@memberjunction/react-runtime 2.89.0 → 2.91.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 (84) hide show
  1. package/.turbo/turbo-build.log +29 -1
  2. package/CHANGELOG.md +30 -0
  3. package/dist/compiler/babel-config.js +1 -0
  4. package/dist/compiler/babel-config.js.map +1 -0
  5. package/dist/compiler/component-compiler.d.ts +3 -0
  6. package/dist/compiler/component-compiler.d.ts.map +1 -1
  7. package/dist/compiler/component-compiler.js +159 -8
  8. package/dist/compiler/component-compiler.js.map +1 -0
  9. package/dist/compiler/index.js +1 -0
  10. package/dist/compiler/index.js.map +1 -0
  11. package/dist/index.d.ts +1 -1
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +4 -4
  14. package/dist/index.js.map +1 -0
  15. package/dist/registry/component-registry.d.ts +1 -0
  16. package/dist/registry/component-registry.d.ts.map +1 -1
  17. package/dist/registry/component-registry.js +10 -0
  18. package/dist/registry/component-registry.js.map +1 -0
  19. package/dist/registry/component-resolver.js +1 -0
  20. package/dist/registry/component-resolver.js.map +1 -0
  21. package/dist/registry/index.js +1 -0
  22. package/dist/registry/index.js.map +1 -0
  23. package/dist/runtime/component-hierarchy.d.ts +7 -4
  24. package/dist/runtime/component-hierarchy.d.ts.map +1 -1
  25. package/dist/runtime/component-hierarchy.js +20 -6
  26. package/dist/runtime/component-hierarchy.js.map +1 -0
  27. package/dist/runtime/error-boundary.js +1 -0
  28. package/dist/runtime/error-boundary.js.map +1 -0
  29. package/dist/runtime/index.js +1 -0
  30. package/dist/runtime/index.js.map +1 -0
  31. package/dist/runtime/prop-builder.d.ts +2 -1
  32. package/dist/runtime/prop-builder.d.ts.map +1 -1
  33. package/dist/runtime/prop-builder.js +1 -0
  34. package/dist/runtime/prop-builder.js.map +1 -0
  35. package/dist/runtime/react-root-manager.js +1 -0
  36. package/dist/runtime/react-root-manager.js.map +1 -0
  37. package/dist/runtime.umd.js +2 -0
  38. package/dist/runtime.umd.js.LICENSE.txt +10 -0
  39. package/dist/types/index.d.ts +4 -5
  40. package/dist/types/index.d.ts.map +1 -1
  41. package/dist/types/index.js +1 -0
  42. package/dist/types/index.js.map +1 -0
  43. package/dist/types/library-config.js +1 -0
  44. package/dist/types/library-config.js.map +1 -0
  45. package/dist/utilities/cache-manager.js +1 -0
  46. package/dist/utilities/cache-manager.js.map +1 -0
  47. package/dist/utilities/component-error-analyzer.js +1 -0
  48. package/dist/utilities/component-error-analyzer.js.map +1 -0
  49. package/dist/utilities/component-styles.js +1 -0
  50. package/dist/utilities/component-styles.js.map +1 -0
  51. package/dist/utilities/core-libraries.js +1 -0
  52. package/dist/utilities/core-libraries.js.map +1 -0
  53. package/dist/utilities/index.d.ts +1 -1
  54. package/dist/utilities/index.d.ts.map +1 -1
  55. package/dist/utilities/index.js +2 -1
  56. package/dist/utilities/index.js.map +1 -0
  57. package/dist/utilities/library-loader.d.ts.map +1 -1
  58. package/dist/utilities/library-loader.js +15 -0
  59. package/dist/utilities/library-loader.js.map +1 -0
  60. package/dist/utilities/library-registry.d.ts +24 -0
  61. package/dist/utilities/library-registry.d.ts.map +1 -0
  62. package/dist/utilities/library-registry.js +74 -0
  63. package/dist/utilities/library-registry.js.map +1 -0
  64. package/dist/utilities/resource-manager.js +1 -0
  65. package/dist/utilities/resource-manager.js.map +1 -0
  66. package/dist/utilities/standard-libraries.js +1 -0
  67. package/dist/utilities/standard-libraries.js.map +1 -0
  68. package/package.json +16 -6
  69. package/src/compiler/component-compiler.ts +238 -9
  70. package/src/index.ts +5 -4
  71. package/src/registry/component-registry.ts +18 -0
  72. package/src/runtime/component-hierarchy.ts +29 -8
  73. package/src/runtime/prop-builder.ts +3 -2
  74. package/src/types/index.ts +12 -11
  75. package/src/utilities/index.ts +1 -1
  76. package/src/utilities/library-loader.ts +18 -0
  77. package/src/utilities/library-registry.ts +149 -0
  78. package/tsconfig.json +1 -0
  79. package/tsconfig.tsbuildinfo +1 -1
  80. package/webpack.umd.config.js +76 -0
  81. package/dist/utilities/runtime-utilities.d.ts +0 -10
  82. package/dist/utilities/runtime-utilities.d.ts.map +0 -1
  83. package/dist/utilities/runtime-utilities.js +0 -92
  84. package/src/utilities/runtime-utilities.ts +0 -122
