@bluelibs/runner 3.3.0 → 3.3.1

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.
Files changed (41) hide show
  1. package/dist/define.js +24 -23
  2. package/dist/define.js.map +1 -1
  3. package/dist/defs/core.d.ts +144 -0
  4. package/dist/defs/core.js +6 -0
  5. package/dist/defs/core.js.map +1 -0
  6. package/dist/defs/symbols.d.ts +42 -0
  7. package/dist/defs/symbols.js +45 -0
  8. package/dist/defs/symbols.js.map +1 -0
  9. package/dist/defs/tags.d.ts +70 -0
  10. package/dist/defs/tags.js +6 -0
  11. package/dist/defs/tags.js.map +1 -0
  12. package/dist/defs.d.ts +11 -18
  13. package/dist/defs.js +16 -19
  14. package/dist/defs.js.map +1 -1
  15. package/dist/types/dependencies.d.ts +47 -18
  16. package/dist/types/event.d.ts +49 -0
  17. package/dist/types/event.js +4 -0
  18. package/dist/types/event.js.map +1 -0
  19. package/dist/types/index.d.ts +4 -10
  20. package/dist/types/index.js +8 -7
  21. package/dist/types/index.js.map +1 -1
  22. package/dist/types/metadata.d.ts +75 -0
  23. package/dist/types/metadata.js +3 -0
  24. package/dist/types/metadata.js.map +1 -0
  25. package/dist/types/middleware.d.ts +43 -18
  26. package/dist/types/middleware.js +0 -3
  27. package/dist/types/middleware.js.map +1 -1
  28. package/dist/types/resource.d.ts +96 -0
  29. package/dist/types/resource.js +3 -0
  30. package/dist/types/resource.js.map +1 -0
  31. package/dist/types/symbols.d.ts +17 -0
  32. package/dist/types/symbols.js +18 -3
  33. package/dist/types/symbols.js.map +1 -1
  34. package/dist/types/task.d.ts +68 -0
  35. package/dist/types/task.js +3 -0
  36. package/dist/types/task.js.map +1 -0
  37. package/package.json +1 -1
  38. package/src/__tests__/models/EventManager.test.ts +39 -6
  39. package/src/__tests__/tools/getCallerFile.test.ts +9 -11
  40. package/src/define.ts +31 -24
  41. package/src/defs.ts +11 -19
package/dist/define.js CHANGED
@@ -34,8 +34,8 @@ function defineTask(taskConfig) {
34
34
  const isAnonymous = !Boolean(taskConfig.id);
35
35
  const id = taskConfig.id || (0, getCallerFile_1.generateCallerIdFromFile)(filePath, "task");
36
36
  return {
37
- [defs_1.symbols.task]: true,
38
- [defs_1.symbols.filePath]: filePath,
37
+ [defs_1.symbolTask]: true,
38
+ [defs_1.symbolFilePath]: filePath,
39
39
  id,
40
40
  dependencies: taskConfig.dependencies || {},
41
41
  middleware: taskConfig.middleware || [],
@@ -49,7 +49,7 @@ function defineTask(taskConfig) {
49
49
  ? Symbol(`anonymous-task.events.beforeRun`)
50
50
  : `${id}.events.beforeRun`,
51
51
  }),
52
- [defs_1.symbols.filePath]: (0, getCallerFile_1.getCallerFile)(),
52
+ [defs_1.symbolFilePath]: (0, getCallerFile_1.getCallerFile)(),
53
53
  },
