@jsonui/core 0.4.4 → 0.6.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/dist/cjs/index.js +729 -45
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/index.d.ts +1 -1
- package/dist/cjs/types/stock/Stock.d.ts +1 -4
- package/dist/cjs/types/stock/appRootFunctions.d.ts +1 -4
- package/dist/cjs/types/stock/functions.d.ts +2 -2
- package/dist/cjs/types/stock/validation.d.ts +7 -3
- package/dist/cjs/types/store/root/selectors.d.ts +4 -4
- package/dist/cjs/types/utils/constants.d.ts +2 -0
- package/dist/cjs/types/utils/types.d.ts +16 -3
- package/dist/cjs/types/utils/util.d.ts +5 -2
- package/dist/cjs/types/wrapper/wrapperUtil.d.ts +3 -6
- package/dist/esm/index.js +729 -45
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/index.d.ts +1 -1
- package/dist/esm/types/stock/Stock.d.ts +1 -4
- package/dist/esm/types/stock/appRootFunctions.d.ts +1 -4
- package/dist/esm/types/stock/functions.d.ts +2 -2
- package/dist/esm/types/stock/validation.d.ts +7 -3
- package/dist/esm/types/store/root/selectors.d.ts +4 -4
- package/dist/esm/types/utils/constants.d.ts +2 -0
- package/dist/esm/types/utils/types.d.ts +16 -3
- package/dist/esm/types/utils/util.d.ts +5 -2
- package/dist/esm/types/wrapper/wrapperUtil.d.ts +3 -6
- package/dist/index.d.ts +45 -26
- package/package.json +4 -2
package/dist/cjs/index.js
CHANGED
|
@@ -4958,6 +4958,7 @@ var hasOwnProperty$3 = Object.hasOwnProperty || function (obj, key) {
|
|
|
4958
4958
|
|
|
4959
4959
|
var traverse$3 = traverse$4.exports;const SEPARATOR = '/';
|
|
4960
4960
|
const STORE_ERROR_POSTFIX = '.error';
|
|
4961
|
+
const STORE_TOUCH_POSTFIX = '.touch';
|
|
4961
4962
|
const PATH_MODIFIERS_KEY = '$pathModifiers';
|
|
4962
4963
|
const MODIFIER_KEY = '$modifier';
|
|
4963
4964
|
const ACTION_KEY = '$action';
|
|
@@ -4985,10 +4986,11 @@ const REDUX_PATHS = '$$reduxPaths';
|
|
|
4985
4986
|
const V_CHILDREN_PREFIX = '$child';
|
|
4986
4987
|
const PARENT_PROP_NAME = '__parentprop';
|
|
4987
4988
|
const CURRENT_PATH_NAME = '__currentPaths';
|
|
4989
|
+
const REDUX_GET_SUBSCRIBERS_NAME = '__subscriberPaths';
|
|
4988
4990
|
const UNDEFINED_COMP_NAME = '_Undefined';
|
|
4989
4991
|
const PRIMITIVE_COMP_NAME = '_PrimitiveProp'; // TODO check all literal and replace with this constant
|
|
4990
4992
|
const FRAGMENT_COMP_NAME = 'Fragment'; // TODO check all literal and replace with this constant
|
|
4991
|
-
var constants=/*#__PURE__*/Object.freeze({__proto__:null,SEPARATOR:SEPARATOR,STORE_ERROR_POSTFIX:STORE_ERROR_POSTFIX,PATH_MODIFIERS_KEY:PATH_MODIFIERS_KEY,MODIFIER_KEY:MODIFIER_KEY,ACTION_KEY:ACTION_KEY,PERSIST_STORAGE_KEY:PERSIST_STORAGE_KEY,PERSIST_STORAGE_NAMES:PERSIST_STORAGE_NAMES,REF_ASSETS:REF_ASSETS,REF_LOCALES:REF_LOCALES,REF_VALIDATES:REF_VALIDATES,STYLE_WEB_NAME:STYLE_WEB_NAME,STYLE_RN_NAME:STYLE_RN_NAME,REDUX_GET_FUNCTION:REDUX_GET_FUNCTION,REDUX_SET_FUNCTION:REDUX_SET_FUNCTION,REDUX_FUNCTIONS:REDUX_FUNCTIONS,PATHNAME:PATHNAME,SIMPLE_DATA_TYPES:SIMPLE_DATA_TYPES,V_CHILDREN_NAME:V_CHILDREN_NAME,V_COMP_NAME:V_COMP_NAME,LIST_SEMAPHORE:LIST_SEMAPHORE,LIST_ITEM:LIST_ITEM,LIST_PAGE:LIST_PAGE,LIST_ITEM_PER_PAGE:LIST_ITEM_PER_PAGE,LIST_LENGTH:LIST_LENGTH,LIST_ITEM_PER_PAGE_DEFAULT:LIST_ITEM_PER_PAGE_DEFAULT,REDUX_PATHS:REDUX_PATHS,V_CHILDREN_PREFIX:V_CHILDREN_PREFIX,PARENT_PROP_NAME:PARENT_PROP_NAME,CURRENT_PATH_NAME:CURRENT_PATH_NAME,UNDEFINED_COMP_NAME:UNDEFINED_COMP_NAME,PRIMITIVE_COMP_NAME:PRIMITIVE_COMP_NAME,FRAGMENT_COMP_NAME:FRAGMENT_COMP_NAME});var jsonpointer = {};var hasExcape = /~/;
|
|
4993
|
+
var constants=/*#__PURE__*/Object.freeze({__proto__:null,SEPARATOR:SEPARATOR,STORE_ERROR_POSTFIX:STORE_ERROR_POSTFIX,STORE_TOUCH_POSTFIX:STORE_TOUCH_POSTFIX,PATH_MODIFIERS_KEY:PATH_MODIFIERS_KEY,MODIFIER_KEY:MODIFIER_KEY,ACTION_KEY:ACTION_KEY,PERSIST_STORAGE_KEY:PERSIST_STORAGE_KEY,PERSIST_STORAGE_NAMES:PERSIST_STORAGE_NAMES,REF_ASSETS:REF_ASSETS,REF_LOCALES:REF_LOCALES,REF_VALIDATES:REF_VALIDATES,STYLE_WEB_NAME:STYLE_WEB_NAME,STYLE_RN_NAME:STYLE_RN_NAME,REDUX_GET_FUNCTION:REDUX_GET_FUNCTION,REDUX_SET_FUNCTION:REDUX_SET_FUNCTION,REDUX_FUNCTIONS:REDUX_FUNCTIONS,PATHNAME:PATHNAME,SIMPLE_DATA_TYPES:SIMPLE_DATA_TYPES,V_CHILDREN_NAME:V_CHILDREN_NAME,V_COMP_NAME:V_COMP_NAME,LIST_SEMAPHORE:LIST_SEMAPHORE,LIST_ITEM:LIST_ITEM,LIST_PAGE:LIST_PAGE,LIST_ITEM_PER_PAGE:LIST_ITEM_PER_PAGE,LIST_LENGTH:LIST_LENGTH,LIST_ITEM_PER_PAGE_DEFAULT:LIST_ITEM_PER_PAGE_DEFAULT,REDUX_PATHS:REDUX_PATHS,V_CHILDREN_PREFIX:V_CHILDREN_PREFIX,PARENT_PROP_NAME:PARENT_PROP_NAME,CURRENT_PATH_NAME:CURRENT_PATH_NAME,REDUX_GET_SUBSCRIBERS_NAME:REDUX_GET_SUBSCRIBERS_NAME,UNDEFINED_COMP_NAME:UNDEFINED_COMP_NAME,PRIMITIVE_COMP_NAME:PRIMITIVE_COMP_NAME,FRAGMENT_COMP_NAME:FRAGMENT_COMP_NAME});var jsonpointer = {};var hasExcape = /~/;
|
|
4992
4994
|
var escapeMatcher = /~[01]/g;
|
|
4993
4995
|
function escapeReplacer (m) {
|
|
4994
4996
|
switch (m) {
|
|
@@ -6573,13 +6575,22 @@ var pull_1 = pull;const findLastIndex = (arr, func) => {
|
|
|
6573
6575
|
};
|
|
6574
6576
|
const drop = (arr, n = 1) => arr.slice(n);
|
|
6575
6577
|
const isNumber = (a) => typeof a === 'number';
|
|
6578
|
+
const jsonPointerFix = (path) => {
|
|
6579
|
+
if (path !== null && path !== undefined && typeof path === 'string') {
|
|
6580
|
+
let str = path;
|
|
6581
|
+
str = str.charAt(str.length - 1) === SEPARATOR ? str.slice(0, -1) : str;
|
|
6582
|
+
str = str.startsWith(SEPARATOR) ? str : `${SEPARATOR}${str}`;
|
|
6583
|
+
return str;
|
|
6584
|
+
}
|
|
6585
|
+
return SEPARATOR;
|
|
6586
|
+
};
|
|
6576
6587
|
const jsonPointerGet = (json, path) => {
|
|
6577
6588
|
if (json === undefined || path === null || path === undefined || typeof path !== 'string')
|
|
6578
6589
|
return undefined;
|
|
6579
6590
|
if (path === SEPARATOR /* || path === '' same effect */)
|
|
6580
6591
|
return json;
|
|
6581
6592
|
try {
|
|
6582
|
-
return jsonpointer.get(json,
|
|
6593
|
+
return jsonpointer.get(json, jsonPointerFix(path));
|
|
6583
6594
|
}
|
|
6584
6595
|
catch (e) {
|
|
6585
6596
|
return undefined;
|
|
@@ -6592,7 +6603,7 @@ const jsonPointerSet = (json, path, value) => {
|
|
|
6592
6603
|
return value;
|
|
6593
6604
|
}
|
|
6594
6605
|
try {
|
|
6595
|
-
jsonpointer.set(json, path
|
|
6606
|
+
jsonpointer.set(json, jsonPointerFix(path), value);
|
|
6596
6607
|
return json;
|
|
6597
6608
|
// eslint-disable-next-line no-empty
|
|
6598
6609
|
}
|
|
@@ -6682,7 +6693,7 @@ const collectObjMerge = (refConst, json) => {
|
|
|
6682
6693
|
}
|
|
6683
6694
|
return res;
|
|
6684
6695
|
};
|
|
6685
|
-
const collectObjToArray = (refConst, json) => {
|
|
6696
|
+
const collectObjToArray = (refConst, json, flatten = false) => {
|
|
6686
6697
|
if (refConst && json && typeof json === 'object') {
|
|
6687
6698
|
const refs = [];
|
|
6688
6699
|
// eslint-disable-next-line func-names
|
|
@@ -6691,11 +6702,11 @@ const collectObjToArray = (refConst, json) => {
|
|
|
6691
6702
|
refs.push(x[refConst]);
|
|
6692
6703
|
}
|
|
6693
6704
|
});
|
|
6694
|
-
return refs;
|
|
6705
|
+
return flatten === true ? refs.flat() : refs;
|
|
6695
6706
|
}
|
|
6696
6707
|
return [];
|
|
6697
6708
|
};
|
|
6698
|
-
const
|
|
6709
|
+
const isValidJson = (d) => {
|
|
6699
6710
|
try {
|
|
6700
6711
|
JSON.stringify(d);
|
|
6701
6712
|
}
|
|
@@ -6703,7 +6714,24 @@ const isCircular = (d) => {
|
|
|
6703
6714
|
return true;
|
|
6704
6715
|
}
|
|
6705
6716
|
return false;
|
|
6706
|
-
};
|
|
6717
|
+
};
|
|
6718
|
+
const isPrimitiveValue = (value, emptyStringAllowed = false) => value !== 'undefined' && value !== null && ['string', 'boolean', 'number', 'bigint'].includes(typeof value) && (value !== '' || emptyStringAllowed);
|
|
6719
|
+
const hasLeaf = (obj, emptyStringAllowed = false) => {
|
|
6720
|
+
if (typeof obj === 'object') {
|
|
6721
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
6722
|
+
for (const key in obj) {
|
|
6723
|
+
// eslint-disable-next-line no-prototype-builtins
|
|
6724
|
+
if (obj.hasOwnProperty(key)) {
|
|
6725
|
+
const value = obj[key];
|
|
6726
|
+
if (typeof value === 'object') {
|
|
6727
|
+
return hasLeaf(value);
|
|
6728
|
+
}
|
|
6729
|
+
return isPrimitiveValue(value, emptyStringAllowed);
|
|
6730
|
+
}
|
|
6731
|
+
}
|
|
6732
|
+
}
|
|
6733
|
+
return isPrimitiveValue(obj, emptyStringAllowed);
|
|
6734
|
+
};var util$1=/*#__PURE__*/Object.freeze({__proto__:null,findLastIndex:findLastIndex,drop:drop,isNumber:isNumber,jsonPointerFix:jsonPointerFix,jsonPointerGet:jsonPointerGet,jsonPointerSet:jsonPointerSet,pathArrayToPathString:pathArrayToPathString,pathArrayToJsonPointer:pathArrayToJsonPointer,isOnlyObject:isOnlyObject,mergePath:mergePath,changeRelativePath:changeRelativePath,mergeDeep:mergeDeep,collectObjMerge:collectObjMerge,collectObjToArray:collectObjToArray,isValidJson:isValidJson,isPrimitiveValue:isPrimitiveValue,hasLeaf:hasLeaf});const getFilteredPath = (_a, func) => {
|
|
6707
6735
|
var _b = PARENT_PROP_NAME; _a[_b]; var propsNew = __rest(_a, [_b + ""]);
|
|
6708
6736
|
const paths = [];
|
|
6709
6737
|
function* jsonTraverse(o) {
|
|
@@ -6762,9 +6790,7 @@ const calculatePropsFromModifier = (props, stock) => {
|
|
|
6762
6790
|
}
|
|
6763
6791
|
traverse$3(props).set(i.path, stock.callFunction(functionName, functionParams, props));
|
|
6764
6792
|
}));
|
|
6765
|
-
return reduxPaths
|
|
6766
|
-
return { store: i === null || i === void 0 ? void 0 : i.store, path: i === null || i === void 0 ? void 0 : i.path };
|
|
6767
|
-
});
|
|
6793
|
+
return reduxPaths;
|
|
6768
6794
|
};
|
|
6769
6795
|
const getCurrentPaths = (props, pathModifier) => {
|
|
6770
6796
|
const currentPaths = Object.assign({}, props[CURRENT_PATH_NAME]);
|
|
@@ -6812,7 +6838,7 @@ const genChildenFromListItem = (props, stock) => {
|
|
|
6812
6838
|
const { path } = currentPaths[store];
|
|
6813
6839
|
if (currentPaths && !listLength) {
|
|
6814
6840
|
if (path) {
|
|
6815
|
-
const list = stock.callFunction(
|
|
6841
|
+
const list = stock.callFunction(REDUX_GET_FUNCTION, { store, path });
|
|
6816
6842
|
listLength = !!list && Array.isArray(list) ? list.length : 0;
|
|
6817
6843
|
}
|
|
6818
6844
|
}
|
|
@@ -6835,14 +6861,14 @@ const genChildenFromListItem = (props, stock) => {
|
|
|
6835
6861
|
return children.length > 0 ? children : undefined;
|
|
6836
6862
|
};
|
|
6837
6863
|
const getRootWrapperProps = (props, stock) => {
|
|
6838
|
-
const
|
|
6839
|
-
|
|
6840
|
-
|
|
6841
|
-
|
|
6842
|
-
|
|
6864
|
+
const subscriberPaths = calculatePropsFromModifier(props, stock);
|
|
6865
|
+
actionBuilder(props, stock);
|
|
6866
|
+
if (props[LIST_SEMAPHORE]) {
|
|
6867
|
+
// eslint-disable-next-line no-param-reassign
|
|
6868
|
+
props[V_CHILDREN_NAME] = genChildenFromListItem(props, stock);
|
|
6843
6869
|
}
|
|
6844
|
-
|
|
6845
|
-
|
|
6870
|
+
// eslint-disable-next-line no-param-reassign
|
|
6871
|
+
props[REDUX_GET_SUBSCRIBERS_NAME] = subscriberPaths;
|
|
6846
6872
|
};
|
|
6847
6873
|
const isChildrenProp = (propName) => !!propName && typeof propName === 'string' && propName.startsWith(V_CHILDREN_PREFIX);
|
|
6848
6874
|
const getParentProps = (props) => {
|
|
@@ -6905,10 +6931,10 @@ const isTechnicalProp = (propName) => [
|
|
|
6905
6931
|
LIST_ITEM_PER_PAGE,
|
|
6906
6932
|
LIST_LENGTH,
|
|
6907
6933
|
'style',
|
|
6908
|
-
|
|
6934
|
+
REDUX_GET_SUBSCRIBERS_NAME,
|
|
6909
6935
|
].includes(propName);
|
|
6910
6936
|
const removeTechnicalProps = (changeableProps) => {
|
|
6911
|
-
const _a = changeableProps, _b = PARENT_PROP_NAME; _a[_b]; const _c = STYLE_WEB_NAME; _a[_c]; const _d = V_COMP_NAME; _a[_d]; const _e = PATH_MODIFIERS_KEY; _a[_e]; const _f = CURRENT_PATH_NAME; _a[_f]; const _g =
|
|
6937
|
+
const _a = changeableProps, _b = PARENT_PROP_NAME; _a[_b]; const _c = STYLE_WEB_NAME; _a[_c]; const _d = V_COMP_NAME; _a[_d]; const _e = PATH_MODIFIERS_KEY; _a[_e]; const _f = CURRENT_PATH_NAME; _a[_f]; const _g = REDUX_GET_SUBSCRIBERS_NAME; _a[_g]; const _h = PATH_MODIFIERS_KEY; _a[_h]; const _j = LIST_SEMAPHORE; _a[_j]; const _k = LIST_ITEM; _a[_k]; const _l = LIST_PAGE; _a[_l]; const _m = LIST_ITEM_PER_PAGE; _a[_m]; const _o = LIST_LENGTH; _a[_o]; const newProps = __rest(_a, [_b + "", "style", _c + "", _d + "", _e + "", _f + "", _g + "", _h + "", _j + "", _k + "", _l + "", _m + "", _o + ""]);
|
|
6912
6938
|
return newProps;
|
|
6913
6939
|
};var wrapperUtil=/*#__PURE__*/Object.freeze({__proto__:null,getFilteredPath:getFilteredPath,actionBuilder:actionBuilder,calculatePropsFromModifier:calculatePropsFromModifier,getCurrentPaths:getCurrentPaths,normalisePrimitives:normalisePrimitives,getRootWrapperProps:getRootWrapperProps,isChildrenProp:isChildrenProp,getParentProps:getParentProps,getPropsChildrenFilter:getPropsChildrenFilter,getChildrensForRoot:getChildrensForRoot,generateChildren:generateChildren,generateNewChildren:generateNewChildren,isTechnicalProp:isTechnicalProp,removeTechnicalProps:removeTechnicalProps});var ajv = {exports: {}};var core$2 = {};var validate = {};var boolSchema = {};var errors = {};var codegen = {};var code$1 = {};(function (exports) {
|
|
6914
6940
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -13902,21 +13928,50 @@ class I18n {
|
|
|
13902
13928
|
}
|
|
13903
13929
|
}
|
|
13904
13930
|
}const StockContext = require$$0.createContext(null);
|
|
13905
|
-
const PathModifierContext = require$$0.createContext({})
|
|
13931
|
+
const PathModifierContext = require$$0.createContext({});// eslint-disable-next-line no-shadow
|
|
13932
|
+
var ReduxPathTypeEnum;
|
|
13933
|
+
(function (ReduxPathTypeEnum) {
|
|
13934
|
+
ReduxPathTypeEnum["ERROR"] = "ERROR";
|
|
13935
|
+
ReduxPathTypeEnum["TOUCH"] = "TOUCH";
|
|
13936
|
+
ReduxPathTypeEnum["NORMAL"] = "NORMAL";
|
|
13937
|
+
})(ReduxPathTypeEnum || (ReduxPathTypeEnum = {}));const getState = (state) => state === null || state === void 0 ? void 0 : state.root;
|
|
13906
13938
|
const getValue = (state, store, path) => jsonPointerGet(state[store], path) || null;
|
|
13907
|
-
const
|
|
13939
|
+
const getStoreNameFromType = (store, type) =>
|
|
13940
|
+
// eslint-disable-next-line no-nested-ternary
|
|
13941
|
+
type === ReduxPathTypeEnum.ERROR ? `${store}${STORE_ERROR_POSTFIX}` : type === ReduxPathTypeEnum.TOUCH ? `${store}${STORE_TOUCH_POSTFIX}` : `${store}`;
|
|
13942
|
+
const getStateValue = (globalState, { store, path, type, jsonataDef }, currentPaths) => {
|
|
13908
13943
|
const state = getState(globalState);
|
|
13909
13944
|
if (state && store && path) {
|
|
13910
13945
|
const convertedPath = currentPaths && currentPaths[store] && currentPaths[store].path ? changeRelativePath(`${currentPaths[store].path}${SEPARATOR}${path}`) : path;
|
|
13911
|
-
|
|
13946
|
+
const storeName = getStoreNameFromType(store, type);
|
|
13947
|
+
let value = getValue(state, storeName, convertedPath);
|
|
13948
|
+
if (jsonataDef) {
|
|
13949
|
+
try {
|
|
13950
|
+
// eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
|
|
13951
|
+
const jsonata = require('jsonata');
|
|
13952
|
+
const expression = jsonata(jsonataDef);
|
|
13953
|
+
value = expression.evaluate(value);
|
|
13954
|
+
}
|
|
13955
|
+
catch (error) {
|
|
13956
|
+
// eslint-disable-next-line no-console
|
|
13957
|
+
console.error('jsonata error', error, jsonataDef);
|
|
13958
|
+
}
|
|
13959
|
+
}
|
|
13960
|
+
if (type === ReduxPathTypeEnum.ERROR) {
|
|
13961
|
+
// if we have error, need to show, the empty structure is not error, doesn't matter how deep is it
|
|
13962
|
+
return hasLeaf(value) ? value : null;
|
|
13963
|
+
}
|
|
13964
|
+
if (type === ReduxPathTypeEnum.TOUCH) {
|
|
13965
|
+
return hasLeaf(value); // return true if is touched.
|
|
13966
|
+
}
|
|
13967
|
+
return value;
|
|
13912
13968
|
}
|
|
13913
13969
|
return null;
|
|
13914
13970
|
};
|
|
13915
13971
|
const compSelectorHook = (currentPaths, subscriberPaths) => (state) => {
|
|
13916
13972
|
if (typeof subscriberPaths === 'object' && Array.isArray(subscriberPaths) && (subscriberPaths === null || subscriberPaths === void 0 ? void 0 : subscriberPaths.length) > 0) {
|
|
13917
|
-
return subscriberPaths.map((subscriberPath) => getStateValue
|
|
13973
|
+
return subscriberPaths.map((subscriberPath) => getStateValue(state, subscriberPath, currentPaths));
|
|
13918
13974
|
}
|
|
13919
|
-
// TODO isError, currentPaths, root need to solve propperly
|
|
13920
13975
|
return undefined;
|
|
13921
13976
|
};const DATA_UPDATE = 'DATA_UPDATE';
|
|
13922
13977
|
const PURGE = 'PURGE';
|
|
@@ -13927,23 +13982,39 @@ const set$1 = (payload) => ({
|
|
|
13927
13982
|
const purge = (payload) => ({
|
|
13928
13983
|
type: PURGE,
|
|
13929
13984
|
payload,
|
|
13930
|
-
});const
|
|
13931
|
-
const { store, path } = attr;
|
|
13932
|
-
const state = stock.reduxStore.getState();
|
|
13933
|
-
return getStateValue$1(state, { store, path }, currentPaths);
|
|
13934
|
-
};
|
|
13935
|
-
const get = (attr, { [CURRENT_PATH_NAME]: currentPaths } = {}, callerArgs, stock) => {
|
|
13936
|
-
const { store, path } = attr;
|
|
13985
|
+
});const get = (attr, { [CURRENT_PATH_NAME]: currentPaths } = {}, callerArgs, stock) => {
|
|
13986
|
+
const { store, path, type, jsonataDef } = attr;
|
|
13937
13987
|
const state = stock.reduxStore.getState();
|
|
13938
|
-
return getStateValue
|
|
13988
|
+
return getStateValue(state, { store, path, type, jsonataDef }, currentPaths);
|
|
13939
13989
|
};
|
|
13940
13990
|
const set = (attr, props, callerArgs, stock) => {
|
|
13941
13991
|
stock.reduxStore.dispatch(set$1(Object.assign(Object.assign({}, attr), { value: attr && attr.value !== undefined ? attr.value : callerArgs[0], [CURRENT_PATH_NAME]: props[CURRENT_PATH_NAME], stock })));
|
|
13942
13992
|
};
|
|
13993
|
+
const jsonata = (_a) => {
|
|
13994
|
+
var { jsonataDef } = _a, attr = __rest(_a, ["jsonataDef"]);
|
|
13995
|
+
if (jsonataDef) {
|
|
13996
|
+
// console.log(' ---- jsonata ---- ')
|
|
13997
|
+
// console.log('jsonataDef: ', jsonataDef)
|
|
13998
|
+
// console.log('attr: ', attr)
|
|
13999
|
+
try {
|
|
14000
|
+
// eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
|
|
14001
|
+
const jsonataObj = require('jsonata');
|
|
14002
|
+
const expression = jsonataObj(jsonataDef);
|
|
14003
|
+
const evaluate = expression.evaluate(attr);
|
|
14004
|
+
// console.log('evaluate: ', evaluate)
|
|
14005
|
+
return evaluate;
|
|
14006
|
+
}
|
|
14007
|
+
catch (error) {
|
|
14008
|
+
// eslint-disable-next-line no-console
|
|
14009
|
+
console.error('jsonata error', error, jsonataDef);
|
|
14010
|
+
}
|
|
14011
|
+
}
|
|
14012
|
+
return null;
|
|
14013
|
+
};
|
|
13943
14014
|
var functions = {
|
|
13944
|
-
getStateValue,
|
|
13945
14015
|
get,
|
|
13946
14016
|
set,
|
|
14017
|
+
jsonata,
|
|
13947
14018
|
};/**
|
|
13948
14019
|
* Adapted from React: https://github.com/facebook/react/blob/master/packages/shared/formatProdErrorMessage.js
|
|
13949
14020
|
*
|
|
@@ -14463,39 +14534,648 @@ var persistConfig = {
|
|
|
14463
14534
|
whitelist: ['root'],
|
|
14464
14535
|
transforms: [SetTransform],
|
|
14465
14536
|
};function n(n){for(var r=arguments.length,t=Array(r>1?r-1:0),e=1;e<r;e++)t[e-1]=arguments[e];if("production"!==process.env.NODE_ENV){var i=Y[n],o=i?"function"==typeof i?i.apply(null,t):i:"unknown error nr: "+n;throw Error("[Immer] "+o)}throw Error("[Immer] minified error nr: "+n+(t.length?" "+t.map((function(n){return "'"+n+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function r(n){return !!n&&!!n[Q]}function t(n){return !!n&&(function(n){if(!n||"object"!=typeof n)return !1;var r=Object.getPrototypeOf(n);if(null===r)return !0;var t=Object.hasOwnProperty.call(r,"constructor")&&r.constructor;return t===Object||"function"==typeof t&&Function.toString.call(t)===Z}(n)||Array.isArray(n)||!!n[L]||!!n.constructor[L]||s(n)||v(n))}function i(n,r,t){void 0===t&&(t=!1),0===o(n)?(t?Object.keys:nn)(n).forEach((function(e){t&&"symbol"==typeof e||r(e,n[e],n);})):n.forEach((function(t,e){return r(e,t,n)}));}function o(n){var r=n[Q];return r?r.i>3?r.i-4:r.i:Array.isArray(n)?1:s(n)?2:v(n)?3:0}function u(n,r){return 2===o(n)?n.has(r):Object.prototype.hasOwnProperty.call(n,r)}function a(n,r){return 2===o(n)?n.get(r):n[r]}function f(n,r,t){var e=o(n);2===e?n.set(r,t):3===e?(n.delete(r),n.add(t)):n[r]=t;}function c(n,r){return n===r?0!==n||1/n==1/r:n!=n&&r!=r}function s(n){return X&&n instanceof Map}function v(n){return q&&n instanceof Set}function p(n){return n.o||n.t}function l(n){if(Array.isArray(n))return Array.prototype.slice.call(n);var r=rn(n);delete r[Q];for(var t=nn(r),e=0;e<t.length;e++){var i=t[e],o=r[i];!1===o.writable&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(r[i]={configurable:!0,writable:!0,enumerable:o.enumerable,value:n[i]});}return Object.create(Object.getPrototypeOf(n),r)}function d(n,e){return void 0===e&&(e=!1),y(n)||r(n)||!t(n)?n:(o(n)>1&&(n.set=n.add=n.clear=n.delete=h),Object.freeze(n),e&&i(n,(function(n,r){return d(r,!0)}),!0),n)}function h(){n(2);}function y(n){return null==n||"object"!=typeof n||Object.isFrozen(n)}function b(r){var t=tn[r];return t||n(18,r),t}function _(){return "production"===process.env.NODE_ENV||U||n(0),U}function j(n,r){r&&(b("Patches"),n.u=[],n.s=[],n.v=r);}function O(n){g(n),n.p.forEach(S),n.p=null;}function g(n){n===U&&(U=n.l);}function w(n){return U={p:[],l:U,h:n,m:!0,_:0}}function S(n){var r=n[Q];0===r.i||1===r.i?r.j():r.O=!0;}function P(r,e){e._=e.p.length;var i=e.p[0],o=void 0!==r&&r!==i;return e.h.g||b("ES5").S(e,r,o),o?(i[Q].P&&(O(e),n(4)),t(r)&&(r=M(e,r),e.l||x(e,r)),e.u&&b("Patches").M(i[Q].t,r,e.u,e.s)):r=M(e,i,[]),O(e),e.u&&e.v(e.u,e.s),r!==H?r:void 0}function M(n,r,t){if(y(r))return r;var e=r[Q];if(!e)return i(r,(function(i,o){return A(n,e,r,i,o,t)}),!0),r;if(e.A!==n)return r;if(!e.P)return x(n,e.t,!0),e.t;if(!e.I){e.I=!0,e.A._--;var o=4===e.i||5===e.i?e.o=l(e.k):e.o;i(3===e.i?new Set(o):o,(function(r,i){return A(n,e,o,r,i,t)})),x(n,o,!1),t&&n.u&&b("Patches").R(e,t,n.u,n.s);}return e.o}function A(e,i,o,a,c,s){if("production"!==process.env.NODE_ENV&&c===o&&n(5),r(c)){var v=M(e,c,s&&i&&3!==i.i&&!u(i.D,a)?s.concat(a):void 0);if(f(o,a,v),!r(v))return;e.m=!1;}if(t(c)&&!y(c)){if(!e.h.F&&e._<1)return;M(e,c),i&&i.A.l||x(e,c);}}function x(n,r,t){void 0===t&&(t=!1),n.h.F&&n.m&&d(r,t);}function z(n,r){var t=n[Q];return (t?p(t):n)[r]}function I(n,r){if(r in n)for(var t=Object.getPrototypeOf(n);t;){var e=Object.getOwnPropertyDescriptor(t,r);if(e)return e;t=Object.getPrototypeOf(t);}}function k(n){n.P||(n.P=!0,n.l&&k(n.l));}function E(n){n.o||(n.o=l(n.t));}function R(n,r,t){var e=s(r)?b("MapSet").N(r,t):v(r)?b("MapSet").T(r,t):n.g?function(n,r){var t=Array.isArray(n),e={i:t?1:0,A:r?r.A:_(),P:!1,I:!1,D:{},l:r,t:n,k:null,o:null,j:null,C:!1},i=e,o=en;t&&(i=[e],o=on);var u=Proxy.revocable(i,o),a=u.revoke,f=u.proxy;return e.k=f,e.j=a,f}(r,t):b("ES5").J(r,t);return (t?t.A:_()).p.push(e),e}function D(e){return r(e)||n(22,e),function n(r){if(!t(r))return r;var e,u=r[Q],c=o(r);if(u){if(!u.P&&(u.i<4||!b("ES5").K(u)))return u.t;u.I=!0,e=F(r,c),u.I=!1;}else e=F(r,c);return i(e,(function(r,t){u&&a(u.t,r)===t||f(e,r,n(t));})),3===c?new Set(e):e}(e)}function F(n,r){switch(r){case 2:return new Map(n);case 3:return Array.from(n)}return l(n)}var G,U,W="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),X="undefined"!=typeof Map,q="undefined"!=typeof Set,B="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,H=W?Symbol.for("immer-nothing"):((G={})["immer-nothing"]=!0,G),L=W?Symbol.for("immer-draftable"):"__$immer_draftable",Q=W?Symbol.for("immer-state"):"__$immer_state",Y={0:"Illegal state",1:"Immer drafts cannot have computed properties",2:"This object has been frozen and should not be mutated",3:function(n){return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+n},4:"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.",5:"Immer forbids circular references",6:"The first or second argument to `produce` must be a function",7:"The third argument to `produce` must be a function or undefined",8:"First argument to `createDraft` must be a plain object, an array, or an immerable object",9:"First argument to `finishDraft` must be a draft returned by `createDraft`",10:"The given draft is already finalized",11:"Object.defineProperty() cannot be used on an Immer draft",12:"Object.setPrototypeOf() cannot be used on an Immer draft",13:"Immer only supports deleting array indices",14:"Immer only supports setting array indices and the 'length' property",15:function(n){return "Cannot apply patch, path doesn't resolve: "+n},16:'Sets cannot have "replace" patches.',17:function(n){return "Unsupported patch operation: "+n},18:function(n){return "The plugin for '"+n+"' has not been loaded into Immer. To enable the plugin, import and call `enable"+n+"()` when initializing your application."},20:"Cannot use proxies if Proxy, Proxy.revocable or Reflect are not available",21:function(n){return "produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '"+n+"'"},22:function(n){return "'current' expects a draft, got: "+n},23:function(n){return "'original' expects a draft, got: "+n},24:"Patching reserved attributes like __proto__, prototype and constructor is not allowed"},Z=""+Object.prototype.constructor,nn="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(n){return Object.getOwnPropertyNames(n).concat(Object.getOwnPropertySymbols(n))}:Object.getOwnPropertyNames,rn=Object.getOwnPropertyDescriptors||function(n){var r={};return nn(n).forEach((function(t){r[t]=Object.getOwnPropertyDescriptor(n,t);})),r},tn={},en={get:function(n,r){if(r===Q)return n;var e=p(n);if(!u(e,r))return function(n,r,t){var e,i=I(r,t);return i?"value"in i?i.value:null===(e=i.get)||void 0===e?void 0:e.call(n.k):void 0}(n,e,r);var i=e[r];return n.I||!t(i)?i:i===z(n.t,r)?(E(n),n.o[r]=R(n.A.h,i,n)):i},has:function(n,r){return r in p(n)},ownKeys:function(n){return Reflect.ownKeys(p(n))},set:function(n,r,t){var e=I(p(n),r);if(null==e?void 0:e.set)return e.set.call(n.k,t),!0;if(!n.P){var i=z(p(n),r),o=null==i?void 0:i[Q];if(o&&o.t===t)return n.o[r]=t,n.D[r]=!1,!0;if(c(t,i)&&(void 0!==t||u(n.t,r)))return !0;E(n),k(n);}return n.o[r]===t&&"number"!=typeof t&&(void 0!==t||r in n.o)||(n.o[r]=t,n.D[r]=!0,!0)},deleteProperty:function(n,r){return void 0!==z(n.t,r)||r in n.t?(n.D[r]=!1,E(n),k(n)):delete n.D[r],n.o&&delete n.o[r],!0},getOwnPropertyDescriptor:function(n,r){var t=p(n),e=Reflect.getOwnPropertyDescriptor(t,r);return e?{writable:!0,configurable:1!==n.i||"length"!==r,enumerable:e.enumerable,value:t[r]}:e},defineProperty:function(){n(11);},getPrototypeOf:function(n){return Object.getPrototypeOf(n.t)},setPrototypeOf:function(){n(12);}},on={};i(en,(function(n,r){on[n]=function(){return arguments[0]=arguments[0][0],r.apply(this,arguments)};})),on.deleteProperty=function(r,t){return "production"!==process.env.NODE_ENV&&isNaN(parseInt(t))&&n(13),on.set.call(this,r,t,void 0)},on.set=function(r,t,e){return "production"!==process.env.NODE_ENV&&"length"!==t&&isNaN(parseInt(t))&&n(14),en.set.call(this,r[0],t,e,r[0])};var un=function(){function e(r){var e=this;this.g=B,this.F=!0,this.produce=function(r,i,o){if("function"==typeof r&&"function"!=typeof i){var u=i;i=r;var a=e;return function(n){var r=this;void 0===n&&(n=u);for(var t=arguments.length,e=Array(t>1?t-1:0),o=1;o<t;o++)e[o-1]=arguments[o];return a.produce(n,(function(n){var t;return (t=i).call.apply(t,[r,n].concat(e))}))}}var f;if("function"!=typeof i&&n(6),void 0!==o&&"function"!=typeof o&&n(7),t(r)){var c=w(e),s=R(e,r,void 0),v=!0;try{f=i(s),v=!1;}finally{v?O(c):g(c);}return "undefined"!=typeof Promise&&f instanceof Promise?f.then((function(n){return j(c,o),P(n,c)}),(function(n){throw O(c),n})):(j(c,o),P(f,c))}if(!r||"object"!=typeof r){if(void 0===(f=i(r))&&(f=r),f===H&&(f=void 0),e.F&&d(f,!0),o){var p=[],l=[];b("Patches").M(r,f,p,l),o(p,l);}return f}n(21,r);},this.produceWithPatches=function(n,r){if("function"==typeof n)return function(r){for(var t=arguments.length,i=Array(t>1?t-1:0),o=1;o<t;o++)i[o-1]=arguments[o];return e.produceWithPatches(r,(function(r){return n.apply(void 0,[r].concat(i))}))};var t,i,o=e.produce(n,r,(function(n,r){t=n,i=r;}));return "undefined"!=typeof Promise&&o instanceof Promise?o.then((function(n){return [n,t,i]})):[o,t,i]},"boolean"==typeof(null==r?void 0:r.useProxies)&&this.setUseProxies(r.useProxies),"boolean"==typeof(null==r?void 0:r.autoFreeze)&&this.setAutoFreeze(r.autoFreeze);}var i=e.prototype;return i.createDraft=function(e){t(e)||n(8),r(e)&&(e=D(e));var i=w(this),o=R(this,e,void 0);return o[Q].C=!0,g(i),o},i.finishDraft=function(r,t){var e=r&&r[Q];"production"!==process.env.NODE_ENV&&(e&&e.C||n(9),e.I&&n(10));var i=e.A;return j(i,t),P(void 0,i)},i.setAutoFreeze=function(n){this.F=n;},i.setUseProxies=function(r){r&&!B&&n(20),this.g=r;},i.applyPatches=function(n,t){var e;for(e=t.length-1;e>=0;e--){var i=t[e];if(0===i.path.length&&"replace"===i.op){n=i.value;break}}e>-1&&(t=t.slice(e+1));var o=b("Patches").$;return r(n)?o(n,t):this.produce(n,(function(n){return o(n,t)}))},e}(),an=new un,fn=an.produce;an.produceWithPatches.bind(an);an.setAutoFreeze.bind(an);an.setUseProxies.bind(an);an.applyPatches.bind(an);an.createDraft.bind(an);an.finishDraft.bind(an);var produce = fn;
|
|
14466
|
-
|
|
14537
|
+
var dist$1 = {exports: {}};(function (module, exports) {
|
|
14538
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14539
|
+
const ajv_1 = ajv.exports;
|
|
14540
|
+
const codegen_1 = codegen;
|
|
14541
|
+
const code_1 = code$1;
|
|
14542
|
+
const validate_1 = validate;
|
|
14543
|
+
const errors_1 = errors;
|
|
14544
|
+
const names_1 = names$1;
|
|
14545
|
+
const keyword = "errorMessage";
|
|
14546
|
+
const used = new ajv_1.Name("emUsed");
|
|
14547
|
+
const KEYWORD_PROPERTY_PARAMS = {
|
|
14548
|
+
required: "missingProperty",
|
|
14549
|
+
dependencies: "property",
|
|
14550
|
+
dependentRequired: "property",
|
|
14551
|
+
};
|
|
14552
|
+
const INTERPOLATION = /\$\{[^}]+\}/;
|
|
14553
|
+
const INTERPOLATION_REPLACE = /\$\{([^}]+)\}/g;
|
|
14554
|
+
const EMPTY_STR = /^""\s*\+\s*|\s*\+\s*""$/g;
|
|
14555
|
+
function errorMessage(options) {
|
|
14556
|
+
return {
|
|
14557
|
+
keyword,
|
|
14558
|
+
schemaType: ["string", "object"],
|
|
14559
|
+
post: true,
|
|
14560
|
+
code(cxt) {
|
|
14561
|
+
const { gen, data, schema, schemaValue, it } = cxt;
|
|
14562
|
+
if (it.createErrors === false)
|
|
14563
|
+
return;
|
|
14564
|
+
const sch = schema;
|
|
14565
|
+
const instancePath = codegen_1.strConcat(names_1.default.instancePath, it.errorPath);
|
|
14566
|
+
gen.if(ajv_1._ `${names_1.default.errors} > 0`, () => {
|
|
14567
|
+
if (typeof sch == "object") {
|
|
14568
|
+
const [kwdPropErrors, kwdErrors] = keywordErrorsConfig(sch);
|
|
14569
|
+
if (kwdErrors)
|
|
14570
|
+
processKeywordErrors(kwdErrors);
|
|
14571
|
+
if (kwdPropErrors)
|
|
14572
|
+
processKeywordPropErrors(kwdPropErrors);
|
|
14573
|
+
processChildErrors(childErrorsConfig(sch));
|
|
14574
|
+
}
|
|
14575
|
+
const schMessage = typeof sch == "string" ? sch : sch._;
|
|
14576
|
+
if (schMessage)
|
|
14577
|
+
processAllErrors(schMessage);
|
|
14578
|
+
if (!options.keepErrors)
|
|
14579
|
+
removeUsedErrors();
|
|
14580
|
+
});
|
|
14581
|
+
function childErrorsConfig({ properties, items }) {
|
|
14582
|
+
const errors = {};
|
|
14583
|
+
if (properties) {
|
|
14584
|
+
errors.props = {};
|
|
14585
|
+
for (const p in properties)
|
|
14586
|
+
errors.props[p] = [];
|
|
14587
|
+
}
|
|
14588
|
+
if (items) {
|
|
14589
|
+
errors.items = {};
|
|
14590
|
+
for (let i = 0; i < items.length; i++)
|
|
14591
|
+
errors.items[i] = [];
|
|
14592
|
+
}
|
|
14593
|
+
return errors;
|
|
14594
|
+
}
|
|
14595
|
+
function keywordErrorsConfig(emSchema) {
|
|
14596
|
+
let propErrors;
|
|
14597
|
+
let errors;
|
|
14598
|
+
for (const k in emSchema) {
|
|
14599
|
+
if (k === "properties" || k === "items")
|
|
14600
|
+
continue;
|
|
14601
|
+
const kwdSch = emSchema[k];
|
|
14602
|
+
if (typeof kwdSch == "object") {
|
|
14603
|
+
propErrors || (propErrors = {});
|
|
14604
|
+
const errMap = (propErrors[k] = {});
|
|
14605
|
+
for (const p in kwdSch)
|
|
14606
|
+
errMap[p] = [];
|
|
14607
|
+
}
|
|
14608
|
+
else {
|
|
14609
|
+
errors || (errors = {});
|
|
14610
|
+
errors[k] = [];
|
|
14611
|
+
}
|
|
14612
|
+
}
|
|
14613
|
+
return [propErrors, errors];
|
|
14614
|
+
}
|
|
14615
|
+
function processKeywordErrors(kwdErrors) {
|
|
14616
|
+
const kwdErrs = gen.const("emErrors", ajv_1.stringify(kwdErrors));
|
|
14617
|
+
const templates = gen.const("templates", getTemplatesCode(kwdErrors, schema));
|
|
14618
|
+
gen.forOf("err", names_1.default.vErrors, (err) => gen.if(matchKeywordError(err, kwdErrs), () => gen.code(ajv_1._ `${kwdErrs}[${err}.keyword].push(${err})`).assign(ajv_1._ `${err}.${used}`, true)));
|
|
14619
|
+
const { singleError } = options;
|
|
14620
|
+
if (singleError) {
|
|
14621
|
+
const message = gen.let("message", ajv_1._ `""`);
|
|
14622
|
+
const paramsErrors = gen.let("paramsErrors", ajv_1._ `[]`);
|
|
14623
|
+
loopErrors((key) => {
|
|
14624
|
+
gen.if(message, () => gen.code(ajv_1._ `${message} += ${typeof singleError == "string" ? singleError : ";"}`));
|
|
14625
|
+
gen.code(ajv_1._ `${message} += ${errMessage(key)}`);
|
|
14626
|
+
gen.assign(paramsErrors, ajv_1._ `${paramsErrors}.concat(${kwdErrs}[${key}])`);
|
|
14627
|
+
});
|
|
14628
|
+
errors_1.reportError(cxt, { message, params: ajv_1._ `{errors: ${paramsErrors}}` });
|
|
14629
|
+
}
|
|
14630
|
+
else {
|
|
14631
|
+
loopErrors((key) => errors_1.reportError(cxt, {
|
|
14632
|
+
message: errMessage(key),
|
|
14633
|
+
params: ajv_1._ `{errors: ${kwdErrs}[${key}]}`,
|
|
14634
|
+
}));
|
|
14635
|
+
}
|
|
14636
|
+
function loopErrors(body) {
|
|
14637
|
+
gen.forIn("key", kwdErrs, (key) => gen.if(ajv_1._ `${kwdErrs}[${key}].length`, () => body(key)));
|
|
14638
|
+
}
|
|
14639
|
+
function errMessage(key) {
|
|
14640
|
+
return ajv_1._ `${key} in ${templates} ? ${templates}[${key}]() : ${schemaValue}[${key}]`;
|
|
14641
|
+
}
|
|
14642
|
+
}
|
|
14643
|
+
function processKeywordPropErrors(kwdPropErrors) {
|
|
14644
|
+
const kwdErrs = gen.const("emErrors", ajv_1.stringify(kwdPropErrors));
|
|
14645
|
+
const templatesCode = [];
|
|
14646
|
+
for (const k in kwdPropErrors) {
|
|
14647
|
+
templatesCode.push([
|
|
14648
|
+
k,
|
|
14649
|
+
getTemplatesCode(kwdPropErrors[k], schema[k]),
|
|
14650
|
+
]);
|
|
14651
|
+
}
|
|
14652
|
+
const templates = gen.const("templates", gen.object(...templatesCode));
|
|
14653
|
+
const kwdPropParams = gen.scopeValue("obj", {
|
|
14654
|
+
ref: KEYWORD_PROPERTY_PARAMS,
|
|
14655
|
+
code: ajv_1.stringify(KEYWORD_PROPERTY_PARAMS),
|
|
14656
|
+
});
|
|
14657
|
+
const propParam = gen.let("emPropParams");
|
|
14658
|
+
const paramsErrors = gen.let("emParamsErrors");
|
|
14659
|
+
gen.forOf("err", names_1.default.vErrors, (err) => gen.if(matchKeywordError(err, kwdErrs), () => {
|
|
14660
|
+
gen.assign(propParam, ajv_1._ `${kwdPropParams}[${err}.keyword]`);
|
|
14661
|
+
gen.assign(paramsErrors, ajv_1._ `${kwdErrs}[${err}.keyword][${err}.params[${propParam}]]`);
|
|
14662
|
+
gen.if(paramsErrors, () => gen.code(ajv_1._ `${paramsErrors}.push(${err})`).assign(ajv_1._ `${err}.${used}`, true));
|
|
14663
|
+
}));
|
|
14664
|
+
gen.forIn("key", kwdErrs, (key) => gen.forIn("keyProp", ajv_1._ `${kwdErrs}[${key}]`, (keyProp) => {
|
|
14665
|
+
gen.assign(paramsErrors, ajv_1._ `${kwdErrs}[${key}][${keyProp}]`);
|
|
14666
|
+
gen.if(ajv_1._ `${paramsErrors}.length`, () => {
|
|
14667
|
+
const tmpl = gen.const("tmpl", ajv_1._ `${templates}[${key}] && ${templates}[${key}][${keyProp}]`);
|
|
14668
|
+
errors_1.reportError(cxt, {
|
|
14669
|
+
message: ajv_1._ `${tmpl} ? ${tmpl}() : ${schemaValue}[${key}][${keyProp}]`,
|
|
14670
|
+
params: ajv_1._ `{errors: ${paramsErrors}}`,
|
|
14671
|
+
});
|
|
14672
|
+
});
|
|
14673
|
+
}));
|
|
14674
|
+
}
|
|
14675
|
+
function processChildErrors(childErrors) {
|
|
14676
|
+
const { props, items } = childErrors;
|
|
14677
|
+
if (!props && !items)
|
|
14678
|
+
return;
|
|
14679
|
+
const isObj = ajv_1._ `typeof ${data} == "object"`;
|
|
14680
|
+
const isArr = ajv_1._ `Array.isArray(${data})`;
|
|
14681
|
+
const childErrs = gen.let("emErrors");
|
|
14682
|
+
let childKwd;
|
|
14683
|
+
let childProp;
|
|
14684
|
+
const templates = gen.let("templates");
|
|
14685
|
+
if (props && items) {
|
|
14686
|
+
childKwd = gen.let("emChildKwd");
|
|
14687
|
+
gen.if(isObj);
|
|
14688
|
+
gen.if(isArr, () => {
|
|
14689
|
+
init(items, schema.items);
|
|
14690
|
+
gen.assign(childKwd, ajv_1.str `items`);
|
|
14691
|
+
}, () => {
|
|
14692
|
+
init(props, schema.properties);
|
|
14693
|
+
gen.assign(childKwd, ajv_1.str `properties`);
|
|
14694
|
+
});
|
|
14695
|
+
childProp = ajv_1._ `[${childKwd}]`;
|
|
14696
|
+
}
|
|
14697
|
+
else if (items) {
|
|
14698
|
+
gen.if(isArr);
|
|
14699
|
+
init(items, schema.items);
|
|
14700
|
+
childProp = ajv_1._ `.items`;
|
|
14701
|
+
}
|
|
14702
|
+
else if (props) {
|
|
14703
|
+
gen.if(codegen_1.and(isObj, codegen_1.not(isArr)));
|
|
14704
|
+
init(props, schema.properties);
|
|
14705
|
+
childProp = ajv_1._ `.properties`;
|
|
14706
|
+
}
|
|
14707
|
+
gen.forOf("err", names_1.default.vErrors, (err) => ifMatchesChildError(err, childErrs, (child) => gen.code(ajv_1._ `${childErrs}[${child}].push(${err})`).assign(ajv_1._ `${err}.${used}`, true)));
|
|
14708
|
+
gen.forIn("key", childErrs, (key) => gen.if(ajv_1._ `${childErrs}[${key}].length`, () => {
|
|
14709
|
+
errors_1.reportError(cxt, {
|
|
14710
|
+
message: ajv_1._ `${key} in ${templates} ? ${templates}[${key}]() : ${schemaValue}${childProp}[${key}]`,
|
|
14711
|
+
params: ajv_1._ `{errors: ${childErrs}[${key}]}`,
|
|
14712
|
+
});
|
|
14713
|
+
gen.assign(ajv_1._ `${names_1.default.vErrors}[${names_1.default.errors}-1].instancePath`, ajv_1._ `${instancePath} + "/" + ${key}.replace(/~/g, "~0").replace(/\\//g, "~1")`);
|
|
14714
|
+
}));
|
|
14715
|
+
gen.endIf();
|
|
14716
|
+
function init(children, msgs) {
|
|
14717
|
+
gen.assign(childErrs, ajv_1.stringify(children));
|
|
14718
|
+
gen.assign(templates, getTemplatesCode(children, msgs));
|
|
14719
|
+
}
|
|
14720
|
+
}
|
|
14721
|
+
function processAllErrors(schMessage) {
|
|
14722
|
+
const errs = gen.const("emErrs", ajv_1._ `[]`);
|
|
14723
|
+
gen.forOf("err", names_1.default.vErrors, (err) => gen.if(matchAnyError(err), () => gen.code(ajv_1._ `${errs}.push(${err})`).assign(ajv_1._ `${err}.${used}`, true)));
|
|
14724
|
+
gen.if(ajv_1._ `${errs}.length`, () => errors_1.reportError(cxt, {
|
|
14725
|
+
message: templateExpr(schMessage),
|
|
14726
|
+
params: ajv_1._ `{errors: ${errs}}`,
|
|
14727
|
+
}));
|
|
14728
|
+
}
|
|
14729
|
+
function removeUsedErrors() {
|
|
14730
|
+
const errs = gen.const("emErrs", ajv_1._ `[]`);
|
|
14731
|
+
gen.forOf("err", names_1.default.vErrors, (err) => gen.if(ajv_1._ `!${err}.${used}`, () => gen.code(ajv_1._ `${errs}.push(${err})`)));
|
|
14732
|
+
gen.assign(names_1.default.vErrors, errs).assign(names_1.default.errors, ajv_1._ `${errs}.length`);
|
|
14733
|
+
}
|
|
14734
|
+
function matchKeywordError(err, kwdErrs) {
|
|
14735
|
+
return codegen_1.and(ajv_1._ `${err}.keyword !== ${keyword}`, ajv_1._ `!${err}.${used}`, ajv_1._ `${err}.instancePath === ${instancePath}`, ajv_1._ `${err}.keyword in ${kwdErrs}`,
|
|
14736
|
+
// TODO match the end of the string?
|
|
14737
|
+
ajv_1._ `${err}.schemaPath.indexOf(${it.errSchemaPath}) === 0`, ajv_1._ `/^\\/[^\\/]*$/.test(${err}.schemaPath.slice(${it.errSchemaPath.length}))`);
|
|
14738
|
+
}
|
|
14739
|
+
function ifMatchesChildError(err, childErrs, thenBody) {
|
|
14740
|
+
gen.if(codegen_1.and(ajv_1._ `${err}.keyword !== ${keyword}`, ajv_1._ `!${err}.${used}`, ajv_1._ `${err}.instancePath.indexOf(${instancePath}) === 0`), () => {
|
|
14741
|
+
const childRegex = gen.scopeValue("pattern", {
|
|
14742
|
+
ref: /^\/([^/]*)(?:\/|$)/,
|
|
14743
|
+
code: ajv_1._ `new RegExp("^\\\/([^/]*)(?:\\\/|$)")`,
|
|
14744
|
+
});
|
|
14745
|
+
const matches = gen.const("emMatches", ajv_1._ `${childRegex}.exec(${err}.instancePath.slice(${instancePath}.length))`);
|
|
14746
|
+
const child = gen.const("emChild", ajv_1._ `${matches} && ${matches}[1].replace(/~1/g, "/").replace(/~0/g, "~")`);
|
|
14747
|
+
gen.if(ajv_1._ `${child} !== undefined && ${child} in ${childErrs}`, () => thenBody(child));
|
|
14748
|
+
});
|
|
14749
|
+
}
|
|
14750
|
+
function matchAnyError(err) {
|
|
14751
|
+
return codegen_1.and(ajv_1._ `${err}.keyword !== ${keyword}`, ajv_1._ `!${err}.${used}`, codegen_1.or(ajv_1._ `${err}.instancePath === ${instancePath}`, codegen_1.and(ajv_1._ `${err}.instancePath.indexOf(${instancePath}) === 0`, ajv_1._ `${err}.instancePath[${instancePath}.length] === "/"`)), ajv_1._ `${err}.schemaPath.indexOf(${it.errSchemaPath}) === 0`, ajv_1._ `${err}.schemaPath[${it.errSchemaPath}.length] === "/"`);
|
|
14752
|
+
}
|
|
14753
|
+
function getTemplatesCode(keys, msgs) {
|
|
14754
|
+
const templatesCode = [];
|
|
14755
|
+
for (const k in keys) {
|
|
14756
|
+
const msg = msgs[k];
|
|
14757
|
+
if (INTERPOLATION.test(msg))
|
|
14758
|
+
templatesCode.push([k, templateFunc(msg)]);
|
|
14759
|
+
}
|
|
14760
|
+
return gen.object(...templatesCode);
|
|
14761
|
+
}
|
|
14762
|
+
function templateExpr(msg) {
|
|
14763
|
+
if (!INTERPOLATION.test(msg))
|
|
14764
|
+
return ajv_1.stringify(msg);
|
|
14765
|
+
return new code_1._Code(code_1.safeStringify(msg)
|
|
14766
|
+
.replace(INTERPOLATION_REPLACE, (_s, ptr) => `" + JSON.stringify(${validate_1.getData(ptr, it)}) + "`)
|
|
14767
|
+
.replace(EMPTY_STR, ""));
|
|
14768
|
+
}
|
|
14769
|
+
function templateFunc(msg) {
|
|
14770
|
+
return ajv_1._ `function(){return ${templateExpr(msg)}}`;
|
|
14771
|
+
}
|
|
14772
|
+
},
|
|
14773
|
+
metaSchema: {
|
|
14774
|
+
anyOf: [
|
|
14775
|
+
{ type: "string" },
|
|
14776
|
+
{
|
|
14777
|
+
type: "object",
|
|
14778
|
+
properties: {
|
|
14779
|
+
properties: { $ref: "#/$defs/stringMap" },
|
|
14780
|
+
items: { $ref: "#/$defs/stringList" },
|
|
14781
|
+
required: { $ref: "#/$defs/stringOrMap" },
|
|
14782
|
+
dependencies: { $ref: "#/$defs/stringOrMap" },
|
|
14783
|
+
},
|
|
14784
|
+
additionalProperties: { type: "string" },
|
|
14785
|
+
},
|
|
14786
|
+
],
|
|
14787
|
+
$defs: {
|
|
14788
|
+
stringMap: {
|
|
14789
|
+
type: "object",
|
|
14790
|
+
additionalProperties: { type: "string" },
|
|
14791
|
+
},
|
|
14792
|
+
stringOrMap: {
|
|
14793
|
+
anyOf: [{ type: "string" }, { $ref: "#/$defs/stringMap" }],
|
|
14794
|
+
},
|
|
14795
|
+
stringList: { type: "array", items: { type: "string" } },
|
|
14796
|
+
},
|
|
14797
|
+
},
|
|
14798
|
+
};
|
|
14799
|
+
}
|
|
14800
|
+
const ajvErrors = (ajv, options = {}) => {
|
|
14801
|
+
if (!ajv.opts.allErrors)
|
|
14802
|
+
throw new Error("ajv-errors: Ajv option allErrors must be true");
|
|
14803
|
+
if (ajv.opts.jsPropertySyntax) {
|
|
14804
|
+
throw new Error("ajv-errors: ajv option jsPropertySyntax is not supported");
|
|
14805
|
+
}
|
|
14806
|
+
return ajv.addKeyword(errorMessage(options));
|
|
14807
|
+
};
|
|
14808
|
+
exports.default = ajvErrors;
|
|
14809
|
+
module.exports = ajvErrors;
|
|
14810
|
+
module.exports.default = ajvErrors;
|
|
14811
|
+
|
|
14812
|
+
}(dist$1, dist$1.exports));
|
|
14813
|
+
|
|
14814
|
+
var ajvErrors = /*@__PURE__*/getDefaultExportFromCjs(dist$1.exports);var dist = {exports: {}};var formats = {};(function (exports) {
|
|
14815
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14816
|
+
exports.formatNames = exports.fastFormats = exports.fullFormats = void 0;
|
|
14817
|
+
function fmtDef(validate, compare) {
|
|
14818
|
+
return { validate, compare };
|
|
14819
|
+
}
|
|
14820
|
+
exports.fullFormats = {
|
|
14821
|
+
// date: http://tools.ietf.org/html/rfc3339#section-5.6
|
|
14822
|
+
date: fmtDef(date, compareDate),
|
|
14823
|
+
// date-time: http://tools.ietf.org/html/rfc3339#section-5.6
|
|
14824
|
+
time: fmtDef(getTime(true), compareTime),
|
|
14825
|
+
"date-time": fmtDef(getDateTime(true), compareDateTime),
|
|
14826
|
+
"iso-time": fmtDef(getTime(), compareIsoTime),
|
|
14827
|
+
"iso-date-time": fmtDef(getDateTime(), compareIsoDateTime),
|
|
14828
|
+
// duration: https://tools.ietf.org/html/rfc3339#appendix-A
|
|
14829
|
+
duration: /^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,
|
|
14830
|
+
uri,
|
|
14831
|
+
"uri-reference": /^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,
|
|
14832
|
+
// uri-template: https://tools.ietf.org/html/rfc6570
|
|
14833
|
+
"uri-template": /^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,
|
|
14834
|
+
// For the source: https://gist.github.com/dperini/729294
|
|
14835
|
+
// For test cases: https://mathiasbynens.be/demo/url-regex
|
|
14836
|
+
url: /^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,
|
|
14837
|
+
email: /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,
|
|
14838
|
+
hostname: /^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,
|
|
14839
|
+
// optimized https://www.safaribooksonline.com/library/view/regular-expressions-cookbook/9780596802837/ch07s16.html
|
|
14840
|
+
ipv4: /^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,
|
|
14841
|
+
ipv6: /^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,
|
|
14842
|
+
regex,
|
|
14843
|
+
// uuid: http://tools.ietf.org/html/rfc4122
|
|
14844
|
+
uuid: /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,
|
|
14845
|
+
// JSON-pointer: https://tools.ietf.org/html/rfc6901
|
|
14846
|
+
// uri fragment: https://tools.ietf.org/html/rfc3986#appendix-A
|
|
14847
|
+
"json-pointer": /^(?:\/(?:[^~/]|~0|~1)*)*$/,
|
|
14848
|
+
"json-pointer-uri-fragment": /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,
|
|
14849
|
+
// relative JSON-pointer: http://tools.ietf.org/html/draft-luff-relative-json-pointer-00
|
|
14850
|
+
"relative-json-pointer": /^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,
|
|
14851
|
+
// the following formats are used by the openapi specification: https://spec.openapis.org/oas/v3.0.0#data-types
|
|
14852
|
+
// byte: https://github.com/miguelmota/is-base64
|
|
14853
|
+
byte,
|
|
14854
|
+
// signed 32 bit integer
|
|
14855
|
+
int32: { type: "number", validate: validateInt32 },
|
|
14856
|
+
// signed 64 bit integer
|
|
14857
|
+
int64: { type: "number", validate: validateInt64 },
|
|
14858
|
+
// C-type float
|
|
14859
|
+
float: { type: "number", validate: validateNumber },
|
|
14860
|
+
// C-type double
|
|
14861
|
+
double: { type: "number", validate: validateNumber },
|
|
14862
|
+
// hint to the UI to hide input strings
|
|
14863
|
+
password: true,
|
|
14864
|
+
// unchecked string payload
|
|
14865
|
+
binary: true,
|
|
14866
|
+
};
|
|
14867
|
+
exports.fastFormats = {
|
|
14868
|
+
...exports.fullFormats,
|
|
14869
|
+
date: fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\d$/, compareDate),
|
|
14870
|
+
time: fmtDef(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i, compareTime),
|
|
14871
|
+
"date-time": fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i, compareDateTime),
|
|
14872
|
+
"iso-time": fmtDef(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i, compareIsoTime),
|
|
14873
|
+
"iso-date-time": fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i, compareIsoDateTime),
|
|
14874
|
+
// uri: https://github.com/mafintosh/is-my-json-valid/blob/master/formats.js
|
|
14875
|
+
uri: /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,
|
|
14876
|
+
"uri-reference": /^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,
|
|
14877
|
+
// email (sources from jsen validator):
|
|
14878
|
+
// http://stackoverflow.com/questions/201323/using-a-regular-expression-to-validate-an-email-address#answer-8829363
|
|
14879
|
+
// http://www.w3.org/TR/html5/forms.html#valid-e-mail-address (search for 'wilful violation')
|
|
14880
|
+
email: /^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,
|
|
14881
|
+
};
|
|
14882
|
+
exports.formatNames = Object.keys(exports.fullFormats);
|
|
14883
|
+
function isLeapYear(year) {
|
|
14884
|
+
// https://tools.ietf.org/html/rfc3339#appendix-C
|
|
14885
|
+
return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
|
|
14886
|
+
}
|
|
14887
|
+
const DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/;
|
|
14888
|
+
const DAYS = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
14889
|
+
function date(str) {
|
|
14890
|
+
// full-date from http://tools.ietf.org/html/rfc3339#section-5.6
|
|
14891
|
+
const matches = DATE.exec(str);
|
|
14892
|
+
if (!matches)
|
|
14893
|
+
return false;
|
|
14894
|
+
const year = +matches[1];
|
|
14895
|
+
const month = +matches[2];
|
|
14896
|
+
const day = +matches[3];
|
|
14897
|
+
return (month >= 1 &&
|
|
14898
|
+
month <= 12 &&
|
|
14899
|
+
day >= 1 &&
|
|
14900
|
+
day <= (month === 2 && isLeapYear(year) ? 29 : DAYS[month]));
|
|
14901
|
+
}
|
|
14902
|
+
function compareDate(d1, d2) {
|
|
14903
|
+
if (!(d1 && d2))
|
|
14904
|
+
return undefined;
|
|
14905
|
+
if (d1 > d2)
|
|
14906
|
+
return 1;
|
|
14907
|
+
if (d1 < d2)
|
|
14908
|
+
return -1;
|
|
14909
|
+
return 0;
|
|
14910
|
+
}
|
|
14911
|
+
const TIME = /^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;
|
|
14912
|
+
function getTime(strictTimeZone) {
|
|
14913
|
+
return function time(str) {
|
|
14914
|
+
const matches = TIME.exec(str);
|
|
14915
|
+
if (!matches)
|
|
14916
|
+
return false;
|
|
14917
|
+
const hr = +matches[1];
|
|
14918
|
+
const min = +matches[2];
|
|
14919
|
+
const sec = +matches[3];
|
|
14920
|
+
const tz = matches[4];
|
|
14921
|
+
const tzSign = matches[5] === "-" ? -1 : 1;
|
|
14922
|
+
const tzH = +(matches[6] || 0);
|
|
14923
|
+
const tzM = +(matches[7] || 0);
|
|
14924
|
+
if (tzH > 23 || tzM > 59 || (strictTimeZone && !tz))
|
|
14925
|
+
return false;
|
|
14926
|
+
if (hr <= 23 && min <= 59 && sec < 60)
|
|
14927
|
+
return true;
|
|
14928
|
+
// leap second
|
|
14929
|
+
const utcMin = min - tzM * tzSign;
|
|
14930
|
+
const utcHr = hr - tzH * tzSign - (utcMin < 0 ? 1 : 0);
|
|
14931
|
+
return (utcHr === 23 || utcHr === -1) && (utcMin === 59 || utcMin === -1) && sec < 61;
|
|
14932
|
+
};
|
|
14933
|
+
}
|
|
14934
|
+
function compareTime(s1, s2) {
|
|
14935
|
+
if (!(s1 && s2))
|
|
14936
|
+
return undefined;
|
|
14937
|
+
const t1 = new Date("2020-01-01T" + s1).valueOf();
|
|
14938
|
+
const t2 = new Date("2020-01-01T" + s2).valueOf();
|
|
14939
|
+
if (!(t1 && t2))
|
|
14940
|
+
return undefined;
|
|
14941
|
+
return t1 - t2;
|
|
14942
|
+
}
|
|
14943
|
+
function compareIsoTime(t1, t2) {
|
|
14944
|
+
if (!(t1 && t2))
|
|
14945
|
+
return undefined;
|
|
14946
|
+
const a1 = TIME.exec(t1);
|
|
14947
|
+
const a2 = TIME.exec(t2);
|
|
14948
|
+
if (!(a1 && a2))
|
|
14949
|
+
return undefined;
|
|
14950
|
+
t1 = a1[1] + a1[2] + a1[3];
|
|
14951
|
+
t2 = a2[1] + a2[2] + a2[3];
|
|
14952
|
+
if (t1 > t2)
|
|
14953
|
+
return 1;
|
|
14954
|
+
if (t1 < t2)
|
|
14955
|
+
return -1;
|
|
14956
|
+
return 0;
|
|
14957
|
+
}
|
|
14958
|
+
const DATE_TIME_SEPARATOR = /t|\s/i;
|
|
14959
|
+
function getDateTime(strictTimeZone) {
|
|
14960
|
+
const time = getTime(strictTimeZone);
|
|
14961
|
+
return function date_time(str) {
|
|
14962
|
+
// http://tools.ietf.org/html/rfc3339#section-5.6
|
|
14963
|
+
const dateTime = str.split(DATE_TIME_SEPARATOR);
|
|
14964
|
+
return dateTime.length === 2 && date(dateTime[0]) && time(dateTime[1]);
|
|
14965
|
+
};
|
|
14966
|
+
}
|
|
14967
|
+
function compareDateTime(dt1, dt2) {
|
|
14968
|
+
if (!(dt1 && dt2))
|
|
14969
|
+
return undefined;
|
|
14970
|
+
const d1 = new Date(dt1).valueOf();
|
|
14971
|
+
const d2 = new Date(dt2).valueOf();
|
|
14972
|
+
if (!(d1 && d2))
|
|
14973
|
+
return undefined;
|
|
14974
|
+
return d1 - d2;
|
|
14975
|
+
}
|
|
14976
|
+
function compareIsoDateTime(dt1, dt2) {
|
|
14977
|
+
if (!(dt1 && dt2))
|
|
14978
|
+
return undefined;
|
|
14979
|
+
const [d1, t1] = dt1.split(DATE_TIME_SEPARATOR);
|
|
14980
|
+
const [d2, t2] = dt2.split(DATE_TIME_SEPARATOR);
|
|
14981
|
+
const res = compareDate(d1, d2);
|
|
14982
|
+
if (res === undefined)
|
|
14983
|
+
return undefined;
|
|
14984
|
+
return res || compareTime(t1, t2);
|
|
14985
|
+
}
|
|
14986
|
+
const NOT_URI_FRAGMENT = /\/|:/;
|
|
14987
|
+
const URI = /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
|
|
14988
|
+
function uri(str) {
|
|
14989
|
+
// http://jmrware.com/articles/2009/uri_regexp/URI_regex.html + optional protocol + required "."
|
|
14990
|
+
return NOT_URI_FRAGMENT.test(str) && URI.test(str);
|
|
14991
|
+
}
|
|
14992
|
+
const BYTE = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;
|
|
14993
|
+
function byte(str) {
|
|
14994
|
+
BYTE.lastIndex = 0;
|
|
14995
|
+
return BYTE.test(str);
|
|
14996
|
+
}
|
|
14997
|
+
const MIN_INT32 = -(2 ** 31);
|
|
14998
|
+
const MAX_INT32 = 2 ** 31 - 1;
|
|
14999
|
+
function validateInt32(value) {
|
|
15000
|
+
return Number.isInteger(value) && value <= MAX_INT32 && value >= MIN_INT32;
|
|
15001
|
+
}
|
|
15002
|
+
function validateInt64(value) {
|
|
15003
|
+
// JSON and javascript max Int is 2**53, so any int that passes isInteger is valid for Int64
|
|
15004
|
+
return Number.isInteger(value);
|
|
15005
|
+
}
|
|
15006
|
+
function validateNumber() {
|
|
15007
|
+
return true;
|
|
15008
|
+
}
|
|
15009
|
+
const Z_ANCHOR = /[^\\]\\Z/;
|
|
15010
|
+
function regex(str) {
|
|
15011
|
+
if (Z_ANCHOR.test(str))
|
|
15012
|
+
return false;
|
|
15013
|
+
try {
|
|
15014
|
+
new RegExp(str);
|
|
15015
|
+
return true;
|
|
15016
|
+
}
|
|
15017
|
+
catch (e) {
|
|
15018
|
+
return false;
|
|
15019
|
+
}
|
|
15020
|
+
}
|
|
15021
|
+
|
|
15022
|
+
}(formats));var limit = {};(function (exports) {
|
|
15023
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15024
|
+
exports.formatLimitDefinition = void 0;
|
|
15025
|
+
const ajv_1 = ajv.exports;
|
|
15026
|
+
const codegen_1 = codegen;
|
|
15027
|
+
const ops = codegen_1.operators;
|
|
15028
|
+
const KWDs = {
|
|
15029
|
+
formatMaximum: { okStr: "<=", ok: ops.LTE, fail: ops.GT },
|
|
15030
|
+
formatMinimum: { okStr: ">=", ok: ops.GTE, fail: ops.LT },
|
|
15031
|
+
formatExclusiveMaximum: { okStr: "<", ok: ops.LT, fail: ops.GTE },
|
|
15032
|
+
formatExclusiveMinimum: { okStr: ">", ok: ops.GT, fail: ops.LTE },
|
|
15033
|
+
};
|
|
15034
|
+
const error = {
|
|
15035
|
+
message: ({ keyword, schemaCode }) => (0, codegen_1.str) `should be ${KWDs[keyword].okStr} ${schemaCode}`,
|
|
15036
|
+
params: ({ keyword, schemaCode }) => (0, codegen_1._) `{comparison: ${KWDs[keyword].okStr}, limit: ${schemaCode}}`,
|
|
15037
|
+
};
|
|
15038
|
+
exports.formatLimitDefinition = {
|
|
15039
|
+
keyword: Object.keys(KWDs),
|
|
15040
|
+
type: "string",
|
|
15041
|
+
schemaType: "string",
|
|
15042
|
+
$data: true,
|
|
15043
|
+
error,
|
|
15044
|
+
code(cxt) {
|
|
15045
|
+
const { gen, data, schemaCode, keyword, it } = cxt;
|
|
15046
|
+
const { opts, self } = it;
|
|
15047
|
+
if (!opts.validateFormats)
|
|
15048
|
+
return;
|
|
15049
|
+
const fCxt = new ajv_1.KeywordCxt(it, self.RULES.all.format.definition, "format");
|
|
15050
|
+
if (fCxt.$data)
|
|
15051
|
+
validate$DataFormat();
|
|
15052
|
+
else
|
|
15053
|
+
validateFormat();
|
|
15054
|
+
function validate$DataFormat() {
|
|
15055
|
+
const fmts = gen.scopeValue("formats", {
|
|
15056
|
+
ref: self.formats,
|
|
15057
|
+
code: opts.code.formats,
|
|
15058
|
+
});
|
|
15059
|
+
const fmt = gen.const("fmt", (0, codegen_1._) `${fmts}[${fCxt.schemaCode}]`);
|
|
15060
|
+
cxt.fail$data((0, codegen_1.or)((0, codegen_1._) `typeof ${fmt} != "object"`, (0, codegen_1._) `${fmt} instanceof RegExp`, (0, codegen_1._) `typeof ${fmt}.compare != "function"`, compareCode(fmt)));
|
|
15061
|
+
}
|
|
15062
|
+
function validateFormat() {
|
|
15063
|
+
const format = fCxt.schema;
|
|
15064
|
+
const fmtDef = self.formats[format];
|
|
15065
|
+
if (!fmtDef || fmtDef === true)
|
|
15066
|
+
return;
|
|
15067
|
+
if (typeof fmtDef != "object" ||
|
|
15068
|
+
fmtDef instanceof RegExp ||
|
|
15069
|
+
typeof fmtDef.compare != "function") {
|
|
15070
|
+
throw new Error(`"${keyword}": format "${format}" does not define "compare" function`);
|
|
15071
|
+
}
|
|
15072
|
+
const fmt = gen.scopeValue("formats", {
|
|
15073
|
+
key: format,
|
|
15074
|
+
ref: fmtDef,
|
|
15075
|
+
code: opts.code.formats ? (0, codegen_1._) `${opts.code.formats}${(0, codegen_1.getProperty)(format)}` : undefined,
|
|
15076
|
+
});
|
|
15077
|
+
cxt.fail$data(compareCode(fmt));
|
|
15078
|
+
}
|
|
15079
|
+
function compareCode(fmt) {
|
|
15080
|
+
return (0, codegen_1._) `${fmt}.compare(${data}, ${schemaCode}) ${KWDs[keyword].fail} 0`;
|
|
15081
|
+
}
|
|
15082
|
+
},
|
|
15083
|
+
dependencies: ["format"],
|
|
15084
|
+
};
|
|
15085
|
+
const formatLimitPlugin = (ajv) => {
|
|
15086
|
+
ajv.addKeyword(exports.formatLimitDefinition);
|
|
15087
|
+
return ajv;
|
|
15088
|
+
};
|
|
15089
|
+
exports.default = formatLimitPlugin;
|
|
15090
|
+
|
|
15091
|
+
}(limit));(function (module, exports) {
|
|
15092
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15093
|
+
const formats_1 = formats;
|
|
15094
|
+
const limit_1 = limit;
|
|
15095
|
+
const codegen_1 = codegen;
|
|
15096
|
+
const fullName = new codegen_1.Name("fullFormats");
|
|
15097
|
+
const fastName = new codegen_1.Name("fastFormats");
|
|
15098
|
+
const formatsPlugin = (ajv, opts = { keywords: true }) => {
|
|
15099
|
+
if (Array.isArray(opts)) {
|
|
15100
|
+
addFormats(ajv, opts, formats_1.fullFormats, fullName);
|
|
15101
|
+
return ajv;
|
|
15102
|
+
}
|
|
15103
|
+
const [formats, exportName] = opts.mode === "fast" ? [formats_1.fastFormats, fastName] : [formats_1.fullFormats, fullName];
|
|
15104
|
+
const list = opts.formats || formats_1.formatNames;
|
|
15105
|
+
addFormats(ajv, list, formats, exportName);
|
|
15106
|
+
if (opts.keywords)
|
|
15107
|
+
(0, limit_1.default)(ajv);
|
|
15108
|
+
return ajv;
|
|
15109
|
+
};
|
|
15110
|
+
formatsPlugin.get = (name, mode = "full") => {
|
|
15111
|
+
const formats = mode === "fast" ? formats_1.fastFormats : formats_1.fullFormats;
|
|
15112
|
+
const f = formats[name];
|
|
15113
|
+
if (!f)
|
|
15114
|
+
throw new Error(`Unknown format "${name}"`);
|
|
15115
|
+
return f;
|
|
15116
|
+
};
|
|
15117
|
+
function addFormats(ajv, list, fs, exportName) {
|
|
15118
|
+
var _a;
|
|
15119
|
+
var _b;
|
|
15120
|
+
(_a = (_b = ajv.opts.code).formats) !== null && _a !== void 0 ? _a : (_b.formats = (0, codegen_1._) `require("ajv-formats/dist/formats").${exportName}`);
|
|
15121
|
+
for (const f of list)
|
|
15122
|
+
ajv.addFormat(f, fs[f]);
|
|
15123
|
+
}
|
|
15124
|
+
module.exports = exports = formatsPlugin;
|
|
15125
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15126
|
+
exports.default = formatsPlugin;
|
|
15127
|
+
|
|
15128
|
+
}(dist, dist.exports));
|
|
15129
|
+
|
|
15130
|
+
var ajvFormats = /*@__PURE__*/getDefaultExportFromCjs(dist.exports);const pathConverter = (path) => path.replace(/\./g, SEPARATOR);
|
|
14467
15131
|
const errorConverter = (errors) => {
|
|
14468
15132
|
const res = {};
|
|
15133
|
+
// convert error and add as an array item to the particular property
|
|
14469
15134
|
if (errors) {
|
|
14470
15135
|
errors.forEach((i) => {
|
|
15136
|
+
var _a, _b, _c, _d, _e, _f;
|
|
14471
15137
|
if (i.keyword === 'required') {
|
|
15138
|
+
// because it's not parent error, need to move that level
|
|
14472
15139
|
jsonpointer.set(res, `${pathConverter(`${i.instancePath}.${i.params.missingProperty}`)}/-`, i.message);
|
|
14473
15140
|
}
|
|
15141
|
+
else if (i.keyword === 'errorMessage' && ((_c = (_b = (_a = i === null || i === void 0 ? void 0 : i.params) === null || _a === void 0 ? void 0 : _a.errors) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.keyword) === 'required') {
|
|
15142
|
+
jsonpointer.set(res, `${pathConverter(`${i.instancePath}.${(_f = (_e = (_d = i === null || i === void 0 ? void 0 : i.params) === null || _d === void 0 ? void 0 : _d.errors) === null || _e === void 0 ? void 0 : _e[0]) === null || _f === void 0 ? void 0 : _f.params.missingProperty}`)}/-`, i.message);
|
|
15143
|
+
}
|
|
14474
15144
|
else {
|
|
14475
15145
|
jsonpointer.set(res, `${pathConverter(i.instancePath)}/-`, i.message);
|
|
14476
15146
|
}
|
|
14477
15147
|
});
|
|
14478
15148
|
}
|
|
14479
|
-
|
|
15149
|
+
// TODO: if it's a root level validation, looks like : {-: 'should be email'} should be converted
|
|
15150
|
+
return res && res['-'] ? res['-'] : res;
|
|
14480
15151
|
};
|
|
14481
|
-
const validateJSON = (schema,
|
|
15152
|
+
const validateJSON = (schema, data) => {
|
|
14482
15153
|
const ajv = new Ajv({ allErrors: true });
|
|
15154
|
+
ajvErrors(ajv);
|
|
15155
|
+
ajvFormats(ajv);
|
|
14483
15156
|
const validate = ajv.compile(schema);
|
|
14484
15157
|
const valid = validate(data);
|
|
15158
|
+
return {
|
|
15159
|
+
valid: validate(data),
|
|
15160
|
+
error: valid ? null : errorConverter(validate.errors),
|
|
15161
|
+
};
|
|
15162
|
+
};
|
|
15163
|
+
const validateJSONAndStore = (schema, store, data) => {
|
|
15164
|
+
const { valid, error } = validateJSON(schema, data);
|
|
14485
15165
|
return {
|
|
14486
15166
|
store: `${store}${STORE_ERROR_POSTFIX}`,
|
|
14487
15167
|
valid,
|
|
14488
|
-
value:
|
|
15168
|
+
value: error,
|
|
14489
15169
|
};
|
|
14490
15170
|
};const initialState = {};
|
|
14491
|
-
const
|
|
15171
|
+
const globalValidateNewState = (stock, newState, actionStore, actionPath) => {
|
|
14492
15172
|
if (stock === null || stock === void 0 ? void 0 : stock.validations) {
|
|
14493
15173
|
stock.validations.forEach((validateItem) => {
|
|
14494
15174
|
if (validateItem.store === actionStore && `${actionPath}`.startsWith(validateItem.path)) {
|
|
14495
15175
|
if (validateItem.schema) {
|
|
14496
|
-
const
|
|
14497
|
-
const
|
|
14498
|
-
|
|
15176
|
+
const state = D(newState);
|
|
15177
|
+
const stateToBeValidated = jsonPointerGet(state, `${SEPARATOR}${actionStore}${validateItem.path}`);
|
|
15178
|
+
const errors = validateJSONAndStore(validateItem.schema, actionStore, stateToBeValidated);
|
|
14499
15179
|
// eslint-disable-next-line no-param-reassign
|
|
14500
15180
|
newState = jsonPointerSet(newState, `${SEPARATOR}${errors.store}${validateItem.path}`, errors.value);
|
|
14501
15181
|
}
|
|
@@ -14507,12 +15187,12 @@ const reducer = (state = initialState, action) => {
|
|
|
14507
15187
|
switch (action === null || action === void 0 ? void 0 : action.type) {
|
|
14508
15188
|
case DATA_UPDATE: {
|
|
14509
15189
|
const { store = undefined, path = undefined, value = undefined, jsonataDef = undefined, [CURRENT_PATH_NAME]: currentPaths = undefined, stock = undefined, } = (action === null || action === void 0 ? void 0 : action.payload) || {};
|
|
14510
|
-
if (store && path && !
|
|
15190
|
+
if (store && path && !isValidJson(value)) {
|
|
14511
15191
|
const storekey = `${store}`;
|
|
14512
15192
|
let convertedPath = currentPaths && currentPaths[storekey] && currentPaths[storekey].path
|
|
14513
15193
|
? changeRelativePath(`${currentPaths[storekey].path}${SEPARATOR}${path}`)
|
|
14514
15194
|
: changeRelativePath(path);
|
|
14515
|
-
convertedPath = convertedPath
|
|
15195
|
+
convertedPath = jsonPointerFix(convertedPath);
|
|
14516
15196
|
const absolutePathWithStoreKey = `${SEPARATOR}${storekey}${convertedPath}`;
|
|
14517
15197
|
const newState = produce(state, (draft) => {
|
|
14518
15198
|
if (jsonataDef) {
|
|
@@ -14535,8 +15215,12 @@ const reducer = (state = initialState, action) => {
|
|
|
14535
15215
|
// eslint-disable-next-line no-param-reassign
|
|
14536
15216
|
draft = jsonPointerSet(draft, absolutePathWithStoreKey, value);
|
|
14537
15217
|
}
|
|
15218
|
+
// set, if a leaf touched
|
|
15219
|
+
// TODO if array or object touched, can easily overwite the leaf touched
|
|
15220
|
+
// eslint-disable-next-line no-param-reassign
|
|
15221
|
+
draft = jsonPointerSet(draft, `${SEPARATOR}${storekey}${STORE_TOUCH_POSTFIX}${convertedPath}`, true);
|
|
14538
15222
|
// if validatior has match, need to validate it synchronously
|
|
14539
|
-
|
|
15223
|
+
globalValidateNewState(stock, draft, store, convertedPath);
|
|
14540
15224
|
});
|
|
14541
15225
|
return newState;
|
|
14542
15226
|
}
|