@cldmv/slothlet 3.1.0 → 3.2.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/README.md +12 -7
- package/dist/lib/builders/api_builder.mjs +101 -4
- package/dist/lib/handlers/api-manager.mjs +179 -14
- package/dist/lib/handlers/metadata.mjs +15 -0
- package/dist/lib/handlers/unified-wrapper.mjs +22 -11
- package/dist/lib/handlers/version-manager.mjs +773 -0
- package/dist/lib/helpers/config.mjs +20 -5
- package/dist/lib/i18n/languages/de-de.json +15 -1
- package/dist/lib/i18n/languages/en-gb.json +15 -1
- package/dist/lib/i18n/languages/en-us.json +15 -1
- package/dist/lib/i18n/languages/es-mx.json +15 -1
- package/dist/lib/i18n/languages/fr-fr.json +15 -1
- package/dist/lib/i18n/languages/hi-in.json +15 -1
- package/dist/lib/i18n/languages/ja-jp.json +15 -1
- package/dist/lib/i18n/languages/ko-kr.json +15 -1
- package/dist/lib/i18n/languages/pt-br.json +15 -1
- package/dist/lib/i18n/languages/ru-ru.json +15 -1
- package/dist/lib/i18n/languages/zh-cn.json +15 -1
- package/dist/slothlet.mjs +70 -1
- package/package.json +5 -2
- package/types/dist/lib/builders/api_builder.d.mts.map +1 -1
- package/types/dist/lib/handlers/api-manager.d.mts +28 -0
- package/types/dist/lib/handlers/api-manager.d.mts.map +1 -1
- package/types/dist/lib/handlers/metadata.d.mts +15 -0
- package/types/dist/lib/handlers/metadata.d.mts.map +1 -1
- package/types/dist/lib/handlers/unified-wrapper.d.mts.map +1 -1
- package/types/dist/lib/handlers/version-manager.d.mts +234 -0
- package/types/dist/lib/handlers/version-manager.d.mts.map +1 -0
- package/types/dist/lib/helpers/config.d.mts.map +1 -1
- package/types/dist/slothlet.d.mts +15 -0
- package/types/dist/slothlet.d.mts.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-manager.d.mts","sourceRoot":"","sources":["../../../../dist/lib/handlers/api-manager.mjs"],"names":[],"mappings":"AAmDA;;;;;;;;;;;;;;GAcG;AACH;IACC,gCAAuC;IAgBtC;;;;MAMC;IAGF;;;;;;;;;;;;;;;;;;OAkBG;IACH,yBAuFC;IAED;;;;;;;;;;;;;;OAcG;IACH,oBA+BC;IAED;;;;;;;;;;;;;;OAcG;IACH,0BA4BC;IAED;;;;;;;;;;;;OAYG;IACH,6BAIC;IAED;;;;;;;;;;;;OAYG;IACH,uBASC;IAED;;;;;;;;;;;;;OAaG;IACH,yBAkCC;IAED;;;;;;;;;;;;;OAaG;IACH,uBAEC;IAED;;;;;;;;;;;;;;OAcG;IACH,oBAmNC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,uBAkGC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,uBA8GC;IAED;;;;;;;;;;;;OAYG;IACH,mBAmGC;IACD;;;;;;;;;;;;OAYG;IACH,uBAwEC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6CG;IACH,wBA3CG;QAAuB,OAAO,EAAtB,MAAM;QACkB,UAAU,EAAlC,MAAM,GAAC,MAAM,EAAE;QACkB,OAAO,GAAxC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;KAC/B,GAAU,OAAO,CAAC,MAAM,GAAC,MAAM,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"api-manager.d.mts","sourceRoot":"","sources":["../../../../dist/lib/handlers/api-manager.mjs"],"names":[],"mappings":"AAmDA;;;;;;;;;;;;;;GAcG;AACH;IACC,gCAAuC;IAgBtC;;;;MAMC;IAGF;;;;;;;;;;;;;;;;;;OAkBG;IACH,yBAuFC;IAED;;;;;;;;;;;;;;OAcG;IACH,oBA+BC;IAED;;;;;;;;;;;;;;OAcG;IACH,0BA4BC;IAED;;;;;;;;;;;;OAYG;IACH,6BAIC;IAED;;;;;;;;;;;;OAYG;IACH,uBASC;IAED;;;;;;;;;;;;;OAaG;IACH,yBAkCC;IAED;;;;;;;;;;;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
|
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;
|
|
119
134
|
/**
|
|
120
135
|
* Remove metadata keys (or all metadata) for an API path.
|
|
121
136
|
*
|
|
@@ -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;;;;;;;;;;;;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;
|
|
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,OAkBhB;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;8BA5qB6B,0CAA0C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unified-wrapper.d.mts","sourceRoot":"","sources":["../../../../dist/lib/handlers/unified-wrapper.mjs"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"unified-wrapper.d.mts","sourceRoot":"","sources":["../../../../dist/lib/handlers/unified-wrapper.mjs"],"names":[],"mappings":"AAgvGA;;;;;;;;;;;GAWG;AACH,sCAPW,OAAO,GACL,cAAc,GAAC,IAAI,CAkB/B;;;;;AA5pGD;;;;;;;;;;GAUG;AACH;IAiQC;;;;;;;;;;;;;;;;OAgBG;IACH,0BA8BC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,gCA0DC;IApWD;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,+IAtBG;QAAwB,IAAI,EAApB,MAAM;QACU,OAAO,EAAvB,MAAM;QACW,WAAW;QACT,eAAe;QAChB,UAAU,GAA5B,OAAO;QACW,mBAAmB,GAArC,OAAO;QACU,QAAQ,GAAzB,MAAM;QACW,QAAQ,GAAzB,MAAM;QACW,YAAY,GAA7B,MAAM;KAEd,EA4KF;IA1MD;;;;;;;;;;;OAWG;IACH,4BAFa,MAAO,SAAS,CAK5B;IA+ND;;;;OAIG;IACH,qBAHa,MAAO,IAAI,CAKvB;IAkID;;;;;;;;;;;OAWG;IACH,sBAiCC;IAED;;;;;;;;;;;;OAYG;IACH,mBAgDC;IAED;;;;;;;;;OASG;IACH,qBAmDC;IAED;;;;OAIG;IACH,uBA+FC;IAED;;;;;;;;;OASG;IACH,qBAEC;IAED;;;;;;;;;OASG;IACH,sBAiBC;IAED;;;;;;;;;;OAUG;IACH,6BA2bC;IAED;;;;;;;;;;;OAWG;IACH,8BAwIC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,8BAipBC;IAED;;;;;;OAMG;IACH,uCA8qCC;IAjVE,mBAA0B;IA/kF7B;;;OAGG;IACH,2EAFa,GAAC,CA8Bb;;CAi4FD;8BAxtG6B,0CAA0C;iBADvD,WAAW"}
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Manages versioned API paths and their dispatcher proxies.
|
|
3
|
+
*
|
|
4
|
+
* Allows the same logical API path (e.g. `auth`) to be registered under multiple
|
|
5
|
+
* version tags (e.g. `v1`, `v2`). A dispatcher proxy lives at the logical path and
|
|
6
|
+
* routes property accesses to the correct versioned namespace at call time.
|
|
7
|
+
*
|
|
8
|
+
* @class VersionManager
|
|
9
|
+
* @extends ComponentBase
|
|
10
|
+
* @package
|
|
11
|
+
*/
|
|
12
|
+
export class VersionManager extends ComponentBase {
|
|
13
|
+
static slothletProperty: string;
|
|
14
|
+
/**
|
|
15
|
+
* Register a new version for a logical path and rebuild the dispatcher.
|
|
16
|
+
*
|
|
17
|
+
* @param {string} logicalPath - Logical API path (e.g. `"auth"`).
|
|
18
|
+
* @param {string} versionTag - Version tag (e.g. `"v1"`).
|
|
19
|
+
* @param {string} moduleID - Module ID of the mounted versioned module.
|
|
20
|
+
* @param {object} versionMeta - User-supplied version metadata (stored in VersionManager only).
|
|
21
|
+
* @param {boolean} isDefault - Whether this version should be the explicit default.
|
|
22
|
+
* @returns {void}
|
|
23
|
+
* @example
|
|
24
|
+
* versionManager.registerVersion("auth", "v1", "auth_abc", { stable: true }, true);
|
|
25
|
+
*/
|
|
26
|
+
registerVersion(logicalPath: string, versionTag: string, moduleID: string, versionMeta: object, isDefault: boolean): void;
|
|
27
|
+
/**
|
|
28
|
+
* Unregister a version for a logical path.
|
|
29
|
+
* Rebuilds or tears down the dispatcher accordingly.
|
|
30
|
+
*
|
|
31
|
+
* @param {string} logicalPath - Logical API path.
|
|
32
|
+
* @param {string} versionTag - Version tag to remove.
|
|
33
|
+
* @returns {boolean} `true` when the version was found and removed.
|
|
34
|
+
* @example
|
|
35
|
+
* versionManager.unregisterVersion("auth", "v2");
|
|
36
|
+
*/
|
|
37
|
+
unregisterVersion(logicalPath: string, versionTag: string): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Get the version key (logicalPath + versionTag) for a given module ID.
|
|
40
|
+
* Used as a reverse lookup during remove operations.
|
|
41
|
+
*
|
|
42
|
+
* @param {string} moduleID - Module ID.
|
|
43
|
+
* @returns {{ logicalPath: string, versionTag: string } | undefined}
|
|
44
|
+
* @example
|
|
45
|
+
* versionManager.getVersionKeyForModule("auth_abc123"); // { logicalPath: "auth", versionTag: "v1" }
|
|
46
|
+
*/
|
|
47
|
+
getVersionKeyForModule(moduleID: string): {
|
|
48
|
+
logicalPath: string;
|
|
49
|
+
versionTag: string;
|
|
50
|
+
} | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* Returns `true` when a live dispatcher proxy is tracked for the given logical path.
|
|
53
|
+
* Used by ApiManager to detect whether a removed path was a logical dispatcher.
|
|
54
|
+
*
|
|
55
|
+
* @param {string} logicalPath - Logical API path (e.g. `"auth"`).
|
|
56
|
+
* @returns {boolean}
|
|
57
|
+
* @example
|
|
58
|
+
* versionManager.hasDispatcher("auth"); // true
|
|
59
|
+
*/
|
|
60
|
+
hasDispatcher(logicalPath: string): boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Retrieve the VersionManager-only metadata object stored for a module ID.
|
|
63
|
+
* Used internally by `buildAllVersionsArg` and `buildCallerArg`.
|
|
64
|
+
*
|
|
65
|
+
* @param {string} moduleID - Opaque module ID.
|
|
66
|
+
* @returns {object | undefined} Stored version metadata or `undefined`.
|
|
67
|
+
* @example
|
|
68
|
+
* versionManager.getVersionMetadata("auth_abc123"); // { version: "v1", logicalPath: "auth", stable: true }
|
|
69
|
+
*/
|
|
70
|
+
getVersionMetadata(moduleID: string): object | undefined;
|
|
71
|
+
/**
|
|
72
|
+
* Retrieve the VersionManager-only metadata for a logical path and version tag.
|
|
73
|
+
*
|
|
74
|
+
* @param {string} logicalPath - Logical API path (e.g. `"auth"`).
|
|
75
|
+
* @param {string} versionTag - Version tag (e.g. `"v1"`, `"2.3.0"`).
|
|
76
|
+
* @returns {object | undefined} Stored version metadata or `undefined` if not registered.
|
|
77
|
+
* @example
|
|
78
|
+
* versionManager.getVersionMetadataByPath("auth", "v1"); // { version: "v1", logicalPath: "auth", stable: true }
|
|
79
|
+
*/
|
|
80
|
+
getVersionMetadataByPath(logicalPath: string, versionTag: string): object | undefined;
|
|
81
|
+
/**
|
|
82
|
+
* Patch (merge) the VersionManager-only metadata for a registered logical path and version tag at runtime.
|
|
83
|
+
* The injected `version` and `logicalPath` keys always win over any user-supplied fields in `patch`.
|
|
84
|
+
*
|
|
85
|
+
* @param {string} logicalPath - Logical API path (e.g. `"auth"`).
|
|
86
|
+
* @param {string} versionTag - Version tag (e.g. `"v1"`, `"2.3.0"`).
|
|
87
|
+
* @param {object} patch - Plain object of keys to merge into the stored version metadata.
|
|
88
|
+
* @returns {void}
|
|
89
|
+
* @throws {SlothletError} When the logical path or version tag is not registered.
|
|
90
|
+
* @example
|
|
91
|
+
* versionManager.setVersionMetadataByPath("auth", "v1", { stable: true });
|
|
92
|
+
*/
|
|
93
|
+
setVersionMetadataByPath(logicalPath: string, versionTag: string, patch: object): void;
|
|
94
|
+
/**
|
|
95
|
+
* Return a snapshot of all registered versions and the default tag for a logical path.
|
|
96
|
+
*
|
|
97
|
+
* @param {string} logicalPath - Logical API path.
|
|
98
|
+
* @returns {{ versions: object, default: string | null } | undefined} Snapshot object, or `undefined` if the path is not registered.
|
|
99
|
+
* @example
|
|
100
|
+
* versionManager.list("auth"); // { versions: { v1: {...}, v2: {...} }, default: "v2" }
|
|
101
|
+
* versionManager.list("unknown"); // undefined
|
|
102
|
+
*/
|
|
103
|
+
list(logicalPath: string): {
|
|
104
|
+
versions: object;
|
|
105
|
+
default: string | null;
|
|
106
|
+
} | undefined;
|
|
107
|
+
/**
|
|
108
|
+
* Explicitly override the default version for a logical path at runtime.
|
|
109
|
+
* Clears any previous explicit defaults and marks only the specified tag.
|
|
110
|
+
*
|
|
111
|
+
* @param {string} logicalPath - Logical API path.
|
|
112
|
+
* @param {string} versionTag - Version tag to set as default.
|
|
113
|
+
* @returns {void}
|
|
114
|
+
* @throws {SlothletError} When the version tag is not registered for the path.
|
|
115
|
+
* @example
|
|
116
|
+
* versionManager.setDefault("auth", "v1");
|
|
117
|
+
*/
|
|
118
|
+
setDefault(logicalPath: string, versionTag: string): void;
|
|
119
|
+
/**
|
|
120
|
+
* Determine the default version tag for a logical path.
|
|
121
|
+
*
|
|
122
|
+
* Algorithm:
|
|
123
|
+
* 1. Return the first version entry with `isDefault === true`.
|
|
124
|
+
* 2. Otherwise, normalise all tags, sort descending, return highest.
|
|
125
|
+
* 3. Return `null` when no versions are registered.
|
|
126
|
+
*
|
|
127
|
+
* @param {string} logicalPath - Logical API path.
|
|
128
|
+
* @returns {string | null} The default version tag, or `null`.
|
|
129
|
+
* @example
|
|
130
|
+
* // Given: ["v1", "v3", "v8", "v2"]
|
|
131
|
+
* versionManager.getDefaultVersion("auth"); // "v8"
|
|
132
|
+
*/
|
|
133
|
+
getDefaultVersion(logicalPath: string): string | null;
|
|
134
|
+
/**
|
|
135
|
+
* Run the configured discriminator and return the winning version tag.
|
|
136
|
+
*
|
|
137
|
+
* When the configured `versionDispatcher` is a string, reads that key from
|
|
138
|
+
* `caller.versionMetadata`. When it is a function, calls it with `(allVersions, caller)`.
|
|
139
|
+
*
|
|
140
|
+
* @param {string} logicalPath - Logical API path.
|
|
141
|
+
* @param {object} allVersions - Pre-built allVersions arg (see `buildAllVersionsArg`).
|
|
142
|
+
* @param {object} caller - Pre-built caller arg (see `buildCallerArg`).
|
|
143
|
+
* @returns {string | null} Resolved version tag, or `null` to fall through to default.
|
|
144
|
+
* @example
|
|
145
|
+
* const tag = versionManager.resolveForPath("auth", allVersions, caller); // "v2"
|
|
146
|
+
*/
|
|
147
|
+
resolveForPath(logicalPath: string, allVersions: object, caller: object): string | null;
|
|
148
|
+
/**
|
|
149
|
+
* Build the `allVersions` argument passed to function discriminators.
|
|
150
|
+
*
|
|
151
|
+
* Each key is a version tag; each value contains `version`, `default`, `metadata`
|
|
152
|
+
* (regular Metadata system data), and `versionMetadata` (VersionManager-only store).
|
|
153
|
+
*
|
|
154
|
+
* @param {string} logicalPath - Logical API path.
|
|
155
|
+
* @returns {object} Map-like object keyed by version tag.
|
|
156
|
+
* @example
|
|
157
|
+
* versionManager.buildAllVersionsArg("auth");
|
|
158
|
+
* // { v1: { version: "v1", default: true, metadata: {...}, versionMetadata: {...} } }
|
|
159
|
+
*/
|
|
160
|
+
buildAllVersionsArg(logicalPath: string): object;
|
|
161
|
+
/**
|
|
162
|
+
* Build the `caller` argument passed to function discriminators.
|
|
163
|
+
*
|
|
164
|
+
* Returns `null` for version-specific fields when the caller is not a registered
|
|
165
|
+
* versioned module.
|
|
166
|
+
*
|
|
167
|
+
* @param {object | null | undefined} callerWrapper - The caller's UnifiedWrapper proxy.
|
|
168
|
+
* @returns {{ version: string|null, default: boolean|null, metadata: object, versionMetadata: object|null }}
|
|
169
|
+
* @example
|
|
170
|
+
* versionManager.buildCallerArg(callerWrapper);
|
|
171
|
+
* // { version: "v2", default: false, metadata: {...}, versionMetadata: {...} }
|
|
172
|
+
*/
|
|
173
|
+
buildCallerArg(callerWrapper: object | null | undefined): {
|
|
174
|
+
version: string | null;
|
|
175
|
+
default: boolean | null;
|
|
176
|
+
metadata: object;
|
|
177
|
+
versionMetadata: object | null;
|
|
178
|
+
};
|
|
179
|
+
/**
|
|
180
|
+
* Create a native Proxy that dispatches property accesses to the correct versioned path.
|
|
181
|
+
*
|
|
182
|
+
* The dispatcher handles all property categories defined in the spec (framework
|
|
183
|
+
* internal keys, stable framework accessors, `then`, symbols, routing, etc.).
|
|
184
|
+
*
|
|
185
|
+
* @param {string} logicalPath - Logical API path this dispatcher covers.
|
|
186
|
+
* @returns {object} A Proxy instance for version-dispatched property access. The returned
|
|
187
|
+
* value is a Proxy wrapping a frozen plain-object target; it is NOT the Proxy constructor.
|
|
188
|
+
* @example
|
|
189
|
+
* const proxy = versionManager.createDispatcher("auth");
|
|
190
|
+
* proxy.login; // resolves version then returns api.v2.auth.login
|
|
191
|
+
*/
|
|
192
|
+
createDispatcher(logicalPath: string): object;
|
|
193
|
+
/**
|
|
194
|
+
* Rebuild (or create) the dispatcher proxy for a logical path and mount it
|
|
195
|
+
* on both `api` and `boundApi`.
|
|
196
|
+
*
|
|
197
|
+
* @param {string} logicalPath - Logical API path.
|
|
198
|
+
* @returns {void}
|
|
199
|
+
* @example
|
|
200
|
+
* versionManager.updateDispatcher("auth");
|
|
201
|
+
*/
|
|
202
|
+
updateDispatcher(logicalPath: string): void;
|
|
203
|
+
/**
|
|
204
|
+
* Tear down the dispatcher for a logical path, removing it from the API tree.
|
|
205
|
+
*
|
|
206
|
+
* @param {string} logicalPath - Logical API path.
|
|
207
|
+
* @returns {void}
|
|
208
|
+
* @example
|
|
209
|
+
* versionManager.teardownDispatcher("auth");
|
|
210
|
+
*/
|
|
211
|
+
teardownDispatcher(logicalPath: string): void;
|
|
212
|
+
/**
|
|
213
|
+
* Called after a versioned module is reloaded.
|
|
214
|
+
* Refreshes internal metadata and rebuilds the dispatcher for the affected path.
|
|
215
|
+
*
|
|
216
|
+
* @param {string} moduleID - Module ID that was reloaded.
|
|
217
|
+
* @returns {void}
|
|
218
|
+
* @example
|
|
219
|
+
* versionManager.onVersionedModuleReload("auth_abc");
|
|
220
|
+
*/
|
|
221
|
+
onVersionedModuleReload(moduleID: string): void;
|
|
222
|
+
/**
|
|
223
|
+
* Clear all internal state.
|
|
224
|
+
* Called automatically by the shutdown sequence.
|
|
225
|
+
*
|
|
226
|
+
* @returns {void}
|
|
227
|
+
* @example
|
|
228
|
+
* versionManager.shutdown();
|
|
229
|
+
*/
|
|
230
|
+
shutdown(): void;
|
|
231
|
+
#private;
|
|
232
|
+
}
|
|
233
|
+
import { ComponentBase } from "@cldmv/slothlet/factories/component-base";
|
|
234
|
+
//# sourceMappingURL=version-manager.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version-manager.d.mts","sourceRoot":"","sources":["../../../../dist/lib/handlers/version-manager.mjs"],"names":[],"mappings":"AAsGA;;;;;;;;;;GAUG;AACH;IACC,gCAA2C;IA8B3C;;;;;;;;;;;OAWG;IACH,6BATW,MAAM,cACN,MAAM,YACN,MAAM,eACN,MAAM,aACN,OAAO,GACL,IAAI,CAyDhB;IAED;;;;;;;;;OASG;IACH,+BANW,MAAM,cACN,MAAM,GACJ,OAAO,CAqCnB;IAED;;;;;;;;OAQG;IACH,iCALW,MAAM,GACJ;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAMnE;IAED;;;;;;;;OAQG;IACH,2BALW,MAAM,GACJ,OAAO,CAMnB;IAED;;;;;;;;OAQG;IACH,6BALW,MAAM,GACJ,MAAM,GAAG,SAAS,CAM9B;IAED;;;;;;;;OAQG;IACH,sCANW,MAAM,cACN,MAAM,GACJ,MAAM,GAAG,SAAS,CAU9B;IAED;;;;;;;;;;;OAWG;IACH,sCARW,MAAM,cACN,MAAM,SACN,MAAM,GACJ,IAAI,CAsBhB;IAED;;;;;;;;OAQG;IACH,kBAN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IAED;;;;;OAKG;IACH,2BAJW,MAAM,GACJ,MAAM,CAsBlB;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,+CAcC;IAED;;;;;OAKG;IACH,6BAJW,OAAO,MAAO,
|
|
1
|
+
{"version":3,"file":"config.d.mts","sourceRoot":"","sources":["../../../../dist/lib/helpers/config.mjs"],"names":[],"mappings":"AAoBA;;;;;GAKG;AACH;IACC,gCAAmC;IAEnC;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,qCAxBW,MAAM,MAAO,OAkDvB;IAED;;;;;OAKG;IACH,iCAJW,MAAM,GACJ,MAAM,CAsBlB;IAED;;;;;OAKG;IACH,2BAJW,MAAM,GACJ,MAAM,CAsBlB;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,+CAcC;IAED;;;;;OAKG;IACH,6BAJW,OAAO,MAAO,OAiExB;IAED;;;;;;OAMG;IACH,0CA2IC;IAED;;;;;OAKG;IACH,uCAJW,OAAO,GAAC,MAAM,MAAO,GACnB,MAAO,IAAI,CAsCvB;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,yBArBW,MAAO,IAAI,GAAC,SAAS,GAEnB;QAAE,OAAO,EAAE,MAAM,EAAE,CAAA;KAAE,GAAC,IAAI,CA4BtC;CACD;8BAxc6B,0CAA0C"}
|
|
@@ -140,6 +140,14 @@ export type SlothletOptions = {
|
|
|
140
140
|
* See [TYPESCRIPT.md](docs/TYPESCRIPT.md) for the full configuration reference.
|
|
141
141
|
*/
|
|
142
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;
|
|
143
151
|
};
|
|
144
152
|
/**
|
|
145
153
|
* Bound API object returned by `slothlet()`.
|
|
@@ -224,6 +232,13 @@ export type SlothletAPI = {
|
|
|
224
232
|
get: Function;
|
|
225
233
|
unregister: Function;
|
|
226
234
|
};
|
|
235
|
+
versioning: {
|
|
236
|
+
list: Function;
|
|
237
|
+
setDefault: Function;
|
|
238
|
+
unregister: Function;
|
|
239
|
+
getVersionMetadata: Function;
|
|
240
|
+
setVersionMetadata: Function;
|
|
241
|
+
};
|
|
227
242
|
reference?: object;
|
|
228
243
|
reload: Function;
|
|
229
244
|
run: Function;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slothlet.d.mts","sourceRoot":"","sources":["../../dist/slothlet.mjs"],"names":[],"mappings":"
|
|
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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