stellate 2.16.0 → 2.16.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +8 -8
- package/dist/index.d.ts +3 -3
- package/package.json +2 -2
package/dist/bin.js
CHANGED
|
@@ -519,7 +519,7 @@ ${r.data.toString("base64")}
|
|
|
519
519
|
${e.message}
|
|
520
520
|
|
|
521
521
|
Please try to use any of the available CLI options to provide this information.`)}return(0,hne.default)({...t[0],onState:e=>{e.aborted&&process.nextTick(()=>{process.exit(0)})}},{...t[1],onSubmit:()=>{console.log()}})};function N1(){return Qn(`${yl}/app/settings/access-tokens`)}function Sp(t,e,r="overview"){return Qn(`${yl}/app/org/${t}/services/${e}/${r}`)}var f3=(0,yne.default)("stellate:client");var gne=process.env.STELLATE_ENDPOINT==="local",bne=process.env.STELLATE_ENDPOINT==="staging",yl=gne?"http://localhost:3000":bne?"https://dev.stellate.co":"https://stellate.co";f3({baseUrl:yl});var vne=gne?"http://localhost:3001/api":bne?"https://api-dev.stellate.co/api":"https://api.stellate.co/api";f3({apiUrl:vne});var bs=class{constructor(e){this.token=e}async query(e,r){let i={"Content-Type":"application/json"};this.token&&(i["stellate-token"]=this.token);let s=JSON.stringify({query:e,variables:r}),n=await E2(vne,{method:"POST",body:s,headers:i}),a=await n.text();f3(a);let o;try{o=JSON.parse(a)}catch{throw new Error(a)}if(!n.ok)throw o.message==="Request Entity Too Large"||n.status===413?new Error("Payload too large, your GraphQL schema might be too large"):new Error(a);if(o.errors)throw new Error(EBe(o.errors[0].message));return f3(o),o.data||{}}};function EBe(t){return t.toLowerCase().includes("not authorized")?`Invalid api token. Please make sure that the env var STELLATE_TOKEN is valid or run "stellate login".
|
|
522
|
-
You can get a new api token at ${N1()}`:t}var ve=Oe(require("zod"));var wt=Oe(require("zod")),wBe=wt.string().refine(t=>t.match(/^[1-9][0-9]*(s|m|h)$/)),ABe=wt.object({value:wt.number().int().min(1),unit:wt.enum(["seconds","minutes","hours"])}).strict(),Sne=wt.union([wBe,ABe]),JO=wt.object({type:wt.literal("QueryComplexity"),budget:wt.number().int().min(1),warning:wt.number().int().min(1).optional(),window:Sne}).strict(),XO=wt.object({type:wt.literal("RequestCount"),budget:wt.number().int().min(1),warning:wt.number().int().min(1).optional(),window:Sne}).strict(),M2=wt.union([wt.function(),wt.string()]),QO=["enabled","disabled","dryRun"],I1=wt.object({name:wt.string(),description:wt.string().optional(),state:wt.enum(QO).optional(),groupBy:wt.union([wt.literal("ip"),wt.object({header:wt.string()}),wt.object({cookie:wt.string()}),wt.object({jwt:wt.string()}),wt.object({consumerIdentifier:wt.string()})]),allowList:wt.array(wt.string()).optional(),limit:wt.union([JO,XO])}).strict(),ryr=wt.array(I1),iyr=wt.array(wt.union([I1,wt.object({name:wt.string(),description:wt.string().optional(),state:wt.enum(QO).optional(),group:wt.string(),allowList:wt.array(wt.string()).optional(),limit:wt.union([JO,XO])})])),d3=wt.object({name:wt.string(),description:wt.string().optional(),state:wt.enum(QO).optional(),consumerIdentifier:wt.string().optional(),allowList:wt.array(wt.string()).optional(),limit:wt.union([JO,XO])}).strict(),h3=wt.object({listSizeArguments:wt.array(wt.string()).optional(),maxComplexity:wt.number().int().min(1).optional()}).strict();var PBe=ve.object({types:ve.record(ve.boolean().or(ve.record(ve.boolean())).or(ve.array(ve.string()))).or(ve.array(ve.string())).optional().nullable(),operationHashes:ve.array(ve.string()).optional().nullable(),maxAge:ve.number().min(0).optional().nullable(),swr:ve.number().min(0).optional().nullable(),scope:ve.string().nonempty().optional().nullable(),description:ve.string().optional().nullable()}),_Be=["HS256","HS384","HS512","RS256","RS384","RS512","ES256","ES384","ES256k","EdDSA","PS256","PS384","PS512"],j2=ve.object({claim:ve.string().optional().nullable(),algorithm:ve.enum(_Be).optional().nullable(),secret:ve.string().optional().nullable()}).optional().nullable(),wne=ve.function().args(ve.object({headers:ve.record(ve.string().or(ve.array(ve.string()))),cookies:ve.record(ve.string())})).returns(ve.string().nullable()),CBe=ve.object({definition:ve.union([ve.string(),wne]).optional().nullable(),jwt:j2}),DBe=ve.object({autoAdd:ve.boolean().optional().nullable(),defaults:ve.array(ve.string()).optional().nullable(),types:ve.record(ve.array(ve.string())).nullable()}),NBe=ve.object({query:ve.string().optional().nullable(),mutation:ve.string().optional().nullable(),subscription:ve.string().optional().nullable()}),Tne=ve.object({isEnabled:ve.boolean().optional().nullable(),whenGraphQLResponse:ve.boolean().optional().nullable()}),IBe=ve.object({networkErrors:Tne.optional().nullable(),serverErrors:Tne.optional().nullable()}),xne=5,OBe=ve.record(ve.union([ve.object({header:ve.string(),jwt:j2}),ve.object({cookie:ve.string(),jwt:j2})])).refine(t=>Object.keys(t).length<=xne,{message:`You can't define more than ${xne} custom attributes`}),kBe=ve.union([ve.object({header:ve.string(),jwt:j2}),ve.object({cookie:ve.string(),jwt:j2})]),LBe=ve.object({secret:ve.string().optional().nullable()}),FBe=ve.object({name:ve.string()}),RBe=ve.object({apq:ve.boolean().nullable().optional(),sendHashToOrigin:ve.boolean().nullable().optional(),rejectInvalidHashes:ve.boolean().nullable().optional()}),ZO=ve.object({enabled:ve.boolean(),title:ve.string().optional(),readme:ve.string().optional(),description:ve.string().optional(),urls:ve.object({privacy:ve.string().url().optional(),terms:ve.string().url().optional(),website:ve.string().url().optional(),logo:ve.string().url().optional(),favicon:ve.string().url().optional(),support:ve.string().url().or(ve.string().refine(t=>{if(!t.startsWith("mailto:"))return!1;let e=t.slice(7);return ve.string().email().safeParse(e).success})).optional()}).optional(),brandColor:ve.string().optional(),auth:ve.boolean().optional()}),ek=ve.object({enabled:ve.boolean(),experimentalDeferSupport:ve.boolean().optional()}),BBe=ve.object({enabled:ve.boolean()}),MBe=ve.object({enabled:ve.boolean(),title:ve.string().optional()}),Ene=ve.string().max(60).regex(/^(?!-)[a-z0-9-]*[a-z0-9]$/i).transform(t=>t.toLowerCase()),jBe=ve.object({requestSize:ve.object({maxBytes:ve.number(),enabled:ve.boolean()}).nullable().optional(),directives:ve.object({max:ve.number(),enabled:ve.boolean()}).nullable().optional(),depth:ve.object({max:ve.number(),enabled:ve.boolean()}).nullable().optional(),aliases:ve.object({max:ve.number(),enabled:ve.boolean()}).nullable().optional(),suggestionsInErrors:ve.object({mode:ve.enum(["mask"]),enabled:ve.boolean()}).nullable().optional()}),VBe=ve.object({app:Ene.optional(),name:Ene.optional(),originUrl:ve.string().url().optional(),httpVersion:ve.enum(["1.1","2","3"]).optional().nullable(),schema:ve.string().optional().nullable(),schemaPolling:BBe.optional().nullable(),cacheIntrospection:ve.boolean().optional().nullable(),blockIntrospection:ve.boolean().optional().nullable(),injectHeaders:ve.boolean().optional().nullable(),devPortal:ZO.optional().nullable(),partialQueryCaching:ek.optional().nullable(),ignoreOriginCacheControl:ve.boolean().optional().nullable(),queryDepthLimit:ve.number().int().min(0).max(1e3).optional().nullable(),passThroughOnly:ve.boolean().optional().nullable(),mutationPolicy:ve.enum(["Type","List","Entity"]).optional().nullable(),bypassCacheHeaders:ve.array(FBe).optional().nullable(),enablePlayground:ve.boolean().optional().nullable(),headers:ve.record(ve.string().nonempty()).optional().nullable(),scopes:ve.record(ve.string().or(wne).or(CBe)).optional().nullable(),rootTypeNames:NBe.optional().nullable(),keyFields:DBe.optional().nullable(),rules:ve.array(PBe).optional().nullable(),nonCacheable:ve.array(ve.string()).optional().nullable(),retries:IBe.optional().nullable(),customAttributes:OBe.optional().nullable(),userId:kBe.optional().nullable(),graphiql:MBe.optional().nullable(),persistedOperations:RBe.optional().nullable(),requestSigning:LBe.optional().nullable(),getConsumerIdentifiers:M2.optional().nullable(),rateLimit:d3.optional().nullable(),rateLimits:ve.union([ve.array(I1),M2]).optional().nullable(),complexity:h3.optional().nullable(),schemaView:ve.object({include:ve.array(ve.string()),exclude:ve.array(ve.string())}).optional().nullable(),security:jBe.optional().nullable(),removeCookies:ve.array(ve.string()).optional().nullable(),variableLogging:ve.object({enabled:ve.boolean()}).optional().nullable()}),Ane={schema:null,bypassCacheHeaders:null,injectHeaders:null,enablePlayground:null,ignoreOriginCacheControl:null,queryDepthLimit:null,passThroughOnly:null,mutationPolicy:null,headers:null,scopes:null,rootTypeNames:null,keyFields:null,rules:null,nonCacheable:null,retries:null,schemaView:null,removeCookies:null},O1=t=>{try{return VBe.parse(t)}catch(e){throw e instanceof ve.ZodError?new Error(e.errors.map(r=>`${r.path.length>0?`${r.path.join(".")}: `:""}${r.message}`).join(`
|
|
522
|
+
You can get a new api token at ${N1()}`:t}var ve=Oe(require("zod"));var wt=Oe(require("zod")),wBe=wt.string().refine(t=>t.match(/^[1-9][0-9]*(s|m|h)$/)),ABe=wt.object({value:wt.number().int().min(1),unit:wt.enum(["seconds","minutes","hours"])}).strict(),Sne=wt.union([wBe,ABe]),JO=wt.object({type:wt.literal("QueryComplexity"),budget:wt.number().int().min(1),warning:wt.number().int().min(1).optional(),window:Sne}).strict(),XO=wt.object({type:wt.literal("RequestCount"),budget:wt.number().int().min(1),warning:wt.number().int().min(1).optional(),window:Sne}).strict(),M2=wt.union([wt.function(),wt.string()]),QO=["enabled","disabled","dryRun"],I1=wt.object({name:wt.string(),description:wt.string().optional(),state:wt.enum(QO).optional(),groupBy:wt.union([wt.literal("ip"),wt.object({header:wt.string()}),wt.object({cookie:wt.string()}),wt.object({jwt:wt.string()}),wt.object({consumerIdentifier:wt.string()})]),allowList:wt.array(wt.string()).optional(),limit:wt.union([JO,XO])}).strict(),ryr=wt.array(I1),iyr=wt.array(wt.union([I1,wt.object({name:wt.string(),description:wt.string().optional(),state:wt.enum(QO).optional(),group:wt.string(),allowList:wt.array(wt.string()).optional(),limit:wt.union([JO,XO])})])),d3=wt.object({name:wt.string(),description:wt.string().optional(),state:wt.enum(QO).optional(),consumerIdentifier:wt.string().optional(),allowList:wt.array(wt.string()).optional(),limit:wt.union([JO,XO])}).strict(),h3=wt.object({listSizeArguments:wt.array(wt.string()).optional(),maxComplexity:wt.number().int().min(1).optional()}).strict();var PBe=ve.object({types:ve.record(ve.boolean().or(ve.record(ve.boolean())).or(ve.array(ve.string()))).or(ve.array(ve.string())).optional().nullable(),operationHashes:ve.array(ve.string()).optional().nullable(),maxAge:ve.number().min(0).optional().nullable(),swr:ve.number().min(0).optional().nullable(),scope:ve.string().nonempty().optional().nullable(),description:ve.string().optional().nullable()}),_Be=["HS256","HS384","HS512","RS256","RS384","RS512","ES256","ES384","ES256k","EdDSA","PS256","PS384","PS512"],j2=ve.object({claim:ve.string().optional().nullable(),algorithm:ve.enum(_Be).optional().nullable(),secret:ve.string().optional().nullable()}).optional().nullable(),wne=ve.function().args(ve.object({headers:ve.record(ve.string().or(ve.array(ve.string()))),cookies:ve.record(ve.string())})).returns(ve.string().nullable()),CBe=ve.object({definition:ve.union([ve.string(),wne]).optional().nullable(),jwt:j2}),DBe=ve.object({autoAdd:ve.boolean().optional().nullable(),defaults:ve.array(ve.string()).optional().nullable(),types:ve.record(ve.array(ve.string())).nullable()}),NBe=ve.object({query:ve.string().optional().nullable(),mutation:ve.string().optional().nullable(),subscription:ve.string().optional().nullable()}),Tne=ve.object({isEnabled:ve.boolean().optional().nullable(),whenGraphQLResponse:ve.boolean().optional().nullable()}),IBe=ve.object({networkErrors:Tne.optional().nullable(),serverErrors:Tne.optional().nullable()}),xne=5,OBe=ve.record(ve.union([ve.object({header:ve.string(),jwt:j2}),ve.object({cookie:ve.string(),jwt:j2})])).refine(t=>Object.keys(t).length<=xne,{message:`You can't define more than ${xne} custom attributes`}),kBe=ve.union([ve.object({header:ve.string(),jwt:j2}),ve.object({cookie:ve.string(),jwt:j2})]),LBe=ve.object({secret:ve.string().optional().nullable()}),FBe=ve.object({name:ve.string()}),RBe=ve.object({apq:ve.boolean().nullable().optional(),sendHashToOrigin:ve.boolean().nullable().optional(),rejectInvalidHashes:ve.boolean().nullable().optional()}),ZO=ve.object({enabled:ve.boolean(),title:ve.string().optional(),readme:ve.string().optional(),description:ve.string().optional(),urls:ve.object({privacy:ve.string().url().optional(),terms:ve.string().url().optional(),website:ve.string().url().optional(),logo:ve.string().url().optional(),favicon:ve.string().url().optional(),support:ve.string().url().or(ve.string().refine(t=>{if(!t.startsWith("mailto:"))return!1;let e=t.slice(7);return ve.string().email().safeParse(e).success})).optional()}).optional(),brandColor:ve.string().optional(),auth:ve.boolean().optional()}),ek=ve.object({enabled:ve.boolean(),experimentalDeferSupport:ve.boolean().optional()}),BBe=ve.object({enabled:ve.boolean()}),MBe=ve.object({enabled:ve.boolean(),title:ve.string().optional()}),Ene=ve.string().max(60).regex(/^(?!-)[a-z0-9-]*[a-z0-9]$/i).transform(t=>t.toLowerCase()),jBe=ve.object({requestSize:ve.object({maxBytes:ve.number(),enabled:ve.boolean()}).nullable().optional(),directives:ve.object({max:ve.number(),enabled:ve.boolean()}).nullable().optional(),depth:ve.object({max:ve.number(),enabled:ve.boolean()}).nullable().optional(),aliases:ve.object({max:ve.number(),enabled:ve.boolean()}).nullable().optional(),suggestionsInErrors:ve.object({mode:ve.enum(["mask"]),enabled:ve.boolean()}).nullable().optional()}),VBe=ve.object({app:Ene.optional(),name:Ene.optional(),originUrl:ve.string().url().optional(),httpVersion:ve.enum(["1.1","2","3"]).optional().nullable(),schema:ve.string().optional().nullable(),schemaPolling:BBe.optional().nullable(),cacheIntrospection:ve.boolean().optional().nullable(),blockIntrospection:ve.boolean().optional().nullable(),injectHeaders:ve.boolean().optional().nullable(),devPortal:ZO.optional().nullable(),partialQueryCaching:ek.optional().nullable(),ignoreOriginCacheControl:ve.boolean().optional().nullable(),queryDepthLimit:ve.number().int().min(0).max(1e3).optional().nullable(),passThroughOnly:ve.boolean().optional().nullable(),mutationPolicy:ve.enum(["Type","List","Entity","None"]).optional().nullable(),bypassCacheHeaders:ve.array(FBe).optional().nullable(),enablePlayground:ve.boolean().optional().nullable(),headers:ve.record(ve.string().nonempty()).optional().nullable(),scopes:ve.record(ve.string().or(wne).or(CBe)).optional().nullable(),rootTypeNames:NBe.optional().nullable(),keyFields:DBe.optional().nullable(),rules:ve.array(PBe).optional().nullable(),nonCacheable:ve.array(ve.string()).optional().nullable(),retries:IBe.optional().nullable(),customAttributes:OBe.optional().nullable(),userId:kBe.optional().nullable(),graphiql:MBe.optional().nullable(),persistedOperations:RBe.optional().nullable(),requestSigning:LBe.optional().nullable(),getConsumerIdentifiers:M2.optional().nullable(),rateLimit:d3.optional().nullable(),rateLimits:ve.union([ve.array(I1),M2]).optional().nullable(),complexity:h3.optional().nullable(),schemaView:ve.object({include:ve.array(ve.string()),exclude:ve.array(ve.string())}).optional().nullable(),security:jBe.optional().nullable(),removeCookies:ve.array(ve.string()).optional().nullable(),variableLogging:ve.object({enabled:ve.boolean()}).optional().nullable()}),Ane={schema:null,bypassCacheHeaders:null,injectHeaders:null,enablePlayground:null,ignoreOriginCacheControl:null,queryDepthLimit:null,passThroughOnly:null,mutationPolicy:null,headers:null,scopes:null,rootTypeNames:null,keyFields:null,rules:null,nonCacheable:null,retries:null,schemaView:null,removeCookies:null},O1=t=>{try{return VBe.parse(t)}catch(e){throw e instanceof ve.ZodError?new Error(e.errors.map(r=>`${r.path.length>0?`${r.path.join(".")}: `:""}${r.message}`).join(`
|
|
523
523
|
- `),{cause:e}):e}};var Em=Object.freeze({major:16,minor:8,patch:1,preReleaseTag:null});function cr(t,e){if(!!!t)throw new Error(e)}function fo(t){return typeof(t==null?void 0:t.then)=="function"}function Us(t){return typeof t=="object"&&t!==null}function Ui(t,e){if(!!!t)throw new Error(e!=null?e:"Unexpected invariant triggered.")}var UBe=/\r\n|[\n\r]/g;function k1(t,e){let r=0,i=1;for(let s of t.body.matchAll(UBe)){if(typeof s.index=="number"||Ui(!1),s.index>=e)break;r=s.index+s[0].length,i+=1}return{line:i,column:e+1-r}}function tk(t){return m3(t.source,k1(t.source,t.start))}function m3(t,e){let r=t.locationOffset.column-1,i="".padStart(r)+t.body,s=e.line-1,n=t.locationOffset.line-1,a=e.line+n,o=e.line===1?r:0,l=e.column+o,u=`${t.name}:${a}:${l}
|
|
524
524
|
`,c=i.split(/\r\n|[\n\r]/g),p=c[s];if(p.length>120){let d=Math.floor(l/80),f=l%80,h=[];for(let m=0;m<p.length;m+=80)h.push(p.slice(m,m+80));return u+Pne([[`${a} |`,h[0]],...h.slice(1,d+1).map(m=>["|",m]),["|","^".padStart(f)],["|",h[d+1]]])}return u+Pne([[`${a-1} |`,c[s-1]],[`${a} |`,p],["|","^".padStart(l)],[`${a+1} |`,c[s+1]]])}function Pne(t){let e=t.filter(([i,s])=>s!==void 0),r=Math.max(...e.map(([i])=>i.length));return e.map(([i,s])=>i.padStart(r)+(s?" "+s:"")).join(`
|
|
525
525
|
`)}function qBe(t){let e=t[0];return e==null||"kind"in e||"length"in e?{nodes:e,source:t[1],positions:t[2],path:t[3],originalError:t[4],extensions:t[5]}:e}var ce=class extends Error{constructor(e,...r){var i,s,n;let{nodes:a,source:o,positions:l,path:u,originalError:c,extensions:p}=qBe(r);super(e),this.name="GraphQLError",this.path=u!=null?u:void 0,this.originalError=c!=null?c:void 0,this.nodes=_ne(Array.isArray(a)?a:a?[a]:void 0);let d=_ne((i=this.nodes)===null||i===void 0?void 0:i.map(h=>h.loc).filter(h=>h!=null));this.source=o!=null?o:d==null||(s=d[0])===null||s===void 0?void 0:s.source,this.positions=l!=null?l:d==null?void 0:d.map(h=>h.start),this.locations=l&&o?l.map(h=>k1(o,h)):d==null?void 0:d.map(h=>k1(h.source,h.start));let f=Us(c==null?void 0:c.extensions)?c==null?void 0:c.extensions:void 0;this.extensions=(n=p!=null?p:f)!==null&&n!==void 0?n:Object.create(null),Object.defineProperties(this,{message:{writable:!0,enumerable:!0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),c!=null&&c.stack?Object.defineProperty(this,"stack",{value:c.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,ce):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}get[Symbol.toStringTag](){return"GraphQLError"}toString(){let e=this.message;if(this.nodes)for(let r of this.nodes)r.loc&&(e+=`
|
|
@@ -1123,7 +1123,7 @@ Try running "stellate pull" first if your service has been created already.`);le
|
|
|
1123
1123
|
|
|
1124
1124
|
-s, --service Name of the service
|
|
1125
1125
|
-b, --browser Automatically open the preview UI with the default browser
|
|
1126
|
-
`);var Ln=Oe(As());var Bv=Oe(As());var dN=class{async parse(e){return ss(e,{"--help":Boolean,"-h":"--help","--version":Boolean,"-v":"--version","--json":Boolean})["--help"]?this.help():"stellate@2.16.
|
|
1126
|
+
`);var Ln=Oe(As());var Bv=Oe(As());var dN=class{async parse(e){return ss(e,{"--help":Boolean,"-h":"--help","--version":Boolean,"-v":"--version","--json":Boolean})["--help"]?this.help():"stellate@2.16.3"}help(e){if(e)throw new Is(`
|
|
1127
1127
|
${Bv.default.bold.red("!")} ${e}
|
|
1128
1128
|
${dN.help}`);return dN.help}},Gy=dN;Gy.help=is(`
|
|
1129
1129
|
Print current version of Stellate
|
|
@@ -1323,10 +1323,10 @@ ${sI.help}`);return sI.help}},Fw=sI;Fw.help=is(`
|
|
|
1323
1323
|
All further pulls once a ${sa.default.dim("stellate")} config file has been created
|
|
1324
1324
|
${sa.default.dim("$")} stellate pull
|
|
1325
1325
|
|
|
1326
|
-
`);var Rs=Oe(As()),EDe=Oe(up()),bX=Oe(require("is-ci"));var Rw=Oe(As()),gX="stellate_cache";function xDe(t,e,r){let i=[],s=t.getDirective(gX);if(!s)return r;if(!(s.locations.includes(vt.FIELD_DEFINITION)&&s.locations.includes(vt.OBJECT)))return console.warn(Rw.default.yellowBright("The @stellate_cache defined by the schema is defined for unexpected locations, expected are 'FIELD_DEFINITION' and 'OBJECT'.")),r;if(!s.args.find(c=>c.name==="maxAge"))return console.warn(Rw.default.yellowBright("The @stellate_cache directive defined by the schema is missing the 'maxAge: Int!' argument.")),r;if(!s.args.find(c=>c.name==="swr"))return console.warn(Rw.default.yellowBright("The @stellate_cache directive defined by the schema is missing the 'swr: Int' argument.")),r;if(!s.args.find(c=>c.name==="scope"))return console.warn(Rw.default.yellowBright("The @stellate_cache directive defined by the schema is missing the 'scope: String' argument.")),r;let u=Object.entries(t.getTypeMap()).map(([c,p])=>c.startsWith("__")?void 0:p).filter(Boolean);for(let c=0;c<u.length;c++){let p=u[c];if(!Ge(p))continue;let d=ww(t,p,gX);if(d&&d.length){let[h]=d;if(h.scope&&!e.includes(h.scope))throw new Error(`Found scope "${h.scope}" in the schema but not in the stellate config.`);i.push({type:p.name,field:void 0,...h})}let f=Object.values(p.getFields());for(let h=0;h<f.length;h++){let m=f[h],g=ww(t,m,gX);if(!g||!g.length)continue;let[b]=g;if(b.scope&&!e.includes(b.scope))throw new Error(`Found scope "${b.scope}" in the schema but not in the stellate config.`);i.push({type:p.name,field:m.name,...b})}}return i.reduce((c,p)=>{let d=idr(p,c);if(!d)c.push({description:"This rule was generated from schema-directives",types:{[p.type]:p.field?[p.field]:!0},maxAge:p.maxAge,swr:p.swr,scope:p.scope});else if(p.field)if(Array.isArray(d.types[p.type]))d.types[p.type].includes(p.field)||d.types[p.type].push(p.field);else if(!d.types[p.type])d.types[p.type]=[p.field];else throw new Error(`Found "${typeof d.types[p.type]}" for "${p.type}" which is unexpected, file an issue at https://github.com/StellateHQ/cli/issues`);else Array.isArray(d.types[p.type])?c.push({description:"This rule was generated from schema-directives",types:{[p.type]:p.field?[p.field]:!0},maxAge:p.maxAge,swr:p.swr,scope:p.scope}):d.types[p.type]=!0;return c},r)}function idr(t,e){let r=e.filter(i=>i.maxAge===t.maxAge);if(r.length)if(t.swr){let i=r.filter(s=>s.swr===t.swr);if(t.scope){let s=i.filter(n=>n.scope===t.scope);return t.field?s.find(n=>Array.isArray(n.types[t.type])):s.find(n=>!n.types[t.type])}else{let s=i.filter(n=>!n.scope);return t.field?s.find(n=>Array.isArray(n.types[t.type])):s.find(n=>!n.types[t.type])}}else if(t.scope){let i=r.filter(s=>s.scope===t.scope&&!s.swr);return t.field?i.find(s=>Array.isArray(s.types[t.type])):i.find(s=>!s.types[t.type])}else return r.find(i=>!i.swr&&!i.scope)}var aI=class{async parse(e){let r=ss(e,{"--service":String,"--env":String,"--org":String,"--help":Boolean,"--dry":Boolean,"-e":"--env","-o":"--org","-h":"--help","--app":"--service"},!1);if(r["--help"])return this.help();if(r["--env"]&&r["--service"])throw new Error("Please only specify --env or --service.");let i=r._[0];if(i&&i!=="schema")throw new Error("The CLI does not support `stellate push [field]` anymore.\nInstead the entire configuration is now pushed for your environment to match it exactly.\nTo migrate, pull the latest configuration, which may include new fields you have set up in your dashboard, and run `stellate push`.");let s=r._[0]==="schema",n=await Ws(),a=r["--env"],o=await ha(a),l=kl(o,r["--service"]),u=r["--dry"];if(a&&!o)throw new Error(`Could not find configuration for environment "${a}".
|
|
1326
|
+
`);var Rs=Oe(As()),EDe=Oe(up()),bX=Oe(require("is-ci"));var Rw=Oe(As()),gX="stellate_cache";function xDe(t,e,r){let i=[],s=t.getDirective(gX);if(!s)return r;if(!(s.locations.includes(vt.FIELD_DEFINITION)&&s.locations.includes(vt.OBJECT)))return console.warn(Rw.default.yellowBright("The @stellate_cache defined by the schema is defined for unexpected locations, expected are 'FIELD_DEFINITION' and 'OBJECT'.")),r;if(!s.args.find(c=>c.name==="maxAge"))return console.warn(Rw.default.yellowBright("The @stellate_cache directive defined by the schema is missing the 'maxAge: Int!' argument.")),r;if(!s.args.find(c=>c.name==="swr"))return console.warn(Rw.default.yellowBright("The @stellate_cache directive defined by the schema is missing the 'swr: Int' argument.")),r;if(!s.args.find(c=>c.name==="scope"))return console.warn(Rw.default.yellowBright("The @stellate_cache directive defined by the schema is missing the 'scope: String' argument.")),r;let u=Object.entries(t.getTypeMap()).map(([c,p])=>c.startsWith("__")?void 0:p).filter(Boolean);for(let c=0;c<u.length;c++){let p=u[c];if(!Ge(p))continue;let d=ww(t,p,gX);if(d&&d.length){let[h]=d;if(h.scope&&!e.includes(h.scope))throw new Error(`Found scope "${h.scope}" in the schema but not in the stellate config.`);i.push({type:p.name,field:void 0,...h})}let f=Object.values(p.getFields());for(let h=0;h<f.length;h++){let m=f[h],g=ww(t,m,gX);if(!g||!g.length)continue;let[b]=g;if(b.scope&&!e.includes(b.scope))throw new Error(`Found scope "${b.scope}" in the schema but not in the stellate config.`);i.push({type:p.name,field:m.name,...b})}}return i.reduce((c,p)=>{let d=idr(p,c);if(!d)c.push({description:"This rule was generated from schema-directives",types:{[p.type]:p.field?[p.field]:!0},maxAge:p.maxAge,swr:p.swr,scope:p.scope});else if(p.field)if(Array.isArray(d.types[p.type]))d.types[p.type].includes(p.field)||d.types[p.type].push(p.field);else if(!d.types[p.type])d.types[p.type]=[p.field];else throw new Error(`Found "${typeof d.types[p.type]}" for "${p.type}" which is unexpected, file an issue at https://github.com/StellateHQ/cli/issues`);else Array.isArray(d.types[p.type])?c.push({description:"This rule was generated from schema-directives",types:{[p.type]:p.field?[p.field]:!0},maxAge:p.maxAge,swr:p.swr,scope:p.scope}):d.types[p.type]=!0;return c},r)}function idr(t,e){let r=e.filter(i=>i.maxAge===t.maxAge);if(r.length)if(t.swr){let i=r.filter(s=>s.swr===t.swr);if(t.scope){let s=i.filter(n=>n.scope===t.scope);return t.field?s.find(n=>Array.isArray(n.types[t.type])):s.find(n=>!n.types[t.type])}else{let s=i.filter(n=>!n.scope);return t.field?s.find(n=>Array.isArray(n.types[t.type])):s.find(n=>!n.types[t.type])}}else if(t.scope){let i=r.filter(s=>s.scope===t.scope&&!s.swr);return t.field?i.find(s=>Array.isArray(s.types[t.type])):i.find(s=>!s.types[t.type])}else return r.find(i=>!i.swr&&!i.scope)}var aI=class{async parse(e){var g;let r=ss(e,{"--service":String,"--env":String,"--org":String,"--help":Boolean,"--dry":Boolean,"-e":"--env","-o":"--org","-h":"--help","--app":"--service"},!1);if(r["--help"])return this.help();if(r["--env"]&&r["--service"])throw new Error("Please only specify --env or --service.");let i=r._[0];if(i&&i!=="schema")throw new Error("The CLI does not support `stellate push [field]` anymore.\nInstead the entire configuration is now pushed for your environment to match it exactly.\nTo migrate, pull the latest configuration, which may include new fields you have set up in your dashboard, and run `stellate push`.");let s=r._[0]==="schema",n=await Ws(),a=r["--env"],o=await ha(a),l=kl(o,r["--service"]),u=r["--dry"];if(a&&!o)throw new Error(`Could not find configuration for environment "${a}".
|
|
1327
1327
|
Either remove the --env (-e) flag or add configuration for this environment.`);if(!o)throw new Error(`Could not find stellate configuration file.
|
|
1328
|
-
Try running "stellate pull" first if your service has been created already.`);let c=new bs(n);if(u&&s)throw new Error(`We currently don't support combining "--dry" with schema pushes.`);if(Array.isArray(o.rateLimits)){let
|
|
1329
|
-
Please make sure to provide a unique name for each rate limit.`)}}let p=await kJ(o.schema,o.headers),d=await Gf(p,o.headers,o.schemaView);if(Zn(p)){let
|
|
1328
|
+
Try running "stellate pull" first if your service has been created already.`);let c=new bs(n);if(u&&s)throw new Error(`We currently don't support combining "--dry" with schema pushes.`);if(Array.isArray(o.rateLimits)){let b=o.rateLimits.map(x=>x.name),S=new Set(b.filter((x,v)=>b.indexOf(x)!==v));if(S.size>0){let x=[...S].join(", ");throw new Error(`You have configured rate limits with the same name: ${x}.
|
|
1329
|
+
Please make sure to provide a unique name for each rate limit.`)}}if((g=o.partialQueryCaching)!=null&&g.enabled&&o.ignoreOriginCacheControl===!1)throw new Error("Partial Query Caching does not support configuring the cache with the origin Cache-Control header. Please delete the `ignoreOriginCacheControl: false` setting or disable `partialQueryCaching`.");let p=await kJ(o.schema,o.headers),d=await Gf(p,o.headers,o.schemaView);if(Zn(p)){let b=xDe(p,Object.keys(o.scopes||{}),o.rules||[]);o.rules=b}if(!s)try{await this.diffConfig(c,o,l)||process.exit(0)}catch{}if(u)return"";let f=(0,EDe.default)(`Pushing ${s?"schema":"configuration"} for ${Rs.default.bold(o.name)}`).start(),h=null;try{let{app:b}=await c.query(`
|
|
1330
1330
|
query app($name: ServiceName) {
|
|
1331
1331
|
app(name: $name) {
|
|
1332
1332
|
organization {
|
|
@@ -1336,7 +1336,7 @@ Please make sure to provide a unique name for each rate limit.`)}}let p=await kJ
|
|
|
1336
1336
|
}
|
|
1337
1337
|
}
|
|
1338
1338
|
}
|
|
1339
|
-
`,{name:l});h=
|
|
1339
|
+
`,{name:l});h=b.organization}catch{}try{s?await c.query(`
|
|
1340
1340
|
mutation pushAppSchema(
|
|
1341
1341
|
$appName: ServiceName!
|
|
1342
1342
|
$schema: IntrospectionQuery!
|
|
@@ -1359,7 +1359,7 @@ Please make sure to provide a unique name for each rate limit.`)}}let p=await kJ
|
|
|
1359
1359
|
allowDeletion: true
|
|
1360
1360
|
)
|
|
1361
1361
|
}
|
|
1362
|
-
`,{input:o,appName:l,source:bX.default?"CI":"CLI",schema:d})}catch(
|
|
1362
|
+
`,{input:o,appName:l,source:bX.default?"CI":"CLI",schema:d})}catch(b){let S=b.message;if(!S.includes("Could not find app")&&!S.includes("App could not be accessed or found"))if(f.fail(),S.includes("Using the rate-limiting feature is not allowed for this user.")){let x=h?` See ${Qn(Sp(h.slug,l,"security/rate-limiting"))} for how to activate the feature.`:"";throw new Error(`${S}${x}`)}else throw b;if(s)throw f.fail(),new Error("Can't create an app in schema-push mode.");return h=await Mv(c,r["--org"]||process.env.STELLATE_ORG||process.env.GRAPHCDN_ORG),await c.query(`
|
|
1363
1363
|
mutation createApp(
|
|
1364
1364
|
$input: Input!
|
|
1365
1365
|
$schema: IntrospectionQuery
|
|
@@ -1421,7 +1421,7 @@ Try running "stellate pull" first if your service has been created already.`);le
|
|
|
1421
1421
|
value
|
|
1422
1422
|
}
|
|
1423
1423
|
}
|
|
1424
|
-
`,u=await Ws();a=(await new bs(u).query(l,{name:"serve-token-"+Date.now(),appName:e})).createAdminApiToken.value,this.writePurgeToken(e,a)}let o=(0,jX.default)();o.use("/",(0,MX.createProxyMiddleware)({target:n,changeOrigin:!0,logLevel:"silent",onProxyReq:l=>{l.path.endsWith("/")&&(l.path=l.path.slice(0,-1)),l.setHeader("stellate-cli-serve-port",r),l.setHeader("stellate-token",a)}})),o.listen(r)}setupApiProxy(e,r){let i=`https://${e}.stellate.${process.env.STELLATE_ENDPOINT==="staging"||process.env.STELLATE_ENDPOINT==="local"?"dev":"sh"}`,s=(0,jX.default)();s.use("/",(0,MX.createProxyMiddleware)({target:i,changeOrigin:!0,headers:{"stellate-cli-serve-port":""+r},logLevel:"silent"})),s.listen(r)}ensureConfig(){lm.default.existsSync(Ec)||lm.default.mkdirSync(Ec)}getCache(){try{this.ensureConfig();let e=lm.default.readFileSync(iT,"utf-8");return JSON.parse(e)}catch{return{}}}getCacheEntry(e){try{this.ensureConfig();let r=lm.default.readFileSync(iT,"utf-8"),i=JSON.parse(r);if(!e)throw new Error('You need a service-name in your "stellate" config or as the "--service" argument.');return i[e]||{checksum:"",envName:""}}catch{return{checksum:"",envName:""}}}getChecksum(e){return Shr(JSON.stringify(e)+"2.16.
|
|
1424
|
+
`,u=await Ws();a=(await new bs(u).query(l,{name:"serve-token-"+Date.now(),appName:e})).createAdminApiToken.value,this.writePurgeToken(e,a)}let o=(0,jX.default)();o.use("/",(0,MX.createProxyMiddleware)({target:n,changeOrigin:!0,logLevel:"silent",onProxyReq:l=>{l.path.endsWith("/")&&(l.path=l.path.slice(0,-1)),l.setHeader("stellate-cli-serve-port",r),l.setHeader("stellate-token",a)}})),o.listen(r)}setupApiProxy(e,r){let i=`https://${e}.stellate.${process.env.STELLATE_ENDPOINT==="staging"||process.env.STELLATE_ENDPOINT==="local"?"dev":"sh"}`,s=(0,jX.default)();s.use("/",(0,MX.createProxyMiddleware)({target:i,changeOrigin:!0,headers:{"stellate-cli-serve-port":""+r},logLevel:"silent"})),s.listen(r)}ensureConfig(){lm.default.existsSync(Ec)||lm.default.mkdirSync(Ec)}getCache(){try{this.ensureConfig();let e=lm.default.readFileSync(iT,"utf-8");return JSON.parse(e)}catch{return{}}}getCacheEntry(e){try{this.ensureConfig();let r=lm.default.readFileSync(iT,"utf-8"),i=JSON.parse(r);if(!e)throw new Error('You need a service-name in your "stellate" config or as the "--service" argument.');return i[e]||{checksum:"",envName:""}}catch{return{checksum:"",envName:""}}}getChecksum(e){return Shr(JSON.stringify(e)+"2.16.3")}writePurgeToken(e,r){let i=this.getCache();i[e]={...i[e],purgeToken:r},lm.default.writeFileSync(iT,JSON.stringify(i))}writeCache(e,r,i){let s=this.getCache();if(!e)throw new Error('You need a service-name in your "stellate" config or as the "--service" argument.');return s[e]={checksum:this.getChecksum(r),envName:i},lm.default.writeFileSync(iT,JSON.stringify(s)),s[e]}},Yw=VX;Yw.help=is(`
|
|
1425
1425
|
(BETA) - Use a local backend with Stellate\u2019s GraphQL Edge Cache.
|
|
1426
1426
|
|
|
1427
1427
|
${Xv.default.bold("Usage")}
|
package/dist/index.d.ts
CHANGED
|
@@ -181,7 +181,7 @@ declare const inputSchema: z.ZodObject<{
|
|
|
181
181
|
ignoreOriginCacheControl: z.ZodNullable<z.ZodOptional<z.ZodBoolean>>;
|
|
182
182
|
queryDepthLimit: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
183
183
|
passThroughOnly: z.ZodNullable<z.ZodOptional<z.ZodBoolean>>;
|
|
184
|
-
mutationPolicy: z.ZodNullable<z.ZodOptional<z.ZodEnum<["Type", "List", "Entity"]>>>;
|
|
184
|
+
mutationPolicy: z.ZodNullable<z.ZodOptional<z.ZodEnum<["Type", "List", "Entity", "None"]>>>;
|
|
185
185
|
bypassCacheHeaders: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
186
186
|
name: z.ZodString;
|
|
187
187
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -1005,7 +1005,7 @@ declare const inputSchema: z.ZodObject<{
|
|
|
1005
1005
|
ignoreOriginCacheControl?: boolean | null | undefined;
|
|
1006
1006
|
queryDepthLimit?: number | null | undefined;
|
|
1007
1007
|
passThroughOnly?: boolean | null | undefined;
|
|
1008
|
-
mutationPolicy?: "Type" | "List" | "Entity" | null | undefined;
|
|
1008
|
+
mutationPolicy?: "Type" | "List" | "Entity" | "None" | null | undefined;
|
|
1009
1009
|
bypassCacheHeaders?: {
|
|
1010
1010
|
name: string;
|
|
1011
1011
|
}[] | null | undefined;
|
|
@@ -1242,7 +1242,7 @@ declare const inputSchema: z.ZodObject<{
|
|
|
1242
1242
|
ignoreOriginCacheControl?: boolean | null | undefined;
|
|
1243
1243
|
queryDepthLimit?: number | null | undefined;
|
|
1244
1244
|
passThroughOnly?: boolean | null | undefined;
|
|
1245
|
-
mutationPolicy?: "Type" | "List" | "Entity" | null | undefined;
|
|
1245
|
+
mutationPolicy?: "Type" | "List" | "Entity" | "None" | null | undefined;
|
|
1246
1246
|
bypassCacheHeaders?: {
|
|
1247
1247
|
name: string;
|
|
1248
1248
|
}[] | null | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stellate",
|
|
3
|
-
"version": "2.16.
|
|
3
|
+
"version": "2.16.3",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=16"
|
|
6
6
|
},
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"vitest": "^1.4.0",
|
|
45
45
|
"ws": "8.11.0",
|
|
46
46
|
"yaml": "^1.10.2",
|
|
47
|
-
"@gcdn/configuration": "1.
|
|
47
|
+
"@gcdn/configuration": "1.39.0"
|
|
48
48
|
},
|
|
49
49
|
"bin": {
|
|
50
50
|
"stellate": "dist/bin.js",
|