Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 3x 3x 1x 6x 6x 6x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 6x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 6x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 6x 6x 1x 1x 1x | import {checkSubject, type PrimitiveDescriptor} from '../engine.ts';
/** `orchestrator` — the business-logic coordinator of a namespace. */
const orchestrator: PrimitiveDescriptor = {
id: 'orchestrator',
title: 'Orchestrator',
skill: 'blong-orchestrator',
summary:
'Business-logic coordinator. Dispatch orchestrators own a namespace; init files declare ' +
'the realm namespace; schedule orchestrators run cron handlers.',
kinds: ['dispatch', 'init', 'schedule'],
defaultKind: 'dispatch',
roots: ['orchestrator'],
check(ctx) {
return checkSubject(ctx.subject);
},
files(ctx) {
const name = ctx.object;
switch (ctx.kind) {
case 'init':
return [
{
path: `orchestrator/${ctx.subject}/init.ts`,
content: `import {handler} from '@feasibleone/blong';
/**
* Declares the '<realm>' namespace handled by this realm's dispatch orchestrator.
* The folder name '${ctx.subject}' stays LITERAL — do NOT replace it.
*/
export default handler(() => ({
namespace: '${ctx.subject}',
}));
`,
},
];
case 'schedule':
return [
{
path: `orchestrator/${name}.ts`,
content: `import {orchestrator} from '@feasibleone/blong';
export default orchestrator(() => ({
extends: 'orchestrator.schedule',
activation: {
default: {
namespace: '${ctx.subject}',
imports: [/\\.${name}$/],
schedule: {${name}Run: '0 2 * * *'},
},
},
}));
`,
},
];
default:
return [
{
path: `orchestrator/${name}.ts`,
content: `import {orchestrator} from '@feasibleone/blong';
export default orchestrator(() => ({
extends: 'orchestrator.dispatch',
activation: {
default: {
namespace: '${ctx.subject}',
imports: [/\\.${name}$/],
logLevel: 'info',
},
},
}));
`,
},
];
}
},
};
export default orchestrator;
|