@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.
Files changed (138) hide show
  1. package/README.md +22 -9
  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 -1155
  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 -2513
  12. package/dist/lib/handlers/context-async.mjs +1 -168
  13. package/dist/lib/handlers/context-live.mjs +1 -168
  14. package/dist/lib/handlers/hook-manager.mjs +1 -773
  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 +17 -0
  21. package/dist/lib/handlers/unified-wrapper.mjs +1 -3042
  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 -355
  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 +17 -0
  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 +21 -1
  33. package/dist/lib/i18n/languages/en-gb.json +21 -1
  34. package/dist/lib/i18n/languages/en-us.json +21 -1
  35. package/dist/lib/i18n/languages/es-mx.json +21 -1
  36. package/dist/lib/i18n/languages/fr-fr.json +21 -1
  37. package/dist/lib/i18n/languages/hi-in.json +21 -1
  38. package/dist/lib/i18n/languages/ja-jp.json +21 -1
  39. package/dist/lib/i18n/languages/ko-kr.json +21 -1
  40. package/dist/lib/i18n/languages/pt-br.json +21 -1
  41. package/dist/lib/i18n/languages/ru-ru.json +21 -1
  42. package/dist/lib/i18n/languages/zh-cn.json +21 -1
  43. package/dist/lib/i18n/translations.mjs +1 -126
  44. package/dist/lib/modes/eager.mjs +1 -59
  45. package/dist/lib/modes/lazy.mjs +1 -81
  46. package/dist/lib/processors/flatten.mjs +1 -437
  47. package/dist/lib/processors/loader.mjs +1 -339
  48. package/dist/lib/processors/type-generator.mjs +1 -275
  49. package/dist/lib/processors/typescript.mjs +1 -172
  50. package/dist/lib/runtime/runtime-asynclocalstorage.mjs +1 -113
  51. package/dist/lib/runtime/runtime-livebindings.mjs +1 -78
  52. package/dist/lib/runtime/runtime.mjs +1 -102
  53. package/dist/slothlet.mjs +1 -808
  54. package/package.json +37 -31
  55. package/types/dist/lib/builders/api-assignment.d.mts +3 -92
  56. package/types/dist/lib/builders/api-assignment.d.mts.map +1 -1
  57. package/types/dist/lib/builders/api_builder.d.mts +102 -91
  58. package/types/dist/lib/builders/api_builder.d.mts.map +1 -1
  59. package/types/dist/lib/builders/builder.d.mts +1 -55
  60. package/types/dist/lib/builders/builder.d.mts.map +1 -1
  61. package/types/dist/lib/builders/modes-processor.d.mts +3 -27
  62. package/types/dist/lib/builders/modes-processor.d.mts.map +1 -1
  63. package/types/dist/lib/errors.d.mts +19 -109
  64. package/types/dist/lib/errors.d.mts.map +1 -1
  65. package/types/dist/lib/factories/component-base.d.mts +7 -177
  66. package/types/dist/lib/factories/component-base.d.mts.map +1 -1
  67. package/types/dist/lib/factories/context.d.mts +4 -22
  68. package/types/dist/lib/factories/context.d.mts.map +1 -1
  69. package/types/dist/lib/handlers/api-cache-manager.d.mts +20 -203
  70. package/types/dist/lib/handlers/api-cache-manager.d.mts.map +1 -1
  71. package/types/dist/lib/handlers/api-manager.d.mts +33 -408
  72. package/types/dist/lib/handlers/api-manager.d.mts.map +1 -1
  73. package/types/dist/lib/handlers/context-async.d.mts +23 -61
  74. package/types/dist/lib/handlers/context-async.d.mts.map +1 -1
  75. package/types/dist/lib/handlers/context-live.d.mts +22 -59
  76. package/types/dist/lib/handlers/context-live.d.mts.map +1 -1
  77. package/types/dist/lib/handlers/hook-manager.d.mts +46 -185
  78. package/types/dist/lib/handlers/hook-manager.d.mts.map +1 -1
  79. package/types/dist/lib/handlers/lifecycle-token.d.mts +3 -48
  80. package/types/dist/lib/handlers/lifecycle-token.d.mts.map +1 -1
  81. package/types/dist/lib/handlers/lifecycle.d.mts +5 -82
  82. package/types/dist/lib/handlers/lifecycle.d.mts.map +1 -1
  83. package/types/dist/lib/handlers/materialize-manager.d.mts +8 -70
  84. package/types/dist/lib/handlers/materialize-manager.d.mts.map +1 -1
  85. package/types/dist/lib/handlers/metadata.d.mts +17 -221
  86. package/types/dist/lib/handlers/metadata.d.mts.map +1 -1
  87. package/types/dist/lib/handlers/ownership.d.mts +44 -160
  88. package/types/dist/lib/handlers/ownership.d.mts.map +1 -1
  89. package/types/dist/lib/handlers/permission-manager.d.mts +47 -0
  90. package/types/dist/lib/handlers/permission-manager.d.mts.map +1 -0
  91. package/types/dist/lib/handlers/unified-wrapper.d.mts +26 -239
  92. package/types/dist/lib/handlers/unified-wrapper.d.mts.map +1 -1
  93. package/types/dist/lib/handlers/version-manager.d.mts +28 -225
  94. package/types/dist/lib/handlers/version-manager.d.mts.map +1 -1
  95. package/types/dist/lib/helpers/class-instance-wrapper.d.mts +2 -52
  96. package/types/dist/lib/helpers/class-instance-wrapper.d.mts.map +1 -1
  97. package/types/dist/lib/helpers/config.d.mts +125 -123
  98. package/types/dist/lib/helpers/config.d.mts.map +1 -1
  99. package/types/dist/lib/helpers/eventemitter-context.d.mts +3 -29
  100. package/types/dist/lib/helpers/eventemitter-context.d.mts.map +1 -1
  101. package/types/dist/lib/helpers/hint-detector.d.mts +2 -15
  102. package/types/dist/lib/helpers/hint-detector.d.mts.map +1 -1
  103. package/types/dist/lib/helpers/modes-utils.d.mts +3 -30
  104. package/types/dist/lib/helpers/modes-utils.d.mts.map +1 -1
  105. package/types/dist/lib/helpers/pattern-matcher.d.mts +4 -0
  106. package/types/dist/lib/helpers/pattern-matcher.d.mts.map +1 -0
  107. package/types/dist/lib/helpers/resolve-from-caller.d.mts +3 -27
  108. package/types/dist/lib/helpers/resolve-from-caller.d.mts.map +1 -1
  109. package/types/dist/lib/helpers/sanitize.d.mts +4 -92
  110. package/types/dist/lib/helpers/sanitize.d.mts.map +1 -1
  111. package/types/dist/lib/helpers/utilities.d.mts +4 -52
  112. package/types/dist/lib/helpers/utilities.d.mts.map +1 -1
  113. package/types/dist/lib/i18n/translations.d.mts +4 -37
  114. package/types/dist/lib/i18n/translations.d.mts.map +1 -1
  115. package/types/dist/lib/modes/eager.d.mts +8 -30
  116. package/types/dist/lib/modes/eager.d.mts.map +1 -1
  117. package/types/dist/lib/modes/lazy.d.mts +10 -43
  118. package/types/dist/lib/modes/lazy.d.mts.map +1 -1
  119. package/types/dist/lib/processors/flatten.d.mts +56 -107
  120. package/types/dist/lib/processors/flatten.d.mts.map +1 -1
  121. package/types/dist/lib/processors/loader.d.mts +6 -41
  122. package/types/dist/lib/processors/loader.d.mts.map +1 -1
  123. package/types/dist/lib/processors/type-generator.d.mts +2 -16
  124. package/types/dist/lib/processors/type-generator.d.mts.map +1 -1
  125. package/types/dist/lib/processors/typescript.d.mts +6 -53
  126. package/types/dist/lib/processors/typescript.d.mts.map +1 -1
  127. package/types/dist/lib/runtime/runtime-asynclocalstorage.d.mts +3 -71
  128. package/types/dist/lib/runtime/runtime-asynclocalstorage.d.mts.map +1 -1
  129. package/types/dist/lib/runtime/runtime-livebindings.d.mts +2 -37
  130. package/types/dist/lib/runtime/runtime-livebindings.d.mts.map +1 -1
  131. package/types/dist/lib/runtime/runtime.d.mts +3 -39
  132. package/types/dist/lib/runtime/runtime.d.mts.map +1 -1
  133. package/types/dist/slothlet.d.mts +3 -249
  134. package/types/dist/slothlet.d.mts.map +1 -1
  135. package/types/index.d.mts +36 -16
  136. package/types/index.d.mts.map +1 -0
  137. package/AGENT-USAGE.md +0 -736
  138. package/docs/API-RULES.md +0 -712
