@flexkit/studio 0.2.20 → 0.2.21

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.
Files changed (101) hide show
  1. package/dist/activity-nav-button-7RLCHOFV.js +2 -0
  2. package/dist/{activity-nav-button-V5DFHADL.js.map → activity-nav-button-7RLCHOFV.js.map} +1 -1
  3. package/dist/chat-page-QKSMDM7A.js +4 -0
  4. package/dist/chat-page-QKSMDM7A.js.map +1 -0
  5. package/dist/chunk-3TAYSYYW.js +7 -0
  6. package/dist/{chunk-NYSQU73M.js.map → chunk-3TAYSYYW.js.map} +1 -1
  7. package/dist/{chunk-ME55YNBF.js → chunk-4PUMSUJL.js} +2 -2
  8. package/dist/{chunk-ME55YNBF.js.map → chunk-4PUMSUJL.js.map} +1 -1
  9. package/dist/{chunk-BMX4URYN.js → chunk-7ERLYAPR.js} +2 -2
  10. package/dist/{chunk-BMX4URYN.js.map → chunk-7ERLYAPR.js.map} +1 -1
  11. package/dist/chunk-7KLXWCDS.js +3 -0
  12. package/dist/chunk-7KLXWCDS.js.map +1 -0
  13. package/dist/{chunk-2P2QV3K6.js → chunk-7KRDPQXX.js} +2 -2
  14. package/dist/{chunk-2P2QV3K6.js.map → chunk-7KRDPQXX.js.map} +1 -1
  15. package/dist/{chunk-F2DT6NRK.js → chunk-AFLZA2R5.js} +2 -2
  16. package/dist/{chunk-F2DT6NRK.js.map → chunk-AFLZA2R5.js.map} +1 -1
  17. package/dist/chunk-AHR2EZGG.js +4 -0
  18. package/dist/{chunk-LK67JOQA.js.map → chunk-AHR2EZGG.js.map} +1 -1
  19. package/dist/chunk-BXUW6OXZ.js +2 -0
  20. package/dist/{chunk-BXN72PW2.js.map → chunk-BXUW6OXZ.js.map} +1 -1
  21. package/dist/chunk-DZS344SD.js +378 -0
  22. package/dist/chunk-DZS344SD.js.map +1 -0
  23. package/dist/chunk-ELOJGLAR.js +2 -0
  24. package/dist/chunk-ELOJGLAR.js.map +1 -0
  25. package/dist/chunk-HKN6BX5U.js +2 -0
  26. package/dist/chunk-HKN6BX5U.js.map +1 -0
  27. package/dist/{chunk-HLHLBMLJ.js → chunk-I4INIJFN.js} +2 -2
  28. package/dist/{chunk-HLHLBMLJ.js.map → chunk-I4INIJFN.js.map} +1 -1
  29. package/dist/{chunk-RY6PECIT.js → chunk-MJICM7YP.js} +2 -2
  30. package/dist/{chunk-RY6PECIT.js.map → chunk-MJICM7YP.js.map} +1 -1
  31. package/dist/chunk-MLHXPTBT.js +2 -0
  32. package/dist/chunk-MLHXPTBT.js.map +1 -0
  33. package/dist/{chunk-B7QMGBK5.js → chunk-PLZUH56T.js} +3 -3
  34. package/dist/{chunk-B7QMGBK5.js.map → chunk-PLZUH56T.js.map} +1 -1
  35. package/dist/{chunk-UOR437J2.js → chunk-QCVQJN5O.js} +2 -2
  36. package/dist/{chunk-UOR437J2.js.map → chunk-QCVQJN5O.js.map} +1 -1
  37. package/dist/{chunk-DHVKE36X.js → chunk-SY67F62K.js} +3 -3
  38. package/dist/{chunk-DHVKE36X.js.map → chunk-SY67F62K.js.map} +1 -1
  39. package/dist/chunk-T2DOW23R.js +3 -0
  40. package/dist/chunk-T2DOW23R.js.map +1 -0
  41. package/dist/{chunk-MKK65RQB.js → chunk-YBLY77TV.js} +5 -5
  42. package/dist/{chunk-MKK65RQB.js.map → chunk-YBLY77TV.js.map} +1 -1
  43. package/dist/{chunk-JWBER5NX.js → chunk-YJM2RPTA.js} +2 -2
  44. package/dist/{chunk-JWBER5NX.js.map → chunk-YJM2RPTA.js.map} +1 -1
  45. package/dist/{entry-XVLXKEQV.js → entry-BKWT63OH.js} +2 -2
  46. package/dist/{entry-XVLXKEQV.js.map → entry-BKWT63OH.js.map} +1 -1
  47. package/dist/index.css +21 -0
  48. package/dist/index.js +6 -6
  49. package/dist/index.js.map +1 -1
  50. package/dist/list-F2MN4VI4.js +3 -0
  51. package/dist/{list-4OJMI4CB.js.map → list-F2MN4VI4.js.map} +1 -1
  52. package/dist/list-RFIARR7J.js +2 -0
  53. package/dist/{list-RABV2F3H.js.map → list-RFIARR7J.js.map} +1 -1
  54. package/dist/{pages-7LWBCW2X.js → pages-6YG37BSV.js} +3 -3
  55. package/dist/{pages-7LWBCW2X.js.map → pages-6YG37BSV.js.map} +1 -1
  56. package/dist/plugin-pages-R5QCB5GZ.js +2 -0
  57. package/dist/{plugin-pages-PQWTH7P5.js.map → plugin-pages-R5QCB5GZ.js.map} +1 -1
  58. package/dist/record-links-BACU2DWS.js +2 -0
  59. package/dist/{record-links-BFHPBOAL.js.map → record-links-BACU2DWS.js.map} +1 -1
  60. package/dist/root-6FML7PJC.js +23 -0
  61. package/dist/{root-FTT4XDCE.js.map → root-6FML7PJC.js.map} +1 -1
  62. package/dist/{root-BS6QCYLO.js → root-FCO3MQTE.js} +3 -3
  63. package/dist/{root-BS6QCYLO.js.map → root-FCO3MQTE.js.map} +1 -1
  64. package/dist/{root-RXMRNU4M.js → root-MQ5FZRMQ.js} +2 -2
  65. package/dist/{root-RXMRNU4M.js.map → root-MQ5FZRMQ.js.map} +1 -1
  66. package/dist/root-MTJAYVPT.js +14 -0
  67. package/dist/root-MTJAYVPT.js.map +1 -0
  68. package/dist/{root-COI626G2.js → root-U4QMDA3Q.js} +2 -2
  69. package/dist/{root-COI626G2.js.map → root-U4QMDA3Q.js.map} +1 -1
  70. package/dist/root-UCQDMHDV.js +2 -0
  71. package/dist/{root-PDSTTPHO.js.map → root-UCQDMHDV.js.map} +1 -1
  72. package/dist/{search-VPS2UHPQ.js → search-7DVZZIZ6.js} +2 -2
  73. package/dist/{search-VPS2UHPQ.js.map → search-7DVZZIZ6.js.map} +1 -1
  74. package/dist/skills-pages-EPIBHZVO.js +2 -0
  75. package/dist/skills-pages-EPIBHZVO.js.map +1 -0
  76. package/dist/source-F6B2UBWX.js +2 -0
  77. package/dist/{source-MNHZQD4T.js.map → source-F6B2UBWX.js.map} +1 -1
  78. package/package.json +6 -3
  79. package/dist/activity-nav-button-V5DFHADL.js +0 -2
  80. package/dist/chat-page-4G4XQ26P.js +0 -4
  81. package/dist/chat-page-4G4XQ26P.js.map +0 -1
  82. package/dist/chunk-445XKMAG.js +0 -379
  83. package/dist/chunk-445XKMAG.js.map +0 -1
  84. package/dist/chunk-A7XHA2P6.js +0 -3
  85. package/dist/chunk-A7XHA2P6.js.map +0 -1
  86. package/dist/chunk-BMO7JFAX.js +0 -2
  87. package/dist/chunk-BMO7JFAX.js.map +0 -1
  88. package/dist/chunk-BXN72PW2.js +0 -2
  89. package/dist/chunk-LK67JOQA.js +0 -4
  90. package/dist/chunk-NYSQU73M.js +0 -7
  91. package/dist/list-4OJMI4CB.js +0 -3
  92. package/dist/list-RABV2F3H.js +0 -2
  93. package/dist/plugin-pages-PQWTH7P5.js +0 -2
  94. package/dist/record-links-BFHPBOAL.js +0 -2
  95. package/dist/root-FTT4XDCE.js +0 -23
  96. package/dist/root-PDSTTPHO.js +0 -2
  97. package/dist/root-TZYOIXVG.js +0 -2
  98. package/dist/root-TZYOIXVG.js.map +0 -1
  99. package/dist/skills-pages-G6JK7KKQ.js +0 -2
  100. package/dist/skills-pages-G6JK7KKQ.js.map +0 -1
  101. package/dist/source-MNHZQD4T.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-T2DOW23R.js';import {a}from'./chunk-YDVO6XWD.js';import {a as a$1}from'./chunk-ERDARDGB.js';import {b,c as c$1}from'./chunk-PLZUH56T.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 Gt=25,yn=3,Wt=3,mn=["id","string"],hn=["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`,$n=`_id
17
+ path
18
+ url`;function N(t){return t?a(t)==="relationship"&&t.relationship?.mode==="multiple"&&t.relationship.entity==="_asset":false}function Et(t,n){return !t||!N(t)?false:n?.name!==c$1.name||t.name!=="assets"}function ct(t){return t?.dataType==="asset"||t?.inputType==="asset"}function Kt(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 An(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 En(t,n){return n?$n:t?$t:At}function Jt(t,n=true,e=true,r=Gt,i=false){let s=n?` properties {
19
+ sortOrder
20
+ }
21
+ `:"",o=En(e,i),c=n?`(first: ${r}, sort: [{ edge: { sortOrder: ASC } }])`:`(first: ${r})`;return ` ${t}Connection${c} {
22
+ aggregate {
23
+ count {
24
+ nodes
25
+ }
26
+ }
27
+ edges {
28
+ `+s+` node {
29
+ ${o}
30
+ }
31
+ }
32
+ }
33
+ `}function Pt(t){return t?.aggregate?.count?.nodes??0}function Xt(t,n){let e=t[`${n}Total`];return typeof e=="number"?e:Pt(t[`${n}Connection`])}function bt(t,n=""){return ` ${t}Connection${n} {
34
+ aggregate {
35
+ count {
36
+ nodes
37
+ }
38
+ }
39
+ }
40
+ `}function bn(t,n,e){return n?e==="total"?` ${t}Total
41
+ `:bt(t,"(where: $where)"):""}function Sn(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),c=find(propEq(s,"name"))(o?.attributes??[]),u=c&&a(c)==="local"?`{
56
+ _id
57
+ default
58
+ ${i}}
59
+ `:"";return t.relationship?.mode==="single"?` ${t.name} {
60
+ ${s} ${u}}
61
+ `:` ${t.name} (limit: 3, offset: 0) {
62
+ ${s} ${u}}
63
+ `}return ` ${t.name}
64
+ `}function _n(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),c=find(propEq(i.relationship?.field,"name"))(o?.attributes??[]),u=a(c)==="local"?`{
76
+ _id
77
+ default
78
+ ${s}}
79
+ `:"";if(i.relationship?.mode==="single")return `${r}
80
+ ${i.name} {
81
+ ${i.relationship.field} ${u}}
82
+ `;if(i.relationship?.field)return `${r}
83
+ ${i.name} (limit: ${Wt}, offset: 0) {
84
+ ${i.relationship.field} ${u}}
85
+ `}return `${r}
86
+ ${i.name}
87
+ `},"")??""}function Rn(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 Xn(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,c=r?.countMode??"aggregate",u="(where: $where, limit: $limit, offset: $offset, sort: $sort)",l=U(e,t),a$2=l?.name??t,d=a$1(l),f=i==="display"?d?[d]:[]:l?.attributes??[],g=Rn(f),h=`$where: ${a$2}Where, $limit: Int, $offset: Int, $sort: [${a$2}Sort!]`,y=r?.operationName??`Get${v(t)}`;if(!l)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(g[$]):true).join(`
88
+ `),p=tt(f).filter($=>s!=="list"||i==="display"||mt(g[$])),m=L(["local"],f).filter($=>s!=="list"?true:i==="display"||mt(g[$])),E=m.reduce(($,R)=>`${$}
89
+ ${R} {
90
+ _id
91
+ default
92
+ }
93
+ `,""),T=m.reduce(($,R)=>`${$}
94
+ ${R} {
95
+ _id
96
+ default
97
+ ${n}
98
+ }
99
+ `,""),F=n==="default"?E:T,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 Q=p.reduce(($,R)=>`${$}
110
+ ${R} {
111
+ ${b}
112
+ }
113
+ `,""),z=f.filter($=>a($)==="relationship").reduce(($,R)=>{if(s==="list"&&i!=="display"&&R.hidden===true)return $;if(N(R))return `${$}
114
+ ${Jt(R.name,Et(R,l),s!=="list",s==="list"?yn:Gt,s==="list")}`;let q=find(propEq(R.relationship?.entity,"name"))(e);if(s==="list"){let it=a$1(q),st=Sn(it,n,e,true),ot=R.relationship?.mode==="single"?1:3;return `${$}
115
+ ${R.name} (limit: ${ot}, offset: 0) {
116
+ _id
117
+ ${st} }
118
+ `}let j=_n(q,n,e);return `${bt(R.name).trim()}${$}
119
+ ${R.name} (limit: 25, offset: 0) { _id ${j}}
120
+ `},"");return {queryEntityName:t,query:`query ${y}(${h}) {
121
+ `+bn(t,o,c)+` ${t}${u} {
122
+ _id
123
+ _updatedAt
124
+ ${A} ${F} ${Q} ${z}}
125
+ }
126
+ `}}function Zt(t,n,e,r){let s=U(r,t)?.attributes??[];if(s.length===0)return {count:0,results:[]};let o=Xt(e,t),c=e[t],u=(a$1,d)=>{let f=d.name;return a$1.slice(0,3).map(g=>{if(a(d)!=="local")return g[f];let h=B(g[f]);return h?.[n]??h?.default}).join(", ")},l=c.map(a$2=>{let{_id:d}=a$2,f=typeof a$2._updatedAt=="string"?a$2._updatedAt:"",g=L("global",s).filter(p=>p!=="_updatedAt").reduce((p,m)=>({...p,[m]:a$2[m]}),{}),h=L("local",s).reduce((p,m)=>{let E=B(a$2[m]);return {...p,[m]:E?.[n]?E[n]:E?.default}},{}),y=tt(s).reduce((p,m)=>({...p,[m]:B(a$2[m])}),{}),A=L(["relationship"],s).reduce((p,m)=>{let E=find(propEq(m,"name"))(s),T=E.relationship?.entity??"",F=find(propEq(T,"name"))(r),b=a$1(F),Q=a$2[m];if(N(E)){let q=Kt(a$2[`${m}Connection`]);return {...p,[m]:q}}if(!b)throw new Error(`There is an error in the schema for the relationship attribute "${m}"`);let J=b.name,z=a(b);if(E.relationship?.mode==="multiple"){let q=Array.isArray(Q)?Q:[];return {...p,[m]:u(q,b)}}let $=B(Q);if(z==="global")return {...p,[m]:$?.[J]};let R=B($?.[J]);return {...p,[m]:R?.[n]??R?.default}},{});return {_id:d,...g,...h,...y,...A,_updatedAt:f}});return {count:o,results:l}}function Ht(t,n,e,r){let s=U(r,t)?.attributes??[];if(s.length===0)return {count:0,results:[]};let o=Xt(e,t),u=e[t].map(l=>{let a$1=L("global",s).reduce((h,y)=>({...h,[y]:{value:l[y],disabled:false,scope:"default",_id:""}}),{}),d=L("local",s).reduce((h,y)=>{let A=find(propEq(y,"name"))(s),p=B(l[y]);return {...h,[y]:{value:p?In(p,n):null,disabled:!!(p&&p[n]===null&&a(A)==="local"&&n!=="default"),scope:n,_id:p?p._id:null}}},{}),f=tt(s).reduce((h,y)=>({...h,[y]:{value:B(l[y]),disabled:false,scope:"default",_id:""}}),{}),g=L(["relationship"],s).reduce((h,y)=>{let A=find(propEq(y,"name"))(s),p=l[y],m=A.relationship?.mode==="single"?B(p):p,E=m?._id,T=Pt(l[`${y}Connection`]);if(N(A)){let F=Kt(l[`${y}Connection`]);return {...h,[y]:{count:T,_id:E,knownAssetSortOrders:An(F),value:F,disabled:false,scope:n}}}return {...h,[y]:{count:T,_id:E,value:m,disabled:false,scope:n}}},{});return {...a$1,...d,...f,...g}});return {count:o,results:u}}function In(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 Zn(t,n,e,r,i,s,o){let c=U(r,t),u=c?.name??t,l=c?.attributes??[],a=nt(t);if(l.length===0)return "";let d=Yt(l,s),f=Nt(l,d),g=Ln(n,l,d,e),h=wn(l,i,d),y=Fn(l,i,d),A=t,p=o?.responseFields??nn(r,t,e);return `mutation ${`Update${v(t)}`}($where: ${u}Where) {
127
+ update${a}(
128
+ where: $where
129
+ update: {${f}${g}${h}${y}
130
+ }
131
+ ) {
132
+ ${A} {
133
+ _id
134
+ ${p} }
135
+ }
136
+ }
137
+ `}function Yt(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 tt(t){return t.filter(ct).map(e=>e.name)}function Nt(t,n,e="update"){let r=pick(L("global",t),n);return toPairs(r).reduce((s,[o,c])=>{let u=find(propEq(o,"name"))(t),l=Array.isArray(c?.value)?null:c?.value??null,a=St(u.dataType,l);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 wn(t,n,e){let r=pick(tt(t),e);return toPairs(r).reduce((o,[c,u])=>{let l=ht(u.value),a=ht(n[c]?.value);if(l===a)return o;let d=a?` {
140
+ disconnect: [{
141
+ where: {
142
+ node: {
143
+ _id: { eq: ${O(a)} }
144
+ }
145
+ }
146
+ }]
147
+ }
148
+ `:"",f=l?` {
149
+ connect: [{
150
+ where: {
151
+ node: {
152
+ _id: { eq: ${O(l)} }
153
+ }
154
+ }
155
+ }]
156
+ }
157
+ `:"";return `${o}
158
+ ${c}: [
159
+ ${d}${f} ]`},"")}function On(t,n){let e=pick(tt(t),n);return toPairs(e).reduce((s,[o,c])=>{let u=ht(c.value);return u?`${s}
160
+ ${o}: {
161
+ connect: [{
162
+ where: {
163
+ node: {
164
+ _id: { eq: ${O(u)} }
165
+ }
166
+ }
167
+ }]
168
+ }`:s},"")}function Ln(t,n,e,r){let i=pick(L("local",n),e);return toPairs(i).reduce((c,[u,l])=>{let a=find(propEq(u,"name"))(n),{dataType:d}=a,f=l.disabled||Array.isArray(l.value)?"null":St(d,l.value);return l._id?`${c}
169
+ ${u}: [{
170
+ update: {
171
+ node: {
172
+ ${r}: { set: ${f} }
173
+ }
174
+ }
175
+ }]`:l.disabled||Array.isArray(l.value)||l.value===void 0||l.value===null||l.value===""||f===null||f===""?c:`${c}
176
+ ${u}: [{
177
+ create: {
178
+ node: {
179
+ _id: ${O(`${t}:${u}`)}
180
+ _type: "${d}"
181
+ ${r}: ${f}
182
+ }
183
+ }
184
+ }]`},"")}function Fn(t,n,e){let r=pick(L("relationship",t),e);return toPairs(r).reduce((o,[c,u])=>{let l=find(propEq(c,"name"))(t),{inputType:a,relationship:d}=l;if(a==="relationship"&&d?.mode==="single"){let f=n[c]._id??"",g=u._id??"";if(f===g)return o;let h=f?` {
185
+ disconnect: [{
186
+ where: {
187
+ node: {
188
+ _id: { eq: ${O(f)} }
189
+ }
190
+ }
191
+ }]
192
+ }
193
+ `:"",y=g?` {
194
+ connect: [{
195
+ where: {
196
+ node: {
197
+ _id: { eq: ${O(g)} }
198
+ }
199
+ }
200
+ }]
201
+ }
202
+ `:"";return `${o}
203
+ ${c}: [
204
+ ${h}${y} ]`}if(a==="relationship"&&d?.mode==="multiple"){if(d.entity==="_asset")return `${o}${Cn(c,n[c],u)}`;let f=uniq(u.relationships?.disconnect??[]).filter(Boolean),h=(u.relationships?.connect??[]).map(p=>O(p._id)).join(", "),y=f.length?` {
205
+ disconnect: [
206
+ ${f.map(p=>` {
207
+ where: {
208
+ node: {
209
+ _id: { eq: ${O(p)} }
210
+ }
211
+ }
212
+ }
213
+ `).join("")} ]
214
+ }
215
+ `:"",A=h?` {
216
+ connect: [{
217
+ where: {
218
+ node: {
219
+ _id: { in: [${h}] }
220
+ }
221
+ }
222
+ }]
223
+ }
224
+ `:"";return !y&&!A?o:`${o}
225
+ ${c}: [
226
+ ${y}${A} ]`}return `${o}
227
+ `},"")}function Cn(t,n,e){let i=(e.relationships?.connect??[]).map((g,h)=>({...g,sortOrder:g.sortOrder??h})),s=i.map(g=>g._id),o={...Tn(n),...n?.knownAssetSortOrders??{},...e.knownAssetSortOrders??{}},c=uniq(e.relationships?.disconnect??[]).filter(g=>g&&!s.includes(g)),u=i.filter(g=>o[g._id]===void 0),l=i.filter(g=>{let h=o[g._id];return h!==void 0&&h!==g.sortOrder}),a=Mn(c),d=Qn(u),f=qn(l);return !a&&!d&&!f?"":`
228
+ ${t}: [
229
+ ${a}${d}${f} ]`}function Tn(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 Mn(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
+ ${tn(t)} ]
239
+ }
240
+ `}function tn(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 qn(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 hn.includes(t)?n?.toString()?O(n.toString()):null:mn.includes(t)?n==null?null:O(n.toString()):n==null||n===""?null:n.toString()}function O(t){return JSON.stringify(t)}function nn(t,n,e){let r=U(t,n),i=r?.attributes??[],s=L("global",i),o=L("local",i),c=L("relationship",i),u=s.reduce((l,a)=>`${l}${a}
251
+ `,"");return u+=o.reduce((l,a)=>`${l} ${a} {
252
+ _id
253
+ ${e}
254
+ }
255
+ `,""),u+=c.reduce((l,a$1)=>{let d=find(propEq(a$1,"name"))(i),f=d?.relationship?.mode??"single";if(N(d))return `${l}${Jt(a$1,Et(d,r))}`;let g=d?.relationship?.entity??"",y=find(propEq(g,"name"))(t)?.attributes??[],A=d?.relationship?.field??"[invalid_relationship_field_name_in_schema]",p=find(propEq(A,"name"))(y),m=a(p),E="";if(f==="single"&&(m==="global"&&(E=` ${a$1} {
256
+ _id
257
+ ${A}
258
+ }
259
+ `),m==="local"&&(E=` ${a$1} {
260
+ _id
261
+ ${A} {
262
+ _id
263
+ default
264
+ ${e}
265
+ }
266
+ }
267
+ `)),f==="multiple"&&y.length){let T=y.reduce((F,b)=>{if(a(b)==="local")return `${F} ${b.name} {
268
+ _id
269
+ default
270
+ ${e}
271
+ }
272
+ `;if(a(b)==="relationship"){let Q=e==="default"?"":`${e}
273
+ `,J=find(propEq(b.relationship?.entity,"name"))(t),z=find(propEq(b.relationship?.field,"name"))(J?.attributes??[]),$=a(z)==="local"?`{
274
+ _id
275
+ default
276
+ ${Q}}
277
+ `:"";if(b.relationship?.mode==="single")return `${F} ${b.name} {
278
+ ${b.relationship.field} ${$}}
279
+ `;if(b.relationship?.field)return `${F} ${b.name} (limit: ${Wt}, 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
+ ${T} }
287
+ `;}return `${l}${E}`},""),u}function Hn(t,n,e){let r=typeof e=="string"?[e]:[...e],i=find(propEq(t,"name"))(n),s=i?.attributes??[],o=nt(i?.plural??""),c=xn(s,r),u=`Delete${v(i?.plural??t)}`;return t==="_asset"?`mutation ${u}($where: ${t}Where) {
288
+ delete_assets(
289
+ where: $where
290
+ ) {
291
+ nodesDeleted
292
+ relationshipsDeleted
293
+ }
294
+ }
295
+ `:`mutation ${u}($where: ${t}Where) {
296
+ delete${o}(
297
+ where: $where
298
+ ${c?` delete: {
299
+ ${c}
300
+ }
301
+ `:""} ) {
302
+ nodesDeleted
303
+ relationshipsDeleted
304
+ }
305
+ }
306
+ `}function Yn(t){let n=typeof t=="string"?[t]:[...t];return n.length===1?{_id:{eq:n[0]}}:{_id:{in:n}}}function xn(t,n){return L("local",t).reduce((i,s)=>{let o=n.map(u=>O(`${u}:${s}`)).join(", "),c=n.length===1?`_id: { eq: ${o} }`:`_id: { in: [${o}] }`;return `${i}
307
+ ${s}: [{
308
+ where: {
309
+ node: {
310
+ ${c}
311
+ }
312
+ }
313
+ }]`},"")}function Nn(t,n,e,r,i){let s=U(n,t),o=s?.attributes??[],c=nt(s?.plural??"");if(o.length===0)return "";let u=Yt(o,e),l=Nt(o,u,"create"),a=kn(o,u,"default",r),d=On(o,u),f=vn(o,u),g=t,h=nn(n,g,"default");return `mutation ${`Create${v(t)}`} {
314
+ create${c}(
315
+ input: [{
316
+ _id: ${O(r)} ${l} ${a}
317
+ ${d}
318
+ ${f}
319
+ }]
320
+ ) {
321
+ ${g} {
322
+ _id
323
+ ${h} }
324
+ }
325
+ }
326
+ `}function kn(t,n,e,r){let i=pick(L("local",t),n);return toPairs(i).reduce((c,[u,l])=>{if(l?.value===void 0||l.value===null||l.value==="")return c;let a=find(propEq(u,"name"))(t),d=Array.isArray(l.value)?"null":St(a.dataType,l.value);return `${c}
327
+ ${u}: {
328
+ create: [{
329
+ node: {
330
+ _id: ${O(`${r}:${u}`)}
331
+ _type: "${a.dataType}"
332
+ ${e}: ${d}
333
+ }
334
+ }]
335
+ }`},"")}function vn(t,n){let e=pick(L("relationship",t),n);return toPairs(e).reduce((s,[o,c])=>{let u=find(propEq(o,"name"))(t),{inputType:l,relationship:a}=u;if(l==="relationship"&&a?.mode==="single"){if(!c._id)return s;let g=`connect: [{
336
+ where: {
337
+ node: {
338
+ _id: { eq: ${O(c._id)} }
339
+ }
340
+ }
341
+ }]
342
+ `;return `${s}
343
+ ${o}: {
344
+ ${g} }`}let d=l==="relationship"&&a?.mode==="multiple",f=Array.isArray(c.relationships?.connect)&&c.relationships.connect.length>0;if(d&&f){let g=c.relationships?.connect??[];if(a?.entity==="_asset"){let A=tn(g.map((p,m)=>({...p,sortOrder:p.sortOrder??m})));return `${s}
345
+ ${o}: {
346
+ connect: [
347
+ ${A} ]
348
+ }`}let h=g.map(A=>O(A._id)).join(", "),y=h?`connect: {
349
+ where: {
350
+ node: {
351
+ _id: { in: [${h}] }
352
+ }
353
+ }
354
+ }
355
+ `:"";return `${s}
356
+ ${o}: {
357
+ ${y} }`}return `${s}
358
+ `},"")}function te({relatedEntityName:t,scope:n,schema:e}){let i=find(propEq(t,"name"))(e)?.plural??"";return i?at(i,n,e,{selection:"list",operationName:`GetRelated${v(i)}`}):{queryEntityName:"",query:""}}function ne({attributeName:t,entityName:n,entityNamePlural:e,schema:r}){let i=U(r,e),s=find(propEq(t,"name"))(i?.attributes??[]),o=Et(s,i),c=o?` properties {
359
+ sortOrder
360
+ }
361
+ `:"",u=o?"(first: $first, sort: [{ edge: { sortOrder: ASC } }])":"(first: $first)",l=`Get${v(n)}AssetConnection`;return {queryEntityName:e,query:`query ${l}($where: ${n}Where, $first: Int) {
362
+ ${e}(where: $where) {
363
+ ${t}Connection${u} {
364
+ aggregate {
365
+ count {
366
+ nodes
367
+ }
368
+ }
369
+ edges {
370
+ `+c+` node {
371
+ ${$t}
372
+ }
373
+ }
374
+ }
375
+ }
376
+ }
377
+ `}}var nt=t=>t.charAt(0).toUpperCase()+t.slice(1);function v(t){let n=t.split(/[^0-9A-Za-z]+/).filter(Boolean).map(nt).join("");return n?/^[A-Za-z_]/.test(n)?n:`Entity${n}`:"Entity"}function U(t,n){return n==="_assets"?b:find(propEq(n,"plural"))(t)}function ee(t,n,e){if(!t||typeof t!="object")return {};let r=U(e,n);if(!r)return {};let i=`update${nt(n)}`,s=t[i];if(!s||typeof s!="object")return {};let o=s[n],c=Array.isArray(o)?o[0]:void 0;return !c||typeof c!="object"?{}:r.attributes.reduce((u,l)=>{if(a(l)!=="local")return u;let d=B(c[l.name])?._id;return typeof d!="string"||d.length===0?u:{...u,[l.name]:d}},{})}var dt=null,_t=new Set,en=[],Rt=new Set,It=new Set,wt=new Set;function oe(t,n){if(t==="_asset"||t==="_assets")return `Get${v(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${v(i)}`}function rn(t){return Rt.add(t),()=>{Rt.delete(t);}}function sn(t){return It.add(t),()=>{It.delete(t);}}function on(t){return wt.add(t),()=>{wt.delete(t);}}function ue(t,n,e){let r=new Set(e.filter(Boolean));if(r.size>0)for(let i of It)i(n,r);return jn(t,n)}function le(t,n){let e=n.filter(r=>!!r._id);if(e.length!==0)for(let r of wt)r(t,e);}function jn(t,n){return _t.add(n),new Promise((e,r)=>{en.push({resolve:e,reject:r}),dt&&clearTimeout(dt),dt=setTimeout(()=>{let i=new Set(_t),s=en.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:c}of s)c(o);});},50);})}function $e({entityNamePlural:t,schema:n,scope:e$1,variables:r,isForm:i,selection:s="full",includeCount:o=true}){let[c$1,u]=useState({count:0,results:[]}),[l,a]=useState(false),[d$1,f]=useState(false),[g,h]=useState(null),y=useRef(false),A=useRef(false),p=useRef(0),m=useRef(null),E=useRef(null),T=`${t}Total`,F=U(n,t),Q=r?.where===void 0&&(F?.spaces?.length??0)===0&&(g?.field!==T||g.schema!==n)?"total":"aggregate",J=useMemo(()=>gql(at(t,e$1,n,{selection:s,countMode:Q,includeCount:o}).query),[t,e$1,n,s,Q,o]),z=useMemo(()=>gql(at(t,e$1,n,{selection:s,includeCount:false}).query),[t,e$1,n,s]),{schemaErrorMessage:$,setSchemaErrorMessage:R}=e(),{loading:q,data:j,fetchMore:it,refetch:st,error:ot,networkStatus:H}=useQuery(J,{variables:r,notifyOnNetworkStatusChange:true}),Lt=useRef(it),gt=useRef(st),Ft=useRef(z),Ct=useRef(H),Tt=useRef(r);Lt.current=it,gt.current=st,Ft.current=z,Tt.current=r;let yt=o&&d(ot,T),Mt=Q==="total"&&yt,G=yt?void 0:ot,Y=yt&&!j?.[t],Qt=a$2(G),P=c(G),{isProjectDisabled:an,isProjectReadOnly:dn}=(()=>{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(()=>{Mt&&h({field:T,schema:n});},[n,Mt,T]);let fn=useCallback(I=>{if(y.current||A.current)return;y.current=true,a(true);let{limit:x}=I.variables,k=p.current;Lt.current({...I,query:Ft.current,variables:{...Tt.current,...I.variables,offset:k,limit:x}}).then(({data:X})=>{let M=rt({data:X,entityNamePlural:t,isForm:i,schema:n,scope:e$1}),D=M.results.length;p.current=k+(D===0?0:Math.min(D,x)),u(C=>{let W=uniqBy(prop("_id"),[...C.results,...M.results]);return W.length===C.results.length?{count:C.results.length,results:C.results}:{count:M.count||C.count,results:W}});}).catch(X=>{console.error("Error fetching more data:",X);}).finally(()=>{y.current=false,a(false);});},[t,i,n,e$1]),pn=useCallback(I=>{if(A.current)return Promise.resolve();let x=I?.preserve===true;return A.current=true,y.current=false,a(false),x||(m.current=null,E.current=null,p.current=0,f(true),u({count:0,results:[]})),gt.current().then(({data:k})=>{let X=JSON.stringify({entityNamePlural:t,scope:e$1,selection:s,includeCount:o,variables:r}),M=rt({data:k,entityNamePlural:t,isForm:i,schema:n,scope:e$1});m.current=X,E.current=null,p.current=pt(r)+M.results.length,u(M);}).catch(k=>{console.error("Error reloading data:",k);}).finally(()=>{A.current=false,f(false);})},[t,i,n,e$1,s,o,r]);return useEffect(()=>{if(P){R(P);return}j&&$&&!G&&R(null);},[j,G,$,P,R]),useEffect(()=>{if(G||P||Y)return;let I=JSON.stringify({entityNamePlural:t,scope:e$1,selection:s,includeCount:o,variables:r});if(m.current===I)return;if(q&&E.current!==I){E.current=I,p.current=0,u({count:0,results:[]});return}if(q)return;let x=rt({data:j,entityNamePlural:t,isForm:i,schema:n,scope:e$1});m.current=I,E.current=null,p.current=pt(r)+x.results.length,u(x);},[j,G,t,i,q,Y,n,P,e$1,s,o,r]),useEffect(()=>{let I=Ct.current;if(Ct.current=H,G||P||A.current||Y||I!==NetworkStatus.refetch||H!==NetworkStatus.ready||!j)return;let x=JSON.stringify({entityNamePlural:t,scope:e$1,selection:s,includeCount:o,variables:r}),k=rt({data:j,entityNamePlural:t,isForm:i,schema:n,scope:e$1});m.current=x,E.current=null,p.current=pt(r)+k.results.length,u(k);},[j,G,t,i,Y,H,n,P,e$1,s,o,r]),useEffect(()=>{if(i)return;let I=`Get${v(t)}`,x=rn(M=>{if(!(!M.has(I)||y.current||A.current))return gt.current().then(({data:D})=>{let C=JSON.stringify({entityNamePlural:t,scope:e$1,selection:s,includeCount:o,variables:r}),W=rt({data:D,entityNamePlural:t,isForm:i,schema:n,scope:e$1});m.current=C,E.current=null,p.current=pt(r)+W.results.length,u(W);}).catch(D=>{console.error("Error soft-refreshing entity list:",D);})}),k=sn((M,D)=>{M===I&&u(C=>{let W=C.results.filter(xt=>{let kt=typeof xt._id=="string"?xt._id:void 0;return !kt||!D.has(kt)}),qt=C.results.length-W.length;return qt===0?C:{count:Math.max(0,C.count-qt),results:W}});}),X=on((M,D)=>{M===I&&u(C=>Bn(C,D,r?.sort));});return ()=>{x(),k(),X();}},[t,i,n,e$1,s,o,r]),{isLoading:q&&H!==NetworkStatus.refetch||d$1||Y,isLoadingMore:l,fetchMore:fn,reload:pn,count:c$1.count,data:c$1.results,isProjectDisabled:an,isProjectReadOnly:dn,schemaErrorMessage:$}}function pt(t){let n=t?.offset;return typeof n=="number"&&Number.isFinite(n)?n:0}function rt(t){let n=t.entityNamePlural;return t.data?.[n]?t.isForm?Ht(t.entityNamePlural,t.scope,t.data,t.schema):Zt(t.entityNamePlural,t.scope,t.data,t.schema):{count:0,results:[]}}function Bn(t,n,e){let r=new Map(n.map(o=>[o._id,o])),i=false,s=t.results.map(o=>{let c=typeof o._id=="string"?o._id:void 0;if(!c)return o;let u=r.get(c);return u?(i=true,{...o,...u.attributes}):o});return i?{count:t.count,results:zn(s,e)}:t}function zn(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((c,u)=>{let l=c[i],a=u[i],d=typeof l=="string"?l:"",f=typeof a=="string"?a:"";return d.localeCompare(f)*o})}export{Gt as a,Kt as b,An as c,Xn as d,at as e,Zt as f,Zn as g,Hn as h,Yn as i,Nn as j,te as k,ne as l,U as m,ee as n,oe as o,ue as p,le as q,jn as r,$e as s};//# sourceMappingURL=chunk-DZS344SD.js.map
378
+ //# sourceMappingURL=chunk-DZS344SD.js.map