@jsonui/core 0.0.12 → 0.1.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/README.md +20 -0
- package/dist/cjs/index.js +14600 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/types/index.d.ts +13 -0
- package/dist/{stock → cjs/types/stock}/Stock.d.ts +27 -27
- package/dist/cjs/types/stock/Stock.test.d.ts +1 -0
- package/dist/{stock → cjs/types/stock}/appRootFunctions.d.ts +7 -7
- package/dist/{stock → cjs/types/stock}/functions.d.ts +7 -7
- package/dist/{stock → cjs/types/stock}/validation.d.ts +7 -7
- package/dist/{store → cjs/types/store}/persistConfig.d.ts +8 -8
- package/dist/{store → cjs/types/store}/reducers.d.ts +4 -4
- package/dist/{store → cjs/types/store}/root/actions.d.ts +10 -10
- package/dist/{store → cjs/types/store}/root/reducer.d.ts +4 -4
- package/dist/cjs/types/store/root/reducer.test.d.ts +1 -0
- package/dist/cjs/types/store/root/selector.test.d.ts +1 -0
- package/dist/{store → cjs/types/store}/root/selectors.d.ts +11 -11
- package/dist/{util → cjs/types/utils}/I18n.d.ts +27 -27
- package/dist/cjs/types/utils/I18n.test.d.ts +1 -0
- package/dist/{utils → cjs/types/utils}/constants.d.ts +23 -19
- package/dist/{utils → cjs/types/utils}/contextHandler.d.ts +4 -4
- package/dist/{util → cjs/types/utils}/jsonRefResolver.d.ts +2 -2
- package/dist/{utils → cjs/types/utils}/types.d.ts +27 -27
- package/dist/cjs/types/utils/util.d.ts +18 -0
- package/dist/cjs/types/utils/util.test.d.ts +1 -0
- package/dist/{wrapper → cjs/types/wrapper}/wrapperUtil.d.ts +15 -15
- package/dist/esm/index.js +14600 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/types/index.d.ts +13 -0
- package/dist/esm/types/stock/Stock.d.ts +27 -0
- package/dist/esm/types/stock/Stock.test.d.ts +1 -0
- package/dist/esm/types/stock/appRootFunctions.d.ts +7 -0
- package/dist/esm/types/stock/functions.d.ts +7 -0
- package/dist/esm/types/stock/validation.d.ts +7 -0
- package/dist/esm/types/store/persistConfig.d.ts +8 -0
- package/dist/esm/types/store/reducers.d.ts +4 -0
- package/dist/esm/types/store/root/actions.d.ts +10 -0
- package/dist/esm/types/store/root/reducer.d.ts +4 -0
- package/dist/esm/types/store/root/reducer.test.d.ts +1 -0
- package/dist/esm/types/store/root/selector.test.d.ts +1 -0
- package/dist/esm/types/store/root/selectors.d.ts +11 -0
- package/dist/{utils → esm/types/utils}/I18n.d.ts +27 -27
- package/dist/esm/types/utils/I18n.test.d.ts +1 -0
- package/dist/{util → esm/types/utils}/constants.d.ts +23 -19
- package/dist/esm/types/utils/contextHandler.d.ts +4 -0
- package/dist/{utils → esm/types/utils}/jsonRefResolver.d.ts +2 -2
- package/dist/{util → esm/types/utils}/types.d.ts +27 -27
- package/dist/esm/types/utils/util.d.ts +18 -0
- package/dist/esm/types/utils/util.test.d.ts +1 -0
- package/dist/esm/types/wrapper/wrapperUtil.d.ts +15 -0
- package/dist/index.d.ts +273 -14
- package/package.json +22 -9
- package/.eslintrc.json +0 -52
- package/.prettierrc +0 -6
- package/dist/index.cjs +0 -2
- package/dist/index.cjs.map +0 -1
- package/dist/index.modern.js +0 -2
- package/dist/index.modern.js.map +0 -1
- package/dist/index.module.mjs +0 -2
- package/dist/index.module.mjs.map +0 -1
- package/dist/index.umd.js +0 -2
- package/dist/index.umd.js.map +0 -1
- package/dist/store/renderers/actions.d.ts +0 -10
- package/dist/store/renderers/reducer.d.ts +0 -2
- package/dist/store/renderers/selectors.d.ts +0 -5
- package/dist/util/contextHandler.d.ts +0 -3
- package/dist/util/util.d.ts +0 -22
- package/dist/utils/util.d.ts +0 -23
- package/src/index.ts +0 -30
- package/src/stock/Stock.ts +0 -75
- package/src/stock/appRootFunctions.ts +0 -15
- package/src/stock/functions.ts +0 -25
- package/src/stock/validation.ts +0 -30
- package/src/store/persistConfig.ts +0 -20
- package/src/store/reducers.ts +0 -6
- package/src/store/root/actions.ts +0 -12
- package/src/store/root/reducer.ts +0 -71
- package/src/store/root/selectors.ts +0 -61
- package/src/typings/key-value-replace.d.ts +0 -8
- package/src/utils/I18n.ts +0 -99
- package/src/utils/constants.ts +0 -21
- package/src/utils/contextHandler.ts +0 -5
- package/src/utils/jsonRefResolver.ts +0 -88
- package/src/utils/types.ts +0 -35
- package/src/utils/util.ts +0 -144
- package/src/wrapper/wrapperUtil.tsx +0 -138
- package/tsconfig.json +0 -5
package/package.json
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsonui/core",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"source": "src/index.ts",
|
|
6
|
-
"main": "dist/index.
|
|
7
|
-
"module": "dist/index.
|
|
8
|
-
"
|
|
6
|
+
"main": "dist/cjs/index.js",
|
|
7
|
+
"module": "dist/esm/index.js",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
9
11
|
"types": "dist/index.d.ts",
|
|
10
12
|
"type": "module",
|
|
11
13
|
"scripts": {
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
14
|
+
"lint": "eslint src --ext .jsx,.js,.tsx,.ts",
|
|
15
|
+
"test": "jest",
|
|
16
|
+
"build": "rollup -c --compact",
|
|
17
|
+
"start": "rollup -c --watch"
|
|
15
18
|
},
|
|
16
19
|
"publishConfig": {
|
|
17
20
|
"access": "public"
|
|
@@ -32,6 +35,11 @@
|
|
|
32
35
|
"react-dom": "^17.0.2"
|
|
33
36
|
},
|
|
34
37
|
"devDependencies": {
|
|
38
|
+
"@rollup/plugin-commonjs": "^21.0.1",
|
|
39
|
+
"@rollup/plugin-json": "^4.1.0",
|
|
40
|
+
"@rollup/plugin-node-resolve": "^13.1.3",
|
|
41
|
+
"@rollup/plugin-typescript": "^8.3.0",
|
|
42
|
+
"@types/jest": "^27.4.0",
|
|
35
43
|
"@types/traverse": "^0.6.32",
|
|
36
44
|
"@typescript-eslint/eslint-plugin": "^5.10.0",
|
|
37
45
|
"@typescript-eslint/parser": "^5.10.0",
|
|
@@ -40,7 +48,12 @@
|
|
|
40
48
|
"eslint-plugin-import": "^2.25.3",
|
|
41
49
|
"eslint-plugin-jsx-a11y": "^6.5.1",
|
|
42
50
|
"eslint-plugin-react": "^7.28.0",
|
|
43
|
-
"eslint-plugin-react-hooks": "^4.3.0"
|
|
51
|
+
"eslint-plugin-react-hooks": "^4.3.0",
|
|
52
|
+
"jest": "^27.5.1",
|
|
53
|
+
"rollup": "^2.67.3",
|
|
54
|
+
"rollup-plugin-dts": "^4.1.0",
|
|
55
|
+
"rollup-plugin-visualizer": "^5.5.4",
|
|
56
|
+
"ts-jest": "^27.1.3"
|
|
44
57
|
},
|
|
45
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "114bfde08c68bb604f99f047119a5d0eb2ad9e06"
|
|
46
59
|
}
|
package/.eslintrc.json
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"env": {
|
|
3
|
-
"browser": true,
|
|
4
|
-
"es2021": true
|
|
5
|
-
},
|
|
6
|
-
"extends": [
|
|
7
|
-
"airbnb",
|
|
8
|
-
"plugin:react/recommended",
|
|
9
|
-
"eslint:recommended",
|
|
10
|
-
"plugin:@typescript-eslint/recommended",
|
|
11
|
-
"plugin:import/typescript",
|
|
12
|
-
"plugin:prettier/recommended",
|
|
13
|
-
"prettier"
|
|
14
|
-
],
|
|
15
|
-
"parser": "@typescript-eslint/parser",
|
|
16
|
-
"parserOptions": {
|
|
17
|
-
"ecmaFeatures": {
|
|
18
|
-
"jsx": true,
|
|
19
|
-
"ecmaVersion": 6,
|
|
20
|
-
"sourceType": "module"
|
|
21
|
-
},
|
|
22
|
-
"ecmaVersion": 13,
|
|
23
|
-
"sourceType": "module"
|
|
24
|
-
},
|
|
25
|
-
"plugins": ["@typescript-eslint", "prettier", "react-hooks", "react"],
|
|
26
|
-
"rules": {
|
|
27
|
-
"default-param-last": 0,
|
|
28
|
-
"@typescript-eslint/no-explicit-any": 0,
|
|
29
|
-
"react/jsx-props-no-spreading": 0,
|
|
30
|
-
"react/function-component-definition": 0,
|
|
31
|
-
"react/destructuring-assignment": 0,
|
|
32
|
-
"react/prop-types": 0,
|
|
33
|
-
"arrow-body-style": 0,
|
|
34
|
-
"react/jsx-filename-extension": [
|
|
35
|
-
1,
|
|
36
|
-
{
|
|
37
|
-
"extensions": [".js", ".jsx", ".ts", ".tsx"]
|
|
38
|
-
}
|
|
39
|
-
],
|
|
40
|
-
"import/extensions": ["error", "always", { "ts": "never", "tsx": "never", "js": "never", "jsx": "never" }],
|
|
41
|
-
"@typescript-eslint/no-unused-vars":["error", { "ignoreRestSiblings": true }]
|
|
42
|
-
},
|
|
43
|
-
"settings": {
|
|
44
|
-
"react": { "pragma": "React", "version": "detect" },
|
|
45
|
-
"import/resolver": {
|
|
46
|
-
"node": {
|
|
47
|
-
"paths": ["src"],
|
|
48
|
-
"moduleDirectory": ["node_modules", "src"]
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
package/.prettierrc
DELETED
package/dist/index.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var t=require("react"),e=require("lodash/orderBy"),r=require("traverse"),n=require("jsonpointer"),i=require("lodash/cloneDeep"),o=require("lodash/drop"),a=require("lodash/findIndex"),s=require("lodash/pull"),u=require("lodash/compact"),l=require("lodash/findLastIndex"),c=require("lodash/unset"),f=require("lodash/uniq"),h=require("lodash/defaultsDeep"),p=require("ajv"),d=require("key-value-replace"),v=require("redux-persist"),g=require("lodash/pick"),y=require("redux"),m=require("immer");function P(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var E=/*#__PURE__*/P(t),_=/*#__PURE__*/P(e),x=/*#__PURE__*/P(r),j=/*#__PURE__*/P(n),S=/*#__PURE__*/P(i),A=/*#__PURE__*/P(o),b=/*#__PURE__*/P(a),k=/*#__PURE__*/P(s),R=/*#__PURE__*/P(u),$=/*#__PURE__*/P(l),T=/*#__PURE__*/P(c),O=/*#__PURE__*/P(f),q=/*#__PURE__*/P(h),C=/*#__PURE__*/P(p),I=/*#__PURE__*/P(d),D=/*#__PURE__*/P(g),L=/*#__PURE__*/P(m);function N(){return N=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},N.apply(this,arguments)}function W(t,e){if(null==t)return{};var r,n,i={},o=Object.keys(t);for(n=0;n<o.length;n++)e.indexOf(r=o[n])>=0||(i[r]=t[r]);return i}function F(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:String(e)}var M=["data"],w=["set","get"],K=["string","number","boolean","null"],H={__proto__:null,SEPARATOR:"/",STORE_ERROR_POSTFIX:".error",PATH_MODIFIERS_KEY:"$pathModifiers",MODIFIER_KEY:"$modifier",ACTION_KEY:"$action",PERSIST_STORAGE_KEY:"$persistStores",PERSIST_STORAGE_NAMES:M,REF_ASSETS:"$assetsRef",REF_LOCALES:"$locales",REF_VALIDATES:"$validations",STYLE_WEB_NAME:"styleWeb",STYLE_RN_NAME:"styleRN",REDUX_FUNCTIONS:w,PATHNAME:"path",SIMPLE_DATA_TYPES:K,V_CHILDREN_NAME:"$children",V_COMP_NAME:"$comp",ITEM_OF_ARRAY:"item",PAGINATION_ITEM_PER_PAGE:1},U=function(t,e){if(null==t||null==e||"string"!=typeof e)return null;if("/"===e)return t;try{return j.default.get(t,e.startsWith("/")?e:"/"+e)}catch(t){return null}},Y=function(t,e,r){if(null!=t&&null!=e&&"string"==typeof e)if("/"!==e&&""!==e)try{j.default.set(t,e.startsWith("/")?e:"/"+e,r)}catch(t){}else t=r},G=function(t){return"/"+t.join("/")};function B(t){return t&&"object"==typeof t&&!Array.isArray(t)}var V=function(t){var e=t.split("/");e&&e.length>1&&""===e[e.length-1]&&e.pop();var r=$.default(e,function(t){return""===t});r>0&&(e=A.default(e,r)),e=k.default(e,".");var n=0,i=-1;do{n+=1,-1!==(i=b.default(e,function(t){return".."===t}))&&(T.default(e,"["+i+"]"),T.default(e,"["+(i-1)+"]"),e=R.default(e))}while(-1!==i&&n<100);return e.join("/")},z=function(t){return"number"==typeof t},Z={__proto__:null,jsonPointerGet:U,jsonPointerSet:Y,getCleanedTopic:function(t){return!t||"string"!=typeof t||0===t.length||t.length>1024?null:t.replace(/[^0-9a-zA-Z]/g,"-")},pathArrayToPathString:function(t){return t.map(function(t,e){return Number.isInteger(t)?"["+t+"]":(e>0?".":"")+t}).join("")},pathArrayToJsonPointer:G,isObject:B,mergeDeep:function t(e){var r=[].slice.call(arguments,1);if(!r.length)return e;var n=r.shift();if(B(e)&&B(n))for(var i in n){var o,a;B(n[i])?(e[i]||Object.assign(e,((o={})[i]={},o)),t(e[i],n[i])):Object.assign(e,((a={})[i]=n[i],a))}return t.apply(void 0,[e].concat(r))},mergePath:function(t,e){if(!e||"object"!=typeof e)return t;var r=S.default(t);return Object.entries(e).forEach(function(t){j.default.set(r,t[0],t[1])}),r},changeRelativePath:V,getStyleForWeb:function(t,e){return void 0===t&&(t={}),"View"===e?function(t){var e=t.parentComp,r=N({display:"flex",flexDirection:"column"},t.style,t.styleWeb);return r&&r.borderWidth&&!r.borderStyle&&(r.borderStyle="solid"),r&&r.flex&&(e&&e.style&&e.style.flex&&e.style.flex<1?(r.height="100%",r.width="100%"):r.height||(r.height=100*r.flex+"%")),r}(t):N({},t.style,t.styleWeb)},noChildren:function(t){return["Image"].includes(t)},isNumber:z},J=["parentComp"],X=["parentComp"],Q=function(t,e){var r=[],n=W(t,J);x.default(n).forEach(function(t){!t||!t.$action||this.path.length>1&&this.path.includes("$children")||r.push({path:this.path,level:this.level})}),_.default(r,["level"],["desc"]).forEach(function(r){try{var n=x.default(t).get(r.path),i="$action",o=n[i],a=W(n,[i].map(F));return x.default(t).set(r.path,function(){try{var r=arguments;return Promise.resolve(e.callFunction(o,a,t,[].slice.call(r))).then(function(){})}catch(t){return Promise.reject(t)}}),Promise.resolve()}catch(t){return Promise.reject(t)}})},tt=function(t,e){var r=[],n=W(t,X);x.default(n).forEach(function(t){!t||!t.$modifier||w.includes(t.$modifier)||this.path.length>1&&this.path.includes("$children")||r.push({path:this.path,level:this.level})}),_.default(r,["level"],["desc"]).forEach(function(r){try{var n=x.default(t).get(r.path),i="$modifier",o=n[i],a=W(n,[i].map(F));return x.default(t).set(r.path,e.callFunction(o,a,t)),Promise.resolve()}catch(t){return Promise.reject(t)}})},et=function(t,e){var r,n=N({},K.includes(typeof t)?{}:t,((r={parentComp:e}).$comp=K.includes(typeof t)||null==t?"_PrimitiveProp":t.$comp,r.$children=K.includes(typeof t)||null==t?t:t.$children,r));for(var i in n)void 0===n[i]&&delete n[i];return n},rt=function(t,e,r){var n=W(t,["parentComp","$children"].map(F));return t&&Array.isArray(e)?e.map(function(t,e){/*#__PURE__*/return E.default.createElement(r,N({key:e},et(t,n)))}):/*#__PURE__*/E.default.createElement(r,et(e,n))},nt={__proto__:null,actionBuilder:Q,modifierBuilder:tt,pathModifierBuilder:function(t,e){var r=N({},t.currentPaths),n=!1;return e&&0!==Object.keys(e).length&&Object.keys(e).forEach(function(t){if(t&&e[t]&&null!=e[t].path){var i,o,a=e[t].path,s=r[t];n=!0,r[t]=!(""+a).startsWith("/")&&s&&s.path?((i={}).path=V(s.path+"/"+a),i):((o={}).path=a,o),r[t]&&!(""+r[t].path).startsWith("/")&&(r[t].path="/"+r[t].path)}}),n?{currentPaths:r}:void 0},getWrapperProps:et,getRootWrapperProps:function(t,e){var r=N({},t);return tt(r,e),Q(r,e),r.isList&&(r.$children=function(t){var e=t.page,r=void 0===e?0:e,n=t.listLength,i=void 0===n?0:n,o=t.itemPerPage,a=void 0===o?1:o,s=t.listItem,u=t.$pathModifiers,l=[];if(z(r)&&z(i)&&z(a)&&u)for(var c=(r=r>=0?r:0)*(a=a>=0?a:0)<=(i=i>=0?i:0)?r*a:0,f=u[Object.keys(u)[0]],h=c;h<i&&h<c+a;h++){var p,d;l.push(N({},s,((d={}).$pathModifiers=N({},u,((p={})[Object.keys(u)[0]]=N({},f,{path:h}),p)),d)))}return l}(r)),r},getChildrensForRoot:rt,generateChildren:function(t,e){return"_PrimitiveProp"!==t.$comp?rt(t,t.$children,e.Wrapper):t.$children}},it=function(t){return!(!t||"string"!=typeof t)&&/^[A-Za-z]*:\/\//.test(t)},ot=function(t){var e=t.split("/");e=k.default(e,".");var r=0,n=-1;do{r+=1,-1!==(n=b.default(e,function(t){return".."===t}))&&(T.default(e,"["+n+"]"),T.default(e,"["+(n-1)+"]"),e=R.default(e))}while(-1!==n&&r<100);return e.join("/")},at={__proto__:null,collectJsonKeys:function(t,e){var r=[];x.default(e).forEach(function(e){e&&e[t]&&this&&!this.circular&&r.push(e[t])});var n={};return O.default(R.default(r)).forEach(function(t){return q.default(n,t)}),n},getRefs:function(t,e,r){void 0===r&&(r="");var n=[];return x.default(e).forEach(function(e){if(e&&e[t]&&this&&!this.circular){var i,o=e[t];if((s=o)&&"string"==typeof s&&!it(s)&&s.startsWith("/")){var a=function(t){if(t&&"string"==typeof t){var e=t.match(/^([A-Za-z]*:\/\/[^/]*)(\/|)/);if(e)return e[1]+"/"}return null}(r);i=ot(""+a+o)}else i=function(t){return!!t&&"string"==typeof t&&!it(t)&&!t.startsWith("/")}(o)?ot(""+r+o):o;e[t]=i,n.push(i)}var s}),O.default(R.default(n))}},st={$id:"http://example.com/schemas/schema.json",type:"object",additionalProperties:{type:"object",properties:{translation:{type:"object",additionalProperties:{type:"string"},propertyNames:{type:"string"},minProperties:1},additionalProperties:!1}},propertyNames:{pattern:"^[A-Za-z0-9_-]*$",type:"string"},minProperties:1},ut=t.createContext(null),lt=t.createContext({}),ct=["parentComp"],ft=function(t,e,r){var n=e.store,i=e.path,o=e.isError,a=void 0!==o&&o,s=function(t){return t.root}(t);return n&&i?function(t,e,r){return U(t[e],r)}(s,n+(a?".error":""),r&&r[n]&&r[n].path?V(r[n].path+"/"+i):i):null},ht={getStateValue:function(t,e,r,n){var i=(void 0===e?{}:e).currentPaths,o=t.store,a=t.path,s=n.reduxStore.getState();return ft(s,{store:o,path:a},i)},get:function(t,e,r,n){var i=(void 0===e?{}:e).currentPaths,o=t.store,a=t.path,s=n.reduxStore.getState();return ft(s,{store:o,path:a},i)},set:function(t,e,r,n){n.reduxStore.dispatch({type:"DATA_UPDATE",payload:N({},t,{value:t&&void 0!==t.value?t.value:r[0],currentPaths:e.currentPaths,stock:n})})}},pt={key:"main",whitelist:["root"],transforms:[v.createTransform(function(t,e){return"root"!==e?t:D.default(t,M)},function(t,e){return"root"!==e?t:D.default(t,M)})]},dt=function(t){return t.replace(/\./g,"/")},vt={data:{}},gt=y.combineReducers({root:function(t,e){switch(void 0===t&&(t=vt),e.type){case"DATA_UPDATE":var r=e.payload,n=r.store,i=r.path,o=r.value,a=r.jsonataDef,s=r.currentPaths,u=r.stock;if(n&&i){var l=""+n,c=V(s&&s[l]&&s[l].path?s[l].path+"/"+i:i),f="/"+l+c;return L.default(t,function(t){if(a)try{var e=require("jsonata")(a).evaluate(o);Y(t,f,e)}catch(e){console.error("jsonata error",e,a),Y(t,f,o)}else Y(t,f,o);!function(t,e,r,n){null!=t&&t.validations&&t.validations.forEach(function(t){if(t.store===r&&(""+n).startsWith(t.path)&&t.schema){var i=U(e,"/"+r+t.path),o=function(t,e,r){var n,i,o=new C.default({allErrors:!0}).compile(t),a=o(r);return{store:e+".error",valid:a,value:a?null:(n=o.errors,i={},n&&n.forEach(function(t){j.default.set(i,"required"===t.keyword?dt(t.instancePath+"."+t.params.missingProperty)+"/-":dt(t.instancePath)+"/-",t.message)}),i)}}(t.schema,r,i);Y(e,"/"+o.store+t.path,o.value)}})}(u,t,n,c)})}return t;case"PURGE":return vt;default:return t}}}),yt={deletePersistDataStore:function(t,e,r,n){try{return n.reduxStore.dispatch({type:"PURGE",payload:null}),Promise.resolve(n.callFunction("reloadApp",{})).then(function(){})}catch(t){return Promise.reject(t)}}};exports.I18n=function(t){var e=this,r=t.language,n=void 0===r?"en":r,i=t.resources,o=t.nonExistsHandler,a=t.keyPrefix,s=void 0===a?"{{":a,u=t.keyPostfix,l=void 0===u?"}}":u;this.language=void 0,this.languages=void 0,this.resources=void 0,this.keyPrefix=void 0,this.keyPostfix=void 0,this.nonExistsHandler=void 0,this.availableLanguageKey=void 0,this.getLocales=function(){return(e.language.includes("-")?e.language.split("-"):e.language.split("_")||[])[0]},this.t=function(t,r,n){if(!e.resources||!e.resources&&!e.language&&!n||!e.resources[""+(e.availableLanguageKey||n)])return t;var i=e.resources[""+(e.availableLanguageKey||n)].translation[t];return i?r?I.default(i,r,[e.keyPrefix,e.keyPostfix]):i:(e.nonExistsHandler&&"function"==typeof e.nonExistsHandler&&e.nonExistsHandler(t),t)},this.language=n,this.nonExistsHandler=o,this.keyPrefix=s,this.keyPostfix=l,(new C.default).compile(st)(i)&&(this.resources=i),this.languages=Object.keys(i),this.languages&&this.languages.includes(this.language)?this.availableLanguageKey=this.language:this.languages&&this.languages.includes(this.getLocales())&&(this.availableLanguageKey=this.getLocales())},exports.PathModifierContext=lt,exports.Stock=function(t,e,r){var n=this;this.stock=void 0,this.Wrapper=void 0,this.reduxStore=void 0,this.validations=void 0,this.init=function(t){var e=t.functions;n.stock.components=N({},n.stock.components,t.components),n.stock.functions=N({},n.stock.functions,e)},this.registerComponent=function(t,e){t&&"string"==typeof t&&t.length>0&&!(t in n.stock.components)&&(n.stock.components[t]=e)},this.registerFunction=function(t,e){t&&"string"==typeof t&&t.length>0&&!(t in n.stock.functions)&&(n.stock.functions[t]=e)},this.callFunction=function(t,e,r,i){return e&&t&&t in n.stock.functions?n.stock.functions[t](e,r,i,n):null},this.getComponent=function(t){return t&&t in n.stock.components?n.stock.components[t]:n.stock.components._Undefined},this.stock={components:{},functions:{}},this.Wrapper=e,this.validations=[],this.reduxStore=r,this.init(t)},exports.StockContext=ut,exports.appRootFunctions=yt,exports.constants=H,exports.genAllStateProps=function(t,e){var r=e.currentPaths,n={},i=[],o=W(e,ct);return x.default(o).forEach(function(t){!t||!t.$modifier||"get"!==t.$modifier||this.path.length>1&&this.path.includes("$children")||i.push({path:this.path,level:this.level})}),_.default(i,["level"],["desc"]).forEach(function(i){try{var o=x.default(e).get(i.path),a="$modifier",s=o[a],u=W(o,[a].map(F));if("get"===s&&u.store&&u.path){var l=ft(t,u,r);if(u.jsonataDef)try{l=require("jsonata")(u.jsonataDef).evaluate(l)}catch(t){console.error("jsonata error",t,u.jsonataDef)}n[G(i.path)]=l}return Promise.resolve()}catch(t){return Promise.reject(t)}}),n},exports.jsonRefResolver=at,exports.persistConfig=pt,exports.stockFunctions=ht,exports.storeReducers=gt,exports.util=Z,exports.wrapperUtil=nt;
|
|
2
|
-
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../src/stock/Stock.ts","../src/utils/constants.ts","../src/utils/util.ts","../src/wrapper/wrapperUtil.tsx","../src/utils/jsonRefResolver.ts","../src/utils/I18n.ts","../src/utils/contextHandler.ts","../src/store/root/selectors.ts","../src/stock/functions.ts","../src/store/root/actions.ts","../src/store/persistConfig.ts","../src/stock/validation.ts","../src/store/root/reducer.ts","../src/store/reducers.ts","../src/stock/appRootFunctions.ts"],"sourcesContent":["import React from 'react'\nimport { JsonUIFunctions, JsonUIFunctionType } from './appRootFunctions'\n\ninterface JsonUIComponentsType {\n [key: string]: React.ReactNode\n}\n\ninterface NewStockType {\n components: JsonUIComponentsType\n functions: JsonUIFunctions\n}\n\ntype InitType = (prop: NewStockType) => void\ntype RegisterFunctionType = (key: string, value: JsonUIFunctionType) => void\ntype RegisterComponentType = (key: string, value: React.ReactNode) => void\ntype CallFunctionType = (name: string, attr?: any, props?: any, callerArgs?: any) => void\ntype GetComponentType = (componentName: string) => React.ReactNode\n\nexport default class Stock {\n stock: NewStockType\n\n Wrapper: React.ReactNode\n\n reduxStore: any\n\n validations: any\n\n constructor(newStock: NewStockType, Wrapper: React.ReactNode, reduxStore: any) {\n this.stock = {\n components: {} as JsonUIComponentsType,\n functions: {} as JsonUIFunctions,\n }\n this.Wrapper = Wrapper\n this.validations = []\n this.reduxStore = reduxStore\n this.init(newStock)\n }\n\n init: InitType = ({ components, functions }) => {\n this.stock.components = {\n ...this.stock.components,\n ...components,\n }\n this.stock.functions = {\n ...this.stock.functions,\n ...functions,\n }\n }\n\n registerComponent: RegisterComponentType = (key, value) => {\n if (!!key && typeof key === 'string' && key.length > 0 && !(key in this.stock.components)) {\n this.stock.components[key] = value\n }\n }\n\n registerFunction: RegisterFunctionType = (key, value) => {\n if (!!key && typeof key === 'string' && key.length > 0 && !(key in this.stock.functions)) {\n this.stock.functions[key] = value\n }\n }\n\n callFunction: CallFunctionType = (name, attr, props, callerArgs) => {\n if (!!attr && !!name && name in this.stock.functions) {\n const result = this.stock.functions[name](attr, props, callerArgs, this)\n return result\n }\n return null\n }\n\n getComponent: GetComponentType = (componentName) =>\n !!componentName && componentName in this.stock.components\n ? this.stock.components[componentName]\n : // eslint-disable-next-line no-underscore-dangle\n this.stock.components._Undefined\n}\n","export const SEPARATOR = '/'\nexport const STORE_ERROR_POSTFIX = '.error'\n\nexport const PATH_MODIFIERS_KEY = '$pathModifiers'\nexport const MODIFIER_KEY = '$modifier'\nexport const ACTION_KEY = '$action'\nexport const PERSIST_STORAGE_KEY = '$persistStores'\nexport const PERSIST_STORAGE_NAMES = ['data']\nexport const REF_ASSETS = '$assetsRef'\nexport const REF_LOCALES = '$locales'\nexport const REF_VALIDATES = '$validations'\nexport const STYLE_WEB_NAME = 'styleWeb'\nexport const STYLE_RN_NAME = 'styleRN'\nexport const REDUX_FUNCTIONS = ['set', 'get']\n\nexport const PATHNAME = 'path'\nexport const SIMPLE_DATA_TYPES = ['string', 'number', 'boolean', 'null']\nexport const V_CHILDREN_NAME = '$children'\nexport const V_COMP_NAME = '$comp'\nexport const ITEM_OF_ARRAY = 'item'\nexport const PAGINATION_ITEM_PER_PAGE = 1\n","import jsonpointer from 'jsonpointer'\nimport cloneDeep from 'lodash/cloneDeep'\nimport drop from 'lodash/drop'\nimport findIndex from 'lodash/findIndex'\nimport pull from 'lodash/pull'\nimport compact from 'lodash/compact'\nimport findLastIndex from 'lodash/findLastIndex'\nimport unset from 'lodash/unset'\nimport * as c from './constants'\nimport { PropsType } from './types'\n\nexport const jsonPointerGet = (json: any, path?: string) => {\n if (json === null || json === undefined || path === null || path === undefined || typeof path !== 'string') return null\n if (path === c.SEPARATOR /* || path === '' same effect */) return json\n try {\n return jsonpointer.get(json, path.startsWith(c.SEPARATOR) ? path : `${c.SEPARATOR}${path}`)\n } catch (e) {\n return null\n }\n}\n\nexport const jsonPointerSet = (json: any, path?: string, value?: any) => {\n if (json === null || json === undefined || path === null || path === undefined || typeof path !== 'string') return\n if (path === c.SEPARATOR || path === '') {\n // eslint-disable-next-line no-param-reassign\n json = value\n return\n }\n try {\n jsonpointer.set(json, path.startsWith(c.SEPARATOR) ? path : `${c.SEPARATOR}${path}`, value)\n // eslint-disable-next-line no-empty\n } catch (e) {}\n}\n\nexport const getCleanedTopic = (text: string | any) => {\n if (!text || typeof text !== 'string' || text.length === 0 || text.length > 1024) {\n return null\n }\n return text.replace(/[^0-9a-zA-Z]/g, '-')\n}\n\nexport const pathArrayToPathString = (array: string[]) => array.map((i, index) => (Number.isInteger(i) ? `[${i}]` : `${index > 0 ? '.' : ''}${i}`)).join('')\n\nexport const pathArrayToJsonPointer = (array: string[]) => `/${array.join('/')}`\n\n/**\n * Simple object check.\n * @param item\n * @returns {boolean}\n */\nexport function isObject(item: any) {\n return item && typeof item === 'object' && !Array.isArray(item)\n}\n\n/**\n * Deep merge two objects.\n * @param target\n * @param ...sources\n */\nexport function mergeDeep(target: any, ...sources: any): any {\n if (!sources.length) return target\n const source = sources.shift()\n\n if (isObject(target) && isObject(source)) {\n // eslint-disable-next-line no-restricted-syntax\n for (const key in source) {\n if (isObject(source[key])) {\n if (!target[key]) Object.assign(target, { [key]: {} })\n mergeDeep(target[key], source[key])\n } else {\n Object.assign(target, { [key]: source[key] })\n }\n }\n }\n\n return mergeDeep(target, ...sources)\n}\n\nexport const mergePath = (target: any, newState: any) => {\n if (!newState || typeof newState !== 'object') return target\n const newTarget = cloneDeep(target)\n Object.entries(newState).forEach(([key, value]) => {\n jsonpointer.set(newTarget, key, value)\n })\n return newTarget\n}\n\n// eslint-disable-next-line import/prefer-default-export\nexport const changeRelativePath = (path: string) => {\n let pathArray = path.split(c.SEPARATOR)\n if (pathArray && pathArray.length > 1 && pathArray[pathArray.length - 1] === '') {\n pathArray.pop()\n }\n const absolutepathIndex = findLastIndex(pathArray, (i) => i === '')\n if (absolutepathIndex > 0) {\n pathArray = drop(pathArray, absolutepathIndex)\n }\n pathArray = pull(pathArray, '.')\n let count = 0\n let relativepathIndex = -1\n do {\n count += 1\n relativepathIndex = findIndex(pathArray, (i) => i === '..')\n if (relativepathIndex !== -1) {\n unset(pathArray, `[${relativepathIndex}]`)\n unset(pathArray, `[${relativepathIndex - 1}]`)\n pathArray = compact(pathArray)\n }\n } while (relativepathIndex !== -1 && count < 100)\n return pathArray.join(c.SEPARATOR)\n}\n\n// changeRelativePath('111/22222/3333/./anything/../../start')\n\nconst genStyle = (props: PropsType) => {\n const { parentComp } = props\n const style = { display: 'flex', flexDirection: 'column', ...(props.style as any), ...(props[c.STYLE_WEB_NAME] as any) }\n\n if (style && style.borderWidth && !style.borderStyle) {\n style.borderStyle = 'solid'\n }\n if (style && style.flex) {\n if (\n parentComp &&\n (parentComp as any).style &&\n (parentComp as any).style.flex &&\n (parentComp as any).style.flex < 1\n // if smaller or larger, noesn't matter\n ) {\n style.height = `100%`\n style.width = `100%`\n } else if (!style.height) {\n style.height = `${style.flex * 100}%`\n }\n }\n return style\n}\nexport const getStyleForWeb = (props: PropsType = {}, component: string) =>\n component === 'View' ? genStyle(props) : { ...(props.style as any), ...(props[c.STYLE_WEB_NAME] as any) }\n\n// TODO it have to be configurable\nexport const noChildren = (component: string) => ['Image'].includes(component)\n\nexport const isNumber = (a: any) => typeof a === 'number'\n","import React from 'react'\nimport orderBy from 'lodash/orderBy'\nimport traverse from 'traverse'\nimport * as c from 'utils/constants'\nimport * as util from 'utils/util'\nimport Stock from 'stock/Stock'\nimport { PathModifiersType, PathModifierType, PathsType, PropsType, WrapperType } from '../utils/types'\n\nexport const actionBuilder = (props: PropsType, stock: InstanceType<typeof Stock>) => {\n const paths: PathsType = []\n const { parentComp, ...propsNew } = props\n // eslint-disable-next-line func-names\n traverse(propsNew).forEach(function (x) {\n if (\n !!x &&\n !!x[c.ACTION_KEY] &&\n // && !c.REDUX_FUNCTIONS.includes(x[c.ACTION_KEY])\n !(this.path.length > 1 && this.path.includes(c.V_CHILDREN_NAME))\n ) {\n paths.push({ path: this.path, level: this.level })\n }\n })\n orderBy(paths, ['level'], ['desc']).forEach(async (i) => {\n const { [c.ACTION_KEY]: functionName, ...functionParams } = traverse(props).get(i.path)\n traverse(props).set(i.path, async (...callerArgs: any[]) => {\n await stock.callFunction(functionName, functionParams, props, callerArgs)\n })\n })\n}\n\nexport const modifierBuilder = (props: PropsType, stock: InstanceType<typeof Stock>) => {\n const paths: PathsType = []\n const { parentComp, ...propsNew } = props\n // eslint-disable-next-line func-names\n traverse(propsNew).forEach(function (x) {\n if (!!x && !!x[c.MODIFIER_KEY] && !c.REDUX_FUNCTIONS.includes(x[c.MODIFIER_KEY]) && !(this.path.length > 1 && this.path.includes(c.V_CHILDREN_NAME))) {\n paths.push({ path: this.path, level: this.level })\n }\n })\n orderBy(paths, ['level'], ['desc']).forEach(async (i) => {\n const { [c.MODIFIER_KEY]: functionName, ...functionParams } = traverse(props).get(i.path)\n traverse(props).set(i.path, stock.callFunction(functionName, functionParams, props))\n })\n}\n\nexport const pathModifierBuilder = (props: PropsType, pathModifier: PathModifiersType) => {\n const currentPaths: PathModifiersType = { ...(props.currentPaths as PathModifiersType) }\n let modified = false\n if (pathModifier && Object.keys(pathModifier).length !== 0) {\n Object.keys(pathModifier).forEach((key: string) => {\n if (!!key && !!pathModifier[key] && pathModifier[key][c.PATHNAME] !== undefined && pathModifier[key][c.PATHNAME] !== null) {\n const path = pathModifier[key][c.PATHNAME]\n const parent = currentPaths[key]\n modified = true\n if (`${path}`.startsWith(c.SEPARATOR) || !(parent && parent[c.PATHNAME])) {\n currentPaths[key] = { [c.PATHNAME]: path }\n } else {\n currentPaths[key] = { [c.PATHNAME]: util.changeRelativePath(`${parent[c.PATHNAME]}${c.SEPARATOR}${path}`) }\n }\n if (!!currentPaths[key] && !`${currentPaths[key][c.PATHNAME]}`.startsWith(c.SEPARATOR)) {\n currentPaths[key][c.PATHNAME] = `${c.SEPARATOR}${currentPaths[key][c.PATHNAME]}`\n }\n }\n })\n }\n return modified ? { currentPaths } : undefined\n}\n\nexport const getWrapperProps = (props: PropsType, parentComp?: any) => {\n const res: PropsType = {\n ...(c.SIMPLE_DATA_TYPES.includes(typeof props) ? {} : props),\n parentComp,\n [c.V_COMP_NAME]: c.SIMPLE_DATA_TYPES.includes(typeof props) || props === undefined || props === null ? '_PrimitiveProp' : props[c.V_COMP_NAME],\n [c.V_CHILDREN_NAME]: c.SIMPLE_DATA_TYPES.includes(typeof props) || props === undefined || props === null ? props : props[c.V_CHILDREN_NAME],\n }\n // eslint-disable-next-line no-restricted-syntax\n for (const i in res) if (typeof res[i] === 'undefined') delete res[i]\n return res\n}\n\nconst genChildenFromListItem = (props: PropsType) => {\n let { page = 0, listLength = 0, itemPerPage = c.PAGINATION_ITEM_PER_PAGE } = props as { page?: number; listLength?: number; itemPerPage?: number }\n const { listItem } = props\n const pathModifiers: PathModifiersType = props[c.PATH_MODIFIERS_KEY] as PathModifiersType\n const children: PropsType[] = []\n if (util.isNumber(page) && util.isNumber(listLength) && util.isNumber(itemPerPage) && pathModifiers) {\n page = page >= 0 ? page : 0\n itemPerPage = itemPerPage >= 0 ? itemPerPage : 0\n listLength = listLength >= 0 ? listLength : 0\n const offset = page * itemPerPage <= listLength ? page * itemPerPage : 0\n const itemkey: string = Object.keys(pathModifiers)[0]\n const firstItem: PathModifierType = pathModifiers[itemkey]\n // eslint-disable-next-line no-plusplus\n for (let i = offset; i < listLength && i < offset + itemPerPage; i++) {\n children.push({\n ...(listItem as PropsType),\n [c.PATH_MODIFIERS_KEY]: {\n ...(pathModifiers as PathModifiersType),\n [Object.keys(pathModifiers)[0]]: {\n ...(firstItem as PathModifierType),\n path: i,\n },\n } as PathModifiersType,\n })\n }\n }\n return children\n}\n\nexport const getRootWrapperProps = (props: PropsType, stock: InstanceType<typeof Stock>) => {\n const newProps = {\n ...props,\n // if the children generation move to wrapper, the redux genAllStateProps doesn't wortk properly. why?\n }\n modifierBuilder(newProps, stock)\n actionBuilder(newProps, stock)\n if (newProps.isList) {\n newProps[c.V_CHILDREN_NAME] = genChildenFromListItem(newProps)\n }\n\n return newProps\n}\n\nexport const getChildrensForRoot = (props: PropsType, children: any, Wrapper: WrapperType) => {\n const { parentComp, [c.V_CHILDREN_NAME]: _notused, ...newParentComp } = props\n // eslint-disable-next-line no-nested-ternary\n return !!props && Array.isArray(children) ? (\n children.map((childrenItem, index) => {\n // eslint-disable-next-line react/no-array-index-key\n return <Wrapper key={index} {...getWrapperProps(childrenItem, newParentComp)} />\n })\n ) : (\n <Wrapper {...getWrapperProps(children, newParentComp)} />\n )\n}\n\nexport const generateChildren = (props: PropsType, { Wrapper }: InstanceType<typeof Stock>) =>\n props[c.V_COMP_NAME] !== '_PrimitiveProp' ? getChildrensForRoot(props, props[c.V_CHILDREN_NAME], Wrapper as WrapperType) : props[c.V_CHILDREN_NAME]\n","import traverse from 'traverse'\nimport uniq from 'lodash/uniq'\nimport compact from 'lodash/compact'\nimport unset from 'lodash/unset'\nimport findIndex from 'lodash/findIndex'\nimport pull from 'lodash/pull'\nimport defaultsDeep from 'lodash/defaultsDeep'\nimport * as c from './constants'\n\nexport const collectJsonKeys = (refConst: string, json: any) => {\n const refs: any[] = []\n // eslint-disable-next-line func-names\n traverse(json).forEach(function (x) {\n if (x && x[refConst] && !!this && !this.circular) {\n refs.push(x[refConst])\n }\n })\n const res = {}\n uniq(compact(refs)).forEach((i) => defaultsDeep(res, i))\n return res\n}\n\nconst isFullPath = (path?: string) => {\n if (!!path && typeof path === 'string') {\n const regex = /^[A-Za-z]*:\\/\\//\n return regex.test(path)\n }\n return false\n}\n\nconst isRelativePath = (path?: string) => !!path && typeof path === 'string' && !isFullPath(path) && !path.startsWith(c.SEPARATOR) // if not full and not start with /\n\nconst isRootPath = (path?: string) => !!path && typeof path === 'string' && !isFullPath(path) && path.startsWith(c.SEPARATOR) // if not full and start with /\n\nconst changeRelativePath = (path: string) => {\n let pathArray = path.split(c.SEPARATOR)\n pathArray = pull(pathArray, '.') // remove all ./\n let count = 0\n let relativepathIndex = -1\n do {\n count += 1\n relativepathIndex = findIndex(pathArray, (i) => i === '..')\n if (relativepathIndex !== -1) {\n unset(pathArray, `[${relativepathIndex}]`)\n unset(pathArray, `[${relativepathIndex - 1}]`)\n pathArray = compact(pathArray)\n }\n } while (relativepathIndex !== -1 && count < 100)\n return pathArray.join(c.SEPARATOR)\n}\n\n// TODO: just workaround, not works with http://localhost for example\nconst getRoot = (url3?: string) => {\n if (!!url3 && typeof url3 === 'string') {\n const regex = /^([A-Za-z]*:\\/\\/[^/]*)(\\/|)/\n const found = url3.match(regex)\n if (found) {\n return `${found[1]}/`\n }\n }\n return null\n}\n\n// console.error('test',isFullPath('asdasd://'))\nexport const getRefs = (refConst: string, json: any, projectPath = '') => {\n const refs: any[] = []\n // eslint-disable-next-line func-names\n traverse(json).forEach(function (x) {\n if (x && x[refConst] && !!this && !this.circular) {\n const ref = x[refConst]\n let absolutePath\n // TODO: If the projectPath is absolute, will be wrong\n if (isRootPath(ref)) {\n const root = getRoot(projectPath)\n absolutePath = changeRelativePath(`${root}${ref}`)\n } else if (isRelativePath(ref)) {\n absolutePath = changeRelativePath(`${projectPath}${ref}`)\n } else {\n absolutePath = ref\n }\n // eslint-disable-next-line no-param-reassign\n x[refConst] = absolutePath\n refs.push(absolutePath)\n }\n })\n // console.warn(refs);\n return uniq(compact(refs))\n}\n","import Ajv from 'ajv'\nimport keyValueReplace from 'key-value-replace'\n\ninterface I18nResources {\n [key: string]: {\n translation: {\n [key: string]: string\n }\n }\n}\n\ninterface I18nProps {\n language?: string\n resources?: I18nResources\n keyPrefix?: string\n keyPostfix?: string\n nonExistsHandler?: (key: string) => void\n}\nconst I18nSchema = {\n $id: 'http://example.com/schemas/schema.json',\n type: 'object',\n additionalProperties: {\n type: 'object',\n properties: {\n translation: {\n type: 'object',\n additionalProperties: {\n type: 'string',\n },\n propertyNames: {\n type: 'string',\n },\n minProperties: 1,\n },\n additionalProperties: false,\n },\n },\n propertyNames: {\n pattern: '^[A-Za-z0-9_-]*$',\n type: 'string',\n },\n minProperties: 1,\n}\n\nexport default class I18n {\n language: string\n\n languages: string[]\n\n resources?: I18nResources\n\n keyPrefix?: string\n\n keyPostfix?: string\n\n nonExistsHandler?: (key: string) => void\n\n availableLanguageKey?: string\n\n // eslint-disable-next-line consistent-this\n constructor({ language = 'en', resources, nonExistsHandler, keyPrefix = '{{', keyPostfix = '}}' }: I18nProps) {\n this.language = language\n this.nonExistsHandler = nonExistsHandler\n this.keyPrefix = keyPrefix\n this.keyPostfix = keyPostfix\n\n const ajv = new Ajv()\n const validate = ajv.compile(I18nSchema)\n const isValid = validate(resources)\n if (isValid) {\n this.resources = resources\n }\n this.languages = Object.keys(resources as any)\n if (this.languages && this.languages.includes(this.language)) {\n this.availableLanguageKey = this.language\n } else if (this.languages && this.languages.includes(this.getLocales())) {\n this.availableLanguageKey = this.getLocales()\n }\n }\n\n getLocales = () => (this.language.includes('-') ? this.language.split('-') : this.language.split('_') || [])[0]\n\n t = (key: string, options?: any, language?: string | null) => {\n if (!this.resources || (!this.resources && !this.language && !language) || !this.resources[`${this.availableLanguageKey || language}`]) {\n return key\n }\n const value = this.resources[`${this.availableLanguageKey || language}`].translation[key]\n if (!value) {\n if (this.nonExistsHandler && typeof this.nonExistsHandler === 'function') {\n this.nonExistsHandler(key)\n }\n return key\n }\n if (options) {\n return keyValueReplace(value, options, [this.keyPrefix, this.keyPostfix])\n }\n return value\n }\n}\n","import { createContext } from 'react'\nimport Stock from 'stock/Stock'\n\nexport const StockContext = createContext<typeof Stock | null>(null)\nexport const PathModifierContext = createContext({})\n","import traverse from 'traverse'\nimport orderBy from 'lodash/orderBy'\nimport * as c from '../../utils/constants'\nimport * as util from '../../utils/util'\nimport { PathModifiersType, PathType, PropsType } from '../../utils/types'\nimport { RootStateType } from './reducer'\n\nexport const getState = (state: any): RootStateType => state.root\n\nexport const getValue = (state: any, store: string, path: string) => util.jsonPointerGet(state[store], path)\n\nexport interface ReduxPathType {\n store: string\n path: string\n isError?: boolean\n}\n\nexport const getStateValue = (globalState: any, { store, path, isError = false }: ReduxPathType, currentPaths: PathModifiersType) => {\n const state = getState(globalState)\n\n if (store && path) {\n const convertedPath =\n currentPaths && currentPaths[store] && currentPaths[store].path ? util.changeRelativePath(`${currentPaths[store].path}${c.SEPARATOR}${path}`) : path\n\n return getValue(state, `${store}${isError ? c.STORE_ERROR_POSTFIX : ''}`, convertedPath)\n }\n return null\n}\n\nexport const genAllStateProps = (globalState: any, props: PropsType) => {\n const { currentPaths } = props\n const result: PropsType = {}\n const paths: PathType[] = []\n const { parentComp, ...propsNew } = props\n // eslint-disable-next-line func-names\n traverse(propsNew).forEach(function (x) {\n if (!!x && !!x[c.MODIFIER_KEY] && x[c.MODIFIER_KEY] === 'get' && !(this.path.length > 1 && this.path.includes(c.V_CHILDREN_NAME))) {\n paths.push({ path: this.path, level: this.level })\n }\n })\n orderBy(paths, ['level'], ['desc']).forEach(async (i) => {\n const { [c.MODIFIER_KEY]: functionName, ...functionParams } = traverse(props).get(i.path)\n if (functionName === 'get' && functionParams.store && functionParams.path) {\n let value = getStateValue(globalState, functionParams, currentPaths as PathModifiersType)\n if (functionParams.jsonataDef) {\n try {\n // eslint-disable-next-line global-require, @typescript-eslint/no-var-requires\n const jsonata = require('jsonata')\n const expression = jsonata(functionParams.jsonataDef)\n value = expression.evaluate(value)\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error('jsonata error', error, functionParams.jsonataDef)\n }\n }\n // traverse(result).set(i.path, value)\n result[util.pathArrayToJsonPointer(i.path)] = value\n }\n })\n return result\n}\n","import { getStateValue as getStateValueSelector } from '../store/root/selectors'\nimport { set as setAction } from '../store/root/actions'\nimport { JsonUIFunctionType } from './appRootFunctions'\nimport { PathModifiersType } from '../utils/types'\n\nconst getStateValue: JsonUIFunctionType = (attr, { currentPaths } = {}, callerArgs, stock) => {\n const { store, path } = attr\n const state = stock.reduxStore.getState()\n return getStateValueSelector(state, { store, path }, currentPaths as PathModifiersType)\n}\nconst get: JsonUIFunctionType = (attr, { currentPaths } = {}, callerArgs, stock) => {\n const { store, path } = attr\n const state = stock.reduxStore.getState()\n return getStateValueSelector(state, { store, path }, currentPaths as PathModifiersType)\n}\nconst set: JsonUIFunctionType = (attr, props, callerArgs, stock) => {\n stock.reduxStore.dispatch(\n setAction({ ...attr, value: attr && attr.value !== undefined ? attr.value : callerArgs[0], currentPaths: props.currentPaths, stock })\n )\n}\nexport default {\n getStateValue,\n get,\n set,\n}\n","export const DATA_UPDATE = 'DATA_UPDATE'\nexport const PURGE = 'PURGE'\n\nexport const set = (payload: any) => ({\n type: DATA_UPDATE,\n payload,\n})\n\nexport const purge = (payload: any) => ({\n type: PURGE,\n payload,\n})\n","import { createTransform } from 'redux-persist'\nimport pick from 'lodash/pick'\nimport * as c from '../utils/constants'\n\nconst SetTransform = createTransform(\n (inboundState, key) => {\n if (key !== 'root') return inboundState\n return pick(inboundState, c.PERSIST_STORAGE_NAMES)\n },\n (outboundState, key) => {\n if (key !== 'root') return outboundState\n return pick(outboundState, c.PERSIST_STORAGE_NAMES)\n }\n)\n\nexport default {\n key: 'main',\n whitelist: ['root'],\n transforms: [SetTransform],\n}\n","import Ajv, { ErrorObject, JSONSchemaType } from 'ajv'\nimport jsonpointer from 'jsonpointer'\nimport * as c from '../utils/constants'\n\nconst pathConverter = (path: string) => path.replace(/\\./g, c.SEPARATOR)\n\nexport const errorConverter = (errors: ErrorObject<string, Record<string, any>, unknown>[] | null | undefined) => {\n const res = {}\n if (errors) {\n errors.forEach((i) => {\n if (i.keyword === 'required') {\n jsonpointer.set(res, `${pathConverter(`${i.instancePath}.${i.params.missingProperty}`)}/-`, i.message)\n } else {\n jsonpointer.set(res, `${pathConverter(i.instancePath)}/-`, i.message)\n }\n })\n }\n return res\n}\n\nexport const validateJSON = (schema: any, store: string, data: any) => {\n const ajv = new Ajv({ allErrors: true })\n const validate = ajv.compile(schema as JSONSchemaType<any>)\n const valid = validate(data)\n return {\n store: `${store}${c.STORE_ERROR_POSTFIX}`,\n valid,\n value: valid ? null : errorConverter(validate.errors),\n }\n}\n","import produce from 'immer'\nimport { AnyAction } from 'redux'\nimport { ValidationType } from '../../utils/types'\nimport * as c from '../../utils/constants'\nimport * as util from '../../utils/util'\nimport { validateJSON } from '../../stock/validation'\nimport { DATA_UPDATE, PURGE } from './actions'\nimport Stock from '../../stock/Stock'\n\nexport type RootStateType = any\n\nconst initialState: RootStateType = {\n data: {},\n}\nconst validateNewState = (stock: InstanceType<typeof Stock>, newState: RootStateType, actionStore: string, actionPath: string) => {\n if (stock?.validations) {\n stock.validations.forEach((validateItem: ValidationType) => {\n if (validateItem.store === actionStore && `${actionPath}`.startsWith(validateItem.path)) {\n if (validateItem.schema) {\n const stateToBeValidated = util.jsonPointerGet(newState, `${c.SEPARATOR}${actionStore}${validateItem.path}`)\n const errors = validateJSON(validateItem.schema, actionStore, stateToBeValidated)\n // console.log('matched validator', `${c.SEPARATOR}${errors.store}${validateItem.path}`, errors)\n util.jsonPointerSet(newState, `${c.SEPARATOR}${errors.store}${validateItem.path}`, errors.value)\n }\n }\n })\n }\n}\nconst reducer = (state = initialState, action: AnyAction) => {\n switch (action.type) {\n case DATA_UPDATE: {\n const { store, path, value, jsonataDef, currentPaths, stock } = action.payload\n if (store && path) {\n const storekey = `${store}`\n const convertedPath =\n currentPaths && currentPaths[storekey] && currentPaths[storekey].path\n ? util.changeRelativePath(`${currentPaths[storekey].path}${c.SEPARATOR}${path}`)\n : util.changeRelativePath(path)\n const absolutePathWithStoreKey = `${c.SEPARATOR}${storekey}${convertedPath}`\n const newState = produce(state, (draft: RootStateType) => {\n if (jsonataDef) {\n try {\n // eslint-disable-next-line global-require, @typescript-eslint/no-var-requires\n const jsonata = require('jsonata')\n const expression = jsonata(jsonataDef)\n const newValue = expression.evaluate(value)\n util.jsonPointerSet(draft, absolutePathWithStoreKey, newValue)\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error('jsonata error', error, jsonataDef)\n util.jsonPointerSet(draft, absolutePathWithStoreKey, value)\n }\n } else {\n util.jsonPointerSet(draft, absolutePathWithStoreKey, value)\n }\n // if validatior has match, need to validate it synchronously\n validateNewState(stock, draft, store, convertedPath)\n })\n return newState\n }\n return state\n }\n case PURGE: {\n return initialState\n }\n default:\n return state\n }\n}\n\nexport default reducer\n","import { combineReducers } from 'redux'\nimport root from './root/reducer'\n\nconst rootReducer = combineReducers({ root })\n\nexport default rootReducer\n","import { purge } from '../store/root/actions'\n\nexport type JsonUIFunctionType = (attr: any, props: any, callerArgs: any, stock: any) => Promise<void> | void | any\n\nexport interface JsonUIFunctions {\n [key: string]: JsonUIFunctionType\n}\nexport const deletePersistDataStore: JsonUIFunctionType = async (attr, props, callerArgs, stock) => {\n stock.reduxStore.dispatch(purge(null))\n await stock.callFunction('reloadApp', {})\n}\n\nconst appRootFunctions: JsonUIFunctions = { deletePersistDataStore }\n\nexport default appRootFunctions\n"],"names":["Stock","PERSIST_STORAGE_NAMES","REDUX_FUNCTIONS","SIMPLE_DATA_TYPES","jsonPointerGet","json","path","jsonpointer","get","startsWith","e","jsonPointerSet","value","set","pathArrayToJsonPointer","array","join","isObject","item","Array","isArray","changeRelativePath","pathArray","split","length","pop","absolutepathIndex","findLastIndex","i","drop","pull","count","relativepathIndex","findIndex","unset","compact","isNumber","a","text","replace","map","index","Number","isInteger","mergeDeep","target","sources","source","shift","key","Object","assign","newState","newTarget","cloneDeep","entries","forEach","props","component","parentComp","style","display","flexDirection","borderWidth","borderStyle","flex","height","width","genStyle","includes","actionBuilder","stock","paths","propsNew","traverse","x","this","push","level","orderBy","functionName","functionParams","callFunction","modifierBuilder","c","getWrapperProps","res","getChildrensForRoot","children","Wrapper","newParentComp","childrenItem","React","pathModifier","currentPaths","modified","keys","parent","util","undefined","newProps","isList","page","listLength","itemPerPage","listItem","pathModifiers","offset","firstItem","genChildenFromListItem","isFullPath","test","refConst","refs","circular","uniq","defaultsDeep","projectPath","absolutePath","ref","root","url3","found","match","getRoot","isRelativePath","I18nSchema","$id","type","additionalProperties","properties","translation","propertyNames","minProperties","pattern","StockContext","createContext","PathModifierContext","getStateValue","globalState","store","isError","state","getState","getValue","attr","callerArgs","reduxStore","getStateValueSelector","dispatch","payload","whitelist","transforms","createTransform","inboundState","pick","outboundState","pathConverter","initialState","data","rootReducer","combineReducers","action","jsonataDef","storekey","convertedPath","absolutePathWithStoreKey","produce","draft","newValue","require","jsonata","evaluate","error","console","actionStore","actionPath","validations","validateItem","schema","stateToBeValidated","errors","validate","Ajv","allErrors","compile","valid","keyword","instancePath","params","missingProperty","message","validateJSON","validateNewState","appRootFunctions","deletePersistDataStore","language","resources","nonExistsHandler","keyPrefix","keyPostfix","languages","availableLanguageKey","getLocales","_this","t","options","keyValueReplace","newStock","init","functions","components","registerComponent","registerFunction","name","getComponent","componentName","_Undefined","result"],"mappings":"4gDAkBqBA,ICXRC,EAAwB,CAAC,QAMzBC,EAAkB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,KAAKqG,YAAc,GACnBrG,KAAKuE,WAAaA,EAClBvE,KAAKqI,KAAKD,qGONkB,SAACrE,EAAkBlF,GACjD,IAAQqC,EAAiBrC,EAAjBqC,aACF4H,EAAoB,GACpBlJ,EAAoB,GACHC,IAAahB,MA0BpC,OAxBAiB,UAASD,GAAUjB,QAAQ,SAAUmB,IAC7BA,IAAOA,EAAC,WAA0C,QAAtBA,EAAC,WAAgCC,KAAKtE,KAAKkB,OAAS,GAAKoD,KAAKtE,KAAK+D,SNnB1E,cMoBzBG,EAAMK,KAAK,CAAEvE,KAAMsE,KAAKtE,KAAMwE,MAAOF,KAAKE,UAG9CC,UAAQP,EAAO,CAAC,SAAU,CAAC,SAAShB,iBAAe5B,OACjD,MAA8D8C,UAASjB,GAAOjD,IAAIoB,EAAEtB,QNrC5D,YMqCE0E,OAAiBC,kBAC3C,GAAqB,QAAjBD,GAA0BC,EAAe2D,OAAS3D,EAAe3E,KAAM,CACzE,IAAIM,EAAQ8H,GAAcC,EAAa1D,EAAgBa,GACvD,GAAIb,EAAekF,WACjB,IAIEvJ,EAFgB8J,QAAQ,UACLC,CAAQ1F,EAAekF,YACvBS,SAAShK,GAC5B,MAAOiK,GAEPC,QAAQD,MAAM,gBAAiBA,EAAO5F,EAAekF,YAIzDuD,EAAOxH,EAA4BtE,EAAEtB,OAASM,2BAhBlD,qCAmBO8M"}
|
package/dist/index.modern.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import t,{createContext as e}from"react";import r from"lodash/orderBy";import s from"traverse";import o from"jsonpointer";import i from"lodash/cloneDeep";import n from"lodash/drop";import a from"lodash/findIndex";import l from"lodash/pull";import c from"lodash/compact";import h from"lodash/findLastIndex";import p from"lodash/unset";import u from"lodash/uniq";import f from"lodash/defaultsDeep";import d from"ajv";import m from"key-value-replace";import{createTransform as g}from"redux-persist";import y from"lodash/pick";import{combineReducers as $}from"redux";import v from"immer";function E(){return E=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(t[s]=r[s])}return t},E.apply(this,arguments)}function P(t,e){if(null==t)return{};var r,s,o={},i=Object.keys(t);for(s=0;s<i.length;s++)e.indexOf(r=i[s])>=0||(o[r]=t[r]);return o}function _(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var s=r.call(t,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:String(e)}class A{constructor(t,e,r){this.stock=void 0,this.Wrapper=void 0,this.reduxStore=void 0,this.validations=void 0,this.init=({components:t,functions:e})=>{this.stock.components=E({},this.stock.components,t),this.stock.functions=E({},this.stock.functions,e)},this.registerComponent=(t,e)=>{t&&"string"==typeof t&&t.length>0&&!(t in this.stock.components)&&(this.stock.components[t]=e)},this.registerFunction=(t,e)=>{t&&"string"==typeof t&&t.length>0&&!(t in this.stock.functions)&&(this.stock.functions[t]=e)},this.callFunction=(t,e,r,s)=>e&&t&&t in this.stock.functions?this.stock.functions[t](e,r,s,this):null,this.getComponent=t=>t&&t in this.stock.components?this.stock.components[t]:this.stock.components._Undefined,this.stock={components:{},functions:{}},this.Wrapper=e,this.validations=[],this.reduxStore=r,this.init(t)}}const S=["data"],b=["set","get"],k=["string","number","boolean","null"],j=1;var x={__proto__:null,SEPARATOR:"/",STORE_ERROR_POSTFIX:".error",PATH_MODIFIERS_KEY:"$pathModifiers",MODIFIER_KEY:"$modifier",ACTION_KEY:"$action",PERSIST_STORAGE_KEY:"$persistStores",PERSIST_STORAGE_NAMES:S,REF_ASSETS:"$assetsRef",REF_LOCALES:"$locales",REF_VALIDATES:"$validations",STYLE_WEB_NAME:"styleWeb",STYLE_RN_NAME:"styleRN",REDUX_FUNCTIONS:b,PATHNAME:"path",SIMPLE_DATA_TYPES:k,V_CHILDREN_NAME:"$children",V_COMP_NAME:"$comp",ITEM_OF_ARRAY:"item",PAGINATION_ITEM_PER_PAGE:j};const R=(t,e)=>{if(null==t||null==e||"string"!=typeof e)return null;if("/"===e)return t;try{return o.get(t,e.startsWith("/")?e:`/${e}`)}catch(t){return null}},O=(t,e,r)=>{if(null!=t&&null!=e&&"string"==typeof e)if("/"!==e&&""!==e)try{o.set(t,e.startsWith("/")?e:`/${e}`,r)}catch(t){}else t=r},T=t=>`/${t.join("/")}`;function I(t){return t&&"object"==typeof t&&!Array.isArray(t)}const D=t=>{let e=t.split("/");e&&e.length>1&&""===e[e.length-1]&&e.pop();const r=h(e,t=>""===t);r>0&&(e=n(e,r)),e=l(e,".");let s=0,o=-1;do{s+=1,o=a(e,t=>".."===t),-1!==o&&(p(e,`[${o}]`),p(e,`[${o-1}]`),e=c(e))}while(-1!==o&&s<100);return e.join("/")},L=t=>"number"==typeof t;var N={__proto__:null,jsonPointerGet:R,jsonPointerSet:O,getCleanedTopic:t=>!t||"string"!=typeof t||0===t.length||t.length>1024?null:t.replace(/[^0-9a-zA-Z]/g,"-"),pathArrayToPathString:t=>t.map((t,e)=>Number.isInteger(t)?`[${t}]`:`${e>0?".":""}${t}`).join(""),pathArrayToJsonPointer:T,isObject:I,mergeDeep:function t(e,...r){if(!r.length)return e;const s=r.shift();if(I(e)&&I(s))for(const r in s)I(s[r])?(e[r]||Object.assign(e,{[r]:{}}),t(e[r],s[r])):Object.assign(e,{[r]:s[r]});return t(e,...r)},mergePath:(t,e)=>{if(!e||"object"!=typeof e)return t;const r=i(t);return Object.entries(e).forEach(([t,e])=>{o.set(r,t,e)}),r},changeRelativePath:D,getStyleForWeb:(t={},e)=>"View"===e?(t=>{const{parentComp:e}=t,r=E({display:"flex",flexDirection:"column"},t.style,t.styleWeb);return r&&r.borderWidth&&!r.borderStyle&&(r.borderStyle="solid"),r&&r.flex&&(e&&e.style&&e.style.flex&&e.style.flex<1?(r.height="100%",r.width="100%"):r.height||(r.height=100*r.flex+"%")),r})(t):E({},t.style,t.styleWeb),noChildren:t=>["Image"].includes(t),isNumber:L};const W=["parentComp"],C=["parentComp"],F=(t,e)=>{const o=[],i=P(t,W);s(i).forEach(function(t){!t||!t.$action||this.path.length>1&&this.path.includes("$children")||o.push({path:this.path,level:this.level})}),r(o,["level"],["desc"]).forEach(async r=>{const o=s(t).get(r.path),i="$action",{[i]:n}=o,a=P(o,[i].map(_));s(t).set(r.path,async(...r)=>{await e.callFunction(n,a,t,r)})})},M=(t,e)=>{const o=[],i=P(t,C);s(i).forEach(function(t){!t||!t.$modifier||b.includes(t.$modifier)||this.path.length>1&&this.path.includes("$children")||o.push({path:this.path,level:this.level})}),r(o,["level"],["desc"]).forEach(async r=>{const o=s(t).get(r.path),i="$modifier",{[i]:n}=o,a=P(o,[i].map(_));s(t).set(r.path,e.callFunction(n,a,t))})},w=(t,e)=>{const r=E({},k.includes(typeof t)?{}:t,{parentComp:e,$comp:k.includes(typeof t)||null==t?"_PrimitiveProp":t.$comp,$children:k.includes(typeof t)||null==t?t:t.$children});for(const t in r)void 0===r[t]&&delete r[t];return r},K=(e,r,s)=>{const o=P(e,["parentComp","$children"].map(_));return e&&Array.isArray(r)?r.map((e,r)=>/*#__PURE__*/t.createElement(s,E({key:r},w(e,o)))):/*#__PURE__*/t.createElement(s,w(r,o))};var H={__proto__:null,actionBuilder:F,modifierBuilder:M,pathModifierBuilder:(t,e)=>{const r=E({},t.currentPaths);let s=!1;return e&&0!==Object.keys(e).length&&Object.keys(e).forEach(t=>{if(t&&e[t]&&null!=e[t].path){const o=e[t].path,i=r[t];s=!0,r[t]=!`${o}`.startsWith("/")&&i&&i.path?{path:D(`${i.path}/${o}`)}:{path:o},r[t]&&!`${r[t].path}`.startsWith("/")&&(r[t].path=`/${r[t].path}`)}}),s?{currentPaths:r}:void 0},getWrapperProps:w,getRootWrapperProps:(t,e)=>{const r=E({},t);return M(r,e),F(r,e),r.isList&&(r.$children=(t=>{let{page:e=0,listLength:r=0,itemPerPage:s=j}=t;const{listItem:o}=t,i=t.$pathModifiers,n=[];if(L(e)&&L(r)&&L(s)&&i){e=e>=0?e:0,s=s>=0?s:0,r=r>=0?r:0;const t=e*s<=r?e*s:0,a=i[Object.keys(i)[0]];for(let e=t;e<r&&e<t+s;e++)n.push(E({},o,{$pathModifiers:E({},i,{[Object.keys(i)[0]]:E({},a,{path:e})})}))}return n})(r)),r},getChildrensForRoot:K,generateChildren:(t,{Wrapper:e})=>"_PrimitiveProp"!==t.$comp?K(t,t.$children,e):t.$children};const Y=t=>!(!t||"string"!=typeof t)&&/^[A-Za-z]*:\/\//.test(t),G=t=>{let e=t.split("/");e=l(e,".");let r=0,s=-1;do{r+=1,s=a(e,t=>".."===t),-1!==s&&(p(e,`[${s}]`),p(e,`[${s-1}]`),e=c(e))}while(-1!==s&&r<100);return e.join("/")};var U={__proto__:null,collectJsonKeys:(t,e)=>{const r=[];s(e).forEach(function(e){e&&e[t]&&this&&!this.circular&&r.push(e[t])});const o={};return u(c(r)).forEach(t=>f(o,t)),o},getRefs:(t,e,r="")=>{const o=[];return s(e).forEach(function(e){if(e&&e[t]&&this&&!this.circular){const i=e[t];let n;if((s=i)&&"string"==typeof s&&!Y(s)&&s.startsWith("/")){const t=(t=>{if(t&&"string"==typeof t){const e=t.match(/^([A-Za-z]*:\/\/[^/]*)(\/|)/);if(e)return`${e[1]}/`}return null})(r);n=G(`${t}${i}`)}else n=(t=>!!t&&"string"==typeof t&&!Y(t)&&!t.startsWith("/"))(i)?G(`${r}${i}`):i;e[t]=n,o.push(n)}var s}),u(c(o))}};const B={$id:"http://example.com/schemas/schema.json",type:"object",additionalProperties:{type:"object",properties:{translation:{type:"object",additionalProperties:{type:"string"},propertyNames:{type:"string"},minProperties:1},additionalProperties:!1}},propertyNames:{pattern:"^[A-Za-z0-9_-]*$",type:"string"},minProperties:1};class V{constructor({language:t="en",resources:e,nonExistsHandler:r,keyPrefix:s="{{",keyPostfix:o="}}"}){this.language=void 0,this.languages=void 0,this.resources=void 0,this.keyPrefix=void 0,this.keyPostfix=void 0,this.nonExistsHandler=void 0,this.availableLanguageKey=void 0,this.getLocales=()=>(this.language.includes("-")?this.language.split("-"):this.language.split("_")||[])[0],this.t=(t,e,r)=>{if(!this.resources||!this.resources&&!this.language&&!r||!this.resources[`${this.availableLanguageKey||r}`])return t;const s=this.resources[`${this.availableLanguageKey||r}`].translation[t];return s?e?m(s,e,[this.keyPrefix,this.keyPostfix]):s:(this.nonExistsHandler&&"function"==typeof this.nonExistsHandler&&this.nonExistsHandler(t),t)},this.language=t,this.nonExistsHandler=r,this.keyPrefix=s,this.keyPostfix=o,(new d).compile(B)(e)&&(this.resources=e),this.languages=Object.keys(e),this.languages&&this.languages.includes(this.language)?this.availableLanguageKey=this.language:this.languages&&this.languages.includes(this.getLocales())&&(this.availableLanguageKey=this.getLocales())}}const q=e(null),z=e({}),Z=["parentComp"],J=(t,{store:e,path:r,isError:s=!1},o)=>{const i=(t=>t.root)(t);return e&&r?((t,e,r)=>R(t[e],r))(i,`${e}${s?".error":""}`,o&&o[e]&&o[e].path?D(`${o[e].path}/${r}`):r):null},X=(t,e)=>{const{currentPaths:o}=e,i={},n=[],a=P(e,Z);return s(a).forEach(function(t){!t||!t.$modifier||"get"!==t.$modifier||this.path.length>1&&this.path.includes("$children")||n.push({path:this.path,level:this.level})}),r(n,["level"],["desc"]).forEach(async r=>{const n=s(e).get(r.path),a="$modifier",{[a]:l}=n,c=P(n,[a].map(_));if("get"===l&&c.store&&c.path){let e=J(t,c,o);if(c.jsonataDef)try{e=require("jsonata")(c.jsonataDef).evaluate(e)}catch(t){console.error("jsonata error",t,c.jsonataDef)}i[T(r.path)]=e}}),i};var Q={getStateValue:(t,{currentPaths:e}={},r,s)=>{const{store:o,path:i}=t,n=s.reduxStore.getState();return J(n,{store:o,path:i},e)},get:(t,{currentPaths:e}={},r,s)=>{const{store:o,path:i}=t,n=s.reduxStore.getState();return J(n,{store:o,path:i},e)},set:(t,e,r,s)=>{s.reduxStore.dispatch({type:"DATA_UPDATE",payload:E({},t,{value:t&&void 0!==t.value?t.value:r[0],currentPaths:e.currentPaths,stock:s})})}},tt={key:"main",whitelist:["root"],transforms:[g((t,e)=>"root"!==e?t:y(t,S),(t,e)=>"root"!==e?t:y(t,S))]};const et=t=>t.replace(/\./g,"/"),rt=t=>{const e={};return t&&t.forEach(t=>{o.set(e,"required"===t.keyword?`${et(`${t.instancePath}.${t.params.missingProperty}`)}/-`:`${et(t.instancePath)}/-`,t.message)}),e},st={data:{}},ot=$({root:(t=st,e)=>{switch(e.type){case"DATA_UPDATE":{const{store:r,path:s,value:o,jsonataDef:i,currentPaths:n,stock:a}=e.payload;if(r&&s){const e=`${r}`,l=D(n&&n[e]&&n[e].path?`${n[e].path}/${s}`:s),c=`/${e}${l}`;return v(t,t=>{if(i)try{const e=require("jsonata")(i).evaluate(o);O(t,c,e)}catch(e){console.error("jsonata error",e,i),O(t,c,o)}else O(t,c,o);((t,e,r,s)=>{null!=t&&t.validations&&t.validations.forEach(t=>{if(t.store===r&&`${s}`.startsWith(t.path)&&t.schema){const s=R(e,`/${r}${t.path}`),o=((t,e,r)=>{const s=new d({allErrors:!0}).compile(t),o=s(r);return{store:`${e}.error`,valid:o,value:o?null:rt(s.errors)}})(t.schema,r,s);O(e,`/${o.store}${t.path}`,o.value)}})})(a,t,r,l)})}return t}case"PURGE":return st;default:return t}}}),it={deletePersistDataStore:async(t,e,r,s)=>{s.reduxStore.dispatch({type:"PURGE",payload:null}),await s.callFunction("reloadApp",{})}};export{V as I18n,z as PathModifierContext,A as Stock,q as StockContext,it as appRootFunctions,x as constants,X as genAllStateProps,U as jsonRefResolver,tt as persistConfig,Q as stockFunctions,ot as storeReducers,N as util,H as wrapperUtil};
|
|
2
|
-
//# sourceMappingURL=index.modern.js.map
|
package/dist/index.modern.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.modern.js","sources":["../src/stock/Stock.ts","../src/utils/constants.ts","../src/utils/util.ts","../src/wrapper/wrapperUtil.tsx","../src/utils/jsonRefResolver.ts","../src/utils/I18n.ts","../src/utils/contextHandler.ts","../src/store/root/selectors.ts","../src/stock/functions.ts","../src/store/root/actions.ts","../src/store/persistConfig.ts","../src/stock/validation.ts","../src/store/root/reducer.ts","../src/store/reducers.ts","../src/stock/appRootFunctions.ts"],"sourcesContent":["import React from 'react'\nimport { JsonUIFunctions, JsonUIFunctionType } from './appRootFunctions'\n\ninterface JsonUIComponentsType {\n [key: string]: React.ReactNode\n}\n\ninterface NewStockType {\n components: JsonUIComponentsType\n functions: JsonUIFunctions\n}\n\ntype InitType = (prop: NewStockType) => void\ntype RegisterFunctionType = (key: string, value: JsonUIFunctionType) => void\ntype RegisterComponentType = (key: string, value: React.ReactNode) => void\ntype CallFunctionType = (name: string, attr?: any, props?: any, callerArgs?: any) => void\ntype GetComponentType = (componentName: string) => React.ReactNode\n\nexport default class Stock {\n stock: NewStockType\n\n Wrapper: React.ReactNode\n\n reduxStore: any\n\n validations: any\n\n constructor(newStock: NewStockType, Wrapper: React.ReactNode, reduxStore: any) {\n this.stock = {\n components: {} as JsonUIComponentsType,\n functions: {} as JsonUIFunctions,\n }\n this.Wrapper = Wrapper\n this.validations = []\n this.reduxStore = reduxStore\n this.init(newStock)\n }\n\n init: InitType = ({ components, functions }) => {\n this.stock.components = {\n ...this.stock.components,\n ...components,\n }\n this.stock.functions = {\n ...this.stock.functions,\n ...functions,\n }\n }\n\n registerComponent: RegisterComponentType = (key, value) => {\n if (!!key && typeof key === 'string' && key.length > 0 && !(key in this.stock.components)) {\n this.stock.components[key] = value\n }\n }\n\n registerFunction: RegisterFunctionType = (key, value) => {\n if (!!key && typeof key === 'string' && key.length > 0 && !(key in this.stock.functions)) {\n this.stock.functions[key] = value\n }\n }\n\n callFunction: CallFunctionType = (name, attr, props, callerArgs) => {\n if (!!attr && !!name && name in this.stock.functions) {\n const result = this.stock.functions[name](attr, props, callerArgs, this)\n return result\n }\n return null\n }\n\n getComponent: GetComponentType = (componentName) =>\n !!componentName && componentName in this.stock.components\n ? this.stock.components[componentName]\n : // eslint-disable-next-line no-underscore-dangle\n this.stock.components._Undefined\n}\n","export const SEPARATOR = '/'\nexport const STORE_ERROR_POSTFIX = '.error'\n\nexport const PATH_MODIFIERS_KEY = '$pathModifiers'\nexport const MODIFIER_KEY = '$modifier'\nexport const ACTION_KEY = '$action'\nexport const PERSIST_STORAGE_KEY = '$persistStores'\nexport const PERSIST_STORAGE_NAMES = ['data']\nexport const REF_ASSETS = '$assetsRef'\nexport const REF_LOCALES = '$locales'\nexport const REF_VALIDATES = '$validations'\nexport const STYLE_WEB_NAME = 'styleWeb'\nexport const STYLE_RN_NAME = 'styleRN'\nexport const REDUX_FUNCTIONS = ['set', 'get']\n\nexport const PATHNAME = 'path'\nexport const SIMPLE_DATA_TYPES = ['string', 'number', 'boolean', 'null']\nexport const V_CHILDREN_NAME = '$children'\nexport const V_COMP_NAME = '$comp'\nexport const ITEM_OF_ARRAY = 'item'\nexport const PAGINATION_ITEM_PER_PAGE = 1\n","import jsonpointer from 'jsonpointer'\nimport cloneDeep from 'lodash/cloneDeep'\nimport drop from 'lodash/drop'\nimport findIndex from 'lodash/findIndex'\nimport pull from 'lodash/pull'\nimport compact from 'lodash/compact'\nimport findLastIndex from 'lodash/findLastIndex'\nimport unset from 'lodash/unset'\nimport * as c from './constants'\nimport { PropsType } from './types'\n\nexport const jsonPointerGet = (json: any, path?: string) => {\n if (json === null || json === undefined || path === null || path === undefined || typeof path !== 'string') return null\n if (path === c.SEPARATOR /* || path === '' same effect */) return json\n try {\n return jsonpointer.get(json, path.startsWith(c.SEPARATOR) ? path : `${c.SEPARATOR}${path}`)\n } catch (e) {\n return null\n }\n}\n\nexport const jsonPointerSet = (json: any, path?: string, value?: any) => {\n if (json === null || json === undefined || path === null || path === undefined || typeof path !== 'string') return\n if (path === c.SEPARATOR || path === '') {\n // eslint-disable-next-line no-param-reassign\n json = value\n return\n }\n try {\n jsonpointer.set(json, path.startsWith(c.SEPARATOR) ? path : `${c.SEPARATOR}${path}`, value)\n // eslint-disable-next-line no-empty\n } catch (e) {}\n}\n\nexport const getCleanedTopic = (text: string | any) => {\n if (!text || typeof text !== 'string' || text.length === 0 || text.length > 1024) {\n return null\n }\n return text.replace(/[^0-9a-zA-Z]/g, '-')\n}\n\nexport const pathArrayToPathString = (array: string[]) => array.map((i, index) => (Number.isInteger(i) ? `[${i}]` : `${index > 0 ? '.' : ''}${i}`)).join('')\n\nexport const pathArrayToJsonPointer = (array: string[]) => `/${array.join('/')}`\n\n/**\n * Simple object check.\n * @param item\n * @returns {boolean}\n */\nexport function isObject(item: any) {\n return item && typeof item === 'object' && !Array.isArray(item)\n}\n\n/**\n * Deep merge two objects.\n * @param target\n * @param ...sources\n */\nexport function mergeDeep(target: any, ...sources: any): any {\n if (!sources.length) return target\n const source = sources.shift()\n\n if (isObject(target) && isObject(source)) {\n // eslint-disable-next-line no-restricted-syntax\n for (const key in source) {\n if (isObject(source[key])) {\n if (!target[key]) Object.assign(target, { [key]: {} })\n mergeDeep(target[key], source[key])\n } else {\n Object.assign(target, { [key]: source[key] })\n }\n }\n }\n\n return mergeDeep(target, ...sources)\n}\n\nexport const mergePath = (target: any, newState: any) => {\n if (!newState || typeof newState !== 'object') return target\n const newTarget = cloneDeep(target)\n Object.entries(newState).forEach(([key, value]) => {\n jsonpointer.set(newTarget, key, value)\n })\n return newTarget\n}\n\n// eslint-disable-next-line import/prefer-default-export\nexport const changeRelativePath = (path: string) => {\n let pathArray = path.split(c.SEPARATOR)\n if (pathArray && pathArray.length > 1 && pathArray[pathArray.length - 1] === '') {\n pathArray.pop()\n }\n const absolutepathIndex = findLastIndex(pathArray, (i) => i === '')\n if (absolutepathIndex > 0) {\n pathArray = drop(pathArray, absolutepathIndex)\n }\n pathArray = pull(pathArray, '.')\n let count = 0\n let relativepathIndex = -1\n do {\n count += 1\n relativepathIndex = findIndex(pathArray, (i) => i === '..')\n if (relativepathIndex !== -1) {\n unset(pathArray, `[${relativepathIndex}]`)\n unset(pathArray, `[${relativepathIndex - 1}]`)\n pathArray = compact(pathArray)\n }\n } while (relativepathIndex !== -1 && count < 100)\n return pathArray.join(c.SEPARATOR)\n}\n\n// changeRelativePath('111/22222/3333/./anything/../../start')\n\nconst genStyle = (props: PropsType) => {\n const { parentComp } = props\n const style = { display: 'flex', flexDirection: 'column', ...(props.style as any), ...(props[c.STYLE_WEB_NAME] as any) }\n\n if (style && style.borderWidth && !style.borderStyle) {\n style.borderStyle = 'solid'\n }\n if (style && style.flex) {\n if (\n parentComp &&\n (parentComp as any).style &&\n (parentComp as any).style.flex &&\n (parentComp as any).style.flex < 1\n // if smaller or larger, noesn't matter\n ) {\n style.height = `100%`\n style.width = `100%`\n } else if (!style.height) {\n style.height = `${style.flex * 100}%`\n }\n }\n return style\n}\nexport const getStyleForWeb = (props: PropsType = {}, component: string) =>\n component === 'View' ? genStyle(props) : { ...(props.style as any), ...(props[c.STYLE_WEB_NAME] as any) }\n\n// TODO it have to be configurable\nexport const noChildren = (component: string) => ['Image'].includes(component)\n\nexport const isNumber = (a: any) => typeof a === 'number'\n","import React from 'react'\nimport orderBy from 'lodash/orderBy'\nimport traverse from 'traverse'\nimport * as c from 'utils/constants'\nimport * as util from 'utils/util'\nimport Stock from 'stock/Stock'\nimport { PathModifiersType, PathModifierType, PathsType, PropsType, WrapperType } from '../utils/types'\n\nexport const actionBuilder = (props: PropsType, stock: InstanceType<typeof Stock>) => {\n const paths: PathsType = []\n const { parentComp, ...propsNew } = props\n // eslint-disable-next-line func-names\n traverse(propsNew).forEach(function (x) {\n if (\n !!x &&\n !!x[c.ACTION_KEY] &&\n // && !c.REDUX_FUNCTIONS.includes(x[c.ACTION_KEY])\n !(this.path.length > 1 && this.path.includes(c.V_CHILDREN_NAME))\n ) {\n paths.push({ path: this.path, level: this.level })\n }\n })\n orderBy(paths, ['level'], ['desc']).forEach(async (i) => {\n const { [c.ACTION_KEY]: functionName, ...functionParams } = traverse(props).get(i.path)\n traverse(props).set(i.path, async (...callerArgs: any[]) => {\n await stock.callFunction(functionName, functionParams, props, callerArgs)\n })\n })\n}\n\nexport const modifierBuilder = (props: PropsType, stock: InstanceType<typeof Stock>) => {\n const paths: PathsType = []\n const { parentComp, ...propsNew } = props\n // eslint-disable-next-line func-names\n traverse(propsNew).forEach(function (x) {\n if (!!x && !!x[c.MODIFIER_KEY] && !c.REDUX_FUNCTIONS.includes(x[c.MODIFIER_KEY]) && !(this.path.length > 1 && this.path.includes(c.V_CHILDREN_NAME))) {\n paths.push({ path: this.path, level: this.level })\n }\n })\n orderBy(paths, ['level'], ['desc']).forEach(async (i) => {\n const { [c.MODIFIER_KEY]: functionName, ...functionParams } = traverse(props).get(i.path)\n traverse(props).set(i.path, stock.callFunction(functionName, functionParams, props))\n })\n}\n\nexport const pathModifierBuilder = (props: PropsType, pathModifier: PathModifiersType) => {\n const currentPaths: PathModifiersType = { ...(props.currentPaths as PathModifiersType) }\n let modified = false\n if (pathModifier && Object.keys(pathModifier).length !== 0) {\n Object.keys(pathModifier).forEach((key: string) => {\n if (!!key && !!pathModifier[key] && pathModifier[key][c.PATHNAME] !== undefined && pathModifier[key][c.PATHNAME] !== null) {\n const path = pathModifier[key][c.PATHNAME]\n const parent = currentPaths[key]\n modified = true\n if (`${path}`.startsWith(c.SEPARATOR) || !(parent && parent[c.PATHNAME])) {\n currentPaths[key] = { [c.PATHNAME]: path }\n } else {\n currentPaths[key] = { [c.PATHNAME]: util.changeRelativePath(`${parent[c.PATHNAME]}${c.SEPARATOR}${path}`) }\n }\n if (!!currentPaths[key] && !`${currentPaths[key][c.PATHNAME]}`.startsWith(c.SEPARATOR)) {\n currentPaths[key][c.PATHNAME] = `${c.SEPARATOR}${currentPaths[key][c.PATHNAME]}`\n }\n }\n })\n }\n return modified ? { currentPaths } : undefined\n}\n\nexport const getWrapperProps = (props: PropsType, parentComp?: any) => {\n const res: PropsType = {\n ...(c.SIMPLE_DATA_TYPES.includes(typeof props) ? {} : props),\n parentComp,\n [c.V_COMP_NAME]: c.SIMPLE_DATA_TYPES.includes(typeof props) || props === undefined || props === null ? '_PrimitiveProp' : props[c.V_COMP_NAME],\n [c.V_CHILDREN_NAME]: c.SIMPLE_DATA_TYPES.includes(typeof props) || props === undefined || props === null ? props : props[c.V_CHILDREN_NAME],\n }\n // eslint-disable-next-line no-restricted-syntax\n for (const i in res) if (typeof res[i] === 'undefined') delete res[i]\n return res\n}\n\nconst genChildenFromListItem = (props: PropsType) => {\n let { page = 0, listLength = 0, itemPerPage = c.PAGINATION_ITEM_PER_PAGE } = props as { page?: number; listLength?: number; itemPerPage?: number }\n const { listItem } = props\n const pathModifiers: PathModifiersType = props[c.PATH_MODIFIERS_KEY] as PathModifiersType\n const children: PropsType[] = []\n if (util.isNumber(page) && util.isNumber(listLength) && util.isNumber(itemPerPage) && pathModifiers) {\n page = page >= 0 ? page : 0\n itemPerPage = itemPerPage >= 0 ? itemPerPage : 0\n listLength = listLength >= 0 ? listLength : 0\n const offset = page * itemPerPage <= listLength ? page * itemPerPage : 0\n const itemkey: string = Object.keys(pathModifiers)[0]\n const firstItem: PathModifierType = pathModifiers[itemkey]\n // eslint-disable-next-line no-plusplus\n for (let i = offset; i < listLength && i < offset + itemPerPage; i++) {\n children.push({\n ...(listItem as PropsType),\n [c.PATH_MODIFIERS_KEY]: {\n ...(pathModifiers as PathModifiersType),\n [Object.keys(pathModifiers)[0]]: {\n ...(firstItem as PathModifierType),\n path: i,\n },\n } as PathModifiersType,\n })\n }\n }\n return children\n}\n\nexport const getRootWrapperProps = (props: PropsType, stock: InstanceType<typeof Stock>) => {\n const newProps = {\n ...props,\n // if the children generation move to wrapper, the redux genAllStateProps doesn't wortk properly. why?\n }\n modifierBuilder(newProps, stock)\n actionBuilder(newProps, stock)\n if (newProps.isList) {\n newProps[c.V_CHILDREN_NAME] = genChildenFromListItem(newProps)\n }\n\n return newProps\n}\n\nexport const getChildrensForRoot = (props: PropsType, children: any, Wrapper: WrapperType) => {\n const { parentComp, [c.V_CHILDREN_NAME]: _notused, ...newParentComp } = props\n // eslint-disable-next-line no-nested-ternary\n return !!props && Array.isArray(children) ? (\n children.map((childrenItem, index) => {\n // eslint-disable-next-line react/no-array-index-key\n return <Wrapper key={index} {...getWrapperProps(childrenItem, newParentComp)} />\n })\n ) : (\n <Wrapper {...getWrapperProps(children, newParentComp)} />\n )\n}\n\nexport const generateChildren = (props: PropsType, { Wrapper }: InstanceType<typeof Stock>) =>\n props[c.V_COMP_NAME] !== '_PrimitiveProp' ? getChildrensForRoot(props, props[c.V_CHILDREN_NAME], Wrapper as WrapperType) : props[c.V_CHILDREN_NAME]\n","import traverse from 'traverse'\nimport uniq from 'lodash/uniq'\nimport compact from 'lodash/compact'\nimport unset from 'lodash/unset'\nimport findIndex from 'lodash/findIndex'\nimport pull from 'lodash/pull'\nimport defaultsDeep from 'lodash/defaultsDeep'\nimport * as c from './constants'\n\nexport const collectJsonKeys = (refConst: string, json: any) => {\n const refs: any[] = []\n // eslint-disable-next-line func-names\n traverse(json).forEach(function (x) {\n if (x && x[refConst] && !!this && !this.circular) {\n refs.push(x[refConst])\n }\n })\n const res = {}\n uniq(compact(refs)).forEach((i) => defaultsDeep(res, i))\n return res\n}\n\nconst isFullPath = (path?: string) => {\n if (!!path && typeof path === 'string') {\n const regex = /^[A-Za-z]*:\\/\\//\n return regex.test(path)\n }\n return false\n}\n\nconst isRelativePath = (path?: string) => !!path && typeof path === 'string' && !isFullPath(path) && !path.startsWith(c.SEPARATOR) // if not full and not start with /\n\nconst isRootPath = (path?: string) => !!path && typeof path === 'string' && !isFullPath(path) && path.startsWith(c.SEPARATOR) // if not full and start with /\n\nconst changeRelativePath = (path: string) => {\n let pathArray = path.split(c.SEPARATOR)\n pathArray = pull(pathArray, '.') // remove all ./\n let count = 0\n let relativepathIndex = -1\n do {\n count += 1\n relativepathIndex = findIndex(pathArray, (i) => i === '..')\n if (relativepathIndex !== -1) {\n unset(pathArray, `[${relativepathIndex}]`)\n unset(pathArray, `[${relativepathIndex - 1}]`)\n pathArray = compact(pathArray)\n }\n } while (relativepathIndex !== -1 && count < 100)\n return pathArray.join(c.SEPARATOR)\n}\n\n// TODO: just workaround, not works with http://localhost for example\nconst getRoot = (url3?: string) => {\n if (!!url3 && typeof url3 === 'string') {\n const regex = /^([A-Za-z]*:\\/\\/[^/]*)(\\/|)/\n const found = url3.match(regex)\n if (found) {\n return `${found[1]}/`\n }\n }\n return null\n}\n\n// console.error('test',isFullPath('asdasd://'))\nexport const getRefs = (refConst: string, json: any, projectPath = '') => {\n const refs: any[] = []\n // eslint-disable-next-line func-names\n traverse(json).forEach(function (x) {\n if (x && x[refConst] && !!this && !this.circular) {\n const ref = x[refConst]\n let absolutePath\n // TODO: If the projectPath is absolute, will be wrong\n if (isRootPath(ref)) {\n const root = getRoot(projectPath)\n absolutePath = changeRelativePath(`${root}${ref}`)\n } else if (isRelativePath(ref)) {\n absolutePath = changeRelativePath(`${projectPath}${ref}`)\n } else {\n absolutePath = ref\n }\n // eslint-disable-next-line no-param-reassign\n x[refConst] = absolutePath\n refs.push(absolutePath)\n }\n })\n // console.warn(refs);\n return uniq(compact(refs))\n}\n","import Ajv from 'ajv'\nimport keyValueReplace from 'key-value-replace'\n\ninterface I18nResources {\n [key: string]: {\n translation: {\n [key: string]: string\n }\n }\n}\n\ninterface I18nProps {\n language?: string\n resources?: I18nResources\n keyPrefix?: string\n keyPostfix?: string\n nonExistsHandler?: (key: string) => void\n}\nconst I18nSchema = {\n $id: 'http://example.com/schemas/schema.json',\n type: 'object',\n additionalProperties: {\n type: 'object',\n properties: {\n translation: {\n type: 'object',\n additionalProperties: {\n type: 'string',\n },\n propertyNames: {\n type: 'string',\n },\n minProperties: 1,\n },\n additionalProperties: false,\n },\n },\n propertyNames: {\n pattern: '^[A-Za-z0-9_-]*$',\n type: 'string',\n },\n minProperties: 1,\n}\n\nexport default class I18n {\n language: string\n\n languages: string[]\n\n resources?: I18nResources\n\n keyPrefix?: string\n\n keyPostfix?: string\n\n nonExistsHandler?: (key: string) => void\n\n availableLanguageKey?: string\n\n // eslint-disable-next-line consistent-this\n constructor({ language = 'en', resources, nonExistsHandler, keyPrefix = '{{', keyPostfix = '}}' }: I18nProps) {\n this.language = language\n this.nonExistsHandler = nonExistsHandler\n this.keyPrefix = keyPrefix\n this.keyPostfix = keyPostfix\n\n const ajv = new Ajv()\n const validate = ajv.compile(I18nSchema)\n const isValid = validate(resources)\n if (isValid) {\n this.resources = resources\n }\n this.languages = Object.keys(resources as any)\n if (this.languages && this.languages.includes(this.language)) {\n this.availableLanguageKey = this.language\n } else if (this.languages && this.languages.includes(this.getLocales())) {\n this.availableLanguageKey = this.getLocales()\n }\n }\n\n getLocales = () => (this.language.includes('-') ? this.language.split('-') : this.language.split('_') || [])[0]\n\n t = (key: string, options?: any, language?: string | null) => {\n if (!this.resources || (!this.resources && !this.language && !language) || !this.resources[`${this.availableLanguageKey || language}`]) {\n return key\n }\n const value = this.resources[`${this.availableLanguageKey || language}`].translation[key]\n if (!value) {\n if (this.nonExistsHandler && typeof this.nonExistsHandler === 'function') {\n this.nonExistsHandler(key)\n }\n return key\n }\n if (options) {\n return keyValueReplace(value, options, [this.keyPrefix, this.keyPostfix])\n }\n return value\n }\n}\n","import { createContext } from 'react'\nimport Stock from 'stock/Stock'\n\nexport const StockContext = createContext<typeof Stock | null>(null)\nexport const PathModifierContext = createContext({})\n","import traverse from 'traverse'\nimport orderBy from 'lodash/orderBy'\nimport * as c from '../../utils/constants'\nimport * as util from '../../utils/util'\nimport { PathModifiersType, PathType, PropsType } from '../../utils/types'\nimport { RootStateType } from './reducer'\n\nexport const getState = (state: any): RootStateType => state.root\n\nexport const getValue = (state: any, store: string, path: string) => util.jsonPointerGet(state[store], path)\n\nexport interface ReduxPathType {\n store: string\n path: string\n isError?: boolean\n}\n\nexport const getStateValue = (globalState: any, { store, path, isError = false }: ReduxPathType, currentPaths: PathModifiersType) => {\n const state = getState(globalState)\n\n if (store && path) {\n const convertedPath =\n currentPaths && currentPaths[store] && currentPaths[store].path ? util.changeRelativePath(`${currentPaths[store].path}${c.SEPARATOR}${path}`) : path\n\n return getValue(state, `${store}${isError ? c.STORE_ERROR_POSTFIX : ''}`, convertedPath)\n }\n return null\n}\n\nexport const genAllStateProps = (globalState: any, props: PropsType) => {\n const { currentPaths } = props\n const result: PropsType = {}\n const paths: PathType[] = []\n const { parentComp, ...propsNew } = props\n // eslint-disable-next-line func-names\n traverse(propsNew).forEach(function (x) {\n if (!!x && !!x[c.MODIFIER_KEY] && x[c.MODIFIER_KEY] === 'get' && !(this.path.length > 1 && this.path.includes(c.V_CHILDREN_NAME))) {\n paths.push({ path: this.path, level: this.level })\n }\n })\n orderBy(paths, ['level'], ['desc']).forEach(async (i) => {\n const { [c.MODIFIER_KEY]: functionName, ...functionParams } = traverse(props).get(i.path)\n if (functionName === 'get' && functionParams.store && functionParams.path) {\n let value = getStateValue(globalState, functionParams, currentPaths as PathModifiersType)\n if (functionParams.jsonataDef) {\n try {\n // eslint-disable-next-line global-require, @typescript-eslint/no-var-requires\n const jsonata = require('jsonata')\n const expression = jsonata(functionParams.jsonataDef)\n value = expression.evaluate(value)\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error('jsonata error', error, functionParams.jsonataDef)\n }\n }\n // traverse(result).set(i.path, value)\n result[util.pathArrayToJsonPointer(i.path)] = value\n }\n })\n return result\n}\n","import { getStateValue as getStateValueSelector } from '../store/root/selectors'\nimport { set as setAction } from '../store/root/actions'\nimport { JsonUIFunctionType } from './appRootFunctions'\nimport { PathModifiersType } from '../utils/types'\n\nconst getStateValue: JsonUIFunctionType = (attr, { currentPaths } = {}, callerArgs, stock) => {\n const { store, path } = attr\n const state = stock.reduxStore.getState()\n return getStateValueSelector(state, { store, path }, currentPaths as PathModifiersType)\n}\nconst get: JsonUIFunctionType = (attr, { currentPaths } = {}, callerArgs, stock) => {\n const { store, path } = attr\n const state = stock.reduxStore.getState()\n return getStateValueSelector(state, { store, path }, currentPaths as PathModifiersType)\n}\nconst set: JsonUIFunctionType = (attr, props, callerArgs, stock) => {\n stock.reduxStore.dispatch(\n setAction({ ...attr, value: attr && attr.value !== undefined ? attr.value : callerArgs[0], currentPaths: props.currentPaths, stock })\n )\n}\nexport default {\n getStateValue,\n get,\n set,\n}\n","export const DATA_UPDATE = 'DATA_UPDATE'\nexport const PURGE = 'PURGE'\n\nexport const set = (payload: any) => ({\n type: DATA_UPDATE,\n payload,\n})\n\nexport const purge = (payload: any) => ({\n type: PURGE,\n payload,\n})\n","import { createTransform } from 'redux-persist'\nimport pick from 'lodash/pick'\nimport * as c from '../utils/constants'\n\nconst SetTransform = createTransform(\n (inboundState, key) => {\n if (key !== 'root') return inboundState\n return pick(inboundState, c.PERSIST_STORAGE_NAMES)\n },\n (outboundState, key) => {\n if (key !== 'root') return outboundState\n return pick(outboundState, c.PERSIST_STORAGE_NAMES)\n }\n)\n\nexport default {\n key: 'main',\n whitelist: ['root'],\n transforms: [SetTransform],\n}\n","import Ajv, { ErrorObject, JSONSchemaType } from 'ajv'\nimport jsonpointer from 'jsonpointer'\nimport * as c from '../utils/constants'\n\nconst pathConverter = (path: string) => path.replace(/\\./g, c.SEPARATOR)\n\nexport const errorConverter = (errors: ErrorObject<string, Record<string, any>, unknown>[] | null | undefined) => {\n const res = {}\n if (errors) {\n errors.forEach((i) => {\n if (i.keyword === 'required') {\n jsonpointer.set(res, `${pathConverter(`${i.instancePath}.${i.params.missingProperty}`)}/-`, i.message)\n } else {\n jsonpointer.set(res, `${pathConverter(i.instancePath)}/-`, i.message)\n }\n })\n }\n return res\n}\n\nexport const validateJSON = (schema: any, store: string, data: any) => {\n const ajv = new Ajv({ allErrors: true })\n const validate = ajv.compile(schema as JSONSchemaType<any>)\n const valid = validate(data)\n return {\n store: `${store}${c.STORE_ERROR_POSTFIX}`,\n valid,\n value: valid ? null : errorConverter(validate.errors),\n }\n}\n","import produce from 'immer'\nimport { AnyAction } from 'redux'\nimport { ValidationType } from '../../utils/types'\nimport * as c from '../../utils/constants'\nimport * as util from '../../utils/util'\nimport { validateJSON } from '../../stock/validation'\nimport { DATA_UPDATE, PURGE } from './actions'\nimport Stock from '../../stock/Stock'\n\nexport type RootStateType = any\n\nconst initialState: RootStateType = {\n data: {},\n}\nconst validateNewState = (stock: InstanceType<typeof Stock>, newState: RootStateType, actionStore: string, actionPath: string) => {\n if (stock?.validations) {\n stock.validations.forEach((validateItem: ValidationType) => {\n if (validateItem.store === actionStore && `${actionPath}`.startsWith(validateItem.path)) {\n if (validateItem.schema) {\n const stateToBeValidated = util.jsonPointerGet(newState, `${c.SEPARATOR}${actionStore}${validateItem.path}`)\n const errors = validateJSON(validateItem.schema, actionStore, stateToBeValidated)\n // console.log('matched validator', `${c.SEPARATOR}${errors.store}${validateItem.path}`, errors)\n util.jsonPointerSet(newState, `${c.SEPARATOR}${errors.store}${validateItem.path}`, errors.value)\n }\n }\n })\n }\n}\nconst reducer = (state = initialState, action: AnyAction) => {\n switch (action.type) {\n case DATA_UPDATE: {\n const { store, path, value, jsonataDef, currentPaths, stock } = action.payload\n if (store && path) {\n const storekey = `${store}`\n const convertedPath =\n currentPaths && currentPaths[storekey] && currentPaths[storekey].path\n ? util.changeRelativePath(`${currentPaths[storekey].path}${c.SEPARATOR}${path}`)\n : util.changeRelativePath(path)\n const absolutePathWithStoreKey = `${c.SEPARATOR}${storekey}${convertedPath}`\n const newState = produce(state, (draft: RootStateType) => {\n if (jsonataDef) {\n try {\n // eslint-disable-next-line global-require, @typescript-eslint/no-var-requires\n const jsonata = require('jsonata')\n const expression = jsonata(jsonataDef)\n const newValue = expression.evaluate(value)\n util.jsonPointerSet(draft, absolutePathWithStoreKey, newValue)\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error('jsonata error', error, jsonataDef)\n util.jsonPointerSet(draft, absolutePathWithStoreKey, value)\n }\n } else {\n util.jsonPointerSet(draft, absolutePathWithStoreKey, value)\n }\n // if validatior has match, need to validate it synchronously\n validateNewState(stock, draft, store, convertedPath)\n })\n return newState\n }\n return state\n }\n case PURGE: {\n return initialState\n }\n default:\n return state\n }\n}\n\nexport default reducer\n","import { combineReducers } from 'redux'\nimport root from './root/reducer'\n\nconst rootReducer = combineReducers({ root })\n\nexport default rootReducer\n","import { purge } from '../store/root/actions'\n\nexport type JsonUIFunctionType = (attr: any, props: any, callerArgs: any, stock: any) => Promise<void> | void | any\n\nexport interface JsonUIFunctions {\n [key: string]: JsonUIFunctionType\n}\nexport const deletePersistDataStore: JsonUIFunctionType = async (attr, props, callerArgs, stock) => {\n stock.reduxStore.dispatch(purge(null))\n await stock.callFunction('reloadApp', {})\n}\n\nconst appRootFunctions: JsonUIFunctions = { deletePersistDataStore }\n\nexport default appRootFunctions\n"],"names":["Stock","constructor","newStock","Wrapper","reduxStore","stock","validations","init","components","functions","this","registerComponent","key","value","length","registerFunction","callFunction","name","attr","props","callerArgs","getComponent","componentName","_Undefined","PERSIST_STORAGE_NAMES","REDUX_FUNCTIONS","SIMPLE_DATA_TYPES","PAGINATION_ITEM_PER_PAGE","jsonPointerGet","json","path","jsonpointer","get","startsWith","e","jsonPointerSet","set","pathArrayToJsonPointer","array","join","isObject","item","Array","isArray","changeRelativePath","pathArray","split","pop","absolutepathIndex","findLastIndex","i","drop","pull","count","relativepathIndex","findIndex","unset","compact","isNumber","a","text","replace","map","index","Number","isInteger","mergeDeep","target","sources","source","shift","Object","assign","newState","newTarget","cloneDeep","entries","forEach","component","parentComp","style","display","flexDirection","borderWidth","borderStyle","flex","height","width","genStyle","includes","actionBuilder","paths","propsNew","traverse","x","push","level","orderBy","async","_c$ACTION_KEY","functionName","functionParams","modifierBuilder","c","_c$MODIFIER_KEY","getWrapperProps","res","$comp","$children","getChildrensForRoot","children","newParentComp","childrenItem","React","pathModifier","currentPaths","modified","keys","parent","util","undefined","newProps","isList","page","listLength","itemPerPage","listItem","pathModifiers","offset","firstItem","$pathModifiers","genChildenFromListItem","isFullPath","test","refConst","refs","circular","uniq","defaultsDeep","projectPath","ref","absolutePath","root","url3","found","match","getRoot","isRelativePath","I18nSchema","$id","type","additionalProperties","properties","translation","propertyNames","minProperties","pattern","I18n","language","resources","nonExistsHandler","keyPrefix","keyPostfix","languages","availableLanguageKey","getLocales","t","options","keyValueReplace","Ajv","compile","validate","StockContext","createContext","PathModifierContext","getStateValue","globalState","store","isError","state","getState","getValue","genAllStateProps","result","jsonataDef","require","jsonata","evaluate","error","console","getStateValueSelector","dispatch","payload","whitelist","transforms","createTransform","inboundState","pick","outboundState","pathConverter","errorConverter","errors","keyword","instancePath","params","missingProperty","message","initialState","data","rootReducer","combineReducers","action","storekey","convertedPath","absolutePathWithStoreKey","produce","draft","newValue","actionStore","actionPath","validateItem","schema","stateToBeValidated","allErrors","valid","validateJSON","validateNewState","appRootFunctions","deletePersistDataStore"],"mappings":"8sCAkBqBA,EASnBC,YAAYC,EAAwBC,EAA0BC,QAR9DC,kBAEAF,oBAEAC,uBAEAE,wBAaAC,KAAiB,EAAGC,WAAAA,EAAYC,UAAAA,MAC9BC,KAAKL,MAAMG,gBACNE,KAAKL,MAAMG,WACXA,GAELE,KAAKL,MAAMI,eACNC,KAAKL,MAAMI,UACXA,SAIPE,kBAA2C,CAACC,EAAKC,KACzCD,GAAsB,iBAARA,GAAoBA,EAAIE,OAAS,KAAOF,UAAYP,MAAMG,cAC5EE,KAAKL,MAAMG,WAAWI,GAAOC,SAIjCE,iBAAyC,CAACH,EAAKC,KACvCD,GAAsB,iBAARA,GAAoBA,EAAIE,OAAS,KAAOF,UAAYP,MAAMI,aAC5EC,KAAKL,MAAMI,UAAUG,GAAOC,SAIhCG,aAAiC,CAACC,EAAMC,EAAMC,EAAOC,IAC7CF,GAAUD,GAAQA,UAAaZ,MAAMI,UAC1BC,KAAKL,MAAMI,UAAUQ,GAAMC,EAAMC,EAAOC,EAAYV,gBAMvEW,aAAkCC,GAC9BA,GAAiBA,UAAsBjB,MAAMG,WAC3CE,KAAKL,MAAMG,WAAWc,GAEtBZ,KAAKL,MAAMG,WAAWe,WA7C1Bb,KAAKL,MAAQ,CACXG,WAAY,GACZC,UAAW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I,MAAOhF,EAAMC,EAAOC,EAAYf,KACxFA,EAAMD,WAAW2L,ULCjBzC,KARmB,QASnB0C,QKFgC,aAC1B3L,EAAMW,aAAa,YAAa"}
|
package/dist/index.module.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import t,{createContext as e}from"react";import r from"lodash/orderBy";import n from"traverse";import o from"jsonpointer";import i from"lodash/cloneDeep";import a from"lodash/drop";import s from"lodash/findIndex";import u from"lodash/pull";import c from"lodash/compact";import l from"lodash/findLastIndex";import h from"lodash/unset";import p from"lodash/uniq";import f from"lodash/defaultsDeep";import d from"ajv";import v from"key-value-replace";import{createTransform as m}from"redux-persist";import g from"lodash/pick";import{combineReducers as y}from"redux";import P from"immer";function E(){return E=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},E.apply(this,arguments)}function _(t,e){if(null==t)return{};var r,n,o={},i=Object.keys(t);for(n=0;n<i.length;n++)e.indexOf(r=i[n])>=0||(o[r]=t[r]);return o}function j(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:String(e)}var A=function(t,e,r){var n=this;this.stock=void 0,this.Wrapper=void 0,this.reduxStore=void 0,this.validations=void 0,this.init=function(t){var e=t.functions;n.stock.components=E({},n.stock.components,t.components),n.stock.functions=E({},n.stock.functions,e)},this.registerComponent=function(t,e){t&&"string"==typeof t&&t.length>0&&!(t in n.stock.components)&&(n.stock.components[t]=e)},this.registerFunction=function(t,e){t&&"string"==typeof t&&t.length>0&&!(t in n.stock.functions)&&(n.stock.functions[t]=e)},this.callFunction=function(t,e,r,o){return e&&t&&t in n.stock.functions?n.stock.functions[t](e,r,o,n):null},this.getComponent=function(t){return t&&t in n.stock.components?n.stock.components[t]:n.stock.components._Undefined},this.stock={components:{},functions:{}},this.Wrapper=e,this.validations=[],this.reduxStore=r,this.init(t)},S=["data"],b=["set","get"],k=["string","number","boolean","null"],x={__proto__:null,SEPARATOR:"/",STORE_ERROR_POSTFIX:".error",PATH_MODIFIERS_KEY:"$pathModifiers",MODIFIER_KEY:"$modifier",ACTION_KEY:"$action",PERSIST_STORAGE_KEY:"$persistStores",PERSIST_STORAGE_NAMES:S,REF_ASSETS:"$assetsRef",REF_LOCALES:"$locales",REF_VALIDATES:"$validations",STYLE_WEB_NAME:"styleWeb",STYLE_RN_NAME:"styleRN",REDUX_FUNCTIONS:b,PATHNAME:"path",SIMPLE_DATA_TYPES:k,V_CHILDREN_NAME:"$children",V_COMP_NAME:"$comp",ITEM_OF_ARRAY:"item",PAGINATION_ITEM_PER_PAGE:1},$=function(t,e){if(null==t||null==e||"string"!=typeof e)return null;if("/"===e)return t;try{return o.get(t,e.startsWith("/")?e:"/"+e)}catch(t){return null}},R=function(t,e,r){if(null!=t&&null!=e&&"string"==typeof e)if("/"!==e&&""!==e)try{o.set(t,e.startsWith("/")?e:"/"+e,r)}catch(t){}else t=r},O=function(t){return"/"+t.join("/")};function T(t){return t&&"object"==typeof t&&!Array.isArray(t)}var I=function(t){var e=t.split("/");e&&e.length>1&&""===e[e.length-1]&&e.pop();var r=l(e,function(t){return""===t});r>0&&(e=a(e,r)),e=u(e,".");var n=0,o=-1;do{n+=1,-1!==(o=s(e,function(t){return".."===t}))&&(h(e,"["+o+"]"),h(e,"["+(o-1)+"]"),e=c(e))}while(-1!==o&&n<100);return e.join("/")},D=function(t){return"number"==typeof t},L={__proto__:null,jsonPointerGet:$,jsonPointerSet:R,getCleanedTopic:function(t){return!t||"string"!=typeof t||0===t.length||t.length>1024?null:t.replace(/[^0-9a-zA-Z]/g,"-")},pathArrayToPathString:function(t){return t.map(function(t,e){return Number.isInteger(t)?"["+t+"]":(e>0?".":"")+t}).join("")},pathArrayToJsonPointer:O,isObject:T,mergeDeep:function t(e){var r=[].slice.call(arguments,1);if(!r.length)return e;var n=r.shift();if(T(e)&&T(n))for(var o in n){var i,a;T(n[o])?(e[o]||Object.assign(e,((i={})[o]={},i)),t(e[o],n[o])):Object.assign(e,((a={})[o]=n[o],a))}return t.apply(void 0,[e].concat(r))},mergePath:function(t,e){if(!e||"object"!=typeof e)return t;var r=i(t);return Object.entries(e).forEach(function(t){o.set(r,t[0],t[1])}),r},changeRelativePath:I,getStyleForWeb:function(t,e){return void 0===t&&(t={}),"View"===e?function(t){var e=t.parentComp,r=E({display:"flex",flexDirection:"column"},t.style,t.styleWeb);return r&&r.borderWidth&&!r.borderStyle&&(r.borderStyle="solid"),r&&r.flex&&(e&&e.style&&e.style.flex&&e.style.flex<1?(r.height="100%",r.width="100%"):r.height||(r.height=100*r.flex+"%")),r}(t):E({},t.style,t.styleWeb)},noChildren:function(t){return["Image"].includes(t)},isNumber:D},N=["parentComp"],W=["parentComp"],C=function(t,e){var o=[],i=_(t,N);n(i).forEach(function(t){!t||!t.$action||this.path.length>1&&this.path.includes("$children")||o.push({path:this.path,level:this.level})}),r(o,["level"],["desc"]).forEach(function(r){try{var o=n(t).get(r.path),i="$action",a=o[i],s=_(o,[i].map(j));return n(t).set(r.path,function(){try{var r=arguments;return Promise.resolve(e.callFunction(a,s,t,[].slice.call(r))).then(function(){})}catch(t){return Promise.reject(t)}}),Promise.resolve()}catch(t){return Promise.reject(t)}})},F=function(t,e){var o=[],i=_(t,W);n(i).forEach(function(t){!t||!t.$modifier||b.includes(t.$modifier)||this.path.length>1&&this.path.includes("$children")||o.push({path:this.path,level:this.level})}),r(o,["level"],["desc"]).forEach(function(r){try{var o=n(t).get(r.path),i="$modifier",a=o[i],s=_(o,[i].map(j));return n(t).set(r.path,e.callFunction(a,s,t)),Promise.resolve()}catch(t){return Promise.reject(t)}})},M=function(t,e){var r,n=E({},k.includes(typeof t)?{}:t,((r={parentComp:e}).$comp=k.includes(typeof t)||null==t?"_PrimitiveProp":t.$comp,r.$children=k.includes(typeof t)||null==t?t:t.$children,r));for(var o in n)void 0===n[o]&&delete n[o];return n},w=function(e,r,n){var o=_(e,["parentComp","$children"].map(j));return e&&Array.isArray(r)?r.map(function(e,r){/*#__PURE__*/return t.createElement(n,E({key:r},M(e,o)))}):/*#__PURE__*/t.createElement(n,M(r,o))},K={__proto__:null,actionBuilder:C,modifierBuilder:F,pathModifierBuilder:function(t,e){var r=E({},t.currentPaths),n=!1;return e&&0!==Object.keys(e).length&&Object.keys(e).forEach(function(t){if(t&&e[t]&&null!=e[t].path){var o,i,a=e[t].path,s=r[t];n=!0,r[t]=!(""+a).startsWith("/")&&s&&s.path?((o={}).path=I(s.path+"/"+a),o):((i={}).path=a,i),r[t]&&!(""+r[t].path).startsWith("/")&&(r[t].path="/"+r[t].path)}}),n?{currentPaths:r}:void 0},getWrapperProps:M,getRootWrapperProps:function(t,e){var r=E({},t);return F(r,e),C(r,e),r.isList&&(r.$children=function(t){var e=t.page,r=void 0===e?0:e,n=t.listLength,o=void 0===n?0:n,i=t.itemPerPage,a=void 0===i?1:i,s=t.listItem,u=t.$pathModifiers,c=[];if(D(r)&&D(o)&&D(a)&&u)for(var l=(r=r>=0?r:0)*(a=a>=0?a:0)<=(o=o>=0?o:0)?r*a:0,h=u[Object.keys(u)[0]],p=l;p<o&&p<l+a;p++){var f,d;c.push(E({},s,((d={}).$pathModifiers=E({},u,((f={})[Object.keys(u)[0]]=E({},h,{path:p}),f)),d)))}return c}(r)),r},getChildrensForRoot:w,generateChildren:function(t,e){return"_PrimitiveProp"!==t.$comp?w(t,t.$children,e.Wrapper):t.$children}},H=function(t){return!(!t||"string"!=typeof t)&&/^[A-Za-z]*:\/\//.test(t)},Y=function(t){var e=t.split("/");e=u(e,".");var r=0,n=-1;do{r+=1,-1!==(n=s(e,function(t){return".."===t}))&&(h(e,"["+n+"]"),h(e,"["+(n-1)+"]"),e=c(e))}while(-1!==n&&r<100);return e.join("/")},G={__proto__:null,collectJsonKeys:function(t,e){var r=[];n(e).forEach(function(e){e&&e[t]&&this&&!this.circular&&r.push(e[t])});var o={};return p(c(r)).forEach(function(t){return f(o,t)}),o},getRefs:function(t,e,r){void 0===r&&(r="");var o=[];return n(e).forEach(function(e){if(e&&e[t]&&this&&!this.circular){var n,i=e[t];if((s=i)&&"string"==typeof s&&!H(s)&&s.startsWith("/")){var a=function(t){if(t&&"string"==typeof t){var e=t.match(/^([A-Za-z]*:\/\/[^/]*)(\/|)/);if(e)return e[1]+"/"}return null}(r);n=Y(""+a+i)}else n=function(t){return!!t&&"string"==typeof t&&!H(t)&&!t.startsWith("/")}(i)?Y(""+r+i):i;e[t]=n,o.push(n)}var s}),p(c(o))}},U={$id:"http://example.com/schemas/schema.json",type:"object",additionalProperties:{type:"object",properties:{translation:{type:"object",additionalProperties:{type:"string"},propertyNames:{type:"string"},minProperties:1},additionalProperties:!1}},propertyNames:{pattern:"^[A-Za-z0-9_-]*$",type:"string"},minProperties:1},B=function(t){var e=this,r=t.language,n=void 0===r?"en":r,o=t.resources,i=t.nonExistsHandler,a=t.keyPrefix,s=void 0===a?"{{":a,u=t.keyPostfix,c=void 0===u?"}}":u;this.language=void 0,this.languages=void 0,this.resources=void 0,this.keyPrefix=void 0,this.keyPostfix=void 0,this.nonExistsHandler=void 0,this.availableLanguageKey=void 0,this.getLocales=function(){return(e.language.includes("-")?e.language.split("-"):e.language.split("_")||[])[0]},this.t=function(t,r,n){if(!e.resources||!e.resources&&!e.language&&!n||!e.resources[""+(e.availableLanguageKey||n)])return t;var o=e.resources[""+(e.availableLanguageKey||n)].translation[t];return o?r?v(o,r,[e.keyPrefix,e.keyPostfix]):o:(e.nonExistsHandler&&"function"==typeof e.nonExistsHandler&&e.nonExistsHandler(t),t)},this.language=n,this.nonExistsHandler=i,this.keyPrefix=s,this.keyPostfix=c,(new d).compile(U)(o)&&(this.resources=o),this.languages=Object.keys(o),this.languages&&this.languages.includes(this.language)?this.availableLanguageKey=this.language:this.languages&&this.languages.includes(this.getLocales())&&(this.availableLanguageKey=this.getLocales())},V=e(null),q=e({}),z=["parentComp"],Z=function(t,e,r){var n=e.store,o=e.path,i=e.isError,a=void 0!==i&&i,s=function(t){return t.root}(t);return n&&o?function(t,e,r){return $(t[e],r)}(s,n+(a?".error":""),r&&r[n]&&r[n].path?I(r[n].path+"/"+o):o):null},J=function(t,e){var o=e.currentPaths,i={},a=[],s=_(e,z);return n(s).forEach(function(t){!t||!t.$modifier||"get"!==t.$modifier||this.path.length>1&&this.path.includes("$children")||a.push({path:this.path,level:this.level})}),r(a,["level"],["desc"]).forEach(function(r){try{var a=n(e).get(r.path),s="$modifier",u=a[s],c=_(a,[s].map(j));if("get"===u&&c.store&&c.path){var l=Z(t,c,o);if(c.jsonataDef)try{l=require("jsonata")(c.jsonataDef).evaluate(l)}catch(t){console.error("jsonata error",t,c.jsonataDef)}i[O(r.path)]=l}return Promise.resolve()}catch(t){return Promise.reject(t)}}),i},X={getStateValue:function(t,e,r,n){var o=(void 0===e?{}:e).currentPaths,i=t.store,a=t.path,s=n.reduxStore.getState();return Z(s,{store:i,path:a},o)},get:function(t,e,r,n){var o=(void 0===e?{}:e).currentPaths,i=t.store,a=t.path,s=n.reduxStore.getState();return Z(s,{store:i,path:a},o)},set:function(t,e,r,n){n.reduxStore.dispatch({type:"DATA_UPDATE",payload:E({},t,{value:t&&void 0!==t.value?t.value:r[0],currentPaths:e.currentPaths,stock:n})})}},Q={key:"main",whitelist:["root"],transforms:[m(function(t,e){return"root"!==e?t:g(t,S)},function(t,e){return"root"!==e?t:g(t,S)})]},tt=function(t){return t.replace(/\./g,"/")},et={data:{}},rt=y({root:function(t,e){switch(void 0===t&&(t=et),e.type){case"DATA_UPDATE":var r=e.payload,n=r.store,i=r.path,a=r.value,s=r.jsonataDef,u=r.currentPaths,c=r.stock;if(n&&i){var l=""+n,h=I(u&&u[l]&&u[l].path?u[l].path+"/"+i:i),p="/"+l+h;return P(t,function(t){if(s)try{var e=require("jsonata")(s).evaluate(a);R(t,p,e)}catch(e){console.error("jsonata error",e,s),R(t,p,a)}else R(t,p,a);!function(t,e,r,n){null!=t&&t.validations&&t.validations.forEach(function(t){if(t.store===r&&(""+n).startsWith(t.path)&&t.schema){var i=$(e,"/"+r+t.path),a=function(t,e,r){var n,i,a=new d({allErrors:!0}).compile(t),s=a(r);return{store:e+".error",valid:s,value:s?null:(n=a.errors,i={},n&&n.forEach(function(t){o.set(i,"required"===t.keyword?tt(t.instancePath+"."+t.params.missingProperty)+"/-":tt(t.instancePath)+"/-",t.message)}),i)}}(t.schema,r,i);R(e,"/"+a.store+t.path,a.value)}})}(c,t,n,h)})}return t;case"PURGE":return et;default:return t}}}),nt={deletePersistDataStore:function(t,e,r,n){try{return n.reduxStore.dispatch({type:"PURGE",payload:null}),Promise.resolve(n.callFunction("reloadApp",{})).then(function(){})}catch(t){return Promise.reject(t)}}};export{B as I18n,q as PathModifierContext,A as Stock,V as StockContext,nt as appRootFunctions,x as constants,J as genAllStateProps,G as jsonRefResolver,Q as persistConfig,X as stockFunctions,rt as storeReducers,L as util,K as wrapperUtil};
|
|
2
|
-
//# sourceMappingURL=index.module.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.module.mjs","sources":["../src/stock/Stock.ts","../src/utils/constants.ts","../src/utils/util.ts","../src/wrapper/wrapperUtil.tsx","../src/utils/jsonRefResolver.ts","../src/utils/I18n.ts","../src/utils/contextHandler.ts","../src/store/root/selectors.ts","../src/stock/functions.ts","../src/store/root/actions.ts","../src/store/persistConfig.ts","../src/stock/validation.ts","../src/store/root/reducer.ts","../src/store/reducers.ts","../src/stock/appRootFunctions.ts"],"sourcesContent":["import React from 'react'\nimport { JsonUIFunctions, JsonUIFunctionType } from './appRootFunctions'\n\ninterface JsonUIComponentsType {\n [key: string]: React.ReactNode\n}\n\ninterface NewStockType {\n components: JsonUIComponentsType\n functions: JsonUIFunctions\n}\n\ntype InitType = (prop: NewStockType) => void\ntype RegisterFunctionType = (key: string, value: JsonUIFunctionType) => void\ntype RegisterComponentType = (key: string, value: React.ReactNode) => void\ntype CallFunctionType = (name: string, attr?: any, props?: any, callerArgs?: any) => void\ntype GetComponentType = (componentName: string) => React.ReactNode\n\nexport default class Stock {\n stock: NewStockType\n\n Wrapper: React.ReactNode\n\n reduxStore: any\n\n validations: any\n\n constructor(newStock: NewStockType, Wrapper: React.ReactNode, reduxStore: any) {\n this.stock = {\n components: {} as JsonUIComponentsType,\n functions: {} as JsonUIFunctions,\n }\n this.Wrapper = Wrapper\n this.validations = []\n this.reduxStore = reduxStore\n this.init(newStock)\n }\n\n init: InitType = ({ components, functions }) => {\n this.stock.components = {\n ...this.stock.components,\n ...components,\n }\n this.stock.functions = {\n ...this.stock.functions,\n ...functions,\n }\n }\n\n registerComponent: RegisterComponentType = (key, value) => {\n if (!!key && typeof key === 'string' && key.length > 0 && !(key in this.stock.components)) {\n this.stock.components[key] = value\n }\n }\n\n registerFunction: RegisterFunctionType = (key, value) => {\n if (!!key && typeof key === 'string' && key.length > 0 && !(key in this.stock.functions)) {\n this.stock.functions[key] = value\n }\n }\n\n callFunction: CallFunctionType = (name, attr, props, callerArgs) => {\n if (!!attr && !!name && name in this.stock.functions) {\n const result = this.stock.functions[name](attr, props, callerArgs, this)\n return result\n }\n return null\n }\n\n getComponent: GetComponentType = (componentName) =>\n !!componentName && componentName in this.stock.components\n ? this.stock.components[componentName]\n : // eslint-disable-next-line no-underscore-dangle\n this.stock.components._Undefined\n}\n","export const SEPARATOR = '/'\nexport const STORE_ERROR_POSTFIX = '.error'\n\nexport const PATH_MODIFIERS_KEY = '$pathModifiers'\nexport const MODIFIER_KEY = '$modifier'\nexport const ACTION_KEY = '$action'\nexport const PERSIST_STORAGE_KEY = '$persistStores'\nexport const PERSIST_STORAGE_NAMES = ['data']\nexport const REF_ASSETS = '$assetsRef'\nexport const REF_LOCALES = '$locales'\nexport const REF_VALIDATES = '$validations'\nexport const STYLE_WEB_NAME = 'styleWeb'\nexport const STYLE_RN_NAME = 'styleRN'\nexport const REDUX_FUNCTIONS = ['set', 'get']\n\nexport const PATHNAME = 'path'\nexport const SIMPLE_DATA_TYPES = ['string', 'number', 'boolean', 'null']\nexport const V_CHILDREN_NAME = '$children'\nexport const V_COMP_NAME = '$comp'\nexport const ITEM_OF_ARRAY = 'item'\nexport const PAGINATION_ITEM_PER_PAGE = 1\n","import jsonpointer from 'jsonpointer'\nimport cloneDeep from 'lodash/cloneDeep'\nimport drop from 'lodash/drop'\nimport findIndex from 'lodash/findIndex'\nimport pull from 'lodash/pull'\nimport compact from 'lodash/compact'\nimport findLastIndex from 'lodash/findLastIndex'\nimport unset from 'lodash/unset'\nimport * as c from './constants'\nimport { PropsType } from './types'\n\nexport const jsonPointerGet = (json: any, path?: string) => {\n if (json === null || json === undefined || path === null || path === undefined || typeof path !== 'string') return null\n if (path === c.SEPARATOR /* || path === '' same effect */) return json\n try {\n return jsonpointer.get(json, path.startsWith(c.SEPARATOR) ? path : `${c.SEPARATOR}${path}`)\n } catch (e) {\n return null\n }\n}\n\nexport const jsonPointerSet = (json: any, path?: string, value?: any) => {\n if (json === null || json === undefined || path === null || path === undefined || typeof path !== 'string') return\n if (path === c.SEPARATOR || path === '') {\n // eslint-disable-next-line no-param-reassign\n json = value\n return\n }\n try {\n jsonpointer.set(json, path.startsWith(c.SEPARATOR) ? path : `${c.SEPARATOR}${path}`, value)\n // eslint-disable-next-line no-empty\n } catch (e) {}\n}\n\nexport const getCleanedTopic = (text: string | any) => {\n if (!text || typeof text !== 'string' || text.length === 0 || text.length > 1024) {\n return null\n }\n return text.replace(/[^0-9a-zA-Z]/g, '-')\n}\n\nexport const pathArrayToPathString = (array: string[]) => array.map((i, index) => (Number.isInteger(i) ? `[${i}]` : `${index > 0 ? '.' : ''}${i}`)).join('')\n\nexport const pathArrayToJsonPointer = (array: string[]) => `/${array.join('/')}`\n\n/**\n * Simple object check.\n * @param item\n * @returns {boolean}\n */\nexport function isObject(item: any) {\n return item && typeof item === 'object' && !Array.isArray(item)\n}\n\n/**\n * Deep merge two objects.\n * @param target\n * @param ...sources\n */\nexport function mergeDeep(target: any, ...sources: any): any {\n if (!sources.length) return target\n const source = sources.shift()\n\n if (isObject(target) && isObject(source)) {\n // eslint-disable-next-line no-restricted-syntax\n for (const key in source) {\n if (isObject(source[key])) {\n if (!target[key]) Object.assign(target, { [key]: {} })\n mergeDeep(target[key], source[key])\n } else {\n Object.assign(target, { [key]: source[key] })\n }\n }\n }\n\n return mergeDeep(target, ...sources)\n}\n\nexport const mergePath = (target: any, newState: any) => {\n if (!newState || typeof newState !== 'object') return target\n const newTarget = cloneDeep(target)\n Object.entries(newState).forEach(([key, value]) => {\n jsonpointer.set(newTarget, key, value)\n })\n return newTarget\n}\n\n// eslint-disable-next-line import/prefer-default-export\nexport const changeRelativePath = (path: string) => {\n let pathArray = path.split(c.SEPARATOR)\n if (pathArray && pathArray.length > 1 && pathArray[pathArray.length - 1] === '') {\n pathArray.pop()\n }\n const absolutepathIndex = findLastIndex(pathArray, (i) => i === '')\n if (absolutepathIndex > 0) {\n pathArray = drop(pathArray, absolutepathIndex)\n }\n pathArray = pull(pathArray, '.')\n let count = 0\n let relativepathIndex = -1\n do {\n count += 1\n relativepathIndex = findIndex(pathArray, (i) => i === '..')\n if (relativepathIndex !== -1) {\n unset(pathArray, `[${relativepathIndex}]`)\n unset(pathArray, `[${relativepathIndex - 1}]`)\n pathArray = compact(pathArray)\n }\n } while (relativepathIndex !== -1 && count < 100)\n return pathArray.join(c.SEPARATOR)\n}\n\n// changeRelativePath('111/22222/3333/./anything/../../start')\n\nconst genStyle = (props: PropsType) => {\n const { parentComp } = props\n const style = { display: 'flex', flexDirection: 'column', ...(props.style as any), ...(props[c.STYLE_WEB_NAME] as any) }\n\n if (style && style.borderWidth && !style.borderStyle) {\n style.borderStyle = 'solid'\n }\n if (style && style.flex) {\n if (\n parentComp &&\n (parentComp as any).style &&\n (parentComp as any).style.flex &&\n (parentComp as any).style.flex < 1\n // if smaller or larger, noesn't matter\n ) {\n style.height = `100%`\n style.width = `100%`\n } else if (!style.height) {\n style.height = `${style.flex * 100}%`\n }\n }\n return style\n}\nexport const getStyleForWeb = (props: PropsType = {}, component: string) =>\n component === 'View' ? genStyle(props) : { ...(props.style as any), ...(props[c.STYLE_WEB_NAME] as any) }\n\n// TODO it have to be configurable\nexport const noChildren = (component: string) => ['Image'].includes(component)\n\nexport const isNumber = (a: any) => typeof a === 'number'\n","import React from 'react'\nimport orderBy from 'lodash/orderBy'\nimport traverse from 'traverse'\nimport * as c from 'utils/constants'\nimport * as util from 'utils/util'\nimport Stock from 'stock/Stock'\nimport { PathModifiersType, PathModifierType, PathsType, PropsType, WrapperType } from '../utils/types'\n\nexport const actionBuilder = (props: PropsType, stock: InstanceType<typeof Stock>) => {\n const paths: PathsType = []\n const { parentComp, ...propsNew } = props\n // eslint-disable-next-line func-names\n traverse(propsNew).forEach(function (x) {\n if (\n !!x &&\n !!x[c.ACTION_KEY] &&\n // && !c.REDUX_FUNCTIONS.includes(x[c.ACTION_KEY])\n !(this.path.length > 1 && this.path.includes(c.V_CHILDREN_NAME))\n ) {\n paths.push({ path: this.path, level: this.level })\n }\n })\n orderBy(paths, ['level'], ['desc']).forEach(async (i) => {\n const { [c.ACTION_KEY]: functionName, ...functionParams } = traverse(props).get(i.path)\n traverse(props).set(i.path, async (...callerArgs: any[]) => {\n await stock.callFunction(functionName, functionParams, props, callerArgs)\n })\n })\n}\n\nexport const modifierBuilder = (props: PropsType, stock: InstanceType<typeof Stock>) => {\n const paths: PathsType = []\n const { parentComp, ...propsNew } = props\n // eslint-disable-next-line func-names\n traverse(propsNew).forEach(function (x) {\n if (!!x && !!x[c.MODIFIER_KEY] && !c.REDUX_FUNCTIONS.includes(x[c.MODIFIER_KEY]) && !(this.path.length > 1 && this.path.includes(c.V_CHILDREN_NAME))) {\n paths.push({ path: this.path, level: this.level })\n }\n })\n orderBy(paths, ['level'], ['desc']).forEach(async (i) => {\n const { [c.MODIFIER_KEY]: functionName, ...functionParams } = traverse(props).get(i.path)\n traverse(props).set(i.path, stock.callFunction(functionName, functionParams, props))\n })\n}\n\nexport const pathModifierBuilder = (props: PropsType, pathModifier: PathModifiersType) => {\n const currentPaths: PathModifiersType = { ...(props.currentPaths as PathModifiersType) }\n let modified = false\n if (pathModifier && Object.keys(pathModifier).length !== 0) {\n Object.keys(pathModifier).forEach((key: string) => {\n if (!!key && !!pathModifier[key] && pathModifier[key][c.PATHNAME] !== undefined && pathModifier[key][c.PATHNAME] !== null) {\n const path = pathModifier[key][c.PATHNAME]\n const parent = currentPaths[key]\n modified = true\n if (`${path}`.startsWith(c.SEPARATOR) || !(parent && parent[c.PATHNAME])) {\n currentPaths[key] = { [c.PATHNAME]: path }\n } else {\n currentPaths[key] = { [c.PATHNAME]: util.changeRelativePath(`${parent[c.PATHNAME]}${c.SEPARATOR}${path}`) }\n }\n if (!!currentPaths[key] && !`${currentPaths[key][c.PATHNAME]}`.startsWith(c.SEPARATOR)) {\n currentPaths[key][c.PATHNAME] = `${c.SEPARATOR}${currentPaths[key][c.PATHNAME]}`\n }\n }\n })\n }\n return modified ? { currentPaths } : undefined\n}\n\nexport const getWrapperProps = (props: PropsType, parentComp?: any) => {\n const res: PropsType = {\n ...(c.SIMPLE_DATA_TYPES.includes(typeof props) ? {} : props),\n parentComp,\n [c.V_COMP_NAME]: c.SIMPLE_DATA_TYPES.includes(typeof props) || props === undefined || props === null ? '_PrimitiveProp' : props[c.V_COMP_NAME],\n [c.V_CHILDREN_NAME]: c.SIMPLE_DATA_TYPES.includes(typeof props) || props === undefined || props === null ? props : props[c.V_CHILDREN_NAME],\n }\n // eslint-disable-next-line no-restricted-syntax\n for (const i in res) if (typeof res[i] === 'undefined') delete res[i]\n return res\n}\n\nconst genChildenFromListItem = (props: PropsType) => {\n let { page = 0, listLength = 0, itemPerPage = c.PAGINATION_ITEM_PER_PAGE } = props as { page?: number; listLength?: number; itemPerPage?: number }\n const { listItem } = props\n const pathModifiers: PathModifiersType = props[c.PATH_MODIFIERS_KEY] as PathModifiersType\n const children: PropsType[] = []\n if (util.isNumber(page) && util.isNumber(listLength) && util.isNumber(itemPerPage) && pathModifiers) {\n page = page >= 0 ? page : 0\n itemPerPage = itemPerPage >= 0 ? itemPerPage : 0\n listLength = listLength >= 0 ? listLength : 0\n const offset = page * itemPerPage <= listLength ? page * itemPerPage : 0\n const itemkey: string = Object.keys(pathModifiers)[0]\n const firstItem: PathModifierType = pathModifiers[itemkey]\n // eslint-disable-next-line no-plusplus\n for (let i = offset; i < listLength && i < offset + itemPerPage; i++) {\n children.push({\n ...(listItem as PropsType),\n [c.PATH_MODIFIERS_KEY]: {\n ...(pathModifiers as PathModifiersType),\n [Object.keys(pathModifiers)[0]]: {\n ...(firstItem as PathModifierType),\n path: i,\n },\n } as PathModifiersType,\n })\n }\n }\n return children\n}\n\nexport const getRootWrapperProps = (props: PropsType, stock: InstanceType<typeof Stock>) => {\n const newProps = {\n ...props,\n // if the children generation move to wrapper, the redux genAllStateProps doesn't wortk properly. why?\n }\n modifierBuilder(newProps, stock)\n actionBuilder(newProps, stock)\n if (newProps.isList) {\n newProps[c.V_CHILDREN_NAME] = genChildenFromListItem(newProps)\n }\n\n return newProps\n}\n\nexport const getChildrensForRoot = (props: PropsType, children: any, Wrapper: WrapperType) => {\n const { parentComp, [c.V_CHILDREN_NAME]: _notused, ...newParentComp } = props\n // eslint-disable-next-line no-nested-ternary\n return !!props && Array.isArray(children) ? (\n children.map((childrenItem, index) => {\n // eslint-disable-next-line react/no-array-index-key\n return <Wrapper key={index} {...getWrapperProps(childrenItem, newParentComp)} />\n })\n ) : (\n <Wrapper {...getWrapperProps(children, newParentComp)} />\n )\n}\n\nexport const generateChildren = (props: PropsType, { Wrapper }: InstanceType<typeof Stock>) =>\n props[c.V_COMP_NAME] !== '_PrimitiveProp' ? getChildrensForRoot(props, props[c.V_CHILDREN_NAME], Wrapper as WrapperType) : props[c.V_CHILDREN_NAME]\n","import traverse from 'traverse'\nimport uniq from 'lodash/uniq'\nimport compact from 'lodash/compact'\nimport unset from 'lodash/unset'\nimport findIndex from 'lodash/findIndex'\nimport pull from 'lodash/pull'\nimport defaultsDeep from 'lodash/defaultsDeep'\nimport * as c from './constants'\n\nexport const collectJsonKeys = (refConst: string, json: any) => {\n const refs: any[] = []\n // eslint-disable-next-line func-names\n traverse(json).forEach(function (x) {\n if (x && x[refConst] && !!this && !this.circular) {\n refs.push(x[refConst])\n }\n })\n const res = {}\n uniq(compact(refs)).forEach((i) => defaultsDeep(res, i))\n return res\n}\n\nconst isFullPath = (path?: string) => {\n if (!!path && typeof path === 'string') {\n const regex = /^[A-Za-z]*:\\/\\//\n return regex.test(path)\n }\n return false\n}\n\nconst isRelativePath = (path?: string) => !!path && typeof path === 'string' && !isFullPath(path) && !path.startsWith(c.SEPARATOR) // if not full and not start with /\n\nconst isRootPath = (path?: string) => !!path && typeof path === 'string' && !isFullPath(path) && path.startsWith(c.SEPARATOR) // if not full and start with /\n\nconst changeRelativePath = (path: string) => {\n let pathArray = path.split(c.SEPARATOR)\n pathArray = pull(pathArray, '.') // remove all ./\n let count = 0\n let relativepathIndex = -1\n do {\n count += 1\n relativepathIndex = findIndex(pathArray, (i) => i === '..')\n if (relativepathIndex !== -1) {\n unset(pathArray, `[${relativepathIndex}]`)\n unset(pathArray, `[${relativepathIndex - 1}]`)\n pathArray = compact(pathArray)\n }\n } while (relativepathIndex !== -1 && count < 100)\n return pathArray.join(c.SEPARATOR)\n}\n\n// TODO: just workaround, not works with http://localhost for example\nconst getRoot = (url3?: string) => {\n if (!!url3 && typeof url3 === 'string') {\n const regex = /^([A-Za-z]*:\\/\\/[^/]*)(\\/|)/\n const found = url3.match(regex)\n if (found) {\n return `${found[1]}/`\n }\n }\n return null\n}\n\n// console.error('test',isFullPath('asdasd://'))\nexport const getRefs = (refConst: string, json: any, projectPath = '') => {\n const refs: any[] = []\n // eslint-disable-next-line func-names\n traverse(json).forEach(function (x) {\n if (x && x[refConst] && !!this && !this.circular) {\n const ref = x[refConst]\n let absolutePath\n // TODO: If the projectPath is absolute, will be wrong\n if (isRootPath(ref)) {\n const root = getRoot(projectPath)\n absolutePath = changeRelativePath(`${root}${ref}`)\n } else if (isRelativePath(ref)) {\n absolutePath = changeRelativePath(`${projectPath}${ref}`)\n } else {\n absolutePath = ref\n }\n // eslint-disable-next-line no-param-reassign\n x[refConst] = absolutePath\n refs.push(absolutePath)\n }\n })\n // console.warn(refs);\n return uniq(compact(refs))\n}\n","import Ajv from 'ajv'\nimport keyValueReplace from 'key-value-replace'\n\ninterface I18nResources {\n [key: string]: {\n translation: {\n [key: string]: string\n }\n }\n}\n\ninterface I18nProps {\n language?: string\n resources?: I18nResources\n keyPrefix?: string\n keyPostfix?: string\n nonExistsHandler?: (key: string) => void\n}\nconst I18nSchema = {\n $id: 'http://example.com/schemas/schema.json',\n type: 'object',\n additionalProperties: {\n type: 'object',\n properties: {\n translation: {\n type: 'object',\n additionalProperties: {\n type: 'string',\n },\n propertyNames: {\n type: 'string',\n },\n minProperties: 1,\n },\n additionalProperties: false,\n },\n },\n propertyNames: {\n pattern: '^[A-Za-z0-9_-]*$',\n type: 'string',\n },\n minProperties: 1,\n}\n\nexport default class I18n {\n language: string\n\n languages: string[]\n\n resources?: I18nResources\n\n keyPrefix?: string\n\n keyPostfix?: string\n\n nonExistsHandler?: (key: string) => void\n\n availableLanguageKey?: string\n\n // eslint-disable-next-line consistent-this\n constructor({ language = 'en', resources, nonExistsHandler, keyPrefix = '{{', keyPostfix = '}}' }: I18nProps) {\n this.language = language\n this.nonExistsHandler = nonExistsHandler\n this.keyPrefix = keyPrefix\n this.keyPostfix = keyPostfix\n\n const ajv = new Ajv()\n const validate = ajv.compile(I18nSchema)\n const isValid = validate(resources)\n if (isValid) {\n this.resources = resources\n }\n this.languages = Object.keys(resources as any)\n if (this.languages && this.languages.includes(this.language)) {\n this.availableLanguageKey = this.language\n } else if (this.languages && this.languages.includes(this.getLocales())) {\n this.availableLanguageKey = this.getLocales()\n }\n }\n\n getLocales = () => (this.language.includes('-') ? this.language.split('-') : this.language.split('_') || [])[0]\n\n t = (key: string, options?: any, language?: string | null) => {\n if (!this.resources || (!this.resources && !this.language && !language) || !this.resources[`${this.availableLanguageKey || language}`]) {\n return key\n }\n const value = this.resources[`${this.availableLanguageKey || language}`].translation[key]\n if (!value) {\n if (this.nonExistsHandler && typeof this.nonExistsHandler === 'function') {\n this.nonExistsHandler(key)\n }\n return key\n }\n if (options) {\n return keyValueReplace(value, options, [this.keyPrefix, this.keyPostfix])\n }\n return value\n }\n}\n","import { createContext } from 'react'\nimport Stock from 'stock/Stock'\n\nexport const StockContext = createContext<typeof Stock | null>(null)\nexport const PathModifierContext = createContext({})\n","import traverse from 'traverse'\nimport orderBy from 'lodash/orderBy'\nimport * as c from '../../utils/constants'\nimport * as util from '../../utils/util'\nimport { PathModifiersType, PathType, PropsType } from '../../utils/types'\nimport { RootStateType } from './reducer'\n\nexport const getState = (state: any): RootStateType => state.root\n\nexport const getValue = (state: any, store: string, path: string) => util.jsonPointerGet(state[store], path)\n\nexport interface ReduxPathType {\n store: string\n path: string\n isError?: boolean\n}\n\nexport const getStateValue = (globalState: any, { store, path, isError = false }: ReduxPathType, currentPaths: PathModifiersType) => {\n const state = getState(globalState)\n\n if (store && path) {\n const convertedPath =\n currentPaths && currentPaths[store] && currentPaths[store].path ? util.changeRelativePath(`${currentPaths[store].path}${c.SEPARATOR}${path}`) : path\n\n return getValue(state, `${store}${isError ? c.STORE_ERROR_POSTFIX : ''}`, convertedPath)\n }\n return null\n}\n\nexport const genAllStateProps = (globalState: any, props: PropsType) => {\n const { currentPaths } = props\n const result: PropsType = {}\n const paths: PathType[] = []\n const { parentComp, ...propsNew } = props\n // eslint-disable-next-line func-names\n traverse(propsNew).forEach(function (x) {\n if (!!x && !!x[c.MODIFIER_KEY] && x[c.MODIFIER_KEY] === 'get' && !(this.path.length > 1 && this.path.includes(c.V_CHILDREN_NAME))) {\n paths.push({ path: this.path, level: this.level })\n }\n })\n orderBy(paths, ['level'], ['desc']).forEach(async (i) => {\n const { [c.MODIFIER_KEY]: functionName, ...functionParams } = traverse(props).get(i.path)\n if (functionName === 'get' && functionParams.store && functionParams.path) {\n let value = getStateValue(globalState, functionParams, currentPaths as PathModifiersType)\n if (functionParams.jsonataDef) {\n try {\n // eslint-disable-next-line global-require, @typescript-eslint/no-var-requires\n const jsonata = require('jsonata')\n const expression = jsonata(functionParams.jsonataDef)\n value = expression.evaluate(value)\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error('jsonata error', error, functionParams.jsonataDef)\n }\n }\n // traverse(result).set(i.path, value)\n result[util.pathArrayToJsonPointer(i.path)] = value\n }\n })\n return result\n}\n","import { getStateValue as getStateValueSelector } from '../store/root/selectors'\nimport { set as setAction } from '../store/root/actions'\nimport { JsonUIFunctionType } from './appRootFunctions'\nimport { PathModifiersType } from '../utils/types'\n\nconst getStateValue: JsonUIFunctionType = (attr, { currentPaths } = {}, callerArgs, stock) => {\n const { store, path } = attr\n const state = stock.reduxStore.getState()\n return getStateValueSelector(state, { store, path }, currentPaths as PathModifiersType)\n}\nconst get: JsonUIFunctionType = (attr, { currentPaths } = {}, callerArgs, stock) => {\n const { store, path } = attr\n const state = stock.reduxStore.getState()\n return getStateValueSelector(state, { store, path }, currentPaths as PathModifiersType)\n}\nconst set: JsonUIFunctionType = (attr, props, callerArgs, stock) => {\n stock.reduxStore.dispatch(\n setAction({ ...attr, value: attr && attr.value !== undefined ? attr.value : callerArgs[0], currentPaths: props.currentPaths, stock })\n )\n}\nexport default {\n getStateValue,\n get,\n set,\n}\n","export const DATA_UPDATE = 'DATA_UPDATE'\nexport const PURGE = 'PURGE'\n\nexport const set = (payload: any) => ({\n type: DATA_UPDATE,\n payload,\n})\n\nexport const purge = (payload: any) => ({\n type: PURGE,\n payload,\n})\n","import { createTransform } from 'redux-persist'\nimport pick from 'lodash/pick'\nimport * as c from '../utils/constants'\n\nconst SetTransform = createTransform(\n (inboundState, key) => {\n if (key !== 'root') return inboundState\n return pick(inboundState, c.PERSIST_STORAGE_NAMES)\n },\n (outboundState, key) => {\n if (key !== 'root') return outboundState\n return pick(outboundState, c.PERSIST_STORAGE_NAMES)\n }\n)\n\nexport default {\n key: 'main',\n whitelist: ['root'],\n transforms: [SetTransform],\n}\n","import Ajv, { ErrorObject, JSONSchemaType } from 'ajv'\nimport jsonpointer from 'jsonpointer'\nimport * as c from '../utils/constants'\n\nconst pathConverter = (path: string) => path.replace(/\\./g, c.SEPARATOR)\n\nexport const errorConverter = (errors: ErrorObject<string, Record<string, any>, unknown>[] | null | undefined) => {\n const res = {}\n if (errors) {\n errors.forEach((i) => {\n if (i.keyword === 'required') {\n jsonpointer.set(res, `${pathConverter(`${i.instancePath}.${i.params.missingProperty}`)}/-`, i.message)\n } else {\n jsonpointer.set(res, `${pathConverter(i.instancePath)}/-`, i.message)\n }\n })\n }\n return res\n}\n\nexport const validateJSON = (schema: any, store: string, data: any) => {\n const ajv = new Ajv({ allErrors: true })\n const validate = ajv.compile(schema as JSONSchemaType<any>)\n const valid = validate(data)\n return {\n store: `${store}${c.STORE_ERROR_POSTFIX}`,\n valid,\n value: valid ? null : errorConverter(validate.errors),\n }\n}\n","import produce from 'immer'\nimport { AnyAction } from 'redux'\nimport { ValidationType } from '../../utils/types'\nimport * as c from '../../utils/constants'\nimport * as util from '../../utils/util'\nimport { validateJSON } from '../../stock/validation'\nimport { DATA_UPDATE, PURGE } from './actions'\nimport Stock from '../../stock/Stock'\n\nexport type RootStateType = any\n\nconst initialState: RootStateType = {\n data: {},\n}\nconst validateNewState = (stock: InstanceType<typeof Stock>, newState: RootStateType, actionStore: string, actionPath: string) => {\n if (stock?.validations) {\n stock.validations.forEach((validateItem: ValidationType) => {\n if (validateItem.store === actionStore && `${actionPath}`.startsWith(validateItem.path)) {\n if (validateItem.schema) {\n const stateToBeValidated = util.jsonPointerGet(newState, `${c.SEPARATOR}${actionStore}${validateItem.path}`)\n const errors = validateJSON(validateItem.schema, actionStore, stateToBeValidated)\n // console.log('matched validator', `${c.SEPARATOR}${errors.store}${validateItem.path}`, errors)\n util.jsonPointerSet(newState, `${c.SEPARATOR}${errors.store}${validateItem.path}`, errors.value)\n }\n }\n })\n }\n}\nconst reducer = (state = initialState, action: AnyAction) => {\n switch (action.type) {\n case DATA_UPDATE: {\n const { store, path, value, jsonataDef, currentPaths, stock } = action.payload\n if (store && path) {\n const storekey = `${store}`\n const convertedPath =\n currentPaths && currentPaths[storekey] && currentPaths[storekey].path\n ? util.changeRelativePath(`${currentPaths[storekey].path}${c.SEPARATOR}${path}`)\n : util.changeRelativePath(path)\n const absolutePathWithStoreKey = `${c.SEPARATOR}${storekey}${convertedPath}`\n const newState = produce(state, (draft: RootStateType) => {\n if (jsonataDef) {\n try {\n // eslint-disable-next-line global-require, @typescript-eslint/no-var-requires\n const jsonata = require('jsonata')\n const expression = jsonata(jsonataDef)\n const newValue = expression.evaluate(value)\n util.jsonPointerSet(draft, absolutePathWithStoreKey, newValue)\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error('jsonata error', error, jsonataDef)\n util.jsonPointerSet(draft, absolutePathWithStoreKey, value)\n }\n } else {\n util.jsonPointerSet(draft, absolutePathWithStoreKey, value)\n }\n // if validatior has match, need to validate it synchronously\n validateNewState(stock, draft, store, convertedPath)\n })\n return newState\n }\n return state\n }\n case PURGE: {\n return initialState\n }\n default:\n return state\n }\n}\n\nexport default reducer\n","import { combineReducers } from 'redux'\nimport root from './root/reducer'\n\nconst rootReducer = combineReducers({ root })\n\nexport default rootReducer\n","import { purge } from '../store/root/actions'\n\nexport type JsonUIFunctionType = (attr: any, props: any, callerArgs: any, stock: any) => Promise<void> | void | any\n\nexport interface JsonUIFunctions {\n [key: string]: JsonUIFunctionType\n}\nexport const deletePersistDataStore: JsonUIFunctionType = async (attr, props, callerArgs, stock) => {\n stock.reduxStore.dispatch(purge(null))\n await stock.callFunction('reloadApp', {})\n}\n\nconst appRootFunctions: JsonUIFunctions = { deletePersistDataStore }\n\nexport default appRootFunctions\n"],"names":["Stock","newStock","Wrapper","reduxStore","stock","validations","init","functions","_this","components","registerComponent","key","value","length","registerFunction","callFunction","name","attr","props","callerArgs","getComponent","componentName","_Undefined","this","PERSIST_STORAGE_NAMES","REDUX_FUNCTIONS","SIMPLE_DATA_TYPES","jsonPointerGet","json","path","jsonpointer","get","startsWith","e","jsonPointerSet","set","pathArrayToJsonPointer","array","join","isObject","item","Array","isArray","changeRelativePath","pathArray","split","pop","absolutepathIndex","findLastIndex","i","drop","pull","count","relativepathIndex","findIndex","unset","compact","isNumber","a","text","replace","map","index","Number","isInteger","mergeDeep","target","sources","source","shift","Object","assign","newState","newTarget","cloneDeep","entries","forEach","component","parentComp","style","display","flexDirection","borderWidth","borderStyle","flex","height","width","genStyle","includes","actionBuilder","paths","propsNew","traverse","x","push","level","orderBy","functionName","functionParams","modifierBuilder","c","getWrapperProps","res","getChildrensForRoot","children","newParentComp","childrenItem","React","pathModifier","currentPaths","modified","keys","parent","util","undefined","newProps","isList","page","listLength","itemPerPage","listItem","pathModifiers","offset","firstItem","genChildenFromListItem","isFullPath","test","refConst","refs","circular","uniq","defaultsDeep","projectPath","absolutePath","ref","root","url3","found","match","getRoot","isRelativePath","I18nSchema","$id","type","additionalProperties","properties","translation","propertyNames","minProperties","pattern","I18n","language","resources","nonExistsHandler","keyPrefix","keyPostfix","languages","availableLanguageKey","getLocales","t","options","keyValueReplace","Ajv","compile","validate","StockContext","createContext","PathModifierContext","getStateValue","globalState","store","isError","state","getState","getValue","genAllStateProps","result","jsonataDef","require","jsonata","evaluate","error","console","getStateValueSelector","dispatch","payload","whitelist","transforms","createTransform","inboundState","pick","outboundState","pathConverter","initialState","data","rootReducer","combineReducers","action","storekey","convertedPath","absolutePathWithStoreKey","produce","draft","newValue","actionStore","actionPath","validateItem","schema","stateToBeValidated","errors","allErrors","valid","keyword","instancePath","params","missingProperty","message","validateJSON","validateNewState","appRootFunctions","deletePersistDataStore"],"mappings":"wsCAkBqBA,IAAAA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