@adonis-agora/durable 0.52.4 → 0.53.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/providers/durable_provider.d.ts.map +1 -1
- package/dist/providers/durable_provider.js +25 -8
- package/dist/providers/durable_provider.js.map +1 -1
- package/dist/src/dashboard/index.d.ts +1 -1
- package/dist/src/dashboard/index.js +1 -1
- package/dist/src/engine.d.ts +9 -1
- package/dist/src/engine.d.ts.map +1 -1
- package/dist/src/engine.js +5 -1
- package/dist/src/engine.js.map +1 -1
- package/dist/src/entities.d.ts +3 -1
- package/dist/src/entities.d.ts.map +1 -1
- package/dist/src/entities.js +4 -1
- package/dist/src/entities.js.map +1 -1
- package/dist/src/event-accumulators.d.ts +3 -1
- package/dist/src/event-accumulators.d.ts.map +1 -1
- package/dist/src/event-accumulators.js +4 -2
- package/dist/src/event-accumulators.js.map +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/interfaces.d.ts +15 -6
- package/dist/src/interfaces.d.ts.map +1 -1
- package/dist/src/interfaces.js.map +1 -1
- package/dist/src/origin.d.ts +35 -0
- package/dist/src/origin.d.ts.map +1 -0
- package/dist/src/origin.js +201 -0
- package/dist/src/origin.js.map +1 -0
- package/dist/src/package-origin.d.ts +7 -0
- package/dist/src/package-origin.d.ts.map +1 -0
- package/dist/src/package-origin.js +7 -0
- package/dist/src/package-origin.js.map +1 -0
- package/dist/src/workflow-discovery.d.ts +23 -2
- package/dist/src/workflow-discovery.d.ts.map +1 -1
- package/dist/src/workflow-discovery.js +85 -15
- package/dist/src/workflow-discovery.js.map +1 -1
- package/dist/src/workflow-events.d.ts.map +1 -1
- package/dist/src/workflow-events.js +13 -2
- package/dist/src/workflow-events.js.map +1 -1
- package/dist/src/workflow-ref.d.ts +6 -1
- package/dist/src/workflow-ref.d.ts.map +1 -1
- package/dist/src/workflow-ref.js +11 -1
- package/dist/src/workflow-ref.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This package's npm name, stamped as `origin` on the built-in workflows the engine registers
|
|
3
|
+
* itself (the entity runner and the `onEvent` debounce/batch accumulators), so the console's ORIGIN
|
|
4
|
+
* facet tells them apart from the app's own runs.
|
|
5
|
+
*/
|
|
6
|
+
export const PACKAGE_ORIGIN = '@adonis-agora/durable';
|
|
7
|
+
//# sourceMappingURL=package-origin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-origin.js","sourceRoot":"","sources":["../../src/package-origin.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,uBAAuB,CAAC"}
|
|
@@ -19,6 +19,13 @@ export interface DiscoveredWorkflow {
|
|
|
19
19
|
cls: DiscoveredWorkflowClass;
|
|
20
20
|
/** The module it was found in: an absolute path for a directory scan, the key for a barrel. */
|
|
21
21
|
file: string;
|
|
22
|
+
/**
|
|
23
|
+
* The package the workflow's runs are attributed to (`WorkflowRun.origin`): the class's explicit
|
|
24
|
+
* `static workflow.origin`, else DERIVED — its decorator-captured declaring file, else this
|
|
25
|
+
* module's file — mapped to the nearest `package.json` `name`. `undefined` when none of those
|
|
26
|
+
* resolves with confidence (see `./origin.ts`).
|
|
27
|
+
*/
|
|
28
|
+
origin?: string;
|
|
22
29
|
}
|
|
23
30
|
/**
|
|
24
31
|
* A factory that instantiates a workflow class. When provided, it replaces the default `new Ctor()` —
|
|
@@ -38,6 +45,11 @@ export type WorkflowClassFactory = (ctor: DiscoveredWorkflowClass) => Discovered
|
|
|
38
45
|
* `factory` lets the host resolve the instance via the IoC container (constructor injection); when
|
|
39
46
|
* omitted, the class is instantiated directly with `new Ctor()` (no args). The factory may be async
|
|
40
47
|
* (the Adonis container's `make` resolves async), so this function is async.
|
|
48
|
+
*
|
|
49
|
+
* Origin: the class's explicit `static workflow.origin` wins; else the package that DECLARED it, when
|
|
50
|
+
* a class decorator (`@Scheduled`, `@OnEvent`, `@OnDiagnostic`) captured its file; else the package
|
|
51
|
+
* whose code is CALLING this function (a lib registering its own workflows → the lib). `undefined`
|
|
52
|
+
* when none resolves. See `./origin.ts`.
|
|
41
53
|
*/
|
|
42
54
|
export declare function registerWorkflowClass(engine: WorkflowEngine, cls: unknown, factory?: WorkflowClassFactory): Promise<boolean>;
|
|
43
55
|
/** Re-exported from its shared home so existing `pickModuleExt` imports keep working. */
|
|
@@ -78,7 +90,16 @@ export type WorkflowsBarrel = BarrelTree;
|
|
|
78
90
|
* and registering each workflow export: the build-time equivalent of {@link registerWorkflowsFromDir},
|
|
79
91
|
* with no runtime `readdir`. Each module is imported once and each class registered once (deduped),
|
|
80
92
|
* so a class re-exported from several modules is safe. Same cross-root duplicate rule as the scan.
|
|
81
|
-
* Returns the registered metadata so the caller can log
|
|
93
|
+
* Returns the registered metadata (with each workflow's resolved `origin`) so the caller can log
|
|
94
|
+
* what was wired.
|
|
95
|
+
*
|
|
96
|
+
* `options.appRoot` is the app root the barrel was generated for (a path or `file:` URL — the durable
|
|
97
|
+
* provider passes `app.appRoot`). It is what derives an origin for the barrel's modules, which carry
|
|
98
|
+
* no absolute file: a multi-root barrel's app-relative file keys are resolved against it, and a
|
|
99
|
+
* single-root barrel's name-only keys resolve to the app root itself (its sources are the app's own
|
|
100
|
+
* directories). Without it, modules are attributed to the package CALLING this function.
|
|
82
101
|
*/
|
|
83
|
-
export declare function registerWorkflowsFromBarrel(engine: WorkflowEngine, barrel: WorkflowsBarrel | readonly RootedBarrel[], factory?: WorkflowClassFactory
|
|
102
|
+
export declare function registerWorkflowsFromBarrel(engine: WorkflowEngine, barrel: WorkflowsBarrel | readonly RootedBarrel[], factory?: WorkflowClassFactory, options?: {
|
|
103
|
+
appRoot?: string | URL;
|
|
104
|
+
}): Promise<WorkflowMeta[]>;
|
|
84
105
|
//# sourceMappingURL=workflow-discovery.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-discovery.d.ts","sourceRoot":"","sources":["../../src/workflow-discovery.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"workflow-discovery.d.ts","sourceRoot":"","sources":["../../src/workflow-discovery.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,UAAU,EAIf,KAAK,YAAY,EAElB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AASlD,OAAO,EAEL,KAAK,YAAY,EAGlB,MAAM,mBAAmB,CAAC;AAE3B;;;;;;;GAOG;AACH,MAAM,MAAM,uBAAuB,GAAG,UAAU;IAC9C,GAAG,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;CAC/D,CAAC;AAEF;2CAC2C;AAC3C,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,YAAY,CAAC;IACnB,GAAG,EAAE,uBAAuB,CAAC;IAC7B,+FAA+F;IAC/F,IAAI,EAAE,MAAM,CAAC;IACb;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;GAMG;AACH,MAAM,MAAM,oBAAoB,GAAG,CACjC,IAAI,EAAE,uBAAuB,KAC1B,uBAAuB,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC,uBAAuB,CAAC,WAAW,CAAC,CAAC,CAAC;AAQ1F;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,cAAc,EACtB,GAAG,EAAE,OAAO,EACZ,OAAO,GAAE,oBAA6C,GACrD,OAAO,CAAC,OAAO,CAAC,CAMlB;AAkFD,yFAAyF;AACzF,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AA6CrD;;;;;;;;;;;;GAYG;AACH,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,GAC9B,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAM/B;AAQD;;;;;GAKG;AACH,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,cAAc,EACtB,GAAG,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,EAC/B,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,YAAY,EAAE,CAAC,CAKzB;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC;AAEzC;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,2BAA2B,CAC/C,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE,eAAe,GAAG,SAAS,YAAY,EAAE,EACjD,OAAO,CAAC,EAAE,oBAAoB,EAC9B,OAAO,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,GACnC,OAAO,CAAC,YAAY,EAAE,CAAC,CAazB"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { isAbsolute, join } from 'node:path';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
1
3
|
import { barrelModules, DuplicateDiscoveryError, scanDirsModules, } from './discovery-roots.js';
|
|
4
|
+
import { declaredOriginOf, ORIGIN_RESOLVED, originOfCaller, originOfDir, originOfFile, } from './origin.js';
|
|
2
5
|
import { eventTriggerCanonicalName, workflowEvents } from './workflow-events.js';
|
|
3
6
|
import { onErrorRoutesOf, workflowMeta, workflowSchedules, } from './workflow-ref.js';
|
|
4
7
|
function defaultWorkflowFactory(ctor) {
|
|
@@ -14,11 +17,35 @@ function defaultWorkflowFactory(ctor) {
|
|
|
14
17
|
* `factory` lets the host resolve the instance via the IoC container (constructor injection); when
|
|
15
18
|
* omitted, the class is instantiated directly with `new Ctor()` (no args). The factory may be async
|
|
16
19
|
* (the Adonis container's `make` resolves async), so this function is async.
|
|
20
|
+
*
|
|
21
|
+
* Origin: the class's explicit `static workflow.origin` wins; else the package that DECLARED it, when
|
|
22
|
+
* a class decorator (`@Scheduled`, `@OnEvent`, `@OnDiagnostic`) captured its file; else the package
|
|
23
|
+
* whose code is CALLING this function (a lib registering its own workflows → the lib). `undefined`
|
|
24
|
+
* when none resolves. See `./origin.ts`.
|
|
17
25
|
*/
|
|
18
26
|
export async function registerWorkflowClass(engine, cls, factory = defaultWorkflowFactory) {
|
|
27
|
+
// Derived synchronously, before the first `await`, so the frame above this call is the CALLER's
|
|
28
|
+
// (a lib registering its own class is attributed to the lib). Only the fallback: an explicit
|
|
29
|
+
// `static workflow.origin` and a decorator-captured declaring file both outrank it.
|
|
30
|
+
const callerOrigin = originOfCaller(registerWorkflowClass);
|
|
31
|
+
return registerClass(engine, cls, factory, callerOrigin);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Resolve a workflow class's origin: explicit `static workflow.origin` > the class's decorator-
|
|
35
|
+
* captured declaring file > `fallback` (the discovered module's file, or the registering caller).
|
|
36
|
+
*/
|
|
37
|
+
function resolveClassOrigin(meta, cls, fallback) {
|
|
38
|
+
return meta.origin || declaredOriginOf(cls) || fallback;
|
|
39
|
+
}
|
|
40
|
+
/** {@link registerWorkflowClass} with the derived-origin fallback already computed by the caller. */
|
|
41
|
+
async function registerClass(engine, cls, factory, derivedOrigin) {
|
|
19
42
|
const meta = workflowMeta(cls);
|
|
20
43
|
if (!meta)
|
|
21
44
|
return false;
|
|
45
|
+
const origin = resolveClassOrigin(meta, cls, derivedOrigin);
|
|
46
|
+
// Passed on EVERY registration (the `.dlq` one included), resolved or not, so the engine never
|
|
47
|
+
// re-derives from its own caller — which would be this file, not the workflow's package.
|
|
48
|
+
const originOpts = { ...(origin ? { origin } : {}), [ORIGIN_RESOLVED]: true };
|
|
22
49
|
const Ctor = cls;
|
|
23
50
|
const instance = await factory(Ctor);
|
|
24
51
|
// Colocated `static on` event triggers: exact-string ones register under the engine's
|
|
@@ -38,7 +65,7 @@ export async function registerWorkflowClass(engine, cls, factory = defaultWorkfl
|
|
|
38
65
|
throw new Error(`workflow ${meta.name} declares both a deadLetter() method and a deadLetterWorkflow option. Use one: the inline handler, or the reference.`);
|
|
39
66
|
}
|
|
40
67
|
const dlqName = `${meta.name}.dlq`;
|
|
41
|
-
engine.register(dlqName, meta.version, (ctx, input) => Promise.resolve(inlineDeadLetter.call(instance, ctx, input)),
|
|
68
|
+
engine.register(dlqName, meta.version, (ctx, input) => Promise.resolve(inlineDeadLetter.call(instance, ctx, input)), originOpts);
|
|
42
69
|
deadLetterWorkflow = dlqName;
|
|
43
70
|
}
|
|
44
71
|
engine.register(meta.name, meta.version, (ctx, input) => Promise.resolve(instance.run(ctx, input)), {
|
|
@@ -50,7 +77,7 @@ export async function registerWorkflowClass(engine, cls, factory = defaultWorkfl
|
|
|
50
77
|
: {}),
|
|
51
78
|
...(meta.singleton ? { singleton: meta.singleton } : {}),
|
|
52
79
|
...(meta.concurrency ? { concurrency: meta.concurrency } : {}),
|
|
53
|
-
...
|
|
80
|
+
...originOpts,
|
|
54
81
|
...(meta.onError?.length ? { onError: onErrorRoutesOf(meta) } : {}),
|
|
55
82
|
...(meta.inputSchema ? { inputSchema: meta.inputSchema } : {}),
|
|
56
83
|
...(meta.searchAttributes ? { searchAttributesSchema: meta.searchAttributes } : {}),
|
|
@@ -75,11 +102,12 @@ export { pickModuleExt } from './discovery-roots.js';
|
|
|
75
102
|
* root nothing changes from the single-directory behaviour (both are kept; the later registration
|
|
76
103
|
* wins on the engine).
|
|
77
104
|
*/
|
|
78
|
-
async function collectWorkflows(modules) {
|
|
105
|
+
async function collectWorkflows(modules, moduleOrigin) {
|
|
79
106
|
const found = [];
|
|
80
107
|
const seen = new Set();
|
|
81
108
|
const owners = new Map();
|
|
82
|
-
for (const
|
|
109
|
+
for (const module of modules) {
|
|
110
|
+
const { root, file, load } = module;
|
|
83
111
|
const mod = await load();
|
|
84
112
|
for (const exported of Object.values(mod)) {
|
|
85
113
|
if (seen.has(exported))
|
|
@@ -95,7 +123,13 @@ async function collectWorkflows(modules) {
|
|
|
95
123
|
if (!owner)
|
|
96
124
|
owners.set(id, { root, file });
|
|
97
125
|
seen.add(exported);
|
|
98
|
-
|
|
126
|
+
const origin = resolveClassOrigin(meta, exported, moduleOrigin(module));
|
|
127
|
+
found.push({
|
|
128
|
+
meta,
|
|
129
|
+
cls: exported,
|
|
130
|
+
file,
|
|
131
|
+
...(origin ? { origin } : {}),
|
|
132
|
+
});
|
|
99
133
|
}
|
|
100
134
|
}
|
|
101
135
|
return found;
|
|
@@ -114,7 +148,14 @@ async function collectWorkflows(modules) {
|
|
|
114
148
|
* roots throws a {@link DuplicateDiscoveryError} naming both files.
|
|
115
149
|
*/
|
|
116
150
|
export async function discoverWorkflows(dir) {
|
|
117
|
-
|
|
151
|
+
// A scanned module's path is a real file of the package that owns it: `app/workflows/x.ts` (or a
|
|
152
|
+
// built `build/app/workflows/x.js`, whose `build/package.json` carries the app's name) → the app.
|
|
153
|
+
return collectWorkflows(await scanDirsModules(typeof dir === 'string' ? [dir] : dir), (module) => originOfFile(module.file));
|
|
154
|
+
}
|
|
155
|
+
/** The registered metadata a discovery entry reports, with its RESOLVED origin. */
|
|
156
|
+
function registeredMeta({ meta, origin }) {
|
|
157
|
+
const { origin: _explicit, ...rest } = meta;
|
|
158
|
+
return origin ? { ...rest, origin } : rest;
|
|
118
159
|
}
|
|
119
160
|
/**
|
|
120
161
|
* Discover every workflow class (`BaseWorkflow` subclass) under `dir` — one directory or several,
|
|
@@ -124,9 +165,9 @@ export async function discoverWorkflows(dir) {
|
|
|
124
165
|
*/
|
|
125
166
|
export async function registerWorkflowsFromDir(engine, dir, factory) {
|
|
126
167
|
const discovered = await discoverWorkflows(dir);
|
|
127
|
-
for (const
|
|
128
|
-
await
|
|
129
|
-
return discovered.map(
|
|
168
|
+
for (const d of discovered)
|
|
169
|
+
await registerClass(engine, d.cls, factory ?? defaultWorkflowFactory, d.origin);
|
|
170
|
+
return discovered.map(registeredMeta);
|
|
130
171
|
}
|
|
131
172
|
/**
|
|
132
173
|
* Register every workflow class reachable from a generated {@link WorkflowsBarrel} (`BaseWorkflow`
|
|
@@ -134,12 +175,41 @@ export async function registerWorkflowsFromDir(engine, dir, factory) {
|
|
|
134
175
|
* and registering each workflow export: the build-time equivalent of {@link registerWorkflowsFromDir},
|
|
135
176
|
* with no runtime `readdir`. Each module is imported once and each class registered once (deduped),
|
|
136
177
|
* so a class re-exported from several modules is safe. Same cross-root duplicate rule as the scan.
|
|
137
|
-
* Returns the registered metadata so the caller can log
|
|
178
|
+
* Returns the registered metadata (with each workflow's resolved `origin`) so the caller can log
|
|
179
|
+
* what was wired.
|
|
180
|
+
*
|
|
181
|
+
* `options.appRoot` is the app root the barrel was generated for (a path or `file:` URL — the durable
|
|
182
|
+
* provider passes `app.appRoot`). It is what derives an origin for the barrel's modules, which carry
|
|
183
|
+
* no absolute file: a multi-root barrel's app-relative file keys are resolved against it, and a
|
|
184
|
+
* single-root barrel's name-only keys resolve to the app root itself (its sources are the app's own
|
|
185
|
+
* directories). Without it, modules are attributed to the package CALLING this function.
|
|
138
186
|
*/
|
|
139
|
-
export async function registerWorkflowsFromBarrel(engine, barrel, factory) {
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
187
|
+
export async function registerWorkflowsFromBarrel(engine, barrel, factory, options) {
|
|
188
|
+
const appRoot = toPath(options?.appRoot);
|
|
189
|
+
const callerOrigin = appRoot === undefined ? originOfCaller(registerWorkflowsFromBarrel) : undefined;
|
|
190
|
+
const discovered = await collectWorkflows(barrelModules(barrel), ({ root, file }) => {
|
|
191
|
+
if (appRoot === undefined)
|
|
192
|
+
return callerOrigin;
|
|
193
|
+
// A single-root barrel (`root: ''`) keys modules by NAME, not path: resolve from the app root.
|
|
194
|
+
if (root === '')
|
|
195
|
+
return originOfDir(appRoot);
|
|
196
|
+
return originOfFile(isAbsolute(file) ? file : join(appRoot, file));
|
|
197
|
+
});
|
|
198
|
+
for (const d of discovered)
|
|
199
|
+
await registerClass(engine, d.cls, factory ?? defaultWorkflowFactory, d.origin);
|
|
200
|
+
return discovered.map(registeredMeta);
|
|
201
|
+
}
|
|
202
|
+
/** A path or `file:` URL (string or `URL`) → a filesystem path; anything unusable → `undefined`. */
|
|
203
|
+
function toPath(value) {
|
|
204
|
+
if (value === undefined)
|
|
205
|
+
return undefined;
|
|
206
|
+
try {
|
|
207
|
+
if (value instanceof URL)
|
|
208
|
+
return fileURLToPath(value);
|
|
209
|
+
return value.startsWith('file:') ? fileURLToPath(value) : value;
|
|
210
|
+
}
|
|
211
|
+
catch {
|
|
212
|
+
return undefined;
|
|
213
|
+
}
|
|
144
214
|
}
|
|
145
215
|
//# sourceMappingURL=workflow-discovery.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-discovery.js","sourceRoot":"","sources":["../../src/workflow-discovery.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,aAAa,EAEb,uBAAuB,EAEvB,eAAe,GAChB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,yBAAyB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACjF,OAAO,EACL,eAAe,EAEf,YAAY,EACZ,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"workflow-discovery.js","sourceRoot":"","sources":["../../src/workflow-discovery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAEL,aAAa,EAEb,uBAAuB,EAEvB,eAAe,GAChB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,WAAW,EACX,YAAY,GACb,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,yBAAyB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACjF,OAAO,EACL,eAAe,EAEf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+B;IAC7C,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC1C,IAAI,CAAC;QACH,IAAI,KAAK,YAAY,GAAG;YAAE,OAAO,aAAa,CAAC,KAAK,CAAC,CAAC;QACtD,OAAO,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IAClE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-events.d.ts","sourceRoot":"","sources":["../../src/workflow-events.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"workflow-events.d.ts","sourceRoot":"","sources":["../../src/workflow-events.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,aAAa,EAAgB,MAAM,mBAAmB,CAAC;AAErE;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,mGAAmG;AACnG,MAAM,WAAW,oBAAoB;IACnC,yEAAyE;IACzE,KAAK,EAAE,MAAM,CAAC;CACf;AAED,6FAA6F;AAC7F,MAAM,WAAW,wBAAwB;IACvC,2DAA2D;IAC3D,GAAG,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACzB;AAED,oFAAoF;AACpF,MAAM,MAAM,oBAAoB,GAC5B,CAAC;IAAE,MAAM,EAAE,SAAS,CAAA;CAAE,GAAG,oBAAoB,CAAC,GAC9C,CAAC;IAAE,MAAM,EAAE,aAAa,CAAA;CAAE,GAAG,wBAAwB,CAAC,CAAC;AAE3D,sFAAsF;AACtF,MAAM,MAAM,sBAAsB,GAC9B,CAAC;IAAE,MAAM,EAAE,SAAS,CAAA;CAAE,GAAG,oBAAoB,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,GACrE,CAAC;IAAE,MAAM,EAAE,aAAa,CAAA;CAAE,GAAG,wBAAwB,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAElF;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,sBAAsB,GAAG,MAAM,GAAG,IAAI,CAIxF;AAED,wFAAwF;AACxF,wBAAgB,cAAc,CAAC,MAAM,EAAE,OAAO,GAAG,sBAAsB,EAAE,CAOxE;AAUD;;;;;;;GAOG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,oBAAoB,GAAG,cAAc,CAOpE;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,wBAAwB,GAAG,cAAc,CAO7E;AAED,kFAAkF;AAClF,MAAM,MAAM,sBAAsB,GAAG,aAAa,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { callerFile, rememberDeclaringFile } from './origin.js';
|
|
1
2
|
import { workflowMeta } from './workflow-ref.js';
|
|
2
3
|
/**
|
|
3
4
|
* The canonical engine event name an EXACT trigger maps to — the name the workflow
|
|
@@ -40,7 +41,12 @@ function stampOn(target, config) {
|
|
|
40
41
|
* ```
|
|
41
42
|
*/
|
|
42
43
|
export function OnEvent(config) {
|
|
43
|
-
|
|
44
|
+
// The declaring module is the caller of this factory: the class's origin (see `./origin.ts`).
|
|
45
|
+
const declaredIn = callerFile(OnEvent);
|
|
46
|
+
return (target) => {
|
|
47
|
+
rememberDeclaringFile(target, declaredIn);
|
|
48
|
+
stampOn(target, { source: 'emitter', ...config });
|
|
49
|
+
};
|
|
44
50
|
}
|
|
45
51
|
/**
|
|
46
52
|
* Listen to an event on the **`@adonis-agora/diagnostics` bus** (`agora:<lib>:<event>`
|
|
@@ -53,6 +59,11 @@ export function OnEvent(config) {
|
|
|
53
59
|
* ```
|
|
54
60
|
*/
|
|
55
61
|
export function OnDiagnostic(config) {
|
|
56
|
-
|
|
62
|
+
// The declaring module is the caller of this factory: the class's origin (see `./origin.ts`).
|
|
63
|
+
const declaredIn = callerFile(OnDiagnostic);
|
|
64
|
+
return (target) => {
|
|
65
|
+
rememberDeclaringFile(target, declaredIn);
|
|
66
|
+
stampOn(target, { source: 'diagnostics', ...config });
|
|
67
|
+
};
|
|
57
68
|
}
|
|
58
69
|
//# sourceMappingURL=workflow-events.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-events.js","sourceRoot":"","sources":["../../src/workflow-events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAkDrE;;;;;;GAMG;AACH,MAAM,UAAU,yBAAyB,CAAC,OAA+B;IACvE,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS;QAAE,OAAO,OAAO,CAAC,KAAK,CAAC;IACvD,IAAI,OAAO,CAAC,KAAK,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IAC7C,OAAO,OAAO,OAAO,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AAC5F,CAAC;AAED,wFAAwF;AACxF,MAAM,UAAU,cAAc,CAAC,MAAe;IAC5C,MAAM,IAAI,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;IAClC,IAAI,CAAC,IAAI;QAAE,OAAO,EAAE,CAAC;IACrB,MAAM,GAAG,GAAI,MAAiE,CAAC,EAAE,CAAC;IAClF,IAAI,CAAC,GAAG;QAAE,OAAO,EAAE,CAAC;IACpB,MAAM,GAAG,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAC7C,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,QAAQ,EAAE,IAAI,CAA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AAO,CAAC,MAA4B;IAClD,8FAA8F;IAC9F,MAAM,UAAU,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IACvC,OAAO,CAAC,MAAM,EAAE,EAAE;QAChB,qBAAqB,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;QAC1C,OAAO,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;IACpD,CAAC,CAAC;AACJ,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,YAAY,CAAC,MAAgC;IAC3D,8FAA8F;IAC9F,MAAM,UAAU,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;IAC5C,OAAO,CAAC,MAAM,EAAE,EAAE;QAChB,qBAAqB,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;QAC1C,OAAO,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;IACxD,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -43,7 +43,12 @@ export interface WorkflowOptions {
|
|
|
43
43
|
/**
|
|
44
44
|
* Package attribution stamped on every run of this workflow (see `WorkflowRun.origin`) — which
|
|
45
45
|
* package's code produced it, e.g. `@adonis-agora/catalog-pipeline`. Powers the console's origin
|
|
46
|
-
* facet
|
|
46
|
+
* facet. Usually OMITTED: the origin is derived from the nearest `package.json` `name` of the
|
|
47
|
+
* class's declaring file (captured by `@Scheduled` / `@OnEvent` / `@OnDiagnostic`), else of the
|
|
48
|
+
* discovered module (`app/workflows/…` → the app), else of the code calling
|
|
49
|
+
* `registerWorkflowClass` (a lib → the lib). Set it only to override that — e.g. an app that
|
|
50
|
+
* hand-registers a lib's undecorated class would otherwise be credited with it. A value here
|
|
51
|
+
* always wins; a workflow nothing can attribute has no origin (shown as `app` in the console).
|
|
47
52
|
*/
|
|
48
53
|
origin?: string;
|
|
49
54
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-ref.d.ts","sourceRoot":"","sources":["../../src/workflow-ref.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"workflow-ref.d.ts","sourceRoot":"","sources":["../../src/workflow-ref.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAE9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAChF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,2GAA2G;AAC3G,MAAM,WAAW,eAAe;IAC9B,+EAA+E;IAC/E,IAAI,EAAE,MAAM,CAAC;IACb,yFAAyF;IACzF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gEAAgE;IAChE,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,kFAAkF;IAClF,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACnC,oFAAoF;IACpF,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAChC;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,GAAG;Y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,EAAE,KAAK,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC;CAC1C,GACG,CAAC,GACD,OAAO,CAAC;AAEZ,gFAAgF;AAChF,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI,CAAC,SAAS,QAAQ,MAClD,GAAG,IAAI,EAAE,KAAK,EAAE,KACb;IACH,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,GAAG,MAAM,CAAC,CAAC;CACxC,GACG,OAAO,CAAC,CAAC,CAAC,GACV,OAAO,CAAC;AAEZ;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,WAAW,GAAG,MAAM,CASrD;AAED,sGAAsG;AACtG,wBAAgB,eAAe,CAAC,IAAI,EAAE,eAAe,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,EAAE,CAK5F;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,OAAO,GAEb;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;CAAE,GACrF,SAAS,CAaZ"}
|
package/dist/src/workflow-ref.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* `ctx.child(ShippingWorkflow, input)` type-checks the input and returns a typed result — while a
|
|
6
6
|
* string stays available for the cross-runtime case.
|
|
7
7
|
*/
|
|
8
|
+
import { callerFile, declaredOriginOf, originOfCaller, rememberDeclaringFile } from './origin.js';
|
|
8
9
|
/**
|
|
9
10
|
* Read a class's {@link WorkflowMeta} — its name/version/tags/… — from its `static workflow =
|
|
10
11
|
* { name, version, … }` config (the {@link BaseWorkflow} authoring form). Any absent `version` is
|
|
@@ -70,7 +71,11 @@ export function workflowSchedules(target) {
|
|
|
70
71
|
* key is part of the deterministic run id, and reordering declarations would silently re-key them.
|
|
71
72
|
*/
|
|
72
73
|
export function Scheduled(config) {
|
|
74
|
+
// Captured in the FACTORY, which runs in the declaring module (the returned decorator may be
|
|
75
|
+
// applied from a `__decorate` helper in another package): the class's origin (see `./origin.ts`).
|
|
76
|
+
const declaredIn = callerFile(Scheduled);
|
|
73
77
|
return (target) => {
|
|
78
|
+
rememberDeclaringFile(target, declaredIn);
|
|
74
79
|
const cls = target;
|
|
75
80
|
const existing = cls.schedule === undefined ? [] : Array.isArray(cls.schedule) ? cls.schedule : [cls.schedule];
|
|
76
81
|
const added = Array.isArray(config) ? config : [config];
|
|
@@ -104,12 +109,17 @@ export function onErrorRoutesOf(meta) {
|
|
|
104
109
|
* carrying no `static workflow` config.
|
|
105
110
|
*/
|
|
106
111
|
export function workflowAnnouncement(target) {
|
|
112
|
+
// Same precedence as registration: explicit `origin` > the class's decorator-captured declaring
|
|
113
|
+
// file > the package calling this (a lib announcing its own workflow). Derived before anything
|
|
114
|
+
// else so the captured frame is the caller's.
|
|
115
|
+
const callerOrigin = originOfCaller(workflowAnnouncement);
|
|
107
116
|
const meta = workflowMeta(target);
|
|
108
117
|
if (!meta)
|
|
109
118
|
return undefined;
|
|
119
|
+
const origin = meta.origin || declaredOriginOf(target) || callerOrigin;
|
|
110
120
|
return {
|
|
111
121
|
version: meta.version,
|
|
112
|
-
...(
|
|
122
|
+
...(origin ? { origin } : {}),
|
|
113
123
|
...(meta.onError?.length ? { onError: onErrorRoutesOf(meta) } : {}),
|
|
114
124
|
};
|
|
115
125
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-ref.js","sourceRoot":"","sources":["../../src/workflow-ref.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"workflow-ref.js","sourceRoot":"","sources":["../../src/workflow-ref.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,EAAE,UA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E,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC;QACvD,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;QACpF,QAAQ,EAAE,YAAY,CAAC,QAAQ,CAAC;KACjC,CAAC,CAAC,CAAC;AACN,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAClC,MAAe;IAIf,gGAAgG;IAChG,+FAA+F;IAC/F,8CAA8C;IAC9C,MAAM,YAAY,GAAG,cAAc,CAAC,oBAAoB,CAAC,CAAC;IAC1D,MAAM,IAAI,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;IAClC,IAAI,CAAC,IAAI;QAAE,OAAO,SAAS,CAAC;IAC5B,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,gBAAgB,CAAC,MAAM,CAAC,IAAI,YAAY,CAAC;IACvE,OAAO;QACL,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7B,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACpE,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adonis-agora/durable",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.53.0",
|
|
4
4
|
"description": "Durable cross-app workflows for AdonisJS — deterministic replay engine, AdonisJS binding, ace commands, dashboard, OpenTelemetry, Telescope, testing harness and Redis admission, all in one package. Part of the Agora ecosystem.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|