@memberjunction/react-runtime 2.93.0 → 2.95.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/.turbo/turbo-build.log +6 -6
  2. package/CHANGELOG.md +28 -0
  3. package/README.md +180 -2
  4. package/dist/compiler/component-compiler.d.ts +1 -0
  5. package/dist/compiler/component-compiler.d.ts.map +1 -1
  6. package/dist/compiler/component-compiler.js +253 -61
  7. package/dist/compiler/component-compiler.js.map +1 -1
  8. package/dist/index.d.ts +3 -2
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +15 -5
  11. package/dist/index.js.map +1 -1
  12. package/dist/registry/component-registry-service.d.ts +6 -3
  13. package/dist/registry/component-registry-service.d.ts.map +1 -1
  14. package/dist/registry/component-registry-service.js +38 -11
  15. package/dist/registry/component-registry-service.js.map +1 -1
  16. package/dist/registry/component-registry.d.ts +6 -3
  17. package/dist/registry/component-registry.d.ts.map +1 -1
  18. package/dist/registry/component-registry.js +17 -0
  19. package/dist/registry/component-registry.js.map +1 -1
  20. package/dist/registry/component-resolver.d.ts +2 -1
  21. package/dist/registry/component-resolver.d.ts.map +1 -1
  22. package/dist/registry/component-resolver.js +101 -14
  23. package/dist/registry/component-resolver.js.map +1 -1
  24. package/dist/runtime/component-hierarchy.d.ts.map +1 -1
  25. package/dist/runtime/component-hierarchy.js +75 -13
  26. package/dist/runtime/component-hierarchy.js.map +1 -1
  27. package/dist/runtime/prop-builder.d.ts +2 -2
  28. package/dist/runtime/prop-builder.d.ts.map +1 -1
  29. package/dist/runtime/prop-builder.js +32 -14
  30. package/dist/runtime/prop-builder.js.map +1 -1
  31. package/dist/runtime.umd.js +1 -1
  32. package/dist/types/dependency-types.d.ts +62 -0
  33. package/dist/types/dependency-types.d.ts.map +1 -0
  34. package/dist/types/dependency-types.js +3 -0
  35. package/dist/types/dependency-types.js.map +1 -0
  36. package/dist/types/index.d.ts +8 -10
  37. package/dist/types/index.d.ts.map +1 -1
  38. package/dist/types/index.js +1 -0
  39. package/dist/types/index.js.map +1 -1
  40. package/dist/utilities/index.d.ts +1 -0
  41. package/dist/utilities/index.d.ts.map +1 -1
  42. package/dist/utilities/index.js +1 -0
  43. package/dist/utilities/index.js.map +1 -1
  44. package/dist/utilities/library-dependency-resolver.d.ts +19 -0
  45. package/dist/utilities/library-dependency-resolver.d.ts.map +1 -0
  46. package/dist/utilities/library-dependency-resolver.js +419 -0
  47. package/dist/utilities/library-dependency-resolver.js.map +1 -0
  48. package/dist/utilities/library-loader.d.ts +9 -0
  49. package/dist/utilities/library-loader.d.ts.map +1 -1
  50. package/dist/utilities/library-loader.js +164 -0
  51. package/dist/utilities/library-loader.js.map +1 -1
  52. package/package.json +5 -5
  53. package/src/compiler/component-compiler.ts +280 -82
  54. package/src/index.ts +20 -5
  55. package/src/registry/component-registry-service.ts +53 -14
  56. package/src/registry/component-registry.ts +36 -7
  57. package/src/registry/component-resolver.ts +130 -16
  58. package/src/runtime/component-hierarchy.ts +101 -27
  59. package/src/runtime/prop-builder.ts +38 -18
  60. package/src/types/dependency-types.ts +110 -0
  61. package/src/types/index.ts +17 -21
  62. package/src/utilities/index.ts +1 -0
  63. package/src/utilities/library-dependency-resolver.ts +613 -0
  64. package/src/utilities/library-loader.ts +274 -0
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAG/C,cAAc,SAAS,CAAC;AAGxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EACL,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACd,oBAAoB,EACpB,YAAY,EACb,MAAM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AM,WAAW,CAAC;AAEnB,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,WAAW,CAAC;AAInB,OAAO,EACL,WAAW,EACX,4BAA4B,EAC7B,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EACL,iBAAiB,EACjB,sBAAsB,EACtB,uBAAuB,EACxB,MAAM,gCAAgC,CAAC;AAExC,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,eAAe,EACf,iBAAiB,EAClB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACpB,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EACL,eAAe,EACf,eAAe,EACf,eAAe,EAChB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EACL,YAAY,EACZ,UAAU,EACV,YAAY,EACb,MAAM,2BAA2B,CAAC;AAGnC,eAAO,MAAM,OAAO,WAAW,CAAC;AAGhC,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;CAiB3B,CAAC;AAUF,wBAAgB,kBAAkB,CAChC,aAAa,EAAE,GAAG,EAClB,MAAM,CAAC,EAAE;IACP,QAAQ,CAAC,EAAE,OAAO,CAAC,OAAO,SAAS,EAAE,cAAc,CAAC,CAAC;IACrD,QAAQ,CAAC,EAAE,OAAO,CAAC,OAAO,SAAS,EAAE,cAAc,CAAC,CAAC;CACtD,EACD,cAAc,CAAC,EAAE,OAAO,SAAS,EAAE,cAAc,EACjD,KAAK,GAAE,OAAe;;;;;;EA0BvB"}
package/dist/index.js CHANGED
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.createReactRuntime = exports.DEFAULT_CONFIGS = exports.VERSION = exports.CacheManager = exports.resourceManager = exports.ResourceManager = exports.ComponentErrorAnalyzer = exports.LibraryRegistry = exports.LibraryLoader = exports.createStandardLibraries = exports.StandardLibraryManager = exports.createDefaultComponentStyles = exports.SetupStyles = exports.reactRootManager = exports.ReactRootManager = exports.countComponentsInHierarchy = exports.flattenComponentHierarchy = exports.validateComponentSpec = exports.registerComponentHierarchy = exports.ComponentHierarchyRegistrar = exports.extractPropPaths = exports.wrapCallbacksWithLogging = exports.createPropsTransformer = exports.mergeProps = exports.validateComponentProps = exports.normalizeStyles = exports.normalizeCallbacks = exports.buildComponentProps = exports.createErrorLogger = exports.formatComponentError = exports.withErrorBoundary = exports.createErrorBoundary = exports.ComponentSpec = exports.ComponentResolver = exports.ComponentRegistry = exports.getJSXConfig = exports.validateBabelPresets = exports.getBabelConfig = exports.DEVELOPMENT_CONFIG = exports.PRODUCTION_CONFIG = exports.DEFAULT_PLUGINS = exports.DEFAULT_PRESETS = exports.ComponentCompiler = void 0;
17
+ exports.createReactRuntime = exports.DEFAULT_CONFIGS = exports.VERSION = exports.CacheManager = exports.resourceManager = exports.ResourceManager = exports.ComponentErrorAnalyzer = exports.LibraryRegistry = exports.LibraryLoader = exports.createStandardLibraries = exports.StandardLibraryManager = exports.createDefaultComponentStyles = exports.SetupStyles = exports.reactRootManager = exports.ReactRootManager = exports.countComponentsInHierarchy = exports.flattenComponentHierarchy = exports.validateComponentSpec = exports.registerComponentHierarchy = exports.ComponentHierarchyRegistrar = exports.extractPropPaths = exports.wrapCallbacksWithLogging = exports.createPropsTransformer = exports.mergeProps = exports.validateComponentProps = exports.normalizeStyles = exports.normalizeCallbacks = exports.buildComponentProps = exports.createErrorLogger = exports.formatComponentError = exports.withErrorBoundary = exports.createErrorBoundary = exports.ComponentRegistryService = exports.ComponentSpec = exports.ComponentResolver = exports.ComponentRegistry = exports.getJSXConfig = exports.validateBabelPresets = exports.getBabelConfig = exports.DEVELOPMENT_CONFIG = exports.PRODUCTION_CONFIG = exports.DEFAULT_PLUGINS = exports.DEFAULT_PRESETS = exports.ComponentCompiler = void 0;
18
18
  const compiler_1 = require("./compiler");
19
19
  const registry_1 = require("./registry");
20
20
  const registry_2 = require("./registry");
