@sankhyalabs/sankhyablocks 1.1.21 → 1.1.22

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.
@@ -7645,7 +7645,12 @@ class DataUnitFetcher {
7645
7645
  const { dataUnit: changeDU, record, updatingFields, operation } = change;
7646
7646
  const parsedUpdatingFields = Object.entries(updatingFields).map(([fieldName, value]) => {
7647
7647
  if (value) {
7648
- value = value.toString();
7648
+ try {
7649
+ value = JSON.stringify(value);
7650
+ }
7651
+ catch (_a) {
7652
+ value = value.toString();
7653
+ }
7649
7654
  }
7650
7655
  return { fieldName, value };
7651
7656
  });
@@ -124,7 +124,12 @@ export default class DataUnitFetcher {
124
124
  const { dataUnit: changeDU, record, updatingFields, operation } = change;
125
125
  const parsedUpdatingFields = Object.entries(updatingFields).map(([fieldName, value]) => {
126
126
  if (value) {
127
- value = value.toString();
127
+ try {
128
+ value = JSON.stringify(value);
129
+ }
130
+ catch (_a) {
131
+ value = value.toString();
132
+ }
128
133
  }
129
134
  return { fieldName, value };
130
135
  });
@@ -7641,7 +7641,12 @@ class DataUnitFetcher {
7641
7641
  const { dataUnit: changeDU, record, updatingFields, operation } = change;
7642
7642
  const parsedUpdatingFields = Object.entries(updatingFields).map(([fieldName, value]) => {
7643
7643
  if (value) {
7644
- value = value.toString();
7644
+ try {
7645
+ value = JSON.stringify(value);
7646
+ }
7647
+ catch (_a) {
7648
+ value = value.toString();
7649
+ }
7645
7650
  }
7646
7651
  return { fieldName, value };
7647
7652
  });
@@ -7641,7 +7641,12 @@ class DataUnitFetcher {
7641
7641
  const { dataUnit: changeDU, record, updatingFields, operation } = change;
7642
7642
  const parsedUpdatingFields = Object.entries(updatingFields).map(([fieldName, value]) => {
7643
7643
  if (value) {
7644
- value = value.toString();
7644
+ try {
7645
+ value = JSON.stringify(value);
7646
+ }
7647
+ catch (_a) {
7648
+ value = value.toString();
7649
+ }
7645
7650
  }
7646
7651
  return { fieldName, value };
7647
7652
  });
@@ -45,7 +45,7 @@ import{r as t,c as e,h as n}from"./p-5fa264b9.js";class i{constructor(t){this._m
45
45
  value
46
46
  }
47
47
  }
48
- }`)}getDataUnit(t,e){const n=new F(`dd://${t}/${e}`);return n.metadataLoader=t=>this.loadMetadata(t),n.dataLoader=(t,e,n)=>this.loadData(t,e,n),n.saveLoader=(t,e)=>this.saveData(t,e),n.removeLoader=(t,e)=>this.removeRecords(t,e),n}loadMetadata(t){return new Promise(((e,n)=>{mt.get().callGraphQL({values:{name:t.name},query:this.templateByQuery.get("fetchDataUnit")}).then((t=>{var n;const i={name:t.name,label:t.name,fields:[]};null===(n=t.fields)||void 0===n||n.forEach((t=>{let e;Array.isArray(t.properties)&&(e={},t.properties.forEach((t=>e[t.name]=t.value))),i.fields.push(Object.assign(Object.assign({},t),{properties:e}))})),e(i)})).catch((t=>{n(t)}))}))}loadData(t,e,n){return new Promise(((i,r)=>{mt.get().callGraphQL({values:{dataunit:t.name,sort:e,filters:n},query:this.templateByQuery.get("fetchData")}).then((e=>{const n=[];e.data.records.forEach((e=>{const i={__record__id__:e.id};e.fields.forEach((({name:e,value:n})=>{i[e]=t.valueFromString(e,n)})),n.push(i)})),i(n)})).catch((t=>{r(t)}))}))}saveData(t,e){const n=e.map((t=>{const{dataUnit:e,record:n,updatingFields:i,operation:r}=t;return{dataUnit:e,updatingFields:Object.entries(i).map((([t,e])=>(e&&(e=e.toString()),{fieldName:t,value:e}))),operation:r,recordId:n.__record__id__}}));return new Promise(((e,i)=>{mt.get().callGraphQL({values:{changes:n},query:this.templateByQuery.get("saveData")}).then((n=>{const i=[];null==n||n.forEach((e=>{const n={__record__id__:e.id};e.oldId&&(n.__old__id__=e.oldId),e.fields.forEach((({name:e,value:i})=>{n[e]=t.valueFromString(e,i)})),i.push(n)})),e(i)})).catch((t=>{i(t)}))}))}removeRecords(t,e){const n=e.map((e=>({dataUnit:t.name,operation:A.DELETE,recordId:e})));return new Promise(((t,i)=>{mt.get().callGraphQL({values:{changes:n},query:this.templateByQuery.get("saveData")}).then((()=>{t(e)})).catch((t=>{i(t)}))}))}}class wt{static openAppActivity(t,e){var n;null===(n=window.workspace)||void 0===n||n.openAppActivity(t,e)}}wt.resourceID=window.workspace.resourceID;class gt{constructor(){this.templateByQuery=new Map,this.buldTemplates()}buldTemplates(){this.templateByQuery.set("fetchParam",pt.gql`query($name: String!) {
48
+ }`)}getDataUnit(t,e){const n=new F(`dd://${t}/${e}`);return n.metadataLoader=t=>this.loadMetadata(t),n.dataLoader=(t,e,n)=>this.loadData(t,e,n),n.saveLoader=(t,e)=>this.saveData(t,e),n.removeLoader=(t,e)=>this.removeRecords(t,e),n}loadMetadata(t){return new Promise(((e,n)=>{mt.get().callGraphQL({values:{name:t.name},query:this.templateByQuery.get("fetchDataUnit")}).then((t=>{var n;const i={name:t.name,label:t.name,fields:[]};null===(n=t.fields)||void 0===n||n.forEach((t=>{let e;Array.isArray(t.properties)&&(e={},t.properties.forEach((t=>e[t.name]=t.value))),i.fields.push(Object.assign(Object.assign({},t),{properties:e}))})),e(i)})).catch((t=>{n(t)}))}))}loadData(t,e,n){return new Promise(((i,r)=>{mt.get().callGraphQL({values:{dataunit:t.name,sort:e,filters:n},query:this.templateByQuery.get("fetchData")}).then((e=>{const n=[];e.data.records.forEach((e=>{const i={__record__id__:e.id};e.fields.forEach((({name:e,value:n})=>{i[e]=t.valueFromString(e,n)})),n.push(i)})),i(n)})).catch((t=>{r(t)}))}))}saveData(t,e){const n=e.map((t=>{const{dataUnit:e,record:n,updatingFields:i,operation:r}=t;return{dataUnit:e,updatingFields:Object.entries(i).map((([t,e])=>{if(e)try{e=JSON.stringify(e)}catch(t){e=e.toString()}return{fieldName:t,value:e}})),operation:r,recordId:n.__record__id__}}));return new Promise(((e,i)=>{mt.get().callGraphQL({values:{changes:n},query:this.templateByQuery.get("saveData")}).then((n=>{const i=[];null==n||n.forEach((e=>{const n={__record__id__:e.id};e.oldId&&(n.__old__id__=e.oldId),e.fields.forEach((({name:e,value:i})=>{n[e]=t.valueFromString(e,i)})),i.push(n)})),e(i)})).catch((t=>{i(t)}))}))}removeRecords(t,e){const n=e.map((e=>({dataUnit:t.name,operation:A.DELETE,recordId:e})));return new Promise(((t,i)=>{mt.get().callGraphQL({values:{changes:n},query:this.templateByQuery.get("saveData")}).then((()=>{t(e)})).catch((t=>{i(t)}))}))}}class wt{static openAppActivity(t,e){var n;null===(n=window.workspace)||void 0===n||n.openAppActivity(t,e)}}wt.resourceID=window.workspace.resourceID;class gt{constructor(){this.templateByQuery=new Map,this.buldTemplates()}buldTemplates(){this.templateByQuery.set("fetchParam",pt.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-5fa264b9.js";(()=>{const t=import.meta.url,r={};return""!==t&&(r.resourcesUrl=new URL(".",t).href),a(r)})().then((a=>t([["p-1f8989f1",[[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)));
1
+ import{p as a,b as t}from"./p-5fa264b9.js";(()=>{const t=import.meta.url,r={};return""!==t&&(r.resourcesUrl=new URL(".",t).href),a(r)})().then((a=>t([["p-fe95f2c4",[[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.1.21",
3
+ "version": "1.1.22",
4
4
  "description": "Stencil Component Starter",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",