@sankhyalabs/sankhyablocks 1.3.1 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/snk-application.cjs.entry.js +1 -1
- package/dist/collection/lib/http/data-fetcher/fetchers/dataunit-fetcher.js +1 -1
- package/dist/components/snk-application.js +1 -1
- package/dist/esm/snk-application.entry.js +1 -1
- package/dist/sankhyablocks/{p-5d8ddbda.entry.js → p-76b95007.entry.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/package.json +8 -4
|
@@ -45,7 +45,7 @@ import{r as e,c as t,h as n}from"./p-a33afc3b.js";import{DataUnit as i,ChangeOpe
|
|
|
45
45
|
value
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
}`)}getDataUnit(e,t){const n=new i(`dd://${e}/${t}`);return n.metadataLoader=e=>this.loadMetadata(e),n.dataLoader=(e,t,n)=>this.loadData(e,t,n),n.saveLoader=(e,t)=>this.saveData(e,t),n.removeLoader=(e,t)=>this.removeRecords(e,t),n}loadMetadata(e){return new Promise(((t,n)=>{G.get().callGraphQL({values:{name:e.name},query:this.templateByQuery.get("fetchDataUnit")}).then((e=>{var n;const i={name:e.name,label:e.name,fields:[]};null===(n=e.fields)||void 0===n||n.forEach((e=>{let t;Array.isArray(e.properties)&&(t={},e.properties.forEach((e=>t[e.name]=e.value))),i.fields.push(Object.assign(Object.assign({},e),{properties:t}))})),t(i)})).catch((e=>{n(e)}))}))}loadData(e,t,n){return new Promise(((i,r)=>{G.get().callGraphQL({values:{dataunit:e.name,sort:t,filters:n},query:this.templateByQuery.get("fetchData")}).then((t=>{const n=[];t.data.records.forEach((t=>{const i={__record__id__:t.id};t.fields.forEach((({name:t,value:n})=>{i[t]=e.valueFromString(t,n)})),n.push(i)})),i(n)})).catch((e=>{r(e)}))}))}saveData(e,t){const n=t.map((e=>{const{dataUnit:t,record:n,updatingFields:i,operation:r}=e;return{dataUnit:t,updatingFields:Object.entries(i).map((([e,t])=>({fieldName:e,value:this.formatValueToServer(t)}))),operation:r,recordId:n.__record__id__}}));return new Promise(((t,i)=>{G.get().callGraphQL({values:{changes:n},query:this.templateByQuery.get("saveData")}).then((n=>{const i=[];null==n||n.forEach((t=>{const n={__record__id__:t.id};t.oldId&&(n.__old__id__=t.oldId),t.fields.forEach((({name:t,value:i})=>{n[t]=e.valueFromString(t,i)})),i.push(n)})),t(i)})).catch((e=>{i(e)}))}))}formatValueToServer(e){if(void 0===e)return e;try{if(e instanceof Date)return e.toString();e=JSON.stringify(e)}catch(t){e=e.toString()}return e}removeRecords(e,t){const n=t.map((t=>({dataUnit:e.name,operation:r.DELETE,recordId:t})));return new Promise(((e,i)=>{G.get().callGraphQL({values:{changes:n},query:this.templateByQuery.get("saveData")}).then((()=>{e(t)})).catch((e=>{i(e)}))}))}}class z{static openAppActivity(e,t){var n;null===(n=window.workspace)||void 0===n||n.openAppActivity(e,t)}}z.resourceID=window.workspace.resourceID;class Q{constructor(){this.templateByQuery=new Map,this.buldTemplates()}buldTemplates(){this.templateByQuery.set("fetchParam",B.gql`query($name: String!) {
|
|
48
|
+
}`)}getDataUnit(e,t){const n=new i(`dd://${e}/${t}`);return n.metadataLoader=e=>this.loadMetadata(e),n.dataLoader=(e,t,n)=>this.loadData(e,t,n),n.saveLoader=(e,t)=>this.saveData(e,t),n.removeLoader=(e,t)=>this.removeRecords(e,t),n}loadMetadata(e){return new Promise(((t,n)=>{G.get().callGraphQL({values:{name:e.name},query:this.templateByQuery.get("fetchDataUnit")}).then((e=>{var n;const i={name:e.name,label:e.name,fields:[]};null===(n=e.fields)||void 0===n||n.forEach((e=>{let t;Array.isArray(e.properties)&&(t={},e.properties.forEach((e=>t[e.name]=e.value))),i.fields.push(Object.assign(Object.assign({},e),{properties:t}))})),t(i)})).catch((e=>{n(e)}))}))}loadData(e,t,n){return new Promise(((i,r)=>{G.get().callGraphQL({values:{dataunit:e.name,sort:t,filters:n},query:this.templateByQuery.get("fetchData")}).then((t=>{const n=[];t.data.records.forEach((t=>{const i={__record__id__:t.id};t.fields.forEach((({name:t,value:n})=>{i[t]=e.valueFromString(t,n)})),n.push(i)})),i(n)})).catch((e=>{r(e)}))}))}saveData(e,t){const n=t.map((e=>{const{dataUnit:t,record:n,updatingFields:i,operation:r}=e;return{dataUnit:t,updatingFields:Object.entries(i).map((([e,t])=>({fieldName:e,value:this.formatValueToServer(t)}))),operation:r,recordId:n.__record__id__}}));return new Promise(((t,i)=>{G.get().callGraphQL({values:{changes:n},query:this.templateByQuery.get("saveData")}).then((n=>{const i=[];null==n||n.forEach((t=>{const n={__record__id__:t.id};t.oldId&&(n.__old__id__=t.oldId),t.fields.forEach((({name:t,value:i})=>{n[t]=e.valueFromString(t,i)})),i.push(n)})),t(i)})).catch((e=>{i(e)}))}))}formatValueToServer(e){if(void 0===e)return e;try{if(e instanceof Date||"string"==typeof e)return e.toString();e=JSON.stringify(e)}catch(t){e=e.toString()}return e}removeRecords(e,t){const n=t.map((t=>({dataUnit:e.name,operation:r.DELETE,recordId:t})));return new Promise(((e,i)=>{G.get().callGraphQL({values:{changes:n},query:this.templateByQuery.get("saveData")}).then((()=>{e(t)})).catch((e=>{i(e)}))}))}}class z{static openAppActivity(e,t){var n;null===(n=window.workspace)||void 0===n||n.openAppActivity(e,t)}}z.resourceID=window.workspace.resourceID;class Q{constructor(){this.templateByQuery=new Map,this.buldTemplates()}buldTemplates(){this.templateByQuery.set("fetchParam",B.gql`query($name: String!) {
|
|
49
49
|
$queryAlias$: fetchResource(name: $name){
|
|
50
50
|
name
|
|
51
51
|
resource
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as a,b as t}from"./p-a33afc3b.js";(()=>{const t=import.meta.url,r={};return""!==t&&(r.resourcesUrl=new URL(".",t).href),a(r)})().then((a=>t([["p-
|
|
1
|
+
import{p as a,b as t}from"./p-a33afc3b.js";(()=>{const t=import.meta.url,r={};return""!==t&&(r.resourcesUrl=new URL(".",t).href),a(r)})().then((a=>t([["p-76b95007",[[2,"snk-application",{getStringParam:[64],getIntParam:[64],getFloatParam:[64],getBooleanParam:[64],getDateParam:[64],temOpcional:[64],getAttributeFromHTMLWrapper:[64],openApp:[64],createDataunit:[64],getResourceID:[64],alert:[64],error:[64],confirm:[64],info:[64],loadFormConfig:[64]}]]]],a)));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sankhyalabs/sankhyablocks",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"description": "Stencil Component Starter",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -27,8 +27,9 @@
|
|
|
27
27
|
"test": "stencil test --spec --e2e",
|
|
28
28
|
"test.watch": "stencil test --spec --e2e --watchAll",
|
|
29
29
|
"generate": "stencil generate",
|
|
30
|
-
"link": "node link.js",
|
|
31
|
-
"semantic-release": "semantic-release"
|
|
30
|
+
"link": "node scripts/link.js",
|
|
31
|
+
"semantic-release": "semantic-release",
|
|
32
|
+
"link-dev": "gulp watch-dev"
|
|
32
33
|
},
|
|
33
34
|
"dependencies": {
|
|
34
35
|
"graphql-request": "^4.2.0"
|
|
@@ -50,7 +51,10 @@
|
|
|
50
51
|
"jest-cli": "^27.4.5",
|
|
51
52
|
"puppeteer": "^10.0.0",
|
|
52
53
|
"redux": "^4.1.2",
|
|
53
|
-
"semantic-release": "17.4.3"
|
|
54
|
+
"semantic-release": "17.4.3",
|
|
55
|
+
"gulp": "^4.0.2",
|
|
56
|
+
"gulp-run": "^1.7.1",
|
|
57
|
+
"gulp-watch": "^5.0.1"
|
|
54
58
|
},
|
|
55
59
|
"jest": {
|
|
56
60
|
"verbose": true
|