@aemforms/af-core 0.22.58 → 0.22.60

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.
@@ -8,7 +8,7 @@ export declare type FunctionDefinition = {
8
8
  };
9
9
  declare class FunctionRuntimeImpl {
10
10
  private static instance;
11
- private static customFunctions;
11
+ private customFunctions;
12
12
  private constructor();
13
13
  static getInstance(): FunctionRuntimeImpl;
14
14
  registerFunctions(functions: {
@@ -165,6 +165,7 @@ const createAction = (name, payload = {}) => {
165
165
  };
166
166
  class FunctionRuntimeImpl {
167
167
  constructor() {
168
+ this.customFunctions = {};
168
169
  }
169
170
  static getInstance() {
170
171
  if (!FunctionRuntimeImpl.instance) {
@@ -181,7 +182,7 @@ class FunctionRuntimeImpl {
181
182
  const globals = {
182
183
  form: interpreter.globals.form,
183
184
  invoke: (funcName, ...args) => {
184
- return FunctionRuntimeImpl.customFunctions[funcName]._func.call(undefined, args, data, interpreter);
185
+ return FunctionRuntimeImpl.getInstance().customFunctions[funcName]._func.call(undefined, args, data, interpreter);
185
186
  }
186
187
  };
187
188
  return funcDef(...args, globals);
@@ -193,13 +194,13 @@ class FunctionRuntimeImpl {
193
194
  console.warn(`Unable to register function with name ${name}.`);
194
195
  return;
195
196
  }
196
- FunctionRuntimeImpl.customFunctions[name] = finalFunction;
197
+ FunctionRuntimeImpl.getInstance().customFunctions[name] = finalFunction;
197
198
  });
198
199
  }
199
200
  unregisterFunctions(...names) {
200
201
  names.forEach(name => {
201
- if (name in FunctionRuntimeImpl.customFunctions) {
202
- delete FunctionRuntimeImpl.customFunctions[name];
202
+ if (name in FunctionRuntimeImpl.getInstance().customFunctions) {
203
+ FunctionRuntimeImpl === null || FunctionRuntimeImpl === void 0 ? true : delete FunctionRuntimeImpl.getInstance().customFunctions[name];
203
204
  }
204
205
  });
205
206
  }
@@ -377,9 +378,8 @@ class FunctionRuntimeImpl {
377
378
  _signature: []
378
379
  }
379
380
  };
380
- return Object.assign(Object.assign({}, defaultFunctions), FunctionRuntimeImpl.customFunctions);
381
+ return Object.assign(Object.assign({}, defaultFunctions), FunctionRuntimeImpl.getInstance().customFunctions);
381
382
  }
382
383
  }
383
384
  FunctionRuntimeImpl.instance = null;
384
- FunctionRuntimeImpl.customFunctions = {};
385
385
  exports.FunctionRuntime = FunctionRuntimeImpl.getInstance();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aemforms/af-core",
3
- "version": "0.22.58",
3
+ "version": "0.22.60",
4
4
  "description": "Core Module for Forms Runtime",
5
5
  "author": "Adobe Systems",
6
6
  "license": "Adobe Proprietary",
@@ -35,7 +35,7 @@
35
35
  },
36
36
  "dependencies": {
37
37
  "@adobe/json-formula": "0.1.50",
38
- "@aemforms/af-formatters": "^0.22.58"
38
+ "@aemforms/af-formatters": "^0.22.60"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@babel/preset-env": "^7.20.2",