@cldmv/slothlet-types 3.15.3 → 3.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/builders/api-assignment.d.mts +125 -4
- package/lib/builders/api_builder.d.mts +104 -7
- package/lib/builders/builder.d.mts +82 -1
- package/lib/builders/modes-processor.d.mts +66 -3
- package/lib/errors.d.mts +114 -19
- package/lib/factories/component-base.d.mts +171 -8
- package/lib/factories/context.d.mts +22 -4
- package/lib/handlers/api-cache-manager.d.mts +209 -20
- package/lib/handlers/api-manager.d.mts +539 -38
- package/lib/handlers/context-async.d.mts +92 -25
- package/lib/handlers/context-live.d.mts +117 -30
- package/lib/handlers/framework-internals.d.mts +33 -2
- package/lib/handlers/hook-manager.d.mts +306 -73
- package/lib/handlers/lifecycle-token.d.mts +48 -3
- package/lib/handlers/lifecycle.d.mts +86 -5
- package/lib/handlers/materialize-manager.d.mts +76 -8
- package/lib/handlers/metadata.d.mts +238 -18
- package/lib/handlers/module-manager.d.mts +169 -21
- package/lib/handlers/ownership.d.mts +376 -45
- package/lib/handlers/permission-manager.d.mts +283 -46
- package/lib/handlers/routine-manager.d.mts +425 -0
- package/lib/handlers/trusted-root.d.mts +45 -4
- package/lib/handlers/unified-wrapper.d.mts +287 -26
- package/lib/handlers/version-manager.d.mts +236 -29
- package/lib/helpers/caller-pinning.d.mts +21 -2
- package/lib/helpers/class-instance-wrapper.d.mts +56 -2
- package/lib/helpers/config.d.mts +311 -161
- package/lib/helpers/defaults.d.mts +39 -0
- package/lib/helpers/eventemitter-context.d.mts +29 -3
- package/lib/helpers/eventtarget-context.d.mts +19 -1
- package/lib/helpers/eventtarget-property-context.d.mts +21 -0
- package/lib/helpers/generate-manifest.d.mts +174 -7
- package/lib/helpers/hint-detector.d.mts +22 -2
- package/lib/helpers/manifest-resolver.d.mts +100 -1
- package/lib/helpers/modes-utils.d.mts +30 -3
- package/lib/helpers/module-discovery.d.mts +80 -7
- package/lib/helpers/module-manifest-validator.d.mts +36 -13
- package/lib/helpers/module-sort.d.mts +64 -1
- package/lib/helpers/observer-context.d.mts +21 -0
- package/lib/helpers/pattern-matcher.d.mts +43 -3
- package/lib/helpers/platform.d.mts +109 -10
- package/lib/helpers/resolve-from-caller.d.mts +27 -3
- package/lib/helpers/sanitize.d.mts +92 -4
- package/lib/helpers/scheduler-context.d.mts +21 -1
- package/lib/helpers/utilities.d.mts +52 -4
- package/lib/i18n/translations.d.mts +50 -5
- package/lib/modes/eager.d.mts +46 -8
- package/lib/modes/lazy.d.mts +57 -10
- package/lib/processors/flatten.d.mts +116 -56
- package/lib/processors/loader.d.mts +77 -10
- package/lib/processors/type-generator.d.mts +16 -2
- package/lib/processors/typescript.d.mts +169 -13
- package/lib/runtime/runtime-asynclocalstorage.d.mts +71 -3
- package/lib/runtime/runtime-livebindings.d.mts +37 -2
- package/lib/runtime/runtime.d.mts +39 -3
- package/lib/typegen/typegen.d.mts +34 -2
- package/package.json +5 -23
- package/slothlet.d.mts +428 -3
|
@@ -1,12 +1,175 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base class for Slothlet component classes.
|
|
3
|
+
* @class ComponentBase
|
|
4
|
+
* @package
|
|
5
|
+
*
|
|
6
|
+
* @description
|
|
7
|
+
* Provides common Slothlet property access for handlers, builders, and processors.
|
|
8
|
+
* All component classes should extend this to gain consistent access to the Slothlet
|
|
9
|
+
* instance's configuration, API references, and error classes. Components are instantiated
|
|
10
|
+
* with a reference to the Slothlet class itself, making them modular extensions.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* class ApiManager extends ComponentBase {
|
|
14
|
+
* constructor(slothlet) {
|
|
15
|
+
* super(slothlet);
|
|
16
|
+
* this.state = { addHistory: [] };
|
|
17
|
+
* }
|
|
18
|
+
*
|
|
19
|
+
* someMethod() {
|
|
20
|
+
* if (this.debug?.api) {
|
|
21
|
+
* console.log(`Slothlet: ${this.instanceID}`);
|
|
22
|
+
* }
|
|
23
|
+
* throw new this.SlothletError("INVALID_CONFIG", { reason: "bad input" });
|
|
24
|
+
* }
|
|
25
|
+
* }
|
|
26
|
+
*/
|
|
1
27
|
export class ComponentBase {
|
|
28
|
+
/**
|
|
29
|
+
* Complete set of property names reserved by the slothlet framework.
|
|
30
|
+
*
|
|
31
|
+
* @description
|
|
32
|
+
* These keys are either private wrapper internals, read-only info props exposed
|
|
33
|
+
* through the proxy, write-blocked lifecycle keys, or builtin namespace keys
|
|
34
|
+
* injected at the API root level. Used by all components to distinguish framework
|
|
35
|
+
* internals from user-defined properties when:
|
|
36
|
+
* - Collecting user-set custom properties for preservation across reload
|
|
37
|
+
* (`_collectCustomProperties` in api-manager.mjs)
|
|
38
|
+
* - Extracting child keys for impl reconstruction (`_extractFullImpl`)
|
|
39
|
+
* - Determining whether a set(trap) write should be silently absorbed (`setTrap`)
|
|
40
|
+
* - Filtering what getTrap exposes externally on wrapper proxies
|
|
41
|
+
*
|
|
42
|
+
* Note: `_materialize` is included here (skip for collection/extraction) but
|
|
43
|
+
* setTrap exempts it since the framework needs to write it directly.
|
|
44
|
+
*
|
|
45
|
+
* @type {Set<string>}
|
|
46
|
+
* @static
|
|
47
|
+
*/
|
|
2
48
|
static INTERNAL_KEYS: Set<string>;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
49
|
+
/**
|
|
50
|
+
* Create a component base instance.
|
|
51
|
+
* @param {object} slothlet - Slothlet class instance.
|
|
52
|
+
* @package
|
|
53
|
+
*
|
|
54
|
+
* @description
|
|
55
|
+
* Stores the Slothlet reference for access via getters. The Slothlet class itself
|
|
56
|
+
* is passed (not a separate "instance" object), making components modular extensions
|
|
57
|
+
* of Slothlet.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* super(slothlet);
|
|
61
|
+
*/
|
|
62
|
+
constructor(slothlet: object);
|
|
63
|
+
/**
|
|
64
|
+
* Get Slothlet instance via the canonical internal accessor name.
|
|
65
|
+
* @returns {object} Slothlet instance.
|
|
66
|
+
* @package
|
|
67
|
+
*
|
|
68
|
+
* @description
|
|
69
|
+
* Prototype getter — NOT an own property — so the JS Proxy invariant for
|
|
70
|
+
* non-configurable own properties never applies. UnifiedWrapper's getTrap blocks
|
|
71
|
+
* this name via the underscore-filter before it can reach the getter.
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* const s = this.____slothlet;
|
|
75
|
+
*/
|
|
76
|
+
get ____slothlet(): object;
|
|
77
|
+
/**
|
|
78
|
+
* Get Slothlet instance (internal access).
|
|
79
|
+
* @returns {object} Slothlet instance.
|
|
80
|
+
* @package
|
|
81
|
+
*
|
|
82
|
+
* @description
|
|
83
|
+
* Provides direct access to the Slothlet instance for legacy code compatibility.
|
|
84
|
+
* Prefer using specific getters (config, helpers, handlers) when possible.
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* this.slothlet.debug("api", { action: "assigned" });
|
|
88
|
+
*/
|
|
89
|
+
get slothlet(): object;
|
|
90
|
+
/**
|
|
91
|
+
* Get Slothlet configuration.
|
|
92
|
+
* @returns {object} Slothlet configuration object.
|
|
93
|
+
* @package
|
|
94
|
+
*
|
|
95
|
+
* @description
|
|
96
|
+
* Provides access to the Slothlet config for collision modes, debug settings, etc.
|
|
97
|
+
* Named with ____ prefix to avoid shadowing user API names like 'config'.
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* const collisionMode = this.____config.collision.api;
|
|
101
|
+
*/
|
|
102
|
+
get ____config(): object;
|
|
103
|
+
/**
|
|
104
|
+
* Get Slothlet instance ID.
|
|
105
|
+
* @returns {string} Slothlet instance identifier.
|
|
106
|
+
* @package
|
|
107
|
+
*/
|
|
108
|
+
get instanceID(): string;
|
|
109
|
+
/**
|
|
110
|
+
* Get SlothletError class.
|
|
111
|
+
* @returns {Function} SlothletError constructor.
|
|
112
|
+
* @package
|
|
113
|
+
*
|
|
114
|
+
* @description
|
|
115
|
+
* Provides access to SlothletError without importing in every file.
|
|
116
|
+
* Components can throw errors via `new this.SlothletError(...)`.
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* throw new this.SlothletError("INVALID_CONFIG", { reason: "missing dir" });
|
|
120
|
+
*/
|
|
121
|
+
get SlothletError(): Function;
|
|
122
|
+
/**
|
|
123
|
+
* Get SlothletWarning class.
|
|
124
|
+
* @returns {Function} SlothletWarning constructor.
|
|
125
|
+
* @package
|
|
126
|
+
*
|
|
127
|
+
* @description
|
|
128
|
+
* Provides access to SlothletWarning without importing in every file.
|
|
129
|
+
* Components can issue warnings via `new this.SlothletWarning(...)`.
|
|
130
|
+
*
|
|
131
|
+
* @example
|
|
132
|
+
* new this.SlothletWarning("WARNING_DEPRECATED", { feature: "oldApi" });
|
|
133
|
+
*/
|
|
134
|
+
get SlothletWarning(): Function;
|
|
135
|
+
/**
|
|
136
|
+
* Emit a non-throwing diagnostic lifecycle event (`impl:warning` or `impl:error`).
|
|
137
|
+
* @param {"warning"|"error"} level - Diagnostic level → `impl:warning` or `impl:error`.
|
|
138
|
+
* @param {object} data - Diagnostic payload.
|
|
139
|
+
* @param {string} data.code - i18n code (e.g. "WARN_SYNTHETIC_ROOT_COLLISION") used to translate `message`.
|
|
140
|
+
* @param {object} data.context - Structured context object passed to the diagnostic (also the i18n interpolation params).
|
|
141
|
+
* @param {string} [data.apiPath] - API path where the mutation was attempted ("" / "(root)" for root).
|
|
142
|
+
* @param {string} [data.source] - Command family that produced the diagnostic (addApi | reload | buildAPI | module-mount).
|
|
143
|
+
* @param {string} [data.moduleID] - Module identifier, when one is in scope.
|
|
144
|
+
* @param {Error} [data.error] - The originating Error / SlothletError (impl:error only).
|
|
145
|
+
* @returns {Promise<void>} Resolves once all subscribers (including async ones) have run.
|
|
146
|
+
* @package
|
|
147
|
+
*
|
|
148
|
+
* @description
|
|
149
|
+
* Fires an additive lifecycle event for a diagnostic the framework handled WITHOUT throwing —
|
|
150
|
+
* a warning, or a runtime error a command caught and continued past. Observers registered via
|
|
151
|
+
* `api.slothlet.lifecycle.on("impl:warning"|"impl:error", fn)` — or the construction-time
|
|
152
|
+
* `lifecycle` config option — receive these regardless of the `silent` config: `silent`
|
|
153
|
+
* suppresses console output only, never events. The human-readable `message` is translated
|
|
154
|
+
* from `code` + `context` here so subscribers get a ready-to-display string even when the
|
|
155
|
+
* corresponding SlothletWarning/SlothletError was never constructed (e.g. under `silent`).
|
|
156
|
+
*
|
|
157
|
+
* Emission stays per-site: each diagnostic location calls this explicitly, mirroring how each
|
|
158
|
+
* site constructs its own `this.SlothletWarning`. The SlothletError / SlothletWarning classes
|
|
159
|
+
* remain context-free (no slothlet reference) and are never coupled to the lifecycle emitter.
|
|
160
|
+
*
|
|
161
|
+
* @example
|
|
162
|
+
* await this.emitImplDiagnostic("warning", {
|
|
163
|
+
* apiPath: "", code: "WARN_SYNTHETIC_ROOT_EMPTY", context: { apiPath: "(root)" }, source: "addApi"
|
|
164
|
+
* });
|
|
165
|
+
*/
|
|
166
|
+
emitImplDiagnostic(level: "warning" | "error", data: {
|
|
167
|
+
code: string;
|
|
168
|
+
context: object;
|
|
169
|
+
apiPath?: string | undefined;
|
|
170
|
+
source?: string | undefined;
|
|
171
|
+
moduleID?: string | undefined;
|
|
172
|
+
error?: Error | undefined;
|
|
173
|
+
}): Promise<void>;
|
|
11
174
|
#private;
|
|
12
175
|
}
|
|
@@ -1,7 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Get context manager for specified runtime type
|
|
3
|
+
* @param {string} runtime - Runtime type ("async" or "live")
|
|
4
|
+
* @returns {Object} Context manager instance
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export function getContextManager(runtime?: string): Object;
|
|
8
|
+
/**
|
|
9
|
+
* Default context manager (async)
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
3
12
|
export const contextManager: import("#handlers/context-async").AsyncContextManager;
|
|
4
|
-
|
|
5
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Async runtime for runtime exports
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
export const asyncRuntime: import("#handlers/context-async").AsyncContextManager;
|
|
18
|
+
/**
|
|
19
|
+
* Live runtime for runtime exports
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
6
22
|
export const liveRuntime: import("#handlers/context-live").LiveContextManager;
|
|
23
|
+
import { asyncContextManager } from "#handlers/context-async";
|
|
24
|
+
import { liveContextManager } from "#handlers/context-live";
|
|
7
25
|
export { asyncContextManager, liveContextManager };
|
|
@@ -1,24 +1,213 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cache entry structure for API tree storage and rebuild parameters.
|
|
3
|
+
* @typedef {Object} CacheEntry
|
|
4
|
+
* @property {string} endpoint - API path endpoint (e.g., ".", "plugins")
|
|
5
|
+
* @property {string} moduleID - Module identifier
|
|
6
|
+
* @property {Object} api - Complete buildAPI result tree (primary storage)
|
|
7
|
+
* @property {string} folderPath - Source folder path
|
|
8
|
+
* @property {string} mode - Loading mode: 'lazy' or 'eager'
|
|
9
|
+
* @property {Object} sanitizeOptions - Sanitization configuration
|
|
10
|
+
* @property {string} collisionMode - Collision handling mode
|
|
11
|
+
* @property {Object} config - Config snapshot at add time
|
|
12
|
+
* @property {number} timestamp - Cache creation time (Unix ms)
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Manages API caches - complete buildAPI results per moduleID
|
|
16
|
+
* @class ApiCacheManager
|
|
17
|
+
* @extends ComponentBase
|
|
18
|
+
* @public
|
|
19
|
+
*
|
|
20
|
+
* @description
|
|
21
|
+
* Stores complete API trees for each moduleID with all rebuild parameters.
|
|
22
|
+
* The cache is the PRIMARY storage - live API references cached trees.
|
|
23
|
+
* Enables hot reload by rebuilding caches from disk and updating live references.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* const cacheManager = new ApiCacheManager(slothlet);
|
|
27
|
+
* cacheManager.set("module_abc", { api: tree, folderPath: "./plugins", ... });
|
|
28
|
+
*/
|
|
1
29
|
export class ApiCacheManager extends ComponentBase {
|
|
2
30
|
static slothletProperty: string;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
31
|
+
/**
|
|
32
|
+
* Create ApiCacheManager instance
|
|
33
|
+
* @param {object} slothlet - Slothlet instance
|
|
34
|
+
* @public
|
|
35
|
+
*/
|
|
36
|
+
constructor(slothlet: object);
|
|
37
|
+
/**
|
|
38
|
+
* Cache storage - moduleID → CacheEntry
|
|
39
|
+
* @type {Map<string, CacheEntry>}
|
|
40
|
+
* @private
|
|
41
|
+
*/
|
|
42
|
+
private caches;
|
|
43
|
+
/**
|
|
44
|
+
* Store cache entry for moduleID
|
|
45
|
+
* @param {string} moduleID - Module identifier
|
|
46
|
+
* @param {CacheEntry} entry - Cache entry with api tree and rebuild parameters
|
|
47
|
+
* @returns {void}
|
|
48
|
+
* @public
|
|
49
|
+
*
|
|
50
|
+
* @description
|
|
51
|
+
* Stores complete buildAPI result. The cached API tree becomes the source of truth.
|
|
52
|
+
* Existing references should point to entry.api, not copy it.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* cache.set("base_abc123", {
|
|
56
|
+
* endpoint: ".",
|
|
57
|
+
* moduleID: "base_abc123",
|
|
58
|
+
* api: apiTree,
|
|
59
|
+
* folderPath: this.____config.dir,
|
|
60
|
+
* mode: "lazy",
|
|
61
|
+
* sanitizeOptions: {},
|
|
62
|
+
* collisionMode: "merge",
|
|
63
|
+
* config: {...this.____config},
|
|
64
|
+
* timestamp: Date.now()
|
|
65
|
+
* });
|
|
66
|
+
*/
|
|
67
|
+
public set(moduleID: string, entry: CacheEntry): void;
|
|
68
|
+
/**
|
|
69
|
+
* Get cache entry by moduleID
|
|
70
|
+
* @param {string} moduleID - Module identifier
|
|
71
|
+
* @returns {CacheEntry|undefined} Cache entry or undefined if not found
|
|
72
|
+
* @public
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* const cache = cacheManager.get("base_abc123");
|
|
76
|
+
* if (cache) {
|
|
77
|
+
* const api = cache.api; // Get API tree from cache
|
|
78
|
+
* }
|
|
79
|
+
*/
|
|
80
|
+
public get(moduleID: string): CacheEntry | undefined;
|
|
81
|
+
/**
|
|
82
|
+
* Check if cache exists for moduleID
|
|
83
|
+
* @param {string} moduleID - Module identifier
|
|
84
|
+
* @returns {boolean} True if cache exists
|
|
85
|
+
* @public
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* if (cacheManager.has("base_abc123")) {
|
|
89
|
+
* // Cache exists
|
|
90
|
+
* }
|
|
91
|
+
*/
|
|
92
|
+
public has(moduleID: string): boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Delete cache entry by moduleID
|
|
95
|
+
* @param {string} moduleID - Module identifier
|
|
96
|
+
* @returns {boolean} True if cache was deleted
|
|
97
|
+
* @public
|
|
98
|
+
*
|
|
99
|
+
* @description
|
|
100
|
+
* Removes cache entry. Should be called when module is removed via api.remove(moduleID).
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
* cacheManager.delete("plugins_abc123");
|
|
104
|
+
*/
|
|
105
|
+
public delete(moduleID: string): boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Get all moduleIDs in cache
|
|
108
|
+
* @returns {string[]} Array of moduleIDs
|
|
109
|
+
* @public
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* const moduleIDs = cacheManager.getAllModuleIDs();
|
|
113
|
+
* // ["base_abc123", "plugins_xyz789", ...]
|
|
114
|
+
*/
|
|
115
|
+
public getAllModuleIDs(): string[];
|
|
116
|
+
/**
|
|
117
|
+
* Get cache diagnostics
|
|
118
|
+
* @returns {object} Diagnostic information
|
|
119
|
+
* @public
|
|
120
|
+
*
|
|
121
|
+
* @description
|
|
122
|
+
* Returns diagnostic data about cached modules. Available under api.slothlet.diag.caches
|
|
123
|
+
* when config.debug.diagnostics is enabled.
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* const diag = cacheManager.getCacheDiagnostics();
|
|
127
|
+
* // {
|
|
128
|
+
* // totalCaches: 3,
|
|
129
|
+
* // caches: [
|
|
130
|
+
* // { moduleID: "base_abc123", endpoint: ".", pathCount: 42, timestamp: ... },
|
|
131
|
+
* // ...
|
|
132
|
+
* // ]
|
|
133
|
+
* // }
|
|
134
|
+
*/
|
|
135
|
+
public getCacheDiagnostics(): object;
|
|
136
|
+
/**
|
|
137
|
+
* Count API paths in a tree
|
|
138
|
+
* @param {object} api - API tree
|
|
139
|
+
* @param {WeakSet} [visited] - Visited objects (prevent circular refs)
|
|
140
|
+
* @returns {number} Number of paths
|
|
141
|
+
* @private
|
|
142
|
+
*/
|
|
143
|
+
private _countPaths;
|
|
144
|
+
/**
|
|
145
|
+
* Clear all caches
|
|
146
|
+
* @returns {void}
|
|
147
|
+
* @public
|
|
148
|
+
*
|
|
149
|
+
* @description
|
|
150
|
+
* Removes all cache entries. Used during shutdown or full reload.
|
|
151
|
+
*
|
|
152
|
+
* @example
|
|
153
|
+
* cacheManager.clear();
|
|
154
|
+
*/
|
|
155
|
+
public clear(): void;
|
|
156
|
+
/**
|
|
157
|
+
* Rebuild cache from disk by calling buildAPI with stored parameters
|
|
158
|
+
* @param {string} moduleID - Module identifier to rebuild
|
|
159
|
+
* @returns {Promise<object>} Fresh API tree from buildAPI
|
|
160
|
+
* @public
|
|
161
|
+
*
|
|
162
|
+
* @description
|
|
163
|
+
* Reloads module source files and rebuilds API tree. Does NOT update cache -
|
|
164
|
+
* caller must call set() with fresh tree. Returns the new API tree.
|
|
165
|
+
*
|
|
166
|
+
* @example
|
|
167
|
+
* const freshApi = await cacheManager.rebuildCache("plugins_abc123");
|
|
168
|
+
* cacheManager.set("plugins_abc123", { ...existingEntry, api: freshApi, timestamp: Date.now() });
|
|
169
|
+
*/
|
|
170
|
+
public rebuildCache(moduleID: string): Promise<object>;
|
|
23
171
|
}
|
|
172
|
+
/**
|
|
173
|
+
* Cache entry structure for API tree storage and rebuild parameters.
|
|
174
|
+
*/
|
|
175
|
+
export type CacheEntry = {
|
|
176
|
+
/**
|
|
177
|
+
* - API path endpoint (e.g., ".", "plugins")
|
|
178
|
+
*/
|
|
179
|
+
endpoint: string;
|
|
180
|
+
/**
|
|
181
|
+
* - Module identifier
|
|
182
|
+
*/
|
|
183
|
+
moduleID: string;
|
|
184
|
+
/**
|
|
185
|
+
* - Complete buildAPI result tree (primary storage)
|
|
186
|
+
*/
|
|
187
|
+
api: Object;
|
|
188
|
+
/**
|
|
189
|
+
* - Source folder path
|
|
190
|
+
*/
|
|
191
|
+
folderPath: string;
|
|
192
|
+
/**
|
|
193
|
+
* - Loading mode: 'lazy' or 'eager'
|
|
194
|
+
*/
|
|
195
|
+
mode: string;
|
|
196
|
+
/**
|
|
197
|
+
* - Sanitization configuration
|
|
198
|
+
*/
|
|
199
|
+
sanitizeOptions: Object;
|
|
200
|
+
/**
|
|
201
|
+
* - Collision handling mode
|
|
202
|
+
*/
|
|
203
|
+
collisionMode: string;
|
|
204
|
+
/**
|
|
205
|
+
* - Config snapshot at add time
|
|
206
|
+
*/
|
|
207
|
+
config: Object;
|
|
208
|
+
/**
|
|
209
|
+
* - Cache creation time (Unix ms)
|
|
210
|
+
*/
|
|
211
|
+
timestamp: number;
|
|
212
|
+
};
|
|
24
213
|
import { ComponentBase } from "#factories/component-base";
|