@memberjunction/react-runtime 6.2.0-edge.0 → 6.2.0-edge.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/.turbo/turbo-build.log +12 -12
- package/CHANGELOG.md +61 -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 +72 -72
- 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
|
@@ -30,7 +30,12 @@ export class ComponentRegistry {
|
|
|
30
30
|
private registry: Map<string, RegistryEntry>;
|
|
31
31
|
private config: RegistryConfig;
|
|
32
32
|
private cleanupTimer?: NodeJS.Timeout | number;
|
|
33
|
-
public readonly
|
|
33
|
+
public readonly RegistryId: string;
|
|
34
|
+
|
|
35
|
+
/** @deprecated Use {@link RegistryId}. */
|
|
36
|
+
public get registryId(): string {
|
|
37
|
+
return this.RegistryId;
|
|
38
|
+
}
|
|
34
39
|
|
|
35
40
|
/**
|
|
36
41
|
* Creates a new ComponentRegistry instance
|
|
@@ -39,7 +44,7 @@ export class ComponentRegistry {
|
|
|
39
44
|
constructor(config?: Partial<RegistryConfig>) {
|
|
40
45
|
this.config = { ...DEFAULT_REGISTRY_CONFIG, ...config };
|
|
41
46
|
this.registry = new Map();
|
|
42
|
-
this.
|
|
47
|
+
this.RegistryId = `component-registry-${Date.now()}`;
|
|
43
48
|
|
|
44
49
|
// Start cleanup timer if configured
|
|
45
50
|
if (this.config.cleanupInterval > 0) {
|
|
@@ -61,7 +66,7 @@ export class ComponentRegistry {
|
|
|
61
66
|
* @param tags - Optional tags for categorization
|
|
62
67
|
* @returns The registered component's metadata
|
|
63
68
|
*/
|
|
64
|
-
|
|
69
|
+
Register(
|
|
65
70
|
name: string,
|
|
66
71
|
component: ComponentObject,
|
|
67
72
|
namespace: string = 'Global',
|
|
@@ -100,6 +105,18 @@ export class ComponentRegistry {
|
|
|
100
105
|
return metadata;
|
|
101
106
|
}
|
|
102
107
|
|
|
108
|
+
/** @deprecated Use {@link Register}. */
|
|
109
|
+
register(
|
|
110
|
+
name: string,
|
|
111
|
+
component: ComponentObject,
|
|
112
|
+
namespace: string = 'Global',
|
|
113
|
+
version: string = 'v1',
|
|
114
|
+
contentHash?: string,
|
|
115
|
+
tags?: string[]
|
|
116
|
+
): ComponentMetadata {
|
|
117
|
+
return this.Register(name, component, namespace, version, contentHash, tags);
|
|
118
|
+
}
|
|
119
|
+
|
|
103
120
|
/**
|
|
104
121
|
* Gets a component from the registry
|
|
105
122
|
* @param name - Component name
|
|
@@ -111,7 +128,7 @@ export class ComponentRegistry {
|
|
|
111
128
|
* (existing behavior).
|
|
112
129
|
* @returns The component object if found, undefined otherwise
|
|
113
130
|
*/
|
|
114
|
-
|
|
131
|
+
Get(name: string, namespace: string = 'Global', version?: string, contentHash?: string): ComponentObject | undefined {
|
|
115
132
|
const id = this.resolveLookupKey(name, namespace, version, contentHash);
|
|
116
133
|
|
|
117
134
|
if (!id) return undefined;
|
|
@@ -127,6 +144,11 @@ export class ComponentRegistry {
|
|
|
127
144
|
return undefined;
|
|
128
145
|
}
|
|
129
146
|
|
|
147
|
+
/** @deprecated Use {@link Get}. */
|
|
148
|
+
get(name: string, namespace: string = 'Global', version?: string, contentHash?: string): ComponentObject | undefined {
|
|
149
|
+
return this.Get(name, namespace, version, contentHash);
|
|
150
|
+
}
|
|
151
|
+
|
|
130
152
|
/**
|
|
131
153
|
* Checks if a component exists in the registry
|
|
132
154
|
* @param name - Component name
|
|
@@ -135,11 +157,16 @@ export class ComponentRegistry {
|
|
|
135
157
|
* @param contentHash - Optional content fingerprint (see {@link get})
|
|
136
158
|
* @returns true if the component exists
|
|
137
159
|
*/
|
|
138
|
-
|
|
160
|
+
Has(name: string, namespace: string = 'Global', version?: string, contentHash?: string): boolean {
|
|
139
161
|
const id = this.resolveLookupKey(name, namespace, version, contentHash);
|
|
140
162
|
return id ? this.registry.has(id) : false;
|
|
141
163
|
}
|
|
142
164
|
|
|
165
|
+
/** @deprecated Use {@link Has}. */
|
|
166
|
+
has(name: string, namespace: string = 'Global', version?: string, contentHash?: string): boolean {
|
|
167
|
+
return this.Has(name, namespace, version, contentHash);
|
|
168
|
+
}
|
|
169
|
+
|
|
143
170
|
/**
|
|
144
171
|
* Removes a component from the registry
|
|
145
172
|
* @param name - Component name
|
|
@@ -148,18 +175,23 @@ export class ComponentRegistry {
|
|
|
148
175
|
* @param contentHash - Optional content fingerprint (see {@link get})
|
|
149
176
|
* @returns true if the component was removed
|
|
150
177
|
*/
|
|
151
|
-
|
|
178
|
+
Unregister(name: string, namespace: string = 'Global', version?: string, contentHash?: string): boolean {
|
|
152
179
|
const id = this.resolveLookupKey(name, namespace, version, contentHash);
|
|
153
180
|
if (!id) return false;
|
|
154
181
|
return this.registry.delete(id);
|
|
155
182
|
}
|
|
156
183
|
|
|
184
|
+
/** @deprecated Use {@link Unregister}. */
|
|
185
|
+
unregister(name: string, namespace: string = 'Global', version?: string, contentHash?: string): boolean {
|
|
186
|
+
return this.Unregister(name, namespace, version, contentHash);
|
|
187
|
+
}
|
|
188
|
+
|
|
157
189
|
/**
|
|
158
190
|
* Gets all components in a namespace
|
|
159
191
|
* @param namespace - Namespace to query
|
|
160
192
|
* @returns Array of components in the namespace
|
|
161
193
|
*/
|
|
162
|
-
|
|
194
|
+
GetNamespace(namespace: string): ComponentMetadata[] {
|
|
163
195
|
const components: ComponentMetadata[] = [];
|
|
164
196
|
|
|
165
197
|
for (const entry of this.registry.values()) {
|
|
@@ -171,13 +203,18 @@ export class ComponentRegistry {
|
|
|
171
203
|
return components;
|
|
172
204
|
}
|
|
173
205
|
|
|
206
|
+
/** @deprecated Use {@link GetNamespace}. */
|
|
207
|
+
getNamespace(namespace: string): ComponentMetadata[] {
|
|
208
|
+
return this.GetNamespace(namespace);
|
|
209
|
+
}
|
|
210
|
+
|
|
174
211
|
/**
|
|
175
212
|
* Gets all components in a namespace and version as a map
|
|
176
213
|
* @param namespace - Namespace to query (default: 'Global')
|
|
177
214
|
* @param version - Version to query (default: 'v1')
|
|
178
215
|
* @returns Object mapping component names to component objects
|
|
179
216
|
*/
|
|
180
|
-
|
|
217
|
+
GetAll(namespace: string = 'Global', version: string = 'v1'): Record<string, ComponentObject> {
|
|
181
218
|
const components: Record<string, ComponentObject> = {};
|
|
182
219
|
|
|
183
220
|
for (const entry of this.registry.values()) {
|
|
@@ -189,11 +226,16 @@ export class ComponentRegistry {
|
|
|
189
226
|
return components;
|
|
190
227
|
}
|
|
191
228
|
|
|
229
|
+
/** @deprecated Use {@link GetAll}. */
|
|
230
|
+
getAll(namespace: string = 'Global', version: string = 'v1'): Record<string, ComponentObject> {
|
|
231
|
+
return this.GetAll(namespace, version);
|
|
232
|
+
}
|
|
233
|
+
|
|
192
234
|
/**
|
|
193
235
|
* Gets all registered namespaces
|
|
194
236
|
* @returns Array of unique namespace names
|
|
195
237
|
*/
|
|
196
|
-
|
|
238
|
+
GetNamespaces(): string[] {
|
|
197
239
|
const namespaces = new Set<string>();
|
|
198
240
|
|
|
199
241
|
for (const entry of this.registry.values()) {
|
|
@@ -203,12 +245,17 @@ export class ComponentRegistry {
|
|
|
203
245
|
return Array.from(namespaces);
|
|
204
246
|
}
|
|
205
247
|
|
|
248
|
+
/** @deprecated Use {@link GetNamespaces}. */
|
|
249
|
+
getNamespaces(): string[] {
|
|
250
|
+
return this.GetNamespaces();
|
|
251
|
+
}
|
|
252
|
+
|
|
206
253
|
/**
|
|
207
254
|
* Gets components by tags
|
|
208
255
|
* @param tags - Tags to search for
|
|
209
256
|
* @returns Array of components matching any of the tags
|
|
210
257
|
*/
|
|
211
|
-
|
|
258
|
+
GetByTags(tags: string[]): ComponentMetadata[] {
|
|
212
259
|
const components: ComponentMetadata[] = [];
|
|
213
260
|
|
|
214
261
|
for (const entry of this.registry.values()) {
|
|
@@ -220,6 +267,11 @@ export class ComponentRegistry {
|
|
|
220
267
|
return components;
|
|
221
268
|
}
|
|
222
269
|
|
|
270
|
+
/** @deprecated Use {@link GetByTags}. */
|
|
271
|
+
getByTags(tags: string[]): ComponentMetadata[] {
|
|
272
|
+
return this.GetByTags(tags);
|
|
273
|
+
}
|
|
274
|
+
|
|
223
275
|
/**
|
|
224
276
|
* Decrements reference count for a component
|
|
225
277
|
* @param name - Component name
|
|
@@ -227,7 +279,7 @@ export class ComponentRegistry {
|
|
|
227
279
|
* @param version - Component version
|
|
228
280
|
* @param contentHash - Optional content fingerprint (see {@link get})
|
|
229
281
|
*/
|
|
230
|
-
|
|
282
|
+
Release(name: string, namespace: string = 'Global', version?: string, contentHash?: string): void {
|
|
231
283
|
const id = this.resolveLookupKey(name, namespace, version, contentHash);
|
|
232
284
|
if (!id) return;
|
|
233
285
|
|
|
@@ -237,19 +289,29 @@ export class ComponentRegistry {
|
|
|
237
289
|
}
|
|
238
290
|
}
|
|
239
291
|
|
|
292
|
+
/** @deprecated Use {@link Release}. */
|
|
293
|
+
release(name: string, namespace: string = 'Global', version?: string, contentHash?: string): void {
|
|
294
|
+
return this.Release(name, namespace, version, contentHash);
|
|
295
|
+
}
|
|
296
|
+
|
|
240
297
|
/**
|
|
241
298
|
* Clears all components from the registry
|
|
242
299
|
*/
|
|
243
|
-
|
|
300
|
+
Clear(): void {
|
|
244
301
|
this.registry.clear();
|
|
245
302
|
}
|
|
246
303
|
|
|
304
|
+
/** @deprecated Use {@link Clear}. */
|
|
305
|
+
clear(): void {
|
|
306
|
+
return this.Clear();
|
|
307
|
+
}
|
|
308
|
+
|
|
247
309
|
/**
|
|
248
310
|
* Clear all components in a specific namespace
|
|
249
311
|
* @param namespace - Namespace to clear (default: 'Global')
|
|
250
312
|
* @returns Number of components removed
|
|
251
313
|
*/
|
|
252
|
-
|
|
314
|
+
ClearNamespace(namespace: string = 'Global'): number {
|
|
253
315
|
const toRemove: string[] = [];
|
|
254
316
|
for (const [key, entry] of this.registry) {
|
|
255
317
|
if (entry.metadata.namespace === namespace) {
|
|
@@ -262,30 +324,45 @@ export class ComponentRegistry {
|
|
|
262
324
|
return toRemove.length;
|
|
263
325
|
}
|
|
264
326
|
|
|
327
|
+
/** @deprecated Use {@link ClearNamespace}. */
|
|
328
|
+
clearNamespace(namespace: string = 'Global'): number {
|
|
329
|
+
return this.ClearNamespace(namespace);
|
|
330
|
+
}
|
|
331
|
+
|
|
265
332
|
/**
|
|
266
333
|
* Force clear all components and reset registry
|
|
267
334
|
* Used for development/testing scenarios
|
|
268
335
|
*/
|
|
269
|
-
|
|
336
|
+
ForceClear(): void {
|
|
270
337
|
this.stopCleanupTimer();
|
|
271
338
|
this.registry.clear();
|
|
272
339
|
console.log('🧹 Registry force cleared - all components removed');
|
|
273
340
|
}
|
|
274
341
|
|
|
342
|
+
/** @deprecated Use {@link ForceClear}. */
|
|
343
|
+
forceClear(): void {
|
|
344
|
+
return this.ForceClear();
|
|
345
|
+
}
|
|
346
|
+
|
|
275
347
|
/**
|
|
276
348
|
* Gets the current size of the registry
|
|
277
349
|
* @returns Number of registered components
|
|
278
350
|
*/
|
|
279
|
-
|
|
351
|
+
Size(): number {
|
|
280
352
|
return this.registry.size;
|
|
281
353
|
}
|
|
282
354
|
|
|
355
|
+
/** @deprecated Use {@link Size}. */
|
|
356
|
+
size(): number {
|
|
357
|
+
return this.Size();
|
|
358
|
+
}
|
|
359
|
+
|
|
283
360
|
/**
|
|
284
361
|
* Performs cleanup of unused components
|
|
285
362
|
* @param force - Force cleanup regardless of reference count
|
|
286
363
|
* @returns Number of components removed
|
|
287
364
|
*/
|
|
288
|
-
|
|
365
|
+
Cleanup(force: boolean = false): number {
|
|
289
366
|
const toRemove: string[] = [];
|
|
290
367
|
const now = Date.now();
|
|
291
368
|
|
|
@@ -306,11 +383,16 @@ export class ComponentRegistry {
|
|
|
306
383
|
return toRemove.length;
|
|
307
384
|
}
|
|
308
385
|
|
|
386
|
+
/** @deprecated Use {@link Cleanup}. */
|
|
387
|
+
cleanup(force: boolean = false): number {
|
|
388
|
+
return this.Cleanup(force);
|
|
389
|
+
}
|
|
390
|
+
|
|
309
391
|
/**
|
|
310
392
|
* Gets registry statistics
|
|
311
393
|
* @returns Object containing registry stats
|
|
312
394
|
*/
|
|
313
|
-
|
|
395
|
+
GetStats(): {
|
|
314
396
|
totalComponents: number;
|
|
315
397
|
namespaces: number;
|
|
316
398
|
totalRefCount: number;
|
|
@@ -335,21 +417,37 @@ export class ComponentRegistry {
|
|
|
335
417
|
|
|
336
418
|
return {
|
|
337
419
|
totalComponents: this.registry.size,
|
|
338
|
-
namespaces: this.
|
|
420
|
+
namespaces: this.GetNamespaces().length,
|
|
339
421
|
totalRefCount,
|
|
340
422
|
oldestComponent: oldest,
|
|
341
423
|
newestComponent: newest
|
|
342
424
|
};
|
|
343
425
|
}
|
|
344
426
|
|
|
427
|
+
/** @deprecated Use {@link GetStats}. */
|
|
428
|
+
getStats(): {
|
|
429
|
+
totalComponents: number;
|
|
430
|
+
namespaces: number;
|
|
431
|
+
totalRefCount: number;
|
|
432
|
+
oldestComponent?: Date;
|
|
433
|
+
newestComponent?: Date;
|
|
434
|
+
} {
|
|
435
|
+
return this.GetStats();
|
|
436
|
+
}
|
|
437
|
+
|
|
345
438
|
/**
|
|
346
439
|
* Destroys the registry and cleans up resources
|
|
347
440
|
*/
|
|
348
|
-
|
|
441
|
+
Destroy(): void {
|
|
349
442
|
this.stopCleanupTimer();
|
|
350
|
-
this.
|
|
443
|
+
this.Clear();
|
|
351
444
|
// Clean up any resources associated with this registry
|
|
352
|
-
resourceManager.cleanupComponent(this.
|
|
445
|
+
resourceManager.cleanupComponent(this.RegistryId);
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
/** @deprecated Use {@link Destroy}. */
|
|
449
|
+
destroy(): void {
|
|
450
|
+
return this.Destroy();
|
|
353
451
|
}
|
|
354
452
|
|
|
355
453
|
/**
|
|
@@ -454,9 +552,9 @@ export class ComponentRegistry {
|
|
|
454
552
|
*/
|
|
455
553
|
private startCleanupTimer(): void {
|
|
456
554
|
this.cleanupTimer = resourceManager.setInterval(
|
|
457
|
-
this.
|
|
555
|
+
this.RegistryId,
|
|
458
556
|
() => {
|
|
459
|
-
this.
|
|
557
|
+
this.Cleanup();
|
|
460
558
|
},
|
|
461
559
|
this.config.cleanupInterval,
|
|
462
560
|
{ purpose: 'component-registry-cleanup' }
|
|
@@ -468,7 +566,7 @@ export class ComponentRegistry {
|
|
|
468
566
|
*/
|
|
469
567
|
private stopCleanupTimer(): void {
|
|
470
568
|
if (this.cleanupTimer) {
|
|
471
|
-
resourceManager.clearInterval(this.
|
|
569
|
+
resourceManager.clearInterval(this.RegistryId, this.cleanupTimer as number);
|
|
472
570
|
this.cleanupTimer = undefined;
|
|
473
571
|
}
|
|
474
572
|
}
|
|
@@ -63,7 +63,7 @@ export class ComponentResolver {
|
|
|
63
63
|
* @param contextUser - Optional user context for database operations
|
|
64
64
|
* @returns Map of component names to resolved components
|
|
65
65
|
*/
|
|
66
|
-
async
|
|
66
|
+
async ResolveComponents(
|
|
67
67
|
spec: ComponentSpec,
|
|
68
68
|
namespace: string = 'Global',
|
|
69
69
|
contextUser?: UserInfo
|
|
@@ -152,6 +152,15 @@ export class ComponentResolver {
|
|
|
152
152
|
return unwrapped;
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
+
/** @deprecated Use {@link ResolveComponents}. */
|
|
156
|
+
async resolveComponents(
|
|
157
|
+
spec: ComponentSpec,
|
|
158
|
+
namespace: string = 'Global',
|
|
159
|
+
contextUser?: UserInfo
|
|
160
|
+
): Promise<ResolvedComponents> {
|
|
161
|
+
return this.ResolveComponents(spec, namespace, contextUser);
|
|
162
|
+
}
|
|
163
|
+
|
|
155
164
|
/**
|
|
156
165
|
* Recursively resolves a component hierarchy
|
|
157
166
|
* @param spec - Component specification
|
|
@@ -377,7 +386,7 @@ export class ComponentResolver {
|
|
|
377
386
|
/**
|
|
378
387
|
* Cleanup resolver resources
|
|
379
388
|
*/
|
|
380
|
-
|
|
389
|
+
Cleanup(): void {
|
|
381
390
|
// Remove our references when resolver is destroyed
|
|
382
391
|
if (this.registryService) {
|
|
383
392
|
// This would allow the registry service to clean up unused components
|
|
@@ -388,13 +397,18 @@ export class ComponentResolver {
|
|
|
388
397
|
}
|
|
389
398
|
}
|
|
390
399
|
|
|
400
|
+
/** @deprecated Use {@link Cleanup}. */
|
|
401
|
+
cleanup(): void {
|
|
402
|
+
return this.Cleanup();
|
|
403
|
+
}
|
|
404
|
+
|
|
391
405
|
/**
|
|
392
406
|
* Validates that all required components are available
|
|
393
407
|
* @param spec - Component specification to validate
|
|
394
408
|
* @param namespace - Namespace for validation
|
|
395
409
|
* @returns Array of missing component names
|
|
396
410
|
*/
|
|
397
|
-
|
|
411
|
+
ValidateDependencies(spec: ComponentSpec, namespace: string = 'Global'): string[] {
|
|
398
412
|
const missing: string[] = [];
|
|
399
413
|
const checked = new Set<string>();
|
|
400
414
|
|
|
@@ -403,6 +417,11 @@ export class ComponentResolver {
|
|
|
403
417
|
return missing;
|
|
404
418
|
}
|
|
405
419
|
|
|
420
|
+
/** @deprecated Use {@link ValidateDependencies}. */
|
|
421
|
+
validateDependencies(spec: ComponentSpec, namespace: string = 'Global'): string[] {
|
|
422
|
+
return this.ValidateDependencies(spec, namespace);
|
|
423
|
+
}
|
|
424
|
+
|
|
406
425
|
/**
|
|
407
426
|
* Recursively checks for missing dependencies
|
|
408
427
|
* @param spec - Component specification
|
|
@@ -436,7 +455,7 @@ export class ComponentResolver {
|
|
|
436
455
|
* @param spec - Component specification
|
|
437
456
|
* @returns Dependency graph as adjacency list
|
|
438
457
|
*/
|
|
439
|
-
|
|
458
|
+
GetDependencyGraph(spec: ComponentSpec): Map<string, string[]> {
|
|
440
459
|
const graph = new Map<string, string[]>();
|
|
441
460
|
const visited = new Set<string>();
|
|
442
461
|
|
|
@@ -445,6 +464,11 @@ export class ComponentResolver {
|
|
|
445
464
|
return graph;
|
|
446
465
|
}
|
|
447
466
|
|
|
467
|
+
/** @deprecated Use {@link GetDependencyGraph}. */
|
|
468
|
+
getDependencyGraph(spec: ComponentSpec): Map<string, string[]> {
|
|
469
|
+
return this.GetDependencyGraph(spec);
|
|
470
|
+
}
|
|
471
|
+
|
|
448
472
|
/**
|
|
449
473
|
* Recursively builds the dependency graph
|
|
450
474
|
* @param spec - Component specification
|
|
@@ -475,8 +499,8 @@ export class ComponentResolver {
|
|
|
475
499
|
* @param spec - Root component specification
|
|
476
500
|
* @returns Array of component names in dependency order
|
|
477
501
|
*/
|
|
478
|
-
|
|
479
|
-
const graph = this.
|
|
502
|
+
GetLoadOrder(spec: ComponentSpec): string[] {
|
|
503
|
+
const graph = this.GetDependencyGraph(spec);
|
|
480
504
|
const visited = new Set<string>();
|
|
481
505
|
const stack: string[] = [];
|
|
482
506
|
|
|
@@ -491,6 +515,11 @@ export class ComponentResolver {
|
|
|
491
515
|
return stack.reverse();
|
|
492
516
|
}
|
|
493
517
|
|
|
518
|
+
/** @deprecated Use {@link GetLoadOrder}. */
|
|
519
|
+
getLoadOrder(spec: ComponentSpec): string[] {
|
|
520
|
+
return this.GetLoadOrder(spec);
|
|
521
|
+
}
|
|
522
|
+
|
|
494
523
|
/**
|
|
495
524
|
* DFS helper for topological sort
|
|
496
525
|
* @param node - Current node
|
|
@@ -522,11 +551,11 @@ export class ComponentResolver {
|
|
|
522
551
|
* @param namespace - Namespace for resolution
|
|
523
552
|
* @returns Ordered array of resolved components
|
|
524
553
|
*/
|
|
525
|
-
|
|
554
|
+
ResolveInOrder(spec: ComponentSpec, namespace: string = 'Global'): Array<{
|
|
526
555
|
name: string;
|
|
527
556
|
component: any;
|
|
528
557
|
}> {
|
|
529
|
-
const loadOrder = this.
|
|
558
|
+
const loadOrder = this.GetLoadOrder(spec);
|
|
530
559
|
const resolved: Array<{ name: string; component: any }> = [];
|
|
531
560
|
|
|
532
561
|
for (const name of loadOrder) {
|
|
@@ -539,12 +568,20 @@ export class ComponentResolver {
|
|
|
539
568
|
return resolved;
|
|
540
569
|
}
|
|
541
570
|
|
|
571
|
+
/** @deprecated Use {@link ResolveInOrder}. */
|
|
572
|
+
resolveInOrder(spec: ComponentSpec, namespace: string = 'Global'): Array<{
|
|
573
|
+
name: string;
|
|
574
|
+
component: any;
|
|
575
|
+
}> {
|
|
576
|
+
return this.ResolveInOrder(spec, namespace);
|
|
577
|
+
}
|
|
578
|
+
|
|
542
579
|
/**
|
|
543
580
|
* Creates a flattened list of all component specifications
|
|
544
581
|
* @param spec - Root component specification
|
|
545
582
|
* @returns Array of all component specs in the hierarchy
|
|
546
583
|
*/
|
|
547
|
-
|
|
584
|
+
FlattenComponentSpecs(spec: ComponentSpec): ComponentSpec[] {
|
|
548
585
|
const flattened: ComponentSpec[] = [];
|
|
549
586
|
const visited = new Set<string>();
|
|
550
587
|
|
|
@@ -553,6 +590,11 @@ export class ComponentResolver {
|
|
|
553
590
|
return flattened;
|
|
554
591
|
}
|
|
555
592
|
|
|
593
|
+
/** @deprecated Use {@link FlattenComponentSpecs}. */
|
|
594
|
+
flattenComponentSpecs(spec: ComponentSpec): ComponentSpec[] {
|
|
595
|
+
return this.FlattenComponentSpecs(spec);
|
|
596
|
+
}
|
|
597
|
+
|
|
556
598
|
/**
|
|
557
599
|
* Recursively collects component specifications
|
|
558
600
|
* @param spec - Current component specification
|
|
@@ -9,29 +9,29 @@ import { ComponentSpec } from '@memberjunction/interactive-component-types';
|
|
|
9
9
|
* Metadata about a component from a registry
|
|
10
10
|
*/
|
|
11
11
|
export interface RegistryComponentMetadata {
|
|
12
|
-
name: string;
|
|
13
|
-
namespace: string;
|
|
14
|
-
version: string;
|
|
15
|
-
description: string;
|
|
16
|
-
title?: string;
|
|
17
|
-
type?: string;
|
|
18
|
-
status?: string;
|
|
19
|
-
properties?: ComponentSpec['properties'];
|
|
20
|
-
events?: ComponentSpec['events'];
|
|
21
|
-
libraries?: ComponentSpec['libraries'];
|
|
22
|
-
dependencies?: ComponentSpec['dependencies'];
|
|
23
|
-
sourceRegistryID?: string | null;
|
|
24
|
-
isLocal: boolean;
|
|
25
|
-
lastFetched?: Date;
|
|
26
|
-
cacheDuration?: number;
|
|
12
|
+
name: string; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub
|
|
13
|
+
namespace: string; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub
|
|
14
|
+
version: string; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub
|
|
15
|
+
description: string; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub
|
|
16
|
+
title?: string; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub
|
|
17
|
+
type?: string; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub
|
|
18
|
+
status?: string; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub
|
|
19
|
+
properties?: ComponentSpec['properties']; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub
|
|
20
|
+
events?: ComponentSpec['events']; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub
|
|
21
|
+
libraries?: ComponentSpec['libraries']; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub
|
|
22
|
+
dependencies?: ComponentSpec['dependencies']; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub
|
|
23
|
+
sourceRegistryID?: string | null; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub
|
|
24
|
+
isLocal: boolean; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub
|
|
25
|
+
lastFetched?: Date; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub
|
|
26
|
+
cacheDuration?: number; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
* Response from fetching a component from a registry
|
|
31
31
|
*/
|
|
32
32
|
export interface RegistryComponentResponse {
|
|
33
|
-
metadata: RegistryComponentMetadata;
|
|
34
|
-
spec: ComponentSpec;
|
|
33
|
+
metadata: RegistryComponentMetadata; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub
|
|
34
|
+
spec: ComponentSpec; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
/**
|
|
@@ -41,7 +41,7 @@ export interface RegistryProvider {
|
|
|
41
41
|
/**
|
|
42
42
|
* Name of the registry provider
|
|
43
43
|
*/
|
|
44
|
-
name: string;
|
|
44
|
+
name: string; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
47
|
* Fetch a component from the registry
|
|
@@ -50,7 +50,7 @@ export interface RegistryProvider {
|
|
|
50
50
|
* @param version - Component version (optional, defaults to latest)
|
|
51
51
|
* @returns Component metadata and specification
|
|
52
52
|
*/
|
|
53
|
-
fetchComponent(
|
|
53
|
+
fetchComponent( // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub
|
|
54
54
|
name: string,
|
|
55
55
|
namespace: string,
|
|
56
56
|
version?: string
|
|
@@ -63,7 +63,7 @@ export interface RegistryProvider {
|
|
|
63
63
|
* @param version - Component version (optional)
|
|
64
64
|
* @returns True if component exists
|
|
65
65
|
*/
|
|
66
|
-
componentExists?(
|
|
66
|
+
componentExists?( // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub
|
|
67
67
|
name: string,
|
|
68
68
|
namespace: string,
|
|
69
69
|
version?: string
|
|
@@ -75,7 +75,7 @@ export interface RegistryProvider {
|
|
|
75
75
|
* @param namespace - Component namespace
|
|
76
76
|
* @returns Array of available versions
|
|
77
77
|
*/
|
|
78
|
-
getComponentVersions?(
|
|
78
|
+
getComponentVersions?( // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub
|
|
79
79
|
name: string,
|
|
80
80
|
namespace: string
|
|
81
81
|
): Promise<string[]>;
|
|
@@ -85,35 +85,35 @@ export interface RegistryProvider {
|
|
|
85
85
|
* Search filters for registry queries
|
|
86
86
|
*/
|
|
87
87
|
export interface RegistrySearchFilters {
|
|
88
|
-
type?: string;
|
|
89
|
-
status?: string;
|
|
90
|
-
namespace?: string;
|
|
91
|
-
query?: string;
|
|
92
|
-
limit?: number;
|
|
93
|
-
offset?: number;
|
|
88
|
+
type?: string; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub
|
|
89
|
+
status?: string; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub
|
|
90
|
+
namespace?: string; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub
|
|
91
|
+
query?: string; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub
|
|
92
|
+
limit?: number; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub
|
|
93
|
+
offset?: number; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
/**
|
|
97
97
|
* Dependency information for a component
|
|
98
98
|
*/
|
|
99
99
|
export interface ComponentDependencyInfo {
|
|
100
|
-
name: string;
|
|
101
|
-
namespace: string;
|
|
102
|
-
version?: string;
|
|
103
|
-
isRequired: boolean;
|
|
104
|
-
location: 'embedded' | 'registry';
|
|
105
|
-
sourceRegistryID?: string | null;
|
|
100
|
+
name: string; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub
|
|
101
|
+
namespace: string; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub
|
|
102
|
+
version?: string; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub
|
|
103
|
+
isRequired: boolean; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub
|
|
104
|
+
location: 'embedded' | 'registry'; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub
|
|
105
|
+
sourceRegistryID?: string | null; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
/**
|
|
109
109
|
* Tree structure for dependency resolution
|
|
110
110
|
*/
|
|
111
111
|
export interface DependencyTree {
|
|
112
|
-
componentId: string;
|
|
113
|
-
name?: string;
|
|
114
|
-
namespace?: string;
|
|
115
|
-
version?: string;
|
|
116
|
-
dependencies?: DependencyTree[];
|
|
117
|
-
circular?: boolean;
|
|
118
|
-
totalCount?: number;
|
|
112
|
+
componentId: string; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub
|
|
113
|
+
name?: string; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub
|
|
114
|
+
namespace?: string; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub
|
|
115
|
+
version?: string; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub
|
|
116
|
+
dependencies?: DependencyTree[]; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub
|
|
117
|
+
circular?: boolean; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub
|
|
118
|
+
totalCount?: number; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub
|
|
119
119
|
}
|