@aemforms/af-core 0.22.123 → 0.22.125
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.
- package/esm/afb-runtime.js +18 -4
- package/lib/Field.js +4 -2
- package/lib/rules/FunctionRuntime.js +15 -3
- package/package.json +2 -2
package/esm/afb-runtime.js
CHANGED
|
@@ -3144,10 +3144,14 @@ class FunctionRuntimeImpl {
|
|
|
3144
3144
|
let success;
|
|
3145
3145
|
let errorFn;
|
|
3146
3146
|
let payload = valueOf(args[2]);
|
|
3147
|
-
if (typeof (args[3]) === 'string') {
|
|
3147
|
+
if (typeof (args[3]) === 'string' && args.length === 5) {
|
|
3148
3148
|
success = valueOf(args[3]);
|
|
3149
3149
|
errorFn = valueOf(args[4]);
|
|
3150
3150
|
}
|
|
3151
|
+
else if (typeof (args[4]) === 'string' && args.length === 6) {
|
|
3152
|
+
success = valueOf(args[4]);
|
|
3153
|
+
errorFn = valueOf(args[5]);
|
|
3154
|
+
}
|
|
3151
3155
|
return async (retryOptions) => {
|
|
3152
3156
|
try {
|
|
3153
3157
|
if (payload instanceof Promise) {
|
|
@@ -3158,8 +3162,16 @@ class FunctionRuntimeImpl {
|
|
|
3158
3162
|
console.error('Error resolving payload Promise:', error);
|
|
3159
3163
|
throw error;
|
|
3160
3164
|
}
|
|
3161
|
-
let finalHeaders =
|
|
3162
|
-
let finalBody =
|
|
3165
|
+
let finalHeaders = {};
|
|
3166
|
+
let finalBody = {};
|
|
3167
|
+
if (args.length === 5) {
|
|
3168
|
+
finalBody = payload.body || {};
|
|
3169
|
+
finalHeaders = payload.headers || {};
|
|
3170
|
+
}
|
|
3171
|
+
else {
|
|
3172
|
+
finalBody = payload || {};
|
|
3173
|
+
finalHeaders = args[3] || {};
|
|
3174
|
+
}
|
|
3163
3175
|
if (retryOptions) {
|
|
3164
3176
|
if (retryOptions.body) {
|
|
3165
3177
|
finalBody = {
|
|
@@ -4177,7 +4189,9 @@ class Field extends Scriptable {
|
|
|
4177
4189
|
return this.executeExpression(this.displayValueExpression);
|
|
4178
4190
|
}
|
|
4179
4191
|
const df = this.displayFormat;
|
|
4180
|
-
if (df && this.isNotEmpty(this.value) &&
|
|
4192
|
+
if (df && this.isNotEmpty(this.value) &&
|
|
4193
|
+
this?.validity?.typeMismatch !== true &&
|
|
4194
|
+
((this.format === 'date' || this.format === 'date-time') ? this?.validity?.formatMismatch !== true : true)) {
|
|
4181
4195
|
try {
|
|
4182
4196
|
return format(this.value, this.lang, df);
|
|
4183
4197
|
}
|
package/lib/Field.js
CHANGED
|
@@ -316,12 +316,14 @@ class Field extends Scriptable_1.default {
|
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
318
|
get displayValue() {
|
|
319
|
-
var _a;
|
|
319
|
+
var _a, _b;
|
|
320
320
|
if (this.displayValueExpression && typeof this.displayValueExpression === 'string' && this.displayValueExpression.length !== 0) {
|
|
321
321
|
return this.executeExpression(this.displayValueExpression);
|
|
322
322
|
}
|
|
323
323
|
const df = this.displayFormat;
|
|
324
|
-
if (df && this.isNotEmpty(this.value) &&
|
|
324
|
+
if (df && this.isNotEmpty(this.value) &&
|
|
325
|
+
((_a = this === null || this === void 0 ? void 0 : this.validity) === null || _a === void 0 ? void 0 : _a.typeMismatch) !== true &&
|
|
326
|
+
((this.format === 'date' || this.format === 'date-time') ? ((_b = this === null || this === void 0 ? void 0 : this.validity) === null || _b === void 0 ? void 0 : _b.formatMismatch) !== true : true)) {
|
|
325
327
|
try {
|
|
326
328
|
return (0, af_formatters_1.format)(this.value, this.lang, df);
|
|
327
329
|
}
|
|
@@ -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 =
|
|
523
|
-
let finalBody =
|
|
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.
|
|
3
|
+
"version": "0.22.125",
|
|
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.
|
|
40
|
+
"@aemforms/af-formatters": "^0.22.125"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@babel/preset-env": "^7.20.2",
|