@cldmv/slothlet 3.3.0 → 3.4.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.
Files changed (139) hide show
  1. package/README.md +9 -10
  2. package/REFERENCE.md +23 -0
  3. package/dist/lib/builders/api-assignment.mjs +1 -589
  4. package/dist/lib/builders/api_builder.mjs +1 -1385
  5. package/dist/lib/builders/builder.mjs +1 -78
  6. package/dist/lib/builders/modes-processor.mjs +1 -1800
  7. package/dist/lib/errors.mjs +9 -211
  8. package/dist/lib/factories/component-base.mjs +1 -80
  9. package/dist/lib/factories/context.mjs +1 -22
  10. package/dist/lib/handlers/api-cache-manager.mjs +1 -200
  11. package/dist/lib/handlers/api-manager.mjs +1 -2536
  12. package/dist/lib/handlers/context-async.mjs +1 -172
  13. package/dist/lib/handlers/context-live.mjs +1 -173
  14. package/dist/lib/handlers/hook-manager.mjs +1 -667
  15. package/dist/lib/handlers/lifecycle-token.mjs +1 -28
  16. package/dist/lib/handlers/lifecycle.mjs +1 -115
  17. package/dist/lib/handlers/materialize-manager.mjs +1 -48
  18. package/dist/lib/handlers/metadata.mjs +1 -501
  19. package/dist/lib/handlers/ownership.mjs +1 -322
  20. package/dist/lib/handlers/permission-manager.mjs +1 -392
  21. package/dist/lib/handlers/unified-wrapper.mjs +1 -3110
  22. package/dist/lib/handlers/version-manager.mjs +1 -885
  23. package/dist/lib/helpers/class-instance-wrapper.mjs +1 -109
  24. package/dist/lib/helpers/config.mjs +1 -439
  25. package/dist/lib/helpers/eventemitter-context.mjs +1 -349
  26. package/dist/lib/helpers/hint-detector.mjs +1 -47
  27. package/dist/lib/helpers/modes-utils.mjs +1 -37
  28. package/dist/lib/helpers/pattern-matcher.mjs +1 -125
  29. package/dist/lib/helpers/resolve-from-caller.mjs +1 -169
  30. package/dist/lib/helpers/sanitize.mjs +1 -340
  31. package/dist/lib/helpers/utilities.mjs +1 -70
  32. package/dist/lib/i18n/languages/de-de.json +1 -0
  33. package/dist/lib/i18n/languages/en-gb.json +1 -0
  34. package/dist/lib/i18n/languages/en-us.json +1 -0
  35. package/dist/lib/i18n/languages/es-es.json +412 -0
  36. package/dist/lib/i18n/languages/es-mx.json +1 -0
  37. package/dist/lib/i18n/languages/fr-fr.json +1 -0
  38. package/dist/lib/i18n/languages/hi-in.json +2 -1
  39. package/dist/lib/i18n/languages/ja-jp.json +1 -0
  40. package/dist/lib/i18n/languages/ko-kr.json +1 -0
  41. package/dist/lib/i18n/languages/pt-br.json +21 -20
  42. package/dist/lib/i18n/languages/ru-ru.json +2 -1
  43. package/dist/lib/i18n/languages/zh-cn.json +6 -5
  44. package/dist/lib/i18n/translations.mjs +1 -126
  45. package/dist/lib/modes/eager.mjs +1 -59
  46. package/dist/lib/modes/lazy.mjs +1 -81
  47. package/dist/lib/processors/flatten.mjs +1 -437
  48. package/dist/lib/processors/loader.mjs +1 -339
  49. package/dist/lib/processors/type-generator.mjs +1 -275
  50. package/dist/lib/processors/typescript.mjs +1 -172
  51. package/dist/lib/runtime/runtime-asynclocalstorage.mjs +1 -113
  52. package/dist/lib/runtime/runtime-livebindings.mjs +1 -78
  53. package/dist/lib/runtime/runtime.mjs +1 -102
  54. package/dist/slothlet.mjs +1 -817
  55. package/package.json +35 -31
  56. package/types/dist/lib/builders/api-assignment.d.mts +3 -92
  57. package/types/dist/lib/builders/api-assignment.d.mts.map +1 -1
  58. package/types/dist/lib/builders/api_builder.d.mts +102 -91
  59. package/types/dist/lib/builders/api_builder.d.mts.map +1 -1
  60. package/types/dist/lib/builders/builder.d.mts +1 -55
  61. package/types/dist/lib/builders/builder.d.mts.map +1 -1
  62. package/types/dist/lib/builders/modes-processor.d.mts +3 -27
  63. package/types/dist/lib/builders/modes-processor.d.mts.map +1 -1
  64. package/types/dist/lib/errors.d.mts +19 -109
  65. package/types/dist/lib/errors.d.mts.map +1 -1
  66. package/types/dist/lib/factories/component-base.d.mts +7 -177
  67. package/types/dist/lib/factories/component-base.d.mts.map +1 -1
  68. package/types/dist/lib/factories/context.d.mts +4 -22
  69. package/types/dist/lib/factories/context.d.mts.map +1 -1
  70. package/types/dist/lib/handlers/api-cache-manager.d.mts +20 -203
  71. package/types/dist/lib/handlers/api-cache-manager.d.mts.map +1 -1
  72. package/types/dist/lib/handlers/api-manager.d.mts +34 -408
  73. package/types/dist/lib/handlers/api-manager.d.mts.map +1 -1
  74. package/types/dist/lib/handlers/context-async.d.mts +23 -61
  75. package/types/dist/lib/handlers/context-async.d.mts.map +1 -1
  76. package/types/dist/lib/handlers/context-live.d.mts +22 -59
  77. package/types/dist/lib/handlers/context-live.d.mts.map +1 -1
  78. package/types/dist/lib/handlers/hook-manager.d.mts +46 -185
  79. package/types/dist/lib/handlers/hook-manager.d.mts.map +1 -1
  80. package/types/dist/lib/handlers/lifecycle-token.d.mts +3 -48
  81. package/types/dist/lib/handlers/lifecycle-token.d.mts.map +1 -1
  82. package/types/dist/lib/handlers/lifecycle.d.mts +5 -82
  83. package/types/dist/lib/handlers/lifecycle.d.mts.map +1 -1
  84. package/types/dist/lib/handlers/materialize-manager.d.mts +8 -70
  85. package/types/dist/lib/handlers/materialize-manager.d.mts.map +1 -1
  86. package/types/dist/lib/handlers/metadata.d.mts +17 -221
  87. package/types/dist/lib/handlers/metadata.d.mts.map +1 -1
  88. package/types/dist/lib/handlers/ownership.d.mts +44 -160
  89. package/types/dist/lib/handlers/ownership.d.mts.map +1 -1
  90. package/types/dist/lib/handlers/permission-manager.d.mts +40 -141
  91. package/types/dist/lib/handlers/permission-manager.d.mts.map +1 -1
  92. package/types/dist/lib/handlers/unified-wrapper.d.mts +26 -239
  93. package/types/dist/lib/handlers/unified-wrapper.d.mts.map +1 -1
  94. package/types/dist/lib/handlers/version-manager.d.mts +28 -225
  95. package/types/dist/lib/handlers/version-manager.d.mts.map +1 -1
  96. package/types/dist/lib/helpers/class-instance-wrapper.d.mts +2 -52
  97. package/types/dist/lib/helpers/class-instance-wrapper.d.mts.map +1 -1
  98. package/types/dist/lib/helpers/config.d.mts +125 -139
  99. package/types/dist/lib/helpers/config.d.mts.map +1 -1
  100. package/types/dist/lib/helpers/eventemitter-context.d.mts +3 -29
  101. package/types/dist/lib/helpers/eventemitter-context.d.mts.map +1 -1
  102. package/types/dist/lib/helpers/hint-detector.d.mts +2 -15
  103. package/types/dist/lib/helpers/hint-detector.d.mts.map +1 -1
  104. package/types/dist/lib/helpers/modes-utils.d.mts +3 -30
  105. package/types/dist/lib/helpers/modes-utils.d.mts.map +1 -1
  106. package/types/dist/lib/helpers/pattern-matcher.d.mts +3 -43
  107. package/types/dist/lib/helpers/pattern-matcher.d.mts.map +1 -1
  108. package/types/dist/lib/helpers/resolve-from-caller.d.mts +3 -27
  109. package/types/dist/lib/helpers/resolve-from-caller.d.mts.map +1 -1
  110. package/types/dist/lib/helpers/sanitize.d.mts +4 -92
  111. package/types/dist/lib/helpers/sanitize.d.mts.map +1 -1
  112. package/types/dist/lib/helpers/utilities.d.mts +4 -52
  113. package/types/dist/lib/helpers/utilities.d.mts.map +1 -1
  114. package/types/dist/lib/i18n/translations.d.mts +4 -37
  115. package/types/dist/lib/i18n/translations.d.mts.map +1 -1
  116. package/types/dist/lib/modes/eager.d.mts +8 -30
  117. package/types/dist/lib/modes/eager.d.mts.map +1 -1
  118. package/types/dist/lib/modes/lazy.d.mts +10 -43
  119. package/types/dist/lib/modes/lazy.d.mts.map +1 -1
  120. package/types/dist/lib/processors/flatten.d.mts +56 -107
  121. package/types/dist/lib/processors/flatten.d.mts.map +1 -1
  122. package/types/dist/lib/processors/loader.d.mts +6 -41
  123. package/types/dist/lib/processors/loader.d.mts.map +1 -1
  124. package/types/dist/lib/processors/type-generator.d.mts +2 -16
  125. package/types/dist/lib/processors/type-generator.d.mts.map +1 -1
  126. package/types/dist/lib/processors/typescript.d.mts +6 -53
  127. package/types/dist/lib/processors/typescript.d.mts.map +1 -1
  128. package/types/dist/lib/runtime/runtime-asynclocalstorage.d.mts +3 -71
  129. package/types/dist/lib/runtime/runtime-asynclocalstorage.d.mts.map +1 -1
  130. package/types/dist/lib/runtime/runtime-livebindings.d.mts +2 -37
  131. package/types/dist/lib/runtime/runtime-livebindings.d.mts.map +1 -1
  132. package/types/dist/lib/runtime/runtime.d.mts +3 -39
  133. package/types/dist/lib/runtime/runtime.d.mts.map +1 -1
  134. package/types/dist/slothlet.d.mts +3 -249
  135. package/types/dist/slothlet.d.mts.map +1 -1
  136. package/types/index.d.mts +36 -16
  137. package/types/index.d.mts.map +1 -0
  138. package/AGENT-USAGE.md +0 -736
  139. 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
