@theconcurrent/utility
Advanced tools
Comparing version 0.0.29 to 0.0.30
@@ -1,2 +0,2 @@ | ||
(function(r,f){typeof exports=="object"&&typeof module!="undefined"?f(exports,require("graphql")):typeof define=="function"&&define.amd?define(["exports","graphql"],f):(r=typeof globalThis!="undefined"?globalThis:r||self,f(r["@theconcurrent/utility"]={},r.graphql))})(this,function(r,f){"use strict";function s(e,t,i){return e.find(n=>n[t]===i)}function d(e,t){return e.filter(i=>t in i)}function p(e,t,i){return e.sort((n,u)=>{const o=t.indexOf(String(n[i])),y=t.indexOf(String(u[i]));return o===-1?1:y===-1?-1:o-y})}function T(e){const t=e==null?void 0:e.find(i=>i.name==="model");if(t)return t.args.displayColumns}function g(e){var t,i;return((i=(t=e==null?void 0:e.find(n=>n.name==="label"))==null?void 0:t.args)==null?void 0:i.name)||void 0}function B(e){const t=e==null?void 0:e.find(i=>i.name==="model");if(t)return t.args.representative}function N(e){var t,i;return((i=(t=e==null?void 0:e.find(n=>n.name==="specifiedBy"))==null?void 0:t.args)==null?void 0:i.url)||void 0}function a(e,t){return s(e,"typeName",t)}function m(e,t,i){var c;const n=a(e,t);if(!n||n.kind!=="Object"||!n.fields)return;if(i.length===0)return n;const[u,...o]=i,y=(c=n.fields.find(j=>j.name===u))==null?void 0:c.typeName;if(y)return m(e,y,o)}function l(e,t,i,n=[],u){if(u<0)return;const o=a(e,t);if(!(!o||n.includes(t))&&(n.push(t),!(o.kind!=="Object"||!o.fields)))for(const y of o.fields){if(y.typeName===i)return y.name;const c=l(e,y.typeName,i,n,u-1);if(c)return`${y.name}.${c}`}}function h(e,t,i,n){const u=l(e,t,i,[],0);if(u)return`${n}${u}`}function E(e,t){return e.find(i=>{var n;return(n=i.directives)==null?void 0:n.find(u=>u.name===t)})}function F(e,t){return e.filter(i=>{var n;return(n=i.directives)==null?void 0:n.find(u=>u.name===t)})||[]}function v(e,t){const i=t.split(".");if(i[0]!==e.name)return null;let n=e;for(const u of i.slice(1)){if(!n||!n.fields)return null;const o=n.fields.find(y=>y.name===u);if(!o)return null;n=o}return n}function P(e,t){const i=t.split(".");let n=e;return i.forEach(u=>{typeof n=="object"&&n!==null&&u in n?n=n[u]:n=null}),n}function S(e){return f.isEnumType(e.type)||f.isNonNullType(e.type)&&f.isEnumType(e.type.ofType)}function I(e){return f.isListType(e.type)||f.isNonNullType(e.type)&&f.isListType(e.type.ofType)}function L(e){return!!(f.isScalarType(e.type)||f.isNonNullType(e.type)&&(f.isScalarType(e.type.ofType)||f.isListType(e.type.ofType)&&(f.isScalarType(e.type.ofType.ofType)||f.isNonNullType(e.type.ofType.ofType)&&f.isScalarType(e.type.ofType.ofType.ofType))))}function b(e){return e.charAt(0).toLowerCase()+e.slice(1)}function O(e,t){return e.replace(/\${(.*?)}/g,(i,n)=>n.split(".").reduce((u,o)=>typeof u=="object"&&u!==null&&o in u?u[o]:i,t))}r.checkIsEnum=S,r.checkIsList=I,r.checkIsScalar=L,r.filterEntitiesByDirectiveName=F,r.findEntityByDirectiveName=E,r.findEntityFromPath=m,r.findPathToEntity=l,r.findValue=P,r.generatePath=h,r.getDisplayColumnsFromDirectives=T,r.getEntityByName=a,r.getField=v,r.getItemByKeyAndValue=s,r.getItemsByHavingKey=d,r.getLabelFromDirectives=g,r.getRepresentativeFromDirectives=B,r.getSpecifiedByFromDirectives=N,r.lowercaseFirstLetter=b,r.simpleTemplateEngine=O,r.sortDataByOrder=p,Object.defineProperty(r,Symbol.toStringTag,{value:"Module"})}); | ||
(function(r,u){typeof exports=="object"&&typeof module!="undefined"?u(exports,require("graphql")):typeof define=="function"&&define.amd?define(["exports","graphql"],u):(r=typeof globalThis!="undefined"?globalThis:r||self,u(r["@theconcurrent/utility"]={},r.graphql))})(this,function(r,u){"use strict";function l(n,e,i){return n.find(t=>t[e]===i)}function d(n,e){return n.filter(i=>e in i)}function p(n,e,i){return n.sort((t,o)=>{const c=e.indexOf(String(t[i])),f=e.indexOf(String(o[i]));return c===-1?1:f===-1?-1:c-f})}function g(n){const e=n==null?void 0:n.find(i=>i.name==="model");if(e)return e.args.displayColumns}function T(n){var e,i;return((i=(e=n==null?void 0:n.find(t=>t.name==="label"))==null?void 0:e.args)==null?void 0:i.name)||void 0}function A(n){const e=n==null?void 0:n.find(i=>i.name==="model");if(e)return e.args.representative}function F(n){var e,i;return((i=(e=n==null?void 0:n.find(t=>t.name==="specifiedBy"))==null?void 0:e.args)==null?void 0:i.url)||void 0}function y(n,e){return l(n,"typeName",e)}function m(n,e,i){var a;const t=y(n,e);if(!t||t.kind!=="Object"||!t.fields)return;if(i.length===0)return t;const[o,...c]=i,f=(a=t.fields.find(k=>k.name===o))==null?void 0:a.typeName;if(f)return m(n,f,c)}function s(n,e,i,t=[],o){if(o<0)return;const c=y(n,e);if(!(!c||t.includes(e))&&(t.push(e),!(c.kind!=="Object"||!c.fields)))for(const f of c.fields){if(f.typeName===i)return f.name;const a=s(n,f.typeName,i,t,o-1);if(a)return`${f.name}.${a}`}}function h(n,e,i,t){const o=s(n,e,i,[],0);if(o)return`${t}${o}`}function B(n,e){return n.find(i=>{var t;return(t=i.directives)==null?void 0:t.find(o=>o.name===e)})}function N(n,e){return n.filter(i=>{var t;return(t=i.directives)==null?void 0:t.find(o=>o.name===e)})||[]}function E(n,e){const i=e.split(".");if(i[0]!==n.name)return null;let t=n;for(const o of i.slice(1)){if(!t||!t.fields)return null;const c=t.fields.find(f=>f.name===o);if(!c)return null;t=c}return t}function S(n,e){const i=e.split(".");let t=n;return i.forEach(o=>{typeof t=="object"&&t!==null&&o in t?t=t[o]:t=null}),t}function v(n){return u.isEnumType(n.type)||u.isNonNullType(n.type)&&u.isEnumType(n.type.ofType)}function L(n){return u.isListType(n.type)||u.isNonNullType(n.type)&&u.isListType(n.type.ofType)}function P(n){return!!(u.isScalarType(n.type)||u.isNonNullType(n.type)&&(u.isScalarType(n.type.ofType)||u.isListType(n.type.ofType)&&(u.isScalarType(n.type.ofType.ofType)||u.isNonNullType(n.type.ofType.ofType)&&u.isScalarType(n.type.ofType.ofType.ofType))))}function I(n){return n.charAt(0).toLowerCase()+n.slice(1)}function b(n,e){return n.replace(/\${(.*?)}/g,(i,t)=>t.split(".").reduce((o,c)=>typeof o=="object"&&o!==null&&c in o?o[c]:i,e))}function D(n){return n.find(e=>e.action==="create")}function O(n){return n.find(e=>e.action==="list")}function j(n){return n.find(e=>e.action==="update")}function w(n){return n.find(e=>e.action==="show")}function C(n){return n.find(e=>e.action==="delete")}r.checkIsEnum=v,r.checkIsList=L,r.checkIsScalar=P,r.filterEntitiesByDirectiveName=N,r.findEntityByDirectiveName=B,r.findEntityFromPath=m,r.findPathToEntity=s,r.findValue=S,r.generatePath=h,r.getCreateActionFromActions=D,r.getDeleteActionFromActions=C,r.getDisplayColumnsFromDirectives=g,r.getEntityByName=y,r.getField=E,r.getItemByKeyAndValue=l,r.getItemsByHavingKey=d,r.getLabelFromDirectives=T,r.getListActionFromActions=O,r.getRepresentativeFromDirectives=A,r.getShowActionFromActions=w,r.getSpecifiedByFromDirectives=F,r.getUpdateActionFromActions=j,r.lowercaseFirstLetter=I,r.simpleTemplateEngine=b,r.sortDataByOrder=p,Object.defineProperty(r,Symbol.toStringTag,{value:"Module"})}); | ||
//# sourceMappingURL=index.umd.js.map |
@@ -9,2 +9,3 @@ import { getItemByKeyAndValue, getItemsByHavingKey, sortDataByOrder } from './dictionaryArray'; | ||
import simpleTemplateEngine from './simpleTemplateEngine'; | ||
import { getCreateActionFromActions, getDeleteActionFromActions, getListActionFromActions, getShowActionFromActions, getUpdateActionFromActions } from './actions'; | ||
export { getItemByKeyAndValue, getItemsByHavingKey, sortDataByOrder }; | ||
@@ -18,2 +19,3 @@ export { getDisplayColumnsFromDirectives, getLabelFromDirectives, getRepresentativeFromDirectives, getSpecifiedByFromDirectives, }; | ||
export { simpleTemplateEngine }; | ||
export { getCreateActionFromActions, getDeleteActionFromActions, getListActionFromActions, getShowActionFromActions, getUpdateActionFromActions, }; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,11 +0,11 @@ | ||
import { isEnumType as y, isNonNullType as p, isListType as c, isScalarType as a } from "graphql"; | ||
function d(n, e, r) { | ||
return n.find((t) => t[e] === r); | ||
import { isEnumType as y, isNonNullType as a, isListType as p, isScalarType as c } from "graphql"; | ||
function d(n, t, r) { | ||
return n.find((e) => e[t] === r); | ||
} | ||
function h(n, e) { | ||
return n.filter((r) => e in r); | ||
function h(n, t) { | ||
return n.filter((r) => t in r); | ||
} | ||
function B(n, e, r) { | ||
return n.sort((t, i) => { | ||
const o = e.indexOf(String(t[r])), u = e.indexOf(String(i[r])); | ||
function A(n, t, r) { | ||
return n.sort((e, i) => { | ||
const o = t.indexOf(String(e[r])), u = t.indexOf(String(i[r])); | ||
return o === -1 ? 1 : u === -1 ? -1 : o - u; | ||
@@ -15,30 +15,30 @@ }); | ||
function F(n) { | ||
const e = n == null ? void 0 : n.find((r) => r.name === "model"); | ||
if (e) | ||
return e.args.displayColumns; | ||
const t = n == null ? void 0 : n.find((r) => r.name === "model"); | ||
if (t) | ||
return t.args.displayColumns; | ||
} | ||
function B(n) { | ||
var t, r; | ||
return ((r = (t = n == null ? void 0 : n.find((e) => e.name === "label")) == null ? void 0 : t.args) == null ? void 0 : r.name) || void 0; | ||
} | ||
function P(n) { | ||
var e, r; | ||
return ((r = (e = n == null ? void 0 : n.find((t) => t.name === "label")) == null ? void 0 : e.args) == null ? void 0 : r.name) || void 0; | ||
const t = n == null ? void 0 : n.find((r) => r.name === "model"); | ||
if (t) | ||
return t.args.representative; | ||
} | ||
function E(n) { | ||
const e = n == null ? void 0 : n.find((r) => r.name === "model"); | ||
if (e) | ||
return e.args.representative; | ||
var t, r; | ||
return ((r = (t = n == null ? void 0 : n.find((e) => e.name === "specifiedBy")) == null ? void 0 : t.args) == null ? void 0 : r.url) || void 0; | ||
} | ||
function N(n) { | ||
var e, r; | ||
return ((r = (e = n == null ? void 0 : n.find((t) => t.name === "specifiedBy")) == null ? void 0 : e.args) == null ? void 0 : r.url) || void 0; | ||
function l(n, t) { | ||
return d(n, "typeName", t); | ||
} | ||
function l(n, e) { | ||
return d(n, "typeName", e); | ||
} | ||
function g(n, e, r) { | ||
function g(n, t, r) { | ||
var f; | ||
const t = l(n, e); | ||
if (!t || t.kind !== "Object" || !t.fields) | ||
const e = l(n, t); | ||
if (!e || e.kind !== "Object" || !e.fields) | ||
return; | ||
if (r.length === 0) | ||
return t; | ||
const [i, ...o] = r, u = (f = t.fields.find( | ||
return e; | ||
const [i, ...o] = r, u = (f = e.fields.find( | ||
(m) => m.name === i | ||
@@ -49,7 +49,7 @@ )) == null ? void 0 : f.typeName; | ||
} | ||
function s(n, e, r, t = [], i) { | ||
function s(n, t, r, e = [], i) { | ||
if (i < 0) | ||
return; | ||
const o = l(n, e); | ||
if (!(!o || t.includes(e)) && (t.push(e), !(o.kind !== "Object" || !o.fields))) | ||
const o = l(n, t); | ||
if (!(!o || e.includes(t)) && (e.push(t), !(o.kind !== "Object" || !o.fields))) | ||
for (const u of o.fields) { | ||
@@ -62,3 +62,3 @@ if (u.typeName === r) | ||
r, | ||
t, | ||
e, | ||
i - 1 | ||
@@ -70,49 +70,49 @@ ); | ||
} | ||
function b(n, e, r, t) { | ||
const i = s(n, e, r, [], 0); | ||
function N(n, t, r, e) { | ||
const i = s(n, t, r, [], 0); | ||
if (i) | ||
return `${t}${i}`; | ||
return `${e}${i}`; | ||
} | ||
function x(n, e) { | ||
function b(n, t) { | ||
return n.find((r) => { | ||
var t; | ||
return (t = r.directives) == null ? void 0 : t.find((i) => i.name === e); | ||
var e; | ||
return (e = r.directives) == null ? void 0 : e.find((i) => i.name === t); | ||
}); | ||
} | ||
function A(n, e) { | ||
function x(n, t) { | ||
return n.filter((r) => { | ||
var t; | ||
return (t = r.directives) == null ? void 0 : t.find((i) => i.name === e); | ||
var e; | ||
return (e = r.directives) == null ? void 0 : e.find((i) => i.name === t); | ||
}) || []; | ||
} | ||
function I(n, e) { | ||
const r = e.split("."); | ||
function L(n, t) { | ||
const r = t.split("."); | ||
if (r[0] !== n.name) | ||
return null; | ||
let t = n; | ||
let e = n; | ||
for (const i of r.slice(1)) { | ||
if (!t || !t.fields) | ||
if (!e || !e.fields) | ||
return null; | ||
const o = t.fields.find((u) => u.name === i); | ||
const o = e.fields.find((u) => u.name === i); | ||
if (!o) | ||
return null; | ||
t = o; | ||
e = o; | ||
} | ||
return t; | ||
return e; | ||
} | ||
function L(n, e) { | ||
const r = e.split("."); | ||
let t = n; | ||
function S(n, t) { | ||
const r = t.split("."); | ||
let e = n; | ||
return r.forEach((i) => { | ||
typeof t == "object" && t !== null && i in t ? t = t[i] : t = null; | ||
}), t; | ||
typeof e == "object" && e !== null && i in e ? e = e[i] : e = null; | ||
}), e; | ||
} | ||
function I(n) { | ||
return y(n.type) || a(n.type) && y(n.type.ofType); | ||
} | ||
function O(n) { | ||
return y(n.type) || p(n.type) && y(n.type.ofType); | ||
return p(n.type) || a(n.type) && p(n.type.ofType); | ||
} | ||
function S(n) { | ||
return c(n.type) || p(n.type) && c(n.type.ofType); | ||
} | ||
function $(n) { | ||
return !!(a(n.type) || p(n.type) && (a(n.type.ofType) || c(n.type.ofType) && (a(n.type.ofType.ofType) || p(n.type.ofType.ofType) && a(n.type.ofType.ofType.ofType)))); | ||
return !!(c(n.type) || a(n.type) && (c(n.type.ofType) || p(n.type.ofType) && (c(n.type.ofType.ofType) || a(n.type.ofType.ofType) && c(n.type.ofType.ofType.ofType)))); | ||
} | ||
@@ -122,8 +122,8 @@ function j(n) { | ||
} | ||
function v(n, e) { | ||
function v(n, t) { | ||
return n.replace( | ||
/\${(.*?)}/g, | ||
(r, t) => ( | ||
(r, e) => ( | ||
// eslint-disable-next-line | ||
t.split(".").reduce((i, o) => typeof i == "object" && i !== null && o in i ? i[o] : r, e) | ||
e.split(".").reduce((i, o) => typeof i == "object" && i !== null && o in i ? i[o] : r, t) | ||
) | ||
@@ -133,24 +133,44 @@ // 'as any'は、dataに適切な型を与えることで除去することができます。 | ||
} | ||
function w(n) { | ||
return n.find((t) => t.action === "create"); | ||
} | ||
function C(n) { | ||
return n.find((t) => t.action === "list"); | ||
} | ||
function k(n) { | ||
return n.find((t) => t.action === "update"); | ||
} | ||
function K(n) { | ||
return n.find((t) => t.action === "show"); | ||
} | ||
function V(n) { | ||
return n.find((t) => t.action === "delete"); | ||
} | ||
export { | ||
O as checkIsEnum, | ||
S as checkIsList, | ||
I as checkIsEnum, | ||
O as checkIsList, | ||
$ as checkIsScalar, | ||
A as filterEntitiesByDirectiveName, | ||
x as findEntityByDirectiveName, | ||
x as filterEntitiesByDirectiveName, | ||
b as findEntityByDirectiveName, | ||
g as findEntityFromPath, | ||
s as findPathToEntity, | ||
L as findValue, | ||
b as generatePath, | ||
S as findValue, | ||
N as generatePath, | ||
w as getCreateActionFromActions, | ||
V as getDeleteActionFromActions, | ||
F as getDisplayColumnsFromDirectives, | ||
l as getEntityByName, | ||
I as getField, | ||
L as getField, | ||
d as getItemByKeyAndValue, | ||
h as getItemsByHavingKey, | ||
P as getLabelFromDirectives, | ||
E as getRepresentativeFromDirectives, | ||
N as getSpecifiedByFromDirectives, | ||
B as getLabelFromDirectives, | ||
C as getListActionFromActions, | ||
P as getRepresentativeFromDirectives, | ||
K as getShowActionFromActions, | ||
E as getSpecifiedByFromDirectives, | ||
k as getUpdateActionFromActions, | ||
j as lowercaseFirstLetter, | ||
v as simpleTemplateEngine, | ||
B as sortDataByOrder | ||
A as sortDataByOrder | ||
}; | ||
//# sourceMappingURL=index.es.js.map |
@@ -1,2 +0,2 @@ | ||
(function(r,f){typeof exports=="object"&&typeof module!="undefined"?f(exports,require("graphql")):typeof define=="function"&&define.amd?define(["exports","graphql"],f):(r=typeof globalThis!="undefined"?globalThis:r||self,f(r["@theconcurrent/utility"]={},r.graphql))})(this,function(r,f){"use strict";function s(e,t,i){return e.find(n=>n[t]===i)}function d(e,t){return e.filter(i=>t in i)}function p(e,t,i){return e.sort((n,u)=>{const o=t.indexOf(String(n[i])),y=t.indexOf(String(u[i]));return o===-1?1:y===-1?-1:o-y})}function T(e){const t=e==null?void 0:e.find(i=>i.name==="model");if(t)return t.args.displayColumns}function g(e){var t,i;return((i=(t=e==null?void 0:e.find(n=>n.name==="label"))==null?void 0:t.args)==null?void 0:i.name)||void 0}function B(e){const t=e==null?void 0:e.find(i=>i.name==="model");if(t)return t.args.representative}function N(e){var t,i;return((i=(t=e==null?void 0:e.find(n=>n.name==="specifiedBy"))==null?void 0:t.args)==null?void 0:i.url)||void 0}function a(e,t){return s(e,"typeName",t)}function m(e,t,i){var c;const n=a(e,t);if(!n||n.kind!=="Object"||!n.fields)return;if(i.length===0)return n;const[u,...o]=i,y=(c=n.fields.find(j=>j.name===u))==null?void 0:c.typeName;if(y)return m(e,y,o)}function l(e,t,i,n=[],u){if(u<0)return;const o=a(e,t);if(!(!o||n.includes(t))&&(n.push(t),!(o.kind!=="Object"||!o.fields)))for(const y of o.fields){if(y.typeName===i)return y.name;const c=l(e,y.typeName,i,n,u-1);if(c)return`${y.name}.${c}`}}function h(e,t,i,n){const u=l(e,t,i,[],0);if(u)return`${n}${u}`}function E(e,t){return e.find(i=>{var n;return(n=i.directives)==null?void 0:n.find(u=>u.name===t)})}function F(e,t){return e.filter(i=>{var n;return(n=i.directives)==null?void 0:n.find(u=>u.name===t)})||[]}function v(e,t){const i=t.split(".");if(i[0]!==e.name)return null;let n=e;for(const u of i.slice(1)){if(!n||!n.fields)return null;const o=n.fields.find(y=>y.name===u);if(!o)return null;n=o}return n}function P(e,t){const i=t.split(".");let n=e;return i.forEach(u=>{typeof n=="object"&&n!==null&&u in n?n=n[u]:n=null}),n}function S(e){return f.isEnumType(e.type)||f.isNonNullType(e.type)&&f.isEnumType(e.type.ofType)}function I(e){return f.isListType(e.type)||f.isNonNullType(e.type)&&f.isListType(e.type.ofType)}function L(e){return!!(f.isScalarType(e.type)||f.isNonNullType(e.type)&&(f.isScalarType(e.type.ofType)||f.isListType(e.type.ofType)&&(f.isScalarType(e.type.ofType.ofType)||f.isNonNullType(e.type.ofType.ofType)&&f.isScalarType(e.type.ofType.ofType.ofType))))}function b(e){return e.charAt(0).toLowerCase()+e.slice(1)}function O(e,t){return e.replace(/\${(.*?)}/g,(i,n)=>n.split(".").reduce((u,o)=>typeof u=="object"&&u!==null&&o in u?u[o]:i,t))}r.checkIsEnum=S,r.checkIsList=I,r.checkIsScalar=L,r.filterEntitiesByDirectiveName=F,r.findEntityByDirectiveName=E,r.findEntityFromPath=m,r.findPathToEntity=l,r.findValue=P,r.generatePath=h,r.getDisplayColumnsFromDirectives=T,r.getEntityByName=a,r.getField=v,r.getItemByKeyAndValue=s,r.getItemsByHavingKey=d,r.getLabelFromDirectives=g,r.getRepresentativeFromDirectives=B,r.getSpecifiedByFromDirectives=N,r.lowercaseFirstLetter=b,r.simpleTemplateEngine=O,r.sortDataByOrder=p,Object.defineProperty(r,Symbol.toStringTag,{value:"Module"})}); | ||
(function(r,u){typeof exports=="object"&&typeof module!="undefined"?u(exports,require("graphql")):typeof define=="function"&&define.amd?define(["exports","graphql"],u):(r=typeof globalThis!="undefined"?globalThis:r||self,u(r["@theconcurrent/utility"]={},r.graphql))})(this,function(r,u){"use strict";function l(n,e,i){return n.find(t=>t[e]===i)}function d(n,e){return n.filter(i=>e in i)}function p(n,e,i){return n.sort((t,o)=>{const c=e.indexOf(String(t[i])),f=e.indexOf(String(o[i]));return c===-1?1:f===-1?-1:c-f})}function g(n){const e=n==null?void 0:n.find(i=>i.name==="model");if(e)return e.args.displayColumns}function T(n){var e,i;return((i=(e=n==null?void 0:n.find(t=>t.name==="label"))==null?void 0:e.args)==null?void 0:i.name)||void 0}function A(n){const e=n==null?void 0:n.find(i=>i.name==="model");if(e)return e.args.representative}function F(n){var e,i;return((i=(e=n==null?void 0:n.find(t=>t.name==="specifiedBy"))==null?void 0:e.args)==null?void 0:i.url)||void 0}function y(n,e){return l(n,"typeName",e)}function m(n,e,i){var a;const t=y(n,e);if(!t||t.kind!=="Object"||!t.fields)return;if(i.length===0)return t;const[o,...c]=i,f=(a=t.fields.find(k=>k.name===o))==null?void 0:a.typeName;if(f)return m(n,f,c)}function s(n,e,i,t=[],o){if(o<0)return;const c=y(n,e);if(!(!c||t.includes(e))&&(t.push(e),!(c.kind!=="Object"||!c.fields)))for(const f of c.fields){if(f.typeName===i)return f.name;const a=s(n,f.typeName,i,t,o-1);if(a)return`${f.name}.${a}`}}function h(n,e,i,t){const o=s(n,e,i,[],0);if(o)return`${t}${o}`}function B(n,e){return n.find(i=>{var t;return(t=i.directives)==null?void 0:t.find(o=>o.name===e)})}function N(n,e){return n.filter(i=>{var t;return(t=i.directives)==null?void 0:t.find(o=>o.name===e)})||[]}function E(n,e){const i=e.split(".");if(i[0]!==n.name)return null;let t=n;for(const o of i.slice(1)){if(!t||!t.fields)return null;const c=t.fields.find(f=>f.name===o);if(!c)return null;t=c}return t}function S(n,e){const i=e.split(".");let t=n;return i.forEach(o=>{typeof t=="object"&&t!==null&&o in t?t=t[o]:t=null}),t}function v(n){return u.isEnumType(n.type)||u.isNonNullType(n.type)&&u.isEnumType(n.type.ofType)}function L(n){return u.isListType(n.type)||u.isNonNullType(n.type)&&u.isListType(n.type.ofType)}function P(n){return!!(u.isScalarType(n.type)||u.isNonNullType(n.type)&&(u.isScalarType(n.type.ofType)||u.isListType(n.type.ofType)&&(u.isScalarType(n.type.ofType.ofType)||u.isNonNullType(n.type.ofType.ofType)&&u.isScalarType(n.type.ofType.ofType.ofType))))}function I(n){return n.charAt(0).toLowerCase()+n.slice(1)}function b(n,e){return n.replace(/\${(.*?)}/g,(i,t)=>t.split(".").reduce((o,c)=>typeof o=="object"&&o!==null&&c in o?o[c]:i,e))}function D(n){return n.find(e=>e.action==="create")}function O(n){return n.find(e=>e.action==="list")}function j(n){return n.find(e=>e.action==="update")}function w(n){return n.find(e=>e.action==="show")}function C(n){return n.find(e=>e.action==="delete")}r.checkIsEnum=v,r.checkIsList=L,r.checkIsScalar=P,r.filterEntitiesByDirectiveName=N,r.findEntityByDirectiveName=B,r.findEntityFromPath=m,r.findPathToEntity=s,r.findValue=S,r.generatePath=h,r.getCreateActionFromActions=D,r.getDeleteActionFromActions=C,r.getDisplayColumnsFromDirectives=g,r.getEntityByName=y,r.getField=E,r.getItemByKeyAndValue=l,r.getItemsByHavingKey=d,r.getLabelFromDirectives=T,r.getListActionFromActions=O,r.getRepresentativeFromDirectives=A,r.getShowActionFromActions=w,r.getSpecifiedByFromDirectives=F,r.getUpdateActionFromActions=j,r.lowercaseFirstLetter=I,r.simpleTemplateEngine=b,r.sortDataByOrder=p,Object.defineProperty(r,Symbol.toStringTag,{value:"Module"})}); | ||
//# sourceMappingURL=index.umd.js.map |
@@ -70,2 +70,39 @@ import type { DocumentNode } from 'graphql'; | ||
}; | ||
export type InputField = { | ||
name: string; | ||
typeName: string; | ||
description: Description; | ||
kind: 'Object' | 'Scalar' | 'Enum' | 'InputObject' | 'Union' | 'Interface'; | ||
isNonNull: boolean; | ||
isListNonNull?: boolean; | ||
isList: boolean; | ||
isEnum: boolean; | ||
possibleTypes?: Array<string>; | ||
args?: Array<InputField>; | ||
directives?: Array<DirectiveInfo>; | ||
}; | ||
export type ScalarDefinitionObject = { | ||
typeName: TypeName; | ||
description: Description; | ||
directives: DirectiveInfo[] | undefined; | ||
}; | ||
export type InputObjectDefinitionObject = { | ||
inputFields: Array<InputField>; | ||
typeName: TypeName; | ||
description: Description; | ||
directives: DirectiveInfo[] | undefined; | ||
}; | ||
export type EnumDefinitionObject = { | ||
enumValues: Array<SimplifiedEnumValue>; | ||
typeName: TypeName; | ||
description: Description; | ||
directives: DirectiveInfo[] | undefined; | ||
}; | ||
export type VariableObject = { | ||
typeName: TypeName; | ||
description: Description; | ||
directives: DirectiveInfo[] | undefined; | ||
inputFields: Array<InputField> | undefined; | ||
enumValues: Array<SimplifiedEnumValue> | undefined; | ||
}; | ||
export type VariableDefinitionObject = { | ||
@@ -75,3 +112,5 @@ name: string; | ||
isNonNull: boolean; | ||
variable: ScalarSimplifiedEntityType | InputObjectSimplifiedEntityType | EnumSimplifiedEntityType; | ||
isScalar: boolean; | ||
isEnum: boolean; | ||
variable: VariableObject; | ||
}; | ||
@@ -124,2 +163,52 @@ type FieldCommon = { | ||
}; | ||
export type ActionCreate = { | ||
action: 'create'; | ||
queries: Array<RawQuery>; | ||
responseDataPath: { | ||
data: string; | ||
}; | ||
fields: Array<ResourceActionField>; | ||
variableDefinitionObjects: VariableDefinitionObject[]; | ||
input: InputObjectSimplifiedEntityType; | ||
}; | ||
export type ActionUpdate = { | ||
action: 'update'; | ||
queries: Array<RawQuery>; | ||
responseDataPath: { | ||
data: string; | ||
}; | ||
fields: Array<ResourceActionField>; | ||
variableDefinitionObjects: VariableDefinitionObject[]; | ||
input: InputObjectSimplifiedEntityType; | ||
}; | ||
export type ActionList = { | ||
action: 'list'; | ||
path: string; | ||
queries: Array<RawQuery>; | ||
responseDataPath: { | ||
data: string; | ||
total: string; | ||
}; | ||
displayColumns?: string[]; | ||
filter: VariableDefinitionObject | undefined; | ||
fields: Array<ResourceActionField>; | ||
}; | ||
export type ActionShow = { | ||
action: 'show'; | ||
path: string; | ||
queries: Array<RawQuery>; | ||
responseDataPath: { | ||
data: string; | ||
}; | ||
removingTabs?: string[]; | ||
fields: Array<ResourceActionField>; | ||
}; | ||
export type ActionDelete = { | ||
action: 'delete'; | ||
queries: Array<RawQuery>; | ||
responseDataPath: { | ||
data: string; | ||
}; | ||
}; | ||
export type Action = ActionCreate | ActionUpdate | ActionList | ActionShow | ActionDelete; | ||
export type FinalResource = { | ||
@@ -131,48 +220,65 @@ name: string; | ||
category: string | undefined; | ||
create?: { | ||
queries: Array<RawQuery>; | ||
responseDataPath: { | ||
data: string; | ||
}; | ||
fields: Array<ResourceActionField>; | ||
variableDefinitionObjects: VariableDefinitionObject[]; | ||
relations: Array<Relation>; | ||
representative: string; | ||
actions: Action[]; | ||
}; | ||
export type InitialRawQuery = { | ||
name: string; | ||
gql?: DocumentNode; | ||
queryString?: string; | ||
}; | ||
export type InitialActionCreate = { | ||
action: 'create'; | ||
path?: string; | ||
queries?: Array<InitialRawQuery>; | ||
responseDataPath?: { | ||
data: string; | ||
}; | ||
update?: { | ||
queries: Array<RawQuery>; | ||
responseDataPath: { | ||
data: string; | ||
}; | ||
fields: Array<ResourceActionField>; | ||
variableDefinitionObjects: VariableDefinitionObject[]; | ||
}; | ||
export type InitialActionUpdate = { | ||
action: 'update'; | ||
path?: string; | ||
queries?: Array<InitialRawQuery>; | ||
responseDataPath?: { | ||
data: string; | ||
}; | ||
list?: { | ||
queries: Array<RawQuery>; | ||
responseDataPath: { | ||
data: string; | ||
total: string; | ||
}; | ||
fields: Array<ResourceActionField>; | ||
variablesStructure?: VariableDefinitionObject[]; | ||
path: string; | ||
displayColumns?: string[]; | ||
}; | ||
export type InitialActionList = { | ||
action: 'list'; | ||
path?: string; | ||
queries?: Array<InitialRawQuery>; | ||
responseDataPath?: { | ||
data: string; | ||
total: string; | ||
}; | ||
show?: { | ||
queries: Array<RawQuery>; | ||
responseDataPath: { | ||
data: string; | ||
}; | ||
fields: Array<ResourceActionField>; | ||
variablesStructure?: VariableDefinitionObject[]; | ||
path: string; | ||
removingTabs?: string[]; | ||
displayColumns?: string[]; | ||
}; | ||
export type InitialActionShow = { | ||
action: 'show'; | ||
path?: string; | ||
queries?: Array<InitialRawQuery>; | ||
responseDataPath?: { | ||
data: string; | ||
}; | ||
delete?: { | ||
queries: Array<RawQuery>; | ||
responseDataPath: { | ||
data: string; | ||
}; | ||
removingTabs?: string[]; | ||
}; | ||
export type InitialActionDelete = { | ||
action: 'delete'; | ||
path?: string; | ||
queries?: Array<RawQuery>; | ||
responseDataPath?: { | ||
data: string; | ||
}; | ||
relations: Array<Relation>; | ||
}; | ||
export type InitialActions = InitialActionCreate | InitialActionUpdate | InitialActionList | InitialActionShow | InitialActionDelete; | ||
export type InitialResource = { | ||
name: string; | ||
label?: string; | ||
skipMenu?: boolean; | ||
schemeResourceName?: string; | ||
category?: string; | ||
actions?: InitialActions[]; | ||
additionalRelations?: Array<Relation>; | ||
}; | ||
export {}; | ||
//# sourceMappingURL=base_type.d.ts.map |
@@ -1,3 +0,3 @@ | ||
import type { SimplifiedEntityType, FieldObject } from './shared/base_type'; | ||
export type { SimplifiedEntityType, FieldObject }; | ||
import type { ActionCreate, ActionDelete, ActionList, ActionShow, ActionUpdate, FieldObject, FinalResource, SimplifiedEntityType } from './shared/base_type'; | ||
export type { ActionCreate, ActionDelete, ActionList, ActionShow, ActionUpdate, FieldObject, FinalResource, SimplifiedEntityType, }; | ||
//# sourceMappingURL=type.d.ts.map |
{ | ||
"name": "@theconcurrent/utility", | ||
"version": "0.0.29", | ||
"version": "0.0.30", | ||
"main": "./dist/index.umd.js", | ||
@@ -29,3 +29,3 @@ "module": "./dist/index.es.js", | ||
}, | ||
"gitHead": "20a0ac17e76087beeab1c2808f709a412b4060e6" | ||
"gitHead": "8906fd7a93e7dbbc1cc2c25602720ab54dcd1105" | ||
} |
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
Sorry, the diff of this file is not supported yet
78775
64
607