@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,250 +1,4 @@
1
- /**
2
- * Create a new Slothlet instance and load an API from a directory.
3
- * This is the sole public entry point for slothlet. Each call produces an independent
4
- * API instance with its own component graph, context store, and lifecycle.
5
- * @alias module:@cldmv/slothlet
6
- * @async
7
- * @param {SlothletOptions} config - Configuration options
8
- * @returns {Promise<SlothletAPI>} Fully loaded, proxy-based API object
9
- * @public
10
- * @example
11
- * // Minimal usage
12
- * const api = await slothlet({ dir: "./api" });
13
- * const result = await api.math.add(2, 3);
14
- * await api.slothlet.shutdown();
15
- *
16
- * @example
17
- * // Lazy mode with background materialization
18
- * const api = await slothlet({
19
- * dir: "./api",
20
- * mode: "lazy",
21
- * backgroundMaterialize: true
22
- * });
23
- *
24
- * @example
25
- * // With hooks
26
- * const api = await slothlet({ dir: "./api", hook: true });
27
- * api.slothlet.hook.on("before", "**", (endpoint, args) => { /* ... *\/ });
28
- *
29
- * @example
30
- * // Hot-reload a module at runtime
31
- * await api.slothlet.api.reload("./api/math.mjs");
32
- *
33
- * @example
34
- * // Strict collision control
35
- * const api = await slothlet({
36
- * dir: "./api",
37
- * api: { collision: { initial: "merge", api: "error" } }
38
- * });
39
- */
40
- export function slothlet(config: SlothletOptions): Promise<SlothletAPI>;
41
- export default slothlet;
42
- /**
43
- * Configuration options passed to `slothlet()`.
44
- */
45
- export type SlothletOptions = {
46
- /**
47
- * - Directory to scan for API modules. Relative paths are resolved from the calling file.
48
- */
49
- dir: string;
50
- /**
51
- * - Loading strategy.
52
- * - `"eager"` — all modules are loaded immediately at startup (default).
53
- * - `"lazy"` — modules are loaded on first access via a Proxy.
54
- * Also accepted: `"immediate"` / `"preload"` (eager aliases); `"deferred"` / `"proxy"` (lazy aliases).
55
- */
56
- mode?: "eager" | "lazy";
57
- /**
58
- * - Context propagation runtime.
59
- * - `"async"` — AsyncLocalStorage (Node.js built-in, recommended for production).
60
- * - `"live"` — Experimental live bindings.
61
- * Also accepted: `"asynclocalstorage"` / `"als"` / `"node"` as aliases for `"async"`.
62
- */
63
- runtime?: "async" | "live";
64
- /**
65
- * - Directory traversal depth. `Infinity` scans all subdirectories (default). `0` scans only the root.
66
- */
67
- apiDepth?: number;
68
- /**
69
- * - Object merged into the per-request context accessible inside API functions via `import { context } from "@cldmv/slothlet/runtime"`.
70
- */
71
- context?: object | null;
72
- /**
73
- * - Object whose properties are merged directly onto the root API and also available as `api.slothlet.reference`.
74
- */
75
- reference?: object | null;
76
- /**
77
- * - Controls how per-request scope data is merged. `"shallow"` merges top-level keys; `"deep"` recurses into nested objects.
78
- */
79
- scope?: {
80
- merge: "shallow" | "deep";
81
- };
82
- /**
83
- * - API build and mutation settings.
84
- */
85
- api?: {
86
- collision?: string | {
87
- initial: string;
88
- api: string;
89
- };
90
- mutations?: object;
91
- };
92
- /**
93
- * - Hook system configuration.
94
- * - `false` — disabled (default).
95
- * - `true` — enabled, all endpoints.
96
- * - `string` — enabled with a default glob pattern.
97
- * - `object` — full control: `{ enabled: boolean, pattern?: string, suppressErrors?: boolean }`.
98
- */
99
- hook?: boolean | string | object;
100
- /**
101
- * - Enable verbose internal logging. `true` enables all categories.
102
- * Pass an object with sub-keys `builder`, `api`, `index`, `modes`, `wrapper`, `ownership`, `context` to target specific subsystems.
103
- */
104
- debug?: boolean | object;
105
- /**
106
- * - Suppress all console output from slothlet (warnings, deprecations). Does not affect `debug`.
107
- */
108
- silent?: boolean;
109
- /**
110
- * - Enable the `api.slothlet.diag.*` introspection namespace. Intended for testing; do not enable in production.
111
- */
112
- diagnostics?: boolean;
113
- /**
114
- * - Enable internal tracking. Pass `true` or `{ materialization: true }` to track lazy-mode materialization progress.
115
- */
116
- tracking?: boolean | object;
117
- /**
118
- * - When `mode: "lazy"`, immediately begins materializing all paths in the background after init.
119
- */
120
- backgroundMaterialize?: boolean;
121
- /**
122
- * - Internationalization settings (dev-facing, process-global).
123
- * `{ language: string }` — selects the locale for framework messages (e.g. `"en-us"`, `"fr-fr"`, `"ja-jp"`).
124
- */
125
- i18n?: object;
126
- /**
127
- * - Environment variable snapshot configuration.
128
- * Pass `{ include: ["KEY"] }` to capture only the listed variable names in `api.slothlet.env`.
129
- * Omit (or pass `undefined`) to capture a full frozen snapshot of `process.env`.
130
- * Non-string entries in `include` are silently ignored; an all-non-string array falls back to the full snapshot.
131
- */
132
- env?: {
133
- include?: string[];
134
- };
135
- /**
136
- * - TypeScript support.
137
- * - `false` — disabled (default).
138
- * - `true` or `"fast"` — esbuild transpilation, no type checking.
139
- * - `"strict"` — tsc compilation with type checking and `.d.ts` generation.
140
- * See [TYPESCRIPT.md](docs/TYPESCRIPT.md) for the full configuration reference.
141
- */
142
- typescript?: boolean | "fast" | "strict" | object;
143
- /**
144
- * - Version routing discriminator for versioned API paths.
145
- * - **string** (e.g. `"version"`) — at dispatch time, reads that key from the calling module's version metadata to select a version tag.
146
- * - **function** — called as `(allVersions, caller) => versionTag | null`; return a registered version tag to force routing, or `null`/`undefined` to fall through to the automatic default.
147
- * - **omitted / `undefined`** — behaves identically to `"version"`.
148
- * Only relevant when modules are registered via `api.slothlet.api.add()` with a `versionConfig` argument.
149
- */
150
- versionDispatcher?: string | Function | null;
151
- };
152
- /**
153
- * Bound API object returned by `slothlet()`.
154
- * The root contains all loaded module exports plus the reserved `slothlet` namespace.
155
- */
156
- export type SlothletAPI = {
157
- /**
158
- * - Like `shutdown()` but additionally invokes registered destroy hooks before teardown. %%sig: (): void%% %%example: // ESM usage via slothlet API|import slothlet from "@cldmv/slothlet";|const api = await slothlet({ dir: './api' });|await api.destroy();%% %%example: // ESM usage via slothlet API (inside async function)|async function example() {| const { default: slothlet } = await import("@cldmv/slothlet");| const api = await slothlet({ dir: './api' });| await api.destroy();|}%% %%example: // CJS usage via slothlet API (top-level)|let slothlet;|(async () => {| ({ slothlet } = await import("@cldmv/slothlet"));| const api = await slothlet({ dir: './api' });| await api.destroy();|})();%% %%example: // CJS usage via slothlet API (inside async function)|const slothlet = require("@cldmv/slothlet");|const api = await slothlet({ dir: './api' });|await api.destroy();%%
159
- */
160
- destroy: () => void;
161
- /**
162
- * - Convenience alias for `slothlet.shutdown()`. Shuts down the instance and invokes any user-provided shutdown hook first. %%sig: (): void%% %%example: // ESM usage via slothlet API|import slothlet from "@cldmv/slothlet";|const api = await slothlet({ dir: './api' });|await api.shutdown();%% %%example: // ESM usage via slothlet API (inside async function)|async function example() {| const { default: slothlet } = await import("@cldmv/slothlet");| const api = await slothlet({ dir: './api' });| await api.shutdown();|}%% %%example: // CJS usage via slothlet API (top-level)|let slothlet;|(async () => {| ({ slothlet } = await import("@cldmv/slothlet"));| const api = await slothlet({ dir: './api' });| await api.shutdown();|})();%% %%example: // CJS usage via slothlet API (inside async function)|const slothlet = require("@cldmv/slothlet");|const api = await slothlet({ dir: './api' });|await api.shutdown();%%
163
- */
164
- shutdown: () => void;
165
- /**
166
- * - Built-in control namespace. All framework internals live here to avoid collisions with loaded modules.
167
- */
168
- slothlet: {
169
- env: Readonly<Record<string, string | undefined>>;
170
- api: {
171
- add: Function;
172
- reload: Function;
173
- remove: Function;
174
- };
175
- context: {
176
- get: Function;
177
- inspect: () => any;
178
- run: Function;
179
- scope: Function;
180
- set: Function;
181
- };
182
- diag?: {
183
- caches?: {
184
- get?: () => any;
185
- getAllModuleIDs?: () => string[];
186
- has?: Function;
187
- };
188
- context?: object;
189
- describe?: Function;
190
- getAPI?: () => any;
191
- getOwnership?: () => any;
192
- hook?: object;
193
- inspect?: () => any;
194
- owner?: {
195
- get?: Function;
196
- };
197
- reference?: object;
198
- SlothletWarning?: () => SlothletWarning;
199
- };
200
- hook: {
201
- clear: Function;
202
- disable: Function;
203
- enable: Function;
204
- list: Function;
205
- off: Function;
206
- on: Function;
207
- remove: Function;
208
- };
209
- lifecycle: {
210
- off: Function;
211
- on: Function;
212
- };
213
- materialize: {
214
- get: () => any;
215
- materialized: boolean;
216
- wait: () => Promise<void>;
217
- };
218
- metadata: {
219
- caller: () => any | null;
220
- get: Function;
221
- remove: Function;
222
- removeFor: Function;
223
- self: () => any | null;
224
- set: Function;
225
- setFor: Function;
226
- setGlobal: Function;
227
- };
228
- owner: {
229
- get: Function;
230
- };
231
- ownership: {
232
- get: Function;
233
- unregister: Function;
234
- };
235
- versioning: {
236
- list: Function;
237
- setDefault: Function;
238
- unregister: Function;
239
- getVersionMetadata: Function;
240
- setVersionMetadata: Function;
241
- };
242
- reference?: object;
243
- reload: Function;
244
- run: Function;
245
- scope: Function;
246
- shutdown: () => Promise<void>;
247
- };
248
- };
249
- import { SlothletWarning } from "@cldmv/slothlet/errors";
1
+ declare function stdin_default(config: any): Promise<{}>;
2
+ export function slothlet(config: any): Promise<{}>;
3
+ export { stdin_default as default };
250
4
  //# sourceMappingURL=slothlet.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"slothlet.d.mts","sourceRoot":"","sources":["../../dist/slothlet.mjs"],"names":[],"mappings":"AA4+BA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,iCAjCW,eAAe,GACb,OAAO,CAAC,WAAW,CAAC,CAsChC;;;;;;;;;SAWa,MAAM;;;;;;;WACN,OAAO,GAAC,MAAM;;;;;;;cAId,OAAO,GAAC,MAAM;;;;eAId,MAAM;;;;cACN,MAAM,GAAC,IAAI;;;;gBACX,MAAM,GAAC,IAAI;;;;YACX;QAAC,KAAK,EAAE,SAAS,GAAC,MAAM,CAAA;KAAC;;;;UAEpC;QAAuD,SAAS,GAArD,MAAM,GAAC;YAAC,OAAO,EAAE,MAAM,CAAC;YAAC,GAAG,EAAE,MAAM,CAAA;SAAC;QAGxB,SAAS,GAAtB,MAAM;KAEjB;;;;;;;;WAAW,OAAO,GAAC,MAAM,GAAC,MAAM;;;;;YAKrB,OAAO,GAAC,MAAM;;;;aAEd,OAAO;;;;kBACP,OAAO;;;;eACP,OAAO,GAAC,MAAM;;;;4BACd,OAAO;;;;;WACP,MAAM;;;;;;;UAMjB;QAA0B,OAAO,GAAtB,MAAM,EAAE;KACnB;;;;;;;;iBAAW,OAAO,GAAC,MAAM,GAAC,QAAQ,GAAC,MAAM;;;;;;;;wBAK9B,MAAM,cAAU,IAAI;;;;;;;;;;aAWpB,MAAY,IAAI;;;;cAChB,MAAY,IAAI;;;;cAE3B;QAAgE,GAAG,EAAxD,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAC,SAAS,CAAC,CAAC;QACzB,GAAG,EAC/B;YAAkC,GAAG;YACH,MAAM;YACN,MAAM;SACxC;QAA4B,OAAO,EACnC;YAAsC,GAAG;YACO,OAAO,EAA5C,SAAkB;YACS,GAAG;YACH,KAAK;YACL,GAAG;SACzC;QAA6B,IAAI,GACjC;YAAkC,MAAM,GACxC;gBAAqD,GAAG,GAA7C,SAAkB;gBAC0B,eAAe,GAA3D,MAAY,MAAM,EAAE;gBACY,GAAG;aAC9C;YAAkC,OAAO,GAA9B,MAAM;YACmB,QAAQ;YACE,MAAM,GAAzC,SAAkB;YACiB,YAAY,GAA/C,SAAkB;YACK,IAAI,GAA3B,MAAM;YAC6B,OAAO,GAA1C,SAAkB;YACK,KAAK,GACvC;gBAA0C,GAAG;aAC7C;YAAkC,SAAS,GAAhC,MAAM;YACsC,eAAe,GAA3D,MAAY,eAAe;SACtC;QAA4B,IAAI,EAChC;YAAmC,KAAK;YACL,OAAO;YACP,MAAM;YACN,IAAI;YACJ,GAAG;YACH,EAAE;YACF,MAAM;SACzC;QAA4B,SAAS,EACrC;YAAwC,GAAG;YACH,EAAE;SAC1C;QAA4B,WAAW,EACvC;YAAoD,GAAG,EAA5C,SAAkB;YACY,YAAY,EAA1C,OAAO;YAC0C,IAAI,EAArD,MAAY,OAAO,CAAE,IAAI,CAAC;SACrC;QAA4B,QAAQ,EACpC;YAAsD,MAAM,EAAjD,MAAY,MAAO,IAAI;YACK,GAAG;YACH,MAAM;YACN,SAAS;YACM,IAAI,EAA/C,MAAY,MAAO,IAAI;YACK,GAAG;YACH,MAAM;YACN,SAAS;SAChD;QAA4B,KAAK,EACjC;YAAoC,GAAG;SACvC;QAA4B,SAAS,EACrC;YAAwC,GAAG;YACH,UAAU;SAClD;QAA4B,UAAU,EACtC;YAAyC,IAAI;YACJ,UAAU;YACV,UAAU;YACV,kBAAkB;YAClB,kBAAkB;SAC3D;QAA6B,SAAS,GAA3B,MAAM;QACa,MAAM;QACN,GAAG;QACH,KAAK;QACa,QAAQ,EAA7C,MAAY,OAAO,CAAE,IAAI,CAAC;KACvC;;gCAvkC6D,wBAAwB"}
