@bluelibs/runner 4.5.0-alpha → 4.5.0-alpha.2
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/dist/index.cjs +4265 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.mts +1734 -0
- package/dist/index.d.ts +1696 -45
- package/dist/index.mjs +4233 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +11 -14
- package/dist/context.d.ts +0 -29
- package/dist/context.js +0 -52
- package/dist/context.js.map +0 -1
- package/dist/define.d.ts +0 -9
- package/dist/define.js +0 -32
- package/dist/define.js.map +0 -1
- package/dist/definers/defineEvent.d.ts +0 -2
- package/dist/definers/defineEvent.js +0 -23
- package/dist/definers/defineEvent.js.map +0 -1
- package/dist/definers/defineHook.d.ts +0 -6
- package/dist/definers/defineHook.js +0 -24
- package/dist/definers/defineHook.js.map +0 -1
- package/dist/definers/defineOverride.d.ts +0 -14
- package/dist/definers/defineOverride.js +0 -13
- package/dist/definers/defineOverride.js.map +0 -1
- package/dist/definers/defineResource.d.ts +0 -2
- package/dist/definers/defineResource.js +0 -69
- package/dist/definers/defineResource.js.map +0 -1
- package/dist/definers/defineResourceMiddleware.d.ts +0 -2
- package/dist/definers/defineResourceMiddleware.js +0 -42
- package/dist/definers/defineResourceMiddleware.js.map +0 -1
- package/dist/definers/defineTag.d.ts +0 -12
- package/dist/definers/defineTag.js +0 -107
- package/dist/definers/defineTag.js.map +0 -1
- package/dist/definers/defineTask.d.ts +0 -15
- package/dist/definers/defineTask.js +0 -42
- package/dist/definers/defineTask.js.map +0 -1
- package/dist/definers/defineTaskMiddleware.d.ts +0 -2
- package/dist/definers/defineTaskMiddleware.js +0 -42
- package/dist/definers/defineTaskMiddleware.js.map +0 -1
- package/dist/definers/tools.d.ts +0 -45
- package/dist/definers/tools.js +0 -75
- package/dist/definers/tools.js.map +0 -1
- package/dist/defs.d.ts +0 -29
- package/dist/defs.js +0 -45
- package/dist/defs.js.map +0 -1
- package/dist/errors.d.ts +0 -96
- package/dist/errors.js +0 -178
- package/dist/errors.js.map +0 -1
- package/dist/globals/globalEvents.d.ts +0 -17
- package/dist/globals/globalEvents.js +0 -33
- package/dist/globals/globalEvents.js.map +0 -1
- package/dist/globals/globalMiddleware.d.ts +0 -31
- package/dist/globals/globalMiddleware.js +0 -25
- package/dist/globals/globalMiddleware.js.map +0 -1
- package/dist/globals/globalResources.d.ts +0 -30
- package/dist/globals/globalResources.js +0 -55
- package/dist/globals/globalResources.js.map +0 -1
- package/dist/globals/globalTags.d.ts +0 -9
- package/dist/globals/globalTags.js +0 -23
- package/dist/globals/globalTags.js.map +0 -1
- package/dist/globals/middleware/cache.middleware.d.ts +0 -27
- package/dist/globals/middleware/cache.middleware.js +0 -73
- package/dist/globals/middleware/cache.middleware.js.map +0 -1
- package/dist/globals/middleware/requireContext.middleware.d.ts +0 -6
- package/dist/globals/middleware/requireContext.middleware.js +0 -16
- package/dist/globals/middleware/requireContext.middleware.js.map +0 -1
- package/dist/globals/middleware/retry.middleware.d.ts +0 -21
- package/dist/globals/middleware/retry.middleware.js +0 -61
- package/dist/globals/middleware/retry.middleware.js.map +0 -1
- package/dist/globals/middleware/timeout.middleware.d.ts +0 -9
- package/dist/globals/middleware/timeout.middleware.js +0 -61
- package/dist/globals/middleware/timeout.middleware.js.map +0 -1
- package/dist/globals/resources/debug/debug.resource.d.ts +0 -7
- package/dist/globals/resources/debug/debug.resource.js +0 -29
- package/dist/globals/resources/debug/debug.resource.js.map +0 -1
- package/dist/globals/resources/debug/debug.tag.d.ts +0 -2
- package/dist/globals/resources/debug/debug.tag.js +0 -12
- package/dist/globals/resources/debug/debug.tag.js.map +0 -1
- package/dist/globals/resources/debug/debugConfig.resource.d.ts +0 -22
- package/dist/globals/resources/debug/debugConfig.resource.js +0 -20
- package/dist/globals/resources/debug/debugConfig.resource.js.map +0 -1
- package/dist/globals/resources/debug/executionTracker.middleware.d.ts +0 -50
- package/dist/globals/resources/debug/executionTracker.middleware.js +0 -78
- package/dist/globals/resources/debug/executionTracker.middleware.js.map +0 -1
- package/dist/globals/resources/debug/globalEvent.hook.d.ts +0 -27
- package/dist/globals/resources/debug/globalEvent.hook.js +0 -38
- package/dist/globals/resources/debug/globalEvent.hook.js.map +0 -1
- package/dist/globals/resources/debug/hook.hook.d.ts +0 -30
- package/dist/globals/resources/debug/hook.hook.js +0 -48
- package/dist/globals/resources/debug/hook.hook.js.map +0 -1
- package/dist/globals/resources/debug/index.d.ts +0 -6
- package/dist/globals/resources/debug/index.js +0 -23
- package/dist/globals/resources/debug/index.js.map +0 -1
- package/dist/globals/resources/debug/middleware.hook.d.ts +0 -30
- package/dist/globals/resources/debug/middleware.hook.js +0 -75
- package/dist/globals/resources/debug/middleware.hook.js.map +0 -1
- package/dist/globals/resources/debug/types.d.ts +0 -25
- package/dist/globals/resources/debug/types.js +0 -65
- package/dist/globals/resources/debug/types.js.map +0 -1
- package/dist/globals/resources/debug/utils.d.ts +0 -2
- package/dist/globals/resources/debug/utils.js +0 -13
- package/dist/globals/resources/debug/utils.js.map +0 -1
- package/dist/globals/resources/queue.resource.d.ts +0 -10
- package/dist/globals/resources/queue.resource.js +0 -31
- package/dist/globals/resources/queue.resource.js.map +0 -1
- package/dist/globals/types.d.ts +0 -1
- package/dist/globals/types.js +0 -18
- package/dist/globals/types.js.map +0 -1
- package/dist/index.js +0 -48
- package/dist/index.js.map +0 -1
- package/dist/models/DependencyProcessor.d.ts +0 -48
- package/dist/models/DependencyProcessor.js +0 -276
- package/dist/models/DependencyProcessor.js.map +0 -1
- package/dist/models/EventManager.d.ts +0 -153
- package/dist/models/EventManager.js +0 -421
- package/dist/models/EventManager.js.map +0 -1
- package/dist/models/LogPrinter.d.ts +0 -55
- package/dist/models/LogPrinter.js +0 -202
- package/dist/models/LogPrinter.js.map +0 -1
- package/dist/models/Logger.d.ts +0 -85
- package/dist/models/Logger.js +0 -194
- package/dist/models/Logger.js.map +0 -1
- package/dist/models/MiddlewareManager.d.ts +0 -86
- package/dist/models/MiddlewareManager.js +0 -391
- package/dist/models/MiddlewareManager.js.map +0 -1
- package/dist/models/OverrideManager.d.ts +0 -13
- package/dist/models/OverrideManager.js +0 -84
- package/dist/models/OverrideManager.js.map +0 -1
- package/dist/models/Queue.d.ts +0 -25
- package/dist/models/Queue.js +0 -56
- package/dist/models/Queue.js.map +0 -1
- package/dist/models/ResourceInitializer.d.ts +0 -20
- package/dist/models/ResourceInitializer.js +0 -34
- package/dist/models/ResourceInitializer.js.map +0 -1
- package/dist/models/RunResult.d.ts +0 -35
- package/dist/models/RunResult.js +0 -62
- package/dist/models/RunResult.js.map +0 -1
- package/dist/models/Semaphore.d.ts +0 -61
- package/dist/models/Semaphore.js +0 -164
- package/dist/models/Semaphore.js.map +0 -1
- package/dist/models/Store.d.ts +0 -56
- package/dist/models/Store.js +0 -209
- package/dist/models/Store.js.map +0 -1
- package/dist/models/StoreRegistry.d.ts +0 -43
- package/dist/models/StoreRegistry.js +0 -375
- package/dist/models/StoreRegistry.js.map +0 -1
- package/dist/models/StoreValidator.d.ts +0 -8
- package/dist/models/StoreValidator.js +0 -73
- package/dist/models/StoreValidator.js.map +0 -1
- package/dist/models/TaskRunner.d.ts +0 -27
- package/dist/models/TaskRunner.js +0 -53
- package/dist/models/TaskRunner.js.map +0 -1
- package/dist/models/UnhandledError.d.ts +0 -11
- package/dist/models/UnhandledError.js +0 -32
- package/dist/models/UnhandledError.js.map +0 -1
- package/dist/models/index.d.ts +0 -11
- package/dist/models/index.js +0 -28
- package/dist/models/index.js.map +0 -1
- package/dist/models/utils/findCircularDependencies.d.ts +0 -16
- package/dist/models/utils/findCircularDependencies.js +0 -45
- package/dist/models/utils/findCircularDependencies.js.map +0 -1
- package/dist/models/utils/safeStringify.d.ts +0 -3
- package/dist/models/utils/safeStringify.js +0 -45
- package/dist/models/utils/safeStringify.js.map +0 -1
- package/dist/platform/browser.d.ts +0 -15
- package/dist/platform/browser.js +0 -98
- package/dist/platform/browser.js.map +0 -1
- package/dist/platform/index.d.ts +0 -8
- package/dist/platform/index.js +0 -47
- package/dist/platform/index.js.map +0 -1
- package/dist/platform/node.d.ts +0 -11
- package/dist/platform/node.js +0 -45
- package/dist/platform/node.js.map +0 -1
- package/dist/platform/types.d.ts +0 -28
- package/dist/platform/types.js +0 -19
- package/dist/platform/types.js.map +0 -1
- package/dist/platform/universal.d.ts +0 -16
- package/dist/platform/universal.js +0 -57
- package/dist/platform/universal.js.map +0 -1
- package/dist/processHooks.d.ts +0 -2
- package/dist/processHooks.js +0 -79
- package/dist/processHooks.js.map +0 -1
- package/dist/run.d.ts +0 -14
- package/dist/run.js +0 -126
- package/dist/run.js.map +0 -1
- package/dist/testing.d.ts +0 -25
- package/dist/testing.js +0 -42
- package/dist/testing.js.map +0 -1
- package/dist/tools/getCallerFile.d.ts +0 -1
- package/dist/tools/getCallerFile.js +0 -30
- package/dist/tools/getCallerFile.js.map +0 -1
- package/dist/types/contracts.d.ts +0 -55
- package/dist/types/contracts.js +0 -4
- package/dist/types/contracts.js.map +0 -1
- package/dist/types/event.d.ts +0 -74
- package/dist/types/event.js +0 -17
- package/dist/types/event.js.map +0 -1
- package/dist/types/hook.d.ts +0 -23
- package/dist/types/hook.js +0 -4
- package/dist/types/hook.js.map +0 -1
- package/dist/types/meta.d.ts +0 -18
- package/dist/types/meta.js +0 -7
- package/dist/types/meta.js.map +0 -1
- package/dist/types/resource.d.ts +0 -84
- package/dist/types/resource.js +0 -4
- package/dist/types/resource.js.map +0 -1
- package/dist/types/resourceMiddleware.d.ts +0 -47
- package/dist/types/resourceMiddleware.js +0 -4
- package/dist/types/resourceMiddleware.js.map +0 -1
- package/dist/types/runner.d.ts +0 -55
- package/dist/types/runner.js +0 -3
- package/dist/types/runner.js.map +0 -1
- package/dist/types/storeTypes.d.ts +0 -40
- package/dist/types/storeTypes.js +0 -3
- package/dist/types/storeTypes.js.map +0 -1
- package/dist/types/symbols.d.ts +0 -30
- package/dist/types/symbols.js +0 -40
- package/dist/types/symbols.js.map +0 -1
- package/dist/types/tag.d.ts +0 -46
- package/dist/types/tag.js +0 -4
- package/dist/types/tag.js.map +0 -1
- package/dist/types/task.d.ts +0 -44
- package/dist/types/task.js +0 -4
- package/dist/types/task.js.map +0 -1
- package/dist/types/taskMiddleware.d.ts +0 -48
- package/dist/types/taskMiddleware.js +0 -4
- package/dist/types/taskMiddleware.js.map +0 -1
- package/dist/types/utilities.d.ts +0 -110
- package/dist/types/utilities.js +0 -19
- package/dist/types/utilities.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,22 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bluelibs/runner",
|
|
3
|
-
"version": "4.5.0-alpha",
|
|
3
|
+
"version": "4.5.0-alpha.2",
|
|
4
4
|
"description": "BlueLibs Runner",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
5
|
+
"sideEffects": false,
|
|
6
|
+
"main": "dist/index.cjs",
|
|
7
|
+
"module": "dist/index.mjs",
|
|
7
8
|
"types": "dist/index.d.ts",
|
|
8
9
|
"exports": {
|
|
9
10
|
".": {
|
|
10
11
|
"types": "./dist/index.d.ts",
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"default": "./dist/index.
|
|
14
|
-
},
|
|
15
|
-
"./platform": {
|
|
16
|
-
"types": "./dist/platform/index.d.ts",
|
|
17
|
-
"node": "./dist/platform/node.js",
|
|
18
|
-
"browser": "./dist/platform/browser.js",
|
|
19
|
-
"default": "./dist/platform/index.js"
|
|
12
|
+
"import": "./dist/index.mjs",
|
|
13
|
+
"require": "./dist/index.cjs",
|
|
14
|
+
"default": "./dist/index.mjs"
|
|
20
15
|
}
|
|
21
16
|
},
|
|
22
17
|
"repository": {
|
|
@@ -24,9 +19,9 @@
|
|
|
24
19
|
"url": "https://github.com/bluelibs/bluelibs"
|
|
25
20
|
},
|
|
26
21
|
"scripts": {
|
|
27
|
-
"build": "
|
|
22
|
+
"build": "tsup --config tsup.config.ts --sourcemap",
|
|
28
23
|
"clean": "rm -rf dist",
|
|
29
|
-
"watch": "
|
|
24
|
+
"watch": "tsup --config tsup.config.ts --watch",
|
|
30
25
|
"test": "jest --verbose --runInBand",
|
|
31
26
|
"test:dev": "jest --verbose --watch",
|
|
32
27
|
"coverage": "jest --verbose --coverage",
|
|
@@ -54,12 +49,14 @@
|
|
|
54
49
|
"eslint-plugin-prettier": "3.1.1",
|
|
55
50
|
"express": "^5.1.0",
|
|
56
51
|
"jest": "^29.0.0",
|
|
52
|
+
"jest-environment-jsdom": "^30.1.2",
|
|
57
53
|
"jest-junit": "^10.0.0",
|
|
58
54
|
"prettier": "^2.0.5",
|
|
59
55
|
"reflect-metadata": "^0.2.2",
|
|
60
56
|
"source-map-support": "^0.5.13",
|
|
61
57
|
"tailwindcss": "^4.1.12",
|
|
62
58
|
"ts-jest": "^29.0.0",
|
|
59
|
+
"tsup": "^8.0.0",
|
|
63
60
|
"typedoc": "^0.26.7",
|
|
64
61
|
"typedoc-material-theme": "^1.1.0",
|
|
65
62
|
"typedoc-plugin-pages": "^1.1.0",
|
package/dist/context.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { ITaskMiddlewareConfigured } from "./defs";
|
|
2
|
-
import { ContextError } from "./errors";
|
|
3
|
-
export { ContextError };
|
|
4
|
-
/**
|
|
5
|
-
* The generic Context object returned by `createContext`.
|
|
6
|
-
*/
|
|
7
|
-
export interface Context<T> {
|
|
8
|
-
/** unique symbol used as key in the AsyncLocalStorage map */
|
|
9
|
-
readonly id: symbol;
|
|
10
|
-
/** Retrieve the current context value or throw */
|
|
11
|
-
use(): T;
|
|
12
|
-
/**
|
|
13
|
-
* Provide a value for this context during the lifetime of `fn()`
|
|
14
|
-
*/
|
|
15
|
-
provide<R>(value: T, fn: () => Promise<R> | R): Promise<R> | R;
|
|
16
|
-
/**
|
|
17
|
-
* Generates a middleware that guarantees the context exists (and optionally
|
|
18
|
-
* enforces that certain keys are present on the context object).
|
|
19
|
-
*/
|
|
20
|
-
require<K extends keyof T = never>(keys?: K[]): ITaskMiddlewareConfigured<{
|
|
21
|
-
context: Context<T>;
|
|
22
|
-
}>;
|
|
23
|
-
}
|
|
24
|
-
export declare const storage: import("./platform").IAsyncLocalStorage<Map<symbol, unknown>>;
|
|
25
|
-
/**
|
|
26
|
-
* Create a new typed Context. The result contains helpers similar to React’s
|
|
27
|
-
* Context API but adapted for async usage in Runner.
|
|
28
|
-
*/
|
|
29
|
-
export declare function createContext<T>(name?: string): Context<T>;
|
package/dist/context.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.storage = exports.ContextError = void 0;
|
|
4
|
-
exports.createContext = createContext;
|
|
5
|
-
const platform_1 = require("./platform");
|
|
6
|
-
const requireContext_middleware_1 = require("./globals/middleware/requireContext.middleware");
|
|
7
|
-
const errors_1 = require("./errors");
|
|
8
|
-
Object.defineProperty(exports, "ContextError", { enumerable: true, get: function () { return errors_1.ContextError; } });
|
|
9
|
-
// The internal storage maps Context identifiers (symbols) to their values
|
|
10
|
-
const platform = (0, platform_1.getPlatform)();
|
|
11
|
-
exports.storage = platform.createAsyncLocalStorage();
|
|
12
|
-
/** Returns the currently active store or undefined. */
|
|
13
|
-
function getCurrentStore() {
|
|
14
|
-
return exports.storage.getStore();
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Create a new typed Context. The result contains helpers similar to React’s
|
|
18
|
-
* Context API but adapted for async usage in Runner.
|
|
19
|
-
*/
|
|
20
|
-
function createContext(name = "runner.context") {
|
|
21
|
-
const ctxId = Symbol(name);
|
|
22
|
-
function use() {
|
|
23
|
-
const store = getCurrentStore();
|
|
24
|
-
if (!store || !store.has(ctxId)) {
|
|
25
|
-
throw new errors_1.ContextError(`Context not available for symbol ${ctxId.toString()}`);
|
|
26
|
-
}
|
|
27
|
-
return store.get(ctxId);
|
|
28
|
-
}
|
|
29
|
-
function provide(value, fn) {
|
|
30
|
-
const currentStore = getCurrentStore();
|
|
31
|
-
const map = currentStore
|
|
32
|
-
? new Map(currentStore)
|
|
33
|
-
: new Map();
|
|
34
|
-
map.set(ctxId, value);
|
|
35
|
-
return exports.storage.run(map, fn);
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Generates a middleware that guarantees the context exists (and optionally
|
|
39
|
-
* enforces that certain keys are present on the context object).
|
|
40
|
-
* @throws {ContextError} if the context is not available
|
|
41
|
-
*/
|
|
42
|
-
function require() {
|
|
43
|
-
return requireContext_middleware_1.requireContextTaskMiddleware.with({ context: this });
|
|
44
|
-
}
|
|
45
|
-
return {
|
|
46
|
-
id: ctxId,
|
|
47
|
-
use,
|
|
48
|
-
provide,
|
|
49
|
-
require,
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
//# sourceMappingURL=context.js.map
|
package/dist/context.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":";;;AAwCA,sCAsCC;AA9ED,yCAAyC;AAEzC,8FAA8F;AAC9F,qCAAwC;AAE/B,6FAFA,qBAAY,OAEA;AAsBrB,0EAA0E;AAC1E,MAAM,QAAQ,GAAG,IAAA,sBAAW,GAAE,CAAC;AAClB,QAAA,OAAO,GAAG,QAAQ,CAAC,uBAAuB,EAAwB,CAAC;AAEhF,uDAAuD;AACvD,SAAS,eAAe;IACtB,OAAO,eAAO,CAAC,QAAQ,EAAE,CAAC;AAC5B,CAAC;AAED;;;GAGG;AACH,SAAgB,aAAa,CAAI,OAAe,gBAAgB;IAC9D,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;IAE3B,SAAS,GAAG;QACV,MAAM,KAAK,GAAG,eAAe,EAAE,CAAC;QAChC,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;YAChC,MAAM,IAAI,qBAAY,CACpB,oCAAoC,KAAK,CAAC,QAAQ,EAAE,EAAE,CACvD,CAAC;QACJ,CAAC;QACD,OAAO,KAAK,CAAC,GAAG,CAAC,KAAK,CAAM,CAAC;IAC/B,CAAC;IAED,SAAS,OAAO,CAAI,KAAQ,EAAE,EAAwB;QACpD,MAAM,YAAY,GAAG,eAAe,EAAE,CAAC;QACvC,MAAM,GAAG,GAAG,YAAY;YACtB,CAAC,CAAC,IAAI,GAAG,CAAC,YAAY,CAAC;YACvB,CAAC,CAAC,IAAI,GAAG,EAAmB,CAAC;QAC/B,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QAEtB,OAAO,eAAO,CAAC,GAAG,CAAC,GAAG,EAAE,EAAS,CAAC,CAAC;IACrC,CAAC;IAED;;;;OAIG;IACH,SAAS,OAAO;QACd,OAAO,wDAA4B,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAkB,EAAE,CAAC,CAAC;IAC5E,CAAC;IAED,OAAO;QACL,EAAE,EAAE,KAAK;QACT,GAAG;QACH,OAAO;QACP,OAAO;KACR,CAAC;AACJ,CAAC"}
|
package/dist/define.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export { defineTask } from "./definers/defineTask";
|
|
2
|
-
export { defineHook } from "./definers/defineHook";
|
|
3
|
-
export { defineResource } from "./definers/defineResource";
|
|
4
|
-
export { defineEvent } from "./definers/defineEvent";
|
|
5
|
-
export { defineTaskMiddleware } from "./definers/defineTaskMiddleware";
|
|
6
|
-
export { defineResourceMiddleware } from "./definers/defineResourceMiddleware";
|
|
7
|
-
export { defineOverride } from "./definers/defineOverride";
|
|
8
|
-
export { defineTag } from "./definers/defineTag";
|
|
9
|
-
export { isTask, isResource, isResourceWithConfig, isEvent, isHook, isTaskMiddleware, isResourceMiddleware, isTag, isOptional, } from "./definers/tools";
|
package/dist/define.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isOptional = exports.isTag = exports.isResourceMiddleware = exports.isTaskMiddleware = exports.isHook = exports.isEvent = exports.isResourceWithConfig = exports.isResource = exports.isTask = exports.defineTag = exports.defineOverride = exports.defineResourceMiddleware = exports.defineTaskMiddleware = exports.defineEvent = exports.defineResource = exports.defineHook = exports.defineTask = void 0;
|
|
4
|
-
// Re-export all define functions from their separate files
|
|
5
|
-
var defineTask_1 = require("./definers/defineTask");
|
|
6
|
-
Object.defineProperty(exports, "defineTask", { enumerable: true, get: function () { return defineTask_1.defineTask; } });
|
|
7
|
-
var defineHook_1 = require("./definers/defineHook");
|
|
8
|
-
Object.defineProperty(exports, "defineHook", { enumerable: true, get: function () { return defineHook_1.defineHook; } });
|
|
9
|
-
var defineResource_1 = require("./definers/defineResource");
|
|
10
|
-
Object.defineProperty(exports, "defineResource", { enumerable: true, get: function () { return defineResource_1.defineResource; } });
|
|
11
|
-
var defineEvent_1 = require("./definers/defineEvent");
|
|
12
|
-
Object.defineProperty(exports, "defineEvent", { enumerable: true, get: function () { return defineEvent_1.defineEvent; } });
|
|
13
|
-
var defineTaskMiddleware_1 = require("./definers/defineTaskMiddleware");
|
|
14
|
-
Object.defineProperty(exports, "defineTaskMiddleware", { enumerable: true, get: function () { return defineTaskMiddleware_1.defineTaskMiddleware; } });
|
|
15
|
-
var defineResourceMiddleware_1 = require("./definers/defineResourceMiddleware");
|
|
16
|
-
Object.defineProperty(exports, "defineResourceMiddleware", { enumerable: true, get: function () { return defineResourceMiddleware_1.defineResourceMiddleware; } });
|
|
17
|
-
var defineOverride_1 = require("./definers/defineOverride");
|
|
18
|
-
Object.defineProperty(exports, "defineOverride", { enumerable: true, get: function () { return defineOverride_1.defineOverride; } });
|
|
19
|
-
var defineTag_1 = require("./definers/defineTag");
|
|
20
|
-
Object.defineProperty(exports, "defineTag", { enumerable: true, get: function () { return defineTag_1.defineTag; } });
|
|
21
|
-
// Re-export type guards and utility functions
|
|
22
|
-
var tools_1 = require("./definers/tools");
|
|
23
|
-
Object.defineProperty(exports, "isTask", { enumerable: true, get: function () { return tools_1.isTask; } });
|
|
24
|
-
Object.defineProperty(exports, "isResource", { enumerable: true, get: function () { return tools_1.isResource; } });
|
|
25
|
-
Object.defineProperty(exports, "isResourceWithConfig", { enumerable: true, get: function () { return tools_1.isResourceWithConfig; } });
|
|
26
|
-
Object.defineProperty(exports, "isEvent", { enumerable: true, get: function () { return tools_1.isEvent; } });
|
|
27
|
-
Object.defineProperty(exports, "isHook", { enumerable: true, get: function () { return tools_1.isHook; } });
|
|
28
|
-
Object.defineProperty(exports, "isTaskMiddleware", { enumerable: true, get: function () { return tools_1.isTaskMiddleware; } });
|
|
29
|
-
Object.defineProperty(exports, "isResourceMiddleware", { enumerable: true, get: function () { return tools_1.isResourceMiddleware; } });
|
|
30
|
-
Object.defineProperty(exports, "isTag", { enumerable: true, get: function () { return tools_1.isTag; } });
|
|
31
|
-
Object.defineProperty(exports, "isOptional", { enumerable: true, get: function () { return tools_1.isOptional; } });
|
|
32
|
-
//# sourceMappingURL=define.js.map
|
package/dist/define.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"define.js","sourceRoot":"","sources":["../src/define.ts"],"names":[],"mappings":";;;AAAA,2DAA2D;AAC3D,oDAAmD;AAA1C,wGAAA,UAAU,OAAA;AACnB,oDAAmD;AAA1C,wGAAA,UAAU,OAAA;AACnB,4DAA2D;AAAlD,gHAAA,cAAc,OAAA;AACvB,sDAAqD;AAA5C,0GAAA,WAAW,OAAA;AACpB,wEAAuE;AAA9D,4HAAA,oBAAoB,OAAA;AAC7B,gFAA+E;AAAtE,oIAAA,wBAAwB,OAAA;AACjC,4DAA2D;AAAlD,gHAAA,cAAc,OAAA;AACvB,kDAAiD;AAAxC,sGAAA,SAAS,OAAA;AAElB,8CAA8C;AAC9C,0CAU0B;AATxB,+FAAA,MAAM,OAAA;AACN,mGAAA,UAAU,OAAA;AACV,6GAAA,oBAAoB,OAAA;AACpB,gGAAA,OAAO,OAAA;AACP,+FAAA,MAAM,OAAA;AACN,yGAAA,gBAAgB,OAAA;AAChB,6GAAA,oBAAoB,OAAA;AACpB,8FAAA,KAAK,OAAA;AACL,mGAAA,UAAU,OAAA"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.defineEvent = defineEvent;
|
|
4
|
-
const defs_1 = require("../defs");
|
|
5
|
-
const getCallerFile_1 = require("../tools/getCallerFile");
|
|
6
|
-
function defineEvent(config) {
|
|
7
|
-
const callerFilePath = (0, getCallerFile_1.getCallerFile)();
|
|
8
|
-
const eventConfig = config;
|
|
9
|
-
return {
|
|
10
|
-
...eventConfig,
|
|
11
|
-
id: eventConfig.id,
|
|
12
|
-
[defs_1.symbolFilePath]: callerFilePath,
|
|
13
|
-
[defs_1.symbolEvent]: true, // This is a workaround
|
|
14
|
-
tags: eventConfig.tags || [],
|
|
15
|
-
optional() {
|
|
16
|
-
return {
|
|
17
|
-
inner: this,
|
|
18
|
-
[defs_1.symbolOptionalDependency]: true,
|
|
19
|
-
};
|
|
20
|
-
},
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=defineEvent.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"defineEvent.js","sourceRoot":"","sources":["../../src/definers/defineEvent.ts"],"names":[],"mappings":";;AAUA,kCAkBC;AA5BD,kCAOiB;AACjB,0DAAuD;AAEvD,SAAgB,WAAW,CACzB,MAAkC;IAElC,MAAM,cAAc,GAAG,IAAA,6BAAa,GAAE,CAAC;IACvC,MAAM,WAAW,GAAG,MAAM,CAAC;IAC3B,OAAO;QACL,GAAG,WAAW;QACd,EAAE,EAAE,WAAW,CAAC,EAAE;QAClB,CAAC,qBAAc,CAAC,EAAE,cAAc;QAChC,CAAC,kBAAW,CAAC,EAAE,IAAI,EAAE,uBAAuB;QAC5C,IAAI,EAAE,WAAW,CAAC,IAAI,IAAI,EAAE;QAC5B,QAAQ;YACN,OAAO;gBACL,KAAK,EAAE,IAAI;gBACX,CAAC,+BAAwB,CAAC,EAAE,IAAI;aACQ,CAAC;QAC7C,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { DependencyMapType, IEventDefinition, ITaskMeta, IHook, IHookDefinition } from "../defs";
|
|
2
|
-
/**
|
|
3
|
-
* Define a hook (event listeners).
|
|
4
|
-
* Same shape as task with mandatory `on` and without `middleware`.
|
|
5
|
-
*/
|
|
6
|
-
export declare function defineHook<D extends DependencyMapType = any, TOn extends "*" | IEventDefinition<any> | readonly IEventDefinition<any>[] = any, TMeta extends ITaskMeta = any>(hookDef: IHookDefinition<D, TOn, TMeta>): IHook<D, TOn, TMeta>;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.defineHook = defineHook;
|
|
4
|
-
const defs_1 = require("../defs");
|
|
5
|
-
const getCallerFile_1 = require("../tools/getCallerFile");
|
|
6
|
-
/**
|
|
7
|
-
* Define a hook (event listeners).
|
|
8
|
-
* Same shape as task with mandatory `on` and without `middleware`.
|
|
9
|
-
*/
|
|
10
|
-
function defineHook(hookDef) {
|
|
11
|
-
const filePath = (0, getCallerFile_1.getCallerFile)();
|
|
12
|
-
return {
|
|
13
|
-
[defs_1.symbolHook]: true,
|
|
14
|
-
[defs_1.symbolFilePath]: filePath,
|
|
15
|
-
id: hookDef.id,
|
|
16
|
-
dependencies: hookDef.dependencies || {},
|
|
17
|
-
on: hookDef.on,
|
|
18
|
-
order: hookDef.order,
|
|
19
|
-
run: hookDef.run,
|
|
20
|
-
meta: hookDef.meta || {},
|
|
21
|
-
tags: hookDef.tags || [],
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=defineHook.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"defineHook.js","sourceRoot":"","sources":["../../src/definers/defineHook.ts"],"names":[],"mappings":";;AAeA,gCAoBC;AAnCD,kCAQiB;AACjB,0DAAuD;AAEvD;;;GAGG;AACH,SAAgB,UAAU,CAOxB,OAAuC;IACvC,MAAM,QAAQ,GAAG,IAAA,6BAAa,GAAE,CAAC;IACjC,OAAO;QACL,CAAC,iBAAU,CAAC,EAAE,IAAI;QAClB,CAAC,qBAAc,CAAC,EAAE,QAAQ;QAC1B,EAAE,EAAE,OAAO,CAAC,EAAE;QACd,YAAY,EAAE,OAAO,CAAC,YAAY,IAAK,EAAQ;QAC/C,EAAE,EAAE,OAAO,CAAC,EAAE;QACd,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,IAAI,EAAE,OAAO,CAAC,IAAI,IAAK,EAAY;QACnC,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,EAAE;KACD,CAAC;AAC5B,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ITask, IResource, ITaskMiddleware, IResourceMiddleware, IHook } from "../defs";
|
|
2
|
-
/**
|
|
3
|
-
* Override helper that preserves the original `id` and returns the same type.
|
|
4
|
-
* You can override any property except `id`. The override is shallow-merged over the base.
|
|
5
|
-
*
|
|
6
|
-
* @param base - The base definition to override.
|
|
7
|
-
* @param patch - Properties to override (except `id`).
|
|
8
|
-
* @returns A definition of the same kind with overrides applied.
|
|
9
|
-
*/
|
|
10
|
-
export declare function defineOverride<T extends ITask<any, any, any, any, any, any>>(base: T, patch: Omit<Partial<T>, "id"> & Pick<T, "run">): T;
|
|
11
|
-
export declare function defineOverride<T extends IResource<any, any, any, any, any, any>>(base: T, patch: Omit<Partial<T>, "id"> & Pick<T, "init">): T;
|
|
12
|
-
export declare function defineOverride<T extends ITaskMiddleware<any, any, any, any>>(base: T, patch: Omit<Partial<T>, "id">): T;
|
|
13
|
-
export declare function defineOverride<T extends IResourceMiddleware<any, any, any, any>>(base: T, patch: Omit<Partial<T>, "id"> & Pick<T, "run">): T;
|
|
14
|
-
export declare function defineOverride<T extends IHook<any, any, any>>(base: T, patch: Omit<Partial<T>, "id" | "on"> & Pick<T, "run">): T;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.defineOverride = defineOverride;
|
|
4
|
-
function defineOverride(base, patch) {
|
|
5
|
-
const { id: _ignored, ...rest } = patch;
|
|
6
|
-
// Ensure we never change the id, and merge overrides last
|
|
7
|
-
return {
|
|
8
|
-
...base,
|
|
9
|
-
...rest,
|
|
10
|
-
id: base.id,
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=defineOverride.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"defineOverride.js","sourceRoot":"","sources":["../../src/definers/defineOverride.ts"],"names":[],"mappings":";;AAkCA,wCAWC;AAXD,SAAgB,cAAc,CAC5B,IAA+D,EAC/D,KAA8B;IAE9B,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IACxC,0DAA0D;IAC1D,OAAO;QACL,GAAI,IAAY;QAChB,GAAG,IAAI;QACP,EAAE,EAAG,IAAY,CAAC,EAAE;KACd,CAAC;AACX,CAAC"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { IResource, IResourceDefinition, DependencyMapType, IResourceMeta, TagType, ResourceMiddlewareAttachmentType } from "../defs";
|
|
2
|
-
export declare function defineResource<TConfig = void, TValue extends Promise<any> = Promise<any>, TDeps extends DependencyMapType = {}, TPrivate = any, TMeta extends IResourceMeta = any, TTags extends TagType[] = TagType[], TMiddleware extends ResourceMiddlewareAttachmentType[] = ResourceMiddlewareAttachmentType[]>(constConfig: IResourceDefinition<TConfig, TValue, TDeps, TPrivate, any, any, TMeta, TTags, TMiddleware>): IResource<TConfig, TValue, TDeps, TPrivate, TMeta, TTags, TMiddleware>;
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.defineResource = defineResource;
|
|
4
|
-
const defs_1 = require("../defs");
|
|
5
|
-
const errors_1 = require("../errors");
|
|
6
|
-
const getCallerFile_1 = require("../tools/getCallerFile");
|
|
7
|
-
function defineResource(constConfig) {
|
|
8
|
-
/**
|
|
9
|
-
* Define a resource.
|
|
10
|
-
* Produces a strongly-typed resource with id, registration hooks,
|
|
11
|
-
* and optional config schema.
|
|
12
|
-
*
|
|
13
|
-
* - If `id` is omitted, an anonymous, file-based id is generated (resource or index flavored).
|
|
14
|
-
* - Provides `.with(config)` for config-bound registration with optional runtime validation.
|
|
15
|
-
*
|
|
16
|
-
* @typeParam TConfig - Configuration type accepted by the resource.
|
|
17
|
-
* @typeParam TValue - Promise type resolved by the resource `init`.
|
|
18
|
-
* @typeParam TDeps - Dependency map type this resource requires.
|
|
19
|
-
* @typeParam TPrivate - Private context type exposed to middleware during init.
|
|
20
|
-
* @typeParam TMeta - Arbitrary metadata type carried by the resource.
|
|
21
|
-
* @param constConfig - The resource definition config.
|
|
22
|
-
* @returns A branded resource definition usable by the runner.
|
|
23
|
-
*/
|
|
24
|
-
// The symbolFilePath might already come from defineIndex() for example
|
|
25
|
-
const filePath = constConfig[defs_1.symbolFilePath] || (0, getCallerFile_1.getCallerFile)();
|
|
26
|
-
const isIndexResource = constConfig[defs_1.symbolIndexResource] || false;
|
|
27
|
-
const id = constConfig.id;
|
|
28
|
-
return {
|
|
29
|
-
[defs_1.symbolResource]: true,
|
|
30
|
-
[defs_1.symbolFilePath]: filePath,
|
|
31
|
-
[defs_1.symbolIndexResource]: isIndexResource,
|
|
32
|
-
id,
|
|
33
|
-
dependencies: constConfig.dependencies,
|
|
34
|
-
dispose: constConfig.dispose,
|
|
35
|
-
register: constConfig.register || [],
|
|
36
|
-
overrides: constConfig.overrides || [],
|
|
37
|
-
init: constConfig.init,
|
|
38
|
-
context: constConfig.context,
|
|
39
|
-
configSchema: constConfig.configSchema,
|
|
40
|
-
resultSchema: constConfig.resultSchema,
|
|
41
|
-
tags: constConfig.tags || [],
|
|
42
|
-
with: function (config) {
|
|
43
|
-
// Validate config with schema if provided (fail fast)
|
|
44
|
-
if (constConfig.configSchema) {
|
|
45
|
-
try {
|
|
46
|
-
config = constConfig.configSchema.parse(config);
|
|
47
|
-
}
|
|
48
|
-
catch (error) {
|
|
49
|
-
throw new errors_1.ValidationError("Resource config", id, error instanceof Error ? error : new Error(String(error)));
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
return {
|
|
53
|
-
[defs_1.symbolResourceWithConfig]: true,
|
|
54
|
-
id: this.id,
|
|
55
|
-
resource: this,
|
|
56
|
-
config,
|
|
57
|
-
};
|
|
58
|
-
},
|
|
59
|
-
meta: (constConfig.meta || {}),
|
|
60
|
-
middleware: constConfig.middleware || [],
|
|
61
|
-
optional() {
|
|
62
|
-
return {
|
|
63
|
-
inner: this,
|
|
64
|
-
[defs_1.symbolOptionalDependency]: true,
|
|
65
|
-
};
|
|
66
|
-
},
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
//# sourceMappingURL=defineResource.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"defineResource.js","sourceRoot":"","sources":["../../src/definers/defineResource.ts"],"names":[],"mappings":";;AAkBA,wCAiGC;AAnHD,kCAciB;AACjB,sCAA4C;AAC5C,0DAAuD;AAEvD,SAAgB,cAAc,CAS5B,WAUC;IAED;;;;;;;;;;;;;;;OAeG;IACH,uEAAuE;IACvE,MAAM,QAAQ,GAAW,WAAW,CAAC,qBAAc,CAAC,IAAI,IAAA,6BAAa,GAAE,CAAC;IACxE,MAAM,eAAe,GAAG,WAAW,CAAC,0BAAmB,CAAC,IAAI,KAAK,CAAC;IAClE,MAAM,EAAE,GAAG,WAAW,CAAC,EAAE,CAAC;IAE1B,OAAO;QACL,CAAC,qBAAc,CAAC,EAAE,IAAI;QACtB,CAAC,qBAAc,CAAC,EAAE,QAAQ;QAC1B,CAAC,0BAAmB,CAAC,EAAE,eAAe;QACtC,EAAE;QACF,YAAY,EAAE,WAAW,CAAC,YAAY;QACtC,OAAO,EAAE,WAAW,CAAC,OAAO;QAC5B,QAAQ,EAAE,WAAW,CAAC,QAAQ,IAAI,EAAE;QACpC,SAAS,EAAE,WAAW,CAAC,SAAS,IAAI,EAAE;QACtC,IAAI,EAAE,WAAW,CAAC,IAAI;QACtB,OAAO,EAAE,WAAW,CAAC,OAAO;QAC5B,YAAY,EAAE,WAAW,CAAC,YAAY;QACtC,YAAY,EAAE,WAAW,CAAC,YAAY;QACtC,IAAI,EAAE,WAAW,CAAC,IAAI,IAAK,EAAuB;QAClD,IAAI,EAAE,UAAU,MAAe;YAC7B,sDAAsD;YACtD,IAAI,WAAW,CAAC,YAAY,EAAE,CAAC;gBAC7B,IAAI,CAAC;oBACH,MAAM,GAAG,WAAW,CAAC,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;gBAClD,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,MAAM,IAAI,wBAAe,CACvB,iBAAiB,EACjB,EAAE,EACF,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAC1D,CAAC;gBACJ,CAAC;YACH,CAAC;YAED,OAAO;gBACL,CAAC,+BAAwB,CAAC,EAAE,IAAI;gBAChC,EAAE,EAAE,IAAI,CAAC,EAAE;gBACX,QAAQ,EAAE,IAAI;gBACd,MAAM;aASP,CAAC;QACJ,CAAC;QAED,IAAI,EAAE,CAAC,WAAW,CAAC,IAAI,IAAI,EAAE,CAAU;QACvC,UAAU,EAAE,WAAW,CAAC,UAAU,IAAK,EAA6B;QACpE,QAAQ;YACN,OAAO;gBACL,KAAK,EAAE,IAAI;gBACX,CAAC,+BAAwB,CAAC,EAAE,IAAI;aAGjC,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { IResourceMiddleware, IResourceMiddlewareDefinition, DependencyMapType } from "../defs";
|
|
2
|
-
export declare function defineResourceMiddleware<TConfig = any, TEnforceInputContract = void, TEnforceOutputContract = void, TDependencies extends DependencyMapType = any>(middlewareDef: IResourceMiddlewareDefinition<TConfig, TEnforceInputContract, TEnforceOutputContract, TDependencies>): IResourceMiddleware<TConfig, TEnforceInputContract, TEnforceOutputContract, TDependencies>;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.defineResourceMiddleware = defineResourceMiddleware;
|
|
4
|
-
const defs_1 = require("../defs");
|
|
5
|
-
const errors_1 = require("../errors");
|
|
6
|
-
const getCallerFile_1 = require("../tools/getCallerFile");
|
|
7
|
-
function defineResourceMiddleware(middlewareDef) {
|
|
8
|
-
const filePath = (0, getCallerFile_1.getCallerFile)();
|
|
9
|
-
const base = {
|
|
10
|
-
[defs_1.symbolFilePath]: filePath,
|
|
11
|
-
[defs_1.symbolResourceMiddleware]: true,
|
|
12
|
-
config: {},
|
|
13
|
-
configSchema: middlewareDef.configSchema,
|
|
14
|
-
...middlewareDef,
|
|
15
|
-
dependencies: middlewareDef.dependencies || {},
|
|
16
|
-
};
|
|
17
|
-
const wrap = (obj) => {
|
|
18
|
-
return {
|
|
19
|
-
...obj,
|
|
20
|
-
with: (config) => {
|
|
21
|
-
if (obj.configSchema) {
|
|
22
|
-
try {
|
|
23
|
-
config = obj.configSchema.parse(config);
|
|
24
|
-
}
|
|
25
|
-
catch (error) {
|
|
26
|
-
throw new errors_1.ValidationError("Middleware config", obj.id, error);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return wrap({
|
|
30
|
-
...obj,
|
|
31
|
-
[defs_1.symbolMiddlewareConfigured]: true,
|
|
32
|
-
config: {
|
|
33
|
-
...obj.config,
|
|
34
|
-
...config,
|
|
35
|
-
},
|
|
36
|
-
});
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
return wrap(base);
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=defineResourceMiddleware.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"defineResourceMiddleware.js","sourceRoot":"","sources":["../../src/definers/defineResourceMiddleware.ts"],"names":[],"mappings":";;AAYA,4DAgFC;AA5FD,kCAQiB;AACjB,sCAA4C;AAC5C,0DAAuD;AAEvD,SAAgB,wBAAwB,CAMtC,aAKC;IAOD,MAAM,QAAQ,GAAG,IAAA,6BAAa,GAAE,CAAC;IACjC,MAAM,IAAI,GAAG;QACX,CAAC,qBAAc,CAAC,EAAE,QAAQ;QAC1B,CAAC,+BAAwB,CAAC,EAAE,IAAI;QAChC,MAAM,EAAE,EAAa;QACrB,YAAY,EAAE,aAAa,CAAC,YAAY;QACxC,GAAG,aAAa;QAChB,YAAY,EAAE,aAAa,CAAC,YAAY,IAAK,EAAoB;KAMlE,CAAC;IAEF,MAAM,IAAI,GAAG,CACX,GAOC,EAMD,EAAE;QACF,OAAO;YACL,GAAG,GAAG;YACN,IAAI,EAAE,CAAC,MAAe,EAAE,EAAE;gBACxB,IAAI,GAAG,CAAC,YAAY,EAAE,CAAC;oBACrB,IAAI,CAAC;wBACH,MAAM,GAAG,GAAG,CAAC,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;oBAC1C,CAAC;oBAAC,OAAO,KAAK,EAAE,CAAC;wBACf,MAAM,IAAI,wBAAe,CACvB,mBAAmB,EACnB,GAAG,CAAC,EAAE,EACN,KAAc,CACf,CAAC;oBACJ,CAAC;gBACH,CAAC;gBACD,OAAO,IAAI,CAAC;oBACV,GAAG,GAAG;oBACN,CAAC,iCAA0B,CAAC,EAAE,IAAI;oBAClC,MAAM,EAAE;wBACN,GAAI,GAAG,CAAC,MAAkB;wBAC1B,GAAG,MAAM;qBACV;iBAC6G,CAAC,CAAC;YACpH,CAAC;SAMF,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC;AACpB,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { ITag, ITagDefinition } from "../defs";
|
|
2
|
-
/**
|
|
3
|
-
* Create a tag definition.
|
|
4
|
-
* - `.with(config)` to create configured instances
|
|
5
|
-
* - `.extract(tags)` to extract this tag from a list of tags or a taggable's meta
|
|
6
|
-
*
|
|
7
|
-
* @typeParam TConfig - Configuration type carried by configured tags.
|
|
8
|
-
* @typeParam TEnforceContract - Optional helper type to enforce a contract when tags are used.
|
|
9
|
-
* @param definition - The tag definition (id).
|
|
10
|
-
* @returns A tag object with helpers to configure and extract.
|
|
11
|
-
*/
|
|
12
|
-
export declare function defineTag<TConfig = void, TEnforceInputContract = void, TEnforceOutputContract = void>(definition: ITagDefinition<TConfig, TEnforceInputContract, TEnforceOutputContract>): ITag<TConfig, TEnforceInputContract, TEnforceOutputContract>;
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.defineTag = defineTag;
|
|
4
|
-
const defs_1 = require("../defs");
|
|
5
|
-
const errors_1 = require("../errors");
|
|
6
|
-
const getCallerFile_1 = require("../tools/getCallerFile");
|
|
7
|
-
/**
|
|
8
|
-
* Create a tag definition.
|
|
9
|
-
* - `.with(config)` to create configured instances
|
|
10
|
-
* - `.extract(tags)` to extract this tag from a list of tags or a taggable's meta
|
|
11
|
-
*
|
|
12
|
-
* @typeParam TConfig - Configuration type carried by configured tags.
|
|
13
|
-
* @typeParam TEnforceContract - Optional helper type to enforce a contract when tags are used.
|
|
14
|
-
* @param definition - The tag definition (id).
|
|
15
|
-
* @returns A tag object with helpers to configure and extract.
|
|
16
|
-
*/
|
|
17
|
-
function defineTag(definition) {
|
|
18
|
-
const id = definition.id;
|
|
19
|
-
const filePath = (0, getCallerFile_1.getCallerFile)();
|
|
20
|
-
const foundation = {
|
|
21
|
-
id,
|
|
22
|
-
meta: definition.meta,
|
|
23
|
-
config: definition.config,
|
|
24
|
-
configSchema: definition.configSchema,
|
|
25
|
-
};
|
|
26
|
-
return {
|
|
27
|
-
...foundation,
|
|
28
|
-
[defs_1.symbolTag]: true,
|
|
29
|
-
[defs_1.symbolFilePath]: filePath,
|
|
30
|
-
/**
|
|
31
|
-
* Specify custom config for this tag which extends the default one if exists
|
|
32
|
-
* @param tagConfig
|
|
33
|
-
* @returns
|
|
34
|
-
*/
|
|
35
|
-
with(tagConfig) {
|
|
36
|
-
if (definition.configSchema) {
|
|
37
|
-
try {
|
|
38
|
-
tagConfig = definition.configSchema.parse(tagConfig);
|
|
39
|
-
}
|
|
40
|
-
catch (error) {
|
|
41
|
-
throw new errors_1.ValidationError("Tag config", this.id, error);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
let config;
|
|
45
|
-
if (typeof tagConfig === "object") {
|
|
46
|
-
if (typeof foundation.config === "object") {
|
|
47
|
-
config = {
|
|
48
|
-
...foundation.config,
|
|
49
|
-
...tagConfig,
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
config = tagConfig;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
config = tagConfig;
|
|
58
|
-
}
|
|
59
|
-
return {
|
|
60
|
-
...foundation,
|
|
61
|
-
[defs_1.symbolTagConfigured]: true,
|
|
62
|
-
config,
|
|
63
|
-
};
|
|
64
|
-
},
|
|
65
|
-
/**
|
|
66
|
-
* Checks if the tag exists in a taggable or a list of tags.
|
|
67
|
-
* @param target
|
|
68
|
-
* @returns
|
|
69
|
-
*/
|
|
70
|
-
exists(target) {
|
|
71
|
-
let currentTags = [];
|
|
72
|
-
if (Array.isArray(target)) {
|
|
73
|
-
currentTags = target;
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
currentTags = target.tags;
|
|
77
|
-
}
|
|
78
|
-
for (const candidate of currentTags) {
|
|
79
|
-
if (candidate.id === id) {
|
|
80
|
-
return true;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
return false;
|
|
84
|
-
},
|
|
85
|
-
/**
|
|
86
|
-
* Function which serves 2 purposes, verifying if the task exists, and retrieving its config
|
|
87
|
-
* @param target
|
|
88
|
-
* @returns
|
|
89
|
-
*/
|
|
90
|
-
extract(target) {
|
|
91
|
-
let currentTags = [];
|
|
92
|
-
if (Array.isArray(target)) {
|
|
93
|
-
currentTags = target;
|
|
94
|
-
}
|
|
95
|
-
else {
|
|
96
|
-
currentTags = target.tags || [];
|
|
97
|
-
}
|
|
98
|
-
for (const candidate of currentTags) {
|
|
99
|
-
if (candidate.id === id) {
|
|
100
|
-
return candidate.config;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
return;
|
|
104
|
-
},
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
//# sourceMappingURL=defineTag.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"defineTag.js","sourceRoot":"","sources":["../../src/definers/defineTag.ts"],"names":[],"mappings":";;AAuBA,8BAuGC;AA9HD,kCASiB;AACjB,sCAA4C;AAC5C,0DAAuD;AAEvD;;;;;;;;;GASG;AACH,SAAgB,SAAS,CAKvB,UAIC;IAED,MAAM,EAAE,GAAG,UAAU,CAAC,EAAE,CAAC;IACzB,MAAM,QAAQ,GAAG,IAAA,6BAAa,GAAE,CAAC;IACjC,MAAM,UAAU,GAAG;QACjB,EAAE;QACF,IAAI,EAAE,UAAU,CAAC,IAAI;QACrB,MAAM,EAAE,UAAU,CAAC,MAAM;QACzB,YAAY,EAAE,UAAU,CAAC,YAAY;KAC0B,CAAC;IAElE,OAAO;QACL,GAAG,UAAU;QACb,CAAC,gBAAS,CAAC,EAAE,IAAI;QACjB,CAAC,qBAAc,CAAC,EAAE,QAAQ;QAC1B;;;;WAIG;QACH,IAAI,CAAC,SAAkB;YACrB,IAAI,UAAU,CAAC,YAAY,EAAE,CAAC;gBAC5B,IAAI,CAAC;oBACH,SAAS,GAAG,UAAU,CAAC,YAAY,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;gBACvD,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,MAAM,IAAI,wBAAe,CAAC,YAAY,EAAE,IAAI,CAAC,EAAE,EAAE,KAAc,CAAC,CAAC;gBACnE,CAAC;YACH,CAAC;YACD,IAAI,MAAe,CAAC;YACpB,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE,CAAC;gBAClC,IAAI,OAAO,UAAU,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;oBAC1C,MAAM,GAAG;wBACP,GAAG,UAAU,CAAC,MAAM;wBACpB,GAAG,SAAS;qBACb,CAAC;gBACJ,CAAC;qBAAM,CAAC;oBACN,MAAM,GAAG,SAAS,CAAC;gBACrB,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,MAAM,GAAG,SAAS,CAAC;YACrB,CAAC;YACD,OAAO;gBACL,GAAG,UAAU;gBACb,CAAC,0BAAmB,CAAC,EAAE,IAAI;gBAC3B,MAAM;aAKP,CAAC;QACJ,CAAC;QACD;;;;WAIG;QACH,MAAM,CAAC,MAA6B;YAClC,IAAI,WAAW,GAAc,EAAE,CAAC;YAChC,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;gBAC1B,WAAW,GAAG,MAAM,CAAC;YACvB,CAAC;iBAAM,CAAC;gBACN,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC;YAC5B,CAAC;YAED,KAAK,MAAM,SAAS,IAAI,WAAW,EAAE,CAAC;gBACpC,IAAI,SAAS,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC;oBACxB,OAAO,IAAI,CAAC;gBACd,CAAC;YACH,CAAC;YAED,OAAO,KAAK,CAAC;QACf,CAAC;QACD;;;;WAIG;QACH,OAAO,CAAC,MAA6B;YACnC,IAAI,WAAW,GAAc,EAAE,CAAC;YAChC,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;gBAC1B,WAAW,GAAG,MAAM,CAAC;YACvB,CAAC;iBAAM,CAAC;gBACN,WAAW,GAAG,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;YAClC,CAAC;YAED,KAAK,MAAM,SAAS,IAAI,WAAW,EAAE,CAAC;gBACpC,IAAI,SAAS,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC;oBACxB,OAAO,SAAS,CAAC,MAAiB,CAAC;gBACrC,CAAC;YACH,CAAC;YAED,OAAO;QACT,CAAC;KACqE,CAAC;AAC3E,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ITask, ITaskDefinition, DependencyMapType, ITaskMeta, TagType, TaskMiddlewareAttachmentType } from "../defs";
|
|
2
|
-
/**
|
|
3
|
-
* Define a task.
|
|
4
|
-
* Generates a strongly-typed task object with id, dependencies,
|
|
5
|
-
* middleware, and metadata.
|
|
6
|
-
*
|
|
7
|
-
* @typeParam Input - Input type accepted by the task's `run` function.
|
|
8
|
-
* @typeParam Output - Promise type returned by the `run` function.
|
|
9
|
-
* @typeParam Deps - Dependency map type this task requires.
|
|
10
|
-
* @typeParam TOn - Event type or "*" this task listens to.
|
|
11
|
-
* @typeParam TMeta - Arbitrary metadata type carried by the task.
|
|
12
|
-
* @param taskConfig - The task definition config.
|
|
13
|
-
* @returns A branded task definition usable by the runner.
|
|
14
|
-
*/
|
|
15
|
-
export declare function defineTask<Input = undefined, Output extends Promise<any> = any, Deps extends DependencyMapType = any, TMeta extends ITaskMeta = any, TTags extends TagType[] = TagType[], TMiddleware extends TaskMiddlewareAttachmentType[] = TaskMiddlewareAttachmentType[]>(taskConfig: ITaskDefinition<Input, Output, Deps, TMeta, TTags, TMiddleware>): ITask<Input, Output, Deps, TMeta, TTags, TMiddleware>;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.defineTask = defineTask;
|
|
4
|
-
const defs_1 = require("../defs");
|
|
5
|
-
const getCallerFile_1 = require("../tools/getCallerFile");
|
|
6
|
-
/**
|
|
7
|
-
* Define a task.
|
|
8
|
-
* Generates a strongly-typed task object with id, dependencies,
|
|
9
|
-
* middleware, and metadata.
|
|
10
|
-
*
|
|
11
|
-
* @typeParam Input - Input type accepted by the task's `run` function.
|
|
12
|
-
* @typeParam Output - Promise type returned by the `run` function.
|
|
13
|
-
* @typeParam Deps - Dependency map type this task requires.
|
|
14
|
-
* @typeParam TOn - Event type or "*" this task listens to.
|
|
15
|
-
* @typeParam TMeta - Arbitrary metadata type carried by the task.
|
|
16
|
-
* @param taskConfig - The task definition config.
|
|
17
|
-
* @returns A branded task definition usable by the runner.
|
|
18
|
-
*/
|
|
19
|
-
function defineTask(taskConfig) {
|
|
20
|
-
const filePath = (0, getCallerFile_1.getCallerFile)();
|
|
21
|
-
const id = taskConfig.id;
|
|
22
|
-
return {
|
|
23
|
-
[defs_1.symbolTask]: true,
|
|
24
|
-
[defs_1.symbolFilePath]: filePath,
|
|
25
|
-
id,
|
|
26
|
-
dependencies: taskConfig.dependencies || {},
|
|
27
|
-
middleware: taskConfig.middleware || [],
|
|
28
|
-
run: taskConfig.run,
|
|
29
|
-
inputSchema: taskConfig.inputSchema,
|
|
30
|
-
resultSchema: taskConfig.resultSchema,
|
|
31
|
-
meta: taskConfig.meta || {},
|
|
32
|
-
tags: taskConfig.tags || [],
|
|
33
|
-
// autorun,
|
|
34
|
-
optional() {
|
|
35
|
-
return {
|
|
36
|
-
inner: this,
|
|
37
|
-
[defs_1.symbolOptionalDependency]: true,
|
|
38
|
-
};
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=defineTask.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"defineTask.js","sourceRoot":"","sources":["../../src/definers/defineTask.ts"],"names":[],"mappings":";;AA2BA,gCAiCC;AA5DD,kCAWiB;AACjB,0DAAuD;AAEvD;;;;;;;;;;;;GAYG;AACH,SAAgB,UAAU,CAQxB,UAA2E;IAE3E,MAAM,QAAQ,GAAG,IAAA,6BAAa,GAAE,CAAC;IACjC,MAAM,EAAE,GAAG,UAAU,CAAC,EAAE,CAAC;IACzB,OAAO;QACL,CAAC,iBAAU,CAAC,EAAE,IAAI;QAClB,CAAC,qBAAc,CAAC,EAAE,QAAQ;QAC1B,EAAE;QACF,YAAY,EAAE,UAAU,CAAC,YAAY,IAAK,EAAW;QACrD,UAAU,EAAE,UAAU,CAAC,UAAU,IAAK,EAA6B;QACnE,GAAG,EAAE,UAAU,CAAC,GAAG;QACnB,WAAW,EAAE,UAAU,CAAC,WAAW;QACnC,YAAY,EAAE,UAAU,CAAC,YAAY;QACrC,IAAI,EAAE,UAAU,CAAC,IAAI,IAAK,EAAY;QACtC,IAAI,EAAE,UAAU,CAAC,IAAI,IAAK,EAAuB;QACjD,WAAW;QACX,QAAQ;YACN,OAAO;gBACL,KAAK,EAAE,IAAI;gBACX,CAAC,+BAAwB,CAAC,EAAE,IAAI;aAGjC,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { ITaskMiddleware, ITaskMiddlewareDefinition, DependencyMapType } from "../defs";
|
|
2
|
-
export declare function defineTaskMiddleware<TConfig = any, TEnforceInputContract = void, TEnforceOutputContract = void, TDependencies extends DependencyMapType = any>(middlewareDef: ITaskMiddlewareDefinition<TConfig, TEnforceInputContract, TEnforceOutputContract, TDependencies>): ITaskMiddleware<TConfig, TEnforceInputContract, TEnforceOutputContract, TDependencies>;
|