@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
|
@@ -14,225 +14,105 @@
|
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
|
|
18
17
|
|
|
19
18
|
|
|
20
19
|
|
|
21
|
-
import { detectCurrentInstanceId, getInstanceData } from "@cldmv/slothlet/helpers/instance-manager";
|
|
22
20
|
|
|
23
21
|
|
|
24
|
-
|
|
25
|
-
const liveBindingsRuntime = await import("@cldmv/slothlet/runtime/live");
|
|
22
|
+
import { asyncRuntime, liveRuntime } from "@cldmv/slothlet/factories/context";
|
|
26
23
|
|
|
27
24
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const instanceId = detectCurrentInstanceId();
|
|
25
|
+
const asyncRuntimeModule = await import("@cldmv/slothlet/runtime/async");
|
|
26
|
+
const liveRuntimeModule = await import("@cldmv/slothlet/runtime/live");
|
|
31
27
|
|
|
32
|
-
if (instanceId) {
|
|
33
|
-
const instanceData = getInstanceData(instanceId);
|
|
34
|
-
if (instanceData && instanceData.config && instanceData.config.runtime) {
|
|
35
|
-
return instanceData.config.runtime;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
28
|
|
|
29
|
+
function getCurrentRuntime() {
|
|
39
30
|
|
|
40
|
-
|
|
41
|
-
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
const asyncCtx = asyncRuntime.tryGetContext();
|
|
34
|
+
if (asyncCtx) {
|
|
35
|
+
return asyncRuntimeModule;
|
|
36
|
+
}
|
|
42
37
|
|
|
38
|
+
|
|
39
|
+
const liveCtx = liveRuntime.tryGetContext();
|
|
40
|
+
if (liveCtx) {
|
|
41
|
+
return liveRuntimeModule;
|
|
42
|
+
}
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
return runtimeType === "live" ? liveBindingsRuntime : asyncRuntime;
|
|
44
|
+
|
|
45
|
+
return asyncRuntimeModule;
|
|
47
46
|
}
|
|
48
47
|
|
|
49
48
|
|
|
50
49
|
export const self = new Proxy(
|
|
51
|
-
|
|
50
|
+
{},
|
|
52
51
|
{
|
|
53
52
|
get(_, prop) {
|
|
54
53
|
const runtime = getCurrentRuntime();
|
|
55
54
|
return runtime.self[prop];
|
|
56
55
|
},
|
|
57
|
-
ownKeys(
|
|
56
|
+
ownKeys() {
|
|
58
57
|
const runtime = getCurrentRuntime();
|
|
59
|
-
|
|
60
|
-
const targetKeys = Reflect.ownKeys(target);
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const allKeys = new Set([...runtimeKeys, ...targetKeys]);
|
|
64
|
-
return Array.from(allKeys);
|
|
58
|
+
return Reflect.ownKeys(runtime.self);
|
|
65
59
|
},
|
|
66
60
|
has(_, prop) {
|
|
67
61
|
const runtime = getCurrentRuntime();
|
|
68
62
|
return prop in runtime.self;
|
|
69
63
|
},
|
|
70
|
-
getOwnPropertyDescriptor(
|
|
64
|
+
getOwnPropertyDescriptor(_, prop) {
|
|
71
65
|
const runtime = getCurrentRuntime();
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
if (!descriptor) {
|
|
76
|
-
return Reflect.getOwnPropertyDescriptor(target, prop);
|
|
77
|
-
}
|
|
78
|
-
|
|
66
|
+
const desc = Reflect.getOwnPropertyDescriptor(runtime.self, prop);
|
|
79
67
|
|
|
80
68
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
return undefined;
|
|
69
|
+
if (desc) {
|
|
70
|
+
return { ...desc, configurable: true };
|
|
86
71
|
}
|
|
87
|
-
|
|
88
|
-
return descriptor;
|
|
89
|
-
},
|
|
90
|
-
getPrototypeOf() {
|
|
91
|
-
const runtime = getCurrentRuntime();
|
|
92
|
-
return Reflect.getPrototypeOf(runtime.self);
|
|
93
|
-
},
|
|
94
|
-
isExtensible() {
|
|
95
|
-
const runtime = getCurrentRuntime();
|
|
96
|
-
return Reflect.isExtensible(runtime.self);
|
|
72
|
+
return undefined;
|
|
97
73
|
}
|
|
98
74
|
}
|
|
99
75
|
);
|
|
100
76
|
|
|
77
|
+
|
|
101
78
|
export const context = new Proxy(
|
|
102
|
-
{},
|
|
79
|
+
{},
|
|
103
80
|
{
|
|
104
81
|
get(_, prop) {
|
|
105
82
|
const runtime = getCurrentRuntime();
|
|
106
83
|
return runtime.context[prop];
|
|
107
84
|
},
|
|
108
|
-
ownKeys(
|
|
85
|
+
ownKeys() {
|
|
109
86
|
const runtime = getCurrentRuntime();
|
|
110
|
-
|
|
111
|
-
const targetKeys = Reflect.ownKeys(target);
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
const allKeys = new Set([...runtimeKeys, ...targetKeys]);
|
|
115
|
-
return Array.from(allKeys);
|
|
87
|
+
return Reflect.ownKeys(runtime.context);
|
|
116
88
|
},
|
|
117
89
|
has(_, prop) {
|
|
118
90
|
const runtime = getCurrentRuntime();
|
|
119
91
|
return prop in runtime.context;
|
|
120
92
|
},
|
|
121
|
-
getOwnPropertyDescriptor(
|
|
122
|
-
const runtime = getCurrentRuntime();
|
|
123
|
-
const descriptor = Reflect.getOwnPropertyDescriptor(runtime.context, prop);
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
if (!descriptor) {
|
|
127
|
-
return Reflect.getOwnPropertyDescriptor(target, prop);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
const targetDescriptor = Reflect.getOwnPropertyDescriptor(target, prop);
|
|
133
|
-
if (!targetDescriptor && descriptor && descriptor.configurable === false) {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
return undefined;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
return descriptor;
|
|
140
|
-
},
|
|
141
|
-
getPrototypeOf() {
|
|
93
|
+
getOwnPropertyDescriptor(_, prop) {
|
|
142
94
|
const runtime = getCurrentRuntime();
|
|
143
|
-
return Reflect.
|
|
95
|
+
return Reflect.getOwnPropertyDescriptor(runtime.context, prop);
|
|
144
96
|
},
|
|
145
|
-
|
|
97
|
+
set(_, prop, value) {
|
|
146
98
|
const runtime = getCurrentRuntime();
|
|
147
|
-
|
|
99
|
+
runtime.context[prop] = value;
|
|
100
|
+
return true;
|
|
148
101
|
}
|
|
149
102
|
}
|
|
150
103
|
);
|
|
151
104
|
|
|
152
|
-
|
|
153
|
-
|
|
105
|
+
|
|
106
|
+
export const instanceID = new Proxy(
|
|
107
|
+
{},
|
|
154
108
|
{
|
|
155
109
|
get(_, prop) {
|
|
156
110
|
const runtime = getCurrentRuntime();
|
|
157
|
-
return runtime.
|
|
158
|
-
},
|
|
159
|
-
ownKeys(target) {
|
|
160
|
-
const runtime = getCurrentRuntime();
|
|
161
|
-
const runtimeKeys = Reflect.ownKeys(runtime.reference);
|
|
162
|
-
const targetKeys = Reflect.ownKeys(target);
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
const allKeys = new Set([...runtimeKeys, ...targetKeys]);
|
|
166
|
-
return Array.from(allKeys);
|
|
111
|
+
return runtime.instanceID ? runtime.instanceID[prop] : undefined;
|
|
167
112
|
},
|
|
168
113
|
has(_, prop) {
|
|
169
114
|
const runtime = getCurrentRuntime();
|
|
170
|
-
return prop in runtime.
|
|
171
|
-
},
|
|
172
|
-
getOwnPropertyDescriptor(target, prop) {
|
|
173
|
-
const runtime = getCurrentRuntime();
|
|
174
|
-
const descriptor = Reflect.getOwnPropertyDescriptor(runtime.reference, prop);
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
if (!descriptor) {
|
|
178
|
-
return Reflect.getOwnPropertyDescriptor(target, prop);
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
const targetDescriptor = Reflect.getOwnPropertyDescriptor(target, prop);
|
|
184
|
-
if (!targetDescriptor && descriptor && descriptor.configurable === false) {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
return undefined;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
return descriptor;
|
|
191
|
-
},
|
|
192
|
-
getPrototypeOf() {
|
|
193
|
-
const runtime = getCurrentRuntime();
|
|
194
|
-
return Reflect.getPrototypeOf(runtime.reference);
|
|
195
|
-
},
|
|
196
|
-
isExtensible() {
|
|
197
|
-
const runtime = getCurrentRuntime();
|
|
198
|
-
return Reflect.isExtensible(runtime.reference);
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
);
|
|
202
|
-
|
|
203
|
-
export function runWithCtx(ctx, fn, thisArg, args) {
|
|
204
|
-
const runtime = getCurrentRuntime();
|
|
205
|
-
return runtime.runWithCtx(ctx, fn, thisArg, args);
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
export function makeWrapper(ctx) {
|
|
209
|
-
const runtime = getCurrentRuntime();
|
|
210
|
-
return runtime.makeWrapper(ctx);
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
export function getCtx() {
|
|
214
|
-
const runtime = getCurrentRuntime();
|
|
215
|
-
return (runtime.getCtx || runtime.getContext)();
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
export const instanceId = (() => {
|
|
219
|
-
const runtimeType = detectRuntimeType();
|
|
220
|
-
if (runtimeType === "async") {
|
|
221
|
-
return null;
|
|
222
|
-
}
|
|
223
|
-
const runtime = getCurrentRuntime();
|
|
224
|
-
return runtime.instanceId;
|
|
225
|
-
})();
|
|
226
|
-
|
|
227
|
-
export const sharedALS = getCurrentRuntime().sharedALS;
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
export const metadataAPI = new Proxy(
|
|
231
|
-
{},
|
|
232
|
-
{
|
|
233
|
-
get(_, prop) {
|
|
234
|
-
const runtime = getCurrentRuntime();
|
|
235
|
-
return runtime.metadataAPI[prop];
|
|
115
|
+
return runtime.instanceID ? prop in runtime.instanceID : false;
|
|
236
116
|
}
|
|
237
117
|
}
|
|
238
118
|
);
|