1
+ {"version":3,"file":"slothlet.d.mts","sourceRoot":"","sources":["../../dist/slothlet.mjs"],"names":[],"mappings":"AAAwga,yDAA6G;AAA7G,mDAA6G"}
package/types/index.d.mts CHANGED
@@ -1,19 +1,39 @@
1
1
  /**
2
- * TypeScript declarations for @cldmv/slothlet index
3
- *
4
- * This file is auto-generated by tools/build-exports.mjs
5
- * Run: npm run build:exports to regenerate
2
+ * Creates a slothlet API instance with live-binding context and AsyncLocalStorage support.
3
+ * Automatically wraps all API functions with context isolation for multi-instance support.
4
+ * @public
5
+ * @async
6
+ *
7
+ * @param {object} [options={}] - Configuration options for the slothlet instance
8
+ * @param {string} [options.dir="api"] - Directory to load API modules from
9
+ * @param {boolean} [options.lazy=false] - Use lazy loading (true) or eager loading (false) - legacy option
10
+ * @param {string} [options.mode] - Loading mode ("lazy", "eager") or execution mode ("singleton", "vm", "worker", "fork") - takes precedence over lazy option
11
+ * @param {string} [options.engine="singleton"] - Execution mode (singleton, vm, worker, fork)
12
+ * @param {number} [options.apiDepth=Infinity] - Maximum directory depth to scan
13
+ * @param {boolean} [options.debug=false] - Enable debug logging
14
+ * @param {string} [options.api_mode="auto"] - API structure mode (auto, function, object)
15
+ * @param {boolean} [options.allowApiOverwrite=true] - Allow addApi to overwrite existing API endpoints
16
+ * @param {object} [options.context={}] - Context data for live bindings
17
+ * @param {object} [options.reference={}] - Reference objects to merge into API root
18
+ * @returns {Promise<import("./src/slothlet.mjs").SlothletAPI>} The bound API object with management methods
19
+ *
20
+ * @example // ESM
21
+ * import slothlet from "@cldmv/slothlet";
22
+ * const api = await slothlet({ dir: './api', lazy: true });
23
+ * const result = await api.math.add(2, 3); // 5
24
+ *
6
25
  */
