@cldmv/slothlet 2.11.0 → 3.0.1
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/AGENT-USAGE.md +355 -325
- package/README.md +554 -238
- package/dist/lib/builders/api-assignment.mjs +605 -0
- package/dist/lib/builders/api_builder.mjs +1073 -0
- package/dist/lib/builders/builder.mjs +94 -0
- package/dist/lib/builders/modes-processor.mjs +1816 -0
- package/dist/lib/errors.mjs +227 -0
- package/dist/lib/factories/component-base.mjs +96 -0
- package/dist/lib/factories/context.mjs +38 -0
- package/dist/lib/handlers/api-cache-manager.mjs +216 -0
- package/dist/lib/handlers/api-manager.mjs +2364 -0
- package/dist/lib/handlers/context-async.mjs +184 -0
- package/dist/lib/handlers/context-live.mjs +184 -0
- package/dist/lib/handlers/hook-manager.mjs +789 -0
- package/dist/lib/handlers/lifecycle-token.mjs +44 -0
- package/dist/lib/handlers/lifecycle.mjs +131 -0
- package/dist/lib/handlers/materialize-manager.mjs +64 -0
- package/dist/lib/handlers/metadata.mjs +500 -0
- package/dist/lib/handlers/ownership.mjs +338 -0
- package/dist/lib/handlers/unified-wrapper.mjs +3031 -0
- package/dist/lib/helpers/class-instance-wrapper.mjs +125 -0
- package/dist/lib/helpers/config.mjs +343 -0
- package/dist/lib/helpers/eventemitter-context.mjs +365 -0
- package/dist/lib/helpers/hint-detector.mjs +63 -0
- package/dist/lib/helpers/modes-utils.mjs +53 -0
- package/dist/lib/helpers/resolve-from-caller.mjs +123 -117
- package/dist/lib/helpers/sanitize.mjs +247 -168
- package/dist/lib/helpers/utilities.mjs +46 -81
- package/dist/lib/i18n/languages/de-de.json +377 -0
- package/dist/lib/i18n/languages/en-gb.json +377 -0
- package/dist/lib/i18n/languages/en-us.json +377 -0
- package/dist/lib/i18n/languages/es-mx.json +377 -0
- package/dist/lib/i18n/languages/fr-fr.json +377 -0
- package/dist/lib/i18n/languages/hi-in.json +377 -0
- package/dist/lib/i18n/languages/ja-jp.json +377 -0
- package/dist/lib/i18n/languages/ko-kr.json +377 -0
- package/dist/lib/i18n/languages/pt-br.json +377 -0
- package/dist/lib/i18n/languages/ru-ru.json +377 -0
- package/dist/lib/i18n/languages/zh-cn.json +377 -0
- package/dist/lib/i18n/translations.mjs +140 -0
- package/dist/lib/modes/eager.mjs +75 -0
- package/dist/lib/modes/lazy.mjs +97 -0
- package/dist/lib/processors/flatten.mjs +453 -0
- package/dist/lib/processors/loader.mjs +355 -0
- package/dist/lib/processors/type-generator.mjs +291 -0
- package/dist/lib/processors/typescript.mjs +188 -0
- package/dist/lib/runtime/runtime-asynclocalstorage.mjs +80 -522
- package/dist/lib/runtime/runtime-livebindings.mjs +45 -390
- package/dist/lib/runtime/runtime.mjs +39 -159
- package/dist/slothlet.mjs +525 -744
- package/docs/API-RULES.md +338 -486
- package/index.cjs +4 -4
- package/index.mjs +82 -45
- package/package.json +143 -30
- package/types/dist/lib/builders/api-assignment.d.mts +97 -0
- package/types/dist/lib/builders/api-assignment.d.mts.map +1 -0
- package/types/dist/lib/builders/api_builder.d.mts +96 -0
- package/types/dist/lib/builders/api_builder.d.mts.map +1 -0
- package/types/dist/lib/builders/builder.d.mts +60 -0
- package/types/dist/lib/builders/builder.d.mts.map +1 -0
- package/types/dist/lib/builders/modes-processor.d.mts +32 -0
- package/types/dist/lib/builders/modes-processor.d.mts.map +1 -0
- package/types/dist/lib/errors.d.mts +118 -0
- package/types/dist/lib/errors.d.mts.map +1 -0
- package/types/dist/lib/factories/component-base.d.mts +182 -0
- package/types/dist/lib/factories/component-base.d.mts.map +1 -0
- package/types/dist/lib/factories/context.d.mts +26 -0
- package/types/dist/lib/factories/context.d.mts.map +1 -0
- package/types/dist/lib/handlers/api-cache-manager.d.mts +208 -0
- package/types/dist/lib/handlers/api-cache-manager.d.mts.map +1 -0
- package/types/dist/lib/handlers/api-manager.d.mts +392 -0
- package/types/dist/lib/handlers/api-manager.d.mts.map +1 -0
- package/types/dist/lib/handlers/context-async.d.mts +66 -0
- package/types/dist/lib/handlers/context-async.d.mts.map +1 -0
- package/types/dist/lib/handlers/context-live.d.mts +65 -0
- package/types/dist/lib/handlers/context-live.d.mts.map +1 -0
- package/types/dist/lib/handlers/hook-manager.d.mts +199 -0
- package/types/dist/lib/handlers/hook-manager.d.mts.map +1 -0
- package/types/dist/lib/handlers/lifecycle-token.d.mts +49 -0
- package/types/dist/lib/handlers/lifecycle-token.d.mts.map +1 -0
- package/types/dist/lib/handlers/lifecycle.d.mts +90 -0
- package/types/dist/lib/handlers/lifecycle.d.mts.map +1 -0
- package/types/dist/lib/handlers/materialize-manager.d.mts +75 -0
- package/types/dist/lib/handlers/materialize-manager.d.mts.map +1 -0
- package/types/dist/lib/handlers/metadata.d.mts +215 -0
- package/types/dist/lib/handlers/metadata.d.mts.map +1 -0
- package/types/dist/lib/handlers/ownership.d.mts +170 -0
- package/types/dist/lib/handlers/ownership.d.mts.map +1 -0
- package/types/dist/lib/handlers/unified-wrapper.d.mts +250 -0
- package/types/dist/lib/handlers/unified-wrapper.d.mts.map +1 -0
- package/types/dist/lib/helpers/class-instance-wrapper.d.mts +54 -0
- package/types/dist/lib/helpers/class-instance-wrapper.d.mts.map +1 -0
- package/types/dist/lib/helpers/config.d.mts +96 -0
- package/types/dist/lib/helpers/config.d.mts.map +1 -0
- package/types/dist/lib/helpers/eventemitter-context.d.mts +31 -0
- package/types/dist/lib/helpers/eventemitter-context.d.mts.map +1 -0
- package/types/dist/lib/helpers/hint-detector.d.mts +20 -0
- package/types/dist/lib/helpers/hint-detector.d.mts.map +1 -0
- package/types/dist/lib/helpers/modes-utils.d.mts +35 -0
- package/types/dist/lib/helpers/modes-utils.d.mts.map +1 -0
- package/types/dist/lib/helpers/resolve-from-caller.d.mts +29 -145
- package/types/dist/lib/helpers/resolve-from-caller.d.mts.map +1 -1
- package/types/dist/lib/helpers/sanitize.d.mts +95 -94
- package/types/dist/lib/helpers/sanitize.d.mts.map +1 -1
- package/types/dist/lib/helpers/utilities.d.mts +53 -116
- package/types/dist/lib/helpers/utilities.d.mts.map +1 -1
- package/types/dist/lib/i18n/translations.d.mts +39 -0
- package/types/dist/lib/i18n/translations.d.mts.map +1 -0
- package/types/dist/lib/modes/eager.d.mts +36 -0
- package/types/dist/lib/modes/eager.d.mts.map +1 -0
- package/types/dist/lib/modes/lazy.d.mts +49 -0
- package/types/dist/lib/modes/lazy.d.mts.map +1 -0
- package/types/dist/lib/processors/flatten.d.mts +114 -0
- package/types/dist/lib/processors/flatten.d.mts.map +1 -0
- package/types/dist/lib/processors/loader.d.mts +47 -0
- package/types/dist/lib/processors/loader.d.mts.map +1 -0
- package/types/dist/lib/processors/type-generator.d.mts +19 -0
- package/types/dist/lib/processors/type-generator.d.mts.map +1 -0
- package/types/dist/lib/processors/typescript.d.mts +55 -0
- package/types/dist/lib/processors/typescript.d.mts.map +1 -0
- package/types/dist/lib/runtime/runtime-asynclocalstorage.d.mts +47 -42
- package/types/dist/lib/runtime/runtime-asynclocalstorage.d.mts.map +1 -1
- package/types/dist/lib/runtime/runtime-livebindings.d.mts +34 -65
- package/types/dist/lib/runtime/runtime-livebindings.d.mts.map +1 -1
- package/types/dist/lib/runtime/runtime.d.mts +39 -9
- package/types/dist/lib/runtime/runtime.d.mts.map +1 -1
- package/types/dist/slothlet.d.mts +184 -111
- package/types/dist/slothlet.d.mts.map +1 -1
- package/types/index.d.mts +1 -3
- package/dist/lib/engine/README.md +0 -21
- package/dist/lib/engine/slothlet_child.mjs +0 -59
- package/dist/lib/engine/slothlet_engine.mjs +0 -372
- package/dist/lib/engine/slothlet_esm.mjs +0 -230
- package/dist/lib/engine/slothlet_helpers.mjs +0 -455
- package/dist/lib/engine/slothlet_worker.mjs +0 -149
- package/dist/lib/helpers/als-eventemitter.mjs +0 -256
- package/dist/lib/helpers/api_builder/add_api.mjs +0 -553
- package/dist/lib/helpers/api_builder/analysis.mjs +0 -532
- package/dist/lib/helpers/api_builder/construction.mjs +0 -495
- package/dist/lib/helpers/api_builder/decisions.mjs +0 -748
- package/dist/lib/helpers/api_builder/metadata.mjs +0 -248
- package/dist/lib/helpers/api_builder.mjs +0 -41
- package/dist/lib/helpers/auto-wrap.mjs +0 -62
- package/dist/lib/helpers/hooks.mjs +0 -389
- package/dist/lib/helpers/instance-manager.mjs +0 -111
- package/dist/lib/helpers/metadata-api.mjs +0 -201
- package/dist/lib/helpers/multidefault.mjs +0 -216
- package/dist/lib/modes/slothlet_eager.mjs +0 -154
- package/dist/lib/modes/slothlet_lazy.mjs +0 -594
- package/docs/API-RULES-CONDITIONS.md +0 -712
- package/types/dist/lib/engine/slothlet_child.d.mts +0 -2
- package/types/dist/lib/engine/slothlet_child.d.mts.map +0 -1
- package/types/dist/lib/engine/slothlet_engine.d.mts +0 -31
- package/types/dist/lib/engine/slothlet_engine.d.mts.map +0 -1
- package/types/dist/lib/engine/slothlet_esm.d.mts +0 -19
- package/types/dist/lib/engine/slothlet_esm.d.mts.map +0 -1
- package/types/dist/lib/engine/slothlet_helpers.d.mts +0 -25
- package/types/dist/lib/engine/slothlet_helpers.d.mts.map +0 -1
- package/types/dist/lib/engine/slothlet_worker.d.mts +0 -2
- package/types/dist/lib/engine/slothlet_worker.d.mts.map +0 -1
- package/types/dist/lib/helpers/als-eventemitter.d.mts +0 -56
- package/types/dist/lib/helpers/als-eventemitter.d.mts.map +0 -1
- package/types/dist/lib/helpers/api_builder/add_api.d.mts +0 -102
- package/types/dist/lib/helpers/api_builder/add_api.d.mts.map +0 -1
- package/types/dist/lib/helpers/api_builder/analysis.d.mts +0 -189
- package/types/dist/lib/helpers/api_builder/analysis.d.mts.map +0 -1
- package/types/dist/lib/helpers/api_builder/construction.d.mts +0 -107
- package/types/dist/lib/helpers/api_builder/construction.d.mts.map +0 -1
- package/types/dist/lib/helpers/api_builder/decisions.d.mts +0 -213
- package/types/dist/lib/helpers/api_builder/decisions.d.mts.map +0 -1
- package/types/dist/lib/helpers/api_builder/metadata.d.mts +0 -99
- package/types/dist/lib/helpers/api_builder/metadata.d.mts.map +0 -1
- package/types/dist/lib/helpers/api_builder.d.mts +0 -6
- package/types/dist/lib/helpers/api_builder.d.mts.map +0 -1
- package/types/dist/lib/helpers/auto-wrap.d.mts +0 -49
- package/types/dist/lib/helpers/auto-wrap.d.mts.map +0 -1
- package/types/dist/lib/helpers/hooks.d.mts +0 -342
- package/types/dist/lib/helpers/hooks.d.mts.map +0 -1
- package/types/dist/lib/helpers/instance-manager.d.mts +0 -41
- package/types/dist/lib/helpers/instance-manager.d.mts.map +0 -1
- package/types/dist/lib/helpers/metadata-api.d.mts +0 -132
- package/types/dist/lib/helpers/metadata-api.d.mts.map +0 -1
- package/types/dist/lib/helpers/multidefault.d.mts +0 -90
- package/types/dist/lib/helpers/multidefault.d.mts.map +0 -1
- package/types/dist/lib/modes/slothlet_eager.d.mts +0 -65
- package/types/dist/lib/modes/slothlet_eager.d.mts.map +0 -1
- package/types/dist/lib/modes/slothlet_lazy.d.mts +0 -31
- package/types/dist/lib/modes/slothlet_lazy.d.mts.map +0 -1
- package/types/index.d.mts.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"slothlet_child.d.mts","sourceRoot":"","sources":["../../../../dist/lib/engine/slothlet_child.mjs"],"names":[],"mappings":""}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sets the shutdown function for the engine.
|
|
3
|
-
* @param {Function} fn - Shutdown function to set
|
|
4
|
-
* @returns {Function} Previously set shutdown function
|
|
5
|
-
* @example
|
|
6
|
-
* const prev = setShutdown(() => console.log("Shutting down"));
|
|
7
|
-
*/
|
|
8
|
-
export function setShutdown(fn: Function): Function;
|
|
9
|
-
/**
|
|
10
|
-
* Creates a slothlet engine with the specified mode and options.
|
|
11
|
-
* @param {object} allOptions - Engine configuration options
|
|
12
|
-
* @param {string} allOptions.entry - Entry point for the slothlet module
|
|
13
|
-
* @param {string} [allOptions.mode="vm"] - Engine mode: "vm", "worker", "fork", or "child"
|
|
14
|
-
* @param {object} [allOptions.context] - Context object for modules
|
|
15
|
-
* @param {object} [allOptions.reference] - Reference object for modules
|
|
16
|
-
* @returns {Promise<object>} Engine instance with API and shutdown capabilities
|
|
17
|
-
* @example
|
|
18
|
-
* const engine = await createEngine({
|
|
19
|
-
* entry: './api/index.mjs',
|
|
20
|
-
* mode: 'vm',
|
|
21
|
-
* context: { user: 'alice' }
|
|
22
|
-
* });
|
|
23
|
-
*/
|
|
24
|
-
export function createEngine(allOptions: {
|
|
25
|
-
entry: string;
|
|
26
|
-
mode?: string;
|
|
27
|
-
context?: object;
|
|
28
|
-
reference?: object;
|
|
29
|
-
}): Promise<object>;
|
|
30
|
-
export function makeFacade2(portal: any): () => void;
|
|
31
|
-
//# sourceMappingURL=slothlet_engine.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"slothlet_engine.d.mts","sourceRoot":"","sources":["../../../../dist/lib/engine/slothlet_engine.mjs"],"names":[],"mappings":"AAgCA;;;;;;GAMG;AACH,oDAIC;AAED;;;;;;;;;;;;;;GAcG;AACH,yCAZG;IAA2B,KAAK,EAAxB,MAAM;IACc,IAAI,GAAxB,MAAM;IACc,OAAO,GAA3B,MAAM;IACc,SAAS,GAA7B,MAAM;CACd,GAAU,OAAO,CAAC,MAAM,CAAC,CAgC3B;AAyRD,qDA4BC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Minimal custom ESM loader for VM context fallback when SourceTextModule is unavailable.
|
|
3
|
-
* Parses import/export statements, loads dependencies recursively, and evaluates code in context.
|
|
4
|
-
* Limitations: Only supports static imports/exports, no top-level await, no dynamic import, no advanced ESM features.
|
|
5
|
-
* @param {object} context - The VM context.
|
|
6
|
-
* @param {string} fileUrl - The file URL to load.
|
|
7
|
-
* @param {Set<string>} [visited] - Tracks loaded modules to prevent cycles.
|
|
8
|
-
* @returns {Promise<object>} Module namespace object.
|
|
9
|
-
* @example
|
|
10
|
-
* const ns = await loadEsmModuleFallback(context, 'file:///path/to/mod.mjs');
|
|
11
|
-
*/
|
|
12
|
-
export function loadEsmModuleFallback(context: object, fileUrl: string, visited?: Set<string>): Promise<object>;
|
|
13
|
-
/**
|
|
14
|
-
* Detects if a file is ESM based on extension or code content.
|
|
15
|
-
* @param {string} fileUrl
|
|
16
|
-
* @returns {Promise<boolean>}
|
|
17
|
-
*/
|
|
18
|
-
export function isEsmFile(fileUrl: string): Promise<boolean>;
|
|
19
|
-
//# sourceMappingURL=slothlet_esm.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"slothlet_esm.d.mts","sourceRoot":"","sources":["../../../../dist/lib/engine/slothlet_esm.mjs"],"names":[],"mappings":"AAmBA;;;;;;;;;;GAUG;AACH,+CAPW,MAAM,WACN,MAAM,YACN,GAAG,CAAC,MAAM,CAAC,GACT,OAAO,CAAC,MAAM,CAAC,CAkM3B;AAED;;;;GAIG;AACH,mCAHW,MAAM,GACJ,OAAO,CAAC,OAAO,CAAC,CAW5B"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export function normalizeContext(ctx: any): any;
|
|
2
|
-
export function installGlobalsInCurrentRealm(contextMap: any): void;
|
|
3
|
-
export function extendSelfWithReference(self: any, reference: any): void;
|
|
4
|
-
export function installPortalForSelf(): void;
|
|
5
|
-
export function asUrl(p: any): any;
|
|
6
|
-
export function isPlainObject(o: any): boolean;
|
|
7
|
-
export function guessName(v: any): any;
|
|
8
|
-
export function makeNodeishContext(): vm.Context;
|
|
9
|
-
/**
|
|
10
|
-
* Loads a module into a VM context, supporting ESM (mjs), CJS (cjs), or auto-detection.
|
|
11
|
-
* @param {object} context - The VM context.
|
|
12
|
-
* @param {string} fileUrl - The file URL to load.
|
|
13
|
-
* @param {string} [mode='auto'] - 'auto', 'mjs', or 'cjs'.
|
|
14
|
-
* @returns {Promise<object>} Module namespace or SourceTextModule.
|
|
15
|
-
*/
|
|
16
|
-
export function loadEsmInVm2(context: object, fileUrl: string, mode?: string, ...args: any[]): Promise<object>;
|
|
17
|
-
export function loadEsmInVm(context: any, fileUrl: any): Promise<any>;
|
|
18
|
-
export function installContextGlobalsVM(context: any, userContext: any): void;
|
|
19
|
-
export function bootSlothletVM(context: any, entryUrl: any, loadConfig: any, ctxRef: any): Promise<void>;
|
|
20
|
-
export function marshalArgsReplaceFunctions(value: any, registerCb: any): any;
|
|
21
|
-
export function reviveArgsReplaceTokens(value: any, invokeCb: any): any;
|
|
22
|
-
export function containsFunction(value: any): boolean;
|
|
23
|
-
export const HAS_STM: boolean;
|
|
24
|
-
import vm from "node:vm";
|
|
25
|
-
//# sourceMappingURL=slothlet_helpers.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"slothlet_helpers.d.mts","sourceRoot":"","sources":["../../../../dist/lib/engine/slothlet_helpers.mjs"],"names":[],"mappings":"AAuBA,gDAwBC;AAED,oEAGC;AAED,yEAYC;AAED,6CA6BC;AAED,mCAEC;AAED,+CAEC;AAED,uCAOC;AAQD,iDAyBC;AAED;;;;;;GAMG;AACH,sCALW,MAAM,WACN,MAAM,SACN,MAAM,mBACJ,OAAO,CAAC,MAAM,CAAC,CA2L3B;AAGD,sEAsDC;AAED,8EAYC;AAED,yGAmDC;AAID,8EAaC;AAED,wEAaC;AAED,sDAKC;AAhYD,8BAAiE;eA3GlD,SAAS"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"slothlet_worker.d.mts","sourceRoot":"","sources":["../../../../dist/lib/engine/slothlet_worker.mjs"],"names":[],"mappings":""}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Enable AsyncLocalStorage context propagation for all EventEmitter instances.
|
|
3
|
-
*
|
|
4
|
-
* @function enableAlsForEventEmitters
|
|
5
|
-
* @package
|
|
6
|
-
* @param {AsyncLocalStorage} [als] - The AsyncLocalStorage instance to use (defaults to slothlet's shared instance)
|
|
7
|
-
*
|
|
8
|
-
* @description
|
|
9
|
-
* Patches EventEmitter.prototype to automatically preserve AsyncLocalStorage context
|
|
10
|
-
* in event listeners using AsyncResource. This ensures that event handlers maintain
|
|
11
|
-
* the same context that was active when they were registered.
|
|
12
|
-
*
|
|
13
|
-
* Uses Node.js AsyncResource API for proper context propagation, following
|
|
14
|
-
* official guidance for AsyncLocalStorage across callback boundaries.
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* // Enable ALS for all EventEmitters
|
|
18
|
-
* import { enableAlsForEventEmitters } from "./als-eventemitter.mjs";
|
|
19
|
-
* enableAlsForEventEmitters(als);
|
|
20
|
-
*/
|
|
21
|
-
export function enableAlsForEventEmitters(als?: AsyncLocalStorage<any>): void;
|
|
22
|
-
/**
|
|
23
|
-
* Disable AsyncLocalStorage context propagation for EventEmitter instances.
|
|
24
|
-
*
|
|
25
|
-
* @function disableAlsForEventEmitters
|
|
26
|
-
* @package
|
|
27
|
-
*
|
|
28
|
-
* @description
|
|
29
|
-
* Restores original EventEmitter methods, removing the AsyncLocalStorage
|
|
30
|
-
* context propagation. This should be called during cleanup to prevent
|
|
31
|
-
* hanging AsyncResource instances that can keep the event loop alive.
|
|
32
|
-
*
|
|
33
|
-
* @example
|
|
34
|
-
* // Disable ALS patching during shutdown
|
|
35
|
-
* disableAlsForEventEmitters();
|
|
36
|
-
*/
|
|
37
|
-
/**
|
|
38
|
-
* Clean up ALL listeners that went through slothlet's EventEmitter patching.
|
|
39
|
-
*
|
|
40
|
-
* @function cleanupAllSlothletListeners
|
|
41
|
-
* @package
|
|
42
|
-
*
|
|
43
|
-
* @description
|
|
44
|
-
* Removes all event listeners that were registered through slothlet's patched
|
|
45
|
-
* EventEmitter methods. This includes listeners from third-party libraries
|
|
46
|
-
* that got wrapped with AsyncResource instances. This nuclear cleanup option
|
|
47
|
-
* should be called during shutdown to prevent hanging listeners.
|
|
48
|
-
*
|
|
49
|
-
* @example
|
|
50
|
-
* // Clean up all patched listeners during shutdown
|
|
51
|
-
* cleanupAllSlothletListeners();
|
|
52
|
-
*/
|
|
53
|
-
export function cleanupAllSlothletListeners(): void;
|
|
54
|
-
export function disableAlsForEventEmitters(): void;
|
|
55
|
-
import { AsyncLocalStorage } from "node:async_hooks";
|
|
56
|
-
//# sourceMappingURL=als-eventemitter.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"als-eventemitter.d.mts","sourceRoot":"","sources":["../../../../dist/lib/helpers/als-eventemitter.mjs"],"names":[],"mappings":"AAiDA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,8EAiNC;AAED;;;;;;;;;;;;;;GAcG;AACH;;;;;;;;;;;;;;;GAeG;AACH,oDAyBC;AAED,mDAmCC;kCArVgD,kBAAkB"}
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @typedef {Object} AddApiFromFolderParams
|
|
3
|
-
* @property {string} apiPath - Dot-notation path where modules will be added
|
|
4
|
-
* @property {string} folderPath - Path to folder containing modules to load
|
|
5
|
-
* @property {object} instance - Slothlet instance with api, boundapi, config, modes, etc.
|
|
6
|
-
* @property {object} [metadata={}] - Metadata to attach to all loaded functions
|
|
7
|
-
* @property {object} [options={}] - Additional options for module loading
|
|
8
|
-
* @property {boolean} [options.forceOverwrite=false] - Allow overwriting existing APIs (requires Rule 12)
|
|
9
|
-
* @property {string} [options.moduleId] - Module identifier for ownership tracking (required with forceOverwrite)
|
|
10
|
-
*/
|
|
11
|
-
/**
|
|
12
|
-
* @description
|
|
13
|
-
* Dynamically adds API modules from a new folder to the existing API at a specified path.
|
|
14
|
-
*
|
|
15
|
-
* @function addApiFromFolder
|
|
16
|
-
* @memberof module:@cldmv/slothlet.lib.helpers.api_builder.add_api
|
|
17
|
-
* @param {AddApiFromFolderParams} params - Configuration object
|
|
18
|
-
* @returns {Promise<void>}
|
|
19
|
-
* @throws {Error} If API not loaded, invalid parameters, folder does not exist, or merge conflicts
|
|
20
|
-
* @package
|
|
21
|
-
*
|
|
22
|
-
* This function enables runtime extension of the API by loading modules from a folder
|
|
23
|
-
* and merging them into a specified location in the API tree. It performs comprehensive
|
|
24
|
-
* validation, supports both relative and absolute paths, handles intermediate object
|
|
25
|
-
* creation, and respects the allowApiOverwrite configuration.
|
|
26
|
-
*
|
|
27
|
-
* The method performs the following steps:
|
|
28
|
-
* 1. Validates that the API is loaded and the folder exists
|
|
29
|
-
* 2. Resolves relative folder paths from the caller location
|
|
30
|
-
* 3. Loads modules from the specified folder using the current loading mode
|
|
31
|
-
* 4. Navigates to the specified API path, creating intermediate objects as needed
|
|
32
|
-
* 5. Merges the new modules into the target location
|
|
33
|
-
* 6. Updates all live bindings to reflect the changes
|
|
34
|
-
*
|
|
35
|
-
* @example
|
|
36
|
-
* // Internal usage
|
|
37
|
-
* import { addApiFromFolder } from "./add_api.mjs";
|
|
38
|
-
*
|
|
39
|
-
* // Add additional modules at runtime.plugins path
|
|
40
|
-
* await addApiFromFolder(
|
|
41
|
-
* "runtime.plugins",
|
|
42
|
-
* "./plugins",
|
|
43
|
-
* slothletInstance
|
|
44
|
-
* );
|
|
45
|
-
*
|
|
46
|
-
* @example
|
|
47
|
-
* // Add modules to root level
|
|
48
|
-
* await addApiFromFolder(
|
|
49
|
-
* "utilities",
|
|
50
|
-
* "./utils",
|
|
51
|
-
* slothletInstance
|
|
52
|
-
* );
|
|
53
|
-
*
|
|
54
|
-
* @example
|
|
55
|
-
* // Add deep nested modules
|
|
56
|
-
* await addApiFromFolder(
|
|
57
|
-
* "services.external.stripe",
|
|
58
|
-
* "./services/stripe",
|
|
59
|
-
* slothletInstance
|
|
60
|
-
* );
|
|
61
|
-
*
|
|
62
|
-
* @example
|
|
63
|
-
* // Add modules with metadata
|
|
64
|
-
* await addApiFromFolder(
|
|
65
|
-
* "extensions.untrusted",
|
|
66
|
-
* "./untrusted-plugins",
|
|
67
|
-
* slothletInstance,
|
|
68
|
-
* {
|
|
69
|
-
* trusted: false,
|
|
70
|
-
* permissions: ["read"],
|
|
71
|
-
* version: "1.0.0",
|
|
72
|
-
* author: "external"
|
|
73
|
-
* }
|
|
74
|
-
* );
|
|
75
|
-
*/
|
|
76
|
-
export function addApiFromFolder({ apiPath, folderPath, instance, metadata, options }: AddApiFromFolderParams): Promise<void>;
|
|
77
|
-
export type AddApiFromFolderParams = {
|
|
78
|
-
/**
|
|
79
|
-
* - Dot-notation path where modules will be added
|
|
80
|
-
*/
|
|
81
|
-
apiPath: string;
|
|
82
|
-
/**
|
|
83
|
-
* - Path to folder containing modules to load
|
|
84
|
-
*/
|
|
85
|
-
folderPath: string;
|
|
86
|
-
/**
|
|
87
|
-
* - Slothlet instance with api, boundapi, config, modes, etc.
|
|
88
|
-
*/
|
|
89
|
-
instance: object;
|
|
90
|
-
/**
|
|
91
|
-
* - Metadata to attach to all loaded functions
|
|
92
|
-
*/
|
|
93
|
-
metadata?: object;
|
|
94
|
-
/**
|
|
95
|
-
* - Additional options for module loading
|
|
96
|
-
*/
|
|
97
|
-
options?: {
|
|
98
|
-
forceOverwrite?: boolean;
|
|
99
|
-
moduleId?: string;
|
|
100
|
-
};
|
|
101
|
-
};
|
|
102
|
-
//# sourceMappingURL=add_api.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"add_api.d.mts","sourceRoot":"","sources":["../../../../../dist/lib/helpers/api_builder/add_api.mjs"],"names":[],"mappings":"AAkDA;;;;;;;;;GASG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG;AACH,uFA3DW,sBAAsB,GACpB,OAAO,CAAC,IAAI,CAAC,CAskBzB;;;;;aAtlBa,MAAM;;;;gBACN,MAAM;;;;cACN,MAAM;;;;eACN,MAAM;;;;cAEjB;QAA6B,cAAc,GAAhC,OAAO;QACU,QAAQ,GAAzB,MAAM;KACnB"}
|
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Helper function to check if a value is likely serializable without calling JSON.stringify.
|
|
3
|
-
* Used by toJSON methods to avoid expensive serialization attempts on complex objects.
|
|
4
|
-
*
|
|
5
|
-
* @internal
|
|
6
|
-
* @private
|
|
7
|
-
* @param {*} val - The value to check for serializability
|
|
8
|
-
* @returns {boolean} True if the value is likely serializable, false otherwise
|
|
9
|
-
*/
|
|
10
|
-
export function isLikelySerializable(val: any): boolean;
|
|
11
|
-
/**
|
|
12
|
-
* Analyzes a module and returns processing decisions that both eager and lazy modes can use.
|
|
13
|
-
* This centralizes the module loading logic from _loadSingleModule while allowing each mode
|
|
14
|
-
* to handle the results according to their strategy (immediate materialization vs proxy creation).
|
|
15
|
-
*
|
|
16
|
-
* @function analyzeModule
|
|
17
|
-
* @internal
|
|
18
|
-
* @package
|
|
19
|
-
* @param {string} modulePath - Absolute path to the module file
|
|
20
|
-
* @param {object} options - Analysis options
|
|
21
|
-
* @param {boolean} [options.debug=false] - Enable debug logging
|
|
22
|
-
* @param {object} [options.instance] - Slothlet instance for accessing config and methods
|
|
23
|
-
* @returns {Promise<{
|
|
24
|
-
* rawModule: object,
|
|
25
|
-
* processedModule: object,
|
|
26
|
-
* isFunction: boolean,
|
|
27
|
-
* hasDefault: boolean,
|
|
28
|
-
* isCjs: boolean,
|
|
29
|
-
* exports: Array<[string, any]>,
|
|
30
|
-
* defaultExportType: 'function'|'object'|null,
|
|
31
|
-
* shouldWrapAsCallable: boolean,
|
|
32
|
-
* namedExports: object,
|
|
33
|
-
* metadata: object
|
|
34
|
-
* }>} Module analysis results
|
|
35
|
-
*
|
|
36
|
-
* @example
|
|
37
|
-
* // Analyze a module file
|
|
38
|
-
* const analysis = await analyzeModule("./api/math.mjs", { instance });
|
|
39
|
-
* // Eager mode: use analysis.processedModule directly
|
|
40
|
-
* // Lazy mode: create proxy based on analysis.isFunction, analysis.exports, etc.
|
|
41
|
-
*/
|
|
42
|
-
export function analyzeModule(modulePath: string, options?: {
|
|
43
|
-
debug?: boolean;
|
|
44
|
-
instance?: object;
|
|
45
|
-
}): Promise<{
|
|
46
|
-
rawModule: object;
|
|
47
|
-
processedModule: object;
|
|
48
|
-
isFunction: boolean;
|
|
49
|
-
hasDefault: boolean;
|
|
50
|
-
isCjs: boolean;
|
|
51
|
-
exports: Array<[string, any]>;
|
|
52
|
-
defaultExportType: "function" | "object" | null;
|
|
53
|
-
shouldWrapAsCallable: boolean;
|
|
54
|
-
namedExports: object;
|
|
55
|
-
metadata: object;
|
|
56
|
-
}>;
|
|
57
|
-
/**
|
|
58
|
-
* Processes module analysis results into a final module object using slothlet's established patterns.
|
|
59
|
-
* This centralizes the processing logic while allowing both modes to apply the results differently.
|
|
60
|
-
*
|
|
61
|
-
* @function processModuleFromAnalysis
|
|
62
|
-
* @internal
|
|
63
|
-
* @package
|
|
64
|
-
* @param {object} analysis - Results from analyzeModule
|
|
65
|
-
* @param {object} options - Processing options
|
|
66
|
-
* @param {object} [options.instance] - Slothlet instance for accessing _toapiPathKey method
|
|
67
|
-
* @param {boolean} [options.debug=false] - Enable debug logging
|
|
68
|
-
* @returns {object} Processed module ready for API integration
|
|
69
|
-
*
|
|
70
|
-
* @example
|
|
71
|
-
* // Process analyzed module
|
|
72
|
-
* const analysis = await analyzeModule(modulePath, { instance });
|
|
73
|
-
* const processed = processModuleFromAnalysis(analysis, { instance });
|
|
74
|
-
* // Both modes can use 'processed' but integrate it differently
|
|
75
|
-
*/
|
|
76
|
-
export function processModuleFromAnalysis(analysis: object, options?: {
|
|
77
|
-
instance?: object;
|
|
78
|
-
debug?: boolean;
|
|
79
|
-
}): object;
|
|
80
|
-
/**
|
|
81
|
-
* Analyzes a directory and returns structural decisions that both eager and lazy modes can use.
|
|
82
|
-
* This provides the decision-making logic for directory handling without implementing the actual
|
|
83
|
-
* loading strategy (allowing lazy mode to create proxies while eager mode materializes).
|
|
84
|
-
*
|
|
85
|
-
* @function analyzeDirectoryStructure
|
|
86
|
-
* @internal
|
|
87
|
-
* @package
|
|
88
|
-
* @param {string} categoryPath - Absolute path to the directory
|
|
89
|
-
* @param {object} options - Analysis options
|
|
90
|
-
* @param {object} options.instance - Slothlet instance for accessing config and methods
|
|
91
|
-
* @param {number} [options.currentDepth=0] - Current traversal depth
|
|
92
|
-
* @param {number} [options.maxDepth=Infinity] - Maximum traversal depth
|
|
93
|
-
* @param {boolean} [options.debug=false] - Enable debug logging
|
|
94
|
-
* @returns {Promise<{
|
|
95
|
-
* isSingleFile: boolean,
|
|
96
|
-
* shouldAutoFlatten: boolean,
|
|
97
|
-
* categoryName: string,
|
|
98
|
-
* moduleFiles: Array<import('fs').Dirent>,
|
|
99
|
-
* subDirs: Array<import('fs').Dirent>,
|
|
100
|
-
* multiDefaultAnalysis: object,
|
|
101
|
-
* processingStrategy: 'single-file'|'multi-file'|'empty',
|
|
102
|
-
* flatteningHints: object
|
|
103
|
-
* }>} Directory structure analysis
|
|
104
|
-
*
|
|
105
|
-
* @example
|
|
106
|
-
* // Analyze directory structure
|
|
107
|
-
* const analysis = await analyzeDirectoryStructure(categoryPath, { instance });
|
|
108
|
-
* if (analysis.isSingleFile) {
|
|
109
|
-
* // Both modes: handle as single file (but differently)
|
|
110
|
-
* } else {
|
|
111
|
-
* // Both modes: handle as multi-file (but differently)
|
|
112
|
-
* }
|
|
113
|
-
*/
|
|
114
|
-
export function analyzeDirectoryStructure(categoryPath: string, options?: {
|
|
115
|
-
instance: object;
|
|
116
|
-
currentDepth?: number;
|
|
117
|
-
maxDepth?: number;
|
|
118
|
-
debug?: boolean;
|
|
119
|
-
}): Promise<{
|
|
120
|
-
isSingleFile: boolean;
|
|
121
|
-
shouldAutoFlatten: boolean;
|
|
122
|
-
categoryName: string;
|
|
123
|
-
moduleFiles: Array<import("fs").Dirent>;
|
|
124
|
-
subDirs: Array<import("fs").Dirent>;
|
|
125
|
-
multiDefaultAnalysis: object;
|
|
126
|
-
processingStrategy: "single-file" | "multi-file" | "empty";
|
|
127
|
-
flatteningHints: object;
|
|
128
|
-
}>;
|
|
129
|
-
/**
|
|
130
|
-
* Returns category building decisions and processed modules that both eager and lazy modes can use.
|
|
131
|
-
* This provides all the structural information needed to build a category but lets each mode
|
|
132
|
-
* implement the actual building strategy (materialization vs proxy creation).
|
|
133
|
-
*
|
|
134
|
-
* @function getCategoryBuildingDecisions
|
|
135
|
-
* @internal
|
|
136
|
-
* @package
|
|
137
|
-
* @param {string} categoryPath - Absolute path to the directory
|
|
138
|
-
* @param {object} options - Building options
|
|
139
|
-
* @param {object} options.instance - Slothlet instance for accessing config and methods
|
|
140
|
-
* @param {number} [options.currentDepth=0] - Current traversal depth
|
|
141
|
-
* @param {number} [options.maxDepth=Infinity] - Maximum traversal depth
|
|
142
|
-
* @param {boolean} [options.debug=false] - Enable debug logging
|
|
143
|
-
* @returns {Promise<{
|
|
144
|
-
* processingStrategy: 'single-file'|'multi-file'|'empty',
|
|
145
|
-
* categoryName: string,
|
|
146
|
-
* shouldFlattenSingle: boolean,
|
|
147
|
-
* processedModules: Array<{file: import('fs').Dirent, moduleName: string, processedModule: any, flattening: object}>,
|
|
148
|
-
* subDirectories: Array<{dirEntry: import('fs').Dirent, apiPathKey: string}>,
|
|
149
|
-
* multiDefaultAnalysis: object,
|
|
150
|
-
* flatteningDecisions: object,
|
|
151
|
-
* upwardFlatteningCandidate: {shouldFlatten: boolean, apiPathKey: string}
|
|
152
|
-
* }>} Complete category building information
|
|
153
|
-
*
|
|
154
|
-
* @example
|
|
155
|
-
* // Get category building decisions
|
|
156
|
-
* const decisions = await getCategoryBuildingDecisions(categoryPath, { instance });
|
|
157
|
-
* if (decisions.processingStrategy === "single-file") {
|
|
158
|
-
* // Both modes: handle single file differently
|
|
159
|
-
* // Eager: return decisions.processedModules[0].processedModule
|
|
160
|
-
* // Lazy: create proxy based on decisions.processedModules[0].flattening
|
|
161
|
-
* }
|
|
162
|
-
*/
|
|
163
|
-
export function getCategoryBuildingDecisions(categoryPath: string, options?: {
|
|
164
|
-
instance: object;
|
|
165
|
-
currentDepth?: number;
|
|
166
|
-
maxDepth?: number;
|
|
167
|
-
debug?: boolean;
|
|
168
|
-
}): Promise<{
|
|
169
|
-
processingStrategy: "single-file" | "multi-file" | "empty";
|
|
170
|
-
categoryName: string;
|
|
171
|
-
shouldFlattenSingle: boolean;
|
|
172
|
-
processedModules: Array<{
|
|
173
|
-
file: import("fs").Dirent;
|
|
174
|
-
moduleName: string;
|
|
175
|
-
processedModule: any;
|
|
176
|
-
flattening: object;
|
|
177
|
-
}>;
|
|
178
|
-
subDirectories: Array<{
|
|
179
|
-
dirEntry: import("fs").Dirent;
|
|
180
|
-
apiPathKey: string;
|
|
181
|
-
}>;
|
|
182
|
-
multiDefaultAnalysis: object;
|
|
183
|
-
flatteningDecisions: object;
|
|
184
|
-
upwardFlatteningCandidate: {
|
|
185
|
-
shouldFlatten: boolean;
|
|
186
|
-
apiPathKey: string;
|
|
187
|
-
};
|
|
188
|
-
}>;
|
|
189
|
-
//# sourceMappingURL=analysis.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"analysis.d.mts","sourceRoot":"","sources":["../../../../../dist/lib/helpers/api_builder/analysis.mjs"],"names":[],"mappings":"AA0CA;;;;;;;;GAQG;AACH,0CAHW,GAAC,GACC,OAAO,CAcnB;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,0CAvBW,MAAM,YAEd;IAA0B,KAAK,GAAvB,OAAO;IACU,QAAQ,GAAzB,MAAM;CACd,GAAU,OAAO,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;IAC9B,iBAAiB,EAAE,UAAU,GAAC,QAAQ,GAAC,IAAI,CAAC;IAC5C,oBAAoB,EAAE,OAAO,CAAC;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAC,CA4GJ;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,oDAZW,MAAM,YAEd;IAAyB,QAAQ,GAAzB,MAAM;IACY,KAAK,GAAvB,OAAO;CACf,GAAU,MAAM,CA4NlB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wDA1BW,MAAM,YAEd;IAAwB,QAAQ,EAAxB,MAAM;IACW,YAAY,GAA7B,MAAM;IACW,QAAQ,GAAzB,MAAM;IACY,KAAK,GAAvB,OAAO;CACf,GAAU,OAAO,CAAC;IAChB,YAAY,EAAE,OAAO,CAAC;IACtB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,KAAK,CAAC,OAAO,IAAI,EAAE,MAAM,CAAC,CAAC;IACxC,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,EAAE,MAAM,CAAC,CAAC;IACpC,oBAAoB,EAAE,MAAM,CAAC;IAC7B,kBAAkB,EAAE,aAAa,GAAC,YAAY,GAAC,OAAO,CAAC;IACvD,eAAe,EAAE,MAAM,CAAA;CACxB,CAAC,CAkEJ;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,2DA1BW,MAAM,YAEd;IAAwB,QAAQ,EAAxB,MAAM;IACW,YAAY,GAA7B,MAAM;IACW,QAAQ,GAAzB,MAAM;IACY,KAAK,GAAvB,OAAO;CACf,GAAU,OAAO,CAAC;IAChB,kBAAkB,EAAE,aAAa,GAAC,YAAY,GAAC,OAAO,CAAC;IACvD,YAAY,EAAE,MAAM,CAAC;IACrB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,gBAAgB,EAAE,KAAK,CAAC;QAAC,IAAI,EAAE,OAAO,IAAI,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,eAAe,EAAE,GAAG,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAC,CAAC,CAAC;IACnH,cAAc,EAAE,KAAK,CAAC;QAAC,QAAQ,EAAE,OAAO,IAAI,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAC,CAAC,CAAC;IAC3E,oBAAoB,EAAE,MAAM,CAAC;IAC7B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,yBAAyB,EAAE;QAAC,aAAa,EAAE,OAAO,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAC,CAAA;CACxE,CAAC,CAmHJ"}
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Converts a filename or folder name to camelCase for API property.
|
|
3
|
-
* Extracted from slothlet._toapiPathKey for use in API building functions.
|
|
4
|
-
*
|
|
5
|
-
* @function toapiPathKey
|
|
6
|
-
* @internal
|
|
7
|
-
* @package
|
|
8
|
-
* @param {string} name - The name to convert
|
|
9
|
-
* @param {object} [sanitizeConfig={}] - Sanitization configuration
|
|
10
|
-
* @returns {string} The camelCase version of the name
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* toapiPathKey('root-math') // 'rootMath'
|
|
14
|
-
* toapiPathKey('auto-ip') // 'autoIP' (with proper config)
|
|
15
|
-
*/
|
|
16
|
-
export function toapiPathKey(name: string, sanitizeConfig?: object): string;
|
|
17
|
-
/**
|
|
18
|
-
* Filters out files that should not be loaded by slothlet.
|
|
19
|
-
* Extracted from slothlet._shouldIncludeFile for use in API building functions.
|
|
20
|
-
*
|
|
21
|
-
* @function shouldIncludeFile
|
|
22
|
-
* @internal
|
|
23
|
-
* @package
|
|
24
|
-
* @param {object} entry - The directory entry to check
|
|
25
|
-
* @returns {boolean} True if the file should be included, false if it should be excluded
|
|
26
|
-
*
|
|
27
|
-
* @example
|
|
28
|
-
* const entries = await fs.readdir(dir, { withFileTypes: true });
|
|
29
|
-
* const moduleFiles = entries.filter(e => shouldIncludeFile(e));
|
|
30
|
-
*/
|
|
31
|
-
export function shouldIncludeFile(entry: object): boolean;
|
|
32
|
-
/**
|
|
33
|
-
* Comprehensive category/directory building function that replaces _buildCategory.
|
|
34
|
-
* Handles complete directory structure processing with all flattening rules.
|
|
35
|
-
*
|
|
36
|
-
* @function buildCategoryStructure
|
|
37
|
-
* @internal
|
|
38
|
-
* @package
|
|
39
|
-
* @async
|
|
40
|
-
* @param {string} categoryPath - Absolute path to the category directory
|
|
41
|
-
* @param {object} options - Building options
|
|
42
|
-
* @param {number} [options.currentDepth=0] - Current recursion depth
|
|
43
|
-
* @param {number} [options.maxDepth=Infinity] - Maximum recursion depth
|
|
44
|
-
* @param {string} [options.mode="eager"] - Loading mode ("eager" or "lazy")
|
|
45
|
-
* @param {function} [options.subdirHandler] - Custom subdirectory handler for lazy mode
|
|
46
|
-
* @param {object} options.instance - Slothlet instance for access to helper methods
|
|
47
|
-
* @returns {Promise<object>} Complete category API structure
|
|
48
|
-
*
|
|
49
|
-
* @description
|
|
50
|
-
* Complete directory structure building pipeline that handles:
|
|
51
|
-
* - Single-file vs multi-file directory processing
|
|
52
|
-
* - Auto-flattening decisions for single files matching directory names
|
|
53
|
-
* - Multi-default export detection and processing
|
|
54
|
-
* - Self-referential export handling
|
|
55
|
-
* - Recursive subdirectory traversal with depth control
|
|
56
|
-
* - Function name preference over sanitized names
|
|
57
|
-
* - All established slothlet flattening rules and conventions
|
|
58
|
-
*
|
|
59
|
-
* @example
|
|
60
|
-
* // Internal usage - build complete category structure
|
|
61
|
-
* const categoryApi = await buildCategoryStructure("/path/to/category", {
|
|
62
|
-
* currentDepth: 0, maxDepth: 3, mode: "eager", instance: slothletInstance
|
|
63
|
-
* });
|
|
64
|
-
*/
|
|
65
|
-
export function buildCategoryStructure(categoryPath: string, options?: {
|
|
66
|
-
currentDepth?: number;
|
|
67
|
-
maxDepth?: number;
|
|
68
|
-
mode?: string;
|
|
69
|
-
subdirHandler?: Function;
|
|
70
|
-
instance: object;
|
|
71
|
-
}): Promise<object>;
|
|
72
|
-
/**
|
|
73
|
-
* Comprehensive root API building function that replaces eager/lazy create methods.
|
|
74
|
-
* Handles complete root-level API construction with mode-specific optimizations.
|
|
75
|
-
*
|
|
76
|
-
* @function buildRootAPI
|
|
77
|
-
* @internal
|
|
78
|
-
* @package
|
|
79
|
-
* @async
|
|
80
|
-
* @param {string} dir - Root directory path to build API from
|
|
81
|
-
* @param {object} options - Building options
|
|
82
|
-
* @param {boolean} [options.lazy=false] - Whether to use lazy loading mode
|
|
83
|
-
* @param {number} [options.maxDepth=Infinity] - Maximum recursion depth
|
|
84
|
-
* @param {object} options.instance - Slothlet instance for access to helper methods
|
|
85
|
-
* @returns {Promise<object|function>} Complete root API (object or function with properties)
|
|
86
|
-
*
|
|
87
|
-
* @description
|
|
88
|
-
* Complete root API building pipeline that handles:
|
|
89
|
-
* - Root-level module processing with multi-default detection
|
|
90
|
-
* - Root contributor pattern (default function becomes callable API)
|
|
91
|
-
* - Named export merging and flattening decisions
|
|
92
|
-
* - Recursive directory structure building via buildCategoryStructure
|
|
93
|
-
* - Mode-specific optimizations (eager vs lazy)
|
|
94
|
-
* - All established slothlet API construction patterns
|
|
95
|
-
*
|
|
96
|
-
* @example
|
|
97
|
-
* // Internal usage - build complete root API
|
|
98
|
-
* const rootApi = await buildRootAPI("/path/to/api", {
|
|
99
|
-
* lazy: false, maxDepth: 3, instance: slothletInstance
|
|
100
|
-
* });
|
|
101
|
-
*/
|
|
102
|
-
export function buildRootAPI(dir: string, options?: {
|
|
103
|
-
lazy?: boolean;
|
|
104
|
-
maxDepth?: number;
|
|
105
|
-
instance: object;
|
|
106
|
-
}): Promise<object | Function>;
|
|
107
|
-
//# sourceMappingURL=construction.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"construction.d.mts","sourceRoot":"","sources":["../../../../../dist/lib/helpers/api_builder/construction.mjs"],"names":[],"mappings":"AA0CA;;;;;;;;;;;;;;GAcG;AACH,mCARW,MAAM,mBACN,MAAM,GACJ,MAAM,CAQlB;AAED;;;;;;;;;;;;;GAaG;AACH,yCAPW,MAAM,GACJ,OAAO,CAgBnB;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,qDAzBW,MAAM,YAEd;IAAyB,YAAY,GAA7B,MAAM;IACW,QAAQ,GAAzB,MAAM;IACW,IAAI,GAArB,MAAM;IACa,aAAa;IAChB,QAAQ,EAAxB,MAAM;CACd,GAAU,OAAO,CAAC,MAAM,CAAC,CA+U3B;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,kCAtBW,MAAM,YAEd;IAA0B,IAAI,GAAtB,OAAO;IACU,QAAQ,GAAzB,MAAM;IACU,QAAQ,EAAxB,MAAM;CACd,GAAU,OAAO,CAAC,MAAM,WAAS,CAAC,CAoIpC"}
|