@cldmv/slothlet 3.2.3 → 3.3.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/README.md +22 -9
- package/REFERENCE.md +23 -0
- package/dist/lib/builders/api-assignment.mjs +1 -589
- package/dist/lib/builders/api_builder.mjs +1 -1155
- package/dist/lib/builders/builder.mjs +1 -78
- package/dist/lib/builders/modes-processor.mjs +1 -1800
- package/dist/lib/errors.mjs +9 -211
- package/dist/lib/factories/component-base.mjs +1 -80
- package/dist/lib/factories/context.mjs +1 -22
- package/dist/lib/handlers/api-cache-manager.mjs +1 -200
- package/dist/lib/handlers/api-manager.mjs +1 -2513
- package/dist/lib/handlers/context-async.mjs +1 -168
- package/dist/lib/handlers/context-live.mjs +1 -168
- package/dist/lib/handlers/hook-manager.mjs +1 -773
- package/dist/lib/handlers/lifecycle-token.mjs +1 -28
- package/dist/lib/handlers/lifecycle.mjs +1 -115
- package/dist/lib/handlers/materialize-manager.mjs +1 -48
- package/dist/lib/handlers/metadata.mjs +1 -501
- package/dist/lib/handlers/ownership.mjs +1 -322
- package/dist/lib/handlers/permission-manager.mjs +17 -0
- package/dist/lib/handlers/unified-wrapper.mjs +1 -3042
- package/dist/lib/handlers/version-manager.mjs +1 -885
- package/dist/lib/helpers/class-instance-wrapper.mjs +1 -109
- package/dist/lib/helpers/config.mjs +1 -355
- package/dist/lib/helpers/eventemitter-context.mjs +1 -349
- package/dist/lib/helpers/hint-detector.mjs +1 -47
- package/dist/lib/helpers/modes-utils.mjs +1 -37
- package/dist/lib/helpers/pattern-matcher.mjs +17 -0
- package/dist/lib/helpers/resolve-from-caller.mjs +1 -169
- package/dist/lib/helpers/sanitize.mjs +1 -340
- package/dist/lib/helpers/utilities.mjs +1 -70
- package/dist/lib/i18n/languages/de-de.json +21 -1
- package/dist/lib/i18n/languages/en-gb.json +21 -1
- package/dist/lib/i18n/languages/en-us.json +21 -1
- package/dist/lib/i18n/languages/es-mx.json +21 -1
- package/dist/lib/i18n/languages/fr-fr.json +21 -1
- package/dist/lib/i18n/languages/hi-in.json +21 -1
- package/dist/lib/i18n/languages/ja-jp.json +21 -1
- package/dist/lib/i18n/languages/ko-kr.json +21 -1
- package/dist/lib/i18n/languages/pt-br.json +21 -1
- package/dist/lib/i18n/languages/ru-ru.json +21 -1
- package/dist/lib/i18n/languages/zh-cn.json +21 -1
- package/dist/lib/i18n/translations.mjs +1 -126
- package/dist/lib/modes/eager.mjs +1 -59
- package/dist/lib/modes/lazy.mjs +1 -81
- package/dist/lib/processors/flatten.mjs +1 -437
- package/dist/lib/processors/loader.mjs +1 -339
- package/dist/lib/processors/type-generator.mjs +1 -275
- package/dist/lib/processors/typescript.mjs +1 -172
- package/dist/lib/runtime/runtime-asynclocalstorage.mjs +1 -113
- package/dist/lib/runtime/runtime-livebindings.mjs +1 -78
- package/dist/lib/runtime/runtime.mjs +1 -102
- package/dist/slothlet.mjs +1 -808
- package/package.json +37 -31
- package/types/dist/lib/builders/api-assignment.d.mts +3 -92
- package/types/dist/lib/builders/api-assignment.d.mts.map +1 -1
- package/types/dist/lib/builders/api_builder.d.mts +102 -91
- package/types/dist/lib/builders/api_builder.d.mts.map +1 -1
- package/types/dist/lib/builders/builder.d.mts +1 -55
- package/types/dist/lib/builders/builder.d.mts.map +1 -1
- package/types/dist/lib/builders/modes-processor.d.mts +3 -27
- package/types/dist/lib/builders/modes-processor.d.mts.map +1 -1
- package/types/dist/lib/errors.d.mts +19 -109
- package/types/dist/lib/errors.d.mts.map +1 -1
- package/types/dist/lib/factories/component-base.d.mts +7 -177
- package/types/dist/lib/factories/component-base.d.mts.map +1 -1
- package/types/dist/lib/factories/context.d.mts +4 -22
- package/types/dist/lib/factories/context.d.mts.map +1 -1
- package/types/dist/lib/handlers/api-cache-manager.d.mts +20 -203
- package/types/dist/lib/handlers/api-cache-manager.d.mts.map +1 -1
- package/types/dist/lib/handlers/api-manager.d.mts +33 -408
- package/types/dist/lib/handlers/api-manager.d.mts.map +1 -1
- package/types/dist/lib/handlers/context-async.d.mts +23 -61
- package/types/dist/lib/handlers/context-async.d.mts.map +1 -1
- package/types/dist/lib/handlers/context-live.d.mts +22 -59
- package/types/dist/lib/handlers/context-live.d.mts.map +1 -1
- package/types/dist/lib/handlers/hook-manager.d.mts +46 -185
- package/types/dist/lib/handlers/hook-manager.d.mts.map +1 -1
- package/types/dist/lib/handlers/lifecycle-token.d.mts +3 -48
- package/types/dist/lib/handlers/lifecycle-token.d.mts.map +1 -1
- package/types/dist/lib/handlers/lifecycle.d.mts +5 -82
- package/types/dist/lib/handlers/lifecycle.d.mts.map +1 -1
- package/types/dist/lib/handlers/materialize-manager.d.mts +8 -70
- package/types/dist/lib/handlers/materialize-manager.d.mts.map +1 -1
- package/types/dist/lib/handlers/metadata.d.mts +17 -221
- package/types/dist/lib/handlers/metadata.d.mts.map +1 -1
- package/types/dist/lib/handlers/ownership.d.mts +44 -160
- package/types/dist/lib/handlers/ownership.d.mts.map +1 -1
- package/types/dist/lib/handlers/permission-manager.d.mts +47 -0
- package/types/dist/lib/handlers/permission-manager.d.mts.map +1 -0
- package/types/dist/lib/handlers/unified-wrapper.d.mts +26 -239
- package/types/dist/lib/handlers/unified-wrapper.d.mts.map +1 -1
- package/types/dist/lib/handlers/version-manager.d.mts +28 -225
- package/types/dist/lib/handlers/version-manager.d.mts.map +1 -1
- package/types/dist/lib/helpers/class-instance-wrapper.d.mts +2 -52
- package/types/dist/lib/helpers/class-instance-wrapper.d.mts.map +1 -1
- package/types/dist/lib/helpers/config.d.mts +125 -123
- package/types/dist/lib/helpers/config.d.mts.map +1 -1
- package/types/dist/lib/helpers/eventemitter-context.d.mts +3 -29
- package/types/dist/lib/helpers/eventemitter-context.d.mts.map +1 -1
- package/types/dist/lib/helpers/hint-detector.d.mts +2 -15
- package/types/dist/lib/helpers/hint-detector.d.mts.map +1 -1
- package/types/dist/lib/helpers/modes-utils.d.mts +3 -30
- package/types/dist/lib/helpers/modes-utils.d.mts.map +1 -1
- package/types/dist/lib/helpers/pattern-matcher.d.mts +4 -0
- package/types/dist/lib/helpers/pattern-matcher.d.mts.map +1 -0
- package/types/dist/lib/helpers/resolve-from-caller.d.mts +3 -27
- package/types/dist/lib/helpers/resolve-from-caller.d.mts.map +1 -1
- package/types/dist/lib/helpers/sanitize.d.mts +4 -92
- package/types/dist/lib/helpers/sanitize.d.mts.map +1 -1
- package/types/dist/lib/helpers/utilities.d.mts +4 -52
- package/types/dist/lib/helpers/utilities.d.mts.map +1 -1
- package/types/dist/lib/i18n/translations.d.mts +4 -37
- package/types/dist/lib/i18n/translations.d.mts.map +1 -1
- package/types/dist/lib/modes/eager.d.mts +8 -30
- package/types/dist/lib/modes/eager.d.mts.map +1 -1
- package/types/dist/lib/modes/lazy.d.mts +10 -43
- package/types/dist/lib/modes/lazy.d.mts.map +1 -1
- package/types/dist/lib/processors/flatten.d.mts +56 -107
- package/types/dist/lib/processors/flatten.d.mts.map +1 -1
- package/types/dist/lib/processors/loader.d.mts +6 -41
- package/types/dist/lib/processors/loader.d.mts.map +1 -1
- package/types/dist/lib/processors/type-generator.d.mts +2 -16
- package/types/dist/lib/processors/type-generator.d.mts.map +1 -1
- package/types/dist/lib/processors/typescript.d.mts +6 -53
- package/types/dist/lib/processors/typescript.d.mts.map +1 -1
- package/types/dist/lib/runtime/runtime-asynclocalstorage.d.mts +3 -71
- package/types/dist/lib/runtime/runtime-asynclocalstorage.d.mts.map +1 -1
- package/types/dist/lib/runtime/runtime-livebindings.d.mts +2 -37
- package/types/dist/lib/runtime/runtime-livebindings.d.mts.map +1 -1
- package/types/dist/lib/runtime/runtime.d.mts +3 -39
- package/types/dist/lib/runtime/runtime.d.mts.map +1 -1
- package/types/dist/slothlet.d.mts +3 -249
- package/types/dist/slothlet.d.mts.map +1 -1
- package/types/index.d.mts +36 -16
- package/types/index.d.mts.map +1 -0
- package/AGENT-USAGE.md +0 -736
- package/docs/API-RULES.md +0 -712
|
@@ -1,16 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Manages hooks for API function interception.
|
|
3
|
-
* Supports before/after/always/error hooks with pattern matching and priority ordering.
|
|
4
|
-
*
|
|
5
|
-
* @class HookManager
|
|
6
|
-
* @extends ComponentBase
|
|
7
|
-
*/
|
|
8
1
|
export class HookManager extends ComponentBase {
|
|
9
|
-
/**
|
|
10
|
-
* Property name for auto-discovery
|
|
11
|
-
* @type {string}
|
|
12
|
-
* @static
|
|
13
|
-
*/
|
|
14
2
|
static slothletProperty: string;
|
|
15
3
|
enabled: any;
|
|
16
4
|
defaultPattern: any;
|
|
@@ -20,180 +8,53 @@ export class HookManager extends ComponentBase {
|
|
|
20
8
|
hooks: Map<any, any>;
|
|
21
9
|
registrationOrder: number;
|
|
22
10
|
reportedErrors: WeakSet<object>;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
* @public
|
|
70
|
-
*/
|
|
71
|
-
public enable(filter?: object | string): number;
|
|
72
|
-
/**
|
|
73
|
-
* Disable hooks matching filter criteria.
|
|
74
|
-
*
|
|
75
|
-
* @param {object|string} [filter={}] - Filter criteria (empty = disable all, string = pattern)
|
|
76
|
-
* @param {string} [filter.id] - Disable hook by ID
|
|
77
|
-
* @param {string} [filter.type] - Disable hooks by type
|
|
78
|
-
* @param {string} [filter.pattern] - Disable hooks matching pattern
|
|
79
|
-
* @returns {number} Number of hooks disabled
|
|
80
|
-
* @public
|
|
81
|
-
*/
|
|
82
|
-
public disable(filter?: object | string): number;
|
|
83
|
-
/**
|
|
84
|
-
* List registered hooks matching filter criteria.
|
|
85
|
-
*
|
|
86
|
-
* @param {object|string} [filter={}] - Filter criteria (empty = list all), type string, or pattern string
|
|
87
|
-
* @param {string} [filter.id] - List hook by ID
|
|
88
|
-
* @param {string} [filter.type] - List hooks by type
|
|
89
|
-
* @param {string} [filter.pattern] - List hooks matching pattern
|
|
90
|
-
* @param {boolean} [filter.enabled] - Filter by enabled state
|
|
91
|
-
* @returns {object} Object with registeredHooks array property
|
|
92
|
-
* @public
|
|
93
|
-
*/
|
|
94
|
-
public list(filter?: object | string): object;
|
|
95
|
-
/**
|
|
96
|
-
* Get hooks for a specific API path and type.
|
|
97
|
-
* Used internally by UnifiedWrapper.
|
|
98
|
-
*
|
|
99
|
-
* @param {string} type - Hook type (before/after/always/error)
|
|
100
|
-
* @param {string} apiPath - API path (e.g., "math.add")
|
|
101
|
-
* @returns {Array<object>} Sorted array of matching hooks
|
|
102
|
-
* @public
|
|
103
|
-
*/
|
|
104
|
-
public getHooksForPath(type: string, apiPath: string): Array<object>;
|
|
105
|
-
/**
|
|
106
|
-
* Execute before hooks for an API path.
|
|
107
|
-
*
|
|
108
|
-
* @param {string} path - API path being called
|
|
109
|
-
* @param {Array} args - Function arguments
|
|
110
|
-
* @param {object} api - Bound API object
|
|
111
|
-
* @param {object} ctx - User context object
|
|
112
|
-
* @returns {object} Result object: { args, shortCircuit, value }
|
|
113
|
-
* @public
|
|
114
|
-
*/
|
|
115
|
-
public executeBeforeHooks(path: string, args: any[], api: object, ctx: object): object;
|
|
116
|
-
/**
|
|
117
|
-
* Execute after hooks for an API path.
|
|
118
|
-
*
|
|
119
|
-
* @param {string} path - API path being called
|
|
120
|
-
* @param {*} result - Function return value
|
|
121
|
-
* @param {Array} args - Original function arguments
|
|
122
|
-
* @param {object} api - Bound API object
|
|
123
|
-
* @param {object} ctx - User context object
|
|
124
|
-
* @returns {HookExecutionResult} Object indicating if result was modified and the final result
|
|
125
|
-
* @public
|
|
126
|
-
*/
|
|
127
|
-
public executeAfterHooks(path: string, result: any, args: any[], api: object, ctx: object): HookExecutionResult;
|
|
128
|
-
/**
|
|
129
|
-
* Execute always hooks for an API path.
|
|
130
|
-
*
|
|
131
|
-
* @param {string} path - API path being called
|
|
132
|
-
* @param {Array} args - Function arguments
|
|
133
|
-
* @param {*} resultOrError - Function result or error
|
|
134
|
-
* @param {boolean} hasError - Whether an error occurred
|
|
135
|
-
* @param {Array<Error>} errors - Array of errors that occurred
|
|
136
|
-
* @param {object} api - Bound API object
|
|
137
|
-
* @param {object} ctx - User context object
|
|
138
|
-
* @public
|
|
139
|
-
*/
|
|
140
|
-
public executeAlwaysHooks(path: string, args: any[], resultOrError: any, hasError: boolean, errors: Array<Error>, api: object, ctx: object): void;
|
|
141
|
-
/**
|
|
142
|
-
* Execute error hooks for an API path.
|
|
143
|
-
*
|
|
144
|
-
* @param {string} path - API path being called
|
|
145
|
-
* @param {Error} error - The error that occurred
|
|
146
|
-
* @param {object} source - Error source info with type, hookTag, hookId, timestamp, stack
|
|
147
|
-
* @param {Array} args - Function arguments
|
|
148
|
-
* @param {object} api - Bound API object
|
|
149
|
-
* @param {object} ctx - User context object
|
|
150
|
-
* @public
|
|
151
|
-
*/
|
|
152
|
-
public executeErrorHooks(path: string, error: Error, source: object, args: any[], api: object, ctx: object): void;
|
|
153
|
-
/**
|
|
154
|
-
* Get the pattern compilation function for diagnostic purposes.
|
|
155
|
-
* Only exposed when diagnostics mode is enabled.
|
|
156
|
-
*
|
|
157
|
-
* @returns {function} The pattern compilation function
|
|
158
|
-
* @internal
|
|
159
|
-
*/
|
|
160
|
-
getCompilePatternForDiagnostics(): Function;
|
|
161
|
-
/**
|
|
162
|
-
* Export all registered hooks (including handler closures) so they can be
|
|
163
|
-
* re-registered on a fresh HookManager instance after a full reload.
|
|
164
|
-
*
|
|
165
|
-
* @returns {Array<object>} Snapshot of all current hook registrations.
|
|
166
|
-
* @public
|
|
167
|
-
*/
|
|
168
|
-
public exportHooks(): Array<object>;
|
|
169
|
-
/**
|
|
170
|
-
* Re-register hooks exported by {@link exportHooks} into this (new) instance.
|
|
171
|
-
* Called after a full `api.slothlet.reload()` to restore user-registered hooks.
|
|
172
|
-
*
|
|
173
|
-
* @param {Array<object>} registrations - Snapshot returned by exportHooks().
|
|
174
|
-
* @returns {void}
|
|
175
|
-
* @public
|
|
176
|
-
*/
|
|
177
|
-
public importHooks(registrations: Array<object>): void;
|
|
178
|
-
/**
|
|
179
|
-
* Cleanup hook manager on shutdown.
|
|
180
|
-
* @public
|
|
181
|
-
*/
|
|
182
|
-
public shutdown(): Promise<void>;
|
|
11
|
+
on(typePattern: any, handler: any, options?: {}): any;
|
|
12
|
+
remove(filter?: {}): number;
|
|
13
|
+
enable(filter?: {}): number;
|
|
14
|
+
disable(filter?: {}): number;
|
|
15
|
+
list(filter?: {}): {
|
|
16
|
+
registeredHooks: {
|
|
17
|
+
id: any;
|
|
18
|
+
type: any;
|
|
19
|
+
pattern: any;
|
|
20
|
+
priority: any;
|
|
21
|
+
subset: any;
|
|
22
|
+
enabled: any;
|
|
23
|
+
}[];
|
|
24
|
+
};
|
|
25
|
+
getHooksForPath(type: any, apiPath: any): any[];
|
|
26
|
+
executeBeforeHooks(path: any, args: any, api: any, ctx: any): {
|
|
27
|
+
args: any;
|
|
28
|
+
shortCircuit: boolean;
|
|
29
|
+
value: any;
|
|
30
|
+
} | {
|
|
31
|
+
args: any;
|
|
32
|
+
shortCircuit: boolean;
|
|
33
|
+
value?: undefined;
|
|
34
|
+
};
|
|
35
|
+
executeAfterHooks(path: any, result: any, args: any, api: any, ctx: any): {
|
|
36
|
+
modified: boolean;
|
|
37
|
+
result?: undefined;
|
|
38
|
+
} | {
|
|
39
|
+
modified: boolean;
|
|
40
|
+
result: any;
|
|
41
|
+
};
|
|
42
|
+
executeAlwaysHooks(path: any, args: any, resultOrError: any, hasError: boolean | undefined, errors: any[] | undefined, api: any, ctx: any): void;
|
|
43
|
+
executeErrorHooks(path: any, error: any, source: any, args: any, api: any, ctx: any): void;
|
|
44
|
+
getCompilePatternForDiagnostics(): (pattern: any) => any;
|
|
45
|
+
exportHooks(): {
|
|
46
|
+
typePattern: string;
|
|
47
|
+
handler: any;
|
|
48
|
+
options: {
|
|
49
|
+
id: any;
|
|
50
|
+
priority: any;
|
|
51
|
+
subset: any;
|
|
52
|
+
};
|
|
53
|
+
enabled: any;
|
|
54
|
+
}[];
|
|
55
|
+
importHooks(registrations: any): void;
|
|
56
|
+
shutdown(): Promise<void>;
|
|
183
57
|
#private;
|
|
184
58
|
}
|
|
185
|
-
/**
|
|
186
|
-
* Result returned by hook execution methods.
|
|
187
|
-
*/
|
|
188
|
-
export type HookExecutionResult = {
|
|
189
|
-
/**
|
|
190
|
-
* - Whether any hook modified the result value.
|
|
191
|
-
*/
|
|
192
|
-
modified: boolean;
|
|
193
|
-
/**
|
|
194
|
-
* - The final (possibly hook-modified) return value.
|
|
195
|
-
*/
|
|
196
|
-
result?: any;
|
|
197
|
-
};
|
|
198
59
|
import { ComponentBase } from "@cldmv/slothlet/factories/component-base";
|
|
199
60
|
//# sourceMappingURL=hook-manager.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hook-manager.d.mts","sourceRoot":"","sources":["../../../../dist/lib/handlers/hook-manager.mjs"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hook-manager.d.mts","sourceRoot":"","sources":["../../../../dist/lib/handlers/hook-manager.mjs"],"names":[],"mappings":"AAAsN;IAAwC,gCAAsC;IAA2a,aAA+B;IAAC,oBAA4C;IAAC,oBAAoD;IAAC,0BAA4B;IAAC,6BAA8B;IAAC,qBAAkB;IAAC,0BAAwB;IAAC,gCAA+B;IAAC,sDAAujC;IAAA,4BAA2vB;IAAA,4BAAmI;IAAA,6BAAyK;IAAA;;;;;;;;;MAA46B;IAAA,gDAA+pB;IAAA;;;;;;;;MAAswB;IAAA;;;;;;MAA2pB;IAAA,iJAAqb;IAAA,2FAA2Y;IAAwzB,yDAAyE;IAA8mD;;;;;;;;;QAA2Q;IAAA,sCAAyM;IAAA,0BAA8N;;CAAC;8BAA5+T,0CAA0C"}
|
|
@@ -1,49 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* Safe to call multiple times on the same instance (idempotent) — subsequent calls are
|
|
5
|
-
* silently ignored, preserving the original token. This handles the reload code path where
|
|
6
|
-
* `load()` is called again on the same Slothlet object.
|
|
7
|
-
*
|
|
8
|
-
* @param {object} slothlet - The Slothlet instance to register.
|
|
9
|
-
* @returns {void}
|
|
10
|
-
* @package
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* // Called once (or on reload) in Slothlet.load():
|
|
14
|
-
* registerInstance(this);
|
|
15
|
-
*/
|
|
16
|
-
export function registerInstance(slothlet: object): void;
|
|
17
|
-
/**
|
|
18
|
-
* Returns the per-instance capability token for the given Slothlet instance.
|
|
19
|
-
*
|
|
20
|
-
* Used internally by `lifecycle.mjs` (emit dispatch) and `modes-processor.mjs`
|
|
21
|
-
* (direct tagSystemMetadata call for folder wrappers). Requires a live registered
|
|
22
|
-
* Slothlet instance — cannot be exploited without one.
|
|
23
|
-
*
|
|
24
|
-
* @param {object} slothlet - A registered Slothlet instance.
|
|
25
|
-
* @returns {symbol|undefined} The instance token, or undefined if not registered.
|
|
26
|
-
* @package
|
|
27
|
-
*
|
|
28
|
-
* @example
|
|
29
|
-
* handler(data, getInstanceToken(this.slothlet));
|
|
30
|
-
*/
|
|
31
|
-
export function getInstanceToken(slothlet: object): symbol | undefined;
|
|
32
|
-
/**
|
|
33
|
-
* Verifies that `token` is the registered capability token for the given Slothlet instance.
|
|
34
|
-
*
|
|
35
|
-
* Used by `metadata.mjs` inside `tagSystemMetadata()` to reject calls that did not
|
|
36
|
-
* originate from the internal lifecycle dispatch path.
|
|
37
|
-
*
|
|
38
|
-
* @param {object} slothlet - A registered Slothlet instance.
|
|
39
|
-
* @param {*} token - The token value to verify.
|
|
40
|
-
* @returns {boolean} `true` only if `token` is the exact Symbol registered for `slothlet`.
|
|
41
|
-
* @package
|
|
42
|
-
*
|
|
43
|
-
* @example
|
|
44
|
-
* if (!verifyToken(this.slothlet, token)) {
|
|
45
|
-
* throw new this.SlothletError("METADATA_LIFECYCLE_BYPASS", ...);
|
|
46
|
-
* }
|
|
47
|
-
*/
|
|
48
|
-
export function verifyToken(slothlet: object, token: any): boolean;
|
|
1
|
+
export function getInstanceToken(slothlet: any): any;
|
|
2
|
+
export function registerInstance(slothlet: any): void;
|
|
3
|
+
export function verifyToken(slothlet: any, token: any): boolean;
|
|
49
4
|
//# sourceMappingURL=lifecycle-token.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lifecycle-token.d.mts","sourceRoot":"","sources":["../../../../dist/lib/handlers/lifecycle-token.mjs"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lifecycle-token.d.mts","sourceRoot":"","sources":["../../../../dist/lib/handlers/lifecycle-token.mjs"],"names":[],"mappings":"AAAuL,qDAAwE;AAA9N,sDAAsJ;AAAwE,gEAAiF"}
|
|
@@ -1,90 +1,13 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Lifecycle event manager for impl changes
|
|
3
|
-
* @extends ComponentBase
|
|
4
|
-
* @public
|
|
5
|
-
*/
|
|
6
1
|
export class Lifecycle extends ComponentBase {
|
|
7
|
-
/**
|
|
8
|
-
* Where this component should be mounted on the Slothlet instance
|
|
9
|
-
* @type {string}
|
|
10
|
-
*/
|
|
11
2
|
static slothletProperty: string;
|
|
12
3
|
subscribers: Map<any, any>;
|
|
13
4
|
eventLog: any[];
|
|
14
5
|
maxLogSize: number;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
* @public
|
|
21
|
-
*
|
|
22
|
-
* @description
|
|
23
|
-
* Subscribe to lifecycle events to react to impl changes.
|
|
24
|
-
*
|
|
25
|
-
* @example
|
|
26
|
-
* const unsubscribe = lifecycle.subscribe("impl:changed", (data) => {
|
|
27
|
-
* console.log("Impl changed:", data.apiPath, data.source);
|
|
28
|
-
* });
|
|
29
|
-
*/
|
|
30
|
-
public subscribe(event: string, handler: Function): Function;
|
|
31
|
-
/**
|
|
32
|
-
* Alias for subscribe() - standard EventEmitter pattern
|
|
33
|
-
* @param {string} event - Event name
|
|
34
|
-
* @param {Function} handler - Event handler function
|
|
35
|
-
* @returns {Function} Unsubscribe function
|
|
36
|
-
* @public
|
|
37
|
-
*
|
|
38
|
-
* @example
|
|
39
|
-
* lifecycle.on('materialized:complete', (data) => {
|
|
40
|
-
* console.log(`${data.total} modules materialized`);
|
|
41
|
-
* });
|
|
42
|
-
*/
|
|
43
|
-
public on(event: string, handler: Function): Function;
|
|
44
|
-
/**
|
|
45
|
-
* Unsubscribe from lifecycle event - standard EventEmitter pattern
|
|
46
|
-
* @param {string} event - Event name
|
|
47
|
-
* @param {Function} handler - Event handler function to remove
|
|
48
|
-
* @public
|
|
49
|
-
*
|
|
50
|
-
* @example
|
|
51
|
-
* const handler = (data) => console.log(data);
|
|
52
|
-
* lifecycle.on('impl:changed', handler);
|
|
53
|
-
* lifecycle.off('impl:changed', handler);
|
|
54
|
-
*/
|
|
55
|
-
public off(event: string, handler: Function): void;
|
|
56
|
-
/**
|
|
57
|
-
* Alias for off() - standard EventEmitter pattern
|
|
58
|
-
* @param {string} event - Event name
|
|
59
|
-
* @param {Function} handler - Event handler function to remove
|
|
60
|
-
* @public
|
|
61
|
-
*/
|
|
62
|
-
public unsubscribe(event: string, handler: Function): void;
|
|
63
|
-
/**
|
|
64
|
-
* Emit lifecycle event
|
|
65
|
-
* @param {string} event - Event name
|
|
66
|
-
* @param {object} data - Event data
|
|
67
|
-
* @private
|
|
68
|
-
*
|
|
69
|
-
* @description
|
|
70
|
-
* Emit event to all subscribers. Event data should include:
|
|
71
|
-
* - apiPath: API path where impl exists
|
|
72
|
-
* - impl: The implementation object
|
|
73
|
-
* - source: Source of event (initial, hot-reload, materialization, etc)
|
|
74
|
-
* - moduleID: Module identifier (if applicable)
|
|
75
|
-
* - filePath: File path (if applicable)
|
|
76
|
-
* - metadata: Additional metadata
|
|
77
|
-
*
|
|
78
|
-
* @example
|
|
79
|
-
* lifecycle.emit("impl:created", {
|
|
80
|
-
* apiPath: "math.add",
|
|
81
|
-
* impl: addFunction,
|
|
82
|
-
* source: "initial",
|
|
83
|
-
* moduleID: "base_abc123",
|
|
84
|
-
* filePath: "/path/to/math.mjs"
|
|
85
|
-
* });
|
|
86
|
-
*/
|
|
87
|
-
private emit;
|
|
6
|
+
subscribe(event: any, handler: any): () => void;
|
|
7
|
+
on(event: any, handler: any): () => void;
|
|
8
|
+
off(event: any, handler: any): void;
|
|
9
|
+
unsubscribe(event: any, handler: any): void;
|
|
10
|
+
emit(event: any, data: any): Promise<void>;
|
|
88
11
|
}
|
|
89
12
|
import { ComponentBase } from "@cldmv/slothlet/factories/component-base";
|
|
90
13
|
//# sourceMappingURL=lifecycle.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lifecycle.d.mts","sourceRoot":"","sources":["../../../../dist/lib/handlers/lifecycle.mjs"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lifecycle.d.mts","sourceRoot":"","sources":["../../../../dist/lib/handlers/lifecycle.mjs"],"names":[],"mappings":"AAA2I;IAAsC,gCAAoC;IAAsC,2BAAwB;IAAC,gBAAgB;IAAC,mBAAmB;IAAC,gDAAqO;IAAA,yCAAuD;IAAA,oCAAqG;IAAA,4CAAmD;IAAA,2CAAg4B;CAAC;8BAArlD,0CAA0C"}
|
|
@@ -1,75 +1,13 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Manager for tracking lazy folder materialization state
|
|
3
|
-
* @class MaterializeManager
|
|
4
|
-
* @extends ComponentBase
|
|
5
|
-
* @package
|
|
6
|
-
*
|
|
7
|
-
* @description
|
|
8
|
-
* Provides access to lazy materialization state via `api.slothlet.materialize`.
|
|
9
|
-
* Tracks count of unmaterialized lazy folders and provides boolean state, statistics,
|
|
10
|
-
* and wait functionality for synchronization.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* const api = await slothlet({ dir: "./api", mode: "lazy" });
|
|
14
|
-
*
|
|
15
|
-
* // Check if fully materialized
|
|
16
|
-
* if (api.slothlet.materialize.materialized) {
|
|
17
|
-
* console.log("All lazy folders loaded!");
|
|
18
|
-
* }
|
|
19
|
-
*
|
|
20
|
-
* // Get statistics
|
|
21
|
-
* const stats = api.slothlet.materialize.get();
|
|
22
|
-
* console.log(`${stats.percentage}% loaded (${stats.remaining}/${stats.total} remaining)`);
|
|
23
|
-
*
|
|
24
|
-
* // Wait for full materialization
|
|
25
|
-
* await api.slothlet.materialize.wait();
|
|
26
|
-
*/
|
|
27
1
|
export class MaterializeManager extends ComponentBase {
|
|
28
2
|
static slothletProperty: string;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
* console.log("API is fully loaded");
|
|
38
|
-
* }
|
|
39
|
-
*/
|
|
40
|
-
public get materialized(): boolean;
|
|
41
|
-
/**
|
|
42
|
-
* Get detailed materialization statistics
|
|
43
|
-
* @returns {Object} Statistics object with total, materialized, remaining, percentage
|
|
44
|
-
* @public
|
|
45
|
-
*
|
|
46
|
-
* @example
|
|
47
|
-
* const stats = api.slothlet.materialize.get();
|
|
48
|
-
* // { total: 5, materialized: 3, remaining: 2, percentage: 60 }
|
|
49
|
-
*/
|
|
50
|
-
public get(): any;
|
|
51
|
-
/**
|
|
52
|
-
* Wait for full materialization (all lazy folders loaded)
|
|
53
|
-
* Returns immediately if already fully materialized
|
|
54
|
-
* @returns {Promise<void>} Resolves when all lazy wrappers have materialized
|
|
55
|
-
* @public
|
|
56
|
-
*
|
|
57
|
-
* @example
|
|
58
|
-
* // Wait for API to fully load
|
|
59
|
-
* await api.slothlet.materialize.wait();
|
|
60
|
-
* console.log("All modules loaded!");
|
|
61
|
-
*
|
|
62
|
-
* @example
|
|
63
|
-
* // Wait with timeout
|
|
64
|
-
* const timeoutPromise = new Promise((_, reject) =>
|
|
65
|
-
* setTimeout(() => reject(new Error("Timeout")), 5000)
|
|
66
|
-
* );
|
|
67
|
-
* await Promise.race([
|
|
68
|
-
* api.slothlet.materialize.wait(),
|
|
69
|
-
* timeoutPromise
|
|
70
|
-
* ]);
|
|
71
|
-
*/
|
|
72
|
-
public wait(): Promise<void>;
|
|
3
|
+
get materialized(): boolean;
|
|
4
|
+
get(): {
|
|
5
|
+
total: any;
|
|
6
|
+
materialized: number;
|
|
7
|
+
remaining: any;
|
|
8
|
+
percentage: number;
|
|
9
|
+
};
|
|
10
|
+
wait(): Promise<any>;
|
|
73
11
|
}
|
|
74
12
|
import { ComponentBase } from "@cldmv/slothlet/factories/component-base";
|
|
75
13
|
//# sourceMappingURL=materialize-manager.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"materialize-manager.d.mts","sourceRoot":"","sources":["../../../../dist/lib/handlers/materialize-manager.mjs"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"materialize-manager.d.mts","sourceRoot":"","sources":["../../../../dist/lib/handlers/materialize-manager.mjs"],"names":[],"mappings":"AAAoE;IAA+C,gCAAsC;IAAsC,4BAAqE;IAAA;;;;;MAA0P;IAAA,qBAAsJ;CAAC;8BAA5nB,0CAA0C"}
|