ripplo 0.20.1 → 0.20.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.
@@ -126,7 +126,7 @@ directive @setup(path: [String!]!, kind: SetupKind!) on FIELD_DEFINITION
126
126
  enum SetupKind { create replace }
127
127
  scalar Date
128
128
  scalar DateTime
129
- `,Jx=f.strictObject({id:f.string().min(1)}),qs=f.strictObject({entity:f.string().min(1)}),Qx=f.strictObject({value:f.string()}),qx=f.strictObject({name:f.string().min(1)}),lo=f.strictObject({kind:f.enum(["create","replace"]),path:f.array(f.string().min(1)).min(1)});function it(e){let t=Zh(e.schema,e.node,e.name)?.[0];return t==null?void 0:e.validator.parse(t)}a(it,"readDirective");function Pr(e){return Zh(e.schema,e.node,e.name)?.[0]!=null}a(Pr,"hasDirective");function Yx(e){return`Declare a supported representation for scalar ${e}.`}a(Yx,"renderUnknownScalar");function Mn(e){return`The constraints do not apply to ${e}. String takes minLength and maxLength. Int and Float take min and max. No other type takes a constraint.`}a(Mn,"renderInvalidConstraint");var Kx="The constraint min is above its max.",Wx="The constraint minLength is above its maxLength.";function Hx(e){return`The schema operation ${e} does not exist.`}a(Hx,"renderMissingOperation");var Ks="actor",Ys="actor";function po(e){return tO(e).match(t=>t,t=>{throw new TypeError(`schema-layout-invalid:${t.map(n=>n.kind).join(",")}`)})}a(po,"schemaLayout");function tO(e){let t=rO(e),n=[...t.issues,...nO(e),...iO(e),...oO(e)];return n.length>0?Le(n):rt({actor:t.root,mutation:e.getMutationType()??void 0})}a(tO,"readSchemaLayout");function rO(e){let t=e.getQueryType(),n=t?.getFields()[Ys];if(t==null||n==null)return{issues:[],root:void 0};let i=j(n.type)?n.type.ofType:void 0,r=n.args.length===0?[]:[{field:Ys,kind:"root-field-arguments"}];return!A(i)||!Pr({name:"entity",node:i,schema:e})?{issues:[...r,{field:Ys,kind:"root-field-type"}],root:void 0}:{issues:r,root:{field:n,query:t,type:i}}}a(rO,"actorRoot");function nO(e){return Object.keys(e.getQueryType()?.getFields()??{}).filter(t=>t!==Ys).map(t=>({field:t,kind:"root-field-unexpected"}))}a(nO,"unexpectedQueryFields");function iO(e){return e.getSubscriptionType()==null?[]:[{kind:"subscription-present"}]}a(iO,"subscriptionIssues");function oO(e){return Object.values(e.getMutationType()?.getFields()??{}).filter(t=>!Pr({name:"setup",node:t,schema:e})).map(t=>({field:t.name,kind:"mutation-field-not-setup"}))}a(oO,"mutationIssues");var Xx=new WeakMap;function aO(e){let t=Xx.get(e);if(t!=null)return t;let n=[...tb(e),...Ws(e)];return Xx.set(e,n),n}a(aO,"schemaOperations");function Ws(e){let{mutation:t}=po(e);return t==null?[]:Object.values(t.getFields()).map(n=>sO({field:n,owner:t,schema:e}))}a(Ws,"setupOperationsOf");function Zn(e){return tb(e)[0]}a(Zn,"actorOperation");function Bh(e){let t=aO(e.schema).find(n=>n.id===e.id);if(t==null)throw new TypeError(Hx(e.id));return t}a(Bh,"requireOperation");function eb(e){let t=Bh(e);if(t.kind!=="setup")throw new TypeError(`operation-not-setup:${e.id}`);return t}a(eb,"requireSetupOperation");function tb(e){let{actor:t}=po(e);return t==null?[]:[{field:t.field,id:rb({field:t.field,owner:t.query}),kind:"actor",owner:t.query}]}a(tb,"actorOperations");function sO({field:e,owner:t,schema:n}){let i=it({name:"setup",node:e,schema:n,validator:lo});if(i==null)throw new TypeError(`setup-operation-metadata-missing:${t.name}.${e.name}`);return{field:e,id:rb({field:e,owner:t}),kind:"setup",owner:t,setup:i}}a(sO,"setupOperation");function rb({field:e,owner:t}){return ct.parse(`${t.name}.${e.name}`)}a(rb,"operationId");function Jh(e,t){switch(t.kind){case"null":return`${e} is null, but the schema requires a value.`;case"not-list":return`${e} is not a list.`;case"not-object":return`${e} is not an object.`;case"scalar":return`${e} is invalid: ${t.messages.join(" ")}`;case"typename":return`${e} has __typename ${t.typename}, but the schema requires ${t.expected}.`}}a(Jh,"renderValueProblem");function nb(e,t){return`${e} holds ${JSON.stringify(t.value)}, which is not a usable ID. Use a nonempty string or an integer.`}a(nb,"renderIdentityProblem");function ib(e){return`The returned object has no ${e} field.`}a(ib,"renderMissingReturnedField");function ob(e){return`${e} cannot be read because the returned value is not an object.`}a(ob,"renderReturnedParentNotObject");function ab(e){return`The returned value is not JSON: ${e.join(" ")}`}a(ab,"renderNonJsonReturn");function sb(e){return`${e} cannot read facts.references.identities. No binding sees the ids setup created. Reference arguments arrive as the application's own ids.`}a(sb,"renderHiddenIdentities");var We=class extends Error{constructor(n){super(cb(n));this.failures=n;this.name=cm}static{a(this,"BindingError")}},Qh=class extends Error{constructor(n,i){super(`${cb(n)} (${i})`);this.failures=n;this.written=i;this.name=um}static{a(this,"SetupBindingError")}};function Hs(e){return t=>{throw t instanceof We?new Qh(t.failures,e):t}}a(Hs,"setupFailure");function cb(e){return e.map(t=>`${t.kind}: ${t.operation}`).join(", ")}a(cb,"renderFailures");var lr=class extends Error{constructor(n){super(n.join(" "));this.issues=n;this.name="SchemaOutputValidationError"}static{a(this,"OutputValidationError")}};var Gn=f.record(f.string().min(1),f.record(f.string().min(1),f.string().min(1))),qh=f.union([f.string().min(1),f.number().int()]).transform(String);function ub({entity:e,modelId:t,registry:n}){let i=lb({entity:e,modelId:t,registry:n});if(i==null)throw new fo({entity:e,modelId:t});return i}a(ub,"applicationId");var fo=class extends Error{constructor(n){super(`identity-unbound:${n.entity}:${n.modelId}`);this.identity=n;this.name="MissingIdentityError"}static{a(this,"MissingIdentityError")}};function lb({entity:e,modelId:t,registry:n}){let i=pb({entity:e,registry:n});if(i===void 0||!Object.hasOwn(i,t))return;let r=i[t];if(r===void 0)throw new TypeError(`identity-entry-invalid:${e}:${t}`);return r}a(lb,"knownIdentity");function pb({entity:e,registry:t}){if(!Object.hasOwn(t,e))return;let n=t[e];if(n===void 0)throw new TypeError(`identity-entity-invalid:${e}`);return n}a(pb,"entityIdentities");function db(e){let t=pb(e)??{},n=Object.entries(t).find(([r,o])=>r!==e.modelId&&o===e.applicationId);if(n!=null)throw new TypeError(`identity-alias:${e.entity}:${e.modelId}:${n[0]}`);let i=lb(e);if(i!=null&&i!==e.applicationId)throw new TypeError(`identity-rebound:${e.entity}:${e.modelId}`);return{...e.registry,[e.entity]:{...t,[e.modelId]:e.applicationId}}}a(db,"registerIdentity");function Xs(e){return Gn.parse(e.identities)}a(Xs,"registryFromReferences");function Bn(e){return qh.parse(e)}a(Bn,"identityValue");function Yh(e){return Object.values(e.getTypeMap()).filter(t=>A(t)||M(t)).flatMap(t=>Object.values(t.getFields()).flatMap(n=>{let i=it({name:"referenceValue",node:n,schema:e,validator:qx});return i==null?[]:[{field:n,name:i.name,parent:t.name}]}))}a(Yh,"referenceDeclarations");function fb({entity:e,modelId:t,references:n,schema:i,value:r}){if(!st(r))throw new TypeError(`entity-value-not-object:${e.type.name}`);let o=db({applicationId:Bn(r[e.identity.id]),entity:e.type.name,modelId:t,registry:Xs(n)});return Yh(i).filter(s=>s.parent===e.type.name).reduce((s,{field:c,name:u})=>{let l=r[c.name];if(l===void 0)throw new TypeError(`entity-field-missing:${e.type.name}.${c.name}`);return{...s,[u]:{...cO(s[u]),[t]:l}}},{...n,identities:o})}a(fb,"bindEntity");function cO(e){if(e===void 0)return{};if(!st(e))throw new TypeError("reference-value-is-not-record");return e}a(cO,"keyedValues");var Kh="identities";function mb({operation:e,references:t}){let n=Object.fromEntries(Object.entries(t).filter(([i])=>i!==Kh));return uO({operation:e,value:n})}a(mb,"bindingReferences");function uO({operation:e,value:t}){return new Proxy(t,{get:a((n,i,r)=>{if(i===Kh)throw new TypeError(sb(e));return Reflect.get(n,i,r)},"get")})}a(uO,"refusingIdentities");function ec({references:e,schema:t}){return{...Object.fromEntries(Yh(t).map(i=>[i.name,{}])),[Kh]:{},...e}}a(ec,"initialReferences");function hb(e){switch(e.kind){case"network":return"The request did not reach the application.";case"http":return`The request returned status ${String(e.status)}.`;case"not-json":return"The response was not JSON."}}a(hb,"renderReadFailure");var pr=class extends Error{constructor(n){super(hb(n));this.readFailure=n;this.name=pm}static{a(this,"ReadFailureError")}};var vb=Symbol.for("ripplo.last-transient-fetch-failure"),gb=Symbol.for("ripplo.fetch-monitored"),lO=f.strictObject({at:f.number(),failure:yn});function xb(){if(Reflect.get(globalThis,gb)===globalThis.fetch)return;let e=globalThis.fetch.bind(globalThis),t=a(async(...n)=>{let i=await e(...n).catch(r=>{throw yb({kind:"network"}),r});return yb({kind:"http",status:i.status}),i},"monitored");Reflect.set(globalThis,"fetch",t),Reflect.set(globalThis,gb,t)}a(xb,"installFetchMonitor");function bb(e){let t=lO.optional().parse(Reflect.get(globalThis,vb));return t!=null&&t.at>=e?t.failure:void 0}a(bb,"transientFailureSince");function yb(e){hm(e)&&Reflect.set(globalThis,vb,{at:performance.now(),failure:e})}a(yb,"recordFailure");var pO=f.custom(e=>typeof e=="function");function Wh({arguments:e,operation:t,resolvers:n}){let i=n[t];if(i===void 0)throw new We([{arguments:e,kind:"missing",operation:t}]);return pO.parse(i)}a(Wh,"requireResolver");async function _b(e){let{context:t,invoke:n,operation:i,runtime:r}=e,o=Wh({arguments:e.arguments,operation:i,resolvers:r.module.resolvers}),s={...t,references:mb({operation:i,references:t.references})};r.trace({kind:"started",operation:i,token:t.run.token});let c=performance.now(),u=await Promise.resolve().then(()=>n(o,s)).catch(p=>{throw dO({error:p,operation:i,startedAt:c})}),{value:l}=fO({operation:i,returned:u});return r.trace({durationMs:performance.now()-c,kind:"returned",operation:i,token:t.run.token}),l}a(_b,"callResolver");function dO({error:e,operation:t,startedAt:n}){let i=bb(n);if(i!=null)return new pr(i);let r=Ai(e);return new We([{kind:"execution-failed",message:r.kind==="error"?r.message:r.value,operation:t}])}a(dO,"executionFailure");function fO({operation:e,returned:t}){let n=yt.safeParse(t);if(n.success)return{value:n.data};let i=ab(n.error.issues.map(r=>r.message));throw new We([{issues:[i],kind:"invalid-output",operation:e}])}a(fO,"jsonReturn");function tc({schema:e,type:t}){return t.getValues().map(n=>{let i=it({name:"value",node:n,schema:e,validator:Qx});return{application:n.name,model:i==null?n.name:i.value}})}a(tc,"enumValues");function Sb(e){return Object.fromEntries(e.operation.field.args.flatMap(t=>{let n=e.arguments[t.name];if(n===void 0){if(!j(t.type)||t.defaultValue!==void 0)return[];throw new TypeError(`operation-argument-missing:${t.name}`)}let i=rc({node:t,registry:e.registry,schema:e.schema,type:t.type,value:n});return[[t.name,i.value]]}))}a(Sb,"applicationArguments");function rc(e){return e.value===null?{value:null}:j(e.type)?rc({...e,type:e.type.ofType}):J(e.type)?mO(e):hO(e)}a(rc,"mapArgument");function mO(e){if(!J(e.type)||!Array.isArray(e.value))throw new TypeError("operation-input-list-invalid");let t=e.type.ofType;return{value:e.value.map(n=>rc({...e,type:t,value:n}).value)}}a(mO,"mapInputList");function hO(e){let t=it({name:"reference",node:e.node,schema:e.schema,validator:qs});if(t!=null)return{value:ub({entity:t.entity,modelId:Bn(e.value),registry:e.registry})};if(te(e.type)){let n=tc({schema:e.schema,type:e.type}).find(i=>i.model===e.value);if(n==null)throw new TypeError("operation-input-enum-invalid");return{value:n.application}}return V(e.type)?gO(e):{value:e.value}}a(hO,"mapLeafArgument");function gO(e){if(!V(e.type)||!st(e.value))throw new TypeError("operation-input-object-invalid");let t=e.value,n=e.type.getFields();return{value:Object.fromEntries(Object.entries(t).map(([i,r])=>{let o=n[i];if(o==null)throw new TypeError(`operation-input-field-unknown:${i}`);return[i,rc({...e,node:o,type:o.type,value:r}).value]}))}}a(gO,"mapInputObject");function nc({schema:e,type:t}){let n=Hh({schema:e,type:t});if(n==null)throw new TypeError(`entity-metadata-missing:${String(t)}`);let[i]=yO({entity:n,schema:e});if(i!=null)throw new TypeError(`entity-${i.role}-invalid:${n.type.name}:${i.field}`);return n}a(nc,"requireEntity");function Hh({schema:e,type:t}){let n=le(t);if(!A(n))return;let i=it({name:"entity",node:n,schema:e,validator:Jx});return i==null?void 0:{identity:i,type:n}}a(Hh,"readEntity");function yO({entity:e,schema:t}){let{identity:n,type:i}=e,r=i.getFields(),o=r[n.id],c=o!=null&&j(o.type)&&be(o.type.ofType)?[]:[{field:n.id,role:"id"}],u=Object.values(r).flatMap(l=>{let p=le(l.type);return[...l.name===n.id||Pr({name:"referenceValue",node:l,schema:t})?[]:[{field:l.name,role:"undeclared"}],...be(p)||te(p)?[]:[{field:l.name,role:"composite"}],...l.args.length===0?[]:[{field:l.name,role:"arguments"}]]});return[...c,...u]}a(yO,"entityFieldProblems");var Xh="value",Tb=new WeakMap;function ic(e){let t=Tb.get(e);if(t!=null)return t;let n=vO(e).match(i=>i,i=>{throw new TypeError(`seed-tree-invalid:${i.map(r=>r.kind).join(",")}`)});return Tb.set(e,n),n}a(ic,"seedTree");function vO(e){let t=Ws(e).reduce((n,i)=>xO(i).andThen(r=>tg({leaf:r,path:i.setup.path,tree:n.tree})).match(r=>({issues:n.issues,tree:r}),r=>({issues:[...n.issues,...r],tree:n.tree})),{issues:[],tree:$b});return t.issues.length>0?Le(t.issues):rt(t.tree)}a(vO,"readSeedTree");var $b={fields:{},kind:"object"};function eg(e){let[t,...n]=e.field.args;return t?.name===Xh&&n.length===0?t:void 0}a(eg,"valueArgument");function xO(e){let t=eg(e);return t==null?Le([{kind:"setup-arguments-invalid",setup:e.id}]):rt({kind:e.setup.kind,operation:e,value:t})}a(xO,"seedLeaf");function tg({leaf:e,path:t,tree:n}){let[i,...r]=t;if(i==null)throw new TypeError(`setup-path-empty:${e.operation.id}`);let o=Object.hasOwn(n.fields,i)?n.fields[i]:void 0,s=_O({existing:o,last:r.length===0,leaf:e});return s!=null?Le([s]):(o?.kind==="object"?tg({leaf:e,path:r,tree:o}):bO({leaf:e,path:r})).map(u=>({...n,fields:{...n.fields,[i]:u}}))}a(tg,"withLeaf");function bO({leaf:e,path:t}){return t.length===0?rt(e):tg({leaf:e,path:t,tree:$b})}a(bO,"nested");function _O({existing:e,last:t,leaf:n}){let i=n.operation.id,{path:r}=n.operation.setup;if(e!=null)return e.kind==="object"?t?{kind:"setup-path-overlap",path:r,setup:i}:void 0:t?{kind:"setup-path-shared",other:e.operation.id,path:r,setup:i}:{kind:"setup-path-overlap",path:r,setup:i}}a(_O,"pathConflict");var rg=ct,ng=yt,Ib=f.discriminatedUnion("kind",[f.strictObject({kind:sm.extract(["actor"]),operation:rg}),f.strictObject({kind:lo.shape.kind.extract(["create"]),modelId:f.string().min(1),operation:rg,value:ng}),f.strictObject({kind:lo.shape.kind.extract(["replace"]),operation:rg,value:ng})]),SO=f.strictObject({references:_r,value:ng}),bG=f.discriminatedUnion("kind",[SO.extend({kind:f.literal("returned")}),f.strictObject({failures:Li,kind:f.literal("binding-failed")}),f.strictObject({entity:Gn.keyType,kind:f.literal("missing-reference"),modelId:Gn.valueType.keyType}),f.strictObject({failure:yn,kind:f.literal("read-failed")}),f.strictObject({error:om,kind:f.literal("failed")})]);function oc(e){switch(e.kind){case"actor":return{};case"create":case"replace":return{[Xh]:e.value}}}a(oc,"setupCallArguments");function Eb({references:e,run:t}){return{references:e,run:t,scope:{kind:"observation"}}}a(Eb,"freshOperationContext");function Ob({operation:e,schema:t}){let n=t.getType(e.owner.name);if(!A(n))throw new TypeError(`operation-owner-not-object:${e.owner.name}`);let i=new Et({...t.toConfig(),mutation:void 0,query:n,subscription:void 0}),r=In(TO(e)),o=zs(i,r);if(o.length>0)throw new AggregateError(o,"invalid-operation-query");return{document:r,schema:i}}a(Ob,"operationDocument");function TO({field:e}){let t=e.args.map(o=>{let s=o.defaultValue===void 0?null:jt(o.defaultValue,o.type),c=s==null?"":` = ${ee(s)}`;return`$${o.name}: ${String(o.type)}${c}`}),n=e.args.map(o=>`${o.name}: $${o.name}`),i=t.length===0?"":`(${t.join(", ")})`,r=n.length===0?"":`(${n.join(", ")})`;return`query Resolve${i} { ${e.name}${r}${$O(e.type)} }`}a(TO,"renderOperationQuery");function $O(e){let t=le(e);if(de(t))return"";if(!A(t))throw new TypeError(`operation-return-type-unsupported:${t.name}`);return` { ${Object.values(t.getFields()).map(i=>{if(!de(le(i.type))||i.args.length>0)throw new TypeError(`operation-return-field-unsupported:${t.name}.${i.name}`);return i.name}).join(" ")} }`}a($O,"returnSelection");var ig=Symbol("schema-resolver"),og=f.custom(e=>typeof e=="function"),IO=og.parse(Cn);function wb({args:e,context:t,info:n,source:i,standard:r}){if(t==null||typeof t!="object")return r(i,e,t,n);let o=Reflect.get(t,ig);return(o===void 0?r:og.parse(o))(i,e,t,n)}a(wb,"resolveSchemaField");function Nb(e){return e===void 0?IO:og.parse(e)}a(Nb,"standardSchemaResolver");async function Db({arguments:e,context:t,operation:n,runtime:i}){let r=await Cs({...Ob({operation:n,schema:i.schema}),contextValue:{...t,[ig]:EO({operation:n,runtime:i})},rootValue:{},variableValues:e});if(r.errors!=null)throw OO({errors:r.errors,operation:n});let o=yt.parse(r.data),s=st(o)?o[n.field.name]:void 0;if(s===void 0)throw new TypeError(`operation-result-missing:${n.id}`);return s}a(Db,"executeOperation");function EO({operation:e,runtime:t}){return async(n,i,r,o)=>{let s=`${o.parentType.name}.${o.fieldName}`;if(s===e.id)return _b({arguments:i,context:r,operation:e.id,runtime:t,invoke:a((u,l)=>u(n,i,l,o),"invoke")});if(!st(n))throw new lr([ob(s)]);let c=n[o.fieldName];if(c===void 0)throw new lr([ib(s)]);return c}}a(EO,"operationResolver");function OO({errors:e,operation:t}){let n=e.map(u=>wO({error:u,operation:t})),i=n.find(u=>u.kind==="transient")??n.find(u=>u.kind==="invariant");if(i!=null&&i.kind!=="implementation")return i.error;let r=n.flatMap(u=>u.kind==="implementation"?u.failures:[]),o=r.flatMap(u=>u.kind==="invalid-output"?u.issues:[]),[s,...c]=[...r.filter(u=>u.kind!=="invalid-output"),...o.length===0?[]:[{issues:o,kind:"invalid-output",operation:t.id}]];if(s==null)throw new TypeError(`operation-errors-empty:${t.id}`);return new We([s,...c])}a(OO,"operationFailure");function wO({error:e,operation:t}){let n=e.originalError;return n instanceof We?{failures:n.failures,kind:"implementation"}:n instanceof pr?{error:n,kind:"transient"}:n instanceof lr?kb({issues:n.issues,operation:t}):n instanceof x?kb({issues:[n.message],operation:t}):{error:n??e,kind:"invariant"}}a(wO,"classifyError");function kb({issues:e,operation:t}){return{failures:[{issues:[...e],kind:"invalid-output",operation:t.id}],kind:"implementation"}}a(kb,"invalidOutput");async function Jn({call:e,runtime:t,target:n}){let{schema:i}=t,r=Bh({id:e.operation,schema:i}),o=r.kind==="actor"?r.kind:r.setup.kind;if(o!==e.kind)throw new TypeError(`setup-operation-kind-mismatch:${e.operation}:${e.kind}:${o}`);let s=await Db({arguments:Sb({arguments:oc(e),operation:r,registry:Xs(n.references),schema:i}),context:Eb(n),operation:r,runtime:t});switch(e.kind){case"replace":return{references:n.references,value:s};case"actor":case"create":return{references:fb({entity:nc({schema:i,type:r.field.type}),modelId:e.kind==="actor"?Ks:e.modelId,references:n.references,schema:i,value:s}),value:s}}}a(Jn,"invokeSetupOperation");function Rb({runtime:e,steps:t}){let n=Zn(e.schema),r=[...n==null?[]:[{arguments:{},operation:n.id}],...t.map(c=>({arguments:oc(c),operation:c.operation}))].flatMap(c=>NO({...c,runtime:e})),[o,...s]=[...new Map(r.map(c=>[c.operation,c])).values()];if(o!=null)throw new We([o,...s])}a(Rb,"requireSetupBindings");async function Ab({runtime:e,steps:t,target:n}){return t.reduce(async(i,r)=>kO({runtime:e,step:r,target:await i}),Promise.resolve(n)).catch(Hs("written"))}a(Ab,"executeSetup");function NO({arguments:e,operation:t,runtime:n}){try{return Wh({arguments:e,operation:t,resolvers:n.module.resolvers}),[]}catch(i){if(i instanceof We)return i.failures;throw i}}a(NO,"missingBinding");async function kO({runtime:e,step:t,target:n}){let i=await Jn({call:t,runtime:e,target:n});return{...n,references:i.references}}a(kO,"executeStep");var cc=yg(jb(),1);function mo(e){let{node:t,schema:n,type:i,value:r}=e;if(r===null)return[];if(j(i))return mo({...e,type:i.ofType});if(J(i)){if(!Array.isArray(r))throw new TypeError("identity-dependency-list-invalid");return r.flatMap(s=>mo({...e,type:i.ofType,value:s}))}let o=it({name:"reference",node:t,schema:n,validator:qs});return o!=null?[{entity:o.entity,modelId:Bn(r)}]:V(i)?DO({schema:n,type:i,value:r}):[]}a(mo,"referenceDependencies");function DO({schema:e,type:t,value:n}){if(!st(n))throw new TypeError("identity-dependency-object-invalid");let i=t.getFields();return Object.entries(n).flatMap(([r,o])=>{let s=i[r];if(s==null)throw new TypeError(`identity-dependency-field-missing:${r}`);return mo({node:s,schema:e,type:s.type,value:o})})}a(DO,"fieldDependencies");function Lb({schema:e,steps:t}){let n=t.map(o=>RO({schema:e,step:o})),i=AO(e),r=new cc.DepGraph;return n.forEach((o,s)=>{r.addNode(String(s),o.step)}),n.forEach((o,s)=>{jO({actor:i,task:o,tasks:n}).forEach(c=>{r.addDependency(String(s),String(c))})}),LO(r).map(o=>r.getNodeData(o))}a(Lb,"orderedSetupSteps");function RO({schema:e,step:t}){let n=eb({id:t.operation,schema:e}),i=eg(n);if(i==null)throw new TypeError(`setup-value-argument-missing:${n.id}`);return{created:t.kind==="create"?{entity:nc({schema:e,type:n.field.type}).type.name,modelId:t.modelId}:void 0,dependencies:mo({node:i,schema:e,type:i.type,value:t.value}),step:t}}a(RO,"setupTask");function AO(e){let{actor:t}=po(e);return t==null?void 0:{entity:t.type.name,modelId:Ks}}a(AO,"actorIdentity");function jO({actor:e,task:t,tasks:n}){return t.dependencies.flatMap(i=>{let r=xn(i),o=n.findIndex(s=>s.created!=null&&xn(s.created)===r);if(o!==-1)return[o];if(e==null||xn(e)!==r)throw new TypeError(`setup-reference-unbound:${i.entity}:${i.modelId}`);return[]})}a(jO,"prerequisites");function LO(e){try{return e.overallOrder()}catch(t){throw t instanceof cc.DepGraphCycleError?new TypeError(`setup-reference-dependency-cycle:${t.cyclePath.join(",")}`):t}}a(LO,"topologicalOrder");function Pb({schema:e,seed:t}){return Ub({node:ic(e),path:[],value:t})}a(Pb,"setupPlan");function Ub({node:e,path:t,value:n}){switch(e.kind){case"replace":return[{kind:"replace",operation:e.operation.id,path:t,value:n}];case"create":return Object.entries(zb({path:t,value:n})).map(([i,r])=>({kind:"create",modelId:i,operation:e.operation.id,path:t,value:r}));case"object":{let i=zb({path:t,value:n});return Object.entries(e.fields).flatMap(([r,o])=>{let s=Object.hasOwn(i,r)?i[r]:void 0;if(s===void 0)throw new TypeError(`seed-path-missing:${[...t,r].join(".")}`);return Ub({node:o,path:[...t,r],value:s})})}}}a(Ub,"nodeSteps");function zb({path:e,value:t}){if(!st(t))throw new TypeError(`seed-path-not-object:${e.join(".")}`);return t}a(zb,"seedObject");function Fb({field:e,parent:t}){let n=e.astNode?.name.value;if(n==null||t==null||!A(t)&&!M(t))return[e];let i=sg({interfaces:t.getInterfaces(),name:n,seen:[]});return[e,...i]}a(Fb,"fieldSources");function uc({argument:e,field:t,parent:n}){if(!A(n)&&!M(n))throw new TypeError("argument-parent-is-not-object");let i=sg({interfaces:n.getInterfaces(),name:t.name,seen:[]});return[e,...i.flatMap(r=>r.args.filter(o=>o.name===e.name))]}a(uc,"argumentSources");function sg({interfaces:e,name:t,seen:n}){return e.flatMap(i=>{if(n.includes(i.name))throw new TypeError(`constraint-interface-cycle:${i.name}`);let r=i.getFields()[t];return[...r==null?[]:[r],...sg({interfaces:i.getInterfaces(),name:t,seen:[...n,i.name]})]})}a(sg,"inheritedFields");var cg=f.strictObject({max:f.number().optional(),maxLength:f.number().int().nonnegative().optional(),min:f.number().optional(),minLength:f.number().int().nonnegative().optional()}).refine(e=>e.min==null||e.max==null||e.min<=e.max,{error:Kx}).refine(e=>e.minLength==null||e.maxLength==null||e.minLength<=e.maxLength,{error:Wx});function lc(e){switch(e){case"String":return f.string();case"Int":return ug("Int");case"Float":return ug("Float");case"Boolean":return f.boolean();case"ID":return f.union([f.string(),f.number().int()]);case"Date":return f.iso.date();case"DateTime":return f.iso.datetime({offset:!0})}throw new TypeError(Yx(e))}a(lc,"scalarValidator");function ug(e){return e==="Int"?f.number().int().min(-2147483648).max(2147483647):f.number()}a(ug,"numberValidator");function Cb({bounds:e,name:t}){if(t==="String")return zO(e);if(t==="Int"||t==="Float")return PO({bounds:e,name:t});throw new TypeError(Mn(t))}a(Cb,"fieldScalarValidator");function zO(e){if(e.min!=null||e.max!=null)throw new TypeError(Mn("String"));let t=e.minLength==null?f.string():f.string().min(e.minLength);return e.maxLength==null?t:t.max(e.maxLength)}a(zO,"boundedString");function PO({bounds:e,name:t}){if(e.minLength!=null||e.maxLength!=null)throw new TypeError(Mn(t));let n=ug(t),i=e.min==null?n:n.min(e.min);return e.max==null?i:i.max(e.max)}a(PO,"boundedNumber");function qn({fields:e,schema:t}){let n=e[0];if(n==null)throw new TypeError("scalar-field-declaration-missing");let i=le(n.type),r=e.flatMap(o=>{let s=it({name:"constraint",node:o,schema:t,validator:cg});return s==null?[]:[s]});if(!be(i)){if(r.length>0)throw new TypeError(Mn(i.name));return}return r.length===0?lc(i.name):Cb({bounds:UO(r),name:i.name})}a(qn,"scalarFieldValidator");function UO(e){return cg.parse({max:e.flatMap(t=>t.max==null?[]:[t.max]).toSorted((t,n)=>t-n).at(0),maxLength:e.flatMap(t=>t.maxLength==null?[]:[t.maxLength]).toSorted((t,n)=>t-n).at(0),min:e.flatMap(t=>t.min==null?[]:[t.min]).toSorted((t,n)=>n-t).at(0),minLength:e.flatMap(t=>t.minLength==null?[]:[t.minLength]).toSorted((t,n)=>n-t).at(0)})}a(UO,"combinedBounds");var Gb=Gn.valueType.keyType,Vb=new WeakMap;function Bb(e){let t=Vb.get(e);if(t!=null)return t;let n=Jb({inputs:FO(e),node:ic(e)}).pipe(_r);return Vb.set(e,n),n}a(Bb,"seedValidator");function FO(e){let t={schema:e,validatorOf:a(i=>{let r=n.get(i.name);if(r==null)throw new TypeError(`seed-input-type-unknown:${i.name}`);return r},"validatorOf")},n=new Map(Object.values(e.getTypeMap()).filter(i=>V(i)).map(i=>[i.name,f.lazy(()=>CO({inputs:t,type:i}))]));return t}a(FO,"inputValidators");function Jb({inputs:e,node:t}){switch(t.kind){case"object":return f.strictObject(Object.fromEntries(Object.entries(t.fields).map(([n,i])=>[n,Jb({inputs:e,node:i})])));case"replace":return Mb({inputs:e,leaf:t});case"create":return f.record(Gb,Mb({inputs:e,leaf:t}))}}a(Jb,"nodeValidator");function Mb({inputs:e,leaf:t}){let{operation:n,value:i}=t;return lg({fields:uc({argument:i,field:n.field,parent:n.owner}),inputs:e,node:i,type:i.type})}a(Mb,"leafValidator");function lg(e){return j(e.type)?Zb({...e,type:e.type.ofType}):Zb(e).nullable()}a(lg,"valueValidator");function Zb(e){let{fields:t,inputs:n,node:i,type:r}=e;if(J(r))return f.array(lg({...e,type:r.ofType}));if(Pr({name:"reference",node:i,schema:n.schema}))return Gb;if(V(r))return n.validatorOf(r);if(te(r))return f.enum(tc({schema:n.schema,type:r}).map(s=>s.model));let o=qn({fields:t,schema:n.schema});if(o==null)throw new TypeError(`seed-scalar-validator-missing:${String(r)}`);return o}a(Zb,"presentValidator");function CO({inputs:e,type:t}){return f.strictObject(Object.fromEntries(Object.values(t.getFields()).map(n=>{let i=lg({fields:[n],inputs:e,node:n,type:n.type}),r=j(n.type)&&n.defaultValue===void 0;return[n.name,r?i:i.optional()]})))}a(CO,"inputObjectValidator");async function Qb({runtime:e,target:t}){let{schema:n}=e,i=ec({references:t.references,schema:n}),r=Zn(n);if(r==null)return{...t,references:i};let o=await Jn({call:{kind:"actor",operation:r.id},runtime:e,target:{...t,references:i}});return{...t,references:o.references}}a(Qb,"bootstrapReferences");var qb=f.strictObject({references:_r,run:vn});var Yb=f.strictObject({call:Ib,target:qb});async function Kb({request:e,runtime:t}){try{let n=Yb.parse(JSON.parse(e));return{...await Jn({call:n.call,runtime:t,target:{...n.target,references:ec({references:n.target.references,schema:t.schema})}}),kind:"returned"}}catch(n){return VO(n)}}a(Kb,"callSingleOperation");function VO(e){return e instanceof fo?{...e.identity,kind:"missing-reference"}:e instanceof We?{failures:e.failures,kind:"binding-failed"}:e instanceof pr?{failure:e.readFailure,kind:"read-failed"}:{error:Ai(e),kind:"failed"}}a(VO,"operationFailure");function Wb(e){return{operation:a(t=>Kb({request:t,runtime:e}),"operation"),setup:a(t=>MO({request:t,runtime:e}),"setup")}}a(Wb,"createSchemaBinding");async function MO({request:e,runtime:t}){let{schema:n}=t,i=Bb(n).parse(e.seed),r=Lb({schema:n,steps:Pb({schema:n,seed:i})}),o=await ZO({runtime:t,steps:r,target:e.target}).catch(Hs("unwritten"));return(await Ab({runtime:t,steps:r,target:o})).references}a(MO,"setupBinding");async function ZO({runtime:e,steps:t,target:n}){return Rb({runtime:e,steps:t}),Qb({runtime:e,target:n})}a(ZO,"signedInTarget");function Hb({coordinate:e,fields:t,schema:n}){try{qn({fields:t,schema:n})}catch(i){throw new TypeError(`${e}: ${GO(i)}`,{cause:i})}}a(Hb,"requireScalarDeclaration");function GO(e){return e instanceof f.ZodError?e.issues.map(t=>t.message).join(" "):e instanceof Error?e.message:String(e)}a(GO,"thrownText");function Xb({field:e,parent:t,schema:n,value:i}){let r=Hh({schema:n,type:t});if(i==null||r?.identity.id!==e.name)return[];let o=yt.parse(i);return qh.safeParse(o).success?[]:[{value:o}]}a(Xb,"identityProblems");function e_(e){return V(e)||A(e)||M(e)?Object.values(e.getFields()):[]}a(e_,"schemaFields");var t_=f.record(f.string(),f.unknown());function Yn(e){return j(e.type)?e.value==null?[{kind:"null"}]:Yn({...e,type:e.type.ofType}):e.value==null?[]:J(e.type)?QO({...e,type:e.type}):V(e.type)?qO({...e,type:e.type}):A(e.type)?BO({expected:e.type.name,value:e.value}):JO(e)}a(Yn,"valueProblems");function BO({expected:e,value:t}){let n=t_.safeParse(t);if(!n.success)return[{kind:"not-object"}];let i=n.data.__typename;return i===void 0||i===e?[]:[{expected:e,kind:"typename",typename:JSON.stringify(i)}]}a(BO,"typenameProblems");function JO(e){let t=qn(e)?.safeParse(e.value);return t==null||t.success?[]:[{kind:"scalar",messages:t.error.issues.map(n=>n.message)}]}a(JO,"scalarProblems");function QO(e){if(!Array.isArray(e.value))return[{kind:"not-list"}];let t=e.type.ofType;return e.value.flatMap(n=>Yn({...e,type:t,value:n}))}a(QO,"listProblems");function qO(e){let t=t_.safeParse(e.value);if(!t.success)return[{kind:"not-object"}];let n=t.data;return e_(e.type).flatMap(i=>Yn({fields:[i],schema:e.schema,type:i.type,value:n[i.name]}))}a(qO,"inputProblems");function r_({field:e,parent:t,schema:n,standard:i}){let r=Fb({field:e,parent:t}),o=`${t.name}.${e.name}`;return Hb({coordinate:o,fields:r,schema:n}),async(s,c,u,l)=>{e.args.forEach(b=>{let N=Yn({fields:uc({argument:b,field:e,parent:t}),schema:n,type:b.type,value:c[b.name]}),[L]=N;if(L!=null)throw new TypeError(Jh(`${o}(${b.name})`,L))});let p=await wb({args:c,context:u,info:l,source:s,standard:i}),d=Yn({fields:r,schema:n,type:e.type,value:p}).map(b=>Jh(o,b)),m=d.length>0?d:Xb({field:e,parent:t,schema:n,value:p}).map(b=>nb(o,b)),[g,...y]=m;if(g!=null)throw new lr([g,...y]);return p}}a(r_,"validatedFieldResolver");function n_({name:e,scalar:t,validator:n}){return new ke({...t.toConfig(),name:e,parseLiteral:a((i,r)=>n.parse(t.parseLiteral(i,r)),"parseLiteral"),parseValue:a(i=>n.parse(t.parseValue(i)),"parseValue"),serialize:a(i=>ji.parse(t.serialize(n.parse(i))),"serialize")})}a(n_,"validatedScalar");var i_="directive @constraint(min: Float, max: Float, minLength: Int, maxLength: Int) on FIELD_DEFINITION | INPUT_FIELD_DEFINITION | ARGUMENT_DEFINITION";function o_(e){return Mx(e,{[K.OBJECT_FIELD]:(t,n,i)=>{let r=e.getType(i),o=A(r)?r.getFields()[n]:void 0;if(o==null||!A(r))throw new TypeError(`schema-field-declaration-missing:${i}.${n}`);return{...t,resolve:r_({field:o,parent:r,schema:e,standard:Nb(t.resolve)})}},[K.SCALAR_TYPE]:t=>t.name!=="Date"&&t.name!=="DateTime"?t:n_({name:t.name,scalar:t,validator:lc(t.name)})})}a(o_,"constrainSchema");function a_(e){return o_(YO(e))}a(a_,"buildBindingSchema");var s_=`${i_}
129
+ `,Jx=f.strictObject({id:f.string().min(1)}),qs=f.strictObject({entity:f.string().min(1)}),Qx=f.strictObject({value:f.string()}),qx=f.strictObject({name:f.string().min(1)}),lo=f.strictObject({kind:f.enum(["create","replace"]),path:f.array(f.string().min(1)).min(1)});function it(e){let t=Zh(e.schema,e.node,e.name)?.[0];return t==null?void 0:e.validator.parse(t)}a(it,"readDirective");function Pr(e){return Zh(e.schema,e.node,e.name)?.[0]!=null}a(Pr,"hasDirective");function Yx(e){return`Declare a supported representation for scalar ${e}.`}a(Yx,"renderUnknownScalar");function Mn(e){return`The constraints do not apply to ${e}. String takes minLength and maxLength. Int and Float take min and max. No other type takes a constraint.`}a(Mn,"renderInvalidConstraint");var Kx="The constraint min is above its max.",Wx="The constraint minLength is above its maxLength.";function Hx(e){return`The schema operation ${e} does not exist.`}a(Hx,"renderMissingOperation");var Ks="actor",Ys="actor";function po(e){return tO(e).match(t=>t,t=>{throw new TypeError(`schema-layout-invalid:${t.map(n=>n.kind).join(",")}`)})}a(po,"schemaLayout");function tO(e){let t=rO(e),n=[...t.issues,...nO(e),...iO(e),...oO(e)];return n.length>0?Le(n):rt({actor:t.root,mutation:e.getMutationType()??void 0})}a(tO,"readSchemaLayout");function rO(e){let t=e.getQueryType(),n=t?.getFields()[Ys];if(t==null||n==null)return{issues:[],root:void 0};let i=j(n.type)?n.type.ofType:void 0,r=n.args.length===0?[]:[{field:Ys,kind:"root-field-arguments"}];return!A(i)||!Pr({name:"entity",node:i,schema:e})?{issues:[...r,{field:Ys,kind:"root-field-type"}],root:void 0}:{issues:r,root:{field:n,query:t,type:i}}}a(rO,"actorRoot");function nO(e){return Object.keys(e.getQueryType()?.getFields()??{}).filter(t=>t!==Ys).map(t=>({field:t,kind:"root-field-unexpected"}))}a(nO,"unexpectedQueryFields");function iO(e){return e.getSubscriptionType()==null?[]:[{kind:"subscription-present"}]}a(iO,"subscriptionIssues");function oO(e){return Object.values(e.getMutationType()?.getFields()??{}).filter(t=>!Pr({name:"setup",node:t,schema:e})).map(t=>({field:t.name,kind:"mutation-field-not-setup"}))}a(oO,"mutationIssues");var Xx=new WeakMap;function aO(e){let t=Xx.get(e);if(t!=null)return t;let n=[...tb(e),...Ws(e)];return Xx.set(e,n),n}a(aO,"schemaOperations");function Ws(e){let{mutation:t}=po(e);return t==null?[]:Object.values(t.getFields()).map(n=>sO({field:n,owner:t,schema:e}))}a(Ws,"setupOperationsOf");function Zn(e){return tb(e)[0]}a(Zn,"actorOperation");function Bh(e){let t=aO(e.schema).find(n=>n.id===e.id);if(t==null)throw new TypeError(Hx(e.id));return t}a(Bh,"requireOperation");function eb(e){let t=Bh(e);if(t.kind!=="setup")throw new TypeError(`operation-not-setup:${e.id}`);return t}a(eb,"requireSetupOperation");function tb(e){let{actor:t}=po(e);return t==null?[]:[{field:t.field,id:rb({field:t.field,owner:t.query}),kind:"actor",owner:t.query}]}a(tb,"actorOperations");function sO({field:e,owner:t,schema:n}){let i=it({name:"setup",node:e,schema:n,validator:lo});if(i==null)throw new TypeError(`setup-operation-metadata-missing:${t.name}.${e.name}`);return{field:e,id:rb({field:e,owner:t}),kind:"setup",owner:t,setup:i}}a(sO,"setupOperation");function rb({field:e,owner:t}){return ct.parse(`${t.name}.${e.name}`)}a(rb,"operationId");function Jh(e,t){switch(t.kind){case"null":return`${e} is null, but the schema requires a value.`;case"not-list":return`${e} is not a list.`;case"not-object":return`${e} is not an object.`;case"scalar":return`${e} is invalid: ${t.messages.join(" ")}`;case"typename":return`${e} has __typename ${t.typename}, but the schema requires ${t.expected}.`}}a(Jh,"renderValueProblem");function nb(e,t){return`${e} holds ${JSON.stringify(t.value)}, which is not a usable ID. Use a nonempty string or an integer.`}a(nb,"renderIdentityProblem");function ib(e){return`The returned object has no ${e} field.`}a(ib,"renderMissingReturnedField");function ob(e){return`${e} cannot be read because the returned value is not an object.`}a(ob,"renderReturnedParentNotObject");function ab(e){return`The returned value is not JSON: ${e.join(" ")}`}a(ab,"renderNonJsonReturn");function sb(e){return`${e} cannot read facts.references.identities. No binding sees the ids setup created. Reference arguments arrive as the application's own ids.`}a(sb,"renderHiddenIdentities");var We=class extends Error{constructor(n){super(cb(n));this.failures=n;this.name=cm}static{a(this,"BindingError")}},Qh=class extends Error{constructor(n,i){super(`${cb(n)} (${i})`);this.failures=n;this.written=i;this.name=um}static{a(this,"SetupBindingError")}};function Hs(e){return t=>{throw t instanceof We?new Qh(t.failures,e):t}}a(Hs,"setupFailure");function cb(e){return e.map(t=>`${t.kind}: ${t.operation}`).join(", ")}a(cb,"renderFailures");var lr=class extends Error{constructor(n){super(n.join(" "));this.issues=n;this.name="SchemaOutputValidationError"}static{a(this,"OutputValidationError")}};var Gn=f.record(f.string().min(1),f.record(f.string().min(1),f.string().min(1))),qh=f.union([f.string().min(1),f.number().int()]).transform(String);function ub({entity:e,modelId:t,registry:n}){let i=lb({entity:e,modelId:t,registry:n});if(i==null)throw new fo({entity:e,modelId:t});return i}a(ub,"applicationId");var fo=class extends Error{constructor(n){super(`identity-unbound:${n.entity}:${n.modelId}`);this.identity=n;this.name="MissingIdentityError"}static{a(this,"MissingIdentityError")}};function lb({entity:e,modelId:t,registry:n}){let i=pb({entity:e,registry:n});if(i===void 0||!Object.hasOwn(i,t))return;let r=i[t];if(r===void 0)throw new TypeError(`identity-entry-invalid:${e}:${t}`);return r}a(lb,"knownIdentity");function pb({entity:e,registry:t}){if(!Object.hasOwn(t,e))return;let n=t[e];if(n===void 0)throw new TypeError(`identity-entity-invalid:${e}`);return n}a(pb,"entityIdentities");function db(e){let t=pb(e)??{},n=Object.entries(t).find(([r,o])=>r!==e.modelId&&o===e.applicationId);if(n!=null)throw new TypeError(`identity-alias:${e.entity}:${e.modelId}:${n[0]}`);let i=lb(e);if(i!=null&&i!==e.applicationId)throw new TypeError(`identity-rebound:${e.entity}:${e.modelId}`);return{...e.registry,[e.entity]:{...t,[e.modelId]:e.applicationId}}}a(db,"registerIdentity");function Xs(e){return Gn.parse(e.identities)}a(Xs,"registryFromReferences");function Bn(e){return qh.parse(e)}a(Bn,"identityValue");function Yh(e){return Object.values(e.getTypeMap()).filter(t=>A(t)||M(t)).flatMap(t=>Object.values(t.getFields()).flatMap(n=>{let i=it({name:"referenceValue",node:n,schema:e,validator:qx});return i==null?[]:[{field:n,name:i.name,parent:t.name}]}))}a(Yh,"referenceDeclarations");function fb({entity:e,modelId:t,references:n,schema:i,value:r}){if(!st(r))throw new TypeError(`entity-value-not-object:${e.type.name}`);let o=db({applicationId:Bn(r[e.identity.id]),entity:e.type.name,modelId:t,registry:Xs(n)});return Yh(i).filter(s=>s.parent===e.type.name).reduce((s,{field:c,name:u})=>{let l=r[c.name];if(l===void 0)throw new TypeError(`entity-field-missing:${e.type.name}.${c.name}`);return{...s,[u]:{...cO(s[u]),[t]:l}}},{...n,identities:o})}a(fb,"bindEntity");function cO(e){if(e===void 0)return{};if(!st(e))throw new TypeError("reference-value-is-not-record");return e}a(cO,"keyedValues");var Kh="identities";function mb({operation:e,references:t}){let n=Object.fromEntries(Object.entries(t).filter(([i])=>i!==Kh));return uO({operation:e,value:n})}a(mb,"bindingReferences");function uO({operation:e,value:t}){return new Proxy(t,{get:a((n,i,r)=>{if(i===Kh)throw new TypeError(sb(e));return Reflect.get(n,i,r)},"get")})}a(uO,"refusingIdentities");function ec({references:e,schema:t}){return{...Object.fromEntries(Yh(t).map(i=>[i.name,{}])),[Kh]:{},...e}}a(ec,"initialReferences");function hb(e){switch(e.kind){case"network":return"The request did not reach the application.";case"http":return`The request returned status ${String(e.status)}.`;case"not-json":return"The response was not JSON."}}a(hb,"renderReadFailure");var pr=class extends Error{constructor(n){super(hb(n));this.readFailure=n;this.name=pm}static{a(this,"ReadFailureError")}};var vb=Symbol.for("ripplo.last-transient-fetch-failure"),gb=Symbol.for("ripplo.fetch-monitored"),lO=f.strictObject({at:f.number(),failure:yn});function xb(){if(Reflect.get(globalThis,gb)===globalThis.fetch)return;let e=globalThis.fetch.bind(globalThis),t=a(async(...n)=>{let i=await e(...n).catch(r=>{throw yb({kind:"network"}),r});return yb({kind:"http",status:i.status}),i},"monitored");Reflect.set(globalThis,"fetch",t),Reflect.set(globalThis,gb,t)}a(xb,"installFetchMonitor");function bb(e){let t=lO.optional().parse(Reflect.get(globalThis,vb));return t!=null&&t.at>=e?t.failure:void 0}a(bb,"transientFailureSince");function yb(e){hm(e)&&Reflect.set(globalThis,vb,{at:performance.now(),failure:e})}a(yb,"recordFailure");var pO=f.custom(e=>typeof e=="function");function Wh({arguments:e,operation:t,resolvers:n}){let i=n[t];if(i===void 0)throw new We([{arguments:e,kind:"missing",operation:t}]);return pO.parse(i)}a(Wh,"requireResolver");async function _b(e){let{context:t,invoke:n,operation:i,runtime:r}=e,o=Wh({arguments:e.arguments,operation:i,resolvers:r.module.resolvers}),s={...t,references:mb({operation:i,references:t.references})};r.trace({kind:"started",operation:i,token:t.run.token});let c=performance.now(),u=await Promise.resolve().then(()=>n(o,s)).catch(p=>{throw dO({error:p,operation:i,startedAt:c})}),{value:l}=fO({operation:i,returned:u});return r.trace({durationMs:performance.now()-c,kind:"returned",operation:i,token:t.run.token}),l}a(_b,"callResolver");function dO({error:e,operation:t,startedAt:n}){let i=bb(n);if(i!=null)return new pr(i);let r=Ai(e);return new We([{kind:"execution-failed",message:r.kind==="error"?r.message:r.value,operation:t}])}a(dO,"executionFailure");function fO({operation:e,returned:t}){let n=yt.safeParse(t);if(n.success)return{value:n.data};let i=ab(n.error.issues.map(r=>r.message));throw new We([{issues:[i],kind:"invalid-output",operation:e}])}a(fO,"jsonReturn");function tc({schema:e,type:t}){return t.getValues().map(n=>{let i=it({name:"value",node:n,schema:e,validator:Qx});return{application:n.name,model:i==null?n.name:i.value}})}a(tc,"enumValues");function Sb(e){return Object.fromEntries(e.operation.field.args.flatMap(t=>{let n=e.arguments[t.name];if(n===void 0){if(!j(t.type)||t.defaultValue!==void 0)return[];throw new TypeError(`operation-argument-missing:${t.name}`)}let i=rc({node:t,registry:e.registry,schema:e.schema,type:t.type,value:n});return[[t.name,i.value]]}))}a(Sb,"applicationArguments");function rc(e){return e.value===null?{value:null}:j(e.type)?rc({...e,type:e.type.ofType}):J(e.type)?mO(e):hO(e)}a(rc,"mapArgument");function mO(e){if(!J(e.type)||!Array.isArray(e.value))throw new TypeError("operation-input-list-invalid");let t=e.type.ofType;return{value:e.value.map(n=>rc({...e,type:t,value:n}).value)}}a(mO,"mapInputList");function hO(e){let t=it({name:"reference",node:e.node,schema:e.schema,validator:qs});if(t!=null)return{value:ub({entity:t.entity,modelId:Bn(e.value),registry:e.registry})};if(te(e.type)){let n=tc({schema:e.schema,type:e.type}).find(i=>i.model===e.value);if(n==null)throw new TypeError("operation-input-enum-invalid");return{value:n.application}}return V(e.type)?gO(e):{value:e.value}}a(hO,"mapLeafArgument");function gO(e){if(!V(e.type)||!st(e.value))throw new TypeError("operation-input-object-invalid");let t=e.value,n=e.type.getFields();return{value:Object.fromEntries(Object.entries(t).map(([i,r])=>{let o=n[i];if(o==null)throw new TypeError(`operation-input-field-unknown:${i}`);return[i,rc({...e,node:o,type:o.type,value:r}).value]}))}}a(gO,"mapInputObject");function nc({schema:e,type:t}){let n=Hh({schema:e,type:t});if(n==null)throw new TypeError(`entity-metadata-missing:${String(t)}`);let[i]=yO({entity:n,schema:e});if(i!=null)throw new TypeError(`entity-${i.role}-invalid:${n.type.name}:${i.field}`);return n}a(nc,"requireEntity");function Hh({schema:e,type:t}){let n=le(t);if(!A(n))return;let i=it({name:"entity",node:n,schema:e,validator:Jx});return i==null?void 0:{identity:i,type:n}}a(Hh,"readEntity");function yO({entity:e,schema:t}){let{identity:n,type:i}=e,r=i.getFields(),o=r[n.id],c=o!=null&&j(o.type)&&be(o.type.ofType)?[]:[{field:n.id,role:"id"}],u=Object.values(r).flatMap(l=>{let p=le(l.type);return[...l.name===n.id||Pr({name:"referenceValue",node:l,schema:t})?[]:[{field:l.name,role:"undeclared"}],...be(p)||te(p)?[]:[{field:l.name,role:"composite"}],...l.args.length===0?[]:[{field:l.name,role:"arguments"}]]});return[...c,...u]}a(yO,"entityFieldProblems");var Xh="value",Tb=new WeakMap;function ic(e){let t=Tb.get(e);if(t!=null)return t;let n=vO(e).match(i=>i,i=>{throw new TypeError(`seed-tree-invalid:${i.map(r=>r.kind).join(",")}`)});return Tb.set(e,n),n}a(ic,"seedTree");function vO(e){let t=Ws(e).reduce((n,i)=>xO(i).andThen(r=>tg({leaf:r,path:i.setup.path,tree:n.tree})).match(r=>({issues:n.issues,tree:r}),r=>({issues:[...n.issues,...r],tree:n.tree})),{issues:[],tree:$b});return t.issues.length>0?Le(t.issues):rt(t.tree)}a(vO,"readSeedTree");var $b={fields:{},kind:"object"};function eg(e){let[t,...n]=e.field.args;return t?.name===Xh&&n.length===0?t:void 0}a(eg,"valueArgument");function xO(e){let t=eg(e);return t==null?Le([{kind:"setup-arguments-invalid",setup:e.id}]):rt({kind:e.setup.kind,operation:e,value:t})}a(xO,"seedLeaf");function tg({leaf:e,path:t,tree:n}){let[i,...r]=t;if(i==null)throw new TypeError(`setup-path-empty:${e.operation.id}`);let o=Object.hasOwn(n.fields,i)?n.fields[i]:void 0,s=_O({existing:o,last:r.length===0,leaf:e});return s!=null?Le([s]):(o?.kind==="object"?tg({leaf:e,path:r,tree:o}):bO({leaf:e,path:r})).map(u=>({...n,fields:{...n.fields,[i]:u}}))}a(tg,"withLeaf");function bO({leaf:e,path:t}){return t.length===0?rt(e):tg({leaf:e,path:t,tree:$b})}a(bO,"nested");function _O({existing:e,last:t,leaf:n}){let i=n.operation.id,{path:r}=n.operation.setup;if(e!=null)return e.kind==="object"?t?{kind:"setup-path-overlap",path:r,setup:i}:void 0:t?{kind:"setup-path-shared",other:e.operation.id,path:r,setup:i}:{kind:"setup-path-overlap",path:r,setup:i}}a(_O,"pathConflict");var rg=ct,ng=yt,Ib=f.discriminatedUnion("kind",[f.strictObject({kind:sm.extract(["actor"]),operation:rg}),f.strictObject({kind:lo.shape.kind.extract(["create"]),modelId:f.string().min(1),operation:rg,value:ng}),f.strictObject({kind:lo.shape.kind.extract(["replace"]),operation:rg,value:ng})]),SO=f.strictObject({references:_r,value:ng}),_G=f.discriminatedUnion("kind",[SO.extend({kind:f.literal("returned")}),f.strictObject({failures:Li,kind:f.literal("binding-failed")}),f.strictObject({entity:Gn.keyType,kind:f.literal("missing-reference"),modelId:Gn.valueType.keyType}),f.strictObject({failure:yn,kind:f.literal("read-failed")}),f.strictObject({error:om,kind:f.literal("failed")})]);function oc(e){switch(e.kind){case"actor":return{};case"create":case"replace":return{[Xh]:e.value}}}a(oc,"setupCallArguments");function Eb({references:e,run:t}){return{references:e,run:t,scope:{kind:"observation"}}}a(Eb,"freshOperationContext");function Ob({operation:e,schema:t}){let n=t.getType(e.owner.name);if(!A(n))throw new TypeError(`operation-owner-not-object:${e.owner.name}`);let i=new Et({...t.toConfig(),mutation:void 0,query:n,subscription:void 0}),r=In(TO(e)),o=zs(i,r);if(o.length>0)throw new AggregateError(o,"invalid-operation-query");return{document:r,schema:i}}a(Ob,"operationDocument");function TO({field:e}){let t=e.args.map(o=>{let s=o.defaultValue===void 0?null:jt(o.defaultValue,o.type),c=s==null?"":` = ${ee(s)}`;return`$${o.name}: ${String(o.type)}${c}`}),n=e.args.map(o=>`${o.name}: $${o.name}`),i=t.length===0?"":`(${t.join(", ")})`,r=n.length===0?"":`(${n.join(", ")})`;return`query Resolve${i} { ${e.name}${r}${$O(e.type)} }`}a(TO,"renderOperationQuery");function $O(e){let t=le(e);if(de(t))return"";if(!A(t))throw new TypeError(`operation-return-type-unsupported:${t.name}`);return` { ${Object.values(t.getFields()).map(i=>{if(!de(le(i.type))||i.args.length>0)throw new TypeError(`operation-return-field-unsupported:${t.name}.${i.name}`);return i.name}).join(" ")} }`}a($O,"returnSelection");var ig=Symbol("schema-resolver"),og=f.custom(e=>typeof e=="function"),IO=og.parse(Cn);function wb({args:e,context:t,info:n,source:i,standard:r}){if(t==null||typeof t!="object")return r(i,e,t,n);let o=Reflect.get(t,ig);return(o===void 0?r:og.parse(o))(i,e,t,n)}a(wb,"resolveSchemaField");function Nb(e){return e===void 0?IO:og.parse(e)}a(Nb,"standardSchemaResolver");async function Db({arguments:e,context:t,operation:n,runtime:i}){let r=await Cs({...Ob({operation:n,schema:i.schema}),contextValue:{...t,[ig]:EO({operation:n,runtime:i})},rootValue:{},variableValues:e});if(r.errors!=null)throw OO({errors:r.errors,operation:n});let o=yt.parse(r.data),s=st(o)?o[n.field.name]:void 0;if(s===void 0)throw new TypeError(`operation-result-missing:${n.id}`);return s}a(Db,"executeOperation");function EO({operation:e,runtime:t}){return async(n,i,r,o)=>{let s=`${o.parentType.name}.${o.fieldName}`;if(s===e.id)return _b({arguments:i,context:r,operation:e.id,runtime:t,invoke:a((u,l)=>u(n,i,l,o),"invoke")});if(!st(n))throw new lr([ob(s)]);let c=n[o.fieldName];if(c===void 0)throw new lr([ib(s)]);return c}}a(EO,"operationResolver");function OO({errors:e,operation:t}){let n=e.map(u=>wO({error:u,operation:t})),i=n.find(u=>u.kind==="transient")??n.find(u=>u.kind==="invariant");if(i!=null&&i.kind!=="implementation")return i.error;let r=n.flatMap(u=>u.kind==="implementation"?u.failures:[]),o=r.flatMap(u=>u.kind==="invalid-output"?u.issues:[]),[s,...c]=[...r.filter(u=>u.kind!=="invalid-output"),...o.length===0?[]:[{issues:o,kind:"invalid-output",operation:t.id}]];if(s==null)throw new TypeError(`operation-errors-empty:${t.id}`);return new We([s,...c])}a(OO,"operationFailure");function wO({error:e,operation:t}){let n=e.originalError;return n instanceof We?{failures:n.failures,kind:"implementation"}:n instanceof pr?{error:n,kind:"transient"}:n instanceof lr?kb({issues:n.issues,operation:t}):n instanceof x?kb({issues:[n.message],operation:t}):{error:n??e,kind:"invariant"}}a(wO,"classifyError");function kb({issues:e,operation:t}){return{failures:[{issues:[...e],kind:"invalid-output",operation:t.id}],kind:"implementation"}}a(kb,"invalidOutput");async function Jn({call:e,runtime:t,target:n}){let{schema:i}=t,r=Bh({id:e.operation,schema:i}),o=r.kind==="actor"?r.kind:r.setup.kind;if(o!==e.kind)throw new TypeError(`setup-operation-kind-mismatch:${e.operation}:${e.kind}:${o}`);let s=await Db({arguments:Sb({arguments:oc(e),operation:r,registry:Xs(n.references),schema:i}),context:Eb(n),operation:r,runtime:t});switch(e.kind){case"replace":return{references:n.references,value:s};case"actor":case"create":return{references:fb({entity:nc({schema:i,type:r.field.type}),modelId:e.kind==="actor"?Ks:e.modelId,references:n.references,schema:i,value:s}),value:s}}}a(Jn,"invokeSetupOperation");function Rb({runtime:e,steps:t}){let n=Zn(e.schema),r=[...n==null?[]:[{arguments:{},operation:n.id}],...t.map(c=>({arguments:oc(c),operation:c.operation}))].flatMap(c=>NO({...c,runtime:e})),[o,...s]=[...new Map(r.map(c=>[c.operation,c])).values()];if(o!=null)throw new We([o,...s])}a(Rb,"requireSetupBindings");async function Ab({runtime:e,steps:t,target:n}){return t.reduce(async(i,r)=>kO({runtime:e,step:r,target:await i}),Promise.resolve(n)).catch(Hs("written"))}a(Ab,"executeSetup");function NO({arguments:e,operation:t,runtime:n}){try{return Wh({arguments:e,operation:t,resolvers:n.module.resolvers}),[]}catch(i){if(i instanceof We)return i.failures;throw i}}a(NO,"missingBinding");async function kO({runtime:e,step:t,target:n}){let i=await Jn({call:t,runtime:e,target:n});return{...n,references:i.references}}a(kO,"executeStep");var cc=yg(jb(),1);function mo(e){let{node:t,schema:n,type:i,value:r}=e;if(r===null)return[];if(j(i))return mo({...e,type:i.ofType});if(J(i)){if(!Array.isArray(r))throw new TypeError("identity-dependency-list-invalid");return r.flatMap(s=>mo({...e,type:i.ofType,value:s}))}let o=it({name:"reference",node:t,schema:n,validator:qs});return o!=null?[{entity:o.entity,modelId:Bn(r)}]:V(i)?DO({schema:n,type:i,value:r}):[]}a(mo,"referenceDependencies");function DO({schema:e,type:t,value:n}){if(!st(n))throw new TypeError("identity-dependency-object-invalid");let i=t.getFields();return Object.entries(n).flatMap(([r,o])=>{let s=i[r];if(s==null)throw new TypeError(`identity-dependency-field-missing:${r}`);return mo({node:s,schema:e,type:s.type,value:o})})}a(DO,"fieldDependencies");function Lb({schema:e,steps:t}){let n=t.map(o=>RO({schema:e,step:o})),i=AO(e),r=new cc.DepGraph;return n.forEach((o,s)=>{r.addNode(String(s),o.step)}),n.forEach((o,s)=>{jO({actor:i,task:o,tasks:n}).forEach(c=>{r.addDependency(String(s),String(c))})}),LO(r).map(o=>r.getNodeData(o))}a(Lb,"orderedSetupSteps");function RO({schema:e,step:t}){let n=eb({id:t.operation,schema:e}),i=eg(n);if(i==null)throw new TypeError(`setup-value-argument-missing:${n.id}`);return{created:t.kind==="create"?{entity:nc({schema:e,type:n.field.type}).type.name,modelId:t.modelId}:void 0,dependencies:mo({node:i,schema:e,type:i.type,value:t.value}),step:t}}a(RO,"setupTask");function AO(e){let{actor:t}=po(e);return t==null?void 0:{entity:t.type.name,modelId:Ks}}a(AO,"actorIdentity");function jO({actor:e,task:t,tasks:n}){return t.dependencies.flatMap(i=>{let r=xn(i),o=n.findIndex(s=>s.created!=null&&xn(s.created)===r);if(o!==-1)return[o];if(e==null||xn(e)!==r)throw new TypeError(`setup-reference-unbound:${i.entity}:${i.modelId}`);return[]})}a(jO,"prerequisites");function LO(e){try{return e.overallOrder()}catch(t){throw t instanceof cc.DepGraphCycleError?new TypeError(`setup-reference-dependency-cycle:${t.cyclePath.join(",")}`):t}}a(LO,"topologicalOrder");function Pb({schema:e,seed:t}){return Ub({node:ic(e),path:[],value:t})}a(Pb,"setupPlan");function Ub({node:e,path:t,value:n}){switch(e.kind){case"replace":return[{kind:"replace",operation:e.operation.id,path:t,value:n}];case"create":return Object.entries(zb({path:t,value:n})).map(([i,r])=>({kind:"create",modelId:i,operation:e.operation.id,path:t,value:r}));case"object":{let i=zb({path:t,value:n});return Object.entries(e.fields).flatMap(([r,o])=>{let s=Object.hasOwn(i,r)?i[r]:void 0;if(s===void 0)throw new TypeError(`seed-path-missing:${[...t,r].join(".")}`);return Ub({node:o,path:[...t,r],value:s})})}}}a(Ub,"nodeSteps");function zb({path:e,value:t}){if(!st(t))throw new TypeError(`seed-path-not-object:${e.join(".")}`);return t}a(zb,"seedObject");function Fb({field:e,parent:t}){let n=e.astNode?.name.value;if(n==null||t==null||!A(t)&&!M(t))return[e];let i=sg({interfaces:t.getInterfaces(),name:n,seen:[]});return[e,...i]}a(Fb,"fieldSources");function uc({argument:e,field:t,parent:n}){if(!A(n)&&!M(n))throw new TypeError("argument-parent-is-not-object");let i=sg({interfaces:n.getInterfaces(),name:t.name,seen:[]});return[e,...i.flatMap(r=>r.args.filter(o=>o.name===e.name))]}a(uc,"argumentSources");function sg({interfaces:e,name:t,seen:n}){return e.flatMap(i=>{if(n.includes(i.name))throw new TypeError(`constraint-interface-cycle:${i.name}`);let r=i.getFields()[t];return[...r==null?[]:[r],...sg({interfaces:i.getInterfaces(),name:t,seen:[...n,i.name]})]})}a(sg,"inheritedFields");var cg=f.strictObject({max:f.number().optional(),maxLength:f.number().int().nonnegative().optional(),min:f.number().optional(),minLength:f.number().int().nonnegative().optional()}).refine(e=>e.min==null||e.max==null||e.min<=e.max,{error:Kx}).refine(e=>e.minLength==null||e.maxLength==null||e.minLength<=e.maxLength,{error:Wx});function lc(e){switch(e){case"String":return f.string();case"Int":return ug("Int");case"Float":return ug("Float");case"Boolean":return f.boolean();case"ID":return f.union([f.string(),f.number().int()]);case"Date":return f.iso.date();case"DateTime":return f.iso.datetime({offset:!0})}throw new TypeError(Yx(e))}a(lc,"scalarValidator");function ug(e){return e==="Int"?f.number().int().min(-2147483648).max(2147483647):f.number()}a(ug,"numberValidator");function Cb({bounds:e,name:t}){if(t==="String")return zO(e);if(t==="Int"||t==="Float")return PO({bounds:e,name:t});throw new TypeError(Mn(t))}a(Cb,"fieldScalarValidator");function zO(e){if(e.min!=null||e.max!=null)throw new TypeError(Mn("String"));let t=e.minLength==null?f.string():f.string().min(e.minLength);return e.maxLength==null?t:t.max(e.maxLength)}a(zO,"boundedString");function PO({bounds:e,name:t}){if(e.minLength!=null||e.maxLength!=null)throw new TypeError(Mn(t));let n=ug(t),i=e.min==null?n:n.min(e.min);return e.max==null?i:i.max(e.max)}a(PO,"boundedNumber");function qn({fields:e,schema:t}){let n=e[0];if(n==null)throw new TypeError("scalar-field-declaration-missing");let i=le(n.type),r=e.flatMap(o=>{let s=it({name:"constraint",node:o,schema:t,validator:cg});return s==null?[]:[s]});if(!be(i)){if(r.length>0)throw new TypeError(Mn(i.name));return}return r.length===0?lc(i.name):Cb({bounds:UO(r),name:i.name})}a(qn,"scalarFieldValidator");function UO(e){return cg.parse({max:e.flatMap(t=>t.max==null?[]:[t.max]).toSorted((t,n)=>t-n).at(0),maxLength:e.flatMap(t=>t.maxLength==null?[]:[t.maxLength]).toSorted((t,n)=>t-n).at(0),min:e.flatMap(t=>t.min==null?[]:[t.min]).toSorted((t,n)=>n-t).at(0),minLength:e.flatMap(t=>t.minLength==null?[]:[t.minLength]).toSorted((t,n)=>n-t).at(0)})}a(UO,"combinedBounds");var Gb=Gn.valueType.keyType,Vb=new WeakMap;function Bb(e){let t=Vb.get(e);if(t!=null)return t;let n=Jb({inputs:FO(e),node:ic(e)}).pipe(_r);return Vb.set(e,n),n}a(Bb,"seedValidator");function FO(e){let t={schema:e,validatorOf:a(i=>{let r=n.get(i.name);if(r==null)throw new TypeError(`seed-input-type-unknown:${i.name}`);return r},"validatorOf")},n=new Map(Object.values(e.getTypeMap()).filter(i=>V(i)).map(i=>[i.name,f.lazy(()=>CO({inputs:t,type:i}))]));return t}a(FO,"inputValidators");function Jb({inputs:e,node:t}){switch(t.kind){case"object":return f.strictObject(Object.fromEntries(Object.entries(t.fields).map(([n,i])=>[n,Jb({inputs:e,node:i})])));case"replace":return Mb({inputs:e,leaf:t});case"create":return f.record(Gb,Mb({inputs:e,leaf:t}))}}a(Jb,"nodeValidator");function Mb({inputs:e,leaf:t}){let{operation:n,value:i}=t;return lg({fields:uc({argument:i,field:n.field,parent:n.owner}),inputs:e,node:i,type:i.type})}a(Mb,"leafValidator");function lg(e){return j(e.type)?Zb({...e,type:e.type.ofType}):Zb(e).nullable()}a(lg,"valueValidator");function Zb(e){let{fields:t,inputs:n,node:i,type:r}=e;if(J(r))return f.array(lg({...e,type:r.ofType}));if(Pr({name:"reference",node:i,schema:n.schema}))return Gb;if(V(r))return n.validatorOf(r);if(te(r))return f.enum(tc({schema:n.schema,type:r}).map(s=>s.model));let o=qn({fields:t,schema:n.schema});if(o==null)throw new TypeError(`seed-scalar-validator-missing:${String(r)}`);return o}a(Zb,"presentValidator");function CO({inputs:e,type:t}){return f.strictObject(Object.fromEntries(Object.values(t.getFields()).map(n=>{let i=lg({fields:[n],inputs:e,node:n,type:n.type}),r=j(n.type)&&n.defaultValue===void 0;return[n.name,r?i:i.optional()]})))}a(CO,"inputObjectValidator");async function Qb({runtime:e,target:t}){let{schema:n}=e,i=ec({references:t.references,schema:n}),r=Zn(n);if(r==null)return{...t,references:i};let o=await Jn({call:{kind:"actor",operation:r.id},runtime:e,target:{...t,references:i}});return{...t,references:o.references}}a(Qb,"bootstrapReferences");var qb=f.strictObject({references:_r,run:vn});var Yb=f.strictObject({call:Ib,target:qb});async function Kb({request:e,runtime:t}){try{let n=Yb.parse(JSON.parse(e));return{...await Jn({call:n.call,runtime:t,target:{...n.target,references:ec({references:n.target.references,schema:t.schema})}}),kind:"returned"}}catch(n){return VO(n)}}a(Kb,"callSingleOperation");function VO(e){return e instanceof fo?{...e.identity,kind:"missing-reference"}:e instanceof We?{failures:e.failures,kind:"binding-failed"}:e instanceof pr?{failure:e.readFailure,kind:"read-failed"}:{error:Ai(e),kind:"failed"}}a(VO,"operationFailure");function Wb(e){return{operation:a(t=>Kb({request:t,runtime:e}),"operation"),setup:a(t=>MO({request:t,runtime:e}),"setup")}}a(Wb,"createSchemaBinding");async function MO({request:e,runtime:t}){let{schema:n}=t,i=Bb(n).parse(e.seed),r=Lb({schema:n,steps:Pb({schema:n,seed:i})}),o=await ZO({runtime:t,steps:r,target:e.target}).catch(Hs("unwritten"));return(await Ab({runtime:t,steps:r,target:o})).references}a(MO,"setupBinding");async function ZO({runtime:e,steps:t,target:n}){return Rb({runtime:e,steps:t}),Qb({runtime:e,target:n})}a(ZO,"signedInTarget");function Hb({coordinate:e,fields:t,schema:n}){try{qn({fields:t,schema:n})}catch(i){throw new TypeError(`${e}: ${GO(i)}`,{cause:i})}}a(Hb,"requireScalarDeclaration");function GO(e){return e instanceof f.ZodError?e.issues.map(t=>t.message).join(" "):e instanceof Error?e.message:String(e)}a(GO,"thrownText");function Xb({field:e,parent:t,schema:n,value:i}){let r=Hh({schema:n,type:t});if(i==null||r?.identity.id!==e.name)return[];let o=yt.parse(i);return qh.safeParse(o).success?[]:[{value:o}]}a(Xb,"identityProblems");function e_(e){return V(e)||A(e)||M(e)?Object.values(e.getFields()):[]}a(e_,"schemaFields");var t_=f.record(f.string(),f.unknown());function Yn(e){return j(e.type)?e.value==null?[{kind:"null"}]:Yn({...e,type:e.type.ofType}):e.value==null?[]:J(e.type)?QO({...e,type:e.type}):V(e.type)?qO({...e,type:e.type}):A(e.type)?BO({expected:e.type.name,value:e.value}):JO(e)}a(Yn,"valueProblems");function BO({expected:e,value:t}){let n=t_.safeParse(t);if(!n.success)return[{kind:"not-object"}];let i=n.data.__typename;return i===void 0||i===e?[]:[{expected:e,kind:"typename",typename:JSON.stringify(i)}]}a(BO,"typenameProblems");function JO(e){let t=qn(e)?.safeParse(e.value);return t==null||t.success?[]:[{kind:"scalar",messages:t.error.issues.map(n=>n.message)}]}a(JO,"scalarProblems");function QO(e){if(!Array.isArray(e.value))return[{kind:"not-list"}];let t=e.type.ofType;return e.value.flatMap(n=>Yn({...e,type:t,value:n}))}a(QO,"listProblems");function qO(e){let t=t_.safeParse(e.value);if(!t.success)return[{kind:"not-object"}];let n=t.data;return e_(e.type).flatMap(i=>Yn({fields:[i],schema:e.schema,type:i.type,value:n[i.name]}))}a(qO,"inputProblems");function r_({field:e,parent:t,schema:n,standard:i}){let r=Fb({field:e,parent:t}),o=`${t.name}.${e.name}`;return Hb({coordinate:o,fields:r,schema:n}),async(s,c,u,l)=>{e.args.forEach(b=>{let N=Yn({fields:uc({argument:b,field:e,parent:t}),schema:n,type:b.type,value:c[b.name]}),[L]=N;if(L!=null)throw new TypeError(Jh(`${o}(${b.name})`,L))});let p=await wb({args:c,context:u,info:l,source:s,standard:i}),d=Yn({fields:r,schema:n,type:e.type,value:p}).map(b=>Jh(o,b)),m=d.length>0?d:Xb({field:e,parent:t,schema:n,value:p}).map(b=>nb(o,b)),[g,...y]=m;if(g!=null)throw new lr([g,...y]);return p}}a(r_,"validatedFieldResolver");function n_({name:e,scalar:t,validator:n}){return new ke({...t.toConfig(),name:e,parseLiteral:a((i,r)=>n.parse(t.parseLiteral(i,r)),"parseLiteral"),parseValue:a(i=>n.parse(t.parseValue(i)),"parseValue"),serialize:a(i=>ji.parse(t.serialize(n.parse(i))),"serialize")})}a(n_,"validatedScalar");var i_="directive @constraint(min: Float, max: Float, minLength: Int, maxLength: Int) on FIELD_DEFINITION | INPUT_FIELD_DEFINITION | ARGUMENT_DEFINITION";function o_(e){return Mx(e,{[K.OBJECT_FIELD]:(t,n,i)=>{let r=e.getType(i),o=A(r)?r.getFields()[n]:void 0;if(o==null||!A(r))throw new TypeError(`schema-field-declaration-missing:${i}.${n}`);return{...t,resolve:r_({field:o,parent:r,schema:e,standard:Nb(t.resolve)})}},[K.SCALAR_TYPE]:t=>t.name!=="Date"&&t.name!=="DateTime"?t:n_({name:t.name,scalar:t,validator:lc(t.name)})})}a(o_,"constrainSchema");function a_(e){return o_(YO(e))}a(a_,"buildBindingSchema");var s_=`${i_}
130
130
  ${Bx}
131
- `,xJ=s_.split(`
131
+ `,bJ=s_.split(`
132
132
  `).length-1;function YO(e){return Ms(`${s_}${e}`)}a(YO,"buildContractSchema");function c_({module:e,source:t}){xb(),Reflect.set(globalThis,Im,Wb({module:e,schema:a_(t),trace:KO}))}a(c_,"installBindings");function KO(e){globalThis.dispatchEvent(new CustomEvent(gm,{detail:e}))}a(KO,"dispatchQuery");return h_(WO);})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ripplo",
3
- "version": "0.20.1",
3
+ "version": "0.20.3",
4
4
  "description": "CLI for Ripplo — AI-powered end-to-end testing",
5
5
  "type": "module",
6
6
  "homepage": "https://ripplo.ai",