@theconcurrent/query
Advanced tools
Comparing version 0.0.12 to 0.0.13
@@ -1,52 +0,35 @@ | ||
(function(s,f){typeof exports=="object"&&typeof module!="undefined"?f(exports):typeof define=="function"&&define.amd?define(["exports"],f):(s=typeof globalThis!="undefined"?globalThis:s||self,f(s["@theconcurrent/query"]={}))})(this,function(s){"use strict";function f(e,t,r){return e.find(n=>n[t]===r)}function m(e,t,r="typeName"){return f(e,r,t)}function M(e,t,r){var n;const i=m(e,t);if(!i||i.kind!=="Object"||!i.fields)return;if(r.length===0)return i;const[o,...a]=r,c=(n=i.fields.find(l=>l.name===o))==null?void 0:n.typeName;if(c)return M(e,c,a)}function u(e,t,r){const n=M(e,r,(t==null?void 0:t.split("."))||[]);if(!n)throw new Error("Can't find Entity");return n}function C(e){return e.args?!e.args.find(t=>t.nonNull):!0}function E(e){var t,r;return(r=(t=e.fields)==null?void 0:t.filter(n=>n.kind==="Scalar"||n.kind==="Enum"))==null?void 0:r.filter(C).map(n=>n.name)}function N(e){return E(e).join(` | ||
`)}function T(e,t){var i;const r=(i=e==null?void 0:e.fields)==null?void 0:i.filter(o=>o.kind==="Scalar").map(o=>o.name);if(!r)throw new Error("Can't find relatedFields");const n=r.filter(o=>t.includes(o));return n.length===0?r[0]:n.join(` | ||
`)}function S(e,t){return t.map(r=>f(e,"typeName",r))}function L(e,t){var r,n;return(n=(r=e.fields)==null?void 0:r.filter(i=>i.kind===t))==null?void 0:n.filter(C)}function O(e){return`{ | ||
${e} | ||
}`}function w(e,t){return`${e} ${O(t)}`}function V(e,t,r){const n=f(e,"typeName",r.typeName);return T(n,t)}function W(e,t,r){var n;return(n=L(t,"Object"))==null?void 0:n.map(i=>{const o=V(e,r,i);return w(i.name,o)})}function q(e,t,r){return T(t,r)}function A(e,t,r){const n=q(e,t,r);return w(`... on ${t.typeName}`,n)}function G(e,t,r){var n;return(n=W(e,t,r))==null?void 0:n.join(` | ||
`)}function I(e,t,r){var n;return(n=L(t,"Union"))==null?void 0:n.map(i=>{const o=S(e,i.possibleTypes||[]).map(a=>A(e,a,r)).join(` | ||
`);return w(i.name,o)}).join(` | ||
`)}function K(e,t,r){var a,c;const n=t.split("."),i=n.pop(),o=u(e,n[0]?n.join("."):void 0,r);if(o.kind==="Object"||o.kind==="Interface")return(c=(a=o==null?void 0:o.fields)==null?void 0:a.find(l=>l.name===i))==null?void 0:c.args}function z(e){const t=e.nonNull?"!":"",r=e.listNonNull?"!":"",n=e.list?`[${e.typeName}${t}${r}]`:`${e.typeName}${t}`;return`$${e.name}: ${n}`}function v(e){return e.length===0?"":`(${e.map(z).join(", ")})`}function b(e){return e.length===0?"":`(${e.map(t=>`${t.name}: $${t.name}`).join(", ")})`}function U(e,t,r,n,i){const o=r.split("."),a=o.pop(),c=e!=null&&e.fields?N(e):void 0,l=G(t,e,n),y=I(t,e,n),$=o.length-1>0?"}".repeat(o.length-1):"",g=K(t,r,i);return{dividedPath:o,name:a,fields:c,relatedObjectFields:l,relatedUnionFields:y,closingBraces:$,variableDeclaration:v(g),variableUsage:b(g)}}function R(e,t){var i;const n=(i=u(e,t,"Query").directives)==null?void 0:i.find(o=>o.name==="collection");if(!n)throw new Error("Can't generate List Query");return n.args}function B(e,t,r){const{dividedPath:n,name:i,closingBraces:o,variableDeclaration:a,variableUsage:c}=e;return` | ||
(function(l,u){typeof exports=="object"&&typeof module!="undefined"?u(exports):typeof define=="function"&&define.amd?define(["exports"],u):(l=typeof globalThis!="undefined"?globalThis:l||self,u(l["@theconcurrent/query"]={}))})(this,function(l){"use strict";function u(e,t,r){const{dividedPath:n,name:o,closingBraces:i,variableDeclaration:a,variableUsage:c}=e;return` | ||
query ${r}${a} { | ||
${n.join(".").replace(/\./g,` { | ||
`)} ${n.length===0?"":"{"} | ||
${i}${c} { | ||
${o}${c} { | ||
${t} | ||
} | ||
} | ||
${n.length===0?"":"}"}${o} | ||
`.trim()}function j(e,t,r){const n=u(e,r,"Query"),i=U(n,e,r,t,"Query"),o=`${i.fields||""} | ||
${i.relatedObjectFields||""} | ||
${i.relatedUnionFields||""}`;return B(i,o,i.name)}function k(e,t,r){const n=R(e,r);if(!n)throw new Error("Can't generate List Query");const i=m(e,n.typeName);if(!i)throw new Error("Can't generate List Query");const o=U(i,e,r,t,"Query"),a=`${n.dataPath} { | ||
${o.fields||""} | ||
${o.relatedObjectFields||""} | ||
${o.relatedUnionFields||""}} | ||
${n.totalPath}`;return B(o,a,o.name)}function H(e,t,r){const n=R(e,r);if(!n)throw new Error("Can't generate List Query");const i=m(e,n.typeName);if(!i)throw new Error("Can't generate List Query");const o=E(i).filter(l=>["id",...t].includes(l)),a=U(i,e,r,t,"Query"),c=`${n.dataPath} { | ||
${o||""}}`;return B(a,c,a.name.replace(/List$/,"MinimumList"))}function D(e,t,r){var d;const n=r.split("."),i=n.shift(),o=u(e,i,"Mutation"),a=(d=m(e,"Mutation"))==null?void 0:d.fields.find(Q=>Q.typeName===o.typeName);if(!a)throw new Error("Can't generate Create Mutation");const c=u(e,r,"Mutation"),l="}".repeat(n.length-1),y=v(a.args),$=b(a.args),p=`${N(c)||""} | ||
`,F="mutation",h=n[0];return` | ||
${F} ${i}${y} { | ||
${i}${$} { | ||
${h}{ | ||
${p} | ||
${n.length===0?"":"}"}${i} | ||
`.trim()}function $(e,t,r){return e.find(n=>n[t]===r)}function F(e,t){return $(e,"typeName",t)}function h(e,t,r){var n;const o=F(e,t);if(!o||o.kind!=="Object"||!o.fields)return;if(r.length===0)return o;const[i,...a]=r,c=(n=o.fields.find(s=>s.name===i))==null?void 0:n.typeName;if(c)return h(e,c,a)}function d(e,t,r){const n=h(e,r,(t==null?void 0:t.split("."))||[]);if(!n)throw new Error("Can't find Entity");return n}function T(e,t){var o;const n=(o=d(e,t,"Query").directives)==null?void 0:o.find(i=>i.name==="collection");if(!n)throw new Error("Can't generate List Query");return n.args}function N(e){return e.args?!e.args.find(t=>t.nonNull):!0}function Q(e){var t,r;return(r=(t=e.fields)==null?void 0:t.filter(n=>n.kind==="Scalar"||n.kind==="Enum"))==null?void 0:r.filter(N).map(n=>n.name)}function b(e){return Q(e).join(` | ||
`)}function k(e,t){var n;const r=d(e,t,"Mutation");return(n=F(e,"Mutation"))==null?void 0:n.fields.find(o=>o.typeName===r.typeName)}function U(e,t){const r=d(e,t,"Mutation");return b(r)}function C(e){const t=e.nonNull?"!":"",r=e.listNonNull?"!":"",n=e.list?`[${e.typeName}${t}${r}]`:`${e.typeName}${t}`;return`$${e.name}: ${n}`}function v(e){return e.length===0?"":`(${e.map(C).join(", ")})`}function E(e){return e.length===0?"":`(${e.map(t=>`${t.name}: $${t.name}`).join(", ")})`}function p(e,t,r){const{simplifiedEntities:n}=e,o=t.split("."),i=o.shift(),a=k(n,i);if(!a)throw new Error(`Can't generate ${r} Mutation`);const c=U(n,t),s="}".repeat(o.length-1),f=v(a.args),m=E(a.args),y=`${c||""} | ||
`,z="mutation",H=o[0];return` | ||
${z} ${i}${f} { | ||
${i}${m} { | ||
${H}{ | ||
${y} | ||
} | ||
} | ||
}${l} | ||
`.trim()}function P(e,t,r){var d;const n=r.split("."),i=n.shift(),o=u(e,i,"Mutation"),a=(d=m(e,"Mutation"))==null?void 0:d.fields.find(Q=>Q.typeName===o.typeName);if(!a)throw new Error("Can't generate Update Mutation");const c=u(e,r,"Mutation"),l="}".repeat(n.length-1),y=v(a.args),$=b(a.args),p=`${N(c)||""} | ||
`,F="mutation",h=n[0];return` | ||
${F} ${i}${y} { | ||
${i}${$} { | ||
${h}{ | ||
${p} | ||
} | ||
} | ||
}${l} | ||
`.trim()}function x(e,t,r){var d;const n=r.split("."),i=n.shift(),o=u(e,i,"Mutation"),a=(d=m(e,"Mutation"))==null?void 0:d.fields.find(Q=>Q.typeName===o.typeName);if(!a)throw new Error("Can't generate Delete Mutation");const c=u(e,r,"Mutation"),l="}".repeat(n.length-1),y=v(a.args),$=b(a.args),p=`${N(c)||""} | ||
`,F="mutation",h=n[0];return` | ||
${F} ${i}${y} { | ||
${i}${$} { | ||
${h}{ | ||
${p} | ||
} | ||
} | ||
}${l} | ||
`.trim()}function J(e,t){return D(e.simplifiedEntities,e.config.nodeRepresentatives,t)}function X(e,t){return P(e.simplifiedEntities,e.config.nodeRepresentatives,t)}function Y(e,t){return x(e.simplifiedEntities,e.config.nodeRepresentatives,t)}function Z(e,t){return k(e.simplifiedEntities,e.config.nodeRepresentatives,t)}function _(e,t){return H(e.simplifiedEntities,e.config.nodeRepresentatives,t)}function ee(e,t){return j(e.simplifiedEntities,e.config.nodeRepresentatives,t)}s.createMinimumQueryForList=_,s.createQueryForCreate=J,s.createQueryForDelete=Y,s.createQueryForList=Z,s.createQueryForShow=ee,s.createQueryForUpdate=X,s.getCreateQuery=D,s.getDeleteQuery=x,s.getListQuery=k,s.getShowQuery=j,s.getUpdateQuery=P,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})}); | ||
}${s} | ||
`.trim()}function w(e,t){var o;const r=(o=e==null?void 0:e.fields)==null?void 0:o.filter(i=>i.kind==="Scalar").map(i=>i.name);if(!r)throw new Error("Can't find relatedFields");const n=r.filter(i=>t.includes(i));return n.length===0?r[0]:n.join(` | ||
`)}function x(e,t){var r,n;return(n=(r=e.fields)==null?void 0:r.filter(o=>o.kind===t))==null?void 0:n.filter(N)}function L(e){return`{ | ||
${e} | ||
}`}function g(e,t){return`${e} ${L(t)}`}function M(e,t,r){const n=$(e,"typeName",r.typeName);return w(n,t)}function R(e,t,r){var n;return(n=x(t,"Object"))==null?void 0:n.map(o=>{const i=M(e,r,o);return g(o.name,i)})}function P(e,t,r){var n;return(n=R(e,t,r))==null?void 0:n.join(` | ||
`)}function D(e,t){return t.map(r=>$(e,"typeName",r))}function S(e,t,r){return w(t,r)}function V(e,t,r){const n=S(e,t,r);return g(`... on ${t.typeName}`,n)}function O(e,t,r){var n;return(n=x(t,"Union"))==null?void 0:n.map(o=>{const i=D(e,o.possibleTypes||[]).map(a=>V(e,a,r)).join(` | ||
`);return g(o.name,i)}).join(` | ||
`)}function W(e,t,r){var a,c;const n=t.split("."),o=n.pop(),i=d(e,n[0]?n.join("."):void 0,r);if(i.kind==="Object"||i.kind==="Interface")return(c=(a=i==null?void 0:i.fields)==null?void 0:a.find(s=>s.name===o))==null?void 0:c.args}function B(e,t,r,n,o){const i=r.split("."),a=i.pop(),c=e!=null&&e.fields?b(e):void 0,s=P(t,e,n),f=O(t,e,n),m=i.length-1>0?"}".repeat(i.length-1):"",y=W(t,r,o);return{dividedPath:i,name:a,fields:c,relatedObjectFields:s,relatedUnionFields:f,closingBraces:m,variableDeclaration:v(y),variableUsage:E(y)}}function j(e,t,r){const{simplifiedEntities:n,config:{nodeRepresentatives:o}}=e,i=T(n,t);if(!i)throw new Error("Can't generate List Query");const a=F(n,i.typeName);if(!a)throw new Error("Can't generate List Query");const c=B(a,n,t,o,"Query"),s=r(i,c,a);return{variables:c,fieldsBlock:s}}function q(e,t){const{config:{nodeRepresentatives:r}}=e,n=(a,c,s)=>{const f=Q(s).filter(m=>["id",...r].includes(m)).join(` | ||
`);return`${a.dataPath} { | ||
${f||""}}`},{variables:o,fieldsBlock:i}=j(e,t,n);return u(o,i,o.name.replace(/List$/,"MinimumList"))}function A(e,t){return p(e,t,"Create")}function G(e,t){return p(e,t,"Delete")}function I(e,t){const r=(i,a)=>`${i.dataPath} { | ||
${a.fields||""} | ||
${a.relatedObjectFields||""} | ||
${a.relatedUnionFields||""}} | ||
${i.totalPath}`,{variables:n,fieldsBlock:o}=j(e,t,r);return u(n,o,n.name)}function K(e,t){const{simplifiedEntities:r,config:{nodeRepresentatives:n}}=e,o=d(r,t,"Query");if(!o)throw new Error("Can't generate Show Query");const i=B(o,r,t,n,"Query"),a=`${i.fields||""} | ||
${i.relatedObjectFields||""} | ||
${i.relatedUnionFields||""}`;return u(i,a,i.name)}function _(e,t){return p(e,t,"Update")}l.createMinimumQueryForList=q,l.createQueryForCreate=A,l.createQueryForDelete=G,l.createQueryForList=I,l.createQueryForShow=K,l.createQueryForUpdate=_,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})}); | ||
//# sourceMappingURL=index.umd.js.map |
@@ -1,20 +0,3 @@ | ||
import type { SimplifiedEntityType } from './types'; | ||
type Params = { | ||
simplifiedEntities: SimplifiedEntityType[]; | ||
config: { | ||
nodeRepresentatives: Array<string>; | ||
}; | ||
}; | ||
export declare function getShowQuery(simplifiedEntities: SimplifiedEntityType[], nodeRepresentatives: Array<string>, path: string): string; | ||
export declare function getListQuery(simplifiedEntities: SimplifiedEntityType[], nodeRepresentatives: Array<string>, path: string): string; | ||
export declare function getCreateQuery(simplifiedEntities: SimplifiedEntityType[], nodeRepresentatives: Array<string>, path: string): string; | ||
export declare function getUpdateQuery(simplifiedEntities: SimplifiedEntityType[], nodeRepresentatives: Array<string>, path: string): string; | ||
export declare function getDeleteQuery(simplifiedEntities: SimplifiedEntityType[], nodeRepresentatives: Array<string>, path: string): string; | ||
export declare function createQueryForCreate(params: Params, path: string): string; | ||
export declare function createQueryForUpdate(params: Params, path: string): string; | ||
export declare function createQueryForDelete(params: Params, path: string): string; | ||
export declare function createQueryForList(params: Params, path: string): string; | ||
export declare function createMinimumQueryForList(params: Params, path: string): string; | ||
export declare function createQueryForShow(params: Params, path: string): string; | ||
export {}; | ||
import { createMinimumQueryForList, createQueryForCreate, createQueryForDelete, createQueryForList, createQueryForShow, createQueryForUpdate } from './operationGenerators'; | ||
export { createMinimumQueryForList, createQueryForCreate, createQueryForDelete, createQueryForList, createQueryForShow, createQueryForUpdate, }; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,24 +0,37 @@ | ||
function Q(e, t, r) { | ||
return e.find((n) => n[t] === r); | ||
function m(e, t, i) { | ||
const { dividedPath: n, name: o, closingBraces: r, variableDeclaration: a, variableUsage: l } = e; | ||
return ` | ||
query ${i}${a} { | ||
${n.join(".").replace(/\./g, ` { | ||
`)} ${n.length === 0 ? "" : "{"} | ||
${o}${l} { | ||
${t} | ||
} | ||
} | ||
${n.length === 0 ? "" : "}"}${r} | ||
`.trim(); | ||
} | ||
function $(e, t, r = "typeName") { | ||
return Q(e, r, t); | ||
function $(e, t, i) { | ||
return e.find((n) => n[t] === i); | ||
} | ||
function B(e, t, r) { | ||
function y(e, t) { | ||
return $(e, "typeName", t); | ||
} | ||
function g(e, t, i) { | ||
var n; | ||
const i = $(e, t); | ||
if (!i || i.kind !== "Object" || !i.fields) | ||
const o = y(e, t); | ||
if (!o || o.kind !== "Object" || !o.fields) | ||
return; | ||
if (r.length === 0) | ||
return i; | ||
const [o, ...a] = r, c = (n = i.fields.find( | ||
(s) => s.name === o | ||
if (i.length === 0) | ||
return o; | ||
const [r, ...a] = i, l = (n = o.fields.find( | ||
(c) => c.name === r | ||
)) == null ? void 0 : n.typeName; | ||
if (c) | ||
return B(e, c, a); | ||
if (l) | ||
return g(e, l, a); | ||
} | ||
function l(e, t, r) { | ||
const n = B( | ||
function d(e, t, i) { | ||
const n = g( | ||
e, | ||
r, | ||
i, | ||
(t == null ? void 0 : t.split(".")) || [] | ||
@@ -30,30 +43,73 @@ ); | ||
} | ||
function E(e) { | ||
function U(e, t) { | ||
var o; | ||
const n = (o = d(e, t, "Query").directives) == null ? void 0 : o.find((r) => r.name === "collection"); | ||
if (!n) | ||
throw new Error("Can't generate List Query"); | ||
return n.args; | ||
} | ||
function N(e) { | ||
return e.args ? !e.args.find((t) => t.nonNull) : !0; | ||
} | ||
function U(e) { | ||
var t, r; | ||
return (r = (t = e.fields) == null ? void 0 : t.filter((n) => n.kind === "Scalar" || n.kind === "Enum")) == null ? void 0 : r.filter(E).map((n) => n.name); | ||
function h(e) { | ||
var t, i; | ||
return (i = (t = e.fields) == null ? void 0 : t.filter((n) => n.kind === "Scalar" || n.kind === "Enum")) == null ? void 0 : i.filter(N).map((n) => n.name); | ||
} | ||
function F(e) { | ||
return U(e).join(` | ||
function x(e) { | ||
return h(e).join(` | ||
`); | ||
} | ||
function M(e, t) { | ||
var i; | ||
const r = (i = e == null ? void 0 : e.fields) == null ? void 0 : i.filter((o) => o.kind === "Scalar").map((o) => o.name); | ||
if (!r) | ||
function T(e, t) { | ||
var n; | ||
const i = d(e, t, "Mutation"); | ||
return (n = y(e, "Mutation")) == null ? void 0 : n.fields.find( | ||
// @ts-ignore | ||
// eslint-disable-next-line | ||
(o) => o.typeName === i.typeName | ||
); | ||
} | ||
function C(e, t) { | ||
const i = d(e, t, "Mutation"); | ||
return x(i); | ||
} | ||
function R(e) { | ||
const t = e.nonNull ? "!" : "", i = e.listNonNull ? "!" : "", n = e.list ? `[${e.typeName}${t}${i}]` : `${e.typeName}${t}`; | ||
return `$${e.name}: ${n}`; | ||
} | ||
function v(e) { | ||
return e.length === 0 ? "" : `(${e.map(R).join(", ")})`; | ||
} | ||
function b(e) { | ||
return e.length === 0 ? "" : `(${e.map((t) => `${t.name}: $${t.name}`).join(", ")})`; | ||
} | ||
function p(e, t, i) { | ||
const { simplifiedEntities: n } = e, o = t.split("."), r = o.shift(), a = T(n, r); | ||
if (!a) | ||
throw new Error(`Can't generate ${i} Mutation`); | ||
const l = C(n, t), c = "}".repeat(o.length - 1), s = v(a.args), u = b(a.args), f = `${l || ""} | ||
`, k = "mutation", j = o[0]; | ||
return ` | ||
${k} ${r}${s} { | ||
${r}${u} { | ||
${j}{ | ||
${f} | ||
} | ||
} | ||
}${c} | ||
`.trim(); | ||
} | ||
function E(e, t) { | ||
var o; | ||
const i = (o = e == null ? void 0 : e.fields) == null ? void 0 : o.filter((r) => r.kind === "Scalar").map((r) => r.name); | ||
if (!i) | ||
throw new Error("Can't find relatedFields"); | ||
const n = r.filter((o) => t.includes(o)); | ||
return n.length === 0 ? r[0] : n.join(` | ||
const n = i.filter((r) => t.includes(r)); | ||
return n.length === 0 ? i[0] : n.join(` | ||
`); | ||
} | ||
function k(e, t) { | ||
return t.map((r) => Q(e, "typeName", r)); | ||
function w(e, t) { | ||
var i, n; | ||
return (n = (i = e.fields) == null ? void 0 : i.filter((o) => o.kind === t)) == null ? void 0 : n.filter(N); | ||
} | ||
function R(e, t) { | ||
var r, n; | ||
return (n = (r = e.fields) == null ? void 0 : r.filter((i) => i.kind === t)) == null ? void 0 : n.filter(E); | ||
} | ||
function T(e) { | ||
function L(e) { | ||
return `{ | ||
@@ -63,250 +119,153 @@ ${e} | ||
} | ||
function w(e, t) { | ||
return `${e} ${T(t)}`; | ||
function F(e, t) { | ||
return `${e} ${L(t)}`; | ||
} | ||
function j(e, t, r) { | ||
const n = Q(e, "typeName", r.typeName); | ||
return M(n, t); | ||
function M(e, t, i) { | ||
const n = $(e, "typeName", i.typeName); | ||
return E(n, t); | ||
} | ||
function L(e, t, r) { | ||
function P(e, t, i) { | ||
var n; | ||
return (n = R(t, "Object")) == null ? void 0 : n.map((i) => { | ||
const o = j(e, r, i); | ||
return w(i.name, o); | ||
return (n = w(t, "Object")) == null ? void 0 : n.map((o) => { | ||
const r = M(e, i, o); | ||
return F(o.name, r); | ||
}); | ||
} | ||
function D(e, t, r) { | ||
return M(t, r); | ||
function D(e, t, i) { | ||
var n; | ||
return (n = P(e, t, i)) == null ? void 0 : n.join(` | ||
`); | ||
} | ||
function P(e, t, r) { | ||
const n = D( | ||
function V(e, t) { | ||
return t.map((i) => $(e, "typeName", i)); | ||
} | ||
function S(e, t, i) { | ||
return E(t, i); | ||
} | ||
function W(e, t, i) { | ||
const n = S( | ||
e, | ||
t, | ||
r | ||
i | ||
); | ||
return w(`... on ${t.typeName}`, n); | ||
return F(`... on ${t.typeName}`, n); | ||
} | ||
function S(e, t, r) { | ||
function O(e, t, i) { | ||
var n; | ||
return (n = L(e, t, r)) == null ? void 0 : n.join(` | ||
`); | ||
} | ||
function V(e, t, r) { | ||
var n; | ||
return (n = R(t, "Union")) == null ? void 0 : n.map((i) => { | ||
const o = k( | ||
return (n = w(t, "Union")) == null ? void 0 : n.map((o) => { | ||
const r = V( | ||
e, | ||
i.possibleTypes || [] | ||
o.possibleTypes || [] | ||
).map( | ||
(a) => P(e, a, r) | ||
(a) => W(e, a, i) | ||
).join(` | ||
`); | ||
return w(i.name, o); | ||
return F(o.name, r); | ||
}).join(` | ||
`); | ||
} | ||
function W(e, t, r) { | ||
var a, c; | ||
const n = t.split("."), i = n.pop(), o = l(e, n[0] ? n.join(".") : void 0, r); | ||
if (o.kind === "Object" || o.kind === "Interface") | ||
return (c = (a = o == null ? void 0 : o.fields) == null ? void 0 : a.find((s) => s.name === i)) == null ? void 0 : c.args; | ||
function q(e, t, i) { | ||
var a, l; | ||
const n = t.split("."), o = n.pop(), r = d(e, n[0] ? n.join(".") : void 0, i); | ||
if (r.kind === "Object" || r.kind === "Interface") | ||
return (l = (a = r == null ? void 0 : r.fields) == null ? void 0 : a.find((c) => c.name === o)) == null ? void 0 : l.args; | ||
} | ||
function O(e) { | ||
const t = e.nonNull ? "!" : "", r = e.listNonNull ? "!" : "", n = e.list ? `[${e.typeName}${t}${r}]` : `${e.typeName}${t}`; | ||
return `$${e.name}: ${n}`; | ||
} | ||
function v(e) { | ||
return e.length === 0 ? "" : `(${e.map(O).join(", ")})`; | ||
} | ||
function h(e) { | ||
return e.length === 0 ? "" : `(${e.map((t) => `${t.name}: $${t.name}`).join(", ")})`; | ||
} | ||
function b(e, t, r, n, i) { | ||
const o = r.split("."), a = o.pop(), c = e != null && e.fields ? F(e) : void 0, s = S( | ||
function B(e, t, i, n, o) { | ||
const r = i.split("."), a = r.pop(), l = e != null && e.fields ? x(e) : void 0, c = D( | ||
t, | ||
e, | ||
n | ||
), d = V( | ||
), s = O( | ||
t, | ||
e, | ||
n | ||
), f = o.length - 1 > 0 ? "}".repeat(o.length - 1) : "", m = W(t, r, i); | ||
), u = r.length - 1 > 0 ? "}".repeat(r.length - 1) : "", f = q(t, i, o); | ||
return { | ||
dividedPath: o, | ||
dividedPath: r, | ||
name: a, | ||
fields: c, | ||
relatedObjectFields: s, | ||
relatedUnionFields: d, | ||
closingBraces: f, | ||
variableDeclaration: v(m), | ||
variableUsage: h(m) | ||
fields: l, | ||
relatedObjectFields: c, | ||
relatedUnionFields: s, | ||
closingBraces: u, | ||
variableDeclaration: v(f), | ||
variableUsage: b(f) | ||
}; | ||
} | ||
function C(e, t) { | ||
var i; | ||
const n = (i = l(e, t, "Query").directives) == null ? void 0 : i.find((o) => o.name === "collection"); | ||
if (!n) | ||
function Q(e, t, i) { | ||
const { | ||
simplifiedEntities: n, | ||
config: { nodeRepresentatives: o } | ||
} = e, r = U(n, t); | ||
if (!r) | ||
throw new Error("Can't generate List Query"); | ||
return n.args; | ||
} | ||
function x(e, t, r) { | ||
const { dividedPath: n, name: i, closingBraces: o, variableDeclaration: a, variableUsage: c } = e; | ||
return ` | ||
query ${r}${a} { | ||
${n.join(".").replace(/\./g, ` { | ||
`)} ${n.length === 0 ? "" : "{"} | ||
${i}${c} { | ||
${t} | ||
} | ||
} | ||
${n.length === 0 ? "" : "}"}${o} | ||
`.trim(); | ||
} | ||
function q(e, t, r) { | ||
const n = l(e, r, "Query"), i = b( | ||
const a = y(n, r.typeName); | ||
if (!a) | ||
throw new Error("Can't generate List Query"); | ||
const l = B( | ||
a, | ||
n, | ||
e, | ||
r, | ||
t, | ||
o, | ||
"Query" | ||
), o = `${i.fields || ""} | ||
${i.relatedObjectFields || ""} | ||
${i.relatedUnionFields || ""}`; | ||
return x(i, o, i.name); | ||
), c = i(r, l, a); | ||
return { variables: l, fieldsBlock: c }; | ||
} | ||
function A(e, t, r) { | ||
const n = C(e, r); | ||
if (!n) | ||
throw new Error("Can't generate List Query"); | ||
const i = $(e, n.typeName); | ||
if (!i) | ||
throw new Error("Can't generate List Query"); | ||
const o = b( | ||
i, | ||
e, | ||
function A(e, t) { | ||
const { | ||
config: { nodeRepresentatives: i } | ||
} = e, n = (a, l, c) => { | ||
const s = h(c).filter((u) => ["id", ...i].includes(u)).join(` | ||
`); | ||
return `${a.dataPath} { | ||
${s || ""}}`; | ||
}, { variables: o, fieldsBlock: r } = Q(e, t, n); | ||
return m( | ||
o, | ||
r, | ||
t, | ||
"Query" | ||
), a = `${n.dataPath} { | ||
${o.fields || ""} | ||
${o.relatedObjectFields || ""} | ||
${o.relatedUnionFields || ""}} | ||
${n.totalPath}`; | ||
return x(o, a, o.name); | ||
} | ||
function G(e, t, r) { | ||
const n = C(e, r); | ||
if (!n) | ||
throw new Error("Can't generate List Query"); | ||
const i = $(e, n.typeName); | ||
if (!i) | ||
throw new Error("Can't generate List Query"); | ||
const o = U(i).filter((s) => ["id", ...t].includes(s)), a = b( | ||
i, | ||
e, | ||
r, | ||
t, | ||
"Query" | ||
), c = `${n.dataPath} { | ||
${o || ""}}`; | ||
return x( | ||
a, | ||
c, | ||
a.name.replace(/List$/, "MinimumList") | ||
o.name.replace(/List$/, "MinimumList") | ||
); | ||
} | ||
function I(e, t, r) { | ||
var u; | ||
const n = r.split("."), i = n.shift(), o = l(e, i, "Mutation"), a = (u = $(e, "Mutation")) == null ? void 0 : u.fields.find( | ||
// @ts-ignore | ||
// eslint-disable-next-line | ||
(N) => N.typeName === o.typeName | ||
); | ||
if (!a) | ||
throw new Error("Can't generate Create Mutation"); | ||
const c = l(e, r, "Mutation"), s = "}".repeat(n.length - 1), d = v(a.args), f = h(a.args), y = `${F(c) || ""} | ||
`, g = "mutation", p = n[0]; | ||
return ` | ||
${g} ${i}${d} { | ||
${i}${f} { | ||
${p}{ | ||
${y} | ||
} | ||
} | ||
}${s} | ||
`.trim(); | ||
function G(e, t) { | ||
return p(e, t, "Create"); | ||
} | ||
function K(e, t, r) { | ||
var u; | ||
const n = r.split("."), i = n.shift(), o = l(e, i, "Mutation"), a = (u = $(e, "Mutation")) == null ? void 0 : u.fields.find( | ||
// @ts-ignore | ||
// eslint-disable-next-line | ||
(N) => N.typeName === o.typeName | ||
); | ||
if (!a) | ||
throw new Error("Can't generate Update Mutation"); | ||
const c = l(e, r, "Mutation"), s = "}".repeat(n.length - 1), d = v(a.args), f = h(a.args), y = `${F(c) || ""} | ||
`, g = "mutation", p = n[0]; | ||
return ` | ||
${g} ${i}${d} { | ||
${i}${f} { | ||
${p}{ | ||
${y} | ||
} | ||
} | ||
}${s} | ||
`.trim(); | ||
function I(e, t) { | ||
return p(e, t, "Delete"); | ||
} | ||
function z(e, t, r) { | ||
var u; | ||
const n = r.split("."), i = n.shift(), o = l(e, i, "Mutation"), a = (u = $(e, "Mutation")) == null ? void 0 : u.fields.find( | ||
// @ts-ignore | ||
// eslint-disable-next-line | ||
(N) => N.typeName === o.typeName | ||
); | ||
if (!a) | ||
throw new Error("Can't generate Delete Mutation"); | ||
const c = l(e, r, "Mutation"), s = "}".repeat(n.length - 1), d = v(a.args), f = h(a.args), y = `${F(c) || ""} | ||
`, g = "mutation", p = n[0]; | ||
return ` | ||
${g} ${i}${d} { | ||
${i}${f} { | ||
${p}{ | ||
${y} | ||
} | ||
} | ||
}${s} | ||
`.trim(); | ||
function K(e, t) { | ||
const i = (r, a) => `${r.dataPath} { | ||
${a.fields || ""} | ||
${a.relatedObjectFields || ""} | ||
${a.relatedUnionFields || ""}} | ||
${r.totalPath}`, { variables: n, fieldsBlock: o } = Q(e, t, i); | ||
return m(n, o, n.name); | ||
} | ||
function H(e, t) { | ||
return I(e.simplifiedEntities, e.config.nodeRepresentatives, t); | ||
function _(e, t) { | ||
const { | ||
simplifiedEntities: i, | ||
config: { nodeRepresentatives: n } | ||
} = e, o = d(i, t, "Query"); | ||
if (!o) | ||
throw new Error("Can't generate Show Query"); | ||
const r = B( | ||
o, | ||
i, | ||
t, | ||
n, | ||
"Query" | ||
), a = `${r.fields || ""} | ||
${r.relatedObjectFields || ""} | ||
${r.relatedUnionFields || ""}`; | ||
return m(r, a, r.name); | ||
} | ||
function J(e, t) { | ||
return K(e.simplifiedEntities, e.config.nodeRepresentatives, t); | ||
function z(e, t) { | ||
return p(e, t, "Update"); | ||
} | ||
function X(e, t) { | ||
return z(e.simplifiedEntities, e.config.nodeRepresentatives, t); | ||
} | ||
function Y(e, t) { | ||
return A(e.simplifiedEntities, e.config.nodeRepresentatives, t); | ||
} | ||
function Z(e, t) { | ||
return G(e.simplifiedEntities, e.config.nodeRepresentatives, t); | ||
} | ||
function _(e, t) { | ||
return q(e.simplifiedEntities, e.config.nodeRepresentatives, t); | ||
} | ||
export { | ||
Z as createMinimumQueryForList, | ||
H as createQueryForCreate, | ||
X as createQueryForDelete, | ||
Y as createQueryForList, | ||
A as createMinimumQueryForList, | ||
G as createQueryForCreate, | ||
I as createQueryForDelete, | ||
K as createQueryForList, | ||
_ as createQueryForShow, | ||
J as createQueryForUpdate, | ||
I as getCreateQuery, | ||
z as getDeleteQuery, | ||
A as getListQuery, | ||
q as getShowQuery, | ||
K as getUpdateQuery | ||
z as createQueryForUpdate | ||
}; | ||
//# sourceMappingURL=index.es.js.map |
@@ -1,52 +0,35 @@ | ||
(function(s,f){typeof exports=="object"&&typeof module!="undefined"?f(exports):typeof define=="function"&&define.amd?define(["exports"],f):(s=typeof globalThis!="undefined"?globalThis:s||self,f(s["@theconcurrent/query"]={}))})(this,function(s){"use strict";function f(e,t,r){return e.find(n=>n[t]===r)}function m(e,t,r="typeName"){return f(e,r,t)}function M(e,t,r){var n;const i=m(e,t);if(!i||i.kind!=="Object"||!i.fields)return;if(r.length===0)return i;const[o,...a]=r,c=(n=i.fields.find(l=>l.name===o))==null?void 0:n.typeName;if(c)return M(e,c,a)}function u(e,t,r){const n=M(e,r,(t==null?void 0:t.split("."))||[]);if(!n)throw new Error("Can't find Entity");return n}function C(e){return e.args?!e.args.find(t=>t.nonNull):!0}function E(e){var t,r;return(r=(t=e.fields)==null?void 0:t.filter(n=>n.kind==="Scalar"||n.kind==="Enum"))==null?void 0:r.filter(C).map(n=>n.name)}function N(e){return E(e).join(` | ||
`)}function T(e,t){var i;const r=(i=e==null?void 0:e.fields)==null?void 0:i.filter(o=>o.kind==="Scalar").map(o=>o.name);if(!r)throw new Error("Can't find relatedFields");const n=r.filter(o=>t.includes(o));return n.length===0?r[0]:n.join(` | ||
`)}function S(e,t){return t.map(r=>f(e,"typeName",r))}function L(e,t){var r,n;return(n=(r=e.fields)==null?void 0:r.filter(i=>i.kind===t))==null?void 0:n.filter(C)}function O(e){return`{ | ||
${e} | ||
}`}function w(e,t){return`${e} ${O(t)}`}function V(e,t,r){const n=f(e,"typeName",r.typeName);return T(n,t)}function W(e,t,r){var n;return(n=L(t,"Object"))==null?void 0:n.map(i=>{const o=V(e,r,i);return w(i.name,o)})}function q(e,t,r){return T(t,r)}function A(e,t,r){const n=q(e,t,r);return w(`... on ${t.typeName}`,n)}function G(e,t,r){var n;return(n=W(e,t,r))==null?void 0:n.join(` | ||
`)}function I(e,t,r){var n;return(n=L(t,"Union"))==null?void 0:n.map(i=>{const o=S(e,i.possibleTypes||[]).map(a=>A(e,a,r)).join(` | ||
`);return w(i.name,o)}).join(` | ||
`)}function K(e,t,r){var a,c;const n=t.split("."),i=n.pop(),o=u(e,n[0]?n.join("."):void 0,r);if(o.kind==="Object"||o.kind==="Interface")return(c=(a=o==null?void 0:o.fields)==null?void 0:a.find(l=>l.name===i))==null?void 0:c.args}function z(e){const t=e.nonNull?"!":"",r=e.listNonNull?"!":"",n=e.list?`[${e.typeName}${t}${r}]`:`${e.typeName}${t}`;return`$${e.name}: ${n}`}function v(e){return e.length===0?"":`(${e.map(z).join(", ")})`}function b(e){return e.length===0?"":`(${e.map(t=>`${t.name}: $${t.name}`).join(", ")})`}function U(e,t,r,n,i){const o=r.split("."),a=o.pop(),c=e!=null&&e.fields?N(e):void 0,l=G(t,e,n),y=I(t,e,n),$=o.length-1>0?"}".repeat(o.length-1):"",g=K(t,r,i);return{dividedPath:o,name:a,fields:c,relatedObjectFields:l,relatedUnionFields:y,closingBraces:$,variableDeclaration:v(g),variableUsage:b(g)}}function R(e,t){var i;const n=(i=u(e,t,"Query").directives)==null?void 0:i.find(o=>o.name==="collection");if(!n)throw new Error("Can't generate List Query");return n.args}function B(e,t,r){const{dividedPath:n,name:i,closingBraces:o,variableDeclaration:a,variableUsage:c}=e;return` | ||
(function(l,u){typeof exports=="object"&&typeof module!="undefined"?u(exports):typeof define=="function"&&define.amd?define(["exports"],u):(l=typeof globalThis!="undefined"?globalThis:l||self,u(l["@theconcurrent/query"]={}))})(this,function(l){"use strict";function u(e,t,r){const{dividedPath:n,name:o,closingBraces:i,variableDeclaration:a,variableUsage:c}=e;return` | ||
query ${r}${a} { | ||
${n.join(".").replace(/\./g,` { | ||
`)} ${n.length===0?"":"{"} | ||
${i}${c} { | ||
${o}${c} { | ||
${t} | ||
} | ||
} | ||
${n.length===0?"":"}"}${o} | ||
`.trim()}function j(e,t,r){const n=u(e,r,"Query"),i=U(n,e,r,t,"Query"),o=`${i.fields||""} | ||
${i.relatedObjectFields||""} | ||
${i.relatedUnionFields||""}`;return B(i,o,i.name)}function k(e,t,r){const n=R(e,r);if(!n)throw new Error("Can't generate List Query");const i=m(e,n.typeName);if(!i)throw new Error("Can't generate List Query");const o=U(i,e,r,t,"Query"),a=`${n.dataPath} { | ||
${o.fields||""} | ||
${o.relatedObjectFields||""} | ||
${o.relatedUnionFields||""}} | ||
${n.totalPath}`;return B(o,a,o.name)}function H(e,t,r){const n=R(e,r);if(!n)throw new Error("Can't generate List Query");const i=m(e,n.typeName);if(!i)throw new Error("Can't generate List Query");const o=E(i).filter(l=>["id",...t].includes(l)),a=U(i,e,r,t,"Query"),c=`${n.dataPath} { | ||
${o||""}}`;return B(a,c,a.name.replace(/List$/,"MinimumList"))}function D(e,t,r){var d;const n=r.split("."),i=n.shift(),o=u(e,i,"Mutation"),a=(d=m(e,"Mutation"))==null?void 0:d.fields.find(Q=>Q.typeName===o.typeName);if(!a)throw new Error("Can't generate Create Mutation");const c=u(e,r,"Mutation"),l="}".repeat(n.length-1),y=v(a.args),$=b(a.args),p=`${N(c)||""} | ||
`,F="mutation",h=n[0];return` | ||
${F} ${i}${y} { | ||
${i}${$} { | ||
${h}{ | ||
${p} | ||
${n.length===0?"":"}"}${i} | ||
`.trim()}function $(e,t,r){return e.find(n=>n[t]===r)}function F(e,t){return $(e,"typeName",t)}function h(e,t,r){var n;const o=F(e,t);if(!o||o.kind!=="Object"||!o.fields)return;if(r.length===0)return o;const[i,...a]=r,c=(n=o.fields.find(s=>s.name===i))==null?void 0:n.typeName;if(c)return h(e,c,a)}function d(e,t,r){const n=h(e,r,(t==null?void 0:t.split("."))||[]);if(!n)throw new Error("Can't find Entity");return n}function T(e,t){var o;const n=(o=d(e,t,"Query").directives)==null?void 0:o.find(i=>i.name==="collection");if(!n)throw new Error("Can't generate List Query");return n.args}function N(e){return e.args?!e.args.find(t=>t.nonNull):!0}function Q(e){var t,r;return(r=(t=e.fields)==null?void 0:t.filter(n=>n.kind==="Scalar"||n.kind==="Enum"))==null?void 0:r.filter(N).map(n=>n.name)}function b(e){return Q(e).join(` | ||
`)}function k(e,t){var n;const r=d(e,t,"Mutation");return(n=F(e,"Mutation"))==null?void 0:n.fields.find(o=>o.typeName===r.typeName)}function U(e,t){const r=d(e,t,"Mutation");return b(r)}function C(e){const t=e.nonNull?"!":"",r=e.listNonNull?"!":"",n=e.list?`[${e.typeName}${t}${r}]`:`${e.typeName}${t}`;return`$${e.name}: ${n}`}function v(e){return e.length===0?"":`(${e.map(C).join(", ")})`}function E(e){return e.length===0?"":`(${e.map(t=>`${t.name}: $${t.name}`).join(", ")})`}function p(e,t,r){const{simplifiedEntities:n}=e,o=t.split("."),i=o.shift(),a=k(n,i);if(!a)throw new Error(`Can't generate ${r} Mutation`);const c=U(n,t),s="}".repeat(o.length-1),f=v(a.args),m=E(a.args),y=`${c||""} | ||
`,z="mutation",H=o[0];return` | ||
${z} ${i}${f} { | ||
${i}${m} { | ||
${H}{ | ||
${y} | ||
} | ||
} | ||
}${l} | ||
`.trim()}function P(e,t,r){var d;const n=r.split("."),i=n.shift(),o=u(e,i,"Mutation"),a=(d=m(e,"Mutation"))==null?void 0:d.fields.find(Q=>Q.typeName===o.typeName);if(!a)throw new Error("Can't generate Update Mutation");const c=u(e,r,"Mutation"),l="}".repeat(n.length-1),y=v(a.args),$=b(a.args),p=`${N(c)||""} | ||
`,F="mutation",h=n[0];return` | ||
${F} ${i}${y} { | ||
${i}${$} { | ||
${h}{ | ||
${p} | ||
} | ||
} | ||
}${l} | ||
`.trim()}function x(e,t,r){var d;const n=r.split("."),i=n.shift(),o=u(e,i,"Mutation"),a=(d=m(e,"Mutation"))==null?void 0:d.fields.find(Q=>Q.typeName===o.typeName);if(!a)throw new Error("Can't generate Delete Mutation");const c=u(e,r,"Mutation"),l="}".repeat(n.length-1),y=v(a.args),$=b(a.args),p=`${N(c)||""} | ||
`,F="mutation",h=n[0];return` | ||
${F} ${i}${y} { | ||
${i}${$} { | ||
${h}{ | ||
${p} | ||
} | ||
} | ||
}${l} | ||
`.trim()}function J(e,t){return D(e.simplifiedEntities,e.config.nodeRepresentatives,t)}function X(e,t){return P(e.simplifiedEntities,e.config.nodeRepresentatives,t)}function Y(e,t){return x(e.simplifiedEntities,e.config.nodeRepresentatives,t)}function Z(e,t){return k(e.simplifiedEntities,e.config.nodeRepresentatives,t)}function _(e,t){return H(e.simplifiedEntities,e.config.nodeRepresentatives,t)}function ee(e,t){return j(e.simplifiedEntities,e.config.nodeRepresentatives,t)}s.createMinimumQueryForList=_,s.createQueryForCreate=J,s.createQueryForDelete=Y,s.createQueryForList=Z,s.createQueryForShow=ee,s.createQueryForUpdate=X,s.getCreateQuery=D,s.getDeleteQuery=x,s.getListQuery=k,s.getShowQuery=j,s.getUpdateQuery=P,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})}); | ||
}${s} | ||
`.trim()}function w(e,t){var o;const r=(o=e==null?void 0:e.fields)==null?void 0:o.filter(i=>i.kind==="Scalar").map(i=>i.name);if(!r)throw new Error("Can't find relatedFields");const n=r.filter(i=>t.includes(i));return n.length===0?r[0]:n.join(` | ||
`)}function x(e,t){var r,n;return(n=(r=e.fields)==null?void 0:r.filter(o=>o.kind===t))==null?void 0:n.filter(N)}function L(e){return`{ | ||
${e} | ||
}`}function g(e,t){return`${e} ${L(t)}`}function M(e,t,r){const n=$(e,"typeName",r.typeName);return w(n,t)}function R(e,t,r){var n;return(n=x(t,"Object"))==null?void 0:n.map(o=>{const i=M(e,r,o);return g(o.name,i)})}function P(e,t,r){var n;return(n=R(e,t,r))==null?void 0:n.join(` | ||
`)}function D(e,t){return t.map(r=>$(e,"typeName",r))}function S(e,t,r){return w(t,r)}function V(e,t,r){const n=S(e,t,r);return g(`... on ${t.typeName}`,n)}function O(e,t,r){var n;return(n=x(t,"Union"))==null?void 0:n.map(o=>{const i=D(e,o.possibleTypes||[]).map(a=>V(e,a,r)).join(` | ||
`);return g(o.name,i)}).join(` | ||
`)}function W(e,t,r){var a,c;const n=t.split("."),o=n.pop(),i=d(e,n[0]?n.join("."):void 0,r);if(i.kind==="Object"||i.kind==="Interface")return(c=(a=i==null?void 0:i.fields)==null?void 0:a.find(s=>s.name===o))==null?void 0:c.args}function B(e,t,r,n,o){const i=r.split("."),a=i.pop(),c=e!=null&&e.fields?b(e):void 0,s=P(t,e,n),f=O(t,e,n),m=i.length-1>0?"}".repeat(i.length-1):"",y=W(t,r,o);return{dividedPath:i,name:a,fields:c,relatedObjectFields:s,relatedUnionFields:f,closingBraces:m,variableDeclaration:v(y),variableUsage:E(y)}}function j(e,t,r){const{simplifiedEntities:n,config:{nodeRepresentatives:o}}=e,i=T(n,t);if(!i)throw new Error("Can't generate List Query");const a=F(n,i.typeName);if(!a)throw new Error("Can't generate List Query");const c=B(a,n,t,o,"Query"),s=r(i,c,a);return{variables:c,fieldsBlock:s}}function q(e,t){const{config:{nodeRepresentatives:r}}=e,n=(a,c,s)=>{const f=Q(s).filter(m=>["id",...r].includes(m)).join(` | ||
`);return`${a.dataPath} { | ||
${f||""}}`},{variables:o,fieldsBlock:i}=j(e,t,n);return u(o,i,o.name.replace(/List$/,"MinimumList"))}function A(e,t){return p(e,t,"Create")}function G(e,t){return p(e,t,"Delete")}function I(e,t){const r=(i,a)=>`${i.dataPath} { | ||
${a.fields||""} | ||
${a.relatedObjectFields||""} | ||
${a.relatedUnionFields||""}} | ||
${i.totalPath}`,{variables:n,fieldsBlock:o}=j(e,t,r);return u(n,o,n.name)}function K(e,t){const{simplifiedEntities:r,config:{nodeRepresentatives:n}}=e,o=d(r,t,"Query");if(!o)throw new Error("Can't generate Show Query");const i=B(o,r,t,n,"Query"),a=`${i.fields||""} | ||
${i.relatedObjectFields||""} | ||
${i.relatedUnionFields||""}`;return u(i,a,i.name)}function _(e,t){return p(e,t,"Update")}l.createMinimumQueryForList=q,l.createQueryForCreate=A,l.createQueryForDelete=G,l.createQueryForList=I,l.createQueryForShow=K,l.createQueryForUpdate=_,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})}); | ||
//# sourceMappingURL=index.umd.js.map |
import type { DirectiveInfo, EnumSimplifiedEntityType, InputObjectSimplifiedEntityType, InterfaceSimplifiedEntityType, ObjectSimplifiedEntityType, ScalarSimplifiedEntityType, SimplifiedDirectiveType, SimplifiedEntityType, SimplifiedField, TypeNameAndDescriptionAndDirective, UnionSimplifiedEntityType } from './shared/base_type'; | ||
export type { DirectiveInfo, EnumSimplifiedEntityType, InputObjectSimplifiedEntityType, InterfaceSimplifiedEntityType, ObjectSimplifiedEntityType, ScalarSimplifiedEntityType, SimplifiedDirectiveType, SimplifiedEntityType, SimplifiedField, TypeNameAndDescriptionAndDirective, UnionSimplifiedEntityType, }; | ||
export type Arg = { | ||
name: string; | ||
nonNull: boolean; | ||
listNonNull?: boolean; | ||
typeName: string; | ||
list: boolean; | ||
}; | ||
export type Variables = { | ||
dividedPath: string[]; | ||
name: string; | ||
closingBraces: string; | ||
variableDeclaration: string; | ||
variableUsage: string; | ||
fields: string | undefined; | ||
relatedObjectFields: string | undefined; | ||
relatedUnionFields: string | undefined; | ||
}; | ||
export type Params = { | ||
simplifiedEntities: SimplifiedEntityType[]; | ||
config: { | ||
nodeRepresentatives: Array<string>; | ||
}; | ||
}; | ||
//# sourceMappingURL=types.d.ts.map |
{ | ||
"name": "@theconcurrent/query", | ||
"version": "0.0.12", | ||
"version": "0.0.13", | ||
"main": "./dist/index.umd.js", | ||
@@ -26,3 +26,3 @@ "module": "./dist/index.es.js", | ||
], | ||
"gitHead": "624bd9aa25c3c824a06de9760d4e500ddeca10d1" | ||
"gitHead": "39ad5e218bd817ecd0c25aa47e23f378201465f7" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
102403
56
642
1