You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP
Socket
Sign inDemoInstall
Socket

@solidlab/sdx

Package Overview
Dependencies
Maintainers
6
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@solidlab/sdx - npm Package Compare versions

Comparing version

to
0.7.1

2

dist/constants.js

@@ -1,1 +0,1 @@

var e=".sdxconfig",c=".solidmanifest",r="package.json",s=".sdx",H=`${s}/list.cache`,_="src/.sdx-gen",n=`${_}/shacl`,t=`${_}/graphql`,S=`${t}/schema.graphqls`,p=`${_}/sdk.generated.ts`,x=".graphqlrc.yml",A="src/gql",D=`${A}/queries.graphql`,E;(function(o){o.NO_SHACL_SCHEMAS="No shacl schema's"})(E||(E={}));var P=["@solidlab/sdx-sdk@1.0.0-beta.18"],R=["@solidlab/sdx@6.0.4"];export{E as ERROR,P as LIB_DEPENDENCIES,R as LIB_DEV_DEPENDENCIES,s as PATH_DOT_SDX_FOLDER,D as PATH_GRAPHQL_QUERIES,A as PATH_GRAPHQL_QUERIES_FOLDER,x as PATH_GRAPHQL_RC,r as PATH_PACKAGE_JSON,e as PATH_SDX_CONFIG,_ as PATH_SDX_GENERATE_FOLDER,t as PATH_SDX_GENERATE_GRAPHQL_FOLDER,S as PATH_SDX_GENERATE_GRAPHQL_SCHEMA,p as PATH_SDX_GENERATE_SDK,n as PATH_SDX_GENERATE_SHACL_FOLDER,H as PATH_SDX_LIST_CACHE,c as PATH_SOLID_MANIFEST};
var e=".sdxconfig",c=".solidmanifest",r="package.json",s=".sdx",H=`${s}/list.cache`,_="src/.sdx-gen",n=`${_}/shacl`,t=`${_}/graphql`,S=`${t}/schema.graphqls`,p=`${_}/sdk.generated.ts`,x=".graphqlrc.yml",A="src/gql",D=`${A}/queries.graphql`,E;(function(o){o.NO_SHACL_SCHEMAS="No shacl schema's"})(E||(E={}));var P=["@solidlab/sdx-sdk@1.0.0-beta.18"],R=["@solidlab/sdx@0.6.5"];export{E as ERROR,P as LIB_DEPENDENCIES,R as LIB_DEV_DEPENDENCIES,s as PATH_DOT_SDX_FOLDER,D as PATH_GRAPHQL_QUERIES,A as PATH_GRAPHQL_QUERIES_FOLDER,x as PATH_GRAPHQL_RC,r as PATH_PACKAGE_JSON,e as PATH_SDX_CONFIG,_ as PATH_SDX_GENERATE_FOLDER,t as PATH_SDX_GENERATE_GRAPHQL_FOLDER,S as PATH_SDX_GENERATE_GRAPHQL_SCHEMA,p as PATH_SDX_GENERATE_SDK,n as PATH_SDX_GENERATE_SHACL_FOLDER,H as PATH_SDX_LIST_CACHE,c as PATH_SOLID_MANIFEST};

@@ -1,3 +0,3 @@

