@wise/dynamic-flow-client 3.30.1 → 3.31.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.
- package/build/main.js +47 -22
- package/build/main.min.js +1 -1
- package/build/main.mjs +47 -22
- package/build/types/legacy/common/utils/api-utils.d.ts +0 -1
- package/build/types/revamp/domain/features/validation/validateStringPattern.d.ts +2 -0
- package/build/types/revamp/domain/features/validation/value-checks.d.ts +5 -2
- package/package.json +4 -4
package/build/main.js
CHANGED
|
@@ -7679,6 +7679,29 @@ var createNumberInputComponent = (numberInputProps, updateComponent) => {
|
|
|
7679
7679
|
return numberComponent;
|
|
7680
7680
|
};
|
|
7681
7681
|
|
|
7682
|
+
// src/revamp/domain/features/validation/validateStringPattern.ts
|
|
7683
|
+
var validateStringPattern = (pattern, logEvent) => {
|
|
7684
|
+
if (!pattern) {
|
|
7685
|
+
return;
|
|
7686
|
+
}
|
|
7687
|
+
try {
|
|
7688
|
+
new RegExp(pattern, "u");
|
|
7689
|
+
} catch (error) {
|
|
7690
|
+
const message = `Invalid schema pattern. Failed to instantiate RegExp with Unicode support.`;
|
|
7691
|
+
if (logEvent) {
|
|
7692
|
+
logEvent("warning", message, {
|
|
7693
|
+
pattern,
|
|
7694
|
+
error: error == null ? void 0 : error.toString()
|
|
7695
|
+
});
|
|
7696
|
+
} else {
|
|
7697
|
+
console.warn(`DynamicFlow - warning - ${message}`, {
|
|
7698
|
+
pattern,
|
|
7699
|
+
error: error == null ? void 0 : error.toString()
|
|
7700
|
+
});
|
|
7701
|
+
}
|
|
7702
|
+
}
|
|
7703
|
+
};
|
|
7704
|
+
|
|
7682
7705
|
// src/revamp/domain/features/validation/value-checks.ts
|
|
7683
7706
|
var getAboveMaxItemsCheck = ({ maxItems }, messageFunctions) => (value) => {
|
|
7684
7707
|
if (isNumber(maxItems) && isArray(value) && value.length > maxItems) {
|
|
@@ -7754,11 +7777,14 @@ var getBelowMinimumDateCheck = ({ minimum }, messageFunctions) => (value) => {
|
|
|
7754
7777
|
}
|
|
7755
7778
|
return null;
|
|
7756
7779
|
};
|
|
7757
|
-
var getNotAdheringToPatternCheck = ({ pattern }, messageFunctions
|
|
7758
|
-
|
|
7759
|
-
|
|
7760
|
-
|
|
7761
|
-
|
|
7780
|
+
var getNotAdheringToPatternCheck = ({ pattern }, messageFunctions, options) => {
|
|
7781
|
+
validateStringPattern(pattern, options == null ? void 0 : options.logEvent);
|
|
7782
|
+
return (value) => {
|
|
7783
|
+
if (isString(pattern) && isString(value)) {
|
|
7784
|
+
return new RegExp(pattern).test(value) ? null : messageFunctions.pattern();
|
|
7785
|
+
}
|
|
7786
|
+
return null;
|
|
7787
|
+
};
|
|
7762
7788
|
};
|
|
7763
7789
|
var getRequiredCheck = (required, messageFunctions) => (value) => {
|
|
7764
7790
|
if (!required) {
|
|
@@ -7936,7 +7962,7 @@ var getPerformPersistAsync = ({
|
|
|
7936
7962
|
trackFailure();
|
|
7937
7963
|
throw new Error(genericErrorMessage);
|
|
7938
7964
|
}
|
|
7939
|
-
const validationError = response.
|
|
7965
|
+
const validationError = !response.ok && isObject(json) ? getValidationError(param, json) : null;
|
|
7940
7966
|
trackFailure(json);
|
|
7941
7967
|
throw new Error(validationError != null ? validationError : genericErrorMessage);
|
|
7942
7968
|
};
|
|
@@ -9061,7 +9087,7 @@ var stringSchemaToTextInputComponent = (schemaMapperProps, mapperProps) => {
|
|
|
9061
9087
|
minLength,
|
|
9062
9088
|
validationMessages
|
|
9063
9089
|
} = schema;
|
|
9064
|
-
const { getErrorMessageFunctions, updateComponent, onRefresh, onValueChange } = mapperProps;
|
|
9090
|
+
const { getErrorMessageFunctions, updateComponent, onRefresh, onValueChange, logEvent } = mapperProps;
|
|
9065
9091
|
const controlForLegacyFormat = getControlForLegacyFormat(format);
|
|
9066
9092
|
const errorMessageFunctions = getErrorMessageFunctions(validationMessages);
|
|
9067
9093
|
const { performPersistAsync, persistedState } = getPersistAsyncInitialState(
|
|
@@ -9082,7 +9108,7 @@ var stringSchemaToTextInputComponent = (schemaMapperProps, mapperProps) => {
|
|
|
9082
9108
|
getRequiredCheck(required, errorMessageFunctions),
|
|
9083
9109
|
getAboveMaxLengthCheck(schema, errorMessageFunctions),
|
|
9084
9110
|
getBelowMinLengthCheck(schema, errorMessageFunctions),
|
|
9085
|
-
getNotAdheringToPatternCheck(schema, errorMessageFunctions)
|
|
9111
|
+
getNotAdheringToPatternCheck(schema, errorMessageFunctions, { logEvent })
|
|
9086
9112
|
],
|
|
9087
9113
|
control: control != null ? control : controlForLegacyFormat,
|
|
9088
9114
|
displayFormat,
|
|
@@ -14450,9 +14476,6 @@ var debounce2 = (callback, waitMs) => {
|
|
|
14450
14476
|
function isStatus2xx(status) {
|
|
14451
14477
|
return status >= 200 && status < 300;
|
|
14452
14478
|
}
|
|
14453
|
-
function isStatus422(status) {
|
|
14454
|
-
return status === 422;
|
|
14455
|
-
}
|
|
14456
14479
|
|
|
14457
14480
|
// src/legacy/common/validators/types/type-validators.ts
|
|
14458
14481
|
var isString2 = (value) => typeof value === "string";
|
|
@@ -17888,7 +17911,7 @@ function PersistAsyncBlobSchema(props) {
|
|
|
17888
17911
|
}
|
|
17889
17912
|
}, [model, schema, submitted, required]);
|
|
17890
17913
|
const onSuccess = async (httpResponse, _fileName) => {
|
|
17891
|
-
const jsonResponse = await httpResponse
|
|
17914
|
+
const jsonResponse = await getResponseJsonObject(httpResponse);
|
|
17892
17915
|
const id2 = getIdFromResponse(schema.persistAsync.idProperty, jsonResponse);
|
|
17893
17916
|
onChange({ model: id2, triggerSchema: schema, triggerModel: id2 });
|
|
17894
17917
|
setChanged(true);
|
|
@@ -17896,8 +17919,8 @@ function PersistAsyncBlobSchema(props) {
|
|
|
17896
17919
|
};
|
|
17897
17920
|
const onFailure = async (error) => {
|
|
17898
17921
|
const errorResponse = error;
|
|
17899
|
-
if (errorResponse.response
|
|
17900
|
-
const jsonResponse = await errorResponse.response
|
|
17922
|
+
if (errorResponse.response) {
|
|
17923
|
+
const jsonResponse = await getResponseJsonObject(errorResponse.response);
|
|
17901
17924
|
setPersistAsyncValidationMessages(jsonResponse.validation || {});
|
|
17902
17925
|
setPersistAsyncValidations([schema.persistAsync.param]);
|
|
17903
17926
|
}
|
|
@@ -17956,6 +17979,10 @@ function PersistAsyncBlobSchema(props) {
|
|
|
17956
17979
|
)
|
|
17957
17980
|
] });
|
|
17958
17981
|
}
|
|
17982
|
+
var getResponseJsonObject = async (response) => {
|
|
17983
|
+
const json = await response.json().catch(() => ({}));
|
|
17984
|
+
return isObject2(json) ? json : {};
|
|
17985
|
+
};
|
|
17959
17986
|
var PersistAsyncBlobSchema_default = PersistAsyncBlobSchema;
|
|
17960
17987
|
|
|
17961
17988
|
// src/legacy/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.tsx
|
|
@@ -19322,7 +19349,7 @@ function PersistAsyncBasicSchema(props) {
|
|
|
19322
19349
|
if (isStatus2xx(response.status)) {
|
|
19323
19350
|
const id = getIdFromResponse(idProperty, responseBody);
|
|
19324
19351
|
onChange({ model: id, triggerSchema: schema, triggerModel: id });
|
|
19325
|
-
} else if (
|
|
19352
|
+
} else if (!response.ok) {
|
|
19326
19353
|
const { validation } = responseBody;
|
|
19327
19354
|
const error = isObject2(validation) && (validation == null ? void 0 : validation[param]) || null;
|
|
19328
19355
|
setPersistAsyncError(error);
|
|
@@ -19426,13 +19453,11 @@ var usePersistAsync = (persistAsync) => {
|
|
|
19426
19453
|
}
|
|
19427
19454
|
}
|
|
19428
19455
|
async function handleHTTPError(response) {
|
|
19429
|
-
|
|
19430
|
-
|
|
19431
|
-
|
|
19432
|
-
|
|
19433
|
-
|
|
19434
|
-
throw new Error(error);
|
|
19435
|
-
}
|
|
19456
|
+
const jsonResponse = await response.json();
|
|
19457
|
+
if (isObject2(jsonResponse)) {
|
|
19458
|
+
const error = getErrorFromResponse(persistAsync.param, jsonResponse);
|
|
19459
|
+
if (isString2(error)) {
|
|
19460
|
+
throw new Error(error);
|
|
19436
19461
|
}
|
|
19437
19462
|
}
|
|
19438
19463
|
throw new Error(intl.formatMessage(generic_error_messages_default.genericErrorRetryHint));
|