@@ -34,6 +34,7 @@ Object.defineProperty(exports, "ComponentRegistry", { enumerable: true, get: fun
34
34
  var registry_4 = require("./registry");
35
35
  Object.defineProperty(exports, "ComponentResolver", { enumerable: true, get: function () { return registry_4.ComponentResolver; } });
36
36
  Object.defineProperty(exports, "ComponentSpec", { enumerable: true, get: function () { return registry_4.ComponentSpec; } });
37
+ Object.defineProperty(exports, "ComponentRegistryService", { enumerable: true, get: function () { return registry_4.ComponentRegistryService; } });
37
38
  var runtime_1 = require("./runtime");
38
39
  Object.defineProperty(exports, "createErrorBoundary", { enumerable: true, get: function () { return runtime_1.createErrorBoundary; } });
39
40
  Object.defineProperty(exports, "withErrorBoundary", { enumerable: true, get: function () { return runtime_1.withErrorBoundary; } });
@@ -93,16 +94,25 @@ exports.DEFAULT_CONFIGS = {
93
94
  enableNamespaces: true
94
95
  }
95
96
  };
96
- function createReactRuntime(babelInstance, config, runtimeContext) {
97
- const compiler = new compiler_1.ComponentCompiler(config?.compiler);
97
+ function createReactRuntime(babelInstance, config, runtimeContext, debug = false) {
98
+ const compilerConfig = {
99
+ ...config?.compiler,
100
+ debug: config?.compiler?.debug ?? debug
101
+ };
102
+ const registryConfig = {
103
+ ...config?.registry,
104
+ debug: config?.registry?.debug ?? debug
105
+ };
106
+ const compiler = new compiler_1.ComponentCompiler(compilerConfig);
98
107
  compiler.setBabelInstance(babelInstance);
99
- const registry = new registry_1.ComponentRegistry(config?.registry);
108
+ const registry = new registry_1.ComponentRegistry(registryConfig);
100
109
  const resolver = new registry_2.ComponentResolver(registry, compiler, runtimeContext);
101
110
  return {
102
111
  compiler,
103
112
  registry,
104
113
  resolver,
105
- version: exports.VERSION
114
+ version: exports.VERSION,
115
+ debug
106
116
  };
107
117
  }
108
118
  exports.createReactRuntime = createReactRuntime;
package/dist/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AAuB,OAAA;AAGzB,6DAIoC;AAHlC,+GAAA,aAAa,OAAA;AAKf,iEAGsC;AAFpC,mHAAA,eAAe,OAAA;AAIjB,iFAG8C;AAF5C,kIAAA,sBAAsB,OAAA;AAIxB,iEAIsC;AAHpC,mHAAA,eAAe,OAAA;AACf,mHAAA,eAAe,OAAA;AAIjB,2DAImC;AAHjC,6GAAA,YAAY,OAAA;AAMD,QAAA,OAAO,GAAG,QAAQ,CAAC;AAGnB,QAAA,eAAe,GAAG;IAC7B,QAAQ,EAAE;QACR,KAAK,EAAE;YACL,OAAO,EAAE,CAAC,OAAO,CAAC;YAClB,OAAO,EAAE,EAAE;SACZ;QACD,MAAM,EAAE,KAAK;QACb,UAAU,EAAE,KAAK;QACjB,KAAK,EAAE,IAAI;QACX,YAAY,EAAE,GAAG;KAClB;IACD,QAAQ,EAAE;QACR,aAAa,EAAE,IAAI;QACnB,eAAe,EAAE,KAAK;QACtB,MAAM,EAAE,IAAI;QACZ,gBAAgB,EAAE,IAAI;KACvB;CACF,CAAC;AASF,SAAgB,kBAAkB,CAChC,aAAkB,EAClB,MAGC,EACD,cAAiD;IAEjD,MAAM,QAAQ,GAAG,IAAI,4BAAiB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACzD,QAAQ,CAAC,gBAAgB,CAAC,aAAa,CAAC,CAAC;IAEzC,MAAM,QAAQ,GAAG,IAAI,4BAAiB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACzD,MAAM,QAAQ,GAAG,IAAI,4BAAiB,CAAC,QAAQ,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC;IAE3E,OAAO;QACL,QAAQ;QACR,QAAQ;QACR,QAAQ;QACR,OAAO,EAAE,eAAO;KACjB,CAAC;AACJ,CAAC;AApBD,gDAoBC","sourcesContent":["/**\n * @fileoverview Main entry point for the MemberJunction React Runtime.\n * Exports all public APIs for platform-agnostic React component compilation and execution.\n * @module @memberjunction/react-runtime\n */\n\n// Import necessary classes for createReactRuntime function\nimport { ComponentCompiler } from './compiler';\nimport { ComponentRegistry } from './registry';\nimport { ComponentResolver } from './registry';\n\n// Export all types\nexport * from './types';\n\n// Export compiler APIs\nexport { ComponentCompiler } from './compiler';\nexport { \n DEFAULT_PRESETS,\n DEFAULT_PLUGINS,\n PRODUCTION_CONFIG,\n DEVELOPMENT_CONFIG,\n getBabelConfig,\n validateBabelPresets,\n getJSXConfig\n} from './compiler';\n\n// Export registry APIs\nexport { ComponentRegistry } from './registry';\nexport { \n ComponentResolver,\n ComponentSpec,\n ResolvedComponents\n} from './registry';\n\n// Export runtime APIs\nexport {\n createErrorBoundary,\n withErrorBoundary,\n formatComponentError,\n createErrorLogger\n} from './runtime';\n\n\nexport {\n buildComponentProps,\n normalizeCallbacks,\n normalizeStyles,\n validateComponentProps,\n mergeProps,\n createPropsTransformer,\n wrapCallbacksWithLogging,\n extractPropPaths,\n PropBuilderOptions\n} from './runtime';\n\nexport {\n ComponentHierarchyRegistrar,\n registerComponentHierarchy,\n validateComponentSpec,\n flattenComponentHierarchy,\n countComponentsInHierarchy,\n HierarchyRegistrationResult,\n ComponentRegistrationError,\n HierarchyRegistrationOptions\n} from './runtime';\n\nexport {\n ReactRootManager,\n reactRootManager,\n ManagedReactRoot\n} from './runtime';\n\n// Export utilities\n\nexport { \n SetupStyles,\n createDefaultComponentStyles \n} from './utilities/component-styles';\n\nexport {\n StandardLibraries,\n StandardLibraryManager,\n createStandardLibraries\n} from './utilities/standard-libraries';\n\nexport {\n LibraryLoader,\n LibraryLoadOptions,\n LibraryLoadResult\n} from './utilities/library-loader';\n\nexport {\n LibraryRegistry,\n LibraryDefinition\n} from './utilities/library-registry';\n\nexport {\n ComponentErrorAnalyzer,\n FailedComponentInfo\n} from './utilities/component-error-analyzer';\n\nexport {\n ResourceManager,\n resourceManager,\n ManagedResource\n} from './utilities/resource-manager';\n\nexport {\n CacheManager,\n CacheEntry,\n CacheOptions\n} from './utilities/cache-manager';\n\n// Version information\nexport const VERSION = '2.69.1';\n\n// Default configurations\nexport const DEFAULT_CONFIGS = {\n compiler: {\n babel: {\n presets: ['react'],\n plugins: []\n },\n minify: false,\n sourceMaps: false,\n cache: true,\n maxCacheSize: 100\n },\n registry: {\n maxComponents: 1000,\n cleanupInterval: 60000,\n useLRU: true,\n enableNamespaces: true\n }\n};\n\n/**\n * Creates a complete React runtime instance with all necessary components\n * @param babelInstance - Babel standalone instance for compilation\n * @param config - Optional configuration overrides\n * @param runtimeContext - Optional runtime context for registry-based components\n * @returns Object containing compiler, registry, and resolver instances\n */\nexport function createReactRuntime(\n babelInstance: any,\n config?: {\n compiler?: Partial<import('./types').CompilerConfig>;\n registry?: Partial<import('./types').RegistryConfig>;\n },\n runtimeContext?: import('./types').RuntimeContext\n) {\n const compiler = new ComponentCompiler(config?.compiler);\n compiler.setBabelInstance(babelInstance);\n \n const registry = new ComponentRegistry(config?.registry);\n const resolver = new ComponentResolver(registry, compiler, runtimeContext);\n\n return {\n compiler,\n registry,\n resolver,\n version: VERSION\n };\n}"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAOA,yCAA+C;AAC/C,yCAA+C;AAC/C,yCAA+C;AAG/C,0CAAwB;AAGxB,uCAA+C;AAAtC,6GAAA,iBAAiB,OAAA;AAC1B,uCAQoB;AAPlB,2GAAA,eAAe,OAAA;AACf,2GAAA,eAAe,OAAA;AACf,6GAAA,iBAAiB,OAAA;AACjB,8GAAA,kBAAkB,OAAA;AAClB,0GAAA,cAAc,OAAA;AACd,gHAAA,oBAAoB,OAAA;AACpB,wGAAA,YAAY,OAAA;AAId,uCAA+C;AAAtC,6GAAA,iBAAiB,OAAA;AAC1B,uCAKoB;AAJlB,6GAAA,iBAAiB,OAAA;AACjB,yGAAA,aAAa,OAAA;AAEb,oHAAA,wBAAwB,OAAA;AAI1B,qCAKmB;AAJjB,8GAAA,mBAAmB,OAAA;AACnB,4GAAA,iBAAiB,OAAA;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IAAI;QACZ,gBAAgB,EAAE,IAAI;KACvB;CACF,CAAC;AAUF,SAAgB,kBAAkB,CAChC,aAAkB,EAClB,MAGC,EACD,cAAiD,EACjD,QAAiB,KAAK;IAGtB,MAAM,cAAc,GAAG;QACrB,GAAG,MAAM,EAAE,QAAQ;QACnB,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,IAAI,KAAK;KACxC,CAAC;IAEF,MAAM,cAAc,GAAG;QACrB,GAAG,MAAM,EAAE,QAAQ;QACnB,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,IAAI,KAAK;KACxC,CAAC;IAEF,MAAM,QAAQ,GAAG,IAAI,4BAAiB,CAAC,cAAc,CAAC,CAAC;IACvD,QAAQ,CAAC,gBAAgB,CAAC,aAAa,CAAC,CAAC;IAEzC,MAAM,QAAQ,GAAG,IAAI,4BAAiB,CAAC,cAAc,CAAC,CAAC;IACvD,MAAM,QAAQ,GAAG,IAAI,4BAAiB,CAAC,QAAQ,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC;IAE3E,OAAO;QACL,QAAQ;QACR,QAAQ;QACR,QAAQ;QACR,OAAO,EAAE,eAAO;QAChB,KAAK;KACN,CAAC;AACJ,CAAC;AAjCD,gDAiCC","sourcesContent":["/**\n * @fileoverview Main entry point for the MemberJunction React Runtime.\n * Exports all public APIs for platform-agnostic React component compilation and execution.\n * @module @memberjunction/react-runtime\n */\n\n// Import necessary classes for createReactRuntime function\nimport { ComponentCompiler } from './compiler';\nimport { ComponentRegistry } from './registry';\nimport { ComponentResolver } from './registry';\n\n// Export all types\nexport * from './types';\n\n// Export compiler APIs\nexport { ComponentCompiler } from './compiler';\nexport { \n DEFAULT_PRESETS,\n DEFAULT_PLUGINS,\n PRODUCTION_CONFIG,\n DEVELOPMENT_CONFIG,\n getBabelConfig,\n validateBabelPresets,\n getJSXConfig\n} from './compiler';\n\n// Export registry APIs\nexport { ComponentRegistry } from './registry';\nexport { \n ComponentResolver,\n ComponentSpec,\n ResolvedComponents,\n ComponentRegistryService\n} from './registry';\n\n// Export runtime APIs\nexport {\n createErrorBoundary,\n withErrorBoundary,\n formatComponentError,\n createErrorLogger\n} from './runtime';\n\n\nexport {\n buildComponentProps,\n normalizeCallbacks,\n normalizeStyles,\n validateComponentProps,\n mergeProps,\n createPropsTransformer,\n wrapCallbacksWithLogging,\n extractPropPaths,\n PropBuilderOptions\n} from './runtime';\n\nexport {\n ComponentHierarchyRegistrar,\n registerComponentHierarchy,\n validateComponentSpec,\n flattenComponentHierarchy,\n countComponentsInHierarchy,\n HierarchyRegistrationResult,\n ComponentRegistrationError,\n HierarchyRegistrationOptions\n} from './runtime';\n\nexport {\n ReactRootManager,\n reactRootManager,\n ManagedReactRoot\n} from './runtime';\n\n// Export utilities\n\nexport { \n SetupStyles,\n createDefaultComponentStyles \n} from './utilities/component-styles';\n\nexport {\n StandardLibraries,\n StandardLibraryManager,\n createStandardLibraries\n} from './utilities/standard-libraries';\n\nexport {\n LibraryLoader,\n LibraryLoadOptions,\n LibraryLoadResult\n} from './utilities/library-loader';\n\nexport {\n LibraryRegistry,\n LibraryDefinition\n} from './utilities/library-registry';\n\nexport {\n ComponentErrorAnalyzer,\n FailedComponentInfo\n} from './utilities/component-error-analyzer';\n\nexport {\n ResourceManager,\n resourceManager,\n ManagedResource\n} from './utilities/resource-manager';\n\nexport {\n CacheManager,\n CacheEntry,\n CacheOptions\n} from './utilities/cache-manager';\n\n// Version information\nexport const VERSION = '2.69.1';\n\n// Default configurations\nexport const DEFAULT_CONFIGS = {\n compiler: {\n babel: {\n presets: ['react'],\n plugins: []\n },\n minify: false,\n sourceMaps: false,\n cache: true,\n maxCacheSize: 100\n },\n registry: {\n maxComponents: 1000,\n cleanupInterval: 60000,\n useLRU: true,\n enableNamespaces: true\n }\n};\n\n/**\n * Creates a complete React runtime instance with all necessary components\n * @param babelInstance - Babel standalone instance for compilation\n * @param config - Optional configuration overrides\n * @param runtimeContext - Optional runtime context for registry-based components\n * @param debug - Enable debug logging (defaults to false)\n * @returns Object containing compiler, registry, and resolver instances\n */\nexport function createReactRuntime(\n babelInstance: any,\n config?: {\n compiler?: Partial<import('./types').CompilerConfig>;\n registry?: Partial<import('./types').RegistryConfig>;\n },\n runtimeContext?: import('./types').RuntimeContext,\n debug: boolean = false\n) {\n // Merge debug flag into configs\n const compilerConfig = {\n ...config?.compiler,\n debug: config?.compiler?.debug ?? debug\n };\n \n const registryConfig = {\n ...config?.registry,\n debug: config?.registry?.debug ?? debug\n };\n \n const compiler = new ComponentCompiler(compilerConfig);\n compiler.setBabelInstance(babelInstance);\n \n const registry = new ComponentRegistry(registryConfig);\n const resolver = new ComponentResolver(registry, compiler, runtimeContext);\n\n return {\n compiler,\n registry,\n resolver,\n version: VERSION,\n debug\n };\n}"]}
@@ -1,4 +1,4 @@
1
- import { ComponentSpec } from '@memberjunction/interactive-component-types';
1
+ import { ComponentSpec, ComponentObject } from '@memberjunction/interactive-component-types';
2
2
  import { ComponentCompiler } from '../compiler';
3
3
  import { RuntimeContext } from '../types';
4
4
  import { ComponentDependencyInfo, DependencyTree } from './registry-provider';
@@ -11,10 +11,11 @@ export declare class ComponentRegistryService {
11
11
  private runtimeContext;
12
12
  private componentEngine;
13
13
  private registryProviders;
14
+ private debug;
14
15
  private constructor();
15
- static getInstance(compiler: ComponentCompiler, context: RuntimeContext): ComponentRegistryService;
16
+ static getInstance(compiler: ComponentCompiler, context: RuntimeContext, debug?: boolean): ComponentRegistryService;
16
17
  initialize(contextUser?: UserInfo): Promise<void>;
17
- getCompiledComponent(componentId: string, referenceId?: string, contextUser?: UserInfo): Promise<Function>;
18
+ getCompiledComponent(componentId: string, referenceId?: string, contextUser?: UserInfo): Promise<ComponentObject>;
18
19
  getComponentSpec(componentId: string, contextUser?: UserInfo): Promise<ComponentSpec>;
19
20
  private fetchFromExternalRegistry;
20
21
  private cacheExternalComponent;
@@ -31,6 +32,8 @@ export declare class ComponentRegistryService {
31
32
  memoryEstimate: string;
32
33
  };
33
34
  clearCache(): void;
35
+ forceClearAll(): void;
36
+ static reset(): void;
34
37
  private getComponentKey;
35
38
  }
36
39
  //# sourceMappingURL=component-registry-service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"component-registry-service.d.ts","sourceRoot":"","sources":["../../src/registry/component-registry-service.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAGL,uBAAuB,EACvB,cAAc,EAEf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAY,MAAM,sBAAsB,CAAC;AAuB1D,qBAAa,wBAAwB;IACnC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAyC;IAGhE,OAAO,CAAC,sBAAsB,CAA8C;IAC5E,OAAO,CAAC,mBAAmB,CAAkC;IAG7D,OAAO,CAAC,QAAQ,CAAoB;IACpC,OAAO,CAAC,cAAc,CAAiB;IACvC,OAAO,CAAC,eAAe,CAAoC;IAC3D,OAAO,CAAC,iBAAiB,CAAuC;IAEhE,OAAO;IAWP,MAAM,CAAC,WAAW,CAChB,QAAQ,EAAE,iBAAiB,EAC3B,OAAO,EAAE,cAAc,GACtB,wBAAwB;IAUrB,UAAU,CAAC,WAAW,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAQjD,oBAAoB,CACxB,WAAW,EAAE,MAAM,EACnB,WAAW,CAAC,EAAE,MAAM,EACpB,WAAW,CAAC,EAAE,QAAQ,GACrB,OAAO,CAAC,QAAQ,CAAC;IAuFd,gBAAgB,CACpB,WAAW,EAAE,MAAM,EACnB,WAAW,CAAC,EAAE,QAAQ,GACrB,OAAO,CAAC,aAAa,CAAC;YAqDX,yBAAyB;YAgCzB,sBAAsB;IAwF9B,gBAAgB,CACpB,WAAW,EAAE,MAAM,EACnB,WAAW,CAAC,EAAE,QAAQ,GACrB,OAAO,CAAC,uBAAuB,EAAE,CAAC;IAkC/B,qBAAqB,CACzB,WAAW,EAAE,MAAM,EACnB,WAAW,CAAC,EAAE,QAAQ,EACtB,OAAO,cAAoB,GAC1B,OAAO,CAAC,cAAc,CAAC;IAmDpB,mBAAmB,CACvB,eAAe,EAAE,MAAM,EACvB,WAAW,CAAC,EAAE,QAAQ,GACrB,OAAO,CAAC,MAAM,EAAE,CAAC;IAqBpB,OAAO,CAAC,qBAAqB;IAU7B,wBAAwB,CAAC,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI;IAezE,OAAO,CAAC,qBAAqB;IAkB7B,OAAO,CAAC,iBAAiB;IAWzB,aAAa,IAAI;QACf,kBAAkB,EAAE,MAAM,CAAC;QAC3B,aAAa,EAAE,MAAM,CAAC;QACtB,cAAc,EAAE,MAAM,CAAC;KACxB;IAgBD,UAAU,IAAI,IAAI;IASlB,OAAO,CAAC,eAAe;CAUxB"}
1
+ {"version":3,"file":"component-registry-service.d.ts","sourceRoot":"","sources":["../../src/registry/component-registry-service.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAC7F,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAGL,uBAAuB,EACvB,cAAc,EAEf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAY,MAAM,sBAAsB,CAAC;AAuB1D,qBAAa,wBAAwB;IACnC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAyC;IAGhE,OAAO,CAAC,sBAAsB,CAA8C;IAC5E,OAAO,CAAC,mBAAmB,CAAkC;IAG7D,OAAO,CAAC,QAAQ,CAAoB;IACpC,OAAO,CAAC,cAAc,CAAiB;IACvC,OAAO,CAAC,eAAe,CAA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K,IAAI,IAAI;IAUpB,OAAO,CAAC,eAAe;CAUxB"}
@@ -4,17 +4,19 @@ exports.ComponentRegistryService = void 0;
4
4
  const core_1 = require("@memberjunction/core");
5
5
  const core_entities_1 = require("@memberjunction/core-entities");
6
6
  class ComponentRegistryService {
7
- constructor(compiler, runtimeContext) {
7
+ constructor(compiler, runtimeContext, debug = false) {
8
8
  this.compiledComponentCache = new Map();
9
9
  this.componentReferences = new Map();
10
10
  this.componentEngine = core_entities_1.ComponentMetadataEngine.Instance;
11
11
  this.registryProviders = new Map();
12
+ this.debug = false;
12
13
  this.compiler = compiler;
13
14
  this.runtimeContext = runtimeContext;
15
+ this.debug = debug;
14
16
  }
15
- static getInstance(compiler, context) {
17
+ static getInstance(compiler, context, debug = false) {
16
18
  if (!ComponentRegistryService.instance) {
17
- ComponentRegistryService.instance = new ComponentRegistryService(compiler, context);
19
+ ComponentRegistryService.instance = new ComponentRegistryService(compiler, context, debug);
18
20
  }
19
21
  return ComponentRegistryService.instance;
20
22
  }
@@ -35,10 +37,14 @@ class ComponentRegistryService {
35
37
  if (referenceId) {
36
38
  this.addComponentReference(key, referenceId);
37
39
  }
38
- console.log(`✅ Reusing compiled component from cache: ${key} (use count: ${cached.useCount})`);
40
+ if (this.debug) {
41
+ console.log(`✅ Reusing compiled component from cache: ${key} (use count: ${cached.useCount})`);
42
+ }
39
43
  return cached.component;
40
44
  }
41
- console.log(`🔄 Loading and compiling component: ${key}`);
45
+ if (this.debug) {
46
+ console.log(`🔄 Loading and compiling component: ${key}`);
47
+ }
42
48
  const spec = await this.getComponentSpec(componentId, contextUser);
43
49
  const allLibraries = this.componentEngine.ComponentLibraries || [];
44
50
  const compilationResult = await this.compiler.compile({
@@ -68,7 +74,7 @@ class ComponentRegistryService {
68
74
  if (!compilationResult.component) {
69
75
  throw new Error(`Component compilation succeeded but no component returned`);
70
76
  }
71
- const compiledComponent = compilationResult.component.component(this.runtimeContext);
77
+ const compiledComponent = compilationResult.component.factory(this.runtimeContext);
72
78
  this.compiledComponentCache.set(key, {
73
79
  component: compiledComponent,
74
80
  metadata,
@@ -94,7 +100,9 @@ class ComponentRegistryService {
94
100
  return JSON.parse(component.Specification);
95
101
  }
96
102
  if (component.Specification && component.LastSyncedAt) {
97
- console.log(`Using cached external component: ${component.Name} (synced: ${component.LastSyncedAt})`);
103
+ if (this.debug) {
104
+ console.log(`Using cached external component: ${component.Name} (synced: ${component.LastSyncedAt})`);
105
+ }
98
106
  return JSON.parse(component.Specification);
99
107
  }
100
108
  const registry = this.componentEngine.ComponentRegistries?.find(r => r.ID === component.SourceRegistryID);
@@ -116,7 +124,9 @@ class ComponentRegistryService {
116
124
  if (apiKey) {
117
125
  headers['Authorization'] = `Bearer ${apiKey}`;
118
126
  }
119
- console.log(`Fetching from external registry: ${url}`);
127
+ if (this.debug) {
128
+ console.log(`Fetching from external registry: ${url}`);
129
+ }
120
130
  const response = await fetch(url, { headers });
121
131
  if (!response.ok) {
122
132
  throw new Error(`Registry fetch failed: ${response.status} ${response.statusText}`);
@@ -178,7 +188,9 @@ class ComponentRegistryService {
178
188
  if (!result) {
179
189
  throw new Error(`Failed to save cached component: ${componentEntity.Name}\n${componentEntity.LatestResult.Message || componentEntity.LatestResult.Error || componentEntity.LatestResult.Errors?.join(',')}`);
180
190
  }
181
- console.log(`Cached external component: ${componentEntity.Name} at ${componentEntity.LastSyncedAt}`);
191
+ if (this.debug) {
192
+ console.log(`Cached external component: ${componentEntity.Name} at ${componentEntity.LastSyncedAt}`);
193
+ }
182
194
  await this.componentEngine.Config(true, contextUser);
183
195
  }
184
196
  async loadDependencies(componentId, contextUser) {
@@ -267,7 +279,9 @@ class ComponentRegistryService {
267
279
  const timeSinceLastUse = Date.now() - cached.lastUsed.getTime();
268
280
  const evictionThreshold = 5 * 60 * 1000;
269
281
  if (timeSinceLastUse > evictionThreshold) {
270
- console.log(`🗑️ Evicting unused component from cache: ${componentKey}`);
282
+ if (this.debug) {
283
+ console.log(`🗑️ Evicting unused component from cache: ${componentKey}`);
284
+ }
271
285
  this.compiledComponentCache.delete(componentKey);
272
286
  }
273
287
  }
@@ -288,10 +302,23 @@ class ComponentRegistryService {
288
302
  };
289
303
  }
290
304
  clearCache() {
291
- console.log('🧹 Clearing all component caches');
305
+ if (this.debug) {
306
+ console.log('🧹 Clearing all component caches');
307
+ }
292
308
  this.compiledComponentCache.clear();
293
309
  this.componentReferences.clear();
294
310
  }
311
+ forceClearAll() {
312
+ this.compiledComponentCache.clear();
313
+ this.componentReferences.clear();
314
+ console.log('🧹 Component cache force cleared');
315
+ }
316
+ static reset() {
317
+ if (ComponentRegistryService.instance) {
318
+ ComponentRegistryService.instance.forceClearAll();
319
+ ComponentRegistryService.instance = null;
320
+ }
321
+ }
295
322
  getComponentKey(name, namespace, version, sourceRegistryId) {
296
323
  const registryPart = sourceRegistryId || 'local';
297
324
  const namespacePart = namespace || 'global';
@@ -1 +1 @@
1
- {"version":3,"file":"component-registry-service.js","sourceRoot":"","sources":["../../src/registry/component-registry-service.ts"],"names":[],"mappings":";;;AAeA,+CAA0D;AAC1D,iEAMuC;AAgBvC,MAAa,wBAAwB;IAanC,YACE,QAA2B,EAC3B,cAA8B;QAXxB,2BAAsB,GAAG,IAAI,GAAG,EAAmC,CAAC;QACpE,wBAAmB,GAAG,IAAI,GAAG,EAAuB,CAAC;QAKrD,oBAAe,GAAG,uCAAuB,CAAC,QAAQ,CAAC;QACnD,sBAAiB,GAAG,IAAI,GAAG,EAA4B,CAAC;QAM9D,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IACvC,CAAC;IAKD,MAAM,CAAC,WAAW,CAChB,QAA2B,EAC3B,OAAuB;QAEvB,IAAI,CAAC,wBAAwB,CAAC,QAAQ,EAAE,CAAC;YACvC,wBAAwB,CAAC,QAAQ,GAAG,IAAI,wBAAwB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QACtF,CAAC;QACD,OAAO,wBAA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,aAAa,GAAG,CAAC,CAAC;QACtB,IAAI,CAAC,sBAAsB,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;YAC3C,aAAa,IAAI,MAAM,CAAC,QAAQ,CAAC;QACnC,CAAC,CAAC,CAAC;QAEH,OAAO;YACL,kBAAkB,EAAE,IAAI,CAAC,sBAAsB,CAAC,IAAI;YACpD,aAAa;YACb,cAAc,EAAE,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,IAAI,GAAG,EAAE,CAAC,IAAI;SAChE,CAAC;IACJ,CAAC;IAKD,UAAU;QACR,OAAO,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;QAChD,IAAI,CAAC,sBAAsB,CAAC,KAAK,EAAE,CAAC;QACpC,IAAI,CAAC,mBAAmB,CAAC,KAAK,EAAE,CAAC;IACnC,CAAC;IAKO,eAAe,CACrB,IAAY,EACZ,SAAoC,EACpC,OAAe,EACf,gBAA2C;QAE3C,MAAM,YAAY,GAAG,gBAAgB,IAAI,OAAO,CAAC;QACjD,MAAM,aAAa,GAAG,SAAS,IAAI,QAAQ,CAAC;QAC5C,OAAO,GAAG,YAAY,IAAI,aAAa,IAAI,IAAI,IAAI,OAAO,EAAE,CAAC;IAC/D,CAAC;;AAxgBH,4DAygBC;AAxgBgB,iCAAQ,GAAoC,IAAI,AAAxC,CAAyC","sourcesContent":["/**\n * @fileoverview Service for managing registry-based component loading with caching\n * @module @memberjunction/react-runtime/registry\n */\n\nimport { ComponentSpec } from '@memberjunction/interactive-component-types';\nimport { ComponentCompiler } from '../compiler';\nimport { RuntimeContext } from '../types';\nimport { \n RegistryProvider, \n RegistryComponentResponse,\n ComponentDependencyInfo,\n DependencyTree, \n RegistryComponentMetadata\n} from './registry-provider';\nimport { UserInfo, Metadata } from '@memberjunction/core';\nimport { \n ComponentEntity, \n ComponentRegistryEntity,\n ComponentDependencyEntity,\n ComponentLibraryLinkEntity,\n ComponentMetadataEngine\n} from '@memberjunction/core-entities';\n\n/**\n * Cached compiled component with metadata\n */\ninterface CachedCompiledComponent {\n component: Function;\n metadata: RegistryComponentResponse['metadata'];\n compiledAt: Date;\n lastUsed: Date;\n useCount: number;\n}\n\n/**\n * Service for managing component loading from registries with compilation caching\n */\nexport class ComponentRegistryService {\n private static instance: ComponentRegistryService | null = null;\n \n // Caches\n private compiledComponentCache = new Map<string, CachedCompiledComponent>();\n private componentReferences = new Map<string, Set<string>>();\n \n // Dependencies\n private compiler: ComponentCompiler;\n private runtimeContext: RuntimeContext;\n private componentEngine = ComponentMetadataEngine.Instance;\n private registryProviders = new Map<string, RegistryProvider>();\n \n private constructor(\n compiler: ComponentCompiler,\n runtimeContext: RuntimeContext\n ) {\n this.compiler = compiler;\n this.runtimeContext = runtimeContext;\n }\n \n /**\n * Get or create the singleton instance\n */\n static getInstance(\n compiler: ComponentCompiler, \n context: RuntimeContext\n ): ComponentRegistryService {\n if (!ComponentRegistryService.instance) {\n ComponentRegistryService.instance = new ComponentRegistryService(compiler, context);\n }\n return ComponentRegistryService.instance;\n }\n \n /**\n * Initialize the service with metadata\n */\n async initialize(contextUser?: UserInfo): Promise<void> {\n // Initialize metadata engine\n await this.componentEngine.Config(false, contextUser);\n }\n \n /**\n * Get a compiled component, using cache if available\n */\n async getCompiledComponent(\n componentId: string,\n referenceId?: string,\n contextUser?: UserInfo\n ): Promise<Function> {\n await this.initialize(contextUser);\n \n // Find component in metadata\n const component = this.componentEngine.Components.find((c: ComponentEntity) => c.ID === componentId);\n if (!component) {\n throw new Error(`Component not found: ${componentId}`);\n }\n \n const key = this.getComponentKey(component.Name, component.Namespace, component.Version, component.SourceRegistryID);\n \n // Check if already compiled and cached\n if (this.compiledComponentCache.has(key)) {\n const cached = this.compiledComponentCache.get(key)!;\n cached.lastUsed = new Date();\n cached.useCount++;\n \n // Track reference if provided\n if (referenceId) {\n this.addComponentReference(key, referenceId);\n }\n \n console.log(`✅ Reusing compiled component from cache: ${key} (use count: ${cached.useCount})`);\n return cached.component;\n }\n \n // Not in cache, need to load and compile\n console.log(`🔄 Loading and compiling component: ${key}`);\n \n // Get the component specification\n const spec = await this.getComponentSpec(componentId, contextUser);\n \n // Compile the component\n // Load all libraries from metadata engine\n const allLibraries = this.componentEngine.ComponentLibraries || [];\n \n const compilationResult = await this.compiler.compile({\n componentName: component.Name,\n componentCode: spec.code,\n libraries: spec.libraries,\n allLibraries\n });\n \n if (!compilationResult.success) {\n throw new Error(`Failed to compile component ${component.Name}: ${compilationResult.error}`);\n }\n \n // Cache the compiled component\n const metadata: RegistryComponentMetadata = {\n name: component.Name,\n namespace: component.Namespace || '',\n version: component.Version,\n description: component.Description || '',\n title: component.Title || undefined,\n type: component.Type || undefined,\n status: component.Status || undefined,\n properties: spec.properties,\n events: spec.events,\n libraries: spec.libraries,\n dependencies: spec.dependencies,\n sourceRegistryID: component.SourceRegistryID,\n isLocal: !component.SourceRegistryID\n };\n \n if (!compilationResult.component) {\n throw new Error(`Component compilation succeeded but no component returned`);\n }\n const compiledComponent = compilationResult.component.component(this.runtimeContext);\n this.compiledComponentCache.set(key, {\n component: compiledComponent,\n metadata,\n compiledAt: new Date(),\n lastUsed: new Date(),\n useCount: 1\n });\n \n // Track reference\n if (referenceId) {\n this.addComponentReference(key, referenceId);\n }\n \n return compiledComponent;\n }\n \n /**\n * Get component specification from database or external registry\n */\n async getComponentSpec(\n componentId: string,\n contextUser?: UserInfo\n ): Promise<ComponentSpec> {\n await this.initialize(contextUser);\n \n const component = this.componentEngine.Components.find((c: ComponentEntity) => c.ID === componentId);\n if (!component) {\n throw new Error(`Component not found: ${componentId}`);\n }\n \n if (!component.SourceRegistryID) {\n // LOCAL: Use specification from database\n if (!component.Specification) {\n throw new Error(`Local component ${component.Name} has no specification`);\n }\n return JSON.parse(component.Specification);\n }\n \n // EXTERNAL: Check if we have a cached version\n if (component.Specification && component.LastSyncedAt) {\n // For now, always use cached version (no expiration)\n console.log(`Using cached external component: ${component.Name} (synced: ${component.LastSyncedAt})`);\n return JSON.parse(component.Specification);\n }\n \n // Need to fetch from external registry\n const registry = this.componentEngine.ComponentRegistries?.find(\n r => r.ID === component.SourceRegistryID\n );\n \n if (!registry) {\n throw new Error(`Registry not found: ${component.SourceRegistryID}`);\n }\n \n if (!registry) {\n throw new Error(`Registry not found: ${component.SourceRegistryID}`);\n }\n \n const spec = await this.fetchFromExternalRegistry(\n registry.URI || '',\n component.Name,\n component.Namespace || '',\n component.Version,\n this.getRegistryApiKey(registry.ID) // API keys stored in env vars or secure config\n );\n \n // Store in local database for future use\n await this.cacheExternalComponent(componentId, spec, contextUser);\n \n return spec;\n }\n \n /**\n * Fetch component from external registry via HTTP\n */\n private async fetchFromExternalRegistry(\n uri: string,\n name: string,\n namespace: string,\n version: string,\n apiKey?: string\n ): Promise<ComponentSpec> {\n const url = `${uri}/components/${encodeURIComponent(namespace)}/${encodeURIComponent(name)}/${version}`;\n \n const headers: HeadersInit = {\n 'Accept': 'application/json'\n };\n \n if (apiKey) {\n headers['Authorization'] = `Bearer ${apiKey}`;\n }\n \n console.log(`Fetching from external registry: ${url}`);\n \n const response = await fetch(url, { headers });\n \n if (!response.ok) {\n throw new Error(`Registry fetch failed: ${response.status} ${response.statusText}`);\n }\n \n const spec = await response.json() as ComponentSpec;\n return spec;\n }\n \n /**\n * Cache an external component in the local database\n */\n private async cacheExternalComponent(\n componentId: string,\n spec: ComponentSpec,\n contextUser?: UserInfo\n ): Promise<void> {\n // Get the actual entity object to save\n const md = new Metadata();\n const componentEntity = await md.GetEntityObject<ComponentEntity>('MJ: Components', contextUser);\n \n // Load the existing component\n if (!await componentEntity.Load(componentId)) {\n throw new Error(`Failed to load component entity: ${componentId}`);\n }\n \n // Update with fetched specification and all fields from spec\n componentEntity.Specification = JSON.stringify(spec);\n componentEntity.LastSyncedAt = new Date();\n \n // Set ReplicatedAt only on first fetch\n if (!componentEntity.ReplicatedAt) {\n componentEntity.ReplicatedAt = new Date();\n }\n \n // Update all fields from the spec with strong typing\n if (spec.name) {\n componentEntity.Name = spec.name;\n }\n \n if (spec.namespace) {\n componentEntity.Namespace = spec.namespace;\n }\n \n if (spec.version) {\n componentEntity.Version = spec.version;\n }\n \n if (spec.title) {\n componentEntity.Title = spec.title;\n }\n \n if (spec.description) {\n componentEntity.Description = spec.description;\n }\n \n if (spec.type) {\n // Map spec type to entity type (entity has specific enum values)\n const typeMap: Record<string, ComponentEntity['Type']> = {\n 'report': 'Report',\n 'dashboard': 'Dashboard',\n 'form': 'Form',\n 'table': 'Table',\n 'chart': 'Chart',\n 'navigation': 'Navigation',\n 'search': 'Search',\n 'widget': 'Widget',\n 'utility': 'Utility',\n 'other': 'Other'\n };\n \n const mappedType = typeMap[spec.type.toLowerCase()];\n if (mappedType) {\n componentEntity.Type = mappedType;\n }\n }\n \n if (spec.functionalRequirements) {\n componentEntity.FunctionalRequirements = spec.functionalRequirements;\n }\n \n if (spec.technicalDesign) {\n componentEntity.TechnicalDesign = spec.technicalDesign;\n }\n \n // Save back to database\n const result = await componentEntity.Save();\n if (!result) {\n throw new Error(`Failed to save cached component: ${componentEntity.Name}\\n${componentEntity.LatestResult.Message || componentEntity.LatestResult.Error || componentEntity.LatestResult.Errors?.join(',')}`);\n }\n \n console.log(`Cached external component: ${componentEntity.Name} at ${componentEntity.LastSyncedAt}`);\n \n // Refresh metadata cache after saving\n await this.componentEngine.Config(true, contextUser);\n }\n \n /**\n * Load component dependencies from database\n */\n async loadDependencies(\n componentId: string,\n contextUser?: UserInfo\n ): Promise<ComponentDependencyInfo[]> {\n await this.initialize(contextUser);\n \n // Get dependencies from metadata cache\n const dependencies = this.componentEngine.ComponentDependencies?.filter(\n d => d.ComponentID === componentId\n ) || [];\n \n const result: ComponentDependencyInfo[] = [];\n \n for (const dep of dependencies) {\n // Find the dependency component\n const depComponent = this.componentEngine.Components.find(\n (c: ComponentEntity) => c.ID === dep.DependencyComponentID\n );\n \n if (depComponent) {\n result.push({\n name: depComponent.Name,\n namespace: depComponent.Namespace || '',\n version: depComponent.Version, // Version comes from the linked Component record\n isRequired: true, // All dependencies are required in MemberJunction\n location: depComponent.SourceRegistryID ? 'registry' : 'embedded',\n sourceRegistryID: depComponent.SourceRegistryID\n });\n }\n }\n \n return result;\n }\n \n /**\n * Resolve full dependency tree for a component\n */\n async resolveDependencyTree(\n componentId: string,\n contextUser?: UserInfo,\n visited = new Set<string>()\n ): Promise<DependencyTree> {\n if (visited.has(componentId)) {\n return { \n componentId, \n circular: true \n };\n }\n visited.add(componentId);\n \n await this.initialize(contextUser);\n \n const component = this.componentEngine.Components.find((c: ComponentEntity) => c.ID === componentId);\n if (!component) {\n return { componentId, dependencies: [] };\n }\n \n // Get direct dependencies\n const directDeps = await this.loadDependencies(componentId, contextUser);\n \n // Recursively resolve each dependency\n const dependencies: DependencyTree[] = [];\n for (const dep of directDeps) {\n // Find the dependency component\n const depComponent = this.componentEngine.Components.find(\n c => c.Name.trim().toLowerCase() === dep.name.trim().toLowerCase() && \n c.Namespace?.trim().toLowerCase() === dep.namespace?.trim().toLowerCase()\n );\n \n if (depComponent) {\n const subTree = await this.resolveDependencyTree(\n depComponent.ID, \n contextUser, \n visited\n );\n dependencies.push(subTree);\n }\n }\n \n return {\n componentId,\n name: component.Name,\n namespace: component.Namespace || undefined,\n version: component.Version,\n dependencies,\n totalCount: dependencies.reduce((sum, d) => sum + (d.totalCount || 1), 1)\n };\n }\n \n /**\n * Get components to load in dependency order\n */\n async getComponentsToLoad(\n rootComponentId: string,\n contextUser?: UserInfo\n ): Promise<string[]> {\n const tree = await this.resolveDependencyTree(rootComponentId, contextUser);\n \n // Flatten tree in dependency order (depth-first)\n const ordered: string[] = [];\n const processNode = (node: DependencyTree) => {\n if (node.dependencies) {\n node.dependencies.forEach(processNode);\n }\n if (!ordered.includes(node.componentId)) {\n ordered.push(node.componentId);\n }\n };\n processNode(tree);\n \n return ordered;\n }\n \n /**\n * Add a reference to a component\n */\n private addComponentReference(componentKey: string, referenceId: string): void {\n if (!this.componentReferences.has(componentKey)) {\n this.componentReferences.set(componentKey, new Set());\n }\n this.componentReferences.get(componentKey)!.add(referenceId);\n }\n \n /**\n * Remove a reference to a component\n */\n removeComponentReference(componentKey: string, referenceId: string): void {\n const refs = this.componentReferences.get(componentKey);\n if (refs) {\n refs.delete(referenceId);\n \n // If no more references and cache cleanup is enabled\n if (refs.size === 0) {\n this.considerCacheEviction(componentKey);\n }\n }\n }\n \n /**\n * Consider evicting a component from cache\n */\n private considerCacheEviction(componentKey: string): void {\n const cached = this.compiledComponentCache.get(componentKey);\n if (cached) {\n const timeSinceLastUse = Date.now() - cached.lastUsed.getTime();\n const evictionThreshold = 5 * 60 * 1000; // 5 minutes\n \n if (timeSinceLastUse > evictionThreshold) {\n console.log(`🗑️ Evicting unused component from cache: ${componentKey}`);\n this.compiledComponentCache.delete(componentKey);\n }\n }\n }\n \n /**\n * Get API key for a registry from secure configuration\n * @param registryId - Registry ID\n * @returns API key or undefined\n */\n private getRegistryApiKey(registryId: string): string | undefined {\n // API keys should be stored in environment variables or secure configuration\n // Format: REGISTRY_API_KEY_{registryId} or similar\n // This is a placeholder - actual implementation would depend on the security infrastructure\n const envKey = `REGISTRY_API_KEY_${registryId.replace(/-/g, '_').toUpperCase()}`;\n return process.env[envKey];\n }\n \n /**\n * Get cache statistics\n */\n getCacheStats(): {\n compiledComponents: number;\n totalUseCount: number;\n memoryEstimate: string;\n } {\n let totalUseCount = 0;\n this.compiledComponentCache.forEach(cached => {\n totalUseCount += cached.useCount;\n });\n \n return {\n compiledComponents: this.compiledComponentCache.size,\n totalUseCount,\n memoryEstimate: `~${(this.compiledComponentCache.size * 50)}KB` // Rough estimate\n };\n }\n \n /**\n * Clear all caches\n */\n clearCache(): void {\n console.log('🧹 Clearing all component caches');\n this.compiledComponentCache.clear();\n this.componentReferences.clear();\n }\n \n /**\n * Generate a cache key for a component\n */\n private getComponentKey(\n name: string, \n namespace: string | null | undefined, \n version: string, \n sourceRegistryId: string | null | undefined\n ): string {\n const registryPart = sourceRegistryId || 'local';\n const namespacePart = namespace || 'global';\n return `${registryPart}/${namespacePart}/${name}@${version}`;\n }\n}"]}
1
+ {"version":3,"file":"component-registry-service.js","sourceRoot":"","sources":["../../src/registry/component-registry-service.ts"],"names":[],"mappings":";;;AAeA,+CAA0D;AAC1D,iEAMuC;AAgBvC,MAAa,wBAAwB;IAcnC,YACE,QAA2B,EAC3B,cAA8B,EAC9B,QAAiB,KAAK;QAbhB,2BAAsB,GAAG,IAAI,GAAG,EAAmC,CAAC;QACpE,wBAAmB,GAAG,IAAI,GAAG,EAAuB,CAAC;QAKrD,oBAAe,GAAG,uCAAuB,CAAC,QAAQ,CAAC;QACnD,sBAAiB,GAAG,IAAI,GAAG,EAA4B,CAAC;QACxD,UAAK,GAAY,KAAK,CAAC;QAO7B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAKD,MAAM,CAAC,WAAW,CAChB,QAA2B,EAC3B,OAAuB,EACvB,QAAiB,KAAK;QAEtB,IAAI,CAAC,wBAAwB,CAAC,QAAQ,EAAE,CAAC;YACvC,wBAAwB,CAAC,QAAQ,GAAG,IAAI,wBAAwB,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;QAC7F,CAAC;QACD,OAAO,wBAAwB,CAAC,QAAQ,CAAC;IAC3C,CAAC;IAKD,KAAK,CAAC,UAAU,CAAC,WAAsB;QAErC,MAAM,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;IACxD,CAAC;IAKD,KAAK,CAAC,oBAAoB,CACxB,WAAmB,EACnB,WAAoB,EACpB,WAAsB;QAEtB,MAAM,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;QAGnC,MAAM,SAAS,GAAG,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAkB,EAAE,EAAE,CAAC,CAAC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C,EAAE;YAC3C,aAAa,IAAI,MAAM,CAAC,QAAQ,CAAC;QACnC,CAAC,CAAC,CAAC;QAEH,OAAO;YACL,kBAAkB,EAAE,IAAI,CAAC,sBAAsB,CAAC,IAAI;YACpD,aAAa;YACb,cAAc,EAAE,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,IAAI,GAAG,EAAE,CAAC,IAAI;SAChE,CAAC;IACJ,CAAC;IAKD,UAAU;QACR,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;QAClD,CAAC;QACD,IAAI,CAAC,sBAAsB,CAAC,KAAK,EAAE,CAAC;QACpC,IAAI,CAAC,mBAAmB,CAAC,KAAK,EAAE,CAAC;IACnC,CAAC;IAMD,aAAa;QACX,IAAI,CAAC,sBAAsB,CAAC,KAAK,EAAE,CAAC;QACpC,IAAI,CAAC,mBAAmB,CAAC,KAAK,EAAE,CAAC;QACjC,OAAO,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;IAClD,CAAC;IAMD,MAAM,CAAC,KAAK;QACV,IAAI,wBAAwB,CAAC,QAAQ,EAAE,CAAC;YACtC,wBAAwB,CAAC,QAAQ,CAAC,aAAa,EAAE,CAAC;YAClD,wBAAwB,CAAC,QAAQ,GAAG,IAAI,CAAC;QAC3C,CAAC;IACH,CAAC;IAKO,eAAe,CACrB,IAAY,EACZ,SAAoC,EACpC,OAAe,EACf,gBAA2C;QAE3C,MAAM,YAAY,GAAG,gBAAgB,IAAI,OAAO,CAAC;QACjD,MAAM,aAAa,GAAG,SAAS,IAAI,QAAQ,CAAC;QAC5C,OAAO,GAAG,YAAY,IAAI,aAAa,IAAI,IAAI,IAAI,OAAO,EAAE,CAAC;IAC/D,CAAC;;AA/iBH,4DAgjBC;AA/iBgB,iCAAQ,GAAoC,IAAI,AAAxC,CAAyC","sourcesContent":["/**\n * @fileoverview Service for managing registry-based component loading with caching\n * @module @memberjunction/react-runtime/registry\n */\n\nimport { ComponentSpec, ComponentObject } from '@memberjunction/interactive-component-types';\nimport { ComponentCompiler } from '../compiler';\nimport { RuntimeContext } from '../types';\nimport { \n RegistryProvider, \n RegistryComponentResponse,\n ComponentDependencyInfo,\n DependencyTree, \n RegistryComponentMetadata\n} from './registry-provider';\nimport { UserInfo, Metadata } from '@memberjunction/core';\nimport { \n ComponentEntity, \n ComponentRegistryEntity,\n ComponentDependencyEntity,\n ComponentLibraryLinkEntity,\n ComponentMetadataEngine\n} from '@memberjunction/core-entities';\n\n/**\n * Cached compiled component with metadata\n */\ninterface CachedCompiledComponent {\n component: ComponentObject;\n metadata: RegistryComponentResponse['metadata'];\n compiledAt: Date;\n lastUsed: Date;\n useCount: number;\n}\n\n/**\n * Service for managing component loading from registries with compilation caching\n */\nexport class ComponentRegistryService {\n private static instance: ComponentRegistryService | null = null;\n \n // Caches\n private compiledComponentCache = new Map<string, CachedCompiledComponent>();\n private componentReferences = new Map<string, Set<string>>();\n \n // Dependencies\n private compiler: ComponentCompiler;\n private runtimeContext: RuntimeContext;\n private componentEngine = ComponentMetadataEngine.Instance;\n private registryProviders = new Map<string, RegistryProvider>();\n private debug: boolean = false;\n \n private constructor(\n compiler: ComponentCompiler,\n runtimeContext: RuntimeContext,\n debug: boolean = false\n ) {\n this.compiler = compiler;\n this.runtimeContext = runtimeContext;\n this.debug = debug;\n }\n \n /**\n * Get or create the singleton instance\n */\n static getInstance(\n compiler: ComponentCompiler, \n context: RuntimeContext,\n debug: boolean = false\n ): ComponentRegistryService {\n if (!ComponentRegistryService.instance) {\n ComponentRegistryService.instance = new ComponentRegistryService(compiler, context, debug);\n }\n return ComponentRegistryService.instance;\n }\n \n /**\n * Initialize the service with metadata\n */\n async initialize(contextUser?: UserInfo): Promise<void> {\n // Initialize metadata engine\n await this.componentEngine.Config(false, contextUser);\n }\n \n /**\n * Get a compiled component, using cache if available\n */\n async getCompiledComponent(\n componentId: string,\n referenceId?: string,\n contextUser?: UserInfo\n ): Promise<ComponentObject> {\n await this.initialize(contextUser);\n \n // Find component in metadata\n const component = this.componentEngine.Components.find((c: ComponentEntity) => c.ID === componentId);\n if (!component) {\n throw new Error(`Component not found: ${componentId}`);\n }\n \n const key = this.getComponentKey(component.Name, component.Namespace, component.Version, component.SourceRegistryID);\n \n // Check if already compiled and cached\n if (this.compiledComponentCache.has(key)) {\n const cached = this.compiledComponentCache.get(key)!;\n cached.lastUsed = new Date();\n cached.useCount++;\n \n // Track reference if provided\n if (referenceId) {\n this.addComponentReference(key, referenceId);\n }\n \n if (this.debug) {\n console.log(`✅ Reusing compiled component from cache: ${key} (use count: ${cached.useCount})`);\n }\n return cached.component;\n }\n \n // Not in cache, need to load and compile\n if (this.debug) {\n console.log(`🔄 Loading and compiling component: ${key}`);\n }\n \n // Get the component specification\n const spec = await this.getComponentSpec(componentId, contextUser);\n \n // Compile the component\n // Load all libraries from metadata engine\n const allLibraries = this.componentEngine.ComponentLibraries || [];\n \n const compilationResult = await this.compiler.compile({\n componentName: component.Name,\n componentCode: spec.code,\n libraries: spec.libraries,\n allLibraries\n });\n \n if (!compilationResult.success) {\n throw new Error(`Failed to compile component ${component.Name}: ${compilationResult.error}`);\n }\n \n // Cache the compiled component\n const metadata: RegistryComponentMetadata = {\n name: component.Name,\n namespace: component.Namespace || '',\n version: component.Version,\n description: component.Description || '',\n title: component.Title || undefined,\n type: component.Type || undefined,\n status: component.Status || undefined,\n properties: spec.properties,\n events: spec.events,\n libraries: spec.libraries,\n dependencies: spec.dependencies,\n sourceRegistryID: component.SourceRegistryID,\n isLocal: !component.SourceRegistryID\n };\n \n if (!compilationResult.component) {\n throw new Error(`Component compilation succeeded but no component returned`);\n }\n const compiledComponent = compilationResult.component.factory(this.runtimeContext);\n this.compiledComponentCache.set(key, {\n component: compiledComponent,\n metadata,\n compiledAt: new Date(),\n lastUsed: new Date(),\n useCount: 1\n });\n \n // Track reference\n if (referenceId) {\n this.addComponentReference(key, referenceId);\n }\n \n return compiledComponent;\n }\n \n /**\n * Get component specification from database or external registry\n */\n async getComponentSpec(\n componentId: string,\n contextUser?: UserInfo\n ): Promise<ComponentSpec> {\n await this.initialize(contextUser);\n \n const component = this.componentEngine.Components.find((c: ComponentEntity) => c.ID === componentId);\n if (!component) {\n throw new Error(`Component not found: ${componentId}`);\n }\n \n if (!component.SourceRegistryID) {\n // LOCAL: Use specification from database\n if (!component.Specification) {\n throw new Error(`Local component ${component.Name} has no specification`);\n }\n return JSON.parse(component.Specification);\n }\n \n // EXTERNAL: Check if we have a cached version\n if (component.Specification && component.LastSyncedAt) {\n // For now, always use cached version (no expiration)\n if (this.debug) {\n console.log(`Using cached external component: ${component.Name} (synced: ${component.LastSyncedAt})`);\n }\n return JSON.parse(component.Specification);\n }\n \n // Need to fetch from external registry\n const registry = this.componentEngine.ComponentRegistries?.find(\n r => r.ID === component.SourceRegistryID\n );\n \n if (!registry) {\n throw new Error(`Registry not found: ${component.SourceRegistryID}`);\n }\n \n if (!registry) {\n throw new Error(`Registry not found: ${component.SourceRegistryID}`);\n }\n \n const spec = await this.fetchFromExternalRegistry(\n registry.URI || '',\n component.Name,\n component.Namespace || '',\n component.Version,\n this.getRegistryApiKey(registry.ID) // API keys stored in env vars or secure config\n );\n \n // Store in local database for future use\n await this.cacheExternalComponent(componentId, spec, contextUser);\n \n return spec;\n }\n \n /**\n * Fetch component from external registry via HTTP\n */\n private async fetchFromExternalRegistry(\n uri: string,\n name: string,\n namespace: string,\n version: string,\n apiKey?: string\n ): Promise<ComponentSpec> {\n const url = `${uri}/components/${encodeURIComponent(namespace)}/${encodeURIComponent(name)}/${version}`;\n \n const headers: HeadersInit = {\n 'Accept': 'application/json'\n };\n \n if (apiKey) {\n headers['Authorization'] = `Bearer ${apiKey}`;\n }\n \n if (this.debug) {\n console.log(`Fetching from external registry: ${url}`);\n }\n \n const response = await fetch(url, { headers });\n \n if (!response.ok) {\n throw new Error(`Registry fetch failed: ${response.status} ${response.statusText}`);\n }\n \n const spec = await response.json() as ComponentSpec;\n return spec;\n }\n \n /**\n * Cache an external component in the local database\n */\n private async cacheExternalComponent(\n componentId: string,\n spec: ComponentSpec,\n contextUser?: UserInfo\n ): Promise<void> {\n // Get the actual entity object to save\n const md = new Metadata();\n const componentEntity = await md.GetEntityObject<ComponentEntity>('MJ: Components', contextUser);\n \n // Load the existing component\n if (!await componentEntity.Load(componentId)) {\n throw new Error(`Failed to load component entity: ${componentId}`);\n }\n \n // Update with fetched specification and all fields from spec\n componentEntity.Specification = JSON.stringify(spec);\n componentEntity.LastSyncedAt = new Date();\n \n // Set ReplicatedAt only on first fetch\n if (!componentEntity.ReplicatedAt) {\n componentEntity.ReplicatedAt = new Date();\n }\n \n // Update all fields from the spec with strong typing\n if (spec.name) {\n componentEntity.Name = spec.name;\n }\n \n if (spec.namespace) {\n componentEntity.Namespace = spec.namespace;\n }\n \n if (spec.version) {\n componentEntity.Version = spec.version;\n }\n \n if (spec.title) {\n componentEntity.Title = spec.title;\n }\n \n if (spec.description) {\n componentEntity.Description = spec.description;\n }\n \n if (spec.type) {\n // Map spec type to entity type (entity has specific enum values)\n const typeMap: Record<string, ComponentEntity['Type']> = {\n 'report': 'Report',\n 'dashboard': 'Dashboard',\n 'form': 'Form',\n 'table': 'Table',\n 'chart': 'Chart',\n 'navigation': 'Navigation',\n 'search': 'Search',\n 'widget': 'Widget',\n 'utility': 'Utility',\n 'other': 'Other'\n };\n \n const mappedType = typeMap[spec.type.toLowerCase()];\n if (mappedType) {\n componentEntity.Type = mappedType;\n }\n }\n \n if (spec.functionalRequirements) {\n componentEntity.FunctionalRequirements = spec.functionalRequirements;\n }\n \n if (spec.technicalDesign) {\n componentEntity.TechnicalDesign = spec.technicalDesign;\n }\n \n // Save back to database\n const result = await componentEntity.Save();\n if (!result) {\n throw new Error(`Failed to save cached component: ${componentEntity.Name}\\n${componentEntity.LatestResult.Message || componentEntity.LatestResult.Error || componentEntity.LatestResult.Errors?.join(',')}`);\n }\n \n if (this.debug) {\n console.log(`Cached external component: ${componentEntity.Name} at ${componentEntity.LastSyncedAt}`);\n }\n \n // Refresh metadata cache after saving\n await this.componentEngine.Config(true, contextUser);\n }\n \n /**\n * Load component dependencies from database\n */\n async loadDependencies(\n componentId: string,\n contextUser?: UserInfo\n ): Promise<ComponentDependencyInfo[]> {\n await this.initialize(contextUser);\n \n // Get dependencies from metadata cache\n const dependencies = this.componentEngine.ComponentDependencies?.filter(\n d => d.ComponentID === componentId\n ) || [];\n \n const result: ComponentDependencyInfo[] = [];\n \n for (const dep of dependencies) {\n // Find the dependency component\n const depComponent = this.componentEngine.Components.find(\n (c: ComponentEntity) => c.ID === dep.DependencyComponentID\n );\n \n if (depComponent) {\n result.push({\n name: depComponent.Name,\n namespace: depComponent.Namespace || '',\n version: depComponent.Version, // Version comes from the linked Component record\n isRequired: true, // All dependencies are required in MemberJunction\n location: depComponent.SourceRegistryID ? 'registry' : 'embedded',\n sourceRegistryID: depComponent.SourceRegistryID\n });\n }\n }\n \n return result;\n }\n \n /**\n * Resolve full dependency tree for a component\n */\n async resolveDependencyTree(\n componentId: string,\n contextUser?: UserInfo,\n visited = new Set<string>()\n ): Promise<DependencyTree> {\n if (visited.has(componentId)) {\n return { \n componentId, \n circular: true \n };\n }\n visited.add(componentId);\n \n await this.initialize(contextUser);\n \n const component = this.componentEngine.Components.find((c: ComponentEntity) => c.ID === componentId);\n if (!component) {\n return { componentId, dependencies: [] };\n }\n \n // Get direct dependencies\n const directDeps = await this.loadDependencies(componentId, contextUser);\n \n // Recursively resolve each dependency\n const dependencies: DependencyTree[] = [];\n for (const dep of directDeps) {\n // Find the dependency component\n const depComponent = this.componentEngine.Components.find(\n c => c.Name.trim().toLowerCase() === dep.name.trim().toLowerCase() && \n c.Namespace?.trim().toLowerCase() === dep.namespace?.trim().toLowerCase()\n );\n \n if (depComponent) {\n const subTree = await this.resolveDependencyTree(\n depComponent.ID, \n contextUser, \n visited\n );\n dependencies.push(subTree);\n }\n }\n \n return {\n componentId,\n name: component.Name,\n namespace: component.Namespace || undefined,\n version: component.Version,\n dependencies,\n totalCount: dependencies.reduce((sum, d) => sum + (d.totalCount || 1), 1)\n };\n }\n \n /**\n * Get components to load in dependency order\n */\n async getComponentsToLoad(\n rootComponentId: string,\n contextUser?: UserInfo\n ): Promise<string[]> {\n const tree = await this.resolveDependencyTree(rootComponentId, contextUser);\n \n // Flatten tree in dependency order (depth-first)\n const ordered: string[] = [];\n const processNode = (node: DependencyTree) => {\n if (node.dependencies) {\n node.dependencies.forEach(processNode);\n }\n if (!ordered.includes(node.componentId)) {\n ordered.push(node.componentId);\n }\n };\n processNode(tree);\n \n return ordered;\n }\n \n /**\n * Add a reference to a component\n */\n private addComponentReference(componentKey: string, referenceId: string): void {\n if (!this.componentReferences.has(componentKey)) {\n this.componentReferences.set(componentKey, new Set());\n }\n this.componentReferences.get(componentKey)!.add(referenceId);\n }\n \n /**\n * Remove a reference to a component\n */\n removeComponentReference(componentKey: string, referenceId: string): void {\n const refs = this.componentReferences.get(componentKey);\n if (refs) {\n refs.delete(referenceId);\n \n // If no more references and cache cleanup is enabled\n if (refs.size === 0) {\n this.considerCacheEviction(componentKey);\n }\n }\n }\n \n /**\n * Consider evicting a component from cache\n */\n private considerCacheEviction(componentKey: string): void {\n const cached = this.compiledComponentCache.get(componentKey);\n if (cached) {\n const timeSinceLastUse = Date.now() - cached.lastUsed.getTime();\n const evictionThreshold = 5 * 60 * 1000; // 5 minutes\n \n if (timeSinceLastUse > evictionThreshold) {\n if (this.debug) {\n console.log(`🗑️ Evicting unused component from cache: ${componentKey}`);\n }\n this.compiledComponentCache.delete(componentKey);\n }\n }\n }\n \n /**\n * Get API key for a registry from secure configuration\n * @param registryId - Registry ID\n * @returns API key or undefined\n */\n private getRegistryApiKey(registryId: string): string | undefined {\n // API keys should be stored in environment variables or secure configuration\n // Format: REGISTRY_API_KEY_{registryId} or similar\n // This is a placeholder - actual implementation would depend on the security infrastructure\n const envKey = `REGISTRY_API_KEY_${registryId.replace(/-/g, '_').toUpperCase()}`;\n return process.env[envKey];\n }\n \n /**\n * Get cache statistics\n */\n getCacheStats(): {\n compiledComponents: number;\n totalUseCount: number;\n memoryEstimate: string;\n } {\n let totalUseCount = 0;\n this.compiledComponentCache.forEach(cached => {\n totalUseCount += cached.useCount;\n });\n \n return {\n compiledComponents: this.compiledComponentCache.size,\n totalUseCount,\n memoryEstimate: `~${(this.compiledComponentCache.size * 50)}KB` // Rough estimate\n };\n }\n \n /**\n * Clear all caches\n */\n clearCache(): void {\n if (this.debug) {\n console.log('🧹 Clearing all component caches');\n }\n this.compiledComponentCache.clear();\n this.componentReferences.clear();\n }\n\n /**\n * Force clear all compiled components\n * Used for Component Studio to ensure fresh loads\n */\n forceClearAll(): void {\n this.compiledComponentCache.clear();\n this.componentReferences.clear();\n console.log('🧹 Component cache force cleared');\n }\n\n /**\n * Reset the singleton instance\n * Forces new instance creation on next access\n */\n static reset(): void {\n if (ComponentRegistryService.instance) {\n ComponentRegistryService.instance.forceClearAll();\n ComponentRegistryService.instance = null;\n }\n }\n \n /**\n * Generate a cache key for a component\n */\n private getComponentKey(\n name: string, \n namespace: string | null | undefined, \n version: string, \n sourceRegistryId: string | null | undefined\n ): string {\n const registryPart = sourceRegistryId || 'local';\n const namespacePart = namespace || 'global';\n return `${registryPart}/${namespacePart}/${name}@${version}`;\n }\n}"]}
@@ -1,20 +1,23 @@
1
1
  import { ComponentMetadata, RegistryConfig } from '../types';
2
+ import { ComponentObject } from '@memberjunction/interactive-component-types';
2
3
  export declare class ComponentRegistry {
3
4
  private registry;
4
5
  private config;
5
6
  private cleanupTimer?;
6
7
  private registryId;
7
8
  constructor(config?: Partial<RegistryConfig>);
8
- register(name: string, component: any, namespace?: string, version?: string, tags?: string[]): ComponentMetadata;
9
- get(name: string, namespace?: string, version?: string): any;
9
+ register(name: string, component: ComponentObject, namespace?: string, version?: string, tags?: string[]): ComponentMetadata;
10
+ get(name: string, namespace?: string, version?: string): ComponentObject | undefined;
10
11
  has(name: string, namespace?: string, version?: string): boolean;
11
12
  unregister(name: string, namespace?: string, version?: string): boolean;
12
13
  getNamespace(namespace: string): ComponentMetadata[];
13
- getAll(namespace?: string, version?: string): Record<string, any>;
14
+ getAll(namespace?: string, version?: string): Record<string, ComponentObject>;
14
15
  getNamespaces(): string[];
15
16
  getByTags(tags: string[]): ComponentMetadata[];
16
17
  release(name: string, namespace?: string, version?: string): void;
17
18
  clear(): void;
19
+ clearNamespace(namespace?: string): number;
20
+ forceClear(): void;
18
21
  size(): number;
19
22
  cleanup(force?: boolean): number;
20
23
  getStats(): {
@@ -1 +1 @@
1
- {"version":3,"file":"component-registry.d.ts","sourceRoot":"","sources":["../../src/registry/component-registry.ts"],"names":[],"mappings":"AAMA,OAAO,EAEL,iBAAiB,EACjB,cAAc,EACf,MAAM,UAAU,CAAC;AAiBlB,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAA6B;IAC7C,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,YAAY,CAAC,CAA0B;IAC/C,OAAO,CAAC,UAAU,CAAS;gBAMf,MAAM,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC;IAoB5C,QAAQ,CACN,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,GAAG,EACd,SAAS,GAAE,MAAiB,EAC5B,OAAO,GAAE,MAAa,EACtB,IAAI,CAAC,EAAE,MAAM,EAAE,GACd,iBAAiB;IAuCpB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,GAAE,MAAiB,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,GAAG;IAyBtE,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,GAAE,MAAiB,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO;IAe1E,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,GAAE,MAAiB,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO;IAejF,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,iBAAiB,EAA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AoBzB,OAAO,CAAC,QAAQ;IAsBhB,OAAO,CAAC,iBAAiB;IAczB,OAAO,CAAC,gBAAgB;CAMzB"}
@@ -115,6 +115,23 @@ class ComponentRegistry {
115
115
  clear() {
116
116
  this.registry.clear();
117
117
  }
118
+ clearNamespace(namespace = 'Global') {
119
+ const toRemove = [];
120
+ for (const [key, entry] of this.registry) {
121
+ if (entry.metadata.namespace === namespace) {
122
+ toRemove.push(key);
123
+ }
124
+ }
125
+ for (const key of toRemove) {
126
+ this.registry.delete(key);
127
+ }
128
+ return toRemove.length;
129
+ }
130
+ forceClear() {
131
+ this.stopCleanupTimer();
132
+ this.registry.clear();
133
+ console.log('🧹 Registry force cleared - all components removed');
134
+ }
118
135
  size() {
119
136
  return this.registry.size;
120
137
  }
@@ -1 +1 @@
1
- {"version":3,"file":"component-registry.js","sourceRoot":"","sources":["../../src/registry/component-registry.ts"],"names":[],"mappings":";;;AAWA,oEAAgE;AAKhE,MAAM,uBAAuB,GAAmB;IAC9C,aAAa,EAAE,IAAI;IACnB,eAAe,EAAE,KAAK;IACtB,MAAM,EAAE,IAAI;IACZ,gBAAgB,EAAE,IAAI;CACvB,CAAC;AAMF,MAAa,iBAAiB;IAU5B,YAAY,MAAgC;QAC1C,IAAI,CAAC,MAAM,GAAG,EAAE,GAAG,uBAAuB,EAAE,GAAG,MAAM,EAAE,CAAC;QACxD,IAAI,CAAC,QAAQ,GAAG,IAAI,GAAG,EAAE,CAAC;QAC1B,IAAI,CAAC,UAAU,GAAG,sBAAsB,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;QAGrD,IAAI,IAAI,CAAC,MAAM,CAAC,eAAe,GAAG,CAAC,EAAE,CAAC;YACpC,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAC3B,CAAC;IACH,CAAC;IAWD,QAAQ,CACN,IAAY,EACZ,SAAc,EACd,YAAoB,QAAQ,EAC5B,UAAkB,IAAI,EACtB,IAAe;QAEf,MAAM,EAAE,GAAG,IAAI,CAAC,m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view Platform-agnostic component registry for managing compiled React components.\n * Provides storage, retrieval, and lifecycle management for components with namespace support.\n * @module @memberjunction/react-runtime/registry\n */\n\nimport { \n RegistryEntry, \n ComponentMetadata, \n RegistryConfig \n} from '../types';\nimport { resourceManager } from '../utilities/resource-manager';\n\n/**\n * Default registry configuration\n */\nconst DEFAULT_REGISTRY_CONFIG: RegistryConfig = {\n maxComponents: 1000,\n cleanupInterval: 60000, // 1 minute\n useLRU: true,\n enableNamespaces: true\n};\n\n/**\n * Platform-agnostic component registry.\n * Manages compiled React components with namespace isolation and lifecycle management.\n */\nexport class ComponentRegistry {\n private registry: Map<string, RegistryEntry>;\n private config: RegistryConfig;\n private cleanupTimer?: NodeJS.Timeout | number;\n private registryId: string;\n \n /**\n * Creates a new ComponentRegistry instance\n * @param config - Optional registry configuration\n */\n constructor(config?: Partial<RegistryConfig>) {\n this.config = { ...DEFAULT_REGISTRY_CONFIG, ...config };\n this.registry = new Map();\n this.registryId = `component-registry-${Date.now()}`;\n \n // Start cleanup timer if configured\n if (this.config.cleanupInterval > 0) {\n this.startCleanupTimer();\n }\n }\n\n /**\n * Registers a compiled component\n * @param name - Component name\n * @param component - Compiled component\n * @param namespace - Component namespace (default: 'Global')\n * @param version - Component version (default: 'v1')\n * @param tags - Optional tags for categorization\n * @returns The registered component's metadata\n */\n register(\n name: string,\n component: any,\n namespace: string = 'Global',\n version: string = 'v1',\n tags?: string[]\n ): ComponentMetadata {\n const id = this.generateRegistryKey(name, namespace, version);\n \n // Create metadata\n const metadata: ComponentMetadata = {\n id,\n name,\n version,\n namespace,\n registeredAt: new Date(),\n tags\n };\n\n // Create registry entry\n const entry: RegistryEntry = {\n component,\n metadata,\n lastAccessed: new Date(),\n refCount: 0\n };\n\n // Check capacity\n if (this.registry.size >= this.config.maxComponents && this.config.useLRU) {\n this.evictLRU();\n }\n\n // Store in registry\n this.registry.set(id, entry);\n\n return metadata;\n }\n\n /**\n * Gets a component from the registry\n * @param name - Component name\n * @param namespace - Component namespace\n * @param version - Component version\n * @returns The component if found, undefined otherwise\n */\n get(name: string, namespace: string = 'Global', version?: string): any {\n const id = version \n ? this.generateRegistryKey(name, namespace, version)\n : this.findLatestVersion(name, namespace);\n\n if (!id) return undefined;\n\n const entry = this.registry.get(id);\n if (entry) {\n // Update access time and increment ref count\n entry.lastAccessed = new Date();\n entry.refCount++;\n return entry.component;\n }\n\n return undefined;\n }\n\n /**\n * Checks if a component exists in the registry\n * @param name - Component name\n * @param namespace - Component namespace\n * @param version - Component version\n * @returns true if the component exists\n */\n has(name: string, namespace: string = 'Global', version?: string): boolean {\n const id = version \n ? this.generateRegistryKey(name, namespace, version)\n : this.findLatestVersion(name, namespace);\n\n return id ? this.registry.has(id) : false;\n }\n\n /**\n * Removes a component from the registry\n * @param name - Component name\n * @param namespace - Component namespace\n * @param version - Component version\n * @returns true if the component was removed\n */\n unregister(name: string, namespace: string = 'Global', version?: string): boolean {\n const id = version \n ? this.generateRegistryKey(name, namespace, version)\n : this.findLatestVersion(name, namespace);\n\n if (!id) return false;\n\n return this.registry.delete(id);\n }\n\n /**\n * Gets all components in a namespace\n * @param namespace - Namespace to query\n * @returns Array of components in the namespace\n */\n getNamespace(namespace: string): ComponentMetadata[] {\n const components: ComponentMetadata[] = [];\n \n for (const entry of this.registry.values()) {\n if (entry.metadata.namespace === namespace) {\n components.push(entry.metadata);\n }\n }\n\n return components;\n }\n\n /**\n * Gets all components in a namespace and version as a map\n * @param namespace - Namespace to query (default: 'Global')\n * @param version - Version to query (default: 'v1')\n * @returns Object mapping component names to components\n */\n getAll(namespace: string = 'Global', version: string = 'v1'): Record<string, any> {\n const components: Record<string, any> = {};\n \n for (const entry of this.registry.values()) {\n if (entry.metadata.namespace === namespace && entry.metadata.version === version) {\n components[entry.metadata.name] = entry.component;\n }\n }\n\n return components;\n }\n\n /**\n * Gets all registered namespaces\n * @returns Array of unique namespace names\n */\n getNamespaces(): string[] {\n const namespaces = new Set<string>();\n \n for (const entry of this.registry.values()) {\n namespaces.add(entry.metadata.namespace);\n }\n\n return Array.from(namespaces);\n }\n\n /**\n * Gets components by tags\n * @param tags - Tags to search for\n * @returns Array of components matching any of the tags\n */\n getByTags(tags: string[]): ComponentMetadata[] {\n const components: ComponentMetadata[] = [];\n \n for (const entry of this.registry.values()) {\n if (entry.metadata.tags?.some(tag => tags.includes(tag))) {\n components.push(entry.metadata);\n }\n }\n\n return components;\n }\n\n /**\n * Decrements reference count for a component\n * @param name - Component name\n * @param namespace - Component namespace\n * @param version - Component version\n */\n release(name: string, namespace: string = 'Global', version?: string): void {\n const id = version \n ? this.generateRegistryKey(name, namespace, version)\n : this.findLatestVersion(name, namespace);\n\n if (!id) return;\n\n const entry = this.registry.get(id);\n if (entry && entry.refCount > 0) {\n entry.refCount--;\n }\n }\n\n /**\n * Clears all components from the registry\n */\n clear(): void {\n this.registry.clear();\n }\n\n /**\n * Gets the current size of the registry\n * @returns Number of registered components\n */\n size(): number {\n return this.registry.size;\n }\n\n /**\n * Performs cleanup of unused components\n * @param force - Force cleanup regardless of reference count\n * @returns Number of components removed\n */\n cleanup(force: boolean = false): number {\n const toRemove: string[] = [];\n const now = Date.now();\n\n for (const [id, entry] of this.registry) {\n // Remove if no references and hasn't been accessed recently\n const timeSinceAccess = now - entry.lastAccessed.getTime();\n const isUnused = entry.refCount === 0 && timeSinceAccess > this.config.cleanupInterval;\n\n if (force || isUnused) {\n toRemove.push(id);\n }\n }\n\n for (const id of toRemove) {\n this.registry.delete(id);\n }\n\n return toRemove.length;\n }\n\n /**\n * Gets registry statistics\n * @returns Object containing registry stats\n */\n getStats(): {\n totalComponents: number;\n namespaces: number;\n totalRefCount: number;\n oldestComponent?: Date;\n newestComponent?: Date;\n } {\n let totalRefCount = 0;\n let oldest: Date | undefined;\n let newest: Date | undefined;\n\n for (const entry of this.registry.values()) {\n totalRefCount += entry.refCount;\n \n if (!oldest || entry.metadata.registeredAt < oldest) {\n oldest = entry.metadata.registeredAt;\n }\n \n if (!newest || entry.metadata.registeredAt > newest) {\n newest = entry.metadata.registeredAt;\n }\n }\n\n return {\n totalComponents: this.registry.size,\n namespaces: this.getNamespaces().length,\n totalRefCount,\n oldestComponent: oldest,\n newestComponent: newest\n };\n }\n\n /**\n * Destroys the registry and cleans up resources\n */\n destroy(): void {\n this.stopCleanupTimer();\n this.clear();\n // Clean up any resources associated with this registry\n resourceManager.cleanupComponent(this.registryId);\n }\n\n /**\n * Generates a unique registry key\n * @param name - Component name\n * @param namespace - Component namespace\n * @param version - Component version\n * @returns Registry key\n */\n private generateRegistryKey(name: string, namespace: string, version: string): string {\n if (this.config.enableNamespaces) {\n return `${namespace}::${name}@${version}`;\n }\n return `${name}@${version}`;\n }\n\n /**\n * Finds the latest version of a component\n * @param name - Component name\n * @param namespace - Component namespace\n * @returns Registry key of latest version or undefined\n */\n private findLatestVersion(name: string, namespace: string): string | undefined {\n let latestKey: string | undefined;\n let latestDate: Date | undefined;\n\n for (const [key, entry] of this.registry) {\n if (entry.metadata.name === name && \n entry.metadata.namespace === namespace) {\n if (!latestDate || entry.metadata.registeredAt > latestDate) {\n latestDate = entry.metadata.registeredAt;\n latestKey = key;\n }\n }\n }\n\n return latestKey;\n }\n\n /**\n * Evicts the least recently used component\n */\n private evictLRU(): void {\n let lruKey: string | undefined;\n let lruTime: Date | undefined;\n\n for (const [key, entry] of this.registry) {\n // Skip components with active references\n if (entry.refCount > 0) continue;\n\n if (!lruTime || entry.lastAccessed < lruTime) {\n lruTime = entry.lastAccessed;\n lruKey = key;\n }\n }\n\n if (lruKey) {\n this.registry.delete(lruKey);\n }\n }\n\n /**\n * Starts the automatic cleanup timer\n */\n private startCleanupTimer(): void {\n this.cleanupTimer = resourceManager.setInterval(\n this.registryId,\n () => {\n this.cleanup();\n },\n this.config.cleanupInterval,\n { purpose: 'component-registry-cleanup' }\n );\n }\n\n /**\n * Stops the automatic cleanup timer\n */\n private stopCleanupTimer(): void {\n if (this.cleanupTimer) {\n resourceManager.clearInterval(this.registryId, this.cleanupTimer as number);\n this.cleanupTimer = undefined;\n }\n }\n}"]}
1
+ {"version":3,"file":"component-registry.js","sourceRoot":"","sources":["../../src/registry/component-registry.ts"],"names":[],"mappings":";;;AAYA,oEAAgE;AAKhE,MAAM,uBAAuB,GAAmB;IAC9C,aAAa,EAAE,IAAI;IACnB,eAAe,EAAE,KAAK;IACtB,MAAM,EAAE,IAAI;IACZ,gBAAgB,EAAE,IAAI;CACvB,CAAC;AAMF,MAAa,iBAAiB;IAU5B,YAAY,MAAgC;QAC1C,IAAI,CAAC,MAAM,GAAG,EAAE,GAAG,uBAAuB,EAAE,GAAG,MAAM,EAAE,CAAC;QACxD,IAAI,CAAC,QAAQ,GAAG,IAAI,GAAG,EAAE,CAAC;QAC1B,IAAI,CAAC,UAAU,GAAG,sBAAsB,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;QAGrD,IAAI,IAAI,CAAC,MAAM,CAAC,eAAe,GAAG,CAAC,EAAE,CAAC;YACpC,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAC3B,CAAC;IACH,CAAC;IAWD,QAAQ,CACN,IAAY,EACZ,SAA0B,EAC1B,YAAoB,QAAQ,EAC5B,UAAkB,IAAI,EACtB,IAAe;QAEf,MAAM,EAAE,GAAG,IAAI,CAAC,mBAAmB,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;QAG9D,MAAM,QAAQ,GAAsB;YAClC,EAAE;YACF,IAAI;YACJ,OAAO;YACP,SAAS;YACT,YAAY,EAAE,IAAI,IAAI,EAAE;YACxB,IAAI;SACL,CAAC;QAGF,MAAM,KAAK,GAAkB;YAC3B,SAAS;YACT,QAAQ;YACR,YAAY,EAAE,IAAI,IAAI,EAAE;YACxB,QAAQ,EAAE,CAAC;SACZ,CAAC;QAGF,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,aAAa,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;YAC1E,IAAI,CAA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C,aAAa,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,YAAsB,CAAC,CAAC;YAC5E,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC;QAChC,CAAC;IACH,CAAC;CACF;AAvZD,8CAuZC","sourcesContent":["/**\n * @fileoverview Platform-agnostic component registry for managing compiled React components.\n * Provides storage, retrieval, and lifecycle management for components with namespace support.\n * @module @memberjunction/react-runtime/registry\n */\n\nimport { \n RegistryEntry, \n ComponentMetadata, \n RegistryConfig \n} from '../types';\nimport { ComponentObject } from '@memberjunction/interactive-component-types';\nimport { resourceManager } from '../utilities/resource-manager';\n\n/**\n * Default registry configuration\n */\nconst DEFAULT_REGISTRY_CONFIG: RegistryConfig = {\n maxComponents: 1000,\n cleanupInterval: 60000, // 1 minute\n useLRU: true,\n enableNamespaces: true\n};\n\n/**\n * Platform-agnostic component registry.\n * Manages compiled React components with namespace isolation and lifecycle management.\n */\nexport class ComponentRegistry {\n private registry: Map<string, RegistryEntry>;\n private config: RegistryConfig;\n private cleanupTimer?: NodeJS.Timeout | number;\n private registryId: string;\n \n /**\n * Creates a new ComponentRegistry instance\n * @param config - Optional registry configuration\n */\n constructor(config?: Partial<RegistryConfig>) {\n this.config = { ...DEFAULT_REGISTRY_CONFIG, ...config };\n this.registry = new Map();\n this.registryId = `component-registry-${Date.now()}`;\n \n // Start cleanup timer if configured\n if (this.config.cleanupInterval > 0) {\n this.startCleanupTimer();\n }\n }\n\n /**\n * Registers a compiled component\n * @param name - Component name\n * @param component - Compiled component object\n * @param namespace - Component namespace (default: 'Global')\n * @param version - Component version (default: 'v1')\n * @param tags - Optional tags for categorization\n * @returns The registered component's metadata\n */\n register(\n name: string,\n component: ComponentObject,\n namespace: string = 'Global',\n version: string = 'v1',\n tags?: string[]\n ): ComponentMetadata {\n const id = this.generateRegistryKey(name, namespace, version);\n \n // Create metadata\n const metadata: ComponentMetadata = {\n id,\n name,\n version,\n namespace,\n registeredAt: new Date(),\n tags\n };\n\n // Create registry entry\n const entry: RegistryEntry = {\n component,\n metadata,\n lastAccessed: new Date(),\n refCount: 0\n };\n\n // Check capacity\n if (this.registry.size >= this.config.maxComponents && this.config.useLRU) {\n this.evictLRU();\n }\n\n // Store in registry\n this.registry.set(id, entry);\n\n return metadata;\n }\n\n /**\n * Gets a component from the registry\n * @param name - Component name\n * @param namespace - Component namespace\n * @param version - Component version\n * @returns The component object if found, undefined otherwise\n */\n get(name: string, namespace: string = 'Global', version?: string): ComponentObject | undefined {\n const id = version \n ? this.generateRegistryKey(name, namespace, version)\n : this.findLatestVersion(name, namespace);\n\n if (!id) return undefined;\n\n const entry = this.registry.get(id);\n if (entry) {\n // Update access time and increment ref count\n entry.lastAccessed = new Date();\n entry.refCount++;\n return entry.component;\n }\n\n return undefined;\n }\n\n /**\n * Checks if a component exists in the registry\n * @param name - Component name\n * @param namespace - Component namespace\n * @param version - Component version\n * @returns true if the component exists\n */\n has(name: string, namespace: string = 'Global', version?: string): boolean {\n const id = version \n ? this.generateRegistryKey(name, namespace, version)\n : this.findLatestVersion(name, namespace);\n\n return id ? this.registry.has(id) : false;\n }\n\n /**\n * Removes a component from the registry\n * @param name - Component name\n * @param namespace - Component namespace\n * @param version - Component version\n * @returns true if the component was removed\n */\n unregister(name: string, namespace: string = 'Global', version?: string): boolean {\n const id = version \n ? this.generateRegistryKey(name, namespace, version)\n : this.findLatestVersion(name, namespace);\n\n if (!id) return false;\n\n return this.registry.delete(id);\n }\n\n /**\n * Gets all components in a namespace\n * @param namespace - Namespace to query\n * @returns Array of components in the namespace\n */\n getNamespace(namespace: string): ComponentMetadata[] {\n const components: ComponentMetadata[] = [];\n \n for (const entry of this.registry.values()) {\n if (entry.metadata.namespace === namespace) {\n components.push(entry.metadata);\n }\n }\n\n return components;\n }\n\n /**\n * Gets all components in a namespace and version as a map\n * @param namespace - Namespace to query (default: 'Global')\n * @param version - Version to query (default: 'v1')\n * @returns Object mapping component names to component objects\n */\n getAll(namespace: string = 'Global', version: string = 'v1'): Record<string, ComponentObject> {\n const components: Record<string, ComponentObject> = {};\n \n for (const entry of this.registry.values()) {\n if (entry.metadata.namespace === namespace && entry.metadata.version === version) {\n components[entry.metadata.name] = entry.component;\n }\n }\n\n return components;\n }\n\n /**\n * Gets all registered namespaces\n * @returns Array of unique namespace names\n */\n getNamespaces(): string[] {\n const namespaces = new Set<string>();\n \n for (const entry of this.registry.values()) {\n namespaces.add(entry.metadata.namespace);\n }\n\n return Array.from(namespaces);\n }\n\n /**\n * Gets components by tags\n * @param tags - Tags to search for\n * @returns Array of components matching any of the tags\n */\n getByTags(tags: string[]): ComponentMetadata[] {\n const components: ComponentMetadata[] = [];\n \n for (const entry of this.registry.values()) {\n if (entry.metadata.tags?.some(tag => tags.includes(tag))) {\n components.push(entry.metadata);\n }\n }\n\n return components;\n }\n\n /**\n * Decrements reference count for a component\n * @param name - Component name\n * @param namespace - Component namespace\n * @param version - Component version\n */\n release(name: string, namespace: string = 'Global', version?: string): void {\n const id = version \n ? this.generateRegistryKey(name, namespace, version)\n : this.findLatestVersion(name, namespace);\n\n if (!id) return;\n\n const entry = this.registry.get(id);\n if (entry && entry.refCount > 0) {\n entry.refCount--;\n }\n }\n\n /**\n * Clears all components from the registry\n */\n clear(): void {\n this.registry.clear();\n }\n\n /**\n * Clear all components in a specific namespace\n * @param namespace - Namespace to clear (default: 'Global')\n * @returns Number of components removed\n */\n clearNamespace(namespace: string = 'Global'): number {\n const toRemove: string[] = [];\n for (const [key, entry] of this.registry) {\n if (entry.metadata.namespace === namespace) {\n toRemove.push(key);\n }\n }\n for (const key of toRemove) {\n this.registry.delete(key);\n }\n return toRemove.length;\n }\n\n /**\n * Force clear all components and reset registry\n * Used for development/testing scenarios\n */\n forceClear(): void {\n this.stopCleanupTimer();\n this.registry.clear();\n console.log('🧹 Registry force cleared - all components removed');\n }\n\n /**\n * Gets the current size of the registry\n * @returns Number of registered components\n */\n size(): number {\n return this.registry.size;\n }\n\n /**\n * Performs cleanup of unused components\n * @param force - Force cleanup regardless of reference count\n * @returns Number of components removed\n */\n cleanup(force: boolean = false): number {\n const toRemove: string[] = [];\n const now = Date.now();\n\n for (const [id, entry] of this.registry) {\n // Remove if no references and hasn't been accessed recently\n const timeSinceAccess = now - entry.lastAccessed.getTime();\n const isUnused = entry.refCount === 0 && timeSinceAccess > this.config.cleanupInterval;\n\n if (force || isUnused) {\n toRemove.push(id);\n }\n }\n\n for (const id of toRemove) {\n this.registry.delete(id);\n }\n\n return toRemove.length;\n }\n\n /**\n * Gets registry statistics\n * @returns Object containing registry stats\n */\n getStats(): {\n totalComponents: number;\n namespaces: number;\n totalRefCount: number;\n oldestComponent?: Date;\n newestComponent?: Date;\n } {\n let totalRefCount = 0;\n let oldest: Date | undefined;\n let newest: Date | undefined;\n\n for (const entry of this.registry.values()) {\n totalRefCount += entry.refCount;\n \n if (!oldest || entry.metadata.registeredAt < oldest) {\n oldest = entry.metadata.registeredAt;\n }\n \n if (!newest || entry.metadata.registeredAt > newest) {\n newest = entry.metadata.registeredAt;\n }\n }\n\n return {\n totalComponents: this.registry.size,\n namespaces: this.getNamespaces().length,\n totalRefCount,\n oldestComponent: oldest,\n newestComponent: newest\n };\n }\n\n /**\n * Destroys the registry and cleans up resources\n */\n destroy(): void {\n this.stopCleanupTimer();\n this.clear();\n // Clean up any resources associated with this registry\n resourceManager.cleanupComponent(this.registryId);\n }\n\n /**\n * Generates a unique registry key\n * @param name - Component name\n * @param namespace - Component namespace\n * @param version - Component version\n * @returns Registry key\n */\n private generateRegistryKey(name: string, namespace: string, version: string): string {\n if (this.config.enableNamespaces) {\n return `${namespace}::${name}@${version}`;\n }\n return `${name}@${version}`;\n }\n\n /**\n * Finds the latest version of a component\n * @param name - Component name\n * @param namespace - Component namespace\n * @returns Registry key of latest version or undefined\n */\n private findLatestVersion(name: string, namespace: string): string | undefined {\n let latestKey: string | undefined;\n let latestDate: Date | undefined;\n\n for (const [key, entry] of this.registry) {\n if (entry.metadata.name === name && \n entry.metadata.namespace === namespace) {\n if (!latestDate || entry.metadata.registeredAt > latestDate) {\n latestDate = entry.metadata.registeredAt;\n latestKey = key;\n }\n }\n }\n\n return latestKey;\n }\n\n /**\n * Evicts the least recently used component\n */\n private evictLRU(): void {\n let lruKey: string | undefined;\n let lruTime: Date | undefined;\n\n for (const [key, entry] of this.registry) {\n // Skip components with active references\n if (entry.refCount > 0) continue;\n\n if (!lruTime || entry.lastAccessed < lruTime) {\n lruTime = entry.lastAccessed;\n lruKey = key;\n }\n }\n\n if (lruKey) {\n this.registry.delete(lruKey);\n }\n }\n\n /**\n * Starts the automatic cleanup timer\n */\n private startCleanupTimer(): void {\n this.cleanupTimer = resourceManager.setInterval(\n this.registryId,\n () => {\n this.cleanup();\n },\n this.config.cleanupInterval,\n { purpose: 'component-registry-cleanup' }\n );\n }\n\n /**\n * Stops the automatic cleanup timer\n */\n private stopCleanupTimer(): void {\n if (this.cleanupTimer) {\n resourceManager.clearInterval(this.registryId, this.cleanupTimer as number);\n this.cleanupTimer = undefined;\n }\n }\n}"]}
@@ -13,7 +13,8 @@ export declare class ComponentResolver {
13
13
  private compiler;
14
14
  private runtimeContext;
15
15
  private componentEngine;
16
- constructor(registry: ComponentRegistry, compiler?: ComponentCompiler, runtimeContext?: RuntimeContext);
16
+ private debug;
17
+ constructor(registry: ComponentRegistry, compiler?: ComponentCompiler, runtimeContext?: RuntimeContext, debug?: boolean);
17
18
  resolveComponents(spec: ComponentSpec, namespace?: string, contextUser?: UserInfo): Promise<ResolvedComponents>;
18
19
  private resolveComponentHierarchy;
19
20
  cleanup(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"component-resolver.d.ts","sourceRoot":"","sources":["../../src/registry/component-resolver.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,cAA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