@bluelibs/runner 3.2.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.
- package/README.md +482 -34
- package/dist/cli/extract-docs.d.ts +2 -0
- package/dist/cli/extract-docs.js +88 -0
- package/dist/cli/extract-docs.js.map +1 -0
- package/dist/define.d.ts +21 -1
- package/dist/define.js +95 -23
- package/dist/define.js.map +1 -1
- package/dist/defs/core.d.ts +144 -0
- package/dist/defs/core.js +6 -0
- package/dist/defs/core.js.map +1 -0
- package/dist/defs/symbols.d.ts +42 -0
- package/dist/defs/symbols.js +45 -0
- package/dist/defs/symbols.js.map +1 -0
- package/dist/defs/tags.d.ts +70 -0
- package/dist/defs/tags.js +6 -0
- package/dist/defs/tags.js.map +1 -0
- package/dist/defs.d.ts +168 -16
- package/dist/defs.js +41 -14
- package/dist/defs.js.map +1 -1
- package/dist/docs/introspect.d.ts +7 -0
- package/dist/docs/introspect.js +199 -0
- package/dist/docs/introspect.js.map +1 -0
- package/dist/docs/markdown.d.ts +2 -0
- package/dist/docs/markdown.js +148 -0
- package/dist/docs/markdown.js.map +1 -0
- package/dist/docs/model.d.ts +62 -0
- package/dist/docs/model.js +33 -0
- package/dist/docs/model.js.map +1 -0
- package/dist/express/docsRouter.d.ts +12 -0
- package/dist/express/docsRouter.js +54 -0
- package/dist/express/docsRouter.js.map +1 -0
- package/dist/globals/globalMiddleware.d.ts +1 -0
- package/dist/globals/globalMiddleware.js +2 -0
- package/dist/globals/globalMiddleware.js.map +1 -1
- package/dist/globals/middleware/timeout.middleware.d.ts +8 -0
- package/dist/globals/middleware/timeout.middleware.js +35 -0
- package/dist/globals/middleware/timeout.middleware.js.map +1 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/models/DependencyProcessor.js +2 -2
- package/dist/models/DependencyProcessor.js.map +1 -1
- package/dist/models/Store.d.ts +1 -1
- package/dist/models/StoreConstants.d.ts +1 -1
- package/dist/models/StoreConstants.js +2 -1
- package/dist/models/StoreConstants.js.map +1 -1
- package/dist/models/TaskRunner.d.ts +2 -3
- package/dist/models/TaskRunner.js +1 -2
- package/dist/models/TaskRunner.js.map +1 -1
- package/dist/testing.d.ts +24 -0
- package/dist/testing.js +41 -0
- package/dist/testing.js.map +1 -0
- package/dist/types/dependencies.d.ts +47 -18
- package/dist/types/event.d.ts +49 -0
- package/dist/types/event.js +4 -0
- package/dist/types/event.js.map +1 -0
- package/dist/types/index.d.ts +4 -10
- package/dist/types/index.js +8 -7
- package/dist/types/index.js.map +1 -1
- package/dist/types/metadata.d.ts +75 -0
- package/dist/types/metadata.js +3 -0
- package/dist/types/metadata.js.map +1 -0
- package/dist/types/middleware.d.ts +43 -18
- package/dist/types/middleware.js +0 -3
- package/dist/types/middleware.js.map +1 -1
- package/dist/types/resource.d.ts +96 -0
- package/dist/types/resource.js +3 -0
- package/dist/types/resource.js.map +1 -0
- package/dist/types/symbols.d.ts +17 -0
- package/dist/types/symbols.js +18 -3
- package/dist/types/symbols.js.map +1 -1
- package/dist/types/task.d.ts +68 -0
- package/dist/types/task.js +3 -0
- package/dist/types/task.js.map +1 -0
- package/package.json +4 -4
- package/src/__tests__/benchmark/task-benchmark.test.ts +132 -0
- package/src/__tests__/createTestResource.test.ts +139 -0
- package/src/__tests__/globals/timeout.middleware.test.ts +88 -0
- package/src/__tests__/models/EventManager.test.ts +39 -6
- package/src/__tests__/models/Semaphore.test.ts +1 -1
- package/src/__tests__/override.test.ts +104 -0
- package/src/__tests__/run.overrides.test.ts +50 -21
- package/src/__tests__/run.test.ts +19 -0
- package/src/__tests__/tags.test.ts +396 -0
- package/src/__tests__/tools/getCallerFile.test.ts +9 -11
- package/src/__tests__/typesafety.test.ts +109 -1
- package/src/define.ts +128 -24
- package/src/defs.ts +174 -22
- package/src/globals/globalMiddleware.ts +2 -0
- package/src/globals/middleware/timeout.middleware.ts +46 -0
- package/src/index.ts +6 -0
- package/src/models/DependencyProcessor.ts +2 -10
- package/src/models/StoreConstants.ts +2 -1
- package/src/models/TaskRunner.ts +1 -3
- package/src/testing.ts +66 -0
package/dist/defs.d.ts
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core public TypeScript types for BlueLibs Runner.
|
|
3
|
+
*
|
|
4
|
+
* This file contains the strongly-typed contract for tasks, resources, events
|
|
5
|
+
* and middleware. It mirrors the mental model described in the README:
|
|
6
|
+
* - Tasks are functions (with lifecycle events)
|
|
7
|
+
* - Resources are singletons (with init/dispose hooks and lifecycle events)
|
|
8
|
+
* - Events are simple, strongly-typed emissions
|
|
9
|
+
* - Middleware can target both tasks and resources
|
|
10
|
+
*
|
|
11
|
+
* DX goals:
|
|
12
|
+
* - Crystal‑clear generics and helper types that infer dependency shapes
|
|
13
|
+
* - Friendly JSDoc you can hover in editors to understand usage instantly
|
|
14
|
+
* - Safe overrides and strong typing around config and register mechanics
|
|
15
|
+
*/
|
|
1
16
|
import { MiddlewareEverywhereOptions } from "./define";
|
|
2
17
|
export { ICacheInstance } from "./globals/middleware/cache.middleware";
|
|
18
|
+
export * from "./models/StoreTypes";
|
|
19
|
+
/**
|
|
20
|
+
* Internal brand symbols used to tag created objects at runtime and help with
|
|
21
|
+
* type‑narrowing. Prefer the `isTask`/`isResource`/`isEvent`/`isMiddleware`
|
|
22
|
+
* helpers instead of touching these directly.
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
3
25
|
export declare const symbolTask: unique symbol;
|
|
4
26
|
export declare const symbolResource: unique symbol;
|
|
5
27
|
export declare const symbolResourceWithConfig: unique symbol;
|
|
@@ -9,27 +31,81 @@ export declare const symbolMiddlewareConfigured: unique symbol;
|
|
|
9
31
|
export declare const symbolMiddlewareGlobal: unique symbol;
|
|
10
32
|
export declare const symbolMiddlewareEverywhereTasks: unique symbol;
|
|
11
33
|
export declare const symbolMiddlewareEverywhereResources: unique symbol;
|
|
34
|
+
/** @internal Path to aid anonymous id generation and error messages */
|
|
12
35
|
export declare const symbolFilePath: unique symbol;
|
|
36
|
+
/** @internal Marks disposable instances */
|
|
13
37
|
export declare const symbolDispose: unique symbol;
|
|
38
|
+
/** @internal Link to internal Store */
|
|
14
39
|
export declare const symbolStore: unique symbol;
|
|
40
|
+
/** @internal Brand used by index() resources */
|
|
15
41
|
export declare const symbolIndexResource: unique symbol;
|
|
16
|
-
export
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
42
|
+
export interface ITagDefinition<TConfig = void> {
|
|
43
|
+
id: string | symbol;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* A configured instance of a tag as produced by `ITag.with()`.
|
|
47
|
+
*/
|
|
48
|
+
export interface ITagWithConfig<TConfig = void> {
|
|
49
|
+
id: string | symbol;
|
|
50
|
+
/** The tag definition used to produce this configured instance. */
|
|
51
|
+
tag: ITag<TConfig>;
|
|
52
|
+
/** The configuration captured for this tag instance. */
|
|
53
|
+
config: TConfig;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* A tag definition (builder). Use `.with(config)` to obtain configured instances,
|
|
57
|
+
* and `.extract(tags)` to find either a configured instance or the bare tag in a list.
|
|
58
|
+
*/
|
|
59
|
+
export interface ITag<TConfig = void> extends ITagDefinition<TConfig> {
|
|
60
|
+
/**
|
|
61
|
+
* Creates a configured instance of the tag.
|
|
62
|
+
*/
|
|
63
|
+
with(config: TConfig): ITagWithConfig<TConfig>;
|
|
64
|
+
/**
|
|
65
|
+
* Extracts either a configured instance or the bare tag from a list of tags
|
|
66
|
+
* or from a taggable object (`{ meta: { tags?: [] } }`).
|
|
67
|
+
*/
|
|
68
|
+
extract(target: TagType[] | ITaggable): ExtractedTagResult<TConfig> | null;
|
|
69
|
+
[symbolFilePath]: string;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Restrict bare tags to those whose config can be omitted (void or optional object),
|
|
73
|
+
* mirroring the same principle used for resources in `RegisterableItems`.
|
|
74
|
+
* Required-config tags must appear as configured instances.
|
|
75
|
+
*/
|
|
76
|
+
export type TagType = string | ITag<void> | ITag<{
|
|
77
|
+
[K in any]?: any;
|
|
78
|
+
}> | ITagWithConfig<any>;
|
|
79
|
+
/**
|
|
80
|
+
* Conditional result type for `ITag.extract`:
|
|
81
|
+
* - For void config → just the identifier
|
|
82
|
+
* - For optional object config → identifier with optional config
|
|
83
|
+
* - For required config → identifier with required config
|
|
84
|
+
*/
|
|
85
|
+
export type ExtractedTagResult<TConfig> = {} extends TConfig ? {
|
|
86
|
+
id: string | symbol;
|
|
87
|
+
config?: TConfig;
|
|
88
|
+
} : {
|
|
89
|
+
id: string | symbol;
|
|
90
|
+
config: TConfig;
|
|
28
91
|
};
|
|
92
|
+
/**
|
|
93
|
+
* Any object that can carry tags via metadata. This mirrors how tasks,
|
|
94
|
+
* resources, events, and middleware expose `meta.tags`.
|
|
95
|
+
*/
|
|
96
|
+
export interface ITaggable {
|
|
97
|
+
meta?: {
|
|
98
|
+
tags?: TagType[];
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Common metadata you can attach to tasks/resources/events/middleware.
|
|
103
|
+
* Useful for docs, filtering and middleware decisions.
|
|
104
|
+
*/
|
|
29
105
|
export interface IMeta {
|
|
30
106
|
title?: string;
|
|
31
107
|
description?: string;
|
|
32
|
-
tags?:
|
|
108
|
+
tags?: TagType[];
|
|
33
109
|
}
|
|
34
110
|
export interface ITaskMeta extends IMeta {
|
|
35
111
|
}
|
|
@@ -39,27 +115,47 @@ export interface IEventMeta extends IMeta {
|
|
|
39
115
|
}
|
|
40
116
|
export interface IMiddlewareMeta extends IMeta {
|
|
41
117
|
}
|
|
118
|
+
/**
|
|
119
|
+
* A mapping of dependency keys to Runner definitions. Used in `dependencies`
|
|
120
|
+
* for tasks and resources. Values are later transformed into the actual
|
|
121
|
+
* callable/value shape by `DependencyValuesType`.
|
|
122
|
+
*/
|
|
42
123
|
export type DependencyMapType = Record<string, ITask<any, any, any, any> | IResource<any, any, any> | IEventDefinition<any>>;
|
|
43
124
|
type ExtractTaskInput<T> = T extends ITask<infer I, any, infer D> ? I : never;
|
|
44
125
|
type ExtractTaskOutput<T> = T extends ITask<any, infer O, infer D> ? O : never;
|
|
45
126
|
type ExtractResourceValue<T> = T extends IResource<any, infer V, infer D> ? V : never;
|
|
46
127
|
type ExtractEventParams<T> = T extends IEvent<infer P> ? P : never;
|
|
47
128
|
/**
|
|
48
|
-
*
|
|
129
|
+
* Task dependencies transform into callable functions: call with the task input
|
|
130
|
+
* and you receive the task output.
|
|
49
131
|
*/
|
|
50
132
|
type TaskDependency<I, O> = (...args: I extends null | void ? [] : [I]) => O;
|
|
51
133
|
/**
|
|
52
|
-
*
|
|
134
|
+
* Resource dependencies resolve to the resource's value directly.
|
|
53
135
|
*/
|
|
54
136
|
type ResourceDependency<V> = V;
|
|
55
137
|
/**
|
|
56
|
-
*
|
|
138
|
+
* Event dependencies resolve to an emitter function. If the payload type is
|
|
139
|
+
* `void`, the function can be called with zero args (or an empty object).
|
|
57
140
|
*/
|
|
58
141
|
type EventDependency<P> = P extends void ? (() => Promise<void>) & ((input?: Record<string, never>) => Promise<void>) : (input: P) => Promise<void>;
|
|
142
|
+
/**
|
|
143
|
+
* Transforms a dependency definition into the usable shape inside `run`/`init`:
|
|
144
|
+
* - Task -> callable function
|
|
145
|
+
* - Resource -> resolved value
|
|
146
|
+
* - Event -> emit function
|
|
147
|
+
*/
|
|
59
148
|
export type DependencyValueType<T> = T extends ITask<any, any, any> ? TaskDependency<ExtractTaskInput<T>, ExtractTaskOutput<T>> : T extends IResource<any, any> ? ResourceDependency<ExtractResourceValue<T>> : T extends IEventDefinition<any> ? EventDependency<ExtractEventParams<T>> : never;
|
|
60
149
|
export type DependencyValuesType<T extends DependencyMapType> = {
|
|
61
150
|
[K in keyof T]: DependencyValueType<T[K]>;
|
|
62
151
|
};
|
|
152
|
+
/**
|
|
153
|
+
* Anything you can put inside a resource's `register: []`.
|
|
154
|
+
* - Resources (with or without `.with()`)
|
|
155
|
+
* - Tasks
|
|
156
|
+
* - Middleware
|
|
157
|
+
* - Events
|
|
158
|
+
*/
|
|
63
159
|
export type RegisterableItems<T = any> = IResourceWithConfig<any> | IResource<void, any, any, any> | IResource<{
|
|
64
160
|
[K in any]?: any;
|
|
65
161
|
}, any, any, any> | ITask<any, any, any, any> | IMiddleware<any> | IEvent<any>;
|
|
@@ -67,8 +163,17 @@ export type MiddlewareAttachments = IMiddleware<void> | IMiddleware<{
|
|
|
67
163
|
[K in any]?: any;
|
|
68
164
|
}> | IMiddlewareConfigured<any>;
|
|
69
165
|
export interface ITaskDefinition<TInput = any, TOutput extends Promise<any> = any, TDependencies extends DependencyMapType = {}, TOn extends "*" | IEventDefinition<any> | undefined = undefined> {
|
|
166
|
+
/**
|
|
167
|
+
* Stable identifier. If omitted, an anonymous id is generated from file path
|
|
168
|
+
* (see README: Anonymous IDs).
|
|
169
|
+
*/
|
|
70
170
|
id?: string | symbol;
|
|
171
|
+
/**
|
|
172
|
+
* Access other tasks/resources/events. Can be an object or a function when
|
|
173
|
+
* you need late or config‑dependent resolution.
|
|
174
|
+
*/
|
|
71
175
|
dependencies?: TDependencies | (() => TDependencies);
|
|
176
|
+
/** Middleware applied around task execution. */
|
|
72
177
|
middleware?: MiddlewareAttachments[];
|
|
73
178
|
/**
|
|
74
179
|
* Listen to events in a simple way
|
|
@@ -79,7 +184,12 @@ export interface ITaskDefinition<TInput = any, TOutput extends Promise<any> = an
|
|
|
79
184
|
* The event with the lowest order will be executed first.
|
|
80
185
|
*/
|
|
81
186
|
listenerOrder?: number;
|
|
187
|
+
/** Optional metadata used for docs, filtering and tooling. */
|
|
82
188
|
meta?: ITaskMeta;
|
|
189
|
+
/**
|
|
190
|
+
* The task body. If `on` is set, the input is an `IEventEmission`. Otherwise,
|
|
191
|
+
* it's the declared input type.
|
|
192
|
+
*/
|
|
83
193
|
run: (input: TOn extends undefined ? TInput : IEventEmission<TOn extends "*" ? any : ExtractEventParams<TOn>>, dependencies: DependencyValuesType<TDependencies>) => TOutput;
|
|
84
194
|
}
|
|
85
195
|
export type BeforeRunEventPayload<TInput> = {
|
|
@@ -120,11 +230,22 @@ export interface ITask<TInput = any, TOutput extends Promise<any> = any, TDepend
|
|
|
120
230
|
afterRun: IEvent<AfterRunEventPayload<TInput, TOutput>>;
|
|
121
231
|
onError: IEvent<OnErrorEventPayload>;
|
|
122
232
|
};
|
|
233
|
+
[symbolFilePath]: string;
|
|
234
|
+
[symbolTask]: true;
|
|
123
235
|
}
|
|
124
236
|
export interface IResourceDefinition<TConfig = any, TValue = unknown, TDependencies extends DependencyMapType = {}, TContext = any, THooks = any, TRegisterableItems = any> {
|
|
237
|
+
/** Stable identifier. Omit to get an anonymous id. */
|
|
125
238
|
id?: string | symbol;
|
|
239
|
+
/** Static or lazy dependency map. Receives `config` when provided. */
|
|
126
240
|
dependencies?: TDependencies | ((config: TConfig) => TDependencies);
|
|
241
|
+
/**
|
|
242
|
+
* Register other registerables (resources/tasks/middleware/events). Accepts a
|
|
243
|
+
* static array or a function of `config` to support dynamic wiring.
|
|
244
|
+
*/
|
|
127
245
|
register?: Array<RegisterableItems> | ((config: TConfig) => Array<RegisterableItems>);
|
|
246
|
+
/**
|
|
247
|
+
* Initialize and return the resource value. Called once during boot.
|
|
248
|
+
*/
|
|
128
249
|
init?: (this: any, config: TConfig, dependencies: DependencyValuesType<TDependencies>, context: TContext) => Promise<TValue>;
|
|
129
250
|
/**
|
|
130
251
|
* Clean-up function for the resource. This is called when the resource is no longer needed.
|
|
@@ -136,11 +257,20 @@ export interface IResourceDefinition<TConfig = any, TValue = unknown, TDependenc
|
|
|
136
257
|
*/
|
|
137
258
|
dispose?: (this: any, value: TValue, config: TConfig, dependencies: DependencyValuesType<TDependencies>, context: TContext) => Promise<void>;
|
|
138
259
|
meta?: IResourceMeta;
|
|
260
|
+
/**
|
|
261
|
+
* Safe overrides to swap behavior while preserving identities. See
|
|
262
|
+
* README: Overrides.
|
|
263
|
+
*/
|
|
139
264
|
overrides?: Array<IResource | ITask | IMiddleware | IResourceWithConfig>;
|
|
265
|
+
/** Middleware applied around init/dispose. */
|
|
140
266
|
middleware?: MiddlewareAttachments[];
|
|
267
|
+
/**
|
|
268
|
+
* Create a private, mutable context shared between `init` and `dispose`.
|
|
269
|
+
*/
|
|
141
270
|
context?: () => TContext;
|
|
142
271
|
/**
|
|
143
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.
|
|
144
274
|
*/
|
|
145
275
|
[symbolFilePath]?: string;
|
|
146
276
|
/**
|
|
@@ -162,14 +292,21 @@ export interface IResource<TConfig = void, TValue = any, TDependencies extends D
|
|
|
162
292
|
};
|
|
163
293
|
overrides: Array<IResource | ITask | IMiddleware | IResourceWithConfig>;
|
|
164
294
|
middleware: MiddlewareAttachments[];
|
|
295
|
+
[symbolFilePath]: string;
|
|
296
|
+
[symbolIndexResource]: boolean;
|
|
297
|
+
[symbolResource]: true;
|
|
165
298
|
}
|
|
166
299
|
export interface IResourceWithConfig<TConfig = any, TValue = any, TDependencies extends DependencyMapType = any> {
|
|
300
|
+
/** The id of the underlying resource. */
|
|
167
301
|
id: string;
|
|
302
|
+
/** The underlying resource definition. */
|
|
168
303
|
resource: IResource<TConfig, TValue, TDependencies>;
|
|
304
|
+
/** The configuration captured by `.with(config)`. */
|
|
169
305
|
config: TConfig;
|
|
170
306
|
}
|
|
171
307
|
export type EventHandlerType<T = any> = (event: IEventEmission<T>) => any | Promise<any>;
|
|
172
308
|
export interface IEventDefinition<TPayload = void> {
|
|
309
|
+
/** Stable identifier. Omit to get an anonymous id. */
|
|
173
310
|
id?: string | symbol;
|
|
174
311
|
meta?: IEventMeta;
|
|
175
312
|
}
|
|
@@ -179,6 +316,7 @@ export interface IEvent<TPayload = any> extends IEventDefinition<TPayload> {
|
|
|
179
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.
|
|
180
317
|
*/
|
|
181
318
|
[symbolEvent]: true;
|
|
319
|
+
[symbolFilePath]: string;
|
|
182
320
|
}
|
|
183
321
|
/**
|
|
184
322
|
* This represents the object that is passed to event handlers
|
|
@@ -215,8 +353,13 @@ export interface IEventEmission<TPayload = any> {
|
|
|
215
353
|
isPropagationStopped(): boolean;
|
|
216
354
|
}
|
|
217
355
|
export interface IMiddlewareDefinition<TConfig = any, TDependencies extends DependencyMapType = any> {
|
|
356
|
+
/** Stable identifier. Omit to get an anonymous id. */
|
|
218
357
|
id?: string | symbol;
|
|
358
|
+
/** Static or lazy dependency map. */
|
|
219
359
|
dependencies?: TDependencies | ((config: TConfig) => TDependencies);
|
|
360
|
+
/**
|
|
361
|
+
* The middleware body, called with task/resource execution input.
|
|
362
|
+
*/
|
|
220
363
|
run: (input: IMiddlewareExecutionInput, dependencies: DependencyValuesType<TDependencies>, config: TConfig) => Promise<any>;
|
|
221
364
|
meta?: IMiddlewareMeta;
|
|
222
365
|
}
|
|
@@ -227,9 +370,16 @@ export interface IMiddleware<TConfig = any, TDependencies extends DependencyMapT
|
|
|
227
370
|
[symbolMiddlewareEverywhereResources]?: boolean;
|
|
228
371
|
id: string | symbol;
|
|
229
372
|
dependencies: TDependencies | (() => TDependencies);
|
|
373
|
+
/**
|
|
374
|
+
* Attach this middleware globally. Use options to scope to tasks/resources.
|
|
375
|
+
*/
|
|
230
376
|
everywhere(config?: MiddlewareEverywhereOptions): IMiddleware<TConfig, TDependencies>;
|
|
377
|
+
/** Current configuration object (empty by default). */
|
|
231
378
|
config: TConfig;
|
|
379
|
+
/** Configure the middleware and return a marked, configured instance. */
|
|
232
380
|
with: (config: TConfig) => IMiddlewareConfigured<TConfig, TDependencies>;
|
|
381
|
+
[symbolFilePath]: string;
|
|
382
|
+
[symbolMiddleware]: true;
|
|
233
383
|
}
|
|
234
384
|
export interface IMiddlewareConfigured<TConfig = any, TDependencies extends DependencyMapType = any> extends IMiddleware<TConfig, TDependencies> {
|
|
235
385
|
[symbolMiddlewareConfigured]: true;
|
|
@@ -239,10 +389,12 @@ export interface IMiddlewareDefinitionConfigured<C extends Record<string, any> =
|
|
|
239
389
|
config?: C;
|
|
240
390
|
}
|
|
241
391
|
export interface IMiddlewareExecutionInput<TTaskInput = any, TResourceConfig = any> {
|
|
392
|
+
/** Task hook: present when wrapping a task run. */
|
|
242
393
|
task?: {
|
|
243
394
|
definition: ITask<TTaskInput>;
|
|
244
395
|
input: TTaskInput;
|
|
245
396
|
};
|
|
397
|
+
/** Resource hook: present when wrapping init/dispose. */
|
|
246
398
|
resource?: {
|
|
247
399
|
definition: IResource<TResourceConfig>;
|
|
248
400
|
config: TResourceConfig;
|
package/dist/defs.js
CHANGED
|
@@ -1,6 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Core public TypeScript types for BlueLibs Runner.
|
|
4
|
+
*
|
|
5
|
+
* This file contains the strongly-typed contract for tasks, resources, events
|
|
6
|
+
* and middleware. It mirrors the mental model described in the README:
|
|
7
|
+
* - Tasks are functions (with lifecycle events)
|
|
8
|
+
* - Resources are singletons (with init/dispose hooks and lifecycle events)
|
|
9
|
+
* - Events are simple, strongly-typed emissions
|
|
10
|
+
* - Middleware can target both tasks and resources
|
|
11
|
+
*
|
|
12
|
+
* DX goals:
|
|
13
|
+
* - Crystal‑clear generics and helper types that infer dependency shapes
|
|
14
|
+
* - Friendly JSDoc you can hover in editors to understand usage instantly
|
|
15
|
+
* - Safe overrides and strong typing around config and register mechanics
|
|
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
|
+
};
|
|
2
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
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);
|
|
34
|
+
/**
|
|
35
|
+
* Internal brand symbols used to tag created objects at runtime and help with
|
|
36
|
+
* type‑narrowing. Prefer the `isTask`/`isResource`/`isEvent`/`isMiddleware`
|
|
37
|
+
* helpers instead of touching these directly.
|
|
38
|
+
* @internal
|
|
39
|
+
*/
|
|
4
40
|
exports.symbolTask = Symbol("runner.task");
|
|
5
41
|
exports.symbolResource = Symbol("runner.resource");
|
|
6
42
|
exports.symbolResourceWithConfig = Symbol("runner.resourceWithConfig");
|
|
@@ -10,21 +46,12 @@ exports.symbolMiddlewareConfigured = Symbol("runner.middlewareConfigured");
|
|
|
10
46
|
exports.symbolMiddlewareGlobal = Symbol("runner.middlewareGlobal");
|
|
11
47
|
exports.symbolMiddlewareEverywhereTasks = Symbol("runner.middlewareGlobalTasks");
|
|
12
48
|
exports.symbolMiddlewareEverywhereResources = Symbol("runner.middlewareGlobalResources");
|
|
49
|
+
/** @internal Path to aid anonymous id generation and error messages */
|
|
13
50
|
exports.symbolFilePath = Symbol("runner.filePath");
|
|
51
|
+
/** @internal Marks disposable instances */
|
|
14
52
|
exports.symbolDispose = Symbol("runner.dispose");
|
|
53
|
+
/** @internal Link to internal Store */
|
|
15
54
|
exports.symbolStore = Symbol("runner.store");
|
|
55
|
+
/** @internal Brand used by index() resources */
|
|
16
56
|
exports.symbolIndexResource = Symbol("runner.indexResource");
|
|
17
|
-
exports.symbols = {
|
|
18
|
-
task: exports.symbolTask,
|
|
19
|
-
resource: exports.symbolResource,
|
|
20
|
-
resourceWithConfig: exports.symbolResourceWithConfig,
|
|
21
|
-
indexResource: exports.symbolIndexResource,
|
|
22
|
-
event: exports.symbolEvent,
|
|
23
|
-
middleware: exports.symbolMiddleware,
|
|
24
|
-
middlewareEverywhereTasks: exports.symbolMiddlewareEverywhereTasks,
|
|
25
|
-
middlewareEverywhereResources: exports.symbolMiddlewareEverywhereResources,
|
|
26
|
-
filePath: exports.symbolFilePath,
|
|
27
|
-
dispose: exports.symbolDispose,
|
|
28
|
-
store: exports.symbolStore,
|
|
29
|
-
};
|
|
30
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":"
|
|
1
|
+
{"version":3,"file":"defs.js","sourceRoot":"","sources":["../src/defs.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;;AAMH,sDAAoC;AACpC;;;;;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"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { IResource } from "../defs";
|
|
2
|
+
import { DocsGraph } from "./model";
|
|
3
|
+
type IntrospectOptions = {
|
|
4
|
+
includeGlobals?: boolean;
|
|
5
|
+
};
|
|
6
|
+
export declare function introspectResource(root: IResource<any, any, any, any>, config?: any, options?: IntrospectOptions): Promise<DocsGraph>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.introspectResource = introspectResource;
|
|
4
|
+
const EventManager_1 = require("../models/EventManager");
|
|
5
|
+
const Logger_1 = require("../models/Logger");
|
|
6
|
+
const Store_1 = require("../models/Store");
|
|
7
|
+
const defs_1 = require("../defs");
|
|
8
|
+
const model_1 = require("./model");
|
|
9
|
+
async function introspectResource(root, config = {}, options = {}) {
|
|
10
|
+
const includeGlobals = options.includeGlobals ?? false;
|
|
11
|
+
// Build a Store but do not compute dependencies or initialize root.
|
|
12
|
+
const eventManager = new EventManager_1.EventManager();
|
|
13
|
+
const logger = new Logger_1.Logger(eventManager);
|
|
14
|
+
const store = new Store_1.Store(eventManager, logger);
|
|
15
|
+
// Only registration phase, with overrides processed, but no init.
|
|
16
|
+
store.initializeStore(root, config);
|
|
17
|
+
store.processOverrides();
|
|
18
|
+
const nodes = [];
|
|
19
|
+
const edges = [];
|
|
20
|
+
// Helpers
|
|
21
|
+
const shouldInclude = (id) => {
|
|
22
|
+
const str = (0, model_1.normalizeId)(id);
|
|
23
|
+
if (includeGlobals)
|
|
24
|
+
return true;
|
|
25
|
+
return !str.startsWith("globals.");
|
|
26
|
+
};
|
|
27
|
+
// Resources
|
|
28
|
+
for (const res of store.resources.values()) {
|
|
29
|
+
if (!shouldInclude(res.resource.id))
|
|
30
|
+
continue;
|
|
31
|
+
nodes.push({
|
|
32
|
+
...(0, model_1.buildBaseNode)("resource", res.resource.id, res.resource[defs_1.symbols.filePath], res.resource.meta),
|
|
33
|
+
});
|
|
34
|
+
const regItems = Array.isArray(res.resource.register)
|
|
35
|
+
? res.resource.register
|
|
36
|
+
: [];
|
|
37
|
+
for (const item of regItems) {
|
|
38
|
+
const targetId = item.id || item?.resource?.id;
|
|
39
|
+
if (!targetId || !shouldInclude(targetId))
|
|
40
|
+
continue;
|
|
41
|
+
edges.push({
|
|
42
|
+
type: "registers",
|
|
43
|
+
from: (0, model_1.normalizeId)(res.resource.id),
|
|
44
|
+
to: (0, model_1.normalizeId)(targetId),
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
// Resource dependencies
|
|
48
|
+
const deps = (res.resource.dependencies || {});
|
|
49
|
+
for (const depKey of Object.keys(deps)) {
|
|
50
|
+
const dep = deps[depKey];
|
|
51
|
+
const depId = dep?.id;
|
|
52
|
+
if (!depId || !shouldInclude(depId))
|
|
53
|
+
continue;
|
|
54
|
+
edges.push({
|
|
55
|
+
type: "dependsOn",
|
|
56
|
+
from: (0, model_1.normalizeId)(res.resource.id),
|
|
57
|
+
to: (0, model_1.normalizeId)(depId),
|
|
58
|
+
meta: { key: depKey },
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
// Resource middleware
|
|
62
|
+
for (const mw of res.resource.middleware || []) {
|
|
63
|
+
const mwId = mw.id;
|
|
64
|
+
if (!mwId || !shouldInclude(mwId))
|
|
65
|
+
continue;
|
|
66
|
+
edges.push({
|
|
67
|
+
type: "middleware",
|
|
68
|
+
from: (0, model_1.normalizeId)(res.resource.id),
|
|
69
|
+
to: (0, model_1.normalizeId)(mwId),
|
|
70
|
+
meta: { scope: "resource" },
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
// Tasks
|
|
75
|
+
for (const t of store.tasks.values()) {
|
|
76
|
+
if (!shouldInclude(t.task.id))
|
|
77
|
+
continue;
|
|
78
|
+
nodes.push({
|
|
79
|
+
...(0, model_1.buildBaseNode)("task", t.task.id, t.task[defs_1.symbols.filePath], t.task.meta),
|
|
80
|
+
on: t.task.on
|
|
81
|
+
? t.task.on === "*"
|
|
82
|
+
? "*"
|
|
83
|
+
: (0, model_1.normalizeId)(t.task.on.id)
|
|
84
|
+
: undefined,
|
|
85
|
+
listenerOrder: t.task.listenerOrder,
|
|
86
|
+
});
|
|
87
|
+
// Dependencies
|
|
88
|
+
const deps = (t.task.dependencies || {});
|
|
89
|
+
for (const depKey of Object.keys(deps)) {
|
|
90
|
+
const dep = deps[depKey];
|
|
91
|
+
const depId = dep?.id;
|
|
92
|
+
if (!depId || !shouldInclude(depId))
|
|
93
|
+
continue;
|
|
94
|
+
edges.push({
|
|
95
|
+
type: "dependsOn",
|
|
96
|
+
from: (0, model_1.normalizeId)(t.task.id),
|
|
97
|
+
to: (0, model_1.normalizeId)(depId),
|
|
98
|
+
meta: { key: depKey },
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
// Middleware
|
|
102
|
+
for (const mw of t.task.middleware || []) {
|
|
103
|
+
const mwId = mw.id;
|
|
104
|
+
if (!mwId || !shouldInclude(mwId))
|
|
105
|
+
continue;
|
|
106
|
+
edges.push({
|
|
107
|
+
type: "middleware",
|
|
108
|
+
from: (0, model_1.normalizeId)(t.task.id),
|
|
109
|
+
to: (0, model_1.normalizeId)(mwId),
|
|
110
|
+
meta: { scope: "task" },
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
// Listeners
|
|
114
|
+
if (t.task.on && t.task.on !== "*") {
|
|
115
|
+
const eventId = t.task.on.id;
|
|
116
|
+
if (shouldInclude(eventId)) {
|
|
117
|
+
edges.push({
|
|
118
|
+
type: "listensTo",
|
|
119
|
+
from: (0, model_1.normalizeId)(t.task.id),
|
|
120
|
+
to: (0, model_1.normalizeId)(eventId),
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
// Events (registered globally + lifecycle + custom)
|
|
126
|
+
for (const e of store.events.values()) {
|
|
127
|
+
const eventId = e.event.id;
|
|
128
|
+
if (!eventId)
|
|
129
|
+
continue;
|
|
130
|
+
if (!shouldInclude(eventId))
|
|
131
|
+
continue;
|
|
132
|
+
nodes.push({
|
|
133
|
+
...(0, model_1.buildBaseNode)("event", eventId, e.event[defs_1.symbols.filePath], e.event.meta),
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
// Middleware nodes
|
|
137
|
+
for (const mw of store.middlewares.values()) {
|
|
138
|
+
if (!shouldInclude(mw.middleware.id))
|
|
139
|
+
continue;
|
|
140
|
+
nodes.push({
|
|
141
|
+
...(0, model_1.buildBaseNode)("middleware", mw.middleware.id, mw.middleware[defs_1.symbols.filePath], mw.middleware.meta),
|
|
142
|
+
everywhere: {
|
|
143
|
+
tasks: Boolean(mw.middleware[defs_1.symbols.middlewareEverywhereTasks]),
|
|
144
|
+
resources: Boolean(mw.middleware[defs_1.symbols.middlewareEverywhereResources]),
|
|
145
|
+
},
|
|
146
|
+
});
|
|
147
|
+
// Dependencies of middleware
|
|
148
|
+
const deps = (mw.middleware.dependencies || {});
|
|
149
|
+
for (const depKey of Object.keys(deps)) {
|
|
150
|
+
const dep = deps[depKey];
|
|
151
|
+
const depId = dep?.id;
|
|
152
|
+
if (!depId || !shouldInclude(depId))
|
|
153
|
+
continue;
|
|
154
|
+
edges.push({
|
|
155
|
+
type: "dependsOn",
|
|
156
|
+
from: (0, model_1.normalizeId)(mw.middleware.id),
|
|
157
|
+
to: (0, model_1.normalizeId)(depId),
|
|
158
|
+
meta: { key: depKey },
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
// Override requests and overrides mapping
|
|
163
|
+
for (const req of store.overrideRequests) {
|
|
164
|
+
const source = req.source;
|
|
165
|
+
const targetId = req.override?.id || req.override?.resource?.id;
|
|
166
|
+
if (targetId && shouldInclude(source) && shouldInclude(targetId)) {
|
|
167
|
+
edges.push({
|
|
168
|
+
type: "overrideRequest",
|
|
169
|
+
from: (0, model_1.normalizeId)(source),
|
|
170
|
+
to: (0, model_1.normalizeId)(targetId),
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
for (const [id, ov] of store.overrides) {
|
|
175
|
+
if (!shouldInclude(id))
|
|
176
|
+
continue;
|
|
177
|
+
edges.push({
|
|
178
|
+
type: "overrides",
|
|
179
|
+
from: (0, model_1.normalizeId)(ov.id || ov?.resource?.id),
|
|
180
|
+
to: (0, model_1.normalizeId)(id),
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
const graph = {
|
|
184
|
+
version: 1,
|
|
185
|
+
summary: {
|
|
186
|
+
counts: {
|
|
187
|
+
resources: nodes.filter((n) => n.kind === "resource").length,
|
|
188
|
+
tasks: nodes.filter((n) => n.kind === "task").length,
|
|
189
|
+
events: nodes.filter((n) => n.kind === "event").length,
|
|
190
|
+
middleware: nodes.filter((n) => n.kind === "middleware").length,
|
|
191
|
+
edges: edges.length,
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
nodes,
|
|
195
|
+
edges,
|
|
196
|
+
};
|
|
197
|
+
return graph;
|
|
198
|
+
}
|
|
199
|
+
//# sourceMappingURL=introspect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"introspect.js","sourceRoot":"","sources":["../../src/docs/introspect.ts"],"names":[],"mappings":";;AA6BA,gDA+NC;AA5PD,yDAAsD;AACtD,6CAA0C;AAC1C,2CAAwC;AAcxC,kCAAkC;AAClC,mCAMiB;AAMV,KAAK,UAAU,kBAAkB,CACtC,IAAmC,EACnC,SAAc,EAAE,EAChB,UAA6B,EAAE;IAE/B,MAAM,cAAc,GAAG,OAAO,CAAC,cAAc,IAAI,KAAK,CAAC;IAEvD,oEAAoE;IACpE,MAAM,YAAY,GAAG,IAAI,2BAAY,EAAE,CAAC;IACxC,MAAM,MAAM,GAAG,IAAI,eAAM,CAAC,YAAY,CAAC,CAAC;IACxC,MAAM,KAAK,GAAG,IAAI,aAAK,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;IAE9C,kEAAkE;IAClE,KAAK,CAAC,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACpC,KAAK,CAAC,gBAAgB,EAAE,CAAC;IAEzB,MAAM,KAAK,GAAgB,EAAE,CAAC;IAC9B,MAAM,KAAK,GAAgB,EAAE,CAAC;IAE9B,UAAU;IACV,MAAM,aAAa,GAAG,CAAC,EAAmB,EAAW,EAAE;QACrD,MAAM,GAAG,GAAG,IAAA,mBAAW,EAAC,EAAE,CAAC,CAAC;QAC5B,IAAI,cAAc;YAAE,OAAO,IAAI,CAAC;QAChC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IACrC,CAAC,CAAC;IAEF,YAAY;IACZ,KAAK,MAAM,GAAG,IAAI,KAAK,CAAC,SAAS,CAAC,MAAM,EAAE,EAAE,CAAC;QAC3C,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;YAAE,SAAS;QA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