var w=Object.defineProperty;var a=(i,t)=>w(i,"name",{value:t,configurable:!0});import _ from"chalk";import{execSync as m}from"child_process";import{existsSync as d,mkdirSync as F,readFileSync as N,writeFileSync as c}from"fs";import G from"path";import{cwd as $}from"process";import Q from"prompts";var l=".sdxconfig",h=".solidmanifest",n="package.json",H=".sdx",j=`${H}/list.cache`,E="src/.sdx-gen",b=`${E}/shacl`,O=`${E}/graphql`,J=`${O}/schema.graphqls`,U=`${E}/sdk.generated.ts`,g=".graphqlrc.yml",p="src/gql",u=`${p}/queries.graphql`,f;(function(i){i.NO_SHACL_SCHEMAS="No shacl schema's"})(f||(f={}));var A=["@solidlab/sdx-sdk@1.0.0-beta.18"],x=["@solidlab/sdx@6.0.4"];var P={formatVersion:"1.0.0",catalogs:[{name:"SolidLab Catalog",uri:"https://catalog.solidlab.be"}],options:{autoGenerate:!0,rawRequest:!1}},T={formatVersion:"1.0.0",name:"my-solid-app",author:"",license:"ISC",shapePackages:[]},L=`# .graphqlrc.yml
var w=Object.defineProperty;var a=(i,t)=>w(i,"name",{value:t,configurable:!0});import _ from"chalk";import{execSync as m}from"child_process";import{existsSync as d,mkdirSync as F,readFileSync as N,writeFileSync as c}from"fs";import G from"path";import{cwd as $}from"process";import Q from"prompts";var l=".sdxconfig",h=".solidmanifest",n="package.json",H=".sdx",j=`${H}/list.cache`,E="src/.sdx-gen",b=`${E}/shacl`,O=`${E}/graphql`,J=`${O}/schema.graphqls`,U=`${E}/sdk.generated.ts`,g=".graphqlrc.yml",p="src/gql",u=`${p}/queries.graphql`,f;(function(i){i.NO_SHACL_SCHEMAS="No shacl schema's"})(f||(f={}));var A=["@solidlab/sdx-sdk@1.0.0-beta.18"],x=["@solidlab/sdx@0.6.5"];var P={formatVersion:"1.0.0",catalogs:[{name:"SolidLab Catalog",uri:"https://catalog.solidlab.be"}],options:{autoGenerate:!0,rawRequest:!1}},T={formatVersion:"1.0.0",name:"my-solid-app",author:"",license:"ISC",shapePackages:[]},L=`# .graphqlrc.yml
schema: src/.sdx-gen/graphql/schema.graphqls
documents: src/gql/**/*.graphql`;import{mkdir as C}from"fs/promises";import{isListType as v,isNonNullType as z,isObjectType as V,isScalarType as B}from"graphql";var D="#7C4DFF",R="#FF6700";async function I(i){await C(i,{recursive:!0})}a(I,"ensureDir");var S=class S{async initProject(t,o){let e=this.packageJsonExists(t)&&!o.force;if(this.logPurple("Initializing workspace, first some questions ..."),e){this.logWarning("Existing package.json found: workspace initialisation aborted! (override with --force)");return}let s=await this.promptInput(e,t);t&&(d(t)||F(t)),this.initSolidManifest(s,t),this.initSdxConfig(t),this.initPackageJson(e,s,t),o.noLibs||this.installLibraries(t),this.createGraphQLQueriesFile(t),this.initGraphQLRC(t),this.logPurple("Successfully set up workspace!"),_.reset()}async promptInput(t,o){let e=o==="."||o==="./"||o===".\\",s=$().substring($().lastIndexOf(G.sep)+1),r=o&&!e?[]:[{type:"text",name:"projectName",message:"What is the name of your project?",initial:e?s:"my-solid-app"}];return t||r.push({type:"text",name:"description",message:"How would you describe your project in one line?"},{type:"text",name:"author",message:"Who is the author of this project?"},{type:"text",name:"license",message:"Which license do you want to use?",initial:"ISC"}),Q(r)}initSdxConfig(t){this.logPurple("Writing .sdxconfig ...");let o=t?`${t}/${l}`:l;try{c(o,JSON.stringify(P,null,4))}catch{throw new Error(`Error while writing ${o} to the filesystem.`)}}initSolidManifest(t,o){this.logPurple("Writing .solidmanifest ...");let e=o?`${o}/${h}`:h;try{let s=T;s.name=t.projectName,s.author=t.author,s.license=t.license,c(e,JSON.stringify(s,null,4))}catch{throw new Error(`Error while writing ${e} to the filesystem.`)}}initPackageJson(t,o,e){let s=e?`${e}/${n}`:n;try{this.logPurple("Writing package.json ..."),m(e?`cd ${e} && npm init -y`:"npm init -y");let r=JSON.parse(N(s).toString());r.name=o.projectName,r.description=o.description,r.author=o.author,r.license=o.license,r.types="sdx-types/index.d.ts",c(s,JSON.stringify(r,null,4),{flag:"w"})}catch{throw new Error(`Error while writing ${s} to the filesystem.`)}}packageJsonExists(t){let o=t?`${t}/${n}`:n;try{return N(o),!0}catch{return!1}}installLibraries(t){x.forEach(o=>{try{this.logPurple(`Installing ${o}...`),m(t?`cd ${t} && npm i -D ${o}`:`npm i -D ${o}`)}catch{throw new Error(`Error while installing ${o}!`)}}),A.forEach(o=>{try{this.logPurple(`Installing ${o}...`),m(t?`cd ${t} && npm i -S ${o}`:`npm i -S ${o}`)}catch{throw new Error(`Error while installing ${o}!`)}})}async createGraphQLQueriesFile(t){let o=t?`${t}/${u}`:u,e=t?`${t}/${p}`:p;await I(e),c(o,"",{flag:"w"})}initGraphQLRC(t){let o=t?`${t}/${g}`:g;c(o,L,{flag:"w"})}logPurple(t){console.log(_.hex(D)(t))}logWarning(t){console.log(_.hex(R)(t))}};a(S,"ProjectBuilder");var y=S;export{y as ProjectBuilder};
#!/usr/bin/env node
var Qe=Object.defineProperty;var yt=(r,e,t)=>e in r?Qe(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var i=(r,e)=>Qe(r,"name",{value:e,configurable:!0});var p=(r,e,t)=>(yt(r,typeof e!="symbol"?e+"":e,t),t);import"@abraham/reflection";import Wn from"chalk";import{Command as Bn}from"commander";import ft from"chalk";import{createHash as kn}from"crypto";import{existsSync as mt,mkdirSync as Fn,readdirSync as vn,readFileSync as $e,rmSync as Gn,writeFileSync as ke}from"fs";import{autoInjectable as Qn,singleton as Hn}from"tsyringe";var A=".sdxconfig",y=".solidmanifest",k="package.json",ee=".sdx",fe=`${ee}/list.cache`,me="src/.sdx-gen",S=`${me}/shacl`,St=`${me}/graphql`,I=`${St}/schema.graphqls`,_=`${me}/sdk.generated.ts`,ge=".graphqlrc.yml",w="src/gql",de=`${w}/queries.graphql`,D;(function(r){r.NO_SHACL_SCHEMAS="No shacl schema's"})(D||(D={}));var He=["@solidlab/sdx-sdk@1.0.0-beta.18"],Me=["@solidlab/sdx@6.0.4"];import Ie from"chalk";import{execSync as Oe}from"child_process";import{existsSync as It,mkdirSync as Ot,readFileSync as ze,writeFileSync as G}from"fs";import Et from"path";import{cwd as Ke}from"process";import xt from"prompts";var qe={formatVersion:"1.0.0",catalogs:[{name:"SolidLab Catalog",uri:"https://catalog.solidlab.be"}],options:{autoGenerate:!0,rawRequest:!1}},Ue={formatVersion:"1.0.0",name:"my-solid-app",author:"",license:"ISC",shapePackages:[]},Xe=`# .graphqlrc.yml
var Qe=Object.defineProperty;var yt=(r,e,t)=>e in r?Qe(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var i=(r,e)=>Qe(r,"name",{value:e,configurable:!0});var p=(r,e,t)=>(yt(r,typeof e!="symbol"?e+"":e,t),t);import"@abraham/reflection";import Wn from"chalk";import{Command as Bn}from"commander";import ft from"chalk";import{createHash as kn}from"crypto";import{existsSync as mt,mkdirSync as Fn,readdirSync as vn,readFileSync as $e,rmSync as Gn,writeFileSync as ke}from"fs";import{autoInjectable as Qn,singleton as Hn}from"tsyringe";var A=".sdxconfig",y=".solidmanifest",k="package.json",ee=".sdx",fe=`${ee}/list.cache`,me="src/.sdx-gen",S=`${me}/shacl`,St=`${me}/graphql`,I=`${St}/schema.graphqls`,_=`${me}/sdk.generated.ts`,ge=".graphqlrc.yml",w="src/gql",de=`${w}/queries.graphql`,D;(function(r){r.NO_SHACL_SCHEMAS="No shacl schema's"})(D||(D={}));var He=["@solidlab/sdx-sdk@1.0.0-beta.18"],Me=["@solidlab/sdx@0.6.5"];import Ie from"chalk";import{execSync as Oe}from"child_process";import{existsSync as It,mkdirSync as Ot,readFileSync as ze,writeFileSync as G}from"fs";import Et from"path";import{cwd as Ke}from"process";import xt from"prompts";var qe={formatVersion:"1.0.0",catalogs:[{name:"SolidLab Catalog",uri:"https://catalog.solidlab.be"}],options:{autoGenerate:!0,rawRequest:!1}},Ue={formatVersion:"1.0.0",name:"my-solid-app",author:"",license:"ISC",shapePackages:[]},Xe=`# .graphqlrc.yml
schema: src/.sdx-gen/graphql/schema.graphqls

@@ -9,2 +9,2 @@ documents: src/gql/**/*.graphql`;import{mkdir as wt}from"fs/promises";import{isListType as ye,isNonNullType as Se,isObjectType as Je,isScalarType as Tt}from"graphql";function We(r){let e="No results found.";r&&(e+=` ${r}`),console.log(e),console.log()}i(We,"noResults");var j="#7C4DFF",R="#FF6700";async function re(r){await wt(r,{recursive:!0})}i(re,"ensureDir");var f=i(r=>r.slice(0,1).toUpperCase()+r.slice(1),"capitalize"),we=i(r=>r.slice(0,1).toLowerCase()+r.slice(1),"decapitalize"),Be=i(r=>`${r}Collection`,"plural"),te=i(r=>Tt(r)||Se(r)&&te(r.ofType)||ye(r)&&te(r.ofType),"isOrContainsScalar"),ne=i(r=>Je(r)||Se(r)&&ne(r.ofType)||ye(r)&&ne(r.ofType),"isOrContainsObjectType");var F=i(r=>ye(r)||Se(r)?F(r.ofType):(Je(r),r),"toActualType");function v(r){try{let e=new URL(r);return e.hash.length>0?e.hash.slice(1):e.pathname.slice(e.pathname.lastIndexOf("/")+1)}catch{return r.startsWith("#")||r.startsWith("/")?r.slice(1):r}}i(v,"parseNameFromUri");function Ve(r){return r.reduce((e,t)=>(e.has(t.subject)?e.get(t.subject).push(t):e.set(t.subject,[t]),e),new Map)}i(Ve,"groupBySubject");function Te(r){return r.replace(/[^_a-zA-Z]/g,"_")}i(Te,"cleanseName");var Ee=class Ee{async initProject(e,t){let n=this.packageJsonExists(e)&&!t.force;if(this.logPurple("Initializing workspace, first some questions ..."),n){this.logWarning("Existing package.json found: workspace initialisation aborted! (override with --force)");return}let a=await this.promptInput(n,e);e&&(It(e)||Ot(e)),this.initSolidManifest(a,e),this.initSdxConfig(e),this.initPackageJson(n,a,e),t.noLibs||this.installLibraries(e),this.createGraphQLQueriesFile(e),this.initGraphQLRC(e),this.logPurple("Successfully set up workspace!"),Ie.reset()}async promptInput(e,t){let n=t==="."||t==="./"||t===".\\",a=Ke().substring(Ke().lastIndexOf(Et.sep)+1),s=t&&!n?[]:[{type:"text",name:"projectName",message:"What is the name of your project?",initial:n?a:"my-solid-app"}];return e||s.push({type:"text",name:"description",message:"How would you describe your project in one line?"},{type:"text",name:"author",message:"Who is the author of this project?"},{type:"text",name:"license",message:"Which license do you want to use?",initial:"ISC"}),xt(s)}initSdxConfig(e){this.logPurple("Writing .sdxconfig ...");let t=e?`${e}/${A}`:A;try{G(t,JSON.stringify(qe,null,4))}catch{throw new Error(`Error while writing ${t} to the filesystem.`)}}initSolidManifest(e,t){this.logPurple("Writing .solidmanifest ...");let n=t?`${t}/${y}`:y;try{let a=Ue;a.name=e.projectName,a.author=e.author,a.license=e.license,G(n,JSON.stringify(a,null,4))}catch{throw new Error(`Error while writing ${n} to the filesystem.`)}}initPackageJson(e,t,n){let a=n?`${n}/${k}`:k;try{this.logPurple("Writing package.json ..."),Oe(n?`cd ${n} && npm init -y`:"npm init -y");let s=JSON.parse(ze(a).toString());s.name=t.projectName,s.description=t.description,s.author=t.author,s.license=t.license,s.types="sdx-types/index.d.ts",G(a,JSON.stringify(s,null,4),{flag:"w"})}catch{throw new Error(`Error while writing ${a} to the filesystem.`)}}packageJsonExists(e){let t=e?`${e}/${k}`:k;try{return ze(t),!0}catch{return!1}}installLibraries(e){Me.forEach(t=>{try{this.logPurple(`Installing ${t}...`),Oe(e?`cd ${e} && npm i -D ${t}`:`npm i -D ${t}`)}catch{throw new Error(`Error while installing ${t}!`)}}),He.forEach(t=>{try{this.logPurple(`Installing ${t}...`),Oe(e?`cd ${e} && npm i -S ${t}`:`npm i -S ${t}`)}catch{throw new Error(`Error while installing ${t}!`)}})}async createGraphQLQueriesFile(e){let t=e?`${e}/${de}`:de,n=e?`${e}/${w}`:w;await re(n),G(t,"",{flag:"w"})}initGraphQLRC(e){let t=e?`${e}/${ge}`:ge;G(t,Xe,{flag:"w"})}logPurple(e){console.log(Ie.hex(j)(e))}logWarning(e){console.log(Ie.hex(R)(e))}};i(Ee,"ProjectBuilder");var ae=Ee;import Pt from"axios";import Nt from"chalk";import{autoInjectable as Dt}from"tsyringe";import{autoInjectable as _t,singleton as jt}from"tsyringe";import{readFile as Rt}from"fs/promises";import{readFileSync as Lt}from"fs";function bt(r,e,t,n){var a=arguments.length,s=a<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,n);else for(var c=r.length-1;c>=0;c--)(o=r[c])&&(s=(a<3?o(s):a>3?o(e,t,s):o(e,t))||s);return a>3&&s&&Object.defineProperty(e,t,s),s}i(bt,"_ts_decorate");var Q,L=(Q=class{async getSdxConfig(){let e=await Rt(A);return JSON.parse(e.toString())}getSdxConfigSync(){let e=Lt(A);return JSON.parse(e.toString())}},i(Q,"ConfigService"),Q);L=bt([_t(),jt()],L);function Ct(r,e,t,n){var a=arguments.length,s=a<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,n);else for(var c=r.length-1;c>=0;c--)(o=r[c])&&(s=(a<3?o(s):a>3?o(e,t,s):o(e,t))||s);return a>3&&s&&Object.defineProperty(e,t,s),s}i(Ct,"_ts_decorate");var At="/api";function O(r,e={}){let{catalogs:t}=$t.getSdxConfigSync();t.length>1&&console.log(Nt.hex(R)(`Multiple catalogs found! This is not yet supported: using the first one (${t[0]?.name})!`));let n=t[0]?.uri??"https://catalog.solidlab.be",a=Object.entries(e).map(o=>encodeURIComponent(o[0])+"="+encodeURIComponent(o[1])).join("&"),s=`${n}${At}/${r}`;return a.length===0?s:`${s}?${a}`}i(O,"url");var $t=new L,H,x=(H=class{constructor(){p(this,"http",Pt)}async searchPackage(e){return E(this.http.post(O("search/package"),{keyword:e}))}async listShapes(e){return E(this.http.get(O("shapes",e)))}async searchShape(e){return E(this.http.post(O("search/shape"),{keyword:e}))}async getShape(e){return E(this.http.get(O(`shapes/${e}`)))}async getTypeScheme(e){return E(this.http.get(O(`types/${e}/scheme`),{headers:{"content-type":"text/turtle"}}))}async demoDownloadSchema(e){return E(this.http.get(e,{headers:{"content-type":"text/turtle"}}))}async getShapePackage(e){return E(this.http.get(O(`packages/${e}`)))}async getShapePackageShacl(e){return console.log("downloading from api:",O(`packages/${e}/download)`)),E(this.http.get(O(`packages/${e}/download`),{headers:{"content-type":"text/turtle"}}))}},i(H,"BackendService"),H);x=Ct([Dt()],x);var E=i(async r=>{let e=await r;if(e.status===200)return e.data;throw Error(`${e.status} ${e.statusText}`)},"safe");import{existsSync as Ft,mkdirSync as vt,readFileSync as Gt,writeFileSync as Qt}from"fs";import{autoInjectable as Ht,singleton as Mt}from"tsyringe";function kt(r,e,t,n){var a=arguments.length,s=a<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,n);else for(var c=r.length-1;c>=0;c--)(o=r[c])&&(s=(a<3?o(s):a>3?o(e,t,s):o(e,t))||s);return a>3&&s&&Object.defineProperty(e,t,s),s}i(kt,"_ts_decorate");var M,b=(M=class{storeListToCache(e){Ft(ee)||vt(ee,{recursive:!0}),Qt(fe,JSON.stringify(e),{flag:"w"})}readListFromCache(){return JSON.parse(Gt(fe).toString())}},i(M,"CacheService"),M);b=kt([Ht(),Mt()],b);import{readFileSync as jn}from"fs";import{autoInjectable as Rn,singleton as Ln}from"tsyringe";import{generate as it}from"@graphql-codegen/cli";import{appendFile as ct,lstat as Cn,readFile as Pn,readdir as Nn,rm as pt,stat as lt,writeFile as Dn}from"fs/promises";import{lstat as et,readdir as tt,readFile as zt}from"fs/promises";import{GraphQLObjectType as ce,GraphQLSchema as Kt}from"graphql";import{DirectiveLocation as X}from"graphql/language/directiveLocation.js";import{GraphQLInputObjectType as Yt,GraphQLList as U,GraphQLNonNull as l,isListType as je,isNonNullType as Le}from"graphql/type/definition.js";import{GraphQLDirective as Ce}from"graphql/type/directives.js";import*as g from"graphql/type/scalars.js";import{Parser as Zt}from"n3";import{autoInjectable as en,singleton as tn}from"tsyringe";import{Store as Bt}from"n3";import{Store as Wt}from"n3";import*as C from"graphql/type/scalars.js";import{DataFactory as Ut,Store as Xt}from"n3";import{DataFactory as qt}from"n3";var{namedNode:h}=qt,Ye={XMLLiteral:h("http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral")},$={a:h("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"),langString:h("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString")},m={class:h("http://www.w3.org/ns/shacl#class"),datatype:h("http://www.w3.org/ns/shacl#datatype"),description:h("http://www.w3.org/ns/shacl#description"),minCount:h("http://www.w3.org/ns/shacl#minCount"),maxCount:h("http://www.w3.org/ns/shacl#maxCount"),name:h("http://www.w3.org/ns/shacl#name"),NodeShape:h("http://www.w3.org/ns/shacl#NodeShape"),path:h("http://www.w3.org/ns/shacl#path"),PropertyShape:h("http://www.w3.org/ns/shacl#PropertyShape"),property:h("http://www.w3.org/ns/shacl#property"),targetClass:h("http://www.w3.org/ns/shacl#targetClass")},q={int:h("http://www.w3.org/2001/XMLSchema#int"),float:h("http://www.w3.org/2001/XMLSchema#float"),string:h("http://www.w3.org/2001/XMLSchema#string"),boolean:h("http://www.w3.org/2001/XMLSchema#boolean")};var{namedNode:Jt}=Ut,xe=class xe{constructor(e,t){p(this,"quads");p(this,"context");p(this,"name");p(this,"description");p(this,"type");p(this,"path");p(this,"minCount");p(this,"maxCount");p(this,"className");this.quads=e,this.context=t;let n=new Xt(e);this.name=this.parseObject(n,m.name)??v(this.parseObject(n,m.path)),this.description=this.parseObject(n,m.description),this.type=this.parseType(n),this.path=this.parseObject(n,m.path);let a=this.parseObject(n,m.minCount);this.minCount=a?parseInt(a):void 0;let s=this.parseObject(n,m.maxCount);this.maxCount=s?parseInt(s):void 0,this.className=this.parseClass(n)}parseObject(e,t,n=!1){let a=e.getObjects(null,t,null);if(a&&a.length===1)return a.at(0).value;if(n)throw new Error(`Could not find a ${t.id} for PropertyShape.`)}parseType(e){let t=this.parseObject(e,m.datatype);return this.dataTypeToGraphQLType(t)}parseClass(e){let t=this.parseObject(e,m.class);return this.findMatchingShapeType(t)}dataTypeToGraphQLType(e){switch(e){case q.int.value:return C.GraphQLInt;case q.float.value:return C.GraphQLFloat;case Ye.XMLLiteral.value:case $.langString.value:case q.string.value:return C.GraphQLString;case q.boolean.value:return C.GraphQLFloat;default:return}}findMatchingShapeType(e){if(!e)return;let t=this.context.getStore().getQuads(null,m.targetClass,Jt(e),null);if(t&&t.length===1)return v(t.at(0).subject.value)}get class(){return()=>{let e=this.context.getGraphQLObjectTypes().find(t=>t.name===this.className);return e||console.log(`No Shape found for property ${this.name} ==> IGNORE`),e}}};i(xe,"PropertyShape");var se=xe;var be=class be{constructor(e,t){p(this,"quads");p(this,"name");p(this,"targetClass");p(this,"propertyShapes");this.quads=e;let n=new Wt(e);this.name=this.parseName(n),this.targetClass=this.parseObject(n,m.targetClass),this.propertyShapes=this.parsePropertyShapes(n,t)}parseName(e){let t=e.getSubjects($.a,m.NodeShape,null);if(t&&t.length===1)return v(t.at(0).value);throw new Error("There must be just one Subject for 'a' NodeShape.")}parseObject(e,t,n=!1){let a=e.getObjects(null,t,null);if(a&&a.length===1)return a.at(0).value;if(n)throw new Error(`Could not find a ${t.id} for Shape.`)}parsePropertyShapes(e,t){return e.getQuads(null,m.property,null,null).map(({object:n})=>{if(n.termType==="BlankNode"){let a=t.getBlankNodes().filter(s=>s.subject.equals(n));return new se(a,t)}}).filter(n=>n!==void 0)}};i(be,"Shape");var oe=be;var _e=class _e{constructor(e,t){p(this,"store");p(this,"shapes");p(this,"types");p(this,"blankNodes");p(this,"inputTypes",[]);this.store=new Bt(e),this.blankNodes=this.extractBlankNodes(e),this.shapes=this.extractShapes(this.store),this.types=this.extractTypes(this.shapes,t)}getStore(){return this.store}getGraphQLObjectTypes(){return this.types}getBlankNodes(){return this.blankNodes}getInputTypes(){return this.inputTypes}extractShapes(e){let t=[],n=e.getSubjects($.a,m.NodeShape,null).flatMap(a=>e.getQuads(a,null,null,null));for(let a of Ve(n).entries())t.push(new oe(a[1],this));return t}extractTypes(e,t){return e.map(t)}extractBlankNodes(e){return e.filter(t=>t.subject.termType==="BlankNode")}};i(_e,"Context");var ie=_e;function Vt(r,e,t,n){var a=arguments.length,s=a<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,n);else for(var c=r.length-1;c>=0;c--)(o=r[c])&&(s=(a<3?o(s):a>3?o(e,t,s):o(e,t))||s);return a>3&&s&&Object.defineProperty(e,t,s),s}i(Vt,"_ts_decorate");function Ze(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)}i(Ze,"_ts_metadata");var nn={id:{description:"Auto-generated property that will be assigned to the 'iri' of the Thing that is being queried.",type:new l(g.GraphQLID),extensions:{directives:{identifier:{}}}}},rn={id:{description:"Optional URI to use as an identifier for the new instance. One of the 'id' or 'slug' fields must be set!",type:g.GraphQLID}},an={slug:{description:"Optional slug that is combined with the context of the request to generate an identifier for the new instance. One of the 'id' or 'slug' fields must be set!",type:g.GraphQLString}},sn=new Ce({name:"identifier",locations:[X.FIELD_DEFINITION]}),on=new Ce({name:"is",args:{class:{type:g.GraphQLString}},locations:[X.OBJECT,X.INPUT_OBJECT]}),cn=new Ce({name:"property",args:{iri:{type:g.GraphQLString}},locations:[X.FIELD_DEFINITION,X.INPUT_FIELD_DEFINITION]}),pn="Query",ln="Mutation",W,J=(W=class{constructor(){p(this,"parser");this.parser=new Zt({format:"turtle"})}async parseSHACL(e,t=[]){if((await et(e)).isDirectory()&&(await tt(e)).length===0)throw D.NO_SHACL_SCHEMAS;let a=i(async o=>{if(t.includes(o.toString()))return[];let c=await et(o),u=[];if(c.isDirectory())for(let d of await tt(o))t.includes(d)||u.push(...await a(`${o}/${d}`));else{let d=await zt(o);u.push(...this.parser.parse(d.toString()))}return u},"parsePath"),s=new ie(await a(e),this.generateObjectType);return new Kt({query:this.generateQueryEntryPoints(s.getGraphQLObjectTypes()),mutation:this.generateMutationEntryPoints(s),directives:[on,cn,sn]})}generateQueryEntryPoints(e){return new ce({name:pn,fields:e.reduce((n,a)=>({...n,[we(a.name)]:{type:a,args:{id:{type:g.GraphQLString}}},[Be(we(a.name))]:{type:new U(a)}}),{})})}generateMutationEntryPoints(e){let t=e.getGraphQLObjectTypes();return new ce({name:ln,fields:t.reduce((a,s)=>{let o=`create${f(s.name)}`,c=`mutate${f(s.name)}`;return{...a,[o]:{type:new l(s),args:{input:{type:new l(this.generateInputObjectType(s,`${f(o)}Input`,"create",e))}}},[c]:{type:this.generateMutationObjectType(s,e),args:{id:{type:new l(g.GraphQLID)}}}}},{})})}generateInputObjectType(e,t,n,a){let s=a.getInputTypes().find(o=>t===o.name);if(!s){let o=Object.fromEntries(Object.entries(e.getFields()).filter(([,c])=>te(c.type)).filter(([,c])=>!hn(c)).map(([c,u])=>[Te(c),un(u,n)]));n==="create"&&(o={...rn,...an,...o}),s=new Yt({name:t,fields:o,extensions:e.extensions}),a.getInputTypes().push(s)}return s}generateMutationObjectType(e,t){return new ce({name:`${f(e.name)}Mutation`,fields:this.generateMutationObjectTypeFields(e,t),extensions:e.extensions})}generateMutationObjectTypeFields(e,t){let n={delete:{type:new l(e)}},a=this.generateInputObjectType(e,`Update${f(e.name)}Input`,"update",t);Object.keys(a.getFields()).length>0&&(n.update={type:new l(e),args:{input:{type:new l(a)}}});let s=Object.values(e.getFields()).reduce((o,c)=>{if(ne(c.type)){let u=je(c.type)||Le(c.type)&&je(c.type.ofType);o={...o,...u?this.generateMutationObjectTypeFieldsForCollection(c,e,t):this.generateMutationObjectTypeFieldsForSingular(c,e,t)}}return o},{});return{...n,...s}}generateMutationObjectTypeFieldsForCollection(e,t,n){let a=`add${f(e.name)}`,s=`remove${f(e.name)}`,o=`link${f(e.name)}`,c=`unlink${f(e.name)}`,u=new l(t),d=F(e.type);return{[a]:{type:u,args:{input:{type:new l(this.generateInputObjectType(d,`Create${f(d.name)}Input`,"create",n))}}},[s]:{type:u,args:{id:{type:new l(g.GraphQLID)}}},[o]:{type:u,args:{id:{type:new l(g.GraphQLID)}}},[c]:{type:u,args:{id:{type:new l(g.GraphQLID)}}}}}generateMutationObjectTypeFieldsForSingular(e,t,n){let a=`set${f(e.name)}`,s=`clear${f(e.name)}`,o=`link${f(e.name)}`,c=`unlink${f(e.name)}`,u=new l(t),d=F(e.type);return{[a]:{type:u,args:{input:{type:new l(this.generateInputObjectType(d,`Create${f(d.name)}Input`,"create",n))}}},[s]:{type:u},[o]:{type:u,args:{id:{type:new l(g.GraphQLID)}}},[c]:{type:u,args:{id:{type:new l(g.GraphQLID)}}}}}generateObjectType(e){let t=i((a,s)=>{let o=s;return(!a.maxCount||a.maxCount&&a.maxCount>1)&&(o=new U(o)),a.minCount&&a.minCount>0&&(o=new l(o)),o},"applyMinMaxCount"),n=i(()=>e.propertyShapes.reduce((a,s)=>{let o=s.type??s.class();return o?{...a,[Te(s.name)]:{type:t(s,o),description:s.description,extensions:{directives:{property:{iri:s.path}}}}}:a},nn),"props");return new ce({name:e.name,fields:n,extensions:{directives:{is:{class:e.targetClass}}}})}},i(W,"ShaclParserService"),W);J=Vt([tn(),en(),Ze("design:type",Function),Ze("design:paramtypes",[])],J);function un(r,e){let t=Re(r.type);return t=e==="update"&&Le(t)?t.ofType:t,{type:t,description:r.description,extensions:r.extensions}}i(un,"toInputField");function Re(r,e={}){if(je(r)){let n=Re(r.ofType,{collection:!0});return e.collection&&(n=new U(n)),e.nonNull&&(n=new l(n)),n}if(Le(r)){let n=Re(r.ofType,{nonNull:!0});return e.collection&&(n=new U(n)),e.nonNull&&(n=new l(n)),n}let t=g.specifiedScalarTypes.find(n=>n.name===r.toString());if(!t)throw new Error(`${r.toString()} is not a Scalar!`);return e.collection&&(t=new U(t)),e.nonNull&&(t=new l(t)),t}i(Re,"toScalarInputType");function hn(r){let e=r.extensions.directives;return e&&e.identifier}i(hn,"isIdentifier");import ut from"chalk";import{dirname as An}from"path";import{DirectiveLocation as mn}from"graphql";import{isInputObjectType as gn,isObjectType as dn}from"graphql/type/definition.js";import{autoInjectable as yn,singleton as Sn}from"tsyringe";function fn(r,e,t,n){var a=arguments.length,s=a<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,n);else for(var c=r.length-1;c>=0;c--)(o=r[c])&&(s=(a<3?o(s):a>3?o(e,t,s):o(e,t))||s);return a>3&&s&&Object.defineProperty(e,t,s),s}i(fn,"_ts_decorate");var B=`

export const getSolidClient = <C, E>(requester: Requester<C, E>): Sdk => getSdk<C, E>(requester);`),await this.appendSchemaVariable()}async notify(e){(await this.config.getSdxConfig()).options.autoGenerate&&(e.shaclChanged&&await this.generateGraphqlSchema(),(e.schemaChanged||e.queriesChanged)&&await this.generateTypingsOrSdk())}async removeGeneratedSdk(){try{(await Cn(_)).isFile()&&await pt(_)}catch{}}async appendSchemaVariable(){let e=await Pn(I);await ct(_,`
export const GRAPHQL_SCHEMA = \`${e.toString()}\`;`)}},i(K,"GeneratorService"),K);P=_n([Ln(),Rn(),ot("design:type",Function),ot("design:paramtypes",[typeof J>"u"?Object:J,typeof V>"u"?Object:V,typeof L>"u"?Object:L])],P);function $n(r,e,t,n){var a=arguments.length,s=a<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,n);else for(var c=r.length-1;c>=0;c--)(o=r[c])&&(s=(a<3?o(s):a>3?o(e,t,s):o(e,t))||s);return a>3&&s&&Object.defineProperty(e,t,s),s}i($n,"_ts_decorate");function ht(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)}i(ht,"_ts_metadata");var Y,ue=(Y=class{constructor(e,t,n){p(this,"backend");p(this,"cache");p(this,"generator");this.backend=e,this.cache=t,this.generator=n}async initProject(e,t){new ae().initProject(e,t)}listShapePackages(){let e=JSON.parse($e(y).toString()),t=Object.values(e.shapePackages).map(({name:n,id:a})=>({name:n,id:a}));if(t.length===0){We();return}this.cache?.storeListToCache(t),console.table(t)}async installShapePackage(e){let t=e,n=parseInt(e);isNaN(n)||(t=this.cache.readListFromCache()[n].id),t||console.error("A shape package with that index cannot be found!"),console.log(ft.hex(j)(`Installing shape package ${t}`));let a=encodeURIComponent(t),[s,o]=await Promise.all([this.backend.getShapePackage(a),this.backend.getShapePackageShacl(a)]);this.saveShapeToManifest(s),this.storeSchemeToDisk(t,o),this.generator.notify({shaclChanged:!0})}unInstallShapePackage(e){let t=e,n=parseInt(e);isNaN(n)||(t=this.cache.readListFromCache()[n].id),t||console.error("A type with that index cannot be found!"),console.log(ft.hex(j)(`Uninstalling type package ${t}`)),this.removeSchemeFromDisk(t),this.removeSolidTypeToManifest(t),this.generator.notify({shaclChanged:!0})}removeSchemeFromDisk(e){if(!mt(S))return;let t=this.hash(e);for(let n of vn(S))if(n===t){let a=S+"/"+n;Gn(a);return}}storeSchemeToDisk(e,t){mt(S)||Fn(S,{recursive:!0});let n=S+"/"+this.hash(e);ke(n,t)}hash(e){let t=kn("sha1");return t.update(e),t.digest("hex")}saveShapeToManifest(e){let t=JSON.parse($e(y).toString()),n=t.shapePackages.findIndex(a=>a.id===e.id);n>-1?t.shapePackages[n]=e:t.shapePackages.push(e),ke(y,JSON.stringify(t,null,4),{flag:"w"})}removeSolidTypeToManifest(e){let t=JSON.parse($e(y).toString()),n=t.shapePackages.findIndex(a=>a.id===e);n>-1&&(t.shapePackages.splice(n,1),ke(y,JSON.stringify(t,null,4),{flag:"w"}))}},i(Y,"ProjectService"),Y);ue=$n([Qn(),Hn(),ht("design:type",Function),ht("design:paramtypes",[typeof x>"u"?Object:x,typeof b>"u"?Object:b,typeof P>"u"?Object:P])],ue);import qn from"chalk";import{autoInjectable as Un,singleton as Xn}from"tsyringe";function Mn(r,e,t,n){var a=arguments.length,s=a<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,n);else for(var c=r.length-1;c>=0;c--)(o=r[c])&&(s=(a<3?o(s):a>3?o(e,t,s):o(e,t))||s);return a>3&&s&&Object.defineProperty(e,t,s),s}i(Mn,"_ts_decorate");function gt(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)}i(gt,"_ts_metadata");var Z,he=(Z=class{constructor(e,t){p(this,"backend");p(this,"cache");this.backend=e,this.cache=t}async search(e){let t=await this.backend.searchShape(e);if(t){let n=t.sort((s,o)=>(o.shapePackage.downloads??0)-(s.shapePackage.downloads??0));this.cache.storeListToCache(n.map(({shapePackage:s})=>s));let a=t.map(({shapeMatches:s,shapePackage:o})=>{let{name:c,downloads:u}=o,d=s.slice(0,3).map(Jn).join(", ");return s.length>3&&(d+=", ..."),{matchingTypes:d,name:c,downloads:u}});this.outputResults(a)}}outputResults(e){console.table(e),console.log(qn.yellow("Install a shape package using `sdx install package <index>`"))}},i(Z,"SearchService"),Z);he=Mn([Xn(),Un(),gt("design:type",Function),gt("design:paramtypes",[typeof x>"u"?Object:x,typeof b>"u"?Object:b])],he);function Jn(r){let e=r.lastIndexOf("#");return e>-1?r.slice(e+1):r}i(Jn,"iriToName");var dt="0.7.0";var T=new Bn,N=new ue,Vn=new he,Fe=new P;T.version(dt).description(Wn.hex(j)("Solid Development eXperience toolkit"));T.command("init").description("Initialize a new SDX project, setting up all necessary files.").argument("[projectName]","Name of the project (creates folder with that name in current directory)").option("-f, --force [boolean]","Overwrite any package.json that might be present.",!1).option("--noLibs","Do not install the sdx libraries (@solidlab/sdx and @solidlab/sdx-sdk)",!1).action((r,e)=>N.initProject(r,e));T.command("search").description("Search for a shape package via the SolidLab Catalog API.").argument("<query>","query to search for").action(r=>Vn.search(r));var zn=T.command("install").description("Install an object like a shape package.");zn.command("package").description("Install a shape package using an IRI or an index (from search results).").argument("<IRI|index>","Full IRI of shape package or index (from search results)").action(r=>N.installShapePackage(r));var Kn=T.command("uninstall").description("Uninstall an object like a shape package.");Kn.command("package").description("Uninstall a shape package using an IRI or an index (from list results).").argument("<IRI|index>","Full IRI of shape package or index (from list results)").action(r=>N.unInstallShapePackage(r));var ve=T.command("package").alias("packages").description("Execute standard operations on shape packages.");ve.command("list").description("List all installed shape packages.").action(()=>N.listShapePackages());ve.command("install").argument("<IRI|index>","Full IRI of shape package or index (from search results)").description("Install a shape package using an IRI or an index (from search results).").action(r=>N.installShapePackage(r));ve.command("uninstall").description("Uninstall a shape package using an IRI or an index (from list results).").argument("<IRI|index>","Full IRI of shape package or index (from list results)").action(r=>N.unInstallShapePackage(r));var Yn=T.command("list").description("list objects");Yn.command("packages").alias("package").description("List all installed shape packages.").action(()=>N.listShapePackages());var Ge=T.command("generate").alias("g").description("Generate code from the installed shape packages.");Ge.command("schema").description("Generate or update a GraphQL schema from the installed shape packages.").action(async()=>await Fe.generateGraphqlSchema());Ge.command("shapes").alias("typings").description("Generate or update typings for the installed shape packages.").action(async()=>await Fe.generateTypings());Ge.command("sdk").aliases(["client","solidclient"]).description("Generate or update an SDK from the installed type packages and GraphQL queries.").action(async()=>await Fe.generateTypingsOrSdk());T.parse(process.argv);
export const GRAPHQL_SCHEMA = \`${e.toString()}\`;`)}},i(K,"GeneratorService"),K);P=_n([Ln(),Rn(),ot("design:type",Function),ot("design:paramtypes",[typeof J>"u"?Object:J,typeof V>"u"?Object:V,typeof L>"u"?Object:L])],P);function $n(r,e,t,n){var a=arguments.length,s=a<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,n);else for(var c=r.length-1;c>=0;c--)(o=r[c])&&(s=(a<3?o(s):a>3?o(e,t,s):o(e,t))||s);return a>3&&s&&Object.defineProperty(e,t,s),s}i($n,"_ts_decorate");function ht(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)}i(ht,"_ts_metadata");var Y,ue=(Y=class{constructor(e,t,n){p(this,"backend");p(this,"cache");p(this,"generator");this.backend=e,this.cache=t,this.generator=n}async initProject(e,t){new ae().initProject(e,t)}listShapePackages(){let e=JSON.parse($e(y).toString()),t=Object.values(e.shapePackages).map(({name:n,id:a})=>({name:n,id:a}));if(t.length===0){We();return}this.cache?.storeListToCache(t),console.table(t)}async installShapePackage(e){let t=e,n=parseInt(e);isNaN(n)||(t=this.cache.readListFromCache()[n].id),t||console.error("A shape package with that index cannot be found!"),console.log(ft.hex(j)(`Installing shape package ${t}`));let a=encodeURIComponent(t),[s,o]=await Promise.all([this.backend.getShapePackage(a),this.backend.getShapePackageShacl(a)]);this.saveShapeToManifest(s),this.storeSchemeToDisk(t,o),this.generator.notify({shaclChanged:!0})}unInstallShapePackage(e){let t=e,n=parseInt(e);isNaN(n)||(t=this.cache.readListFromCache()[n].id),t||console.error("A type with that index cannot be found!"),console.log(ft.hex(j)(`Uninstalling type package ${t}`)),this.removeSchemeFromDisk(t),this.removeSolidTypeToManifest(t),this.generator.notify({shaclChanged:!0})}removeSchemeFromDisk(e){if(!mt(S))return;let t=this.hash(e);for(let n of vn(S))if(n===t){let a=S+"/"+n;Gn(a);return}}storeSchemeToDisk(e,t){mt(S)||Fn(S,{recursive:!0});let n=S+"/"+this.hash(e);ke(n,t)}hash(e){let t=kn("sha1");return t.update(e),t.digest("hex")}saveShapeToManifest(e){let t=JSON.parse($e(y).toString()),n=t.shapePackages.findIndex(a=>a.id===e.id);n>-1?t.shapePackages[n]=e:t.shapePackages.push(e),ke(y,JSON.stringify(t,null,4),{flag:"w"})}removeSolidTypeToManifest(e){let t=JSON.parse($e(y).toString()),n=t.shapePackages.findIndex(a=>a.id===e);n>-1&&(t.shapePackages.splice(n,1),ke(y,JSON.stringify(t,null,4),{flag:"w"}))}},i(Y,"ProjectService"),Y);ue=$n([Qn(),Hn(),ht("design:type",Function),ht("design:paramtypes",[typeof x>"u"?Object:x,typeof b>"u"?Object:b,typeof P>"u"?Object:P])],ue);import qn from"chalk";import{autoInjectable as Un,singleton as Xn}from"tsyringe";function Mn(r,e,t,n){var a=arguments.length,s=a<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,n);else for(var c=r.length-1;c>=0;c--)(o=r[c])&&(s=(a<3?o(s):a>3?o(e,t,s):o(e,t))||s);return a>3&&s&&Object.defineProperty(e,t,s),s}i(Mn,"_ts_decorate");function gt(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)}i(gt,"_ts_metadata");var Z,he=(Z=class{constructor(e,t){p(this,"backend");p(this,"cache");this.backend=e,this.cache=t}async search(e){let t=await this.backend.searchShape(e);if(t){let n=t.sort((s,o)=>(o.shapePackage.downloads??0)-(s.shapePackage.downloads??0));this.cache.storeListToCache(n.map(({shapePackage:s})=>s));let a=t.map(({shapeMatches:s,shapePackage:o})=>{let{name:c,downloads:u}=o,d=s.slice(0,3).map(Jn).join(", ");return s.length>3&&(d+=", ..."),{matchingTypes:d,name:c,downloads:u}});this.outputResults(a)}}outputResults(e){console.table(e),console.log(qn.yellow("Install a shape package using `sdx install package <index>`"))}},i(Z,"SearchService"),Z);he=Mn([Xn(),Un(),gt("design:type",Function),gt("design:paramtypes",[typeof x>"u"?Object:x,typeof b>"u"?Object:b])],he);function Jn(r){let e=r.lastIndexOf("#");return e>-1?r.slice(e+1):r}i(Jn,"iriToName");var dt="0.7.1";var T=new Bn,N=new ue,Vn=new he,Fe=new P;T.version(dt).description(Wn.hex(j)("Solid Development eXperience toolkit"));T.command("init").description("Initialize a new SDX project, setting up all necessary files.").argument("[projectName]","Name of the project (creates folder with that name in current directory)").option("-f, --force [boolean]","Overwrite any package.json that might be present.",!1).option("--noLibs","Do not install the sdx libraries (@solidlab/sdx and @solidlab/sdx-sdk)",!1).action((r,e)=>N.initProject(r,e));T.command("search").description("Search for a shape package via the SolidLab Catalog API.").argument("<query>","query to search for").action(r=>Vn.search(r));var zn=T.command("install").description("Install an object like a shape package.");zn.command("package").description("Install a shape package using an IRI or an index (from search results).").argument("<IRI|index>","Full IRI of shape package or index (from search results)").action(r=>N.installShapePackage(r));var Kn=T.command("uninstall").description("Uninstall an object like a shape package.");Kn.command("package").description("Uninstall a shape package using an IRI or an index (from list results).").argument("<IRI|index>","Full IRI of shape package or index (from list results)").action(r=>N.unInstallShapePackage(r));var ve=T.command("package").alias("packages").description("Execute standard operations on shape packages.");ve.command("list").description("List all installed shape packages.").action(()=>N.listShapePackages());ve.command("install").argument("<IRI|index>","Full IRI of shape package or index (from search results)").description("Install a shape package using an IRI or an index (from search results).").action(r=>N.installShapePackage(r));ve.command("uninstall").description("Uninstall a shape package using an IRI or an index (from list results).").argument("<IRI|index>","Full IRI of shape package or index (from list results)").action(r=>N.unInstallShapePackage(r));var Yn=T.command("list").description("list objects");Yn.command("packages").alias("package").description("List all installed shape packages.").action(()=>N.listShapePackages());var Ge=T.command("generate").alias("g").description("Generate code from the installed shape packages.");Ge.command("schema").description("Generate or update a GraphQL schema from the installed shape packages.").action(async()=>await Fe.generateGraphqlSchema());Ge.command("shapes").alias("typings").description("Generate or update typings for the installed shape packages.").action(async()=>await Fe.generateTypings());Ge.command("sdk").aliases(["client","solidclient"]).description("Generate or update an SDK from the installed type packages and GraphQL queries.").action(async()=>await Fe.generateTypingsOrSdk());T.parse(process.argv);

