@contractspec/example.pocket-family-office 1.46.0 → 1.46.2
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/docs/index.d.ts +2 -0
- package/dist/docs/index.d.ts.map +1 -0
- package/dist/docs/pocket-family-office.docblock.d.ts +2 -0
- package/dist/docs/pocket-family-office.docblock.d.ts.map +1 -0
- package/dist/example.d.ts +4 -0
- package/dist/example.d.ts.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1670 -45
- package/package.json +10 -6
package/dist/index.js
CHANGED
|
@@ -1,63 +1,1688 @@
|
|
|
1
|
-
var S9=Object.defineProperty;var _4=(J,X)=>{for(var H in X)S9(J,H,{get:X[H],enumerable:!0,configurable:!0,set:(W)=>X[H]=()=>W})};var A={Idea:"idea",InCreation:"in_creation",Experimental:"experimental",Beta:"beta",Stable:"stable",Deprecated:"deprecated"},K={PlatformCore:"platform.core",PlatformSigil:"platform.sigil",PlatformMarketplace:"platform.marketplace",PlatformMessaging:"platform.messaging",PlatformContent:"platform.content",PlatformFeatureFlags:"platform.featureflags",PlatformFinance:"platform.finance"};var R={Spots:"spots",Collectivity:"collectivity",Marketplace:"marketplace",Sellers:"sellers",Auth:"auth",Login:"login",Signup:"signup",Guide:"guide",Docs:"docs",I18n:"i18n",Incident:"incident",Automation:"automation",Hygiene:"hygiene"};var Z=(J,X)=>({key:J,version:X}),j9={meta:{key:"pocket-family-office.app",version:"1.0.0",appId:"pocket-family-office",title:"Pocket Family Office",description:"Household finance automation: ingest documents, track bills, remind payments, and summarise cashflow.",domain:"finance",owners:[K.PlatformFinance],tags:[R.Guide,"finance","automation"],stability:A.Experimental},capabilities:{enabled:[Z("ai.chat","1.0.0"),Z("ai.embeddings","1.0.0"),Z("vector-db.search","1.0.0"),Z("vector-db.storage","1.0.0"),Z("storage.objects","1.0.0"),Z("email.inbound","1.0.0"),Z("email.transactional","1.0.0"),Z("calendar.events","1.0.0"),Z("sms.outbound","1.0.0"),Z("ai.voice.synthesis","1.0.0"),Z("payments.psp","1.0.0"),Z("openbanking.accounts.read","1.0.0"),Z("openbanking.transactions.read","1.0.0"),Z("openbanking.balances.read","1.0.0")]},integrationSlots:[{slotId:"primaryLLM",requiredCategory:"ai-llm",allowedModes:["managed","byok"],requiredCapabilities:[Z("ai.chat","1.0.0")],required:!0,description:"Chat completion provider powering summarisation, explanations, and insights."},{slotId:"primaryVectorDb",requiredCategory:"vector-db",allowedModes:["managed","byok"],requiredCapabilities:[Z("vector-db.search","1.0.0")],required:!0,description:"Vector database storing embeddings for financial documents and email threads."},{slotId:"primaryStorage",requiredCategory:"storage",allowedModes:["managed","byok"],requiredCapabilities:[Z("storage.objects","1.0.0")],required:!0,description:"Object storage used for raw uploads and normalised documents."},{slotId:"primaryOpenBanking",requiredCategory:"open-banking",allowedModes:["byok"],requiredCapabilities:[Z("openbanking.accounts.read","1.0.0"),Z("openbanking.transactions.read","1.0.0"),Z("openbanking.balances.read","1.0.0")],required:!0,description:"Powens BYOK connection powering bank account, transaction, and balance synchronisation."},{slotId:"emailInbound",requiredCategory:"email",allowedModes:["managed","byok"],requiredCapabilities:[Z("email.inbound","1.0.0")],required:!0,description:"Inbound email/thread sync (Gmail) feeding the knowledge corpus."},{slotId:"emailOutbound",requiredCategory:"email",allowedModes:["managed","byok"],requiredCapabilities:[Z("email.transactional","1.0.0")],required:!0,description:"Transactional email delivery for reminders and summaries."},{slotId:"calendarScheduling",requiredCategory:"calendar",allowedModes:["managed","byok"],requiredCapabilities:[Z("calendar.events","1.0.0")],required:!0,description:"Creates calendar holds for bill reviews and handoff meetings."},{slotId:"voicePlayback",requiredCategory:"ai-voice",allowedModes:["managed","byok"],requiredCapabilities:[Z("ai.voice.synthesis","1.0.0")],required:!1,description:"Optional voice synthesis for spoken summaries (ElevenLabs)."},{slotId:"smsNotifications",requiredCategory:"sms",allowedModes:["managed","byok"],requiredCapabilities:[Z("sms.outbound","1.0.0")],required:!1,description:"SMS provider used for urgent reminders."},{slotId:"paymentsProcessing",requiredCategory:"payments",allowedModes:["managed","byok"],requiredCapabilities:[Z("payments.psp","1.0.0")],required:!1,description:"Optional payments processor enabling bill pay automations."}],workflows:{processUploadedDocument:{key:"pfo.workflow.process-uploaded-document",version:"1.0.0"},upcomingPaymentsReminder:{key:"pfo.workflow.upcoming-payments-reminder",version:"1.0.0"},generateFinancialSummary:{key:"pfo.workflow.generate-financial-summary",version:"1.0.0"},ingestEmailThreads:{key:"pfo.workflow.ingest-email-threads",version:"1.0.0"},syncOpenBankingAccounts:{key:"pfo.workflow.sync-openbanking-accounts",version:"1.0.0"},syncOpenBankingTransactions:{key:"pfo.workflow.sync-openbanking-transactions",version:"1.0.0"},refreshOpenBankingBalances:{key:"pfo.workflow.refresh-openbanking-balances",version:"1.0.0"},generateOpenBankingOverview:{key:"pfo.workflow.generate-openbanking-overview",version:"1.0.0"}},policies:[{key:"pfo.policy.tenancy",version:"1.0.0"},{key:"knowledge.access.financial-docs",version:"1.0.0"}],telemetry:{spec:{key:"pfo.telemetry",version:"1.0.0"}},featureFlags:[{key:"voice-summaries",enabled:!1,description:"Enable ElevenLabs spoken summaries in addition to email distribution."}],routes:[{path:"/dashboard",label:"Overview",workflow:"pfo.workflow.generate-financial-summary"},{path:"/documents/upload",label:"Upload Document",workflow:"pfo.workflow.process-uploaded-document"},{path:"/communications",label:"Inbox",workflow:"pfo.workflow.ingest-email-threads"}],notes:"Pocket Family Office blueprint pulling together finance automations for the hackathon reference implementation."};function kW(J){return J.register(j9)}var SW={meta:{id:"tenant-pfo-sample",tenantId:"tenant.family-office",appId:"pocket-family-office",blueprintName:"pocket-family-office.app",blueprintVersion:"1.0.0",environment:"production",version:"1.0.0",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),status:"published"},featureFlags:[{key:"voice-summaries",enabled:!0,description:"Enable spoken ElevenLabs summaries for daily briefings."}],integrations:[{slotId:"primaryLLM",connectionId:"conn-mistral-primary"},{slotId:"primaryVectorDb",connectionId:"conn-qdrant-finance"},{slotId:"primaryStorage",connectionId:"conn-gcs-documents"},{slotId:"primaryOpenBanking",connectionId:"conn-powens-primary"},{slotId:"emailInbound",connectionId:"conn-gmail-threads"},{slotId:"emailOutbound",connectionId:"conn-postmark-outbound"},{slotId:"calendarScheduling",connectionId:"conn-google-calendar"},{slotId:"voicePlayback",connectionId:"conn-elevenlabs-voice"},{slotId:"smsNotifications",connectionId:"conn-twilio-sms"},{slotId:"paymentsProcessing",connectionId:"conn-stripe-recurring"}],knowledge:[{spaceKey:"knowledge.financial-docs",scope:{workflows:["pfo.workflow.process-uploaded-document","pfo.workflow.generate-financial-summary"]}},{spaceKey:"knowledge.email-threads",scope:{workflows:["pfo.workflow.ingest-email-threads"]}},{spaceKey:"knowledge.financial-overview",scope:{workflows:["pfo.workflow.sync-openbanking-transactions","pfo.workflow.refresh-openbanking-balances","pfo.workflow.generate-financial-summary","pfo.workflow.generate-openbanking-overview"]},required:!1}],locales:{defaultLocale:"en",enabledLocales:["en"]},notes:"Sample tenant configuration for hackathon demos. Replace connection IDs with tenant-specific bindings when provisioning."};var l=new Date,s={tenantId:"tenant.family-office",createdAt:l,updatedAt:l},T9=[{meta:{...s,id:"conn-mistral-primary",integrationKey:"ai-llm.mistral",integrationVersion:"1.0.0",label:"Mistral Primary"},ownershipMode:"managed",config:{model:"mistral-large-latest",embeddingModel:"mistral-embed"},secretProvider:"gcp-secret-manager",secretRef:"gcp://projects/pfo-hackathon/secrets/mistral-api-key/versions/latest",status:"connected",health:{status:"connected",checkedAt:l,latencyMs:180}},{meta:{...s,id:"conn-qdrant-finance",integrationKey:"vectordb.qdrant",integrationVersion:"1.0.0",label:"Qdrant Finance Cluster"},ownershipMode:"managed",config:{apiUrl:"https://qdrant.pfo.internal",collectionPrefix:"tenant-family-office"},secretProvider:"gcp-secret-manager",secretRef:"gcp://projects/pfo-hackathon/secrets/qdrant-api-key/versions/latest",status:"connected",health:{status:"connected",checkedAt:l,latencyMs:95}},{meta:{...s,id:"conn-gcs-documents",integrationKey:"storage.gcs",integrationVersion:"1.0.0",label:"GCS Documents Bucket"},ownershipMode:"managed",config:{bucket:"pfo-uploads",prefix:"financial-docs/"},secretProvider:"gcp-secret-manager",secretRef:"gcp://projects/pfo-hackathon/secrets/gcs-service-account/versions/latest",status:"connected",health:{status:"connected",checkedAt:l,latencyMs:60}},{meta:{...s,id:"conn-gmail-threads",integrationKey:"email.gmail",integrationVersion:"1.0.0",label:"Gmail Household Threads"},ownershipMode:"byok",config:{labelIds:["FINANCE","INBOX"],includeSpamTrash:!1},secretProvider:"gcp-secret-manager",secretRef:"gcp://projects/pfo-hackathon/secrets/gmail-refresh-token/versions/latest",status:"connected",health:{status:"connected",checkedAt:l,latencyMs:320}},{meta:{...s,id:"conn-postmark-outbound",integrationKey:"email.postmark",integrationVersion:"1.0.0",label:"Postmark Transactional"},ownershipMode:"managed",config:{messageStream:"outbound",fromEmail:"family.office@pfo.dev"},secretProvider:"gcp-secret-manager",secretRef:"gcp://projects/pfo-hackathon/secrets/postmark-server-token/versions/latest",status:"connected",health:{status:"connected",checkedAt:l,latencyMs:210}},{meta:{...s,id:"conn-google-calendar",integrationKey:"calendar.google",integrationVersion:"1.0.0",label:"Household Calendar"},ownershipMode:"managed",config:{calendarId:"primary"},secretProvider:"gcp-secret-manager",secretRef:"gcp://projects/pfo-hackathon/secrets/google-calendar-service-account/versions/latest",status:"connected",health:{status:"connected",checkedAt:l,latencyMs:140}},{meta:{...s,id:"conn-elevenlabs-voice",integrationKey:"ai-voice.elevenlabs",integrationVersion:"1.0.0",label:"ElevenLabs Voice"},ownershipMode:"byok",config:{defaultVoiceId:"pNInz6obpgDQGcFmaJgB"},secretProvider:"gcp-secret-manager",secretRef:"gcp://projects/pfo-hackathon/secrets/elevenlabs-api-key/versions/latest",status:"connected",health:{status:"connected",checkedAt:l,latencyMs:250}},{meta:{...s,id:"conn-twilio-sms",integrationKey:"sms.twilio",integrationVersion:"1.0.0",label:"Twilio SMS"},ownershipMode:"managed",config:{fromNumber:"+15552340000"},secretProvider:"gcp-secret-manager",secretRef:"gcp://projects/pfo-hackathon/secrets/twilio-auth-token/versions/latest",status:"connected",health:{status:"connected",checkedAt:l,latencyMs:180}},{meta:{...s,id:"conn-stripe-recurring",integrationKey:"payments.stripe",integrationVersion:"1.0.0",label:"Stripe Recurring Billing"},ownershipMode:"managed",config:{accountId:"acct_1PFOHACKATHON",region:"eu-west-1"},secretProvider:"gcp-secret-manager",secretRef:"gcp://projects/pfo-hackathon/secrets/stripe-secret-key/versions/latest",status:"connected",health:{status:"connected",checkedAt:l,latencyMs:220}},{meta:{...s,id:"conn-powens-primary",integrationKey:"openbanking.powens",integrationVersion:"1.0.0",label:"Powens Open Banking"},ownershipMode:"byok",config:{environment:"sandbox",baseUrl:"https://api-sandbox.powens.com/v2"},secretProvider:"gcp-secret-manager",secretRef:"gcp://projects/pfo-hackathon/secrets/powens-credentials/versions/latest",status:"connected",health:{status:"connected",checkedAt:l,latencyMs:410}}];function TW(J){return T9.find((X)=>X.meta.id===J)}var q0=new Date,vW=[{meta:{id:"source-financial-uploads",tenantId:"tenant.family-office",spaceKey:"knowledge.financial-docs",spaceVersion:"1.0.0",label:"Uploaded Financial Documents",sourceType:"file_upload",createdAt:q0,updatedAt:q0},config:{bucket:"pfo-uploads",prefix:"financial-docs/"},syncSchedule:{enabled:!0,intervalMs:900000},lastSync:{timestamp:q0,success:!0}},{meta:{id:"source-gmail-threads",tenantId:"tenant.family-office",spaceKey:"knowledge.email-threads",spaceVersion:"1.0.0",label:"Household Gmail Threads",sourceType:"email",createdAt:q0,updatedAt:q0},config:{labelIds:["INBOX","FINANCE"]},syncSchedule:{enabled:!0,intervalMs:300000},lastSync:{timestamp:q0,success:!0}},{meta:{id:"source-financial-overview",tenantId:"tenant.family-office",spaceKey:"knowledge.financial-overview",spaceVersion:"1.0.0",label:"Financial Overview",sourceType:"api",createdAt:q0,updatedAt:q0},config:{},syncSchedule:{enabled:!1}}];var gW=Object.freeze({status:"aborted"});function D(J,X,H){function W(Q,U){if(!Q._zod)Object.defineProperty(Q,"_zod",{value:{def:U,constr:z,traits:new Set},enumerable:!1});if(Q._zod.traits.has(J))return;Q._zod.traits.add(J),X(Q,U);let G=z.prototype,P=Object.keys(G);for(let B=0;B<P.length;B++){let $=P[B];if(!($ in Q))Q[$]=G[$].bind(Q)}}let q=H?.Parent??Object;class Y extends q{}Object.defineProperty(Y,"name",{value:J});function z(Q){var U;let G=H?.Parent?new Y:this;W(G,Q),(U=G._zod).deferred??(U.deferred=[]);for(let P of G._zod.deferred)P();return G}return Object.defineProperty(z,"init",{value:W}),Object.defineProperty(z,Symbol.hasInstance,{value:(Q)=>{if(H?.Parent&&Q instanceof H.Parent)return!0;return Q?._zod?.traits?.has(J)}}),Object.defineProperty(z,"name",{value:J}),z}var cW=Symbol("zod_brand");class J0 extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class b0 extends Error{constructor(J){super(`Encountered unidirectional transform during encode: ${J}`);this.name="ZodEncodeError"}}var f0={};function r(J){if(J)Object.assign(f0,J);return f0}var V={};_4(V,{unwrapMessage:()=>_0,uint8ArrayToHex:()=>qX,uint8ArrayToBase64url:()=>HX,uint8ArrayToBase64:()=>h4,stringifyPrimitive:()=>p0,slugify:()=>V1,shallowClone:()=>k4,safeExtend:()=>t9,required:()=>e9,randomString:()=>o9,propertyKeyTypes:()=>R1,promiseAllObject:()=>f9,primitiveTypes:()=>C4,prefixIssues:()=>X0,pick:()=>d9,partial:()=>s9,optionalKeys:()=>N1,omit:()=>n9,objectClone:()=>u9,numKeys:()=>l9,nullish:()=>C0,normalizeParams:()=>I,mergeDefs:()=>z0,merge:()=>a9,jsonStringifyReplacer:()=>$0,joinValues:()=>o0,issue:()=>A0,isPlainObject:()=>Q0,isObject:()=>I0,hexToUint8Array:()=>WX,getSizableOrigin:()=>j4,getParsedType:()=>r9,getLengthableOrigin:()=>j0,getEnumValues:()=>E0,getElementAtPath:()=>m9,floatSafeRemainder:()=>O1,finalizeIssue:()=>n,extend:()=>i9,escapeRegex:()=>D0,esc:()=>l0,defineLazy:()=>N,createTransparentProxy:()=>p9,cloneDef:()=>y9,clone:()=>d,cleanRegex:()=>S0,cleanEnum:()=>JX,captureStackTrace:()=>r0,cached:()=>k0,base64urlToUint8Array:()=>XX,base64ToUint8Array:()=>T4,assignProp:()=>Y0,assertNotEqual:()=>v9,assertNever:()=>g9,assertIs:()=>x9,assertEqual:()=>h9,assert:()=>c9,allowsEval:()=>K1,aborted:()=>w0,NUMBER_FORMAT_RANGES:()=>Z1,Class:()=>v4,BIGINT_FORMAT_RANGES:()=>S4});function h9(J){return J}function v9(J){return J}function x9(J){}function g9(J){throw Error("Unexpected value in exhaustive check")}function c9(J){}function E0(J){let X=Object.values(J).filter((W)=>typeof W==="number");return Object.entries(J).filter(([W,q])=>X.indexOf(+W)===-1).map(([W,q])=>q)}function o0(J,X="|"){return J.map((H)=>p0(H)).join(X)}function $0(J,X){if(typeof X==="bigint")return X.toString();return X}function k0(J){return{get value(){{let H=J();return Object.defineProperty(this,"value",{value:H}),H}throw Error("cached value already set")}}}function C0(J){return J===null||J===void 0}function S0(J){let X=J.startsWith("^")?1:0,H=J.endsWith("$")?J.length-1:J.length;return J.slice(X,H)}function O1(J,X){let H=(J.toString().split(".")[1]||"").length,W=X.toString(),q=(W.split(".")[1]||"").length;if(q===0&&/\d?e-\d?/.test(W)){let U=W.match(/\d?e-(\d?)/);if(U?.[1])q=Number.parseInt(U[1])}let Y=H>q?H:q,z=Number.parseInt(J.toFixed(Y).replace(".","")),Q=Number.parseInt(X.toFixed(Y).replace(".",""));return z%Q/10**Y}var E4=Symbol("evaluating");function N(J,X,H){let W=void 0;Object.defineProperty(J,X,{get(){if(W===E4)return;if(W===void 0)W=E4,W=H();return W},set(q){Object.defineProperty(J,X,{value:q})},configurable:!0})}function u9(J){return Object.create(Object.getPrototypeOf(J),Object.getOwnPropertyDescriptors(J))}function Y0(J,X,H){Object.defineProperty(J,X,{value:H,writable:!0,enumerable:!0,configurable:!0})}function z0(...J){let X={};for(let H of J){let W=Object.getOwnPropertyDescriptors(H);Object.assign(X,W)}return Object.defineProperties({},X)}function y9(J){return z0(J._zod.def)}function m9(J,X){if(!X)return J;return X.reduce((H,W)=>H?.[W],J)}function f9(J){let X=Object.keys(J),H=X.map((W)=>J[W]);return Promise.all(H).then((W)=>{let q={};for(let Y=0;Y<X.length;Y++)q[X[Y]]=W[Y];return q})}function o9(J=10){let H="";for(let W=0;W<J;W++)H+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return H}function l0(J){return JSON.stringify(J)}function V1(J){return J.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var r0="captureStackTrace"in Error?Error.captureStackTrace:(...J)=>{};function I0(J){return typeof J==="object"&&J!==null&&!Array.isArray(J)}var K1=k0(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(J){return!1}});function Q0(J){if(I0(J)===!1)return!1;let X=J.constructor;if(X===void 0)return!0;if(typeof X!=="function")return!0;let H=X.prototype;if(I0(H)===!1)return!1;if(Object.prototype.hasOwnProperty.call(H,"isPrototypeOf")===!1)return!1;return!0}function k4(J){if(Q0(J))return{...J};if(Array.isArray(J))return[...J];return J}function l9(J){let X=0;for(let H in J)if(Object.prototype.hasOwnProperty.call(J,H))X++;return X}var r9=(J)=>{let X=typeof J;switch(X){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(J)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(J))return"array";if(J===null)return"null";if(J.then&&typeof J.then==="function"&&J.catch&&typeof J.catch==="function")return"promise";if(typeof Map<"u"&&J instanceof Map)return"map";if(typeof Set<"u"&&J instanceof Set)return"set";if(typeof Date<"u"&&J instanceof Date)return"date";if(typeof File<"u"&&J instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${X}`)}},R1=new Set(["string","number","symbol"]),C4=new Set(["string","number","bigint","boolean","symbol","undefined"]);function D0(J){return J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function d(J,X,H){let W=new J._zod.constr(X??J._zod.def);if(!X||H?.parent)W._zod.parent=J;return W}function I(J){let X=J;if(!X)return{};if(typeof X==="string")return{error:()=>X};if(X?.message!==void 0){if(X?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");X.error=X.message}if(delete X.message,typeof X.error==="string")return{...X,error:()=>X.error};return X}function p9(J){let X;return new Proxy({},{get(H,W,q){return X??(X=J()),Reflect.get(X,W,q)},set(H,W,q,Y){return X??(X=J()),Reflect.set(X,W,q,Y)},has(H,W){return X??(X=J()),Reflect.has(X,W)},deleteProperty(H,W){return X??(X=J()),Reflect.deleteProperty(X,W)},ownKeys(H){return X??(X=J()),Reflect.ownKeys(X)},getOwnPropertyDescriptor(H,W){return X??(X=J()),Reflect.getOwnPropertyDescriptor(X,W)},defineProperty(H,W,q){return X??(X=J()),Reflect.defineProperty(X,W,q)}})}function p0(J){if(typeof J==="bigint")return J.toString()+"n";if(typeof J==="string")return`"${J}"`;return`${J}`}function N1(J){return Object.keys(J).filter((X)=>{return J[X]._zod.optin==="optional"&&J[X]._zod.optout==="optional"})}var Z1={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},S4={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function d9(J,X){let H=J._zod.def,W=z0(J._zod.def,{get shape(){let q={};for(let Y in X){if(!(Y in H.shape))throw Error(`Unrecognized key: "${Y}"`);if(!X[Y])continue;q[Y]=H.shape[Y]}return Y0(this,"shape",q),q},checks:[]});return d(J,W)}function n9(J,X){let H=J._zod.def,W=z0(J._zod.def,{get shape(){let q={...J._zod.def.shape};for(let Y in X){if(!(Y in H.shape))throw Error(`Unrecognized key: "${Y}"`);if(!X[Y])continue;delete q[Y]}return Y0(this,"shape",q),q},checks:[]});return d(J,W)}function i9(J,X){if(!Q0(X))throw Error("Invalid input to extend: expected a plain object");let H=J._zod.def.checks;if(H&&H.length>0)throw Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");let q=z0(J._zod.def,{get shape(){let Y={...J._zod.def.shape,...X};return Y0(this,"shape",Y),Y},checks:[]});return d(J,q)}function t9(J,X){if(!Q0(X))throw Error("Invalid input to safeExtend: expected a plain object");let H={...J._zod.def,get shape(){let W={...J._zod.def.shape,...X};return Y0(this,"shape",W),W},checks:J._zod.def.checks};return d(J,H)}function a9(J,X){let H=z0(J._zod.def,{get shape(){let W={...J._zod.def.shape,...X._zod.def.shape};return Y0(this,"shape",W),W},get catchall(){return X._zod.def.catchall},checks:[]});return d(J,H)}function s9(J,X,H){let W=z0(X._zod.def,{get shape(){let q=X._zod.def.shape,Y={...q};if(H)for(let z in H){if(!(z in q))throw Error(`Unrecognized key: "${z}"`);if(!H[z])continue;Y[z]=J?new J({type:"optional",innerType:q[z]}):q[z]}else for(let z in q)Y[z]=J?new J({type:"optional",innerType:q[z]}):q[z];return Y0(this,"shape",Y),Y},checks:[]});return d(X,W)}function e9(J,X,H){let W=z0(X._zod.def,{get shape(){let q=X._zod.def.shape,Y={...q};if(H)for(let z in H){if(!(z in Y))throw Error(`Unrecognized key: "${z}"`);if(!H[z])continue;Y[z]=new J({type:"nonoptional",innerType:q[z]})}else for(let z in q)Y[z]=new J({type:"nonoptional",innerType:q[z]});return Y0(this,"shape",Y),Y},checks:[]});return d(X,W)}function w0(J,X=0){if(J.aborted===!0)return!0;for(let H=X;H<J.issues.length;H++)if(J.issues[H]?.continue!==!0)return!0;return!1}function X0(J,X){return X.map((H)=>{var W;return(W=H).path??(W.path=[]),H.path.unshift(J),H})}function _0(J){return typeof J==="string"?J:J?.message}function n(J,X,H){let W={...J,path:J.path??[]};if(!J.message){let q=_0(J.inst?._zod.def?.error?.(J))??_0(X?.error?.(J))??_0(H.customError?.(J))??_0(H.localeError?.(J))??"Invalid input";W.message=q}if(delete W.inst,delete W.continue,!X?.reportInput)delete W.input;return W}function j4(J){if(J instanceof Set)return"set";if(J instanceof Map)return"map";if(J instanceof File)return"file";return"unknown"}function j0(J){if(Array.isArray(J))return"array";if(typeof J==="string")return"string";return"unknown"}function A0(...J){let[X,H,W]=J;if(typeof X==="string")return{message:X,code:"custom",input:H,inst:W};return{...X}}function JX(J){return Object.entries(J).filter(([X,H])=>{return Number.isNaN(Number.parseInt(X,10))}).map((X)=>X[1])}function T4(J){let X=atob(J),H=new Uint8Array(X.length);for(let W=0;W<X.length;W++)H[W]=X.charCodeAt(W);return H}function h4(J){let X="";for(let H=0;H<J.length;H++)X+=String.fromCharCode(J[H]);return btoa(X)}function XX(J){let X=J.replace(/-/g,"+").replace(/_/g,"/"),H="=".repeat((4-X.length%4)%4);return T4(X+H)}function HX(J){return h4(J).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function WX(J){let X=J.replace(/^0x/,"");if(X.length%2!==0)throw Error("Invalid hex string length");let H=new Uint8Array(X.length/2);for(let W=0;W<X.length;W+=2)H[W/2]=Number.parseInt(X.slice(W,W+2),16);return H}function qX(J){return Array.from(J).map((X)=>X.toString(16).padStart(2,"0")).join("")}class v4{constructor(...J){}}var x4=(J,X)=>{J.name="$ZodError",Object.defineProperty(J,"_zod",{value:J._zod,enumerable:!1}),Object.defineProperty(J,"issues",{value:X,enumerable:!1}),J.message=JSON.stringify(X,$0,2),Object.defineProperty(J,"toString",{value:()=>J.message,enumerable:!1})},d0=D("$ZodError",x4),L1=D("$ZodError",x4,{Parent:Error});function g4(J,X=(H)=>H.message){let H={},W=[];for(let q of J.issues)if(q.path.length>0)H[q.path[0]]=H[q.path[0]]||[],H[q.path[0]].push(X(q));else W.push(X(q));return{formErrors:W,fieldErrors:H}}function c4(J,X=(H)=>H.message){let H={_errors:[]},W=(q)=>{for(let Y of q.issues)if(Y.code==="invalid_union"&&Y.errors.length)Y.errors.map((z)=>W({issues:z}));else if(Y.code==="invalid_key")W({issues:Y.issues});else if(Y.code==="invalid_element")W({issues:Y.issues});else if(Y.path.length===0)H._errors.push(X(Y));else{let z=H,Q=0;while(Q<Y.path.length){let U=Y.path[Q];if(Q!==Y.path.length-1)z[U]=z[U]||{_errors:[]};else z[U]=z[U]||{_errors:[]},z[U]._errors.push(X(Y));z=z[U],Q++}}};return W(J),H}var n0=(J)=>(X,H,W,q)=>{let Y=W?Object.assign(W,{async:!1}):{async:!1},z=X._zod.run({value:H,issues:[]},Y);if(z instanceof Promise)throw new J0;if(z.issues.length){let Q=new(q?.Err??J)(z.issues.map((U)=>n(U,Y,r())));throw r0(Q,q?.callee),Q}return z.value};var i0=(J)=>async(X,H,W,q)=>{let Y=W?Object.assign(W,{async:!0}):{async:!0},z=X._zod.run({value:H,issues:[]},Y);if(z instanceof Promise)z=await z;if(z.issues.length){let Q=new(q?.Err??J)(z.issues.map((U)=>n(U,Y,r())));throw r0(Q,q?.callee),Q}return z.value};var T0=(J)=>(X,H,W)=>{let q=W?{...W,async:!1}:{async:!1},Y=X._zod.run({value:H,issues:[]},q);if(Y instanceof Promise)throw new J0;return Y.issues.length?{success:!1,error:new(J??d0)(Y.issues.map((z)=>n(z,q,r())))}:{success:!0,data:Y.value}},u4=T0(L1),h0=(J)=>async(X,H,W)=>{let q=W?Object.assign(W,{async:!0}):{async:!0},Y=X._zod.run({value:H,issues:[]},q);if(Y instanceof Promise)Y=await Y;return Y.issues.length?{success:!1,error:new J(Y.issues.map((z)=>n(z,q,r())))}:{success:!0,data:Y.value}},y4=h0(L1),m4=(J)=>(X,H,W)=>{let q=W?Object.assign(W,{direction:"backward"}):{direction:"backward"};return n0(J)(X,H,q)};var f4=(J)=>(X,H,W)=>{return n0(J)(X,H,W)};var o4=(J)=>async(X,H,W)=>{let q=W?Object.assign(W,{direction:"backward"}):{direction:"backward"};return i0(J)(X,H,q)};var l4=(J)=>async(X,H,W)=>{return i0(J)(X,H,W)};var r4=(J)=>(X,H,W)=>{let q=W?Object.assign(W,{direction:"backward"}):{direction:"backward"};return T0(J)(X,H,q)};var p4=(J)=>(X,H,W)=>{return T0(J)(X,H,W)};var d4=(J)=>async(X,H,W)=>{let q=W?Object.assign(W,{direction:"backward"}):{direction:"backward"};return h0(J)(X,H,q)};var n4=(J)=>async(X,H,W)=>{return h0(J)(X,H,W)};var i4=/^[cC][^\s-]{8,}$/,t4=/^[0-9a-z]+$/,a4=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,s4=/^[0-9a-vA-V]{20}$/,e4=/^[A-Za-z0-9]{27}$/,J6=/^[a-zA-Z0-9_-]{21}$/,X6=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var H6=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,b1=(J)=>{if(!J)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${J}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var W6=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var zX="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function q6(){return new RegExp(zX,"u")}var Y6=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,z6=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var Q6=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,w6=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,G6=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,_1=/^[A-Za-z0-9_-]*$/;var U6=/^\+(?:[0-9]){6,14}[0-9]$/,D6="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",P6=new RegExp(`^${D6}$`);function B6(J){return typeof J.precision==="number"?J.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":J.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${J.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function M6(J){return new RegExp(`^${B6(J)}$`)}function F6(J){let X=B6({precision:J.precision}),H=["Z"];if(J.local)H.push("");if(J.offset)H.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let W=`${X}(?:${H.join("|")})`;return new RegExp(`^${D6}T(?:${W})$`)}var I6=(J)=>{let X=J?`[\\s\\S]{${J?.minimum??0},${J?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${X}$`)},$6=/^-?\d+n?$/,A6=/^-?\d+$/,O6=/^-?\d+(?:\.\d+)?/,V6=/^(?:true|false)$/i;var K6=/^[^A-Z]*$/,R6=/^[^a-z]*$/;var c=D("$ZodCheck",(J,X)=>{var H;J._zod??(J._zod={}),J._zod.def=X,(H=J._zod).onattach??(H.onattach=[])}),N6={number:"number",bigint:"bigint",object:"date"},E1=D("$ZodCheckLessThan",(J,X)=>{c.init(J,X);let H=N6[typeof X.value];J._zod.onattach.push((W)=>{let q=W._zod.bag,Y=(X.inclusive?q.maximum:q.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(X.value<Y)if(X.inclusive)q.maximum=X.value;else q.exclusiveMaximum=X.value}),J._zod.check=(W)=>{if(X.inclusive?W.value<=X.value:W.value<X.value)return;W.issues.push({origin:H,code:"too_big",maximum:X.value,input:W.value,inclusive:X.inclusive,inst:J,continue:!X.abort})}}),k1=D("$ZodCheckGreaterThan",(J,X)=>{c.init(J,X);let H=N6[typeof X.value];J._zod.onattach.push((W)=>{let q=W._zod.bag,Y=(X.inclusive?q.minimum:q.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(X.value>Y)if(X.inclusive)q.minimum=X.value;else q.exclusiveMinimum=X.value}),J._zod.check=(W)=>{if(X.inclusive?W.value>=X.value:W.value>X.value)return;W.issues.push({origin:H,code:"too_small",minimum:X.value,input:W.value,inclusive:X.inclusive,inst:J,continue:!X.abort})}}),Z6=D("$ZodCheckMultipleOf",(J,X)=>{c.init(J,X),J._zod.onattach.push((H)=>{var W;(W=H._zod.bag).multipleOf??(W.multipleOf=X.value)}),J._zod.check=(H)=>{if(typeof H.value!==typeof X.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof H.value==="bigint"?H.value%X.value===BigInt(0):O1(H.value,X.value)===0)return;H.issues.push({origin:typeof H.value,code:"not_multiple_of",divisor:X.value,input:H.value,inst:J,continue:!X.abort})}}),L6=D("$ZodCheckNumberFormat",(J,X)=>{c.init(J,X),X.format=X.format||"float64";let H=X.format?.includes("int"),W=H?"int":"number",[q,Y]=Z1[X.format];J._zod.onattach.push((z)=>{let Q=z._zod.bag;if(Q.format=X.format,Q.minimum=q,Q.maximum=Y,H)Q.pattern=A6}),J._zod.check=(z)=>{let Q=z.value;if(H){if(!Number.isInteger(Q)){z.issues.push({expected:W,format:X.format,code:"invalid_type",continue:!1,input:Q,inst:J});return}if(!Number.isSafeInteger(Q)){if(Q>0)z.issues.push({input:Q,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:J,origin:W,continue:!X.abort});else z.issues.push({input:Q,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:J,origin:W,continue:!X.abort});return}}if(Q<q)z.issues.push({origin:"number",input:Q,code:"too_small",minimum:q,inclusive:!0,inst:J,continue:!X.abort});if(Q>Y)z.issues.push({origin:"number",input:Q,code:"too_big",maximum:Y,inst:J})}});var b6=D("$ZodCheckMaxLength",(J,X)=>{var H;c.init(J,X),(H=J._zod.def).when??(H.when=(W)=>{let q=W.value;return!C0(q)&&q.length!==void 0}),J._zod.onattach.push((W)=>{let q=W._zod.bag.maximum??Number.POSITIVE_INFINITY;if(X.maximum<q)W._zod.bag.maximum=X.maximum}),J._zod.check=(W)=>{let q=W.value;if(q.length<=X.maximum)return;let z=j0(q);W.issues.push({origin:z,code:"too_big",maximum:X.maximum,inclusive:!0,input:q,inst:J,continue:!X.abort})}}),_6=D("$ZodCheckMinLength",(J,X)=>{var H;c.init(J,X),(H=J._zod.def).when??(H.when=(W)=>{let q=W.value;return!C0(q)&&q.length!==void 0}),J._zod.onattach.push((W)=>{let q=W._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(X.minimum>q)W._zod.bag.minimum=X.minimum}),J._zod.check=(W)=>{let q=W.value;if(q.length>=X.minimum)return;let z=j0(q);W.issues.push({origin:z,code:"too_small",minimum:X.minimum,inclusive:!0,input:q,inst:J,continue:!X.abort})}}),E6=D("$ZodCheckLengthEquals",(J,X)=>{var H;c.init(J,X),(H=J._zod.def).when??(H.when=(W)=>{let q=W.value;return!C0(q)&&q.length!==void 0}),J._zod.onattach.push((W)=>{let q=W._zod.bag;q.minimum=X.length,q.maximum=X.length,q.length=X.length}),J._zod.check=(W)=>{let q=W.value,Y=q.length;if(Y===X.length)return;let z=j0(q),Q=Y>X.length;W.issues.push({origin:z,...Q?{code:"too_big",maximum:X.length}:{code:"too_small",minimum:X.length},inclusive:!0,exact:!0,input:W.value,inst:J,continue:!X.abort})}}),v0=D("$ZodCheckStringFormat",(J,X)=>{var H,W;if(c.init(J,X),J._zod.onattach.push((q)=>{let Y=q._zod.bag;if(Y.format=X.format,X.pattern)Y.patterns??(Y.patterns=new Set),Y.patterns.add(X.pattern)}),X.pattern)(H=J._zod).check??(H.check=(q)=>{if(X.pattern.lastIndex=0,X.pattern.test(q.value))return;q.issues.push({origin:"string",code:"invalid_format",format:X.format,input:q.value,...X.pattern?{pattern:X.pattern.toString()}:{},inst:J,continue:!X.abort})});else(W=J._zod).check??(W.check=()=>{})}),k6=D("$ZodCheckRegex",(J,X)=>{v0.init(J,X),J._zod.check=(H)=>{if(X.pattern.lastIndex=0,X.pattern.test(H.value))return;H.issues.push({origin:"string",code:"invalid_format",format:"regex",input:H.value,pattern:X.pattern.toString(),inst:J,continue:!X.abort})}}),C6=D("$ZodCheckLowerCase",(J,X)=>{X.pattern??(X.pattern=K6),v0.init(J,X)}),S6=D("$ZodCheckUpperCase",(J,X)=>{X.pattern??(X.pattern=R6),v0.init(J,X)}),j6=D("$ZodCheckIncludes",(J,X)=>{c.init(J,X);let H=D0(X.includes),W=new RegExp(typeof X.position==="number"?`^.{${X.position}}${H}`:H);X.pattern=W,J._zod.onattach.push((q)=>{let Y=q._zod.bag;Y.patterns??(Y.patterns=new Set),Y.patterns.add(W)}),J._zod.check=(q)=>{if(q.value.includes(X.includes,X.position))return;q.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:X.includes,input:q.value,inst:J,continue:!X.abort})}}),T6=D("$ZodCheckStartsWith",(J,X)=>{c.init(J,X);let H=new RegExp(`^${D0(X.prefix)}.*`);X.pattern??(X.pattern=H),J._zod.onattach.push((W)=>{let q=W._zod.bag;q.patterns??(q.patterns=new Set),q.patterns.add(H)}),J._zod.check=(W)=>{if(W.value.startsWith(X.prefix))return;W.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:X.prefix,input:W.value,inst:J,continue:!X.abort})}}),h6=D("$ZodCheckEndsWith",(J,X)=>{c.init(J,X);let H=new RegExp(`.*${D0(X.suffix)}$`);X.pattern??(X.pattern=H),J._zod.onattach.push((W)=>{let q=W._zod.bag;q.patterns??(q.patterns=new Set),q.patterns.add(H)}),J._zod.check=(W)=>{if(W.value.endsWith(X.suffix))return;W.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:X.suffix,input:W.value,inst:J,continue:!X.abort})}});var v6=D("$ZodCheckOverwrite",(J,X)=>{c.init(J,X),J._zod.check=(H)=>{H.value=X.tx(H.value)}});class C1{constructor(J=[]){if(this.content=[],this.indent=0,this)this.args=J}indented(J){this.indent+=1,J(this),this.indent-=1}write(J){if(typeof J==="function"){J(this,{execution:"sync"}),J(this,{execution:"async"});return}let H=J.split(`
|
|
1
|
+
var c6=Object.defineProperty;var h8=(J,X)=>{for(var H in X)c6(J,H,{get:X[H],enumerable:!0,configurable:!0,set:(W)=>X[H]=()=>W})};var K={Idea:"idea",InCreation:"in_creation",Experimental:"experimental",Beta:"beta",Stable:"stable",Deprecated:"deprecated"},Z={PlatformCore:"platform.core",PlatformSigil:"platform.sigil",PlatformMarketplace:"platform.marketplace",PlatformMessaging:"platform.messaging",PlatformContent:"platform.content",PlatformFeatureFlags:"platform.featureflags",PlatformFinance:"platform.finance"};var N={Spots:"spots",Collectivity:"collectivity",Marketplace:"marketplace",Sellers:"sellers",Auth:"auth",Login:"login",Signup:"signup",Guide:"guide",Docs:"docs",I18n:"i18n",Incident:"incident",Automation:"automation",Hygiene:"hygiene"};var E=(J,X)=>({key:J,version:X}),f6={meta:{key:"pocket-family-office.app",version:"1.0.0",appId:"pocket-family-office",title:"Pocket Family Office",description:"Household finance automation: ingest documents, track bills, remind payments, and summarise cashflow.",domain:"finance",owners:[Z.PlatformFinance],tags:[N.Guide,"finance","automation"],stability:K.Experimental},capabilities:{enabled:[E("ai.chat","1.0.0"),E("ai.embeddings","1.0.0"),E("vector-db.search","1.0.0"),E("vector-db.storage","1.0.0"),E("storage.objects","1.0.0"),E("email.inbound","1.0.0"),E("email.transactional","1.0.0"),E("calendar.events","1.0.0"),E("sms.outbound","1.0.0"),E("ai.voice.synthesis","1.0.0"),E("payments.psp","1.0.0"),E("openbanking.accounts.read","1.0.0"),E("openbanking.transactions.read","1.0.0"),E("openbanking.balances.read","1.0.0")]},integrationSlots:[{slotId:"primaryLLM",requiredCategory:"ai-llm",allowedModes:["managed","byok"],requiredCapabilities:[E("ai.chat","1.0.0")],required:!0,description:"Chat completion provider powering summarisation, explanations, and insights."},{slotId:"primaryVectorDb",requiredCategory:"vector-db",allowedModes:["managed","byok"],requiredCapabilities:[E("vector-db.search","1.0.0")],required:!0,description:"Vector database storing embeddings for financial documents and email threads."},{slotId:"primaryStorage",requiredCategory:"storage",allowedModes:["managed","byok"],requiredCapabilities:[E("storage.objects","1.0.0")],required:!0,description:"Object storage used for raw uploads and normalised documents."},{slotId:"primaryOpenBanking",requiredCategory:"open-banking",allowedModes:["byok"],requiredCapabilities:[E("openbanking.accounts.read","1.0.0"),E("openbanking.transactions.read","1.0.0"),E("openbanking.balances.read","1.0.0")],required:!0,description:"Powens BYOK connection powering bank account, transaction, and balance synchronisation."},{slotId:"emailInbound",requiredCategory:"email",allowedModes:["managed","byok"],requiredCapabilities:[E("email.inbound","1.0.0")],required:!0,description:"Inbound email/thread sync (Gmail) feeding the knowledge corpus."},{slotId:"emailOutbound",requiredCategory:"email",allowedModes:["managed","byok"],requiredCapabilities:[E("email.transactional","1.0.0")],required:!0,description:"Transactional email delivery for reminders and summaries."},{slotId:"calendarScheduling",requiredCategory:"calendar",allowedModes:["managed","byok"],requiredCapabilities:[E("calendar.events","1.0.0")],required:!0,description:"Creates calendar holds for bill reviews and handoff meetings."},{slotId:"voicePlayback",requiredCategory:"ai-voice",allowedModes:["managed","byok"],requiredCapabilities:[E("ai.voice.synthesis","1.0.0")],required:!1,description:"Optional voice synthesis for spoken summaries (ElevenLabs)."},{slotId:"smsNotifications",requiredCategory:"sms",allowedModes:["managed","byok"],requiredCapabilities:[E("sms.outbound","1.0.0")],required:!1,description:"SMS provider used for urgent reminders."},{slotId:"paymentsProcessing",requiredCategory:"payments",allowedModes:["managed","byok"],requiredCapabilities:[E("payments.psp","1.0.0")],required:!1,description:"Optional payments processor enabling bill pay automations."}],workflows:{processUploadedDocument:{key:"pfo.workflow.process-uploaded-document",version:"1.0.0"},upcomingPaymentsReminder:{key:"pfo.workflow.upcoming-payments-reminder",version:"1.0.0"},generateFinancialSummary:{key:"pfo.workflow.generate-financial-summary",version:"1.0.0"},ingestEmailThreads:{key:"pfo.workflow.ingest-email-threads",version:"1.0.0"},syncOpenBankingAccounts:{key:"pfo.workflow.sync-openbanking-accounts",version:"1.0.0"},syncOpenBankingTransactions:{key:"pfo.workflow.sync-openbanking-transactions",version:"1.0.0"},refreshOpenBankingBalances:{key:"pfo.workflow.refresh-openbanking-balances",version:"1.0.0"},generateOpenBankingOverview:{key:"pfo.workflow.generate-openbanking-overview",version:"1.0.0"}},policies:[{key:"pfo.policy.tenancy",version:"1.0.0"},{key:"knowledge.access.financial-docs",version:"1.0.0"}],telemetry:{spec:{key:"pfo.telemetry",version:"1.0.0"}},featureFlags:[{key:"voice-summaries",enabled:!1,description:"Enable ElevenLabs spoken summaries in addition to email distribution."}],routes:[{path:"/dashboard",label:"Overview",workflow:"pfo.workflow.generate-financial-summary"},{path:"/documents/upload",label:"Upload Document",workflow:"pfo.workflow.process-uploaded-document"},{path:"/communications",label:"Inbox",workflow:"pfo.workflow.ingest-email-threads"}],notes:"Pocket Family Office blueprint pulling together finance automations for the hackathon reference implementation."};function V5(J){return J.register(f6)}var D5={meta:{id:"tenant-pfo-sample",tenantId:"tenant.family-office",appId:"pocket-family-office",blueprintName:"pocket-family-office.app",blueprintVersion:"1.0.0",environment:"production",version:"1.0.0",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),status:"published"},featureFlags:[{key:"voice-summaries",enabled:!0,description:"Enable spoken ElevenLabs summaries for daily briefings."}],integrations:[{slotId:"primaryLLM",connectionId:"conn-mistral-primary"},{slotId:"primaryVectorDb",connectionId:"conn-qdrant-finance"},{slotId:"primaryStorage",connectionId:"conn-gcs-documents"},{slotId:"primaryOpenBanking",connectionId:"conn-powens-primary"},{slotId:"emailInbound",connectionId:"conn-gmail-threads"},{slotId:"emailOutbound",connectionId:"conn-postmark-outbound"},{slotId:"calendarScheduling",connectionId:"conn-google-calendar"},{slotId:"voicePlayback",connectionId:"conn-elevenlabs-voice"},{slotId:"smsNotifications",connectionId:"conn-twilio-sms"},{slotId:"paymentsProcessing",connectionId:"conn-stripe-recurring"}],knowledge:[{spaceKey:"knowledge.financial-docs",scope:{workflows:["pfo.workflow.process-uploaded-document","pfo.workflow.generate-financial-summary"]}},{spaceKey:"knowledge.email-threads",scope:{workflows:["pfo.workflow.ingest-email-threads"]}},{spaceKey:"knowledge.financial-overview",scope:{workflows:["pfo.workflow.sync-openbanking-transactions","pfo.workflow.refresh-openbanking-balances","pfo.workflow.generate-financial-summary","pfo.workflow.generate-openbanking-overview"]},required:!1}],locales:{defaultLocale:"en",enabledLocales:["en"]},notes:"Sample tenant configuration for hackathon demos. Replace connection IDs with tenant-specific bindings when provisioning."};var r=new Date,X0={tenantId:"tenant.family-office",createdAt:r,updatedAt:r},o6=[{meta:{...X0,id:"conn-mistral-primary",integrationKey:"ai-llm.mistral",integrationVersion:"1.0.0",label:"Mistral Primary"},ownershipMode:"managed",config:{model:"mistral-large-latest",embeddingModel:"mistral-embed"},secretProvider:"gcp-secret-manager",secretRef:"gcp://projects/pfo-hackathon/secrets/mistral-api-key/versions/latest",status:"connected",health:{status:"connected",checkedAt:r,latencyMs:180}},{meta:{...X0,id:"conn-qdrant-finance",integrationKey:"vectordb.qdrant",integrationVersion:"1.0.0",label:"Qdrant Finance Cluster"},ownershipMode:"managed",config:{apiUrl:"https://qdrant.pfo.internal",collectionPrefix:"tenant-family-office"},secretProvider:"gcp-secret-manager",secretRef:"gcp://projects/pfo-hackathon/secrets/qdrant-api-key/versions/latest",status:"connected",health:{status:"connected",checkedAt:r,latencyMs:95}},{meta:{...X0,id:"conn-gcs-documents",integrationKey:"storage.gcs",integrationVersion:"1.0.0",label:"GCS Documents Bucket"},ownershipMode:"managed",config:{bucket:"pfo-uploads",prefix:"financial-docs/"},secretProvider:"gcp-secret-manager",secretRef:"gcp://projects/pfo-hackathon/secrets/gcs-service-account/versions/latest",status:"connected",health:{status:"connected",checkedAt:r,latencyMs:60}},{meta:{...X0,id:"conn-gmail-threads",integrationKey:"email.gmail",integrationVersion:"1.0.0",label:"Gmail Household Threads"},ownershipMode:"byok",config:{labelIds:["FINANCE","INBOX"],includeSpamTrash:!1},secretProvider:"gcp-secret-manager",secretRef:"gcp://projects/pfo-hackathon/secrets/gmail-refresh-token/versions/latest",status:"connected",health:{status:"connected",checkedAt:r,latencyMs:320}},{meta:{...X0,id:"conn-postmark-outbound",integrationKey:"email.postmark",integrationVersion:"1.0.0",label:"Postmark Transactional"},ownershipMode:"managed",config:{messageStream:"outbound",fromEmail:"family.office@pfo.dev"},secretProvider:"gcp-secret-manager",secretRef:"gcp://projects/pfo-hackathon/secrets/postmark-server-token/versions/latest",status:"connected",health:{status:"connected",checkedAt:r,latencyMs:210}},{meta:{...X0,id:"conn-google-calendar",integrationKey:"calendar.google",integrationVersion:"1.0.0",label:"Household Calendar"},ownershipMode:"managed",config:{calendarId:"primary"},secretProvider:"gcp-secret-manager",secretRef:"gcp://projects/pfo-hackathon/secrets/google-calendar-service-account/versions/latest",status:"connected",health:{status:"connected",checkedAt:r,latencyMs:140}},{meta:{...X0,id:"conn-elevenlabs-voice",integrationKey:"ai-voice.elevenlabs",integrationVersion:"1.0.0",label:"ElevenLabs Voice"},ownershipMode:"byok",config:{defaultVoiceId:"pNInz6obpgDQGcFmaJgB"},secretProvider:"gcp-secret-manager",secretRef:"gcp://projects/pfo-hackathon/secrets/elevenlabs-api-key/versions/latest",status:"connected",health:{status:"connected",checkedAt:r,latencyMs:250}},{meta:{...X0,id:"conn-twilio-sms",integrationKey:"sms.twilio",integrationVersion:"1.0.0",label:"Twilio SMS"},ownershipMode:"managed",config:{fromNumber:"+15552340000"},secretProvider:"gcp-secret-manager",secretRef:"gcp://projects/pfo-hackathon/secrets/twilio-auth-token/versions/latest",status:"connected",health:{status:"connected",checkedAt:r,latencyMs:180}},{meta:{...X0,id:"conn-stripe-recurring",integrationKey:"payments.stripe",integrationVersion:"1.0.0",label:"Stripe Recurring Billing"},ownershipMode:"managed",config:{accountId:"acct_1PFOHACKATHON",region:"eu-west-1"},secretProvider:"gcp-secret-manager",secretRef:"gcp://projects/pfo-hackathon/secrets/stripe-secret-key/versions/latest",status:"connected",health:{status:"connected",checkedAt:r,latencyMs:220}},{meta:{...X0,id:"conn-powens-primary",integrationKey:"openbanking.powens",integrationVersion:"1.0.0",label:"Powens Open Banking"},ownershipMode:"byok",config:{environment:"sandbox",baseUrl:"https://api-sandbox.powens.com/v2"},secretProvider:"gcp-secret-manager",secretRef:"gcp://projects/pfo-hackathon/secrets/powens-credentials/versions/latest",status:"connected",health:{status:"connected",checkedAt:r,latencyMs:410}}];function I5(J){return o6.find((X)=>X.meta.id===J)}var Q0=new Date,R5=[{meta:{id:"source-financial-uploads",tenantId:"tenant.family-office",spaceKey:"knowledge.financial-docs",spaceVersion:"1.0.0",label:"Uploaded Financial Documents",sourceType:"file_upload",createdAt:Q0,updatedAt:Q0},config:{bucket:"pfo-uploads",prefix:"financial-docs/"},syncSchedule:{enabled:!0,intervalMs:900000},lastSync:{timestamp:Q0,success:!0}},{meta:{id:"source-gmail-threads",tenantId:"tenant.family-office",spaceKey:"knowledge.email-threads",spaceVersion:"1.0.0",label:"Household Gmail Threads",sourceType:"email",createdAt:Q0,updatedAt:Q0},config:{labelIds:["INBOX","FINANCE"]},syncSchedule:{enabled:!0,intervalMs:300000},lastSync:{timestamp:Q0,success:!0}},{meta:{id:"source-financial-overview",tenantId:"tenant.family-office",spaceKey:"knowledge.financial-overview",spaceVersion:"1.0.0",label:"Financial Overview",sourceType:"api",createdAt:Q0,updatedAt:Q0},config:{},syncSchedule:{enabled:!1}}];var Z5=Object.freeze({status:"aborted"});function P(J,X,H){function W(z,U){if(!z._zod)Object.defineProperty(z,"_zod",{value:{def:U,constr:Q,traits:new Set},enumerable:!1});if(z._zod.traits.has(J))return;z._zod.traits.add(J),X(z,U);let w=Q.prototype,M=Object.keys(w);for(let F=0;F<M.length;F++){let V=M[F];if(!(V in z))z[V]=w[V].bind(z)}}let q=H?.Parent??Object;class Y extends q{}Object.defineProperty(Y,"name",{value:J});function Q(z){var U;let w=H?.Parent?new Y:this;W(w,z),(U=w._zod).deferred??(U.deferred=[]);for(let M of w._zod.deferred)M();return w}return Object.defineProperty(Q,"init",{value:W}),Object.defineProperty(Q,Symbol.hasInstance,{value:(z)=>{if(H?.Parent&&z instanceof H.Parent)return!0;return z?._zod?.traits?.has(J)}}),Object.defineProperty(Q,"name",{value:J}),Q}var N5=Symbol("zod_brand");class H0 extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class C0 extends Error{constructor(J){super(`Encountered unidirectional transform during encode: ${J}`);this.name="ZodEncodeError"}}var l0={};function d(J){if(J)Object.assign(l0,J);return l0}var L={};h8(L,{unwrapMessage:()=>S0,uint8ArrayToHex:()=>AX,uint8ArrayToBase64url:()=>MX,uint8ArrayToBase64:()=>c8,stringifyPrimitive:()=>n0,slugify:()=>N1,shallowClone:()=>v8,safeExtend:()=>QX,required:()=>GX,randomString:()=>e6,propertyKeyTypes:()=>E1,promiseAllObject:()=>s6,primitiveTypes:()=>g8,prefixIssues:()=>q0,pick:()=>WX,partial:()=>wX,parsedType:()=>k1,optionalKeys:()=>C1,omit:()=>qX,objectClone:()=>i6,numKeys:()=>JX,nullish:()=>T0,normalizeParams:()=>B,mergeDefs:()=>W0,merge:()=>zX,jsonStringifyReplacer:()=>K0,joinValues:()=>p0,issue:()=>I0,isPlainObject:()=>w0,isObject:()=>B0,hexToUint8Array:()=>FX,getSizableOrigin:()=>y8,getParsedType:()=>XX,getLengthableOrigin:()=>_0,getEnumValues:()=>D0,getElementAtPath:()=>a6,floatSafeRemainder:()=>Z1,finalizeIssue:()=>t,extend:()=>YX,escapeRegex:()=>M0,esc:()=>r0,defineLazy:()=>R,createTransparentProxy:()=>HX,cloneDef:()=>t6,clone:()=>i,cleanRegex:()=>j0,cleanEnum:()=>UX,captureStackTrace:()=>d0,cached:()=>k0,base64urlToUint8Array:()=>PX,base64ToUint8Array:()=>m8,assignProp:()=>z0,assertNotEqual:()=>p6,assertNever:()=>d6,assertIs:()=>r6,assertEqual:()=>l6,assert:()=>n6,allowsEval:()=>b1,aborted:()=>G0,NUMBER_FORMAT_RANGES:()=>S1,Class:()=>f8,BIGINT_FORMAT_RANGES:()=>u8});function l6(J){return J}function p6(J){return J}function r6(J){}function d6(J){throw Error("Unexpected value in exhaustive check")}function n6(J){}function D0(J){let X=Object.values(J).filter((W)=>typeof W==="number");return Object.entries(J).filter(([W,q])=>X.indexOf(+W)===-1).map(([W,q])=>q)}function p0(J,X="|"){return J.map((H)=>n0(H)).join(X)}function K0(J,X){if(typeof X==="bigint")return X.toString();return X}function k0(J){return{get value(){{let H=J();return Object.defineProperty(this,"value",{value:H}),H}throw Error("cached value already set")}}}function T0(J){return J===null||J===void 0}function j0(J){let X=J.startsWith("^")?1:0,H=J.endsWith("$")?J.length-1:J.length;return J.slice(X,H)}function Z1(J,X){let H=(J.toString().split(".")[1]||"").length,W=X.toString(),q=(W.split(".")[1]||"").length;if(q===0&&/\d?e-\d?/.test(W)){let U=W.match(/\d?e-(\d?)/);if(U?.[1])q=Number.parseInt(U[1])}let Y=H>q?H:q,Q=Number.parseInt(J.toFixed(Y).replace(".","")),z=Number.parseInt(X.toFixed(Y).replace(".",""));return Q%z/10**Y}var x8=Symbol("evaluating");function R(J,X,H){let W=void 0;Object.defineProperty(J,X,{get(){if(W===x8)return;if(W===void 0)W=x8,W=H();return W},set(q){Object.defineProperty(J,X,{value:q})},configurable:!0})}function i6(J){return Object.create(Object.getPrototypeOf(J),Object.getOwnPropertyDescriptors(J))}function z0(J,X,H){Object.defineProperty(J,X,{value:H,writable:!0,enumerable:!0,configurable:!0})}function W0(...J){let X={};for(let H of J){let W=Object.getOwnPropertyDescriptors(H);Object.assign(X,W)}return Object.defineProperties({},X)}function t6(J){return W0(J._zod.def)}function a6(J,X){if(!X)return J;return X.reduce((H,W)=>H?.[W],J)}function s6(J){let X=Object.keys(J),H=X.map((W)=>J[W]);return Promise.all(H).then((W)=>{let q={};for(let Y=0;Y<X.length;Y++)q[X[Y]]=W[Y];return q})}function e6(J=10){let H="";for(let W=0;W<J;W++)H+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return H}function r0(J){return JSON.stringify(J)}function N1(J){return J.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var d0="captureStackTrace"in Error?Error.captureStackTrace:(...J)=>{};function B0(J){return typeof J==="object"&&J!==null&&!Array.isArray(J)}var b1=k0(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(J){return!1}});function w0(J){if(B0(J)===!1)return!1;let X=J.constructor;if(X===void 0)return!0;if(typeof X!=="function")return!0;let H=X.prototype;if(B0(H)===!1)return!1;if(Object.prototype.hasOwnProperty.call(H,"isPrototypeOf")===!1)return!1;return!0}function v8(J){if(w0(J))return{...J};if(Array.isArray(J))return[...J];return J}function JX(J){let X=0;for(let H in J)if(Object.prototype.hasOwnProperty.call(J,H))X++;return X}var XX=(J)=>{let X=typeof J;switch(X){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(J)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(J))return"array";if(J===null)return"null";if(J.then&&typeof J.then==="function"&&J.catch&&typeof J.catch==="function")return"promise";if(typeof Map<"u"&&J instanceof Map)return"map";if(typeof Set<"u"&&J instanceof Set)return"set";if(typeof Date<"u"&&J instanceof Date)return"date";if(typeof File<"u"&&J instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${X}`)}},E1=new Set(["string","number","symbol"]),g8=new Set(["string","number","bigint","boolean","symbol","undefined"]);function M0(J){return J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function i(J,X,H){let W=new J._zod.constr(X??J._zod.def);if(!X||H?.parent)W._zod.parent=J;return W}function B(J){let X=J;if(!X)return{};if(typeof X==="string")return{error:()=>X};if(X?.message!==void 0){if(X?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");X.error=X.message}if(delete X.message,typeof X.error==="string")return{...X,error:()=>X.error};return X}function HX(J){let X;return new Proxy({},{get(H,W,q){return X??(X=J()),Reflect.get(X,W,q)},set(H,W,q,Y){return X??(X=J()),Reflect.set(X,W,q,Y)},has(H,W){return X??(X=J()),Reflect.has(X,W)},deleteProperty(H,W){return X??(X=J()),Reflect.deleteProperty(X,W)},ownKeys(H){return X??(X=J()),Reflect.ownKeys(X)},getOwnPropertyDescriptor(H,W){return X??(X=J()),Reflect.getOwnPropertyDescriptor(X,W)},defineProperty(H,W,q){return X??(X=J()),Reflect.defineProperty(X,W,q)}})}function n0(J){if(typeof J==="bigint")return J.toString()+"n";if(typeof J==="string")return`"${J}"`;return`${J}`}function C1(J){return Object.keys(J).filter((X)=>{return J[X]._zod.optin==="optional"&&J[X]._zod.optout==="optional"})}var S1={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},u8={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function WX(J,X){let H=J._zod.def,W=H.checks;if(W&&W.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let Y=W0(J._zod.def,{get shape(){let Q={};for(let z in X){if(!(z in H.shape))throw Error(`Unrecognized key: "${z}"`);if(!X[z])continue;Q[z]=H.shape[z]}return z0(this,"shape",Q),Q},checks:[]});return i(J,Y)}function qX(J,X){let H=J._zod.def,W=H.checks;if(W&&W.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let Y=W0(J._zod.def,{get shape(){let Q={...J._zod.def.shape};for(let z in X){if(!(z in H.shape))throw Error(`Unrecognized key: "${z}"`);if(!X[z])continue;delete Q[z]}return z0(this,"shape",Q),Q},checks:[]});return i(J,Y)}function YX(J,X){if(!w0(X))throw Error("Invalid input to extend: expected a plain object");let H=J._zod.def.checks;if(H&&H.length>0){let Y=J._zod.def.shape;for(let Q in X)if(Object.getOwnPropertyDescriptor(Y,Q)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let q=W0(J._zod.def,{get shape(){let Y={...J._zod.def.shape,...X};return z0(this,"shape",Y),Y}});return i(J,q)}function QX(J,X){if(!w0(X))throw Error("Invalid input to safeExtend: expected a plain object");let H=W0(J._zod.def,{get shape(){let W={...J._zod.def.shape,...X};return z0(this,"shape",W),W}});return i(J,H)}function zX(J,X){let H=W0(J._zod.def,{get shape(){let W={...J._zod.def.shape,...X._zod.def.shape};return z0(this,"shape",W),W},get catchall(){return X._zod.def.catchall},checks:[]});return i(J,H)}function wX(J,X,H){let q=X._zod.def.checks;if(q&&q.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let Q=W0(X._zod.def,{get shape(){let z=X._zod.def.shape,U={...z};if(H)for(let w in H){if(!(w in z))throw Error(`Unrecognized key: "${w}"`);if(!H[w])continue;U[w]=J?new J({type:"optional",innerType:z[w]}):z[w]}else for(let w in z)U[w]=J?new J({type:"optional",innerType:z[w]}):z[w];return z0(this,"shape",U),U},checks:[]});return i(X,Q)}function GX(J,X,H){let W=W0(X._zod.def,{get shape(){let q=X._zod.def.shape,Y={...q};if(H)for(let Q in H){if(!(Q in Y))throw Error(`Unrecognized key: "${Q}"`);if(!H[Q])continue;Y[Q]=new J({type:"nonoptional",innerType:q[Q]})}else for(let Q in q)Y[Q]=new J({type:"nonoptional",innerType:q[Q]});return z0(this,"shape",Y),Y}});return i(X,W)}function G0(J,X=0){if(J.aborted===!0)return!0;for(let H=X;H<J.issues.length;H++)if(J.issues[H]?.continue!==!0)return!0;return!1}function q0(J,X){return X.map((H)=>{var W;return(W=H).path??(W.path=[]),H.path.unshift(J),H})}function S0(J){return typeof J==="string"?J:J?.message}function t(J,X,H){let W={...J,path:J.path??[]};if(!J.message){let q=S0(J.inst?._zod.def?.error?.(J))??S0(X?.error?.(J))??S0(H.customError?.(J))??S0(H.localeError?.(J))??"Invalid input";W.message=q}if(delete W.inst,delete W.continue,!X?.reportInput)delete W.input;return W}function y8(J){if(J instanceof Set)return"set";if(J instanceof Map)return"map";if(J instanceof File)return"file";return"unknown"}function _0(J){if(Array.isArray(J))return"array";if(typeof J==="string")return"string";return"unknown"}function k1(J){let X=typeof J;switch(X){case"number":return Number.isNaN(J)?"nan":"number";case"object":{if(J===null)return"null";if(Array.isArray(J))return"array";let H=J;if(H&&Object.getPrototypeOf(H)!==Object.prototype&&"constructor"in H&&H.constructor)return H.constructor.name}}return X}function I0(...J){let[X,H,W]=J;if(typeof X==="string")return{message:X,code:"custom",input:H,inst:W};return{...X}}function UX(J){return Object.entries(J).filter(([X,H])=>{return Number.isNaN(Number.parseInt(X,10))}).map((X)=>X[1])}function m8(J){let X=atob(J),H=new Uint8Array(X.length);for(let W=0;W<X.length;W++)H[W]=X.charCodeAt(W);return H}function c8(J){let X="";for(let H=0;H<J.length;H++)X+=String.fromCharCode(J[H]);return btoa(X)}function PX(J){let X=J.replace(/-/g,"+").replace(/_/g,"/"),H="=".repeat((4-X.length%4)%4);return m8(X+H)}function MX(J){return c8(J).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function FX(J){let X=J.replace(/^0x/,"");if(X.length%2!==0)throw Error("Invalid hex string length");let H=new Uint8Array(X.length/2);for(let W=0;W<X.length;W+=2)H[W/2]=Number.parseInt(X.slice(W,W+2),16);return H}function AX(J){return Array.from(J).map((X)=>X.toString(16).padStart(2,"0")).join("")}class f8{constructor(...J){}}var o8=(J,X)=>{J.name="$ZodError",Object.defineProperty(J,"_zod",{value:J._zod,enumerable:!1}),Object.defineProperty(J,"issues",{value:X,enumerable:!1}),J.message=JSON.stringify(X,K0,2),Object.defineProperty(J,"toString",{value:()=>J.message,enumerable:!1})},i0=P("$ZodError",o8),T1=P("$ZodError",o8,{Parent:Error});function l8(J,X=(H)=>H.message){let H={},W=[];for(let q of J.issues)if(q.path.length>0)H[q.path[0]]=H[q.path[0]]||[],H[q.path[0]].push(X(q));else W.push(X(q));return{formErrors:W,fieldErrors:H}}function p8(J,X=(H)=>H.message){let H={_errors:[]},W=(q)=>{for(let Y of q.issues)if(Y.code==="invalid_union"&&Y.errors.length)Y.errors.map((Q)=>W({issues:Q}));else if(Y.code==="invalid_key")W({issues:Y.issues});else if(Y.code==="invalid_element")W({issues:Y.issues});else if(Y.path.length===0)H._errors.push(X(Y));else{let Q=H,z=0;while(z<Y.path.length){let U=Y.path[z];if(z!==Y.path.length-1)Q[U]=Q[U]||{_errors:[]};else Q[U]=Q[U]||{_errors:[]},Q[U]._errors.push(X(Y));Q=Q[U],z++}}};return W(J),H}var t0=(J)=>(X,H,W,q)=>{let Y=W?Object.assign(W,{async:!1}):{async:!1},Q=X._zod.run({value:H,issues:[]},Y);if(Q instanceof Promise)throw new H0;if(Q.issues.length){let z=new(q?.Err??J)(Q.issues.map((U)=>t(U,Y,d())));throw d0(z,q?.callee),z}return Q.value};var a0=(J)=>async(X,H,W,q)=>{let Y=W?Object.assign(W,{async:!0}):{async:!0},Q=X._zod.run({value:H,issues:[]},Y);if(Q instanceof Promise)Q=await Q;if(Q.issues.length){let z=new(q?.Err??J)(Q.issues.map((U)=>t(U,Y,d())));throw d0(z,q?.callee),z}return Q.value};var h0=(J)=>(X,H,W)=>{let q=W?{...W,async:!1}:{async:!1},Y=X._zod.run({value:H,issues:[]},q);if(Y instanceof Promise)throw new H0;return Y.issues.length?{success:!1,error:new(J??i0)(Y.issues.map((Q)=>t(Q,q,d())))}:{success:!0,data:Y.value}},r8=h0(T1),x0=(J)=>async(X,H,W)=>{let q=W?Object.assign(W,{async:!0}):{async:!0},Y=X._zod.run({value:H,issues:[]},q);if(Y instanceof Promise)Y=await Y;return Y.issues.length?{success:!1,error:new J(Y.issues.map((Q)=>t(Q,q,d())))}:{success:!0,data:Y.value}},d8=x0(T1),n8=(J)=>(X,H,W)=>{let q=W?Object.assign(W,{direction:"backward"}):{direction:"backward"};return t0(J)(X,H,q)};var i8=(J)=>(X,H,W)=>{return t0(J)(X,H,W)};var t8=(J)=>async(X,H,W)=>{let q=W?Object.assign(W,{direction:"backward"}):{direction:"backward"};return a0(J)(X,H,q)};var a8=(J)=>async(X,H,W)=>{return a0(J)(X,H,W)};var s8=(J)=>(X,H,W)=>{let q=W?Object.assign(W,{direction:"backward"}):{direction:"backward"};return h0(J)(X,H,q)};var e8=(J)=>(X,H,W)=>{return h0(J)(X,H,W)};var J2=(J)=>async(X,H,W)=>{let q=W?Object.assign(W,{direction:"backward"}):{direction:"backward"};return x0(J)(X,H,q)};var X2=(J)=>async(X,H,W)=>{return x0(J)(X,H,W)};var H2=/^[cC][^\s-]{8,}$/,W2=/^[0-9a-z]+$/,q2=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Y2=/^[0-9a-vA-V]{20}$/,Q2=/^[A-Za-z0-9]{27}$/,z2=/^[a-zA-Z0-9_-]{21}$/,w2=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var G2=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,j1=(J)=>{if(!J)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${J}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var U2=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var VX="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function P2(){return new RegExp(VX,"u")}var M2=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,F2=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var A2=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,$2=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,V2=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,_1=/^[A-Za-z0-9_-]*$/;var B2=/^\+[1-9]\d{6,14}$/,D2="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",K2=new RegExp(`^${D2}$`);function I2(J){return typeof J.precision==="number"?J.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":J.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${J.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function O2(J){return new RegExp(`^${I2(J)}$`)}function R2(J){let X=I2({precision:J.precision}),H=["Z"];if(J.local)H.push("");if(J.offset)H.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let W=`${X}(?:${H.join("|")})`;return new RegExp(`^${D2}T(?:${W})$`)}var L2=(J)=>{let X=J?`[\\s\\S]{${J?.minimum??0},${J?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${X}$`)},Z2=/^-?\d+n?$/,N2=/^-?\d+$/,s0=/^-?\d+(?:\.\d+)?$/,b2=/^(?:true|false)$/i;var E2=/^[^A-Z]*$/,C2=/^[^a-z]*$/;var y=P("$ZodCheck",(J,X)=>{var H;J._zod??(J._zod={}),J._zod.def=X,(H=J._zod).onattach??(H.onattach=[])}),S2={number:"number",bigint:"bigint",object:"date"},h1=P("$ZodCheckLessThan",(J,X)=>{y.init(J,X);let H=S2[typeof X.value];J._zod.onattach.push((W)=>{let q=W._zod.bag,Y=(X.inclusive?q.maximum:q.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(X.value<Y)if(X.inclusive)q.maximum=X.value;else q.exclusiveMaximum=X.value}),J._zod.check=(W)=>{if(X.inclusive?W.value<=X.value:W.value<X.value)return;W.issues.push({origin:H,code:"too_big",maximum:typeof X.value==="object"?X.value.getTime():X.value,input:W.value,inclusive:X.inclusive,inst:J,continue:!X.abort})}}),x1=P("$ZodCheckGreaterThan",(J,X)=>{y.init(J,X);let H=S2[typeof X.value];J._zod.onattach.push((W)=>{let q=W._zod.bag,Y=(X.inclusive?q.minimum:q.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(X.value>Y)if(X.inclusive)q.minimum=X.value;else q.exclusiveMinimum=X.value}),J._zod.check=(W)=>{if(X.inclusive?W.value>=X.value:W.value>X.value)return;W.issues.push({origin:H,code:"too_small",minimum:typeof X.value==="object"?X.value.getTime():X.value,input:W.value,inclusive:X.inclusive,inst:J,continue:!X.abort})}}),k2=P("$ZodCheckMultipleOf",(J,X)=>{y.init(J,X),J._zod.onattach.push((H)=>{var W;(W=H._zod.bag).multipleOf??(W.multipleOf=X.value)}),J._zod.check=(H)=>{if(typeof H.value!==typeof X.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof H.value==="bigint"?H.value%X.value===BigInt(0):Z1(H.value,X.value)===0)return;H.issues.push({origin:typeof H.value,code:"not_multiple_of",divisor:X.value,input:H.value,inst:J,continue:!X.abort})}}),T2=P("$ZodCheckNumberFormat",(J,X)=>{y.init(J,X),X.format=X.format||"float64";let H=X.format?.includes("int"),W=H?"int":"number",[q,Y]=S1[X.format];J._zod.onattach.push((Q)=>{let z=Q._zod.bag;if(z.format=X.format,z.minimum=q,z.maximum=Y,H)z.pattern=N2}),J._zod.check=(Q)=>{let z=Q.value;if(H){if(!Number.isInteger(z)){Q.issues.push({expected:W,format:X.format,code:"invalid_type",continue:!1,input:z,inst:J});return}if(!Number.isSafeInteger(z)){if(z>0)Q.issues.push({input:z,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:J,origin:W,inclusive:!0,continue:!X.abort});else Q.issues.push({input:z,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:J,origin:W,inclusive:!0,continue:!X.abort});return}}if(z<q)Q.issues.push({origin:"number",input:z,code:"too_small",minimum:q,inclusive:!0,inst:J,continue:!X.abort});if(z>Y)Q.issues.push({origin:"number",input:z,code:"too_big",maximum:Y,inclusive:!0,inst:J,continue:!X.abort})}});var j2=P("$ZodCheckMaxLength",(J,X)=>{var H;y.init(J,X),(H=J._zod.def).when??(H.when=(W)=>{let q=W.value;return!T0(q)&&q.length!==void 0}),J._zod.onattach.push((W)=>{let q=W._zod.bag.maximum??Number.POSITIVE_INFINITY;if(X.maximum<q)W._zod.bag.maximum=X.maximum}),J._zod.check=(W)=>{let q=W.value;if(q.length<=X.maximum)return;let Q=_0(q);W.issues.push({origin:Q,code:"too_big",maximum:X.maximum,inclusive:!0,input:q,inst:J,continue:!X.abort})}}),_2=P("$ZodCheckMinLength",(J,X)=>{var H;y.init(J,X),(H=J._zod.def).when??(H.when=(W)=>{let q=W.value;return!T0(q)&&q.length!==void 0}),J._zod.onattach.push((W)=>{let q=W._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(X.minimum>q)W._zod.bag.minimum=X.minimum}),J._zod.check=(W)=>{let q=W.value;if(q.length>=X.minimum)return;let Q=_0(q);W.issues.push({origin:Q,code:"too_small",minimum:X.minimum,inclusive:!0,input:q,inst:J,continue:!X.abort})}}),h2=P("$ZodCheckLengthEquals",(J,X)=>{var H;y.init(J,X),(H=J._zod.def).when??(H.when=(W)=>{let q=W.value;return!T0(q)&&q.length!==void 0}),J._zod.onattach.push((W)=>{let q=W._zod.bag;q.minimum=X.length,q.maximum=X.length,q.length=X.length}),J._zod.check=(W)=>{let q=W.value,Y=q.length;if(Y===X.length)return;let Q=_0(q),z=Y>X.length;W.issues.push({origin:Q,...z?{code:"too_big",maximum:X.length}:{code:"too_small",minimum:X.length},inclusive:!0,exact:!0,input:W.value,inst:J,continue:!X.abort})}}),v0=P("$ZodCheckStringFormat",(J,X)=>{var H,W;if(y.init(J,X),J._zod.onattach.push((q)=>{let Y=q._zod.bag;if(Y.format=X.format,X.pattern)Y.patterns??(Y.patterns=new Set),Y.patterns.add(X.pattern)}),X.pattern)(H=J._zod).check??(H.check=(q)=>{if(X.pattern.lastIndex=0,X.pattern.test(q.value))return;q.issues.push({origin:"string",code:"invalid_format",format:X.format,input:q.value,...X.pattern?{pattern:X.pattern.toString()}:{},inst:J,continue:!X.abort})});else(W=J._zod).check??(W.check=()=>{})}),x2=P("$ZodCheckRegex",(J,X)=>{v0.init(J,X),J._zod.check=(H)=>{if(X.pattern.lastIndex=0,X.pattern.test(H.value))return;H.issues.push({origin:"string",code:"invalid_format",format:"regex",input:H.value,pattern:X.pattern.toString(),inst:J,continue:!X.abort})}}),v2=P("$ZodCheckLowerCase",(J,X)=>{X.pattern??(X.pattern=E2),v0.init(J,X)}),g2=P("$ZodCheckUpperCase",(J,X)=>{X.pattern??(X.pattern=C2),v0.init(J,X)}),u2=P("$ZodCheckIncludes",(J,X)=>{y.init(J,X);let H=M0(X.includes),W=new RegExp(typeof X.position==="number"?`^.{${X.position}}${H}`:H);X.pattern=W,J._zod.onattach.push((q)=>{let Y=q._zod.bag;Y.patterns??(Y.patterns=new Set),Y.patterns.add(W)}),J._zod.check=(q)=>{if(q.value.includes(X.includes,X.position))return;q.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:X.includes,input:q.value,inst:J,continue:!X.abort})}}),y2=P("$ZodCheckStartsWith",(J,X)=>{y.init(J,X);let H=new RegExp(`^${M0(X.prefix)}.*`);X.pattern??(X.pattern=H),J._zod.onattach.push((W)=>{let q=W._zod.bag;q.patterns??(q.patterns=new Set),q.patterns.add(H)}),J._zod.check=(W)=>{if(W.value.startsWith(X.prefix))return;W.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:X.prefix,input:W.value,inst:J,continue:!X.abort})}}),m2=P("$ZodCheckEndsWith",(J,X)=>{y.init(J,X);let H=new RegExp(`.*${M0(X.suffix)}$`);X.pattern??(X.pattern=H),J._zod.onattach.push((W)=>{let q=W._zod.bag;q.patterns??(q.patterns=new Set),q.patterns.add(H)}),J._zod.check=(W)=>{if(W.value.endsWith(X.suffix))return;W.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:X.suffix,input:W.value,inst:J,continue:!X.abort})}});var c2=P("$ZodCheckOverwrite",(J,X)=>{y.init(J,X),J._zod.check=(H)=>{H.value=X.tx(H.value)}});class v1{constructor(J=[]){if(this.content=[],this.indent=0,this)this.args=J}indented(J){this.indent+=1,J(this),this.indent-=1}write(J){if(typeof J==="function"){J(this,{execution:"sync"}),J(this,{execution:"async"});return}let H=J.split(`
|
|
2
2
|
`).filter((Y)=>Y),W=Math.min(...H.map((Y)=>Y.length-Y.trimStart().length)),q=H.map((Y)=>Y.slice(W)).map((Y)=>" ".repeat(this.indent*2)+Y);for(let Y of q)this.content.push(Y)}compile(){let J=Function,X=this?.args,W=[...(this?.content??[""]).map((q)=>` ${q}`)];return new J(...X,W.join(`
|
|
3
|
-
`))}}var g6={major:4,minor:2,patch:1};var L=D("$ZodType",(J,X)=>{var H;J??(J={}),J._zod.def=X,J._zod.bag=J._zod.bag||{},J._zod.version=g6;let W=[...J._zod.def.checks??[]];if(J._zod.traits.has("$ZodCheck"))W.unshift(J);for(let q of W)for(let Y of q._zod.onattach)Y(J);if(W.length===0)(H=J._zod).deferred??(H.deferred=[]),J._zod.deferred?.push(()=>{J._zod.run=J._zod.parse});else{let q=(z,Q,U)=>{let G=w0(z),P;for(let B of Q){if(B._zod.def.when){if(!B._zod.def.when(z))continue}else if(G)continue;let $=z.issues.length,F=B._zod.check(z);if(F instanceof Promise&&U?.async===!1)throw new J0;if(P||F instanceof Promise)P=(P??Promise.resolve()).then(async()=>{if(await F,z.issues.length===$)return;if(!G)G=w0(z,$)});else{if(z.issues.length===$)continue;if(!G)G=w0(z,$)}}if(P)return P.then(()=>{return z});return z},Y=(z,Q,U)=>{if(w0(z))return z.aborted=!0,z;let G=q(Q,W,U);if(G instanceof Promise){if(U.async===!1)throw new J0;return G.then((P)=>J._zod.parse(P,U))}return J._zod.parse(G,U)};J._zod.run=(z,Q)=>{if(Q.skipChecks)return J._zod.parse(z,Q);if(Q.direction==="backward"){let G=J._zod.parse({value:z.value,issues:[]},{...Q,skipChecks:!0});if(G instanceof Promise)return G.then((P)=>{return Y(P,z,Q)});return Y(G,z,Q)}let U=J._zod.parse(z,Q);if(U instanceof Promise){if(Q.async===!1)throw new J0;return U.then((G)=>q(G,W,Q))}return q(U,W,Q)}}J["~standard"]={validate:(q)=>{try{let Y=u4(J,q);return Y.success?{value:Y.data}:{issues:Y.error?.issues}}catch(Y){return y4(J,q).then((z)=>z.success?{value:z.data}:{issues:z.error?.issues})}},vendor:"zod",version:1}}),e0=D("$ZodString",(J,X)=>{L.init(J,X),J._zod.pattern=[...J?._zod.bag?.patterns??[]].pop()??I6(J._zod.bag),J._zod.parse=(H,W)=>{if(X.coerce)try{H.value=String(H.value)}catch(q){}if(typeof H.value==="string")return H;return H.issues.push({expected:"string",code:"invalid_type",input:H.value,inst:J}),H}}),b=D("$ZodStringFormat",(J,X)=>{v0.init(J,X),e0.init(J,X)}),p6=D("$ZodGUID",(J,X)=>{X.pattern??(X.pattern=H6),b.init(J,X)}),d6=D("$ZodUUID",(J,X)=>{if(X.version){let W={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[X.version];if(W===void 0)throw Error(`Invalid UUID version: "${X.version}"`);X.pattern??(X.pattern=b1(W))}else X.pattern??(X.pattern=b1());b.init(J,X)}),n6=D("$ZodEmail",(J,X)=>{X.pattern??(X.pattern=W6),b.init(J,X)}),i6=D("$ZodURL",(J,X)=>{b.init(J,X),J._zod.check=(H)=>{try{let W=H.value.trim(),q=new URL(W);if(X.hostname){if(X.hostname.lastIndex=0,!X.hostname.test(q.hostname))H.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:X.hostname.source,input:H.value,inst:J,continue:!X.abort})}if(X.protocol){if(X.protocol.lastIndex=0,!X.protocol.test(q.protocol.endsWith(":")?q.protocol.slice(0,-1):q.protocol))H.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:X.protocol.source,input:H.value,inst:J,continue:!X.abort})}if(X.normalize)H.value=q.href;else H.value=W;return}catch(W){H.issues.push({code:"invalid_format",format:"url",input:H.value,inst:J,continue:!X.abort})}}}),t6=D("$ZodEmoji",(J,X)=>{X.pattern??(X.pattern=q6()),b.init(J,X)}),a6=D("$ZodNanoID",(J,X)=>{X.pattern??(X.pattern=J6),b.init(J,X)}),s6=D("$ZodCUID",(J,X)=>{X.pattern??(X.pattern=i4),b.init(J,X)}),e6=D("$ZodCUID2",(J,X)=>{X.pattern??(X.pattern=t4),b.init(J,X)}),J8=D("$ZodULID",(J,X)=>{X.pattern??(X.pattern=a4),b.init(J,X)}),X8=D("$ZodXID",(J,X)=>{X.pattern??(X.pattern=s4),b.init(J,X)}),H8=D("$ZodKSUID",(J,X)=>{X.pattern??(X.pattern=e4),b.init(J,X)}),W8=D("$ZodISODateTime",(J,X)=>{X.pattern??(X.pattern=F6(X)),b.init(J,X)}),q8=D("$ZodISODate",(J,X)=>{X.pattern??(X.pattern=P6),b.init(J,X)}),Y8=D("$ZodISOTime",(J,X)=>{X.pattern??(X.pattern=M6(X)),b.init(J,X)}),z8=D("$ZodISODuration",(J,X)=>{X.pattern??(X.pattern=X6),b.init(J,X)}),Q8=D("$ZodIPv4",(J,X)=>{X.pattern??(X.pattern=Y6),b.init(J,X),J._zod.bag.format="ipv4"}),w8=D("$ZodIPv6",(J,X)=>{X.pattern??(X.pattern=z6),b.init(J,X),J._zod.bag.format="ipv6",J._zod.check=(H)=>{try{new URL(`http://[${H.value}]`)}catch{H.issues.push({code:"invalid_format",format:"ipv6",input:H.value,inst:J,continue:!X.abort})}}});var G8=D("$ZodCIDRv4",(J,X)=>{X.pattern??(X.pattern=Q6),b.init(J,X)}),U8=D("$ZodCIDRv6",(J,X)=>{X.pattern??(X.pattern=w6),b.init(J,X),J._zod.check=(H)=>{let W=H.value.split("/");try{if(W.length!==2)throw Error();let[q,Y]=W;if(!Y)throw Error();let z=Number(Y);if(`${z}`!==Y)throw Error();if(z<0||z>128)throw Error();new URL(`http://[${q}]`)}catch{H.issues.push({code:"invalid_format",format:"cidrv6",input:H.value,inst:J,continue:!X.abort})}}});function D8(J){if(J==="")return!0;if(J.length%4!==0)return!1;try{return atob(J),!0}catch{return!1}}var P8=D("$ZodBase64",(J,X)=>{X.pattern??(X.pattern=G6),b.init(J,X),J._zod.bag.contentEncoding="base64",J._zod.check=(H)=>{if(D8(H.value))return;H.issues.push({code:"invalid_format",format:"base64",input:H.value,inst:J,continue:!X.abort})}});function QX(J){if(!_1.test(J))return!1;let X=J.replace(/[-_]/g,(W)=>W==="-"?"+":"/"),H=X.padEnd(Math.ceil(X.length/4)*4,"=");return D8(H)}var B8=D("$ZodBase64URL",(J,X)=>{X.pattern??(X.pattern=_1),b.init(J,X),J._zod.bag.contentEncoding="base64url",J._zod.check=(H)=>{if(QX(H.value))return;H.issues.push({code:"invalid_format",format:"base64url",input:H.value,inst:J,continue:!X.abort})}}),M8=D("$ZodE164",(J,X)=>{X.pattern??(X.pattern=U6),b.init(J,X)});function wX(J,X=null){try{let H=J.split(".");if(H.length!==3)return!1;let[W]=H;if(!W)return!1;let q=JSON.parse(atob(W));if("typ"in q&&q?.typ!=="JWT")return!1;if(!q.alg)return!1;if(X&&(!("alg"in q)||q.alg!==X))return!1;return!0}catch{return!1}}var F8=D("$ZodJWT",(J,X)=>{b.init(J,X),J._zod.check=(H)=>{if(wX(H.value,X.alg))return;H.issues.push({code:"invalid_format",format:"jwt",input:H.value,inst:J,continue:!X.abort})}});var j1=D("$ZodNumber",(J,X)=>{L.init(J,X),J._zod.pattern=J._zod.bag.pattern??O6,J._zod.parse=(H,W)=>{if(X.coerce)try{H.value=Number(H.value)}catch(z){}let q=H.value;if(typeof q==="number"&&!Number.isNaN(q)&&Number.isFinite(q))return H;let Y=typeof q==="number"?Number.isNaN(q)?"NaN":!Number.isFinite(q)?"Infinity":void 0:void 0;return H.issues.push({expected:"number",code:"invalid_type",input:q,inst:J,...Y?{received:Y}:{}}),H}}),I8=D("$ZodNumberFormat",(J,X)=>{L6.init(J,X),j1.init(J,X)}),$8=D("$ZodBoolean",(J,X)=>{L.init(J,X),J._zod.pattern=V6,J._zod.parse=(H,W)=>{if(X.coerce)try{H.value=Boolean(H.value)}catch(Y){}let q=H.value;if(typeof q==="boolean")return H;return H.issues.push({expected:"boolean",code:"invalid_type",input:q,inst:J}),H}}),A8=D("$ZodBigInt",(J,X)=>{L.init(J,X),J._zod.pattern=$6,J._zod.parse=(H,W)=>{if(X.coerce)try{H.value=BigInt(H.value)}catch(q){}if(typeof H.value==="bigint")return H;return H.issues.push({expected:"bigint",code:"invalid_type",input:H.value,inst:J}),H}});var O8=D("$ZodAny",(J,X)=>{L.init(J,X),J._zod.parse=(H)=>H}),V8=D("$ZodUnknown",(J,X)=>{L.init(J,X),J._zod.parse=(H)=>H}),K8=D("$ZodNever",(J,X)=>{L.init(J,X),J._zod.parse=(H,W)=>{return H.issues.push({expected:"never",code:"invalid_type",input:H.value,inst:J}),H}});var R8=D("$ZodDate",(J,X)=>{L.init(J,X),J._zod.parse=(H,W)=>{if(X.coerce)try{H.value=new Date(H.value)}catch(Q){}let q=H.value,Y=q instanceof Date;if(Y&&!Number.isNaN(q.getTime()))return H;return H.issues.push({expected:"date",code:"invalid_type",input:q,...Y?{received:"Invalid Date"}:{},inst:J}),H}});function c6(J,X,H){if(J.issues.length)X.issues.push(...X0(H,J.issues));X.value[H]=J.value}var N8=D("$ZodArray",(J,X)=>{L.init(J,X),J._zod.parse=(H,W)=>{let q=H.value;if(!Array.isArray(q))return H.issues.push({expected:"array",code:"invalid_type",input:q,inst:J}),H;H.value=Array(q.length);let Y=[];for(let z=0;z<q.length;z++){let Q=q[z],U=X.element._zod.run({value:Q,issues:[]},W);if(U instanceof Promise)Y.push(U.then((G)=>c6(G,H,z)));else c6(U,H,z)}if(Y.length)return Promise.all(Y).then(()=>H);return H}});function s0(J,X,H,W){if(J.issues.length)X.issues.push(...X0(H,J.issues));if(J.value===void 0){if(H in W)X.value[H]=void 0}else X.value[H]=J.value}function Z8(J){let X=Object.keys(J.shape);for(let W of X)if(!J.shape?.[W]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${W}": expected a Zod schema`);let H=N1(J.shape);return{...J,keys:X,keySet:new Set(X),numKeys:X.length,optionalKeys:new Set(H)}}function L8(J,X,H,W,q,Y){let z=[],Q=q.keySet,U=q.catchall._zod,G=U.def.type;for(let P in X){if(Q.has(P))continue;if(G==="never"){z.push(P);continue}let B=U.run({value:X[P],issues:[]},W);if(B instanceof Promise)J.push(B.then(($)=>s0($,H,P,X)));else s0(B,H,P,X)}if(z.length)H.issues.push({code:"unrecognized_keys",keys:z,input:X,inst:Y});if(!J.length)return H;return Promise.all(J).then(()=>{return H})}var GX=D("$ZodObject",(J,X)=>{if(L.init(J,X),!Object.getOwnPropertyDescriptor(X,"shape")?.get){let Q=X.shape;Object.defineProperty(X,"shape",{get:()=>{let U={...Q};return Object.defineProperty(X,"shape",{value:U}),U}})}let W=k0(()=>Z8(X));N(J._zod,"propValues",()=>{let Q=X.shape,U={};for(let G in Q){let P=Q[G]._zod;if(P.values){U[G]??(U[G]=new Set);for(let B of P.values)U[G].add(B)}}return U});let q=I0,Y=X.catchall,z;J._zod.parse=(Q,U)=>{z??(z=W.value);let G=Q.value;if(!q(G))return Q.issues.push({expected:"object",code:"invalid_type",input:G,inst:J}),Q;Q.value={};let P=[],B=z.shape;for(let $ of z.keys){let k=B[$]._zod.run({value:G[$],issues:[]},U);if(k instanceof Promise)P.push(k.then((h)=>s0(h,Q,$,G)));else s0(k,Q,$,G)}if(!Y)return P.length?Promise.all(P).then(()=>Q):Q;return L8(P,G,Q,U,W.value,J)}}),b8=D("$ZodObjectJIT",(J,X)=>{GX.init(J,X);let H=J._zod.parse,W=k0(()=>Z8(X)),q=($)=>{let F=new C1(["shape","payload","ctx"]),k=W.value,h=(g)=>{let x=l0(g);return`shape[${x}]._zod.run({ value: input[${x}], issues: [] }, ctx)`};F.write("const input = payload.value;");let W0=Object.create(null),p=0;for(let g of k.keys)W0[g]=`key_${p++}`;F.write("const newResult = {};");for(let g of k.keys){let x=W0[g],e=l0(g);F.write(`const ${x} = ${h(g)};`),F.write(`
|
|
4
|
-
if (${
|
|
5
|
-
|
|
3
|
+
`))}}var o2={major:4,minor:3,patch:2};var C=P("$ZodType",(J,X)=>{var H;J??(J={}),J._zod.def=X,J._zod.bag=J._zod.bag||{},J._zod.version=o2;let W=[...J._zod.def.checks??[]];if(J._zod.traits.has("$ZodCheck"))W.unshift(J);for(let q of W)for(let Y of q._zod.onattach)Y(J);if(W.length===0)(H=J._zod).deferred??(H.deferred=[]),J._zod.deferred?.push(()=>{J._zod.run=J._zod.parse});else{let q=(Q,z,U)=>{let w=G0(Q),M;for(let F of z){if(F._zod.def.when){if(!F._zod.def.when(Q))continue}else if(w)continue;let V=Q.issues.length,A=F._zod.check(Q);if(A instanceof Promise&&U?.async===!1)throw new H0;if(M||A instanceof Promise)M=(M??Promise.resolve()).then(async()=>{if(await A,Q.issues.length===V)return;if(!w)w=G0(Q,V)});else{if(Q.issues.length===V)continue;if(!w)w=G0(Q,V)}}if(M)return M.then(()=>{return Q});return Q},Y=(Q,z,U)=>{if(G0(Q))return Q.aborted=!0,Q;let w=q(z,W,U);if(w instanceof Promise){if(U.async===!1)throw new H0;return w.then((M)=>J._zod.parse(M,U))}return J._zod.parse(w,U)};J._zod.run=(Q,z)=>{if(z.skipChecks)return J._zod.parse(Q,z);if(z.direction==="backward"){let w=J._zod.parse({value:Q.value,issues:[]},{...z,skipChecks:!0});if(w instanceof Promise)return w.then((M)=>{return Y(M,Q,z)});return Y(w,Q,z)}let U=J._zod.parse(Q,z);if(U instanceof Promise){if(z.async===!1)throw new H0;return U.then((w)=>q(w,W,z))}return q(U,W,z)}}R(J,"~standard",()=>({validate:(q)=>{try{let Y=r8(J,q);return Y.success?{value:Y.data}:{issues:Y.error?.issues}}catch(Y){return d8(J,q).then((Q)=>Q.success?{value:Q.data}:{issues:Q.error?.issues})}},vendor:"zod",version:1}))}),H1=P("$ZodString",(J,X)=>{C.init(J,X),J._zod.pattern=[...J?._zod.bag?.patterns??[]].pop()??L2(J._zod.bag),J._zod.parse=(H,W)=>{if(X.coerce)try{H.value=String(H.value)}catch(q){}if(typeof H.value==="string")return H;return H.issues.push({expected:"string",code:"invalid_type",input:H.value,inst:J}),H}}),S=P("$ZodStringFormat",(J,X)=>{v0.init(J,X),H1.init(J,X)}),s2=P("$ZodGUID",(J,X)=>{X.pattern??(X.pattern=G2),S.init(J,X)}),e2=P("$ZodUUID",(J,X)=>{if(X.version){let W={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[X.version];if(W===void 0)throw Error(`Invalid UUID version: "${X.version}"`);X.pattern??(X.pattern=j1(W))}else X.pattern??(X.pattern=j1());S.init(J,X)}),J9=P("$ZodEmail",(J,X)=>{X.pattern??(X.pattern=U2),S.init(J,X)}),X9=P("$ZodURL",(J,X)=>{S.init(J,X),J._zod.check=(H)=>{try{let W=H.value.trim(),q=new URL(W);if(X.hostname){if(X.hostname.lastIndex=0,!X.hostname.test(q.hostname))H.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:X.hostname.source,input:H.value,inst:J,continue:!X.abort})}if(X.protocol){if(X.protocol.lastIndex=0,!X.protocol.test(q.protocol.endsWith(":")?q.protocol.slice(0,-1):q.protocol))H.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:X.protocol.source,input:H.value,inst:J,continue:!X.abort})}if(X.normalize)H.value=q.href;else H.value=W;return}catch(W){H.issues.push({code:"invalid_format",format:"url",input:H.value,inst:J,continue:!X.abort})}}}),H9=P("$ZodEmoji",(J,X)=>{X.pattern??(X.pattern=P2()),S.init(J,X)}),W9=P("$ZodNanoID",(J,X)=>{X.pattern??(X.pattern=z2),S.init(J,X)}),q9=P("$ZodCUID",(J,X)=>{X.pattern??(X.pattern=H2),S.init(J,X)}),Y9=P("$ZodCUID2",(J,X)=>{X.pattern??(X.pattern=W2),S.init(J,X)}),Q9=P("$ZodULID",(J,X)=>{X.pattern??(X.pattern=q2),S.init(J,X)}),z9=P("$ZodXID",(J,X)=>{X.pattern??(X.pattern=Y2),S.init(J,X)}),w9=P("$ZodKSUID",(J,X)=>{X.pattern??(X.pattern=Q2),S.init(J,X)}),G9=P("$ZodISODateTime",(J,X)=>{X.pattern??(X.pattern=R2(X)),S.init(J,X)}),U9=P("$ZodISODate",(J,X)=>{X.pattern??(X.pattern=K2),S.init(J,X)}),P9=P("$ZodISOTime",(J,X)=>{X.pattern??(X.pattern=O2(X)),S.init(J,X)}),M9=P("$ZodISODuration",(J,X)=>{X.pattern??(X.pattern=w2),S.init(J,X)}),F9=P("$ZodIPv4",(J,X)=>{X.pattern??(X.pattern=M2),S.init(J,X),J._zod.bag.format="ipv4"}),A9=P("$ZodIPv6",(J,X)=>{X.pattern??(X.pattern=F2),S.init(J,X),J._zod.bag.format="ipv6",J._zod.check=(H)=>{try{new URL(`http://[${H.value}]`)}catch{H.issues.push({code:"invalid_format",format:"ipv6",input:H.value,inst:J,continue:!X.abort})}}});var $9=P("$ZodCIDRv4",(J,X)=>{X.pattern??(X.pattern=A2),S.init(J,X)}),V9=P("$ZodCIDRv6",(J,X)=>{X.pattern??(X.pattern=$2),S.init(J,X),J._zod.check=(H)=>{let W=H.value.split("/");try{if(W.length!==2)throw Error();let[q,Y]=W;if(!Y)throw Error();let Q=Number(Y);if(`${Q}`!==Y)throw Error();if(Q<0||Q>128)throw Error();new URL(`http://[${q}]`)}catch{H.issues.push({code:"invalid_format",format:"cidrv6",input:H.value,inst:J,continue:!X.abort})}}});function B9(J){if(J==="")return!0;if(J.length%4!==0)return!1;try{return atob(J),!0}catch{return!1}}var D9=P("$ZodBase64",(J,X)=>{X.pattern??(X.pattern=V2),S.init(J,X),J._zod.bag.contentEncoding="base64",J._zod.check=(H)=>{if(B9(H.value))return;H.issues.push({code:"invalid_format",format:"base64",input:H.value,inst:J,continue:!X.abort})}});function BX(J){if(!_1.test(J))return!1;let X=J.replace(/[-_]/g,(W)=>W==="-"?"+":"/"),H=X.padEnd(Math.ceil(X.length/4)*4,"=");return B9(H)}var K9=P("$ZodBase64URL",(J,X)=>{X.pattern??(X.pattern=_1),S.init(J,X),J._zod.bag.contentEncoding="base64url",J._zod.check=(H)=>{if(BX(H.value))return;H.issues.push({code:"invalid_format",format:"base64url",input:H.value,inst:J,continue:!X.abort})}}),I9=P("$ZodE164",(J,X)=>{X.pattern??(X.pattern=B2),S.init(J,X)});function DX(J,X=null){try{let H=J.split(".");if(H.length!==3)return!1;let[W]=H;if(!W)return!1;let q=JSON.parse(atob(W));if("typ"in q&&q?.typ!=="JWT")return!1;if(!q.alg)return!1;if(X&&(!("alg"in q)||q.alg!==X))return!1;return!0}catch{return!1}}var O9=P("$ZodJWT",(J,X)=>{S.init(J,X),J._zod.check=(H)=>{if(DX(H.value,X.alg))return;H.issues.push({code:"invalid_format",format:"jwt",input:H.value,inst:J,continue:!X.abort})}});var u1=P("$ZodNumber",(J,X)=>{C.init(J,X),J._zod.pattern=J._zod.bag.pattern??s0,J._zod.parse=(H,W)=>{if(X.coerce)try{H.value=Number(H.value)}catch(Q){}let q=H.value;if(typeof q==="number"&&!Number.isNaN(q)&&Number.isFinite(q))return H;let Y=typeof q==="number"?Number.isNaN(q)?"NaN":!Number.isFinite(q)?"Infinity":void 0:void 0;return H.issues.push({expected:"number",code:"invalid_type",input:q,inst:J,...Y?{received:Y}:{}}),H}}),R9=P("$ZodNumberFormat",(J,X)=>{T2.init(J,X),u1.init(J,X)}),L9=P("$ZodBoolean",(J,X)=>{C.init(J,X),J._zod.pattern=b2,J._zod.parse=(H,W)=>{if(X.coerce)try{H.value=Boolean(H.value)}catch(Y){}let q=H.value;if(typeof q==="boolean")return H;return H.issues.push({expected:"boolean",code:"invalid_type",input:q,inst:J}),H}}),Z9=P("$ZodBigInt",(J,X)=>{C.init(J,X),J._zod.pattern=Z2,J._zod.parse=(H,W)=>{if(X.coerce)try{H.value=BigInt(H.value)}catch(q){}if(typeof H.value==="bigint")return H;return H.issues.push({expected:"bigint",code:"invalid_type",input:H.value,inst:J}),H}});var N9=P("$ZodAny",(J,X)=>{C.init(J,X),J._zod.parse=(H)=>H}),b9=P("$ZodUnknown",(J,X)=>{C.init(J,X),J._zod.parse=(H)=>H}),E9=P("$ZodNever",(J,X)=>{C.init(J,X),J._zod.parse=(H,W)=>{return H.issues.push({expected:"never",code:"invalid_type",input:H.value,inst:J}),H}});var C9=P("$ZodDate",(J,X)=>{C.init(J,X),J._zod.parse=(H,W)=>{if(X.coerce)try{H.value=new Date(H.value)}catch(z){}let q=H.value,Y=q instanceof Date;if(Y&&!Number.isNaN(q.getTime()))return H;return H.issues.push({expected:"date",code:"invalid_type",input:q,...Y?{received:"Invalid Date"}:{},inst:J}),H}});function l2(J,X,H){if(J.issues.length)X.issues.push(...q0(H,J.issues));X.value[H]=J.value}var S9=P("$ZodArray",(J,X)=>{C.init(J,X),J._zod.parse=(H,W)=>{let q=H.value;if(!Array.isArray(q))return H.issues.push({expected:"array",code:"invalid_type",input:q,inst:J}),H;H.value=Array(q.length);let Y=[];for(let Q=0;Q<q.length;Q++){let z=q[Q],U=X.element._zod.run({value:z,issues:[]},W);if(U instanceof Promise)Y.push(U.then((w)=>l2(w,H,Q)));else l2(U,H,Q)}if(Y.length)return Promise.all(Y).then(()=>H);return H}});function X1(J,X,H,W,q){if(J.issues.length){if(q&&!(H in W))return;X.issues.push(...q0(H,J.issues))}if(J.value===void 0){if(H in W)X.value[H]=void 0}else X.value[H]=J.value}function k9(J){let X=Object.keys(J.shape);for(let W of X)if(!J.shape?.[W]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${W}": expected a Zod schema`);let H=C1(J.shape);return{...J,keys:X,keySet:new Set(X),numKeys:X.length,optionalKeys:new Set(H)}}function T9(J,X,H,W,q,Y){let Q=[],z=q.keySet,U=q.catchall._zod,w=U.def.type,M=U.optout==="optional";for(let F in X){if(z.has(F))continue;if(w==="never"){Q.push(F);continue}let V=U.run({value:X[F],issues:[]},W);if(V instanceof Promise)J.push(V.then((A)=>X1(A,H,F,X,M)));else X1(V,H,F,X,M)}if(Q.length)H.issues.push({code:"unrecognized_keys",keys:Q,input:X,inst:Y});if(!J.length)return H;return Promise.all(J).then(()=>{return H})}var KX=P("$ZodObject",(J,X)=>{if(C.init(J,X),!Object.getOwnPropertyDescriptor(X,"shape")?.get){let z=X.shape;Object.defineProperty(X,"shape",{get:()=>{let U={...z};return Object.defineProperty(X,"shape",{value:U}),U}})}let W=k0(()=>k9(X));R(J._zod,"propValues",()=>{let z=X.shape,U={};for(let w in z){let M=z[w]._zod;if(M.values){U[w]??(U[w]=new Set);for(let F of M.values)U[w].add(F)}}return U});let q=B0,Y=X.catchall,Q;J._zod.parse=(z,U)=>{Q??(Q=W.value);let w=z.value;if(!q(w))return z.issues.push({expected:"object",code:"invalid_type",input:w,inst:J}),z;z.value={};let M=[],F=Q.shape;for(let V of Q.keys){let A=F[V],b=A._zod.optout==="optional",O=A._zod.run({value:w[V],issues:[]},U);if(O instanceof Promise)M.push(O.then((J0)=>X1(J0,z,V,w,b)));else X1(O,z,V,w,b)}if(!Y)return M.length?Promise.all(M).then(()=>z):z;return T9(M,w,z,U,W.value,J)}}),j9=P("$ZodObjectJIT",(J,X)=>{KX.init(J,X);let H=J._zod.parse,W=k0(()=>k9(X)),q=(V)=>{let A=new v1(["shape","payload","ctx"]),b=W.value,O=(u)=>{let h=r0(u);return`shape[${h}]._zod.run({ value: input[${h}], issues: [] }, ctx)`};A.write("const input = payload.value;");let J0=Object.create(null),n=0;for(let u of b.keys)J0[u]=`key_${n++}`;A.write("const newResult = {};");for(let u of b.keys){let h=J0[u],c=r0(u),o0=V[u]?._zod?.optout==="optional";if(A.write(`const ${h} = ${O(u)};`),o0)A.write(`
|
|
4
|
+
if (${h}.issues.length) {
|
|
5
|
+
if (${c} in input) {
|
|
6
|
+
payload.issues = payload.issues.concat(${h}.issues.map(iss => ({
|
|
7
|
+
...iss,
|
|
8
|
+
path: iss.path ? [${c}, ...iss.path] : [${c}]
|
|
9
|
+
})));
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
if (${h}.value === undefined) {
|
|
14
|
+
if (${c} in input) {
|
|
15
|
+
newResult[${c}] = undefined;
|
|
16
|
+
}
|
|
17
|
+
} else {
|
|
18
|
+
newResult[${c}] = ${h}.value;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
`);else A.write(`
|
|
22
|
+
if (${h}.issues.length) {
|
|
23
|
+
payload.issues = payload.issues.concat(${h}.issues.map(iss => ({
|
|
6
24
|
...iss,
|
|
7
|
-
path: iss.path ? [${
|
|
25
|
+
path: iss.path ? [${c}, ...iss.path] : [${c}]
|
|
8
26
|
})));
|
|
9
27
|
}
|
|
10
28
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
newResult[${e}] = undefined;
|
|
29
|
+
if (${h}.value === undefined) {
|
|
30
|
+
if (${c} in input) {
|
|
31
|
+
newResult[${c}] = undefined;
|
|
15
32
|
}
|
|
16
33
|
} else {
|
|
17
|
-
newResult[${
|
|
34
|
+
newResult[${c}] = ${h}.value;
|
|
18
35
|
}
|
|
19
36
|
|
|
20
|
-
`)}F.write("payload.value = newResult;"),F.write("return payload;");let m0=F.compile();return(g,x)=>m0($,g,x)},Y,z=I0,Q=!f0.jitless,G=Q&&K1.value,P=X.catchall,B;J._zod.parse=($,F)=>{B??(B=W.value);let k=$.value;if(!z(k))return $.issues.push({expected:"object",code:"invalid_type",input:k,inst:J}),$;if(Q&&G&&F?.async===!1&&F.jitless!==!0){if(!Y)Y=q(X.shape);if($=Y($,F),!P)return $;return L8([],k,$,F,B,J)}return H($,F)}});function u6(J,X,H,W){for(let Y of J)if(Y.issues.length===0)return X.value=Y.value,X;let q=J.filter((Y)=>!w0(Y));if(q.length===1)return X.value=q[0].value,q[0];return X.issues.push({code:"invalid_union",input:X.value,inst:H,errors:J.map((Y)=>Y.issues.map((z)=>n(z,W,r())))}),X}var _8=D("$ZodUnion",(J,X)=>{L.init(J,X),N(J._zod,"optin",()=>X.options.some((q)=>q._zod.optin==="optional")?"optional":void 0),N(J._zod,"optout",()=>X.options.some((q)=>q._zod.optout==="optional")?"optional":void 0),N(J._zod,"values",()=>{if(X.options.every((q)=>q._zod.values))return new Set(X.options.flatMap((q)=>Array.from(q._zod.values)));return}),N(J._zod,"pattern",()=>{if(X.options.every((q)=>q._zod.pattern)){let q=X.options.map((Y)=>Y._zod.pattern);return new RegExp(`^(${q.map((Y)=>S0(Y.source)).join("|")})$`)}return});let H=X.options.length===1,W=X.options[0]._zod.run;J._zod.parse=(q,Y)=>{if(H)return W(q,Y);let z=!1,Q=[];for(let U of X.options){let G=U._zod.run({value:q.value,issues:[]},Y);if(G instanceof Promise)Q.push(G),z=!0;else{if(G.issues.length===0)return G;Q.push(G)}}if(!z)return u6(Q,q,J,Y);return Promise.all(Q).then((U)=>{return u6(U,q,J,Y)})}});var E8=D("$ZodIntersection",(J,X)=>{L.init(J,X),J._zod.parse=(H,W)=>{let q=H.value,Y=X.left._zod.run({value:q,issues:[]},W),z=X.right._zod.run({value:q,issues:[]},W);if(Y instanceof Promise||z instanceof Promise)return Promise.all([Y,z]).then(([U,G])=>{return y6(H,U,G)});return y6(H,Y,z)}});function S1(J,X){if(J===X)return{valid:!0,data:J};if(J instanceof Date&&X instanceof Date&&+J===+X)return{valid:!0,data:J};if(Q0(J)&&Q0(X)){let H=Object.keys(X),W=Object.keys(J).filter((Y)=>H.indexOf(Y)!==-1),q={...J,...X};for(let Y of W){let z=S1(J[Y],X[Y]);if(!z.valid)return{valid:!1,mergeErrorPath:[Y,...z.mergeErrorPath]};q[Y]=z.data}return{valid:!0,data:q}}if(Array.isArray(J)&&Array.isArray(X)){if(J.length!==X.length)return{valid:!1,mergeErrorPath:[]};let H=[];for(let W=0;W<J.length;W++){let q=J[W],Y=X[W],z=S1(q,Y);if(!z.valid)return{valid:!1,mergeErrorPath:[W,...z.mergeErrorPath]};H.push(z.data)}return{valid:!0,data:H}}return{valid:!1,mergeErrorPath:[]}}function y6(J,X,H){if(X.issues.length)J.issues.push(...X.issues);if(H.issues.length)J.issues.push(...H.issues);if(w0(J))return J;let W=S1(X.value,H.value);if(!W.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(W.mergeErrorPath)}`);return J.value=W.data,J}var k8=D("$ZodRecord",(J,X)=>{L.init(J,X),J._zod.parse=(H,W)=>{let q=H.value;if(!Q0(q))return H.issues.push({expected:"record",code:"invalid_type",input:q,inst:J}),H;let Y=[],z=X.keyType._zod.values;if(z){H.value={};let Q=new Set;for(let G of z)if(typeof G==="string"||typeof G==="number"||typeof G==="symbol"){Q.add(typeof G==="number"?G.toString():G);let P=X.valueType._zod.run({value:q[G],issues:[]},W);if(P instanceof Promise)Y.push(P.then((B)=>{if(B.issues.length)H.issues.push(...X0(G,B.issues));H.value[G]=B.value}));else{if(P.issues.length)H.issues.push(...X0(G,P.issues));H.value[G]=P.value}}let U;for(let G in q)if(!Q.has(G))U=U??[],U.push(G);if(U&&U.length>0)H.issues.push({code:"unrecognized_keys",input:q,inst:J,keys:U})}else{H.value={};for(let Q of Reflect.ownKeys(q)){if(Q==="__proto__")continue;let U=X.keyType._zod.run({value:Q,issues:[]},W);if(U instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(U.issues.length){if(X.mode==="loose")H.value[Q]=q[Q];else H.issues.push({code:"invalid_key",origin:"record",issues:U.issues.map((P)=>n(P,W,r())),input:Q,path:[Q],inst:J});continue}let G=X.valueType._zod.run({value:q[Q],issues:[]},W);if(G instanceof Promise)Y.push(G.then((P)=>{if(P.issues.length)H.issues.push(...X0(Q,P.issues));H.value[U.value]=P.value}));else{if(G.issues.length)H.issues.push(...X0(Q,G.issues));H.value[U.value]=G.value}}}if(Y.length)return Promise.all(Y).then(()=>H);return H}});var C8=D("$ZodEnum",(J,X)=>{L.init(J,X);let H=E0(X.entries),W=new Set(H);J._zod.values=W,J._zod.pattern=new RegExp(`^(${H.filter((q)=>R1.has(typeof q)).map((q)=>typeof q==="string"?D0(q):q.toString()).join("|")})$`),J._zod.parse=(q,Y)=>{let z=q.value;if(W.has(z))return q;return q.issues.push({code:"invalid_value",values:H,input:z,inst:J}),q}});var S8=D("$ZodTransform",(J,X)=>{L.init(J,X),J._zod.parse=(H,W)=>{if(W.direction==="backward")throw new b0(J.constructor.name);let q=X.transform(H.value,H);if(W.async)return(q instanceof Promise?q:Promise.resolve(q)).then((z)=>{return H.value=z,H});if(q instanceof Promise)throw new J0;return H.value=q,H}});function m6(J,X){if(J.issues.length&&X===void 0)return{issues:[],value:void 0};return J}var j8=D("$ZodOptional",(J,X)=>{L.init(J,X),J._zod.optin="optional",J._zod.optout="optional",N(J._zod,"values",()=>{return X.innerType._zod.values?new Set([...X.innerType._zod.values,void 0]):void 0}),N(J._zod,"pattern",()=>{let H=X.innerType._zod.pattern;return H?new RegExp(`^(${S0(H.source)})?$`):void 0}),J._zod.parse=(H,W)=>{if(X.innerType._zod.optin==="optional"){let q=X.innerType._zod.run(H,W);if(q instanceof Promise)return q.then((Y)=>m6(Y,H.value));return m6(q,H.value)}if(H.value===void 0)return H;return X.innerType._zod.run(H,W)}}),T8=D("$ZodNullable",(J,X)=>{L.init(J,X),N(J._zod,"optin",()=>X.innerType._zod.optin),N(J._zod,"optout",()=>X.innerType._zod.optout),N(J._zod,"pattern",()=>{let H=X.innerType._zod.pattern;return H?new RegExp(`^(${S0(H.source)}|null)$`):void 0}),N(J._zod,"values",()=>{return X.innerType._zod.values?new Set([...X.innerType._zod.values,null]):void 0}),J._zod.parse=(H,W)=>{if(H.value===null)return H;return X.innerType._zod.run(H,W)}}),h8=D("$ZodDefault",(J,X)=>{L.init(J,X),J._zod.optin="optional",N(J._zod,"values",()=>X.innerType._zod.values),J._zod.parse=(H,W)=>{if(W.direction==="backward")return X.innerType._zod.run(H,W);if(H.value===void 0)return H.value=X.defaultValue,H;let q=X.innerType._zod.run(H,W);if(q instanceof Promise)return q.then((Y)=>f6(Y,X));return f6(q,X)}});function f6(J,X){if(J.value===void 0)J.value=X.defaultValue;return J}var v8=D("$ZodPrefault",(J,X)=>{L.init(J,X),J._zod.optin="optional",N(J._zod,"values",()=>X.innerType._zod.values),J._zod.parse=(H,W)=>{if(W.direction==="backward")return X.innerType._zod.run(H,W);if(H.value===void 0)H.value=X.defaultValue;return X.innerType._zod.run(H,W)}}),x8=D("$ZodNonOptional",(J,X)=>{L.init(J,X),N(J._zod,"values",()=>{let H=X.innerType._zod.values;return H?new Set([...H].filter((W)=>W!==void 0)):void 0}),J._zod.parse=(H,W)=>{let q=X.innerType._zod.run(H,W);if(q instanceof Promise)return q.then((Y)=>o6(Y,J));return o6(q,J)}});function o6(J,X){if(!J.issues.length&&J.value===void 0)J.issues.push({code:"invalid_type",expected:"nonoptional",input:J.value,inst:X});return J}var g8=D("$ZodCatch",(J,X)=>{L.init(J,X),N(J._zod,"optin",()=>X.innerType._zod.optin),N(J._zod,"optout",()=>X.innerType._zod.optout),N(J._zod,"values",()=>X.innerType._zod.values),J._zod.parse=(H,W)=>{if(W.direction==="backward")return X.innerType._zod.run(H,W);let q=X.innerType._zod.run(H,W);if(q instanceof Promise)return q.then((Y)=>{if(H.value=Y.value,Y.issues.length)H.value=X.catchValue({...H,error:{issues:Y.issues.map((z)=>n(z,W,r()))},input:H.value}),H.issues=[];return H});if(H.value=q.value,q.issues.length)H.value=X.catchValue({...H,error:{issues:q.issues.map((Y)=>n(Y,W,r()))},input:H.value}),H.issues=[];return H}});var c8=D("$ZodPipe",(J,X)=>{L.init(J,X),N(J._zod,"values",()=>X.in._zod.values),N(J._zod,"optin",()=>X.in._zod.optin),N(J._zod,"optout",()=>X.out._zod.optout),N(J._zod,"propValues",()=>X.in._zod.propValues),J._zod.parse=(H,W)=>{if(W.direction==="backward"){let Y=X.out._zod.run(H,W);if(Y instanceof Promise)return Y.then((z)=>a0(z,X.in,W));return a0(Y,X.in,W)}let q=X.in._zod.run(H,W);if(q instanceof Promise)return q.then((Y)=>a0(Y,X.out,W));return a0(q,X.out,W)}});function a0(J,X,H){if(J.issues.length)return J.aborted=!0,J;return X._zod.run({value:J.value,issues:J.issues},H)}var u8=D("$ZodReadonly",(J,X)=>{L.init(J,X),N(J._zod,"propValues",()=>X.innerType._zod.propValues),N(J._zod,"values",()=>X.innerType._zod.values),N(J._zod,"optin",()=>X.innerType?._zod?.optin),N(J._zod,"optout",()=>X.innerType?._zod?.optout),J._zod.parse=(H,W)=>{if(W.direction==="backward")return X.innerType._zod.run(H,W);let q=X.innerType._zod.run(H,W);if(q instanceof Promise)return q.then(l6);return l6(q)}});function l6(J){return J.value=Object.freeze(J.value),J}var y8=D("$ZodCustom",(J,X)=>{c.init(J,X),L.init(J,X),J._zod.parse=(H,W)=>{return H},J._zod.check=(H)=>{let W=H.value,q=X.fn(W);if(q instanceof Promise)return q.then((Y)=>r6(Y,H,W,J));r6(q,H,W,J);return}});function r6(J,X,H,W){if(!J){let q={code:"custom",input:H,inst:W,path:[...W._zod.def.path??[]],continue:!W._zod.def.abort};if(W._zod.def.params)q.params=W._zod.def.params;X.issues.push(A0(q))}}var UX=(J)=>{let X=typeof J;switch(X){case"number":return Number.isNaN(J)?"NaN":"number";case"object":{if(Array.isArray(J))return"array";if(J===null)return"null";if(Object.getPrototypeOf(J)!==Object.prototype&&J.constructor)return J.constructor.name}}return X},DX=()=>{let J={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function X(W){return J[W]??null}let H={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return(W)=>{switch(W.code){case"invalid_type":return`Invalid input: expected ${W.expected}, received ${UX(W.input)}`;case"invalid_value":if(W.values.length===1)return`Invalid input: expected ${p0(W.values[0])}`;return`Invalid option: expected one of ${o0(W.values,"|")}`;case"too_big":{let q=W.inclusive?"<=":"<",Y=X(W.origin);if(Y)return`Too big: expected ${W.origin??"value"} to have ${q}${W.maximum.toString()} ${Y.unit??"elements"}`;return`Too big: expected ${W.origin??"value"} to be ${q}${W.maximum.toString()}`}case"too_small":{let q=W.inclusive?">=":">",Y=X(W.origin);if(Y)return`Too small: expected ${W.origin} to have ${q}${W.minimum.toString()} ${Y.unit}`;return`Too small: expected ${W.origin} to be ${q}${W.minimum.toString()}`}case"invalid_format":{let q=W;if(q.format==="starts_with")return`Invalid string: must start with "${q.prefix}"`;if(q.format==="ends_with")return`Invalid string: must end with "${q.suffix}"`;if(q.format==="includes")return`Invalid string: must include "${q.includes}"`;if(q.format==="regex")return`Invalid string: must match pattern ${q.pattern}`;return`Invalid ${H[q.format]??W.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${W.divisor}`;case"unrecognized_keys":return`Unrecognized key${W.keys.length>1?"s":""}: ${o0(W.keys,", ")}`;case"invalid_key":return`Invalid key in ${W.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${W.origin}`;default:return"Invalid input"}}};function T1(){return{localeError:DX()}}var m8,X5=Symbol("ZodOutput"),H5=Symbol("ZodInput");class f8{constructor(){this._map=new WeakMap,this._idmap=new Map}add(J,...X){let H=X[0];if(this._map.set(J,H),H&&typeof H==="object"&&"id"in H){if(this._idmap.has(H.id))throw Error(`ID ${H.id} already exists in the registry`);this._idmap.set(H.id,J)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(J){let X=this._map.get(J);if(X&&typeof X==="object"&&"id"in X)this._idmap.delete(X.id);return this._map.delete(J),this}get(J){let X=J._zod.parent;if(X){let H={...this.get(X)??{}};delete H.id;let W={...H,...this._map.get(J)};return Object.keys(W).length?W:void 0}return this._map.get(J)}has(J){return this._map.has(J)}}function PX(){return new f8}(m8=globalThis).__zod_globalRegistry??(m8.__zod_globalRegistry=PX());var P0=globalThis.__zod_globalRegistry;function o8(J,X){return new J({type:"string",...I(X)})}function l8(J,X){return new J({type:"string",coerce:!0,...I(X)})}function r8(J,X){return new J({type:"string",format:"email",check:"string_format",abort:!1,...I(X)})}function h1(J,X){return new J({type:"string",format:"guid",check:"string_format",abort:!1,...I(X)})}function p8(J,X){return new J({type:"string",format:"uuid",check:"string_format",abort:!1,...I(X)})}function d8(J,X){return new J({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...I(X)})}function n8(J,X){return new J({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...I(X)})}function i8(J,X){return new J({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...I(X)})}function t8(J,X){return new J({type:"string",format:"url",check:"string_format",abort:!1,...I(X)})}function a8(J,X){return new J({type:"string",format:"emoji",check:"string_format",abort:!1,...I(X)})}function s8(J,X){return new J({type:"string",format:"nanoid",check:"string_format",abort:!1,...I(X)})}function e8(J,X){return new J({type:"string",format:"cuid",check:"string_format",abort:!1,...I(X)})}function J2(J,X){return new J({type:"string",format:"cuid2",check:"string_format",abort:!1,...I(X)})}function X2(J,X){return new J({type:"string",format:"ulid",check:"string_format",abort:!1,...I(X)})}function H2(J,X){return new J({type:"string",format:"xid",check:"string_format",abort:!1,...I(X)})}function W2(J,X){return new J({type:"string",format:"ksuid",check:"string_format",abort:!1,...I(X)})}function q2(J,X){return new J({type:"string",format:"ipv4",check:"string_format",abort:!1,...I(X)})}function Y2(J,X){return new J({type:"string",format:"ipv6",check:"string_format",abort:!1,...I(X)})}function z2(J,X){return new J({type:"string",format:"cidrv4",check:"string_format",abort:!1,...I(X)})}function Q2(J,X){return new J({type:"string",format:"cidrv6",check:"string_format",abort:!1,...I(X)})}function w2(J,X){return new J({type:"string",format:"base64",check:"string_format",abort:!1,...I(X)})}function G2(J,X){return new J({type:"string",format:"base64url",check:"string_format",abort:!1,...I(X)})}function U2(J,X){return new J({type:"string",format:"e164",check:"string_format",abort:!1,...I(X)})}function D2(J,X){return new J({type:"string",format:"jwt",check:"string_format",abort:!1,...I(X)})}function P2(J,X){return new J({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...I(X)})}function B2(J,X){return new J({type:"string",format:"date",check:"string_format",...I(X)})}function M2(J,X){return new J({type:"string",format:"time",check:"string_format",precision:null,...I(X)})}function F2(J,X){return new J({type:"string",format:"duration",check:"string_format",...I(X)})}function I2(J,X){return new J({type:"number",checks:[],...I(X)})}function $2(J,X){return new J({type:"number",coerce:!0,checks:[],...I(X)})}function A2(J,X){return new J({type:"number",check:"number_format",abort:!1,format:"safeint",...I(X)})}function O2(J,X){return new J({type:"boolean",...I(X)})}function V2(J,X){return new J({type:"boolean",coerce:!0,...I(X)})}function K2(J,X){return new J({type:"bigint",coerce:!0,...I(X)})}function R2(J){return new J({type:"any"})}function N2(J){return new J({type:"unknown"})}function Z2(J,X){return new J({type:"never",...I(X)})}function L2(J,X){return new J({type:"date",...I(X)})}function b2(J,X){return new J({type:"date",coerce:!0,...I(X)})}function O0(J,X){return new E1({check:"less_than",...I(X),value:J,inclusive:!1})}function H0(J,X){return new E1({check:"less_than",...I(X),value:J,inclusive:!0})}function V0(J,X){return new k1({check:"greater_than",...I(X),value:J,inclusive:!1})}function i(J,X){return new k1({check:"greater_than",...I(X),value:J,inclusive:!0})}function x0(J,X){return new Z6({check:"multiple_of",...I(X),value:J})}function J1(J,X){return new b6({check:"max_length",...I(X),maximum:J})}function K0(J,X){return new _6({check:"min_length",...I(X),minimum:J})}function X1(J,X){return new E6({check:"length_equals",...I(X),length:J})}function v1(J,X){return new k6({check:"string_format",format:"regex",...I(X),pattern:J})}function x1(J){return new C6({check:"string_format",format:"lowercase",...I(J)})}function g1(J){return new S6({check:"string_format",format:"uppercase",...I(J)})}function c1(J,X){return new j6({check:"string_format",format:"includes",...I(X),includes:J})}function u1(J,X){return new T6({check:"string_format",format:"starts_with",...I(X),prefix:J})}function y1(J,X){return new h6({check:"string_format",format:"ends_with",...I(X),suffix:J})}function G0(J){return new v6({check:"overwrite",tx:J})}function m1(J){return G0((X)=>X.normalize(J))}function f1(){return G0((J)=>J.trim())}function o1(){return G0((J)=>J.toLowerCase())}function l1(){return G0((J)=>J.toUpperCase())}function r1(){return G0((J)=>V1(J))}function _2(J,X,H){return new J({type:"array",element:X,...I(H)})}function E2(J,X,H){return new J({type:"custom",check:"custom",fn:X,...I(H)})}function k2(J){let X=BX((H)=>{return H.addIssue=(W)=>{if(typeof W==="string")H.issues.push(A0(W,H.value,X._zod.def));else{let q=W;if(q.fatal)q.continue=!1;q.code??(q.code="custom"),q.input??(q.input=H.value),q.inst??(q.inst=X),q.continue??(q.continue=!X._zod.def.abort),H.issues.push(A0(q))}},J(H.value,H)});return X}function BX(J,X){let H=new c({check:"custom",...I(X)});return H._zod.check=J,H}function p1(J){let X=J?.target??"draft-2020-12";if(X==="draft-4")X="draft-04";if(X==="draft-7")X="draft-07";return{processors:J.processors??{},metadataRegistry:J?.metadata??P0,target:X,unrepresentable:J?.unrepresentable??"throw",override:J?.override??(()=>{}),io:J?.io??"output",counter:0,seen:new Map,cycles:J?.cycles??"ref",reused:J?.reused??"inline",external:J?.external??void 0}}function v(J,X,H={path:[],schemaPath:[]}){var W;let q=J._zod.def,Y=X.seen.get(J);if(Y){if(Y.count++,H.schemaPath.includes(J))Y.cycle=H.path;return Y.schema}let z={schema:{},count:1,cycle:void 0,path:H.path};X.seen.set(J,z);let Q=J._zod.toJSONSchema?.();if(Q)z.schema=Q;else{let P={...H,schemaPath:[...H.schemaPath,J],path:H.path},B=J._zod.parent;if(B)z.ref=B,v(B,X,P),X.seen.get(B).isParent=!0;else if(J._zod.processJSONSchema)J._zod.processJSONSchema(X,z.schema,P);else{let $=z.schema,F=X.processors[q.type];if(!F)throw Error(`[toJSONSchema]: Non-representable type encountered: ${q.type}`);F(J,X,$,P)}}let U=X.metadataRegistry.get(J);if(U)Object.assign(z.schema,U);if(X.io==="input"&&y(J))delete z.schema.examples,delete z.schema.default;if(X.io==="input"&&z.schema._prefault)(W=z.schema).default??(W.default=z.schema._prefault);return delete z.schema._prefault,X.seen.get(J).schema}function d1(J,X){let H=J.seen.get(X);if(!H)throw Error("Unprocessed schema. This is a bug in Zod.");let W=(Y)=>{let z=J.target==="draft-2020-12"?"$defs":"definitions";if(J.external){let P=J.external.registry.get(Y[0])?.id,B=J.external.uri??((F)=>F);if(P)return{ref:B(P)};let $=Y[1].defId??Y[1].schema.id??`schema${J.counter++}`;return Y[1].defId=$,{defId:$,ref:`${B("__shared")}#/${z}/${$}`}}if(Y[1]===H)return{ref:"#"};let U=`${"#"}/${z}/`,G=Y[1].schema.id??`__schema${J.counter++}`;return{defId:G,ref:U+G}},q=(Y)=>{if(Y[1].schema.$ref)return;let z=Y[1],{ref:Q,defId:U}=W(Y);if(z.def={...z.schema},U)z.defId=U;let G=z.schema;for(let P in G)delete G[P];G.$ref=Q};if(J.cycles==="throw")for(let Y of J.seen.entries()){let z=Y[1];if(z.cycle)throw Error(`Cycle detected: #/${z.cycle?.join("/")}/<root>
|
|
37
|
+
`)}A.write("payload.value = newResult;"),A.write("return payload;");let f0=A.compile();return(u,h)=>f0(V,u,h)},Y,Q=B0,z=!l0.jitless,w=z&&b1.value,M=X.catchall,F;J._zod.parse=(V,A)=>{F??(F=W.value);let b=V.value;if(!Q(b))return V.issues.push({expected:"object",code:"invalid_type",input:b,inst:J}),V;if(z&&w&&A?.async===!1&&A.jitless!==!0){if(!Y)Y=q(X.shape);if(V=Y(V,A),!M)return V;return T9([],b,V,A,F,J)}return H(V,A)}});function p2(J,X,H,W){for(let Y of J)if(Y.issues.length===0)return X.value=Y.value,X;let q=J.filter((Y)=>!G0(Y));if(q.length===1)return X.value=q[0].value,q[0];return X.issues.push({code:"invalid_union",input:X.value,inst:H,errors:J.map((Y)=>Y.issues.map((Q)=>t(Q,W,d())))}),X}var _9=P("$ZodUnion",(J,X)=>{C.init(J,X),R(J._zod,"optin",()=>X.options.some((q)=>q._zod.optin==="optional")?"optional":void 0),R(J._zod,"optout",()=>X.options.some((q)=>q._zod.optout==="optional")?"optional":void 0),R(J._zod,"values",()=>{if(X.options.every((q)=>q._zod.values))return new Set(X.options.flatMap((q)=>Array.from(q._zod.values)));return}),R(J._zod,"pattern",()=>{if(X.options.every((q)=>q._zod.pattern)){let q=X.options.map((Y)=>Y._zod.pattern);return new RegExp(`^(${q.map((Y)=>j0(Y.source)).join("|")})$`)}return});let H=X.options.length===1,W=X.options[0]._zod.run;J._zod.parse=(q,Y)=>{if(H)return W(q,Y);let Q=!1,z=[];for(let U of X.options){let w=U._zod.run({value:q.value,issues:[]},Y);if(w instanceof Promise)z.push(w),Q=!0;else{if(w.issues.length===0)return w;z.push(w)}}if(!Q)return p2(z,q,J,Y);return Promise.all(z).then((U)=>{return p2(U,q,J,Y)})}});var h9=P("$ZodIntersection",(J,X)=>{C.init(J,X),J._zod.parse=(H,W)=>{let q=H.value,Y=X.left._zod.run({value:q,issues:[]},W),Q=X.right._zod.run({value:q,issues:[]},W);if(Y instanceof Promise||Q instanceof Promise)return Promise.all([Y,Q]).then(([U,w])=>{return r2(H,U,w)});return r2(H,Y,Q)}});function g1(J,X){if(J===X)return{valid:!0,data:J};if(J instanceof Date&&X instanceof Date&&+J===+X)return{valid:!0,data:J};if(w0(J)&&w0(X)){let H=Object.keys(X),W=Object.keys(J).filter((Y)=>H.indexOf(Y)!==-1),q={...J,...X};for(let Y of W){let Q=g1(J[Y],X[Y]);if(!Q.valid)return{valid:!1,mergeErrorPath:[Y,...Q.mergeErrorPath]};q[Y]=Q.data}return{valid:!0,data:q}}if(Array.isArray(J)&&Array.isArray(X)){if(J.length!==X.length)return{valid:!1,mergeErrorPath:[]};let H=[];for(let W=0;W<J.length;W++){let q=J[W],Y=X[W],Q=g1(q,Y);if(!Q.valid)return{valid:!1,mergeErrorPath:[W,...Q.mergeErrorPath]};H.push(Q.data)}return{valid:!0,data:H}}return{valid:!1,mergeErrorPath:[]}}function r2(J,X,H){let W=new Map,q;for(let z of X.issues)if(z.code==="unrecognized_keys"){q??(q=z);for(let U of z.keys){if(!W.has(U))W.set(U,{});W.get(U).l=!0}}else J.issues.push(z);for(let z of H.issues)if(z.code==="unrecognized_keys")for(let U of z.keys){if(!W.has(U))W.set(U,{});W.get(U).r=!0}else J.issues.push(z);let Y=[...W].filter(([,z])=>z.l&&z.r).map(([z])=>z);if(Y.length&&q)J.issues.push({...q,keys:Y});if(G0(J))return J;let Q=g1(X.value,H.value);if(!Q.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(Q.mergeErrorPath)}`);return J.value=Q.data,J}var x9=P("$ZodRecord",(J,X)=>{C.init(J,X),J._zod.parse=(H,W)=>{let q=H.value;if(!w0(q))return H.issues.push({expected:"record",code:"invalid_type",input:q,inst:J}),H;let Y=[],Q=X.keyType._zod.values;if(Q){H.value={};let z=new Set;for(let w of Q)if(typeof w==="string"||typeof w==="number"||typeof w==="symbol"){z.add(typeof w==="number"?w.toString():w);let M=X.valueType._zod.run({value:q[w],issues:[]},W);if(M instanceof Promise)Y.push(M.then((F)=>{if(F.issues.length)H.issues.push(...q0(w,F.issues));H.value[w]=F.value}));else{if(M.issues.length)H.issues.push(...q0(w,M.issues));H.value[w]=M.value}}let U;for(let w in q)if(!z.has(w))U=U??[],U.push(w);if(U&&U.length>0)H.issues.push({code:"unrecognized_keys",input:q,inst:J,keys:U})}else{H.value={};for(let z of Reflect.ownKeys(q)){if(z==="__proto__")continue;let U=X.keyType._zod.run({value:z,issues:[]},W);if(U instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof z==="string"&&s0.test(z)&&U.issues.length&&U.issues.some((F)=>F.code==="invalid_type"&&F.expected==="number")){let F=X.keyType._zod.run({value:Number(z),issues:[]},W);if(F instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(F.issues.length===0)U=F}if(U.issues.length){if(X.mode==="loose")H.value[z]=q[z];else H.issues.push({code:"invalid_key",origin:"record",issues:U.issues.map((F)=>t(F,W,d())),input:z,path:[z],inst:J});continue}let M=X.valueType._zod.run({value:q[z],issues:[]},W);if(M instanceof Promise)Y.push(M.then((F)=>{if(F.issues.length)H.issues.push(...q0(z,F.issues));H.value[U.value]=F.value}));else{if(M.issues.length)H.issues.push(...q0(z,M.issues));H.value[U.value]=M.value}}}if(Y.length)return Promise.all(Y).then(()=>H);return H}});var v9=P("$ZodEnum",(J,X)=>{C.init(J,X);let H=D0(X.entries),W=new Set(H);J._zod.values=W,J._zod.pattern=new RegExp(`^(${H.filter((q)=>E1.has(typeof q)).map((q)=>typeof q==="string"?M0(q):q.toString()).join("|")})$`),J._zod.parse=(q,Y)=>{let Q=q.value;if(W.has(Q))return q;return q.issues.push({code:"invalid_value",values:H,input:Q,inst:J}),q}});var g9=P("$ZodTransform",(J,X)=>{C.init(J,X),J._zod.parse=(H,W)=>{if(W.direction==="backward")throw new C0(J.constructor.name);let q=X.transform(H.value,H);if(W.async)return(q instanceof Promise?q:Promise.resolve(q)).then((Q)=>{return H.value=Q,H});if(q instanceof Promise)throw new H0;return H.value=q,H}});function d2(J,X){if(J.issues.length&&X===void 0)return{issues:[],value:void 0};return J}var y1=P("$ZodOptional",(J,X)=>{C.init(J,X),J._zod.optin="optional",J._zod.optout="optional",R(J._zod,"values",()=>{return X.innerType._zod.values?new Set([...X.innerType._zod.values,void 0]):void 0}),R(J._zod,"pattern",()=>{let H=X.innerType._zod.pattern;return H?new RegExp(`^(${j0(H.source)})?$`):void 0}),J._zod.parse=(H,W)=>{if(X.innerType._zod.optin==="optional"){let q=X.innerType._zod.run(H,W);if(q instanceof Promise)return q.then((Y)=>d2(Y,H.value));return d2(q,H.value)}if(H.value===void 0)return H;return X.innerType._zod.run(H,W)}}),u9=P("$ZodExactOptional",(J,X)=>{y1.init(J,X),R(J._zod,"values",()=>X.innerType._zod.values),R(J._zod,"pattern",()=>X.innerType._zod.pattern),J._zod.parse=(H,W)=>{return X.innerType._zod.run(H,W)}}),y9=P("$ZodNullable",(J,X)=>{C.init(J,X),R(J._zod,"optin",()=>X.innerType._zod.optin),R(J._zod,"optout",()=>X.innerType._zod.optout),R(J._zod,"pattern",()=>{let H=X.innerType._zod.pattern;return H?new RegExp(`^(${j0(H.source)}|null)$`):void 0}),R(J._zod,"values",()=>{return X.innerType._zod.values?new Set([...X.innerType._zod.values,null]):void 0}),J._zod.parse=(H,W)=>{if(H.value===null)return H;return X.innerType._zod.run(H,W)}}),m9=P("$ZodDefault",(J,X)=>{C.init(J,X),J._zod.optin="optional",R(J._zod,"values",()=>X.innerType._zod.values),J._zod.parse=(H,W)=>{if(W.direction==="backward")return X.innerType._zod.run(H,W);if(H.value===void 0)return H.value=X.defaultValue,H;let q=X.innerType._zod.run(H,W);if(q instanceof Promise)return q.then((Y)=>n2(Y,X));return n2(q,X)}});function n2(J,X){if(J.value===void 0)J.value=X.defaultValue;return J}var c9=P("$ZodPrefault",(J,X)=>{C.init(J,X),J._zod.optin="optional",R(J._zod,"values",()=>X.innerType._zod.values),J._zod.parse=(H,W)=>{if(W.direction==="backward")return X.innerType._zod.run(H,W);if(H.value===void 0)H.value=X.defaultValue;return X.innerType._zod.run(H,W)}}),f9=P("$ZodNonOptional",(J,X)=>{C.init(J,X),R(J._zod,"values",()=>{let H=X.innerType._zod.values;return H?new Set([...H].filter((W)=>W!==void 0)):void 0}),J._zod.parse=(H,W)=>{let q=X.innerType._zod.run(H,W);if(q instanceof Promise)return q.then((Y)=>i2(Y,J));return i2(q,J)}});function i2(J,X){if(!J.issues.length&&J.value===void 0)J.issues.push({code:"invalid_type",expected:"nonoptional",input:J.value,inst:X});return J}var o9=P("$ZodCatch",(J,X)=>{C.init(J,X),R(J._zod,"optin",()=>X.innerType._zod.optin),R(J._zod,"optout",()=>X.innerType._zod.optout),R(J._zod,"values",()=>X.innerType._zod.values),J._zod.parse=(H,W)=>{if(W.direction==="backward")return X.innerType._zod.run(H,W);let q=X.innerType._zod.run(H,W);if(q instanceof Promise)return q.then((Y)=>{if(H.value=Y.value,Y.issues.length)H.value=X.catchValue({...H,error:{issues:Y.issues.map((Q)=>t(Q,W,d()))},input:H.value}),H.issues=[];return H});if(H.value=q.value,q.issues.length)H.value=X.catchValue({...H,error:{issues:q.issues.map((Y)=>t(Y,W,d()))},input:H.value}),H.issues=[];return H}});var l9=P("$ZodPipe",(J,X)=>{C.init(J,X),R(J._zod,"values",()=>X.in._zod.values),R(J._zod,"optin",()=>X.in._zod.optin),R(J._zod,"optout",()=>X.out._zod.optout),R(J._zod,"propValues",()=>X.in._zod.propValues),J._zod.parse=(H,W)=>{if(W.direction==="backward"){let Y=X.out._zod.run(H,W);if(Y instanceof Promise)return Y.then((Q)=>J1(Q,X.in,W));return J1(Y,X.in,W)}let q=X.in._zod.run(H,W);if(q instanceof Promise)return q.then((Y)=>J1(Y,X.out,W));return J1(q,X.out,W)}});function J1(J,X,H){if(J.issues.length)return J.aborted=!0,J;return X._zod.run({value:J.value,issues:J.issues},H)}var p9=P("$ZodReadonly",(J,X)=>{C.init(J,X),R(J._zod,"propValues",()=>X.innerType._zod.propValues),R(J._zod,"values",()=>X.innerType._zod.values),R(J._zod,"optin",()=>X.innerType?._zod?.optin),R(J._zod,"optout",()=>X.innerType?._zod?.optout),J._zod.parse=(H,W)=>{if(W.direction==="backward")return X.innerType._zod.run(H,W);let q=X.innerType._zod.run(H,W);if(q instanceof Promise)return q.then(t2);return t2(q)}});function t2(J){return J.value=Object.freeze(J.value),J}var r9=P("$ZodCustom",(J,X)=>{y.init(J,X),C.init(J,X),J._zod.parse=(H,W)=>{return H},J._zod.check=(H)=>{let W=H.value,q=X.fn(W);if(q instanceof Promise)return q.then((Y)=>a2(Y,H,W,J));a2(q,H,W,J);return}});function a2(J,X,H,W){if(!J){let q={code:"custom",input:H,inst:W,path:[...W._zod.def.path??[]],continue:!W._zod.def.abort};if(W._zod.def.params)q.params=W._zod.def.params;X.issues.push(I0(q))}}var IX=()=>{let J={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function X(q){return J[q]??null}let H={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},W={nan:"NaN"};return(q)=>{switch(q.code){case"invalid_type":{let Y=W[q.expected]??q.expected,Q=k1(q.input),z=W[Q]??Q;return`Invalid input: expected ${Y}, received ${z}`}case"invalid_value":if(q.values.length===1)return`Invalid input: expected ${n0(q.values[0])}`;return`Invalid option: expected one of ${p0(q.values,"|")}`;case"too_big":{let Y=q.inclusive?"<=":"<",Q=X(q.origin);if(Q)return`Too big: expected ${q.origin??"value"} to have ${Y}${q.maximum.toString()} ${Q.unit??"elements"}`;return`Too big: expected ${q.origin??"value"} to be ${Y}${q.maximum.toString()}`}case"too_small":{let Y=q.inclusive?">=":">",Q=X(q.origin);if(Q)return`Too small: expected ${q.origin} to have ${Y}${q.minimum.toString()} ${Q.unit}`;return`Too small: expected ${q.origin} to be ${Y}${q.minimum.toString()}`}case"invalid_format":{let Y=q;if(Y.format==="starts_with")return`Invalid string: must start with "${Y.prefix}"`;if(Y.format==="ends_with")return`Invalid string: must end with "${Y.suffix}"`;if(Y.format==="includes")return`Invalid string: must include "${Y.includes}"`;if(Y.format==="regex")return`Invalid string: must match pattern ${Y.pattern}`;return`Invalid ${H[Y.format]??q.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${q.divisor}`;case"unrecognized_keys":return`Unrecognized key${q.keys.length>1?"s":""}: ${p0(q.keys,", ")}`;case"invalid_key":return`Invalid key in ${q.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${q.origin}`;default:return"Invalid input"}}};function m1(){return{localeError:IX()}}var d9,f5=Symbol("ZodOutput"),o5=Symbol("ZodInput");class n9{constructor(){this._map=new WeakMap,this._idmap=new Map}add(J,...X){let H=X[0];if(this._map.set(J,H),H&&typeof H==="object"&&"id"in H)this._idmap.set(H.id,J);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(J){let X=this._map.get(J);if(X&&typeof X==="object"&&"id"in X)this._idmap.delete(X.id);return this._map.delete(J),this}get(J){let X=J._zod.parent;if(X){let H={...this.get(X)??{}};delete H.id;let W={...H,...this._map.get(J)};return Object.keys(W).length?W:void 0}return this._map.get(J)}has(J){return this._map.has(J)}}function OX(){return new n9}(d9=globalThis).__zod_globalRegistry??(d9.__zod_globalRegistry=OX());var F0=globalThis.__zod_globalRegistry;function i9(J,X){return new J({type:"string",...B(X)})}function t9(J,X){return new J({type:"string",coerce:!0,...B(X)})}function a9(J,X){return new J({type:"string",format:"email",check:"string_format",abort:!1,...B(X)})}function c1(J,X){return new J({type:"string",format:"guid",check:"string_format",abort:!1,...B(X)})}function s9(J,X){return new J({type:"string",format:"uuid",check:"string_format",abort:!1,...B(X)})}function e9(J,X){return new J({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...B(X)})}function JJ(J,X){return new J({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...B(X)})}function XJ(J,X){return new J({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...B(X)})}function HJ(J,X){return new J({type:"string",format:"url",check:"string_format",abort:!1,...B(X)})}function WJ(J,X){return new J({type:"string",format:"emoji",check:"string_format",abort:!1,...B(X)})}function qJ(J,X){return new J({type:"string",format:"nanoid",check:"string_format",abort:!1,...B(X)})}function YJ(J,X){return new J({type:"string",format:"cuid",check:"string_format",abort:!1,...B(X)})}function QJ(J,X){return new J({type:"string",format:"cuid2",check:"string_format",abort:!1,...B(X)})}function zJ(J,X){return new J({type:"string",format:"ulid",check:"string_format",abort:!1,...B(X)})}function wJ(J,X){return new J({type:"string",format:"xid",check:"string_format",abort:!1,...B(X)})}function GJ(J,X){return new J({type:"string",format:"ksuid",check:"string_format",abort:!1,...B(X)})}function UJ(J,X){return new J({type:"string",format:"ipv4",check:"string_format",abort:!1,...B(X)})}function PJ(J,X){return new J({type:"string",format:"ipv6",check:"string_format",abort:!1,...B(X)})}function MJ(J,X){return new J({type:"string",format:"cidrv4",check:"string_format",abort:!1,...B(X)})}function FJ(J,X){return new J({type:"string",format:"cidrv6",check:"string_format",abort:!1,...B(X)})}function AJ(J,X){return new J({type:"string",format:"base64",check:"string_format",abort:!1,...B(X)})}function $J(J,X){return new J({type:"string",format:"base64url",check:"string_format",abort:!1,...B(X)})}function VJ(J,X){return new J({type:"string",format:"e164",check:"string_format",abort:!1,...B(X)})}function BJ(J,X){return new J({type:"string",format:"jwt",check:"string_format",abort:!1,...B(X)})}function DJ(J,X){return new J({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...B(X)})}function KJ(J,X){return new J({type:"string",format:"date",check:"string_format",...B(X)})}function IJ(J,X){return new J({type:"string",format:"time",check:"string_format",precision:null,...B(X)})}function OJ(J,X){return new J({type:"string",format:"duration",check:"string_format",...B(X)})}function RJ(J,X){return new J({type:"number",checks:[],...B(X)})}function LJ(J,X){return new J({type:"number",coerce:!0,checks:[],...B(X)})}function ZJ(J,X){return new J({type:"number",check:"number_format",abort:!1,format:"safeint",...B(X)})}function NJ(J,X){return new J({type:"boolean",...B(X)})}function bJ(J,X){return new J({type:"boolean",coerce:!0,...B(X)})}function EJ(J,X){return new J({type:"bigint",coerce:!0,...B(X)})}function CJ(J){return new J({type:"any"})}function SJ(J){return new J({type:"unknown"})}function kJ(J,X){return new J({type:"never",...B(X)})}function TJ(J,X){return new J({type:"date",...B(X)})}function jJ(J,X){return new J({type:"date",coerce:!0,...B(X)})}function O0(J,X){return new h1({check:"less_than",...B(X),value:J,inclusive:!1})}function Y0(J,X){return new h1({check:"less_than",...B(X),value:J,inclusive:!0})}function R0(J,X){return new x1({check:"greater_than",...B(X),value:J,inclusive:!1})}function a(J,X){return new x1({check:"greater_than",...B(X),value:J,inclusive:!0})}function g0(J,X){return new k2({check:"multiple_of",...B(X),value:J})}function W1(J,X){return new j2({check:"max_length",...B(X),maximum:J})}function L0(J,X){return new _2({check:"min_length",...B(X),minimum:J})}function q1(J,X){return new h2({check:"length_equals",...B(X),length:J})}function f1(J,X){return new x2({check:"string_format",format:"regex",...B(X),pattern:J})}function o1(J){return new v2({check:"string_format",format:"lowercase",...B(J)})}function l1(J){return new g2({check:"string_format",format:"uppercase",...B(J)})}function p1(J,X){return new u2({check:"string_format",format:"includes",...B(X),includes:J})}function r1(J,X){return new y2({check:"string_format",format:"starts_with",...B(X),prefix:J})}function d1(J,X){return new m2({check:"string_format",format:"ends_with",...B(X),suffix:J})}function U0(J){return new c2({check:"overwrite",tx:J})}function n1(J){return U0((X)=>X.normalize(J))}function i1(){return U0((J)=>J.trim())}function t1(){return U0((J)=>J.toLowerCase())}function a1(){return U0((J)=>J.toUpperCase())}function s1(){return U0((J)=>N1(J))}function _J(J,X,H){return new J({type:"array",element:X,...B(H)})}function hJ(J,X,H){return new J({type:"custom",check:"custom",fn:X,...B(H)})}function xJ(J){let X=RX((H)=>{return H.addIssue=(W)=>{if(typeof W==="string")H.issues.push(I0(W,H.value,X._zod.def));else{let q=W;if(q.fatal)q.continue=!1;q.code??(q.code="custom"),q.input??(q.input=H.value),q.inst??(q.inst=X),q.continue??(q.continue=!X._zod.def.abort),H.issues.push(I0(q))}},J(H.value,H)});return X}function RX(J,X){let H=new y({check:"custom",...B(X)});return H._zod.check=J,H}function e1(J){let X=J?.target??"draft-2020-12";if(X==="draft-4")X="draft-04";if(X==="draft-7")X="draft-07";return{processors:J.processors??{},metadataRegistry:J?.metadata??F0,target:X,unrepresentable:J?.unrepresentable??"throw",override:J?.override??(()=>{}),io:J?.io??"output",counter:0,seen:new Map,cycles:J?.cycles??"ref",reused:J?.reused??"inline",external:J?.external??void 0}}function g(J,X,H={path:[],schemaPath:[]}){var W;let q=J._zod.def,Y=X.seen.get(J);if(Y){if(Y.count++,H.schemaPath.includes(J))Y.cycle=H.path;return Y.schema}let Q={schema:{},count:1,cycle:void 0,path:H.path};X.seen.set(J,Q);let z=J._zod.toJSONSchema?.();if(z)Q.schema=z;else{let M={...H,schemaPath:[...H.schemaPath,J],path:H.path};if(J._zod.processJSONSchema)J._zod.processJSONSchema(X,Q.schema,M);else{let V=Q.schema,A=X.processors[q.type];if(!A)throw Error(`[toJSONSchema]: Non-representable type encountered: ${q.type}`);A(J,X,V,M)}let F=J._zod.parent;if(F){if(!Q.ref)Q.ref=F;g(F,X,M),X.seen.get(F).isParent=!0}}let U=X.metadataRegistry.get(J);if(U)Object.assign(Q.schema,U);if(X.io==="input"&&f(J))delete Q.schema.examples,delete Q.schema.default;if(X.io==="input"&&Q.schema._prefault)(W=Q.schema).default??(W.default=Q.schema._prefault);return delete Q.schema._prefault,X.seen.get(J).schema}function J8(J,X){let H=J.seen.get(X);if(!H)throw Error("Unprocessed schema. This is a bug in Zod.");let W=new Map;for(let Q of J.seen.entries()){let z=J.metadataRegistry.get(Q[0])?.id;if(z){let U=W.get(z);if(U&&U!==Q[0])throw Error(`Duplicate schema id "${z}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);W.set(z,Q[0])}}let q=(Q)=>{let z=J.target==="draft-2020-12"?"$defs":"definitions";if(J.external){let F=J.external.registry.get(Q[0])?.id,V=J.external.uri??((b)=>b);if(F)return{ref:V(F)};let A=Q[1].defId??Q[1].schema.id??`schema${J.counter++}`;return Q[1].defId=A,{defId:A,ref:`${V("__shared")}#/${z}/${A}`}}if(Q[1]===H)return{ref:"#"};let w=`${"#"}/${z}/`,M=Q[1].schema.id??`__schema${J.counter++}`;return{defId:M,ref:w+M}},Y=(Q)=>{if(Q[1].schema.$ref)return;let z=Q[1],{ref:U,defId:w}=q(Q);if(z.def={...z.schema},w)z.defId=w;let M=z.schema;for(let F in M)delete M[F];M.$ref=U};if(J.cycles==="throw")for(let Q of J.seen.entries()){let z=Q[1];if(z.cycle)throw Error(`Cycle detected: #/${z.cycle?.join("/")}/<root>
|
|
21
38
|
|
|
22
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let Y of J.seen.entries()){let z=Y[1];if(X===Y[0]){q(Y);continue}if(J.external){let U=J.external.registry.get(Y[0])?.id;if(X!==Y[0]&&U){q(Y);continue}}if(J.metadataRegistry.get(Y[0])?.id){q(Y);continue}if(z.cycle){q(Y);continue}if(z.count>1){if(J.reused==="ref"){q(Y);continue}}}}function n1(J,X){let H=J.seen.get(X);if(!H)throw Error("Unprocessed schema. This is a bug in Zod.");let W=(z)=>{let Q=J.seen.get(z),U=Q.def??Q.schema,G={...U};if(Q.ref===null)return;let P=Q.ref;if(Q.ref=null,P){W(P);let B=J.seen.get(P).schema;if(B.$ref&&(J.target==="draft-07"||J.target==="draft-04"||J.target==="openapi-3.0"))U.allOf=U.allOf??[],U.allOf.push(B);else Object.assign(U,B),Object.assign(U,G)}if(!Q.isParent)J.override({zodSchema:z,jsonSchema:U,path:Q.path??[]})};for(let z of[...J.seen.entries()].reverse())W(z[0]);let q={};if(J.target==="draft-2020-12")q.$schema="https://json-schema.org/draft/2020-12/schema";else if(J.target==="draft-07")q.$schema="http://json-schema.org/draft-07/schema#";else if(J.target==="draft-04")q.$schema="http://json-schema.org/draft-04/schema#";else if(J.target==="openapi-3.0");if(J.external?.uri){let z=J.external.registry.get(X)?.id;if(!z)throw Error("Schema is missing an `id` property");q.$id=J.external.uri(z)}Object.assign(q,H.def??H.schema);let Y=J.external?.defs??{};for(let z of J.seen.entries()){let Q=z[1];if(Q.def&&Q.defId)Y[Q.defId]=Q.def}if(J.external);else if(Object.keys(Y).length>0)if(J.target==="draft-2020-12")q.$defs=Y;else q.definitions=Y;try{let z=JSON.parse(JSON.stringify(q));return Object.defineProperty(z,"~standard",{value:{...X["~standard"],jsonSchema:{input:g0(X,"input"),output:g0(X,"output")}},enumerable:!1,writable:!1}),z}catch(z){throw Error("Error converting schema to JSON.")}}function y(J,X){let H=X??{seen:new Set};if(H.seen.has(J))return!1;H.seen.add(J);let W=J._zod.def;if(W.type==="transform")return!0;if(W.type==="array")return y(W.element,H);if(W.type==="set")return y(W.valueType,H);if(W.type==="lazy")return y(W.getter(),H);if(W.type==="promise"||W.type==="optional"||W.type==="nonoptional"||W.type==="nullable"||W.type==="readonly"||W.type==="default"||W.type==="prefault")return y(W.innerType,H);if(W.type==="intersection")return y(W.left,H)||y(W.right,H);if(W.type==="record"||W.type==="map")return y(W.keyType,H)||y(W.valueType,H);if(W.type==="pipe")return y(W.in,H)||y(W.out,H);if(W.type==="object"){for(let q in W.shape)if(y(W.shape[q],H))return!0;return!1}if(W.type==="union"){for(let q of W.options)if(y(q,H))return!0;return!1}if(W.type==="tuple"){for(let q of W.items)if(y(q,H))return!0;if(W.rest&&y(W.rest,H))return!0;return!1}return!1}var C2=(J,X={})=>(H)=>{let W=p1({...H,processors:X});return v(J,W),d1(W,J),n1(W,J)},g0=(J,X)=>(H)=>{let{libraryOptions:W,target:q}=H??{},Y=p1({...W??{},target:q,io:X,processors:{}});return v(J,Y),d1(Y,J),n1(Y,J)};var MX={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},S2=(J,X,H,W)=>{let q=H;q.type="string";let{minimum:Y,maximum:z,format:Q,patterns:U,contentEncoding:G}=J._zod.bag;if(typeof Y==="number")q.minLength=Y;if(typeof z==="number")q.maxLength=z;if(Q){if(q.format=MX[Q]??Q,q.format==="")delete q.format}if(G)q.contentEncoding=G;if(U&&U.size>0){let P=[...U];if(P.length===1)q.pattern=P[0].source;else if(P.length>1)q.allOf=[...P.map((B)=>({...X.target==="draft-07"||X.target==="draft-04"||X.target==="openapi-3.0"?{type:"string"}:{},pattern:B.source}))]}},j2=(J,X,H,W)=>{let q=H,{minimum:Y,maximum:z,format:Q,multipleOf:U,exclusiveMaximum:G,exclusiveMinimum:P}=J._zod.bag;if(typeof Q==="string"&&Q.includes("int"))q.type="integer";else q.type="number";if(typeof P==="number")if(X.target==="draft-04"||X.target==="openapi-3.0")q.minimum=P,q.exclusiveMinimum=!0;else q.exclusiveMinimum=P;if(typeof Y==="number"){if(q.minimum=Y,typeof P==="number"&&X.target!=="draft-04")if(P>=Y)delete q.minimum;else delete q.exclusiveMinimum}if(typeof G==="number")if(X.target==="draft-04"||X.target==="openapi-3.0")q.maximum=G,q.exclusiveMaximum=!0;else q.exclusiveMaximum=G;if(typeof z==="number"){if(q.maximum=z,typeof G==="number"&&X.target!=="draft-04")if(G<=z)delete q.maximum;else delete q.exclusiveMaximum}if(typeof U==="number")q.multipleOf=U},T2=(J,X,H,W)=>{H.type="boolean"},h2=(J,X,H,W)=>{if(X.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema")};var v2=(J,X,H,W)=>{H.not={}},x2=(J,X,H,W)=>{},g2=(J,X,H,W)=>{},c2=(J,X,H,W)=>{if(X.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema")},u2=(J,X,H,W)=>{let q=J._zod.def,Y=E0(q.entries);if(Y.every((z)=>typeof z==="number"))H.type="number";if(Y.every((z)=>typeof z==="string"))H.type="string";H.enum=Y};var y2=(J,X,H,W)=>{if(X.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")};var m2=(J,X,H,W)=>{if(X.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")};var f2=(J,X,H,W)=>{let q=H,Y=J._zod.def,{minimum:z,maximum:Q}=J._zod.bag;if(typeof z==="number")q.minItems=z;if(typeof Q==="number")q.maxItems=Q;q.type="array",q.items=v(Y.element,X,{...W,path:[...W.path,"items"]})},o2=(J,X,H,W)=>{let q=H,Y=J._zod.def;q.type="object",q.properties={};let z=Y.shape;for(let G in z)q.properties[G]=v(z[G],X,{...W,path:[...W.path,"properties",G]});let Q=new Set(Object.keys(z)),U=new Set([...Q].filter((G)=>{let P=Y.shape[G]._zod;if(X.io==="input")return P.optin===void 0;else return P.optout===void 0}));if(U.size>0)q.required=Array.from(U);if(Y.catchall?._zod.def.type==="never")q.additionalProperties=!1;else if(!Y.catchall){if(X.io==="output")q.additionalProperties=!1}else if(Y.catchall)q.additionalProperties=v(Y.catchall,X,{...W,path:[...W.path,"additionalProperties"]})},l2=(J,X,H,W)=>{let q=J._zod.def,Y=q.inclusive===!1,z=q.options.map((Q,U)=>v(Q,X,{...W,path:[...W.path,Y?"oneOf":"anyOf",U]}));if(Y)H.oneOf=z;else H.anyOf=z},r2=(J,X,H,W)=>{let q=J._zod.def,Y=v(q.left,X,{...W,path:[...W.path,"allOf",0]}),z=v(q.right,X,{...W,path:[...W.path,"allOf",1]}),Q=(G)=>("allOf"in G)&&Object.keys(G).length===1,U=[...Q(Y)?Y.allOf:[Y],...Q(z)?z.allOf:[z]];H.allOf=U};var p2=(J,X,H,W)=>{let q=H,Y=J._zod.def;if(q.type="object",X.target==="draft-07"||X.target==="draft-2020-12")q.propertyNames=v(Y.keyType,X,{...W,path:[...W.path,"propertyNames"]});q.additionalProperties=v(Y.valueType,X,{...W,path:[...W.path,"additionalProperties"]})},d2=(J,X,H,W)=>{let q=J._zod.def,Y=v(q.innerType,X,W),z=X.seen.get(J);if(X.target==="openapi-3.0")z.ref=q.innerType,H.nullable=!0;else H.anyOf=[Y,{type:"null"}]},n2=(J,X,H,W)=>{let q=J._zod.def;v(q.innerType,X,W);let Y=X.seen.get(J);Y.ref=q.innerType},i2=(J,X,H,W)=>{let q=J._zod.def;v(q.innerType,X,W);let Y=X.seen.get(J);Y.ref=q.innerType,H.default=JSON.parse(JSON.stringify(q.defaultValue))},t2=(J,X,H,W)=>{let q=J._zod.def;v(q.innerType,X,W);let Y=X.seen.get(J);if(Y.ref=q.innerType,X.io==="input")H._prefault=JSON.parse(JSON.stringify(q.defaultValue))},a2=(J,X,H,W)=>{let q=J._zod.def;v(q.innerType,X,W);let Y=X.seen.get(J);Y.ref=q.innerType;let z;try{z=q.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}H.default=z},s2=(J,X,H,W)=>{let q=J._zod.def,Y=X.io==="input"?q.in._zod.def.type==="transform"?q.out:q.in:q.out;v(Y,X,W);let z=X.seen.get(J);z.ref=Y},e2=(J,X,H,W)=>{let q=J._zod.def;v(q.innerType,X,W);let Y=X.seen.get(J);Y.ref=q.innerType,H.readOnly=!0};var JJ=(J,X,H,W)=>{let q=J._zod.def;v(q.innerType,X,W);let Y=X.seen.get(J);Y.ref=q.innerType};var RX=D("ZodISODateTime",(J,X)=>{W8.init(J,X),C.init(J,X)});function XJ(J){return P2(RX,J)}var NX=D("ZodISODate",(J,X)=>{q8.init(J,X),C.init(J,X)});function HJ(J){return B2(NX,J)}var ZX=D("ZodISOTime",(J,X)=>{Y8.init(J,X),C.init(J,X)});function WJ(J){return M2(ZX,J)}var LX=D("ZodISODuration",(J,X)=>{z8.init(J,X),C.init(J,X)});function qJ(J){return F2(LX,J)}var QJ=(J,X)=>{d0.init(J,X),J.name="ZodError",Object.defineProperties(J,{format:{value:(H)=>c4(J,H)},flatten:{value:(H)=>g4(J,H)},addIssue:{value:(H)=>{J.issues.push(H),J.message=JSON.stringify(J.issues,$0,2)}},addIssues:{value:(H)=>{J.issues.push(...H),J.message=JSON.stringify(J.issues,$0,2)}},isEmpty:{get(){return J.issues.length===0}}})},j5=D("ZodError",QJ),f=D("ZodError",QJ,{Parent:Error});var wJ=n0(f),GJ=i0(f),UJ=T0(f),DJ=h0(f),PJ=m4(f),BJ=f4(f),MJ=o4(f),FJ=l4(f),IJ=r4(f),$J=p4(f),AJ=d4(f),OJ=n4(f);var S=D("ZodType",(J,X)=>{return L.init(J,X),Object.assign(J["~standard"],{jsonSchema:{input:g0(J,"input"),output:g0(J,"output")}}),J.toJSONSchema=C2(J,{}),J.def=X,J.type=X.type,Object.defineProperty(J,"_def",{value:X}),J.check=(...H)=>{return J.clone(V.mergeDefs(X,{checks:[...X.checks??[],...H.map((W)=>typeof W==="function"?{_zod:{check:W,def:{check:"custom"},onattach:[]}}:W)]}))},J.clone=(H,W)=>d(J,H,W),J.brand=()=>J,J.register=(H,W)=>{return H.add(J,W),J},J.parse=(H,W)=>wJ(J,H,W,{callee:J.parse}),J.safeParse=(H,W)=>UJ(J,H,W),J.parseAsync=async(H,W)=>GJ(J,H,W,{callee:J.parseAsync}),J.safeParseAsync=async(H,W)=>DJ(J,H,W),J.spa=J.safeParseAsync,J.encode=(H,W)=>PJ(J,H,W),J.decode=(H,W)=>BJ(J,H,W),J.encodeAsync=async(H,W)=>MJ(J,H,W),J.decodeAsync=async(H,W)=>FJ(J,H,W),J.safeEncode=(H,W)=>IJ(J,H,W),J.safeDecode=(H,W)=>$J(J,H,W),J.safeEncodeAsync=async(H,W)=>AJ(J,H,W),J.safeDecodeAsync=async(H,W)=>OJ(J,H,W),J.refine=(H,W)=>J.check(IH(H,W)),J.superRefine=(H)=>J.check($H(H)),J.overwrite=(H)=>J.check(G0(H)),J.optional=()=>NJ(J),J.nullable=()=>ZJ(J),J.nullish=()=>NJ(ZJ(J)),J.nonoptional=(H)=>GH(J,H),J.array=()=>J4(J),J.or=(H)=>sX([J,H]),J.and=(H)=>JH(J,H),J.transform=(H)=>LJ(J,WH(H)),J.default=(H)=>zH(J,H),J.prefault=(H)=>wH(J,H),J.catch=(H)=>DH(J,H),J.pipe=(H)=>LJ(J,H),J.readonly=()=>MH(J),J.describe=(H)=>{let W=J.clone();return P0.add(W,{description:H}),W},Object.defineProperty(J,"description",{get(){return P0.get(J)?.description},configurable:!0}),J.meta=(...H)=>{if(H.length===0)return P0.get(J);let W=J.clone();return P0.add(W,H[0]),W},J.isOptional=()=>J.safeParse(void 0).success,J.isNullable=()=>J.safeParse(null).success,J}),bJ=D("_ZodString",(J,X)=>{e0.init(J,X),S.init(J,X),J._zod.processJSONSchema=(W,q,Y)=>S2(J,W,q,Y);let H=J._zod.bag;J.format=H.format??null,J.minLength=H.minimum??null,J.maxLength=H.maximum??null,J.regex=(...W)=>J.check(v1(...W)),J.includes=(...W)=>J.check(c1(...W)),J.startsWith=(...W)=>J.check(u1(...W)),J.endsWith=(...W)=>J.check(y1(...W)),J.min=(...W)=>J.check(K0(...W)),J.max=(...W)=>J.check(J1(...W)),J.length=(...W)=>J.check(X1(...W)),J.nonempty=(...W)=>J.check(K0(1,...W)),J.lowercase=(W)=>J.check(x1(W)),J.uppercase=(W)=>J.check(g1(W)),J.trim=()=>J.check(f1()),J.normalize=(...W)=>J.check(m1(...W)),J.toLowerCase=()=>J.check(o1()),J.toUpperCase=()=>J.check(l1()),J.slugify=()=>J.check(r1())}),t1=D("ZodString",(J,X)=>{e0.init(J,X),bJ.init(J,X),J.email=(H)=>J.check(r8(_X,H)),J.url=(H)=>J.check(t8(EX,H)),J.jwt=(H)=>J.check(D2(oX,H)),J.emoji=(H)=>J.check(a8(kX,H)),J.guid=(H)=>J.check(h1(VJ,H)),J.uuid=(H)=>J.check(p8(H1,H)),J.uuidv4=(H)=>J.check(d8(H1,H)),J.uuidv6=(H)=>J.check(n8(H1,H)),J.uuidv7=(H)=>J.check(i8(H1,H)),J.nanoid=(H)=>J.check(s8(CX,H)),J.guid=(H)=>J.check(h1(VJ,H)),J.cuid=(H)=>J.check(e8(SX,H)),J.cuid2=(H)=>J.check(J2(jX,H)),J.ulid=(H)=>J.check(X2(TX,H)),J.base64=(H)=>J.check(w2(yX,H)),J.base64url=(H)=>J.check(G2(mX,H)),J.xid=(H)=>J.check(H2(hX,H)),J.ksuid=(H)=>J.check(W2(vX,H)),J.ipv4=(H)=>J.check(q2(xX,H)),J.ipv6=(H)=>J.check(Y2(gX,H)),J.cidrv4=(H)=>J.check(z2(cX,H)),J.cidrv6=(H)=>J.check(Q2(uX,H)),J.e164=(H)=>J.check(U2(fX,H)),J.datetime=(H)=>J.check(XJ(H)),J.date=(H)=>J.check(HJ(H)),J.time=(H)=>J.check(WJ(H)),J.duration=(H)=>J.check(qJ(H))});function _(J){return o8(t1,J)}var C=D("ZodStringFormat",(J,X)=>{b.init(J,X),bJ.init(J,X)}),_X=D("ZodEmail",(J,X)=>{n6.init(J,X),C.init(J,X)});var VJ=D("ZodGUID",(J,X)=>{p6.init(J,X),C.init(J,X)});var H1=D("ZodUUID",(J,X)=>{d6.init(J,X),C.init(J,X)});var EX=D("ZodURL",(J,X)=>{i6.init(J,X),C.init(J,X)});var kX=D("ZodEmoji",(J,X)=>{t6.init(J,X),C.init(J,X)});var CX=D("ZodNanoID",(J,X)=>{a6.init(J,X),C.init(J,X)});var SX=D("ZodCUID",(J,X)=>{s6.init(J,X),C.init(J,X)});var jX=D("ZodCUID2",(J,X)=>{e6.init(J,X),C.init(J,X)});var TX=D("ZodULID",(J,X)=>{J8.init(J,X),C.init(J,X)});var hX=D("ZodXID",(J,X)=>{X8.init(J,X),C.init(J,X)});var vX=D("ZodKSUID",(J,X)=>{H8.init(J,X),C.init(J,X)});var xX=D("ZodIPv4",(J,X)=>{Q8.init(J,X),C.init(J,X)});var gX=D("ZodIPv6",(J,X)=>{w8.init(J,X),C.init(J,X)});var cX=D("ZodCIDRv4",(J,X)=>{G8.init(J,X),C.init(J,X)});var uX=D("ZodCIDRv6",(J,X)=>{U8.init(J,X),C.init(J,X)});var yX=D("ZodBase64",(J,X)=>{P8.init(J,X),C.init(J,X)});var mX=D("ZodBase64URL",(J,X)=>{B8.init(J,X),C.init(J,X)});var fX=D("ZodE164",(J,X)=>{M8.init(J,X),C.init(J,X)});var oX=D("ZodJWT",(J,X)=>{F8.init(J,X),C.init(J,X)});var W1=D("ZodNumber",(J,X)=>{j1.init(J,X),S.init(J,X),J._zod.processJSONSchema=(W,q,Y)=>j2(J,W,q,Y),J.gt=(W,q)=>J.check(V0(W,q)),J.gte=(W,q)=>J.check(i(W,q)),J.min=(W,q)=>J.check(i(W,q)),J.lt=(W,q)=>J.check(O0(W,q)),J.lte=(W,q)=>J.check(H0(W,q)),J.max=(W,q)=>J.check(H0(W,q)),J.int=(W)=>J.check(KJ(W)),J.safe=(W)=>J.check(KJ(W)),J.positive=(W)=>J.check(V0(0,W)),J.nonnegative=(W)=>J.check(i(0,W)),J.negative=(W)=>J.check(O0(0,W)),J.nonpositive=(W)=>J.check(H0(0,W)),J.multipleOf=(W,q)=>J.check(x0(W,q)),J.step=(W,q)=>J.check(x0(W,q)),J.finite=()=>J;let H=J._zod.bag;J.minValue=Math.max(H.minimum??Number.NEGATIVE_INFINITY,H.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,J.maxValue=Math.min(H.maximum??Number.POSITIVE_INFINITY,H.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,J.isInt=(H.format??"").includes("int")||Number.isSafeInteger(H.multipleOf??0.5),J.isFinite=!0,J.format=H.format??null});function B0(J){return I2(W1,J)}var lX=D("ZodNumberFormat",(J,X)=>{I8.init(J,X),W1.init(J,X)});function KJ(J){return A2(lX,J)}var a1=D("ZodBoolean",(J,X)=>{$8.init(J,X),S.init(J,X),J._zod.processJSONSchema=(H,W,q)=>T2(J,H,W,q)});function _J(J){return O2(a1,J)}var EJ=D("ZodBigInt",(J,X)=>{A8.init(J,X),S.init(J,X),J._zod.processJSONSchema=(W,q,Y)=>h2(J,W,q,Y),J.gte=(W,q)=>J.check(i(W,q)),J.min=(W,q)=>J.check(i(W,q)),J.gt=(W,q)=>J.check(V0(W,q)),J.gte=(W,q)=>J.check(i(W,q)),J.min=(W,q)=>J.check(i(W,q)),J.lt=(W,q)=>J.check(O0(W,q)),J.lte=(W,q)=>J.check(H0(W,q)),J.max=(W,q)=>J.check(H0(W,q)),J.positive=(W)=>J.check(V0(BigInt(0),W)),J.negative=(W)=>J.check(O0(BigInt(0),W)),J.nonpositive=(W)=>J.check(H0(BigInt(0),W)),J.nonnegative=(W)=>J.check(i(BigInt(0),W)),J.multipleOf=(W,q)=>J.check(x0(W,q));let H=J._zod.bag;J.minValue=H.minimum??null,J.maxValue=H.maximum??null,J.format=H.format??null});var rX=D("ZodAny",(J,X)=>{O8.init(J,X),S.init(J,X),J._zod.processJSONSchema=(H,W,q)=>x2(J,H,W,q)});function q1(){return R2(rX)}var pX=D("ZodUnknown",(J,X)=>{V8.init(J,X),S.init(J,X),J._zod.processJSONSchema=(H,W,q)=>g2(J,H,W,q)});function RJ(){return N2(pX)}var dX=D("ZodNever",(J,X)=>{K8.init(J,X),S.init(J,X),J._zod.processJSONSchema=(H,W,q)=>v2(J,H,W,q)});function nX(J){return Z2(dX,J)}var s1=D("ZodDate",(J,X)=>{R8.init(J,X),S.init(J,X),J._zod.processJSONSchema=(W,q,Y)=>c2(J,W,q,Y),J.min=(W,q)=>J.check(i(W,q)),J.max=(W,q)=>J.check(H0(W,q));let H=J._zod.bag;J.minDate=H.minimum?new Date(H.minimum):null,J.maxDate=H.maximum?new Date(H.maximum):null});function e1(J){return L2(s1,J)}var iX=D("ZodArray",(J,X)=>{N8.init(J,X),S.init(J,X),J._zod.processJSONSchema=(H,W,q)=>f2(J,H,W,q),J.element=X.element,J.min=(H,W)=>J.check(K0(H,W)),J.nonempty=(H)=>J.check(K0(1,H)),J.max=(H,W)=>J.check(J1(H,W)),J.length=(H,W)=>J.check(X1(H,W)),J.unwrap=()=>J.element});function J4(J,X){return _2(iX,J,X)}var tX=D("ZodObject",(J,X)=>{b8.init(J,X),S.init(J,X),J._zod.processJSONSchema=(H,W,q)=>o2(J,H,W,q),V.defineLazy(J,"shape",()=>{return X.shape}),J.keyof=()=>H4(Object.keys(J._zod.def.shape)),J.catchall=(H)=>J.clone({...J._zod.def,catchall:H}),J.passthrough=()=>J.clone({...J._zod.def,catchall:RJ()}),J.loose=()=>J.clone({...J._zod.def,catchall:RJ()}),J.strict=()=>J.clone({...J._zod.def,catchall:nX()}),J.strip=()=>J.clone({...J._zod.def,catchall:void 0}),J.extend=(H)=>{return V.extend(J,H)},J.safeExtend=(H)=>{return V.safeExtend(J,H)},J.merge=(H)=>V.merge(J,H),J.pick=(H)=>V.pick(J,H),J.omit=(H)=>V.omit(J,H),J.partial=(...H)=>V.partial(CJ,J,H[0]),J.required=(...H)=>V.required(SJ,J,H[0])});function kJ(J,X){let H={type:"object",shape:J??{},...V.normalizeParams(X)};return new tX(H)}var aX=D("ZodUnion",(J,X)=>{_8.init(J,X),S.init(J,X),J._zod.processJSONSchema=(H,W,q)=>l2(J,H,W,q),J.options=X.options});function sX(J,X){return new aX({type:"union",options:J,...V.normalizeParams(X)})}var eX=D("ZodIntersection",(J,X)=>{E8.init(J,X),S.init(J,X),J._zod.processJSONSchema=(H,W,q)=>r2(J,H,W,q)});function JH(J,X){return new eX({type:"intersection",left:J,right:X})}var XH=D("ZodRecord",(J,X)=>{k8.init(J,X),S.init(J,X),J._zod.processJSONSchema=(H,W,q)=>p2(J,H,W,q),J.keyType=X.keyType,J.valueType=X.valueType});function X4(J,X,H){return new XH({type:"record",keyType:J,valueType:X,...V.normalizeParams(H)})}var i1=D("ZodEnum",(J,X)=>{C8.init(J,X),S.init(J,X),J._zod.processJSONSchema=(W,q,Y)=>u2(J,W,q,Y),J.enum=X.entries,J.options=Object.values(X.entries);let H=new Set(Object.keys(X.entries));J.extract=(W,q)=>{let Y={};for(let z of W)if(H.has(z))Y[z]=X.entries[z];else throw Error(`Key ${z} not found in enum`);return new i1({...X,checks:[],...V.normalizeParams(q),entries:Y})},J.exclude=(W,q)=>{let Y={...X.entries};for(let z of W)if(H.has(z))delete Y[z];else throw Error(`Key ${z} not found in enum`);return new i1({...X,checks:[],...V.normalizeParams(q),entries:Y})}});function H4(J,X){let H=Array.isArray(J)?Object.fromEntries(J.map((W)=>[W,W])):J;return new i1({type:"enum",entries:H,...V.normalizeParams(X)})}var HH=D("ZodTransform",(J,X)=>{S8.init(J,X),S.init(J,X),J._zod.processJSONSchema=(H,W,q)=>m2(J,H,W,q),J._zod.parse=(H,W)=>{if(W.direction==="backward")throw new b0(J.constructor.name);H.addIssue=(Y)=>{if(typeof Y==="string")H.issues.push(V.issue(Y,H.value,X));else{let z=Y;if(z.fatal)z.continue=!1;z.code??(z.code="custom"),z.input??(z.input=H.value),z.inst??(z.inst=J),H.issues.push(V.issue(z))}};let q=X.transform(H.value,H);if(q instanceof Promise)return q.then((Y)=>{return H.value=Y,H});return H.value=q,H}});function WH(J){return new HH({type:"transform",transform:J})}var CJ=D("ZodOptional",(J,X)=>{j8.init(J,X),S.init(J,X),J._zod.processJSONSchema=(H,W,q)=>JJ(J,H,W,q),J.unwrap=()=>J._zod.def.innerType});function NJ(J){return new CJ({type:"optional",innerType:J})}var qH=D("ZodNullable",(J,X)=>{T8.init(J,X),S.init(J,X),J._zod.processJSONSchema=(H,W,q)=>d2(J,H,W,q),J.unwrap=()=>J._zod.def.innerType});function ZJ(J){return new qH({type:"nullable",innerType:J})}var YH=D("ZodDefault",(J,X)=>{h8.init(J,X),S.init(J,X),J._zod.processJSONSchema=(H,W,q)=>i2(J,H,W,q),J.unwrap=()=>J._zod.def.innerType,J.removeDefault=J.unwrap});function zH(J,X){return new YH({type:"default",innerType:J,get defaultValue(){return typeof X==="function"?X():V.shallowClone(X)}})}var QH=D("ZodPrefault",(J,X)=>{v8.init(J,X),S.init(J,X),J._zod.processJSONSchema=(H,W,q)=>t2(J,H,W,q),J.unwrap=()=>J._zod.def.innerType});function wH(J,X){return new QH({type:"prefault",innerType:J,get defaultValue(){return typeof X==="function"?X():V.shallowClone(X)}})}var SJ=D("ZodNonOptional",(J,X)=>{x8.init(J,X),S.init(J,X),J._zod.processJSONSchema=(H,W,q)=>n2(J,H,W,q),J.unwrap=()=>J._zod.def.innerType});function GH(J,X){return new SJ({type:"nonoptional",innerType:J,...V.normalizeParams(X)})}var UH=D("ZodCatch",(J,X)=>{g8.init(J,X),S.init(J,X),J._zod.processJSONSchema=(H,W,q)=>a2(J,H,W,q),J.unwrap=()=>J._zod.def.innerType,J.removeCatch=J.unwrap});function DH(J,X){return new UH({type:"catch",innerType:J,catchValue:typeof X==="function"?X:()=>X})}var PH=D("ZodPipe",(J,X)=>{c8.init(J,X),S.init(J,X),J._zod.processJSONSchema=(H,W,q)=>s2(J,H,W,q),J.in=X.in,J.out=X.out});function LJ(J,X){return new PH({type:"pipe",in:J,out:X})}var BH=D("ZodReadonly",(J,X)=>{u8.init(J,X),S.init(J,X),J._zod.processJSONSchema=(H,W,q)=>e2(J,H,W,q),J.unwrap=()=>J._zod.def.innerType});function MH(J){return new BH({type:"readonly",innerType:J})}var FH=D("ZodCustom",(J,X)=>{y8.init(J,X),S.init(J,X),J._zod.processJSONSchema=(H,W,q)=>y2(J,H,W,q)});function IH(J,X={}){return E2(FH,J,X)}function $H(J){return k2(J)}var N0={};_4(N0,{string:()=>AH,number:()=>OH,date:()=>RH,boolean:()=>VH,bigint:()=>KH});function AH(J){return l8(t1,J)}function OH(J){return $2(W1,J)}function VH(J){return V2(a1,J)}function KH(J){return K2(EJ,J)}function RH(J){return b2(s1,J)}r(T1());function t(J,X){if(!Boolean(J))throw Error(X)}function Y1(J){return typeof J=="object"&&J!==null}function jJ(J,X){if(!Boolean(J))throw Error(X!=null?X:"Unexpected invariant triggered.")}var NH=/\r\n|[\n\r]/g;function Z0(J,X){let H=0,W=1;for(let q of J.body.matchAll(NH)){if(typeof q.index==="number"||jJ(!1),q.index>=X)break;H=q.index+q[0].length,W+=1}return{line:W,column:X+1-H}}function W4(J){return z1(J.source,Z0(J.source,J.start))}function z1(J,X){let H=J.locationOffset.column-1,W="".padStart(H)+J.body,q=X.line-1,Y=J.locationOffset.line-1,z=X.line+Y,Q=X.line===1?H:0,U=X.column+Q,G=`${J.name}:${z}:${U}
|
|
23
|
-
`,
|
|
24
|
-
`)}function
|
|
39
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let Q of J.seen.entries()){let z=Q[1];if(X===Q[0]){Y(Q);continue}if(J.external){let w=J.external.registry.get(Q[0])?.id;if(X!==Q[0]&&w){Y(Q);continue}}if(J.metadataRegistry.get(Q[0])?.id){Y(Q);continue}if(z.cycle){Y(Q);continue}if(z.count>1){if(J.reused==="ref"){Y(Q);continue}}}}function X8(J,X){let H=J.seen.get(X);if(!H)throw Error("Unprocessed schema. This is a bug in Zod.");let W=(Q)=>{let z=J.seen.get(Q);if(z.ref===null)return;let U=z.def??z.schema,w={...U},M=z.ref;if(z.ref=null,M){W(M);let V=J.seen.get(M),A=V.schema;if(A.$ref&&(J.target==="draft-07"||J.target==="draft-04"||J.target==="openapi-3.0"))U.allOf=U.allOf??[],U.allOf.push(A);else Object.assign(U,A);if(Object.assign(U,w),Q._zod.parent===M)for(let O in U){if(O==="$ref"||O==="allOf")continue;if(!(O in w))delete U[O]}if(A.$ref)for(let O in U){if(O==="$ref"||O==="allOf")continue;if(O in V.def&&JSON.stringify(U[O])===JSON.stringify(V.def[O]))delete U[O]}}let F=Q._zod.parent;if(F&&F!==M){W(F);let V=J.seen.get(F);if(V?.schema.$ref){if(U.$ref=V.schema.$ref,V.def)for(let A in U){if(A==="$ref"||A==="allOf")continue;if(A in V.def&&JSON.stringify(U[A])===JSON.stringify(V.def[A]))delete U[A]}}}J.override({zodSchema:Q,jsonSchema:U,path:z.path??[]})};for(let Q of[...J.seen.entries()].reverse())W(Q[0]);let q={};if(J.target==="draft-2020-12")q.$schema="https://json-schema.org/draft/2020-12/schema";else if(J.target==="draft-07")q.$schema="http://json-schema.org/draft-07/schema#";else if(J.target==="draft-04")q.$schema="http://json-schema.org/draft-04/schema#";else if(J.target==="openapi-3.0");if(J.external?.uri){let Q=J.external.registry.get(X)?.id;if(!Q)throw Error("Schema is missing an `id` property");q.$id=J.external.uri(Q)}Object.assign(q,H.def??H.schema);let Y=J.external?.defs??{};for(let Q of J.seen.entries()){let z=Q[1];if(z.def&&z.defId)Y[z.defId]=z.def}if(J.external);else if(Object.keys(Y).length>0)if(J.target==="draft-2020-12")q.$defs=Y;else q.definitions=Y;try{let Q=JSON.parse(JSON.stringify(q));return Object.defineProperty(Q,"~standard",{value:{...X["~standard"],jsonSchema:{input:u0(X,"input",J.processors),output:u0(X,"output",J.processors)}},enumerable:!1,writable:!1}),Q}catch(Q){throw Error("Error converting schema to JSON.")}}function f(J,X){let H=X??{seen:new Set};if(H.seen.has(J))return!1;H.seen.add(J);let W=J._zod.def;if(W.type==="transform")return!0;if(W.type==="array")return f(W.element,H);if(W.type==="set")return f(W.valueType,H);if(W.type==="lazy")return f(W.getter(),H);if(W.type==="promise"||W.type==="optional"||W.type==="nonoptional"||W.type==="nullable"||W.type==="readonly"||W.type==="default"||W.type==="prefault")return f(W.innerType,H);if(W.type==="intersection")return f(W.left,H)||f(W.right,H);if(W.type==="record"||W.type==="map")return f(W.keyType,H)||f(W.valueType,H);if(W.type==="pipe")return f(W.in,H)||f(W.out,H);if(W.type==="object"){for(let q in W.shape)if(f(W.shape[q],H))return!0;return!1}if(W.type==="union"){for(let q of W.options)if(f(q,H))return!0;return!1}if(W.type==="tuple"){for(let q of W.items)if(f(q,H))return!0;if(W.rest&&f(W.rest,H))return!0;return!1}return!1}var vJ=(J,X={})=>(H)=>{let W=e1({...H,processors:X});return g(J,W),J8(W,J),X8(W,J)},u0=(J,X,H={})=>(W)=>{let{libraryOptions:q,target:Y}=W??{},Q=e1({...q??{},target:Y,io:X,processors:H});return g(J,Q),J8(Q,J),X8(Q,J)};var LX={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},gJ=(J,X,H,W)=>{let q=H;q.type="string";let{minimum:Y,maximum:Q,format:z,patterns:U,contentEncoding:w}=J._zod.bag;if(typeof Y==="number")q.minLength=Y;if(typeof Q==="number")q.maxLength=Q;if(z){if(q.format=LX[z]??z,q.format==="")delete q.format;if(z==="time")delete q.format}if(w)q.contentEncoding=w;if(U&&U.size>0){let M=[...U];if(M.length===1)q.pattern=M[0].source;else if(M.length>1)q.allOf=[...M.map((F)=>({...X.target==="draft-07"||X.target==="draft-04"||X.target==="openapi-3.0"?{type:"string"}:{},pattern:F.source}))]}},uJ=(J,X,H,W)=>{let q=H,{minimum:Y,maximum:Q,format:z,multipleOf:U,exclusiveMaximum:w,exclusiveMinimum:M}=J._zod.bag;if(typeof z==="string"&&z.includes("int"))q.type="integer";else q.type="number";if(typeof M==="number")if(X.target==="draft-04"||X.target==="openapi-3.0")q.minimum=M,q.exclusiveMinimum=!0;else q.exclusiveMinimum=M;if(typeof Y==="number"){if(q.minimum=Y,typeof M==="number"&&X.target!=="draft-04")if(M>=Y)delete q.minimum;else delete q.exclusiveMinimum}if(typeof w==="number")if(X.target==="draft-04"||X.target==="openapi-3.0")q.maximum=w,q.exclusiveMaximum=!0;else q.exclusiveMaximum=w;if(typeof Q==="number"){if(q.maximum=Q,typeof w==="number"&&X.target!=="draft-04")if(w<=Q)delete q.maximum;else delete q.exclusiveMaximum}if(typeof U==="number")q.multipleOf=U},yJ=(J,X,H,W)=>{H.type="boolean"},mJ=(J,X,H,W)=>{if(X.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema")};var cJ=(J,X,H,W)=>{H.not={}},fJ=(J,X,H,W)=>{},oJ=(J,X,H,W)=>{},lJ=(J,X,H,W)=>{if(X.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema")},pJ=(J,X,H,W)=>{let q=J._zod.def,Y=D0(q.entries);if(Y.every((Q)=>typeof Q==="number"))H.type="number";if(Y.every((Q)=>typeof Q==="string"))H.type="string";H.enum=Y};var rJ=(J,X,H,W)=>{if(X.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")};var dJ=(J,X,H,W)=>{if(X.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")};var nJ=(J,X,H,W)=>{let q=H,Y=J._zod.def,{minimum:Q,maximum:z}=J._zod.bag;if(typeof Q==="number")q.minItems=Q;if(typeof z==="number")q.maxItems=z;q.type="array",q.items=g(Y.element,X,{...W,path:[...W.path,"items"]})},iJ=(J,X,H,W)=>{let q=H,Y=J._zod.def;q.type="object",q.properties={};let Q=Y.shape;for(let w in Q)q.properties[w]=g(Q[w],X,{...W,path:[...W.path,"properties",w]});let z=new Set(Object.keys(Q)),U=new Set([...z].filter((w)=>{let M=Y.shape[w]._zod;if(X.io==="input")return M.optin===void 0;else return M.optout===void 0}));if(U.size>0)q.required=Array.from(U);if(Y.catchall?._zod.def.type==="never")q.additionalProperties=!1;else if(!Y.catchall){if(X.io==="output")q.additionalProperties=!1}else if(Y.catchall)q.additionalProperties=g(Y.catchall,X,{...W,path:[...W.path,"additionalProperties"]})},tJ=(J,X,H,W)=>{let q=J._zod.def,Y=q.inclusive===!1,Q=q.options.map((z,U)=>g(z,X,{...W,path:[...W.path,Y?"oneOf":"anyOf",U]}));if(Y)H.oneOf=Q;else H.anyOf=Q},aJ=(J,X,H,W)=>{let q=J._zod.def,Y=g(q.left,X,{...W,path:[...W.path,"allOf",0]}),Q=g(q.right,X,{...W,path:[...W.path,"allOf",1]}),z=(w)=>("allOf"in w)&&Object.keys(w).length===1,U=[...z(Y)?Y.allOf:[Y],...z(Q)?Q.allOf:[Q]];H.allOf=U};var sJ=(J,X,H,W)=>{let q=H,Y=J._zod.def;if(q.type="object",X.target==="draft-07"||X.target==="draft-2020-12")q.propertyNames=g(Y.keyType,X,{...W,path:[...W.path,"propertyNames"]});q.additionalProperties=g(Y.valueType,X,{...W,path:[...W.path,"additionalProperties"]});let Q=Y.keyType._zod.def;if(Q.type==="enum"){let U=D0(Q.entries).filter((w)=>typeof w==="string"||typeof w==="number");if(U.length>0)q.required=U}},eJ=(J,X,H,W)=>{let q=J._zod.def,Y=g(q.innerType,X,W),Q=X.seen.get(J);if(X.target==="openapi-3.0")Q.ref=q.innerType,H.nullable=!0;else H.anyOf=[Y,{type:"null"}]},J4=(J,X,H,W)=>{let q=J._zod.def;g(q.innerType,X,W);let Y=X.seen.get(J);Y.ref=q.innerType},X4=(J,X,H,W)=>{let q=J._zod.def;g(q.innerType,X,W);let Y=X.seen.get(J);Y.ref=q.innerType,H.default=JSON.parse(JSON.stringify(q.defaultValue))},H4=(J,X,H,W)=>{let q=J._zod.def;g(q.innerType,X,W);let Y=X.seen.get(J);if(Y.ref=q.innerType,X.io==="input")H._prefault=JSON.parse(JSON.stringify(q.defaultValue))},W4=(J,X,H,W)=>{let q=J._zod.def;g(q.innerType,X,W);let Y=X.seen.get(J);Y.ref=q.innerType;let Q;try{Q=q.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}H.default=Q},q4=(J,X,H,W)=>{let q=J._zod.def,Y=X.io==="input"?q.in._zod.def.type==="transform"?q.out:q.in:q.out;g(Y,X,W);let Q=X.seen.get(J);Q.ref=Y},Y4=(J,X,H,W)=>{let q=J._zod.def;g(q.innerType,X,W);let Y=X.seen.get(J);Y.ref=q.innerType,H.readOnly=!0};var H8=(J,X,H,W)=>{let q=J._zod.def;g(q.innerType,X,W);let Y=X.seen.get(J);Y.ref=q.innerType};var TX=P("ZodISODateTime",(J,X)=>{G9.init(J,X),_.init(J,X)});function Q4(J){return DJ(TX,J)}var jX=P("ZodISODate",(J,X)=>{U9.init(J,X),_.init(J,X)});function z4(J){return KJ(jX,J)}var _X=P("ZodISOTime",(J,X)=>{P9.init(J,X),_.init(J,X)});function w4(J){return IJ(_X,J)}var hX=P("ZodISODuration",(J,X)=>{M9.init(J,X),_.init(J,X)});function G4(J){return OJ(hX,J)}var M4=(J,X)=>{i0.init(J,X),J.name="ZodError",Object.defineProperties(J,{format:{value:(H)=>p8(J,H)},flatten:{value:(H)=>l8(J,H)},addIssue:{value:(H)=>{J.issues.push(H),J.message=JSON.stringify(J.issues,K0,2)}},addIssues:{value:(H)=>{J.issues.push(...H),J.message=JSON.stringify(J.issues,K0,2)}},isEmpty:{get(){return J.issues.length===0}}})},Kq=P("ZodError",M4),l=P("ZodError",M4,{Parent:Error});var F4=t0(l),A4=a0(l),$4=h0(l),V4=x0(l),B4=n8(l),D4=i8(l),K4=t8(l),I4=a8(l),O4=s8(l),R4=e8(l),L4=J2(l),Z4=X2(l);var k=P("ZodType",(J,X)=>{return C.init(J,X),Object.assign(J["~standard"],{jsonSchema:{input:u0(J,"input"),output:u0(J,"output")}}),J.toJSONSchema=vJ(J,{}),J.def=X,J.type=X.type,Object.defineProperty(J,"_def",{value:X}),J.check=(...H)=>{return J.clone(L.mergeDefs(X,{checks:[...X.checks??[],...H.map((W)=>typeof W==="function"?{_zod:{check:W,def:{check:"custom"},onattach:[]}}:W)]}),{parent:!0})},J.with=J.check,J.clone=(H,W)=>i(J,H,W),J.brand=()=>J,J.register=(H,W)=>{return H.add(J,W),J},J.parse=(H,W)=>F4(J,H,W,{callee:J.parse}),J.safeParse=(H,W)=>$4(J,H,W),J.parseAsync=async(H,W)=>A4(J,H,W,{callee:J.parseAsync}),J.safeParseAsync=async(H,W)=>V4(J,H,W),J.spa=J.safeParseAsync,J.encode=(H,W)=>B4(J,H,W),J.decode=(H,W)=>D4(J,H,W),J.encodeAsync=async(H,W)=>K4(J,H,W),J.decodeAsync=async(H,W)=>I4(J,H,W),J.safeEncode=(H,W)=>O4(J,H,W),J.safeDecode=(H,W)=>R4(J,H,W),J.safeEncodeAsync=async(H,W)=>L4(J,H,W),J.safeDecodeAsync=async(H,W)=>Z4(J,H,W),J.refine=(H,W)=>J.check(EH(H,W)),J.superRefine=(H)=>J.check(CH(H)),J.overwrite=(H)=>J.check(U0(H)),J.optional=()=>C4(J),J.exactOptional=()=>AH(J),J.nullable=()=>S4(J),J.nullish=()=>C4(S4(J)),J.nonoptional=(H)=>IH(J,H),J.array=()=>w8(J),J.or=(H)=>zH([J,H]),J.and=(H)=>GH(J,H),J.transform=(H)=>k4(J,MH(H)),J.default=(H)=>BH(J,H),J.prefault=(H)=>KH(J,H),J.catch=(H)=>RH(J,H),J.pipe=(H)=>k4(J,H),J.readonly=()=>NH(J),J.describe=(H)=>{let W=J.clone();return F0.add(W,{description:H}),W},Object.defineProperty(J,"description",{get(){return F0.get(J)?.description},configurable:!0}),J.meta=(...H)=>{if(H.length===0)return F0.get(J);let W=J.clone();return F0.add(W,H[0]),W},J.isOptional=()=>J.safeParse(void 0).success,J.isNullable=()=>J.safeParse(null).success,J.apply=(H)=>H(J),J}),T4=P("_ZodString",(J,X)=>{H1.init(J,X),k.init(J,X),J._zod.processJSONSchema=(W,q,Y)=>gJ(J,W,q,Y);let H=J._zod.bag;J.format=H.format??null,J.minLength=H.minimum??null,J.maxLength=H.maximum??null,J.regex=(...W)=>J.check(f1(...W)),J.includes=(...W)=>J.check(p1(...W)),J.startsWith=(...W)=>J.check(r1(...W)),J.endsWith=(...W)=>J.check(d1(...W)),J.min=(...W)=>J.check(L0(...W)),J.max=(...W)=>J.check(W1(...W)),J.length=(...W)=>J.check(q1(...W)),J.nonempty=(...W)=>J.check(L0(1,...W)),J.lowercase=(W)=>J.check(o1(W)),J.uppercase=(W)=>J.check(l1(W)),J.trim=()=>J.check(i1()),J.normalize=(...W)=>J.check(n1(...W)),J.toLowerCase=()=>J.check(t1()),J.toUpperCase=()=>J.check(a1()),J.slugify=()=>J.check(s1())}),q8=P("ZodString",(J,X)=>{H1.init(J,X),T4.init(J,X),J.email=(H)=>J.check(a9(vX,H)),J.url=(H)=>J.check(HJ(gX,H)),J.jwt=(H)=>J.check(BJ(sX,H)),J.emoji=(H)=>J.check(WJ(uX,H)),J.guid=(H)=>J.check(c1(N4,H)),J.uuid=(H)=>J.check(s9(Y1,H)),J.uuidv4=(H)=>J.check(e9(Y1,H)),J.uuidv6=(H)=>J.check(JJ(Y1,H)),J.uuidv7=(H)=>J.check(XJ(Y1,H)),J.nanoid=(H)=>J.check(qJ(yX,H)),J.guid=(H)=>J.check(c1(N4,H)),J.cuid=(H)=>J.check(YJ(mX,H)),J.cuid2=(H)=>J.check(QJ(cX,H)),J.ulid=(H)=>J.check(zJ(fX,H)),J.base64=(H)=>J.check(AJ(iX,H)),J.base64url=(H)=>J.check($J(tX,H)),J.xid=(H)=>J.check(wJ(oX,H)),J.ksuid=(H)=>J.check(GJ(lX,H)),J.ipv4=(H)=>J.check(UJ(pX,H)),J.ipv6=(H)=>J.check(PJ(rX,H)),J.cidrv4=(H)=>J.check(MJ(dX,H)),J.cidrv6=(H)=>J.check(FJ(nX,H)),J.e164=(H)=>J.check(VJ(aX,H)),J.datetime=(H)=>J.check(Q4(H)),J.date=(H)=>J.check(z4(H)),J.time=(H)=>J.check(w4(H)),J.duration=(H)=>J.check(G4(H))});function T(J){return i9(q8,J)}var _=P("ZodStringFormat",(J,X)=>{S.init(J,X),T4.init(J,X)}),vX=P("ZodEmail",(J,X)=>{J9.init(J,X),_.init(J,X)});var N4=P("ZodGUID",(J,X)=>{s2.init(J,X),_.init(J,X)});var Y1=P("ZodUUID",(J,X)=>{e2.init(J,X),_.init(J,X)});var gX=P("ZodURL",(J,X)=>{X9.init(J,X),_.init(J,X)});var uX=P("ZodEmoji",(J,X)=>{H9.init(J,X),_.init(J,X)});var yX=P("ZodNanoID",(J,X)=>{W9.init(J,X),_.init(J,X)});var mX=P("ZodCUID",(J,X)=>{q9.init(J,X),_.init(J,X)});var cX=P("ZodCUID2",(J,X)=>{Y9.init(J,X),_.init(J,X)});var fX=P("ZodULID",(J,X)=>{Q9.init(J,X),_.init(J,X)});var oX=P("ZodXID",(J,X)=>{z9.init(J,X),_.init(J,X)});var lX=P("ZodKSUID",(J,X)=>{w9.init(J,X),_.init(J,X)});var pX=P("ZodIPv4",(J,X)=>{F9.init(J,X),_.init(J,X)});var rX=P("ZodIPv6",(J,X)=>{A9.init(J,X),_.init(J,X)});var dX=P("ZodCIDRv4",(J,X)=>{$9.init(J,X),_.init(J,X)});var nX=P("ZodCIDRv6",(J,X)=>{V9.init(J,X),_.init(J,X)});var iX=P("ZodBase64",(J,X)=>{D9.init(J,X),_.init(J,X)});var tX=P("ZodBase64URL",(J,X)=>{K9.init(J,X),_.init(J,X)});var aX=P("ZodE164",(J,X)=>{I9.init(J,X),_.init(J,X)});var sX=P("ZodJWT",(J,X)=>{O9.init(J,X),_.init(J,X)});var Q1=P("ZodNumber",(J,X)=>{u1.init(J,X),k.init(J,X),J._zod.processJSONSchema=(W,q,Y)=>uJ(J,W,q,Y),J.gt=(W,q)=>J.check(R0(W,q)),J.gte=(W,q)=>J.check(a(W,q)),J.min=(W,q)=>J.check(a(W,q)),J.lt=(W,q)=>J.check(O0(W,q)),J.lte=(W,q)=>J.check(Y0(W,q)),J.max=(W,q)=>J.check(Y0(W,q)),J.int=(W)=>J.check(b4(W)),J.safe=(W)=>J.check(b4(W)),J.positive=(W)=>J.check(R0(0,W)),J.nonnegative=(W)=>J.check(a(0,W)),J.negative=(W)=>J.check(O0(0,W)),J.nonpositive=(W)=>J.check(Y0(0,W)),J.multipleOf=(W,q)=>J.check(g0(W,q)),J.step=(W,q)=>J.check(g0(W,q)),J.finite=()=>J;let H=J._zod.bag;J.minValue=Math.max(H.minimum??Number.NEGATIVE_INFINITY,H.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,J.maxValue=Math.min(H.maximum??Number.POSITIVE_INFINITY,H.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,J.isInt=(H.format??"").includes("int")||Number.isSafeInteger(H.multipleOf??0.5),J.isFinite=!0,J.format=H.format??null});function A0(J){return RJ(Q1,J)}var eX=P("ZodNumberFormat",(J,X)=>{R9.init(J,X),Q1.init(J,X)});function b4(J){return ZJ(eX,J)}var Y8=P("ZodBoolean",(J,X)=>{L9.init(J,X),k.init(J,X),J._zod.processJSONSchema=(H,W,q)=>yJ(J,H,W,q)});function j4(J){return NJ(Y8,J)}var _4=P("ZodBigInt",(J,X)=>{Z9.init(J,X),k.init(J,X),J._zod.processJSONSchema=(W,q,Y)=>mJ(J,W,q,Y),J.gte=(W,q)=>J.check(a(W,q)),J.min=(W,q)=>J.check(a(W,q)),J.gt=(W,q)=>J.check(R0(W,q)),J.gte=(W,q)=>J.check(a(W,q)),J.min=(W,q)=>J.check(a(W,q)),J.lt=(W,q)=>J.check(O0(W,q)),J.lte=(W,q)=>J.check(Y0(W,q)),J.max=(W,q)=>J.check(Y0(W,q)),J.positive=(W)=>J.check(R0(BigInt(0),W)),J.negative=(W)=>J.check(O0(BigInt(0),W)),J.nonpositive=(W)=>J.check(Y0(BigInt(0),W)),J.nonnegative=(W)=>J.check(a(BigInt(0),W)),J.multipleOf=(W,q)=>J.check(g0(W,q));let H=J._zod.bag;J.minValue=H.minimum??null,J.maxValue=H.maximum??null,J.format=H.format??null});var JH=P("ZodAny",(J,X)=>{N9.init(J,X),k.init(J,X),J._zod.processJSONSchema=(H,W,q)=>fJ(J,H,W,q)});function z1(){return CJ(JH)}var XH=P("ZodUnknown",(J,X)=>{b9.init(J,X),k.init(J,X),J._zod.processJSONSchema=(H,W,q)=>oJ(J,H,W,q)});function E4(){return SJ(XH)}var HH=P("ZodNever",(J,X)=>{E9.init(J,X),k.init(J,X),J._zod.processJSONSchema=(H,W,q)=>cJ(J,H,W,q)});function WH(J){return kJ(HH,J)}var Q8=P("ZodDate",(J,X)=>{C9.init(J,X),k.init(J,X),J._zod.processJSONSchema=(W,q,Y)=>lJ(J,W,q,Y),J.min=(W,q)=>J.check(a(W,q)),J.max=(W,q)=>J.check(Y0(W,q));let H=J._zod.bag;J.minDate=H.minimum?new Date(H.minimum):null,J.maxDate=H.maximum?new Date(H.maximum):null});function z8(J){return TJ(Q8,J)}var qH=P("ZodArray",(J,X)=>{S9.init(J,X),k.init(J,X),J._zod.processJSONSchema=(H,W,q)=>nJ(J,H,W,q),J.element=X.element,J.min=(H,W)=>J.check(L0(H,W)),J.nonempty=(H)=>J.check(L0(1,H)),J.max=(H,W)=>J.check(W1(H,W)),J.length=(H,W)=>J.check(q1(H,W)),J.unwrap=()=>J.element});function w8(J,X){return _J(qH,J,X)}var YH=P("ZodObject",(J,X)=>{j9.init(J,X),k.init(J,X),J._zod.processJSONSchema=(H,W,q)=>iJ(J,H,W,q),L.defineLazy(J,"shape",()=>{return X.shape}),J.keyof=()=>U8(Object.keys(J._zod.def.shape)),J.catchall=(H)=>J.clone({...J._zod.def,catchall:H}),J.passthrough=()=>J.clone({...J._zod.def,catchall:E4()}),J.loose=()=>J.clone({...J._zod.def,catchall:E4()}),J.strict=()=>J.clone({...J._zod.def,catchall:WH()}),J.strip=()=>J.clone({...J._zod.def,catchall:void 0}),J.extend=(H)=>{return L.extend(J,H)},J.safeExtend=(H)=>{return L.safeExtend(J,H)},J.merge=(H)=>L.merge(J,H),J.pick=(H)=>L.pick(J,H),J.omit=(H)=>L.omit(J,H),J.partial=(...H)=>L.partial(x4,J,H[0]),J.required=(...H)=>L.required(v4,J,H[0])});function h4(J,X){let H={type:"object",shape:J??{},...L.normalizeParams(X)};return new YH(H)}var QH=P("ZodUnion",(J,X)=>{_9.init(J,X),k.init(J,X),J._zod.processJSONSchema=(H,W,q)=>tJ(J,H,W,q),J.options=X.options});function zH(J,X){return new QH({type:"union",options:J,...L.normalizeParams(X)})}var wH=P("ZodIntersection",(J,X)=>{h9.init(J,X),k.init(J,X),J._zod.processJSONSchema=(H,W,q)=>aJ(J,H,W,q)});function GH(J,X){return new wH({type:"intersection",left:J,right:X})}var UH=P("ZodRecord",(J,X)=>{x9.init(J,X),k.init(J,X),J._zod.processJSONSchema=(H,W,q)=>sJ(J,H,W,q),J.keyType=X.keyType,J.valueType=X.valueType});function G8(J,X,H){return new UH({type:"record",keyType:J,valueType:X,...L.normalizeParams(H)})}var W8=P("ZodEnum",(J,X)=>{v9.init(J,X),k.init(J,X),J._zod.processJSONSchema=(W,q,Y)=>pJ(J,W,q,Y),J.enum=X.entries,J.options=Object.values(X.entries);let H=new Set(Object.keys(X.entries));J.extract=(W,q)=>{let Y={};for(let Q of W)if(H.has(Q))Y[Q]=X.entries[Q];else throw Error(`Key ${Q} not found in enum`);return new W8({...X,checks:[],...L.normalizeParams(q),entries:Y})},J.exclude=(W,q)=>{let Y={...X.entries};for(let Q of W)if(H.has(Q))delete Y[Q];else throw Error(`Key ${Q} not found in enum`);return new W8({...X,checks:[],...L.normalizeParams(q),entries:Y})}});function U8(J,X){let H=Array.isArray(J)?Object.fromEntries(J.map((W)=>[W,W])):J;return new W8({type:"enum",entries:H,...L.normalizeParams(X)})}var PH=P("ZodTransform",(J,X)=>{g9.init(J,X),k.init(J,X),J._zod.processJSONSchema=(H,W,q)=>dJ(J,H,W,q),J._zod.parse=(H,W)=>{if(W.direction==="backward")throw new C0(J.constructor.name);H.addIssue=(Y)=>{if(typeof Y==="string")H.issues.push(L.issue(Y,H.value,X));else{let Q=Y;if(Q.fatal)Q.continue=!1;Q.code??(Q.code="custom"),Q.input??(Q.input=H.value),Q.inst??(Q.inst=J),H.issues.push(L.issue(Q))}};let q=X.transform(H.value,H);if(q instanceof Promise)return q.then((Y)=>{return H.value=Y,H});return H.value=q,H}});function MH(J){return new PH({type:"transform",transform:J})}var x4=P("ZodOptional",(J,X)=>{y1.init(J,X),k.init(J,X),J._zod.processJSONSchema=(H,W,q)=>H8(J,H,W,q),J.unwrap=()=>J._zod.def.innerType});function C4(J){return new x4({type:"optional",innerType:J})}var FH=P("ZodExactOptional",(J,X)=>{u9.init(J,X),k.init(J,X),J._zod.processJSONSchema=(H,W,q)=>H8(J,H,W,q),J.unwrap=()=>J._zod.def.innerType});function AH(J){return new FH({type:"optional",innerType:J})}var $H=P("ZodNullable",(J,X)=>{y9.init(J,X),k.init(J,X),J._zod.processJSONSchema=(H,W,q)=>eJ(J,H,W,q),J.unwrap=()=>J._zod.def.innerType});function S4(J){return new $H({type:"nullable",innerType:J})}var VH=P("ZodDefault",(J,X)=>{m9.init(J,X),k.init(J,X),J._zod.processJSONSchema=(H,W,q)=>X4(J,H,W,q),J.unwrap=()=>J._zod.def.innerType,J.removeDefault=J.unwrap});function BH(J,X){return new VH({type:"default",innerType:J,get defaultValue(){return typeof X==="function"?X():L.shallowClone(X)}})}var DH=P("ZodPrefault",(J,X)=>{c9.init(J,X),k.init(J,X),J._zod.processJSONSchema=(H,W,q)=>H4(J,H,W,q),J.unwrap=()=>J._zod.def.innerType});function KH(J,X){return new DH({type:"prefault",innerType:J,get defaultValue(){return typeof X==="function"?X():L.shallowClone(X)}})}var v4=P("ZodNonOptional",(J,X)=>{f9.init(J,X),k.init(J,X),J._zod.processJSONSchema=(H,W,q)=>J4(J,H,W,q),J.unwrap=()=>J._zod.def.innerType});function IH(J,X){return new v4({type:"nonoptional",innerType:J,...L.normalizeParams(X)})}var OH=P("ZodCatch",(J,X)=>{o9.init(J,X),k.init(J,X),J._zod.processJSONSchema=(H,W,q)=>W4(J,H,W,q),J.unwrap=()=>J._zod.def.innerType,J.removeCatch=J.unwrap});function RH(J,X){return new OH({type:"catch",innerType:J,catchValue:typeof X==="function"?X:()=>X})}var LH=P("ZodPipe",(J,X)=>{l9.init(J,X),k.init(J,X),J._zod.processJSONSchema=(H,W,q)=>q4(J,H,W,q),J.in=X.in,J.out=X.out});function k4(J,X){return new LH({type:"pipe",in:J,out:X})}var ZH=P("ZodReadonly",(J,X)=>{p9.init(J,X),k.init(J,X),J._zod.processJSONSchema=(H,W,q)=>Y4(J,H,W,q),J.unwrap=()=>J._zod.def.innerType});function NH(J){return new ZH({type:"readonly",innerType:J})}var bH=P("ZodCustom",(J,X)=>{r9.init(J,X),k.init(J,X),J._zod.processJSONSchema=(H,W,q)=>rJ(J,H,W,q)});function EH(J,X={}){return hJ(bH,J,X)}function CH(J){return xJ(J)}var N0={};h8(N0,{string:()=>SH,number:()=>kH,date:()=>_H,boolean:()=>TH,bigint:()=>jH});function SH(J){return t9(q8,J)}function kH(J){return LJ(Q1,J)}function TH(J){return bJ(Y8,J)}function jH(J){return EJ(_4,J)}function _H(J){return jJ(Q8,J)}d(m1());function s(J,X){if(!Boolean(J))throw Error(X)}function w1(J){return typeof J=="object"&&J!==null}function g4(J,X){if(!Boolean(J))throw Error(X!=null?X:"Unexpected invariant triggered.")}var hH=/\r\n|[\n\r]/g;function b0(J,X){let H=0,W=1;for(let q of J.body.matchAll(hH)){if(typeof q.index==="number"||g4(!1),q.index>=X)break;H=q.index+q[0].length,W+=1}return{line:W,column:X+1-H}}function P8(J){return G1(J.source,b0(J.source,J.start))}function G1(J,X){let H=J.locationOffset.column-1,W="".padStart(H)+J.body,q=X.line-1,Y=J.locationOffset.line-1,Q=X.line+Y,z=X.line===1?H:0,U=X.column+z,w=`${J.name}:${Q}:${U}
|
|
40
|
+
`,M=W.split(/\r\n|[\n\r]/g),F=M[q];if(F.length>120){let V=Math.floor(U/80),A=U%80,b=[];for(let O=0;O<F.length;O+=80)b.push(F.slice(O,O+80));return w+u4([[`${Q} |`,b[0]],...b.slice(1,V+1).map((O)=>["|",O]),["|","^".padStart(A)],["|",b[V+1]]])}return w+u4([[`${Q-1} |`,M[q-1]],[`${Q} |`,F],["|","^".padStart(U)],[`${Q+1} |`,M[q+1]]])}function u4(J){let X=J.filter(([W,q])=>q!==void 0),H=Math.max(...X.map(([W])=>W.length));return X.map(([W,q])=>W.padStart(H)+(q?" "+q:"")).join(`
|
|
41
|
+
`)}function xH(J){let X=J[0];if(X==null||"kind"in X||"length"in X)return{nodes:X,source:J[1],positions:J[2],path:J[3],originalError:J[4],extensions:J[5]};return X}class p extends Error{constructor(J,...X){var H,W,q;let{nodes:Y,source:Q,positions:z,path:U,originalError:w,extensions:M}=xH(X);super(J);this.name="GraphQLError",this.path=U!==null&&U!==void 0?U:void 0,this.originalError=w!==null&&w!==void 0?w:void 0,this.nodes=y4(Array.isArray(Y)?Y:Y?[Y]:void 0);let F=y4((H=this.nodes)===null||H===void 0?void 0:H.map((A)=>A.loc).filter((A)=>A!=null));this.source=Q!==null&&Q!==void 0?Q:F===null||F===void 0?void 0:(W=F[0])===null||W===void 0?void 0:W.source,this.positions=z!==null&&z!==void 0?z:F===null||F===void 0?void 0:F.map((A)=>A.start),this.locations=z&&Q?z.map((A)=>b0(Q,A)):F===null||F===void 0?void 0:F.map((A)=>b0(A.source,A.start));let V=w1(w===null||w===void 0?void 0:w.extensions)?w===null||w===void 0?void 0:w.extensions:void 0;if(this.extensions=(q=M!==null&&M!==void 0?M:V)!==null&&q!==void 0?q: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}}),w!==null&&w!==void 0&&w.stack)Object.defineProperty(this,"stack",{value:w.stack,writable:!0,configurable:!0});else if(Error.captureStackTrace)Error.captureStackTrace(this,p);else Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}get[Symbol.toStringTag](){return"GraphQLError"}toString(){let J=this.message;if(this.nodes){for(let X of this.nodes)if(X.loc)J+=`
|
|
25
42
|
|
|
26
|
-
`+
|
|
43
|
+
`+P8(X.loc)}else if(this.source&&this.locations)for(let X of this.locations)J+=`
|
|
27
44
|
|
|
28
|
-
`+
|
|
29
|
-
`;if(
|
|
30
|
-
`;return'"""'+
|
|
45
|
+
`+G1(this.source,X);return J}toJSON(){let J={message:this.message};if(this.locations!=null)J.locations=this.locations;if(this.path!=null)J.path=this.path;if(this.extensions!=null&&Object.keys(this.extensions).length>0)J.extensions=this.extensions;return J}}function y4(J){return J===void 0||J.length===0?void 0:J}var F8={Name:[],Document:["definitions"],OperationDefinition:["description","name","variableDefinitions","directives","selectionSet"],VariableDefinition:["description","variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["description","name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"],TypeCoordinate:["name"],MemberCoordinate:["name","memberName"],ArgumentCoordinate:["name","fieldName","argumentName"],DirectiveCoordinate:["name"],DirectiveArgumentCoordinate:["name","argumentName"]},vH=new Set(Object.keys(F8));function A8(J){let X=J===null||J===void 0?void 0:J.kind;return typeof X==="string"&&vH.has(X)}var M8;(function(J){J.QUERY="query",J.MUTATION="mutation",J.SUBSCRIPTION="subscription"})(M8||(M8={}));var j;(function(J){J.NAME="Name",J.DOCUMENT="Document",J.OPERATION_DEFINITION="OperationDefinition",J.VARIABLE_DEFINITION="VariableDefinition",J.SELECTION_SET="SelectionSet",J.FIELD="Field",J.ARGUMENT="Argument",J.FRAGMENT_SPREAD="FragmentSpread",J.INLINE_FRAGMENT="InlineFragment",J.FRAGMENT_DEFINITION="FragmentDefinition",J.VARIABLE="Variable",J.INT="IntValue",J.FLOAT="FloatValue",J.STRING="StringValue",J.BOOLEAN="BooleanValue",J.NULL="NullValue",J.ENUM="EnumValue",J.LIST="ListValue",J.OBJECT="ObjectValue",J.OBJECT_FIELD="ObjectField",J.DIRECTIVE="Directive",J.NAMED_TYPE="NamedType",J.LIST_TYPE="ListType",J.NON_NULL_TYPE="NonNullType",J.SCHEMA_DEFINITION="SchemaDefinition",J.OPERATION_TYPE_DEFINITION="OperationTypeDefinition",J.SCALAR_TYPE_DEFINITION="ScalarTypeDefinition",J.OBJECT_TYPE_DEFINITION="ObjectTypeDefinition",J.FIELD_DEFINITION="FieldDefinition",J.INPUT_VALUE_DEFINITION="InputValueDefinition",J.INTERFACE_TYPE_DEFINITION="InterfaceTypeDefinition",J.UNION_TYPE_DEFINITION="UnionTypeDefinition",J.ENUM_TYPE_DEFINITION="EnumTypeDefinition",J.ENUM_VALUE_DEFINITION="EnumValueDefinition",J.INPUT_OBJECT_TYPE_DEFINITION="InputObjectTypeDefinition",J.DIRECTIVE_DEFINITION="DirectiveDefinition",J.SCHEMA_EXTENSION="SchemaExtension",J.SCALAR_TYPE_EXTENSION="ScalarTypeExtension",J.OBJECT_TYPE_EXTENSION="ObjectTypeExtension",J.INTERFACE_TYPE_EXTENSION="InterfaceTypeExtension",J.UNION_TYPE_EXTENSION="UnionTypeExtension",J.ENUM_TYPE_EXTENSION="EnumTypeExtension",J.INPUT_OBJECT_TYPE_EXTENSION="InputObjectTypeExtension",J.TYPE_COORDINATE="TypeCoordinate",J.MEMBER_COORDINATE="MemberCoordinate",J.ARGUMENT_COORDINATE="ArgumentCoordinate",J.DIRECTIVE_COORDINATE="DirectiveCoordinate",J.DIRECTIVE_ARGUMENT_COORDINATE="DirectiveArgumentCoordinate"})(j||(j={}));function $8(J){return J===9||J===32}function gH(J){return J>=48&&J<=57}function m4(J){return J>=97&&J<=122||J>=65&&J<=90}function c4(J){return m4(J)||J===95}function f4(J){return m4(J)||gH(J)||J===95}function o4(J,X){let H=J.replace(/"""/g,'\\"""'),W=H.split(/\r\n|[\n\r]/g),q=W.length===1,Y=W.length>1&&W.slice(1).every((A)=>A.length===0||$8(A.charCodeAt(0))),Q=H.endsWith('\\"""'),z=J.endsWith('"')&&!Q,U=J.endsWith("\\"),w=z||U,M=!(X!==null&&X!==void 0&&X.minimize)&&(!q||J.length>70||w||Y||Q),F="",V=q&&$8(J.charCodeAt(0));if(M&&!V||Y)F+=`
|
|
46
|
+
`;if(F+=H,M||w)F+=`
|
|
47
|
+
`;return'"""'+F+'"""'}function $0(J){return U1(J,[])}function U1(J,X){switch(typeof J){case"string":return JSON.stringify(J);case"function":return J.name?`[function ${J.name}]`:"[function]";case"object":return uH(J,X);default:return String(J)}}function uH(J,X){if(J===null)return"null";if(X.includes(J))return"[Circular]";let H=[...X,J];if(yH(J)){let W=J.toJSON();if(W!==J)return typeof W==="string"?W:U1(W,H)}else if(Array.isArray(J))return cH(J,H);return mH(J,H)}function yH(J){return typeof J.toJSON==="function"}function mH(J,X){let H=Object.entries(J);if(H.length===0)return"{}";if(X.length>2)return"["+fH(J)+"]";return"{ "+H.map(([q,Y])=>q+": "+U1(Y,X)).join(", ")+" }"}function cH(J,X){if(J.length===0)return"[]";if(X.length>2)return"[Array]";let H=Math.min(10,J.length),W=J.length-H,q=[];for(let Y=0;Y<H;++Y)q.push(U1(J[Y],X));if(W===1)q.push("... 1 more item");else if(W>1)q.push(`... ${W} more items`);return"["+q.join(", ")+"]"}function fH(J){let X=Object.prototype.toString.call(J).replace(/^\[object /,"").replace(/]$/,"");if(X==="Object"&&typeof J.constructor==="function"){let H=J.constructor.name;if(typeof H==="string"&&H!=="")return H}return X}function l4(J,X){let[H,W]=X?[J,X]:[void 0,J],q=" Did you mean ";if(H)q+=H+" ";let Y=W.map((U)=>`"${U}"`);switch(Y.length){case 0:return"";case 1:return q+Y[0]+"?";case 2:return q+Y[0]+" or "+Y[1]+"?"}let Q=Y.slice(0,5),z=Q.pop();return q+Q.join(", ")+", or "+z+"?"}function V8(J){return J}function p4(J,X){let H=Object.create(null);for(let W of J)H[X(W)]=W;return H}function P1(J,X,H){let W=Object.create(null);for(let q of J)W[X(q)]=H(q);return W}function r4(J,X){let H=0,W=0;while(H<J.length&&W<X.length){let q=J.charCodeAt(H),Y=X.charCodeAt(W);if(M1(q)&&M1(Y)){let Q=0;do++H,Q=Q*10+q-B8,q=J.charCodeAt(H);while(M1(q)&&Q>0);let z=0;do++W,z=z*10+Y-B8,Y=X.charCodeAt(W);while(M1(Y)&&z>0);if(Q<z)return-1;if(Q>z)return 1}else{if(q<Y)return-1;if(q>Y)return 1;++H,++W}}return J.length-X.length}var B8=48,oH=57;function M1(J){return!isNaN(J)&&B8<=J&&J<=oH}function n4(J,X){let H=Object.create(null),W=new i4(J),q=Math.floor(J.length*0.4)+1;for(let Y of X){let Q=W.measure(Y,q);if(Q!==void 0)H[Y]=Q}return Object.keys(H).sort((Y,Q)=>{let z=H[Y]-H[Q];return z!==0?z:r4(Y,Q)})}class i4{constructor(J){this._input=J,this._inputLowerCase=J.toLowerCase(),this._inputArray=d4(this._inputLowerCase),this._rows=[Array(J.length+1).fill(0),Array(J.length+1).fill(0),Array(J.length+1).fill(0)]}measure(J,X){if(this._input===J)return 0;let H=J.toLowerCase();if(this._inputLowerCase===H)return 1;let W=d4(H),q=this._inputArray;if(W.length<q.length){let w=W;W=q,q=w}let Y=W.length,Q=q.length;if(Y-Q>X)return;let z=this._rows;for(let w=0;w<=Q;w++)z[0][w]=w;for(let w=1;w<=Y;w++){let M=z[(w-1)%3],F=z[w%3],V=F[0]=w;for(let A=1;A<=Q;A++){let b=W[w-1]===q[A-1]?0:1,O=Math.min(M[A]+1,F[A-1]+1,M[A-1]+b);if(w>1&&A>1&&W[w-1]===q[A-2]&&W[w-2]===q[A-1]){let J0=z[(w-2)%3][A-2];O=Math.min(O,J0+1)}if(O<V)V=O;F[A]=O}if(V>X)return}let U=z[Y%3][Q];return U<=X?U:void 0}}function d4(J){let X=J.length,H=Array(X);for(let W=0;W<X;++W)H[W]=J.charCodeAt(W);return H}function F1(J){if(J==null)return Object.create(null);if(Object.getPrototypeOf(J)===null)return J;let X=Object.create(null);for(let[H,W]of Object.entries(J))X[H]=W;return X}function t4(J){return`"${J.replace(lH,pH)}"`}var lH=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function pH(J){return rH[J.charCodeAt(0)]}var rH=["\\u0000","\\u0001","\\u0002","\\u0003","\\u0004","\\u0005","\\u0006","\\u0007","\\b","\\t","\\n","\\u000B","\\f","\\r","\\u000E","\\u000F","\\u0010","\\u0011","\\u0012","\\u0013","\\u0014","\\u0015","\\u0016","\\u0017","\\u0018","\\u0019","\\u001A","\\u001B","\\u001C","\\u001D","\\u001E","\\u001F","","","\\\"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\\\","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\u007F","\\u0080","\\u0081","\\u0082","\\u0083","\\u0084","\\u0085","\\u0086","\\u0087","\\u0088","\\u0089","\\u008A","\\u008B","\\u008C","\\u008D","\\u008E","\\u008F","\\u0090","\\u0091","\\u0092","\\u0093","\\u0094","\\u0095","\\u0096","\\u0097","\\u0098","\\u0099","\\u009A","\\u009B","\\u009C","\\u009D","\\u009E","\\u009F"];var a4=Object.freeze({});function D8(J,X,H=F8){let W=new Map;for(let n of Object.values(j))W.set(n,s4(X,n));let q=void 0,Y=Array.isArray(J),Q=[J],z=-1,U=[],w=J,M=void 0,F=void 0,V=[],A=[];do{z++;let n=z===Q.length,f0=n&&U.length!==0;if(n){if(M=A.length===0?void 0:V[V.length-1],w=F,F=A.pop(),f0)if(Y){w=w.slice();let h=0;for(let[c,R1]of U){let o0=c-h;if(R1===null)w.splice(o0,1),h++;else w[o0]=R1}}else{w={...w};for(let[h,c]of U)w[h]=c}z=q.index,Q=q.keys,U=q.edits,Y=q.inArray,q=q.prev}else if(F){if(M=Y?z:Q[z],w=F[M],w===null||w===void 0)continue;V.push(M)}let u;if(!Array.isArray(w)){var b,O;A8(w)||s(!1,`Invalid AST Node: ${$0(w)}.`);let h=n?(b=W.get(w.kind))===null||b===void 0?void 0:b.leave:(O=W.get(w.kind))===null||O===void 0?void 0:O.enter;if(u=h===null||h===void 0?void 0:h.call(X,w,M,F,V,A),u===a4)break;if(u===!1){if(!n){V.pop();continue}}else if(u!==void 0){if(U.push([M,u]),!n)if(A8(u))w=u;else{V.pop();continue}}}if(u===void 0&&f0)U.push([M,w]);if(n)V.pop();else{var J0;if(q={inArray:Y,index:z,keys:Q,edits:U,prev:q},Y=Array.isArray(w),Q=Y?w:(J0=H[w.kind])!==null&&J0!==void 0?J0:[],z=-1,U=[],F)A.push(F);F=w}}while(q!==void 0);if(U.length!==0)return U[U.length-1][1];return J}function s4(J,X){let H=J[X];if(typeof H==="object")return H;else if(typeof H==="function")return{enter:H,leave:void 0};return{enter:J.enter,leave:J.leave}}function $1(J){return D8(J,nH)}var dH=80,nH={Name:{leave:(J)=>J.value},Variable:{leave:(J)=>"$"+J.name},Document:{leave:(J)=>$(J.definitions,`
|
|
31
48
|
|
|
32
|
-
`)},OperationDefinition:{leave(J){let X=
|
|
33
|
-
|
|
49
|
+
`)},OperationDefinition:{leave(J){let X=K8(J.variableDefinitions)?I(`(
|
|
50
|
+
`,$(J.variableDefinitions,`
|
|
34
51
|
`),`
|
|
35
|
-
)`):
|
|
36
|
-
`)
|
|
37
|
-
`)+J+": "+X+
|
|
38
|
-
`,
|
|
52
|
+
)`):I("(",$(J.variableDefinitions,", "),")"),H=I("",J.description,`
|
|
53
|
+
`)+$([J.operation,$([J.name,X]),$(J.directives," ")]," ");return(H==="query"?"":H+" ")+J.selectionSet}},VariableDefinition:{leave:({variable:J,type:X,defaultValue:H,directives:W,description:q})=>I("",q,`
|
|
54
|
+
`)+J+": "+X+I(" = ",H)+I(" ",$(W," "))},SelectionSet:{leave:({selections:J})=>e(J)},Field:{leave({alias:J,name:X,arguments:H,directives:W,selectionSet:q}){let Y=I("",J,": ")+X,Q=Y+I("(",$(H,", "),")");if(Q.length>dH)Q=Y+I(`(
|
|
55
|
+
`,A1($(H,`
|
|
39
56
|
`)),`
|
|
40
|
-
)`);return
|
|
41
|
-
`)+`fragment ${J}${
|
|
42
|
-
`)
|
|
43
|
-
`)
|
|
44
|
-
`)
|
|
45
|
-
`)+X+(
|
|
46
|
-
`,
|
|
57
|
+
)`);return $([Q,$(W," "),q]," ")}},Argument:{leave:({name:J,value:X})=>J+": "+X},FragmentSpread:{leave:({name:J,directives:X})=>"..."+J+I(" ",$(X," "))},InlineFragment:{leave:({typeCondition:J,directives:X,selectionSet:H})=>$(["...",I("on ",J),$(X," "),H]," ")},FragmentDefinition:{leave:({name:J,typeCondition:X,variableDefinitions:H,directives:W,selectionSet:q,description:Y})=>I("",Y,`
|
|
58
|
+
`)+`fragment ${J}${I("(",$(H,", "),")")} on ${X} ${I("",$(W," ")," ")}`+q},IntValue:{leave:({value:J})=>J},FloatValue:{leave:({value:J})=>J},StringValue:{leave:({value:J,block:X})=>X?o4(J):t4(J)},BooleanValue:{leave:({value:J})=>J?"true":"false"},NullValue:{leave:()=>"null"},EnumValue:{leave:({value:J})=>J},ListValue:{leave:({values:J})=>"["+$(J,", ")+"]"},ObjectValue:{leave:({fields:J})=>"{"+$(J,", ")+"}"},ObjectField:{leave:({name:J,value:X})=>J+": "+X},Directive:{leave:({name:J,arguments:X})=>"@"+J+I("(",$(X,", "),")")},NamedType:{leave:({name:J})=>J},ListType:{leave:({type:J})=>"["+J+"]"},NonNullType:{leave:({type:J})=>J+"!"},SchemaDefinition:{leave:({description:J,directives:X,operationTypes:H})=>I("",J,`
|
|
59
|
+
`)+$(["schema",$(X," "),e(H)]," ")},OperationTypeDefinition:{leave:({operation:J,type:X})=>J+": "+X},ScalarTypeDefinition:{leave:({description:J,name:X,directives:H})=>I("",J,`
|
|
60
|
+
`)+$(["scalar",X,$(H," ")]," ")},ObjectTypeDefinition:{leave:({description:J,name:X,interfaces:H,directives:W,fields:q})=>I("",J,`
|
|
61
|
+
`)+$(["type",X,I("implements ",$(H," & ")),$(W," "),e(q)]," ")},FieldDefinition:{leave:({description:J,name:X,arguments:H,type:W,directives:q})=>I("",J,`
|
|
62
|
+
`)+X+(K8(H)?I(`(
|
|
63
|
+
`,A1($(H,`
|
|
47
64
|
`)),`
|
|
48
|
-
)`):
|
|
49
|
-
`)
|
|
50
|
-
`)
|
|
51
|
-
`)
|
|
52
|
-
`)
|
|
53
|
-
`)
|
|
54
|
-
`)
|
|
55
|
-
`)+"directive @"+X+(
|
|
56
|
-
`,
|
|
65
|
+
)`):I("(",$(H,", "),")"))+": "+W+I(" ",$(q," "))},InputValueDefinition:{leave:({description:J,name:X,type:H,defaultValue:W,directives:q})=>I("",J,`
|
|
66
|
+
`)+$([X+": "+H,I("= ",W),$(q," ")]," ")},InterfaceTypeDefinition:{leave:({description:J,name:X,interfaces:H,directives:W,fields:q})=>I("",J,`
|
|
67
|
+
`)+$(["interface",X,I("implements ",$(H," & ")),$(W," "),e(q)]," ")},UnionTypeDefinition:{leave:({description:J,name:X,directives:H,types:W})=>I("",J,`
|
|
68
|
+
`)+$(["union",X,$(H," "),I("= ",$(W," | "))]," ")},EnumTypeDefinition:{leave:({description:J,name:X,directives:H,values:W})=>I("",J,`
|
|
69
|
+
`)+$(["enum",X,$(H," "),e(W)]," ")},EnumValueDefinition:{leave:({description:J,name:X,directives:H})=>I("",J,`
|
|
70
|
+
`)+$([X,$(H," ")]," ")},InputObjectTypeDefinition:{leave:({description:J,name:X,directives:H,fields:W})=>I("",J,`
|
|
71
|
+
`)+$(["input",X,$(H," "),e(W)]," ")},DirectiveDefinition:{leave:({description:J,name:X,arguments:H,repeatable:W,locations:q})=>I("",J,`
|
|
72
|
+
`)+"directive @"+X+(K8(H)?I(`(
|
|
73
|
+
`,A1($(H,`
|
|
57
74
|
`)),`
|
|
58
|
-
)`):
|
|
59
|
-
`,
|
|
75
|
+
)`):I("(",$(H,", "),")"))+(W?" repeatable":"")+" on "+$(q," | ")},SchemaExtension:{leave:({directives:J,operationTypes:X})=>$(["extend schema",$(J," "),e(X)]," ")},ScalarTypeExtension:{leave:({name:J,directives:X})=>$(["extend scalar",J,$(X," ")]," ")},ObjectTypeExtension:{leave:({name:J,interfaces:X,directives:H,fields:W})=>$(["extend type",J,I("implements ",$(X," & ")),$(H," "),e(W)]," ")},InterfaceTypeExtension:{leave:({name:J,interfaces:X,directives:H,fields:W})=>$(["extend interface",J,I("implements ",$(X," & ")),$(H," "),e(W)]," ")},UnionTypeExtension:{leave:({name:J,directives:X,types:H})=>$(["extend union",J,$(X," "),I("= ",$(H," | "))]," ")},EnumTypeExtension:{leave:({name:J,directives:X,values:H})=>$(["extend enum",J,$(X," "),e(H)]," ")},InputObjectTypeExtension:{leave:({name:J,directives:X,fields:H})=>$(["extend input",J,$(X," "),e(H)]," ")},TypeCoordinate:{leave:({name:J})=>J},MemberCoordinate:{leave:({name:J,memberName:X})=>$([J,I(".",X)])},ArgumentCoordinate:{leave:({name:J,fieldName:X,argumentName:H})=>$([J,I(".",X),I("(",H,":)")])},DirectiveCoordinate:{leave:({name:J})=>$(["@",J])},DirectiveArgumentCoordinate:{leave:({name:J,argumentName:X})=>$(["@",J,I("(",X,":)")])}};function $(J,X=""){var H;return(H=J===null||J===void 0?void 0:J.filter((W)=>W).join(X))!==null&&H!==void 0?H:""}function e(J){return I(`{
|
|
76
|
+
`,A1($(J,`
|
|
60
77
|
`)),`
|
|
61
|
-
}`)}function
|
|
62
|
-
`))}function
|
|
63
|
-
`)))!==null&&X!==void 0?X:!1}function B1(J,X){switch(J.kind){case E.NULL:return null;case E.INT:return parseInt(J.value,10);case E.FLOAT:return parseFloat(J.value);case E.STRING:case E.ENUM:case E.BOOLEAN:return J.value;case E.LIST:return J.values.map((H)=>B1(H,X));case E.OBJECT:return w1(J.fields,(H)=>H.name.value,(H)=>B1(H.value,X));case E.VARIABLE:return X===null||X===void 0?void 0:X[J.name.value]}}function c0(J){if(J!=null||t(!1,"Must provide name."),typeof J==="string"||t(!1,"Expected name to be a string."),J.length===0)throw new o("Expected name to be a non-empty string.");for(let X=1;X<J.length;++X)if(!gJ(J.charCodeAt(X)))throw new o(`Names must only contain [_a-zA-Z0-9] but "${J}" does not.`);if(!xJ(J.charCodeAt(0)))throw new o(`Names must start with [_a-zA-Z] but "${J}" does not.`);return J}function P4(J){if(J==="true"||J==="false"||J==="null")throw new o(`Enum values cannot be named: ${J}`);return c0(J)}class u0{constructor(J){var X,H,W,q;let Y=(X=J.parseValue)!==null&&X!==void 0?X:w4;if(this.name=c0(J.name),this.description=J.description,this.specifiedByURL=J.specifiedByURL,this.serialize=(H=J.serialize)!==null&&H!==void 0?H:w4,this.parseValue=Y,this.parseLiteral=(W=J.parseLiteral)!==null&&W!==void 0?W:(z,Q)=>Y(B1(z,Q)),this.extensions=U1(J.extensions),this.astNode=J.astNode,this.extensionASTNodes=(q=J.extensionASTNodes)!==null&&q!==void 0?q:[],J.specifiedByURL==null||typeof J.specifiedByURL==="string"||t(!1,`${this.name} must provide "specifiedByURL" as a string, but got: ${M0(J.specifiedByURL)}.`),J.serialize==null||typeof J.serialize==="function"||t(!1,`${this.name} must provide "serialize" function. If this custom Scalar is also used as an input type, ensure "parseValue" and "parseLiteral" functions are also provided.`),J.parseLiteral)typeof J.parseValue==="function"&&typeof J.parseLiteral==="function"||t(!1,`${this.name} must provide both "parseValue" and "parseLiteral" functions.`)}get[Symbol.toStringTag](){return"GraphQLScalarType"}toConfig(){return{name:this.name,description:this.description,specifiedByURL:this.specifiedByURL,serialize:this.serialize,parseValue:this.parseValue,parseLiteral:this.parseLiteral,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function nJ(J){return Y1(J)&&!Array.isArray(J)}class y0{constructor(J){var X;this.name=c0(J.name),this.description=J.description,this.extensions=U1(J.extensions),this.astNode=J.astNode,this.extensionASTNodes=(X=J.extensionASTNodes)!==null&&X!==void 0?X:[],this._values=typeof J.values==="function"?J.values:iJ(this.name,J.values),this._valueLookup=null,this._nameLookup=null}get[Symbol.toStringTag](){return"GraphQLEnumType"}getValues(){if(typeof this._values==="function")this._values=iJ(this.name,this._values());return this._values}getValue(J){if(this._nameLookup===null)this._nameLookup=yJ(this.getValues(),(X)=>X.name);return this._nameLookup[J]}serialize(J){if(this._valueLookup===null)this._valueLookup=new Map(this.getValues().map((H)=>[H.value,H]));let X=this._valueLookup.get(J);if(X===void 0)throw new o(`Enum "${this.name}" cannot represent value: ${M0(J)}`);return X.name}parseValue(J){if(typeof J!=="string"){let H=M0(J);throw new o(`Enum "${this.name}" cannot represent non-string value: ${H}.`+M1(this,H))}let X=this.getValue(J);if(X==null)throw new o(`Value "${J}" does not exist in "${this.name}" enum.`+M1(this,J));return X.value}parseLiteral(J,X){if(J.kind!==E.ENUM){let W=P1(J);throw new o(`Enum "${this.name}" cannot represent non-enum value: ${W}.`+M1(this,W),{nodes:J})}let H=this.getValue(J.value);if(H==null){let W=P1(J);throw new o(`Value "${W}" does not exist in "${this.name}" enum.`+M1(this,W),{nodes:J})}return H.value}toConfig(){let J=w1(this.getValues(),(X)=>X.name,(X)=>({description:X.description,value:X.value,deprecationReason:X.deprecationReason,extensions:X.extensions,astNode:X.astNode}));return{name:this.name,description:this.description,values:J,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function M1(J,X){let H=J.getValues().map((q)=>q.name),W=oJ(X,H);return uJ("the enum value",W)}function iJ(J,X){return nJ(X)||t(!1,`${J} values must be an object with value names as keys.`),Object.entries(X).map(([H,W])=>{return nJ(W)||t(!1,`${J}.${H} must refer to an object with a "value" key representing an internal value but got: ${M0(W)}.`),{name:P4(H),description:W.description,value:W.value!==void 0?W.value:H,deprecationReason:W.deprecationReason,extensions:U1(W.extensions),astNode:W.astNode}})}var aJ=class{name;values;gqlEnum;constructor(J,X){this.name=J,this.values=X,this.gqlEnum=new y0({name:this.name,values:Object.fromEntries(X.map((H)=>[H,{value:H}]))})}getName(){return this.name}getEnumValues(){return this.values}getPothos(){return this.gqlEnum}getZod(){return H4(this.values)}getJson(){return{type:"string",enum:this.values}}getJsonSchema(){return this.getJson()}},L0=(J,X)=>new aJ(J,X);var j=class extends u0{zodSchema;jsonSchemaDef;constructor(J){super(J);this.zodSchema=J.zod,this.jsonSchemaDef=J.jsonSchema}getZod(){return this.zodSchema}getPothos(){return this}getJson(){return typeof this.jsonSchemaDef==="function"?this.jsonSchemaDef():this.jsonSchemaDef}getJsonSchemaDef(){return this.jsonSchemaDef}getJsonSchema(){let J=(X)=>{let H=typeof X==="function"?X():X;if(Array.isArray(H))return H.map((W)=>J(W));if(H&&typeof H==="object"){let W={};for(let[q,Y]of Object.entries(H))W[q]=J(Y);return W}return H};return J(this.getJson())}};var B4=/^[A-Za-z]{2}(?:-[A-Za-z0-9]{2,8})*$/,M4=/^(?:UTC|[A-Za-z_]+\/[A-Za-z_]+)$/,F4=/^[+]?\d[\d\s().-]{3,}$/,I4=/^[A-Z]{3}$/,$4=/^[A-Z]{2}$/,A4=-90,O4=90,V4=-180,K4=180,w={String_unsecure:()=>new j({name:"String_unsecure",description:"Unvalidated string scalar",zod:_(),parseValue:(J)=>_().parse(J),serialize:(J)=>String(J),parseLiteral:(J)=>{if(J.kind!==E.STRING)throw TypeError("Invalid literal");return J.value},jsonSchema:{type:"string"}}),Int_unsecure:()=>new j({name:"Int_unsecure",description:"Unvalidated integer scalar",zod:B0().int(),parseValue:(J)=>{let X=typeof J==="number"?J:Number(J);return B0().int().parse(X)},serialize:(J)=>Math.trunc(typeof J==="number"?J:Number(J)),parseLiteral:(J)=>{if(J.kind!==E.INT)throw TypeError("Invalid literal");return Number(J.value)},jsonSchema:{type:"integer"}}),Float_unsecure:()=>new j({name:"Float_unsecure",description:"Unvalidated float scalar",zod:B0(),parseValue:(J)=>{let X=typeof J==="number"?J:Number(J);return B0().parse(X)},serialize:(J)=>Number(J),parseLiteral:(J)=>{if(J.kind!==E.FLOAT&&J.kind!==E.INT)throw TypeError("Invalid literal");return Number(J.value)},jsonSchema:{type:"number"}}),Boolean:()=>new j({name:"Boolean",description:"Unvalidated boolean scalar",zod:_J(),parseValue:(J)=>N0.boolean().parse(J),serialize:(J)=>Boolean(J),parseLiteral:(J)=>{if(J.kind!==E.BOOLEAN)throw TypeError("Invalid literal");return J.value},jsonSchema:{type:"boolean"}}),ID:()=>new j({name:"ID",description:"Unvalidated id scalar",zod:_(),parseValue:(J)=>_().parse(J),serialize:(J)=>String(J),parseLiteral:(J)=>{if(J.kind!==E.STRING)throw TypeError("Invalid literal");return J.value},jsonSchema:{type:"string"}}),JSON:()=>new j({name:"JSON",zod:q1(),parseValue:(J)=>J,serialize:(J)=>J,jsonSchema:{}}),JSONObject:()=>new j({name:"JSONObject",zod:X4(_(),q1()),parseValue:(J)=>X4(_(),q1()).parse(J),serialize:(J)=>J??{},jsonSchema:{type:"object"}}),Date:()=>new j({name:"Date",zod:e1(),parseValue:(J)=>J instanceof Date?J:new Date(String(J)),serialize:(J)=>J instanceof Date?J.toISOString().split("T")[0]:String(J),jsonSchema:{type:"string",format:"date"}}),DateTime:()=>new j({name:"DateTime",zod:e1(),parseValue:(J)=>J instanceof Date?J:new Date(String(J)),serialize:(J)=>{return J instanceof Date?J.toISOString():String(J)},jsonSchema:{type:"string",format:"date-time"}}),Time:()=>new j({name:"Time",zod:_().regex(/^\d{2}:\d{2}(:\d{2})?$/),parseValue:(J)=>_().regex(/^\d{2}:\d{2}(:\d{2})?$/).parse(J),serialize:(J)=>String(J),jsonSchema:{type:"string",pattern:"^\\d{2}:\\d{2}(:\\d{2})?$"}}),EmailAddress:()=>new j({name:"EmailAddress",zod:_().email(),parseValue:(J)=>_().email().parse(J),serialize:(J)=>String(J),jsonSchema:{type:"string",format:"email"}}),URL:()=>new j({name:"URL",zod:_().url(),parseValue:(J)=>_().url().parse(J),serialize:(J)=>String(J),jsonSchema:{type:"string",format:"uri"}}),PhoneNumber:()=>new j({name:"PhoneNumber",zod:_().regex(F4),parseValue:(J)=>_().regex(F4).parse(J),serialize:(J)=>String(J),jsonSchema:{type:"string",pattern:F4.source}}),NonEmptyString:()=>new j({name:"NonEmptyString",zod:_().min(1),parseValue:(J)=>_().min(1).parse(J),serialize:(J)=>String(J),jsonSchema:{type:"string",minLength:1}}),Locale:()=>new j({name:"Locale",zod:_().regex(B4),parseValue:(J)=>_().regex(B4).parse(J),serialize:(J)=>String(J),jsonSchema:{type:"string",pattern:B4.source}}),TimeZone:()=>new j({name:"TimeZone",zod:_().regex(M4),parseValue:(J)=>_().regex(M4).parse(J),serialize:(J)=>String(J),jsonSchema:{type:"string",pattern:M4.source}}),Latitude:()=>new j({name:"Latitude",zod:B0().min(A4).max(O4),parseValue:(J)=>N0.number().min(A4).max(O4).parse(J),serialize:(J)=>Number(J),jsonSchema:{type:"number",minimum:A4,maximum:O4}}),Longitude:()=>new j({name:"Longitude",zod:B0().min(V4).max(K4),parseValue:(J)=>N0.number().min(V4).max(K4).parse(J),serialize:(J)=>Number(J),jsonSchema:{type:"number",minimum:V4,maximum:K4}}),Currency:()=>new j({name:"Currency",zod:_().regex(I4),parseValue:(J)=>_().regex(I4).parse(J),serialize:(J)=>String(J),jsonSchema:{type:"string",pattern:I4.source}}),CountryCode:()=>new j({name:"CountryCode",zod:_().regex($4),parseValue:(J)=>_().regex($4).parse(J),serialize:(J)=>String(J),jsonSchema:{type:"string",pattern:$4.source}})};var T=class{constructor(J){this.config=J}getZod(){let J=Object.entries(this.config.fields).reduce((X,[H,W])=>{let q=W.type.getZod(),Y=W.isArray?J4(q):q;return X[H]=W.isOptional?Y.optional():Y,X},{});return kJ(J)}getPothosInput(){return this.config.name}};var m=(J)=>new T(J);var sJ=(J,X)=>()=>(J&&(X=J(J=0)),X);var c3,R4=sJ(()=>{c3={byTag:(J)=>J.meta.tags?.[0]??"untagged",byAllTags:(J)=>J.meta.tags?.length?J.meta.tags:["untagged"],byOwner:(J)=>J.meta.owners?.[0]??"unowned",byDomain:(J)=>{return(J.meta.key??J.meta.key??"").split(".")[0]??"default"},byStability:(J)=>J.meta.stability??"stable",byUrlPath:(J)=>(X)=>{if(!X.path)return"root";return X.path.split("/").filter(Boolean).slice(0,J).join("/")||"root"}}});R4();R4();var J9={meta:{key:"payments.stripe",version:"1.0.0",category:"payments",title:"Stripe Payments",description:"Stripe integration for payment processing, charges, and payouts.",domain:"payments",owners:["platform.payments"],tags:["payments","psp"],stability:A.Stable},supportedModes:["managed","byok"],capabilities:{provides:[{key:"payments.psp",version:"1.0.0"}],requires:[{key:"platform.webhooks",optional:!0,reason:"Recommended for reliable event ingestion"}]},configSchema:{schema:{type:"object",properties:{accountId:{type:"string",description:"Connected account ID when using Stripe Connect (BYOK)."},region:{type:"string",description:"Optional Stripe region or data residency hint."}}},example:{accountId:"acct_123",region:"us-east-1"}},secretSchema:{schema:{type:"object",required:["apiKey","webhookSecret"],properties:{apiKey:{type:"string",description:"Stripe secret API key (sk_live_... or sk_test_...)."},webhookSecret:{type:"string",description:"Signing secret for webhook verification."}}},example:{apiKey:"sk_live_***",webhookSecret:"whsec_***"}},healthCheck:{method:"ping",timeoutMs:5000},docsUrl:"https://stripe.com/docs/api",constraints:{rateLimit:{rpm:1000,rph:20000}},byokSetup:{setupInstructions:"Create a restricted Stripe API key with write access to Charges and provide a webhook signing secret.",requiredScopes:["charges:write","customers:read"]}};var X9={meta:{key:"email.postmark",version:"1.0.0",category:"email",title:"Postmark Transactional Email",description:"Postmark integration for transactional email delivery.",domain:"communications",owners:["platform.messaging"],tags:["email","transactional"],stability:A.Stable},supportedModes:["managed","byok"],capabilities:{provides:[{key:"email.transactional",version:"1.0.0"}],requires:[{key:"platform.webhooks",optional:!0,reason:"Optional for inbound bounce handling"}]},configSchema:{schema:{type:"object",properties:{messageStream:{type:"string",description:"Optional message stream identifier (e.g., transactional)."},fromEmail:{type:"string",description:"Default From address used for outbound messages."}}},example:{messageStream:"outbound",fromEmail:"notifications@example.com"}},secretSchema:{schema:{type:"object",required:["serverToken"],properties:{serverToken:{type:"string",description:"Server token for the Postmark account."}}},example:{serverToken:"server-***"}},healthCheck:{method:"ping",timeoutMs:3000},docsUrl:"https://postmarkapp.com/developer",constraints:{rateLimit:{rpm:500}},byokSetup:{setupInstructions:"Create a Postmark server token with outbound send permissions and configure allowed from addresses."}};var H9={meta:{key:"vectordb.qdrant",version:"1.0.0",category:"vector-db",title:"Qdrant Vector Database",description:"Qdrant integration for vector search and embeddings storage.",domain:"ai",owners:["platform.ai"],tags:["vector-db","search"],stability:A.Experimental},supportedModes:["managed","byok"],capabilities:{provides:[{key:"vector-db.search",version:"1.0.0"},{key:"vector-db.storage",version:"1.0.0"}],requires:[{key:"ai.embeddings",optional:!0,reason:"Required if vectors are generated via hosted embedding services"}]},configSchema:{schema:{type:"object",properties:{apiUrl:{type:"string",description:"Base URL for the Qdrant instance (e.g., https://qdrant.example.com)."},collectionPrefix:{type:"string",description:"Prefix applied to all collection names for this tenant."}}},example:{apiUrl:"https://qdrant.example.com",collectionPrefix:"tenant_"}},secretSchema:{schema:{type:"object",properties:{apiKey:{type:"string",description:"API key or token when authentication is enabled."}}},example:{apiKey:"qdrant-api-key"}},healthCheck:{method:"ping",timeoutMs:4000},docsUrl:"https://qdrant.tech/documentation/quick-start/",constraints:{quotas:{collections:100,pointsPerCollection:1e6}},byokSetup:{setupInstructions:"Provide the HTTPS endpoint of your Qdrant cluster and generate an API key with read/write access to the collections that will be managed."}};var W9={meta:{key:"ai-llm.mistral",version:"1.0.0",category:"ai-llm",title:"Mistral Large Language Model",description:"Mistral integration providing chat completions and embedding generation.",domain:"ai",owners:["platform.ai"],tags:["ai","llm","embeddings"],stability:A.Experimental},supportedModes:["managed","byok"],capabilities:{provides:[{key:"ai.chat",version:"1.0.0"},{key:"ai.embeddings",version:"1.0.0"}]},configSchema:{schema:{type:"object",properties:{model:{type:"string",description:"Default chat completion model (e.g., mistral-large-latest)."},embeddingModel:{type:"string",description:"Embedding model identifier."}}},example:{model:"mistral-large-latest",embeddingModel:"mistral-embed"}},secretSchema:{schema:{type:"object",required:["apiKey"],properties:{apiKey:{type:"string",description:"Mistral API key with access to chat and embeddings endpoints."}}},example:{apiKey:"mistral-***"}},healthCheck:{method:"custom",timeoutMs:5000},docsUrl:"https://docs.mistral.ai/platform/endpoints",constraints:{rateLimit:{rpm:600}},byokSetup:{setupInstructions:"Generate an API key within the Mistral console and ensure the selected models are enabled for the account."}};var q9={meta:{key:"ai-voice.elevenlabs",version:"1.0.0",category:"ai-voice",title:"ElevenLabs Text-to-Speech",description:"ElevenLabs integration for neural voice synthesis and voice catalog access.",domain:"ai",owners:["platform.ai"],tags:["voice","tts"],stability:A.Beta},supportedModes:["managed","byok"],capabilities:{provides:[{key:"ai.voice.synthesis",version:"1.0.0"}]},configSchema:{schema:{type:"object",properties:{defaultVoiceId:{type:"string",description:"Optional default voice identifier for synthesis requests."}}},example:{defaultVoiceId:"pNInz6obpgDQGcFmaJgB"}},secretSchema:{schema:{type:"object",required:["apiKey"],properties:{apiKey:{type:"string",description:"ElevenLabs API key with text-to-speech permissions."}}},example:{apiKey:"eleven-***"}},healthCheck:{method:"custom",timeoutMs:4000},docsUrl:"https://elevenlabs.io/docs/api-reference/text-to-speech",constraints:{rateLimit:{rpm:120}},byokSetup:{setupInstructions:"Create an ElevenLabs API key and ensure the desired voices are accessible to the key scope."}};var Y9={meta:{key:"email.gmail",version:"1.0.0",category:"email",title:"Google Gmail API",description:"Gmail integration supporting inbound thread ingestion and outbound transactional email.",domain:"communications",owners:["platform.messaging"],tags:["email","gmail"],stability:A.Beta},supportedModes:["managed","byok"],capabilities:{provides:[{key:"email.inbound",version:"1.0.0"},{key:"email.outbound",version:"1.0.0"}]},configSchema:{schema:{type:"object",properties:{labelIds:{type:"array",items:{type:"string"},description:"Optional list of label IDs to scope inbound sync."},includeSpamTrash:{type:"boolean",description:"Whether to include spam or trash messages during sync."}}},example:{labelIds:["INBOX"],includeSpamTrash:!1}},secretSchema:{schema:{type:"object",required:["clientId","clientSecret","refreshToken"],properties:{clientId:{type:"string",description:"OAuth client ID for the Google Cloud project."},clientSecret:{type:"string",description:"OAuth client secret for the Google Cloud project."},refreshToken:{type:"string",description:"OAuth refresh token for delegated Gmail access."},redirectUri:{type:"string",description:"Optional redirect URI used when issuing the refresh token."}}},example:{clientId:"xxx.apps.googleusercontent.com",clientSecret:"secret",refreshToken:"refresh-token"}},healthCheck:{method:"custom",timeoutMs:4000},docsUrl:"https://developers.google.com/gmail/api",constraints:{rateLimit:{rpm:600}},byokSetup:{setupInstructions:"Create an OAuth consent screen and credentials within Google Cloud Console, then authorize the Gmail scopes and store the resulting refresh token."}};var z9={meta:{key:"calendar.google",version:"1.0.0",category:"calendar",title:"Google Calendar API",description:"Google Calendar integration for event creation, updates, and scheduling automations.",domain:"productivity",owners:["platform.messaging"],tags:["calendar","google"],stability:A.Beta},supportedModes:["managed","byok"],capabilities:{provides:[{key:"calendar.events",version:"1.0.0"}]},configSchema:{schema:{type:"object",properties:{calendarId:{type:"string",description:"Default calendar identifier (defaults to primary)."}}},example:{calendarId:"primary"}},secretSchema:{schema:{type:"object",required:["clientEmail","privateKey"],properties:{clientEmail:{type:"string",description:"Service account client email."},privateKey:{type:"string",description:"Service account private key."},projectId:{type:"string",description:"Google Cloud project ID."}}},example:{clientEmail:"svc-calendar@example.iam.gserviceaccount.com",privateKey:"-----BEGIN PRIVATE KEY-----...",projectId:"calendar-project"}},healthCheck:{method:"custom",timeoutMs:4000},docsUrl:"https://developers.google.com/calendar/api",constraints:{},byokSetup:{setupInstructions:"Create a Google service account with Calendar access and share the target calendars with the service account email."}};var Q9={meta:{key:"sms.twilio",version:"1.0.0",category:"sms",title:"Twilio Messaging",description:"Twilio SMS integration for transactional and notification messaging.",domain:"communications",owners:["platform.messaging"],tags:["sms","messaging"],stability:A.Stable},supportedModes:["managed","byok"],capabilities:{provides:[{key:"sms.outbound",version:"1.0.0"}]},configSchema:{schema:{type:"object",properties:{fromNumber:{type:"string",description:"Default Twilio phone number used as sender."}}},example:{fromNumber:"+15551234567"}},secretSchema:{schema:{type:"object",required:["accountSid","authToken"],properties:{accountSid:{type:"string",description:"Twilio Account SID."},authToken:{type:"string",description:"Twilio Auth Token."}}},example:{accountSid:"ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",authToken:"auth-token"}},healthCheck:{method:"custom",timeoutMs:3000},docsUrl:"https://www.twilio.com/docs/sms/api",constraints:{rateLimit:{rpm:200}},byokSetup:{setupInstructions:"Provide a Twilio account SID, auth token, and verify the outbound sending numbers used by the integration."}};var w9={meta:{key:"storage.gcs",version:"1.0.0",category:"storage",title:"Google Cloud Storage Buckets",description:"Google Cloud Storage integration for object storage and retrieval.",domain:"infrastructure",owners:["platform.infrastructure"],tags:["storage","gcs","google-cloud"],stability:A.Beta},supportedModes:["managed","byok"],capabilities:{provides:[{key:"storage.objects",version:"1.0.0"}]},configSchema:{schema:{type:"object",required:["bucket"],properties:{bucket:{type:"string",description:"Primary bucket name used for storing objects."},prefix:{type:"string",description:"Optional prefix applied to object keys."}}},example:{bucket:"pfo-tenant-assets",prefix:"documents/"}},secretSchema:{schema:{type:"object",properties:{type:{type:"string",description:"Service account type field from Google credentials JSON (if provided)."},client_email:{type:"string"},private_key:{type:"string"},project_id:{type:"string"}}},example:{type:"service_account",client_email:"svc-account@example.iam.gserviceaccount.com",private_key:"-----BEGIN PRIVATE KEY-----...",project_id:"example-project"}},healthCheck:{method:"ping",timeoutMs:4000},docsUrl:"https://cloud.google.com/storage/docs/apis",constraints:{quotas:{storageGb:5120}},byokSetup:{setupInstructions:"Create a Google Cloud service account with Storage Object Admin role and upload the JSON credentials to the secret store."}};var G9={meta:{key:"openbanking.powens",version:"1.0.0",category:"open-banking",title:"Powens Open Banking (Read)",description:"Read-only Open Banking integration powered by Powens, exposing accounts, transactions, and balances.",domain:"finance",owners:["platform.finance"],tags:["open-banking","powens","finance"],stability:A.Experimental},supportedModes:["byok"],capabilities:{provides:[{key:"openbanking.accounts.read",version:"1.0.0"},{key:"openbanking.transactions.read",version:"1.0.0"},{key:"openbanking.balances.read",version:"1.0.0"}]},configSchema:{schema:{type:"object",required:["environment"],properties:{environment:{type:"string",enum:["sandbox","production"],description:"Powens environment to target. Sandbox uses Powens test API base URL, production uses live endpoints."},baseUrl:{type:"string",description:"Optional override for the Powens API base URL. Defaults to Powens environment defaults."},region:{type:"string",description:"Optional Powens region identifier when targeting a specific data residency cluster."},pollingIntervalMs:{type:"number",description:"Optional custom polling interval in milliseconds for background sync jobs (defaults to platform standard)."}}},example:{environment:"sandbox",baseUrl:"https://api-sandbox.powens.com/v2",region:"eu-west-1",pollingIntervalMs:300000}},secretSchema:{schema:{type:"object",required:["clientId","clientSecret"],properties:{clientId:{type:"string",description:"Powens OAuth client identifier obtained from the Powens Console (BYOK project)."},clientSecret:{type:"string",description:"Powens OAuth client secret used to exchange for access tokens."},apiKey:{type:"string",description:"Optional Powens API key (if the tenant project exposes a dedicated API token)."},webhookSecret:{type:"string",description:"Optional webhook signing secret used to verify Powens webhook payloads."}}},example:{clientId:"powens-client-id",clientSecret:"powens-client-secret",apiKey:"powens-api-key",webhookSecret:"powens-webhook-secret"}},healthCheck:{method:"ping",timeoutMs:8000},docsUrl:"https://docs.powens.com/",constraints:{rateLimit:{rph:1e4,rpm:600}},byokSetup:{setupInstructions:"Create a Powens BYOK project, generate OAuth credentials, and optionally configure webhook delivery for account/transaction updates.",requiredScopes:["accounts:read","transactions:read","balances:read"]}};var F1=new T({name:"BankAccountRecord",description:"Canonical representation of a bank account synced from an open banking provider.",fields:{id:{type:w.ID(),isOptional:!1},tenantId:{type:w.ID(),isOptional:!1},userId:{type:w.ID(),isOptional:!1},connectionId:{type:w.ID(),isOptional:!1},externalId:{type:w.NonEmptyString(),isOptional:!1},institutionId:{type:w.NonEmptyString(),isOptional:!1},institutionName:{type:w.NonEmptyString(),isOptional:!1},institutionLogoUrl:{type:w.URL(),isOptional:!0},iban:{type:w.String_unsecure(),isOptional:!0},bic:{type:w.String_unsecure(),isOptional:!0},accountType:{type:w.NonEmptyString(),isOptional:!1},currency:{type:w.Currency(),isOptional:!1},displayName:{type:w.NonEmptyString(),isOptional:!1},accountNumberMasked:{type:w.String_unsecure(),isOptional:!0},productCode:{type:w.String_unsecure(),isOptional:!0},balance:{type:w.Float_unsecure(),isOptional:!0},availableBalance:{type:w.Float_unsecure(),isOptional:!0},lastSyncedAt:{type:w.DateTime(),isOptional:!1},createdAt:{type:w.DateTime(),isOptional:!1},updatedAt:{type:w.DateTime(),isOptional:!1},metadata:{type:w.JSONObject(),isOptional:!0}}}),N4=new T({name:"BankTransactionRecord",description:"Canonical transaction entry mapped from Powens into the open banking ledger.",fields:{id:{type:w.ID(),isOptional:!1},accountId:{type:w.ID(),isOptional:!1},tenantId:{type:w.ID(),isOptional:!1},connectionId:{type:w.ID(),isOptional:!1},externalId:{type:w.NonEmptyString(),isOptional:!1},amount:{type:w.Float_unsecure(),isOptional:!1},currency:{type:w.Currency(),isOptional:!1},date:{type:w.DateTime(),isOptional:!1},bookingDate:{type:w.DateTime(),isOptional:!0},valueDate:{type:w.DateTime(),isOptional:!0},description:{type:w.String_unsecure(),isOptional:!0},counterpartyName:{type:w.String_unsecure(),isOptional:!0},counterpartyAccount:{type:w.String_unsecure(),isOptional:!0},merchantCategoryCode:{type:w.String_unsecure(),isOptional:!0},rawCategory:{type:w.String_unsecure(),isOptional:!0},standardizedCategory:{type:w.String_unsecure(),isOptional:!0},transactionType:{type:w.NonEmptyString(),isOptional:!1},status:{type:w.NonEmptyString(),isOptional:!1},runningBalance:{type:w.Float_unsecure(),isOptional:!0},metadata:{type:w.JSONObject(),isOptional:!0},createdAt:{type:w.DateTime(),isOptional:!1},updatedAt:{type:w.DateTime(),isOptional:!1}}}),I1=new T({name:"AccountBalanceRecord",description:"Canonical balance snapshot computed from Powens balance payloads.",fields:{id:{type:w.ID(),isOptional:!1},accountId:{type:w.ID(),isOptional:!1},tenantId:{type:w.ID(),isOptional:!1},connectionId:{type:w.ID(),isOptional:!1},balanceType:{type:w.NonEmptyString(),isOptional:!1},currentBalance:{type:w.Float_unsecure(),isOptional:!1},availableBalance:{type:w.Float_unsecure(),isOptional:!0},currency:{type:w.Currency(),isOptional:!1},lastUpdatedAt:{type:w.DateTime(),isOptional:!1},createdAt:{type:w.DateTime(),isOptional:!1},metadata:{type:w.JSONObject(),isOptional:!0}}});var Z4=["iban","bic","accountNumberMasked","accountNumber","counterpartyName","counterpartyAccount","description","merchantName","merchantCategoryCode","reference"],u={accountsSynced:"openbanking.accounts.synced",accountsSyncFailed:"openbanking.accounts.sync_failed",transactionsSynced:"openbanking.transactions.synced",transactionsSyncFailed:"openbanking.transactions.sync_failed",balancesRefreshed:"openbanking.balances.refreshed",balancesRefreshFailed:"openbanking.balances.refresh_failed",overviewGenerated:"openbanking.overview.generated"};var F0=(J)=>({...J,meta:{...J.meta,kind:"command"},policy:{...J.policy,idempotent:J.policy?.policy?.idempotent??!1}}),U0=(J)=>({...J,meta:{...J.meta,kind:"query"},policy:{...J.policy,idempotent:!0}});var f3=new T({name:"OpenBankingListAccountsInput",description:"Parameters for listing bank accounts through the open banking provider.",fields:{tenantId:{type:w.ID(),isOptional:!1},userId:{type:w.ID(),isOptional:!1},connectionId:{type:w.ID(),isOptional:!0},includeBalances:{type:w.Boolean(),isOptional:!0},institutionId:{type:w.String_unsecure(),isOptional:!0},cursor:{type:w.String_unsecure(),isOptional:!0},pageSize:{type:w.Int_unsecure(),isOptional:!0}}}),o3=new T({name:"OpenBankingListAccountsOutput",description:"Paginated list of bank accounts available to the tenant and user.",fields:{accounts:{type:F1,isOptional:!1,isArray:!0},nextCursor:{type:w.String_unsecure(),isOptional:!0},hasMore:{type:w.Boolean(),isOptional:!0}}}),l3=new T({name:"OpenBankingGetAccountInput",description:"Parameters for retrieving a specific bank account.",fields:{tenantId:{type:w.ID(),isOptional:!1},accountId:{type:w.ID(),isOptional:!1},includeBalances:{type:w.Boolean(),isOptional:!0},includeLatestTransactions:{type:w.Boolean(),isOptional:!0}}}),r3=new T({name:"OpenBankingSyncAccountsInput",description:"Command payload to trigger an account synchronisation against the open banking provider.",fields:{tenantId:{type:w.ID(),isOptional:!1},userId:{type:w.ID(),isOptional:!0},connectionId:{type:w.ID(),isOptional:!1},accountIds:{type:w.ID(),isArray:!0,isOptional:!0},forceFullRefresh:{type:w.Boolean(),isOptional:!0},triggerWorkflows:{type:w.Boolean(),isOptional:!0}}}),p3=new T({name:"OpenBankingSyncAccountsOutput",description:"Result of a bank account synchronisation run.",fields:{synced:{type:w.Int_unsecure(),isOptional:!1},failed:{type:w.Int_unsecure(),isOptional:!1},errors:{type:w.String_unsecure(),isArray:!0,isOptional:!0},nextSyncSuggestedAt:{type:w.DateTime(),isOptional:!0}}}),V9=U0({meta:{key:"openbanking.accounts.list",version:"1.0.0",description:"List bank accounts available to a tenant/user via Powens Open Banking.",goal:"Provide downstream workflows with the set of accounts accessible via the configured open banking connection.",context:"Used by Pocket Family Office dashboards and sync workflows to enumerate bank accounts prior to syncing balances or transactions.",owners:["@platform.finance"],tags:["open-banking","powens","accounts"],stability:"experimental"},io:{input:f3,output:o3},policy:{auth:"user"}}),K9=U0({meta:{key:"openbanking.accounts.get",version:"1.0.0",description:"Retrieve the canonical bank account record for the given account identifier.",goal:"Allow user-facing experiences and automations to display up-to-date account metadata.",context:"Invoked by UI surfaces and workflow automation steps that require detailed metadata for a specific bank account.",owners:["@platform.finance"],tags:["open-banking","powens","accounts"],stability:"experimental"},io:{input:l3,output:F1},policy:{auth:"user"}}),R9=F0({meta:{key:"openbanking.accounts.sync",version:"1.0.0",description:"Initiate a synchronisation run to refresh bank account metadata from Powens.",goal:"Keep canonical bank account records aligned with the external open banking provider.",context:"Triggered by scheduled workflows or manual operator actions to reconcile account metadata prior to transaction/balance syncs.",owners:["@platform.finance"],tags:["open-banking","powens","accounts"],stability:"experimental"},io:{input:r3,output:p3},policy:{auth:"admin"},telemetry:{success:{event:{key:u.accountsSynced},properties:({input:J,output:X})=>{let H=J,W=X;return{tenantId:H?.tenantId,connectionId:H?.connectionId,synced:W?.synced,failed:W?.failed}}},failure:{event:{key:u.accountsSyncFailed},properties:({input:J,error:X})=>{let H=J;return{tenantId:H?.tenantId,connectionId:H?.connectionId,error:X instanceof Error?X.message:String(X??"unknown")}}}}});var d3=new T({name:"OpenBankingListTransactionsInput",description:"Parameters for listing bank transactions from the canonical ledger.",fields:{tenantId:{type:w.ID(),isOptional:!1},accountId:{type:w.ID(),isOptional:!1},from:{type:w.DateTime(),isOptional:!0},to:{type:w.DateTime(),isOptional:!0},cursor:{type:w.String_unsecure(),isOptional:!0},pageSize:{type:w.Int_unsecure(),isOptional:!0},direction:{type:w.String_unsecure(),isOptional:!0},minimumAmount:{type:w.Float_unsecure(),isOptional:!0},maximumAmount:{type:w.Float_unsecure(),isOptional:!0},category:{type:w.String_unsecure(),isOptional:!0}}}),n3=new T({name:"OpenBankingListTransactionsOutput",description:"Paginated list of transactions for a bank account.",fields:{transactions:{type:N4,isOptional:!1,isArray:!0},nextCursor:{type:w.String_unsecure(),isOptional:!0},hasMore:{type:w.Boolean(),isOptional:!0}}}),i3=new T({name:"OpenBankingSyncTransactionsInput",description:"Command payload to synchronise transactions from the open banking provider into the canonical ledger.",fields:{tenantId:{type:w.ID(),isOptional:!1},accountId:{type:w.ID(),isOptional:!1},from:{type:w.DateTime(),isOptional:!0},to:{type:w.DateTime(),isOptional:!0},connectionId:{type:w.ID(),isOptional:!0},includePending:{type:w.Boolean(),isOptional:!0},backfillDays:{type:w.Int_unsecure(),isOptional:!0}}}),t3=new T({name:"OpenBankingSyncTransactionsOutput",description:"Result of a transaction synchronisation run.",fields:{synced:{type:w.Int_unsecure(),isOptional:!1},failed:{type:w.Int_unsecure(),isOptional:!1},earliestSyncedAt:{type:w.DateTime(),isOptional:!0},latestSyncedAt:{type:w.DateTime(),isOptional:!0},nextSinceToken:{type:w.String_unsecure(),isOptional:!0},errors:{type:w.String_unsecure(),isArray:!0,isOptional:!0}}}),N9=U0({meta:{key:"openbanking.transactions.list",version:"1.0.0",description:"List bank transactions that have been normalised into the canonical ledger.",goal:"Allow downstream analytics and UI surfaces to page through canonical bank transactions.",context:"Used by Pocket Family Office dashboards, reconciliation workflows, and analytics data views.",owners:["@platform.finance"],tags:["open-banking","powens","transactions"],stability:"experimental"},io:{input:d3,output:n3},policy:{auth:"user"}}),Z9=F0({meta:{key:"openbanking.transactions.sync",version:"1.0.0",description:"Synchronise transactions for a bank account by calling the configured open banking provider.",goal:"Ensure the canonical transaction ledger stays aligned with the external provider.",context:"Triggered by scheduled workflows or on-demand actions when activity is expected on an account.",owners:["@platform.finance"],tags:["open-banking","powens","transactions"],stability:"experimental"},io:{input:i3,output:t3},policy:{auth:"admin"},telemetry:{success:{event:{key:u.transactionsSynced},properties:({input:J,output:X})=>{let H=J,W=X;return{tenantId:H?.tenantId,accountId:H?.accountId,synced:W?.synced,failed:W?.failed,earliestSyncedAt:W?.earliestSyncedAt,latestSyncedAt:W?.latestSyncedAt}}},failure:{event:{key:u.transactionsSyncFailed},properties:({input:J,error:X})=>{let H=J;return{tenantId:H?.tenantId,accountId:H?.accountId,error:X instanceof Error?X.message:String(X??"unknown")}}}}});var a3=new T({name:"OpenBankingGetBalancesInput",description:"Parameters for retrieving bank account balances from the canonical ledger.",fields:{tenantId:{type:w.ID(),isOptional:!1},accountId:{type:w.ID(),isOptional:!1},balanceTypes:{type:w.String_unsecure(),isArray:!0,isOptional:!0}}}),s3=new T({name:"OpenBankingGetBalancesOutput",description:"Canonical balances for a bank account.",fields:{balances:{type:I1,isOptional:!1,isArray:!0},asOf:{type:w.DateTime(),isOptional:!0}}}),e3=new T({name:"OpenBankingRefreshBalancesInput",description:"Command payload to refresh balances for a bank account via the open banking provider.",fields:{tenantId:{type:w.ID(),isOptional:!1},accountId:{type:w.ID(),isOptional:!1},connectionId:{type:w.ID(),isOptional:!0},balanceTypes:{type:w.String_unsecure(),isArray:!0,isOptional:!0},forceRefresh:{type:w.Boolean(),isOptional:!0}}}),JW=new T({name:"OpenBankingRefreshBalancesOutput",description:"Result of a balance refresh against the open banking provider.",fields:{balances:{type:I1,isOptional:!1,isArray:!0},refreshedAt:{type:w.DateTime(),isOptional:!1},errors:{type:w.String_unsecure(),isArray:!0,isOptional:!0}}}),L9=U0({meta:{key:"openbanking.balances.get",version:"1.0.0",description:"Retrieve the latest cached balances for a bank account.",goal:"Expose current and available balances required by dashboards and analytics.",context:"Used by Pocket Family Office UI surfaces and automation steps that require balance totals prior to generating summaries.",owners:["@platform.finance"],tags:["open-banking","powens","balances"],stability:"experimental"},io:{input:a3,output:s3},policy:{auth:"user"}}),b9=F0({meta:{key:"openbanking.balances.refresh",version:"1.0.0",description:"Refresh balances for a bank account via the configured open banking provider.",goal:"Ensure canonical balance records reflect the latest values from Powens.",context:"Triggered by scheduled workflows before generating summaries or forecasting cashflow.",owners:["@platform.finance"],tags:["open-banking","powens","balances"],stability:"experimental"},io:{input:e3,output:JW},policy:{auth:"admin"},telemetry:{success:{event:{key:u.balancesRefreshed},properties:({input:J,output:X})=>{let H=J,W=X;return{tenantId:H?.tenantId,accountId:H?.accountId,refreshedAt:W?.refreshedAt,balanceCount:Array.isArray(W?.balances)?W?.balances.length:void 0}}},failure:{event:{key:u.balancesRefreshFailed},properties:({input:J,error:X})=>{let H=J;return{tenantId:H?.tenantId,accountId:H?.accountId,error:X instanceof Error?X.message:String(X??"unknown")}}}}});var HW=L0("Source",["upload","email","sync"]),WW=L0("Channel",["email","sms","both"]),qW=L0("Period",["P7d","P30d","P90d"]),YW=L0("ObPeriod",["Pweek","Pmonth","Pquarter"]),zW=m({name:"UploadDocumentInput",fields:{bucket:{type:w.NonEmptyString(),isOptional:!1},objectKey:{type:w.NonEmptyString(),isOptional:!1},mimeType:{type:w.NonEmptyString(),isOptional:!1},bytes:{type:w.Int_unsecure(),isOptional:!1},tags:{type:w.String_unsecure(),isOptional:!1,isArray:!0},uploadedAt:{type:w.Date(),isOptional:!1},source:{type:HW,isOptional:!1}}}),QW=m({name:"UploadDocumentOutput",fields:{documentId:{type:w.String_unsecure(),isOptional:!1},ingestionJobId:{type:w.String_unsecure(),isOptional:!1}}}),wW={meta:{key:"pfo.documents.upload",version:"1.0.0",kind:"command",description:"Stores an object in tenant storage and schedules ingestion into the knowledge base.",goal:"Allow users to ingest financial documents for processing.",context:"Part of the finance domain. Documents are uploaded to object storage and then processed by the ingestion pipeline.",owners:[K.PlatformFinance],tags:["documents","ingestion",R.Guide],stability:A.Experimental},io:{input:zW,output:QW},policy:{auth:"user",rateLimit:{rpm:30,key:"user"}}},GW=m({name:"PaymentReminderInput",fields:{billId:{type:w.String_unsecure(),isOptional:!1},recipientEmail:{type:w.EmailAddress(),isOptional:!1},recipientPhone:{type:w.String_unsecure(),isOptional:!0},dueDate:{type:w.Date(),isOptional:!1},amountCents:{type:w.Int_unsecure(),isOptional:!1},currency:{type:w.Currency(),isOptional:!1},channel:{type:WW,isOptional:!1},memo:{type:w.String_unsecure(),isOptional:!0}}}),UW=m({name:"PaymentReminderOutput",fields:{reminderId:{type:w.String_unsecure(),isOptional:!1},scheduledAt:{type:w.Date(),isOptional:!1}}}),DW={meta:{key:"pfo.reminders.schedule-payment",version:"1.0.0",kind:"command",description:"Queues outbound email/SMS reminders for upcoming bills and adds an optional calendar hold.",goal:"Ensure bills are paid on time by notifying users.",context:"Finance automation. Reminders are sent via configured channels (email, SMS).",owners:[K.PlatformFinance],tags:["payments","reminders",R.Automation],stability:A.Beta},io:{input:GW,output:UW},policy:{auth:"user"}},PW=m({name:"FinancialSummaryInput",fields:{period:{type:qW,isOptional:!1},includeVoiceSummary:{type:w.Boolean(),isOptional:!1}}}),BW=m({name:"SummaryHighlight",fields:{label:{type:w.String_unsecure(),isOptional:!1},value:{type:w.String_unsecure(),isOptional:!1}}}),MW=m({name:"FinancialSummaryOutput",fields:{summaryId:{type:w.String_unsecure(),isOptional:!1},generatedAt:{type:w.Date(),isOptional:!1},markdown:{type:w.String_unsecure(),isOptional:!1},highlights:{type:BW,isOptional:!1,isArray:!0},cashflowDelta:{type:w.Float_unsecure(),isOptional:!1}}}),FW={meta:{key:"pfo.summary.generate",version:"1.0.0",kind:"query",description:"Runs RAG over financial documents and email threads to provide a natural-language summary with key metrics.",goal:"Provide a quick overview of financial status and recent activity.",context:"Uses RAG over ingested knowledge. Summaries can be dispatched or viewed in app.",owners:[K.PlatformFinance],tags:["summary","ai",R.Automation],stability:A.Beta},io:{input:PW,output:MW},policy:{auth:"user"}},IW=m({name:"SyncEmailThreadsInput",fields:{labelIds:{type:w.String_unsecure(),isOptional:!1,isArray:!0},maxThreads:{type:w.Int_unsecure(),isOptional:!1},syncSinceMinutes:{type:w.Int_unsecure(),isOptional:!1}}}),$W=m({name:"SyncEmailThreadsOutput",fields:{syncedThreads:{type:w.Int_unsecure(),isOptional:!1},lastMessageAt:{type:w.Date(),isOptional:!0}}}),AW={meta:{key:"pfo.email.sync-threads",version:"1.0.0",kind:"command",description:"Triggers ingestion of Gmail threads into the operational knowledge space.",goal:"Keep knowledge base up to date with email communications.",context:"Syncs from Gmail integration. Only includes threads matching configured labels.",owners:[K.PlatformMessaging],tags:["gmail","knowledge",R.Automation],stability:A.Beta},io:{input:IW,output:$W},policy:{auth:"user"}},OW=m({name:"SummaryDispatchInput",fields:{summaryId:{type:w.String_unsecure(),isOptional:!1},recipientEmail:{type:w.EmailAddress(),isOptional:!1},recipientName:{type:w.String_unsecure(),isOptional:!0},includeVoice:{type:w.Boolean(),isOptional:!1},voiceRecipient:{type:w.String_unsecure(),isOptional:!0}}}),VW=m({name:"SummaryDispatchOutput",fields:{dispatchId:{type:w.String_unsecure(),isOptional:!1},emailSent:{type:w.Boolean(),isOptional:!1},voiceUrl:{type:w.String_unsecure(),isOptional:!0}}}),KW={meta:{key:"pfo.summary.dispatch",version:"1.0.0",kind:"command",description:"Delivers the generated summary via email and optionally synthesises a voice note.",goal:"Deliver financial insights to users proactively.",context:"Dispatches summaries generated by pfo.summary.generate via email or voice.",owners:[K.PlatformMessaging],tags:["summary","communications",R.Automation],stability:A.Experimental},io:{input:OW,output:VW},policy:{auth:"user"}},RW=m({name:"OpenBankingOverviewInput",fields:{tenantId:{type:w.String_unsecure(),isOptional:!1},accountIds:{type:w.String_unsecure(),isOptional:!0,isArray:!0},period:{type:YW,isOptional:!1},asOf:{type:w.Date(),isOptional:!0},includeCategories:{type:w.Boolean(),isOptional:!1},includeCashflowTrend:{type:w.Boolean(),isOptional:!1}}}),NW=m({name:"OpenBankingOverviewOutput",fields:{knowledgeEntryId:{type:w.String_unsecure(),isOptional:!1},periodStart:{type:w.Date(),isOptional:!1},periodEnd:{type:w.Date(),isOptional:!1},generatedAt:{type:w.Date(),isOptional:!1},summaryPath:{type:w.String_unsecure(),isOptional:!0}}}),ZW={meta:{key:"pfo.openbanking.generate-overview",version:"1.0.0",kind:"command",description:"Aggregates balances and transactions into a derived financial overview stored in the knowledge layer.",goal:"Create a periodic financial snapshot.",context:"Aggregates data from open banking integration into a document.",owners:[K.PlatformFinance],tags:["open-banking","summary",R.Automation],stability:A.Experimental},io:{input:RW,output:NW},policy:{auth:"user"},telemetry:{success:{event:{key:u.overviewGenerated,version:"1.0.0"}}}},KG={"pfo.documents.upload":wW,"pfo.reminders.schedule-payment":DW,"pfo.summary.generate":FW,"pfo.summary.dispatch":KW,"pfo.email.sync-threads":AW,"pfo.openbanking.generate-overview":ZW};var ZG={meta:{key:"pfo.workflow.process-uploaded-document",version:"1.0.0",title:"Process Uploaded Document",description:"Stores an uploaded invoice/contract, queues ingestion, and records any follow-up reminders.",domain:"finance",owners:[K.PlatformFinance],tags:["documents","ingestion",R.Automation],stability:A.Experimental},definition:{entryStepId:"store",steps:[{id:"store",type:"automation",label:"Store and Queue Ingestion",description:"Persist the document to storage and enqueue the knowledge ingestion pipeline.",action:{operation:{key:"pfo.documents.upload",version:"1.0.0"}},requiredIntegrations:["primaryStorage","primaryVectorDb"],retry:{maxAttempts:3,backoff:"exponential",delayMs:500}},{id:"review",type:"human",label:"Optional Human Classification",description:"Finance lead can categorise the document while ingestion completes."}],transitions:[{from:"store",to:"review"}]}};var _G={meta:{key:"pfo.workflow.upcoming-payments-reminder",version:"1.0.0",title:"Schedule Upcoming Payment Reminder",description:"Collects payment metadata and schedules multi-channel reminders for bills that are due soon.",domain:"finance",owners:[K.PlatformFinance],tags:["payments","reminders",R.Automation],stability:A.Beta},definition:{entryStepId:"collect",steps:[{id:"collect",type:"human",label:"Review Upcoming Bill",description:"Confirm amount, due date, and preferred delivery channels before scheduling reminder."},{id:"schedule",type:"automation",label:"Schedule Reminder",action:{operation:{key:"pfo.reminders.schedule-payment",version:"1.0.0"}},requiredIntegrations:["emailOutbound","smsNotifications","calendarScheduling"],retry:{maxAttempts:2,backoff:"linear",delayMs:1000}}],transitions:[{from:"collect",to:"schedule",condition:"output?.confirmed === true",label:"Reminder confirmed"}]}};var CG={meta:{key:"pfo.workflow.generate-financial-summary",version:"1.0.0",title:"Generate Financial Summary",description:"Retrieves the latest financial signals, generates an AI summary, and optionally distributes it by voice or email.",domain:"finance",owners:[K.PlatformFinance],tags:["summary","ai",R.Automation],stability:A.Beta},definition:{entryStepId:"summarise",steps:[{id:"summarise",type:"automation",label:"Generate Summary",description:"Run retrieval augmented generation over the knowledge base to produce a household summary.",action:{operation:{key:"pfo.summary.generate",version:"1.0.0"}},requiredIntegrations:["primaryLLM","primaryVectorDb"],retry:{maxAttempts:3,backoff:"exponential",delayMs:750}},{id:"distribute",type:"automation",label:"Distribute Summary",description:"Send the generated summary via email and optionally synthesise a voice note.",action:{operation:{key:"pfo.summary.dispatch",version:"1.0.0"}},requiredIntegrations:["emailOutbound"],retry:{maxAttempts:2,backoff:"linear",delayMs:500}}],transitions:[{from:"summarise",to:"distribute"}]}};var TG={meta:{key:"pfo.workflow.ingest-email-threads",version:"1.0.0",title:"Ingest Email Threads",description:"Synchronises Gmail threads tagged with finance labels and indexes them into operational knowledge spaces.",domain:"communications",owners:[K.PlatformMessaging],tags:["gmail","knowledge",R.Automation],stability:A.Experimental},definition:{entryStepId:"sync",steps:[{id:"sync",type:"automation",label:"Sync Gmail Threads",description:"Fetches Gmail threads and transforms them into knowledge fragments before vector indexing.",action:{operation:{key:"pfo.email.sync-threads",version:"1.0.0"}},requiredIntegrations:["emailInbound","primaryVectorDb"],retry:{maxAttempts:3,backoff:"exponential",delayMs:1000}},{id:"triage",type:"human",label:"Triage Exceptions",description:"Operators can resolve sync failures or tag important threads for follow-up."}],transitions:[{from:"sync",to:"triage",condition:"output?.syncedThreads === 0",label:"No new threads"}]}};var _9={key:"openbanking.accounts.read",version:"1.0.0"},xG={meta:{key:"pfo.workflow.sync-openbanking-accounts",version:"1.0.0",title:"Synchronise Open Banking Accounts",description:"Validates Powens connectivity and synchronises bank account metadata into the canonical ledger.",domain:"finance",owners:[K.PlatformFinance],tags:["open-banking","powens",R.Automation],stability:A.Experimental},definition:{entryStepId:"sync-accounts",steps:[{id:"sync-accounts",type:"automation",label:"Sync Accounts",description:"Refresh linked bank accounts via Powens and upsert canonical BankAccount records.",action:{operation:{key:"openbanking.accounts.sync",version:"1.0.0"}},requiredIntegrations:["primaryOpenBanking"],requiredCapabilities:[_9],retry:{maxAttempts:3,backoff:"exponential",delayMs:1000}},{id:"fetch-accounts",type:"automation",label:"Fetch Accounts",description:"Retrieve the latest canonical account snapshot for downstream consumers.",action:{operation:{key:"openbanking.accounts.list",version:"1.0.0"}},requiredIntegrations:["primaryOpenBanking"],requiredCapabilities:[_9],retry:{maxAttempts:2,backoff:"linear",delayMs:750}}],transitions:[{from:"sync-accounts",to:"fetch-accounts"}]}};var E9={key:"openbanking.transactions.read",version:"1.0.0"},uG={meta:{key:"pfo.workflow.sync-openbanking-transactions",version:"1.0.0",title:"Synchronise Open Banking Transactions",description:"Fetches recent transactions from Powens for each linked account and stores them in the canonical ledger.",domain:"finance",owners:[K.PlatformFinance],tags:["open-banking","powens",R.Automation],stability:A.Experimental},definition:{entryStepId:"sync-transactions",steps:[{id:"sync-transactions",type:"automation",label:"Sync Transactions",description:"Call the Powens provider to pull incremental transactions for active accounts.",action:{operation:{key:"openbanking.transactions.sync",version:"1.0.0"}},requiredIntegrations:["primaryOpenBanking"],requiredCapabilities:[E9],retry:{maxAttempts:4,backoff:"exponential",delayMs:1500}},{id:"list-transactions",type:"automation",label:"List Transactions",description:"Retrieve the canonical transaction list for reporting and downstream analytics.",action:{operation:{key:"openbanking.transactions.list",version:"1.0.0"}},requiredIntegrations:["primaryOpenBanking"],requiredCapabilities:[E9],retry:{maxAttempts:2,backoff:"linear",delayMs:1000}}],transitions:[{from:"sync-transactions",to:"list-transactions"}]}};var k9={key:"openbanking.balances.read",version:"1.0.0"},fG={meta:{key:"pfo.workflow.refresh-openbanking-balances",version:"1.0.0",title:"Refresh Open Banking Balances",description:"Refreshes balances for synced accounts to surface the latest cash positions in dashboards.",domain:"finance",owners:[K.PlatformFinance],tags:["open-banking","powens",R.Automation],stability:A.Experimental},definition:{entryStepId:"refresh-balances",steps:[{id:"refresh-balances",type:"automation",label:"Refresh Balances",description:"Trigger the Powens provider to obtain current and available balances.",action:{operation:{key:"openbanking.balances.refresh",version:"1.0.0"}},requiredIntegrations:["primaryOpenBanking"],requiredCapabilities:[k9],retry:{maxAttempts:3,backoff:"exponential",delayMs:1000}},{id:"fetch-balances",type:"automation",label:"Fetch Balances",description:"Load the canonical balance snapshots for downstream workflows and dashboards.",action:{operation:{key:"openbanking.balances.get",version:"1.0.0"}},requiredIntegrations:["primaryOpenBanking"],requiredCapabilities:[k9],retry:{maxAttempts:2,backoff:"linear",delayMs:750}}],transitions:[{from:"refresh-balances",to:"fetch-balances"}]}};var LW=[{key:"openbanking.accounts.read",version:"1.0.0"},{key:"openbanking.transactions.read",version:"1.0.0"},{key:"openbanking.balances.read",version:"1.0.0"}],rG={meta:{key:"pfo.workflow.generate-openbanking-overview",version:"1.0.0",title:"Generate Open Banking Overview",description:"Produces a derived financial overview and stores it in the operational knowledge space.",domain:"finance",owners:[K.PlatformFinance],tags:["open-banking","summary",R.Automation],stability:A.Experimental},definition:{entryStepId:"generate-overview",steps:[{id:"generate-overview",type:"automation",label:"Generate Overview",description:"Aggregate balances, cashflow, and category breakdowns into a knowledge entry.",action:{operation:{key:"pfo.openbanking.generate-overview",version:"1.0.0"}},requiredIntegrations:["primaryOpenBanking"],requiredCapabilities:LW,retry:{maxAttempts:3,backoff:"exponential",delayMs:1500}}],transitions:[]}};var $1={tenantId:{type:"string",required:!0,description:"Tenant identifier for multi-tenant isolation."},appId:{type:"string",required:!0,description:"Application identifier associated with the event."},blueprint:{type:"string",required:!0,description:"Blueprint name@version emitting the telemetry."},configVersion:{type:"number",required:!0,description:"Resolved app config version when the event was generated."},slotId:{type:"string",required:!0,description:"Integration slot identifier (e.g., primaryOpenBanking)."},connectionId:{type:"string",required:!0,description:"Integration connection ID used for the sync."}};function C9(J){return{type:"string",description:J,pii:!1}}var qU={meta:{key:"pfo.telemetry",version:"1.0.0",title:"Pocket Family Office Telemetry",description:"Operational telemetry for Pocket Family Office workflows, including Powens open banking syncs.",domain:"finance",owners:[K.PlatformFinance],tags:["open-banking",R.Automation],stability:A.Experimental},config:{defaultRetentionDays:180,defaultSamplingRate:1},events:[{key:u.accountsSynced,version:"1.0.0",semantics:{what:"Open banking account synchronisation completed.",why:"Refresh canonical account metadata for reporting and workflows."},privacy:"internal",properties:{...$1,syncedCount:{type:"number",description:"Number of accounts synced successfully."},failedCount:{type:"number",description:"Number of accounts that failed to sync."},durationMs:{type:"number",description:"Duration of the sync job in milliseconds."}}},{key:u.transactionsSynced,version:"1.0.0",semantics:{what:"Open banking transaction synchronisation completed.",why:"Keep canonical transaction ledger in sync for analytics."},privacy:"internal",properties:{...$1,accountId:{type:"string",description:"Bank account identifier used during the sync.",pii:!1},syncedCount:{type:"number",description:"Number of transactions synced successfully."},failedCount:{type:"number",description:"Number of transactions that failed to sync."},from:{type:"timestamp",description:"Start timestamp for the sync window."},to:{type:"timestamp",description:"End timestamp for the sync window."}}},{key:u.balancesRefreshed,version:"1.0.0",semantics:{what:"Open banking balances refreshed.",why:"Provide accurate cash position for dashboards and alerts."},privacy:"internal",properties:{...$1,accountId:C9("Bank account identifier."),balanceTypes:{type:"json",description:"Balance types included in the refresh."},refreshedAt:{type:"timestamp",description:"Timestamp when balances were refreshed."}}},{key:u.overviewGenerated,version:"1.0.0",semantics:{what:"Derived financial overview generated.",why:"Persist cashflow and category summaries into knowledge space."},privacy:"internal",properties:{...$1,knowledgeEntryId:C9("Identifier of the knowledge document containing the overview."),period:{type:"string",description:"Aggregation period used (week, month, quarter)."},periodStart:{type:"timestamp",description:"Start timestamp for the aggregation window."},periodEnd:{type:"timestamp",description:"End timestamp for the aggregation window."}},tags:["knowledge","analytics"]}]},YU=Z4;var QU={meta:{key:"pocket-family-office",version:"1.0.0",title:"Pocket Family Office",description:"Personal finance automation with document ingestion, open banking, and AI summaries",domain:"finance",owners:["@platform.finance"],tags:["finance","open-banking","documents","automation","family-office"],stability:"experimental"},operations:[{key:"pfo.documents.upload",version:"1.0.0"}],events:[],presentations:[],opToPresentation:[],presentationsTargets:[],capabilities:{provides:[{key:"pocket-family-office",version:"1.0.0"}],requires:[{key:"identity",version:"1.0.0"},{key:"openbanking",version:"1.0.0"}]}};export{wW as uploadDocumentContract,_G as upcomingPaymentsReminderWorkflow,uG as syncOpenBankingTransactionsWorkflow,xG as syncOpenBankingAccountsWorkflow,AW as syncEmailThreadsContract,DW as schedulePaymentReminderContract,kW as registerPocketFamilyOfficeBlueprint,fG as refreshOpenBankingBalancesWorkflow,ZG as processUploadedDocumentWorkflow,SW as pocketFamilyOfficeTenantSample,qU as pocketFamilyOfficeTelemetry,vW as pocketFamilyOfficeKnowledgeSources,KG as pocketFamilyOfficeContracts,T9 as pocketFamilyOfficeConnections,j9 as pocketFamilyOfficeBlueprint,TG as ingestEmailThreadsWorkflow,TW as getPocketFamilyOfficeConnection,rG as generateOpenBankingOverviewWorkflow,ZW as generateOpenBankingOverviewContract,CG as generateFinancialSummaryWorkflow,FW as generateFinancialSummaryContract,KW as dispatchFinancialSummaryContract,QU as PocketFamilyOfficeFeature,YU as OPENBANKING_SENSITIVE_FIELDS};
|
|
78
|
+
}`)}function I(J,X,H=""){return X!=null&&X!==""?J+X+H:""}function A1(J){return I(" ",J.replace(/\n/g,`
|
|
79
|
+
`))}function K8(J){var X;return(X=J===null||J===void 0?void 0:J.some((H)=>H.includes(`
|
|
80
|
+
`)))!==null&&X!==void 0?X:!1}function V1(J,X){switch(J.kind){case j.NULL:return null;case j.INT:return parseInt(J.value,10);case j.FLOAT:return parseFloat(J.value);case j.STRING:case j.ENUM:case j.BOOLEAN:return J.value;case j.LIST:return J.values.map((H)=>V1(H,X));case j.OBJECT:return P1(J.fields,(H)=>H.name.value,(H)=>V1(H.value,X));case j.VARIABLE:return X===null||X===void 0?void 0:X[J.name.value]}}function y0(J){if(J!=null||s(!1,"Must provide name."),typeof J==="string"||s(!1,"Expected name to be a string."),J.length===0)throw new p("Expected name to be a non-empty string.");for(let X=1;X<J.length;++X)if(!f4(J.charCodeAt(X)))throw new p(`Names must only contain [_a-zA-Z0-9] but "${J}" does not.`);if(!c4(J.charCodeAt(0)))throw new p(`Names must start with [_a-zA-Z] but "${J}" does not.`);return J}function I8(J){if(J==="true"||J==="false"||J==="null")throw new p(`Enum values cannot be named: ${J}`);return y0(J)}class m0{constructor(J){var X,H,W,q;let Y=(X=J.parseValue)!==null&&X!==void 0?X:V8;if(this.name=y0(J.name),this.description=J.description,this.specifiedByURL=J.specifiedByURL,this.serialize=(H=J.serialize)!==null&&H!==void 0?H:V8,this.parseValue=Y,this.parseLiteral=(W=J.parseLiteral)!==null&&W!==void 0?W:(Q,z)=>Y(V1(Q,z)),this.extensions=F1(J.extensions),this.astNode=J.astNode,this.extensionASTNodes=(q=J.extensionASTNodes)!==null&&q!==void 0?q:[],J.specifiedByURL==null||typeof J.specifiedByURL==="string"||s(!1,`${this.name} must provide "specifiedByURL" as a string, but got: ${$0(J.specifiedByURL)}.`),J.serialize==null||typeof J.serialize==="function"||s(!1,`${this.name} must provide "serialize" function. If this custom Scalar is also used as an input type, ensure "parseValue" and "parseLiteral" functions are also provided.`),J.parseLiteral)typeof J.parseValue==="function"&&typeof J.parseLiteral==="function"||s(!1,`${this.name} must provide both "parseValue" and "parseLiteral" functions.`)}get[Symbol.toStringTag](){return"GraphQLScalarType"}toConfig(){return{name:this.name,description:this.description,specifiedByURL:this.specifiedByURL,serialize:this.serialize,parseValue:this.parseValue,parseLiteral:this.parseLiteral,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function e4(J){return w1(J)&&!Array.isArray(J)}class c0{constructor(J){var X;this.name=y0(J.name),this.description=J.description,this.extensions=F1(J.extensions),this.astNode=J.astNode,this.extensionASTNodes=(X=J.extensionASTNodes)!==null&&X!==void 0?X:[],this._values=typeof J.values==="function"?J.values:J6(this.name,J.values),this._valueLookup=null,this._nameLookup=null}get[Symbol.toStringTag](){return"GraphQLEnumType"}getValues(){if(typeof this._values==="function")this._values=J6(this.name,this._values());return this._values}getValue(J){if(this._nameLookup===null)this._nameLookup=p4(this.getValues(),(X)=>X.name);return this._nameLookup[J]}serialize(J){if(this._valueLookup===null)this._valueLookup=new Map(this.getValues().map((H)=>[H.value,H]));let X=this._valueLookup.get(J);if(X===void 0)throw new p(`Enum "${this.name}" cannot represent value: ${$0(J)}`);return X.name}parseValue(J){if(typeof J!=="string"){let H=$0(J);throw new p(`Enum "${this.name}" cannot represent non-string value: ${H}.`+B1(this,H))}let X=this.getValue(J);if(X==null)throw new p(`Value "${J}" does not exist in "${this.name}" enum.`+B1(this,J));return X.value}parseLiteral(J,X){if(J.kind!==j.ENUM){let W=$1(J);throw new p(`Enum "${this.name}" cannot represent non-enum value: ${W}.`+B1(this,W),{nodes:J})}let H=this.getValue(J.value);if(H==null){let W=$1(J);throw new p(`Value "${W}" does not exist in "${this.name}" enum.`+B1(this,W),{nodes:J})}return H.value}toConfig(){let J=P1(this.getValues(),(X)=>X.name,(X)=>({description:X.description,value:X.value,deprecationReason:X.deprecationReason,extensions:X.extensions,astNode:X.astNode}));return{name:this.name,description:this.description,values:J,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function B1(J,X){let H=J.getValues().map((q)=>q.name),W=n4(X,H);return l4("the enum value",W)}function J6(J,X){return e4(X)||s(!1,`${J} values must be an object with value names as keys.`),Object.entries(X).map(([H,W])=>{return e4(W)||s(!1,`${J}.${H} must refer to an object with a "value" key representing an internal value but got: ${$0(W)}.`),{name:I8(H),description:W.description,value:W.value!==void 0?W.value:H,deprecationReason:W.deprecationReason,extensions:F1(W.extensions),astNode:W.astNode}})}var H6=class{name;values;gqlEnum;constructor(J,X){this.name=J,this.values=X,this.gqlEnum=new c0({name:this.name,values:Object.fromEntries(X.map((H)=>[H,{value:H}]))})}getName(){return this.name}getEnumValues(){return this.values}getPothos(){return this.gqlEnum}getZod(){return U8(this.values)}getJson(){return{type:"string",enum:this.values}}getJsonSchema(){return this.getJson()}},E0=(J,X)=>new H6(J,X);var x=class extends m0{zodSchema;jsonSchemaDef;constructor(J){super(J);this.zodSchema=J.zod,this.jsonSchemaDef=J.jsonSchema}getZod(){return this.zodSchema}getPothos(){return this}getJson(){return typeof this.jsonSchemaDef==="function"?this.jsonSchemaDef():this.jsonSchemaDef}getJsonSchemaDef(){return this.jsonSchemaDef}getJsonSchema(){let J=(X)=>{let H=typeof X==="function"?X():X;if(Array.isArray(H))return H.map((W)=>J(W));if(H&&typeof H==="object"){let W={};for(let[q,Y]of Object.entries(H))W[q]=J(Y);return W}return H};return J(this.getJson())}};var O8=/^[A-Za-z]{2}(?:-[A-Za-z0-9]{2,8})*$/,R8=/^(?:UTC|[A-Za-z_]+\/[A-Za-z_]+)$/,L8=/^[+]?\d[\d\s().-]{3,}$/,Z8=/^[A-Z]{3}$/,N8=/^[A-Z]{2}$/,b8=-90,E8=90,C8=-180,S8=180,G={String_unsecure:()=>new x({name:"String_unsecure",description:"Unvalidated string scalar",zod:T(),parseValue:(J)=>T().parse(J),serialize:(J)=>String(J),parseLiteral:(J)=>{if(J.kind!==j.STRING)throw TypeError("Invalid literal");return J.value},jsonSchema:{type:"string"}}),Int_unsecure:()=>new x({name:"Int_unsecure",description:"Unvalidated integer scalar",zod:A0().int(),parseValue:(J)=>{let X=typeof J==="number"?J:Number(J);return A0().int().parse(X)},serialize:(J)=>Math.trunc(typeof J==="number"?J:Number(J)),parseLiteral:(J)=>{if(J.kind!==j.INT)throw TypeError("Invalid literal");return Number(J.value)},jsonSchema:{type:"integer"}}),Float_unsecure:()=>new x({name:"Float_unsecure",description:"Unvalidated float scalar",zod:A0(),parseValue:(J)=>{let X=typeof J==="number"?J:Number(J);return A0().parse(X)},serialize:(J)=>Number(J),parseLiteral:(J)=>{if(J.kind!==j.FLOAT&&J.kind!==j.INT)throw TypeError("Invalid literal");return Number(J.value)},jsonSchema:{type:"number"}}),Boolean:()=>new x({name:"Boolean",description:"Unvalidated boolean scalar",zod:j4(),parseValue:(J)=>N0.boolean().parse(J),serialize:(J)=>Boolean(J),parseLiteral:(J)=>{if(J.kind!==j.BOOLEAN)throw TypeError("Invalid literal");return J.value},jsonSchema:{type:"boolean"}}),ID:()=>new x({name:"ID",description:"Unvalidated id scalar",zod:T(),parseValue:(J)=>T().parse(J),serialize:(J)=>String(J),parseLiteral:(J)=>{if(J.kind!==j.STRING)throw TypeError("Invalid literal");return J.value},jsonSchema:{type:"string"}}),JSON:()=>new x({name:"JSON",zod:z1(),parseValue:(J)=>J,serialize:(J)=>J,jsonSchema:{}}),JSONObject:()=>new x({name:"JSONObject",zod:G8(T(),z1()),parseValue:(J)=>G8(T(),z1()).parse(J),serialize:(J)=>J??{},jsonSchema:{type:"object"}}),Date:()=>new x({name:"Date",zod:z8(),parseValue:(J)=>J instanceof Date?J:new Date(String(J)),serialize:(J)=>J instanceof Date?J.toISOString().split("T")[0]:String(J),jsonSchema:{type:"string",format:"date"}}),DateTime:()=>new x({name:"DateTime",zod:z8(),parseValue:(J)=>J instanceof Date?J:new Date(String(J)),serialize:(J)=>{return J instanceof Date?J.toISOString():String(J)},jsonSchema:{type:"string",format:"date-time"}}),Time:()=>new x({name:"Time",zod:T().regex(/^\d{2}:\d{2}(:\d{2})?$/),parseValue:(J)=>T().regex(/^\d{2}:\d{2}(:\d{2})?$/).parse(J),serialize:(J)=>String(J),jsonSchema:{type:"string",pattern:"^\\d{2}:\\d{2}(:\\d{2})?$"}}),EmailAddress:()=>new x({name:"EmailAddress",zod:T().email(),parseValue:(J)=>T().email().parse(J),serialize:(J)=>String(J),jsonSchema:{type:"string",format:"email"}}),URL:()=>new x({name:"URL",zod:T().url(),parseValue:(J)=>T().url().parse(J),serialize:(J)=>String(J),jsonSchema:{type:"string",format:"uri"}}),PhoneNumber:()=>new x({name:"PhoneNumber",zod:T().regex(L8),parseValue:(J)=>T().regex(L8).parse(J),serialize:(J)=>String(J),jsonSchema:{type:"string",pattern:L8.source}}),NonEmptyString:()=>new x({name:"NonEmptyString",zod:T().min(1),parseValue:(J)=>T().min(1).parse(J),serialize:(J)=>String(J),jsonSchema:{type:"string",minLength:1}}),Locale:()=>new x({name:"Locale",zod:T().regex(O8),parseValue:(J)=>T().regex(O8).parse(J),serialize:(J)=>String(J),jsonSchema:{type:"string",pattern:O8.source}}),TimeZone:()=>new x({name:"TimeZone",zod:T().regex(R8),parseValue:(J)=>T().regex(R8).parse(J),serialize:(J)=>String(J),jsonSchema:{type:"string",pattern:R8.source}}),Latitude:()=>new x({name:"Latitude",zod:A0().min(b8).max(E8),parseValue:(J)=>N0.number().min(b8).max(E8).parse(J),serialize:(J)=>Number(J),jsonSchema:{type:"number",minimum:b8,maximum:E8}}),Longitude:()=>new x({name:"Longitude",zod:A0().min(C8).max(S8),parseValue:(J)=>N0.number().min(C8).max(S8).parse(J),serialize:(J)=>Number(J),jsonSchema:{type:"number",minimum:C8,maximum:S8}}),Currency:()=>new x({name:"Currency",zod:T().regex(Z8),parseValue:(J)=>T().regex(Z8).parse(J),serialize:(J)=>String(J),jsonSchema:{type:"string",pattern:Z8.source}}),CountryCode:()=>new x({name:"CountryCode",zod:T().regex(N8),parseValue:(J)=>T().regex(N8).parse(J),serialize:(J)=>String(J),jsonSchema:{type:"string",pattern:N8.source}})};var v=class{constructor(J){this.config=J}getZod(){let J=Object.entries(this.config.fields).reduce((X,[H,W])=>{let q=W.type.getZod(),Y=W.isArray?w8(q):q;return X[H]=W.isOptional?Y.optional():Y,X},{});return h4(J)}getPothosInput(){return this.config.name}};var o=(J)=>new v(J);var W6=(J,X)=>()=>(J&&(X=J(J=0)),X);var i3,k8=W6(()=>{i3={byTag:(J)=>J.meta.tags?.[0]??"untagged",byAllTags:(J)=>J.meta.tags?.length?J.meta.tags:["untagged"],byOwner:(J)=>J.meta.owners?.[0]??"unowned",byDomain:(J)=>{return(J.meta.key??J.meta.key??"").split(".")[0]??"default"},byStability:(J)=>J.meta.stability??"stable",byUrlPath:(J)=>(X)=>{if(!X.path)return"root";return X.path.split("/").filter(Boolean).slice(0,J).join("/")||"root"}}});k8();k8();var Y6={meta:{key:"payments.stripe",version:"1.0.0",category:"payments",title:"Stripe Payments",description:"Stripe integration for payment processing, charges, and payouts.",domain:"payments",owners:["platform.payments"],tags:["payments","psp"],stability:K.Stable},supportedModes:["managed","byok"],capabilities:{provides:[{key:"payments.psp",version:"1.0.0"}],requires:[{key:"platform.webhooks",optional:!0,reason:"Recommended for reliable event ingestion"}]},configSchema:{schema:{type:"object",properties:{accountId:{type:"string",description:"Connected account ID when using Stripe Connect (BYOK)."},region:{type:"string",description:"Optional Stripe region or data residency hint."}}},example:{accountId:"acct_123",region:"us-east-1"}},secretSchema:{schema:{type:"object",required:["apiKey","webhookSecret"],properties:{apiKey:{type:"string",description:"Stripe secret API key (sk_live_... or sk_test_...)."},webhookSecret:{type:"string",description:"Signing secret for webhook verification."}}},example:{apiKey:"sk_live_***",webhookSecret:"whsec_***"}},healthCheck:{method:"ping",timeoutMs:5000},docsUrl:"https://stripe.com/docs/api",constraints:{rateLimit:{rpm:1000,rph:20000}},byokSetup:{setupInstructions:"Create a restricted Stripe API key with write access to Charges and provide a webhook signing secret.",requiredScopes:["charges:write","customers:read"]}};var Q6={meta:{key:"email.postmark",version:"1.0.0",category:"email",title:"Postmark Transactional Email",description:"Postmark integration for transactional email delivery.",domain:"communications",owners:["platform.messaging"],tags:["email","transactional"],stability:K.Stable},supportedModes:["managed","byok"],capabilities:{provides:[{key:"email.transactional",version:"1.0.0"}],requires:[{key:"platform.webhooks",optional:!0,reason:"Optional for inbound bounce handling"}]},configSchema:{schema:{type:"object",properties:{messageStream:{type:"string",description:"Optional message stream identifier (e.g., transactional)."},fromEmail:{type:"string",description:"Default From address used for outbound messages."}}},example:{messageStream:"outbound",fromEmail:"notifications@example.com"}},secretSchema:{schema:{type:"object",required:["serverToken"],properties:{serverToken:{type:"string",description:"Server token for the Postmark account."}}},example:{serverToken:"server-***"}},healthCheck:{method:"ping",timeoutMs:3000},docsUrl:"https://postmarkapp.com/developer",constraints:{rateLimit:{rpm:500}},byokSetup:{setupInstructions:"Create a Postmark server token with outbound send permissions and configure allowed from addresses."}};var z6={meta:{key:"vectordb.qdrant",version:"1.0.0",category:"vector-db",title:"Qdrant Vector Database",description:"Qdrant integration for vector search and embeddings storage.",domain:"ai",owners:["platform.ai"],tags:["vector-db","search"],stability:K.Experimental},supportedModes:["managed","byok"],capabilities:{provides:[{key:"vector-db.search",version:"1.0.0"},{key:"vector-db.storage",version:"1.0.0"}],requires:[{key:"ai.embeddings",optional:!0,reason:"Required if vectors are generated via hosted embedding services"}]},configSchema:{schema:{type:"object",properties:{apiUrl:{type:"string",description:"Base URL for the Qdrant instance (e.g., https://qdrant.example.com)."},collectionPrefix:{type:"string",description:"Prefix applied to all collection names for this tenant."}}},example:{apiUrl:"https://qdrant.example.com",collectionPrefix:"tenant_"}},secretSchema:{schema:{type:"object",properties:{apiKey:{type:"string",description:"API key or token when authentication is enabled."}}},example:{apiKey:"qdrant-api-key"}},healthCheck:{method:"ping",timeoutMs:4000},docsUrl:"https://qdrant.tech/documentation/quick-start/",constraints:{quotas:{collections:100,pointsPerCollection:1e6}},byokSetup:{setupInstructions:"Provide the HTTPS endpoint of your Qdrant cluster and generate an API key with read/write access to the collections that will be managed."}};var w6={meta:{key:"ai-llm.mistral",version:"1.0.0",category:"ai-llm",title:"Mistral Large Language Model",description:"Mistral integration providing chat completions and embedding generation.",domain:"ai",owners:["platform.ai"],tags:["ai","llm","embeddings"],stability:K.Experimental},supportedModes:["managed","byok"],capabilities:{provides:[{key:"ai.chat",version:"1.0.0"},{key:"ai.embeddings",version:"1.0.0"}]},configSchema:{schema:{type:"object",properties:{model:{type:"string",description:"Default chat completion model (e.g., mistral-large-latest)."},embeddingModel:{type:"string",description:"Embedding model identifier."}}},example:{model:"mistral-large-latest",embeddingModel:"mistral-embed"}},secretSchema:{schema:{type:"object",required:["apiKey"],properties:{apiKey:{type:"string",description:"Mistral API key with access to chat and embeddings endpoints."}}},example:{apiKey:"mistral-***"}},healthCheck:{method:"custom",timeoutMs:5000},docsUrl:"https://docs.mistral.ai/platform/endpoints",constraints:{rateLimit:{rpm:600}},byokSetup:{setupInstructions:"Generate an API key within the Mistral console and ensure the selected models are enabled for the account."}};var G6={meta:{key:"ai-voice.elevenlabs",version:"1.0.0",category:"ai-voice",title:"ElevenLabs Text-to-Speech",description:"ElevenLabs integration for neural voice synthesis and voice catalog access.",domain:"ai",owners:["platform.ai"],tags:["voice","tts"],stability:K.Beta},supportedModes:["managed","byok"],capabilities:{provides:[{key:"ai.voice.synthesis",version:"1.0.0"}]},configSchema:{schema:{type:"object",properties:{defaultVoiceId:{type:"string",description:"Optional default voice identifier for synthesis requests."}}},example:{defaultVoiceId:"pNInz6obpgDQGcFmaJgB"}},secretSchema:{schema:{type:"object",required:["apiKey"],properties:{apiKey:{type:"string",description:"ElevenLabs API key with text-to-speech permissions."}}},example:{apiKey:"eleven-***"}},healthCheck:{method:"custom",timeoutMs:4000},docsUrl:"https://elevenlabs.io/docs/api-reference/text-to-speech",constraints:{rateLimit:{rpm:120}},byokSetup:{setupInstructions:"Create an ElevenLabs API key and ensure the desired voices are accessible to the key scope."}};var U6={meta:{key:"email.gmail",version:"1.0.0",category:"email",title:"Google Gmail API",description:"Gmail integration supporting inbound thread ingestion and outbound transactional email.",domain:"communications",owners:["platform.messaging"],tags:["email","gmail"],stability:K.Beta},supportedModes:["managed","byok"],capabilities:{provides:[{key:"email.inbound",version:"1.0.0"},{key:"email.outbound",version:"1.0.0"}]},configSchema:{schema:{type:"object",properties:{labelIds:{type:"array",items:{type:"string"},description:"Optional list of label IDs to scope inbound sync."},includeSpamTrash:{type:"boolean",description:"Whether to include spam or trash messages during sync."}}},example:{labelIds:["INBOX"],includeSpamTrash:!1}},secretSchema:{schema:{type:"object",required:["clientId","clientSecret","refreshToken"],properties:{clientId:{type:"string",description:"OAuth client ID for the Google Cloud project."},clientSecret:{type:"string",description:"OAuth client secret for the Google Cloud project."},refreshToken:{type:"string",description:"OAuth refresh token for delegated Gmail access."},redirectUri:{type:"string",description:"Optional redirect URI used when issuing the refresh token."}}},example:{clientId:"xxx.apps.googleusercontent.com",clientSecret:"secret",refreshToken:"refresh-token"}},healthCheck:{method:"custom",timeoutMs:4000},docsUrl:"https://developers.google.com/gmail/api",constraints:{rateLimit:{rpm:600}},byokSetup:{setupInstructions:"Create an OAuth consent screen and credentials within Google Cloud Console, then authorize the Gmail scopes and store the resulting refresh token."}};var P6={meta:{key:"calendar.google",version:"1.0.0",category:"calendar",title:"Google Calendar API",description:"Google Calendar integration for event creation, updates, and scheduling automations.",domain:"productivity",owners:["platform.messaging"],tags:["calendar","google"],stability:K.Beta},supportedModes:["managed","byok"],capabilities:{provides:[{key:"calendar.events",version:"1.0.0"}]},configSchema:{schema:{type:"object",properties:{calendarId:{type:"string",description:"Default calendar identifier (defaults to primary)."}}},example:{calendarId:"primary"}},secretSchema:{schema:{type:"object",required:["clientEmail","privateKey"],properties:{clientEmail:{type:"string",description:"Service account client email."},privateKey:{type:"string",description:"Service account private key."},projectId:{type:"string",description:"Google Cloud project ID."}}},example:{clientEmail:"svc-calendar@example.iam.gserviceaccount.com",privateKey:"-----BEGIN PRIVATE KEY-----...",projectId:"calendar-project"}},healthCheck:{method:"custom",timeoutMs:4000},docsUrl:"https://developers.google.com/calendar/api",constraints:{},byokSetup:{setupInstructions:"Create a Google service account with Calendar access and share the target calendars with the service account email."}};var M6={meta:{key:"sms.twilio",version:"1.0.0",category:"sms",title:"Twilio Messaging",description:"Twilio SMS integration for transactional and notification messaging.",domain:"communications",owners:["platform.messaging"],tags:["sms","messaging"],stability:K.Stable},supportedModes:["managed","byok"],capabilities:{provides:[{key:"sms.outbound",version:"1.0.0"}]},configSchema:{schema:{type:"object",properties:{fromNumber:{type:"string",description:"Default Twilio phone number used as sender."}}},example:{fromNumber:"+15551234567"}},secretSchema:{schema:{type:"object",required:["accountSid","authToken"],properties:{accountSid:{type:"string",description:"Twilio Account SID."},authToken:{type:"string",description:"Twilio Auth Token."}}},example:{accountSid:"ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",authToken:"auth-token"}},healthCheck:{method:"custom",timeoutMs:3000},docsUrl:"https://www.twilio.com/docs/sms/api",constraints:{rateLimit:{rpm:200}},byokSetup:{setupInstructions:"Provide a Twilio account SID, auth token, and verify the outbound sending numbers used by the integration."}};var F6={meta:{key:"storage.gcs",version:"1.0.0",category:"storage",title:"Google Cloud Storage Buckets",description:"Google Cloud Storage integration for object storage and retrieval.",domain:"infrastructure",owners:["platform.infrastructure"],tags:["storage","gcs","google-cloud"],stability:K.Beta},supportedModes:["managed","byok"],capabilities:{provides:[{key:"storage.objects",version:"1.0.0"}]},configSchema:{schema:{type:"object",required:["bucket"],properties:{bucket:{type:"string",description:"Primary bucket name used for storing objects."},prefix:{type:"string",description:"Optional prefix applied to object keys."}}},example:{bucket:"pfo-tenant-assets",prefix:"documents/"}},secretSchema:{schema:{type:"object",properties:{type:{type:"string",description:"Service account type field from Google credentials JSON (if provided)."},client_email:{type:"string"},private_key:{type:"string"},project_id:{type:"string"}}},example:{type:"service_account",client_email:"svc-account@example.iam.gserviceaccount.com",private_key:"-----BEGIN PRIVATE KEY-----...",project_id:"example-project"}},healthCheck:{method:"ping",timeoutMs:4000},docsUrl:"https://cloud.google.com/storage/docs/apis",constraints:{quotas:{storageGb:5120}},byokSetup:{setupInstructions:"Create a Google Cloud service account with Storage Object Admin role and upload the JSON credentials to the secret store."}};var A6={meta:{key:"openbanking.powens",version:"1.0.0",category:"open-banking",title:"Powens Open Banking (Read)",description:"Read-only Open Banking integration powered by Powens, exposing accounts, transactions, and balances.",domain:"finance",owners:["platform.finance"],tags:["open-banking","powens","finance"],stability:K.Experimental},supportedModes:["byok"],capabilities:{provides:[{key:"openbanking.accounts.read",version:"1.0.0"},{key:"openbanking.transactions.read",version:"1.0.0"},{key:"openbanking.balances.read",version:"1.0.0"}]},configSchema:{schema:{type:"object",required:["environment"],properties:{environment:{type:"string",enum:["sandbox","production"],description:"Powens environment to target. Sandbox uses Powens test API base URL, production uses live endpoints."},baseUrl:{type:"string",description:"Optional override for the Powens API base URL. Defaults to Powens environment defaults."},region:{type:"string",description:"Optional Powens region identifier when targeting a specific data residency cluster."},pollingIntervalMs:{type:"number",description:"Optional custom polling interval in milliseconds for background sync jobs (defaults to platform standard)."}}},example:{environment:"sandbox",baseUrl:"https://api-sandbox.powens.com/v2",region:"eu-west-1",pollingIntervalMs:300000}},secretSchema:{schema:{type:"object",required:["clientId","clientSecret"],properties:{clientId:{type:"string",description:"Powens OAuth client identifier obtained from the Powens Console (BYOK project)."},clientSecret:{type:"string",description:"Powens OAuth client secret used to exchange for access tokens."},apiKey:{type:"string",description:"Optional Powens API key (if the tenant project exposes a dedicated API token)."},webhookSecret:{type:"string",description:"Optional webhook signing secret used to verify Powens webhook payloads."}}},example:{clientId:"powens-client-id",clientSecret:"powens-client-secret",apiKey:"powens-api-key",webhookSecret:"powens-webhook-secret"}},healthCheck:{method:"ping",timeoutMs:8000},docsUrl:"https://docs.powens.com/",constraints:{rateLimit:{rph:1e4,rpm:600}},byokSetup:{setupInstructions:"Create a Powens BYOK project, generate OAuth credentials, and optionally configure webhook delivery for account/transaction updates.",requiredScopes:["accounts:read","transactions:read","balances:read"]}};var D1=new v({name:"BankAccountRecord",description:"Canonical representation of a bank account synced from an open banking provider.",fields:{id:{type:G.ID(),isOptional:!1},tenantId:{type:G.ID(),isOptional:!1},userId:{type:G.ID(),isOptional:!1},connectionId:{type:G.ID(),isOptional:!1},externalId:{type:G.NonEmptyString(),isOptional:!1},institutionId:{type:G.NonEmptyString(),isOptional:!1},institutionName:{type:G.NonEmptyString(),isOptional:!1},institutionLogoUrl:{type:G.URL(),isOptional:!0},iban:{type:G.String_unsecure(),isOptional:!0},bic:{type:G.String_unsecure(),isOptional:!0},accountType:{type:G.NonEmptyString(),isOptional:!1},currency:{type:G.Currency(),isOptional:!1},displayName:{type:G.NonEmptyString(),isOptional:!1},accountNumberMasked:{type:G.String_unsecure(),isOptional:!0},productCode:{type:G.String_unsecure(),isOptional:!0},balance:{type:G.Float_unsecure(),isOptional:!0},availableBalance:{type:G.Float_unsecure(),isOptional:!0},lastSyncedAt:{type:G.DateTime(),isOptional:!1},createdAt:{type:G.DateTime(),isOptional:!1},updatedAt:{type:G.DateTime(),isOptional:!1},metadata:{type:G.JSONObject(),isOptional:!0}}}),T8=new v({name:"BankTransactionRecord",description:"Canonical transaction entry mapped from Powens into the open banking ledger.",fields:{id:{type:G.ID(),isOptional:!1},accountId:{type:G.ID(),isOptional:!1},tenantId:{type:G.ID(),isOptional:!1},connectionId:{type:G.ID(),isOptional:!1},externalId:{type:G.NonEmptyString(),isOptional:!1},amount:{type:G.Float_unsecure(),isOptional:!1},currency:{type:G.Currency(),isOptional:!1},date:{type:G.DateTime(),isOptional:!1},bookingDate:{type:G.DateTime(),isOptional:!0},valueDate:{type:G.DateTime(),isOptional:!0},description:{type:G.String_unsecure(),isOptional:!0},counterpartyName:{type:G.String_unsecure(),isOptional:!0},counterpartyAccount:{type:G.String_unsecure(),isOptional:!0},merchantCategoryCode:{type:G.String_unsecure(),isOptional:!0},rawCategory:{type:G.String_unsecure(),isOptional:!0},standardizedCategory:{type:G.String_unsecure(),isOptional:!0},transactionType:{type:G.NonEmptyString(),isOptional:!1},status:{type:G.NonEmptyString(),isOptional:!1},runningBalance:{type:G.Float_unsecure(),isOptional:!0},metadata:{type:G.JSONObject(),isOptional:!0},createdAt:{type:G.DateTime(),isOptional:!1},updatedAt:{type:G.DateTime(),isOptional:!1}}}),K1=new v({name:"AccountBalanceRecord",description:"Canonical balance snapshot computed from Powens balance payloads.",fields:{id:{type:G.ID(),isOptional:!1},accountId:{type:G.ID(),isOptional:!1},tenantId:{type:G.ID(),isOptional:!1},connectionId:{type:G.ID(),isOptional:!1},balanceType:{type:G.NonEmptyString(),isOptional:!1},currentBalance:{type:G.Float_unsecure(),isOptional:!1},availableBalance:{type:G.Float_unsecure(),isOptional:!0},currency:{type:G.Currency(),isOptional:!1},lastUpdatedAt:{type:G.DateTime(),isOptional:!1},createdAt:{type:G.DateTime(),isOptional:!1},metadata:{type:G.JSONObject(),isOptional:!0}}});var j8=["iban","bic","accountNumberMasked","accountNumber","counterpartyName","counterpartyAccount","description","merchantName","merchantCategoryCode","reference"],m={accountsSynced:"openbanking.accounts.synced",accountsSyncFailed:"openbanking.accounts.sync_failed",transactionsSynced:"openbanking.transactions.synced",transactionsSyncFailed:"openbanking.transactions.sync_failed",balancesRefreshed:"openbanking.balances.refreshed",balancesRefreshFailed:"openbanking.balances.refresh_failed",overviewGenerated:"openbanking.overview.generated"};var V0=(J)=>({...J,meta:{...J.meta,kind:"command"},policy:{...J.policy,idempotent:J.policy?.policy?.idempotent??!1}}),P0=(J)=>({...J,meta:{...J.meta,kind:"query"},policy:{...J.policy,idempotent:!0}});var e3=new v({name:"OpenBankingListAccountsInput",description:"Parameters for listing bank accounts through the open banking provider.",fields:{tenantId:{type:G.ID(),isOptional:!1},userId:{type:G.ID(),isOptional:!1},connectionId:{type:G.ID(),isOptional:!0},includeBalances:{type:G.Boolean(),isOptional:!0},institutionId:{type:G.String_unsecure(),isOptional:!0},cursor:{type:G.String_unsecure(),isOptional:!0},pageSize:{type:G.Int_unsecure(),isOptional:!0}}}),JW=new v({name:"OpenBankingListAccountsOutput",description:"Paginated list of bank accounts available to the tenant and user.",fields:{accounts:{type:D1,isOptional:!1,isArray:!0},nextCursor:{type:G.String_unsecure(),isOptional:!0},hasMore:{type:G.Boolean(),isOptional:!0}}}),XW=new v({name:"OpenBankingGetAccountInput",description:"Parameters for retrieving a specific bank account.",fields:{tenantId:{type:G.ID(),isOptional:!1},accountId:{type:G.ID(),isOptional:!1},includeBalances:{type:G.Boolean(),isOptional:!0},includeLatestTransactions:{type:G.Boolean(),isOptional:!0}}}),HW=new v({name:"OpenBankingSyncAccountsInput",description:"Command payload to trigger an account synchronisation against the open banking provider.",fields:{tenantId:{type:G.ID(),isOptional:!1},userId:{type:G.ID(),isOptional:!0},connectionId:{type:G.ID(),isOptional:!1},accountIds:{type:G.ID(),isArray:!0,isOptional:!0},forceFullRefresh:{type:G.Boolean(),isOptional:!0},triggerWorkflows:{type:G.Boolean(),isOptional:!0}}}),WW=new v({name:"OpenBankingSyncAccountsOutput",description:"Result of a bank account synchronisation run.",fields:{synced:{type:G.Int_unsecure(),isOptional:!1},failed:{type:G.Int_unsecure(),isOptional:!1},errors:{type:G.String_unsecure(),isArray:!0,isOptional:!0},nextSyncSuggestedAt:{type:G.DateTime(),isOptional:!0}}}),N6=P0({meta:{key:"openbanking.accounts.list",version:"1.0.0",description:"List bank accounts available to a tenant/user via Powens Open Banking.",goal:"Provide downstream workflows with the set of accounts accessible via the configured open banking connection.",context:"Used by Pocket Family Office dashboards and sync workflows to enumerate bank accounts prior to syncing balances or transactions.",owners:["@platform.finance"],tags:["open-banking","powens","accounts"],stability:"experimental"},io:{input:e3,output:JW},policy:{auth:"user"}}),b6=P0({meta:{key:"openbanking.accounts.get",version:"1.0.0",description:"Retrieve the canonical bank account record for the given account identifier.",goal:"Allow user-facing experiences and automations to display up-to-date account metadata.",context:"Invoked by UI surfaces and workflow automation steps that require detailed metadata for a specific bank account.",owners:["@platform.finance"],tags:["open-banking","powens","accounts"],stability:"experimental"},io:{input:XW,output:D1},policy:{auth:"user"}}),E6=V0({meta:{key:"openbanking.accounts.sync",version:"1.0.0",description:"Initiate a synchronisation run to refresh bank account metadata from Powens.",goal:"Keep canonical bank account records aligned with the external open banking provider.",context:"Triggered by scheduled workflows or manual operator actions to reconcile account metadata prior to transaction/balance syncs.",owners:["@platform.finance"],tags:["open-banking","powens","accounts"],stability:"experimental"},io:{input:HW,output:WW},policy:{auth:"admin"},telemetry:{success:{event:{key:m.accountsSynced},properties:({input:J,output:X})=>{let H=J,W=X;return{tenantId:H?.tenantId,connectionId:H?.connectionId,synced:W?.synced,failed:W?.failed}}},failure:{event:{key:m.accountsSyncFailed},properties:({input:J,error:X})=>{let H=J;return{tenantId:H?.tenantId,connectionId:H?.connectionId,error:X instanceof Error?X.message:String(X??"unknown")}}}}});var qW=new v({name:"OpenBankingListTransactionsInput",description:"Parameters for listing bank transactions from the canonical ledger.",fields:{tenantId:{type:G.ID(),isOptional:!1},accountId:{type:G.ID(),isOptional:!1},from:{type:G.DateTime(),isOptional:!0},to:{type:G.DateTime(),isOptional:!0},cursor:{type:G.String_unsecure(),isOptional:!0},pageSize:{type:G.Int_unsecure(),isOptional:!0},direction:{type:G.String_unsecure(),isOptional:!0},minimumAmount:{type:G.Float_unsecure(),isOptional:!0},maximumAmount:{type:G.Float_unsecure(),isOptional:!0},category:{type:G.String_unsecure(),isOptional:!0}}}),YW=new v({name:"OpenBankingListTransactionsOutput",description:"Paginated list of transactions for a bank account.",fields:{transactions:{type:T8,isOptional:!1,isArray:!0},nextCursor:{type:G.String_unsecure(),isOptional:!0},hasMore:{type:G.Boolean(),isOptional:!0}}}),QW=new v({name:"OpenBankingSyncTransactionsInput",description:"Command payload to synchronise transactions from the open banking provider into the canonical ledger.",fields:{tenantId:{type:G.ID(),isOptional:!1},accountId:{type:G.ID(),isOptional:!1},from:{type:G.DateTime(),isOptional:!0},to:{type:G.DateTime(),isOptional:!0},connectionId:{type:G.ID(),isOptional:!0},includePending:{type:G.Boolean(),isOptional:!0},backfillDays:{type:G.Int_unsecure(),isOptional:!0}}}),zW=new v({name:"OpenBankingSyncTransactionsOutput",description:"Result of a transaction synchronisation run.",fields:{synced:{type:G.Int_unsecure(),isOptional:!1},failed:{type:G.Int_unsecure(),isOptional:!1},earliestSyncedAt:{type:G.DateTime(),isOptional:!0},latestSyncedAt:{type:G.DateTime(),isOptional:!0},nextSinceToken:{type:G.String_unsecure(),isOptional:!0},errors:{type:G.String_unsecure(),isArray:!0,isOptional:!0}}}),C6=P0({meta:{key:"openbanking.transactions.list",version:"1.0.0",description:"List bank transactions that have been normalised into the canonical ledger.",goal:"Allow downstream analytics and UI surfaces to page through canonical bank transactions.",context:"Used by Pocket Family Office dashboards, reconciliation workflows, and analytics data views.",owners:["@platform.finance"],tags:["open-banking","powens","transactions"],stability:"experimental"},io:{input:qW,output:YW},policy:{auth:"user"}}),S6=V0({meta:{key:"openbanking.transactions.sync",version:"1.0.0",description:"Synchronise transactions for a bank account by calling the configured open banking provider.",goal:"Ensure the canonical transaction ledger stays aligned with the external provider.",context:"Triggered by scheduled workflows or on-demand actions when activity is expected on an account.",owners:["@platform.finance"],tags:["open-banking","powens","transactions"],stability:"experimental"},io:{input:QW,output:zW},policy:{auth:"admin"},telemetry:{success:{event:{key:m.transactionsSynced},properties:({input:J,output:X})=>{let H=J,W=X;return{tenantId:H?.tenantId,accountId:H?.accountId,synced:W?.synced,failed:W?.failed,earliestSyncedAt:W?.earliestSyncedAt,latestSyncedAt:W?.latestSyncedAt}}},failure:{event:{key:m.transactionsSyncFailed},properties:({input:J,error:X})=>{let H=J;return{tenantId:H?.tenantId,accountId:H?.accountId,error:X instanceof Error?X.message:String(X??"unknown")}}}}});var wW=new v({name:"OpenBankingGetBalancesInput",description:"Parameters for retrieving bank account balances from the canonical ledger.",fields:{tenantId:{type:G.ID(),isOptional:!1},accountId:{type:G.ID(),isOptional:!1},balanceTypes:{type:G.String_unsecure(),isArray:!0,isOptional:!0}}}),GW=new v({name:"OpenBankingGetBalancesOutput",description:"Canonical balances for a bank account.",fields:{balances:{type:K1,isOptional:!1,isArray:!0},asOf:{type:G.DateTime(),isOptional:!0}}}),UW=new v({name:"OpenBankingRefreshBalancesInput",description:"Command payload to refresh balances for a bank account via the open banking provider.",fields:{tenantId:{type:G.ID(),isOptional:!1},accountId:{type:G.ID(),isOptional:!1},connectionId:{type:G.ID(),isOptional:!0},balanceTypes:{type:G.String_unsecure(),isArray:!0,isOptional:!0},forceRefresh:{type:G.Boolean(),isOptional:!0}}}),PW=new v({name:"OpenBankingRefreshBalancesOutput",description:"Result of a balance refresh against the open banking provider.",fields:{balances:{type:K1,isOptional:!1,isArray:!0},refreshedAt:{type:G.DateTime(),isOptional:!1},errors:{type:G.String_unsecure(),isArray:!0,isOptional:!0}}}),k6=P0({meta:{key:"openbanking.balances.get",version:"1.0.0",description:"Retrieve the latest cached balances for a bank account.",goal:"Expose current and available balances required by dashboards and analytics.",context:"Used by Pocket Family Office UI surfaces and automation steps that require balance totals prior to generating summaries.",owners:["@platform.finance"],tags:["open-banking","powens","balances"],stability:"experimental"},io:{input:wW,output:GW},policy:{auth:"user"}}),T6=V0({meta:{key:"openbanking.balances.refresh",version:"1.0.0",description:"Refresh balances for a bank account via the configured open banking provider.",goal:"Ensure canonical balance records reflect the latest values from Powens.",context:"Triggered by scheduled workflows before generating summaries or forecasting cashflow.",owners:["@platform.finance"],tags:["open-banking","powens","balances"],stability:"experimental"},io:{input:UW,output:PW},policy:{auth:"admin"},telemetry:{success:{event:{key:m.balancesRefreshed},properties:({input:J,output:X})=>{let H=J,W=X;return{tenantId:H?.tenantId,accountId:H?.accountId,refreshedAt:W?.refreshedAt,balanceCount:Array.isArray(W?.balances)?W?.balances.length:void 0}}},failure:{event:{key:m.balancesRefreshFailed},properties:({input:J,error:X})=>{let H=J;return{tenantId:H?.tenantId,accountId:H?.accountId,error:X instanceof Error?X.message:String(X??"unknown")}}}}});var FW=E0("Source",["upload","email","sync"]),AW=E0("Channel",["email","sms","both"]),$W=E0("Period",["P7d","P30d","P90d"]),VW=E0("ObPeriod",["Pweek","Pmonth","Pquarter"]),BW=o({name:"UploadDocumentInput",fields:{bucket:{type:G.NonEmptyString(),isOptional:!1},objectKey:{type:G.NonEmptyString(),isOptional:!1},mimeType:{type:G.NonEmptyString(),isOptional:!1},bytes:{type:G.Int_unsecure(),isOptional:!1},tags:{type:G.String_unsecure(),isOptional:!1,isArray:!0},uploadedAt:{type:G.Date(),isOptional:!1},source:{type:FW,isOptional:!1}}}),DW=o({name:"UploadDocumentOutput",fields:{documentId:{type:G.String_unsecure(),isOptional:!1},ingestionJobId:{type:G.String_unsecure(),isOptional:!1}}}),KW={meta:{key:"pfo.documents.upload",version:"1.0.0",kind:"command",description:"Stores an object in tenant storage and schedules ingestion into the knowledge base.",goal:"Allow users to ingest financial documents for processing.",context:"Part of the finance domain. Documents are uploaded to object storage and then processed by the ingestion pipeline.",owners:[Z.PlatformFinance],tags:["documents","ingestion",N.Guide],stability:K.Experimental},io:{input:BW,output:DW},policy:{auth:"user",rateLimit:{rpm:30,key:"user"}}},IW=o({name:"PaymentReminderInput",fields:{billId:{type:G.String_unsecure(),isOptional:!1},recipientEmail:{type:G.EmailAddress(),isOptional:!1},recipientPhone:{type:G.String_unsecure(),isOptional:!0},dueDate:{type:G.Date(),isOptional:!1},amountCents:{type:G.Int_unsecure(),isOptional:!1},currency:{type:G.Currency(),isOptional:!1},channel:{type:AW,isOptional:!1},memo:{type:G.String_unsecure(),isOptional:!0}}}),OW=o({name:"PaymentReminderOutput",fields:{reminderId:{type:G.String_unsecure(),isOptional:!1},scheduledAt:{type:G.Date(),isOptional:!1}}}),RW={meta:{key:"pfo.reminders.schedule-payment",version:"1.0.0",kind:"command",description:"Queues outbound email/SMS reminders for upcoming bills and adds an optional calendar hold.",goal:"Ensure bills are paid on time by notifying users.",context:"Finance automation. Reminders are sent via configured channels (email, SMS).",owners:[Z.PlatformFinance],tags:["payments","reminders",N.Automation],stability:K.Beta},io:{input:IW,output:OW},policy:{auth:"user"}},LW=o({name:"FinancialSummaryInput",fields:{period:{type:$W,isOptional:!1},includeVoiceSummary:{type:G.Boolean(),isOptional:!1}}}),ZW=o({name:"SummaryHighlight",fields:{label:{type:G.String_unsecure(),isOptional:!1},value:{type:G.String_unsecure(),isOptional:!1}}}),NW=o({name:"FinancialSummaryOutput",fields:{summaryId:{type:G.String_unsecure(),isOptional:!1},generatedAt:{type:G.Date(),isOptional:!1},markdown:{type:G.String_unsecure(),isOptional:!1},highlights:{type:ZW,isOptional:!1,isArray:!0},cashflowDelta:{type:G.Float_unsecure(),isOptional:!1}}}),bW={meta:{key:"pfo.summary.generate",version:"1.0.0",kind:"query",description:"Runs RAG over financial documents and email threads to provide a natural-language summary with key metrics.",goal:"Provide a quick overview of financial status and recent activity.",context:"Uses RAG over ingested knowledge. Summaries can be dispatched or viewed in app.",owners:[Z.PlatformFinance],tags:["summary","ai",N.Automation],stability:K.Beta},io:{input:LW,output:NW},policy:{auth:"user"}},EW=o({name:"SyncEmailThreadsInput",fields:{labelIds:{type:G.String_unsecure(),isOptional:!1,isArray:!0},maxThreads:{type:G.Int_unsecure(),isOptional:!1},syncSinceMinutes:{type:G.Int_unsecure(),isOptional:!1}}}),CW=o({name:"SyncEmailThreadsOutput",fields:{syncedThreads:{type:G.Int_unsecure(),isOptional:!1},lastMessageAt:{type:G.Date(),isOptional:!0}}}),SW={meta:{key:"pfo.email.sync-threads",version:"1.0.0",kind:"command",description:"Triggers ingestion of Gmail threads into the operational knowledge space.",goal:"Keep knowledge base up to date with email communications.",context:"Syncs from Gmail integration. Only includes threads matching configured labels.",owners:[Z.PlatformMessaging],tags:["gmail","knowledge",N.Automation],stability:K.Beta},io:{input:EW,output:CW},policy:{auth:"user"}},kW=o({name:"SummaryDispatchInput",fields:{summaryId:{type:G.String_unsecure(),isOptional:!1},recipientEmail:{type:G.EmailAddress(),isOptional:!1},recipientName:{type:G.String_unsecure(),isOptional:!0},includeVoice:{type:G.Boolean(),isOptional:!1},voiceRecipient:{type:G.String_unsecure(),isOptional:!0}}}),TW=o({name:"SummaryDispatchOutput",fields:{dispatchId:{type:G.String_unsecure(),isOptional:!1},emailSent:{type:G.Boolean(),isOptional:!1},voiceUrl:{type:G.String_unsecure(),isOptional:!0}}}),jW={meta:{key:"pfo.summary.dispatch",version:"1.0.0",kind:"command",description:"Delivers the generated summary via email and optionally synthesises a voice note.",goal:"Deliver financial insights to users proactively.",context:"Dispatches summaries generated by pfo.summary.generate via email or voice.",owners:[Z.PlatformMessaging],tags:["summary","communications",N.Automation],stability:K.Experimental},io:{input:kW,output:TW},policy:{auth:"user"}},_W=o({name:"OpenBankingOverviewInput",fields:{tenantId:{type:G.String_unsecure(),isOptional:!1},accountIds:{type:G.String_unsecure(),isOptional:!0,isArray:!0},period:{type:VW,isOptional:!1},asOf:{type:G.Date(),isOptional:!0},includeCategories:{type:G.Boolean(),isOptional:!1},includeCashflowTrend:{type:G.Boolean(),isOptional:!1}}}),hW=o({name:"OpenBankingOverviewOutput",fields:{knowledgeEntryId:{type:G.String_unsecure(),isOptional:!1},periodStart:{type:G.Date(),isOptional:!1},periodEnd:{type:G.Date(),isOptional:!1},generatedAt:{type:G.Date(),isOptional:!1},summaryPath:{type:G.String_unsecure(),isOptional:!0}}}),xW={meta:{key:"pfo.openbanking.generate-overview",version:"1.0.0",kind:"command",description:"Aggregates balances and transactions into a derived financial overview stored in the knowledge layer.",goal:"Create a periodic financial snapshot.",context:"Aggregates data from open banking integration into a document.",owners:[Z.PlatformFinance],tags:["open-banking","summary",N.Automation],stability:K.Experimental},io:{input:_W,output:hW},policy:{auth:"user"},telemetry:{success:{event:{key:m.overviewGenerated,version:"1.0.0"}}}},wU={"pfo.documents.upload":KW,"pfo.reminders.schedule-payment":RW,"pfo.summary.generate":bW,"pfo.summary.dispatch":jW,"pfo.email.sync-threads":SW,"pfo.openbanking.generate-overview":xW};var PU={meta:{key:"pfo.workflow.process-uploaded-document",version:"1.0.0",title:"Process Uploaded Document",description:"Stores an uploaded invoice/contract, queues ingestion, and records any follow-up reminders.",domain:"finance",owners:[Z.PlatformFinance],tags:["documents","ingestion",N.Automation],stability:K.Experimental},definition:{entryStepId:"store",steps:[{id:"store",type:"automation",label:"Store and Queue Ingestion",description:"Persist the document to storage and enqueue the knowledge ingestion pipeline.",action:{operation:{key:"pfo.documents.upload",version:"1.0.0"}},requiredIntegrations:["primaryStorage","primaryVectorDb"],retry:{maxAttempts:3,backoff:"exponential",delayMs:500}},{id:"review",type:"human",label:"Optional Human Classification",description:"Finance lead can categorise the document while ingestion completes."}],transitions:[{from:"store",to:"review"}]}};var AU={meta:{key:"pfo.workflow.upcoming-payments-reminder",version:"1.0.0",title:"Schedule Upcoming Payment Reminder",description:"Collects payment metadata and schedules multi-channel reminders for bills that are due soon.",domain:"finance",owners:[Z.PlatformFinance],tags:["payments","reminders",N.Automation],stability:K.Beta},definition:{entryStepId:"collect",steps:[{id:"collect",type:"human",label:"Review Upcoming Bill",description:"Confirm amount, due date, and preferred delivery channels before scheduling reminder."},{id:"schedule",type:"automation",label:"Schedule Reminder",action:{operation:{key:"pfo.reminders.schedule-payment",version:"1.0.0"}},requiredIntegrations:["emailOutbound","smsNotifications","calendarScheduling"],retry:{maxAttempts:2,backoff:"linear",delayMs:1000}}],transitions:[{from:"collect",to:"schedule",condition:"output?.confirmed === true",label:"Reminder confirmed"}]}};var BU={meta:{key:"pfo.workflow.generate-financial-summary",version:"1.0.0",title:"Generate Financial Summary",description:"Retrieves the latest financial signals, generates an AI summary, and optionally distributes it by voice or email.",domain:"finance",owners:[Z.PlatformFinance],tags:["summary","ai",N.Automation],stability:K.Beta},definition:{entryStepId:"summarise",steps:[{id:"summarise",type:"automation",label:"Generate Summary",description:"Run retrieval augmented generation over the knowledge base to produce a household summary.",action:{operation:{key:"pfo.summary.generate",version:"1.0.0"}},requiredIntegrations:["primaryLLM","primaryVectorDb"],retry:{maxAttempts:3,backoff:"exponential",delayMs:750}},{id:"distribute",type:"automation",label:"Distribute Summary",description:"Send the generated summary via email and optionally synthesise a voice note.",action:{operation:{key:"pfo.summary.dispatch",version:"1.0.0"}},requiredIntegrations:["emailOutbound"],retry:{maxAttempts:2,backoff:"linear",delayMs:500}}],transitions:[{from:"summarise",to:"distribute"}]}};var IU={meta:{key:"pfo.workflow.ingest-email-threads",version:"1.0.0",title:"Ingest Email Threads",description:"Synchronises Gmail threads tagged with finance labels and indexes them into operational knowledge spaces.",domain:"communications",owners:[Z.PlatformMessaging],tags:["gmail","knowledge",N.Automation],stability:K.Experimental},definition:{entryStepId:"sync",steps:[{id:"sync",type:"automation",label:"Sync Gmail Threads",description:"Fetches Gmail threads and transforms them into knowledge fragments before vector indexing.",action:{operation:{key:"pfo.email.sync-threads",version:"1.0.0"}},requiredIntegrations:["emailInbound","primaryVectorDb"],retry:{maxAttempts:3,backoff:"exponential",delayMs:1000}},{id:"triage",type:"human",label:"Triage Exceptions",description:"Operators can resolve sync failures or tag important threads for follow-up."}],transitions:[{from:"sync",to:"triage",condition:"output?.syncedThreads === 0",label:"No new threads"}]}};var j6={key:"openbanking.accounts.read",version:"1.0.0"},LU={meta:{key:"pfo.workflow.sync-openbanking-accounts",version:"1.0.0",title:"Synchronise Open Banking Accounts",description:"Validates Powens connectivity and synchronises bank account metadata into the canonical ledger.",domain:"finance",owners:[Z.PlatformFinance],tags:["open-banking","powens",N.Automation],stability:K.Experimental},definition:{entryStepId:"sync-accounts",steps:[{id:"sync-accounts",type:"automation",label:"Sync Accounts",description:"Refresh linked bank accounts via Powens and upsert canonical BankAccount records.",action:{operation:{key:"openbanking.accounts.sync",version:"1.0.0"}},requiredIntegrations:["primaryOpenBanking"],requiredCapabilities:[j6],retry:{maxAttempts:3,backoff:"exponential",delayMs:1000}},{id:"fetch-accounts",type:"automation",label:"Fetch Accounts",description:"Retrieve the latest canonical account snapshot for downstream consumers.",action:{operation:{key:"openbanking.accounts.list",version:"1.0.0"}},requiredIntegrations:["primaryOpenBanking"],requiredCapabilities:[j6],retry:{maxAttempts:2,backoff:"linear",delayMs:750}}],transitions:[{from:"sync-accounts",to:"fetch-accounts"}]}};var _6={key:"openbanking.transactions.read",version:"1.0.0"},bU={meta:{key:"pfo.workflow.sync-openbanking-transactions",version:"1.0.0",title:"Synchronise Open Banking Transactions",description:"Fetches recent transactions from Powens for each linked account and stores them in the canonical ledger.",domain:"finance",owners:[Z.PlatformFinance],tags:["open-banking","powens",N.Automation],stability:K.Experimental},definition:{entryStepId:"sync-transactions",steps:[{id:"sync-transactions",type:"automation",label:"Sync Transactions",description:"Call the Powens provider to pull incremental transactions for active accounts.",action:{operation:{key:"openbanking.transactions.sync",version:"1.0.0"}},requiredIntegrations:["primaryOpenBanking"],requiredCapabilities:[_6],retry:{maxAttempts:4,backoff:"exponential",delayMs:1500}},{id:"list-transactions",type:"automation",label:"List Transactions",description:"Retrieve the canonical transaction list for reporting and downstream analytics.",action:{operation:{key:"openbanking.transactions.list",version:"1.0.0"}},requiredIntegrations:["primaryOpenBanking"],requiredCapabilities:[_6],retry:{maxAttempts:2,backoff:"linear",delayMs:1000}}],transitions:[{from:"sync-transactions",to:"list-transactions"}]}};var h6={key:"openbanking.balances.read",version:"1.0.0"},SU={meta:{key:"pfo.workflow.refresh-openbanking-balances",version:"1.0.0",title:"Refresh Open Banking Balances",description:"Refreshes balances for synced accounts to surface the latest cash positions in dashboards.",domain:"finance",owners:[Z.PlatformFinance],tags:["open-banking","powens",N.Automation],stability:K.Experimental},definition:{entryStepId:"refresh-balances",steps:[{id:"refresh-balances",type:"automation",label:"Refresh Balances",description:"Trigger the Powens provider to obtain current and available balances.",action:{operation:{key:"openbanking.balances.refresh",version:"1.0.0"}},requiredIntegrations:["primaryOpenBanking"],requiredCapabilities:[h6],retry:{maxAttempts:3,backoff:"exponential",delayMs:1000}},{id:"fetch-balances",type:"automation",label:"Fetch Balances",description:"Load the canonical balance snapshots for downstream workflows and dashboards.",action:{operation:{key:"openbanking.balances.get",version:"1.0.0"}},requiredIntegrations:["primaryOpenBanking"],requiredCapabilities:[h6],retry:{maxAttempts:2,backoff:"linear",delayMs:750}}],transitions:[{from:"refresh-balances",to:"fetch-balances"}]}};var vW=[{key:"openbanking.accounts.read",version:"1.0.0"},{key:"openbanking.transactions.read",version:"1.0.0"},{key:"openbanking.balances.read",version:"1.0.0"}],jU={meta:{key:"pfo.workflow.generate-openbanking-overview",version:"1.0.0",title:"Generate Open Banking Overview",description:"Produces a derived financial overview and stores it in the operational knowledge space.",domain:"finance",owners:[Z.PlatformFinance],tags:["open-banking","summary",N.Automation],stability:K.Experimental},definition:{entryStepId:"generate-overview",steps:[{id:"generate-overview",type:"automation",label:"Generate Overview",description:"Aggregate balances, cashflow, and category breakdowns into a knowledge entry.",action:{operation:{key:"pfo.openbanking.generate-overview",version:"1.0.0"}},requiredIntegrations:["primaryOpenBanking"],requiredCapabilities:vW,retry:{maxAttempts:3,backoff:"exponential",delayMs:1500}}],transitions:[]}};var I1={tenantId:{type:"string",required:!0,description:"Tenant identifier for multi-tenant isolation."},appId:{type:"string",required:!0,description:"Application identifier associated with the event."},blueprint:{type:"string",required:!0,description:"Blueprint name@version emitting the telemetry."},configVersion:{type:"number",required:!0,description:"Resolved app config version when the event was generated."},slotId:{type:"string",required:!0,description:"Integration slot identifier (e.g., primaryOpenBanking)."},connectionId:{type:"string",required:!0,description:"Integration connection ID used for the sync."}};function x6(J){return{type:"string",description:J,pii:!1}}var pU={meta:{key:"pfo.telemetry",version:"1.0.0",title:"Pocket Family Office Telemetry",description:"Operational telemetry for Pocket Family Office workflows, including Powens open banking syncs.",domain:"finance",owners:[Z.PlatformFinance],tags:["open-banking",N.Automation],stability:K.Experimental},config:{defaultRetentionDays:180,defaultSamplingRate:1},events:[{key:m.accountsSynced,version:"1.0.0",semantics:{what:"Open banking account synchronisation completed.",why:"Refresh canonical account metadata for reporting and workflows."},privacy:"internal",properties:{...I1,syncedCount:{type:"number",description:"Number of accounts synced successfully."},failedCount:{type:"number",description:"Number of accounts that failed to sync."},durationMs:{type:"number",description:"Duration of the sync job in milliseconds."}}},{key:m.transactionsSynced,version:"1.0.0",semantics:{what:"Open banking transaction synchronisation completed.",why:"Keep canonical transaction ledger in sync for analytics."},privacy:"internal",properties:{...I1,accountId:{type:"string",description:"Bank account identifier used during the sync.",pii:!1},syncedCount:{type:"number",description:"Number of transactions synced successfully."},failedCount:{type:"number",description:"Number of transactions that failed to sync."},from:{type:"timestamp",description:"Start timestamp for the sync window."},to:{type:"timestamp",description:"End timestamp for the sync window."}}},{key:m.balancesRefreshed,version:"1.0.0",semantics:{what:"Open banking balances refreshed.",why:"Provide accurate cash position for dashboards and alerts."},privacy:"internal",properties:{...I1,accountId:x6("Bank account identifier."),balanceTypes:{type:"json",description:"Balance types included in the refresh."},refreshedAt:{type:"timestamp",description:"Timestamp when balances were refreshed."}}},{key:m.overviewGenerated,version:"1.0.0",semantics:{what:"Derived financial overview generated.",why:"Persist cashflow and category summaries into knowledge space."},privacy:"internal",properties:{...I1,knowledgeEntryId:x6("Identifier of the knowledge document containing the overview."),period:{type:"string",description:"Aggregation period used (week, month, quarter)."},periodStart:{type:"timestamp",description:"Start timestamp for the aggregation window."},periodEnd:{type:"timestamp",description:"End timestamp for the aggregation window."}},tags:["knowledge","analytics"]}]},rU=j8;var nU={meta:{key:"pocket-family-office",version:"1.0.0",title:"Pocket Family Office",description:"Personal finance automation with document ingestion, open banking, and AI summaries",domain:"finance",owners:["@platform.finance"],tags:["finance","open-banking","documents","automation","family-office"],stability:"experimental"},operations:[{key:"pfo.documents.upload",version:"1.0.0"}],events:[],presentations:[],opToPresentation:[],presentationsTargets:[],capabilities:{provides:[{key:"pocket-family-office",version:"1.0.0"}],requires:[{key:"identity",version:"1.0.0"},{key:"openbanking",version:"1.0.0"}]}};var gW={meta:{key:"pocket-family-office",version:"1.0.0",title:"Pocket Family Office",description:"Personal finance automation with document ingestion, open banking, and AI summaries",kind:"template",visibility:"public",stability:"experimental",owners:["@platform.finance"],tags:["finance","open-banking","documents","automation","family-office"]},docs:{rootDocId:"docs.examples.pocket-family-office"},entrypoints:{packageName:"@contractspec/example.pocket-family-office",feature:"./feature",docs:"./docs"},surfaces:{templates:!0,sandbox:{enabled:!0,modes:["playground","specs","builder"]},studio:{enabled:!0,installable:!0},mcp:{enabled:!0}}},uW=gW;var yW=["markdown","react"];function v6(J){if(!J.length)return"/";let X=J.startsWith("/")?J:`/${J}`;return X==="/"?"/":X.replace(/\/+$/,"")}function mW(J,X){if(J.route)return v6(J.route);let H=X??"/docs",W=J.id.replace(/^docs\.?/,"").replace(/\./g,"/").replace(/\/+/g,"/");return v6(W.startsWith("/")?W:`${H}/${W}`)}function cW(J,X){return X?`${X}.${J.id}`:J.id}function O1(J,X){let H=X?.defaultTargets??yW,W=J.version??X?.defaultVersion??"1.0.0",q=J.stability??X?.defaultStability??"stable";return{meta:{key:cW(J,X?.namespace),title:J.title,version:W,description:J.summary??J.title,tags:J.tags||[],owners:J.owners||[],domain:J.domain||"",stability:q,goal:`Documentation of: ${J.summary}`,context:"Auto-generated"},policy:J.visibility&&J.visibility!=="public"?{flags:[J.visibility]}:void 0,source:{type:"blocknotejs",docJson:J.body},targets:H}}function _8(J,X){return J.map((H)=>({block:H,route:mW(H,X?.routePrefix),descriptor:O1(H,X)}))}var g6=class{routes=new Map;constructor(J=[],X){J.forEach((H)=>this.register(H,X))}register(J,X){let[H]=_8([J],X);if(H)this.routes.set(J.id,H);return this}list(){return[...this.routes.values()]}get(J){return this.routes.get(J)}toRouteTuples(){return this.list().map(({route:J,descriptor:X})=>[J,X])}toPresentationSpecs(J){return this.list().map(({block:X})=>O1(X,J))}},fW=["id","title","body","kind","visibility","route"],u6=new g6;function D(J){for(let X of J){for(let H of fW)if(!X[H])throw Error(`DocBlock ${X.id??"<missing id>"} missing field ${String(H)}`);u6.register(X)}}var y6=[{id:"docs.tech.contracts.presentations",title:"Presentations — Unified Descriptor & Transform Engine",summary:"How PresentationSpec and TransformEngine keep docs/renderers consistent.",visibility:"public",route:"/docs/tech/contracts/presentations",kind:"reference",tags:["presentations","docs","mcp"],body:`## Presentations V2 — Unified Descriptor & Transform Engine
|
|
81
|
+
|
|
82
|
+
### Purpose
|
|
83
|
+
|
|
84
|
+
Unify presentations into one descriptor (\`PresentationSpec\`) that declares a single source (React component key or BlockNote doc) and a list of output targets (react, markdown, application/json, application/xml). A pluggable \`TransformEngine\` renders any target and applies PII redaction.
|
|
85
|
+
|
|
86
|
+
### Types
|
|
87
|
+
|
|
88
|
+
\`\`\`ts
|
|
89
|
+
type PresentationTarget =
|
|
90
|
+
| 'react'
|
|
91
|
+
| 'markdown'
|
|
92
|
+
| 'application/json'
|
|
93
|
+
| 'application/xml';
|
|
94
|
+
|
|
95
|
+
type PresentationSource =
|
|
96
|
+
| {
|
|
97
|
+
type: 'component';
|
|
98
|
+
framework: 'react';
|
|
99
|
+
componentKey: string;
|
|
100
|
+
props?: AnySchemaModel;
|
|
101
|
+
}
|
|
102
|
+
| { type: 'blocknotejs'; docJson: unknown; blockConfig?: unknown };
|
|
103
|
+
|
|
104
|
+
interface PresentationSpec {
|
|
105
|
+
meta: PresentationMeta; // includes partial OwnerShipMeta + description
|
|
106
|
+
policy?: { flags?: string[]; pii?: string[] };
|
|
107
|
+
source: PresentationSource;
|
|
108
|
+
targets: PresentationTarget[];
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Shared ownership schema (source of truth in @contractspec/lib.contracts/src/ownership.ts)
|
|
112
|
+
interface OwnerShipMeta {
|
|
113
|
+
title: string;
|
|
114
|
+
description: string;
|
|
115
|
+
domain: string;
|
|
116
|
+
owners: Owner[];
|
|
117
|
+
tags: Tag[];
|
|
118
|
+
stability: Stability;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
type Stability = 'experimental' | 'beta' | 'stable' | 'deprecated';
|
|
122
|
+
type Owner = string; // curated list available in code (e.g., '@sigil-team', 'team-strit')
|
|
123
|
+
type Tag = string; // curated list available in code (e.g., 'auth', 'spots')
|
|
124
|
+
|
|
125
|
+
// For presentations, meta is a Partial<OwnerShipMeta> plus description, name, version
|
|
126
|
+
interface PresentationMeta extends Partial<OwnerShipMeta> {
|
|
127
|
+
name: string;
|
|
128
|
+
version: string;
|
|
129
|
+
description?: string;
|
|
130
|
+
}
|
|
131
|
+
\`\`\`
|
|
132
|
+
|
|
133
|
+
### Engine
|
|
134
|
+
|
|
135
|
+
Use \`createDefaultTransformEngine()\` and register custom renderers as needed (e.g., high-fidelity BlockNote → Markdown). The default engine supports markdown/json/xml; a React renderer returns a serializable descriptor the host app renders via a \`componentMap\` or a BlockNote renderer. The canonical source type string is \`blocknotejs\` (not \`blocknote\`).
|
|
136
|
+
|
|
137
|
+
PII paths (JSON-like) are redacted from rendered outputs.
|
|
138
|
+
|
|
139
|
+
### MCP Integration
|
|
140
|
+
|
|
141
|
+
\`createMcpServer\` accepts \`presentationsV2\`. Each descriptor is exposed under \`presentation://<name>/v<version>\` and negotiated variants (\`.md/.json/.xml\`) are rendered by the engine.
|
|
142
|
+
|
|
143
|
+
### Migration
|
|
144
|
+
|
|
145
|
+
- V1 \`PresentationSpec\` remains supported; a back-compat helper converts V1 → V2 when convenient.
|
|
146
|
+
- Prefer V2 for new work.
|
|
147
|
+
|
|
148
|
+
### Examples (Sigil)
|
|
149
|
+
|
|
150
|
+
- \`sigil.auth.webauth_tabs_v2\`: component source (\`componentKey: 'sigil.webauth.tabs'\`), targets \`react/json/xml\`.
|
|
151
|
+
- \`sigil.signup.guide_v2\`: BlockNote doc source, targets \`react/markdown/json/xml\`.
|
|
152
|
+
|
|
153
|
+
### React Rendering
|
|
154
|
+
|
|
155
|
+
Host apps use a \`componentMap\` (e.g., \`'sigil.webauth.tabs' → WebAuthTabs\`) and a BlockNote renderer to turn the React render descriptor into elements.`}];D(y6);var m6=[{id:"docs.meta.docblocks-process",title:"DocBlocks process",summary:"How to author goal/how/usage DocBlocks close to code.",kind:"reference",visibility:"mixed",route:"/docs/meta/docblocks-process",tags:["docs","process"],body:`## DocBlocks authoring rules
|
|
156
|
+
|
|
157
|
+
- Colocate docs beside implementation; avoid barrel /docs folders.
|
|
158
|
+
- Split intent:
|
|
159
|
+
- **goal**: why this exists (before implementation).
|
|
160
|
+
- **how**: operational/runbook steps.
|
|
161
|
+
- **usage**: quick checklist for consumers.
|
|
162
|
+
- Use \`visibility\`: public | internal | mixed.
|
|
163
|
+
- Prefer routes like \`/docs/<domain>/<topic>/<kind>\`; ids mirror that.
|
|
164
|
+
- Keep body Markdown LLM-friendly; avoid HTML.
|
|
165
|
+
- Add owners/tags/domain/stability when known.
|
|
166
|
+
- For presentations/markdown outputs, rely on TransformEngine via DocRegistry.
|
|
167
|
+
- No sourcePath; DocBlocks are canonical.`}];D(m6);var oW=[{id:"docs.accessibility_wcag_compliance_specs",title:"Accessibility & WCAG Compliance — **specs.md**",summary:"> **Goal:** Ship interfaces that are usable by everyone, by default. This spec sets non‑negotiable rules, checklists, and CI gates to meet **WCAG 2.2 AA** (aim for AAA where low‑cost), align with **EN 301 549** (EU), and keep parity on **web (Next.js)** and **mobile (Expo/React Native)**.",kind:"reference",visibility:"public",route:"/docs/accessibility_wcag_compliance_specs",tags:["accessibility_wcag_compliance_specs"],body:`# Accessibility & WCAG Compliance — **specs.md**
|
|
168
|
+
|
|
169
|
+
> **Goal:** Ship interfaces that are usable by everyone, by default. This spec sets non‑negotiable rules, checklists, and CI gates to meet **WCAG 2.2 AA** (aim for AAA where low‑cost), align with **EN 301 549** (EU), and keep parity on **web (Next.js)** and **mobile (Expo/React Native)**.
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## 0) Scope & Principles
|
|
174
|
+
|
|
175
|
+
- **Standards:** WCAG 2.2 AA (incl. new 2.2 SCs: Focus Not Obscured, Focus Appearance, Target Size, Dragging Movements, Accessible Authentication, Redundant Entry). EN 301 549 compliance by conformance to WCAG.
|
|
176
|
+
- **Principles:** Perceivable, Operable, Understandable, Robust (POUR).
|
|
177
|
+
- **Rule of ARIA:** “No ARIA is better than bad ARIA.” Prefer native elements.
|
|
178
|
+
- **Definition of Done (DoD):** No Critical/Major a11y issues in CI; keyboard complete; SR (screen reader) smoke test passed; contrasts pass; acceptance criteria below satisfied.
|
|
179
|
+
- **Repo Alignment:** Web apps use **Radix Primitives + shadcn** wrappers centralized in \`packages/lssm/libs/ui-kit-web\`. Prefer those components over per‑app duplicates (\`packages/*/apps/*/src/components/ui\`). When missing, add to \`ui-kit-web\` first, then adopt app‑side.
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## 1) Design Requirements (Design System & Tokens)
|
|
184
|
+
|
|
185
|
+
**1.1 Color & Contrast**
|
|
186
|
+
|
|
187
|
+
- Body text, icons essential to meaning: **≥ 4.5:1**; large text (≥ 18.66px regular / 14px bold): **≥ 3:1**.
|
|
188
|
+
- Interactive states (default/hover/active/disabled/focus) must maintain contrast **≥ 3:1** against adjacent colors; text within components follows text ratios.
|
|
189
|
+
- Provide light & dark themes with tokens that guarantee minimums. **Never rely solely on color** to convey meaning; pair with text, shape, or icon.
|
|
190
|
+
|
|
191
|
+
**1.2 Focus Indicators (WCAG 2.4.11/12)**
|
|
192
|
+
|
|
193
|
+
- Every interactive element has a **visible focus** with clear offset; indicator contrast **≥ 3:1** vs adjacent colors and indicator **area ≥ 2 CSS px** thick.
|
|
194
|
+
- Focus **must not be obscured** by sticky headers/footers or scroll containers.
|
|
195
|
+
|
|
196
|
+
**1.3 Motion & Preferences**
|
|
197
|
+
|
|
198
|
+
- Respect \`prefers-reduced-motion\`: suppress large parallax, auto‑animations; provide instant alternatives.
|
|
199
|
+
- Avoid motion that could trigger vestibular issues; under PRM, use fade/scale under **150ms**.
|
|
200
|
+
|
|
201
|
+
**1.4 Target Size (2.5.8)**
|
|
202
|
+
|
|
203
|
+
- Hit areas **≥ 24×24 CSS px** (web) and **≥ 44×44 dp** (mobile) unless exempt.
|
|
204
|
+
|
|
205
|
+
**1.5 Typography & Layout**
|
|
206
|
+
|
|
207
|
+
- Support zoom to **400%** without loss of content/functionality; responsive reflow at **320 CSS px** width.
|
|
208
|
+
- Maintain clear heading hierarchy (h1…h6), one **h1** per view.
|
|
209
|
+
|
|
210
|
+
- Repository baseline (Web): default body text uses Tailwind \`text-lg\` (≈18px). As of 2025‑09‑20, the repository bumped all Tailwind typography scale usages by +1 step (e.g., \`text-sm\`→\`text-base\`, \`text-base\`→\`text-lg\`, …, \`text-8xl\`→\`text-9xl\`). For long‑form content, default to \`prose-lg\`.
|
|
211
|
+
- Do not use \`text-xs\` for body copy. Reserve \`text-sm\` only for non‑essential meta (timestamps, fine print) while ensuring contrast and touch targets remain compliant.
|
|
212
|
+
- When increasing font size, ensure line height supports readability. Prefer Tailwind defaults or \`leading-relaxed\`/\`leading-7\` for body text where dense blocks appear.
|
|
213
|
+
|
|
214
|
+
**1.6 Iconography & Imagery**
|
|
215
|
+
|
|
216
|
+
- Decorative images: \`alt=""\` or \`aria-hidden="true"\`.
|
|
217
|
+
- Informative images: concise, specific **alt**; complex charts require a **data table or long description**.
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
## 2) Content Requirements (UX Writing)
|
|
222
|
+
|
|
223
|
+
- Links say **what happens** (avoid “click here”).
|
|
224
|
+
- Buttons start with verbs; avoid ambiguous labels.
|
|
225
|
+
- Form labels are **visible**; placeholders are **not labels**.
|
|
226
|
+
- Error messages: human + programmatic association; avoid color‑only.
|
|
227
|
+
- Authentication: allow **copy/paste**, password managers, and avoid cognitive tests alone (**3.3.7/3.3.8/3.3.9**).
|
|
228
|
+
- Avoid CAPTCHAs that block users; if unavoidable, provide **multiple alternatives** (logic-free).
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
## 3) Engineering Requirements (Web — Next.js/React)
|
|
233
|
+
|
|
234
|
+
> Use and extend \`packages/lssm/libs/ui-kit-web\` as the default UI surface. It wraps **Radix** primitives with sensible a11y defaults (focus rings, roles, keyboard, ARIA binding). When a gap exists, add it to \`ui-kit-web\` first.
|
|
235
|
+
|
|
236
|
+
**3.1 Semantics & Landmarks**
|
|
237
|
+
|
|
238
|
+
- Use native elements: \`<button>\`, \`<a href>\`, \`<label for>\`, \`<fieldset>\`, \`<legend>\`, \`<table>\`, etc.
|
|
239
|
+
- Landmarks per page: \`header\`, \`nav\`, \`main\`, \`aside\`, \`footer\`. Provide a **Skip to main content** link.
|
|
240
|
+
- Provide a **Route Announcer** (\`aria-live="polite"\`) and move focus to page **h1** after navigation.
|
|
241
|
+
|
|
242
|
+
**3.2 Keyboard**
|
|
243
|
+
|
|
244
|
+
- All functionality available with keyboard alone. Tab order follows DOM/visual order; **no keyboard traps**.
|
|
245
|
+
- Common bindings:
|
|
246
|
+
- Space/Enter → activate button; Enter on link;
|
|
247
|
+
- Esc closes dialogs/menus;
|
|
248
|
+
- Arrow keys for lists/menus/tablists with **roving tabindex**.
|
|
249
|
+
|
|
250
|
+
**3.3 Focus Management**
|
|
251
|
+
|
|
252
|
+
- On route change (Next.js), move focus to the page \`<h1>\` or container and announce via a live region.
|
|
253
|
+
- Dialogs/menus: **trap focus** inside; return focus to invoking control on close.
|
|
254
|
+
- Don’t steal focus except after explicit user action.
|
|
255
|
+
|
|
256
|
+
**3.4 Forms**
|
|
257
|
+
|
|
258
|
+
- Each input has a \`<label>\` or \`aria-label\`. Group related inputs with \`<fieldset><legend>\`.
|
|
259
|
+
- Associate errors via \`aria-describedby\` or inline IDs; announce with \`role="alert"\` (assertive only for critical).
|
|
260
|
+
- Provide **autocomplete** tokens for known fields; show **inline validation** and do not block on **onBlur** alone.
|
|
261
|
+
|
|
262
|
+
**3.5 ARIA Usage**
|
|
263
|
+
|
|
264
|
+
- Only when needed; match patterns (dialog, menu, combobox, tablist, listbox) per ARIA Authoring Practices.
|
|
265
|
+
- Ensure **name/role/value** are programmatically determinable.
|
|
266
|
+
|
|
267
|
+
**3.6 Media**
|
|
268
|
+
|
|
269
|
+
- Videos: **captions**; provide **transcripts** for audio; audio descriptions for essential visual info.
|
|
270
|
+
- No auto‑playing audio. Auto‑playing video must be muted and pausable; provide controls.
|
|
271
|
+
|
|
272
|
+
**3.7 Tables & Data**
|
|
273
|
+
|
|
274
|
+
- Use \`<th scope>\` for headers; captions via \`<caption>\`; announce sorting via \`aria-sort\`.
|
|
275
|
+
- Provide CSV/JSON export where charts are primary.
|
|
276
|
+
|
|
277
|
+
**3.8 Performance & Robustness**
|
|
278
|
+
|
|
279
|
+
- Avoid content shifts that move focus; reserve space or use skeletons.
|
|
280
|
+
- Maintain accessible names through hydration/SSR; avoid \`dangerouslySetInnerHTML\` where possible.
|
|
281
|
+
|
|
282
|
+
**3.9 Next.js specifics**
|
|
283
|
+
|
|
284
|
+
- Use \`next/link\` for navigation; ensure links are **links**, not buttons.
|
|
285
|
+
- \`next/image\` must include **alt** (empty if decorative).
|
|
286
|
+
- Announce route changes with a **global live region** and shift focus to the new view.
|
|
287
|
+
|
|
288
|
+
**3.10 Accessibility library integration**
|
|
289
|
+
|
|
290
|
+
- Import \`@contractspec/lib.accessibility\` at app root. It auto-imports its \`styles.css\` via the package entry; ensure bundlers keep CSS side effects. If your app tree-shakes CSS, explicitly import the stylesheet once in your root layout:
|
|
291
|
+
|
|
292
|
+
\`\`\`tsx
|
|
293
|
+
// app/layout.tsx
|
|
294
|
+
import '@contractspec/lib.accessibility'; // includes tokens and provider exports
|
|
295
|
+
// or if needed: import '@contractspec/lib.accessibility/src/styles.css';
|
|
296
|
+
\`\`\`
|
|
297
|
+
|
|
298
|
+
- Wrap the app with \`AccessibilityProvider\` and include an element with \`id="main"\` for the skip link target.
|
|
299
|
+
|
|
300
|
+
---
|
|
301
|
+
|
|
302
|
+
## 3b) lssm/ui-kit-web — Component Patterns & Defaults
|
|
303
|
+
|
|
304
|
+
> Source: \`packages/lssm/libs/ui-kit-web/ui/*\`
|
|
305
|
+
|
|
306
|
+
- **Button/Input/Textarea**: Built‑in \`focus-visible\` rings; ensure visible labels via \`FormLabel\` or \`aria-label\`.
|
|
307
|
+
- **Form** (\`form.tsx\`): \`FormControl\` wires \`aria-invalid\` and \`aria-describedby\` to \`FormMessage\` and \`FormDescription\`. Prefer \`FormMessage\` for inline errors. Add \`role="alert"\` only for critical.
|
|
308
|
+
- **Dialog/Sheet/Dropdown**: Use Radix wrappers for focus‑trap and return‑focus. Provide \`DialogTitle\` + \`DialogDescription\` for name/description.
|
|
309
|
+
- **Select/Combobox**: Prefer \`SelectTrigger\` with visible label; for icon‑only triggers, supply \`aria-label\`. Document examples in each app.
|
|
310
|
+
- **Tabs**: Use \`TabsList\`, \`TabsTrigger\`, \`TabsContent\`; names are programmatically determinable.
|
|
311
|
+
- **Toast/Toaster**: Prefer non‑blocking announcements; map critical to assertive region; include action buttons with clear labels.
|
|
312
|
+
- **Table**: Use \`TableCaption\`; ensure \`TableHead\` cells use proper \`scope\`. Provide \`aria-sort\` on sortable headers.
|
|
313
|
+
- **Utilities to add (repo action)**:
|
|
314
|
+
- \`SkipLink\` component and pattern in layouts.
|
|
315
|
+
- \`RouteAnnouncer\` (\`aria-live="polite"\`) and **FocusOnRouteChange** helper.
|
|
316
|
+
- \`VisuallyHidden\` wrapper (Radix visually-hidden or minimal utility).
|
|
317
|
+
- \`useReducedMotion\` helper; honor in animated components.
|
|
318
|
+
- Touch‑size variants (≥44×44) for interactive atoms.
|
|
319
|
+
|
|
320
|
+
---
|
|
321
|
+
|
|
322
|
+
## 4) Engineering Requirements (Mobile — Expo/React Native)
|
|
323
|
+
|
|
324
|
+
- Set \`accessibilityLabel\`, \`accessibilityHint\`, and \`accessibilityRole\` on touchables.
|
|
325
|
+
- Ensure **hit slop** / min size **≥ 44×44 dp**.
|
|
326
|
+
- Support Dynamic Type / font scaling; no clipped text at **200%**.
|
|
327
|
+
- Respect **Invert Colors** and **Reduce Motion**; avoid flashing.
|
|
328
|
+
- Group related items with \`accessibilityElements\` ordering; hide decoration with \`accessible={false}\` or \`importantForAccessibility="no-hide-descendants"\` when appropriate.
|
|
329
|
+
- Test with **VoiceOver (iOS)** and **TalkBack (Android)**.
|
|
330
|
+
|
|
331
|
+
---
|
|
332
|
+
|
|
333
|
+
## 5) Component Patterns (Acceptance Rules)
|
|
334
|
+
|
|
335
|
+
**Buttons & Links**
|
|
336
|
+
|
|
337
|
+
- Use \`<button>\` for actions, \`<a href>\` for navigation. Provide disabled states that are perceivable beyond color.
|
|
338
|
+
|
|
339
|
+
**Navigation**
|
|
340
|
+
|
|
341
|
+
- Provide **Skip link**. One primary nav landmark. Indicate current page (\`aria-current="page"\`).
|
|
342
|
+
|
|
343
|
+
**Menus/Combobox/Autocomplete**
|
|
344
|
+
|
|
345
|
+
- Follow ARIA patterns: focus moves into list; \`aria-expanded\`, \`aria-controls\`, \`aria-activedescendant\` when applicable; Esc closes; typing filters.
|
|
346
|
+
|
|
347
|
+
**Modals/Dialogs**
|
|
348
|
+
|
|
349
|
+
- \`role="dialog"\` or \`alertdialog\` with **label**; focus trapped; background inert; Esc closes; return focus to trigger.
|
|
350
|
+
|
|
351
|
+
**Tabs**
|
|
352
|
+
|
|
353
|
+
- \`role="tablist"\`; tabs are in the tab order; arrow keys switch focus; content is \`role="tabpanel"\` with \`aria-labelledby\`.
|
|
354
|
+
|
|
355
|
+
**Toasts/Notifications**
|
|
356
|
+
|
|
357
|
+
- Non-critical: \`aria-live="polite"\`; critical: \`role="alert"\` sparingly.
|
|
358
|
+
|
|
359
|
+
**Infinite Scroll / “Load More”**
|
|
360
|
+
|
|
361
|
+
- Provide **Load more** control; announce new content to SR; preserve keyboard position.
|
|
362
|
+
|
|
363
|
+
**Drag & Drop (2.5.7)**
|
|
364
|
+
|
|
365
|
+
- Provide **non‑drag** alternative (e.g., move up/down buttons).
|
|
366
|
+
|
|
367
|
+
**Charts & Maps**
|
|
368
|
+
|
|
369
|
+
- Provide **table alternative** or textual summary; keyboard access to datapoints where interactive.
|
|
370
|
+
|
|
371
|
+
---
|
|
372
|
+
|
|
373
|
+
## 6) Testing & CI (Blocking Gates)
|
|
374
|
+
|
|
375
|
+
**Static & Unit**
|
|
376
|
+
|
|
377
|
+
- \`eslint-plugin-jsx-a11y\` — error on violations.
|
|
378
|
+
- \`jest-axe\` — unit tests for components.
|
|
379
|
+
|
|
380
|
+
**Automated Integration**
|
|
381
|
+
|
|
382
|
+
- \`axe-core\` via Playwright or Cypress on critical flows.
|
|
383
|
+
- \`pa11y-ci\` on key routes; threshold: **0 Critical / 0 Serious** to merge.
|
|
384
|
+
- Lighthouse CI a11y score **≥ 95** on target pages.
|
|
385
|
+
|
|
386
|
+
**Manual QA (per release)**
|
|
387
|
+
|
|
388
|
+
- **Keyboard patrol:** navigate primary flows without mouse.
|
|
389
|
+
- **Screen reader smoke:** NVDA (Windows) or VoiceOver (macOS/iOS) across login, navigation, forms, dialogs.
|
|
390
|
+
- **Zoom & Reflow:** 200–400% & 320 px width.
|
|
391
|
+
- **Color/Contrast check:** tokens in both themes.
|
|
392
|
+
|
|
393
|
+
**Reporting**
|
|
394
|
+
|
|
395
|
+
- A11y issues labeled: \`a11y-blocker\`, \`a11y-bug\`, \`a11y-enhancement\` with WCAG ref.
|
|
396
|
+
|
|
397
|
+
---
|
|
398
|
+
|
|
399
|
+
## 7) Repository‑Specific Adoption Plan
|
|
400
|
+
|
|
401
|
+
- Centralize UI usage on \`packages/lssm/libs/ui-kit-web\` and de‑duplicate per‑app \`components/ui\` where feasible.
|
|
402
|
+
- Introduce \`SkipLink\`, \`RouteAnnouncer\`, \`FocusOnRouteChange\`, and \`VisuallyHidden\` in \`ui-kit-web\`. Adopt in app layouts (\`app/layout.tsx\`) first.
|
|
403
|
+
- Add \`useReducedMotion\` and wire into animated components (e.g., \`drawer\`, \`tooltip\`, \`carousel\`).
|
|
404
|
+
- Add touch‑size variants to \`Button\`, \`IconButton\`, \`TabsTrigger\`, toggles.
|
|
405
|
+
- Document Select label patterns and error association in Forms.
|
|
406
|
+
|
|
407
|
+
---
|
|
408
|
+
|
|
409
|
+
## 8) Code Snippets
|
|
410
|
+
|
|
411
|
+
**Skip Link**
|
|
412
|
+
|
|
413
|
+
\`\`\`html
|
|
414
|
+
<a
|
|
415
|
+
class="sr-only focus:not-sr-only focus-visible:outline focus-visible:ring-4 focus-visible:ring-offset-2"
|
|
416
|
+
href="#main"
|
|
417
|
+
>Skip to main content</a
|
|
418
|
+
>
|
|
419
|
+
<main id="main">…</main>
|
|
420
|
+
\`\`\`
|
|
421
|
+
|
|
422
|
+
**Dialog (Radix + shadcn/ui) — essentials**
|
|
423
|
+
|
|
424
|
+
\`\`\`tsx
|
|
425
|
+
// Ensure label, description, focus trap, and return focus on close remain intact
|
|
426
|
+
<Dialog>
|
|
427
|
+
<DialogTrigger asChild>
|
|
428
|
+
<button aria-haspopup="dialog">Open settings</button>
|
|
429
|
+
</DialogTrigger>
|
|
430
|
+
<DialogContent aria-describedby="settings-desc">
|
|
431
|
+
<DialogTitle>Settings</DialogTitle>
|
|
432
|
+
<p id="settings-desc">Update your preferences.</p>
|
|
433
|
+
<DialogClose asChild>
|
|
434
|
+
<button>Close</button>
|
|
435
|
+
</DialogClose>
|
|
436
|
+
</DialogContent>
|
|
437
|
+
</Dialog>
|
|
438
|
+
\`\`\`
|
|
439
|
+
|
|
440
|
+
**Form error association**
|
|
441
|
+
|
|
442
|
+
\`\`\`tsx
|
|
443
|
+
<label htmlFor="email">Email</label>
|
|
444
|
+
<input id="email" name="email" type="email" aria-describedby="email-err" />
|
|
445
|
+
<p id="email-err" role="alert">Enter a valid email.</p>
|
|
446
|
+
\`\`\`
|
|
447
|
+
|
|
448
|
+
**Route change announcement (Next.js)**
|
|
449
|
+
|
|
450
|
+
\`\`\`tsx
|
|
451
|
+
// Add once at app root
|
|
452
|
+
<div
|
|
453
|
+
aria-live="polite"
|
|
454
|
+
aria-atomic="true"
|
|
455
|
+
id="route-announcer"
|
|
456
|
+
className="sr-only"
|
|
457
|
+
/>
|
|
458
|
+
\`\`\`
|
|
459
|
+
|
|
460
|
+
---
|
|
461
|
+
|
|
462
|
+
## 9) Exceptions & Waivers
|
|
463
|
+
|
|
464
|
+
- If a criterion cannot be met, file an issue with: context, attempted alternatives, WCAG reference, impact assessment, and a remediation date. **Temporary waivers only.**
|
|
465
|
+
|
|
466
|
+
---
|
|
467
|
+
|
|
468
|
+
## 10) Ownership
|
|
469
|
+
|
|
470
|
+
- **Design:** maintains token contrast, component specs.
|
|
471
|
+
- **Engineering:** enforces CI gates, implements patterns.
|
|
472
|
+
- **QA:** runs manual checks per release.
|
|
473
|
+
- **PM:** blocks release if AA not met on user‑visible flows.
|
|
474
|
+
|
|
475
|
+
---
|
|
476
|
+
|
|
477
|
+
## 11) References (internalize; no external dependency at runtime)
|
|
478
|
+
|
|
479
|
+
- WCAG 2.2 (AA), EN 301 549. ARIA Authoring Practices. Platform HIG (Apple, Material).
|
|
480
|
+
- \`packages/lssm/libs/ui-kit-web\` as the canonical UI source for web.
|
|
481
|
+
|
|
482
|
+
> **Bottom line:** Shipping means **accessible by default**. We don’t trade a11y for speed; we bake it into speed.
|
|
483
|
+
|
|
484
|
+
---
|
|
485
|
+
|
|
486
|
+
## 12) Adoption Status (2025-09-23)
|
|
487
|
+
|
|
488
|
+
- web-artisan: AccessibilityProvider integrated; sr-only/forced-colors applied; 44x44 targets; forms announce errors; jest-axe and cypress-axe in place.
|
|
489
|
+
- web-strit: AccessibilityProvider integrated; forced-colors, sr-only; forms announce errors; 44x44 targets; contrast tokens and text-scale wired; jest-axe and cypress-axe in place.
|
|
490
|
+
- web-coliving: AccessibilityProvider integrated; forced-colors and focus visibility added; text-scale wired; landing pages converted to \`Section\`/stacks with text-lg defaults; CTA capture standardized; ESLint guard for text-xs in main content; jest-axe and cypress-axe in place. Next: audit icon-only controls and ensure 44x44 targets; add role="alert" where critical.
|
|
491
|
+
|
|
492
|
+
> CI gates: run eslint a11y, jest-axe on components, and cypress-axe on critical flows per app.
|
|
493
|
+
|
|
494
|
+
---
|
|
495
|
+
|
|
496
|
+
## 13) CI Hardening & Visual QA
|
|
497
|
+
|
|
498
|
+
- Linting: Run eslint with jsx-a11y rules across all web apps; block on violations.
|
|
499
|
+
- Unit: Run jest-axe for ui-kit-web and app-level components.
|
|
500
|
+
- Integration: cypress-axe on key flows (auth, forms, dialogs, tables).
|
|
501
|
+
- Synthetic scans: pa11y-ci on critical pages (0 Critical/Serious policy).
|
|
502
|
+
- Performance/A11y audit: Lighthouse CI with a11y score >= 95 on target routes.
|
|
503
|
+
- Artifacts: Upload pa11y and Lighthouse reports per PR; annotate failures.
|
|
504
|
+
|
|
505
|
+
### Recent additions (2025-09-26)
|
|
506
|
+
|
|
507
|
+
- AutocompleteInput (groceries): Upgraded to ARIA combobox pattern with \`aria-controls\`, \`aria-activedescendant\`, \`Escape\`/\`Tab\` handling, and labelled listbox.
|
|
508
|
+
- Cypress a11y tests added for furniture and incidents modules on \`/modules\` and operators flows; checks run axe with critical/serious impacts.
|
|
509
|
+
|
|
510
|
+
## 14) Accessibility Telemetry (PostHog)
|
|
511
|
+
|
|
512
|
+
- Events (anonymized): a11y_pref_changed (text_scale, contrast_mode, reduce_motion), a11y_panel_opened.
|
|
513
|
+
- Properties: app, route, previous_value, new_value, timestamp.
|
|
514
|
+
- Dashboards: Adoption over time, per app/route; correlation with reduced bounce on forms.
|
|
515
|
+
- Privacy: No PII; aggregate only.
|
|
516
|
+
`}];D(oW);var lW=[{id:"docs.tech.lifecycle-stage-system",title:"ContractSpec Lifecycle Stage System – Technical Design",summary:"This document describes how ContractSpec implements lifecycle detection and guidance. It covers architecture, module boundaries, scoring heuristics, and integration points so libraries, modules, bundles, and Studio surfaces stay synchronized.",kind:"reference",visibility:"public",route:"/docs/tech/lifecycle-stage-system",tags:["tech","lifecycle-stage-system"],body:`## ContractSpec Lifecycle Stage System – Technical Design
|
|
517
|
+
|
|
518
|
+
This document describes how ContractSpec implements lifecycle detection and guidance. It covers architecture, module boundaries, scoring heuristics, and integration points so libraries, modules, bundles, and Studio surfaces stay synchronized.
|
|
519
|
+
|
|
520
|
+
---
|
|
521
|
+
|
|
522
|
+
### 1. Architecture Overview
|
|
523
|
+
|
|
524
|
+
\`\`\`
|
|
525
|
+
┌──────────────────────┐
|
|
526
|
+
│ @contractspec/lib.lifecycle │ Types, enums, helpers (pure data)
|
|
527
|
+
└───────────┬──────────┘
|
|
528
|
+
│
|
|
529
|
+
┌───────────▼──────────┐ ┌───────────────────────────┐
|
|
530
|
+
│ modules/lifecycle- │ │ modules/lifecycle-advisor │
|
|
531
|
+
│ core (detection) │ │ (guidance & ceremonies) │
|
|
532
|
+
└───────────┬──────────┘ └───────────┬───────────────┘
|
|
533
|
+
│ │
|
|
534
|
+
├────────────┬──────────────┤
|
|
535
|
+
▼ ▼ ▼
|
|
536
|
+
Adapters: analytics, intent, questionnaires
|
|
537
|
+
│
|
|
538
|
+
┌───────────▼──────────┐
|
|
539
|
+
│ bundles/lifecycle- │ Managed service for Studio
|
|
540
|
+
│ managed │ (REST handlers, AI agent) │
|
|
541
|
+
└───────────┬──────────┘
|
|
542
|
+
│
|
|
543
|
+
ContractSpec Studio surfaces
|
|
544
|
+
(web/mobile APIs, CLI, docs)
|
|
545
|
+
\`\`\`
|
|
546
|
+
|
|
547
|
+
- **Libraries** provide shared vocabulary.
|
|
548
|
+
- **Modules** encapsulate logic, accepting adapters to avoid environment-specific code.
|
|
549
|
+
- **Bundles** compose modules, register agents/events, and expose APIs for Studio.
|
|
550
|
+
- **Apps** (web-landing, future Studio views) consume bundle APIs; they do not reimplement logic. For web-landing we now resolve \`@contractspec/bundle.studio\` and \`@contractspec/lib.database-studio\` directly from their \`packages/.../src\` folders via \`tsconfig\` path aliases so Prisma stays on the server build and Turbopack no longer pulls the prebundled \`dist\` artifacts into client chunks.
|
|
551
|
+
|
|
552
|
+
---
|
|
553
|
+
|
|
554
|
+
### 2. Core Library (\`@contractspec/lib.lifecycle\`)
|
|
555
|
+
|
|
556
|
+
- Stage enum (0–6) with metadata (\`question\`, \`signals\`, \`traps\`).
|
|
557
|
+
- Axes types (\`ProductPhase\`, \`CompanyPhase\`, \`CapitalPhase\`).
|
|
558
|
+
- \`LifecycleSignal\` (source, metric, value, timestamp).
|
|
559
|
+
- \`LifecycleMetricSnapshot\` (aggregated numbers).
|
|
560
|
+
- \`LifecycleMilestone\`, \`LifecycleAction\`, \`LifecycleAssessment\` interfaces.
|
|
561
|
+
- Utility helpers:
|
|
562
|
+
- \`formatStageSummary(stage, assessment)\`
|
|
563
|
+
- \`rankStageCandidates(scores)\`
|
|
564
|
+
|
|
565
|
+
The library exports **no runtime dependencies** so it can be imported from apps, modules, and bundles alike.
|
|
566
|
+
|
|
567
|
+
---
|
|
568
|
+
|
|
569
|
+
### 3. Lifecycle Core Module
|
|
570
|
+
|
|
571
|
+
**Location:** \`packages/modules/lifecycle-core/\`
|
|
572
|
+
|
|
573
|
+
#### Components
|
|
574
|
+
1. **StageSignalCollector**
|
|
575
|
+
- Accepts adapter interfaces:
|
|
576
|
+
- \`AnalyticsAdapter\` (pulls metrics from \`@contractspec/lib.analytics\` or fixture streams).
|
|
577
|
+
- \`IntentAdapter\` (hooks into \`@contractspec/lib.observability\` intent detectors or logs).
|
|
578
|
+
- \`QuestionnaireAdapter\` (loads JSON questionnaires and responses).
|
|
579
|
+
- Produces normalized \`LifecycleSignal[]\`.
|
|
580
|
+
|
|
581
|
+
2. **StageScorer**
|
|
582
|
+
- Weighted scoring model:
|
|
583
|
+
- Base weight per stage (reflecting expected maturity).
|
|
584
|
+
- Feature weights (retention, revenue, team size, qualitative feedback).
|
|
585
|
+
- Confidence computed via variance of contributing signals.
|
|
586
|
+
- Supports pluggable scoring matrices via JSON config.
|
|
587
|
+
- Accepts sparse metric snapshots; the orchestrator sanitizes metrics to numeric-only records before persisting assessments so downstream analytics stay consistent.
|
|
588
|
+
|
|
589
|
+
3. **LifecycleOrchestrator**
|
|
590
|
+
- Coordinates collectors + scorer.
|
|
591
|
+
- Returns \`LifecycleAssessment\` with:
|
|
592
|
+
- \`stage\`, \`confidence\`, \`axisSnapshot\`, \`signalsUsed\`.
|
|
593
|
+
- Recommended focus areas (high-level categories only).
|
|
594
|
+
- Emits events (internally) when stage confidence crosses thresholds (consumed later by bundle).
|
|
595
|
+
|
|
596
|
+
4. **LifecycleMilestonePlanner**
|
|
597
|
+
- Loads \`milestones-catalog.json\` (no DB).
|
|
598
|
+
- Filters upcoming milestones per stage + axis.
|
|
599
|
+
- Tracks completion using provided IDs (caller persists).
|
|
600
|
+
|
|
601
|
+
#### Data Files
|
|
602
|
+
- \`configs/stage-weights.json\`
|
|
603
|
+
- \`configs/milestones-catalog.json\`
|
|
604
|
+
- \`questionnaires/stage-readiness.json\`
|
|
605
|
+
|
|
606
|
+
#### Extension Hooks
|
|
607
|
+
- All adapters exported as TypeScript interfaces.
|
|
608
|
+
- Implementations for analytics/intent can live in bundles or apps without modifying module code.
|
|
609
|
+
|
|
610
|
+
---
|
|
611
|
+
|
|
612
|
+
### 4. Lifecycle Advisor Module
|
|
613
|
+
|
|
614
|
+
**Location:** \`packages/modules/lifecycle-advisor/\`
|
|
615
|
+
|
|
616
|
+
#### Components
|
|
617
|
+
1. **LifecycleRecommendationEngine**
|
|
618
|
+
- Consumes \`LifecycleAssessment\`.
|
|
619
|
+
- Maps gaps to \`LifecycleAction[]\` using rule tables (\`stage-playbooks.ts\`).
|
|
620
|
+
- Supports override hooks for customer-specific rules.
|
|
621
|
+
|
|
622
|
+
2. **ContractSpecLibraryRecommender**
|
|
623
|
+
- Maintains mapping from stage → recommended libraries/modules/bundles.
|
|
624
|
+
- Returns prioritized list with rationale and adoption prerequisites.
|
|
625
|
+
|
|
626
|
+
3. **LifecycleCeremonyDesigner**
|
|
627
|
+
- Provides textual/structural data for ceremonies (title, copy, animation cues, soundtrack references).
|
|
628
|
+
- Ensures low-tech friendly instructions (clear copy, undo guidance).
|
|
629
|
+
|
|
630
|
+
4. **AI Hooks**
|
|
631
|
+
- Defines prompt templates and tool manifests for lifecycle advisor agents (consumed by bundles).
|
|
632
|
+
- Keeps actual LLM integration outside module.
|
|
633
|
+
|
|
634
|
+
---
|
|
635
|
+
|
|
636
|
+
### 5. Managed Bundle (\`lifecycle-managed\`)
|
|
637
|
+
|
|
638
|
+
**Responsibilities**
|
|
639
|
+
- Wire modules together.
|
|
640
|
+
- Provide HTTP/GraphQL handlers (exact transport optional).
|
|
641
|
+
- Register LifecycleAdvisorAgent via \`@contractspec/lib.ai-agent\`.
|
|
642
|
+
- LifecycleAdvisorAgent meta: domain \`operations\`, owners \`team-lifecycle\`, stability \`experimental\`, tags \`guide/lifecycle/ops\` so ops tooling can route incidents quickly.
|
|
643
|
+
- Emit lifecycle events through \`@contractspec/lib.bus\` + \`@contractspec/lib.analytics\`.
|
|
644
|
+
- Integrate with \`contractspec-studio\` packages:
|
|
645
|
+
- Use Studio contracts for authentication/tenant context (without accessing tenant DBs).
|
|
646
|
+
- Store assessments in Studio-managed storage abstractions (in-memory or file-based for now).
|
|
647
|
+
|
|
648
|
+
**APIs**
|
|
649
|
+
- \`POST /lifecycle/assessments\`: Accepts metrics + optional questionnaire answers. Returns \`LifecycleAssessment\`.
|
|
650
|
+
- \`GET /lifecycle/playbooks/:stage\`: Returns stage playbook + ceremonies.
|
|
651
|
+
- \`POST /lifecycle/advise\`: Invokes LifecycleAdvisorAgent with context.
|
|
652
|
+
|
|
653
|
+
**Events**
|
|
654
|
+
- \`LifecycleAssessmentCreated\`
|
|
655
|
+
- \`LifecycleStageChanged\`
|
|
656
|
+
- \`LifecycleGuidanceConsumed\`
|
|
657
|
+
|
|
658
|
+
---
|
|
659
|
+
|
|
660
|
+
### 6. Library Enhancements
|
|
661
|
+
|
|
662
|
+
| Library | Enhancement |
|
|
663
|
+
| --- | --- |
|
|
664
|
+
| \`@contractspec/lib.analytics\` | Lifecycle metric collectors, helper to emit stage events, adapter implementation used by \`StageSignalCollector\`. |
|
|
665
|
+
| \`@contractspec/lib.evolution\` | Accepts \`LifecycleContext\` when ranking spec anomalies/suggestions. |
|
|
666
|
+
| \`@contractspec/lib.growth\` | Stage-specific experiment templates + guardrails referencing lifecycle enums. |
|
|
667
|
+
| \`@contractspec/lib.observability\` | Lifecycle KPI pipeline definitions (drift detection, regression alerts). |
|
|
668
|
+
|
|
669
|
+
Each enhancement must import stage types from \`@contractspec/lib.lifecycle\`.
|
|
670
|
+
|
|
671
|
+
---
|
|
672
|
+
|
|
673
|
+
### 7. Feature Flags & Progressive Delivery
|
|
674
|
+
|
|
675
|
+
- Add new flags in progressive-delivery library:
|
|
676
|
+
- \`LIFECYCLE_DETECTION_ALPHA\`
|
|
677
|
+
- \`LIFECYCLE_ADVISOR_ALPHA\`
|
|
678
|
+
- \`LIFECYCLE_MANAGED_SERVICE\`
|
|
679
|
+
- Bundles/modules should check flags before enabling workflows.
|
|
680
|
+
- Flags referenced in docs + Studio UI to avoid accidental exposure.
|
|
681
|
+
|
|
682
|
+
---
|
|
683
|
+
|
|
684
|
+
### 8. Analytics & Telemetry
|
|
685
|
+
|
|
686
|
+
- Events defined in analytics library; consumed by bundle/app:
|
|
687
|
+
- \`lifecycle_assessment_run\`
|
|
688
|
+
- \`lifecycle_stage_changed\`
|
|
689
|
+
- \`lifecycle_guidance_consumed\`
|
|
690
|
+
- Observability pipeline includes:
|
|
691
|
+
- Composite lifecycle health metric (weighted sum of KPIs).
|
|
692
|
+
- Drift detection comparing stage predictions over time.
|
|
693
|
+
- Alert manager recipes for regression (e.g., PMF drop).
|
|
694
|
+
|
|
695
|
+
---
|
|
696
|
+
|
|
697
|
+
### 9. Testing Strategy
|
|
698
|
+
|
|
699
|
+
1. **Unit**
|
|
700
|
+
- StageScorer weight matrix.
|
|
701
|
+
- RecommendationEngine mapping.
|
|
702
|
+
- Library recommender stage coverage.
|
|
703
|
+
|
|
704
|
+
2. **Contract**
|
|
705
|
+
- Adapters: ensure mock adapters satisfy interfaces.
|
|
706
|
+
- Bundles: ensure HTTP handlers respect request/response contracts even without persistence.
|
|
707
|
+
|
|
708
|
+
3. **Integration**
|
|
709
|
+
- CLI example runs detection + guidance end-to-end on fixture data.
|
|
710
|
+
- Dashboard example renders assessments, verifying JSON structures remain stable.
|
|
711
|
+
|
|
712
|
+
---
|
|
713
|
+
|
|
714
|
+
### 10. Implementation Checklist
|
|
715
|
+
|
|
716
|
+
- [ ] Documentation (product, tech, ops, user).
|
|
717
|
+
- [ ] Library creation (\`@contractspec/lib.lifecycle\`).
|
|
718
|
+
- [ ] Modules (\`lifecycle-core\`, \`lifecycle-advisor\`).
|
|
719
|
+
- [ ] Bundle (\`lifecycle-managed\`) + Studio wiring.
|
|
720
|
+
- [ ] Library enhancements (analytics/evolution/growth/observability).
|
|
721
|
+
- [ ] Examples (CLI + dashboard).
|
|
722
|
+
- [ ] Feature flags + telemetry.
|
|
723
|
+
- [ ] Automated tests + fixtures.
|
|
724
|
+
|
|
725
|
+
Keep this document in sync as modules evolve. When adding new stages or axes, update \`@contractspec/lib.lifecycle\` first, then cascade to adapters, then refresh docs + Studio copy.*** End Patch*** End Patch
|
|
726
|
+
|
|
727
|
+
|
|
728
|
+
`}];D(lW);var pW=[{id:"docs.tech.presentation-runtime",title:"Presentation Runtime",summary:"Cross-platform runtime for list pages and presentation flows.",kind:"reference",visibility:"public",route:"/docs/tech/presentation-runtime",tags:["tech","presentation-runtime"],body:`## Presentation Runtime
|
|
729
|
+
|
|
730
|
+
Cross-platform runtime for list pages and presentation flows.
|
|
731
|
+
|
|
732
|
+
### Packages
|
|
733
|
+
|
|
734
|
+
- \`@contractspec/lib.presentation-runtime-core\`: shared types and config helpers
|
|
735
|
+
- \`@contractspec/lib.presentation-runtime-react\`: React hooks (web/native-compatible API)
|
|
736
|
+
- \`@contractspec/lib.presentation-runtime-react-native\`: Native entrypoint (re-exports React API for now)
|
|
737
|
+
|
|
738
|
+
### Next.js config helper
|
|
739
|
+
|
|
740
|
+
\`\`\`ts
|
|
741
|
+
// next.config.mjs
|
|
742
|
+
import { withPresentationNextAliases } from '@contractspec/lib.presentation-runtime-core/next';
|
|
743
|
+
|
|
744
|
+
const nextConfig = {
|
|
745
|
+
webpack: (config) => withPresentationNextAliases(config),
|
|
746
|
+
};
|
|
747
|
+
|
|
748
|
+
export default nextConfig;
|
|
749
|
+
\`\`\`
|
|
750
|
+
|
|
751
|
+
### Metro config helper
|
|
752
|
+
|
|
753
|
+
\`\`\`js
|
|
754
|
+
// metro.config.js (CJS)
|
|
755
|
+
const { getDefaultConfig } = require('expo/metro-config');
|
|
756
|
+
const {
|
|
757
|
+
withPresentationMetroAliases,
|
|
758
|
+
} = require('@contractspec/lib.presentation-runtime-core/src/metro.cjs');
|
|
759
|
+
|
|
760
|
+
const projectRoot = __dirname;
|
|
761
|
+
const config = getDefaultConfig(projectRoot);
|
|
762
|
+
|
|
763
|
+
module.exports = withPresentationMetroAliases(config);
|
|
764
|
+
\`\`\`
|
|
765
|
+
|
|
766
|
+
### React hooks
|
|
767
|
+
|
|
768
|
+
- \`useListCoordinator\`: URL + RHF + derived variables (no fetching)
|
|
769
|
+
- \`usePresentationController\`: Same plus \`fetcher\` integration
|
|
770
|
+
- \`DataViewRenderer\` (design-system): render \`DataViewSpec\` projections (\`list\`, \`table\`, \`detail\`, \`grid\`) using shared UI atoms
|
|
771
|
+
|
|
772
|
+
Both accept a \`useUrlState\` adapter. On web, use \`useListUrlState\` (design-system) or a Next adapter.
|
|
773
|
+
|
|
774
|
+
### KYC molecules (bundle)
|
|
775
|
+
|
|
776
|
+
- \`ComplianceBadge\` in \`@contractspec/bundle.strit/presentation/components/kyc\` renders a status badge for KYC/compliance snapshots. It accepts a \`state\` (missing_core | incomplete | complete | expiring | unknown) and optional localized \`labels\`. Prefer consuming apps to pass translated labels (e.g., via \`useT('appPlatformAdmin')\`).
|
|
777
|
+
|
|
778
|
+
### Markdown routes and llms.txt
|
|
779
|
+
|
|
780
|
+
- Each web app exposes \`/llms\` (and \`/llms.txt\`, \`/llms.md\`) via rewrites. See [llmstxt.org](https://llmstxt.org/).
|
|
781
|
+
- Catch‑all markdown handler lives at \`app/[...slug].md/route.ts\`. It resolves a page descriptor from \`app/.presentations.manifest.json\` and renders via the \`presentations.v2\` engine (target: \`markdown\`).
|
|
782
|
+
- Per‑page companion convention: add \`app/<route>/ai.ts\` exporting a \`PresentationSpec\`.
|
|
783
|
+
- Build‑time tool: \`tools/generate-presentations-manifest.mjs <app-root>\` populates the manifest.
|
|
784
|
+
- CI check: \`bunllms:check\` verifies coverage (% of pages with descriptors) and fails if below threshold.
|
|
785
|
+
`}];D(pW);var rW=[{id:"docs.tech.auth.better-auth-nextjs",title:"Better Auth + Next.js integration (ContractSpec)",summary:"How ContractSpec wires Better Auth into Next.js (server config, client singleton, and proxy cookie-only redirects).",kind:"reference",visibility:"public",route:"/docs/tech/auth/better-auth-nextjs",tags:["auth","better-auth","nextjs","cookies","proxy","hmr"],body:`# Better Auth + Next.js integration (ContractSpec)
|
|
786
|
+
|
|
787
|
+
This repo uses Better Auth as the primary auth layer (sessions, organizations, teams, API keys, and OAuth).
|
|
788
|
+
|
|
789
|
+
## Server config (Better Auth)
|
|
790
|
+
|
|
791
|
+
- Source: \`packages/bundles/contractspec-studio/src/application/services/auth.ts\`
|
|
792
|
+
- Important: \`nextCookies()\` must be the **last** plugin in the Better Auth plugin list so \`Set-Cookie\` is applied correctly in Next.js environments.
|
|
793
|
+
|
|
794
|
+
## Better Auth Admin plugin
|
|
795
|
+
|
|
796
|
+
ContractSpec Studio enables the Better Auth **Admin plugin** to support platform-admin user operations (list users, impersonation, etc.).
|
|
797
|
+
|
|
798
|
+
- Server: \`admin()\` plugin in \`packages/bundles/contractspec-studio/src/application/services/auth.ts\`
|
|
799
|
+
- Client: \`adminClient()\` in \`packages/bundles/contractspec-studio/src/presentation/providers/auth/client.ts\`
|
|
800
|
+
|
|
801
|
+
### PLATFORM_ADMIN ⇒ Better Auth admin role
|
|
802
|
+
|
|
803
|
+
Better Auth Admin endpoints authorize via \`user.role\`. ContractSpec enforces an org-driven rule:
|
|
804
|
+
|
|
805
|
+
- If the **active organization** has \`type = PLATFORM_ADMIN\`, the signed-in user is ensured to have \`User.role\` containing \`admin\`.
|
|
806
|
+
- This is applied in the session creation hook and re-checked in \`assertsPlatformAdmin()\`.
|
|
807
|
+
|
|
808
|
+
This keeps admin enablement deterministic and avoids manual role backfills.
|
|
809
|
+
|
|
810
|
+
## Client config (React web + Expo)
|
|
811
|
+
|
|
812
|
+
To avoid duplicate background refresh/polling loops in dev (Fast Refresh/HMR), the Better Auth client is implemented as a singleton cached on \`globalThis\`.
|
|
813
|
+
|
|
814
|
+
- Web client: \`packages/bundles/contractspec-studio/src/presentation/providers/auth/client.ts\`
|
|
815
|
+
- Native client: \`packages/bundles/contractspec-studio/src/presentation/providers/auth/client.native.ts\`
|
|
816
|
+
|
|
817
|
+
Import guidance:
|
|
818
|
+
|
|
819
|
+
- If you only need the context/hook, prefer importing from \`@contractspec/bundle.studio/presentation/providers/auth\`.
|
|
820
|
+
- If you explicitly need the Better Auth client instance (e.g. admin impersonation, direct API calls), import from \`@contractspec/bundle.studio/presentation/providers/auth/client\`.
|
|
821
|
+
|
|
822
|
+
## Public routes (login / signup)
|
|
823
|
+
|
|
824
|
+
Public auth pages should avoid eager \`authClient\` initialization.
|
|
825
|
+
|
|
826
|
+
Pattern used:
|
|
827
|
+
|
|
828
|
+
- In the submit handler, dynamically import \`@contractspec/bundle.studio/presentation/providers/auth/index.web\` and call \`authClient.signIn.*\` / \`authClient.signUp.*\`.
|
|
829
|
+
|
|
830
|
+
This prevents session refresh behavior from starting just because a public page rendered.
|
|
831
|
+
|
|
832
|
+
## Next.js proxy auth (web-landing)
|
|
833
|
+
|
|
834
|
+
The Next.js proxy/middleware is used for **redirect decisions only**. It must not perform DB-backed session reads on every request.
|
|
835
|
+
|
|
836
|
+
- Source: \`packages/apps/web-landing/src/proxy.ts\`
|
|
837
|
+
- Approach: cookie-only checks via Better Auth cookies helpers:
|
|
838
|
+
- \`getSessionCookie(request)\`
|
|
839
|
+
- \`getCookieCache(request)\`
|
|
840
|
+
|
|
841
|
+
These checks are intentionally optimistic and should only gate routing. Full authorization must still be enforced on server-side actions/routes and GraphQL resolvers.
|
|
842
|
+
`}];D(rW);var dW=[{id:"docs.tech.schema.README",title:"Multi‑File Prisma Schema Conventions (per database)",summary:"We adopt Prisma multi‑file schema (GA ≥ v6.7) to organize each database’s models by domain and to import core LSSM module schemas locally.",kind:"reference",visibility:"public",route:"/docs/tech/schema/README",tags:["tech","schema","README"],body:'# Multi‑File Prisma Schema Conventions (per database)\n\nWe adopt Prisma multi‑file schema (GA ≥ v6.7) to organize each database’s models by domain and to import core LSSM module schemas locally.\n\nCanonical layout per DB:\n\n```\nprisma/\n schema/\n main.prisma # datasource + generators only\n imported/\n lssm_sigil/*.prisma # imported models/enums only (no datasource/generator)\n lssm_content/*.prisma # idem\n <domain>/*.prisma # vertical‑specific models split by bounded context\n```\n\nNotes:\n\n- Imported files contain only `model` and `enum` blocks (strip `datasource`/`generator`).\n- Preserve `@@schema("…")` annotations to keep tables in their Postgres schemas; we now explicitly list schemas in `main.prisma` to avoid P1012: `schemas = ["public","lssm_sigil","lssm_content","lssm_featureflags","lssm_ops","lssm_planning","lssm_quill","lssm_geoterro"]`.\n- Use `@contractspec/app.cli-database` CLI: `database import|check|generate|migrate:*|seed` to manage a single DB; `@contractspec/app.cli-databases` orchestrates multiple DBs.\n\n## Typed merger config\n\n- Define imported module list once per DB with a typed config:\n\n```ts\n// prisma-merger.config.ts\nimport { defineMergedPrismaConfig } from \'@contractspec/app.cli-database\';\n\nexport default defineMergedPrismaConfig({\n modules: [\n \'@contractspec/app.cli-database-sigil\',\n \'@contractspec/app.cli-database-content\',\n // ...\n ],\n});\n```\n\n- Then run `database import --target .` (no need to pass `--modules`).\n\n## Prisma Config (prisma.config.ts)\n\nWe use Prisma Config per official docs to point Prisma to the multi-file schema folder and migrations:\n\n```ts\n// prisma.config.ts\nimport path from \'node:path\';\nimport { defineConfig } from \'prisma/config\';\n\nexport default defineConfig({\n schema: path.join(\'prisma\', \'schema\'),\n migrations: { path: path.join(\'prisma\', \'migrations\') },\n});\n```\n\nReference: Prisma blog – Organize Your Prisma Schema into Multiple Files: https://www.prisma.io/blog/organize-your-prisma-schema-with-multi-file-support\n\n---\n\n# LSSM Auth (Sigil) – Models & Integration\n\nThis document tracks the identity models and integration points used by the LSSM Sigil module.\n\n## Models (Prisma `lssm_sigil`)\n\n- `User` – core identity with email, optional phone, role, passkeys, apiKeys\n- `Session` – session tokens and metadata; includes `activeOrganizationId`\n- `Account` – external providers (password, OAuth)\n- `Organization` – tenant boundary; includes `type` additional field\n- `Member`, `Invitation`, `Team`, `TeamMember` – org/teams\n- `Role`, `Permission`, `PolicyBinding` – RBAC\n- `ApiKey`, `Passkey` – programmable access and WebAuthn\n- `SsoProvider` – OIDC/SAML provider configuration (org- or user-scoped)\n- `OAuthApplication`, `OAuthAccessToken`, `OAuthConsent` – first/third-party OAuth\n\nThese mirror STRIT additions so Better Auth advanced plugins (admin, organization, apiKey, passkey, genericOAuth) work uniformly across apps.\n\n## Better Auth (server)\n\nEnabled methods:\n\n- Email & password\n- Phone OTP (Telnyx)\n- Passkey (WebAuthn)\n- API keys\n- Organizations & Teams\n- Generic OAuth (FranceConnect+ via OIDC with JWE/JWS using JOSE)\n\nServer config lives at `packages/lssm/modules/sigil/src/application/services/auth.ts`.\n\n## Clients (Expo / React)\n\nClient config lives at `packages/lssm/modules/sigil/src/presentation/providers/auth/expo.ts` with plugins for admin, passkey, apiKey, organization, phone, genericOAuth.\n\n## Environment Variables\n\nTelnyx (phone OTP):\n\n- `TELNYX_API_KEY`\n- `TELNYX_MESSAGING_PROFILE_ID`\n- `TELNYX_FROM_NUMBER`\n\nFranceConnect+ (prefer LSSM*… but STRIT*… fallbacks are supported):\n\n- `LSSM_FRANCECONNECTPLUS_DISCOVERY_URL`\n- `LSSM_FRANCECONNECTPLUS_CLIENT_ID`\n- `LSSM_FRANCECONNECTPLUS_CLIENT_SECRET`\n- `LSSM_FRANCECONNECTPLUS_ENC_PRIVATE_KEY_PEM` (PKCS8; RSA-OAEP-256)\n\nGeneric:\n\n- `API_URL_IDENTITIES` – base URL for Better Auth server\n- `BETTER_AUTH_SECRET` – server secret\n\nKeep this in sync with code changes to avoid drift.\n\n## HCircle domain splits and auth removal\n\n- Auth/identity models are not defined locally anymore. They come from `@contractspec/app.cli-database-sigil` under the `lssm_sigil` schema.\n- `packages/hcircle/libs/database-coliving/prisma/schema/domain/` is split by domain; newsletter/waiting list lives in `newsletter.prisma` and uses `@@map("waiting_list")`.\n- To avoid collisions with module names, the local event models were renamed to `SocialEvent`, `SocialEventAttendee`, and `SocialEventRecurrence` with `@@map` pointing to existing table names.\n\n---\n\n## Vertical profiles (current)\n\n### STRIT\n\n- prisma-merger modules:\n - `@contractspec/app.cli-database-sigil`, `@contractspec/app.cli-database-content`, `@contractspec/app.cli-database-ops`, `@contractspec/app.cli-database-planning`, `@contractspec/app.cli-database-quill`, `@contractspec/app.cli-database-geoterro`\n- main.prisma schemas:\n - `schemas = ["public","lssm_sigil","lssm_content","lssm_ops","lssm_planning","lssm_quill","lssm_geoterro"]`\n- domain splits (`packages/strit/libs/database/prisma/schema/domain/`):\n - `bookings.prisma` (Booking, StritDocument + links to Content `File` and Sigil `Organization`)\n - `commerce.prisma` (Wholesale models; `sellerId` linked to Sigil `Organization`)\n - `files.prisma` (PublicFile, PublicFileAccessLog; `ownerId`→Organization, `uploadedBy`→User)\n - `geo.prisma` (PublicCountry, PublicAddress, City; links to Spots/Series)\n - `spots.prisma`, `urbanism.prisma`, `analytics.prisma`, `onboarding.prisma`, `referrals.prisma`, `subscriptions.prisma`, `content.prisma`\n- auth models are imported from Sigil (no local auth tables).\n- Back-relations for `Organization` (e.g., `files`, seller relations) are declared in the Sigil module to avoid scattering.\n\n### ARTISANOS\n\n- prisma-merger modules:\n - `@contractspec/app.cli-database-sigil`, `@contractspec/app.cli-database-content`, `@contractspec/app.cli-database-featureflags`, `@contractspec/app.cli-database-ops`, `@contractspec/app.cli-database-planning`, `@contractspec/app.cli-database-quill`, `@contractspec/app.cli-database-geoterro`\n- main.prisma schemas:\n - `schemas = ["public","lssm_sigil","lssm_content","lssm_featureflags","lssm_ops","lssm_planning","lssm_quill","lssm_geoterro"]`\n- domain splits (`packages/artisanos/libs/database-artisan/prisma/schema/domain/`):\n - `sales.prisma` (Client, Quote, QuoteTemplate, Invoice, FollowUps)\n - `subsidies.prisma` (SubsidyProgram, AidApplication, SupportingDocument)\n - `projects.prisma` (Project, ProjectPlanningSettings)\n - `crm.prisma` (OrganizationProfessionalProfile, OrganizationCertification)\n - `professions.prisma`, `products.prisma`, `templates.prisma`, `analytics.prisma`, `onboarding.prisma`, `referrals.prisma`, `subscriptions.prisma`, `files.prisma`\n- auth/organization/team models are provided by Sigil; local legacy copies were removed.\n- Where names collide with Content, local models are prefixed (e.g., `PublicFile`) and use `@@map` to keep existing table names where applicable.\n\n## Schema Dictionary: `@contractspec/lib.schema`\n\n### Purpose\n\nDescribe operation I/O once and generate:\n\n- zod (runtime validation)\n- GraphQL (Pothos types/refs)\n- JSON Schema (via `zod-to-json-schema` or native descriptors)\n\n### Primitives\n\n- **FieldType<T>**: describes a scalar or composite field and carries:\n - `zod` schema for validation\n - optional JSON Schema descriptor\n - optional GraphQL scalar reference/name\n- **SchemaModel**: named object model composed of fields. Exposes helpers:\n - `getZod(): z.ZodObject<ZodShapeFromFields<Fields>> | z.ZodArray<z.ZodObject<...>>`\n - Preserves each field\'s schema, optionality, and array-ness\n - Top-level lists are supported via `config.isArray: true`\n - `getJsonSchema(): JSONSchema7` (export for docs, MCP, forms)\n - `getPothosInput()` (GraphQL input object name)\n\n### Multi-Format Wrappers\n\nUse existing schema definitions from other libraries:\n- `ZodSchemaType`: Wraps a raw Zod schema (`z.infer` becomes the TS type).\n- `JsonSchemaType`: Wraps a JSON Schema object.\n- `GraphQLSchemaType`: Wraps a GraphQL SDL string.\n\n### Conventions\n\n- Name models with PascalCase; suffix with `Input`/`Result` when ambiguous.\n- Use explicit enums for multi-value constants; reuse the same enum across input/output.\n- Define domain enums via `defineEnum(\'Name\', [...])` in the relevant domain package (e.g., `packages/strit/libs/contracts-strit/src/enums/`), not in `ScalarTypeEnum`.\n- Reference those enums in `SchemaModel` fields directly (they expose `getZod`, `getPothos`, `getJsonSchema`).\n\n#### Example (STRIT)\n\n```ts\n// packages/strit/libs/contracts-strit/src/enums/recurrence.ts\nimport { defineEnum } from \'@contractspec/lib.schema\';\nexport const SpotEnum = {\n Weekday: () =>\n defineEnum(\'Weekday\', [\'MO\', \'TU\', \'WE\', \'TH\', \'FR\', \'SA\', \'SU\'] as const),\n RecurrenceFrequency: () =>\n defineEnum(\'RecurrenceFrequency\', [\n \'DAILY\',\n \'WEEKLY\',\n \'MONTHLY\',\n \'YEARLY\',\n ] as const),\n} as const;\n```\n\n```ts\n// usage in contracts\nfrequency: { type: SpotEnum.RecurrenceFrequency(), isOptional: false },\nbyWeekday: { type: SpotEnum.Weekday(), isOptional: true, isArray: true },\n```\n\n- Use `Date` type for temporal values and ensure ISO strings in JSON transports where needed.\n\n### Mapping rules (summary)\n\n- Strings → GraphQL `String`\n- Numbers → `Int` if safe 32-bit integer else `Float`\n- Booleans → `Boolean`\n- Dates → custom `Date` scalar\n- Arrays<T> → list of mapped T (set `isArray: true` on the field)\n- Top-level arrays → set `isArray: true` on the model config\n- Objects → input/output object types with stable field order\n- Unions → supported for output; input unions map to JSON (structural input is not supported by GraphQL)\n\n### JSON Schema export\n\nPrefer `getZod()` + `zod-to-json-schema` for consistency. For advanced cases, provide a custom `getJsonSchema()` on the model.\n\n### Example\n\n```ts\nimport { ScalarTypeEnum, SchemaModel } from \'@contractspec/lib.schema\';\n\n// Nested model\nconst Weekday = new SchemaModel({\n name: \'Weekday\',\n fields: {\n value: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n});\n\n// Parent model with array field and nested object\nconst Rule = new SchemaModel({\n name: \'Rule\',\n fields: {\n timezone: { type: ScalarTypeEnum.TimeZone(), isOptional: false },\n byWeekday: { type: Weekday, isOptional: true, isArray: true },\n },\n});\n\nconst CreateThingInput = new SchemaModel({\n name: \'CreateThingInput\',\n fields: {\n name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },\n rule: { type: Rule, isOptional: false },\n },\n});\n\n// zod\nconst z = CreateThingInput.getZod();\n```\n'}];D(dW);var nW=[{id:"docs.tech.templates.runtime",title:"ContractSpec Template Runtime (Phase 9)",summary:"Phase 9 introduces a full local-first runtime for templates so anyone can preview apps directly in the browser without provisioning any infrastructure.",kind:"reference",visibility:"public",route:"/docs/tech/templates/runtime",tags:["tech","templates","runtime"],body:"## ContractSpec Template Runtime (Phase 9)\n\nPhase 9 introduces a full local-first runtime for templates so anyone can preview apps directly in the browser without provisioning any infrastructure.\n\n### Building Blocks\n\n- **Local database** – `@contractspec/lib.runtime-local` wraps `sql.js` (SQLite WASM) and `IndexedDB` so we can seed demo data, run migrations, and persist state between sessions. Tests point the runtime to `node_modules/sql.js/dist` so CI doesn’t need a browser.\n- **Local GraphQL** – `LocalGraphQLClient` wires Apollo Client + SchemaLink to resolvers for tasks, messaging, and i18n recipes. All `/templates`, `/studio`, and `/sandbox` previews use those resolvers so we never call remote APIs during demos.\n- **Template registry + installer** – `.../templates/registry.ts` stores the catalog (todos, messaging, recipes). `TemplateInstaller` can seed the runtime (`install`) or export a base64 snapshot via the new `saveTemplateToStudio` mutation.\n- **TemplateShell** – Shared UI wrapper that creates a `TemplateRuntimeProvider`, shows `LocalDataIndicator`, and (optionally) surfaces the new `SaveToStudioButton`.\n\n### Runtime Flows\n\n1. `/templates` now opens a modal that renders `TemplateShell` for each template. Users can explore without leaving the marketing site.\n2. `/studio` switches to a tabbed mini-app (Projects, Canvas, Specs, Deploy) to showcase Studio surfaces with mock data. Visitors see a **preview** shell, while authenticated users (Better Auth via Sigil) unlock full persistence, versioning, and deployment controls.\n3. `/sandbox` lets visitors pick a template and mode (Playground, Spec Editor, Visual Builder). The console at the bottom streams runtime events for transparency.\n\n### GraphQL Mutations\n\n- `saveTemplateToStudio(input: SaveTemplateInput!): SaveTemplateResult!` writes a placeholder project + spec so that templates installed from the sandbox appear in Studio. The mutation is intentionally simple right now: it records which template was imported, stores metadata, and returns `{ projectId, status: 'QUEUED' }` for the UI.\n- `saveCanvasDraft(input: SaveCanvasDraftInput!): CanvasVersion!` snapshots the current Visual Builder nodes to a draft version tied to a canvas overlay. Inputs include `canvasId`, arbitrary `nodes` JSON, and an optional `label`. The resolver enforces org/org access before calling `CanvasVersionManager`.\n- `deployCanvasVersion(input: DeployCanvasVersionInput!): CanvasVersion!` promotes a previously saved draft (`versionId`) to the deployed state. The returned object includes `status`, `nodes`, `createdAt`, and `createdBy` for UI timelines.\n- `undoCanvasVersion(input: UndoCanvasInput!): CanvasVersion` rewinds the visual builder to the prior snapshot (returns `null` when history is empty) so Studio’s toolbar can surface “Undo” without shelling out to local storage.\n\n### Studio GraphQL endpoint\n\n- The landing app exposes the Studio schema at `/api/studio/graphql` via Yoga so React Query hooks (`useStudioProjects`, `useCreateStudioProject`, `useDeployStudioProject`, etc.) can talk to the bundle without spinning up a separate server.\n\n### Spec Editor typing\n\n- Studio’s spec editor now preloads Monaco with ambient declarations for `@contractspec/lib.contracts` and `zod`, so snippets receive autocomplete and inline errors even before the spec ships to the backend. The helper lives in `presentation/components/studio/organisms/monaco-spec-types.ts` and registers the extra libs once per browser session via `monaco.languages.typescript.typescriptDefaults.addExtraLib`.\n- Compiler options are aligned with our frontend toolchain (ES2020 + React JSX) which means drafts written in the editor behave like the compiled artifacts that flow through Studio pipelines.\n\n### Spec templates\n\n- Selecting a spec type now injects a ready-to-edit scaffold (capability, workflow, policy, dataview, component) so authors start from a canonical layout instead of a blank file. Templates live alongside `SpecEditor.tsx`, and we only overwrite the content when the previous value is empty or when the author explicitly switches types via the dropdown.\n\n### Spec preview\n\n- The validation side panel now embeds a `SpecPreview` widget that shows validation errors alongside transport artifacts (GraphQL schema, REST endpoints, component summaries) once a preview run completes. Tabs let authors toggle between “Validation” and “Artifacts,” mirroring the UX described in the Studio plan.\n\n### Testing\n\n- `src/templates/__tests__/runtime.test.ts` covers todos CRUD, messaging delivery, and recipe locale switching through the local GraphQL API.\n- Studio infrastructure tests live in `src/__tests__/e2e/project-lifecycle.test.ts` and continue to exercise project creation + deploy flows.\n\n### Next Steps\n\nFuture templates can register their React components via `registerTemplateComponents(templateId, components)` so TemplateShell can render them automatically. When new templates are added, remember to:\n\n1. Update the registry entry (schema + tags).\n2. Register components inside `presentation/components/templates`.\n3. Document the template under `docs/templates/`.\n\n\n\n\n\n"}];D(nW);var iW=[{id:"docs.tech.workflows.overview",title:"WorkflowSpec Overview",summary:"WorkflowSpec provides a declarative, versioned format for long-running flows that mix automation and human review. Specs stay inside `@contractspec/lib.contracts` (`src/workflow/spec.ts`) so the same definition powers runtime execution, documentation, and future generation.",kind:"reference",visibility:"public",route:"/docs/tech/workflows/overview",tags:["tech","workflows","overview"],body:"# WorkflowSpec Overview\n\n## Purpose\n\nWorkflowSpec provides a declarative, versioned format for long-running flows that mix automation and human review. Specs stay inside `@contractspec/lib.contracts` (`src/workflow/spec.ts`) so the same definition powers runtime execution, documentation, and future generation.\n\n## Core Types\n\n- `WorkflowMeta`: ownership metadata (`title`, `domain`, `owners`, `tags`, `stability`) plus `name` and `version`.\n- `WorkflowDefinition`:\n - `entryStepId?`: optional explicit entry point (defaults to first step).\n - `steps[]`: ordered list of `Step` descriptors.\n - `transitions[]`: directed edges between steps with optional expressions.\n - `sla?`: aggregated timing hints for the overall flow or per-step budgets.\n - `compensation?`: fallback operations executed when a workflow is rolled back or fails.\n- `Step`:\n - `type`: `human`, `automation`, or `decision`.\n - `action`: references either a `ContractSpec` (`operation`) or `FormSpec` (`form`).\n - Optional `guard`, `timeoutMs`, and retry policy (`maxAttempts`, `backoff`, `delayMs`, `maxDelayMs?`).\n - `requiredIntegrations?`: integration slot ids that must be bound before the step may execute.\n - `requiredCapabilities?`: `CapabilityRef[]` that must be enabled in the resolved app config.\n- `Transition`: `from` → `to` with optional `condition` string (simple data expressions).\n\n## Registry & Validation\n\n- `WorkflowRegistry` (`src/workflow/spec.ts`) stores specs by key `<name>.v<version>` and exposes `register`, `list`, and `get`.\n- `validateWorkflowSpec()` (`src/workflow/validation.ts`) checks:\n - Duplicate step IDs.\n - Unknown `from`/`to` transitions.\n - Empty guards/conditions.\n - Reachability from the entry step.\n - Cycles in the graph.\n - Operation/Form references against provided registries.\n- `assertWorkflowSpecValid()` wraps validation and throws `WorkflowValidationError` when errors remain.\n\n## Runtime\n\n- `WorkflowRunner` (`src/workflow/runner.ts`) executes workflows and coordinates steps.\n - `start(name, version?, initialData?)` returns a `workflowId`.\n - `executeStep(workflowId, input?)` runs the current step (automation or human).\n - `getState(workflowId)` retrieves the latest state snapshot.\n - `cancel(workflowId)` marks the workflow as cancelled.\n - `preFlightCheck(name, version?, resolvedConfig?)` evaluates integration/capability requirements before the workflow starts.\n - Throws `WorkflowPreFlightError` if required integration slots are unbound or required capabilities are disabled.\n- `StateStore` (`src/workflow/state.ts`) abstracts persistence. V1 ships with:\n - `InMemoryStateStore` (`src/workflow/adapters/memory-store.ts`) for tests/dev.\n - Placeholder factories for file/database adapters (`adapters/file-adapter.ts`, `adapters/db-adapter.ts`).\n- Guard evaluation: expression guards run through `evaluateExpression()` (`src/workflow/expression.ts`); custom policy guards can be provided via `guardEvaluator`.\n- Events: the runner emits `workflow.started`, `workflow.step_completed`, `workflow.step_failed`, and `workflow.cancelled` through the optional `eventEmitter`.\n- React bindings (`@contractspec/lib.presentation-runtime-react`):\n - `useWorkflow` hook (polls state, exposes `executeStep`, `cancel`, `refresh`).\n - `WorkflowStepper` progress indicator using design-system Stepper.\n - `WorkflowStepRenderer` helper to render human/automation/decision steps with sensible fallbacks.\n\n## Authoring Checklist\n\n1. Reuse existing operations/forms; create new specs when missing.\n2. Prefer explicit `entryStepId` for clarity (especially with decision branches).\n3. Give automation steps an `operation` and human steps a `form` (warnings surface otherwise).\n4. Use short, meaningful step IDs (`submit`, `review`, `finalize`) to simplify analytics.\n5. Keep guard expressions deterministic; complex policy logic should move to PolicySpec (Phase 2).\n\n## Testing\n\n- Add unit tests for new workflows via `assertWorkflowSpecValid`.\n- Use the new Vitest suites (`validation.test.ts`, `expression.test.ts`, `runner.test.ts`) as examples.\n- CLI support will arrive in Phase 1 PR 3 (`contractspec create --type workflow`).\n\n## Tooling\n\n- `contractspec create --type workflow` scaffolds a WorkflowSpec with interactive prompts.\n- `contractspec build <spec.workflow.ts>` generates a runner scaffold (`.runner.ts`) wired to `WorkflowRunner` and the in-memory store.\n- `contractspec validate` understands `.workflow.ts` files and checks core structure (meta, steps, transitions).\n\n## Next Steps (Non-MVP)\n\n- Persistence adapters (database/file) for workflow state (Phase 2).\n- React bindings (`useWorkflow`, `WorkflowStepper`) and presentation-runtime integration (PR 3).\n- Policy engine integration (`guard.type === 'policy'` validated against PolicySpec).\n- Telemetry hooks for step execution metrics.\n\n"}];D(iW);var tW=[{id:"docs.tech.mcp.endpoints",title:"ContractSpec MCP endpoints",summary:"Dedicated MCP servers for docs, CLI usage, and internal development.",kind:"reference",visibility:"mixed",route:"/docs/tech/mcp/endpoints",tags:["mcp","docs","cli","internal"],body:"# ContractSpec MCP endpoints\n\nThree dedicated MCP servers keep AI agents efficient and scoped:\n\n- **Docs MCP**: `/api/mcp/docs` — exposes DocBlocks as resources + presentations. Tool: `docs.search`.\n- **CLI MCP**: `/api/mcp/cli` — surfaces CLI quickstart/reference/README and suggests commands. Tool: `cli.suggestCommand`.\n- **Internal MCP**: `/api/mcp/internal` — internal routing hints, playbook, and example registry access. Tool: `internal.describe`.\n\n### Usage notes\n- Transports are HTTP POST (streamable HTTP); SSE is disabled.\n- Resources are namespaced (`docs://*`, `cli://*`, `internal://*`) and are read-only.\n- Internal MCP also exposes the examples registry via `examples://*` resources:\n - `examples://list?q=<query>`\n - `examples://example/<id>`\n- Prompts mirror each surface (navigator, usage, bootstrap) for quick agent onboarding.\n- GraphQL remains at `/graphql`; health at `/health`.\n"}];D(tW);var aW=[{id:"docs.tech.vscode.extension",title:"ContractSpec VS Code Extension",summary:"VS Code extension for spec-first development with validation, scaffolding, and MCP integration.",kind:"reference",visibility:"public",route:"/docs/tech/vscode/extension",tags:["vscode","extension","tooling","dx"],body:`# ContractSpec VS Code Extension
|
|
843
|
+
|
|
844
|
+
The ContractSpec VS Code extension provides spec-first development tooling directly in your editor.
|
|
845
|
+
|
|
846
|
+
## Features
|
|
847
|
+
|
|
848
|
+
- **Real-time Validation**: Get instant feedback on spec errors and warnings as you save files
|
|
849
|
+
- **Build/Scaffold**: Generate handler and component skeletons from specs (no AI required)
|
|
850
|
+
- **Spec Explorer**: List and navigate all specs in your workspace
|
|
851
|
+
- **Dependency Analysis**: Visualize spec dependencies and detect cycles
|
|
852
|
+
- **MCP Integration**: Search ContractSpec documentation via Model Context Protocol
|
|
853
|
+
- **Snippets**: Code snippets for common ContractSpec patterns
|
|
854
|
+
|
|
855
|
+
## Commands
|
|
856
|
+
|
|
857
|
+
| Command | Description |
|
|
858
|
+
|---------|-------------|
|
|
859
|
+
| \`ContractSpec: Validate Current Spec\` | Validate the currently open spec file |
|
|
860
|
+
| \`ContractSpec: Validate All Specs\` | Validate all spec files in the workspace |
|
|
861
|
+
| \`ContractSpec: Build/Scaffold\` | Generate handler/component from the current spec |
|
|
862
|
+
| \`ContractSpec: List All Specs\` | Show all specs in the workspace |
|
|
863
|
+
| \`ContractSpec: Analyze Dependencies\` | Analyze and visualize spec dependencies |
|
|
864
|
+
| \`ContractSpec: Search Docs (MCP)\` | Search documentation via MCP |
|
|
865
|
+
|
|
866
|
+
## Configuration
|
|
867
|
+
|
|
868
|
+
| Setting | Description | Default |
|
|
869
|
+
|---------|-------------|---------|
|
|
870
|
+
| \`contractspec.api.baseUrl\` | Base URL for ContractSpec API (enables MCP + remote telemetry) | \`""\` |
|
|
871
|
+
| \`contractspec.telemetry.posthogHost\` | PostHog host URL for direct telemetry | \`"https://eu.posthog.com"\` |
|
|
872
|
+
| \`contractspec.telemetry.posthogProjectKey\` | PostHog project key for direct telemetry | \`""\` |
|
|
873
|
+
| \`contractspec.validation.onSave\` | Run validation on save | \`true\` |
|
|
874
|
+
| \`contractspec.validation.onOpen\` | Run validation on open | \`true\` |
|
|
875
|
+
|
|
876
|
+
## Architecture
|
|
877
|
+
|
|
878
|
+
The extension uses:
|
|
879
|
+
- \`@contractspec/module.workspace\` for pure analysis + templates
|
|
880
|
+
- \`@contractspec/bundle.workspace\` for workspace services + adapters
|
|
881
|
+
|
|
882
|
+
This allows the extension to work without requiring the CLI to be installed.
|
|
883
|
+
|
|
884
|
+
## Telemetry
|
|
885
|
+
|
|
886
|
+
The extension uses a hybrid telemetry approach:
|
|
887
|
+
1. If \`contractspec.api.baseUrl\` is configured → send to API \`/api/telemetry/ingest\`
|
|
888
|
+
2. Otherwise → send directly to PostHog (if project key configured)
|
|
889
|
+
|
|
890
|
+
Telemetry respects VS Code's telemetry settings. No file paths, source code, or PII is collected.
|
|
891
|
+
`},{id:"docs.tech.vscode.snippets",title:"ContractSpec Snippets",summary:"Code snippets for common ContractSpec patterns in VS Code.",kind:"reference",visibility:"public",route:"/docs/tech/vscode/snippets",tags:["vscode","snippets","dx"],body:`# ContractSpec Snippets
|
|
892
|
+
|
|
893
|
+
The VS Code extension includes snippets for common ContractSpec patterns.
|
|
894
|
+
|
|
895
|
+
## Available Snippets
|
|
896
|
+
|
|
897
|
+
| Prefix | Description |
|
|
898
|
+
|--------|-------------|
|
|
899
|
+
| \`contractspec-command\` | Create a new command (write operation) |
|
|
900
|
+
| \`contractspec-query\` | Create a new query (read-only operation) |
|
|
901
|
+
| \`contractspec-event\` | Create a new event |
|
|
902
|
+
| \`contractspec-docblock\` | Create a new DocBlock |
|
|
903
|
+
| \`contractspec-telemetry\` | Create a new TelemetrySpec |
|
|
904
|
+
| \`contractspec-presentation\` | Create a new Presentation |
|
|
905
|
+
|
|
906
|
+
## Usage
|
|
907
|
+
|
|
908
|
+
Type the prefix in a TypeScript file and press Tab to expand the snippet. Tab through the placeholders to fill in your values.
|
|
909
|
+
`}];D(aW);var sW=[{id:"docs.tech.telemetry.ingest",title:"Telemetry Ingest Endpoint",summary:"Server-side telemetry ingestion for ContractSpec clients (VS Code extension, CLI, etc.).",kind:"reference",visibility:"internal",route:"/docs/tech/telemetry/ingest",tags:["telemetry","api","posthog","analytics"],body:`# Telemetry Ingest Endpoint
|
|
910
|
+
|
|
911
|
+
The ContractSpec API provides a telemetry ingest endpoint for clients to send product analytics events.
|
|
912
|
+
|
|
913
|
+
## Endpoint
|
|
914
|
+
|
|
915
|
+
\`\`\`
|
|
916
|
+
POST /api/telemetry/ingest
|
|
917
|
+
\`\`\`
|
|
918
|
+
|
|
919
|
+
## Request
|
|
920
|
+
|
|
921
|
+
\`\`\`json
|
|
922
|
+
{
|
|
923
|
+
"event": "contractspec.vscode.command_run",
|
|
924
|
+
"distinct_id": "client-uuid",
|
|
925
|
+
"properties": {
|
|
926
|
+
"command": "validate"
|
|
927
|
+
},
|
|
928
|
+
"timestamp": "2024-01-15T10:30:00.000Z"
|
|
929
|
+
}
|
|
930
|
+
\`\`\`
|
|
931
|
+
|
|
932
|
+
### Headers
|
|
933
|
+
|
|
934
|
+
| Header | Description |
|
|
935
|
+
|--------|-------------|
|
|
936
|
+
| \`x-contractspec-client-id\` | Optional client identifier (used as fallback for distinct_id) |
|
|
937
|
+
| \`Content-Type\` | Must be \`application/json\` |
|
|
938
|
+
|
|
939
|
+
### Body
|
|
940
|
+
|
|
941
|
+
| Field | Type | Required | Description |
|
|
942
|
+
|-------|------|----------|-------------|
|
|
943
|
+
| \`event\` | string | Yes | Event name (e.g., \`contractspec.vscode.activated\`) |
|
|
944
|
+
| \`distinct_id\` | string | Yes | Anonymous client identifier |
|
|
945
|
+
| \`properties\` | object | No | Event properties |
|
|
946
|
+
| \`timestamp\` | string | No | ISO 8601 timestamp |
|
|
947
|
+
|
|
948
|
+
## Response
|
|
949
|
+
|
|
950
|
+
\`\`\`json
|
|
951
|
+
{
|
|
952
|
+
"success": true
|
|
953
|
+
}
|
|
954
|
+
\`\`\`
|
|
955
|
+
|
|
956
|
+
## Configuration
|
|
957
|
+
|
|
958
|
+
The endpoint requires \`POSTHOG_PROJECT_KEY\` environment variable to be set. If not configured, events are accepted but not forwarded.
|
|
959
|
+
|
|
960
|
+
| Environment Variable | Description | Default |
|
|
961
|
+
|---------------------|-------------|---------|
|
|
962
|
+
| \`POSTHOG_HOST\` | PostHog host URL | \`https://eu.posthog.com\` |
|
|
963
|
+
| \`POSTHOG_PROJECT_KEY\` | PostHog project API key | (required) |
|
|
964
|
+
|
|
965
|
+
## Privacy
|
|
966
|
+
|
|
967
|
+
- No PII is collected or stored
|
|
968
|
+
- \`distinct_id\` is an anonymous client-generated UUID
|
|
969
|
+
- File paths and source code are never included in events
|
|
970
|
+
- Respects VS Code telemetry settings on the client side
|
|
971
|
+
|
|
972
|
+
## Events
|
|
973
|
+
|
|
974
|
+
### Extension Events
|
|
975
|
+
|
|
976
|
+
| Event | Description | Properties |
|
|
977
|
+
|-------|-------------|------------|
|
|
978
|
+
| \`contractspec.vscode.activated\` | Extension activated | \`version\` |
|
|
979
|
+
| \`contractspec.vscode.command_run\` | Command executed | \`command\` |
|
|
980
|
+
| \`contractspec.vscode.mcp_call\` | MCP call made | \`endpoint\`, \`tool\` |
|
|
981
|
+
|
|
982
|
+
### API Events
|
|
983
|
+
|
|
984
|
+
| Event | Description | Properties |
|
|
985
|
+
|-------|-------------|------------|
|
|
986
|
+
| \`contractspec.api.mcp_request\` | MCP request processed | \`endpoint\`, \`method\`, \`success\`, \`duration_ms\` |
|
|
987
|
+
`},{id:"docs.tech.telemetry.hybrid",title:"Hybrid Telemetry Model",summary:"How ContractSpec clients choose between direct PostHog and API-routed telemetry.",kind:"usage",visibility:"internal",route:"/docs/tech/telemetry/hybrid",tags:["telemetry","architecture","posthog"],body:`# Hybrid Telemetry Model
|
|
988
|
+
|
|
989
|
+
ContractSpec uses a hybrid telemetry model where clients can send events either directly to PostHog or via the API server.
|
|
990
|
+
|
|
991
|
+
## Decision Flow
|
|
992
|
+
|
|
993
|
+
\`\`\`
|
|
994
|
+
Is contractspec.api.baseUrl configured?
|
|
995
|
+
├── Yes → Send via /api/telemetry/ingest
|
|
996
|
+
└── No → Is posthogProjectKey configured?
|
|
997
|
+
├── Yes → Send directly to PostHog
|
|
998
|
+
└── No → Telemetry disabled
|
|
999
|
+
\`\`\`
|
|
1000
|
+
|
|
1001
|
+
## Benefits
|
|
1002
|
+
|
|
1003
|
+
### Direct PostHog
|
|
1004
|
+
- No server dependency
|
|
1005
|
+
- Works offline (with batching)
|
|
1006
|
+
- Lower latency
|
|
1007
|
+
|
|
1008
|
+
### Via API
|
|
1009
|
+
- Centralized key management (no client-side keys)
|
|
1010
|
+
- Server-side enrichment and validation
|
|
1011
|
+
- Rate limiting and abuse prevention
|
|
1012
|
+
- Easier migration to other providers
|
|
1013
|
+
|
|
1014
|
+
## Recommendation
|
|
1015
|
+
|
|
1016
|
+
- **Development**: Use direct PostHog with a dev project key
|
|
1017
|
+
- **Production**: Route via API for better governance
|
|
1018
|
+
|
|
1019
|
+
## Future: OpenTelemetry
|
|
1020
|
+
|
|
1021
|
+
The current PostHog implementation is behind a simple interface that can be swapped for OpenTelemetry:
|
|
1022
|
+
|
|
1023
|
+
\`\`\`typescript
|
|
1024
|
+
interface TelemetryClient {
|
|
1025
|
+
send(event: TelemetryEvent): Promise<void>;
|
|
1026
|
+
}
|
|
1027
|
+
\`\`\`
|
|
1028
|
+
|
|
1029
|
+
This allows future migration without changing client code.
|
|
1030
|
+
`}];D(sW);var eW=[{id:"docs.tech.contracts.openapi-export",title:"OpenAPI export (OpenAPI 3.1) from OperationSpecRegistry",summary:"Generate a deterministic OpenAPI document from a OperationSpecRegistry using jsonSchemaForSpec + REST transport metadata.",kind:"reference",visibility:"public",route:"/docs/tech/contracts/openapi-export",tags:["contracts","openapi","rest"],body:`## OpenAPI export (OpenAPI 3.1) from OperationSpecRegistry
|
|
1031
|
+
|
|
1032
|
+
### Purpose
|
|
1033
|
+
|
|
1034
|
+
ContractSpec specs can be exported into an **OpenAPI 3.1** document for tooling (SDK generation, docs, gateways).
|
|
1035
|
+
|
|
1036
|
+
The export is **spec-first**:
|
|
1037
|
+
|
|
1038
|
+
- Uses \`jsonSchemaForSpec(spec)\` for input/output JSON Schema (from SchemaModel → zod → JSON Schema)
|
|
1039
|
+
- Uses \`spec.transport.rest.method/path\` when present
|
|
1040
|
+
- Falls back to deterministic defaults:
|
|
1041
|
+
- Method: \`POST\` for commands, \`GET\` for queries
|
|
1042
|
+
- Path: \`defaultRestPath(name, version)\` → \`/<dot/name>/v<version>\`
|
|
1043
|
+
|
|
1044
|
+
### Library API
|
|
1045
|
+
|
|
1046
|
+
- Function: \`openApiForRegistry(registry, options?)\`
|
|
1047
|
+
- Location: \`@contractspec/lib.contracts/openapi\`
|
|
1048
|
+
|
|
1049
|
+
### CLI
|
|
1050
|
+
|
|
1051
|
+
Export OpenAPI from a registry module:
|
|
1052
|
+
|
|
1053
|
+
\`\`\`bash
|
|
1054
|
+
contractspec openapi --registry ./src/registry.ts --out ./openapi.json
|
|
1055
|
+
\`\`\`
|
|
1056
|
+
|
|
1057
|
+
The registry module must export one of:
|
|
1058
|
+
|
|
1059
|
+
- \`registry: OperationSpecRegistry\`
|
|
1060
|
+
- \`default(): OperationSpecRegistry | Promise<OperationSpecRegistry>\`
|
|
1061
|
+
- \`createRegistry(): OperationSpecRegistry | Promise<OperationSpecRegistry>\`
|
|
1062
|
+
|
|
1063
|
+
### Notes / limitations (current)
|
|
1064
|
+
|
|
1065
|
+
- Responses are generated as a basic \`200\` response (plus schemas when available).
|
|
1066
|
+
- Query (GET) inputs are currently represented as a JSON request body when an input schema exists.
|
|
1067
|
+
- Errors are not yet expanded into OpenAPI responses; that will be added when we standardize error envelopes.`}];D(eW);var J5=[{id:"docs.tech.contracts.openapi-import",title:"OpenAPI Import (OpenAPI 3.1) to ContractSpec",summary:"Import OpenAPI specifications into ContractSpec models, or generate pure Zod/JSON-Schema/GraphQL representations.",kind:"reference",visibility:"public",route:"/docs/tech/contracts/openapi-import",tags:["contracts","openapi","import","codegen"],body:`## OpenAPI Import (OpenAPI 3.1)
|
|
1068
|
+
|
|
1069
|
+
### Purpose
|
|
1070
|
+
|
|
1071
|
+
Import external API definitions into your codebase. Supports both one-time scaffolding and multi-format generation for integration.
|
|
1072
|
+
|
|
1073
|
+
### Modes
|
|
1074
|
+
|
|
1075
|
+
#### 1. ContractSpec Scaffolding (Default)
|
|
1076
|
+
|
|
1077
|
+
Generates standard \`defineSchemaModel\` definitions for full ContractSpec integration.
|
|
1078
|
+
|
|
1079
|
+
\`\`\`bash
|
|
1080
|
+
contractspec openapi import --file api.json --output ./src/contracts
|
|
1081
|
+
\`\`\`
|
|
1082
|
+
|
|
1083
|
+
#### 2. Multi-Format Generation
|
|
1084
|
+
|
|
1085
|
+
Generate schemas in specific formats for direct use in other parts of your stack (adapters, UI, etc.).
|
|
1086
|
+
|
|
1087
|
+
- **Zod**: Pure Zod schemas (\`z.object(...)\`).
|
|
1088
|
+
- **GraphQL**: GraphQL SDL type definitions.
|
|
1089
|
+
- **JSON Schema**: Standard JSON Schema objects.
|
|
1090
|
+
|
|
1091
|
+
\`\`\`bash
|
|
1092
|
+
# Generate Zod schemas suitable for runtime validation
|
|
1093
|
+
contractspec openapi import --file api.json --output ./src/zod --schema-format zod
|
|
1094
|
+
\`\`\`
|
|
1095
|
+
|
|
1096
|
+
### Library API
|
|
1097
|
+
|
|
1098
|
+
- Function: \`importFromOpenApi(doc, options)\`
|
|
1099
|
+
- Location: \`@contractspec/lib.contracts-transformers/openapi\`
|
|
1100
|
+
- Options:
|
|
1101
|
+
- \`schemaFormat\`: 'contractspec' | 'zod' | 'json-schema' | 'graphql'
|
|
1102
|
+
- \`prefix\`: Prefix for model names
|
|
1103
|
+
- \`tags\`: Filter by OpenAPI tags
|
|
1104
|
+
|
|
1105
|
+
### CLI
|
|
1106
|
+
|
|
1107
|
+
\`\`\`bash
|
|
1108
|
+
contractspec openapi import --file <path-or-url> --output <dir> [--schema-format <format>]
|
|
1109
|
+
\`\`\`
|
|
1110
|
+
`}];D(J5);var X5=[{id:"docs.tech.contracts.workspace-config",title:"Workspace Configuration (.contractsrc)",summary:"Configuration-as-code conventions for ContractSpec workspaces (`.contractsrc.json`).",kind:"reference",visibility:"public",route:"/docs/tech/contracts/workspace-config",tags:["tech","contracts","config"],body:"## Workspace Configuration (.contractsrc)\n\nContractSpec uses a hierarchical configuration system anchored by `.contractsrc.json` files. Configuration loader supports standard rc-file discovery (cosmiconfig).\n\n### Schema Formats\n\nThe `schemaFormat` option controls the output format of schema generation commands (like `contractspec openapi import`).\n\nSupported formats:\n- `contractspec` (default): Generates standard `defineSchemaModel` code.\n- `zod`: Generates raw Zod schemas using `z.object({...})`.\n- `json-schema`: Generates JSON Schema definitions.\n- `graphql`: Generates GraphQL SDL type definitions.\n\n### Config Interface\n\n```ts\nexport interface ContractsrcConfig {\n // ... existing fields ...\n schemaFormat?: 'contractspec' | 'zod' | 'json-schema' | 'graphql';\n}\n```\n\nDefined in `@contractspec/lib.contracts/workspace-config`.\n"}];D(X5);var H5=[{id:"docs.tech.studio.workspaces",title:"Studio projects, teams, environments",summary:"Organization-first Studio: projects live under an organization; teams refine access; projects deploy to multiple environments.",kind:"reference",visibility:"mixed",route:"/docs/tech/studio/workspaces",tags:["studio","projects","teams","rbac","environments"],body:`## Concepts
|
|
1111
|
+
|
|
1112
|
+
- **Organization**: the primary grouping boundary for Studio projects.
|
|
1113
|
+
- **Project**: one application (specs, overlays, deployments, integrations, evolution, learning).
|
|
1114
|
+
- **Team**: refines who can see/edit a project within an organization.
|
|
1115
|
+
- **Environment**: deployment target (Development / Staging / Production).
|
|
1116
|
+
|
|
1117
|
+
## Project access (teams + admin override)
|
|
1118
|
+
|
|
1119
|
+
Studio uses multi-team sharing to refine access:
|
|
1120
|
+
|
|
1121
|
+
- **Admins/owners** can access all projects.
|
|
1122
|
+
- If a project is shared with **no teams**, it is **org-wide** (all org members).
|
|
1123
|
+
- If a project is shared with **one or more teams**, it is visible to:
|
|
1124
|
+
- admins/owners, and
|
|
1125
|
+
- members of any linked team.
|
|
1126
|
+
|
|
1127
|
+
## Current persistence (DB + GraphQL)
|
|
1128
|
+
|
|
1129
|
+
- DB (Prisma): \`StudioProject\`, \`Team\`, \`TeamMember\`, \`StudioProjectTeam\`
|
|
1130
|
+
- GraphQL:
|
|
1131
|
+
- \`myStudioProjects\`
|
|
1132
|
+
- \`createStudioProject(input.teamIds?)\`
|
|
1133
|
+
- \`myTeams\`
|
|
1134
|
+
- \`projectTeams(projectId)\`
|
|
1135
|
+
- \`setProjectTeams(projectId, teamIds)\`
|
|
1136
|
+
|
|
1137
|
+
## UI shell behavior
|
|
1138
|
+
|
|
1139
|
+
Studio and Sandbox both use a shared shell:
|
|
1140
|
+
|
|
1141
|
+
- Project selector → Module navigation → Environment selector
|
|
1142
|
+
- Always-on Assistant button (floating)
|
|
1143
|
+
- Learning journey progress (Studio persists learning events; Sandbox stays local-only)
|
|
1144
|
+
|
|
1145
|
+
## Routing
|
|
1146
|
+
|
|
1147
|
+
- \`/studio/projects\`: create/select/delete projects (organization-first).
|
|
1148
|
+
- \`/studio/{projectSlug}/*\`: project modules (canvas/specs/deploy/integrations/evolution/learning).
|
|
1149
|
+
- \`/studio/learning\`: learning hub without selecting a project.
|
|
1150
|
+
`}];D(H5);var W5=[{id:"docs.tech.studio.sandbox.unlogged",title:"Sandbox (unlogged) vs Studio (authenticated)",summary:"The sandbox is a lightweight, unlogged surface that mirrors Studio navigation without auth or analytics.",kind:"reference",visibility:"public",route:"/docs/tech/studio/sandbox-unlogged",tags:["studio","sandbox","privacy","analytics"],body:`## Sandbox guarantees
|
|
1151
|
+
|
|
1152
|
+
- Route: \`/sandbox\`
|
|
1153
|
+
- **No auth requirement**
|
|
1154
|
+
- **No PostHog init**
|
|
1155
|
+
- **No Vercel Analytics**
|
|
1156
|
+
- Local-only state (in-browser runtime + localStorage where needed)
|
|
1157
|
+
|
|
1158
|
+
## What Sandbox is for
|
|
1159
|
+
|
|
1160
|
+
- Try templates and feature modules safely
|
|
1161
|
+
- Preview specs/builder/evolution/learning
|
|
1162
|
+
- Produce copyable CLI commands (no side effects)
|
|
1163
|
+
|
|
1164
|
+
## What Sandbox is *not* for
|
|
1165
|
+
|
|
1166
|
+
- Persisted projects/workspaces
|
|
1167
|
+
- Real deployments
|
|
1168
|
+
- Organization-scoped integrations (unless explicitly enabled later)
|
|
1169
|
+
`}];D(W5);var q5=[{id:"docs.tech.studio.workspace_ops",title:"Workspace ops (repo-linked): list / validate / deps / diff",summary:"Read-only repo operations used by Studio to inspect and validate a linked ContractSpec workspace.",kind:"reference",visibility:"mixed",route:"/docs/tech/studio/workspace-ops",tags:["studio","repo","workspace","validate","diff"],body:"## API surface (api-contractspec)\n\nBase: `/api/workspace-ops`\n\nThese endpoints are **read-only** in v1 and never push to git:\n\n- `GET /api/workspace-ops/:integrationId/config?organizationId=`\n- `GET /api/workspace-ops/:integrationId/specs?organizationId=`\n- `POST /api/workspace-ops/:integrationId/validate` (body: organizationId, files?, pattern?)\n- `POST /api/workspace-ops/:integrationId/deps` (body: organizationId, pattern?)\n- `POST /api/workspace-ops/:integrationId/diff` (body: organizationId, specPath, baseline?, breakingOnly?)\n\n## Repo resolution\n\n- The repo root is resolved from the Studio Integration (`IntegrationProvider.GITHUB`) config:\n - `config.repoCachePath` (preferred) or `config.localPath`\n- Resolution is constrained to `CONTRACTSPEC_REPO_CACHE_DIR` (default: `/tmp/contractspec-repos`)\n\n## Intended UX\n\n- Studio Assistant can run these checks and present results as suggestions.\n- Users can copy equivalent CLI commands for local runs:\n - `contractspec validate`\n - `contractspec deps`\n - `contractspec diff --baseline <ref>`\n"}];D(q5);var Y5=[{id:"docs.tech.studio.project-routing",title:"Studio Project Routing",summary:"Studio uses slugged, project-first routes: /studio/{projectSlug}/* with canonical slug redirects and soft-deleted projects hidden.",kind:"reference",visibility:"public",route:"/docs/tech/studio/project-routing",tags:["studio","routing","projects","slug","redirects"],body:`# Studio Project Routing
|
|
1170
|
+
|
|
1171
|
+
ContractSpec Studio uses a **project-first URL scheme**:
|
|
1172
|
+
|
|
1173
|
+
- \`/studio/projects\` — create, select, and delete projects.
|
|
1174
|
+
- \`/studio/{projectSlug}/*\` — project modules (canvas/specs/deploy/integrations/evolution/learning).
|
|
1175
|
+
- \`/studio/learning\` — learning hub that does not require selecting a project.
|
|
1176
|
+
|
|
1177
|
+
## Studio layout shell
|
|
1178
|
+
|
|
1179
|
+
Studio routes are wrapped in a dedicated **Studio app shell** (header + footer) that provides in-app navigation (Projects/Learning/Teams), organization switching, and account actions.
|
|
1180
|
+
|
|
1181
|
+
Project module routes (\`/studio/{projectSlug}/*\`) render their own module shell (\`WorkspaceProjectShellLayout\`). When combined with the global Studio header, the project shell uses a **sticky header offset** to avoid overlapping sticky headers.
|
|
1182
|
+
|
|
1183
|
+
## Slug behavior (rename-safe)
|
|
1184
|
+
|
|
1185
|
+
- Each project has a \`slug\` stored in the database (\`StudioProject.slug\`).
|
|
1186
|
+
- When a project name changes, Studio **updates the slug** and stores the previous slug as an alias (\`StudioProjectSlugAlias\`).
|
|
1187
|
+
- Requests to an alias slug are **redirected to the canonical slug**.
|
|
1188
|
+
|
|
1189
|
+
GraphQL entrypoint:
|
|
1190
|
+
|
|
1191
|
+
- \`studioProjectBySlug(slug: String!)\` returns:
|
|
1192
|
+
- \`project\`
|
|
1193
|
+
- \`canonicalSlug\`
|
|
1194
|
+
- \`wasRedirect\`
|
|
1195
|
+
|
|
1196
|
+
## Deletion behavior (soft delete)
|
|
1197
|
+
|
|
1198
|
+
Projects are **soft-deleted**:
|
|
1199
|
+
|
|
1200
|
+
- \`deleteStudioProject(id: String!)\` sets \`StudioProject.deletedAt\`.
|
|
1201
|
+
- All listings and access checks filter \`deletedAt = null\`.
|
|
1202
|
+
- Soft-deleted projects are treated as “not found” in Studio routes and GraphQL access checks.
|
|
1203
|
+
|
|
1204
|
+
## Available modules for a selected project
|
|
1205
|
+
|
|
1206
|
+
The following project modules are expected under \`/studio/{projectSlug}\`:
|
|
1207
|
+
|
|
1208
|
+
- \`/canvas\` — Visual builder canvas (stored via overlays and canvas versions).
|
|
1209
|
+
- \`/specs\` — Spec editor (stored as \`StudioSpec\`).
|
|
1210
|
+
- \`/deploy\` — Deployments history + triggers (stored as \`StudioDeployment\`).
|
|
1211
|
+
- \`/integrations\` — Integrations scoped to project (stored as \`StudioIntegration\`).
|
|
1212
|
+
- \`/evolution\` — Evolution sessions (stored as \`EvolutionSession\`).
|
|
1213
|
+
- \`/learning\` — Project learning activity.
|
|
1214
|
+
`}];D(Y5);var Q5=[{id:"docs.tech.studio.platform-admin-panel",title:"Studio Platform Admin Panel",summary:"How PLATFORM_ADMIN organizations manage tenant orgs and integration connections without session switching.",kind:"reference",visibility:"public",route:"/docs/tech/studio/platform-admin-panel",tags:["studio","admin","multi-tenancy","integrations","better-auth"],body:`# Studio Platform Admin Panel
|
|
1215
|
+
|
|
1216
|
+
ContractSpec Studio exposes a dedicated **Platform Admin Panel** for users whose **active organization** has:
|
|
1217
|
+
|
|
1218
|
+
- \`Organization.type = PLATFORM_ADMIN\`
|
|
1219
|
+
|
|
1220
|
+
The UI route is:
|
|
1221
|
+
|
|
1222
|
+
- \`/studio/admin\`
|
|
1223
|
+
|
|
1224
|
+
## Authorization model (no org switching)
|
|
1225
|
+
|
|
1226
|
+
Platform admins **remain in their own organization**. Cross-tenant actions are always explicit and scoped:
|
|
1227
|
+
|
|
1228
|
+
- Admin operations require an explicit \`targetOrganizationId\`.
|
|
1229
|
+
- No session / activeOrganizationId switching is performed as part of admin operations.
|
|
1230
|
+
|
|
1231
|
+
## Integrations management
|
|
1232
|
+
|
|
1233
|
+
The admin panel manages the full ContractSpec Integrations system:
|
|
1234
|
+
|
|
1235
|
+
- Lists all shipped \`IntegrationSpec\` entries (registry built via \`createDefaultIntegrationSpecRegistry()\`).
|
|
1236
|
+
- CRUD \`IntegrationConnection\` records for a selected tenant org.
|
|
1237
|
+
|
|
1238
|
+
### Secrets (reference-only + write-only)
|
|
1239
|
+
|
|
1240
|
+
The admin UI supports two modes:
|
|
1241
|
+
|
|
1242
|
+
- **Reference-only (BYOK)**: store only \`secretProvider\` + \`secretRef\`.
|
|
1243
|
+
- **Write-only provisioning/rotation**: paste a raw secret payload; server writes to the selected backend and stores the resulting reference. The secret value is **never returned or displayed**.
|
|
1244
|
+
|
|
1245
|
+
Supported backends:
|
|
1246
|
+
|
|
1247
|
+
- Env overrides (\`env://...\`)
|
|
1248
|
+
- Google Cloud Secret Manager (\`gcp://...\`)
|
|
1249
|
+
- AWS Secrets Manager (\`aws://secretsmanager/...\`)
|
|
1250
|
+
- Scaleway Secret Manager (\`scw://secret-manager/...\`)
|
|
1251
|
+
|
|
1252
|
+
## Better Auth Admin plugin
|
|
1253
|
+
|
|
1254
|
+
The panel uses the Better Auth **Admin plugin** for user operations (list users, impersonation):
|
|
1255
|
+
|
|
1256
|
+
- Client calls use \`authClient.admin.*\`.
|
|
1257
|
+
- Server-side, ContractSpec enforces that users in a PLATFORM_ADMIN active org have \`User.role\` containing \`admin\` so Better Auth Admin endpoints authorize.
|
|
1258
|
+
|
|
1259
|
+
## GraphQL surface
|
|
1260
|
+
|
|
1261
|
+
The platform-admin GraphQL operations are guarded by the active org type and include:
|
|
1262
|
+
|
|
1263
|
+
- \`platformAdminOrganizations(search, limit, offset)\`
|
|
1264
|
+
- \`platformAdminIntegrationSpecs\`
|
|
1265
|
+
- \`platformAdminIntegrationConnections(input: { targetOrganizationId, category?, status? })\`
|
|
1266
|
+
- \`platformAdminIntegrationConnectionCreate(input)\`
|
|
1267
|
+
- \`platformAdminIntegrationConnectionUpdate(input)\`
|
|
1268
|
+
- \`platformAdminIntegrationConnectionDelete(targetOrganizationId, connectionId)\`
|
|
1269
|
+
|
|
1270
|
+
## Key implementation files
|
|
1271
|
+
|
|
1272
|
+
- Auth + role enforcement: \`packages/bundles/contractspec-studio/src/application/services/auth.ts\`
|
|
1273
|
+
- Admin GraphQL module: \`packages/bundles/contractspec-studio/src/infrastructure/graphql/modules/platform-admin.ts\`
|
|
1274
|
+
- Integrations admin service: \`packages/bundles/contractspec-studio/src/modules/platform-integrations/index.ts\`
|
|
1275
|
+
- Web route: \`packages/apps/web-landing/src/app/(app-customer)/studio/admin/*\`
|
|
1276
|
+
`}];D(Q5);var z5=[{id:"docs.tech.studio.learning-events",title:"Studio Learning Events",summary:"Studio persists learning/activity events to the database; Sandbox keeps learning local-first and unlogged.",kind:"reference",visibility:"public",route:"/docs/tech/studio/learning-events",tags:["studio","learning","events","analytics","sandbox"],body:"# Studio Learning Events\n\nStudio emits lightweight **learning/activity events** to support onboarding, ambient coaching, and learning journeys.\n\n## Persistence model\n\n- **Studio**: events are persisted to the database in `StudioLearningEvent` and are organization-scoped (optionally project-scoped).\n- **Sandbox**: events remain **local-only** (unlogged); they must never be sent to backend services.\n\n## GraphQL API\n\n- `recordLearningEvent(input: { name, projectId?, payload? })`\n- `myLearningEvents(projectId?, limit?)`\n- `myOnboardingTracks(productId?, includeProgress?)`\n- `myOnboardingProgress(trackKey)`\n- `dismissOnboardingTrack(trackKey)`\n\n## Common event names (convention)\n\n- `module.navigated` — user navigated to a Studio module (payload at minimum: `{ moduleId }`).\n- `studio.template.instantiated` — created a new Studio project (starter template). Payload commonly includes `{ templateId, projectSlug }`.\n- `spec.changed` — created or updated a Studio spec. Payload may include `{ action: 'create' | 'update', specId?, specType? }`.\n- `regeneration.completed` — finished a “regen/deploy” action (currently emitted on successful Studio deploy actions).\n- `studio.evolution.applied` — completed an Evolution session (payload commonly includes `{ evolutionSessionId }`).\n\nThese events are intentionally minimal and must avoid PII/secrets in payloads.\n"}];D(z5);var w5=[{id:"docs.tech.studio.learning-journeys",title:"Studio learning journeys (onboarding + coach)",summary:"DB-backed learning journeys tracked per organization: seeded tracks/steps, event-driven progress, XP/streaks, and a Studio coach surface.",kind:"reference",visibility:"public",route:"/docs/tech/studio/learning-journeys",tags:["studio","learning","onboarding","journey","graphql","database"],body:"# Studio learning journeys\n\nStudio supports **DB-backed learning journeys** (onboarding tracks + ambient coach tips) that are advanced by **recorded learning events**.\n\n> See also: `/docs/tech/studio/learning-events` for event naming + payload guardrails.\n\n## Scope (multi-tenancy)\n\n- Progress is tracked **per organization** (tenant/workspace), via a `Learner` record keyed by `(userId, organizationId)`.\n- Learning events are stored as `StudioLearningEvent` under the Studio DB schema, scoped to an organization (optionally a project).\n\n## Persistence model (Prisma)\n\nLearning journey progress lives in the `lssm_learning` schema:\n\n- `Learner` — one per `(userId, organizationId)`\n- `OnboardingTrack` — seeded track definitions (trackKey, name, metadata)\n- `OnboardingStep` — seeded step definitions (stepKey, completionCondition, xpReward, metadata)\n- `OnboardingProgress` — learner × track progress (progress %, xpEarned, completedAt, dismissedAt)\n- `OnboardingStepCompletion` — append-only completion records (stepKey, status, xpEarned, completedAt)\n\n## Track definition source (spec-first)\n\n- Canonical track specs live in `@contractspec/example.learning-journey-registry`.\n- The Studio API seeds/updates the DB definitions via an idempotent “ensure tracks” routine.\n- The DB is kept aligned with track specs (stale steps are removed) to prevent drift and unblock completion.\n\n## Progress advancement (event-driven)\n\n1) UI records an event via GraphQL `recordLearningEvent`\n2) Backend creates `StudioLearningEvent`\n3) Backend advances onboarding by matching the new event against step completion conditions\n4) Backend persists step completions and recomputes:\n - `progress` percentage\n - `xpEarned` (including streak/completion bonuses when configured)\n - track completion state (`completedAt`)\n\n## GraphQL API (Studio)\n\n- `myOnboardingTracks(productId?, includeProgress?)`\n - returns all tracks + optional progress for the current learner\n- `myOnboardingProgress(trackKey)`\n - returns progress + step completion list for a single track\n- `dismissOnboardingTrack(trackKey)`\n - marks a track dismissed for the learner (prevents auto-coach)\n\n## UI routes/surfaces (web)\n\n- `/studio/learning` — learning hub (track list + progress widget)\n- `/studio/learning/{trackKey}` — track detail (steps + map)\n- Studio shell mounts a **coach sheet** that can auto-open for incomplete, non-dismissed onboarding.\n\n## Security + data hygiene\n\n- Do not put secrets/PII in `payload` fields of learning events.\n- Prefer shallow payload filters (small, stable keys).\n"}];D(w5);var G5=[{id:"docs.tech.studio.project-access-teams",title:"Studio Project Access via Teams",summary:"Projects live under organizations; team sharing refines access with an admin/owner override.",kind:"reference",visibility:"public",route:"/docs/tech/studio/project-access-teams",tags:["studio","projects","teams","rbac","access-control"],body:`# Studio Project Access via Teams
|
|
1277
|
+
|
|
1278
|
+
Studio access control is **organization-first** with optional **team-based sharing**.
|
|
1279
|
+
|
|
1280
|
+
## Data model
|
|
1281
|
+
|
|
1282
|
+
- \`Team\` and \`TeamMember\` define team membership inside an organization.
|
|
1283
|
+
- \`StudioProject\` is owned by an organization.
|
|
1284
|
+
- \`StudioProjectTeam\` links projects to 0..N teams.
|
|
1285
|
+
|
|
1286
|
+
## Access rules
|
|
1287
|
+
|
|
1288
|
+
- **Admins/owners**: always have access to all projects in the organization.
|
|
1289
|
+
- **Org-wide projects**: if a project has **no team links**, all organization members can access it.
|
|
1290
|
+
- **Team-scoped projects**: if a project has **one or more team links**, a user must be a member of at least one linked team.
|
|
1291
|
+
|
|
1292
|
+
## GraphQL surfaces
|
|
1293
|
+
|
|
1294
|
+
- Read:
|
|
1295
|
+
- \`myStudioProjects\` (returns only projects you can access)
|
|
1296
|
+
- \`studioProjectBySlug(slug)\` (enforces the same access rules)
|
|
1297
|
+
- \`myTeams\`
|
|
1298
|
+
- \`projectTeams(projectId)\`
|
|
1299
|
+
|
|
1300
|
+
- Write:
|
|
1301
|
+
- \`createStudioProject(input.teamIds?)\` (teamIds optional)
|
|
1302
|
+
- \`setProjectTeams(projectId, teamIds)\` (admin-only)
|
|
1303
|
+
|
|
1304
|
+
## Related
|
|
1305
|
+
+
|
|
1306
|
+
+- Team administration + invitations: see \`/docs/tech/studio/team-invitations\`.
|
|
1307
|
+
+
|
|
1308
|
+
## Notes
|
|
1309
|
+
|
|
1310
|
+
Payloads and events must avoid secrets/PII. For Sandbox, the model remains local-first and unlogged.
|
|
1311
|
+
`}];D(G5);var U5=[{id:"docs.tech.studio.team-invitations",title:"Studio Teams & Invitations",summary:"Admin-only team management and email invitation flow to join an organization and optionally a team.",kind:"reference",visibility:"public",route:"/docs/tech/studio/team-invitations",tags:["studio","teams","invitations","access-control","onboarding"],body:`# Studio Teams & Invitations
|
|
1312
|
+
|
|
1313
|
+
Studio uses **organization membership** as the base access model. Teams are optional and used to refine access to projects.
|
|
1314
|
+
|
|
1315
|
+
## Who can manage teams?
|
|
1316
|
+
|
|
1317
|
+
- **Admins/owners only**: create, rename, delete teams; manage project team access; issue invitations.
|
|
1318
|
+
|
|
1319
|
+
## Invitation data model
|
|
1320
|
+
|
|
1321
|
+
- \`Invitation\` rows are stored under an organization and target an **email** address.
|
|
1322
|
+
|
|
1323
|
+
- An invitation can optionally target a \`teamId\`, which will grant the user membership in that team upon acceptance.
|
|
1324
|
+
|
|
1325
|
+
Key fields:
|
|
1326
|
+
- \`email\`: invited address (must match the accepting user's account email)
|
|
1327
|
+
|
|
1328
|
+
- \`status\`: \`pending | accepted | declined | expired\`
|
|
1329
|
+
|
|
1330
|
+
- \`teamId?\`: optional team to join
|
|
1331
|
+
|
|
1332
|
+
- \`inviterId\`: user who issued the invitation
|
|
1333
|
+
|
|
1334
|
+
## GraphQL surfaces
|
|
1335
|
+
|
|
1336
|
+
- Team CRUD (admin-only):
|
|
1337
|
+
|
|
1338
|
+
- \`createTeam(name)\`
|
|
1339
|
+
|
|
1340
|
+
- \`renameTeam(teamId, name)\`
|
|
1341
|
+
|
|
1342
|
+
- \`deleteTeam(teamId)\`
|
|
1343
|
+
|
|
1344
|
+
|
|
1345
|
+
- Invitations (admin-only):
|
|
1346
|
+
|
|
1347
|
+
- \`organizationInvitations\`
|
|
1348
|
+
|
|
1349
|
+
- \`inviteToOrganization(email, role?, teamId?)\` → returns \`inviteUrl\` and whether an email was sent
|
|
1350
|
+
|
|
1351
|
+
## Accepting an invitation
|
|
1352
|
+
|
|
1353
|
+
The invite link is served as:
|
|
1354
|
+
|
|
1355
|
+
- \`/invite/{invitationId}\`
|
|
1356
|
+
|
|
1357
|
+
Acceptance rules:
|
|
1358
|
+
- The user must be authenticated.
|
|
1359
|
+
|
|
1360
|
+
- The authenticated user’s email must match \`Invitation.email\`.
|
|
1361
|
+
|
|
1362
|
+
- If not already a member, create \`Member(userId, organizationId, role)\`.
|
|
1363
|
+
|
|
1364
|
+
- If \`teamId\` is present, ensure \`TeamMember(teamId, userId)\`.
|
|
1365
|
+
|
|
1366
|
+
- Mark invitation \`status='accepted'\` and set \`acceptedAt\`.
|
|
1367
|
+
|
|
1368
|
+
- Set \`activeOrganizationId\` for the session so \`/studio/*\` routes work immediately.
|
|
1369
|
+
|
|
1370
|
+
## Email delivery
|
|
1371
|
+
|
|
1372
|
+
- If \`RESEND_API_KEY\` is set, the system attempts to send an email.
|
|
1373
|
+
|
|
1374
|
+
- Otherwise, the UI uses the returned \`inviteUrl\` for manual copy/share.
|
|
1375
|
+
`}];D(U5);var P5=[{id:"docs.tech.llm.overview",title:"LLM Integration Overview",summary:"Export specs to LLM-friendly formats, generate implementation guides, and verify implementations.",kind:"reference",visibility:"public",route:"/docs/tech/llm/overview",tags:["llm","ai","export","guide","verify"],body:`# LLM Integration
|
|
1376
|
+
|
|
1377
|
+
ContractSpec provides first-class LLM integration to bridge specifications and AI coding agents.
|
|
1378
|
+
|
|
1379
|
+
## Core Features
|
|
1380
|
+
|
|
1381
|
+
### 1. Multi-Format Export
|
|
1382
|
+
|
|
1383
|
+
Export specs to markdown in formats optimized for LLM consumption:
|
|
1384
|
+
|
|
1385
|
+
- **Context format**: Summary for understanding (goal, context, acceptance criteria)
|
|
1386
|
+
- **Full format**: Complete spec with all details (I/O schemas, policy, events)
|
|
1387
|
+
- **Prompt format**: Actionable prompt with implementation instructions
|
|
1388
|
+
|
|
1389
|
+
### 2. Implementation Guidance
|
|
1390
|
+
|
|
1391
|
+
Generate agent-specific implementation plans:
|
|
1392
|
+
|
|
1393
|
+
- **Claude Code**: Extended thinking mode with structured prompts
|
|
1394
|
+
- **Cursor CLI**: Background/composer mode with .mdc rules generation
|
|
1395
|
+
- **Generic MCP**: Standard format for any MCP-compatible agent
|
|
1396
|
+
|
|
1397
|
+
### 3. Tiered Verification
|
|
1398
|
+
|
|
1399
|
+
Verify implementations against specs:
|
|
1400
|
+
|
|
1401
|
+
- **Tier 1 (Structure)**: Types, exports, imports validation
|
|
1402
|
+
- **Tier 2 (Behavior)**: Scenario coverage, error handling, events
|
|
1403
|
+
- **Tier 3 (AI Review)**: Semantic compliance analysis via LLM
|
|
1404
|
+
|
|
1405
|
+
## Access Points
|
|
1406
|
+
|
|
1407
|
+
| Surface | Commands/Tools |
|
|
1408
|
+
|---------|---------------|
|
|
1409
|
+
| CLI | \`contractspec llm export\`, \`guide\`, \`verify\`, \`copy\` |
|
|
1410
|
+
| MCP | \`llm.export\`, \`llm.guide\`, \`llm.verify\` tools |
|
|
1411
|
+
| VSCode | Export to LLM, Generate Guide, Verify, Copy commands |
|
|
1412
|
+
|
|
1413
|
+
## Quick Start
|
|
1414
|
+
|
|
1415
|
+
### CLI Usage
|
|
1416
|
+
|
|
1417
|
+
\`\`\`bash
|
|
1418
|
+
# Export spec as markdown
|
|
1419
|
+
contractspec llm export path/to/my.spec.ts --format full
|
|
1420
|
+
|
|
1421
|
+
# Generate implementation guide
|
|
1422
|
+
contractspec llm guide path/to/my.spec.ts --agent claude-code
|
|
1423
|
+
|
|
1424
|
+
# Verify implementation
|
|
1425
|
+
contractspec llm verify path/to/my.spec.ts path/to/impl.ts --tier 2
|
|
1426
|
+
|
|
1427
|
+
# Copy spec to clipboard
|
|
1428
|
+
contractspec llm copy path/to/my.spec.ts --format context
|
|
1429
|
+
\`\`\`
|
|
1430
|
+
|
|
1431
|
+
### MCP Usage
|
|
1432
|
+
|
|
1433
|
+
\`\`\`
|
|
1434
|
+
# Export spec
|
|
1435
|
+
llm.export { specPath: "path/to/my.spec.ts", format: "full" }
|
|
1436
|
+
|
|
1437
|
+
# Generate guide
|
|
1438
|
+
llm.guide { specPath: "path/to/my.spec.ts", agent: "cursor-cli" }
|
|
1439
|
+
|
|
1440
|
+
# Verify implementation
|
|
1441
|
+
llm.verify { specPath: "path/to/my.spec.ts", implementationPath: "path/to/impl.ts", tier: "2" }
|
|
1442
|
+
\`\`\`
|
|
1443
|
+
|
|
1444
|
+
### Programmatic Usage
|
|
1445
|
+
|
|
1446
|
+
\`\`\`typescript
|
|
1447
|
+
import { operationSpecToFullMarkdown, operationSpecToAgentPrompt } from '@contractspec/lib.contracts/llm';
|
|
1448
|
+
import { createAgentGuideService, createVerifyService } from '@contractspec/bundle.workspace';
|
|
1449
|
+
|
|
1450
|
+
// Export
|
|
1451
|
+
const markdown = operationSpecToFullMarkdown(mySpec);
|
|
1452
|
+
|
|
1453
|
+
// Generate guide
|
|
1454
|
+
const guideService = createAgentGuideService({ defaultAgent: 'claude-code' });
|
|
1455
|
+
const guide = guideService.generateGuide(mySpec);
|
|
1456
|
+
|
|
1457
|
+
// Verify
|
|
1458
|
+
const verifyService = createVerifyService();
|
|
1459
|
+
const result = await verifyService.verify(mySpec, implementationCode, {
|
|
1460
|
+
tiers: ['structure', 'behavior']
|
|
1461
|
+
});
|
|
1462
|
+
\`\`\`
|
|
1463
|
+
`},{id:"docs.tech.llm.export-formats",title:"LLM Export Formats",summary:"Detailed explanation of the three export formats for LLM consumption.",kind:"reference",visibility:"public",route:"/docs/tech/llm/export-formats",tags:["llm","export","markdown"],body:`# LLM Export Formats
|
|
1464
|
+
|
|
1465
|
+
ContractSpec provides three export formats optimized for different LLM use cases.
|
|
1466
|
+
|
|
1467
|
+
## Context Format
|
|
1468
|
+
|
|
1469
|
+
Best for: Understanding what a spec does, providing background to LLMs.
|
|
1470
|
+
|
|
1471
|
+
Includes:
|
|
1472
|
+
- Spec name, version, type
|
|
1473
|
+
- Goal and context
|
|
1474
|
+
- Description
|
|
1475
|
+
- Acceptance scenarios
|
|
1476
|
+
|
|
1477
|
+
Example:
|
|
1478
|
+
|
|
1479
|
+
\`\`\`markdown
|
|
1480
|
+
# users.createUser (v1)
|
|
1481
|
+
|
|
1482
|
+
> Create a new user account with email verification.
|
|
1483
|
+
|
|
1484
|
+
**Type:** command | **Stability:** stable
|
|
1485
|
+
|
|
1486
|
+
## Goal
|
|
1487
|
+
Create a new user in the system and trigger email verification.
|
|
1488
|
+
|
|
1489
|
+
## Context
|
|
1490
|
+
Part of the user onboarding flow. Called after signup form submission.
|
|
1491
|
+
|
|
1492
|
+
## Acceptance Criteria
|
|
1493
|
+
### Happy path
|
|
1494
|
+
**Given:** Valid email and password
|
|
1495
|
+
**When:** User submits registration
|
|
1496
|
+
**Then:** Account is created, verification email is sent
|
|
1497
|
+
\`\`\`
|
|
1498
|
+
|
|
1499
|
+
## Full Format
|
|
1500
|
+
|
|
1501
|
+
Best for: Complete documentation, implementation reference.
|
|
1502
|
+
|
|
1503
|
+
Includes everything:
|
|
1504
|
+
- All metadata
|
|
1505
|
+
- JSON schemas for I/O
|
|
1506
|
+
- Error definitions
|
|
1507
|
+
- Policy (auth, rate limits, PII)
|
|
1508
|
+
- Events emitted
|
|
1509
|
+
- Examples
|
|
1510
|
+
- Transport configuration
|
|
1511
|
+
|
|
1512
|
+
## Prompt Format
|
|
1513
|
+
|
|
1514
|
+
Best for: Feeding directly to coding agents.
|
|
1515
|
+
|
|
1516
|
+
Includes:
|
|
1517
|
+
- Task header with clear instructions
|
|
1518
|
+
- Full spec context
|
|
1519
|
+
- Implementation requirements
|
|
1520
|
+
- Task-specific guidance (implement/test/refactor/review)
|
|
1521
|
+
- Expected output format
|
|
1522
|
+
|
|
1523
|
+
The prompt format adapts based on task type:
|
|
1524
|
+
- **implement**: Full implementation with tests
|
|
1525
|
+
- **test**: Test generation for existing code
|
|
1526
|
+
- **refactor**: Refactoring while maintaining behavior
|
|
1527
|
+
- **review**: Code review against spec
|
|
1528
|
+
`},{id:"docs.tech.llm.agent-adapters",title:"Agent Adapters",summary:"Adapters for different AI coding agents (Claude, Cursor, MCP).",kind:"reference",visibility:"public",route:"/docs/tech/llm/agent-adapters",tags:["llm","agents","claude","cursor","mcp"],body:`# Agent Adapters
|
|
1529
|
+
|
|
1530
|
+
ContractSpec provides specialized adapters for different AI coding agents.
|
|
1531
|
+
|
|
1532
|
+
## Claude Code Adapter
|
|
1533
|
+
|
|
1534
|
+
Optimized for Anthropic Claude's extended thinking and code generation.
|
|
1535
|
+
|
|
1536
|
+
Features:
|
|
1537
|
+
- Structured markdown with clear sections
|
|
1538
|
+
- Checklists for steps and verification
|
|
1539
|
+
- Icons for file operations (\uD83D\uDCDD create, ✏️ modify)
|
|
1540
|
+
- System prompt for ContractSpec context
|
|
1541
|
+
|
|
1542
|
+
Usage:
|
|
1543
|
+
\`\`\`typescript
|
|
1544
|
+
const guideService = createAgentGuideService({ defaultAgent: 'claude-code' });
|
|
1545
|
+
const result = guideService.generateGuide(spec, { agent: 'claude-code' });
|
|
1546
|
+
// result.prompt.systemPrompt - Claude system context
|
|
1547
|
+
// result.prompt.taskPrompt - Task-specific instructions
|
|
1548
|
+
\`\`\`
|
|
1549
|
+
|
|
1550
|
+
## Cursor CLI Adapter
|
|
1551
|
+
|
|
1552
|
+
Optimized for Cursor's background/composer mode.
|
|
1553
|
+
|
|
1554
|
+
Features:
|
|
1555
|
+
- Compact format for context efficiency
|
|
1556
|
+
- .mdc cursor rules generation
|
|
1557
|
+
- Integration with Cursor's file system
|
|
1558
|
+
- Concise step lists
|
|
1559
|
+
|
|
1560
|
+
Generate Cursor Rules:
|
|
1561
|
+
\`\`\`typescript
|
|
1562
|
+
const cursorRules = guideService.generateAgentConfig(spec, 'cursor-cli');
|
|
1563
|
+
// Save to .cursor/rules/my-spec.mdc
|
|
1564
|
+
\`\`\`
|
|
1565
|
+
|
|
1566
|
+
## Generic MCP Adapter
|
|
1567
|
+
|
|
1568
|
+
Works with any MCP-compatible agent (Cline, Aider, etc.).
|
|
1569
|
+
|
|
1570
|
+
Features:
|
|
1571
|
+
- Standard markdown format
|
|
1572
|
+
- Table-based metadata
|
|
1573
|
+
- JSON resource format support
|
|
1574
|
+
- Prompt message format
|
|
1575
|
+
|
|
1576
|
+
The generic adapter is the default and works across all agents.
|
|
1577
|
+
|
|
1578
|
+
## Choosing an Adapter
|
|
1579
|
+
|
|
1580
|
+
| Agent | Best For | Key Features |
|
|
1581
|
+
|-------|----------|--------------|
|
|
1582
|
+
| Claude Code | Complex implementations | Extended thinking, detailed steps |
|
|
1583
|
+
| Cursor CLI | IDE-integrated work | Cursor rules, compact format |
|
|
1584
|
+
| Generic MCP | Any MCP agent | Universal compatibility |
|
|
1585
|
+
`},{id:"docs.tech.llm.verification",title:"Implementation Verification",summary:"Tiered verification of implementations against specifications.",kind:"reference",visibility:"public",route:"/docs/tech/llm/verification",tags:["llm","verify","validation","testing"],body:`# Implementation Verification
|
|
1586
|
+
|
|
1587
|
+
ContractSpec provides tiered verification to check if implementations comply with specs.
|
|
1588
|
+
|
|
1589
|
+
## Verification Tiers
|
|
1590
|
+
|
|
1591
|
+
### Tier 1: Structure (Fast)
|
|
1592
|
+
|
|
1593
|
+
Checks TypeScript structure against spec requirements:
|
|
1594
|
+
|
|
1595
|
+
| Check | What it validates |
|
|
1596
|
+
|-------|------------------|
|
|
1597
|
+
| Handler export | Function is properly exported |
|
|
1598
|
+
| Contracts import | Imports from @contractspec/lib.contracts |
|
|
1599
|
+
| Schema import | Imports from @contractspec/lib.schema |
|
|
1600
|
+
| No \`any\` type | TypeScript strict compliance |
|
|
1601
|
+
| Error handling | Error codes are referenced |
|
|
1602
|
+
| Event emission | Event patterns exist |
|
|
1603
|
+
| Input validation | Validation patterns used |
|
|
1604
|
+
| Async patterns | Async/await for commands |
|
|
1605
|
+
|
|
1606
|
+
### Tier 2: Behavior (Comprehensive)
|
|
1607
|
+
|
|
1608
|
+
Checks implementation coverage of spec behaviors:
|
|
1609
|
+
|
|
1610
|
+
| Check | What it validates |
|
|
1611
|
+
|-------|------------------|
|
|
1612
|
+
| Scenario coverage | Acceptance scenarios implemented |
|
|
1613
|
+
| Example coverage | Example I/O values referenced |
|
|
1614
|
+
| Error cases | All error conditions handled |
|
|
1615
|
+
| Event conditions | Events emitted correctly |
|
|
1616
|
+
| Idempotency | Idempotent patterns (if required) |
|
|
1617
|
+
|
|
1618
|
+
### Tier 3: AI Review (Deep)
|
|
1619
|
+
|
|
1620
|
+
Uses LLM for semantic analysis:
|
|
1621
|
+
|
|
1622
|
+
- Does the implementation fulfill the spec's intent?
|
|
1623
|
+
- Are edge cases properly handled?
|
|
1624
|
+
- Is the code quality acceptable?
|
|
1625
|
+
- Are there any subtle violations?
|
|
1626
|
+
|
|
1627
|
+
Requires AI API key configuration.
|
|
1628
|
+
|
|
1629
|
+
## Running Verification
|
|
1630
|
+
|
|
1631
|
+
\`\`\`typescript
|
|
1632
|
+
const verifyService = createVerifyService({
|
|
1633
|
+
aiApiKey: process.env.ANTHROPIC_API_KEY, // Optional, for Tier 3
|
|
1634
|
+
aiProvider: 'anthropic',
|
|
1635
|
+
});
|
|
1636
|
+
|
|
1637
|
+
const result = await verifyService.verify(spec, implementationCode, {
|
|
1638
|
+
tiers: ['structure', 'behavior'],
|
|
1639
|
+
failFast: false,
|
|
1640
|
+
includeSuggestions: true,
|
|
1641
|
+
});
|
|
1642
|
+
|
|
1643
|
+
console.log(result.passed); // true/false
|
|
1644
|
+
console.log(result.score); // 0-100
|
|
1645
|
+
console.log(result.summary); // Human-readable summary
|
|
1646
|
+
\`\`\`
|
|
1647
|
+
|
|
1648
|
+
## Verification Report
|
|
1649
|
+
|
|
1650
|
+
The report includes:
|
|
1651
|
+
|
|
1652
|
+
- **passed**: Overall compliance
|
|
1653
|
+
- **score**: 0-100 score
|
|
1654
|
+
- **issues**: Array of problems found
|
|
1655
|
+
- **suggestions**: Recommended fixes
|
|
1656
|
+
- **coverage**: Metrics on scenario/error/field coverage
|
|
1657
|
+
|
|
1658
|
+
Each issue has:
|
|
1659
|
+
- **severity**: error, warning, or info
|
|
1660
|
+
- **category**: type, export, import, scenario, error_handling, semantic
|
|
1661
|
+
- **message**: Description of the issue
|
|
1662
|
+
- **suggestion**: How to fix it
|
|
1663
|
+
`}];D(P5);var M5=[{id:"docs.examples.pocket-family-office.goal",title:"Pocket Family Office — Goal",summary:"Secure personal finance automation combining documents and open banking.",kind:"goal",visibility:"public",route:"/docs/examples/pocket-family-office/goal",tags:["finance","goal"],body:`## Why it matters
|
|
1664
|
+
- Automate document ingestion (receipts, statements) and link to transactions.
|
|
1665
|
+
- Provides a "family office" grade overview for individuals.
|
|
1666
|
+
- Uses open banking for real-time data and AI for insights.
|
|
1667
|
+
|
|
1668
|
+
## Business/Product goal
|
|
1669
|
+
- Reduce manual data entry for personal finance.
|
|
1670
|
+
- Create a unified view of wealth and obligations.
|
|
1671
|
+
- Ensure privacy and security of sensitive financial data.
|
|
1672
|
+
|
|
1673
|
+
## Success criteria
|
|
1674
|
+
- Successful ingestion and classification of documents.
|
|
1675
|
+
- Accurate syncing of open banking data.
|
|
1676
|
+
- Generation of useful financial summaries.`},{id:"docs.examples.pocket-family-office.usage",title:"Pocket Family Office — Usage",summary:"How to deploy and use the personal finance automation template.",kind:"usage",visibility:"public",route:"/docs/examples/pocket-family-office/usage",tags:["finance","usage"],body:`## Setup
|
|
1677
|
+
1) Configure Open Banking credentials (e.g., using a provider mock or sandbox).
|
|
1678
|
+
2) internalize the 'pocket-family-office' feature into your workspace.
|
|
1679
|
+
3) Set up document storage buckets/paths.
|
|
1680
|
+
|
|
1681
|
+
## Core Flows
|
|
1682
|
+
1) **Ingest**: Upload PDF statements or email threads via the 'pfo.documents.upload' operation.
|
|
1683
|
+
2) **Sync**: Trigger 'sync-openbanking-transactions' workflow.
|
|
1684
|
+
3) **Analyze**: Run 'generate-financial-summary' for weekly/monthly insights.
|
|
1685
|
+
|
|
1686
|
+
## Guardrails
|
|
1687
|
+
- PII is redacted in summaries by default.
|
|
1688
|
+
- Read-only access to bank data (no write/payment initiation in this template).`},{id:"docs.examples.pocket-family-office.reference",title:"Pocket Family Office — Reference",summary:"Key components of the Pocket Family Office system.",kind:"reference",visibility:"public",route:"/docs/examples/pocket-family-office",tags:["finance","reference"],body:"## Workflows\n- `process-uploaded-document`: Extracts data from PDFs/Images.\n- `sync-openbanking-transactions`: Fetches latest transactions.\n- `generate-financial-summary`: AI-driven report generation.\n- `upcoming-payments-reminder`: Scans needed actions.\n\n## Operations\n- `pfo.documents.upload`: Secure upload endpoint for documents.\n\n## Capabilities\n- Requires: `identity`, `openbanking`.\n- Provides: `pocket-family-office`."}];D(M5);export{KW as uploadDocumentContract,AU as upcomingPaymentsReminderWorkflow,bU as syncOpenBankingTransactionsWorkflow,LU as syncOpenBankingAccountsWorkflow,SW as syncEmailThreadsContract,RW as schedulePaymentReminderContract,V5 as registerPocketFamilyOfficeBlueprint,SU as refreshOpenBankingBalancesWorkflow,PU as processUploadedDocumentWorkflow,D5 as pocketFamilyOfficeTenantSample,pU as pocketFamilyOfficeTelemetry,R5 as pocketFamilyOfficeKnowledgeSources,wU as pocketFamilyOfficeContracts,o6 as pocketFamilyOfficeConnections,f6 as pocketFamilyOfficeBlueprint,IU as ingestEmailThreadsWorkflow,I5 as getPocketFamilyOfficeConnection,jU as generateOpenBankingOverviewWorkflow,xW as generateOpenBankingOverviewContract,BU as generateFinancialSummaryWorkflow,bW as generateFinancialSummaryContract,uW as example,jW as dispatchFinancialSummaryContract,nU as PocketFamilyOfficeFeature,rU as OPENBANKING_SENSITIVE_FIELDS};
|