@bluelibs/runner 3.2.0 → 3.3.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/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 +71 -0
- package/dist/define.js.map +1 -1
- package/dist/defs.d.ts +163 -4
- package/dist/defs.js +30 -0
- 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/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/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__/typesafety.test.ts +109 -1
- package/src/define.ts +97 -0
- package/src/defs.ts +168 -8
- 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/define.d.ts
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Factory functions for defining tasks, resources, events and middleware.
|
|
3
|
+
*
|
|
4
|
+
* These helpers create strongly-typed definitions while also wiring internal
|
|
5
|
+
* metadata: anonymous IDs, file path tags (for better debugging), lifecycle
|
|
6
|
+
* events, and global middleware flags. See README for high-level concepts.
|
|
7
|
+
*/
|
|
8
|
+
import { ITask, ITaskDefinition, IResource, IResourceWithConfig, IResourceDefinition, IEventDefinition, IMiddlewareDefinition, DependencyMapType, DependencyValuesType, IMiddleware, IEvent, RegisterableItems, ITag, ITagDefinition } from "./defs";
|
|
2
9
|
export declare function defineTask<Input = undefined, Output extends Promise<any> = any, Deps extends DependencyMapType = any, TOn extends "*" | IEventDefinition | undefined = undefined>(taskConfig: ITaskDefinition<Input, Output, Deps, TOn>): ITask<Input, Output, Deps, TOn>;
|
|
3
10
|
export declare function defineResource<TConfig = void, TValue = any, TDeps extends DependencyMapType = {}, TPrivate = any>(constConfig: IResourceDefinition<TConfig, TValue, TDeps, TPrivate>): IResource<TConfig, TValue, TDeps, TPrivate>;
|
|
4
11
|
/**
|
|
@@ -27,3 +34,16 @@ export declare function isResource(definition: any): definition is IResource;
|
|
|
27
34
|
export declare function isResourceWithConfig(definition: any): definition is IResourceWithConfig;
|
|
28
35
|
export declare function isEvent(definition: any): definition is IEvent;
|
|
29
36
|
export declare function isMiddleware(definition: any): definition is IMiddleware;
|
|
37
|
+
/**
|
|
38
|
+
* Override helper that preserves the original `id` and returns the same type.
|
|
39
|
+
* You can override any property except `id`.
|
|
40
|
+
*/
|
|
41
|
+
export declare function defineOverride<T extends ITask<any, any, any, any>>(base: T, patch: Omit<Partial<T>, "id">): T;
|
|
42
|
+
export declare function defineOverride<T extends IResource<any, any, any, any>>(base: T, patch: Omit<Partial<T>, "id">): T;
|
|
43
|
+
export declare function defineOverride<T extends IMiddleware<any, any>>(base: T, patch: Omit<Partial<T>, "id">): T;
|
|
44
|
+
/**
|
|
45
|
+
* Creates a tag definition.
|
|
46
|
+
* - `.with(config)` to create configured instances
|
|
47
|
+
* - `.extract(tags)` to extract this tag from a list of tags
|
|
48
|
+
*/
|
|
49
|
+
export declare function defineTag<TConfig = void>(definition: ITagDefinition<TConfig>): ITag<TConfig>;
|
package/dist/define.js
CHANGED
|
@@ -10,11 +10,26 @@ exports.isResource = isResource;
|
|
|
10
10
|
exports.isResourceWithConfig = isResourceWithConfig;
|
|
11
11
|
exports.isEvent = isEvent;
|
|
12
12
|
exports.isMiddleware = isMiddleware;
|
|
13
|
+
exports.defineOverride = defineOverride;
|
|
14
|
+
exports.defineTag = defineTag;
|
|
15
|
+
/**
|
|
16
|
+
* Factory functions for defining tasks, resources, events and middleware.
|
|
17
|
+
*
|
|
18
|
+
* These helpers create strongly-typed definitions while also wiring internal
|
|
19
|
+
* metadata: anonymous IDs, file path tags (for better debugging), lifecycle
|
|
20
|
+
* events, and global middleware flags. See README for high-level concepts.
|
|
21
|
+
*/
|
|
13
22
|
const defs_1 = require("./defs");
|
|
14
23
|
const errors_1 = require("./errors");
|
|
15
24
|
const getCallerFile_1 = require("./tools/getCallerFile");
|
|
16
25
|
// Helper function to get the caller file
|
|
17
26
|
function defineTask(taskConfig) {
|
|
27
|
+
/**
|
|
28
|
+
* Creates a task definition.
|
|
29
|
+
* - Generates an anonymous id based on file path when `id` is omitted
|
|
30
|
+
* - Wires lifecycle events: beforeRun, afterRun, onError
|
|
31
|
+
* - Carries through dependencies and middleware as declared
|
|
32
|
+
*/
|
|
18
33
|
const filePath = (0, getCallerFile_1.getCallerFile)();
|
|
19
34
|
const isAnonymous = !Boolean(taskConfig.id);
|
|
20
35
|
const id = taskConfig.id || (0, getCallerFile_1.generateCallerIdFromFile)(filePath, "task");
|
|
@@ -58,6 +73,12 @@ function defineTask(taskConfig) {
|
|
|
58
73
|
};
|
|
59
74
|
}
|
|
60
75
|
function defineResource(constConfig) {
|
|
76
|
+
/**
|
|
77
|
+
* Creates a resource definition.
|
|
78
|
+
* - Generates anonymous id when omitted (resource or index flavor)
|
|
79
|
+
* - Wires lifecycle events: beforeInit, afterInit, onError
|
|
80
|
+
* - Exposes `.with(config)` for config‑bound registration
|
|
81
|
+
*/
|
|
61
82
|
// The symbolFilePath might already come from defineIndex() for example
|
|
62
83
|
const filePath = constConfig[defs_1.symbolFilePath] || (0, getCallerFile_1.getCallerFile)();
|
|
63
84
|
const isIndexResource = constConfig[defs_1.symbolIndexResource] || false;
|
|
@@ -119,6 +140,7 @@ function defineResource(constConfig) {
|
|
|
119
140
|
* access them naturally: `deps.services.myTask()` or `deps.services.myResource`.
|
|
120
141
|
*/
|
|
121
142
|
function defineIndex(items) {
|
|
143
|
+
// Build dependency map from given items; unwrap `.with()` to the base resource
|
|
122
144
|
const dependencies = {};
|
|
123
145
|
const register = [];
|
|
124
146
|
for (const key of Object.keys(items)) {
|
|
@@ -143,6 +165,10 @@ function defineIndex(items) {
|
|
|
143
165
|
});
|
|
144
166
|
}
|
|
145
167
|
function defineEvent(config) {
|
|
168
|
+
/**
|
|
169
|
+
* Creates an event definition. Anonymous ids are generated from file path
|
|
170
|
+
* when omitted. The returned object is branded for runtime checks.
|
|
171
|
+
*/
|
|
146
172
|
const callerFilePath = (0, getCallerFile_1.getCallerFile)();
|
|
147
173
|
const eventConfig = config || {};
|
|
148
174
|
return {
|
|
@@ -153,6 +179,12 @@ function defineEvent(config) {
|
|
|
153
179
|
};
|
|
154
180
|
}
|
|
155
181
|
function defineMiddleware(middlewareDef) {
|
|
182
|
+
/**
|
|
183
|
+
* Creates a middleware definition with:
|
|
184
|
+
* - Anonymous id generation when omitted
|
|
185
|
+
* - `.with(config)` to create configured instances
|
|
186
|
+
* - `.everywhere()` to mark as global (optionally scoping to tasks/resources)
|
|
187
|
+
*/
|
|
156
188
|
const filePath = (0, getCallerFile_1.getCallerFile)();
|
|
157
189
|
const object = {
|
|
158
190
|
[defs_1.symbols.filePath]: filePath,
|
|
@@ -202,4 +234,43 @@ function isEvent(definition) {
|
|
|
202
234
|
function isMiddleware(definition) {
|
|
203
235
|
return definition && definition[defs_1.symbols.middleware];
|
|
204
236
|
}
|
|
237
|
+
function defineOverride(base, patch) {
|
|
238
|
+
const { id: _ignored, ...rest } = (patch || {});
|
|
239
|
+
// Ensure we never change the id, and merge overrides last
|
|
240
|
+
return {
|
|
241
|
+
...base,
|
|
242
|
+
...rest,
|
|
243
|
+
id: base.id,
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Creates a tag definition.
|
|
248
|
+
* - `.with(config)` to create configured instances
|
|
249
|
+
* - `.extract(tags)` to extract this tag from a list of tags
|
|
250
|
+
*/
|
|
251
|
+
function defineTag(definition) {
|
|
252
|
+
const id = definition.id;
|
|
253
|
+
return {
|
|
254
|
+
id,
|
|
255
|
+
with(tagConfig) {
|
|
256
|
+
return {
|
|
257
|
+
id,
|
|
258
|
+
tag: this,
|
|
259
|
+
config: tagConfig,
|
|
260
|
+
};
|
|
261
|
+
},
|
|
262
|
+
extract(target) {
|
|
263
|
+
const tags = Array.isArray(target) ? target : target?.meta?.tags || [];
|
|
264
|
+
for (const candidate of tags) {
|
|
265
|
+
if (typeof candidate === "string")
|
|
266
|
+
continue;
|
|
267
|
+
// Configured instance
|
|
268
|
+
if (candidate.id === id) {
|
|
269
|
+
return candidate;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
return null;
|
|
273
|
+
},
|
|
274
|
+
};
|
|
275
|
+
}
|
|
205
276
|
//# sourceMappingURL=define.js.map
|
package/dist/define.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define.js","sourceRoot":"","sources":["../src/define.ts"],"names":[],"mappings":";;
|
|
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,E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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"}
|
package/dist/defs.d.ts
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
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
|
+
/**
|
|
19
|
+
* Internal brand symbols used to tag created objects at runtime and help with
|
|
20
|
+
* type‑narrowing. Prefer the `isTask`/`isResource`/`isEvent`/`isMiddleware`
|
|
21
|
+
* helpers instead of touching these directly.
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
3
24
|
export declare const symbolTask: unique symbol;
|
|
4
25
|
export declare const symbolResource: unique symbol;
|
|
5
26
|
export declare const symbolResourceWithConfig: unique symbol;
|
|
@@ -9,10 +30,19 @@ export declare const symbolMiddlewareConfigured: unique symbol;
|
|
|
9
30
|
export declare const symbolMiddlewareGlobal: unique symbol;
|
|
10
31
|
export declare const symbolMiddlewareEverywhereTasks: unique symbol;
|
|
11
32
|
export declare const symbolMiddlewareEverywhereResources: unique symbol;
|
|
33
|
+
/** @internal Path to aid anonymous id generation and error messages */
|
|
12
34
|
export declare const symbolFilePath: unique symbol;
|
|
35
|
+
/** @internal Marks disposable instances */
|
|
13
36
|
export declare const symbolDispose: unique symbol;
|
|
37
|
+
/** @internal Link to internal Store */
|
|
14
38
|
export declare const symbolStore: unique symbol;
|
|
39
|
+
/** @internal Brand used by index() resources */
|
|
15
40
|
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
|
+
*/
|
|
16
46
|
export declare const symbols: {
|
|
17
47
|
task: symbol;
|
|
18
48
|
resource: symbol;
|
|
@@ -26,10 +56,72 @@ export declare const symbols: {
|
|
|
26
56
|
dispose: symbol;
|
|
27
57
|
store: symbol;
|
|
28
58
|
};
|
|
59
|
+
export interface ITagDefinition<TConfig = void> {
|
|
60
|
+
id: string | symbol;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* A configured instance of a tag as produced by `ITag.with()`.
|
|
64
|
+
*/
|
|
65
|
+
export interface ITagWithConfig<TConfig = void> {
|
|
66
|
+
id: string | symbol;
|
|
67
|
+
/** The tag definition used to produce this configured instance. */
|
|
68
|
+
tag: ITag<TConfig>;
|
|
69
|
+
/** The configuration captured for this tag instance. */
|
|
70
|
+
config: TConfig;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* A tag definition (builder). Use `.with(config)` to obtain configured instances,
|
|
74
|
+
* and `.extract(tags)` to find either a configured instance or the bare tag in a list.
|
|
75
|
+
*/
|
|
76
|
+
export interface ITag<TConfig = void> extends ITagDefinition<TConfig> {
|
|
77
|
+
/**
|
|
78
|
+
* Creates a configured instance of the tag.
|
|
79
|
+
*/
|
|
80
|
+
with(config: TConfig): ITagWithConfig<TConfig>;
|
|
81
|
+
/**
|
|
82
|
+
* Extracts either a configured instance or the bare tag from a list of tags
|
|
83
|
+
* or from a taggable object (`{ meta: { tags?: [] } }`).
|
|
84
|
+
*/
|
|
85
|
+
extract(target: TagType[] | ITaggable): ExtractedTagResult<TConfig> | null;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Restrict bare tags to those whose config can be omitted (void or optional object),
|
|
89
|
+
* mirroring the same principle used for resources in `RegisterableItems`.
|
|
90
|
+
* Required-config tags must appear as configured instances.
|
|
91
|
+
*/
|
|
92
|
+
export type TagType = string | ITag<void> | ITag<{
|
|
93
|
+
[K in any]?: any;
|
|
94
|
+
}> | ITagWithConfig<any>;
|
|
95
|
+
/**
|
|
96
|
+
* Conditional result type for `ITag.extract`:
|
|
97
|
+
* - For void config → just the identifier
|
|
98
|
+
* - For optional object config → identifier with optional config
|
|
99
|
+
* - For required config → identifier with required config
|
|
100
|
+
*/
|
|
101
|
+
export type ExtractedTagResult<TConfig> = {} extends TConfig ? {
|
|
102
|
+
id: string | symbol;
|
|
103
|
+
config?: TConfig;
|
|
104
|
+
} : {
|
|
105
|
+
id: string | symbol;
|
|
106
|
+
config: TConfig;
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* Any object that can carry tags via metadata. This mirrors how tasks,
|
|
110
|
+
* resources, events, and middleware expose `meta.tags`.
|
|
111
|
+
*/
|
|
112
|
+
export interface ITaggable {
|
|
113
|
+
meta?: {
|
|
114
|
+
tags?: TagType[];
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Common metadata you can attach to tasks/resources/events/middleware.
|
|
119
|
+
* Useful for docs, filtering and middleware decisions.
|
|
120
|
+
*/
|
|
29
121
|
export interface IMeta {
|
|
30
122
|
title?: string;
|
|
31
123
|
description?: string;
|
|
32
|
-
tags?:
|
|
124
|
+
tags?: TagType[];
|
|
33
125
|
}
|
|
34
126
|
export interface ITaskMeta extends IMeta {
|
|
35
127
|
}
|
|
@@ -39,27 +131,47 @@ export interface IEventMeta extends IMeta {
|
|
|
39
131
|
}
|
|
40
132
|
export interface IMiddlewareMeta extends IMeta {
|
|
41
133
|
}
|
|
134
|
+
/**
|
|
135
|
+
* A mapping of dependency keys to Runner definitions. Used in `dependencies`
|
|
136
|
+
* for tasks and resources. Values are later transformed into the actual
|
|
137
|
+
* callable/value shape by `DependencyValuesType`.
|
|
138
|
+
*/
|
|
42
139
|
export type DependencyMapType = Record<string, ITask<any, any, any, any> | IResource<any, any, any> | IEventDefinition<any>>;
|
|
43
140
|
type ExtractTaskInput<T> = T extends ITask<infer I, any, infer D> ? I : never;
|
|
44
141
|
type ExtractTaskOutput<T> = T extends ITask<any, infer O, infer D> ? O : never;
|
|
45
142
|
type ExtractResourceValue<T> = T extends IResource<any, infer V, infer D> ? V : never;
|
|
46
143
|
type ExtractEventParams<T> = T extends IEvent<infer P> ? P : never;
|
|
47
144
|
/**
|
|
48
|
-
*
|
|
145
|
+
* Task dependencies transform into callable functions: call with the task input
|
|
146
|
+
* and you receive the task output.
|
|
49
147
|
*/
|
|
50
148
|
type TaskDependency<I, O> = (...args: I extends null | void ? [] : [I]) => O;
|
|
51
149
|
/**
|
|
52
|
-
*
|
|
150
|
+
* Resource dependencies resolve to the resource's value directly.
|
|
53
151
|
*/
|
|
54
152
|
type ResourceDependency<V> = V;
|
|
55
153
|
/**
|
|
56
|
-
*
|
|
154
|
+
* Event dependencies resolve to an emitter function. If the payload type is
|
|
155
|
+
* `void`, the function can be called with zero args (or an empty object).
|
|
57
156
|
*/
|
|
58
157
|
type EventDependency<P> = P extends void ? (() => Promise<void>) & ((input?: Record<string, never>) => Promise<void>) : (input: P) => Promise<void>;
|
|
158
|
+
/**
|
|
159
|
+
* Transforms a dependency definition into the usable shape inside `run`/`init`:
|
|
160
|
+
* - Task -> callable function
|
|
161
|
+
* - Resource -> resolved value
|
|
162
|
+
* - Event -> emit function
|
|
163
|
+
*/
|
|
59
164
|
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
165
|
export type DependencyValuesType<T extends DependencyMapType> = {
|
|
61
166
|
[K in keyof T]: DependencyValueType<T[K]>;
|
|
62
167
|
};
|
|
168
|
+
/**
|
|
169
|
+
* Anything you can put inside a resource's `register: []`.
|
|
170
|
+
* - Resources (with or without `.with()`)
|
|
171
|
+
* - Tasks
|
|
172
|
+
* - Middleware
|
|
173
|
+
* - Events
|
|
174
|
+
*/
|
|
63
175
|
export type RegisterableItems<T = any> = IResourceWithConfig<any> | IResource<void, any, any, any> | IResource<{
|
|
64
176
|
[K in any]?: any;
|
|
65
177
|
}, any, any, any> | ITask<any, any, any, any> | IMiddleware<any> | IEvent<any>;
|
|
@@ -67,8 +179,17 @@ export type MiddlewareAttachments = IMiddleware<void> | IMiddleware<{
|
|
|
67
179
|
[K in any]?: any;
|
|
68
180
|
}> | IMiddlewareConfigured<any>;
|
|
69
181
|
export interface ITaskDefinition<TInput = any, TOutput extends Promise<any> = any, TDependencies extends DependencyMapType = {}, TOn extends "*" | IEventDefinition<any> | undefined = undefined> {
|
|
182
|
+
/**
|
|
183
|
+
* Stable identifier. If omitted, an anonymous id is generated from file path
|
|
184
|
+
* (see README: Anonymous IDs).
|
|
185
|
+
*/
|
|
70
186
|
id?: string | symbol;
|
|
187
|
+
/**
|
|
188
|
+
* Access other tasks/resources/events. Can be an object or a function when
|
|
189
|
+
* you need late or config‑dependent resolution.
|
|
190
|
+
*/
|
|
71
191
|
dependencies?: TDependencies | (() => TDependencies);
|
|
192
|
+
/** Middleware applied around task execution. */
|
|
72
193
|
middleware?: MiddlewareAttachments[];
|
|
73
194
|
/**
|
|
74
195
|
* Listen to events in a simple way
|
|
@@ -79,7 +200,12 @@ export interface ITaskDefinition<TInput = any, TOutput extends Promise<any> = an
|
|
|
79
200
|
* The event with the lowest order will be executed first.
|
|
80
201
|
*/
|
|
81
202
|
listenerOrder?: number;
|
|
203
|
+
/** Optional metadata used for docs, filtering and tooling. */
|
|
82
204
|
meta?: ITaskMeta;
|
|
205
|
+
/**
|
|
206
|
+
* The task body. If `on` is set, the input is an `IEventEmission`. Otherwise,
|
|
207
|
+
* it's the declared input type.
|
|
208
|
+
*/
|
|
83
209
|
run: (input: TOn extends undefined ? TInput : IEventEmission<TOn extends "*" ? any : ExtractEventParams<TOn>>, dependencies: DependencyValuesType<TDependencies>) => TOutput;
|
|
84
210
|
}
|
|
85
211
|
export type BeforeRunEventPayload<TInput> = {
|
|
@@ -122,9 +248,18 @@ export interface ITask<TInput = any, TOutput extends Promise<any> = any, TDepend
|
|
|
122
248
|
};
|
|
123
249
|
}
|
|
124
250
|
export interface IResourceDefinition<TConfig = any, TValue = unknown, TDependencies extends DependencyMapType = {}, TContext = any, THooks = any, TRegisterableItems = any> {
|
|
251
|
+
/** Stable identifier. Omit to get an anonymous id. */
|
|
125
252
|
id?: string | symbol;
|
|
253
|
+
/** Static or lazy dependency map. Receives `config` when provided. */
|
|
126
254
|
dependencies?: TDependencies | ((config: TConfig) => TDependencies);
|
|
255
|
+
/**
|
|
256
|
+
* Register other registerables (resources/tasks/middleware/events). Accepts a
|
|
257
|
+
* static array or a function of `config` to support dynamic wiring.
|
|
258
|
+
*/
|
|
127
259
|
register?: Array<RegisterableItems> | ((config: TConfig) => Array<RegisterableItems>);
|
|
260
|
+
/**
|
|
261
|
+
* Initialize and return the resource value. Called once during boot.
|
|
262
|
+
*/
|
|
128
263
|
init?: (this: any, config: TConfig, dependencies: DependencyValuesType<TDependencies>, context: TContext) => Promise<TValue>;
|
|
129
264
|
/**
|
|
130
265
|
* Clean-up function for the resource. This is called when the resource is no longer needed.
|
|
@@ -136,8 +271,16 @@ export interface IResourceDefinition<TConfig = any, TValue = unknown, TDependenc
|
|
|
136
271
|
*/
|
|
137
272
|
dispose?: (this: any, value: TValue, config: TConfig, dependencies: DependencyValuesType<TDependencies>, context: TContext) => Promise<void>;
|
|
138
273
|
meta?: IResourceMeta;
|
|
274
|
+
/**
|
|
275
|
+
* Safe overrides to swap behavior while preserving identities. See
|
|
276
|
+
* README: Overrides.
|
|
277
|
+
*/
|
|
139
278
|
overrides?: Array<IResource | ITask | IMiddleware | IResourceWithConfig>;
|
|
279
|
+
/** Middleware applied around init/dispose. */
|
|
140
280
|
middleware?: MiddlewareAttachments[];
|
|
281
|
+
/**
|
|
282
|
+
* Create a private, mutable context shared between `init` and `dispose`.
|
|
283
|
+
*/
|
|
141
284
|
context?: () => TContext;
|
|
142
285
|
/**
|
|
143
286
|
* This is optional and used from an index resource to get the correct caller.
|
|
@@ -164,12 +307,16 @@ export interface IResource<TConfig = void, TValue = any, TDependencies extends D
|
|
|
164
307
|
middleware: MiddlewareAttachments[];
|
|
165
308
|
}
|
|
166
309
|
export interface IResourceWithConfig<TConfig = any, TValue = any, TDependencies extends DependencyMapType = any> {
|
|
310
|
+
/** The id of the underlying resource. */
|
|
167
311
|
id: string;
|
|
312
|
+
/** The underlying resource definition. */
|
|
168
313
|
resource: IResource<TConfig, TValue, TDependencies>;
|
|
314
|
+
/** The configuration captured by `.with(config)`. */
|
|
169
315
|
config: TConfig;
|
|
170
316
|
}
|
|
171
317
|
export type EventHandlerType<T = any> = (event: IEventEmission<T>) => any | Promise<any>;
|
|
172
318
|
export interface IEventDefinition<TPayload = void> {
|
|
319
|
+
/** Stable identifier. Omit to get an anonymous id. */
|
|
173
320
|
id?: string | symbol;
|
|
174
321
|
meta?: IEventMeta;
|
|
175
322
|
}
|
|
@@ -215,8 +362,13 @@ export interface IEventEmission<TPayload = any> {
|
|
|
215
362
|
isPropagationStopped(): boolean;
|
|
216
363
|
}
|
|
217
364
|
export interface IMiddlewareDefinition<TConfig = any, TDependencies extends DependencyMapType = any> {
|
|
365
|
+
/** Stable identifier. Omit to get an anonymous id. */
|
|
218
366
|
id?: string | symbol;
|
|
367
|
+
/** Static or lazy dependency map. */
|
|
219
368
|
dependencies?: TDependencies | ((config: TConfig) => TDependencies);
|
|
369
|
+
/**
|
|
370
|
+
* The middleware body, called with task/resource execution input.
|
|
371
|
+
*/
|
|
220
372
|
run: (input: IMiddlewareExecutionInput, dependencies: DependencyValuesType<TDependencies>, config: TConfig) => Promise<any>;
|
|
221
373
|
meta?: IMiddlewareMeta;
|
|
222
374
|
}
|
|
@@ -227,8 +379,13 @@ export interface IMiddleware<TConfig = any, TDependencies extends DependencyMapT
|
|
|
227
379
|
[symbolMiddlewareEverywhereResources]?: boolean;
|
|
228
380
|
id: string | symbol;
|
|
229
381
|
dependencies: TDependencies | (() => TDependencies);
|
|
382
|
+
/**
|
|
383
|
+
* Attach this middleware globally. Use options to scope to tasks/resources.
|
|
384
|
+
*/
|
|
230
385
|
everywhere(config?: MiddlewareEverywhereOptions): IMiddleware<TConfig, TDependencies>;
|
|
386
|
+
/** Current configuration object (empty by default). */
|
|
231
387
|
config: TConfig;
|
|
388
|
+
/** Configure the middleware and return a marked, configured instance. */
|
|
232
389
|
with: (config: TConfig) => IMiddlewareConfigured<TConfig, TDependencies>;
|
|
233
390
|
}
|
|
234
391
|
export interface IMiddlewareConfigured<TConfig = any, TDependencies extends DependencyMapType = any> extends IMiddleware<TConfig, TDependencies> {
|
|
@@ -239,10 +396,12 @@ export interface IMiddlewareDefinitionConfigured<C extends Record<string, any> =
|
|
|
239
396
|
config?: C;
|
|
240
397
|
}
|
|
241
398
|
export interface IMiddlewareExecutionInput<TTaskInput = any, TResourceConfig = any> {
|
|
399
|
+
/** Task hook: present when wrapping a task run. */
|
|
242
400
|
task?: {
|
|
243
401
|
definition: ITask<TTaskInput>;
|
|
244
402
|
input: TTaskInput;
|
|
245
403
|
};
|
|
404
|
+
/** Resource hook: present when wrapping init/dispose. */
|
|
246
405
|
resource?: {
|
|
247
406
|
definition: IResource<TResourceConfig>;
|
|
248
407
|
config: TResourceConfig;
|
package/dist/defs.js
CHANGED
|
@@ -1,6 +1,27 @@
|
|
|
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
|
+
*/
|
|
2
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
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;
|
|
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
|
+
*/
|
|
4
25
|
exports.symbolTask = Symbol("runner.task");
|
|
5
26
|
exports.symbolResource = Symbol("runner.resource");
|
|
6
27
|
exports.symbolResourceWithConfig = Symbol("runner.resourceWithConfig");
|
|
@@ -10,10 +31,19 @@ exports.symbolMiddlewareConfigured = Symbol("runner.middlewareConfigured");
|
|
|
10
31
|
exports.symbolMiddlewareGlobal = Symbol("runner.middlewareGlobal");
|
|
11
32
|
exports.symbolMiddlewareEverywhereTasks = Symbol("runner.middlewareGlobalTasks");
|
|
12
33
|
exports.symbolMiddlewareEverywhereResources = Symbol("runner.middlewareGlobalResources");
|
|
34
|
+
/** @internal Path to aid anonymous id generation and error messages */
|
|
13
35
|
exports.symbolFilePath = Symbol("runner.filePath");
|
|
36
|
+
/** @internal Marks disposable instances */
|
|
14
37
|
exports.symbolDispose = Symbol("runner.dispose");
|
|
38
|
+
/** @internal Link to internal Store */
|
|
15
39
|
exports.symbolStore = Symbol("runner.store");
|
|
40
|
+
/** @internal Brand used by index() resources */
|
|
16
41
|
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
|
+
*/
|
|
17
47
|
exports.symbols = {
|
|
18
48
|
task: exports.symbolTask,
|
|
19
49
|
resource: exports.symbolResource,
|
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;;;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;;;;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,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 {};
|