@aemforms/af-core 0.22.124 → 0.22.126

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.
@@ -1584,26 +1584,31 @@ class BaseNode {
1584
1584
  _data = NullDataValue;
1585
1585
  }
1586
1586
  else if (dataRef !== undefined && !this.repeatable) {
1587
- if (this._tokens.length === 0) {
1588
- this._tokens = tokenize(dataRef);
1589
- }
1590
- let searchData = contextualDataModel;
1591
- if (this._tokens[0].type === TOK_GLOBAL) {
1592
- searchData = this.form.getDataNode();
1593
- }
1594
- else if (this._tokens[0].type === TOK_REPEATABLE) {
1595
- let repeatRoot = this.parent;
1596
- while (!repeatRoot.repeatable && repeatRoot !== this.form) {
1597
- repeatRoot = repeatRoot.parent;
1587
+ try {
1588
+ if (this._tokens.length === 0) {
1589
+ this._tokens = tokenize(dataRef);
1590
+ }
1591
+ let searchData = contextualDataModel;
1592
+ if (this._tokens[0].type === TOK_GLOBAL) {
1593
+ searchData = this.form.getDataNode();
1594
+ }
1595
+ else if (this._tokens[0].type === TOK_REPEATABLE) {
1596
+ let repeatRoot = this.parent;
1597
+ while (!repeatRoot.repeatable && repeatRoot !== this.form) {
1598
+ repeatRoot = repeatRoot.parent;
1599
+ }
1600
+ searchData = repeatRoot.getDataNode();
1601
+ }
1602
+ if (typeof searchData !== 'undefined') {
1603
+ const name = this._tokens[this._tokens.length - 1].value;
1604
+ const create = this.defaultDataModel(name);
1605
+ _data = resolveData(searchData, this._tokens, create);
1606
+ _parent = resolveData(searchData, this._tokens.slice(0, -1));
1607
+ _key = name;
1598
1608
  }
1599
- searchData = repeatRoot.getDataNode();
1600
1609
  }
1601
- if (typeof searchData !== 'undefined') {
1602
- const name = this._tokens[this._tokens.length - 1].value;
1603
- const create = this.defaultDataModel(name);
1604
- _data = resolveData(searchData, this._tokens, create);
1605
- _parent = resolveData(searchData, this._tokens.slice(0, -1));
1606
- _key = name;
1610
+ catch (error) {
1611
+ console.error(`Error parsing dataRef "${dataRef}" for field "${this.id}". The data of this field will not be exported.`);
1607
1612
  }
1608
1613
  }
1609
1614
  else {
@@ -3144,10 +3149,14 @@ class FunctionRuntimeImpl {
3144
3149
  let success;
3145
3150
  let errorFn;
3146
3151
  let payload = valueOf(args[2]);
3147
- if (typeof (args[3]) === 'string') {
3152
+ if (typeof (args[3]) === 'string' && args.length === 5) {
3148
3153
  success = valueOf(args[3]);
3149
3154
  errorFn = valueOf(args[4]);
3150
3155
  }
3156
+ else if (typeof (args[4]) === 'string' && args.length === 6) {
3157
+ success = valueOf(args[4]);
3158
+ errorFn = valueOf(args[5]);
3159
+ }
3151
3160
  return async (retryOptions) => {
3152
3161
  try {
3153
3162
  if (payload instanceof Promise) {
@@ -3158,8 +3167,16 @@ class FunctionRuntimeImpl {
3158
3167
  console.error('Error resolving payload Promise:', error);
3159
3168
  throw error;
3160
3169
  }
3161
- let finalHeaders = payload.headers || {};
3162
- let finalBody = payload.body || {};
3170
+ let finalHeaders = {};
3171
+ let finalBody = {};
3172
+ if (args.length === 5) {
3173
+ finalBody = payload.body || {};
3174
+ finalHeaders = payload.headers || {};
3175
+ }
3176
+ else {
3177
+ finalBody = payload || {};
3178
+ finalHeaders = args[3] || {};
3179
+ }
3163
3180
  if (retryOptions) {
3164
3181
  if (retryOptions.body) {
3165
3182
  finalBody = {
package/lib/BaseNode.js CHANGED
@@ -380,26 +380,31 @@ class BaseNode {
380
380
  _data = EmptyDataValue_1.default;
381
381
  }
382
382
  else if (dataRef !== undefined && !this.repeatable) {
383
- if (this._tokens.length === 0) {
384
- this._tokens = (0, DataRefParser_1.tokenize)(dataRef);
385
- }
386
- let searchData = contextualDataModel;
387
- if (this._tokens[0].type === DataRefParser_1.TOK_GLOBAL) {
388
- searchData = this.form.getDataNode();
389
- }
390
- else if (this._tokens[0].type === DataRefParser_1.TOK_REPEATABLE) {
391
- let repeatRoot = this.parent;
392
- while (!repeatRoot.repeatable && repeatRoot !== this.form) {
393
- repeatRoot = repeatRoot.parent;
383
+ try {
384
+ if (this._tokens.length === 0) {
385
+ this._tokens = (0, DataRefParser_1.tokenize)(dataRef);
386
+ }
387
+ let searchData = contextualDataModel;
388
+ if (this._tokens[0].type === DataRefParser_1.TOK_GLOBAL) {
389
+ searchData = this.form.getDataNode();
390
+ }
391
+ else if (this._tokens[0].type === DataRefParser_1.TOK_REPEATABLE) {
392
+ let repeatRoot = this.parent;
393
+ while (!repeatRoot.repeatable && repeatRoot !== this.form) {
394
+ repeatRoot = repeatRoot.parent;
395
+ }
396
+ searchData = repeatRoot.getDataNode();
397
+ }
398
+ if (typeof searchData !== 'undefined') {
399
+ const name = this._tokens[this._tokens.length - 1].value;
400
+ const create = this.defaultDataModel(name);
401
+ _data = (0, DataRefParser_1.resolveData)(searchData, this._tokens, create);
402
+ _parent = (0, DataRefParser_1.resolveData)(searchData, this._tokens.slice(0, -1));
403
+ _key = name;
394
404
  }
395
- searchData = repeatRoot.getDataNode();
396
405
  }
397
- if (typeof searchData !== 'undefined') {
398
- const name = this._tokens[this._tokens.length - 1].value;
399
- const create = this.defaultDataModel(name);
400
- _data = (0, DataRefParser_1.resolveData)(searchData, this._tokens, create);
401
- _parent = (0, DataRefParser_1.resolveData)(searchData, this._tokens.slice(0, -1));
402
- _key = name;
406
+ catch (error) {
407
+ console.error(`Error parsing dataRef "${dataRef}" for field "${this.id}". The data of this field will not be exported.`);
403
408
  }
404
409
  }
405
410
  else {
@@ -505,10 +505,14 @@ class FunctionRuntimeImpl {
505
505
  let success;
506
506
  let errorFn;
507
507
  let payload = valueOf(args[2]);
508
- if (typeof (args[3]) === 'string') {
508
+ if (typeof (args[3]) === 'string' && args.length === 5) {
509
509
  success = valueOf(args[3]);
510
510
  errorFn = valueOf(args[4]);
511
511
  }
512
+ else if (typeof (args[4]) === 'string' && args.length === 6) {
513
+ success = valueOf(args[4]);
514
+ errorFn = valueOf(args[5]);
515
+ }
512
516
  return (retryOptions) => __awaiter(this, void 0, void 0, function* () {
513
517
  try {
514
518
  if (payload instanceof Promise) {
@@ -519,8 +523,16 @@ class FunctionRuntimeImpl {
519
523
  console.error('Error resolving payload Promise:', error);
520
524
  throw error;
521
525
  }
522
- let finalHeaders = payload.headers || {};
523
- let finalBody = payload.body || {};
526
+ let finalHeaders = {};
527
+ let finalBody = {};
528
+ if (args.length === 5) {
529
+ finalBody = payload.body || {};
530
+ finalHeaders = payload.headers || {};
531
+ }
532
+ else {
533
+ finalBody = payload || {};
534
+ finalHeaders = args[3] || {};
535
+ }
524
536
  if (retryOptions) {
525
537
  if (retryOptions.body) {
526
538
  finalBody = Object.assign(Object.assign({}, finalBody), retryOptions.body);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aemforms/af-core",
3
- "version": "0.22.124",
3
+ "version": "0.22.126",
4
4
  "description": "Core Module for Forms Runtime",
5
5
  "author": "Adobe Systems",
6
6
  "license": "Adobe Proprietary",
@@ -37,7 +37,7 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@adobe/json-formula": "0.1.50",
40
- "@aemforms/af-formatters": "^0.22.124"
40
+ "@aemforms/af-formatters": "^0.22.126"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@babel/preset-env": "^7.20.2",