@memberjunction/react-runtime 6.2.0-edge.0 → 6.2.0-edge.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +14 -14
- package/CHANGELOG.md +93 -0
- package/dist/compiler/babel-config.d.ts +14 -0
- package/dist/compiler/babel-config.d.ts.map +1 -1
- package/dist/compiler/babel-config.js +12 -3
- package/dist/compiler/babel-config.js.map +1 -1
- package/dist/compiler/component-compiler.d.ts +5 -0
- package/dist/compiler/component-compiler.d.ts.map +1 -1
- package/dist/compiler/component-compiler.js +24 -9
- package/dist/compiler/component-compiler.js.map +1 -1
- package/dist/compiler/index.d.ts +1 -1
- package/dist/compiler/index.d.ts.map +1 -1
- package/dist/compiler/index.js +1 -1
- package/dist/compiler/index.js.map +1 -1
- package/dist/component-manager/component-manager.d.ts +8 -0
- package/dist/component-manager/component-manager.d.ts.map +1 -1
- package/dist/component-manager/component-manager.js +18 -6
- package/dist/component-manager/component-manager.js.map +1 -1
- package/dist/index.d.ts +21 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -10
- package/dist/index.js.map +1 -1
- package/dist/registry/component-registry-service.d.ts +18 -0
- package/dist/registry/component-registry-service.d.ts.map +1 -1
- package/dist/registry/component-registry-service.js +65 -23
- package/dist/registry/component-registry-service.js.map +1 -1
- package/dist/registry/component-registry.d.ts +24 -1
- package/dist/registry/component-registry.d.ts.map +1 -1
- package/dist/registry/component-registry.js +74 -23
- package/dist/registry/component-registry.js.map +1 -1
- package/dist/registry/component-resolver.d.ts +10 -0
- package/dist/registry/component-resolver.d.ts.map +1 -1
- package/dist/registry/component-resolver.js +30 -9
- package/dist/registry/component-resolver.js.map +1 -1
- package/dist/registry/registry-provider.js.map +1 -1
- package/dist/runtime/component-hierarchy.d.ts +15 -0
- package/dist/runtime/component-hierarchy.d.ts.map +1 -1
- package/dist/runtime/component-hierarchy.js +28 -10
- package/dist/runtime/component-hierarchy.js.map +1 -1
- package/dist/runtime/error-boundary.d.ts +4 -0
- package/dist/runtime/error-boundary.d.ts.map +1 -1
- package/dist/runtime/error-boundary.js +50 -20
- package/dist/runtime/error-boundary.js.map +1 -1
- package/dist/runtime/index.d.ts +3 -3
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +3 -3
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/prop-builder.d.ts +8 -0
- package/dist/runtime/prop-builder.d.ts.map +1 -1
- package/dist/runtime/prop-builder.js +39 -11
- package/dist/runtime/prop-builder.js.map +1 -1
- package/dist/runtime/react-root-manager.d.ts +10 -0
- package/dist/runtime/react-root-manager.d.ts.map +1 -1
- package/dist/runtime/react-root-manager.js +27 -9
- package/dist/runtime/react-root-manager.js.map +1 -1
- package/dist/runtime.umd.js +194 -125
- package/dist/utilities/cache-manager.d.ts +13 -0
- package/dist/utilities/cache-manager.d.ts.map +1 -1
- package/dist/utilities/cache-manager.js +40 -16
- package/dist/utilities/cache-manager.js.map +1 -1
- package/dist/utilities/component-error-analyzer.d.ts +3 -0
- package/dist/utilities/component-error-analyzer.d.ts.map +1 -1
- package/dist/utilities/component-error-analyzer.js +12 -3
- package/dist/utilities/component-error-analyzer.js.map +1 -1
- package/dist/utilities/component-hash.d.ts +1 -0
- package/dist/utilities/component-hash.d.ts.map +1 -1
- package/dist/utilities/component-hash.js +4 -1
- package/dist/utilities/component-hash.js.map +1 -1
- package/dist/utilities/component-library-theming.d.ts +4 -0
- package/dist/utilities/component-library-theming.d.ts.map +1 -1
- package/dist/utilities/component-library-theming.js +12 -6
- package/dist/utilities/component-library-theming.js.map +1 -1
- package/dist/utilities/component-styles.d.ts +1 -0
- package/dist/utilities/component-styles.d.ts.map +1 -1
- package/dist/utilities/component-styles.js +2 -1
- package/dist/utilities/component-styles.js.map +1 -1
- package/dist/utilities/component-unwrapper.d.ts +8 -2
- package/dist/utilities/component-unwrapper.d.ts.map +1 -1
- package/dist/utilities/component-unwrapper.js +19 -7
- package/dist/utilities/component-unwrapper.js.map +1 -1
- package/dist/utilities/core-libraries.d.ts +2 -0
- package/dist/utilities/core-libraries.d.ts.map +1 -1
- package/dist/utilities/core-libraries.js +9 -3
- package/dist/utilities/core-libraries.js.map +1 -1
- package/dist/utilities/entity-record-key.d.ts +1 -0
- package/dist/utilities/entity-record-key.d.ts.map +1 -1
- package/dist/utilities/entity-record-key.js +4 -1
- package/dist/utilities/entity-record-key.js.map +1 -1
- package/dist/utilities/library-dependency-resolver.d.ts +8 -0
- package/dist/utilities/library-dependency-resolver.d.ts.map +1 -1
- package/dist/utilities/library-dependency-resolver.js +39 -15
- package/dist/utilities/library-dependency-resolver.js.map +1 -1
- package/dist/utilities/library-loader.d.ts +12 -0
- package/dist/utilities/library-loader.d.ts.map +1 -1
- package/dist/utilities/library-loader.js +46 -16
- package/dist/utilities/library-loader.js.map +1 -1
- package/dist/utilities/library-registry.d.ts +5 -0
- package/dist/utilities/library-registry.d.ts.map +1 -1
- package/dist/utilities/library-registry.js +20 -5
- package/dist/utilities/library-registry.js.map +1 -1
- package/dist/utilities/resource-manager.d.ts +19 -0
- package/dist/utilities/resource-manager.d.ts.map +1 -1
- package/dist/utilities/resource-manager.js +63 -18
- package/dist/utilities/resource-manager.js.map +1 -1
- package/dist/utilities/runtime-utilities.d.ts +9 -7
- package/dist/utilities/runtime-utilities.d.ts.map +1 -1
- package/dist/utilities/runtime-utilities.js +22 -16
- package/dist/utilities/runtime-utilities.js.map +1 -1
- package/dist/utilities/standard-libraries.d.ts +10 -0
- package/dist/utilities/standard-libraries.d.ts.map +1 -1
- package/dist/utilities/standard-libraries.js +40 -10
- package/dist/utilities/standard-libraries.js.map +1 -1
- package/dist/utilities/user-state.d.ts +5 -0
- package/dist/utilities/user-state.d.ts.map +1 -1
- package/dist/utilities/user-state.js +20 -5
- package/dist/utilities/user-state.js.map +1 -1
- package/package.json +7 -7
- package/src/__tests__/error-boundary.test.ts +80 -0
- package/src/__tests__/runtime-utilities-factory.test.ts +4 -4
- package/src/__tests__/user-state.test.ts +44 -44
- package/src/compiler/babel-config.ts +18 -3
- package/src/compiler/component-compiler.ts +34 -9
- package/src/compiler/index.ts +3 -3
- package/src/component-manager/component-manager.ts +36 -6
- package/src/index.ts +35 -21
- package/src/registry/component-registry-service.ts +126 -23
- package/src/registry/component-registry.ts +122 -24
- package/src/registry/component-resolver.ts +51 -9
- package/src/registry/registry-provider.ts +40 -40
- package/src/runtime/component-hierarchy.ts +61 -10
- package/src/runtime/error-boundary.ts +77 -22
- package/src/runtime/index.ts +16 -16
- package/src/runtime/prop-builder.ts +69 -11
- package/src/runtime/react-root-manager.ts +48 -10
- package/src/utilities/cache-manager.ts +61 -16
- package/src/utilities/component-error-analyzer.ts +18 -3
- package/src/utilities/component-hash.ts +6 -1
- package/src/utilities/component-library-theming.ts +24 -6
- package/src/utilities/component-styles.ts +4 -1
- package/src/utilities/component-unwrapper.ts +34 -7
- package/src/utilities/core-libraries.ts +13 -3
- package/src/utilities/entity-record-key.ts +11 -1
- package/src/utilities/library-dependency-resolver.ts +66 -15
- package/src/utilities/library-loader.ts +81 -17
- package/src/utilities/library-registry.ts +30 -5
- package/src/utilities/resource-manager.ts +126 -19
- package/src/utilities/runtime-utilities.ts +26 -16
- package/src/utilities/standard-libraries.ts +60 -10
- package/src/utilities/user-state.ts +40 -5
|
@@ -69,7 +69,7 @@ export class ResourceManager {
|
|
|
69
69
|
/**
|
|
70
70
|
* Register a timeout with automatic cleanup
|
|
71
71
|
*/
|
|
72
|
-
|
|
72
|
+
SetTimeout(
|
|
73
73
|
componentId: string,
|
|
74
74
|
callback: () => void,
|
|
75
75
|
delay: number,
|
|
@@ -90,10 +90,20 @@ export class ResourceManager {
|
|
|
90
90
|
return id as any;
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
+
/** @deprecated Use {@link SetTimeout}. */
|
|
94
|
+
setTimeout(
|
|
95
|
+
componentId: string,
|
|
96
|
+
callback: () => void,
|
|
97
|
+
delay: number,
|
|
98
|
+
metadata?: Record<string, any>
|
|
99
|
+
): number {
|
|
100
|
+
return this.SetTimeout(componentId, callback, delay, metadata);
|
|
101
|
+
}
|
|
102
|
+
|
|
93
103
|
/**
|
|
94
104
|
* Register an interval with automatic cleanup
|
|
95
105
|
*/
|
|
96
|
-
|
|
106
|
+
SetInterval(
|
|
97
107
|
componentId: string,
|
|
98
108
|
callback: () => void,
|
|
99
109
|
delay: number,
|
|
@@ -111,17 +121,27 @@ export class ResourceManager {
|
|
|
111
121
|
return id as any;
|
|
112
122
|
}
|
|
113
123
|
|
|
124
|
+
/** @deprecated Use {@link SetInterval}. */
|
|
125
|
+
setInterval(
|
|
126
|
+
componentId: string,
|
|
127
|
+
callback: () => void,
|
|
128
|
+
delay: number,
|
|
129
|
+
metadata?: Record<string, any>
|
|
130
|
+
): number {
|
|
131
|
+
return this.SetInterval(componentId, callback, delay, metadata);
|
|
132
|
+
}
|
|
133
|
+
|
|
114
134
|
/**
|
|
115
135
|
* Register an animation frame with automatic cleanup
|
|
116
136
|
*/
|
|
117
|
-
|
|
137
|
+
RequestAnimationFrame(
|
|
118
138
|
componentId: string,
|
|
119
139
|
callback: FrameRequestCallback,
|
|
120
140
|
metadata?: Record<string, any>
|
|
121
141
|
): TimerId {
|
|
122
142
|
if (!timers.requestAnimationFrame) {
|
|
123
143
|
// Fallback to setTimeout in non-browser environments
|
|
124
|
-
return this.
|
|
144
|
+
return this.SetTimeout(componentId, () => callback(Date.now()), 16, metadata);
|
|
125
145
|
}
|
|
126
146
|
|
|
127
147
|
const id = timers.requestAnimationFrame((time) => {
|
|
@@ -139,26 +159,45 @@ export class ResourceManager {
|
|
|
139
159
|
return id as any;
|
|
140
160
|
}
|
|
141
161
|
|
|
162
|
+
/** @deprecated Use {@link RequestAnimationFrame}. */
|
|
163
|
+
requestAnimationFrame(
|
|
164
|
+
componentId: string,
|
|
165
|
+
callback: FrameRequestCallback,
|
|
166
|
+
metadata?: Record<string, any>
|
|
167
|
+
): TimerId {
|
|
168
|
+
return this.RequestAnimationFrame(componentId, callback, metadata);
|
|
169
|
+
}
|
|
170
|
+
|
|
142
171
|
/**
|
|
143
172
|
* Clear a specific timeout
|
|
144
173
|
*/
|
|
145
|
-
|
|
174
|
+
ClearTimeout(componentId: string, id: number): void {
|
|
146
175
|
timers.clearTimeout(id);
|
|
147
176
|
this.removeResource(componentId, 'timer', id);
|
|
148
177
|
}
|
|
149
178
|
|
|
179
|
+
/** @deprecated Use {@link ClearTimeout}. */
|
|
180
|
+
clearTimeout(componentId: string, id: number): void {
|
|
181
|
+
return this.ClearTimeout(componentId, id);
|
|
182
|
+
}
|
|
183
|
+
|
|
150
184
|
/**
|
|
151
185
|
* Clear a specific interval
|
|
152
186
|
*/
|
|
153
|
-
|
|
187
|
+
ClearInterval(componentId: string, id: number): void {
|
|
154
188
|
timers.clearInterval(id);
|
|
155
189
|
this.removeResource(componentId, 'interval', id);
|
|
156
190
|
}
|
|
157
191
|
|
|
192
|
+
/** @deprecated Use {@link ClearInterval}. */
|
|
193
|
+
clearInterval(componentId: string, id: number): void {
|
|
194
|
+
return this.ClearInterval(componentId, id);
|
|
195
|
+
}
|
|
196
|
+
|
|
158
197
|
/**
|
|
159
198
|
* Cancel a specific animation frame
|
|
160
199
|
*/
|
|
161
|
-
|
|
200
|
+
CancelAnimationFrame(componentId: string, id: TimerId): void {
|
|
162
201
|
if (timers.cancelAnimationFrame) {
|
|
163
202
|
timers.cancelAnimationFrame(id as number);
|
|
164
203
|
} else {
|
|
@@ -168,10 +207,15 @@ export class ResourceManager {
|
|
|
168
207
|
this.removeResource(componentId, 'animationFrame', id);
|
|
169
208
|
}
|
|
170
209
|
|
|
210
|
+
/** @deprecated Use {@link CancelAnimationFrame}. */
|
|
211
|
+
cancelAnimationFrame(componentId: string, id: TimerId): void {
|
|
212
|
+
return this.CancelAnimationFrame(componentId, id);
|
|
213
|
+
}
|
|
214
|
+
|
|
171
215
|
/**
|
|
172
216
|
* Register an event listener with automatic cleanup
|
|
173
217
|
*/
|
|
174
|
-
|
|
218
|
+
AddEventListener(
|
|
175
219
|
componentId: string,
|
|
176
220
|
target: EventTarget,
|
|
177
221
|
type: string,
|
|
@@ -196,10 +240,21 @@ export class ResourceManager {
|
|
|
196
240
|
}
|
|
197
241
|
}
|
|
198
242
|
|
|
243
|
+
/** @deprecated Use {@link AddEventListener}. */
|
|
244
|
+
addEventListener(
|
|
245
|
+
componentId: string,
|
|
246
|
+
target: EventTarget,
|
|
247
|
+
type: string,
|
|
248
|
+
listener: EventListener,
|
|
249
|
+
options?: AddEventListenerOptions
|
|
250
|
+
): void {
|
|
251
|
+
return this.AddEventListener(componentId, target, type, listener, options);
|
|
252
|
+
}
|
|
253
|
+
|
|
199
254
|
/**
|
|
200
255
|
* Register a DOM element that needs cleanup
|
|
201
256
|
*/
|
|
202
|
-
|
|
257
|
+
RegisterDOMElement(
|
|
203
258
|
componentId: string,
|
|
204
259
|
element: any, // Use 'any' to avoid HTMLElement type in Node.js
|
|
205
260
|
cleanup?: () => void
|
|
@@ -223,10 +278,19 @@ export class ResourceManager {
|
|
|
223
278
|
}
|
|
224
279
|
}
|
|
225
280
|
|
|
281
|
+
/** @deprecated Use {@link RegisterDOMElement}. */
|
|
282
|
+
registerDOMElement(
|
|
283
|
+
componentId: string,
|
|
284
|
+
element: any, // Use 'any' to avoid HTMLElement type in Node.js
|
|
285
|
+
cleanup?: () => void
|
|
286
|
+
): void {
|
|
287
|
+
return this.RegisterDOMElement(componentId, element, cleanup);
|
|
288
|
+
}
|
|
289
|
+
|
|
226
290
|
/**
|
|
227
291
|
* Register a React root for cleanup
|
|
228
292
|
*/
|
|
229
|
-
|
|
293
|
+
RegisterReactRoot(
|
|
230
294
|
componentId: string,
|
|
231
295
|
root: any,
|
|
232
296
|
unmountFn: () => void
|
|
@@ -239,23 +303,42 @@ export class ResourceManager {
|
|
|
239
303
|
});
|
|
240
304
|
}
|
|
241
305
|
|
|
306
|
+
/** @deprecated Use {@link RegisterReactRoot}. */
|
|
307
|
+
registerReactRoot(
|
|
308
|
+
componentId: string,
|
|
309
|
+
root: any,
|
|
310
|
+
unmountFn: () => void
|
|
311
|
+
): void {
|
|
312
|
+
return this.RegisterReactRoot(componentId, root, unmountFn);
|
|
313
|
+
}
|
|
314
|
+
|
|
242
315
|
/**
|
|
243
316
|
* Register a generic cleanup callback for a component
|
|
244
317
|
*/
|
|
245
|
-
|
|
318
|
+
RegisterCleanup(componentId: string, cleanup: () => void): void {
|
|
246
319
|
if (!this.cleanupCallbacks.has(componentId)) {
|
|
247
320
|
this.cleanupCallbacks.set(componentId, []);
|
|
248
321
|
}
|
|
249
322
|
this.cleanupCallbacks.get(componentId)!.push(cleanup);
|
|
250
323
|
}
|
|
251
324
|
|
|
325
|
+
/** @deprecated Use {@link RegisterCleanup}. */
|
|
326
|
+
registerCleanup(componentId: string, cleanup: () => void): void {
|
|
327
|
+
return this.RegisterCleanup(componentId, cleanup);
|
|
328
|
+
}
|
|
329
|
+
|
|
252
330
|
/**
|
|
253
331
|
* Register a global resource (not tied to a specific component)
|
|
254
332
|
*/
|
|
255
|
-
|
|
333
|
+
RegisterGlobalResource(resource: ManagedResource): void {
|
|
256
334
|
this.globalResources.add(resource);
|
|
257
335
|
}
|
|
258
336
|
|
|
337
|
+
/** @deprecated Use {@link RegisterGlobalResource}. */
|
|
338
|
+
registerGlobalResource(resource: ManagedResource): void {
|
|
339
|
+
return this.RegisterGlobalResource(resource);
|
|
340
|
+
}
|
|
341
|
+
|
|
259
342
|
/**
|
|
260
343
|
* Add a resource to be managed
|
|
261
344
|
*/
|
|
@@ -288,7 +371,7 @@ export class ResourceManager {
|
|
|
288
371
|
/**
|
|
289
372
|
* Clean up all resources for a specific component
|
|
290
373
|
*/
|
|
291
|
-
|
|
374
|
+
CleanupComponent(componentId: string): void {
|
|
292
375
|
// Clean up tracked resources
|
|
293
376
|
const componentResources = this.resources.get(componentId);
|
|
294
377
|
if (componentResources) {
|
|
@@ -316,10 +399,15 @@ export class ResourceManager {
|
|
|
316
399
|
}
|
|
317
400
|
}
|
|
318
401
|
|
|
402
|
+
/** @deprecated Use {@link CleanupComponent}. */
|
|
403
|
+
cleanupComponent(componentId: string): void {
|
|
404
|
+
return this.CleanupComponent(componentId);
|
|
405
|
+
}
|
|
406
|
+
|
|
319
407
|
/**
|
|
320
408
|
* Clean up all global resources
|
|
321
409
|
*/
|
|
322
|
-
|
|
410
|
+
CleanupGlobal(): void {
|
|
323
411
|
this.globalResources.forEach(resource => {
|
|
324
412
|
try {
|
|
325
413
|
resource.cleanup();
|
|
@@ -330,23 +418,33 @@ export class ResourceManager {
|
|
|
330
418
|
this.globalResources.clear();
|
|
331
419
|
}
|
|
332
420
|
|
|
421
|
+
/** @deprecated Use {@link CleanupGlobal}. */
|
|
422
|
+
cleanupGlobal(): void {
|
|
423
|
+
return this.CleanupGlobal();
|
|
424
|
+
}
|
|
425
|
+
|
|
333
426
|
/**
|
|
334
427
|
* Clean up all resources (components and global)
|
|
335
428
|
*/
|
|
336
|
-
|
|
429
|
+
CleanupAll(): void {
|
|
337
430
|
// Clean up all component resources
|
|
338
431
|
for (const componentId of this.resources.keys()) {
|
|
339
|
-
this.
|
|
432
|
+
this.CleanupComponent(componentId);
|
|
340
433
|
}
|
|
341
434
|
|
|
342
435
|
// Clean up global resources
|
|
343
|
-
this.
|
|
436
|
+
this.CleanupGlobal();
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
/** @deprecated Use {@link CleanupAll}. */
|
|
440
|
+
cleanupAll(): void {
|
|
441
|
+
return this.CleanupAll();
|
|
344
442
|
}
|
|
345
443
|
|
|
346
444
|
/**
|
|
347
445
|
* Get resource statistics for debugging
|
|
348
446
|
*/
|
|
349
|
-
|
|
447
|
+
GetStats(): {
|
|
350
448
|
componentCount: number;
|
|
351
449
|
resourceCounts: Record<string, number>;
|
|
352
450
|
globalResourceCount: number;
|
|
@@ -365,7 +463,16 @@ export class ResourceManager {
|
|
|
365
463
|
globalResourceCount: this.globalResources.size
|
|
366
464
|
};
|
|
367
465
|
}
|
|
466
|
+
|
|
467
|
+
/** @deprecated Use {@link GetStats}. */
|
|
468
|
+
getStats(): {
|
|
469
|
+
componentCount: number;
|
|
470
|
+
resourceCounts: Record<string, number>;
|
|
471
|
+
globalResourceCount: number;
|
|
472
|
+
} {
|
|
473
|
+
return this.GetStats();
|
|
474
|
+
}
|
|
368
475
|
}
|
|
369
476
|
|
|
370
477
|
// Singleton instance
|
|
371
|
-
export const resourceManager = new ResourceManager();
|
|
478
|
+
export const resourceManager = new ResourceManager(); // case-violation-ok-legacy-back-compat: the PascalCase name is already taken in this scope
|
|
@@ -92,30 +92,35 @@ export class RuntimeUtilities {
|
|
|
92
92
|
* passes its own `ProviderToUse`; omitting it falls back to the global default, named
|
|
93
93
|
* explicitly rather than reached for via `new Metadata()`.
|
|
94
94
|
*/
|
|
95
|
-
public
|
|
95
|
+
public BuildUtilities(debug: boolean = false, provider?: IMetadataProvider): ComponentUtilities {
|
|
96
96
|
this.debug = debug;
|
|
97
97
|
this.provider = provider ?? Metadata.Provider;
|
|
98
|
-
return this.
|
|
98
|
+
return this.setupUtilities(this.provider);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** @deprecated Use {@link BuildUtilities}. */
|
|
102
|
+
public buildUtilities(debug: boolean = false, provider?: IMetadataProvider): ComponentUtilities {
|
|
103
|
+
return this.BuildUtilities(debug, provider);
|
|
99
104
|
}
|
|
100
105
|
|
|
101
106
|
/**
|
|
102
107
|
* Sets up the utilities object - copied from skip-chat implementation
|
|
103
108
|
*/
|
|
104
|
-
private
|
|
109
|
+
private setupUtilities(md: IMetadataProvider): ComponentUtilities {
|
|
105
110
|
const rv = RunView.FromMetadataProvider(md);
|
|
106
111
|
const rq = new RunQuery(md as unknown as IRunQueryProvider);
|
|
107
112
|
const u: ComponentUtilities = {
|
|
108
|
-
md: this.
|
|
109
|
-
rv: this.
|
|
110
|
-
rq: this.
|
|
111
|
-
ai: this.
|
|
112
|
-
geoDataEngine: this.
|
|
113
|
-
ml: this.
|
|
113
|
+
md: this.createSimpleMetadata(md),
|
|
114
|
+
rv: this.createSimpleRunView(rv),
|
|
115
|
+
rq: this.createSimpleRunQuery(rq),
|
|
116
|
+
ai: this.createSimpleAITools(),
|
|
117
|
+
geoDataEngine: this.createSimpleGeoDataEngine(),
|
|
118
|
+
ml: this.createSimpleMLTools()
|
|
114
119
|
};
|
|
115
120
|
return u;
|
|
116
121
|
}
|
|
117
122
|
|
|
118
|
-
private
|
|
123
|
+
private createSimpleAITools(): SimpleAITools {
|
|
119
124
|
// Get the GraphQL provider - it's the same as the BaseEntity provider
|
|
120
125
|
const provider = BaseEntity.Provider;
|
|
121
126
|
|
|
@@ -199,7 +204,7 @@ export class RuntimeUtilities {
|
|
|
199
204
|
* Python sidecar lives server-side and cannot run in the browser). Returns `undefined` when no
|
|
200
205
|
* GraphQL provider is available, so the `ml` capability degrades cleanly.
|
|
201
206
|
*/
|
|
202
|
-
private
|
|
207
|
+
private createSimpleMLTools(): SimpleMLTools | undefined {
|
|
203
208
|
const provider = BaseEntity.Provider;
|
|
204
209
|
// Scoring requires a GraphQL provider to route the Remote Operation to the server engine.
|
|
205
210
|
if (!(provider instanceof GraphQLDataProvider)) {
|
|
@@ -354,7 +359,7 @@ export class RuntimeUtilities {
|
|
|
354
359
|
return value.replace(/'/g, "''");
|
|
355
360
|
}
|
|
356
361
|
|
|
357
|
-
private
|
|
362
|
+
private createSimpleMetadata(md: IMetadataProvider): SimpleMetadata {
|
|
358
363
|
return {
|
|
359
364
|
Entities: md.Entities,
|
|
360
365
|
GetEntityObject: (entityName: string) => {
|
|
@@ -363,7 +368,7 @@ export class RuntimeUtilities {
|
|
|
363
368
|
}
|
|
364
369
|
}
|
|
365
370
|
|
|
366
|
-
private
|
|
371
|
+
private createSimpleGeoDataEngine(): SimpleGeoDataEngine | undefined {
|
|
367
372
|
try {
|
|
368
373
|
const geo = GeoDataEngine.Instance;
|
|
369
374
|
if (!geo) return undefined;
|
|
@@ -383,7 +388,7 @@ export class RuntimeUtilities {
|
|
|
383
388
|
}
|
|
384
389
|
}
|
|
385
390
|
|
|
386
|
-
private
|
|
391
|
+
private createSimpleRunQuery(rq: RunQuery): SimpleRunQuery {
|
|
387
392
|
return {
|
|
388
393
|
RunQuery: async (params: RunQueryParams) => {
|
|
389
394
|
// Run a single query and return the results
|
|
@@ -408,7 +413,7 @@ export class RuntimeUtilities {
|
|
|
408
413
|
}
|
|
409
414
|
}
|
|
410
415
|
|
|
411
|
-
private
|
|
416
|
+
private createSimpleRunView(rv: RunView): SimpleRunView {
|
|
412
417
|
return {
|
|
413
418
|
RunView: async (params: RunViewParams) => {
|
|
414
419
|
// Run a single view and return the results
|
|
@@ -457,7 +462,7 @@ export class RuntimeUtilities {
|
|
|
457
462
|
* In a Node.js environment, this will use MJ's ClassFactory for runtime substitution
|
|
458
463
|
* In a browser environment, it will use the base class directly
|
|
459
464
|
*/
|
|
460
|
-
export function
|
|
465
|
+
export function CreateRuntimeUtilities(): RuntimeUtilities {
|
|
461
466
|
try {
|
|
462
467
|
// Resolve through ClassFactory so a host that registers a higher-priority subclass gets it.
|
|
463
468
|
// `CreateInstance` with a null key matches any registration for this root class, and the
|
|
@@ -473,4 +478,9 @@ export function createRuntimeUtilities(): RuntimeUtilities {
|
|
|
473
478
|
}
|
|
474
479
|
|
|
475
480
|
return new RuntimeUtilities();
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
/** @deprecated Use {@link CreateRuntimeUtilities}. */
|
|
484
|
+
export function createRuntimeUtilities(): RuntimeUtilities {
|
|
485
|
+
return CreateRuntimeUtilities();
|
|
476
486
|
}
|
|
@@ -33,56 +33,91 @@ export class StandardLibraryManager {
|
|
|
33
33
|
/**
|
|
34
34
|
* Set a custom library configuration
|
|
35
35
|
*/
|
|
36
|
-
static
|
|
36
|
+
static SetConfiguration(config: LibraryConfiguration): void {
|
|
37
37
|
this.configuration = config;
|
|
38
38
|
}
|
|
39
|
+
|
|
40
|
+
/** @deprecated Use {@link SetConfiguration}. */
|
|
41
|
+
static setConfiguration(config: LibraryConfiguration): void {
|
|
42
|
+
return this.SetConfiguration(config);
|
|
43
|
+
}
|
|
39
44
|
|
|
40
45
|
/**
|
|
41
46
|
* Get the current library configuration
|
|
42
47
|
*/
|
|
43
|
-
static
|
|
48
|
+
static GetConfiguration(): LibraryConfiguration {
|
|
44
49
|
return this.configuration;
|
|
45
50
|
}
|
|
51
|
+
|
|
52
|
+
/** @deprecated Use {@link GetConfiguration}. */
|
|
53
|
+
static getConfiguration(): LibraryConfiguration {
|
|
54
|
+
return this.GetConfiguration();
|
|
55
|
+
}
|
|
46
56
|
|
|
47
57
|
/**
|
|
48
58
|
* Get all enabled libraries
|
|
49
59
|
*/
|
|
50
|
-
static
|
|
60
|
+
static GetEnabledLibraries(): ExternalLibraryConfig[] {
|
|
51
61
|
return this.configuration.libraries.filter(lib => lib.isEnabled);
|
|
52
62
|
}
|
|
63
|
+
|
|
64
|
+
/** @deprecated Use {@link GetEnabledLibraries}. */
|
|
65
|
+
static getEnabledLibraries(): ExternalLibraryConfig[] {
|
|
66
|
+
return this.GetEnabledLibraries();
|
|
67
|
+
}
|
|
53
68
|
|
|
54
69
|
/**
|
|
55
70
|
* Get libraries by category
|
|
56
71
|
*/
|
|
57
|
-
static
|
|
72
|
+
static GetLibrariesByCategory(category: ExternalLibraryConfig['category']): ExternalLibraryConfig[] {
|
|
58
73
|
return this.configuration.libraries.filter(lib => lib.category === category && lib.isEnabled);
|
|
59
74
|
}
|
|
75
|
+
|
|
76
|
+
/** @deprecated Use {@link GetLibrariesByCategory}. */
|
|
77
|
+
static getLibrariesByCategory(category: ExternalLibraryConfig['category']): ExternalLibraryConfig[] {
|
|
78
|
+
return this.GetLibrariesByCategory(category);
|
|
79
|
+
}
|
|
60
80
|
|
|
61
81
|
/**
|
|
62
82
|
* Get core libraries (runtime essentials)
|
|
63
83
|
*/
|
|
64
|
-
static
|
|
84
|
+
static GetCoreLibraries(): ExternalLibraryConfig[] {
|
|
65
85
|
return this.configuration.libraries.filter(lib => lib.isCore && lib.isEnabled);
|
|
66
86
|
}
|
|
87
|
+
|
|
88
|
+
/** @deprecated Use {@link GetCoreLibraries}. */
|
|
89
|
+
static getCoreLibraries(): ExternalLibraryConfig[] {
|
|
90
|
+
return this.GetCoreLibraries();
|
|
91
|
+
}
|
|
67
92
|
|
|
68
93
|
/**
|
|
69
94
|
* Get component libraries (non-runtime)
|
|
70
95
|
*/
|
|
71
|
-
static
|
|
96
|
+
static GetComponentLibraries(): ExternalLibraryConfig[] {
|
|
72
97
|
return this.configuration.libraries.filter(lib => !lib.isRuntimeOnly && lib.isEnabled);
|
|
73
98
|
}
|
|
99
|
+
|
|
100
|
+
/** @deprecated Use {@link GetComponentLibraries}. */
|
|
101
|
+
static getComponentLibraries(): ExternalLibraryConfig[] {
|
|
102
|
+
return this.GetComponentLibraries();
|
|
103
|
+
}
|
|
74
104
|
|
|
75
105
|
/**
|
|
76
106
|
* Get library by ID
|
|
77
107
|
*/
|
|
78
|
-
static
|
|
108
|
+
static GetLibraryById(id: string): ExternalLibraryConfig | undefined {
|
|
79
109
|
return this.configuration.libraries.find(lib => lib.id === id);
|
|
80
110
|
}
|
|
111
|
+
|
|
112
|
+
/** @deprecated Use {@link GetLibraryById}. */
|
|
113
|
+
static getLibraryById(id: string): ExternalLibraryConfig | undefined {
|
|
114
|
+
return this.GetLibraryById(id);
|
|
115
|
+
}
|
|
81
116
|
|
|
82
117
|
/**
|
|
83
118
|
* Get library URLs as a simple object (for backward compatibility)
|
|
84
119
|
*/
|
|
85
|
-
static
|
|
120
|
+
static GetLibraryUrls(): Record<string, string> {
|
|
86
121
|
const urls: Record<string, string> = {};
|
|
87
122
|
this.configuration.libraries
|
|
88
123
|
.filter(lib => lib.isEnabled)
|
|
@@ -96,13 +131,23 @@ export class StandardLibraryManager {
|
|
|
96
131
|
});
|
|
97
132
|
return urls;
|
|
98
133
|
}
|
|
134
|
+
|
|
135
|
+
/** @deprecated Use {@link GetLibraryUrls}. */
|
|
136
|
+
static getLibraryUrls(): Record<string, string> {
|
|
137
|
+
return this.GetLibraryUrls();
|
|
138
|
+
}
|
|
99
139
|
|
|
100
140
|
/**
|
|
101
141
|
* Reset to default configuration
|
|
102
142
|
*/
|
|
103
|
-
static
|
|
143
|
+
static ResetToDefault(): void {
|
|
104
144
|
this.configuration = DEFAULT_LIBRARY_CONFIG;
|
|
105
145
|
}
|
|
146
|
+
|
|
147
|
+
/** @deprecated Use {@link ResetToDefault}. */
|
|
148
|
+
static resetToDefault(): void {
|
|
149
|
+
return this.ResetToDefault();
|
|
150
|
+
}
|
|
106
151
|
}
|
|
107
152
|
|
|
108
153
|
|
|
@@ -110,7 +155,7 @@ export class StandardLibraryManager {
|
|
|
110
155
|
* Creates a standard libraries object for browser environments
|
|
111
156
|
* Dynamically collects all libraries based on current configuration
|
|
112
157
|
*/
|
|
113
|
-
export function
|
|
158
|
+
export function CreateStandardLibraries(): StandardLibraries {
|
|
114
159
|
if (typeof window === 'undefined') {
|
|
115
160
|
// Return empty object in Node.js environments
|
|
116
161
|
return {};
|
|
@@ -127,4 +172,9 @@ export function createStandardLibraries(): StandardLibraries {
|
|
|
127
172
|
});
|
|
128
173
|
|
|
129
174
|
return libs;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/** @deprecated Use {@link CreateStandardLibraries}. */
|
|
178
|
+
export function createStandardLibraries(): StandardLibraries {
|
|
179
|
+
return CreateStandardLibraries();
|
|
130
180
|
}
|
|
@@ -35,7 +35,7 @@ export const USER_STATE_KEY_PREFIX = 'InteractiveComponents_UserState_Root/';
|
|
|
35
35
|
* @returns the resolved scope, or `null` when no stable scope can be derived
|
|
36
36
|
* (e.g. an unnamed component) — signaling the caller to skip persistence.
|
|
37
37
|
*/
|
|
38
|
-
export function
|
|
38
|
+
export function ResolveUserStateScope(
|
|
39
39
|
explicitScope: string | undefined | null,
|
|
40
40
|
namespace: string | undefined | null,
|
|
41
41
|
name: string | undefined | null
|
|
@@ -53,20 +53,34 @@ export function resolveUserStateScope(
|
|
|
53
53
|
return scope.toLowerCase();
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
/** @deprecated Use {@link ResolveUserStateScope}. */
|
|
57
|
+
export function resolveUserStateScope(
|
|
58
|
+
explicitScope: string | undefined | null,
|
|
59
|
+
namespace: string | undefined | null,
|
|
60
|
+
name: string | undefined | null
|
|
61
|
+
): string | null {
|
|
62
|
+
return ResolveUserStateScope(explicitScope, namespace, name);
|
|
63
|
+
}
|
|
64
|
+
|
|
56
65
|
/**
|
|
57
66
|
* Build the full storage key for a resolved scope, or `null` when the scope is
|
|
58
67
|
* `null` (persistence should be skipped).
|
|
59
68
|
*/
|
|
60
|
-
export function
|
|
69
|
+
export function UserStateStorageKey(scope: string | null): string | null {
|
|
61
70
|
return scope ? `${USER_STATE_KEY_PREFIX}${scope}` : null;
|
|
62
71
|
}
|
|
63
72
|
|
|
73
|
+
/** @deprecated Use {@link UserStateStorageKey}. */
|
|
74
|
+
export function userStateStorageKey(scope: string | null): string | null {
|
|
75
|
+
return UserStateStorageKey(scope);
|
|
76
|
+
}
|
|
77
|
+
|
|
64
78
|
/**
|
|
65
79
|
* Safely parse a stored settings blob into a plain object. Returns `{}` for
|
|
66
80
|
* null/empty input, invalid JSON, or any non-object JSON (arrays, primitives) —
|
|
67
81
|
* persisted user settings are always a flat key/value object.
|
|
68
82
|
*/
|
|
69
|
-
export function
|
|
83
|
+
export function ParseStoredUserSettings(raw: string | undefined | null): Record<string, unknown> {
|
|
70
84
|
if (!raw) {
|
|
71
85
|
return {};
|
|
72
86
|
}
|
|
@@ -81,18 +95,31 @@ export function parseStoredUserSettings(raw: string | undefined | null): Record<
|
|
|
81
95
|
}
|
|
82
96
|
}
|
|
83
97
|
|
|
98
|
+
/** @deprecated Use {@link ParseStoredUserSettings}. */
|
|
99
|
+
export function parseStoredUserSettings(raw: string | undefined | null): Record<string, unknown> {
|
|
100
|
+
return ParseStoredUserSettings(raw);
|
|
101
|
+
}
|
|
102
|
+
|
|
84
103
|
/**
|
|
85
104
|
* Merge host-provided defaults with the stored per-user settings. Stored values
|
|
86
105
|
* win, so a returning user sees their saved preferences while a host can still
|
|
87
106
|
* seed sensible first-run defaults that fill any gaps.
|
|
88
107
|
*/
|
|
89
|
-
export function
|
|
108
|
+
export function MergeUserSettings(
|
|
90
109
|
hostDefaults: Record<string, unknown> | undefined | null,
|
|
91
110
|
stored: Record<string, unknown> | undefined | null
|
|
92
111
|
): Record<string, unknown> {
|
|
93
112
|
return { ...(hostDefaults ?? {}), ...(stored ?? {}) };
|
|
94
113
|
}
|
|
95
114
|
|
|
115
|
+
/** @deprecated Use {@link MergeUserSettings}. */
|
|
116
|
+
export function mergeUserSettings(
|
|
117
|
+
hostDefaults: Record<string, unknown> | undefined | null,
|
|
118
|
+
stored: Record<string, unknown> | undefined | null
|
|
119
|
+
): Record<string, unknown> {
|
|
120
|
+
return MergeUserSettings(hostDefaults, stored);
|
|
121
|
+
}
|
|
122
|
+
|
|
96
123
|
/**
|
|
97
124
|
* Apply an `onSaveUserSettings` payload to the host's current settings snapshot.
|
|
98
125
|
*
|
|
@@ -113,7 +140,7 @@ export function mergeUserSettings(
|
|
|
113
140
|
*
|
|
114
141
|
* @returns a new object — neither input is mutated.
|
|
115
142
|
*/
|
|
116
|
-
export function
|
|
143
|
+
export function ApplyUserSettingsUpdate(
|
|
117
144
|
current: Record<string, unknown> | undefined | null,
|
|
118
145
|
incoming: Record<string, unknown> | undefined | null
|
|
119
146
|
): Record<string, unknown> {
|
|
@@ -127,3 +154,11 @@ export function applyUserSettingsUpdate(
|
|
|
127
154
|
}
|
|
128
155
|
return next;
|
|
129
156
|
}
|
|
157
|
+
|
|
158
|
+
/** @deprecated Use {@link ApplyUserSettingsUpdate}. */
|
|
159
|
+
export function applyUserSettingsUpdate(
|
|
160
|
+
current: Record<string, unknown> | undefined | null,
|
|
161
|
+
incoming: Record<string, unknown> | undefined | null
|
|
162
|
+
): Record<string, unknown> {
|
|
163
|
+
return ApplyUserSettingsUpdate(current, incoming);
|
|
164
|
+
}
|