@@ -0,0 +1,76 @@
1
+ const path = require('path');
2
+
3
+ module.exports = {
4
+ entry: './dist/index.js', // Use the compiled TypeScript output
5
+ output: {
6
+ path: path.resolve(__dirname, 'dist'),
7
+ filename: 'runtime.umd.js',
8
+ library: 'MJReactRuntime',
9
+ libraryTarget: 'umd',
10
+ globalObject: 'this'
11
+ },
12
+ mode: 'production',
13
+ target: 'web',
14
+ resolve: {
15
+ extensions: ['.js', '.json'],
16
+ fallback: {
17
+ // Browser polyfills for Node.js modules
18
+ "path": require.resolve("path-browserify"),
19
+ "fs": false,
20
+ "crypto": false,
21
+ "stream": false,
22
+ "util": false,
23
+ "buffer": false,
24
+ "process": false
25
+ }
26
+ },
27
+ module: {
28
+ rules: [
29
+ {
30
+ test: /\.js$/,
31
+ exclude: /node_modules\/(?!@memberjunction)/,
32
+ use: {
33
+ loader: 'babel-loader',
34
+ options: {
35
+ presets: [
36
+ ['@babel/preset-env', {
37
+ targets: {
38
+ browsers: ['last 2 versions', 'ie >= 11']
39
+ }
40
+ }]
41
+ ]
42
+ }
43
+ }
44
+ }
45
+ ]
46
+ },
47
+ externals: {
48
+ // These are expected to be available in the browser environment
49
+ 'react': {
50
+ commonjs: 'react',
51
+ commonjs2: 'react',
52
+ amd: 'react',
53
+ root: 'React'
54
+ },
55
+ 'react-dom': {
56
+ commonjs: 'react-dom',
57
+ commonjs2: 'react-dom',
58
+ amd: 'react-dom',
59
+ root: 'ReactDOM'
60
+ },
61
+ '@babel/standalone': {
62
+ commonjs: '@babel/standalone',
63
+ commonjs2: '@babel/standalone',
64
+ amd: '@babel/standalone',
65
+ root: 'Babel'
66
+ }
67
+ },
68
+ optimization: {
69
+ minimize: true
70
+ },
71
+ performance: {
72
+ hints: false,
73
+ maxAssetSize: 500000, // 500kb
74
+ maxEntrypointSize: 500000
75
+ }
76
+ };
@@ -1,10 +0,0 @@
1
- import { ComponentUtilities } from '@memberjunction/interactive-component-types';
2
- export declare class RuntimeUtilities {
3
- buildUtilities(): ComponentUtilities;
4
- private SetupUtilities;
5
- private CreateSimpleMetadata;
6
- private CreateSimpleRunQuery;
7
- private CreateSimpleRunView;
8
- }
9
- export declare function createRuntimeUtilities(): RuntimeUtilities;
10
- //# sourceMappingURL=runtime-utilities.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"runtime-utilities.d.ts","sourceRoot":"","sources":["../../src/utilities/runtime-utilities.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,kBAAkB,EAAiD,MAAM,6CAA6C,CAAC;AAOhI,qBACa,gBAAgB;IAKpB,cAAc,IAAI,kBAAkB;IAQ3C,OAAO,CAAC,cAAc;IAWtB,OAAO,CAAC,oBAAoB;IAS5B,OAAO,CAAC,oBAAoB;IAe5B,OAAO,CAAC,mBAAmB;CAwB5B;AAOD,wBAAgB,sBAAsB,IAAI,gBAAgB,CAmBzD"}
@@ -1,92 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.createRuntimeUtilities = exports.RuntimeUtilities = void 0;
10
- const core_1 = require("@memberjunction/core");
11
- const global_1 = require("@memberjunction/global");
12
- let RuntimeUtilities = class RuntimeUtilities {
13
- buildUtilities() {
14
- const md = new core_1.Metadata();
15
- return this.SetupUtilities(md);
16
- }
17
- SetupUtilities(md) {
18
- const rv = new core_1.RunView();
19
- const rq = new core_1.RunQuery();
20
- const u = {
21
- md: this.CreateSimpleMetadata(md),
22
- rv: this.CreateSimpleRunView(rv),
23
- rq: this.CreateSimpleRunQuery(rq)
24
- };
25
- return u;
26
- }
27
- CreateSimpleMetadata(md) {
28
- return {
29
- Entities: md.Entities,
30
- GetEntityObject: (entityName) => {
31
- return md.GetEntityObject(entityName);
32
- }
33
- };
34
- }
35
- CreateSimpleRunQuery(rq) {
36
- return {
37
- RunQuery: async (params) => {
38
- try {
39
- const result = await rq.RunQuery(params);
40
- return result;
41
- }
42
- catch (error) {
43
- (0, core_1.LogError)(error);
44
- throw error;
45
- }
46
- }
47
- };
48
- }
49
- CreateSimpleRunView(rv) {
50
- return {
51
- RunView: async (params) => {
52
- try {
53
- const result = await rv.RunView(params);
54
- return result;
55
- }
56
- catch (error) {
57
- (0, core_1.LogError)(error);
58
- throw error;
59
- }
60
- },
61
- RunViews: async (params) => {
62
- try {
63
- const results = await rv.RunViews(params);
64
- return results;
65
- }
66
- catch (error) {
67
- (0, core_1.LogError)(error);
68
- throw error;
69
- }
70
- }
71
- };
72
- }
73
- };
74
- exports.RuntimeUtilities = RuntimeUtilities;
75
- exports.RuntimeUtilities = RuntimeUtilities = __decorate([
76
- (0, global_1.RegisterClass)(RuntimeUtilities, 'RuntimeUtilities')
77
- ], RuntimeUtilities);
78
- function createRuntimeUtilities() {
79
- if (typeof window === 'undefined') {
80
- try {
81
- const obj = global_1.MJGlobal.Instance.ClassFactory.CreateInstance(RuntimeUtilities);
82
- if (!obj) {
83
- throw new Error('Failed to create RuntimeUtilities instance');
84
- }
85
- return obj;
86
- }
87
- catch (e) {
88
- }
89
- }
90
- return new RuntimeUtilities();
91
- }
92
- exports.createRuntimeUtilities = createRuntimeUtilities;
@@ -1,122 +0,0 @@
1
- /**
2
- * @fileoverview Runtime utilities for React components providing access to MemberJunction core functionality
3
- * @module @memberjunction/react-runtime/utilities
4
- */
5
-
6
- import {
7
- Metadata,
8
- RunView,
9
- RunQuery,
10
- RunViewParams,
11
- RunQueryParams,
12
- LogError
13
- } from '@memberjunction/core';
14
-
15
- import { MJGlobal, RegisterClass } from '@memberjunction/global';
16
- import { ComponentUtilities, SimpleMetadata, SimpleRunQuery, SimpleRunView } from '@memberjunction/interactive-component-types';
17
-
18
- /**
19
- * Base class for providing runtime utilities to React components.
20
- * This class can be extended and registered with MJ's ClassFactory
21
- * to provide custom implementations of data access methods.
22
- */
23
- @RegisterClass(RuntimeUtilities, 'RuntimeUtilities')
24
- export class RuntimeUtilities {
25
- /**
26
- * Builds the complete utilities object for React components
27
- * This is the main method that components will use
28
- */
29
- public buildUtilities(): ComponentUtilities {
30
- const md = new Metadata();
31
- return this.SetupUtilities(md);
32
- }
33
-
34
- /**
35
- * Sets up the utilities object - copied from skip-chat implementation
36
- */
37
- private SetupUtilities(md: Metadata): ComponentUtilities {
38
- const rv = new RunView();
39
- const rq = new RunQuery();
40
- const u: ComponentUtilities = {
41
- md: this.CreateSimpleMetadata(md),
42
- rv: this.CreateSimpleRunView(rv),
43
- rq: this.CreateSimpleRunQuery(rq)
44
- };
45
- return u;
46
- }
47
-
48
- private CreateSimpleMetadata(md: Metadata): SimpleMetadata {
49
- return {
50
- Entities: md.Entities,
51
- GetEntityObject: (entityName: string) => {
52
- return md.GetEntityObject(entityName)
53
- }
54
- }
55
- }
56
-
57
- private CreateSimpleRunQuery(rq: RunQuery): SimpleRunQuery {
58
- return {
59
- RunQuery: async (params: RunQueryParams) => {
60
- // Run a single query and return the results
61
- try {
62
- const result = await rq.RunQuery(params);
63
- return result;
64
- } catch (error) {
65
- LogError(error);
66
- throw error; // Re-throw to handle it in the caller
67
- }
68
- }
69
- }
70
- }
71
-
72
- private CreateSimpleRunView(rv: RunView): SimpleRunView {
73
- return {
74
- RunView: async (params: RunViewParams) => {
75
- // Run a single view and return the results
76
- try {
77
- const result = await rv.RunView(params);
78
- return result;
79
- } catch (error) {
80
- LogError(error);
81
- throw error; // Re-throw to handle it in the caller
82
- }
83
- },
84
- RunViews: async (params: RunViewParams[]) => {
85
- // Runs multiple views and returns the results
86
- try {
87
- const results = await rv.RunViews(params);
88
- return results;
89
- } catch (error) {
90
- LogError(error);
91
- throw error; // Re-throw to handle it in the caller
92
- }
93
- }
94
- }
95
- }
96
- }
97
-
98
- /**
99
- * Factory function to create RuntimeUtilities
100
- * In a Node.js environment, this will use MJ's ClassFactory for runtime substitution
101
- * In a browser environment, it will use the base class directly
102
- */
103
- export function createRuntimeUtilities(): RuntimeUtilities {
104
- // Check if we're in a Node.js environment with MJGlobal available
105
- if (typeof window === 'undefined') {
106
- try {
107
- // Use ClassFactory to get the registered class, defaulting to base RuntimeUtilities
108
- const obj = MJGlobal.Instance.ClassFactory.CreateInstance<RuntimeUtilities>(RuntimeUtilities);
109
- if (!obj) {
110
- throw new Error('Failed to create RuntimeUtilities instance');
111
- }
112
-
113
- // Ensure the object is an instance of RuntimeUtilities
114
- return obj;
115
- } catch (e) {
116
- // Fall through to default
117
- }
118
- }
119
-
120
- // Default: just use the base class
121
- return new RuntimeUtilities();
122
- }