7
-
8
- // Re-export all types from the main slothlet module
9
- export type * from "./dist/slothlet.d.mts";
10
- // If you want runtime exports, use the implementation file instead:
11
- export * from "./dist/slothlet.mts";
12
-
13
- // Auto-generated named export declarations (these override the re-export above)
14
- export const async: any;
15
-
16
- // Main slothlet export
17
- declare const slothlet: any;
18
- export default slothlet;
26
+ export default function slothlet(options?: {
27
+ dir?: string | undefined;
28
+ lazy?: boolean | undefined;
29
+ mode?: string | undefined;
30
+ engine?: string | undefined;
31
+ apiDepth?: number | undefined;
32
+ debug?: boolean | undefined;
33
+ api_mode?: string | undefined;
34
+ allowApiOverwrite?: boolean | undefined;
35
+ context?: object | undefined;
36
+ reference?: object | undefined;
37
+ }): Promise<import("./src/slothlet.mjs").SlothletAPI>;
19
38
  export { slothlet };
39
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../index.mjs"],"names":[],"mappings":"AA+FA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,2CAlBG;IAAyB,GAAG;IACF,IAAI;IACL,IAAI;IACJ,MAAM;IACN,QAAQ;IACP,KAAK;IACN,QAAQ;IACP,iBAAiB;IAClB,OAAO;IACP,SAAS;CAClC,GAAU,OAAO,CAAC,OAAO,oBAAoB,EAAE,WAAW,CAAC,CAkB7D"}