- * Register a hook for API functions.
25
- *
26
- * @param {string} typePattern - Combined type and pattern (e.g., "before:math.*")
27
- * @param {function} handler - Hook handler function
28
- * @param {object} [options={}] - Hook options
29
- * @param {string} [options.id] - Unique identifier (auto-generated if not provided)
30
- * @param {number} [options.priority=0] - Higher = earlier execution
31
- * @param {string} [options.subset="primary"] - Phase: "before", "primary", or "after"
32
- * @returns {string} Hook ID
33
- * @public
34
- *
35
- * @example
36
- * hookManager.on("before:math.*", ({ args }) => {
37
- * console.log("Args:", args);
38
- * return args;
39
- * }, { priority: 100 });
40
- */
41
- public on(typePattern: string, handler: Function, options?: {
42
- id?: string;
43
- priority?: number;
44
- subset?: string;
45
- }): string;
46
- /**
47
- * Remove hooks matching filter criteria.
48
- *
49
- * @param {object} [filter={}] - Filter criteria
50
- * @param {string} [filter.id] - Remove hook by ID
51
- * @param {string} [filter.type] - Remove hooks by type
52
- * @param {string} [filter.pattern] - Remove hooks matching pattern
53
- * @returns {number} Number of hooks removed
54
- * @public
55
- */
56
- public remove(filter?: {
57
- id?: string;
58
- type?: string;
59
- pattern?: string;
60
- }): number;
61
- /**
62
- * Enable hooks matching filter criteria.
63
- *
64
- * @param {object|string} [filter={}] - Filter criteria (empty = enable all, string = pattern)
65
- * @param {string} [filter.id] - Enable hook by ID
66
- * @param {string} [filter.type] - Enable hooks by type
67
- * @param {string} [filter.pattern] - Enable hooks matching pattern
68
- * @returns {number} Number of hooks enabled
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":"AAmCA;;;;;;GAMG;AACH;IACC;;;;OAIG;IACH,yBAHU,MAAM,CAGwB;IAoDvC,aAAiC;IACjC,oBAAgD;IAChD,oBAAwD;IACxD,0BAAgC;IAChC,6BAAgC;IAEhC,qBAAsB;IACtB,0BAA0B;IAC1B,gCAAmC;IAGpC;;;;;;;;;;;;;;;;;OAiBG;IACH,uBAfW,MAAM,+BAGd;QAAyB,EAAE,GAAnB,MAAM;QACW,QAAQ,GAAzB,MAAM;QACW,MAAM,GAAvB,MAAM;KACd,GAAU,MAAM,CA+ElB;IAED;;;;;;;;;OASG;IACH,uBANG;QAAwB,EAAE,GAAlB,MAAM;QACU,IAAI,GAApB,MAAM;QACU,OAAO,GAAvB,MAAM;KACd,GAAU,MAAM,CA8ClB;IAED;;;;;;;;;OASG;IACH,uBAPW,MAAM,GAAC,MAAM,GAIX,MAAM,CAalB;IAED;;;;;;;;;OASG;IACH,wBAPW,MAAM,GAAC,MAAM,GAIX,MAAM,CAclB;IAED;;;;;;;;;;OAUG;IACH,qBARW,MAAM,GAAC,MAAM,GAKX,MAAM,CA8DlB;IAED;;;;;;;;OAQG;IACH,6BALW,MAAM,WACN,MAAM,GACJ,KAAK,CAAC,MAAM,CAAC,CAqDzB;IAED;;;;;;;;;OASG;IACH,gCAPW,MAAM,oBAEN,MAAM,OACN,MAAM,GACJ,MAAM,CA6ClB;IAED;;;;;;;;;;OAUG;IACH,+BARW,MAAM,UACN,GAAC,oBAED,MAAM,OACN,MAAM,GACJ,mBAAmB,CA+C/B;IAED;;;;;;;;;;;OAWG;IACH,gCATW,MAAM,8BAEN,GAAC,YACD,OAAO,UACP,KAAK,CAAC,KAAK,CAAC,OACZ,MAAM,OACN,MAAM,QA8BhB;IAED;;;;;;;;;;OAUG;IACH,+BARW,MAAM,SACN,KAAK,UACL,MAAM,oBAEN,MAAM,OACN,MAAM,QA4BhB;IAuDD;;;;;;OAMG;IACH,4CAEC;IA6ID;;;;;;OAMG;IACH,sBAHa,KAAK,CAAC,MAAM,CAAC,CAkBzB;IAED;;;;;;;OAOG;IACH,kCAJW,KAAK,CAAC,MAAM,CAAC,GACX,IAAI,CAWhB;IAED;;;OAGG;IACH,iCAUC;;CACD;;;;;;;;cA31Ba,OAAO;;;;aACP,GAAC;;8BAPe,0CAA0C"}
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
- * Registers a Slothlet instance and creates its per-instance lifecycle capability token.
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":"AA8CA;;;;;;;;;;;;;;GAcG;AACH,2CARW,MAAM,GACJ,IAAI,CAchB;AAED;;;;;;;;;;;;;GAaG;AACH,2CAPW,MAAM,GACJ,MAAM,GAAC,SAAS,CAQ5B;AAED;;;;;;;;;;;;;;;GAeG;AACH,sCAVW,MAAM,SACN,GAAC,GACC,OAAO,CAUnB"}
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
- * Subscribe to lifecycle event
17
- * @param {string} event - Event name (impl:created, impl:changed, impl:removed, materialized:complete, path:collision)
18
- * @param {Function} handler - Event handler function(eventData)
19
- * @returns {Function} Unsubscribe function
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":"AAwBA;;;;GAIG;AACH;IACC;;;OAGG;IACH,yBAFU,MAAM,CAEsB;IAOrC,2BAA4B;IAC5B,gBAAkB;IAClB,mBAAsB;IAGvB;;;;;;;;;;;;;;OAcG;IACH,wBAbW,MAAM,+BA0BhB;IAED;;;;;;;;;;;OAWG;IACH,iBAVW,MAAM,+BAYhB;IAED;;;;;;;;;;OAUG;IACH,kBATW,MAAM,2BAchB;IAED;;;;;OAKG;IACH,0BAJW,MAAM,2BAMhB;IAED;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,aAyDC;CAED;8BAtL6B,0CAA0C"}
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
- * Get materialization state as a boolean
31
- * Returns true when all lazy wrappers have been materialized
32
- * @returns {boolean} True if fully materialized, false if any lazy folders remain
33
- * @public
34
- *
35
- * @example
36
- * if (api.slothlet.materialize.materialized) {
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":"AAqBA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH;IACC,gCAAwC;IAWxC;;;;;;;;;;OAUG;IACH,2BARa,OAAO,CAUnB;IAED;;;;;;;;OAQG;IACH,kBAYC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,eAlBa,OAAO,CAAC,IAAI,CAAC,CA4BzB;CACD;8BA9G6B,0CAA0C"}
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"}