@@ -1,2 +0,2 @@

var Pe=Object.defineProperty;var ct=(r,e,t)=>e in r?Pe(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var a=(r,e)=>Pe(r,"name",{value:e,configurable:!0});var p=(r,e,t)=>(ct(r,typeof e!="symbol"?e+"":e,t),t);import ot from"chalk";import{createHash as Ln}from"crypto";import{existsSync as it,mkdirSync as jn,readdirSync as Nn,readFileSync as Ce,rmSync as Cn,writeFileSync as De}from"fs";import{autoInjectable as Dn,singleton as Pn}from"tsyringe";var j=".sdxconfig",y=".solidmanifest",C="package.json",K=".sdx",ce=`${K}/list.cache`,pe="src/.sdx-gen",S=`${pe}/shacl`,pt=`${pe}/graphql`,T=`${pt}/schema.graphqls`,_=`${pe}/sdk.generated.ts`,le=".graphqlrc.yml",w="src/gql",ue=`${w}/queries.graphql`,L;(function(r){r.NO_SHACL_SCHEMAS="No shacl schema's"})(L||(L={}));var Re=["@solidlab/sdx-sdk@1.0.0-beta.18"],Ae=["@solidlab/sdx@6.0.4"];import de from"chalk";import{execSync as ye}from"child_process";import{existsSync as ht,mkdirSync as ft,readFileSync as Me,writeFileSync as A}from"fs";import mt from"path";import{cwd as qe}from"process";import gt from"prompts";var $e={formatVersion:"1.0.0",catalogs:[{name:"SolidLab Catalog",uri:"https://catalog.solidlab.be"}],options:{autoGenerate:!0,rawRequest:!1}},Fe={formatVersion:"1.0.0",name:"my-solid-app",author:"",license:"ISC",shapePackages:[]},ve=`# .graphqlrc.yml
var Pe=Object.defineProperty;var ct=(r,e,t)=>e in r?Pe(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var a=(r,e)=>Pe(r,"name",{value:e,configurable:!0});var p=(r,e,t)=>(ct(r,typeof e!="symbol"?e+"":e,t),t);import ot from"chalk";import{createHash as Ln}from"crypto";import{existsSync as it,mkdirSync as jn,readdirSync as Nn,readFileSync as Ce,rmSync as Cn,writeFileSync as De}from"fs";import{autoInjectable as Dn,singleton as Pn}from"tsyringe";var j=".sdxconfig",y=".solidmanifest",C="package.json",K=".sdx",ce=`${K}/list.cache`,pe="src/.sdx-gen",S=`${pe}/shacl`,pt=`${pe}/graphql`,T=`${pt}/schema.graphqls`,_=`${pe}/sdk.generated.ts`,le=".graphqlrc.yml",w="src/gql",ue=`${w}/queries.graphql`,L;(function(r){r.NO_SHACL_SCHEMAS="No shacl schema's"})(L||(L={}));var Re=["@solidlab/sdx-sdk@1.0.0-beta.18"],Ae=["@solidlab/sdx@0.6.5"];import de from"chalk";import{execSync as ye}from"child_process";import{existsSync as ht,mkdirSync as ft,readFileSync as Me,writeFileSync as A}from"fs";import mt from"path";import{cwd as qe}from"process";import gt from"prompts";var $e={formatVersion:"1.0.0",catalogs:[{name:"SolidLab Catalog",uri:"https://catalog.solidlab.be"}],options:{autoGenerate:!0,rawRequest:!1}},Fe={formatVersion:"1.0.0",name:"my-solid-app",author:"",license:"ISC",shapePackages:[]},ve=`# .graphqlrc.yml
schema: src/.sdx-gen/graphql/schema.graphqls

@@ -3,0 +3,0 @@ documents: src/gql/**/*.graphql`;import{mkdir as lt}from"fs/promises";import{isListType as he,isNonNullType as fe,isObjectType as Ge,isScalarType as ut}from"graphql";function Qe(r){let e="No results found.";r&&(e+=` ${r}`),console.log(e),console.log()}a(Qe,"noResults");var P="#7C4DFF",x="#FF6700";async function ee(r){await lt(r,{recursive:!0})}a(ee,"ensureDir");var f=a(r=>r.slice(0,1).toUpperCase()+r.slice(1),"capitalize"),me=a(r=>r.slice(0,1).toLowerCase()+r.slice(1),"decapitalize"),He=a(r=>`${r}Collection`,"plural"),Y=a(r=>ut(r)||fe(r)&&Y(r.ofType)||he(r)&&Y(r.ofType),"isOrContainsScalar"),Z=a(r=>Ge(r)||fe(r)&&Z(r.ofType)||he(r)&&Z(r.ofType),"isOrContainsObjectType");var D=a(r=>he(r)||fe(r)?D(r.ofType):(Ge(r),r),"toActualType");function R(r){try{let e=new URL(r);return e.hash.length>0?e.hash.slice(1):e.pathname.slice(e.pathname.lastIndexOf("/")+1)}catch{return r.startsWith("#")||r.startsWith("/")?r.slice(1):r}}a(R,"parseNameFromUri");function ke(r){return r.reduce((e,t)=>(e.has(t.subject)?e.get(t.subject).push(t):e.set(t.subject,[t]),e),new Map)}a(ke,"groupBySubject");function ge(r){return r.replace(/[^_a-zA-Z]/g,"_")}a(ge,"cleanseName");var Se=class Se{async initProject(e,t){let n=this.packageJsonExists(e)&&!t.force;if(this.logPurple("Initializing workspace, first some questions ..."),n){this.logWarning("Existing package.json found: workspace initialisation aborted! (override with --force)");return}let s=await this.promptInput(n,e);e&&(ht(e)||ft(e)),this.initSolidManifest(s,e),this.initSdxConfig(e),this.initPackageJson(n,s,e),t.noLibs||this.installLibraries(e),this.createGraphQLQueriesFile(e),this.initGraphQLRC(e),this.logPurple("Successfully set up workspace!"),de.reset()}async promptInput(e,t){let n=t==="."||t==="./"||t===".\\",s=qe().substring(qe().lastIndexOf(mt.sep)+1),o=t&&!n?[]:[{type:"text",name:"projectName",message:"What is the name of your project?",initial:n?s:"my-solid-app"}];return e||o.push({type:"text",name:"description",message:"How would you describe your project in one line?"},{type:"text",name:"author",message:"Who is the author of this project?"},{type:"text",name:"license",message:"Which license do you want to use?",initial:"ISC"}),gt(o)}initSdxConfig(e){this.logPurple("Writing .sdxconfig ...");let t=e?`${e}/${j}`:j;try{A(t,JSON.stringify($e,null,4))}catch{throw new Error(`Error while writing ${t} to the filesystem.`)}}initSolidManifest(e,t){this.logPurple("Writing .solidmanifest ...");let n=t?`${t}/${y}`:y;try{let s=Fe;s.name=e.projectName,s.author=e.author,s.license=e.license,A(n,JSON.stringify(s,null,4))}catch{throw new Error(`Error while writing ${n} to the filesystem.`)}}initPackageJson(e,t,n){let s=n?`${n}/${C}`:C;try{this.logPurple("Writing package.json ..."),ye(n?`cd ${n} && npm init -y`:"npm init -y");let o=JSON.parse(Me(s).toString());o.name=t.projectName,o.description=t.description,o.author=t.author,o.license=t.license,o.types="sdx-types/index.d.ts",A(s,JSON.stringify(o,null,4),{flag:"w"})}catch{throw new Error(`Error while writing ${s} to the filesystem.`)}}packageJsonExists(e){let t=e?`${e}/${C}`:C;try{return Me(t),!0}catch{return!1}}installLibraries(e){Ae.forEach(t=>{try{this.logPurple(`Installing ${t}...`),ye(e?`cd ${e} && npm i -D ${t}`:`npm i -D ${t}`)}catch{throw new Error(`Error while installing ${t}!`)}}),Re.forEach(t=>{try{this.logPurple(`Installing ${t}...`),ye(e?`cd ${e} && npm i -S ${t}`:`npm i -S ${t}`)}catch{throw new Error(`Error while installing ${t}!`)}})}async createGraphQLQueriesFile(e){let t=e?`${e}/${ue}`:ue,n=e?`${e}/${w}`:w;await ee(n),A(t,"",{flag:"w"})}initGraphQLRC(e){let t=e?`${e}/${le}`:le;A(t,ve,{flag:"w"})}logPurple(e){console.log(de.hex(P)(e))}logWarning(e){console.log(de.hex(x)(e))}};a(Se,"ProjectBuilder");var te=Se;import Ot from"axios";import _t from"chalk";import{autoInjectable as xt}from"tsyringe";import{autoInjectable as yt,singleton as St}from"tsyringe";import{readFile as wt}from"fs/promises";import{readFileSync as Tt}from"fs";function dt(r,e,t,n){var s=arguments.length,o=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(r,e,t,n);else for(var c=r.length-1;c>=0;c--)(i=r[c])&&(o=(s<3?i(o):s>3?i(e,t,o):i(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o}a(dt,"_ts_decorate");var $,b=($=class{async getSdxConfig(){let e=await wt(j);return JSON.parse(e.toString())}getSdxConfigSync(){let e=Tt(j);return JSON.parse(e.toString())}},a($,"ConfigService"),$);b=dt([yt(),St()],b);function Et(r,e,t,n){var s=arguments.length,o=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(r,e,t,n);else for(var c=r.length-1;c>=0;c--)(i=r[c])&&(o=(s<3?i(o):s>3?i(e,t,o):i(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o}a(Et,"_ts_decorate");var bt="/api";function E(r,e={}){let{catalogs:t}=It.getSdxConfigSync();t.length>1&&console.log(_t.hex(x)(`Multiple catalogs found! This is not yet supported: using the first one (${t[0]?.name})!`));let n=t[0]?.uri??"https://catalog.solidlab.be",s=Object.entries(e).map(i=>encodeURIComponent(i[0])+"="+encodeURIComponent(i[1])).join("&"),o=`${n}${bt}/${r}`;return s.length===0?o:`${o}?${s}`}a(E,"url");var It=new b,v,F=(v=class{constructor(){p(this,"http",Ot)}async searchPackage(e){return O(this.http.post(E("search/package"),{keyword:e}))}async listShapes(e){return O(this.http.get(E("shapes",e)))}async searchShape(e){return O(this.http.post(E("search/shape"),{keyword:e}))}async getShape(e){return O(this.http.get(E(`shapes/${e}`)))}async getTypeScheme(e){return O(this.http.get(E(`types/${e}/scheme`),{headers:{"content-type":"text/turtle"}}))}async demoDownloadSchema(e){return O(this.http.get(e,{headers:{"content-type":"text/turtle"}}))}async getShapePackage(e){return O(this.http.get(E(`packages/${e}`)))}async getShapePackageShacl(e){return console.log("downloading from api:",E(`packages/${e}/download)`)),O(this.http.get(E(`packages/${e}/download`),{headers:{"content-type":"text/turtle"}}))}},a(v,"BackendService"),v);F=Et([xt()],F);var O=a(async r=>{let e=await r;if(e.status===200)return e.data;throw Error(`${e.status} ${e.statusText}`)},"safe");import{existsSync as jt,mkdirSync as Nt,readFileSync as Ct,writeFileSync as Dt}from"fs";import{autoInjectable as Pt,singleton as Rt}from"tsyringe";function Lt(r,e,t,n){var s=arguments.length,o=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(r,e,t,n);else for(var c=r.length-1;c>=0;c--)(i=r[c])&&(o=(s<3?i(o):s>3?i(e,t,o):i(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o}a(Lt,"_ts_decorate");var Q,G=(Q=class{storeListToCache(e){jt(K)||Nt(K,{recursive:!0}),Dt(ce,JSON.stringify(e),{flag:"w"})}readListFromCache(){return JSON.parse(Ct(ce).toString())}},a(Q,"CacheService"),Q);G=Lt([Pt(),Rt()],G);import{readFileSync as Sn}from"fs";import{autoInjectable as wn,singleton as Tn}from"tsyringe";import{generate as Ze}from"@graphql-codegen/cli";import{appendFile as et,lstat as En,readFile as On,readdir as _n,rm as tt,stat as nt,writeFile as xn}from"fs/promises";import{lstat as Je,readdir as We,readFile as kt}from"fs/promises";import{GraphQLObjectType as oe,GraphQLSchema as Mt}from"graphql";import{DirectiveLocation as M}from"graphql/language/directiveLocation.js";import{GraphQLInputObjectType as qt,GraphQLList as k,GraphQLNonNull as l,isListType as Oe,isNonNullType as xe}from"graphql/type/definition.js";import{GraphQLDirective as be}from"graphql/type/directives.js";import*as g from"graphql/type/scalars.js";import{Parser as Ut}from"n3";import{autoInjectable as Xt,singleton as Jt}from"tsyringe";import{Store as Qt}from"n3";import{Store as Gt}from"n3";import*as I from"graphql/type/scalars.js";import{DataFactory as $t,Store as Ft}from"n3";import{DataFactory as At}from"n3";var{namedNode:u}=At,Ue={XMLLiteral:u("http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral")},N={a:u("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"),langString:u("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString")},m={class:u("http://www.w3.org/ns/shacl#class"),datatype:u("http://www.w3.org/ns/shacl#datatype"),description:u("http://www.w3.org/ns/shacl#description"),minCount:u("http://www.w3.org/ns/shacl#minCount"),maxCount:u("http://www.w3.org/ns/shacl#maxCount"),name:u("http://www.w3.org/ns/shacl#name"),NodeShape:u("http://www.w3.org/ns/shacl#NodeShape"),path:u("http://www.w3.org/ns/shacl#path"),PropertyShape:u("http://www.w3.org/ns/shacl#PropertyShape"),property:u("http://www.w3.org/ns/shacl#property"),targetClass:u("http://www.w3.org/ns/shacl#targetClass")},H={int:u("http://www.w3.org/2001/XMLSchema#int"),float:u("http://www.w3.org/2001/XMLSchema#float"),string:u("http://www.w3.org/2001/XMLSchema#string"),boolean:u("http://www.w3.org/2001/XMLSchema#boolean")};var{namedNode:vt}=$t,we=class we{constructor(e,t){p(this,"quads");p(this,"context");p(this,"name");p(this,"description");p(this,"type");p(this,"path");p(this,"minCount");p(this,"maxCount");p(this,"className");this.quads=e,this.context=t;let n=new Ft(e);this.name=this.parseObject(n,m.name)??R(this.parseObject(n,m.path)),this.description=this.parseObject(n,m.description),this.type=this.parseType(n),this.path=this.parseObject(n,m.path);let s=this.parseObject(n,m.minCount);this.minCount=s?parseInt(s):void 0;let o=this.parseObject(n,m.maxCount);this.maxCount=o?parseInt(o):void 0,this.className=this.parseClass(n)}parseObject(e,t,n=!1){let s=e.getObjects(null,t,null);if(s&&s.length===1)return s.at(0).value;if(n)throw new Error(`Could not find a ${t.id} for PropertyShape.`)}parseType(e){let t=this.parseObject(e,m.datatype);return this.dataTypeToGraphQLType(t)}parseClass(e){let t=this.parseObject(e,m.class);return this.findMatchingShapeType(t)}dataTypeToGraphQLType(e){switch(e){case H.int.value:return I.GraphQLInt;case H.float.value:return I.GraphQLFloat;case Ue.XMLLiteral.value:case N.langString.value:case H.string.value:return I.GraphQLString;case H.boolean.value:return I.GraphQLFloat;default:return}}findMatchingShapeType(e){if(!e)return;let t=this.context.getStore().getQuads(null,m.targetClass,vt(e),null);if(t&&t.length===1)return R(t.at(0).subject.value)}get class(){return()=>{let e=this.context.getGraphQLObjectTypes().find(t=>t.name===this.className);return e||console.log(`No Shape found for property ${this.name} ==> IGNORE`),e}}};a(we,"PropertyShape");var ne=we;var Te=class Te{constructor(e,t){p(this,"quads");p(this,"name");p(this,"targetClass");p(this,"propertyShapes");this.quads=e;let n=new Gt(e);this.name=this.parseName(n),this.targetClass=this.parseObject(n,m.targetClass),this.propertyShapes=this.parsePropertyShapes(n,t)}parseName(e){let t=e.getSubjects(N.a,m.NodeShape,null);if(t&&t.length===1)return R(t.at(0).value);throw new Error("There must be just one Subject for 'a' NodeShape.")}parseObject(e,t,n=!1){let s=e.getObjects(null,t,null);if(s&&s.length===1)return s.at(0).value;if(n)throw new Error(`Could not find a ${t.id} for Shape.`)}parsePropertyShapes(e,t){return e.getQuads(null,m.property,null,null).map(({object:n})=>{if(n.termType==="BlankNode"){let s=t.getBlankNodes().filter(o=>o.subject.equals(n));return new ne(s,t)}}).filter(n=>n!==void 0)}};a(Te,"Shape");var re=Te;var Ee=class Ee{constructor(e,t){p(this,"store");p(this,"shapes");p(this,"types");p(this,"blankNodes");p(this,"inputTypes",[]);this.store=new Qt(e),this.blankNodes=this.extractBlankNodes(e),this.shapes=this.extractShapes(this.store),this.types=this.extractTypes(this.shapes,t)}getStore(){return this.store}getGraphQLObjectTypes(){return this.types}getBlankNodes(){return this.blankNodes}getInputTypes(){return this.inputTypes}extractShapes(e){let t=[],n=e.getSubjects(N.a,m.NodeShape,null).flatMap(s=>e.getQuads(s,null,null,null));for(let s of ke(n).entries())t.push(new re(s[1],this));return t}extractTypes(e,t){return e.map(t)}extractBlankNodes(e){return e.filter(t=>t.subject.termType==="BlankNode")}};a(Ee,"Context");var se=Ee;function Ht(r,e,t,n){var s=arguments.length,o=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(r,e,t,n);else for(var c=r.length-1;c>=0;c--)(i=r[c])&&(o=(s<3?i(o):s>3?i(e,t,o):i(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o}a(Ht,"_ts_decorate");function Xe(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)}a(Xe,"_ts_metadata");var Wt={id:{description:"Auto-generated property that will be assigned to the 'iri' of the Thing that is being queried.",type:new l(g.GraphQLID),extensions:{directives:{identifier:{}}}}},Bt={id:{description:"Optional URI to use as an identifier for the new instance. One of the 'id' or 'slug' fields must be set!",type:g.GraphQLID}},Vt={slug:{description:"Optional slug that is combined with the context of the request to generate an identifier for the new instance. One of the 'id' or 'slug' fields must be set!",type:g.GraphQLString}},zt=new be({name:"identifier",locations:[M.FIELD_DEFINITION]}),Kt=new be({name:"is",args:{class:{type:g.GraphQLString}},locations:[M.OBJECT,M.INPUT_OBJECT]}),Yt=new be({name:"property",args:{iri:{type:g.GraphQLString}},locations:[M.FIELD_DEFINITION,M.INPUT_FIELD_DEFINITION]}),Zt="Query",en="Mutation",U,q=(U=class{constructor(){p(this,"parser");this.parser=new Ut({format:"turtle"})}async parseSHACL(e,t=[]){if((await Je(e)).isDirectory()&&(await We(e)).length===0)throw L.NO_SHACL_SCHEMAS;let s=a(async i=>{if(t.includes(i.toString()))return[];let c=await Je(i),h=[];if(c.isDirectory())for(let d of await We(i))t.includes(d)||h.push(...await s(`${i}/${d}`));else{let d=await kt(i);h.push(...this.parser.parse(d.toString()))}return h},"parsePath"),o=new se(await s(e),this.generateObjectType);return new Mt({query:this.generateQueryEntryPoints(o.getGraphQLObjectTypes()),mutation:this.generateMutationEntryPoints(o),directives:[Kt,Yt,zt]})}generateQueryEntryPoints(e){return new oe({name:Zt,fields:e.reduce((n,s)=>({...n,[me(s.name)]:{type:s,args:{id:{type:g.GraphQLString}}},[He(me(s.name))]:{type:new k(s)}}),{})})}generateMutationEntryPoints(e){let t=e.getGraphQLObjectTypes();return new oe({name:en,fields:t.reduce((s,o)=>{let i=`create${f(o.name)}`,c=`mutate${f(o.name)}`;return{...s,[i]:{type:new l(o),args:{input:{type:new l(this.generateInputObjectType(o,`${f(i)}Input`,"create",e))}}},[c]:{type:this.generateMutationObjectType(o,e),args:{id:{type:new l(g.GraphQLID)}}}}},{})})}generateInputObjectType(e,t,n,s){let o=s.getInputTypes().find(i=>t===i.name);if(!o){let i=Object.fromEntries(Object.entries(e.getFields()).filter(([,c])=>Y(c.type)).filter(([,c])=>!nn(c)).map(([c,h])=>[ge(c),tn(h,n)]));n==="create"&&(i={...Bt,...Vt,...i}),o=new qt({name:t,fields:i,extensions:e.extensions}),s.getInputTypes().push(o)}return o}generateMutationObjectType(e,t){return new oe({name:`${f(e.name)}Mutation`,fields:this.generateMutationObjectTypeFields(e,t),extensions:e.extensions})}generateMutationObjectTypeFields(e,t){let n={delete:{type:new l(e)}},s=this.generateInputObjectType(e,`Update${f(e.name)}Input`,"update",t);Object.keys(s.getFields()).length>0&&(n.update={type:new l(e),args:{input:{type:new l(s)}}});let o=Object.values(e.getFields()).reduce((i,c)=>{if(Z(c.type)){let h=Oe(c.type)||xe(c.type)&&Oe(c.type.ofType);i={...i,...h?this.generateMutationObjectTypeFieldsForCollection(c,e,t):this.generateMutationObjectTypeFieldsForSingular(c,e,t)}}return i},{});return{...n,...o}}generateMutationObjectTypeFieldsForCollection(e,t,n){let s=`add${f(e.name)}`,o=`remove${f(e.name)}`,i=`link${f(e.name)}`,c=`unlink${f(e.name)}`,h=new l(t),d=D(e.type);return{[s]:{type:h,args:{input:{type:new l(this.generateInputObjectType(d,`Create${f(d.name)}Input`,"create",n))}}},[o]:{type:h,args:{id:{type:new l(g.GraphQLID)}}},[i]:{type:h,args:{id:{type:new l(g.GraphQLID)}}},[c]:{type:h,args:{id:{type:new l(g.GraphQLID)}}}}}generateMutationObjectTypeFieldsForSingular(e,t,n){let s=`set${f(e.name)}`,o=`clear${f(e.name)}`,i=`link${f(e.name)}`,c=`unlink${f(e.name)}`,h=new l(t),d=D(e.type);return{[s]:{type:h,args:{input:{type:new l(this.generateInputObjectType(d,`Create${f(d.name)}Input`,"create",n))}}},[o]:{type:h},[i]:{type:h,args:{id:{type:new l(g.GraphQLID)}}},[c]:{type:h,args:{id:{type:new l(g.GraphQLID)}}}}}generateObjectType(e){let t=a((s,o)=>{let i=o;return(!s.maxCount||s.maxCount&&s.maxCount>1)&&(i=new k(i)),s.minCount&&s.minCount>0&&(i=new l(i)),i},"applyMinMaxCount"),n=a(()=>e.propertyShapes.reduce((s,o)=>{let i=o.type??o.class();return i?{...s,[ge(o.name)]:{type:t(o,i),description:o.description,extensions:{directives:{property:{iri:o.path}}}}}:s},Wt),"props");return new oe({name:e.name,fields:n,extensions:{directives:{is:{class:e.targetClass}}}})}},a(U,"ShaclParserService"),U);q=Ht([Jt(),Xt(),Xe("design:type",Function),Xe("design:paramtypes",[])],q);function tn(r,e){let t=_e(r.type);return t=e==="update"&&xe(t)?t.ofType:t,{type:t,description:r.description,extensions:r.extensions}}a(tn,"toInputField");function _e(r,e={}){if(Oe(r)){let n=_e(r.ofType,{collection:!0});return e.collection&&(n=new k(n)),e.nonNull&&(n=new l(n)),n}if(xe(r)){let n=_e(r.ofType,{nonNull:!0});return e.collection&&(n=new k(n)),e.nonNull&&(n=new l(n)),n}let t=g.specifiedScalarTypes.find(n=>n.name===r.toString());if(!t)throw new Error(`${r.toString()} is not a Scalar!`);return e.collection&&(t=new k(t)),e.nonNull&&(t=new l(t)),t}a(_e,"toScalarInputType");function nn(r){let e=r.extensions.directives;return e&&e.identifier}a(nn,"isIdentifier");import rt from"chalk";import{dirname as bn}from"path";import{DirectiveLocation as sn}from"graphql";import{isInputObjectType as on,isObjectType as an}from"graphql/type/definition.js";import{autoInjectable as cn,singleton as pn}from"tsyringe";function rn(r,e,t,n){var s=arguments.length,o=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(r,e,t,n);else for(var c=r.length-1;c>=0;c--)(i=r[c])&&(o=(s<3?i(o):s>3?i(e,t,o):i(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o}a(rn,"_ts_decorate");var X=`

@@ -1,3 +0,3 @@

declare const LIB_VERSION = "0.7.0";
declare const LIB_VERSION = "0.7.1";
export { LIB_VERSION };

@@ -1,4 +0,4 @@

const LIB_VERSION = "0.7.0";
const LIB_VERSION = "0.7.1";
export {
LIB_VERSION
};
{
"name": "@solidlab/sdx",
"version": "0.7.0",
"version": "0.7.1",
"description": "Solid Development Experience toolkit",

@@ -5,0 +5,0 @@ "type": "module",

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

Sorry, the diff of this file is not supported yet