AsSystem
Αυτό το περιεχόμενο δεν είναι ακόμη διαθέσιμο στη γλώσσα σου.
AsSystem<
TGrant>(options):DualMethodDecorator
Defined in: packages/pipeline-job-context/src/decorators/as-system.decorator.ts:44
Runs system-started work, such as a cron job, once per configured tenant.
Each run has its own tenant, a new correlation id, and the declared service
principal and grants, bound through the registered IJobPrincipal. Grants
come only from this declaration, never from data.
Tenants run one after another. A failing tenant does not stop the others;
the method then rejects with an AggregateError of the failures. Its return
values are discarded. Place it under the scheduling decorator.
Type Parameters
Section titled “Type Parameters”TGrant
Section titled “TGrant”TGrant
Parameters
Section titled “Parameters”options
Section titled “options”AsSystemOptions<TGrant>
Returns
Section titled “Returns”DualMethodDecorator
Example
Section titled “Example”class Maintenance { @AsSystem({ principal: { id: 'session-cleanup', type: 'service' }, grants: [{ action: 'delete', subject: 'Auth' }], }) async purgeSessions() { await purgeExpiredSessions(); }}
cron.schedule('0 3 * * *', () => maintenance.purgeSessions());