@flexkit/studio 0.2.28 → 0.2.30
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/chat-page-5HRMQQRO.js +4 -0
- package/dist/{chat-page-SLY7JDT3.js.map → chat-page-5HRMQQRO.js.map} +1 -1
- package/dist/{chunk-XYLLG7TG.js → chunk-4TQ25SVS.js} +3 -3
- package/dist/{chunk-XYLLG7TG.js.map → chunk-4TQ25SVS.js.map} +1 -1
- package/dist/{chunk-OVV3SPEI.js → chunk-5D6JCGLZ.js} +2 -2
- package/dist/{chunk-OVV3SPEI.js.map → chunk-5D6JCGLZ.js.map} +1 -1
- package/dist/{chunk-TZQIYXV6.js → chunk-6X54ZCSO.js} +2 -2
- package/dist/{chunk-TZQIYXV6.js.map → chunk-6X54ZCSO.js.map} +1 -1
- package/dist/{chunk-JL7F6DNM.js → chunk-A6UGAPMZ.js} +2 -2
- package/dist/{chunk-JL7F6DNM.js.map → chunk-A6UGAPMZ.js.map} +1 -1
- package/dist/chunk-BQWW2Q6B.js +378 -0
- package/dist/chunk-BQWW2Q6B.js.map +1 -0
- package/dist/{chunk-T2F2LSKT.js → chunk-CR3UGX4V.js} +2 -2
- package/dist/{chunk-T2F2LSKT.js.map → chunk-CR3UGX4V.js.map} +1 -1
- package/dist/{chunk-KOPI2BA6.js → chunk-E4RN4USU.js} +3 -3
- package/dist/{chunk-KOPI2BA6.js.map → chunk-E4RN4USU.js.map} +1 -1
- package/dist/{chunk-GELQFNMW.js → chunk-EC3SJ4NQ.js} +2 -2
- package/dist/{chunk-GELQFNMW.js.map → chunk-EC3SJ4NQ.js.map} +1 -1
- package/dist/{chunk-DUH7EUOQ.js → chunk-K2VO74FW.js} +3 -3
- package/dist/{chunk-DUH7EUOQ.js.map → chunk-K2VO74FW.js.map} +1 -1
- package/dist/{chunk-O45E7U6A.js → chunk-LBFL34FM.js} +3 -3
- package/dist/{chunk-O45E7U6A.js.map → chunk-LBFL34FM.js.map} +1 -1
- package/dist/{chunk-52RJAZXC.js → chunk-MNFVAW2B.js} +2 -2
- package/dist/{chunk-52RJAZXC.js.map → chunk-MNFVAW2B.js.map} +1 -1
- package/dist/{chunk-AHYUN6BW.js → chunk-WJRC5CQQ.js} +5 -5
- package/dist/{chunk-AHYUN6BW.js.map → chunk-WJRC5CQQ.js.map} +1 -1
- package/dist/{chunk-VFORIVVT.js → chunk-WPNV6WNQ.js} +3 -3
- package/dist/{chunk-VFORIVVT.js.map → chunk-WPNV6WNQ.js.map} +1 -1
- package/dist/{entry-MWNECEGJ.js → entry-FXAA2IGV.js} +2 -2
- package/dist/{entry-MWNECEGJ.js.map → entry-FXAA2IGV.js.map} +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/{list-IB75TGDL.js → list-DWSTP7CW.js} +2 -2
- package/dist/{list-IB75TGDL.js.map → list-DWSTP7CW.js.map} +1 -1
- package/dist/{list-L2ZOEIPM.js → list-TLIH4DCX.js} +3 -3
- package/dist/{list-L2ZOEIPM.js.map → list-TLIH4DCX.js.map} +1 -1
- package/dist/{pages-EMWNEUIL.js → pages-IXHYEUBL.js} +3 -3
- package/dist/{pages-EMWNEUIL.js.map → pages-IXHYEUBL.js.map} +1 -1
- package/dist/{plugin-pages-FCCI6LUM.js → plugin-pages-Q5KRARJD.js} +2 -2
- package/dist/{plugin-pages-FCCI6LUM.js.map → plugin-pages-Q5KRARJD.js.map} +1 -1
- package/dist/record-links-DSRYOOM5.js +2 -0
- package/dist/{record-links-MQVSKVHN.js.map → record-links-DSRYOOM5.js.map} +1 -1
- package/dist/{root-WQ46J72W.js → root-2QWOQ2AH.js} +3 -3
- package/dist/{root-WQ46J72W.js.map → root-2QWOQ2AH.js.map} +1 -1
- package/dist/{root-NJZRHKIE.js → root-IJKEEUBR.js} +2 -2
- package/dist/{root-NJZRHKIE.js.map → root-IJKEEUBR.js.map} +1 -1
- package/dist/{root-EFNWUWPN.js → root-IKO3UPTJ.js} +2 -2
- package/dist/{root-EFNWUWPN.js.map → root-IKO3UPTJ.js.map} +1 -1
- package/dist/{root-JEOBPU7A.js → root-IMTXHNCZ.js} +2 -2
- package/dist/{root-JEOBPU7A.js.map → root-IMTXHNCZ.js.map} +1 -1
- package/dist/{root-LQAVWIY3.js → root-NW5QG7W5.js} +3 -3
- package/dist/{root-LQAVWIY3.js.map → root-NW5QG7W5.js.map} +1 -1
- package/dist/{root-NU5FDZDZ.js → root-TERO3GWT.js} +3 -3
- package/dist/{root-NU5FDZDZ.js.map → root-TERO3GWT.js.map} +1 -1
- package/dist/{search-X5IUEVYF.js → search-THZV66M5.js} +2 -2
- package/dist/{search-X5IUEVYF.js.map → search-THZV66M5.js.map} +1 -1
- package/dist/{skills-pages-LHPLYVNU.js → skills-pages-D2QSG6WT.js} +2 -2
- package/dist/{skills-pages-LHPLYVNU.js.map → skills-pages-D2QSG6WT.js.map} +1 -1
- package/dist/{source-2KGHPYXB.js → source-AH4O5WGE.js} +2 -2
- package/dist/{source-2KGHPYXB.js.map → source-AH4O5WGE.js.map} +1 -1
- package/package.json +1 -1
- package/dist/chat-page-SLY7JDT3.js +0 -4
- package/dist/chunk-5JQ4T6EJ.js +0 -378
- package/dist/chunk-5JQ4T6EJ.js.map +0 -1
- package/dist/record-links-MQVSKVHN.js +0 -2
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
import'./index.css';import {e,d,a as a$2,c,b as b$1}from'./chunk-LBFL34FM.js';import {a}from'./chunk-YDVO6XWD.js';import {a as a$1}from'./chunk-ERDARDGB.js';import {b,c as c$1}from'./chunk-4TQ25SVS.js';import {find,propEq,omit,pick,toPairs,uniq,uniqBy,prop}from'ramda';import {useState,useRef,useMemo,useEffect,useCallback}from'react';import {gql,NetworkStatus}from'@apollo/client';import {useQuery}from'@apollo/client/react';var Wt=25,mn=3,Kt=3,hn=["id","string"],$n=["date","datetime","duration","time"],$t=`_id
|
|
2
|
+
originalFilename
|
|
3
|
+
mimeType
|
|
4
|
+
path
|
|
5
|
+
url
|
|
6
|
+
size
|
|
7
|
+
height
|
|
8
|
+
width
|
|
9
|
+
lqip`,At=`_id
|
|
10
|
+
originalFilename
|
|
11
|
+
mimeType
|
|
12
|
+
path
|
|
13
|
+
url
|
|
14
|
+
size
|
|
15
|
+
height
|
|
16
|
+
width`,An=`_id
|
|
17
|
+
path
|
|
18
|
+
url`;function tt(t){return t?a(t)==="relationship"&&t.relationship?.mode==="multiple"&&t.relationship.entity==="_asset":false}function Et(t,n){return !t||!tt(t)?false:n?.name!==c$1.name||t.name!=="assets"}function ct(t){return t?.dataType==="asset"||t?.inputType==="asset"}function Jt(t){let n=t,e=n?.edges??[],r=n?.aggregate?.count?.nodes??e.length;return e.reduce((i,s,o)=>(s.node&&i.push({...s.node,sortOrder:s.properties?.sortOrder??o,totalCount:r}),i),[]).sort((i,s)=>(i.sortOrder??Number.MAX_SAFE_INTEGER)-(s.sortOrder??Number.MAX_SAFE_INTEGER))}function En(t){return t.reduce((n,e,r)=>e._id?{...n,[e._id]:e.sortOrder??r}:n,{})}function B(t){return Array.isArray(t)?t[0]??null:t??null}function bn(t,n){return n?An:t?$t:At}function Pt(t,n=true,e=true,r=Wt,i=false){let s=n?` properties {
|
|
19
|
+
sortOrder
|
|
20
|
+
}
|
|
21
|
+
`:"",o=bn(e,i),l=n?`(first: ${r}, sort: [{ edge: { sortOrder: ASC } }])`:`(first: ${r})`;return ` ${t}Connection${l} {
|
|
22
|
+
aggregate {
|
|
23
|
+
count {
|
|
24
|
+
nodes
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
edges {
|
|
28
|
+
`+s+` node {
|
|
29
|
+
${o}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
`}function Xt(t){return t?.aggregate?.count?.nodes??0}function Zt(t,n){let e=t[`${n}Total`];return typeof e=="number"?e:Xt(t[`${n}Connection`])}function bt(t,n=""){return ` ${t}Connection${n} {
|
|
34
|
+
aggregate {
|
|
35
|
+
count {
|
|
36
|
+
nodes
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
`}function Sn(t,n,e){return n?e==="total"?` ${t}Total
|
|
41
|
+
`:bt(t,"(where: $where)"):""}function _n(t,n,e,r=false){if(!t)return "";let i=n==="default"?"":`${n}
|
|
42
|
+
`;if(ct(t))return r?` ${t.name} {
|
|
43
|
+
_id
|
|
44
|
+
path
|
|
45
|
+
url
|
|
46
|
+
}
|
|
47
|
+
`:` ${t.name} {
|
|
48
|
+
${$t}
|
|
49
|
+
}
|
|
50
|
+
`;if(a(t)==="local")return ` ${t.name} {
|
|
51
|
+
_id
|
|
52
|
+
default
|
|
53
|
+
${i}}
|
|
54
|
+
`;if(a(t)==="relationship"){let s=t.relationship?.field;if(!s)return ` ${t.name}
|
|
55
|
+
`;let o=find(propEq(t.relationship?.entity,"name"))(e),l=find(propEq(s,"name"))(o?.attributes??[]),c=l&&a(l)==="local"?`{
|
|
56
|
+
_id
|
|
57
|
+
default
|
|
58
|
+
${i}}
|
|
59
|
+
`:"";return t.relationship?.mode==="single"?` ${t.name} {
|
|
60
|
+
${s} ${c}}
|
|
61
|
+
`:` ${t.name} (limit: 3, offset: 0) {
|
|
62
|
+
${s} ${c}}
|
|
63
|
+
`}return ` ${t.name}
|
|
64
|
+
`}function Rn(t,n,e){return t?.attributes.reduce((r,i)=>{let s=n==="default"?"":`${n}
|
|
65
|
+
`;if(ct(i))return `${r}
|
|
66
|
+
${i.name} {
|
|
67
|
+
${At}
|
|
68
|
+
}
|
|
69
|
+
`;if(a(i)==="local")return `${r}
|
|
70
|
+
${i.name} {
|
|
71
|
+
_id
|
|
72
|
+
default
|
|
73
|
+
${s}
|
|
74
|
+
}
|
|
75
|
+
`;if(a(i)==="relationship"){let o=find(propEq(i.relationship?.entity,"name"))(e),l=find(propEq(i.relationship?.field,"name"))(o?.attributes??[]),c=a(l)==="local"?`{
|
|
76
|
+
_id
|
|
77
|
+
default
|
|
78
|
+
${s}}
|
|
79
|
+
`:"";if(i.relationship?.mode==="single")return `${r}
|
|
80
|
+
${i.name} {
|
|
81
|
+
${i.relationship.field} ${c}}
|
|
82
|
+
`;if(i.relationship?.field)return `${r}
|
|
83
|
+
${i.name} (limit: ${Kt}, offset: 0) {
|
|
84
|
+
${i.relationship.field} ${c}}
|
|
85
|
+
`}return `${r}
|
|
86
|
+
${i.name}
|
|
87
|
+
`},"")??""}function In(t){let n={};for(let e of t)n[e.name]=e;return n}function mt(t){return t?t.name==="url"?true:!(t.hidden===true||t.name==="lqip"):false}function Zn(t,n){if(!Array.isArray(t)||t.length===0)return;let[e]=t;if(!e||typeof e!="object")return;let[r]=Object.keys(e);if(!r||["_id","_createdAt","_updatedAt"].includes(r))return;let i=n?.attributes.find(s=>s.name===r);if(!(!i||a(i)!=="global"||i.dataType==="asset"))return {NOT:{[r]:{eq:null}}}}function at(t,n,e,r){let i=r?.selection??"full",s=i==="display"?"list":i,o=r?.includeCount??true,l=r?.countMode??"aggregate",c="(where: $where, limit: $limit, offset: $offset, sort: $sort)",u=D(e,t),a$2=u?.name??t,d=a$1(u),f=i==="display"?d?[d]:[]:u?.attributes??[],p=In(f),m=`$where: ${a$2}Where, $limit: Int, $offset: Int, $sort: [${a$2}Sort!]`,h=r?.operationName??`Get${x(t)}`;if(!u)throw new Error(`Entity '${a$2}' not found in the schema`);if(f.length===0)throw new Error(`Entity '${a$2}' has no attributes defined in the schema`);let A=L("global",f).filter($=>$==="_updatedAt"?false:s==="list"?i==="display"||mt(p[$]):true).join(`
|
|
88
|
+
`),g=nt(f).filter($=>s!=="list"||i==="display"||mt(p[$])),y=L(["local"],f).filter($=>s!=="list"?true:i==="display"||mt(p[$])),E=y.reduce(($,R)=>`${$}
|
|
89
|
+
${R} {
|
|
90
|
+
_id
|
|
91
|
+
default
|
|
92
|
+
}
|
|
93
|
+
`,""),C=y.reduce(($,R)=>`${$}
|
|
94
|
+
${R} {
|
|
95
|
+
_id
|
|
96
|
+
default
|
|
97
|
+
${n}
|
|
98
|
+
}
|
|
99
|
+
`,""),F=n==="default"?E:C,b=`_id
|
|
100
|
+
path
|
|
101
|
+
url`;s!=="list"&&(b=`_id
|
|
102
|
+
originalFilename
|
|
103
|
+
mimeType
|
|
104
|
+
path
|
|
105
|
+
url
|
|
106
|
+
size
|
|
107
|
+
height
|
|
108
|
+
width
|
|
109
|
+
lqip`);let z=g.reduce(($,R)=>`${$}
|
|
110
|
+
${R} {
|
|
111
|
+
${b}
|
|
112
|
+
}
|
|
113
|
+
`,""),J=f.filter($=>a($)==="relationship").reduce(($,R)=>{if(s==="list"&&i!=="display"&&R.hidden===true)return $;if(tt(R))return `${$}
|
|
114
|
+
${Pt(R.name,Et(R,u),s!=="list",s==="list"?mn:Wt,s==="list")}`;let k=find(propEq(R.relationship?.entity,"name"))(e);if(s==="list"){let v=a$1(k),st=_n(v,n,e,true),ot=R.relationship?.mode==="single"?1:3;return `${$}
|
|
115
|
+
${R.name} (limit: ${ot}, offset: 0) {
|
|
116
|
+
_id
|
|
117
|
+
${st} }
|
|
118
|
+
`}let H=Rn(k,n,e);return `${bt(R.name).trim()}${$}
|
|
119
|
+
${R.name} (limit: 25, offset: 0) { _id ${H}}
|
|
120
|
+
`},"");return {queryEntityName:t,query:`query ${h}(${m}) {
|
|
121
|
+
`+Sn(t,o,l)+` ${t}${c} {
|
|
122
|
+
_id
|
|
123
|
+
_updatedAt
|
|
124
|
+
${A} ${F} ${z} ${J}}
|
|
125
|
+
}
|
|
126
|
+
`}}function Ht(t,n,e,r){let s=D(r,t)?.attributes??[];if(s.length===0)return {count:0,results:[]};let o=Zt(e,t),l=e[t],c=(a$1,d)=>{let f=d.name;return a$1.slice(0,3).map(p=>{if(a(d)!=="local")return p[f];let m=B(p[f]);return m?.[n]??m?.default}).join(", ")},u=l.map(a$2=>{let{_id:d}=a$2,f=typeof a$2._updatedAt=="string"?a$2._updatedAt:"",p=L("global",s).filter(g=>g!=="_updatedAt").reduce((g,y)=>({...g,[y]:a$2[y]}),{}),m=L("local",s).reduce((g,y)=>{let E=B(a$2[y]);return {...g,[y]:E?.[n]?E[n]:E?.default}},{}),h=nt(s).reduce((g,y)=>({...g,[y]:B(a$2[y])}),{}),A=L(["relationship"],s).reduce((g,y)=>{let E=find(propEq(y,"name"))(s),C=E.relationship?.entity??"",F=find(propEq(C,"name"))(r),b=a$1(F),z=a$2[y];if(tt(E)){let k=Jt(a$2[`${y}Connection`]);return {...g,[y]:k}}if(!b)throw new Error(`There is an error in the schema for the relationship attribute "${y}"`);let V=b.name,J=a(b);if(E.relationship?.mode==="multiple"){let k=Array.isArray(z)?z:[];return {...g,[y]:c(k,b)}}let $=B(z);if(J==="global")return {...g,[y]:$?.[V]};let R=B($?.[V]);return {...g,[y]:R?.[n]??R?.default}},{});return {_id:d,...p,...m,...h,...A,_updatedAt:f}});return {count:o,results:u}}function Yt(t,n,e,r){let s=D(r,t)?.attributes??[];if(s.length===0)return {count:0,results:[]};let o=Zt(e,t),c=e[t].map(u=>{let a$1=L("global",s).reduce((m,h)=>({...m,[h]:{value:u[h],disabled:false,scope:"default",_id:""}}),{}),d=L("local",s).reduce((m,h)=>{let A=find(propEq(h,"name"))(s),g=B(u[h]);return {...m,[h]:{value:g?wn(g,n):null,disabled:!!(g&&g[n]===null&&a(A)==="local"&&n!=="default"),scope:n,_id:g?g._id:null}}},{}),f=nt(s).reduce((m,h)=>({...m,[h]:{value:B(u[h]),disabled:false,scope:"default",_id:""}}),{}),p=L(["relationship"],s).reduce((m,h)=>{let A=find(propEq(h,"name"))(s),g=u[h],y=A.relationship?.mode==="single"?B(g):g,E=y?._id,C=Xt(u[`${h}Connection`]);if(tt(A)){let F=Jt(u[`${h}Connection`]);return {...m,[h]:{count:C,_id:E,knownAssetSortOrders:En(F),value:F,disabled:false,scope:n}}}return {...m,[h]:{count:C,_id:E,value:y,disabled:false,scope:n}}},{});return {...a$1,...d,...f,...p}});return {count:o,results:c}}function wn(t,n){return Array.isArray(t)?t.reduce((e,r)=>{if(r[n]??r.default){let i={_id:r._id,disabled:r.scope===null&&n!=="default",scope:n,value:r[n]??r.default};e.push(i);}return e},[]):t[n]??t.default??null}function Hn(t,n,e,r,i,s,o){let l=D(r,t),c=l?.name??t,u=l?.attributes??[],a=et(t);if(u.length===0)return "";let d=Nt(u,s),f=tn(u,d),p=Fn(n,u,d,e),m=On(u,i,d),h=Cn(u,i,d),A=t,g=o?.responseFields??en(r,t,e);return `mutation ${`Update${x(t)}`}($where: ${c}Where) {
|
|
127
|
+
update${a}(
|
|
128
|
+
where: $where
|
|
129
|
+
update: {${f}${p}${m}${h}
|
|
130
|
+
}
|
|
131
|
+
) {
|
|
132
|
+
${A} {
|
|
133
|
+
_id
|
|
134
|
+
${g} }
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
`}function Nt(t,n){let e=t.filter(i=>i.readOnly===true).map(i=>i.name),r=omit(e,n);return pick(t.map(i=>i.name),r)}function L(t,n){return Array.isArray(t)?t.reduce((r,i)=>r.concat(L(i,n)),[]):n.filter(r=>a(r)===t&&r.inputType!=="asset").map(r=>r.name)}function nt(t){return t.filter(ct).map(e=>e.name)}function tn(t,n,e="update"){let r=pick(L("global",t),n);return toPairs(r).reduce((s,[o,l])=>{let c=find(propEq(o,"name"))(t),u=Array.isArray(l?.value)?null:l?.value??null,a=St(c.dataType,u);return e==="create"&&(a===null||a==="")?s:e==="update"?`${s}
|
|
138
|
+
${o}: { set: ${a} }`:`${s}
|
|
139
|
+
${o}: ${a}`},"")}function ht(t){return !t?._id||!t.path?"":t._id}function On(t,n,e){let r=pick(nt(t),e);return toPairs(r).reduce((o,[l,c])=>{let u=ht(c.value),a=ht(n[l]?.value);if(u===a)return o;let d=a?` {
|
|
140
|
+
disconnect: [{
|
|
141
|
+
where: {
|
|
142
|
+
node: {
|
|
143
|
+
_id: { eq: ${O(a)} }
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}]
|
|
147
|
+
}
|
|
148
|
+
`:"",f=u?` {
|
|
149
|
+
connect: [{
|
|
150
|
+
where: {
|
|
151
|
+
node: {
|
|
152
|
+
_id: { eq: ${O(u)} }
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}]
|
|
156
|
+
}
|
|
157
|
+
`:"";return `${o}
|
|
158
|
+
${l}: [
|
|
159
|
+
${d}${f} ]`},"")}function Ln(t,n){let e=pick(nt(t),n);return toPairs(e).reduce((s,[o,l])=>{let c=ht(l.value);return c?`${s}
|
|
160
|
+
${o}: {
|
|
161
|
+
connect: [{
|
|
162
|
+
where: {
|
|
163
|
+
node: {
|
|
164
|
+
_id: { eq: ${O(c)} }
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}]
|
|
168
|
+
}`:s},"")}function Fn(t,n,e,r){let i=pick(L("local",n),e);return toPairs(i).reduce((l,[c,u])=>{let a=find(propEq(c,"name"))(n),{dataType:d}=a,f=u.disabled||Array.isArray(u.value)?"null":St(d,u.value);return u._id?`${l}
|
|
169
|
+
${c}: [{
|
|
170
|
+
update: {
|
|
171
|
+
node: {
|
|
172
|
+
${r}: { set: ${f} }
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}]`:u.disabled||Array.isArray(u.value)||u.value===void 0||u.value===null||u.value===""||f===null||f===""?l:`${l}
|
|
176
|
+
${c}: [{
|
|
177
|
+
create: {
|
|
178
|
+
node: {
|
|
179
|
+
_id: ${O(`${t}:${c}`)}
|
|
180
|
+
_type: "${d}"
|
|
181
|
+
${r}: ${f}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}]`},"")}function Cn(t,n,e){let r=pick(L("relationship",t),e);return toPairs(r).reduce((o,[l,c])=>{let u=find(propEq(l,"name"))(t),{inputType:a,relationship:d}=u;if(a==="relationship"&&d?.mode==="single"){let f=n[l]._id??"",p=c._id??"";if(f===p)return o;let m=f?` {
|
|
185
|
+
disconnect: [{
|
|
186
|
+
where: {
|
|
187
|
+
node: {
|
|
188
|
+
_id: { eq: ${O(f)} }
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}]
|
|
192
|
+
}
|
|
193
|
+
`:"",h=p?` {
|
|
194
|
+
connect: [{
|
|
195
|
+
where: {
|
|
196
|
+
node: {
|
|
197
|
+
_id: { eq: ${O(p)} }
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}]
|
|
201
|
+
}
|
|
202
|
+
`:"";return `${o}
|
|
203
|
+
${l}: [
|
|
204
|
+
${m}${h} ]`}if(a==="relationship"&&d?.mode==="multiple"){if(d.entity==="_asset")return `${o}${Tn(l,n[l],c)}`;let f=uniq(c.relationships?.disconnect??[]).filter(Boolean),m=(c.relationships?.connect??[]).map(g=>O(g._id)).join(", "),h=f.length?` {
|
|
205
|
+
disconnect: [
|
|
206
|
+
${f.map(g=>` {
|
|
207
|
+
where: {
|
|
208
|
+
node: {
|
|
209
|
+
_id: { eq: ${O(g)} }
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
`).join("")} ]
|
|
214
|
+
}
|
|
215
|
+
`:"",A=m?` {
|
|
216
|
+
connect: [{
|
|
217
|
+
where: {
|
|
218
|
+
node: {
|
|
219
|
+
_id: { in: [${m}] }
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}]
|
|
223
|
+
}
|
|
224
|
+
`:"";return !h&&!A?o:`${o}
|
|
225
|
+
${l}: [
|
|
226
|
+
${h}${A} ]`}return `${o}
|
|
227
|
+
`},"")}function Tn(t,n,e){let i=(e.relationships?.connect??[]).map((p,m)=>({...p,sortOrder:p.sortOrder??m})),s=i.map(p=>p._id),o={...Mn(n),...n?.knownAssetSortOrders??{},...e.knownAssetSortOrders??{}},l=uniq(e.relationships?.disconnect??[]).filter(p=>p&&!s.includes(p)),c=i.filter(p=>o[p._id]===void 0),u=i.filter(p=>{let m=o[p._id];return m!==void 0&&m!==p.sortOrder}),a=Qn(l),d=qn(c),f=xn(u);return !a&&!d&&!f?"":`
|
|
228
|
+
${t}: [
|
|
229
|
+
${a}${d}${f} ]`}function Mn(t){let n=t?.value;return Array.isArray(n)?n.reduce((e,r,i)=>{if(typeof r!="object"||!r||!("_id"in r))return e;let{_id:s}=r;if(typeof s!="string"||s.length===0)return e;let o="sortOrder"in r&&typeof r.sortOrder=="number"?r.sortOrder:i;return {...e,[s]:o}},{}):{}}function Qn(t){return t.length===0?"":` {
|
|
230
|
+
disconnect: [
|
|
231
|
+
${t.reduce((e,r)=>`${e} {
|
|
232
|
+
where: { node: { _id: { eq: ${O(r)} } } }
|
|
233
|
+
}
|
|
234
|
+
`,"")} ]
|
|
235
|
+
}
|
|
236
|
+
`}function qn(t){return t.length===0?"":` {
|
|
237
|
+
connect: [
|
|
238
|
+
${nn(t)} ]
|
|
239
|
+
}
|
|
240
|
+
`}function nn(t){return t.reduce((n,e,r)=>{let i=e.sortOrder??r;return `${n} {
|
|
241
|
+
where: { node: { _id: { eq: ${O(e._id)} } } }
|
|
242
|
+
edge: { sortOrder: ${i} }
|
|
243
|
+
}
|
|
244
|
+
`},"")}function xn(t){return t.length===0?"":t.reduce((e,r,i)=>{let s=r.sortOrder??i;return `${e} {
|
|
245
|
+
update: {
|
|
246
|
+
where: { node: { _id: { eq: ${O(r._id)} } } }
|
|
247
|
+
edge: { sortOrder: { set: ${s} } }
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
`},"")}function St(t,n){return $n.includes(t)?n?.toString()?O(n.toString()):null:hn.includes(t)?n==null?null:O(n.toString()):n==null||n===""?null:n.toString()}function O(t){return JSON.stringify(t)}function en(t,n,e){let r=D(t,n),i=r?.attributes??[],s=L("global",i),o=L("local",i),l=L("relationship",i),c=s.reduce((u,a)=>`${u}${a}
|
|
251
|
+
`,"");return c+=o.reduce((u,a)=>`${u} ${a} {
|
|
252
|
+
_id
|
|
253
|
+
${e}
|
|
254
|
+
}
|
|
255
|
+
`,""),c+=l.reduce((u,a$1)=>{let d=find(propEq(a$1,"name"))(i),f=d?.relationship?.mode??"single";if(tt(d))return `${u}${Pt(a$1,Et(d,r))}`;let p=d?.relationship?.entity??"",h=find(propEq(p,"name"))(t)?.attributes??[],A=d?.relationship?.field??"[invalid_relationship_field_name_in_schema]",g=find(propEq(A,"name"))(h),y=a(g),E="";if(f==="single"&&(y==="global"&&(E=` ${a$1} {
|
|
256
|
+
_id
|
|
257
|
+
${A}
|
|
258
|
+
}
|
|
259
|
+
`),y==="local"&&(E=` ${a$1} {
|
|
260
|
+
_id
|
|
261
|
+
${A} {
|
|
262
|
+
_id
|
|
263
|
+
default
|
|
264
|
+
${e}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
`)),f==="multiple"&&h.length){let C=h.reduce((F,b)=>{if(a(b)==="local")return `${F} ${b.name} {
|
|
268
|
+
_id
|
|
269
|
+
default
|
|
270
|
+
${e}
|
|
271
|
+
}
|
|
272
|
+
`;if(a(b)==="relationship"){let z=e==="default"?"":`${e}
|
|
273
|
+
`,V=find(propEq(b.relationship?.entity,"name"))(t),J=find(propEq(b.relationship?.field,"name"))(V?.attributes??[]),$=a(J)==="local"?`{
|
|
274
|
+
_id
|
|
275
|
+
default
|
|
276
|
+
${z}}
|
|
277
|
+
`:"";if(b.relationship?.mode==="single")return `${F} ${b.name} {
|
|
278
|
+
${b.relationship.field} ${$}}
|
|
279
|
+
`;if(b.relationship?.field)return `${F} ${b.name} (limit: ${Kt}, offset: 0) {
|
|
280
|
+
${b.relationship.field} ${$}}
|
|
281
|
+
`}return ct(b)?`${F} ${b.name} {
|
|
282
|
+
${At}
|
|
283
|
+
}
|
|
284
|
+
`:`${F} ${b.name}
|
|
285
|
+
`},"");E=bt(a$1)+` ${a$1} (limit: 25, offset: 0) {
|
|
286
|
+
${C} }
|
|
287
|
+
`;}return `${u}${E}`},""),c}function Yn(t,n,e){let r=typeof e=="string"?[e]:[...e],i=find(propEq(t,"name"))(n),s=i?.attributes??[],o=et(i?.plural??""),l=kn(s,r),c=`Delete${x(i?.plural??t)}`;return t==="_asset"?`mutation ${c}($where: ${t}Where) {
|
|
288
|
+
delete_assets(
|
|
289
|
+
where: $where
|
|
290
|
+
) {
|
|
291
|
+
nodesDeleted
|
|
292
|
+
relationshipsDeleted
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
`:`mutation ${c}($where: ${t}Where) {
|
|
296
|
+
delete${o}(
|
|
297
|
+
where: $where
|
|
298
|
+
${l?` delete: {
|
|
299
|
+
${l}
|
|
300
|
+
}
|
|
301
|
+
`:""} ) {
|
|
302
|
+
nodesDeleted
|
|
303
|
+
relationshipsDeleted
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
`}function Nn(t){let n=typeof t=="string"?[t]:[...t];return n.length===1?{_id:{eq:n[0]}}:{_id:{in:n}}}function kn(t,n){return L("local",t).reduce((i,s)=>{let o=n.map(c=>O(`${c}:${s}`)).join(", "),l=n.length===1?`_id: { eq: ${o} }`:`_id: { in: [${o}] }`;return `${i}
|
|
307
|
+
${s}: [{
|
|
308
|
+
where: {
|
|
309
|
+
node: {
|
|
310
|
+
${l}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}]`},"")}function te(t,n,e,r,i){let s=D(n,t),o=s?.attributes??[],l=et(s?.plural??"");if(o.length===0)return "";let c=Nt(o,e),u=tn(o,c,"create"),a=vn(o,c,"default",r),d=Ln(o,c),f=jn(o,c),p=t,m=en(n,p,"default");return `mutation ${`Create${x(t)}`} {
|
|
314
|
+
create${l}(
|
|
315
|
+
input: [{
|
|
316
|
+
_id: ${O(r)} ${u} ${a}
|
|
317
|
+
${d}
|
|
318
|
+
${f}
|
|
319
|
+
}]
|
|
320
|
+
) {
|
|
321
|
+
${p} {
|
|
322
|
+
_id
|
|
323
|
+
${m} }
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
`}function vn(t,n,e,r){let i=pick(L("local",t),n);return toPairs(i).reduce((l,[c,u])=>{if(u?.value===void 0||u.value===null||u.value==="")return l;let a=find(propEq(c,"name"))(t),d=Array.isArray(u.value)?"null":St(a.dataType,u.value);return `${l}
|
|
327
|
+
${c}: {
|
|
328
|
+
create: [{
|
|
329
|
+
node: {
|
|
330
|
+
_id: ${O(`${r}:${c}`)}
|
|
331
|
+
_type: "${a.dataType}"
|
|
332
|
+
${e}: ${d}
|
|
333
|
+
}
|
|
334
|
+
}]
|
|
335
|
+
}`},"")}function jn(t,n){let e=pick(L("relationship",t),n);return toPairs(e).reduce((s,[o,l])=>{let c=find(propEq(o,"name"))(t),{inputType:u,relationship:a}=c;if(u==="relationship"&&a?.mode==="single"){if(!l._id)return s;let p=`connect: [{
|
|
336
|
+
where: {
|
|
337
|
+
node: {
|
|
338
|
+
_id: { eq: ${O(l._id)} }
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}]
|
|
342
|
+
`;return `${s}
|
|
343
|
+
${o}: {
|
|
344
|
+
${p} }`}let d=u==="relationship"&&a?.mode==="multiple",f=Array.isArray(l.relationships?.connect)&&l.relationships.connect.length>0;if(d&&f){let p=l.relationships?.connect??[];if(a?.entity==="_asset"){let A=nn(p.map((g,y)=>({...g,sortOrder:g.sortOrder??y})));return `${s}
|
|
345
|
+
${o}: {
|
|
346
|
+
connect: [
|
|
347
|
+
${A} ]
|
|
348
|
+
}`}let m=p.map(A=>O(A._id)).join(", "),h=m?`connect: {
|
|
349
|
+
where: {
|
|
350
|
+
node: {
|
|
351
|
+
_id: { in: [${m}] }
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
`:"";return `${s}
|
|
356
|
+
${o}: {
|
|
357
|
+
${h} }`}return `${s}
|
|
358
|
+
`},"")}function ne({relatedEntityName:t,scope:n,schema:e}){let i=find(propEq(t,"name"))(e)?.plural??"";return i?at(i,n,e,{selection:"list",operationName:`GetRelated${x(i)}`}):{queryEntityName:"",query:""}}function ee({attributeName:t,entityName:n,entityNamePlural:e,schema:r}){let i=D(r,e),s=find(propEq(t,"name"))(i?.attributes??[]),o=Et(s,i),l=o?` properties {
|
|
359
|
+
sortOrder
|
|
360
|
+
}
|
|
361
|
+
`:"",c=o?"(first: $first, sort: [{ edge: { sortOrder: ASC } }])":"(first: $first)",u=`Get${x(n)}AssetConnection`;return {queryEntityName:e,query:`query ${u}($where: ${n}Where, $first: Int) {
|
|
362
|
+
${e}(where: $where) {
|
|
363
|
+
${t}Connection${c} {
|
|
364
|
+
aggregate {
|
|
365
|
+
count {
|
|
366
|
+
nodes
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
edges {
|
|
370
|
+
`+l+` node {
|
|
371
|
+
${$t}
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
`}}var et=t=>t.charAt(0).toUpperCase()+t.slice(1);function x(t){let n=t.split(/[^0-9A-Za-z]+/).filter(Boolean).map(et).join("");return n?/^[A-Za-z_]/.test(n)?n:`Entity${n}`:"Entity"}function D(t,n){return n==="_assets"?b:find(propEq(n,"plural"))(t)}function re(t,n,e){if(!t||typeof t!="object")return {};let r=D(e,n);if(!r)return {};let i=`update${et(n)}`,s=t[i];if(!s||typeof s!="object")return {};let o=s[n],l=Array.isArray(o)?o[0]:void 0;return !l||typeof l!="object"?{}:r.attributes.reduce((c,u)=>{if(a(u)!=="local")return c;let d=B(l[u.name])?._id;return typeof d!="string"||d.length===0?c:{...c,[u.name]:d}},{})}var dt=null,_t=new Set,rn=[],Rt=new Set,It=new Set,wt=new Set;function ue(t,n){if(t==="_asset"||t==="_assets")return `Get${x(b.plural)}`;let e=n.find(s=>s.plural===t),r=n.find(s=>s.name===t),i=e?.plural??r?.plural??t;return `Get${x(i)}`}function sn(t){return Rt.add(t),()=>{Rt.delete(t);}}function on(t){return It.add(t),()=>{It.delete(t);}}function un(t){return wt.add(t),()=>{wt.delete(t);}}function le(t,n,e){let r=new Set(e.filter(Boolean));if(r.size>0)for(let i of It)i(n,r);return Dn(t,n)}function ce(t,n){let e=n.filter(r=>!!r._id);if(e.length!==0)for(let r of wt)r(t,e);}function Dn(t,n){return _t.add(n),new Promise((e,r)=>{rn.push({resolve:e,reject:r}),dt&&clearTimeout(dt),dt=setTimeout(()=>{let i=new Set(_t),s=rn.splice(0);_t.clear(),dt=null,Promise.all([...Rt].map(o=>Promise.resolve(o(i)))).then(()=>{for(let{resolve:o}of s)o();}).catch(o=>{console.error("Error refreshing entity lists:",o);for(let{reject:l}of s)l(o);});},50);})}function Ae({entityNamePlural:t,schema:n,scope:e$1,variables:r,isForm:i,selection:s="full",includeCount:o=true,fetchPolicy:l}){let[c$1,u]=useState({count:0,results:[]}),[a,d$1]=useState(false),[f,p]=useState(false),[m,h]=useState(null),A=useRef(false),g=useRef(false),y=useRef(0),E=useRef(null),C=useRef(null),F=`${t}Total`,b=D(n,t),V=r?.where===void 0&&(b?.spaces?.length??0)===0&&(m?.field!==F||m.schema!==n)?"total":"aggregate",J=useMemo(()=>gql(at(t,e$1,n,{selection:s,countMode:V,includeCount:o}).query),[t,e$1,n,s,V,o]),$=useMemo(()=>gql(at(t,e$1,n,{selection:s,includeCount:false}).query),[t,e$1,n,s]),{schemaErrorMessage:R,setSchemaErrorMessage:k}=e(),{loading:H,data:v,fetchMore:st,refetch:ot,error:Lt,networkStatus:Y}=useQuery(J,{variables:r,notifyOnNetworkStatusChange:true,fetchPolicy:l}),Ft=useRef(st),gt=useRef(ot),Ct=useRef($),Tt=useRef(Y),Mt=useRef(r);Ft.current=st,gt.current=ot,Ct.current=$,Mt.current=r;let yt=o&&d(Lt,F),Qt=V==="total"&&yt,G=yt?void 0:Lt,N=yt&&!v?.[t],qt=a$2(G),P=c(G),{isProjectDisabled:dn,isProjectReadOnly:fn}=(()=>{if(qt?.statusCode===403){let I=b$1(qt.bodyText);if(I&&typeof I.code=="string"){if(I.code==="PROJECT_PAUSED")return {isProjectDisabled:true,isProjectReadOnly:false};if(I.code==="READ_ONLY_MODE")return {isProjectDisabled:false,isProjectReadOnly:true}}return {isProjectDisabled:true,isProjectReadOnly:false}}return {isProjectDisabled:false,isProjectReadOnly:false}})();useEffect(()=>{Qt&&h({field:F,schema:n});},[n,Qt,F]);let pn=useCallback(I=>{if(A.current||g.current)return;A.current=true,d$1(true);let{limit:Q}=I.variables,q=y.current;Ft.current({...I,query:Ct.current,variables:{...Mt.current,...I.variables,offset:q,limit:Q}}).then(({data:X})=>{let M=it({data:X,entityNamePlural:t,isForm:i,schema:n,scope:e$1}),j=M.results.length;y.current=q+(j===0?0:Math.min(j,Q)),u(T=>{let W=uniqBy(prop("_id"),[...T.results,...M.results]);return W.length===T.results.length?{count:T.results.length,results:T.results}:{count:M.count||T.count,results:W}});}).catch(X=>{console.error("Error fetching more data:",X);}).finally(()=>{A.current=false,d$1(false);});},[t,i,n,e$1]),gn=useCallback(I=>{if(g.current)return Promise.resolve();let Q=I?.preserve===true;return g.current=true,A.current=false,d$1(false),Q||(E.current=null,C.current=null,y.current=0,p(true),u({count:0,results:[]})),gt.current().then(({data:q})=>{let X=JSON.stringify({entityNamePlural:t,scope:e$1,selection:s,includeCount:o,variables:r}),M=it({data:q,entityNamePlural:t,isForm:i,schema:n,scope:e$1});E.current=X,C.current=null,y.current=pt(r)+M.results.length,u(M);}).catch(q=>{console.error("Error reloading data:",q);}).finally(()=>{g.current=false,p(false);})},[t,i,n,e$1,s,o,r]);return useEffect(()=>{if(P){k(P);return}v&&R&&!G&&k(null);},[v,G,R,P,k]),useEffect(()=>{if(G||P||N)return;let I=JSON.stringify({entityNamePlural:t,scope:e$1,selection:s,includeCount:o,variables:r});if(E.current===I)return;if(H&&C.current!==I){C.current=I,y.current=0,u({count:0,results:[]});return}if(H)return;let Q=it({data:v,entityNamePlural:t,isForm:i,schema:n,scope:e$1});E.current=I,C.current=null,y.current=pt(r)+Q.results.length,u(Q);},[v,G,t,i,H,N,n,P,e$1,s,o,r]),useEffect(()=>{let I=Tt.current;if(Tt.current=Y,G||P||g.current||N||I!==NetworkStatus.refetch||Y!==NetworkStatus.ready||!v)return;let Q=JSON.stringify({entityNamePlural:t,scope:e$1,selection:s,includeCount:o,variables:r}),q=it({data:v,entityNamePlural:t,isForm:i,schema:n,scope:e$1});E.current=Q,C.current=null,y.current=pt(r)+q.results.length,u(q);},[v,G,t,i,N,Y,n,P,e$1,s,o,r]),useEffect(()=>{if(i)return;let I=`Get${x(t)}`,Q=sn(M=>{if(!(!M.has(I)||A.current||g.current))return gt.current().then(({data:j})=>{let T=JSON.stringify({entityNamePlural:t,scope:e$1,selection:s,includeCount:o,variables:r}),W=it({data:j,entityNamePlural:t,isForm:i,schema:n,scope:e$1});E.current=T,C.current=null,y.current=pt(r)+W.results.length,u(W);}).catch(j=>{console.error("Error soft-refreshing entity list:",j);})}),q=on((M,j)=>{M===I&&u(T=>{let W=T.results.filter(kt=>{let vt=typeof kt._id=="string"?kt._id:void 0;return !vt||!j.has(vt)}),xt=T.results.length-W.length;return xt===0?T:{count:Math.max(0,T.count-xt),results:W}});}),X=un((M,j)=>{M===I&&u(T=>zn(T,j,r?.sort));});return ()=>{Q(),q(),X();}},[t,i,n,e$1,s,o,r]),{isLoading:H&&Y!==NetworkStatus.refetch||f||N,isLoadingMore:a,fetchMore:pn,reload:gn,count:c$1.count,data:c$1.results,isProjectDisabled:dn,isProjectReadOnly:fn,schemaErrorMessage:R}}function pt(t){let n=t?.offset;return typeof n=="number"&&Number.isFinite(n)?n:0}function it(t){let n=t.entityNamePlural;return t.data?.[n]?t.isForm?Yt(t.entityNamePlural,t.scope,t.data,t.schema):Ht(t.entityNamePlural,t.scope,t.data,t.schema):{count:0,results:[]}}function zn(t,n,e){let r=new Map(n.map(o=>[o._id,o])),i=false,s=t.results.map(o=>{let l=typeof o._id=="string"?o._id:void 0;if(!l)return o;let c=r.get(l);return c?(i=true,{...o,...c.attributes}):o});return i?{count:t.count,results:Gn(s,e)}:t}function Gn(t,n){if(!Array.isArray(n)||n.length===0)return t;let[e]=n;if(!e||typeof e!="object")return t;let[r]=Object.entries(e),[i,s]=r??[];if(!i||s!=="ASC"&&s!=="DESC")return t;let o=s==="DESC"?-1:1;return [...t].sort((l,c)=>{let u=l[i],a=c[i],d=typeof u=="string"?u:"",f=typeof a=="string"?a:"";return d.localeCompare(f)*o})}export{Wt as a,Jt as b,En as c,Zn as d,at as e,Ht as f,Hn as g,Yn as h,Nn as i,te as j,ne as k,ee as l,D as m,re as n,ue as o,le as p,ce as q,Dn as r,Ae as s};//# sourceMappingURL=chunk-BQWW2Q6B.js.map
|
|
378
|
+
//# sourceMappingURL=chunk-BQWW2Q6B.js.map
|