54
54
  afterRun: {
55
55
  ...defineEvent({
@@ -57,7 +57,7 @@ function defineTask(taskConfig) {
57
57
  ? Symbol(`anonymous-task.events.afterRun`)
58
58
  : `${id}.events.afterRun`,
59
59
  }),
60
- [defs_1.symbols.filePath]: (0, getCallerFile_1.getCallerFile)(),
60
+ [defs_1.symbolFilePath]: (0, getCallerFile_1.getCallerFile)(),
61
61
  },
62
62
  onError: {
63
63
  ...defineEvent({
@@ -65,7 +65,7 @@ function defineTask(taskConfig) {
65
65
  ? Symbol(`anonymous-task.events.onError`)
66
66
  : `${id}.events.onError`,
67
67
  }),
68
- [defs_1.symbols.filePath]: (0, getCallerFile_1.getCallerFile)(),
68
+ [defs_1.symbolFilePath]: (0, getCallerFile_1.getCallerFile)(),
69
69
  },
70
70
  },
71
71
  meta: taskConfig.meta || {},
@@ -86,8 +86,9 @@ function defineResource(constConfig) {
86
86
  const id = constConfig.id ||
87
87
  (0, getCallerFile_1.generateCallerIdFromFile)(filePath, isIndexResource ? "index" : "resource");
88
88
  return {
89
- [defs_1.symbols.resource]: true,
90
- [defs_1.symbols.filePath]: filePath,
89
+ [defs_1.symbolResource]: true,
90
+ [defs_1.symbolFilePath]: filePath,
91
+ [defs_1.symbolIndexResource]: isIndexResource,
91
92
  id,
92
93
  dependencies: constConfig.dependencies,
93
94
  dispose: constConfig.dispose,
@@ -97,7 +98,7 @@ function defineResource(constConfig) {
97
98
  context: constConfig.context,
98
99
  with: function (config) {
99
100
  return {
100
- [defs_1.symbols.resourceWithConfig]: true,
101
+ [defs_1.symbolResourceWithConfig]: true,
101
102
  id: this.id,
102
103
  resource: this,
103
104
  config,
@@ -110,7 +111,7 @@ function defineResource(constConfig) {
110
111
  ? Symbol(`anonymous-resource.events.beforeInit`)
111
112
  : `${id}.events.beforeInit`,
112
113
  }),
113
- [defs_1.symbols.filePath]: filePath,
114
+ [defs_1.symbolFilePath]: filePath,
114
115
  },
115
116
  afterInit: {
116
117
  ...defineEvent({
@@ -118,7 +119,7 @@ function defineResource(constConfig) {
118
119
  ? Symbol(`anonymous-resource.events.afterInit`)
119
120
  : `${id}.events.afterInit`,
120
121
  }),
121
- [defs_1.symbols.filePath]: filePath,
122
+ [defs_1.symbolFilePath]: filePath,
122
123
  },
123
124
  onError: {
124
125
  ...defineEvent({
@@ -126,7 +127,7 @@ function defineResource(constConfig) {
126
127
  ? Symbol(`anonymous-resource.events.onError`)
127
128
  : `${id}.events.onError`,
128
129
  }),
129
- [defs_1.symbols.filePath]: filePath,
130
+ [defs_1.symbolFilePath]: filePath,
130
131
  },
131
132
  },
132
133
  meta: constConfig.meta || {},
@@ -160,8 +161,8 @@ function defineIndex(items) {
160
161
  async init(_, deps) {
161
162
  return deps;
162
163
  },
163
- [defs_1.symbols.filePath]: callerFilePath,
164
- [defs_1.symbols.indexResource]: true,
164
+ [defs_1.symbolFilePath]: callerFilePath,
165
+ [defs_1.symbolIndexResource]: true,
165
166
  });
166
167
  }
167
168
  function defineEvent(config) {
@@ -174,7 +175,7 @@ function defineEvent(config) {
174
175
  return {
175
176
  ...eventConfig,
176
177
  id: eventConfig.id || (0, getCallerFile_1.generateCallerIdFromFile)(callerFilePath, "event"),
177
- [defs_1.symbols.filePath]: callerFilePath,
178
+ [defs_1.symbolFilePath]: callerFilePath,
178
179
  [defs_1.symbolEvent]: true, // This is a workaround
179
180
  };
180
181
  }
@@ -187,8 +188,8 @@ function defineMiddleware(middlewareDef) {
187
188
  */
188
189
  const filePath = (0, getCallerFile_1.getCallerFile)();
189
190
  const object = {
190
- [defs_1.symbols.filePath]: filePath,
191
- [defs_1.symbols.middleware]: true,
191
+ [defs_1.symbolFilePath]: filePath,
192
+ [defs_1.symbolMiddleware]: true,
192
193
  config: {},
193
194
  id: middlewareDef.id || (0, getCallerFile_1.generateCallerIdFromFile)(filePath, "middleware"),
194
195
  ...middlewareDef,
@@ -210,8 +211,8 @@ function defineMiddleware(middlewareDef) {
210
211
  const { tasks = true, resources = true } = options;
211
212
  return {
212
213
  ...object,
213
- [defs_1.symbols.middlewareEverywhereTasks]: tasks,
214
- [defs_1.symbols.middlewareEverywhereResources]: resources,
214
+ [defs_1.symbolMiddlewareEverywhereTasks]: tasks,
215
+ [defs_1.symbolMiddlewareEverywhereResources]: resources,
215
216
  everywhere() {
216
217
  throw errors_1.Errors.middlewareAlreadyGlobal(object.id);
217
218
  },
@@ -220,19 +221,19 @@ function defineMiddleware(middlewareDef) {
220
221
  };
221
222
  }
222
223
  function isTask(definition) {
223
- return definition && definition[defs_1.symbols.task];
224
+ return definition && definition[defs_1.symbolTask];
224
225
  }
225
226
  function isResource(definition) {
226
- return definition && definition[defs_1.symbols.resource];
227
+ return definition && definition[defs_1.symbolResource];
227
228
  }
228
229
  function isResourceWithConfig(definition) {
229
- return definition && definition[defs_1.symbols.resourceWithConfig];
230
+ return definition && definition[defs_1.symbolResourceWithConfig];
230
231
  }
231
232
  function isEvent(definition) {
232
- return definition && definition[defs_1.symbols.event];
233
+ return definition && definition[defs_1.symbolEvent];
233
234
  }
234
235
  function isMiddleware(definition) {
235
- return definition && definition[defs_1.symbols.middleware];
236
+ return definition && definition[defs_1.symbolMiddleware];
236
237
  }
237
238
  function defineOverride(base, patch) {
238
239
  const { id: _ignored, ...rest } = (patch || {});
@@ -1 +1 @@
1
- {"version":3,"file":"define.js","sourceRoot":"","sources":["../src/define.ts"],"names":[],"mappings":";;AAoCA,gCAuDC;AAED,wCAqEC;AAQD,kCAiCC;AAED,kCAeC;AAaD,4CA+CC;AAED,wBAEC;AAED,gCAEC;AAED,oDAIC;AAED,0BAEC;AAED,oCAEC;AAkBD,wCAWC;AAOD,8BA0BC;AA5WD;;;;;;GAMG;AACH,iCAuBgB;AAChB,qCAAkC;AAClC,yDAAgF;AAEhF,yCAAyC;AAEzC,SAAgB,UAAU,CAMxB,UAAqD;IAErD;;;;;OAKG;IACH,MAAM,QAAQ,GAAG,IAAA,6BAAa,GAAE,CAAC;IACjC,MAAM,WAAW,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;IAC5C,MAAM,EAAE,GAAG,UAAU,CAAC,EAAE,IAAI,IAAA,wCAAwB,EAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IACvE,OAAO;QACL,CAAC,cAAO,CAAC,IAAI,CAAC,EAAE,IAAI;QACpB,CAAC,cAAO,CAAC,QAAQ,CAAC,EAAE,QAAQ;QAC5B,EAAE;QACF,YAAY,EAAE,UAAU,CAAC,YAAY,IAAK,EAAW;QACrD,UAAU,EAAE,UAAU,CAAC,UAAU,IAAI,EAAE;QACvC,GAAG,EAAE,UAAU,CAAC,GAAG;QACnB,EAAE,EAAE,UAAU,CAAC,EAAE;QACjB,aAAa,EAAE,UAAU,CAAC,aAAa;QACvC,MAAM,EAAE;YACN,SAAS,EAAE;gBACT,GAAG,WAAW,CAAC;oBACb,EAAE,EAAE,WAAW;wBACb,CAAC,CAAC,MAAM,CAAC,iCAAiC,CAAC;wBAC3C,CAAC,CAAC,GAAG,EAAY,mBAAmB;iBACvC,CAAC;gBACF,CAAC,cAAO,CAAC,QAAQ,CAAC,EAAE,IAAA,6BAAa,GAAE;aACpC;YACD,QAAQ,EAAE;gBACR,GAAG,WAAW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GAAG,CAAC,KAAK,IAAI,EAAE,CAAQ,CAAC;IACvD,0DAA0D;IAC1D,OAAO;QACL,GAAI,IAAY;QAChB,GAAG,IAAI;QACP,EAAE,EAAG,IAAY,CAAC,EAAE;KACd,CAAC;AACX,CAAC;AAED;;;;GAIG;AACH,SAAgB,SAAS,CACvB,UAAmC;IAEnC,MAAM,EAAE,GAAG,UAAU,CAAC,EAAE,CAAC;IAEzB,OAAO;QACL,EAAE;QACF,IAAI,CAAC,SAAkB;YACrB,OAAO;gBACL,EAAE;gBACF,GAAG,EAAE,IAAI;gBACT,MAAM,EAAE,SAAgB;aACE,CAAC;QAC/B,CAAC;QACD,OAAO,CAAC,MAA6B;YACnC,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC;YACvE,KAAK,MAAM,SAAS,IAAI,IAAI,EAAE,CAAC;gBAC7B,IAAI,OAAO,SAAS,KAAK,QAAQ;oBAAE,SAAS;gBAC5C,sBAAsB;gBACtB,IAAI,SAAS,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC;oBACxB,OAAO,SAAoC,CAAC;gBAC9C,CAAC;YACH,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;KACe,CAAC;AACrB,CAAC"}
@@ -0,0 +1,144 @@
1
+ import { IEventMeta, IMiddlewareMeta, IResourceMeta, ITaskMeta } from "./tags";
2
+ import { symbolEvent, symbolMiddleware, symbolMiddlewareConfigured, symbolMiddlewareEverywhereResources, symbolMiddlewareEverywhereTasks } from "./symbols";
3
+ export interface ITask<TInput = any, TOutput extends Promise<any> = any, TDependencies extends DependencyMapType = {}, TOn extends "*" | IEventDefinition<any> | undefined = undefined> extends ITaskDefinition<TInput, TOutput, TDependencies, TOn> {
4
+ id: string | symbol;
5
+ dependencies: TDependencies | (() => TDependencies);
6
+ computedDependencies?: DependencyValuesType<TDependencies>;
7
+ middleware: MiddlewareAttachments[];
8
+ events: {
9
+ beforeRun: IEvent<BeforeRunEventPayload<TInput>>;
10
+ afterRun: IEvent<AfterRunEventPayload<TInput, TOutput>>;
11
+ onError: IEvent<OnErrorEventPayload>;
12
+ };
13
+ }
14
+ export type DependencyMapType = Record<string, ITask<any, any, any, any> | IResource<any, any, any> | IEventDefinition<any>>;
15
+ type ExtractTaskInput<T> = T extends ITask<infer I, any, any, any> ? I : never;
16
+ type ExtractTaskOutput<T> = T extends ITask<any, infer O, any, any> ? O : never;
17
+ type ExtractResourceValue<T> = T extends IResource<any, infer V, any> ? V : never;
18
+ type ExtractEventParams<T> = T extends IEvent<infer P> ? P : never;
19
+ type TaskDependency<I, O> = (...args: I extends null | void ? [] : [I]) => O;
20
+ type ResourceDependency<V> = V;
21
+ type EventDependency<P> = P extends void ? (() => Promise<void>) & ((input?: Record<string, never>) => Promise<void>) : (input: P) => Promise<void>;
22
+ export type DependencyValueType<T> = T extends ITask<any, any, any, any> ? TaskDependency<ExtractTaskInput<T>, ExtractTaskOutput<T>> : T extends IResource<any, any, any> ? ResourceDependency<ExtractResourceValue<T>> : T extends IEventDefinition<any> ? EventDependency<ExtractEventParams<T>> : never;
23
+ export type DependencyValuesType<T extends DependencyMapType> = {
24
+ [K in keyof T]: DependencyValueType<T[K]>;
25
+ };
26
+ export type RegisterableItems<T = any> = IResourceWithConfig<any> | IResource<void, any, any, any> | IResource<{
27
+ [K in any]?: any;
28
+ }, any, any, any> | ITask<any, any, any, any> | IMiddleware<any> | IEvent<any>;
29
+ export type MiddlewareAttachments = IMiddleware<void> | IMiddleware<{
30
+ [K in any]?: any;
31
+ }> | IMiddlewareConfigured<any>;
32
+ export interface ITaskDefinition<TInput = any, TOutput extends Promise<any> = any, TDependencies extends DependencyMapType = {}, TOn extends "*" | IEventDefinition<any> | undefined = undefined> {
33
+ id?: string | symbol;
34
+ dependencies?: TDependencies | (() => TDependencies);
35
+ middleware?: MiddlewareAttachments[];
36
+ on?: TOn;
37
+ listenerOrder?: number;
38
+ meta?: ITaskMeta;
39
+ run: (input: TOn extends undefined ? TInput : IEventEmission<TOn extends "*" ? any : ExtractEventParams<TOn>>, dependencies: DependencyValuesType<TDependencies>) => TOutput;
40
+ }
41
+ export type BeforeRunEventPayload<TInput> = {
42
+ input: TInput;
43
+ };
44
+ export type AfterRunEventPayload<TInput, TOutput> = {
45
+ input: TInput;
46
+ output: TOutput extends Promise<infer U> ? U : TOutput;
47
+ setOutput(newOutput: TOutput extends Promise<infer U> ? U : TOutput): void;
48
+ };
49
+ export type OnErrorEventPayload = {
50
+ error: any;
51
+ suppress(): void;
52
+ };
53
+ export type BeforeInitEventPayload<TConfig> = {
54
+ config: TConfig;
55
+ };
56
+ export type AfterInitEventPayload<TConfig, TValue> = {
57
+ config: TConfig;
58
+ value: TValue;
59
+ };
60
+ export interface IResourceDefinition<TConfig = any, TValue = unknown, TDependencies extends DependencyMapType = {}, TContext = any> {
61
+ id?: string | symbol;
62
+ dependencies?: TDependencies | ((config: TConfig) => TDependencies);
63
+ register?: Array<RegisterableItems> | ((config: TConfig) => Array<RegisterableItems>);
64
+ init?: (this: any, config: TConfig, dependencies: DependencyValuesType<TDependencies>, context: TContext) => Promise<TValue>;
65
+ dispose?: (this: any, value: TValue, config: TConfig, dependencies: DependencyValuesType<TDependencies>, context: TContext) => Promise<void>;
66
+ meta?: IResourceMeta;
67
+ overrides?: Array<IResource | ITask | IMiddleware | IResourceWithConfig>;
68
+ middleware?: MiddlewareAttachments[];
69
+ context?: () => TContext;
70
+ [symbolFilePath]?: string;
71
+ [symbolIndexResource]?: boolean;
72
+ }
73
+ import { symbolFilePath, symbolIndexResource } from "./symbols";
74
+ export interface IResource<TConfig = void, TValue = any, TDependencies extends DependencyMapType = any, TContext = any> extends IResourceDefinition<TConfig, TValue, TDependencies, TContext> {
75
+ id: string | symbol;
76
+ with(config: TConfig): IResourceWithConfig<TConfig, TValue, TDependencies>;
77
+ register: Array<RegisterableItems> | ((config: TConfig) => Array<RegisterableItems>);
78
+ events: {
79
+ beforeInit: IEvent<BeforeInitEventPayload<TConfig>>;
80
+ afterInit: IEvent<AfterInitEventPayload<TConfig, TValue>>;
81
+ onError: IEvent<OnErrorEventPayload>;
82
+ };
83
+ overrides: Array<IResource | ITask | IMiddleware | IResourceWithConfig>;
84
+ middleware: MiddlewareAttachments[];
85
+ }
86
+ export interface IResourceWithConfig<TConfig = any, TValue = any, TDependencies extends DependencyMapType = any> {
87
+ id: string;
88
+ resource: IResource<TConfig, TValue, TDependencies>;
89
+ config: TConfig;
90
+ }
91
+ export type EventHandlerType<T = any> = (event: IEventEmission<T>) => any | Promise<any>;
92
+ export interface IEventDefinition<TPayload = void> {
93
+ id?: string | symbol;
94
+ meta?: IEventMeta;
95
+ }
96
+ export interface IEvent<TPayload = any> extends IEventDefinition<TPayload> {
97
+ id: string | symbol;
98
+ [symbolEvent]: true;
99
+ }
100
+ export interface IMiddlewareDefinition<TConfig = any, TDependencies extends DependencyMapType = any> {
101
+ id?: string | symbol;
102
+ dependencies?: TDependencies | ((config: TConfig) => TDependencies);
103
+ run: (input: IMiddlewareExecutionInput, dependencies: DependencyValuesType<TDependencies>, config: TConfig) => Promise<any>;
104
+ meta?: IMiddlewareMeta;
105
+ }
106
+ export interface IMiddleware<TConfig = any, TDependencies extends DependencyMapType = any> extends IMiddlewareDefinition<TConfig, TDependencies> {
107
+ [symbolMiddleware]: true;
108
+ [symbolMiddlewareConfigured]?: boolean;
109
+ [symbolMiddlewareEverywhereTasks]?: boolean;
110
+ [symbolMiddlewareEverywhereResources]?: boolean;
111
+ id: string | symbol;
112
+ dependencies: TDependencies | (() => TDependencies);
113
+ everywhere(config?: import("../define").MiddlewareEverywhereOptions): IMiddleware<TConfig, TDependencies>;
114
+ config: TConfig;
115
+ with: (config: TConfig) => IMiddlewareConfigured<TConfig, TDependencies>;
116
+ }
117
+ export interface IMiddlewareConfigured<TConfig = any, TDependencies extends DependencyMapType = any> extends IMiddleware<TConfig, TDependencies> {
118
+ [symbolMiddlewareConfigured]: true;
119
+ }
120
+ export interface IMiddlewareDefinitionConfigured<C extends Record<string, any> = {}> {
121
+ middleware: IMiddleware<C>;
122
+ config?: C;
123
+ }
124
+ export interface IMiddlewareExecutionInput<TTaskInput = any, TResourceConfig = any> {
125
+ task?: {
126
+ definition: ITask<TTaskInput>;
127
+ input: TTaskInput;
128
+ };
129
+ resource?: {
130
+ definition: IResource<TResourceConfig>;
131
+ config: TResourceConfig;
132
+ };
133
+ next: (taskInputOrResourceConfig?: TTaskInput | TResourceConfig) => Promise<any>;
134
+ }
135
+ export interface IEventEmission<TPayload = any> {
136
+ id: string | symbol;
137
+ data: TPayload;
138
+ timestamp: Date;
139
+ source: string | symbol;
140
+ meta: IEventMeta;
141
+ stopPropagation(): void;
142
+ isPropagationStopped(): boolean;
143
+ }
144
+ export {};
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const symbols_1 = require("./symbols");
4
+ // symbol imports referenced above
5
+ const symbols_2 = require("./symbols");
6
+ //# sourceMappingURL=core.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core.js","sourceRoot":"","sources":["../../src/defs/core.ts"],"names":[],"mappings":";;AACA,uCASmB;AAyInB,kCAAkC;AAClC,uCAAgE"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Internal brand symbols used to tag created objects at runtime and help with
3
+ * type‑narrowing. Prefer the `isTask`/`isResource`/`isEvent`/`isMiddleware`
4
+ * helpers instead of touching these directly.
5
+ * @internal
6
+ */
7
+ export declare const symbolTask: unique symbol;
8
+ export declare const symbolResource: unique symbol;
9
+ export declare const symbolResourceWithConfig: unique symbol;
10
+ export declare const symbolEvent: unique symbol;
11
+ export declare const symbolMiddleware: unique symbol;
12
+ export declare const symbolMiddlewareConfigured: unique symbol;
13
+ export declare const symbolMiddlewareGlobal: unique symbol;
14
+ export declare const symbolMiddlewareEverywhereTasks: unique symbol;
15
+ export declare const symbolMiddlewareEverywhereResources: unique symbol;
16
+ /** @internal Path to aid anonymous id generation and error messages */
17
+ export declare const symbolFilePath: unique symbol;
18
+ /** @internal Marks disposable instances */
19
+ export declare const symbolDispose: unique symbol;
20
+ /** @internal Link to internal Store */
21
+ export declare const symbolStore: unique symbol;
22
+ /** @internal Brand used by index() resources */
23
+ export declare const symbolIndexResource: unique symbol;
24
+ /**
25
+ * Convenience bag of internal symbols. Intended for framework internals;
26
+ * consumers should not rely on this shape.
27
+ * @internal
28
+ */
29
+ export declare const symbols: {
30
+ task: symbol;
31
+ resource: symbol;
32
+ resourceWithConfig: symbol;
33
+ indexResource: symbol;
34
+ event: symbol;
35
+ middleware: symbol;
36
+ middlewareEverywhereTasks: symbol;
37
+ middlewareEverywhereResources: symbol;
38
+ filePath: symbol;
39
+ dispose: symbol;
40
+ store: symbol;
41
+ };
42
+ export type SymbolsBag = typeof symbols;
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.symbols = exports.symbolIndexResource = exports.symbolStore = exports.symbolDispose = exports.symbolFilePath = exports.symbolMiddlewareEverywhereResources = exports.symbolMiddlewareEverywhereTasks = exports.symbolMiddlewareGlobal = exports.symbolMiddlewareConfigured = exports.symbolMiddleware = exports.symbolEvent = exports.symbolResourceWithConfig = exports.symbolResource = exports.symbolTask = void 0;
4
+ /**
5
+ * Internal brand symbols used to tag created objects at runtime and help with
6
+ * type‑narrowing. Prefer the `isTask`/`isResource`/`isEvent`/`isMiddleware`
7
+ * helpers instead of touching these directly.
8
+ * @internal
9
+ */
10
+ exports.symbolTask = Symbol("runner.task");
11
+ exports.symbolResource = Symbol("runner.resource");
12
+ exports.symbolResourceWithConfig = Symbol("runner.resourceWithConfig");
13
+ exports.symbolEvent = Symbol("runner.event");
14
+ exports.symbolMiddleware = Symbol("runner.middleware");
15
+ exports.symbolMiddlewareConfigured = Symbol("runner.middlewareConfigured");
16
+ exports.symbolMiddlewareGlobal = Symbol("runner.middlewareGlobal");
17
+ exports.symbolMiddlewareEverywhereTasks = Symbol("runner.middlewareGlobalTasks");
18
+ exports.symbolMiddlewareEverywhereResources = Symbol("runner.middlewareGlobalResources");
19
+ /** @internal Path to aid anonymous id generation and error messages */
20
+ exports.symbolFilePath = Symbol("runner.filePath");
21
+ /** @internal Marks disposable instances */
22
+ exports.symbolDispose = Symbol("runner.dispose");
23
+ /** @internal Link to internal Store */
24
+ exports.symbolStore = Symbol("runner.store");
25
+ /** @internal Brand used by index() resources */
26
+ exports.symbolIndexResource = Symbol("runner.indexResource");
27
+ /**
28
+ * Convenience bag of internal symbols. Intended for framework internals;
29
+ * consumers should not rely on this shape.
30
+ * @internal
31
+ */
32
+ exports.symbols = {
33
+ task: exports.symbolTask,
34
+ resource: exports.symbolResource,
35
+ resourceWithConfig: exports.symbolResourceWithConfig,
36
+ indexResource: exports.symbolIndexResource,
37
+ event: exports.symbolEvent,
38
+ middleware: exports.symbolMiddleware,
39
+ middlewareEverywhereTasks: exports.symbolMiddlewareEverywhereTasks,
40
+ middlewareEverywhereResources: exports.symbolMiddlewareEverywhereResources,
41
+ filePath: exports.symbolFilePath,
42
+ dispose: exports.symbolDispose,
43
+ store: exports.symbolStore,
44
+ };
45
+ //# sourceMappingURL=symbols.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"symbols.js","sourceRoot":"","sources":["../../src/defs/symbols.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACU,QAAA,UAAU,GAAkB,MAAM,CAAC,aAAa,CAAC,CAAC;AAClD,QAAA,cAAc,GAAkB,MAAM,CAAC,iBAAiB,CAAC,CAAC;AAC1D,QAAA,wBAAwB,GAAkB,MAAM,CAC3D,2BAA2B,CAC5B,CAAC;AACW,QAAA,WAAW,GAAkB,MAAM,CAAC,cAAc,CAAC,CAAC;AACpD,QAAA,gBAAgB,GAAkB,MAAM,CAAC,mBAAmB,CAAC,CAAC;AAC9D,QAAA,0BAA0B,GAAkB,MAAM,CAC7D,6BAA6B,CAC9B,CAAC;AACW,QAAA,sBAAsB,GAAkB,MAAM,CACzD,yBAAyB,CAC1B,CAAC;AACW,QAAA,+BAA+B,GAAkB,MAAM,CAClE,8BAA8B,CAC/B,CAAC;AACW,QAAA,mCAAmC,GAAkB,MAAM,CACtE,kCAAkC,CACnC,CAAC;AAEF,uEAAuE;AAC1D,QAAA,cAAc,GAAkB,MAAM,CAAC,iBAAiB,CAAC,CAAC;AACvE,2CAA2C;AAC9B,QAAA,aAAa,GAAkB,MAAM,CAAC,gBAAgB,CAAC,CAAC;AACrE,uCAAuC;AAC1B,QAAA,WAAW,GAAkB,MAAM,CAAC,cAAc,CAAC,CAAC;AAEjE,gDAAgD;AACnC,QAAA,mBAAmB,GAAkB,MAAM,CACtD,sBAAsB,CACvB,CAAC;AAEF;;;;GAIG;AACU,QAAA,OAAO,GAAG;IACrB,IAAI,EAAE,kBAAU;IAChB,QAAQ,EAAE,sBAAc;IACxB,kBAAkB,EAAE,gCAAwB;IAC5C,aAAa,EAAE,2BAAmB;IAClC,KAAK,EAAE,mBAAW;IAClB,UAAU,EAAE,wBAAgB;IAC5B,yBAAyB,EAAE,uCAA+B;IAC1D,6BAA6B,EAAE,2CAAmC;IAClE,QAAQ,EAAE,sBAAc;IACxB,OAAO,EAAE,qBAAa;IACtB,KAAK,EAAE,mBAAW;CACnB,CAAC"}
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Tag system and metadata types.
3
+ */
4
+ export interface ITagDefinition<TConfig = void> {
5
+ id: string | symbol;
6
+ }
7
+ /**
8
+ * A configured instance of a tag as produced by `ITag.with()`.
9
+ */
10
+ export interface ITagWithConfig<TConfig = void> {
11
+ id: string | symbol;
12
+ /** The tag definition used to produce this configured instance. */
13
+ tag: ITag<TConfig>;
14
+ /** The configuration captured for this tag instance. */
15
+ config: TConfig;
16
+ }
17
+ /**
18
+ * A tag definition (builder). Use `.with(config)` to obtain configured instances,
19
+ * and `.extract(tags)` to find either a configured instance or the bare tag in a list.
20
+ */
21
+ export interface ITag<TConfig = void> extends ITagDefinition<TConfig> {
22
+ /** Creates a configured instance of the tag. */
23
+ with(config: TConfig): ITagWithConfig<TConfig>;
24
+ /**
25
+ * Extracts either a configured instance or the bare tag from a list of tags
26
+ * or from a taggable object (`{ meta: { tags?: [] } }`).
27
+ */
28
+ extract(target: TagType[] | ITaggable): ExtractedTagResult<TConfig> | null;
29
+ }
30
+ /**
31
+ * Restrict bare tags to those whose config can be omitted (void or optional object),
32
+ * mirroring the same principle used for resources in `RegisterableItems`.
33
+ * Required-config tags must appear as configured instances.
34
+ */
35
+ export type TagType = string | ITag<void> | ITag<{
36
+ [K in any]?: any;
37
+ }> | ITagWithConfig<any>;
38
+ /**
39
+ * Conditional result type for `ITag.extract`:
40
+ * - For void config → just the identifier
41
+ * - For optional object config → identifier with optional config
42
+ * - For required config → identifier with required config
43
+ */
44
+ export type ExtractedTagResult<TConfig> = {} extends TConfig ? {
45
+ id: string | symbol;
46
+ config?: TConfig;
47
+ } : {
48
+ id: string | symbol;
49
+ config: TConfig;
50
+ };
51
+ /** Any object that can carry tags via metadata. */
52
+ export interface ITaggable {
53
+ meta?: {
54
+ tags?: TagType[];
55
+ };
56
+ }
57
+ /** Common metadata you can attach to tasks/resources/events/middleware. */
58
+ export interface IMeta {
59
+ title?: string;
60
+ description?: string;
61
+ tags?: TagType[];
62
+ }
63
+ export interface ITaskMeta extends IMeta {
64
+ }
65
+ export interface IResourceMeta extends IMeta {
66
+ }
67
+ export interface IEventMeta extends IMeta {
68
+ }
69
+ export interface IMiddlewareMeta extends IMeta {
70
+ }
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ /**
3
+ * Tag system and metadata types.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ //# sourceMappingURL=tags.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tags.js","sourceRoot":"","sources":["../../src/defs/tags.ts"],"names":[],"mappings":";AAAA;;GAEG"}
package/dist/defs.d.ts CHANGED
@@ -15,6 +15,7 @@
15
15
  */
16
16
  import { MiddlewareEverywhereOptions } from "./define";
17
17
  export { ICacheInstance } from "./globals/middleware/cache.middleware";
18
+ export * from "./models/StoreTypes";
18
19
  /**
19
20
  * Internal brand symbols used to tag created objects at runtime and help with
20
21
  * type‑narrowing. Prefer the `isTask`/`isResource`/`isEvent`/`isMiddleware`
@@ -38,24 +39,6 @@ export declare const symbolDispose: unique symbol;
38
39
  export declare const symbolStore: unique symbol;
39
40
  /** @internal Brand used by index() resources */
40
41
  export declare const symbolIndexResource: unique symbol;
41
- /**
42
- * Convenience bag of internal symbols. Intended for framework internals;
43
- * consumers should not rely on this shape.
44
- * @internal
45
- */
46
- export declare const symbols: {
47
- task: symbol;
48
- resource: symbol;
49
- resourceWithConfig: symbol;
50
- indexResource: symbol;
51
- event: symbol;
52
- middleware: symbol;
53
- middlewareEverywhereTasks: symbol;
54
- middlewareEverywhereResources: symbol;
55
- filePath: symbol;
56
- dispose: symbol;
57
- store: symbol;
58
- };
59
42
  export interface ITagDefinition<TConfig = void> {
60
43
  id: string | symbol;
61
44
  }
@@ -83,6 +66,7 @@ export interface ITag<TConfig = void> extends ITagDefinition<TConfig> {
83
66
  * or from a taggable object (`{ meta: { tags?: [] } }`).
84
67
  */
85
68
  extract(target: TagType[] | ITaggable): ExtractedTagResult<TConfig> | null;
69
+ [symbolFilePath]: string;
86
70
  }
87
71
  /**
88
72
  * Restrict bare tags to those whose config can be omitted (void or optional object),
@@ -246,6 +230,8 @@ export interface ITask<TInput = any, TOutput extends Promise<any> = any, TDepend
246
230
  afterRun: IEvent<AfterRunEventPayload<TInput, TOutput>>;
247
231
  onError: IEvent<OnErrorEventPayload>;
248
232
  };
233
+ [symbolFilePath]: string;
234
+ [symbolTask]: true;
249
235
  }
250
236
  export interface IResourceDefinition<TConfig = any, TValue = unknown, TDependencies extends DependencyMapType = {}, TContext = any, THooks = any, TRegisterableItems = any> {
251
237
  /** Stable identifier. Omit to get an anonymous id. */
@@ -284,6 +270,7 @@ export interface IResourceDefinition<TConfig = any, TValue = unknown, TDependenc
284
270
  context?: () => TContext;
285
271
  /**
286
272
  * This is optional and used from an index resource to get the correct caller.
273
+ * This is the reason we allow it here as well.
287
274
  */
288
275
  [symbolFilePath]?: string;
289
276
  /**
@@ -305,6 +292,9 @@ export interface IResource<TConfig = void, TValue = any, TDependencies extends D
305
292
  };
306
293
  overrides: Array<IResource | ITask | IMiddleware | IResourceWithConfig>;
307
294
  middleware: MiddlewareAttachments[];
295
+ [symbolFilePath]: string;
296
+ [symbolIndexResource]: boolean;
297
+ [symbolResource]: true;
308
298
  }
309
299
  export interface IResourceWithConfig<TConfig = any, TValue = any, TDependencies extends DependencyMapType = any> {
310
300
  /** The id of the underlying resource. */
@@ -326,6 +316,7 @@ export interface IEvent<TPayload = any> extends IEventDefinition<TPayload> {
326
316
  * We use this event to discriminate between resources with just 'id' and 'events' as they collide. This is a workaround, should be redone using classes and instanceof.
327
317
  */
328
318
  [symbolEvent]: true;
319
+ [symbolFilePath]: string;
329
320
  }
330
321
  /**
331
322
  * This represents the object that is passed to event handlers
@@ -387,6 +378,8 @@ export interface IMiddleware<TConfig = any, TDependencies extends DependencyMapT
387
378
  config: TConfig;
388
379
  /** Configure the middleware and return a marked, configured instance. */
389
380
  with: (config: TConfig) => IMiddlewareConfigured<TConfig, TDependencies>;
381
+ [symbolFilePath]: string;
382
+ [symbolMiddleware]: true;
390
383
  }
391
384
  export interface IMiddlewareConfigured<TConfig = any, TDependencies extends DependencyMapType = any> extends IMiddleware<TConfig, TDependencies> {
392
385
  [symbolMiddlewareConfigured]: true;
package/dist/defs.js CHANGED
@@ -14,8 +14,23 @@
14
14
  * - Friendly JSDoc you can hover in editors to understand usage instantly
15
15
  * - Safe overrides and strong typing around config and register mechanics
16
16
  */
17
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
+ if (k2 === undefined) k2 = k;
19
+ var desc = Object.getOwnPropertyDescriptor(m, k);
20
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
21
+ desc = { enumerable: true, get: function() { return m[k]; } };
22
+ }
23
+ Object.defineProperty(o, k2, desc);
24
+ }) : (function(o, m, k, k2) {
25
+ if (k2 === undefined) k2 = k;
26
+ o[k2] = m[k];
27
+ }));
28
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
29
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
30
+ };
17
31
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.symbols = exports.symbolIndexResource = exports.symbolStore = exports.symbolDispose = exports.symbolFilePath = exports.symbolMiddlewareEverywhereResources = exports.symbolMiddlewareEverywhereTasks = exports.symbolMiddlewareGlobal = exports.symbolMiddlewareConfigured = exports.symbolMiddleware = exports.symbolEvent = exports.symbolResourceWithConfig = exports.symbolResource = exports.symbolTask = void 0;
32
+ exports.symbolIndexResource = exports.symbolStore = exports.symbolDispose = exports.symbolFilePath = exports.symbolMiddlewareEverywhereResources = exports.symbolMiddlewareEverywhereTasks = exports.symbolMiddlewareGlobal = exports.symbolMiddlewareConfigured = exports.symbolMiddleware = exports.symbolEvent = exports.symbolResourceWithConfig = exports.symbolResource = exports.symbolTask = void 0;
33
+ __exportStar(require("./models/StoreTypes"), exports);
19
34
  /**
20
35
  * Internal brand symbols used to tag created objects at runtime and help with
21
36
  * type‑narrowing. Prefer the `isTask`/`isResource`/`isEvent`/`isMiddleware`
@@ -39,22 +54,4 @@ exports.symbolDispose = Symbol("runner.dispose");
39
54
  exports.symbolStore = Symbol("runner.store");
40
55
  /** @internal Brand used by index() resources */
41
56
  exports.symbolIndexResource = Symbol("runner.indexResource");
42
- /**
43
- * Convenience bag of internal symbols. Intended for framework internals;
44
- * consumers should not rely on this shape.
45
- * @internal
46
- */
47
- exports.symbols = {
48
- task: exports.symbolTask,
49
- resource: exports.symbolResource,
50
- resourceWithConfig: exports.symbolResourceWithConfig,
51
- indexResource: exports.symbolIndexResource,
52
- event: exports.symbolEvent,
53
- middleware: exports.symbolMiddleware,
54
- middlewareEverywhereTasks: exports.symbolMiddlewareEverywhereTasks,
55
- middlewareEverywhereResources: exports.symbolMiddlewareEverywhereResources,
56
- filePath: exports.symbolFilePath,
57
- dispose: exports.symbolDispose,
58
- store: exports.symbolStore,
59
- };
60
57
  //# sourceMappingURL=defs.js.map
package/dist/defs.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"defs.js","sourceRoot":"","sources":["../src/defs.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAOH;;;;;GAKG;AACU,QAAA,UAAU,GAAkB,MAAM,CAAC,aAAa,CAAC,CAAC;AAClD,QAAA,cAAc,GAAkB,MAAM,CAAC,iBAAiB,CAAC,CAAC;AAC1D,QAAA,wBAAwB,GAAkB,MAAM,CAC3D,2BAA2B,CAC5B,CAAC;AACW,QAAA,WAAW,GAAkB,MAAM,CAAC,cAAc,CAAC,CAAC;AACpD,QAAA,gBAAgB,GAAkB,MAAM,CAAC,mBAAmB,CAAC,CAAC;AAC9D,QAAA,0BAA0B,GAAkB,MAAM,CAC7D,6BAA6B,CAC9B,CAAC;AACW,QAAA,sBAAsB,GAAkB,MAAM,CACzD,yBAAyB,CAC1B,CAAC;AACW,QAAA,+BAA+B,GAAkB,MAAM,CAClE,8BAA8B,CAC/B,CAAC;AACW,QAAA,mCAAmC,GAAkB,MAAM,CACtE,kCAAkC,CACnC,CAAC;AAEF,uEAAuE;AAC1D,QAAA,cAAc,GAAkB,MAAM,CAAC,iBAAiB,CAAC,CAAC;AACvE,2CAA2C;AAC9B,QAAA,aAAa,GAAkB,MAAM,CAAC,gBAAgB,CAAC,CAAC;AACrE,uCAAuC;AAC1B,QAAA,WAAW,GAAkB,MAAM,CAAC,cAAc,CAAC,CAAC;AAEjE,gDAAgD;AACnC,QAAA,mBAAmB,GAAkB,MAAM,CACtD,sBAAsB,CACvB,CAAC;AAEF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