@@ -1,229 +1,25 @@
1
- /**
2
- * Metadata handler for introspection of function metadata
3
- * @class Metadata
4
- * @extends ComponentBase
5
- * @package
6
- */
7
1
  export class Metadata extends ComponentBase {
8
2
  static slothletProperty: string;
9
- _instanceId: any;
10
- /**
11
- * Tag system metadata (SECURE, IMMUTABLE)
12
- * Called internally during wrapper/function creation
13
- *
14
- * The `token` parameter must be the module-private `LIFECYCLE_TOKEN` Symbol exported
15
- * from `@cldmv/slothlet/handlers/lifecycle-token`. Because a Symbol is a unique,
16
- * non-forgeable value within a Node.js process, and because the token module is not
17
- * listed in the package's public `exports` map, user-land code cannot construct a
18
- * value that satisfies the `token === LIFECYCLE_TOKEN` check without modifying the
19
- * source or importing an undocumented internal path.
20
- *
21
- * @param {Function|Object} target - Wrapper or function to tag
22
- * @param {Object} systemData - System metadata (filePath, apiPath, moduleID, sourceFolder)
23
- * @param {symbol} token - Must be `LIFECYCLE_TOKEN` — the unforgeable module-private Symbol
24
- * @private
25
- */
26
- private tagSystemMetadata;
27
- /**
28
- * Get system metadata only (without user metadata)
29
- * @param {Function|Object} target - Wrapper or function
30
- * @returns {Object|null} System metadata or null
31
- * @package
32
- */
33
- getSystemMetadata(target: Function | any): any | null;
34
- /**
35
- * Get metadata for a target (combines system + user)
36
- * For wrappers: checks current impl to ensure metadata is current
37
- * @param {Function|Object} target - Wrapper or function
38
- * @returns {Object} Combined metadata (deeply frozen)
39
- * @public
40
- */
41
- public getMetadata(target: Function | any): any;
42
- /**
43
- * Set global user metadata (applies to all functions)
44
- * @param {string} key - Metadata key
45
- * @param {unknown} value - Metadata value
46
- * @public
47
- */
48
- public setGlobalMetadata(key: string, value: unknown): void;
49
- /**
50
- * Add/update user metadata for specific function
51
- * @param {Function} target - Function to tag with metadata
52
- * @param {string} key - Metadata key
53
- * @param {unknown} value - Metadata value
54
- * @public
55
- */
56
- public setUserMetadata(target: Function, key: string, value: unknown): void;
57
- /**
58
- * Remove user metadata from specific function
59
- * @param {Function} target - Function to remove metadata from
60
- * @param {string|string[]|Object<string, string[]>} [key] - Optional key(s) to remove (removes all if omitted). Can be:
61
- * - string: Remove single key
62
- * - string[]: Remove multiple keys (each element must be a string)
63
- * - {key: string[]}: Remove nested keys from object values
64
- * @public
65
- */
66
- public removeUserMetadata(target: Function, key?: string | string[] | {
67
- [x: string]: string[];
68
- }): void;
69
- /**
70
- * Register user metadata keyed by an identifier (moduleID or API path)
71
- *
72
- * @description
73
- * Stores user-provided metadata in `#userMetadataStore` under the given
74
- * `identifier`. The identifier is treated opaquely — callers pass either a
75
- * generated moduleID (e.g. `base_slothlet`) or a dot-notation API path
76
- * (e.g. `math`). `getMetadata()` retrieves entries using the same key via
77
- * both the moduleID lookup and `collectMetadataFromParents`, so storing
78
- * under a single key is sufficient for both cases.
79
- *
80
- * Multiple calls to the same identifier are merged; later calls override
81
- * earlier ones for conflicting keys.
82
- *
83
- * @param {string} identifier - Module ID or dot-notation API path
84
- * @param {Object} metadata - User metadata object to merge
85
- * @package
86
- */
87
- registerUserMetadata(identifier: string, metadata: any): void;
88
- /**
89
- * Remove all user metadata for an apiPath
90
- *
91
- * @description
92
- * Cleanup method to remove all user metadata associated with an apiPath.
93
- * Used during api.remove() or cleanup operations.
94
- *
95
- * @param {string} apiPath - API path to remove
96
- * @package
97
- */
98
- removeUserMetadataByApiPath(apiPath: string): void;
99
- /**
100
- * Set metadata for all functions reachable at an API path.
101
- *
102
- * @description
103
- * Stores metadata keyed by `apiPath` so that every function whose system
104
- * `apiPath` starts with (or equals) the given path inherits the values via
105
- * `collectMetadataFromParents()` in `getMetadata()`.
106
- *
107
- * Accepts either a single key/value pair or a plain object to merge.
108
- * Multiple calls to the same path are merged; later calls override earlier
109
- * ones for conflicting keys.
110
- *
111
- * Priority (lowest → highest): global → setForPath → set() → system.
112
- *
113
- * @param {string} apiPath - Dot-notation path (e.g. `"math"`, `"math.add"`)
114
- * @param {string|Object} keyOrObj - Key string (with `value`) OR metadata object to merge
115
- * @param {unknown} [value] - Value when `keyOrObj` is a string key
116
- * @public
117
- */
118
- public setPathMetadata(apiPath: string, keyOrObj: string | any, value?: unknown): void;
119
- /**
120
- * Get the user metadata collected from the path store for a given API path.
121
- *
122
- * @description
123
- * Traverses from root segment to leaf, merging parent → child metadata — the same
124
- * traversal used by `collectMetadataFromParents` inside `getMetadata()`. Does not
125
- * include immutable system metadata; only user-supplied path store entries are returned.
126
- *
127
- * @param {string} apiPath - Dot-notation API path (e.g. `"v1.auth"`, `"math"`).
128
- * @returns {Object} Merged user metadata for the path (not frozen).
129
- * @public
130
- * @example
131
- * metadata.getPathMetadata("v1.auth"); // { stable: true, category: "auth" }
132
- */
133
- public getPathMetadata(apiPath: string): any;
134
- /**
135
- * Remove metadata keys (or all metadata) for an API path.
136
- *
137
- * @description
138
- * Removes one specific key, multiple keys, or ALL user metadata stored under
139
- * the given `apiPath` key in the path store.
140
- * Only affects metadata set via `setForPath()` / `registerUserMetadata()` for
141
- * this exact path segment - it does not walk descendant paths.
142
- *
143
- * @param {string} apiPath - Dot-notation path (e.g. `"math"`, `"math.add"`)
144
- * @param {string|string[]} [key] - Key(s) to remove. Omit to remove all metadata for the path.
145
- * @public
146
- */
147
- public removePathMetadata(apiPath: string, key?: string | string[]): void;
148
- /**
149
- * Export user-managed metadata state for preservation across reload.
150
- *
151
- * @description
152
- * Captures `#globalUserMetadata` and all entries in `#userMetadataStore`
153
- * so they can be restored to a fresh Metadata instance after reload.
154
- * Called by `slothlet.reload()` BEFORE `load()` destroys this instance.
155
- *
156
- * @returns {{ globalMetadata: Object, userMetadataStore: Map }} Snapshot of user state
157
- * @package
158
- */
3
+ _instanceId: null;
4
+ tagSystemMetadata(target: any, systemData: any, token: any): void;
5
+ getSystemMetadata(target: any): any;
6
+ getMetadata(target: any): any;
7
+ setGlobalMetadata(key: any, value: any): void;
8
+ setUserMetadata(target: any, key: any, value: any): void;
9
+ removeUserMetadata(target: any, key: any): void;
10
+ registerUserMetadata(identifier: any, metadata: any): void;
11
+ removeUserMetadataByApiPath(apiPath: any): void;
12
+ setPathMetadata(apiPath: any, keyOrObj: any, value: any): void;
13
+ getPathMetadata(apiPath: any): {};
14
+ removePathMetadata(apiPath: any, key: any): void;
159
15
  exportUserState(): {
160
- globalMetadata: any;
16
+ globalMetadata: {};
161
17
  userMetadataStore: Map<any, any>;
162
18
  };
163
- /**
164
- * Restore user-managed metadata state after a fresh load.
165
- *
166
- * @description
167
- * Merges previously exported state into the new (empty) Metadata instance.
168
- * Called by `slothlet.reload()` AFTER `load()` creates the new instance and
169
- * BEFORE operation-history replay so that `registerUserMetadata()` from replay
170
- * can properly merge over the restored base state.
171
- *
172
- * Merge priority: existing (from load) > saved state.
173
- * This means replay-registered api.add metadata overrides restored values
174
- * for the same key, which is the desired behaviour.
175
- *
176
- * @param {{ globalMetadata: Object, userMetadataStore: Map }} state - Previously exported state
177
- * @package
178
- */
179
- importUserState(state: {
180
- globalMetadata: any;
181
- userMetadataStore: Map<any, any>;
182
- }): void;
183
- /**
184
- * Get metadata of any function by API path.
185
- *
186
- * Traverses `this.slothlet.api` using the dot-notation path, materializes
187
- * lazy wrappers as needed, then returns the combined metadata for the
188
- * resolved target via `getMetadata()`.
189
- *
190
- * Called by the `api.slothlet.metadata.get()` closure injected in
191
- * `slothlet.injectRuntimeMetadataFunctions()`.
192
- *
193
- * @param {string} path - Dot-notation API path (e.g. `"math.add"`)
194
- * @returns {Promise<object|null>} Combined metadata or null
195
- * @public
196
- */
197
- public get(path: string): Promise<object | null>;
198
- /**
199
- * Get metadata for the currently-executing API function.
200
- *
201
- * Reads `currentWrapper` from the active context-manager store — the same
202
- * fast synchronous path used by the unified wrapper's `apply` trap.
203
- * Throws `RUNTIME_NO_ACTIVE_CONTEXT` when called outside of a slothlet
204
- * execution context.
205
- *
206
- * Called by the `api.slothlet.metadata.self()` closure injected in
207
- * `slothlet.injectRuntimeMetadataFunctions()`.
208
- *
209
- * @returns {object} Combined metadata for the current function
210
- * @public
211
- */
212
- public self(): object;
213
- /**
214
- * Get metadata for the API function that called the current function.
215
- *
216
- * Reads `callerWrapper` from the active context-manager store.
217
- * Returns `null` when there is no caller in context (e.g. the function
218
- * was invoked directly from outside the API).
219
- *
220
- * Called by the `api.slothlet.metadata.caller()` closure injected in
221
- * `slothlet.injectRuntimeMetadataFunctions()`.
222
- *
223
- * @returns {object|null} Combined metadata for the calling function, or null
224
- * @public
225
- */
226
- public caller(): object | null;
19
+ importUserState(state: any): void;
20
+ get(path: any): Promise<any>;
21
+ self(): any;
22
+ caller(): any;
227
23
  #private;
228
24
  }
