@aemforms/af-core 0.22.147 → 0.22.148

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.
@@ -2958,12 +2958,12 @@ const request = async (context, uri, httpVerb, payload, success, error, headers)
2958
2958
  }
2959
2959
  return response;
2960
2960
  }
2961
- catch (error) {
2962
- context.form.logger.error('Network error while invoking a rest API:', error);
2961
+ catch (networkError) {
2962
+ context.form.logger.error('Network error while invoking a rest API:', networkError);
2963
2963
  const networkErrorResponse = {
2964
2964
  body: null,
2965
2965
  headers: {},
2966
- error: error instanceof Error ? error.message : String(error)
2966
+ error: networkError instanceof Error ? networkError.message : String(networkError)
2967
2967
  };
2968
2968
  const enhancedPayload = {
2969
2969
  ...baseEnhancedPayload,
@@ -4740,6 +4740,13 @@ class Field extends Scriptable {
4740
4740
  this._setProperty('errorMessage', e);
4741
4741
  this._setProperty('validationMessage', e);
4742
4742
  }
4743
+ set constraintMessage(constraint) {
4744
+ const updatedConstraintMessages = {
4745
+ ...this._jsonModel.constraintMessages,
4746
+ [constraint.type]: constraint.message
4747
+ };
4748
+ this._setProperty('constraintMessages', updatedConstraintMessages);
4749
+ }
4743
4750
  _getConstraintObject() {
4744
4751
  return Constraints;
4745
4752
  }
@@ -66,6 +66,10 @@ declare class Field extends Scriptable<FieldJson> implements FieldModel {
66
66
  getErrorMessage(constraint: keyof (ConstraintsMessages)): string;
67
67
  get errorMessage(): string | undefined;
68
68
  set errorMessage(e: string | undefined);
69
+ set constraintMessage(constraint: {
70
+ type: keyof ConstraintsMessages;
71
+ message: string;
72
+ });
69
73
  _getConstraintObject(): {
70
74
  enum: (constraint: any, inputVal: any) => {
71
75
  valid: boolean;
package/lib/Field.d.ts CHANGED
@@ -66,6 +66,10 @@ declare class Field extends Scriptable<FieldJson> implements FieldModel {
66
66
  getErrorMessage(constraint: keyof (ConstraintsMessages)): string;
67
67
  get errorMessage(): string | undefined;
68
68
  set errorMessage(e: string | undefined);
69
+ set constraintMessage(constraint: {
70
+ type: keyof ConstraintsMessages;
71
+ message: string;
72
+ });
69
73
  _getConstraintObject(): {
70
74
  enum: (constraint: any, inputVal: any) => {
71
75
  valid: boolean;
package/lib/Field.js CHANGED
@@ -481,6 +481,10 @@ class Field extends Scriptable_1.default {
481
481
  this._setProperty('errorMessage', e);
482
482
  this._setProperty('validationMessage', e);
483
483
  }
484
+ set constraintMessage(constraint) {
485
+ const updatedConstraintMessages = Object.assign(Object.assign({}, this._jsonModel.constraintMessages), { [constraint.type]: constraint.message });
486
+ this._setProperty('constraintMessages', updatedConstraintMessages);
487
+ }
484
488
  _getConstraintObject() {
485
489
  return ValidationUtils_1.Constraints;
486
490
  }
@@ -133,12 +133,12 @@ const request = (context, uri, httpVerb, payload, success, error, headers) => __
133
133
  }
134
134
  return response;
135
135
  }
136
- catch (error) {
137
- context.form.logger.error('Network error while invoking a rest API:', error);
136
+ catch (networkError) {
137
+ context.form.logger.error('Network error while invoking a rest API:', networkError);
138
138
  const networkErrorResponse = {
139
139
  body: null,
140
140
  headers: {},
141
- error: error instanceof Error ? error.message : String(error)
141
+ error: networkError instanceof Error ? networkError.message : String(networkError)
142
142
  };
143
143
  const enhancedPayload = Object.assign(Object.assign({}, baseEnhancedPayload), { response: networkErrorResponse });
144
144
  dispatchErrorEvents(networkErrorResponse, error, enhancedPayload);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aemforms/af-core",
3
- "version": "0.22.147",
3
+ "version": "0.22.148",
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.147"
40
+ "@aemforms/af-formatters": "^0.22.148"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@babel/preset-env": "^7.20.2",