@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.
Files changed (149) hide show
  1. package/.turbo/turbo-build.log +14 -14
  2. package/CHANGELOG.md +93 -0
  3. package/dist/compiler/babel-config.d.ts +14 -0
  4. package/dist/compiler/babel-config.d.ts.map +1 -1
  5. package/dist/compiler/babel-config.js +12 -3
  6. package/dist/compiler/babel-config.js.map +1 -1
  7. package/dist/compiler/component-compiler.d.ts +5 -0
  8. package/dist/compiler/component-compiler.d.ts.map +1 -1
  9. package/dist/compiler/component-compiler.js +24 -9
  10. package/dist/compiler/component-compiler.js.map +1 -1
  11. package/dist/compiler/index.d.ts +1 -1
  12. package/dist/compiler/index.d.ts.map +1 -1
  13. package/dist/compiler/index.js +1 -1
  14. package/dist/compiler/index.js.map +1 -1
  15. package/dist/component-manager/component-manager.d.ts +8 -0
  16. package/dist/component-manager/component-manager.d.ts.map +1 -1
  17. package/dist/component-manager/component-manager.js +18 -6
  18. package/dist/component-manager/component-manager.js.map +1 -1
  19. package/dist/index.d.ts +21 -9
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +13 -10
  22. package/dist/index.js.map +1 -1
  23. package/dist/registry/component-registry-service.d.ts +18 -0
  24. package/dist/registry/component-registry-service.d.ts.map +1 -1
  25. package/dist/registry/component-registry-service.js +65 -23
  26. package/dist/registry/component-registry-service.js.map +1 -1
  27. package/dist/registry/component-registry.d.ts +24 -1
  28. package/dist/registry/component-registry.d.ts.map +1 -1
  29. package/dist/registry/component-registry.js +74 -23
  30. package/dist/registry/component-registry.js.map +1 -1
  31. package/dist/registry/component-resolver.d.ts +10 -0
  32. package/dist/registry/component-resolver.d.ts.map +1 -1
  33. package/dist/registry/component-resolver.js +30 -9
  34. package/dist/registry/component-resolver.js.map +1 -1
  35. package/dist/registry/registry-provider.js.map +1 -1
  36. package/dist/runtime/component-hierarchy.d.ts +15 -0
  37. package/dist/runtime/component-hierarchy.d.ts.map +1 -1
  38. package/dist/runtime/component-hierarchy.js +28 -10
  39. package/dist/runtime/component-hierarchy.js.map +1 -1
  40. package/dist/runtime/error-boundary.d.ts +4 -0
  41. package/dist/runtime/error-boundary.d.ts.map +1 -1
  42. package/dist/runtime/error-boundary.js +50 -20
  43. package/dist/runtime/error-boundary.js.map +1 -1
  44. package/dist/runtime/index.d.ts +3 -3
  45. package/dist/runtime/index.d.ts.map +1 -1
  46. package/dist/runtime/index.js +3 -3
  47. package/dist/runtime/index.js.map +1 -1
  48. package/dist/runtime/prop-builder.d.ts +8 -0
  49. package/dist/runtime/prop-builder.d.ts.map +1 -1
  50. package/dist/runtime/prop-builder.js +39 -11
  51. package/dist/runtime/prop-builder.js.map +1 -1
  52. package/dist/runtime/react-root-manager.d.ts +10 -0
  53. package/dist/runtime/react-root-manager.d.ts.map +1 -1
  54. package/dist/runtime/react-root-manager.js +27 -9
  55. package/dist/runtime/react-root-manager.js.map +1 -1
  56. package/dist/runtime.umd.js +194 -125
  57. package/dist/utilities/cache-manager.d.ts +13 -0
  58. package/dist/utilities/cache-manager.d.ts.map +1 -1
  59. package/dist/utilities/cache-manager.js +40 -16
  60. package/dist/utilities/cache-manager.js.map +1 -1
  61. package/dist/utilities/component-error-analyzer.d.ts +3 -0
  62. package/dist/utilities/component-error-analyzer.d.ts.map +1 -1
  63. package/dist/utilities/component-error-analyzer.js +12 -3
  64. package/dist/utilities/component-error-analyzer.js.map +1 -1
  65. package/dist/utilities/component-hash.d.ts +1 -0
  66. package/dist/utilities/component-hash.d.ts.map +1 -1
  67. package/dist/utilities/component-hash.js +4 -1
  68. package/dist/utilities/component-hash.js.map +1 -1
  69. package/dist/utilities/component-library-theming.d.ts +4 -0
  70. package/dist/utilities/component-library-theming.d.ts.map +1 -1
  71. package/dist/utilities/component-library-theming.js +12 -6
  72. package/dist/utilities/component-library-theming.js.map +1 -1
  73. package/dist/utilities/component-styles.d.ts +1 -0
  74. package/dist/utilities/component-styles.d.ts.map +1 -1
  75. package/dist/utilities/component-styles.js +2 -1
  76. package/dist/utilities/component-styles.js.map +1 -1
  77. package/dist/utilities/component-unwrapper.d.ts +8 -2
  78. package/dist/utilities/component-unwrapper.d.ts.map +1 -1
  79. package/dist/utilities/component-unwrapper.js +19 -7
  80. package/dist/utilities/component-unwrapper.js.map +1 -1
  81. package/dist/utilities/core-libraries.d.ts +2 -0
  82. package/dist/utilities/core-libraries.d.ts.map +1 -1
  83. package/dist/utilities/core-libraries.js +9 -3
  84. package/dist/utilities/core-libraries.js.map +1 -1
  85. package/dist/utilities/entity-record-key.d.ts +1 -0
  86. package/dist/utilities/entity-record-key.d.ts.map +1 -1
  87. package/dist/utilities/entity-record-key.js +4 -1
  88. package/dist/utilities/entity-record-key.js.map +1 -1
  89. package/dist/utilities/library-dependency-resolver.d.ts +8 -0
  90. package/dist/utilities/library-dependency-resolver.d.ts.map +1 -1
  91. package/dist/utilities/library-dependency-resolver.js +39 -15
  92. package/dist/utilities/library-dependency-resolver.js.map +1 -1
  93. package/dist/utilities/library-loader.d.ts +12 -0
  94. package/dist/utilities/library-loader.d.ts.map +1 -1
  95. package/dist/utilities/library-loader.js +46 -16
  96. package/dist/utilities/library-loader.js.map +1 -1
  97. package/dist/utilities/library-registry.d.ts +5 -0
  98. package/dist/utilities/library-registry.d.ts.map +1 -1
  99. package/dist/utilities/library-registry.js +20 -5
  100. package/dist/utilities/library-registry.js.map +1 -1
  101. package/dist/utilities/resource-manager.d.ts +19 -0
  102. package/dist/utilities/resource-manager.d.ts.map +1 -1
  103. package/dist/utilities/resource-manager.js +63 -18
  104. package/dist/utilities/resource-manager.js.map +1 -1
  105. package/dist/utilities/runtime-utilities.d.ts +9 -7
  106. package/dist/utilities/runtime-utilities.d.ts.map +1 -1
  107. package/dist/utilities/runtime-utilities.js +22 -16
  108. package/dist/utilities/runtime-utilities.js.map +1 -1
  109. package/dist/utilities/standard-libraries.d.ts +10 -0
  110. package/dist/utilities/standard-libraries.d.ts.map +1 -1
  111. package/dist/utilities/standard-libraries.js +40 -10
  112. package/dist/utilities/standard-libraries.js.map +1 -1
  113. package/dist/utilities/user-state.d.ts +5 -0
  114. package/dist/utilities/user-state.d.ts.map +1 -1
  115. package/dist/utilities/user-state.js +20 -5
  116. package/dist/utilities/user-state.js.map +1 -1
  117. package/package.json +7 -7
  118. package/src/__tests__/error-boundary.test.ts +80 -0
  119. package/src/__tests__/runtime-utilities-factory.test.ts +4 -4
  120. package/src/__tests__/user-state.test.ts +44 -44
  121. package/src/compiler/babel-config.ts +18 -3
  122. package/src/compiler/component-compiler.ts +34 -9
  123. package/src/compiler/index.ts +3 -3
  124. package/src/component-manager/component-manager.ts +36 -6
  125. package/src/index.ts +35 -21
  126. package/src/registry/component-registry-service.ts +126 -23
  127. package/src/registry/component-registry.ts +122 -24
  128. package/src/registry/component-resolver.ts +51 -9
  129. package/src/registry/registry-provider.ts +40 -40
  130. package/src/runtime/component-hierarchy.ts +61 -10
  131. package/src/runtime/error-boundary.ts +77 -22
  132. package/src/runtime/index.ts +16 -16
  133. package/src/runtime/prop-builder.ts +69 -11
  134. package/src/runtime/react-root-manager.ts +48 -10
  135. package/src/utilities/cache-manager.ts +61 -16
  136. package/src/utilities/component-error-analyzer.ts +18 -3
  137. package/src/utilities/component-hash.ts +6 -1
  138. package/src/utilities/component-library-theming.ts +24 -6
  139. package/src/utilities/component-styles.ts +4 -1
  140. package/src/utilities/component-unwrapper.ts +34 -7
  141. package/src/utilities/core-libraries.ts +13 -3
  142. package/src/utilities/entity-record-key.ts +11 -1
  143. package/src/utilities/library-dependency-resolver.ts +66 -15
  144. package/src/utilities/library-loader.ts +81 -17
  145. package/src/utilities/library-registry.ts +30 -5
  146. package/src/utilities/resource-manager.ts +126 -19
  147. package/src/utilities/runtime-utilities.ts +26 -16
  148. package/src/utilities/standard-libraries.ts +60 -10
  149. package/src/utilities/user-state.ts +40 -5
@@ -39,7 +39,7 @@ export class ResourceManager {
39
39
  this.globalResources = new Set();
40
40
  this.cleanupCallbacks = new Map();
41
41
  }