229
25
  import { ComponentBase } from "@cldmv/slothlet/factories/component-base";
@@ -1 +1 @@
1
- {"version":3,"file":"metadata.d.mts","sourceRoot":"","sources":["../../../../dist/lib/handlers/metadata.mjs"],"names":[],"mappings":"AAwBA;;;;;GAKG;AACH;IACC,gCAAqC;IASrC,iBAAmB;IAkCnB;;;;;;;;;;;;;;;OAeG;IACH,0BAyCC;IAED;;;;;OAKG;IACH,0BAJW,cAAe,GACb,MAAO,IAAI,CAYvB;IAED;;;;;;OAMG;IACH,2BAJW,cAAe,OAoEzB;IAED;;;;;OAKG;IACH,8BAJW,MAAM,SACN,OAAO,QAKjB;IAED;;;;;;OAMG;IACH,8CAJW,MAAM,SACN,OAAO,QA+CjB;IAED;;;;;;;;OAQG;IACH,kDANW,MAAM,GAAC,MAAM,EAAE,GAAC;YAAO,MAAM,GAAE,MAAM,EAAE;KAAC,QAkFlD;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,iCAJW,MAAM,uBA2BhB;IAED;;;;;;;;;OASG;IACH,qCAHW,MAAM,QAMhB;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,gCALW,MAAM,YACN,MAAM,MAAO,UACb,OAAO,QAyBjB;IAED;;;;;;;;;;;;;OAaG;IACH,gCANW,MAAM,OAoBhB;IAED;;;;;;;;;;;;OAYG;IACH,mCAJW,MAAM,QACN,MAAM,GAAC,MAAM,EAAE,QA+BzB;IAED;;;;;;;;;;OAUG;IACH,mBAHa;QAAE,cAAc,MAAS;QAAC,iBAAiB,gBAAK;KAAE,CAe9D;IAED;;;;;;;;;;;;;;;OAeG;IACH,uBAHW;QAAE,cAAc,MAAS;QAAC,iBAAiB,gBAAK;KAAE,QAgC5D;IAED;;;;;;;;;;;;;OAaG;IACH,iBAJW,MAAM,GACJ,OAAO,CAAC,MAAM,GAAC,IAAI,CAAC,CAkChC;IAED;;;;;;;;;;;;;OAaG;IACH,eAHa,MAAM,CASlB;IAED;;;;;;;;;;;;OAYG;IACH,iBAHa,MAAM,GAAC,IAAI,CAOvB;;CACD;8BA9qB6B,0CAA0C"}
1
+ {"version":3,"file":"metadata.d.mts","sourceRoot":"","sources":["../../../../dist/lib/handlers/metadata.mjs"],"names":[],"mappings":"AAA2M;IAAqC,gCAAmC;IAA8E,kBAAiB;IAA4U,kEAA2zB;IAAA,oCAA4N;IAAA,8BAAgkC;IAAA,8CAAiE;IAAA,yDAA26B;IAAA,gDAA0mD;IAAA,2DAAkd;IAAA,gDAAgG;IAAA,+DAA4kB;IAAA,kCAAyX;IAAA,iDAAijB;IAAA;;;MAA8P;IAAA,kCAA2jB;IAAA,6BAA8kB;IAAA,YAAkO;IAAA,cAAoJ;;CAAC;8BAAxnS,0CAA0C"}
@@ -1,170 +1,54 @@
1
- /**
2
- * Summary result of an unregister operation.
3
- * @typedef {Object} UnregisterResult
4
- * @property {string[]} removed - API paths that were removed.
5
- * @property {Object[]} rolledBack - Entries that were rolled back to a previous owner.
6
- */
7
- /**
8
- * Tracks which modules own which API paths for hot reload and rollback
9
- * @class OwnershipManager
10
- * @extends ComponentBase
11
- * @public
12
- */
13
1
  export class OwnershipManager extends ComponentBase {
14
2
  static slothletProperty: string;
15
- constructor(slothlet: any);
16
3
  moduleToPath: Map<any, any>;
17
4
  pathToModule: Map<any, any>;
18
5
  _unregisteredModules: Set<any>;
19
- /**
20
- * Register module ownership of API path with its value
21
- * @param {Object} options - Registration options
22
- * @param {string} options.moduleID - Module identifier
23
- * @param {string} options.apiPath - API path being registered
24
- * @param {*} options.value - The actual function/object being registered
25
- * @param {string} [options.source="core"] - Source of registration
26
- * @param {string} [options.collisionMode="error"] - Collision mode: skip, warn, error, merge, replace
27
- * @param {Object} [options.config] - Config object for silent mode check
28
- * @param {string} [options.filePath=null] - File path of the module source (for metadata tracking)
29
- * @returns {Object|null} Registration entry or null if skipped
30
- * @public
31
- */
32
- public register({ moduleID, apiPath, value, source, collisionMode, config, filePath }: {
33
- moduleID: string;
34
- apiPath: string;
6
+ register({ moduleID, apiPath, value, source, collisionMode, config, filePath }: {
7
+ moduleID: any;
8
+ apiPath: any;
35
9
  value: any;
36
- source?: string;
37
- collisionMode?: string;
38
- config?: any;
39
- filePath?: string;
40
- }): any | null;
41
- /**
42
- * @param {string} moduleID - Module to unregister.
43
- * @returns {UnregisterResult} Removal summary.
44
- * @public
45
- *
46
- * @description
47
- * Removes all paths owned by the provided moduleID and reports removals and rollbacks.
48
- *
49
- * @example
50
- * const result = ownership.unregister("module-a");
51
- */
52
- public unregister(moduleID: string): UnregisterResult;
53
- /**
54
- * @param {string} apiPath - API path to modify.
55
- * @param {string|null} [moduleID=null] - Module to remove (defaults to current owner).
56
- * @returns {{ action: "delete"|"none"|"restore", removedModuleId: string|null,
57
- * restoreModuleId: string|null }} Action taken for the path.
58
- * @public
59
- *
60
- * @description
61
- * Removes a module owner from a specific API path. If the current owner is removed and
62
- * previous owners exist, the path is restored to the previous owner.
63
- *
64
- * @example
65
- * const result = ownership.removePath("plugins.tools", "module-a");
66
- */
67
- public removePath(apiPath: string, moduleID?: string | null): {
68
- action: "delete" | "none" | "restore";
69
- removedModuleId: string | null;
70
- restoreModuleId: string | null;
10
+ source?: string | undefined;
11
+ collisionMode?: string | undefined;
12
+ config?: null | undefined;
13
+ filePath?: null | undefined;
14
+ }): any;
15
+ unregister(moduleID: any): {
16
+ removed: any[];
17
+ rolledBack: {
18
+ apiPath: any;
19
+ restoredTo: any;
20
+ }[];
71
21
  };
72
- /**
73
- * Get current owner of API path
74
- * @param {string} apiPath - API path to check
75
- * @returns {Object|null} Current owner entry or null
76
- * @public
77
- */
78
- public getCurrentOwner(apiPath: string): any | null;
79
- /**
80
- * Get current value for API path
81
- * @param {string} apiPath - API path to check
82
- * @returns {*} Current value or undefined
83
- * @public
84
- */
85
- public getCurrentValue(apiPath: string): any;
86
- /**
87
- * Get all paths owned by module
88
- * @param {string} moduleID - Module to query
89
- * @returns {Array<string>} Array of API paths
90
- * @public
91
- */
92
- public getModulePaths(moduleID: string): Array<string>;
93
- /**
94
- * Get ownership history for path
95
- * @param {string} apiPath - API path to query
96
- * @returns {Array<Object>} Ownership history stack
97
- * @public
98
- */
99
- public getPathHistory(apiPath: string): Array<any>;
100
- /**
101
- * Check if module owns path
102
- * @param {string} moduleID - Module to check
103
- * @param {string} apiPath - API path to check
104
- * @returns {boolean} True if module owns path
105
- * @public
106
- */
107
- public ownsPath(moduleID: string, apiPath: string): boolean;
108
- /**
109
- * Get diagnostic info about ownership
110
- * @returns {Object} Diagnostic information
111
- * @public
112
- */
113
- public getDiagnostics(): any;
114
- /**
115
- * Get ownership info for a specific API path
116
- * @param {string} apiPath - API path to check
117
- * @returns {Set<string>|null} Set of moduleIDs that own this path, or null if path not found
118
- * @public
119
- */
120
- public getPathOwnership(apiPath: string): Set<string> | null;
121
- /**
122
- * Recursively register API subtree with ownership
123
- * @param {object} api - API object or subtree
124
- * @param {string} moduleID - Module identifier (owner)
125
- * @param {string} path - Current API path
126
- * @param {WeakSet} [visited] - Visited objects (prevents circular refs)
127
- * @returns {void}
128
- * @public
129
- *
130
- * @description
131
- * Registers entire API subtree structure with ownership manager.
132
- * Used during load, reload, and api.add to establish ownership relationships.
133
- *
134
- * @example
135
- * ownership.registerSubtree(api, "base_abc123", "");
136
- */
137
- public registerSubtree(api: object, moduleID: string, path: string, visited?: WeakSet<any>): void;
138
- /**
139
- * Clear all ownership data
140
- * @public
141
- */
142
- public clear(): void;
143
- /**
144
- * Export ownership state for preservation during reload
145
- * @returns {Object} Serializable ownership state
146
- * @public
147
- */
148
- public exportState(): any;
149
- /**
150
- * Import ownership state from exported data
151
- * @param {Object} state - Previously exported state
152
- * @public
153
- */
154
- public importState(state: any): void;
22
+ removePath(apiPath: any, moduleID?: null): {
23
+ action: string;
24
+ removedModuleId: any;
25
+ restoreModuleId: any;
26
+ };
27
+ getCurrentOwner(apiPath: any): any;
28
+ getCurrentValue(apiPath: any): any;
29
+ getModulePaths(moduleID: any): any[];
30
+ getPathHistory(apiPath: any): any;
31
+ ownsPath(moduleID: any, apiPath: any): any;
32
+ getDiagnostics(): {
33
+ totalModules: number;
34
+ totalPaths: number;
35
+ modules: {
36
+ moduleID: any;
37
+ pathCount: any;
38
+ }[];
39
+ conflictedPaths: {
40
+ apiPath: any;
41
+ ownerStack: any;
42
+ }[];
43
+ };
44
+ getPathOwnership(apiPath: any): Set<any> | null;
45
+ registerSubtree(api: any, moduleID: any, path: any, visited?: WeakSet<object>): void;
46
+ clear(): void;
47
+ exportState(): {
48
+ moduleToPath: any[][];
49
+ pathToModule: [any, any][];
50
+ };
51
+ importState(state: any): void;
155
52
  }
156
- /**
157
- * Summary result of an unregister operation.
158
- */
159
- export type UnregisterResult = {
160
- /**
161
- * - API paths that were removed.
162
- */
163
- removed: string[];
164
- /**
165
- * - Entries that were rolled back to a previous owner.
166
- */
167
- rolledBack: any[];
168
- };
169
53
  import { ComponentBase } from "@cldmv/slothlet/factories/component-base";
170
54
  //# sourceMappingURL=ownership.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ownership.d.mts","sourceRoot":"","sources":["../../../../dist/lib/handlers/ownership.mjs"],"names":[],"mappings":"AAqBA;;;;;GAKG;AAEH;;;;;GAKG;AACH;IACC,gCAAsC;IAEtC,2BAKC;IAHA,4BAA6B;IAC7B,4BAA6B;IAC7B,+BAAqC;IAGtC;;;;;;;;;;;;OAYG;IACH,uFAVG;QAAwB,QAAQ,EAAxB,MAAM;QACU,OAAO,EAAvB,MAAM;QACK,KAAK,EAAhB,GAAC;QACgB,MAAM,GAAvB,MAAM;QACW,aAAa,GAA9B,MAAM;QACW,MAAM;QACN,QAAQ,GAAzB,MAAM;KACd,GAAU,MAAO,IAAI,CAsFvB;IAED;;;;;;;;;;OAUG;IACH,4BAVW,MAAM,GACJ,gBAAgB,CAsC5B;IAED;;;;;;;;;;;;;OAaG;IACH,2BAbW,MAAM,aACN,MAAM,GAAC,IAAI,GACT;QAAE,MAAM,EAAE,QAAQ,GAAC,MAAM,GAAC,SAAS,CAAC;QAAC,eAAe,EAAE,MAAM,GAAC,IAAI,CAAC;QAC5E,eAAe,EAAE,MAAM,GAAC,IAAI,CAAA;KAAE,CA4ChC;IAED;;;;;OAKG;IACH,gCAJW,MAAM,GACJ,MAAO,IAAI,CAOvB;IAED;;;;;OAKG;IACH,gCAJW,MAAM,GACJ,GAAC,CAkBb;IAED;;;;;OAKG;IACH,gCAJW,MAAM,GACJ,KAAK,CAAC,MAAM,CAAC,CAKzB;IAED;;;;;OAKG;IACH,+BAJW,MAAM,GACJ,KAAK,KAAQ,CAKzB;IAED;;;;;;OAMG;IACH,0BALW,MAAM,WACN,MAAM,GACJ,OAAO,CAMnB;IAED;;;;OAIG;IACH,6BAeC;IAED;;;;;OAKG;IACH,iCAJW,MAAM,GACJ,GAAG,CAAC,MAAM,CAAC,GAAC,IAAI,CAS5B;IAED;;;;;;;;;;;;;;;OAeG;IACH,4BAdW,MAAM,YACN,MAAM,QACN,MAAM,2BAEJ,IAAI,CAwDhB;IAED;;;OAGG;IACH,qBAIC;IAED;;;;OAIG;IACH,0BAKC;IAED;;;;OAIG;IACH,qCAaC;CACD;;;;;;;;aAlaa,MAAM,EAAE;;;;gBACR,KAAQ;;8BAPQ,0CAA0C"}
1
+ {"version":3,"file":"ownership.d.mts","sourceRoot":"","sources":["../../../../dist/lib/handlers/ownership.mjs"],"names":[],"mappings":"AAAyI;IAA6C,gCAAoC;IAAsC,4BAAyB;IAAC,4BAAyB;IAAC,+BAAiC;IAAC;;;;;;;;YAAqlD;IAAA;;;;;;MAAud;IAAA;;;;MAAszB;IAAA,mCAAyI;IAAA,mCAA+M;IAAA,qCAAgF;IAAA,kCAAkE;IAAA,2CAA6G;IAAA;;;;;;;;;;;MAA6W;IAAA,gDAA+J;IAAA,qFAAstB;IAAA,cAA8F;IAAA;;;MAA0K;IAAA,8BAAkM;CAAC;8BAAn6K,0CAA0C"}
@@ -0,0 +1,47 @@
1
+ export class PermissionManager extends ComponentBase {
2
+ static slothletProperty: string;
3
+ addRule(rule: any, ownerModuleID?: null, ruleId?: null): string;
4
+ removeRule(ruleId: any, callerModuleID?: null): boolean;
5
+ checkAccess(callerPath: any, targetPath: any, callerFilePath?: null, targetFilePath?: null): any;
6
+ getRulesForPath(targetPath: any): {
7
+ id: any;
8
+ caller: any;
9
+ target: any;
10
+ effect: any;
11
+ ownerModuleID: any;
12
+ registeredAt: any;
13
+ }[];
14
+ getRulesByModule(moduleID: any): {
15
+ id: any;
16
+ caller: any;
17
+ target: any;
18
+ effect: any;
19
+ ownerModuleID: any;
20
+ registeredAt: any;
21
+ }[];
22
+ getRulesForCaller(callerPath: any): {
23
+ id: any;
24
+ caller: any;
25
+ target: any;
26
+ effect: any;
27
+ ownerModuleID: any;
28
+ registeredAt: any;
29
+ }[];
30
+ enable(): void;
31
+ disable(): void;
32
+ isEnabled(): boolean;
33
+ exportRules(): {
34
+ rule: {
35
+ caller: any;
36
+ target: any;
37
+ effect: any;
38
+ };
39
+ ownerModuleID: any;
40
+ }[];
41
+ importRules(registrations: any): void;
42
+ shutdown(): Promise<void>;
43
+ debug(category: any, data: any): void;
44
+ #private;
45
+ }
46
+ import { ComponentBase } from "@cldmv/slothlet/factories/component-base";
47
+ //# sourceMappingURL=permission-manager.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"permission-manager.d.mts","sourceRoot":"","sources":["../../../../dist/lib/handlers/permission-manager.mjs"],"names":[],"mappings":"AAAwM;IAA8C,gCAA4C;IAAiiB,gEAAua;IAAA,wDAAqc;IAAA,iGAAgvB;IAAA;;;;;;;QAA2O;IAAA;;;;;;;QAAoL;IAAA;;;;;;;QAA6O;IAAA,eAA+C;IAAA,gBAAiD;IAAA,qBAAiC;IAAA;;;;;;;QAAsM;IAAA,sCAA6I;IAAA,0BAAmK;IAA29F,sCAAwD;;CAAC;8BAA7pN,0CAA0C"}