42
- setTimeout(componentId, callback, delay, metadata) {
42
+ SetTimeout(componentId, callback, delay, metadata) {
43
43
  const id = timers.setTimeout(() => {
44
44
  this.removeResource(componentId, 'timer', id);
45
45
  callback();
@@ -52,7 +52,10 @@ export class ResourceManager {
52
52
  });
53
53
  return id;
54
54
  }
55
- setInterval(componentId, callback, delay, metadata) {
55
+ setTimeout(componentId, callback, delay, metadata) {
56
+ return this.SetTimeout(componentId, callback, delay, metadata);
57
+ }
58
+ SetInterval(componentId, callback, delay, metadata) {
56
59
  const id = timers.setInterval(callback, delay);
57
60
  this.addResource(componentId, {
58
61
  type: 'interval',
@@ -62,9 +65,12 @@ export class ResourceManager {
62
65
  });
63
66
  return id;
64
67
  }
65
- requestAnimationFrame(componentId, callback, metadata) {
68
+ setInterval(componentId, callback, delay, metadata) {
69
+ return this.SetInterval(componentId, callback, delay, metadata);
70
+ }
71
+ RequestAnimationFrame(componentId, callback, metadata) {
66
72
  if (!timers.requestAnimationFrame) {
67
- return this.setTimeout(componentId, () => callback(Date.now()), 16, metadata);
73
+ return this.SetTimeout(componentId, () => callback(Date.now()), 16, metadata);
68
74
  }
69
75
  const id = timers.requestAnimationFrame((time) => {
70
76
  this.removeResource(componentId, 'animationFrame', id);
@@ -78,15 +84,24 @@ export class ResourceManager {
78
84
  });
79
85
  return id;
80
86
  }
81
- clearTimeout(componentId, id) {
87
+ requestAnimationFrame(componentId, callback, metadata) {
88
+ return this.RequestAnimationFrame(componentId, callback, metadata);
89
+ }
90
+ ClearTimeout(componentId, id) {
82
91
  timers.clearTimeout(id);
83
92
  this.removeResource(componentId, 'timer', id);
84
93
  }
85
- clearInterval(componentId, id) {
94
+ clearTimeout(componentId, id) {
95
+ return this.ClearTimeout(componentId, id);
96
+ }
97
+ ClearInterval(componentId, id) {
86
98
  timers.clearInterval(id);
87
99
  this.removeResource(componentId, 'interval', id);
88
100
  }
89
- cancelAnimationFrame(componentId, id) {
101
+ clearInterval(componentId, id) {
102
+ return this.ClearInterval(componentId, id);
103
+ }
104
+ CancelAnimationFrame(componentId, id) {
90
105
  if (timers.cancelAnimationFrame) {
91
106
  timers.cancelAnimationFrame(id);
92
107
  }
@@ -95,7 +110,10 @@ export class ResourceManager {
95
110
  }
96
111
  this.removeResource(componentId, 'animationFrame', id);
97
112
  }
98
- addEventListener(componentId, target, type, listener, options) {
113
+ cancelAnimationFrame(componentId, id) {
114
+ return this.CancelAnimationFrame(componentId, id);
115
+ }
116
+ AddEventListener(componentId, target, type, listener, options) {
99
117
  if (target && typeof target.addEventListener === 'function') {
100
118
  target.addEventListener(type, listener, options);
101
119
  const resourceId = `${type}-${Date.now()}-${Math.random()}`;
@@ -111,7 +129,10 @@ export class ResourceManager {
111
129
  });
112
130
  }
113
131
  }
114
- registerDOMElement(componentId, element, cleanup) {
132
+ addEventListener(componentId, target, type, listener, options) {
133
+ return this.AddEventListener(componentId, target, type, listener, options);
134
+ }
135
+ RegisterDOMElement(componentId, element, cleanup) {
115
136
  if (typeof document !== 'undefined' && element && element.parentNode) {
116
137
  const resourceId = `dom-${Date.now()}-${Math.random()}`;
117
138
  this.addResource(componentId, {
@@ -129,7 +150,10 @@ export class ResourceManager {
129
150
  });
130
151
  }
131
152
  }
132
- registerReactRoot(componentId, root, unmountFn) {
153
+ registerDOMElement(componentId, element, cleanup) {
154
+ return this.RegisterDOMElement(componentId, element, cleanup);
155
+ }
156
+ RegisterReactRoot(componentId, root, unmountFn) {
133
157
  this.addResource(componentId, {
134
158
  type: 'reactRoot',
135
159
  id: `react-root-${componentId}`,
@@ -137,15 +161,24 @@ export class ResourceManager {
137
161
  metadata: { root }
138
162
  });
139
163
  }
140
- registerCleanup(componentId, cleanup) {
164
+ registerReactRoot(componentId, root, unmountFn) {
165
+ return this.RegisterReactRoot(componentId, root, unmountFn);
166
+ }
167
+ RegisterCleanup(componentId, cleanup) {
141
168
  if (!this.cleanupCallbacks.has(componentId)) {
142
169
  this.cleanupCallbacks.set(componentId, []);
143
170
  }
144
171
  this.cleanupCallbacks.get(componentId).push(cleanup);
145
172
  }
146
- registerGlobalResource(resource) {
173
+ registerCleanup(componentId, cleanup) {
174
+ return this.RegisterCleanup(componentId, cleanup);
175
+ }
176
+ RegisterGlobalResource(resource) {
147
177
  this.globalResources.add(resource);
148
178
  }
179
+ registerGlobalResource(resource) {
180
+ return this.RegisterGlobalResource(resource);
181
+ }
149
182
  addResource(componentId, resource) {
150
183
  if (!this.resources.has(componentId)) {
151
184
  this.resources.set(componentId, new Set());
@@ -161,7 +194,7 @@ export class ResourceManager {
161
194
  }
162
195
  }
163
196
  }
164
- cleanupComponent(componentId) {
197
+ CleanupComponent(componentId) {
165
198
  const componentResources = this.resources.get(componentId);
166
199
  if (componentResources) {
167
200
  componentResources.forEach(resource => {
@@ -187,7 +220,10 @@ export class ResourceManager {
187
220
  this.cleanupCallbacks.delete(componentId);
188
221
  }
189
222
  }
190
- cleanupGlobal() {
223
+ cleanupComponent(componentId) {
224
+ return this.CleanupComponent(componentId);
225
+ }
226
+ CleanupGlobal() {
191
227
  this.globalResources.forEach(resource => {
192
228
  try {
193
229
  resource.cleanup();
@@ -198,13 +234,19 @@ export class ResourceManager {
198
234
  });
199
235
  this.globalResources.clear();
200
236
  }
201
- cleanupAll() {
237
+ cleanupGlobal() {
238
+ return this.CleanupGlobal();
239
+ }
240
+ CleanupAll() {
202
241
  for (const componentId of this.resources.keys()) {
203
- this.cleanupComponent(componentId);
242
+ this.CleanupComponent(componentId);
204
243
  }
205
- this.cleanupGlobal();
244
+ this.CleanupGlobal();
206
245
  }
207
- getStats() {
246
+ cleanupAll() {
247
+ return this.CleanupAll();
248
+ }
249
+ GetStats() {
208
250
  const resourceCounts = {};
209
251
  for (const resources of this.resources.values()) {
210
252
  resources.forEach(resource => {
@@ -217,6 +259,9 @@ export class ResourceManager {
217
259
  globalResourceCount: this.globalResources.size
218
260
  };
219
261
  }
262
+ getStats() {
263
+ return this.GetStats();
264
+ }
220
265
  }
221
266
  export const resourceManager = new ResourceManager();
222
267
  //# sourceMappingURL=resource-manager.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"resource-manager.js","sourceRoot":"","sources":["../../src/utilities/resource-manager.ts"],"names":[],"mappings":"AAmBA,MAAM,iBAAiB,GAAG,GAAG,EAAE;IAE7B,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;QACvD,OAAO;YACL,UAAU,EAAE,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC;YAC1C,YAAY,EAAE,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC;YAC9C,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC;YAC5C,aAAa,EAAE,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC;YAChD,qBAAqB,EAAE,MAAM,CAAC,qBAAqB,EAAE,IAAI,CAAC,MAAM,CAAC;YACjE,oBAAoB,EAAE,MAAM,CAAC,oBAAoB,EAAE,IAAI,CAAC,MAAM,CAAC;SAChE,CAAC;IACJ,CAAC;SAEI,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;QAC5D,OAAO;YACL,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,YAAY,EAAE,MAAM,CAAC,YAAY;YACjC,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B,aAAa,EAAE,MAAM,CAAC,aAAa;YACnC,qBAAqB,EAAE,SAAS;YAChC,oBAAoB,EAAE,SAAS;SAChC,CAAC;IACJ,CAAC;SAEI,CAAC;QACJ,MAAM,IAAI,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC;QACtB,MAAM,cAAc,GAAG,GAAG,EAAE,CAAC,CAAC,CAAC;QAC/B,OAAO;YACL,UAAU,EAAE,cAAc;YAC1B,YAAY,EAAE,IAAI;YAClB,WAAW,EAAE,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;CACF;AAGD,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,eAAe,EAAE,CAAC","sourcesContent":["/**\n * @fileoverview Centralized resource management for React Runtime\n * Handles timers, DOM elements, event listeners, and other resources that need cleanup\n * @module @memberjunction/react-runtime/utilities\n */\n\n// Type alias for timer IDs that works in both browser and Node.js\nexport type TimerId = number | NodeJS.Timeout;\n\nexport interface ManagedResource {\n type: 'timer' | 'interval' | 'animationFrame' | 'eventListener' | 'domElement' | 'observable' | 'reactRoot';\n id: string | TimerId;\n cleanup: () => void;\n metadata?: Record<string, any>;\n}\n\n/**\n * Environment-agnostic timer functions that work in both browser and Node.js\n */\nconst getTimerFunctions = () => {\n // Check if we're in a browser environment\n if (typeof window !== 'undefined' && window.setTimeout) {\n return {\n setTimeout: window.setTimeout.bind(window),\n clearTimeout: window.clearTimeout.bind(window),\n setInterval: window.setInterval.bind(window),\n clearInterval: window.clearInterval.bind(window),\n requestAnimationFrame: window.requestAnimationFrame?.bind(window),\n cancelAnimationFrame: window.cancelAnimationFrame?.bind(window)\n };\n }\n // Node.js environment\n else if (typeof global !== 'undefined' && global.setTimeout) {\n return {\n setTimeout: global.setTimeout,\n clearTimeout: global.clearTimeout,\n setInterval: global.setInterval,\n clearInterval: global.clearInterval,\n requestAnimationFrame: undefined, // Not available in Node.js\n cancelAnimationFrame: undefined\n };\n }\n // Fallback - return no-op functions\n else {\n const noop = () => {};\n const noopWithReturn = () => 0;\n return {\n setTimeout: noopWithReturn,\n clearTimeout: noop,\n setInterval: noopWithReturn,\n clearInterval: noop,\n requestAnimationFrame: undefined,\n cancelAnimationFrame: undefined\n };\n }\n};\n\nconst timers = getTimerFunctions();\n\n/**\n * ResourceManager provides centralized management of resources that need cleanup.\n * This prevents memory leaks by ensuring all resources are properly disposed.\n */\nexport class ResourceManager {\n private resources = new Map<string, Set<ManagedResource>>();\n private globalResources = new Set<ManagedResource>();\n private cleanupCallbacks = new Map<string, (() => void)[]>();\n\n /**\n * Register a timeout with automatic cleanup\n */\n setTimeout(\n componentId: string,\n callback: () => void,\n delay: number,\n metadata?: Record<string, any>\n ): number {\n const id = timers.setTimeout(() => {\n this.removeResource(componentId, 'timer', id);\n callback();\n }, delay);\n\n this.addResource(componentId, {\n type: 'timer',\n id,\n cleanup: () => timers.clearTimeout(id),\n metadata\n });\n\n return id as any;\n }\n\n /**\n * Register an interval with automatic cleanup\n */\n setInterval(\n componentId: string,\n callback: () => void,\n delay: number,\n metadata?: Record<string, any>\n ): number {\n const id = timers.setInterval(callback, delay);\n\n this.addResource(componentId, {\n type: 'interval',\n id,\n cleanup: () => timers.clearInterval(id),\n metadata\n });\n\n return id as any;\n }\n\n /**\n * Register an animation frame with automatic cleanup\n */\n requestAnimationFrame(\n componentId: string,\n callback: FrameRequestCallback,\n metadata?: Record<string, any>\n ): TimerId {\n if (!timers.requestAnimationFrame) {\n // Fallback to setTimeout in non-browser environments\n return this.setTimeout(componentId, () => callback(Date.now()), 16, metadata);\n }\n\n const id = timers.requestAnimationFrame((time) => {\n this.removeResource(componentId, 'animationFrame', id);\n callback(time);\n });\n\n this.addResource(componentId, {\n type: 'animationFrame',\n id,\n cleanup: () => timers.cancelAnimationFrame?.(id),\n metadata\n });\n\n return id as any;\n }\n\n /**\n * Clear a specific timeout\n */\n clearTimeout(componentId: string, id: number): void {\n timers.clearTimeout(id);\n this.removeResource(componentId, 'timer', id);\n }\n\n /**\n * Clear a specific interval\n */\n clearInterval(componentId: string, id: number): void {\n timers.clearInterval(id);\n this.removeResource(componentId, 'interval', id);\n }\n\n /**\n * Cancel a specific animation frame\n */\n cancelAnimationFrame(componentId: string, id: TimerId): void {\n if (timers.cancelAnimationFrame) {\n timers.cancelAnimationFrame(id as number);\n } else {\n // If we fell back to setTimeout, use clearTimeout\n timers.clearTimeout(id as any);\n }\n this.removeResource(componentId, 'animationFrame', id);\n }\n\n /**\n * Register an event listener with automatic cleanup\n */\n addEventListener(\n componentId: string,\n target: EventTarget,\n type: string,\n listener: EventListener,\n options?: AddEventListenerOptions\n ): void {\n // Only add event listeners if we have a valid EventTarget (browser environment)\n if (target && typeof target.addEventListener === 'function') {\n target.addEventListener(type, listener, options);\n \n const resourceId = `${type}-${Date.now()}-${Math.random()}`;\n this.addResource(componentId, {\n type: 'eventListener',\n id: resourceId,\n cleanup: () => {\n if (target && typeof target.removeEventListener === 'function') {\n target.removeEventListener(type, listener, options);\n }\n },\n metadata: { target, type, options }\n });\n }\n }\n\n /**\n * Register a DOM element that needs cleanup\n */\n registerDOMElement(\n componentId: string,\n element: any, // Use 'any' to avoid HTMLElement type in Node.js\n cleanup?: () => void\n ): void {\n // Only register if we're in a browser environment with DOM support\n if (typeof document !== 'undefined' && element && element.parentNode) {\n const resourceId = `dom-${Date.now()}-${Math.random()}`;\n this.addResource(componentId, {\n type: 'domElement',\n id: resourceId,\n cleanup: () => {\n if (cleanup) {\n cleanup();\n }\n if (element && element.parentNode && typeof element.parentNode.removeChild === 'function') {\n element.parentNode.removeChild(element);\n }\n },\n metadata: { element }\n });\n }\n }\n\n /**\n * Register a React root for cleanup\n */\n registerReactRoot(\n componentId: string,\n root: any,\n unmountFn: () => void\n ): void {\n this.addResource(componentId, {\n type: 'reactRoot',\n id: `react-root-${componentId}`,\n cleanup: unmountFn,\n metadata: { root }\n });\n }\n\n /**\n * Register a generic cleanup callback for a component\n */\n registerCleanup(componentId: string, cleanup: () => void): void {\n if (!this.cleanupCallbacks.has(componentId)) {\n this.cleanupCallbacks.set(componentId, []);\n }\n this.cleanupCallbacks.get(componentId)!.push(cleanup);\n }\n\n /**\n * Register a global resource (not tied to a specific component)\n */\n registerGlobalResource(resource: ManagedResource): void {\n this.globalResources.add(resource);\n }\n\n /**\n * Add a resource to be managed\n */\n private addResource(componentId: string, resource: ManagedResource): void {\n if (!this.resources.has(componentId)) {\n this.resources.set(componentId, new Set());\n }\n this.resources.get(componentId)!.add(resource);\n }\n\n /**\n * Remove a specific resource\n */\n private removeResource(\n componentId: string,\n type: ManagedResource['type'],\n id: string | number | NodeJS.Timeout\n ): void {\n const componentResources = this.resources.get(componentId);\n if (componentResources) {\n const toRemove = Array.from(componentResources).find(\n r => r.type === type && r.id === id\n );\n if (toRemove) {\n componentResources.delete(toRemove);\n }\n }\n }\n\n /**\n * Clean up all resources for a specific component\n */\n cleanupComponent(componentId: string): void {\n // Clean up tracked resources\n const componentResources = this.resources.get(componentId);\n if (componentResources) {\n componentResources.forEach(resource => {\n try {\n resource.cleanup();\n } catch (error) {\n console.error(`Error cleaning up ${resource.type} resource:`, error);\n }\n });\n this.resources.delete(componentId);\n }\n\n // Execute cleanup callbacks\n const callbacks = this.cleanupCallbacks.get(componentId);\n if (callbacks) {\n callbacks.forEach(callback => {\n try {\n callback();\n } catch (error) {\n console.error('Error executing cleanup callback:', error);\n }\n });\n this.cleanupCallbacks.delete(componentId);\n }\n }\n\n /**\n * Clean up all global resources\n */\n cleanupGlobal(): void {\n this.globalResources.forEach(resource => {\n try {\n resource.cleanup();\n } catch (error) {\n console.error(`Error cleaning up global ${resource.type} resource:`, error);\n }\n });\n this.globalResources.clear();\n }\n\n /**\n * Clean up all resources (components and global)\n */\n cleanupAll(): void {\n // Clean up all component resources\n for (const componentId of this.resources.keys()) {\n this.cleanupComponent(componentId);\n }\n\n // Clean up global resources\n this.cleanupGlobal();\n }\n\n /**\n * Get resource statistics for debugging\n */\n getStats(): {\n componentCount: number;\n resourceCounts: Record<string, number>;\n globalResourceCount: number;\n } {\n const resourceCounts: Record<string, number> = {};\n \n for (const resources of this.resources.values()) {\n resources.forEach(resource => {\n resourceCounts[resource.type] = (resourceCounts[resource.type] || 0) + 1;\n });\n }\n\n return {\n componentCount: this.resources.size,\n resourceCounts,\n globalResourceCount: this.globalResources.size\n };\n }\n}\n\n// Singleton instance\nexport const resourceManager = new ResourceManager();"]}
1
+ {"version":3,"file":"resource-manager.js","sourceRoot":"","sources":["../../src/utilities/resource-manager.ts"],"names":[],"mappings":"AAmBA,MAAM,iBAAiB,GAAG,GAAG,EAAE;IAE7B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CAAC,QAAQ,CAAC,EAAE;gBAC3B,cAAc,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;YAC3E,CAAC,CAAC,CAAC;QACL,CAAC;QAED,OAAO;YACL,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI;YACnC,cAAc;YACd,mBAAmB,EAAE,IAAI,CAAC,eAAe,CAAC,IAAI;SAC/C,CAAC;IACJ,CAAC;IAGD,QAAQ;QAKN,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;IACzB,CAAC;CACF;AAGD,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,eAAe,EAAE,CAAC","sourcesContent":["/**\n * @fileoverview Centralized resource management for React Runtime\n * Handles timers, DOM elements, event listeners, and other resources that need cleanup\n * @module @memberjunction/react-runtime/utilities\n */\n\n// Type alias for timer IDs that works in both browser and Node.js\nexport type TimerId = number | NodeJS.Timeout;\n\nexport interface ManagedResource {\n type: 'timer' | 'interval' | 'animationFrame' | 'eventListener' | 'domElement' | 'observable' | 'reactRoot';\n id: string | TimerId;\n cleanup: () => void;\n metadata?: Record<string, any>;\n}\n\n/**\n * Environment-agnostic timer functions that work in both browser and Node.js\n */\nconst getTimerFunctions = () => {\n // Check if we're in a browser environment\n if (typeof window !== 'undefined' && window.setTimeout) {\n return {\n setTimeout: window.setTimeout.bind(window),\n clearTimeout: window.clearTimeout.bind(window),\n setInterval: window.setInterval.bind(window),\n clearInterval: window.clearInterval.bind(window),\n requestAnimationFrame: window.requestAnimationFrame?.bind(window),\n cancelAnimationFrame: window.cancelAnimationFrame?.bind(window)\n };\n }\n // Node.js environment\n else if (typeof global !== 'undefined' && global.setTimeout) {\n return {\n setTimeout: global.setTimeout,\n clearTimeout: global.clearTimeout,\n setInterval: global.setInterval,\n clearInterval: global.clearInterval,\n requestAnimationFrame: undefined, // Not available in Node.js\n cancelAnimationFrame: undefined\n };\n }\n // Fallback - return no-op functions\n else {\n const noop = () => {};\n const noopWithReturn = () => 0;\n return {\n setTimeout: noopWithReturn,\n clearTimeout: noop,\n setInterval: noopWithReturn,\n clearInterval: noop,\n requestAnimationFrame: undefined,\n cancelAnimationFrame: undefined\n };\n }\n};\n\nconst timers = getTimerFunctions();\n\n/**\n * ResourceManager provides centralized management of resources that need cleanup.\n * This prevents memory leaks by ensuring all resources are properly disposed.\n */\nexport class ResourceManager {\n private resources = new Map<string, Set<ManagedResource>>();\n private globalResources = new Set<ManagedResource>();\n private cleanupCallbacks = new Map<string, (() => void)[]>();\n\n /**\n * Register a timeout with automatic cleanup\n */\n SetTimeout(\n componentId: string,\n callback: () => void,\n delay: number,\n metadata?: Record<string, any>\n ): number {\n const id = timers.setTimeout(() => {\n this.removeResource(componentId, 'timer', id);\n callback();\n }, delay);\n\n this.addResource(componentId, {\n type: 'timer',\n id,\n cleanup: () => timers.clearTimeout(id),\n metadata\n });\n\n return id as any;\n }\n\n /** @deprecated Use {@link SetTimeout}. */\n setTimeout(\n componentId: string,\n callback: () => void,\n delay: number,\n metadata?: Record<string, any>\n ): number {\n return this.SetTimeout(componentId, callback, delay, metadata);\n }\n\n /**\n * Register an interval with automatic cleanup\n */\n SetInterval(\n componentId: string,\n callback: () => void,\n delay: number,\n metadata?: Record<string, any>\n ): number {\n const id = timers.setInterval(callback, delay);\n\n this.addResource(componentId, {\n type: 'interval',\n id,\n cleanup: () => timers.clearInterval(id),\n metadata\n });\n\n return id as any;\n }\n\n /** @deprecated Use {@link SetInterval}. */\n setInterval(\n componentId: string,\n callback: () => void,\n delay: number,\n metadata?: Record<string, any>\n ): number {\n return this.SetInterval(componentId, callback, delay, metadata);\n }\n\n /**\n * Register an animation frame with automatic cleanup\n */\n RequestAnimationFrame(\n componentId: string,\n callback: FrameRequestCallback,\n metadata?: Record<string, any>\n ): TimerId {\n if (!timers.requestAnimationFrame) {\n // Fallback to setTimeout in non-browser environments\n return this.SetTimeout(componentId, () => callback(Date.now()), 16, metadata);\n }\n\n const id = timers.requestAnimationFrame((time) => {\n this.removeResource(componentId, 'animationFrame', id);\n callback(time);\n });\n\n this.addResource(componentId, {\n type: 'animationFrame',\n id,\n cleanup: () => timers.cancelAnimationFrame?.(id),\n metadata\n });\n\n return id as any;\n }\n\n /** @deprecated Use {@link RequestAnimationFrame}. */\n requestAnimationFrame(\n componentId: string,\n callback: FrameRequestCallback,\n metadata?: Record<string, any>\n ): TimerId {\n return this.RequestAnimationFrame(componentId, callback, metadata);\n }\n\n /**\n * Clear a specific timeout\n */\n ClearTimeout(componentId: string, id: number): void {\n timers.clearTimeout(id);\n this.removeResource(componentId, 'timer', id);\n }\n\n /** @deprecated Use {@link ClearTimeout}. */\n clearTimeout(componentId: string, id: number): void {\n return this.ClearTimeout(componentId, id);\n }\n\n /**\n * Clear a specific interval\n */\n ClearInterval(componentId: string, id: number): void {\n timers.clearInterval(id);\n this.removeResource(componentId, 'interval', id);\n }\n\n /** @deprecated Use {@link ClearInterval}. */\n clearInterval(componentId: string, id: number): void {\n return this.ClearInterval(componentId, id);\n }\n\n /**\n * Cancel a specific animation frame\n */\n CancelAnimationFrame(componentId: string, id: TimerId): void {\n if (timers.cancelAnimationFrame) {\n timers.cancelAnimationFrame(id as number);\n } else {\n // If we fell back to setTimeout, use clearTimeout\n timers.clearTimeout(id as any);\n }\n this.removeResource(componentId, 'animationFrame', id);\n }\n\n /** @deprecated Use {@link CancelAnimationFrame}. */\n cancelAnimationFrame(componentId: string, id: TimerId): void {\n return this.CancelAnimationFrame(componentId, id);\n }\n\n /**\n * Register an event listener with automatic cleanup\n */\n AddEventListener(\n componentId: string,\n target: EventTarget,\n type: string,\n listener: EventListener,\n options?: AddEventListenerOptions\n ): void {\n // Only add event listeners if we have a valid EventTarget (browser environment)\n if (target && typeof target.addEventListener === 'function') {\n target.addEventListener(type, listener, options);\n \n const resourceId = `${type}-${Date.now()}-${Math.random()}`;\n this.addResource(componentId, {\n type: 'eventListener',\n id: resourceId,\n cleanup: () => {\n if (target && typeof target.removeEventListener === 'function') {\n target.removeEventListener(type, listener, options);\n }\n },\n metadata: { target, type, options }\n });\n }\n }\n\n /** @deprecated Use {@link AddEventListener}. */\n addEventListener(\n componentId: string,\n target: EventTarget,\n type: string,\n listener: EventListener,\n options?: AddEventListenerOptions\n ): void {\n return this.AddEventListener(componentId, target, type, listener, options);\n }\n\n /**\n * Register a DOM element that needs cleanup\n */\n RegisterDOMElement(\n componentId: string,\n element: any, // Use 'any' to avoid HTMLElement type in Node.js\n cleanup?: () => void\n ): void {\n // Only register if we're in a browser environment with DOM support\n if (typeof document !== 'undefined' && element && element.parentNode) {\n const resourceId = `dom-${Date.now()}-${Math.random()}`;\n this.addResource(componentId, {\n type: 'domElement',\n id: resourceId,\n cleanup: () => {\n if (cleanup) {\n cleanup();\n }\n if (element && element.parentNode && typeof element.parentNode.removeChild === 'function') {\n element.parentNode.removeChild(element);\n }\n },\n metadata: { element }\n });\n }\n }\n\n /** @deprecated Use {@link RegisterDOMElement}. */\n registerDOMElement(\n componentId: string,\n element: any, // Use 'any' to avoid HTMLElement type in Node.js\n cleanup?: () => void\n ): void {\n return this.RegisterDOMElement(componentId, element, cleanup);\n }\n\n /**\n * Register a React root for cleanup\n */\n RegisterReactRoot(\n componentId: string,\n root: any,\n unmountFn: () => void\n ): void {\n this.addResource(componentId, {\n type: 'reactRoot',\n id: `react-root-${componentId}`,\n cleanup: unmountFn,\n metadata: { root }\n });\n }\n\n /** @deprecated Use {@link RegisterReactRoot}. */\n registerReactRoot(\n componentId: string,\n root: any,\n unmountFn: () => void\n ): void {\n return this.RegisterReactRoot(componentId, root, unmountFn);\n }\n\n /**\n * Register a generic cleanup callback for a component\n */\n RegisterCleanup(componentId: string, cleanup: () => void): void {\n if (!this.cleanupCallbacks.has(componentId)) {\n this.cleanupCallbacks.set(componentId, []);\n }\n this.cleanupCallbacks.get(componentId)!.push(cleanup);\n }\n\n /** @deprecated Use {@link RegisterCleanup}. */\n registerCleanup(componentId: string, cleanup: () => void): void {\n return this.RegisterCleanup(componentId, cleanup);\n }\n\n /**\n * Register a global resource (not tied to a specific component)\n */\n RegisterGlobalResource(resource: ManagedResource): void {\n this.globalResources.add(resource);\n }\n\n /** @deprecated Use {@link RegisterGlobalResource}. */\n registerGlobalResource(resource: ManagedResource): void {\n return this.RegisterGlobalResource(resource);\n }\n\n /**\n * Add a resource to be managed\n */\n private addResource(componentId: string, resource: ManagedResource): void {\n if (!this.resources.has(componentId)) {\n this.resources.set(componentId, new Set());\n }\n this.resources.get(componentId)!.add(resource);\n }\n\n /**\n * Remove a specific resource\n */\n private removeResource(\n componentId: string,\n type: ManagedResource['type'],\n id: string | number | NodeJS.Timeout\n ): void {\n const componentResources = this.resources.get(componentId);\n if (componentResources) {\n const toRemove = Array.from(componentResources).find(\n r => r.type === type && r.id === id\n );\n if (toRemove) {\n componentResources.delete(toRemove);\n }\n }\n }\n\n /**\n * Clean up all resources for a specific component\n */\n CleanupComponent(componentId: string): void {\n // Clean up tracked resources\n const componentResources = this.resources.get(componentId);\n if (componentResources) {\n componentResources.forEach(resource => {\n try {\n resource.cleanup();\n } catch (error) {\n console.error(`Error cleaning up ${resource.type} resource:`, error);\n }\n });\n this.resources.delete(componentId);\n }\n\n // Execute cleanup callbacks\n const callbacks = this.cleanupCallbacks.get(componentId);\n if (callbacks) {\n callbacks.forEach(callback => {\n try {\n callback();\n } catch (error) {\n console.error('Error executing cleanup callback:', error);\n }\n });\n this.cleanupCallbacks.delete(componentId);\n }\n }\n\n /** @deprecated Use {@link CleanupComponent}. */\n cleanupComponent(componentId: string): void {\n return this.CleanupComponent(componentId);\n }\n\n /**\n * Clean up all global resources\n */\n CleanupGlobal(): void {\n this.globalResources.forEach(resource => {\n try {\n resource.cleanup();\n } catch (error) {\n console.error(`Error cleaning up global ${resource.type} resource:`, error);\n }\n });\n this.globalResources.clear();\n }\n\n /** @deprecated Use {@link CleanupGlobal}. */\n cleanupGlobal(): void {\n return this.CleanupGlobal();\n }\n\n /**\n * Clean up all resources (components and global)\n */\n CleanupAll(): void {\n // Clean up all component resources\n for (const componentId of this.resources.keys()) {\n this.CleanupComponent(componentId);\n }\n\n // Clean up global resources\n this.CleanupGlobal();\n }\n\n /** @deprecated Use {@link CleanupAll}. */\n cleanupAll(): void {\n return this.CleanupAll();\n }\n\n /**\n * Get resource statistics for debugging\n */\n GetStats(): {\n componentCount: number;\n resourceCounts: Record<string, number>;\n globalResourceCount: number;\n } {\n const resourceCounts: Record<string, number> = {};\n \n for (const resources of this.resources.values()) {\n resources.forEach(resource => {\n resourceCounts[resource.type] = (resourceCounts[resource.type] || 0) + 1;\n });\n }\n\n return {\n componentCount: this.resources.size,\n resourceCounts,\n globalResourceCount: this.globalResources.size\n };\n }\n\n /** @deprecated Use {@link GetStats}. */\n getStats(): {\n componentCount: number;\n resourceCounts: Record<string, number>;\n globalResourceCount: number;\n } {\n return this.GetStats();\n }\n}\n\n// Singleton instance\nexport const resourceManager = new ResourceManager(); // case-violation-ok-legacy-back-compat: the PascalCase name is already taken in this scope"]}
@@ -3,10 +3,11 @@ import { ComponentUtilities } from '@memberjunction/interactive-component-types'
3
3
  export declare class RuntimeUtilities {
4
4
  private debug;
5
5
  private provider;
6
+ BuildUtilities(debug?: boolean, provider?: IMetadataProvider): ComponentUtilities;
6
7
  buildUtilities(debug?: boolean, provider?: IMetadataProvider): ComponentUtilities;
7
- private SetupUtilities;
8
- private CreateSimpleAITools;
9
- private CreateSimpleMLTools;
8
+ private setupUtilities;
9
+ private createSimpleAITools;
10
+ private createSimpleMLTools;
10
11
  private listMLModels;
11
12
  private buildMLModelsFilter;
12
13
  private mapMLModel;
@@ -14,10 +15,11 @@ export declare class RuntimeUtilities {
14
15
  private scoreMLRecords;
15
16
  private normalizeRecordKeys;
16
17
  private escapeSqlLiteral;
17
- private CreateSimpleMetadata;
18
- private CreateSimpleGeoDataEngine;
19
- private CreateSimpleRunQuery;
20
- private CreateSimpleRunView;
18
+ private createSimpleMetadata;
19
+ private createSimpleGeoDataEngine;
20
+ private createSimpleRunQuery;
21
+ private createSimpleRunView;
21
22
  }
23
+ export declare function CreateRuntimeUtilities(): RuntimeUtilities;
22
24
  export declare function createRuntimeUtilities(): RuntimeUtilities;
23
25
  //# sourceMappingURL=runtime-utilities.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-utilities.d.ts","sourceRoot":"","sources":["../../src/utilities/runtime-utilities.ts"],"names":[],"mappings":"AA+BA,OAAO,EASL,iBAAiB,EAGlB,MAAM,sBAAsB,CAAC;AAI9B,OAAO,EACL,kBAAkB,EAcnB,MAAM,6CAA6C,CAAC;AAcrD,qBACa,gBAAgB;IAC3B,OAAO,CAAC,KAAK,CAAkB;IAM/B,OAAO,CAAC,QAAQ,CAAqB;IAU9B,cAAc,CAAC,KAAK,GAAE,OAAe,EAAE,QAAQ,CAAC,EAAE,iBAAiB,GAAG,kBAAkB;IAS/F,OAAO,CAAC,cAAc;IActB,OAAO,CAAC,mBAAmB;IAoF3B,OAAO,CAAC,mBAAmB;YAwBb,YAAY;IA4B1B,OAAO,CAAC,mBAAmB;IAW3B,OAAO,CAAC,UAAU;IAclB,OAAO,CAAC,cAAc;YAkBR,cAAc;IAwC5B,OAAO,CAAC,mBAAmB;IAgB3B,OAAO,CAAC,gBAAgB;IAIxB,OAAO,CAAC,oBAAoB;IAS5B,OAAO,CAAC,yBAAyB;IAoBjC,OAAO,CAAC,oBAAoB;IAyB5B,OAAO,CAAC,mBAAmB;CA0C5B;AAOD,wBAAgB,sBAAsB,IAAI,gBAAgB,CAgBzD"}
1
+ {"version":3,"file":"runtime-utilities.d.ts","sourceRoot":"","sources":["../../src/utilities/runtime-utilities.ts"],"names":[],"mappings":"AA+BA,OAAO,EASL,iBAAiB,EAGlB,MAAM,sBAAsB,CAAC;AAI9B,OAAO,EACL,kBAAkB,EAcnB,MAAM,6CAA6C,CAAC;AAcrD,qBACa,gBAAgB;IAC3B,OAAO,CAAC,KAAK,CAAkB;IAM/B,OAAO,CAAC,QAAQ,CAAqB;IAU9B,cAAc,CAAC,KAAK,GAAE,OAAe,EAAE,QAAQ,CAAC,EAAE,iBAAiB,GAAG,kBAAkB;IAOxF,cAAc,CAAC,KAAK,GAAE,OAAe,EAAE,QAAQ,CAAC,EAAE,iBAAiB,GAAG,kBAAkB;IAO/F,OAAO,CAAC,cAAc;IActB,OAAO,CAAC,mBAAmB;IAoF3B,OAAO,CAAC,mBAAmB;YAwBb,YAAY;IA4B1B,OAAO,CAAC,mBAAmB;IAW3B,OAAO,CAAC,UAAU;IAclB,OAAO,CAAC,cAAc;YAkBR,cAAc;IAwC5B,OAAO,CAAC,mBAAmB;IAgB3B,OAAO,CAAC,gBAAgB;IAIxB,OAAO,CAAC,oBAAoB;IAS5B,OAAO,CAAC,yBAAyB;IAoBjC,OAAO,CAAC,oBAAoB;IAyB5B,OAAO,CAAC,mBAAmB;CA0C5B;AAOD,wBAAgB,sBAAsB,IAAI,gBAAgB,CAgBzD;AAGD,wBAAgB,sBAAsB,IAAI,gBAAgB,CAEzD"}
@@ -14,25 +14,28 @@ let RuntimeUtilities = class RuntimeUtilities {
14
14
  constructor() {
15
15
  this.debug = false;
16
16
  }
17
- buildUtilities(debug = false, provider) {
17
+ BuildUtilities(debug = false, provider) {
18
18
  this.debug = debug;
19
19
  this.provider = provider ?? Metadata.Provider;
20
- return this.SetupUtilities(this.provider);
20
+ return this.setupUtilities(this.provider);
21
+ }
22
+ buildUtilities(debug = false, provider) {
23
+ return this.BuildUtilities(debug, provider);
21
24
  }
22
- SetupUtilities(md) {
25
+ setupUtilities(md) {
23
26
  const rv = RunView.FromMetadataProvider(md);
24
27
  const rq = new RunQuery(md);
25
28
  const u = {
26
- md: this.CreateSimpleMetadata(md),
27
- rv: this.CreateSimpleRunView(rv),
28
- rq: this.CreateSimpleRunQuery(rq),
29
- ai: this.CreateSimpleAITools(),
30
- geoDataEngine: this.CreateSimpleGeoDataEngine(),
31
- ml: this.CreateSimpleMLTools()
29
+ md: this.createSimpleMetadata(md),
30
+ rv: this.createSimpleRunView(rv),
31
+ rq: this.createSimpleRunQuery(rq),
32
+ ai: this.createSimpleAITools(),
33
+ geoDataEngine: this.createSimpleGeoDataEngine(),
34
+ ml: this.createSimpleMLTools()
32
35
  };
33
36
  return u;
34
37
  }
35
- CreateSimpleAITools() {
38
+ createSimpleAITools() {
36
39
  const provider = BaseEntity.Provider;
37
40
  if (!(provider instanceof GraphQLDataProvider)) {
38
41
  throw new Error('Current data provider is not a GraphQLDataProvider. AI tools require GraphQL provider.');
@@ -97,7 +100,7 @@ let RuntimeUtilities = class RuntimeUtilities {
97
100
  VectorService: new SimpleVectorService()
98
101
  };
99
102
  }
100
- CreateSimpleMLTools() {
103
+ createSimpleMLTools() {
101
104
  const provider = BaseEntity.Provider;
102
105
  if (!(provider instanceof GraphQLDataProvider)) {
103
106
  return undefined;
@@ -210,7 +213,7 @@ let RuntimeUtilities = class RuntimeUtilities {
210
213
  escapeSqlLiteral(value) {
211
214
  return value.replace(/'/g, "''");
212
215
  }
213
- CreateSimpleMetadata(md) {
216
+ createSimpleMetadata(md) {
214
217
  return {
215
218
  Entities: md.Entities,
216
219
  GetEntityObject: (entityName) => {
@@ -218,7 +221,7 @@ let RuntimeUtilities = class RuntimeUtilities {
218
221
  }
219
222
  };
220
223
  }
221
- CreateSimpleGeoDataEngine() {
224
+ createSimpleGeoDataEngine() {
222
225
  try {
223
226
  const geo = GeoDataEngine.Instance;
224
227
  if (!geo)
@@ -237,7 +240,7 @@ let RuntimeUtilities = class RuntimeUtilities {
237
240
  return undefined;
238
241
  }
239
242
  }
240
- CreateSimpleRunQuery(rq) {
243
+ createSimpleRunQuery(rq) {
241
244
  return {
242
245
  RunQuery: async (params) => {
243
246
  try {
@@ -262,7 +265,7 @@ let RuntimeUtilities = class RuntimeUtilities {
262
265
  }
263
266
  };
264
267
  }
265
- CreateSimpleRunView(rv) {
268
+ createSimpleRunView(rv) {
266
269
  return {
267
270
  RunView: async (params) => {
268
271
  try {
@@ -310,7 +313,7 @@ RuntimeUtilities = __decorate([
310
313
  RegisterClass(RuntimeUtilities, 'RuntimeUtilities')
311
314
  ], RuntimeUtilities);
312
315
  export { RuntimeUtilities };
313
- export function createRuntimeUtilities() {
316
+ export function CreateRuntimeUtilities() {
314
317
  try {
315
318
  const obj = MJGlobal.Instance.ClassFactory.CreateInstance(RuntimeUtilities);
316
319
  if (obj) {
@@ -321,4 +324,7 @@ export function createRuntimeUtilities() {
321
324
  }
322
325
  return new RuntimeUtilities();
323
326
  }
327
+ export function createRuntimeUtilities() {
328
+ return CreateRuntimeUtilities();
329
+ }
324
330
  //# sourceMappingURL=runtime-utilities.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-utilities.js","sourceRoot":"","sources":["../../src/utilities/runtime-utilities.ts"],"names":[],"mappings":";;;;;;AA+BA,OAAO,EACL,QAAQ,EACR,OAAO,EACP,QAAQ,EAGR,QAAQ,EACR,UAAU,EAKX,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAiB9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAEL,uCAAuC,EAExC,MAAM,+BAA+B,CAAC;AAQhC,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAAtB;QACG,UAAK,GAAY,KAAK,CAAC;IAsXjC,CAAC;IAtWQ,cAAc,CAAC,QAAiB,KAAK,EAAE,QAA4B;QACxE,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,QAAQ,GAAG,QAAQ,IAAI,QAAQ,CAAC,QAAQ,CAAC;QAC9C,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC5C,C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CAAC;QAKH,MAAM,GAAG,GAAG,QAAQ,CAAC,QAAQ,CAAC,YAAY,CAAC,cAAc,CAAmB,gBAAgB,CAAC,CAAC;QAC9F,IAAI,GAAG,EAAE,CAAC;YACR,OAAO,GAAG,CAAC;QACb,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;IAGT,CAAC;IAED,OAAO,IAAI,gBAAgB,EAAE,CAAC;AAChC,CAAC","sourcesContent":["/**\n * @fileoverview The `utilities` prop every interactive component receives — `md`, `rv`, `rq`, `ai`,\n * `geoDataEngine`, `ml` — built over MemberJunction core.\n * @module @memberjunction/react-runtime/utilities\n *\n * ## Why this is not in the Angular package\n *\n * It was, for its whole life, and it imports nothing from `@angular/*`: 450 lines of pure\n * TypeScript over `@memberjunction/core`, `core-entities` and `graphql-dataprovider`. That made it\n * unreachable from any non-Angular host, and `utilities` is not an Angular concept — it is the\n * data surface the component contract promises. A React Native host either reimplemented it or\n * passed `{}` and shipped components that could not read a row.\n *\n * It lives here, beside the compiler and prop-builder that the same components go through, so every\n * host builds the same `utilities` object from the same code. A second implementation would drift\n * the moment either side added a capability — and the components asking for `utilities.rv.RunView`\n * are authored once, for both.\n *\n * ## Overriding\n *\n * `createRuntimeUtilities` resolves through `MJGlobal.ClassFactory`, so a host that registers a\n * higher-priority subclass of {@link RuntimeUtilities} gets it — on every host, browser included.\n *\n * It did not always. The factory used to consult `ClassFactory` only when\n * `typeof window === 'undefined'`, which made the `@RegisterClass` registration below inert on\n * every browser and React Native host: the base class still worked, but nobody could substitute\n * one. Removing the guard changes nothing for an app that registers no subclass — with a null key\n * `CreateInstance` matches the base's own registration and constructs the same class the fallback\n * would have — and makes the documented extension point real for the ones that do.\n */\n\nimport {\n Metadata,\n RunView,\n RunQuery,\n RunViewParams,\n RunQueryParams,\n LogError,\n BaseEntity,\n IEntityDataProvider,\n IMetadataProvider,\n IRunQueryProvider,\n UserInfo\n} from '@memberjunction/core';\n\nimport { MJGlobal, RegisterClass } from '@memberjunction/global';\nimport { GeoDataEngine } from '@memberjunction/core-entities';\nimport {\n ComponentUtilities,\n SimpleAITools,\n SimpleGeoDataEngine,\n SimpleMetadata,\n SimpleMLTools,\n SimpleMLModelInfo,\n SimpleMLListModelsFilter,\n SimpleMLScoreResult,\n SimpleRunQuery,\n SimpleRunView,\n SimpleExecutePromptParams,\n SimpleExecutePromptResult,\n SimpleEmbedTextParams,\n SimpleEmbedTextResult\n} from '@memberjunction/interactive-component-types';\nimport { GraphQLDataProvider } from '@memberjunction/graphql-dataprovider';\nimport { SimpleVectorService } from '@memberjunction/ai-vectors-memory';\nimport {\n MJMLModelEntity,\n PredictiveStudioScoreRecordSetOperation,\n PredictiveStudioScoreRecordSetInput\n} from '@memberjunction/core-entities';\n\n/**\n * Base class for providing runtime utilities to React components in Angular.\n * This class can be extended and registered with MJ's ClassFactory\n * to provide custom implementations of data access methods.\n */\n@RegisterClass(RuntimeUtilities, 'RuntimeUtilities')\nexport class RuntimeUtilities {\n private debug: boolean = false;\n /**\n * The provider every read in the built utilities goes through. Always set by\n * {@link buildUtilities} before use — falls back to the global provider there\n * (`provider ?? Metadata.Provider`) when the host doesn't supply one.\n */\n private provider!: IMetadataProvider;\n\n /**\n * Builds the complete utilities object for React components\n * This is the main method that components will use\n *\n * @param provider the host's provider. A React component mounted under a non-default provider\n * passes its own `ProviderToUse`; omitting it falls back to the global default, named\n * explicitly rather than reached for via `new Metadata()`.\n */\n public buildUtilities(debug: boolean = false, provider?: IMetadataProvider): ComponentUtilities {\n this.debug = debug;\n this.provider = provider ?? Metadata.Provider;\n return this.SetupUtilities(this.provider);\n }\n\n /**\n * Sets up the utilities object - copied from skip-chat implementation\n */\n private SetupUtilities(md: IMetadataProvider): ComponentUtilities {\n const rv = RunView.FromMetadataProvider(md);\n const rq = new RunQuery(md as unknown as IRunQueryProvider);\n const u: ComponentUtilities = {\n md: this.CreateSimpleMetadata(md),\n rv: this.CreateSimpleRunView(rv),\n rq: this.CreateSimpleRunQuery(rq),\n ai: this.CreateSimpleAITools(),\n geoDataEngine: this.CreateSimpleGeoDataEngine(),\n ml: this.CreateSimpleMLTools()\n };\n return u;\n }\n\n private CreateSimpleAITools(): SimpleAITools {\n // Get the GraphQL provider - it's the same as the BaseEntity provider\n const provider = BaseEntity.Provider;\n \n // Check if it's a GraphQLDataProvider\n if (!(provider instanceof GraphQLDataProvider)) {\n throw new Error('Current data provider is not a GraphQLDataProvider. AI tools require GraphQL provider.');\n }\n\n const graphQLProvider = provider as GraphQLDataProvider;\n \n return {\n ExecutePrompt: async (params: SimpleExecutePromptParams): Promise<SimpleExecutePromptResult> => {\n try {\n // Use the AI client from GraphQLDataProvider to execute simple prompt\n const result = await graphQLProvider.AI.ExecuteSimplePrompt({\n systemPrompt: params.systemPrompt,\n messages: params.messages,\n preferredModels: params.preferredModels,\n modelPower: params.modelPower\n });\n\n console.log(`🤖 ExecutePrompt succeeded!`);\n if (this.debug) {\n console.log(' > params', params);\n console.log(' > result:', result);\n }\n\n return {\n success: result.success,\n result: result.result || '',\n resultObject: result.resultObject,\n modelName: result.modelName || ''\n };\n } catch (error) {\n LogError(error);\n return {\n success: false,\n result: 'Failed to execute prompt: ' + (error instanceof Error ? error.message : String(error)),\n modelName: ''\n };\n }\n },\n \n EmbedText: async (params: SimpleEmbedTextParams): Promise<SimpleEmbedTextResult> => {\n try {\n // Use the AI client from GraphQLDataProvider to generate embeddings\n const result = await graphQLProvider.AI.EmbedText({\n textToEmbed: params.textToEmbed,\n modelSize: params.modelSize\n });\n \n if (result.error) {\n throw new Error(result.error || 'Failed to generate embeddings');\n }\n\n const numEmbeddings: number = Array.isArray(params.textToEmbed) ? result.embeddings?.length : 1;\n console.log(`🤖 EmbedText succeeded! ${numEmbeddings} embeddings returned`);\n if (this.debug) {\n console.log(' > params', params);\n console.log(' > result:', result);\n }\n return {\n result: result.embeddings,\n modelName: result.modelName,\n vectorDimensions: result.vectorDimensions\n };\n } catch (error) {\n LogError(error);\n throw error; // Re-throw for embeddings as they're critical\n }\n },\n \n VectorService: new SimpleVectorService()\n };\n }\n\n /**\n * Creates the ML tools surface for components — listing trained models and scoring records.\n * `listModels` reads the `MJ: ML Models` catalog via RunView; `score` marshals the\n * `PredictiveStudio.ScoreRecordSet` Remote Operation over GraphQL to the server engine (the\n * Python sidecar lives server-side and cannot run in the browser). Returns `undefined` when no\n * GraphQL provider is available, so the `ml` capability degrades cleanly.\n */\n private CreateSimpleMLTools(): SimpleMLTools | undefined {\n const provider = BaseEntity.Provider;\n // Scoring requires a GraphQL provider to route the Remote Operation to the server engine.\n if (!(provider instanceof GraphQLDataProvider)) {\n return undefined;\n }\n const graphQLProvider = provider as GraphQLDataProvider;\n\n return {\n listModels: (filter?: SimpleMLListModelsFilter, contextUser?: UserInfo): Promise<SimpleMLModelInfo[]> =>\n this.listMLModels(filter, contextUser),\n\n score: (\n modelId: string,\n records: Array<Record<string, unknown> | string>,\n options?: { primaryKeyField?: string; contextUser?: UserInfo }\n ): Promise<SimpleMLScoreResult> => this.scoreMLRecords(graphQLProvider, modelId, records, options)\n };\n }\n\n /**\n * Loads the trained-model catalog from `MJ: ML Models`, newest version first, mapping each row\n * to a {@link SimpleMLModelInfo}. Resilient — logs and returns `[]` on any failure.\n */\n private async listMLModels(filter?: SimpleMLListModelsFilter, contextUser?: UserInfo): Promise<SimpleMLModelInfo[]> {\n try {\n const rv = RunView.FromMetadataProvider(this.provider);\n const result = await rv.RunView<MJMLModelEntity>(\n {\n EntityName: 'MJ: ML Models',\n ExtraFilter: this.buildMLModelsFilter(filter),\n OrderBy: 'Version DESC',\n MaxRows: filter?.maxResults,\n ResultType: 'entity_object'\n },\n contextUser\n );\n if (!result.Success) {\n console.error(`❌ listModels failed for MJ: ML Models: ${result.ErrorMessage}`);\n return [];\n }\n return result.Results.map((m) => this.mapMLModel(m));\n } catch (error) {\n LogError(error);\n return [];\n }\n }\n\n /**\n * Builds the ExtraFilter clause for {@link listMLModels}. Defaults to `Status='Published'` so\n * components only see promoted models unless the caller overrides the status.\n */\n private buildMLModelsFilter(filter?: SimpleMLListModelsFilter): string {\n const clauses: string[] = [];\n const status = filter?.status ?? 'Published';\n clauses.push(`Status='${this.escapeSqlLiteral(status)}'`);\n if (filter?.targetVariable) {\n clauses.push(`TargetVariable='${this.escapeSqlLiteral(filter.targetVariable)}'`);\n }\n return clauses.join(' AND ');\n }\n\n /** Maps a single `MJ: ML Models` row to the component-facing {@link SimpleMLModelInfo} shape. */\n private mapMLModel(m: MJMLModelEntity): SimpleMLModelInfo {\n return {\n id: m.ID,\n pipeline: m.Pipeline,\n version: m.Version,\n targetVariable: m.TargetVariable,\n problemType: m.ProblemType,\n status: m.Status,\n metrics: this.parseMLMetrics(m.Metrics),\n holdoutMetrics: this.parseMLMetrics(m.HoldoutMetrics)\n };\n }\n\n /** Defensively parses a JSON metrics blob; returns `undefined` for null/empty/invalid JSON. */\n private parseMLMetrics(raw: string | null): Record<string, unknown> | undefined {\n if (!raw) {\n return undefined;\n }\n try {\n const parsed = JSON.parse(raw);\n return parsed && typeof parsed === 'object' ? (parsed as Record<string, unknown>) : undefined;\n } catch {\n return undefined;\n }\n }\n\n /**\n * Scores records with a trained model by invoking the `PredictiveStudio.ScoreRecordSet` Remote\n * Operation. Normalizes `records` to primary-key strings, requests ephemeral predictions (no\n * write-back), and maps the result. Resilient — logs and returns a zeroed result with the input\n * records counted as failed on any error.\n */\n private async scoreMLRecords(\n provider: GraphQLDataProvider,\n modelId: string,\n records: Array<Record<string, unknown> | string>,\n options?: { primaryKeyField?: string; contextUser?: UserInfo }\n ): Promise<SimpleMLScoreResult> {\n const keys = this.normalizeRecordKeys(records, options?.primaryKeyField ?? 'ID');\n try {\n const input: PredictiveStudioScoreRecordSetInput = {\n modelId,\n scope: { records: keys }\n // No writeBack → predictions are returned ephemerally.\n };\n const op = new PredictiveStudioScoreRecordSetOperation();\n const result = await op.Execute(input, { provider, user: options?.contextUser });\n if (!result.Success || !result.Output) {\n console.error(`❌ score failed for model ${modelId}: ${result.ErrorMessage}`);\n return { scoredCount: 0, failedCount: keys.length, skippedCount: 0, predictions: [] };\n }\n const out = result.Output;\n return {\n scoredCount: out.scored,\n failedCount: out.failed,\n skippedCount: out.skipped,\n predictions: (out.predictions ?? []).map((p) => ({\n recordId: p.recordId,\n score: p.score,\n class: p.class\n }))\n };\n } catch (error) {\n LogError(error);\n return { scoredCount: 0, failedCount: keys.length, skippedCount: 0, predictions: [] };\n }\n }\n\n /**\n * Normalizes a mixed array of primary-key strings and row objects into an array of primary-key\n * strings, reading `primaryKeyField` from objects. Drops entries without a resolvable key.\n */\n private normalizeRecordKeys(records: Array<Record<string, unknown> | string>, primaryKeyField: string): string[] {\n const keys: string[] = [];\n for (const r of records) {\n if (typeof r === 'string') {\n keys.push(r);\n } else if (r != null) {\n const value = r[primaryKeyField];\n if (value != null) {\n keys.push(String(value));\n }\n }\n }\n return keys;\n }\n\n /** Escapes single quotes for safe inlining into a RunView ExtraFilter SQL string literal. */\n private escapeSqlLiteral(value: string): string {\n return value.replace(/'/g, \"''\");\n }\n\n private CreateSimpleMetadata(md: IMetadataProvider): SimpleMetadata {\n return {\n Entities: md.Entities,\n GetEntityObject: (entityName: string) => {\n return md.GetEntityObject(entityName)\n }\n }\n }\n\n private CreateSimpleGeoDataEngine(): SimpleGeoDataEngine | undefined {\n try {\n const geo = GeoDataEngine.Instance;\n if (!geo) return undefined;\n return {\n ResolvePointToLocation: (lat: number, lng: number) => {\n return geo.ResolvePointToLocation(lat, lng);\n },\n // GeoDataEngine is on-demand load — callers must await before ResolvePointToLocation works.\n EnsureLoaded: () => geo.EnsureLoaded(),\n get Loaded() {\n return geo.Loaded;\n }\n };\n } catch {\n // GeoDataEngine may not be configured yet — return undefined\n return undefined;\n }\n }\n\n private CreateSimpleRunQuery(rq: RunQuery): SimpleRunQuery {\n return {\n RunQuery: async (params: RunQueryParams) => {\n // Run a single query and return the results\n try {\n const result = await rq.RunQuery(params);\n if (result.Success) {\n console.log(`✅ RunQuery \"${params.QueryName}\" succeeded: ${result.RowCount} rows returned`);\n if (this.debug) {\n console.log(' > params', params);\n console.log(' > result:', result);\n }\n } else {\n console.error(`❌ RunQuery failed: ${result.ErrorMessage}`);\n }\n return result;\n } catch (error) {\n console.error(`❌ RunQuery threw exception:`, error);\n LogError(error);\n throw error; // Re-throw to handle it in the caller\n }\n }\n }\n }\n\n private CreateSimpleRunView(rv: RunView): SimpleRunView {\n return {\n RunView: async (params: RunViewParams) => {\n // Run a single view and return the results\n try {\n const result = await rv.RunView(params);\n if (result.Success) {\n console.log(`✅ RunView succeeded for ${params.EntityName}: ${result.TotalRowCount} rows returned`);\n if (this.debug) {\n console.log(' > params', params);\n console.log(' > result:', result);\n }\n } else {\n console.error(`❌ RunView failed for ${params.EntityName}: ${result.ErrorMessage}`);\n }\n return result;\n } catch (error) {\n console.error(`❌ RunView threw exception:`, error);\n LogError(error);\n throw error; // Re-throw to handle it in the caller\n }\n },\n RunViews: async (params: RunViewParams[]) => {\n // Runs multiple views and returns the results\n try {\n const results = await rv.RunViews(params);\n const entityNames = params.map(p => p.EntityName).join(', ');\n const totalRows = results.reduce((sum, r) => sum + (r.TotalRowCount || 0), 0);\n console.log(`✅ RunViews succeeded for [${entityNames}]: ${totalRows} total rows returned`);\n if (this.debug) {\n console.log(' > params', params);\n console.log(' > results:', results);\n }\n return results;\n } catch (error) {\n console.error(`❌ RunViews threw exception:`, error);\n LogError(error);\n throw error; // Re-throw to handle it in the caller\n }\n }\n }\n }\n}\n\n/**\n * Factory function to create RuntimeUtilities\n * In a Node.js environment, this will use MJ's ClassFactory for runtime substitution\n * In a browser environment, it will use the base class directly\n */\nexport function createRuntimeUtilities(): RuntimeUtilities {\n try {\n // Resolve through ClassFactory so a host that registers a higher-priority subclass gets it.\n // `CreateInstance` with a null key matches any registration for this root class, and the\n // decorator below registers the base itself, so an app with no override still gets a plain\n // `RuntimeUtilities` — the resolution is the same object either way.\n const obj = MJGlobal.Instance.ClassFactory.CreateInstance<RuntimeUtilities>(RuntimeUtilities);\n if (obj) {\n return obj;\n }\n } catch {\n // ClassFactory throws when a base is declared as unable to stand alone. That is not this\n // class — it is perfectly usable on its own — so fall through rather than fail the component.\n }\n\n return new RuntimeUtilities();\n}"]}
1
+ {"version":3,"file":"runtime-utilities.js","sourceRoot":"","sources":["../../src/utilities/runtime-utilities.ts"],"names":[],"mappings":";;;;;;AA+BA,OAAO,EACL,QAAQ,EACR,OAAO,EACP,QAAQ,EAGR,QAAQ,EACR,UAAU,EAKX,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAiB9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAEL,uCAAuC,EAExC,MAAM,+BAA+B,CAAC;AAQhC,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAAtB;QACG,UAAK,GAAY,KAAK,CAAC;IA2XjC,CAAC;IA3WQ,cAAc,CAAC,QAAiB,KAAK,EAAE,QAA4B;QACxE,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,QAAQ,GAAG,QAAQ,IAAI,QAAQ,CAAC,QAAQ,CAAC;QAC9C,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC5C,CAAC;IAGM,cAAc,CAAC,QAAiB,KAAK,EAAE,QAA4B;QACxE,OAAO,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC9C,CAAC;IAKO,cAAc,CAAC,EAAqB;QAC1C,MAAM,EAAE,GAAG,OAAO,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAC;QAC5C,MAAM,EAAE,GAAG,IAAI,QAAQ,CAAC,EAAkC,CAAC,CAAC;QAC5D,MAAM,CAAC,GAAu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M,CAAC;IAGT,CAAC;IAED,OAAO,IAAI,gBAAgB,EAAE,CAAC;AAChC,CAAC;AAGD,MAAM,UAAU,sBAAsB;IACpC,OAAO,sBAAsB,EAAE,CAAC;AAClC,CAAC","sourcesContent":["/**\n * @fileoverview The `utilities` prop every interactive component receives — `md`, `rv`, `rq`, `ai`,\n * `geoDataEngine`, `ml` — built over MemberJunction core.\n * @module @memberjunction/react-runtime/utilities\n *\n * ## Why this is not in the Angular package\n *\n * It was, for its whole life, and it imports nothing from `@angular/*`: 450 lines of pure\n * TypeScript over `@memberjunction/core`, `core-entities` and `graphql-dataprovider`. That made it\n * unreachable from any non-Angular host, and `utilities` is not an Angular concept — it is the\n * data surface the component contract promises. A React Native host either reimplemented it or\n * passed `{}` and shipped components that could not read a row.\n *\n * It lives here, beside the compiler and prop-builder that the same components go through, so every\n * host builds the same `utilities` object from the same code. A second implementation would drift\n * the moment either side added a capability — and the components asking for `utilities.rv.RunView`\n * are authored once, for both.\n *\n * ## Overriding\n *\n * `createRuntimeUtilities` resolves through `MJGlobal.ClassFactory`, so a host that registers a\n * higher-priority subclass of {@link RuntimeUtilities} gets it — on every host, browser included.\n *\n * It did not always. The factory used to consult `ClassFactory` only when\n * `typeof window === 'undefined'`, which made the `@RegisterClass` registration below inert on\n * every browser and React Native host: the base class still worked, but nobody could substitute\n * one. Removing the guard changes nothing for an app that registers no subclass — with a null key\n * `CreateInstance` matches the base's own registration and constructs the same class the fallback\n * would have — and makes the documented extension point real for the ones that do.\n */\n\nimport {\n Metadata,\n RunView,\n RunQuery,\n RunViewParams,\n RunQueryParams,\n LogError,\n BaseEntity,\n IEntityDataProvider,\n IMetadataProvider,\n IRunQueryProvider,\n UserInfo\n} from '@memberjunction/core';\n\nimport { MJGlobal, RegisterClass } from '@memberjunction/global';\nimport { GeoDataEngine } from '@memberjunction/core-entities';\nimport {\n ComponentUtilities,\n SimpleAITools,\n SimpleGeoDataEngine,\n SimpleMetadata,\n SimpleMLTools,\n SimpleMLModelInfo,\n SimpleMLListModelsFilter,\n SimpleMLScoreResult,\n SimpleRunQuery,\n SimpleRunView,\n SimpleExecutePromptParams,\n SimpleExecutePromptResult,\n SimpleEmbedTextParams,\n SimpleEmbedTextResult\n} from '@memberjunction/interactive-component-types';\nimport { GraphQLDataProvider } from '@memberjunction/graphql-dataprovider';\nimport { SimpleVectorService } from '@memberjunction/ai-vectors-memory';\nimport {\n MJMLModelEntity,\n PredictiveStudioScoreRecordSetOperation,\n PredictiveStudioScoreRecordSetInput\n} from '@memberjunction/core-entities';\n\n/**\n * Base class for providing runtime utilities to React components in Angular.\n * This class can be extended and registered with MJ's ClassFactory\n * to provide custom implementations of data access methods.\n */\n@RegisterClass(RuntimeUtilities, 'RuntimeUtilities')\nexport class RuntimeUtilities {\n private debug: boolean = false;\n /**\n * The provider every read in the built utilities goes through. Always set by\n * {@link buildUtilities} before use — falls back to the global provider there\n * (`provider ?? Metadata.Provider`) when the host doesn't supply one.\n */\n private provider!: IMetadataProvider;\n\n /**\n * Builds the complete utilities object for React components\n * This is the main method that components will use\n *\n * @param provider the host's provider. A React component mounted under a non-default provider\n * passes its own `ProviderToUse`; omitting it falls back to the global default, named\n * explicitly rather than reached for via `new Metadata()`.\n */\n public BuildUtilities(debug: boolean = false, provider?: IMetadataProvider): ComponentUtilities {\n this.debug = debug;\n this.provider = provider ?? Metadata.Provider;\n return this.setupUtilities(this.provider);\n }\n\n /** @deprecated Use {@link BuildUtilities}. */\n public buildUtilities(debug: boolean = false, provider?: IMetadataProvider): ComponentUtilities {\n return this.BuildUtilities(debug, provider);\n }\n\n /**\n * Sets up the utilities object - copied from skip-chat implementation\n */\n private setupUtilities(md: IMetadataProvider): ComponentUtilities {\n const rv = RunView.FromMetadataProvider(md);\n const rq = new RunQuery(md as unknown as IRunQueryProvider);\n const u: ComponentUtilities = {\n md: this.createSimpleMetadata(md),\n rv: this.createSimpleRunView(rv),\n rq: this.createSimpleRunQuery(rq),\n ai: this.createSimpleAITools(),\n geoDataEngine: this.createSimpleGeoDataEngine(),\n ml: this.createSimpleMLTools()\n };\n return u;\n }\n\n private createSimpleAITools(): SimpleAITools {\n // Get the GraphQL provider - it's the same as the BaseEntity provider\n const provider = BaseEntity.Provider;\n \n // Check if it's a GraphQLDataProvider\n if (!(provider instanceof GraphQLDataProvider)) {\n throw new Error('Current data provider is not a GraphQLDataProvider. AI tools require GraphQL provider.');\n }\n\n const graphQLProvider = provider as GraphQLDataProvider;\n \n return {\n ExecutePrompt: async (params: SimpleExecutePromptParams): Promise<SimpleExecutePromptResult> => {\n try {\n // Use the AI client from GraphQLDataProvider to execute simple prompt\n const result = await graphQLProvider.AI.ExecuteSimplePrompt({\n systemPrompt: params.systemPrompt,\n messages: params.messages,\n preferredModels: params.preferredModels,\n modelPower: params.modelPower\n });\n\n console.log(`🤖 ExecutePrompt succeeded!`);\n if (this.debug) {\n console.log(' > params', params);\n console.log(' > result:', result);\n }\n\n return {\n success: result.success,\n result: result.result || '',\n resultObject: result.resultObject,\n modelName: result.modelName || ''\n };\n } catch (error) {\n LogError(error);\n return {\n success: false,\n result: 'Failed to execute prompt: ' + (error instanceof Error ? error.message : String(error)),\n modelName: ''\n };\n }\n },\n \n EmbedText: async (params: SimpleEmbedTextParams): Promise<SimpleEmbedTextResult> => {\n try {\n // Use the AI client from GraphQLDataProvider to generate embeddings\n const result = await graphQLProvider.AI.EmbedText({\n textToEmbed: params.textToEmbed,\n modelSize: params.modelSize\n });\n \n if (result.error) {\n throw new Error(result.error || 'Failed to generate embeddings');\n }\n\n const numEmbeddings: number = Array.isArray(params.textToEmbed) ? result.embeddings?.length : 1;\n console.log(`🤖 EmbedText succeeded! ${numEmbeddings} embeddings returned`);\n if (this.debug) {\n console.log(' > params', params);\n console.log(' > result:', result);\n }\n return {\n result: result.embeddings,\n modelName: result.modelName,\n vectorDimensions: result.vectorDimensions\n };\n } catch (error) {\n LogError(error);\n throw error; // Re-throw for embeddings as they're critical\n }\n },\n \n VectorService: new SimpleVectorService()\n };\n }\n\n /**\n * Creates the ML tools surface for components — listing trained models and scoring records.\n * `listModels` reads the `MJ: ML Models` catalog via RunView; `score` marshals the\n * `PredictiveStudio.ScoreRecordSet` Remote Operation over GraphQL to the server engine (the\n * Python sidecar lives server-side and cannot run in the browser). Returns `undefined` when no\n * GraphQL provider is available, so the `ml` capability degrades cleanly.\n */\n private createSimpleMLTools(): SimpleMLTools | undefined {\n const provider = BaseEntity.Provider;\n // Scoring requires a GraphQL provider to route the Remote Operation to the server engine.\n if (!(provider instanceof GraphQLDataProvider)) {\n return undefined;\n }\n const graphQLProvider = provider as GraphQLDataProvider;\n\n return {\n listModels: (filter?: SimpleMLListModelsFilter, contextUser?: UserInfo): Promise<SimpleMLModelInfo[]> =>\n this.listMLModels(filter, contextUser),\n\n score: (\n modelId: string,\n records: Array<Record<string, unknown> | string>,\n options?: { primaryKeyField?: string; contextUser?: UserInfo }\n ): Promise<SimpleMLScoreResult> => this.scoreMLRecords(graphQLProvider, modelId, records, options)\n };\n }\n\n /**\n * Loads the trained-model catalog from `MJ: ML Models`, newest version first, mapping each row\n * to a {@link SimpleMLModelInfo}. Resilient — logs and returns `[]` on any failure.\n */\n private async listMLModels(filter?: SimpleMLListModelsFilter, contextUser?: UserInfo): Promise<SimpleMLModelInfo[]> {\n try {\n const rv = RunView.FromMetadataProvider(this.provider);\n const result = await rv.RunView<MJMLModelEntity>(\n {\n EntityName: 'MJ: ML Models',\n ExtraFilter: this.buildMLModelsFilter(filter),\n OrderBy: 'Version DESC',\n MaxRows: filter?.maxResults,\n ResultType: 'entity_object'\n },\n contextUser\n );\n if (!result.Success) {\n console.error(`❌ listModels failed for MJ: ML Models: ${result.ErrorMessage}`);\n return [];\n }\n return result.Results.map((m) => this.mapMLModel(m));\n } catch (error) {\n LogError(error);\n return [];\n }\n }\n\n /**\n * Builds the ExtraFilter clause for {@link listMLModels}. Defaults to `Status='Published'` so\n * components only see promoted models unless the caller overrides the status.\n */\n private buildMLModelsFilter(filter?: SimpleMLListModelsFilter): string {\n const clauses: string[] = [];\n const status = filter?.status ?? 'Published';\n clauses.push(`Status='${this.escapeSqlLiteral(status)}'`);\n if (filter?.targetVariable) {\n clauses.push(`TargetVariable='${this.escapeSqlLiteral(filter.targetVariable)}'`);\n }\n return clauses.join(' AND ');\n }\n\n /** Maps a single `MJ: ML Models` row to the component-facing {@link SimpleMLModelInfo} shape. */\n private mapMLModel(m: MJMLModelEntity): SimpleMLModelInfo {\n return {\n id: m.ID,\n pipeline: m.Pipeline,\n version: m.Version,\n targetVariable: m.TargetVariable,\n problemType: m.ProblemType,\n status: m.Status,\n metrics: this.parseMLMetrics(m.Metrics),\n holdoutMetrics: this.parseMLMetrics(m.HoldoutMetrics)\n };\n }\n\n /** Defensively parses a JSON metrics blob; returns `undefined` for null/empty/invalid JSON. */\n private parseMLMetrics(raw: string | null): Record<string, unknown> | undefined {\n if (!raw) {\n return undefined;\n }\n try {\n const parsed = JSON.parse(raw);\n return parsed && typeof parsed === 'object' ? (parsed as Record<string, unknown>) : undefined;\n } catch {\n return undefined;\n }\n }\n\n /**\n * Scores records with a trained model by invoking the `PredictiveStudio.ScoreRecordSet` Remote\n * Operation. Normalizes `records` to primary-key strings, requests ephemeral predictions (no\n * write-back), and maps the result. Resilient — logs and returns a zeroed result with the input\n * records counted as failed on any error.\n */\n private async scoreMLRecords(\n provider: GraphQLDataProvider,\n modelId: string,\n records: Array<Record<string, unknown> | string>,\n options?: { primaryKeyField?: string; contextUser?: UserInfo }\n ): Promise<SimpleMLScoreResult> {\n const keys = this.normalizeRecordKeys(records, options?.primaryKeyField ?? 'ID');\n try {\n const input: PredictiveStudioScoreRecordSetInput = {\n modelId,\n scope: { records: keys }\n // No writeBack → predictions are returned ephemerally.\n };\n const op = new PredictiveStudioScoreRecordSetOperation();\n const result = await op.Execute(input, { provider, user: options?.contextUser });\n if (!result.Success || !result.Output) {\n console.error(`❌ score failed for model ${modelId}: ${result.ErrorMessage}`);\n return { scoredCount: 0, failedCount: keys.length, skippedCount: 0, predictions: [] };\n }\n const out = result.Output;\n return {\n scoredCount: out.scored,\n failedCount: out.failed,\n skippedCount: out.skipped,\n predictions: (out.predictions ?? []).map((p) => ({\n recordId: p.recordId,\n score: p.score,\n class: p.class\n }))\n };\n } catch (error) {\n LogError(error);\n return { scoredCount: 0, failedCount: keys.length, skippedCount: 0, predictions: [] };\n }\n }\n\n /**\n * Normalizes a mixed array of primary-key strings and row objects into an array of primary-key\n * strings, reading `primaryKeyField` from objects. Drops entries without a resolvable key.\n */\n private normalizeRecordKeys(records: Array<Record<string, unknown> | string>, primaryKeyField: string): string[] {\n const keys: string[] = [];\n for (const r of records) {\n if (typeof r === 'string') {\n keys.push(r);\n } else if (r != null) {\n const value = r[primaryKeyField];\n if (value != null) {\n keys.push(String(value));\n }\n }\n }\n return keys;\n }\n\n /** Escapes single quotes for safe inlining into a RunView ExtraFilter SQL string literal. */\n private escapeSqlLiteral(value: string): string {\n return value.replace(/'/g, \"''\");\n }\n\n private createSimpleMetadata(md: IMetadataProvider): SimpleMetadata {\n return {\n Entities: md.Entities,\n GetEntityObject: (entityName: string) => {\n return md.GetEntityObject(entityName)\n }\n }\n }\n\n private createSimpleGeoDataEngine(): SimpleGeoDataEngine | undefined {\n try {\n const geo = GeoDataEngine.Instance;\n if (!geo) return undefined;\n return {\n ResolvePointToLocation: (lat: number, lng: number) => {\n return geo.ResolvePointToLocation(lat, lng);\n },\n // GeoDataEngine is on-demand load — callers must await before ResolvePointToLocation works.\n EnsureLoaded: () => geo.EnsureLoaded(),\n get Loaded() {\n return geo.Loaded;\n }\n };\n } catch {\n // GeoDataEngine may not be configured yet — return undefined\n return undefined;\n }\n }\n\n private createSimpleRunQuery(rq: RunQuery): SimpleRunQuery {\n return {\n RunQuery: async (params: RunQueryParams) => {\n // Run a single query and return the results\n try {\n const result = await rq.RunQuery(params);\n if (result.Success) {\n console.log(`✅ RunQuery \"${params.QueryName}\" succeeded: ${result.RowCount} rows returned`);\n if (this.debug) {\n console.log(' > params', params);\n console.log(' > result:', result);\n }\n } else {\n console.error(`❌ RunQuery failed: ${result.ErrorMessage}`);\n }\n return result;\n } catch (error) {\n console.error(`❌ RunQuery threw exception:`, error);\n LogError(error);\n throw error; // Re-throw to handle it in the caller\n }\n }\n }\n }\n\n private createSimpleRunView(rv: RunView): SimpleRunView {\n return {\n RunView: async (params: RunViewParams) => {\n // Run a single view and return the results\n try {\n const result = await rv.RunView(params);\n if (result.Success) {\n console.log(`✅ RunView succeeded for ${params.EntityName}: ${result.TotalRowCount} rows returned`);\n if (this.debug) {\n console.log(' > params', params);\n console.log(' > result:', result);\n }\n } else {\n console.error(`❌ RunView failed for ${params.EntityName}: ${result.ErrorMessage}`);\n }\n return result;\n } catch (error) {\n console.error(`❌ RunView threw exception:`, error);\n LogError(error);\n throw error; // Re-throw to handle it in the caller\n }\n },\n RunViews: async (params: RunViewParams[]) => {\n // Runs multiple views and returns the results\n try {\n const results = await rv.RunViews(params);\n const entityNames = params.map(p => p.EntityName).join(', ');\n const totalRows = results.reduce((sum, r) => sum + (r.TotalRowCount || 0), 0);\n console.log(`✅ RunViews succeeded for [${entityNames}]: ${totalRows} total rows returned`);\n if (this.debug) {\n console.log(' > params', params);\n console.log(' > results:', results);\n }\n return results;\n } catch (error) {\n console.error(`❌ RunViews threw exception:`, error);\n LogError(error);\n throw error; // Re-throw to handle it in the caller\n }\n }\n }\n }\n}\n\n/**\n * Factory function to create RuntimeUtilities\n * In a Node.js environment, this will use MJ's ClassFactory for runtime substitution\n * In a browser environment, it will use the base class directly\n */\nexport function CreateRuntimeUtilities(): RuntimeUtilities {\n try {\n // Resolve through ClassFactory so a host that registers a higher-priority subclass gets it.\n // `CreateInstance` with a null key matches any registration for this root class, and the\n // decorator below registers the base itself, so an app with no override still gets a plain\n // `RuntimeUtilities` — the resolution is the same object either way.\n const obj = MJGlobal.Instance.ClassFactory.CreateInstance<RuntimeUtilities>(RuntimeUtilities);\n if (obj) {\n return obj;\n }\n } catch {\n // ClassFactory throws when a base is declared as unable to stand alone. That is not this\n // class — it is perfectly usable on its own — so fall through rather than fail the component.\n }\n\n return new RuntimeUtilities();\n}\n\n/** @deprecated Use {@link CreateRuntimeUtilities}. */\nexport function createRuntimeUtilities(): RuntimeUtilities {\n return CreateRuntimeUtilities();\n}"]}
@@ -2,15 +2,25 @@ import { LibraryConfiguration, ExternalLibraryConfig } from '../types/library-co
2
2
  export type StandardLibraries = Record<string, any>;
3
3
  export declare class StandardLibraryManager {
4
4
  private static configuration;
5
+ static SetConfiguration(config: LibraryConfiguration): void;
5
6
  static setConfiguration(config: LibraryConfiguration): void;
7
+ static GetConfiguration(): LibraryConfiguration;
6
8
  static getConfiguration(): LibraryConfiguration;
9
+ static GetEnabledLibraries(): ExternalLibraryConfig[];
7
10
  static getEnabledLibraries(): ExternalLibraryConfig[];
11
+ static GetLibrariesByCategory(category: ExternalLibraryConfig['category']): ExternalLibraryConfig[];
8
12
  static getLibrariesByCategory(category: ExternalLibraryConfig['category']): ExternalLibraryConfig[];
13
+ static GetCoreLibraries(): ExternalLibraryConfig[];
9
14
  static getCoreLibraries(): ExternalLibraryConfig[];
15
+ static GetComponentLibraries(): ExternalLibraryConfig[];
10
16
  static getComponentLibraries(): ExternalLibraryConfig[];
17
+ static GetLibraryById(id: string): ExternalLibraryConfig | undefined;
11
18
  static getLibraryById(id: string): ExternalLibraryConfig | undefined;
19
+ static GetLibraryUrls(): Record<string, string>;
12
20
  static getLibraryUrls(): Record<string, string>;
21
+ static ResetToDefault(): void;
13
22
  static resetToDefault(): void;
14
23
  }
24
+ export declare function CreateStandardLibraries(): StandardLibraries;
15
25
  export declare function createStandardLibraries(): StandardLibraries;
16
26
  //# sourceMappingURL=standard-libraries.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"standard-libraries.d.ts","sourceRoot":"","sources":["../../src/utilities/standard-libraries.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAMt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