@stacksjs/database 0.68.0 → 0.68.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.
Files changed (2) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +10 -10
package/dist/index.js CHANGED
@@ -144,7 +144,7 @@ function moveProperties(source, destination, ignoreKeys) {
144
144
  }
145
145
  };`}function Wx(G){return`const REQUIRED = '${G.required}';
146
146
  const NOT_AN_OBJECT = '${G.object}';
147
- const NOT_AN_ARRAY = '${G.array}';`}var $x=Object.getPrototypeOf(async function(){}).constructor,SM=class{variablesCounter=0;#G;#J;#Y=new yg;constructor(G,J){this.#G=G,this.#J=J||{convertEmptyStringsToNull:!1}}#Z(){this.#Y.writeStatement(Wx({required:"value is required",object:"value is not a valid object",array:"value is not a valid array",...this.#J.messages})),this.#Y.writeStatement(Hx(this.#J)),this.#Y.writeStatement("let out;")}#X(){this.#Y.writeStatement(Yx()),this.#Y.writeStatement("return out;")}#W(){this.compileNode(this.#G.schema,this.#Y,{type:"root",variableName:"root",outputExpression:"out",fieldPathExpression:"out",wildCardPath:""})}#H(){return new $x("root","meta","refs","messagesProvider","errorReporter",this.#Y.toString())}createFieldFor(G,J){switch(J.type){case"array":return Gx(J);case"root":return tg(J);case"object":return Zx(G,this.variablesCounter,J);case"tuple":return Jx(G,J);case"record":return Xx(J)}}compileNode(G,J,Y,Z){switch(G.type){case"literal":return new eg(G,J,this,Y,Z).compile();case"array":return new lg(G,J,this,Y,Z).compile();case"record":return new ag(G,J,this,Y,Z).compile();case"object":return new ng(G,J,this,Y,Z).compile();case"tuple":return new mg(G,J,this,Y,Z).compile();case"union":return new dg(G,J,this,Y,Z).compile()}}compile(){this.#Z(),this.#W(),this.#X();let G=this.#H();return this.variablesCounter=0,this.#Y.flush(),G}};function wM(){let G=0,J={};return{toJSON(){return J},track(Y){G++;let Z=`ref://${G}`;return J[Z]=Y,Z},trackValidation(Y){return this.track(Y)},trackParser(Y){return this.track(Y)},trackTransformer(Y){return this.track(Y)},trackConditional(Y){return this.track(Y)}}}function K0(G,J){let Y={validator:G,isAsync:J?.isAsync||G.constructor.name==="AsyncFunction",implicit:J?.implicit??!1};return function(...Z){return{rule:Y,options:Z[0]}}}var pF={};$G(pF,{COTYPE:()=>Ux,IS_OF_TYPE:()=>e8,ITYPE:()=>Kx,OTYPE:()=>zx,PARSE:()=>y0,UNIQUE_NAME:()=>N8,VALIDATION:()=>C6});var N8=Symbol.for("schema_name"),e8=Symbol.for("is_of_type"),y0=Symbol.for("parse"),Kx=Symbol.for("opaque_input_type"),zx=Symbol.for("opaque_type"),Ux=Symbol.for("camelcase_opaque_type"),C6=Symbol.for("to_validation"),C9=K0((G,J,Y)=>{let Z=J(Y);if(!Y.isDefined&&Z)Y.report(H0.required,"required",Y)},{implicit:!0}),lG=class extends S9{optional(G){return new Qx(this,G)}nullable(){return new Vx(this)}transform(G){return new Mx(G,this)}},Vx=class G extends lG{#G;constructor(J){super();this.#G=J}clone(){return new G(this.#G.clone())}[y0](J,Y,Z){let X=this.#G[y0](J,Y,Z);return X.allowNull=!0,X}},Qx=class G extends lG{#G;validations;constructor(J,Y){super();this.#G=J,this.validations=Y||[]}cloneValidations(){return this.validations.map((J)=>{return{options:J.options,rule:J.rule}})}compileValidations(J){return this.validations.map((Y)=>{return{ruleFnId:J.track({validator:Y.rule.validator,options:Y.options}),implicit:Y.rule.implicit,isAsync:Y.rule.isAsync}})}use(J){return this.validations.push(C6 in J?J[C6]():J),this}requiredWhen(J,Y,Z){if(typeof J==="function")return this.use(C9(J));let X;switch(Y){case"=":X=(H)=>H===Z;break;case"!=":X=(H)=>H!==Z;break;case"in":X=(H)=>Z.includes(H);break;case"notIn":X=(H)=>!Z.includes(H);break;case">":X=(H)=>H>Z;break;case"<":X=(H)=>H<Z;break;case">=":X=(H)=>H>=Z;break;case"<=":X=(H)=>H<=Z}return this.use(C9((H)=>{let W=I0.getNestedValue(J,H);return X(W)}))}requiredIfExists(J){let Y=Array.isArray(J)?J:[J];return this.use(C9((Z)=>{return Y.every((X)=>I0.exists(I0.getNestedValue(X,Z)))}))}requiredIfAnyExists(J){return this.use(C9((Y)=>{return J.some((Z)=>I0.exists(I0.getNestedValue(Z,Y)))}))}requiredIfMissing(J){let Y=Array.isArray(J)?J:[J];return this.use(C9((Z)=>{return Y.every((X)=>I0.isMissing(I0.getNestedValue(X,Z)))}))}requiredIfAnyMissing(J){return this.use(C9((Y)=>{return J.some((Z)=>I0.isMissing(I0.getNestedValue(Z,Y)))}))}clone(){return new G(this.#G.clone(),this.cloneValidations())}[y0](J,Y,Z){let X=this.#G[y0](J,Y,Z);return X.isOptional=!0,X.validations=X.validations.concat(this.compileValidations(Y)),X}},Mx=class G extends lG{#G;#J;constructor(J,Y){super();this.#J=J,this.#G=Y}clone(){return new G(this.#J,this.#G.clone())}[y0](J,Y,Z){let X=this.#G[y0](J,Y,Z);return X.transformFnId=Y.trackTransformer(this.#J),X}},m4=class extends lG{options;validations;constructor(G,J){super();this.options={bail:!0,allowNull:!1,isOptional:!1,...G},this.validations=J||[]}cloneValidations(){return this.validations.map((G)=>{return{options:G.options,rule:G.rule}})}cloneOptions(){return{...this.options}}compileValidations(G){return this.validations.map((J)=>{return{ruleFnId:G.track({validator:J.rule.validator,options:J.options}),implicit:J.rule.implicit,isAsync:J.rule.isAsync}})}parse(G){return this.options.parse=G,this}use(G){return this.validations.push(C6 in G?G[C6]():G),this}bail(G){return this.options.bail=G,this}[y0](G,J,Y){return{type:"literal",fieldName:G,propertyName:Y.toCamelCase?d1(G):G,bail:this.options.bail,allowNull:this.options.allowNull,isOptional:this.options.isOptional,parseFnId:this.options.parse?J.trackParser(this.options.parse):void 0,validations:this.compileValidations(J)}}},dF=class G extends m4{constructor(J,Y){super(J,Y)}clone(){return new G(this.cloneOptions(),this.cloneValidations())}},cG=K0((G,J,Y)=>{let Z=typeof J.choices==="function"?J.choices(Y):J.choices;if(!Z.includes(G))Y.report(H0.enum,"enum",Y,{choices:Z})}),N9=class G extends m4{static rules={enum:cG};#G;getChoices(){return this.#G}constructor(J,Y,Z){super(Y,Z||[cG({choices:J})]);this.#G=J}clone(){return new G(this.#G,this.cloneOptions(),this.cloneValidations())}},N6=["YYYY-MM-DD","YYYY-MM-DD HH:mm:ss"];V1.default.extend(sF.default);V1.default.extend(aF.default);V1.default.extend(rF.default);var Fx=K0((G,J,Y)=>{if(typeof G!=="string"&&typeof G!=="number"){Y.report(H0.date,"date",Y);return}let Z=!1,X=J.formats||N6;if(Array.isArray(X))X=[...X],Z=X.includes("x");else if(typeof X!=="string")X={...X},Z=X.format==="x";let H=Z?I0.asNumber(G):G,W=Z&&!Number.isNaN(H)?V1.default(H):V1.default(G,X,!0);if(!W.isValid()){Y.report(H0.date,"date",Y);return}Y.meta.$value=W,Y.meta.$formats=X,Y.mutate(W.toDate(),Y)}),CM=K0((G,J,Y)=>{if(!Y.meta.$value)return;let Z=J.compare||"day",X=J.format||N6,H=Y.meta.$value,W=typeof J.expectedValue==="function"?J.expectedValue(Y):J.expectedValue,K=V1.default(W,X,!0);if(!K.isValid())throw new Error(`Invalid datetime value "${W}" value provided to the equals rule`);if(!H.isSame(K,Z))Y.report(H0["date.equals"],"date.equals",Y,{expectedValue:W,compare:Z})}),NM=K0((G,J,Y)=>{if(!Y.meta.$value)return;let Z=J.compare||"day",X=J.format||N6,H=Y.meta.$value,W=typeof J.expectedValue==="function"?J.expectedValue(Y):J.expectedValue,K=W==="today"?V1.default():W==="tomorrow"?V1.default().add(1,"day"):V1.default(W,X,!0);if(!K.isValid())throw new Error(`Invalid datetime value "${W}" value provided to the after rule`);if(!H.isAfter(K,Z))Y.report(H0["date.after"],"date.after",Y,{expectedValue:W,compare:Z})}),EM=K0((G,J,Y)=>{if(!Y.meta.$value)return;let Z=J.compare||"day",X=J.format||N6,H=Y.meta.$value,W=typeof J.expectedValue==="function"?J.expectedValue(Y):J.expectedValue,K=W==="today"?V1.default():W==="tomorrow"?V1.default().add(1,"day"):V1.default(W,X,!0);if(!K.isValid())throw new Error(`Invalid datetime value "${W}" value provided to the afterOrEqual rule`);if(!H.isSameOrAfter(K,Z))Y.report(H0["date.afterOrEqual"],"date.afterOrEqual",Y,{expectedValue:W,compare:Z})}),_M=K0((G,J,Y)=>{if(!Y.meta.$value)return;let Z=J.compare||"day",X=J.format||N6,H=Y.meta.$value,W=typeof J.expectedValue==="function"?J.expectedValue(Y):J.expectedValue,K=W==="today"?V1.default():W==="yesterday"?V1.default().subtract(1,"day"):V1.default(W,X,!0);if(!K.isValid())throw new Error(`Invalid datetime value "${W}" value provided to the before rule`);if(!H.isBefore(K,Z))Y.report(H0["date.before"],"date.before",Y,{expectedValue:W,compare:Z})}),kM=K0((G,J,Y)=>{if(!Y.meta.$value)return;let Z=J.compare||"day",X=J.format||N6,H=Y.meta.$value,W=typeof J.expectedValue==="function"?J.expectedValue(Y):J.expectedValue,K=W==="today"?V1.default():W==="yesterday"?V1.default().subtract(1,"day"):V1.default(W,X,!0);if(!K.isValid())throw new Error(`Invalid datetime value "${W}" value provided to the beforeOrEqual rule`);if(!H.isSameOrBefore(K,Z))Y.report(H0["date.beforeOrEqual"],"date.beforeOrEqual",Y,{expectedValue:W,compare:Z})}),bM=K0((G,J,Y)=>{if(!Y.meta.$value)return;let Z=J.compare||"day",X=Y.meta.$value,H=J.format||Y.meta.$formats,W=I0.getNestedValue(J.otherField,Y),K=V1.default(W,H,!0);if(!K.isValid())return;if(!X.isSame(K,Z))Y.report(H0["date.sameAs"],"date.sameAs",Y,{otherField:J.otherField,expectedValue:W,compare:Z})}),vM=K0((G,J,Y)=>{if(!Y.meta.$value)return;let Z=J.compare||"day",X=Y.meta.$value,H=J.format||Y.meta.$formats,W=I0.getNestedValue(J.otherField,Y),K=V1.default(W,H,!0);if(!K.isValid())return;if(X.isSame(K,Z))Y.report(H0["date.notSameAs"],"date.notSameAs",Y,{otherField:J.otherField,expectedValue:W,compare:Z})}),fM=K0((G,J,Y)=>{if(!Y.meta.$value)return;let Z=J.compare||"day",X=Y.meta.$value,H=J.format||Y.meta.$formats,W=I0.getNestedValue(J.otherField,Y),K=V1.default(W,H,!0);if(!K.isValid())return;if(!X.isAfter(K,Z))Y.report(H0["date.afterField"],"date.afterField",Y,{otherField:J.otherField,expectedValue:W,compare:Z})}),hM=K0((G,J,Y)=>{if(!Y.meta.$value)return;let Z=J.compare||"day",X=Y.meta.$value,H=J.format||Y.meta.$formats,W=I0.getNestedValue(J.otherField,Y),K=V1.default(W,H,!0);if(!K.isValid())return;if(!X.isSameOrAfter(K,Z))Y.report(H0["date.afterOrSameAs"],"date.afterOrSameAs",Y,{otherField:J.otherField,expectedValue:W,compare:Z})}),yM=K0((G,J,Y)=>{if(!Y.meta.$value)return;let Z=J.compare||"day",X=Y.meta.$value,H=J.format||Y.meta.$formats,W=I0.getNestedValue(J.otherField,Y),K=V1.default(W,H,!0);if(!K.isValid())return;if(!X.isBefore(K,Z))Y.report(H0["date.beforeField"],"date.beforeField",Y,{otherField:J.otherField,expectedValue:W,compare:Z})}),gM=K0((G,J,Y)=>{if(!Y.meta.$value)return;let Z=J.compare||"day",X=Y.meta.$value,H=J.format||Y.meta.$formats,W=I0.getNestedValue(J.otherField,Y),K=V1.default(W,H,!0);if(!K.isValid())return;if(!X.isSameOrBefore(K,Z))Y.report(H0["date.beforeOrSameAs"],"date.beforeOrSameAs",Y,{otherField:J.otherField,expectedValue:W,compare:Z})}),xM=K0((G,J,Y)=>{if(!Y.meta.$value)return;let X=Y.meta.$value.day();if(X!==0&&X!==6)Y.report(H0["date.weekend"],"date.weekend",Y)}),uM=K0((G,J,Y)=>{if(!Y.meta.$value)return;let X=Y.meta.$value.day();if(X===0||X===6)Y.report(H0["date.weekday"],"date.weekday",Y)}),xX=class G extends m4{static rules={equals:CM,after:NM,afterOrEqual:EM,before:_M,beforeOrEqual:kM,sameAs:bM,notSameAs:vM,afterField:fM,afterOrSameAs:hM,beforeField:yM,beforeOrSameAs:gM,weekend:xM,weekday:uM};[N8]="vine.date";[e8]=(J)=>{if(typeof J!=="string")return!1;return iF.default(J,this.options.formats||N6,!0).isValid()};constructor(J,Y){super(J,Y||[Fx(J||{})])}equals(J,Y){return this.use(CM({expectedValue:J,...Y}))}after(J,Y){return this.use(NM({expectedValue:J,...Y}))}afterOrEqual(J,Y){return this.use(EM({expectedValue:J,...Y}))}before(J,Y){return this.use(_M({expectedValue:J,...Y}))}beforeOrEqual(J,Y){return this.use(kM({expectedValue:J,...Y}))}sameAs(J,Y){return this.use(bM({otherField:J,...Y}))}notSameAs(J,Y){return this.use(vM({otherField:J,...Y}))}afterField(J,Y){return this.use(fM({otherField:J,...Y}))}afterOrSameAs(J,Y){return this.use(hM({otherField:J,...Y}))}beforeField(J,Y){return this.use(yM({otherField:J,...Y}))}beforeOrSameAs(J,Y){return this.use(gM({otherField:J,...Y}))}weekend(){return this.use(xM())}weekday(){return this.use(uM())}clone(){return new G(this.cloneOptions(),this.cloneValidations())}},nF=class G{#G;#J=(J,Y)=>{Y.report(H0.union,"union",Y)};constructor(J){this.#G=J}otherwise(J){return this.#J=J,this}clone(){let J=new G(this.#G);return J.otherwise(this.#J),J}[y0](J,Y,Z){return{type:"union",fieldName:J,propertyName:Z.toCamelCase?d1(J):J,elseConditionalFnRefId:Y.trackConditional(this.#J),conditions:this.#G.map((X)=>X[y0](J,Y,Z))}}},tF=class{#G;#J;constructor(G,J){this.#G=J,this.#J=G}[y0](G,J,Y){return{conditionalFnRefId:J.trackConditional(this.#J),schema:this.#G[y0](G,J,Y)}}};function uX(G){return new nF(G)}uX.if=function G(J,Y){return new tF(J,Y)};uX.else=function G(J){return new tF(()=>!0,J)};var O7=class extends S9{optional(){return new Ox(this)}nullable(){return new qx(this)}},qx=class G extends O7{#G;constructor(J){super();this.#G=J}clone(){return new G(this.#G.clone())}[y0](J,Y,Z){let X=this.#G[y0](J,Y,Z);if(X.type!=="union")X.allowNull=!0;return X}},Ox=class G extends O7{#G;constructor(J){super();this.#G=J}clone(){return new G(this.#G.clone())}[y0](J,Y,Z){let X=this.#G[y0](J,Y,Z);if(X.type!=="union")X.isOptional=!0;return X}},R7=class extends O7{options;validations;constructor(G,J){super();this.options=G||{bail:!0,allowNull:!1,isOptional:!1},this.validations=J||[]}cloneValidations(){return this.validations.map((G)=>{return{options:G.options,rule:G.rule}})}cloneOptions(){return{...this.options}}compileValidations(G){return this.validations.map((J)=>{return{ruleFnId:G.track({validator:J.rule.validator,options:J.options}),implicit:J.rule.implicit,isAsync:J.rule.isAsync}})}parse(G){return this.options.parse=G,this}use(G){return this.validations.push(C6 in G?G[C6]():G),this}bail(G){return this.options.bail=G,this}},oF=class G extends R7{#G;#J=!1;[N8]="vine.array";[e8]=(J)=>{return Array.isArray(J)};constructor(J,Y,Z){super(Y,Z);this.#G=J}allowUnknownProperties(){return this.#J=!0,this}clone(){let J=new G(this.#G.map((Y)=>Y.clone()),this.cloneOptions(),this.cloneValidations());if(this.#J)J.allowUnknownProperties();return J}[y0](J,Y,Z){return{type:"tuple",fieldName:J,propertyName:Z.toCamelCase?d1(J):J,bail:this.options.bail,allowNull:this.options.allowNull,isOptional:this.options.isOptional,allowUnknownProperties:this.#J,parseFnId:this.options.parse?Y.trackParser(this.options.parse):void 0,validations:this.compileValidations(Y),properties:this.#G.map((X,H)=>X[y0](String(H),Y,Z))}}},mM=K0((G,J,Y)=>{if(!Y.isValid)return;if(G.length<J.min)Y.report(H0["array.minLength"],"array.minLength",Y,J)}),cM=K0((G,J,Y)=>{if(!Y.isValid)return;if(G.length>J.max)Y.report(H0["array.maxLength"],"array.maxLength",Y,J)}),lM=K0((G,J,Y)=>{if(!Y.isValid)return;if(G.length!==J.size)Y.report(H0["array.fixedLength"],"array.fixedLength",Y,J)}),pM=K0((G,J,Y)=>{if(!Y.isValid)return;if(G.length<=0)Y.report(H0.notEmpty,"notEmpty",Y)}),dM=K0((G,J,Y)=>{if(!Y.isValid)return;if(!I0.isDistinct(G,J.fields))Y.report(H0.distinct,"distinct",Y,J)}),iM=K0((G,J,Y)=>{if(!Y.isValid)return;Y.mutate(G.filter((Z)=>I0.exists(Z)&&Z!==""),Y)}),eF=class G extends R7{static rules={compact:iM,notEmpty:pM,distinct:dM,minLength:mM,maxLength:cM,fixedLength:lM};#G;[N8]="vine.array";[e8]=(J)=>{return Array.isArray(J)};constructor(J,Y,Z){super(Y,Z);this.#G=J}minLength(J){return this.use(mM({min:J}))}maxLength(J){return this.use(cM({max:J}))}fixedLength(J){return this.use(lM({size:J}))}notEmpty(){return this.use(pM())}distinct(J){return this.use(dM({fields:J}))}compact(){return this.use(iM())}clone(){return new G(this.#G.clone(),this.cloneOptions(),this.cloneValidations())}[y0](J,Y,Z){return{type:"array",fieldName:J,propertyName:Z.toCamelCase?d1(J):J,bail:this.options.bail,allowNull:this.options.allowNull,isOptional:this.options.isOptional,each:this.#G[y0]("*",Y,Z),parseFnId:this.options.parse?Y.trackParser(this.options.parse):void 0,validations:this.compileValidations(Y)}}},Rx=class G extends O7{#G;[N8]="types.object";[e8]=(J)=>{return J!==null&&typeof J==="object"&&!Array.isArray(J)};constructor(J){super();this.#G=J}clone(){return new G(this.#G.clone())}[y0](J,Y,Z){return Z.toCamelCase=!0,this.#G[y0](J,Y,Z)}},Gq=class G extends R7{#G;#J=[];#Y=!1;[N8]="vine.object";[e8]=(J)=>{return J!==null&&typeof J==="object"&&!Array.isArray(J)};constructor(J,Y,Z){super(Y,Z);this.#G=J}getProperties(){return Object.keys(this.#G).reduce((J,Y)=>{return J[Y]=this.#G[Y].clone(),J},{})}allowUnknownProperties(){return this.#Y=!0,this}merge(J){return this.#J.push(J),this}clone(){let J=new G(this.getProperties(),this.cloneOptions(),this.cloneValidations());if(this.#J.forEach((Y)=>J.merge(Y)),this.#Y)J.allowUnknownProperties();return J}toCamelCase(){return new Rx(this)}[y0](J,Y,Z){return{type:"object",fieldName:J,propertyName:Z.toCamelCase?d1(J):J,bail:this.options.bail,allowNull:this.options.allowNull,isOptional:this.options.isOptional,parseFnId:this.options.parse?Y.trackParser(this.options.parse):void 0,allowUnknownProperties:this.#Y,validations:this.compileValidations(Y),properties:Object.keys(this.#G).map((X)=>{return this.#G[X][y0](X,Y,Z)}),groups:this.#J.map((X)=>{return X[y0](Y,Z)})}}},aM=K0((G,J,Y)=>{if(!Y.isValid)return;if(Object.keys(G).length<J.min)Y.report(H0["record.minLength"],"record.minLength",Y,J)}),rM=K0((G,J,Y)=>{if(!Y.isValid)return;if(Object.keys(G).length>J.max)Y.report(H0["record.maxLength"],"record.maxLength",Y,J)}),sM=K0((G,J,Y)=>{if(!Y.isValid)return;if(Object.keys(G).length!==J.size)Y.report(H0["record.fixedLength"],"record.fixedLength",Y,J)}),nM=K0((G,J,Y)=>{if(!Y.isValid)return;J(Object.keys(G),Y)}),Jq=class G extends R7{static rules={maxLength:rM,minLength:aM,fixedLength:sM,validateKeys:nM};#G;[N8]="vine.object";[e8]=(J)=>{return J!==null&&typeof J==="object"&&!Array.isArray(J)};constructor(J,Y,Z){super(Y,Z);this.#G=J}minLength(J){return this.use(aM({min:J}))}maxLength(J){return this.use(rM({max:J}))}fixedLength(J){return this.use(sM({size:J}))}validateKeys(...J){return this.use(nM(...J))}clone(){return new G(this.#G.clone(),this.cloneOptions(),this.cloneValidations())}[y0](J,Y,Z){return{type:"record",fieldName:J,propertyName:Z.toCamelCase?d1(J):J,bail:this.options.bail,allowNull:this.options.allowNull,isOptional:this.options.isOptional,each:this.#G[y0]("*",Y,Z),parseFnId:this.options.parse?Y.trackParser(this.options.parse):void 0,validations:this.compileValidations(Y)}}},tM=K0((G,J,Y)=>{if(typeof G!=="string")Y.report(H0.string,"string",Y)}),oM=K0((G,J,Y)=>{if(!Y.isValid)return;if(!I0.isEmail(G,J))Y.report(H0.email,"email",Y)}),eM=K0((G,J,Y)=>{if(!Y.isValid)return;let Z=J&&typeof J==="function"?J(Y):J,X=Z?.locale||"any";if(!I0.isMobilePhone(G,X,Z))Y.report(H0.mobile,"mobile",Y)}),GF=K0((G,J,Y)=>{if(!Y.isValid)return;if(!I0.isIP(G,J?.version))Y.report(H0.ipAddress,"ipAddress",Y)}),JF=K0((G,J,Y)=>{if(!Y.isValid)return;if(!J.test(G))Y.report(H0.regex,"regex",Y)}),YF=K0((G,J,Y)=>{if(!Y.isValid)return;if(!I0.isHexColor(G))Y.report(H0.hexCode,"hexCode",Y)}),ZF=K0((G,J,Y)=>{if(!Y.isValid)return;if(!I0.isURL(G,J))Y.report(H0.url,"url",Y)}),XF=K0(async(G,J,Y)=>{if(!Y.isValid)return;if(!await I0.isActiveURL(G))Y.report(H0.activeUrl,"activeUrl",Y)}),HF=K0((G,J,Y)=>{if(!Y.isValid)return;let Z="a-zA-Z";if(J){if(J.allowSpaces)Z+="\\s";if(J.allowDashes)Z+="-";if(J.allowUnderscores)Z+="_"}if(!new RegExp(`^[${Z}]+\$`).test(G))Y.report(H0.alpha,"alpha",Y)}),WF=K0((G,J,Y)=>{if(!Y.isValid)return;let Z="a-zA-Z0-9";if(J){if(J.allowSpaces)Z+="\\s";if(J.allowDashes)Z+="-";if(J.allowUnderscores)Z+="_"}if(!new RegExp(`^[${Z}]+\$`).test(G))Y.report(H0.alphaNumeric,"alphaNumeric",Y)}),$F=K0((G,J,Y)=>{if(!Y.isValid)return;if(G.length<J.min)Y.report(H0.minLength,"minLength",Y,J)}),KF=K0((G,J,Y)=>{if(!Y.isValid)return;if(G.length>J.max)Y.report(H0.maxLength,"maxLength",Y,J)}),zF=K0((G,J,Y)=>{if(!Y.isValid)return;if(G.length!==J.size)Y.report(H0.fixedLength,"fixedLength",Y,J)}),UF=K0((G,J,Y)=>{if(!Y.isValid)return;if(!G.endsWith(J.substring))Y.report(H0.endsWith,"endsWith",Y,J)}),VF=K0((G,J,Y)=>{if(!Y.isValid)return;if(!G.startsWith(J.substring))Y.report(H0.startsWith,"startsWith",Y,J)}),QF=K0((G,J,Y)=>{if(!Y.isValid)return;if(I0.getNestedValue(J.otherField,Y)!==G){Y.report(H0.sameAs,"sameAs",Y,J);return}}),MF=K0((G,J,Y)=>{if(!Y.isValid)return;if(I0.getNestedValue(J.otherField,Y)===G){Y.report(H0.notSameAs,"notSameAs",Y,J);return}}),FF=K0((G,J,Y)=>{if(!Y.isValid)return;let Z=J?.confirmationField||`${Y.name}_confirmation`;if(Y.parent[Z]!==G){Y.report(H0.confirmed,"confirmed",Y,{otherField:Z});return}}),qF=K0((G,J,Y)=>{if(!Y.isValid)return;Y.mutate(G.trim(),Y)}),OF=K0((G,J,Y)=>{if(!Y.isValid)return;Y.mutate(Zq.default.default(G,J),Y)}),RF=K0((G,J,Y)=>{if(!Y.isValid)return;Y.mutate(G.toLocaleUpperCase(J),Y)}),AF=K0((G,J,Y)=>{if(!Y.isValid)return;Y.mutate(G.toLocaleLowerCase(J),Y)}),IF=K0((G,J,Y)=>{if(!Y.isValid)return;Y.mutate(d1(G),Y)}),DF=K0((G,J,Y)=>{if(!Y.isValid)return;Y.mutate(Yq.default.default(G),Y)}),LF=K0((G,J,Y)=>{if(!Y.isValid)return;Y.mutate(fX(G,J),Y)}),jF=K0((G,J,Y)=>{if(!Y.isValid)return;if(!(typeof J.choices==="function"?J.choices(Y):J.choices).includes(G)){Y.report(H0.in,"in",Y,J);return}}),TF=K0((G,J,Y)=>{if(!Y.isValid)return;if((typeof J.list==="function"?J.list(Y):J.list).includes(G)){Y.report(H0.notIn,"notIn",Y,J);return}}),BF=K0((G,J,Y)=>{if(!Y.isValid)return;let Z=J?typeof J==="function"?J(Y)?.provider||[]:J.provider:[];if(!Z.length){if(!I0.isCreditCard(G))Y.report(H0.creditCard,"creditCard",Y,{providersList:"credit"})}else if(!Z.find((H)=>I0.isCreditCard(G,{provider:H})))Y.report(H0.creditCard,"creditCard",Y,{providers:Z,providersList:Z.join("/")})}),PF=K0((G,J,Y)=>{if(!Y.isValid)return;let Z=typeof J==="function"?J(Y).countryCode:J.countryCode;if(!Z.find((H)=>I0.isPassportNumber(G,H)))Y.report(H0.passport,"passport",Y,{countryCodes:Z})}),SF=K0((G,J,Y)=>{if(!Y.isValid)return;let Z=J?typeof J==="function"?J(Y)?.countryCode||[]:J.countryCode:[];if(!Z.length){if(!I0.isPostalCode(G,"any"))Y.report(H0.postalCode,"postalCode",Y)}else if(!Z.find((H)=>I0.isPostalCode(G,H)))Y.report(H0.postalCode,"postalCode",Y,{countryCodes:Z})}),wF=K0((G,J,Y)=>{if(!Y.isValid)return;if(!J||!J.version){if(!I0.isUUID(G))Y.report(H0.uuid,"uuid",Y)}else if(!J.version.find((X)=>I0.isUUID(G,X)))Y.report(H0.uuid,"uuid",Y,J)}),CF=K0((G,J,Y)=>{if(!Y.isValid)return;if(!I0.isAscii(G))Y.report(H0.ascii,"ascii",Y)}),NF=K0((G,J,Y)=>{if(!Y.isValid)return;if(!I0.isIBAN(G))Y.report(H0.iban,"iban",Y)}),EF=K0((G,J,Y)=>{if(!Y.isValid)return;if(!I0.isJWT(G))Y.report(H0.jwt,"jwt",Y)}),_F=K0((G,J,Y)=>{if(!Y.isValid)return;if(!I0.isLatLong(G))Y.report(H0.coordinates,"coordinates",Y)}),pG=class G extends m4{static rules={in:jF,jwt:EF,url:ZF,iban:NF,uuid:wF,trim:qF,email:oM,alpha:HF,ascii:CF,notIn:TF,regex:JF,escape:DF,sameAs:QF,mobile:eM,string:tM,hexCode:YF,passport:PF,endsWith:UF,confirmed:FF,activeUrl:XF,minLength:$F,notSameAs:MF,maxLength:KF,ipAddress:GF,creditCard:BF,postalCode:SF,startsWith:VF,toUpperCase:RF,toLowerCase:AF,toCamelCase:IF,fixedLength:zF,coordinates:_F,normalizeUrl:LF,alphaNumeric:WF,normalizeEmail:OF};[N8]="vine.string";[e8]=(J)=>{return typeof J==="string"};constructor(J,Y){super(J,Y||[tM()])}url(...J){return this.use(ZF(...J))}activeUrl(){return this.use(XF())}email(...J){return this.use(oM(...J))}mobile(...J){return this.use(eM(...J))}ipAddress(J){return this.use(GF(J?{version:J}:void 0))}hexCode(){return this.use(YF())}regex(J){return this.use(JF(J))}alpha(J){return this.use(HF(J))}alphaNumeric(J){return this.use(WF(J))}minLength(J){return this.use($F({min:J}))}maxLength(J){return this.use(KF({max:J}))}fixedLength(J){return this.use(zF({size:J}))}confirmed(J){return this.use(FF(J))}trim(){return this.use(qF())}normalizeEmail(J){return this.use(OF(J))}toUpperCase(){return this.use(RF())}toLowerCase(){return this.use(AF())}toCamelCase(){return this.use(IF())}escape(){return this.use(DF())}normalizeUrl(...J){return this.use(LF(...J))}startsWith(J){return this.use(VF({substring:J}))}endsWith(J){return this.use(UF({substring:J}))}sameAs(J){return this.use(QF({otherField:J}))}notSameAs(J){return this.use(MF({otherField:J}))}in(J){return this.use(jF({choices:J}))}notIn(J){return this.use(TF({list:J}))}creditCard(...J){return this.use(BF(...J))}passport(...J){return this.use(PF(...J))}postalCode(...J){return this.use(SF(...J))}uuid(...J){return this.use(wF(...J))}ascii(){return this.use(CF())}iban(){return this.use(NF())}jwt(){return this.use(EF())}coordinates(){return this.use(_F())}clone(){return new G(this.cloneOptions(),this.cloneValidations())}},kF=K0((G,J,Y)=>{let Z=J.strict?G:I0.asNumber(G);if(typeof Z!=="number"||Number.isNaN(Z)||Z===Number.POSITIVE_INFINITY||Z===Number.NEGATIVE_INFINITY){Y.report(H0.number,"number",Y);return}Y.mutate(Z,Y)}),bF=K0((G,J,Y)=>{if(!Y.isValid)return;if(G<J.min)Y.report(H0.min,"min",Y,J)}),vF=K0((G,J,Y)=>{if(!Y.isValid)return;if(G>J.max)Y.report(H0.max,"max",Y,J)}),fF=K0((G,J,Y)=>{if(!Y.isValid)return;if(G<J.min||G>J.max)Y.report(H0.range,"range",Y,J)}),hF=K0((G,J,Y)=>{if(!Y.isValid)return;if(G<0)Y.report(H0.positive,"positive",Y)}),yF=K0((G,J,Y)=>{if(!Y.isValid)return;if(G>=0)Y.report(H0.negative,"negative",Y)}),gF=K0((G,J,Y)=>{if(!Y.isValid)return;if(!I0.isDecimal(String(G),{force_decimal:J.range[0]!==0,decimal_digits:J.range.join(",")}))Y.report(H0.decimal,"decimal",Y,{digits:J.range.join("-")})}),xF=K0((G,J,Y)=>{if(!Y.isValid)return;if(!Number.isInteger(G))Y.report(H0.withoutDecimals,"withoutDecimals",Y)}),uF=K0((G,J,Y)=>{if(!Y.isValid)return;if(!J.values.includes(G))Y.report(H0["number.in"],"in",Y,J)}),E9=class G extends m4{static rules={in:uF,max:vF,min:bF,range:fF,number:kF,decimal:gF,negative:yF,positive:hF,withoutDecimals:xF};[N8]="vine.number";[e8]=(J)=>{let Y=I0.asNumber(J);return!Number.isNaN(Y)};constructor(J,Y){super(J,Y||[kF(J||{})])}min(J){return this.use(bF({min:J}))}max(J){return this.use(vF({max:J}))}range(J){return this.use(fF({min:J[0],max:J[1]}))}positive(){return this.use(hF())}negative(){return this.use(yF())}decimal(J){return this.use(gF({range:Array.isArray(J)?J:[J]}))}withoutDecimals(){return this.use(xF())}clone(){return new G(this.cloneOptions(),this.cloneValidations())}in(J){return this.use(uF({values:J}))}},mF=K0((G,J,Y)=>{let Z=J.strict===!0?G:I0.asBoolean(G);if(typeof Z!=="boolean"){Y.report(H0.boolean,"boolean",Y);return}Y.mutate(Z,Y)}),_9=class G extends m4{static rules={boolean:mF};[N8]="vine.boolean";[e8]=(J)=>{return typeof(this.options.strict===!0?J:I0.asBoolean(J))==="boolean"};constructor(J,Y){super(J,Y||[mF(J||{})])}clone(){return new G(this.cloneOptions(),this.cloneValidations())}},cF=K0((G,J,Y)=>{let Z=G;if(typeof J.expectedValue==="boolean")Z=I0.asBoolean(G);else if(typeof J.expectedValue==="number")Z=I0.asNumber(G);if(Z!==J.expectedValue){Y.report(H0.literal,"literal",Y,J);return}Y.mutate(Z,Y)}),Xq=class G extends m4{static rules={equals:cF};#G;constructor(J,Y,Z){super(Y,Z||[cF({expectedValue:J})]);this.#G=J}clone(){return new G(this.#G,this.cloneOptions(),this.cloneValidations())}},Ax=["on","1","yes","true",!0,1],lF=K0((G,J,Y)=>{if(!Ax.includes(G))Y.report(H0.accepted,"accepted",Y)}),Hq=class G extends m4{static rules={accepted:lF};constructor(J,Y){super(J,Y||[lF()])}clone(){return new G(this.cloneOptions(),this.cloneValidations())}},Ix=class G{#G;#J=(J,Y)=>{Y.report(H0.unionGroup,"unionGroup",Y)};constructor(J){this.#G=J}clone(){let J=new G(this.#G);return J.otherwise(this.#J),J}otherwise(J){return this.#J=J,this}[y0](J,Y){return{type:"group",elseConditionalFnRefId:J.trackConditional(this.#J),conditions:this.#G.map((Z)=>Z[y0](J,Y))}}},Wq=class{#G;#J;constructor(G,J){this.#G=J,this.#J=G}[y0](G,J){return{schema:{type:"sub_object",properties:Object.keys(this.#G).map((Y)=>{return this.#G[Y][y0](Y,G,J)}),groups:[]},conditionalFnRefId:G.trackConditional(this.#J)}}};function mX(G){return new Ix(G)}mX.if=function G(J,Y){return new Wq(J,Y)};mX.else=function G(J){return new Wq(()=>!0,J)};var Dx=class G extends m4{static rules={enum:cG};#G;constructor(J,Y,Z){super(Y,Z||[cG({choices:Object.values(J)})]);this.#G=J}clone(){return new G(this.#G,this.cloneOptions(),this.cloneValidations())}},Lx=class G{#G;#J=(J,Y)=>{Y.report(H0.unionOfTypes,"unionOfTypes",Y)};constructor(J){this.#G=J}otherwise(J){return this.#J=J,this}clone(){let J=new G(this.#G);return J.otherwise(this.#J),J}[y0](J,Y,Z){return{type:"union",fieldName:J,propertyName:Z.toCamelCase?d1(J):J,elseConditionalFnRefId:Y.trackConditional(this.#J),conditions:this.#G.map((X)=>{return{conditionalFnRefId:Y.trackConditional((H,W)=>{return X[e8](H,W)}),schema:X[y0](J,Y,Z)}})}}},jx=class extends S9{group=mX;union=uX;string(){return new pG}boolean(G){return new _9(G)}accepted(){return new Hq}number(G){return new E9(G)}date(G){return new xX(G)}literal(G){return new Xq(G)}object(G){return new Gq(G)}array(G){return new eF(G)}tuple(G){return new oF(G)}record(G){return new Jq(G)}enum(G){if(Array.isArray(G)||typeof G==="function")return new N9(G);return new Dx(G)}any(){return new dF}unionOfTypes(G){let J=new Set;return G.forEach((Y)=>{if(!Y[e8]||!Y[N8])throw new Error(`Cannot use "${Y.constructor.name}". The schema type is not compatible for use with "vine.unionOfTypes"`);if(J.has(Y[N8]))throw new Error(`Cannot use duplicate schema "${Y[N8]}". "vine.unionOfTypes" needs distinct schema types only`);J.add(Y[N8])}),J.clear(),new Lx(G)}},Tx={required:H0.required,array:H0.array,object:H0.object},gX=class{#G;messagesProvider;errorReporter;#J(G){let J=wM();return{compilerNode:{type:"root",schema:G[y0]("",J,{toCamelCase:!1})},refs:J.toJSON()}}constructor(G,J){let{compilerNode:Y,refs:Z}=this.#J(G);this.#G={schema:Y,refs:Z};let X=J.metaDataValidator,H=new SM(Y,{convertEmptyStringsToNull:J.convertEmptyStringsToNull,messages:Tx}).compile();if(this.errorReporter=J.errorReporter,this.messagesProvider=J.messagesProvider,X)this.validate=(W,K)=>{let z=K??{},U=z.meta??{},V=z.errorReporter??this.errorReporter,M=z.messagesProvider??this.messagesProvider;return X(U),H(W,U,Z,M,V())};else this.validate=(W,K)=>{let z=K??{},U=z.meta??{},V=z.errorReporter??this.errorReporter,M=z.messagesProvider??this.messagesProvider;return H(W,U,Z,M,V())}}async tryValidate(G,...[J]){try{return[null,await this.validate(G,J)]}catch(Y){if(Y instanceof jX)return[Y,null];throw Y}}toJSON(){let{schema:G,refs:J}=this.#G;return{schema:structuredClone(G),refs:J}}},$q=class extends jx{messagesProvider=new Q7(H0,rV);errorReporter=()=>new TX;convertEmptyStringsToNull=!1;helpers=I0;createRule=K0;compile(G){return new gX(G,{convertEmptyStringsToNull:this.convertEmptyStringsToNull,messagesProvider:this.messagesProvider,errorReporter:this.errorReporter})}withMetaData(G){return{compile:(J)=>{return new gX(J,{convertEmptyStringsToNull:this.convertEmptyStringsToNull,messagesProvider:this.messagesProvider,errorReporter:this.errorReporter,metaDataValidator:G})}}}validate(G){return this.compile(G.schema).validate(G.data,G)}tryValidate(G){return this.compile(G.schema).tryValidate(G.data,G)}},Bx=new $q,O0=Bx;import{path as Ov1}from"@stacksjs/path";import{snakeCase as Av1}from"@stacksjs/strings";class cX{static isTestEnvironment=!1;static shouldExitProcess=!0;static handle(G,J){if(this.shouldExitProcess=J?.shouldExit!==!1,J?.silent!==!0)this.writeErrorToConsole(G);let Y;if(J?.message)Y=J.message;else if(G instanceof Error)Y=G.message;else if(typeof G==="string")Y=G;else Y=JSON.stringify(G);let Z=new Error(Y);if(G instanceof Error)Object.assign(Z,G);return this.writeErrorToFile(Z).catch((X)=>console.error(X)),Z}static handleError(G,J){return this.handle(G,J),G}static async writeErrorToFile(G){if(!(G instanceof Error)){console.error("Error is not an instance of Error:",G);return}let J=`[${new Date().toISOString()}] ${G.name}: ${G.message}\n`,Y=A7.logsPath("stacks.log")??A7.logsPath("errors.log");try{await Uq(A7.dirname(Y),{recursive:!0}),await zq(Y,J)}catch(Z){console.error("Failed to write to error file:",Z)}}static writeErrorToConsole(G){console.error(G);let J=typeof G==="string"?G:G instanceof Error?G.message:JSON.stringify(G);if(J.includes("bunx --bun cdk destroy")||J===`Failed to execute command: ${Kq("bunx --bun eslint . --fix")}`||J===`Failed to execute command: ${Kq("bun storage/framework/core/actions/src/lint/fix.ts")}`){if(!this.isTestEnvironment)console.log("No need to worry. The edge function is currently being destroyed. Please run `buddy undeploy` shortly again, and continue doing so until it succeeds running."),console.log("Hoping to see you back soon!")}if(this.shouldExitProcess)wx.exit(1)}}function k9(G,J){let Y;if(WG(G))Y=G;else if(G instanceof Error)Y=G.message;else if(J instanceof Error)Y=J.message;else Y=String(G);return Ex(`ERROR: ${Cx(Y)}`),cX.handle(G,J)}async function Ex(G,J){let Y=`[${new Date().toISOString()}] ${G}\n`;try{let Z=J?.logFile??Nx.logging.logsPath??"storage/logs/stacks.log";try{await Px(Z)}catch{console.log("Creating log file directory...",Z),await Uq(Sx(Z),{recursive:!0})}await zq(Z,Y)}catch(Z){console.error("Failed to write to log file:",Z)}}var _x={withStackTrace:!1},Mq=(G,J,Y=_x)=>{let Z=J.isOk()?{type:"Ok",value:J.value}:{type:"Err",value:J.error},X=Y.withStackTrace?new Error().stack:void 0;return{data:Z,message:G,stack:X}};function b9(G,J,Y,Z){function X(H){return H instanceof Y?H:new Y(function(W){W(H)})}return new(Y||(Y=Promise))(function(H,W){function K(V){try{U(Z.next(V))}catch(M){W(M)}}function z(V){try{U(Z.throw(V))}catch(M){W(M)}}function U(V){V.done?H(V.value):X(V.value).then(K,z)}U((Z=Z.apply(G,J||[])).next())})}function Vq(G){var J=typeof Symbol==="function"&&Symbol.iterator,Y=J&&G[J],Z=0;if(Y)return Y.call(G);if(G&&typeof G.length==="number")return{next:function(){if(G&&Z>=G.length)G=void 0;return{value:G&&G[Z++],done:!G}}};throw new TypeError(J?"Object is not iterable.":"Symbol.iterator is not defined.")}function c4(G){return this instanceof c4?(this.v=G,this):new c4(G)}function Qq(G,J,Y){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var Z=Y.apply(G,J||[]),X,H=[];return X=Object.create((typeof AsyncIterator==="function"?AsyncIterator:Object).prototype),K("next"),K("throw"),K("return",W),X[Symbol.asyncIterator]=function(){return this},X;function W(A){return function(R){return Promise.resolve(R).then(A,M)}}function K(A,R){if(Z[A]){if(X[A]=function(w){return new Promise(function(C,D){H.push([A,w,C,D])>1||z(A,w)})},R)X[A]=R(X[A])}}function z(A,R){try{U(Z[A](R))}catch(w){O(H[0][3],w)}}function U(A){A.value instanceof c4?Promise.resolve(A.value.v).then(V,M):O(H[0][2],A)}function V(A){z("next",A)}function M(A){z("throw",A)}function O(A,R){if(A(R),H.shift(),H.length)z(H[0][0],H[0][1])}}function kx(G){var J,Y;return J={},Z("next"),Z("throw",function(X){throw X}),Z("return"),J[Symbol.iterator]=function(){return this},J;function Z(X,H){J[X]=G[X]?function(W){return(Y=!Y)?{value:c4(G[X](W)),done:!1}:H?H(W):W}:H}}function bx(G){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var J=G[Symbol.asyncIterator],Y;return J?J.call(G):(G=typeof Vq==="function"?Vq(G):G[Symbol.iterator](),Y={},Z("next"),Z("throw"),Z("return"),Y[Symbol.asyncIterator]=function(){return this},Y);function Z(H){Y[H]=G[H]&&function(W){return new Promise(function(K,z){W=G[H](W),X(K,z,W.done,W.value)})}}function X(H,W,K,z){Promise.resolve(z).then(function(U){H({value:U,done:K})},W)}}class h1{constructor(G){this._promise=G}static fromSafePromise(G){let J=G.then((Y)=>new B4(Y));return new h1(J)}static fromPromise(G,J){let Y=G.then((Z)=>new B4(Z)).catch((Z)=>new G4(J(Z)));return new h1(Y)}static fromThrowable(G,J){return(...Y)=>{return new h1((()=>b9(this,void 0,void 0,function*(){try{return new B4(yield G(...Y))}catch(Z){return new G4(J?J(Z):Z)}}))())}}static combine(G){return hx(G)}static combineWithAllErrors(G){return yx(G)}map(G){return new h1(this._promise.then((J)=>b9(this,void 0,void 0,function*(){if(J.isErr())return new G4(J.error);return new B4(yield G(J.value))})))}andThrough(G){return new h1(this._promise.then((J)=>b9(this,void 0,void 0,function*(){if(J.isErr())return new G4(J.error);let Y=yield G(J.value);if(Y.isErr())return new G4(Y.error);return new B4(J.value)})))}andTee(G){return new h1(this._promise.then((J)=>b9(this,void 0,void 0,function*(){if(J.isErr())return new G4(J.error);try{yield G(J.value)}catch(Y){}return new B4(J.value)})))}mapErr(G){return new h1(this._promise.then((J)=>b9(this,void 0,void 0,function*(){if(J.isOk())return new B4(J.value);return new G4(yield G(J.error))})))}andThen(G){return new h1(this._promise.then((J)=>{if(J.isErr())return new G4(J.error);let Y=G(J.value);return Y instanceof h1?Y._promise:Y}))}orElse(G){return new h1(this._promise.then((J)=>b9(this,void 0,void 0,function*(){if(J.isErr())return G(J.error);return new B4(J.value)})))}match(G,J){return this._promise.then((Y)=>Y.match(G,J))}unwrapOr(G){return this._promise.then((J)=>J.unwrapOr(G))}safeUnwrap(){return Qq(this,arguments,function*G(){return yield c4(yield c4(yield*kx(bx(yield c4(this._promise.then((J)=>J.safeUnwrap()))))))})}then(G,J){return this._promise.then(G,J)}[Symbol.asyncIterator](){return Qq(this,arguments,function*G(){let J=yield c4(this._promise);if(J.isErr())yield yield c4(I7(J.error));return yield c4(J.value)})}}var I7=(G)=>new h1(Promise.resolve(new G4(G))),vx=h1.fromPromise,fx=h1.fromSafePromise,mv1=h1.fromThrowable,Fq=(G)=>{let J=y1([]);for(let Y of G)if(Y.isErr()){J=E8(Y.error);break}else J.map((Z)=>Z.push(Y.value));return J},hx=(G)=>h1.fromSafePromise(Promise.all(G)).andThen(Fq),qq=(G)=>{let J=y1([]);for(let Y of G)if(Y.isErr()&&J.isErr())J.error.push(Y.error);else if(Y.isErr()&&J.isOk())J=E8([Y.error]);else if(Y.isOk()&&J.isOk())J.value.push(Y.value);return J},yx=(G)=>h1.fromSafePromise(Promise.all(G)).andThen(qq),dG;(function(G){function J(X,H){return(...W)=>{try{let K=X(...W);return y1(K)}catch(K){return E8(H?H(K):K)}}}G.fromThrowable=J;function Y(X){return Fq(X)}G.combine=Y;function Z(X){return qq(X)}G.combineWithAllErrors=Z})(dG||(dG={}));var y1=(G)=>new B4(G);function E8(G){return new G4(G)}class B4{constructor(G){this.value=G}isOk(){return!0}isErr(){return!this.isOk()}map(G){return y1(G(this.value))}mapErr(G){return y1(this.value)}andThen(G){return G(this.value)}andThrough(G){return G(this.value).map((J)=>this.value)}andTee(G){try{G(this.value)}catch(J){}return y1(this.value)}orElse(G){return y1(this.value)}asyncAndThen(G){return G(this.value)}asyncAndThrough(G){return G(this.value).map(()=>this.value)}asyncMap(G){return h1.fromSafePromise(G(this.value))}unwrapOr(G){return this.value}match(G,J){return G(this.value)}safeUnwrap(){let G=this.value;return function*(){return G}()}_unsafeUnwrap(G){return this.value}_unsafeUnwrapErr(G){throw Mq("Called `_unsafeUnwrapErr` on an Ok",this,G)}*[Symbol.iterator](){return this.value}}class G4{constructor(G){this.error=G}isOk(){return!1}isErr(){return!this.isOk()}map(G){return E8(this.error)}mapErr(G){return E8(G(this.error))}andThrough(G){return E8(this.error)}andTee(G){return E8(this.error)}andThen(G){return E8(this.error)}orElse(G){return G(this.error)}asyncAndThen(G){return I7(this.error)}asyncAndThrough(G){return I7(this.error)}asyncMap(G){return I7(this.error)}unwrapOr(G){return G}match(G,J){return J(this.error)}safeUnwrap(){let G=this.error;return function*(){throw yield E8(G),new Error("Do not use this generator out of `safeTry`")}()}_unsafeUnwrap(G){throw Mq("Called `_unsafeUnwrap` on an Err",this,G)}_unsafeUnwrapErr(G){return this.error}*[Symbol.iterator](){let G=this;return yield G,G}}var gx=dG.fromThrowable;import{bold as Kc1,dim as zc1,green as Uc1,italic as Vc1,log as Qc1}from"@stacksjs/cli";import{path as Fc1}from"@stacksjs/path";import{fs as Oc1,glob as Rc1}from"@stacksjs/storage";var pP=k0(qW(),1),dP=k0(kJ(),1),iP=k0(r7(),1);import{italic as jc1,log as Tc1}from"@stacksjs/cli";import{path as H3}from"@stacksjs/path";import{fs as am0,globSync as rm0}from"@stacksjs/storage";import{pascalCase as Cc1,plural as KY,singular as sm0,snakeCase as aP}from"@stacksjs/strings";async function rP(G){if(typeof G==="string")G=(await import(G)).default;return G.table??aP(KY(G?.name||""))}function P2(G,J){if(G.name)return G.name;return H3.basename(J).replace(/\.ts$/,"")}function i1(G,J){if(G.table)return G.table;return aP(KY(P2(G,J)))}function nm0(G,J){let Y=[G,J];return Y.sort(),Y[0]=sm0(Y[0]||""),Y.join("_")}function tm0(G,J){return J in G}async function om0(G,J){let Y=["hasOne","belongsTo","hasMany","belongsToMany","hasOneThrough"],Z=[];for(let X of Y)if(tm0(G,X))for(let H of G[X]||[]){let W=H.model,K;if(WG(H))W=H;let z=H3.userModelsPath(`${W}.ts`),U=H3.storagePath(`framework/database/models/generated/${W}.ts`);if(am0.existsSync(z))K=(await import(z)).default;else K=(await import(U)).default;let V=i1(K,z),M=P2(K,z),O=J.toLowerCase(),A=M.toLowerCase();Z.push({relationship:X,model:W,table:V,foreignKey:H.foreignKey||`${O}_id`,modelKey:`${A}_id`,relationName:H.relationName||"",throughModel:H.through||"",throughForeignKey:H.throughForeignKey||"",pivotTable:H?.pivotTable||nm0(KY(O),KY(K.table||""))})}return Z}async function S2(G,J){let Y=[];if("belongsToMany"in G){let Z=G.belongsToMany||[];for(let X of Z){let W=(await import(H3.userModelsPath(`${X}.ts`))).default,K=P2(G,J),z=K.toLowerCase(),U=typeof X==="object"&&"firstForeignKey"in X?X.firstForeignKey:`${K.toLowerCase()}_${G.primaryKey}`,V=typeof X==="object"&&"secondForeignKey"in X?X.secondForeignKey:`${W.name?.toLowerCase()}_${G.primaryKey}`;Y.push({table:(typeof X==="object"&&"pivotTable"in X?X.pivotTable:void 0)??`${z}_${W.table}`,firstForeignKey:U,secondForeignKey:V})}return Y}return[]}async function X6(G){let J=rm0([H3.userModelsPath("*.ts")],{absolute:!0}),Y=[];for(let Z=0;Z<J.length;Z++){let X=J[Z],H=await import(X);if(G===H.default.name)continue;let W=P2(H,X),K=await om0(H.default,W);if(!K.length)continue;let z=K.find((U)=>U.model===G);if(z)Y.push(z)}return Y}import{path as i$}from"@stacksjs/path";import{fs as Bc0,globSync as Pc0}from"@stacksjs/storage";import{plural as Sc0,snakeCase as wc0}from"@stacksjs/strings";import{italic as sP,log as N4}from"@stacksjs/cli";import{path as K4}from"@stacksjs/path";import{fs as W3,globSync as em0}from"@stacksjs/storage";import{snakeCase as $3}from"@stacksjs/strings";async function nP(){let G=await VY();for(let X of G)await c0.schema.dropTable(X).ifExists().execute();await c0.schema.dropTable("migrations").ifExists().execute(),await c0.schema.dropTable("migration_locks").ifExists().execute(),await c0.schema.dropTable("migrations").ifExists().execute();let J=await W3.readdir(K4.userMigrationsPath()),Y=await W3.readdir(K4.frameworkPath("database/models")),Z=em0([K4.userModelsPath("*.ts")],{absolute:!0});for(let X of Z){let H=(await import(X)).default,W=await S2(H,X);for(let K of W)await c0.schema.dropTable(K.table).ifExists().execute()}if(Y.length){for(let X of Y)if(X.endsWith(".ts")){let H=K4.frameworkPath(`database/models/${X}`);if(W3.existsSync(H))await Bun.$`rm ${H}`}}if(J.length){for(let X of J)if(X.endsWith(".ts")){let H=K4.userMigrationsPath(`${X}`);if(W3.existsSync(H))await Bun.$`rm ${H}`}}return y1("All tables dropped successfully!")}async function tP(G){let J=(await import(G)).default,Y=K4.basename(G),Z=i1(J,G),X=JSON.stringify(J.attributes,null,2),H=K4.frameworkPath(`database/models/${Y}`),W=!1;if(W3.existsSync(H)){N4.info(`Fields have already been generated for ${Z}`);let z=await n4(Y);if(JSON.stringify(z,null,2)===X){N4.debug(`Fields have not changed for ${Z}`);return}W=!0,N4.debug(`Fields have changed for ${Z}`)}else N4.debug(`Fields have not been generated for ${Z}`);await Bun.$`cp ${G} ${H}`;let K=await z4(Z);if(N4.debug(`Has ${Z} been migrated? ${K}`),W)await Xc0(G);else await Gc0(G)}async function Gc0(G){N4.debug("createTableMigration modelPath:",G);let J=(await import(G)).default,Y=i1(J,G),Z=J.traits?.useAuth&&typeof J.traits.useAuth!=="boolean"?J.traits.useAuth.useTwoFactor:!1;await Zc0(J,G);let X=await X6(J,G),H=J?.traits?.useTimestamps??J?.traits?.timestampable??!0,W=J?.traits?.useSoftDeletes??J?.traits?.softDeletable??!1,K=(typeof J.traits?.useAuth==="object"&&J.traits.useAuth.usePasskey)??!1,z=J.traits?.billable||!1;if(K)await Jc0();if(K)await Yc0();let U="import type { Database } from '@stacksjs/database'\n";U+="import { sql } from '@stacksjs/database'\n\n",U+="export async function up(db: Database<any>) {\n",U+=" await db.schema\n",U+=` .createTable('${Y}')\n`,U+=" .addColumn('id', 'integer', col => col.primaryKey().autoIncrement())\n";for(let[A,R]of H6(J.attributes)){let w=R,C=$3(A),D=w2(w.validation?.rule);if(U+=` .addColumn('${C}', ${D}`,w.unique||w?.required){if(U+=", col => col",w.unique)U+=".unique()";if(w?.required)U+=".notNull()";U+=""}U+=")\n"}if(Z!==!1&&Z)U+=" .addColumn('two_factor_secret', 'varchar(255)')\n";if(z)U+=" .addColumn('stripe_id', 'varchar(255)')\n";if(X?.length)for(let A of X)U+=` .addColumn('${A.foreignKey}', 'integer', (col) =>
147
+ const NOT_AN_ARRAY = '${G.array}';`}var $x=Object.getPrototypeOf(async function(){}).constructor,SM=class{variablesCounter=0;#G;#J;#Y=new yg;constructor(G,J){this.#G=G,this.#J=J||{convertEmptyStringsToNull:!1}}#Z(){this.#Y.writeStatement(Wx({required:"value is required",object:"value is not a valid object",array:"value is not a valid array",...this.#J.messages})),this.#Y.writeStatement(Hx(this.#J)),this.#Y.writeStatement("let out;")}#X(){this.#Y.writeStatement(Yx()),this.#Y.writeStatement("return out;")}#W(){this.compileNode(this.#G.schema,this.#Y,{type:"root",variableName:"root",outputExpression:"out",fieldPathExpression:"out",wildCardPath:""})}#H(){return new $x("root","meta","refs","messagesProvider","errorReporter",this.#Y.toString())}createFieldFor(G,J){switch(J.type){case"array":return Gx(J);case"root":return tg(J);case"object":return Zx(G,this.variablesCounter,J);case"tuple":return Jx(G,J);case"record":return Xx(J)}}compileNode(G,J,Y,Z){switch(G.type){case"literal":return new eg(G,J,this,Y,Z).compile();case"array":return new lg(G,J,this,Y,Z).compile();case"record":return new ag(G,J,this,Y,Z).compile();case"object":return new ng(G,J,this,Y,Z).compile();case"tuple":return new mg(G,J,this,Y,Z).compile();case"union":return new dg(G,J,this,Y,Z).compile()}}compile(){this.#Z(),this.#W(),this.#X();let G=this.#H();return this.variablesCounter=0,this.#Y.flush(),G}};function wM(){let G=0,J={};return{toJSON(){return J},track(Y){G++;let Z=`ref://${G}`;return J[Z]=Y,Z},trackValidation(Y){return this.track(Y)},trackParser(Y){return this.track(Y)},trackTransformer(Y){return this.track(Y)},trackConditional(Y){return this.track(Y)}}}function K0(G,J){let Y={validator:G,isAsync:J?.isAsync||G.constructor.name==="AsyncFunction",implicit:J?.implicit??!1};return function(...Z){return{rule:Y,options:Z[0]}}}var pF={};$G(pF,{COTYPE:()=>Ux,IS_OF_TYPE:()=>e8,ITYPE:()=>Kx,OTYPE:()=>zx,PARSE:()=>y0,UNIQUE_NAME:()=>N8,VALIDATION:()=>C6});var N8=Symbol.for("schema_name"),e8=Symbol.for("is_of_type"),y0=Symbol.for("parse"),Kx=Symbol.for("opaque_input_type"),zx=Symbol.for("opaque_type"),Ux=Symbol.for("camelcase_opaque_type"),C6=Symbol.for("to_validation"),C9=K0((G,J,Y)=>{let Z=J(Y);if(!Y.isDefined&&Z)Y.report(H0.required,"required",Y)},{implicit:!0}),lG=class extends S9{optional(G){return new Qx(this,G)}nullable(){return new Vx(this)}transform(G){return new Mx(G,this)}},Vx=class G extends lG{#G;constructor(J){super();this.#G=J}clone(){return new G(this.#G.clone())}[y0](J,Y,Z){let X=this.#G[y0](J,Y,Z);return X.allowNull=!0,X}},Qx=class G extends lG{#G;validations;constructor(J,Y){super();this.#G=J,this.validations=Y||[]}cloneValidations(){return this.validations.map((J)=>{return{options:J.options,rule:J.rule}})}compileValidations(J){return this.validations.map((Y)=>{return{ruleFnId:J.track({validator:Y.rule.validator,options:Y.options}),implicit:Y.rule.implicit,isAsync:Y.rule.isAsync}})}use(J){return this.validations.push(C6 in J?J[C6]():J),this}requiredWhen(J,Y,Z){if(typeof J==="function")return this.use(C9(J));let X;switch(Y){case"=":X=(H)=>H===Z;break;case"!=":X=(H)=>H!==Z;break;case"in":X=(H)=>Z.includes(H);break;case"notIn":X=(H)=>!Z.includes(H);break;case">":X=(H)=>H>Z;break;case"<":X=(H)=>H<Z;break;case">=":X=(H)=>H>=Z;break;case"<=":X=(H)=>H<=Z}return this.use(C9((H)=>{let W=I0.getNestedValue(J,H);return X(W)}))}requiredIfExists(J){let Y=Array.isArray(J)?J:[J];return this.use(C9((Z)=>{return Y.every((X)=>I0.exists(I0.getNestedValue(X,Z)))}))}requiredIfAnyExists(J){return this.use(C9((Y)=>{return J.some((Z)=>I0.exists(I0.getNestedValue(Z,Y)))}))}requiredIfMissing(J){let Y=Array.isArray(J)?J:[J];return this.use(C9((Z)=>{return Y.every((X)=>I0.isMissing(I0.getNestedValue(X,Z)))}))}requiredIfAnyMissing(J){return this.use(C9((Y)=>{return J.some((Z)=>I0.isMissing(I0.getNestedValue(Z,Y)))}))}clone(){return new G(this.#G.clone(),this.cloneValidations())}[y0](J,Y,Z){let X=this.#G[y0](J,Y,Z);return X.isOptional=!0,X.validations=X.validations.concat(this.compileValidations(Y)),X}},Mx=class G extends lG{#G;#J;constructor(J,Y){super();this.#J=J,this.#G=Y}clone(){return new G(this.#J,this.#G.clone())}[y0](J,Y,Z){let X=this.#G[y0](J,Y,Z);return X.transformFnId=Y.trackTransformer(this.#J),X}},m4=class extends lG{options;validations;constructor(G,J){super();this.options={bail:!0,allowNull:!1,isOptional:!1,...G},this.validations=J||[]}cloneValidations(){return this.validations.map((G)=>{return{options:G.options,rule:G.rule}})}cloneOptions(){return{...this.options}}compileValidations(G){return this.validations.map((J)=>{return{ruleFnId:G.track({validator:J.rule.validator,options:J.options}),implicit:J.rule.implicit,isAsync:J.rule.isAsync}})}parse(G){return this.options.parse=G,this}use(G){return this.validations.push(C6 in G?G[C6]():G),this}bail(G){return this.options.bail=G,this}[y0](G,J,Y){return{type:"literal",fieldName:G,propertyName:Y.toCamelCase?d1(G):G,bail:this.options.bail,allowNull:this.options.allowNull,isOptional:this.options.isOptional,parseFnId:this.options.parse?J.trackParser(this.options.parse):void 0,validations:this.compileValidations(J)}}},dF=class G extends m4{constructor(J,Y){super(J,Y)}clone(){return new G(this.cloneOptions(),this.cloneValidations())}},cG=K0((G,J,Y)=>{let Z=typeof J.choices==="function"?J.choices(Y):J.choices;if(!Z.includes(G))Y.report(H0.enum,"enum",Y,{choices:Z})}),N9=class G extends m4{static rules={enum:cG};#G;getChoices(){return this.#G}constructor(J,Y,Z){super(Y,Z||[cG({choices:J})]);this.#G=J}clone(){return new G(this.#G,this.cloneOptions(),this.cloneValidations())}},N6=["YYYY-MM-DD","YYYY-MM-DD HH:mm:ss"];V1.default.extend(sF.default);V1.default.extend(aF.default);V1.default.extend(rF.default);var Fx=K0((G,J,Y)=>{if(typeof G!=="string"&&typeof G!=="number"){Y.report(H0.date,"date",Y);return}let Z=!1,X=J.formats||N6;if(Array.isArray(X))X=[...X],Z=X.includes("x");else if(typeof X!=="string")X={...X},Z=X.format==="x";let H=Z?I0.asNumber(G):G,W=Z&&!Number.isNaN(H)?V1.default(H):V1.default(G,X,!0);if(!W.isValid()){Y.report(H0.date,"date",Y);return}Y.meta.$value=W,Y.meta.$formats=X,Y.mutate(W.toDate(),Y)}),CM=K0((G,J,Y)=>{if(!Y.meta.$value)return;let Z=J.compare||"day",X=J.format||N6,H=Y.meta.$value,W=typeof J.expectedValue==="function"?J.expectedValue(Y):J.expectedValue,K=V1.default(W,X,!0);if(!K.isValid())throw new Error(`Invalid datetime value "${W}" value provided to the equals rule`);if(!H.isSame(K,Z))Y.report(H0["date.equals"],"date.equals",Y,{expectedValue:W,compare:Z})}),NM=K0((G,J,Y)=>{if(!Y.meta.$value)return;let Z=J.compare||"day",X=J.format||N6,H=Y.meta.$value,W=typeof J.expectedValue==="function"?J.expectedValue(Y):J.expectedValue,K=W==="today"?V1.default():W==="tomorrow"?V1.default().add(1,"day"):V1.default(W,X,!0);if(!K.isValid())throw new Error(`Invalid datetime value "${W}" value provided to the after rule`);if(!H.isAfter(K,Z))Y.report(H0["date.after"],"date.after",Y,{expectedValue:W,compare:Z})}),EM=K0((G,J,Y)=>{if(!Y.meta.$value)return;let Z=J.compare||"day",X=J.format||N6,H=Y.meta.$value,W=typeof J.expectedValue==="function"?J.expectedValue(Y):J.expectedValue,K=W==="today"?V1.default():W==="tomorrow"?V1.default().add(1,"day"):V1.default(W,X,!0);if(!K.isValid())throw new Error(`Invalid datetime value "${W}" value provided to the afterOrEqual rule`);if(!H.isSameOrAfter(K,Z))Y.report(H0["date.afterOrEqual"],"date.afterOrEqual",Y,{expectedValue:W,compare:Z})}),_M=K0((G,J,Y)=>{if(!Y.meta.$value)return;let Z=J.compare||"day",X=J.format||N6,H=Y.meta.$value,W=typeof J.expectedValue==="function"?J.expectedValue(Y):J.expectedValue,K=W==="today"?V1.default():W==="yesterday"?V1.default().subtract(1,"day"):V1.default(W,X,!0);if(!K.isValid())throw new Error(`Invalid datetime value "${W}" value provided to the before rule`);if(!H.isBefore(K,Z))Y.report(H0["date.before"],"date.before",Y,{expectedValue:W,compare:Z})}),kM=K0((G,J,Y)=>{if(!Y.meta.$value)return;let Z=J.compare||"day",X=J.format||N6,H=Y.meta.$value,W=typeof J.expectedValue==="function"?J.expectedValue(Y):J.expectedValue,K=W==="today"?V1.default():W==="yesterday"?V1.default().subtract(1,"day"):V1.default(W,X,!0);if(!K.isValid())throw new Error(`Invalid datetime value "${W}" value provided to the beforeOrEqual rule`);if(!H.isSameOrBefore(K,Z))Y.report(H0["date.beforeOrEqual"],"date.beforeOrEqual",Y,{expectedValue:W,compare:Z})}),bM=K0((G,J,Y)=>{if(!Y.meta.$value)return;let Z=J.compare||"day",X=Y.meta.$value,H=J.format||Y.meta.$formats,W=I0.getNestedValue(J.otherField,Y),K=V1.default(W,H,!0);if(!K.isValid())return;if(!X.isSame(K,Z))Y.report(H0["date.sameAs"],"date.sameAs",Y,{otherField:J.otherField,expectedValue:W,compare:Z})}),vM=K0((G,J,Y)=>{if(!Y.meta.$value)return;let Z=J.compare||"day",X=Y.meta.$value,H=J.format||Y.meta.$formats,W=I0.getNestedValue(J.otherField,Y),K=V1.default(W,H,!0);if(!K.isValid())return;if(X.isSame(K,Z))Y.report(H0["date.notSameAs"],"date.notSameAs",Y,{otherField:J.otherField,expectedValue:W,compare:Z})}),fM=K0((G,J,Y)=>{if(!Y.meta.$value)return;let Z=J.compare||"day",X=Y.meta.$value,H=J.format||Y.meta.$formats,W=I0.getNestedValue(J.otherField,Y),K=V1.default(W,H,!0);if(!K.isValid())return;if(!X.isAfter(K,Z))Y.report(H0["date.afterField"],"date.afterField",Y,{otherField:J.otherField,expectedValue:W,compare:Z})}),hM=K0((G,J,Y)=>{if(!Y.meta.$value)return;let Z=J.compare||"day",X=Y.meta.$value,H=J.format||Y.meta.$formats,W=I0.getNestedValue(J.otherField,Y),K=V1.default(W,H,!0);if(!K.isValid())return;if(!X.isSameOrAfter(K,Z))Y.report(H0["date.afterOrSameAs"],"date.afterOrSameAs",Y,{otherField:J.otherField,expectedValue:W,compare:Z})}),yM=K0((G,J,Y)=>{if(!Y.meta.$value)return;let Z=J.compare||"day",X=Y.meta.$value,H=J.format||Y.meta.$formats,W=I0.getNestedValue(J.otherField,Y),K=V1.default(W,H,!0);if(!K.isValid())return;if(!X.isBefore(K,Z))Y.report(H0["date.beforeField"],"date.beforeField",Y,{otherField:J.otherField,expectedValue:W,compare:Z})}),gM=K0((G,J,Y)=>{if(!Y.meta.$value)return;let Z=J.compare||"day",X=Y.meta.$value,H=J.format||Y.meta.$formats,W=I0.getNestedValue(J.otherField,Y),K=V1.default(W,H,!0);if(!K.isValid())return;if(!X.isSameOrBefore(K,Z))Y.report(H0["date.beforeOrSameAs"],"date.beforeOrSameAs",Y,{otherField:J.otherField,expectedValue:W,compare:Z})}),xM=K0((G,J,Y)=>{if(!Y.meta.$value)return;let X=Y.meta.$value.day();if(X!==0&&X!==6)Y.report(H0["date.weekend"],"date.weekend",Y)}),uM=K0((G,J,Y)=>{if(!Y.meta.$value)return;let X=Y.meta.$value.day();if(X===0||X===6)Y.report(H0["date.weekday"],"date.weekday",Y)}),xX=class G extends m4{static rules={equals:CM,after:NM,afterOrEqual:EM,before:_M,beforeOrEqual:kM,sameAs:bM,notSameAs:vM,afterField:fM,afterOrSameAs:hM,beforeField:yM,beforeOrSameAs:gM,weekend:xM,weekday:uM};[N8]="vine.date";[e8]=(J)=>{if(typeof J!=="string")return!1;return iF.default(J,this.options.formats||N6,!0).isValid()};constructor(J,Y){super(J,Y||[Fx(J||{})])}equals(J,Y){return this.use(CM({expectedValue:J,...Y}))}after(J,Y){return this.use(NM({expectedValue:J,...Y}))}afterOrEqual(J,Y){return this.use(EM({expectedValue:J,...Y}))}before(J,Y){return this.use(_M({expectedValue:J,...Y}))}beforeOrEqual(J,Y){return this.use(kM({expectedValue:J,...Y}))}sameAs(J,Y){return this.use(bM({otherField:J,...Y}))}notSameAs(J,Y){return this.use(vM({otherField:J,...Y}))}afterField(J,Y){return this.use(fM({otherField:J,...Y}))}afterOrSameAs(J,Y){return this.use(hM({otherField:J,...Y}))}beforeField(J,Y){return this.use(yM({otherField:J,...Y}))}beforeOrSameAs(J,Y){return this.use(gM({otherField:J,...Y}))}weekend(){return this.use(xM())}weekday(){return this.use(uM())}clone(){return new G(this.cloneOptions(),this.cloneValidations())}},nF=class G{#G;#J=(J,Y)=>{Y.report(H0.union,"union",Y)};constructor(J){this.#G=J}otherwise(J){return this.#J=J,this}clone(){let J=new G(this.#G);return J.otherwise(this.#J),J}[y0](J,Y,Z){return{type:"union",fieldName:J,propertyName:Z.toCamelCase?d1(J):J,elseConditionalFnRefId:Y.trackConditional(this.#J),conditions:this.#G.map((X)=>X[y0](J,Y,Z))}}},tF=class{#G;#J;constructor(G,J){this.#G=J,this.#J=G}[y0](G,J,Y){return{conditionalFnRefId:J.trackConditional(this.#J),schema:this.#G[y0](G,J,Y)}}};function uX(G){return new nF(G)}uX.if=function G(J,Y){return new tF(J,Y)};uX.else=function G(J){return new tF(()=>!0,J)};var O7=class extends S9{optional(){return new Ox(this)}nullable(){return new qx(this)}},qx=class G extends O7{#G;constructor(J){super();this.#G=J}clone(){return new G(this.#G.clone())}[y0](J,Y,Z){let X=this.#G[y0](J,Y,Z);if(X.type!=="union")X.allowNull=!0;return X}},Ox=class G extends O7{#G;constructor(J){super();this.#G=J}clone(){return new G(this.#G.clone())}[y0](J,Y,Z){let X=this.#G[y0](J,Y,Z);if(X.type!=="union")X.isOptional=!0;return X}},R7=class extends O7{options;validations;constructor(G,J){super();this.options=G||{bail:!0,allowNull:!1,isOptional:!1},this.validations=J||[]}cloneValidations(){return this.validations.map((G)=>{return{options:G.options,rule:G.rule}})}cloneOptions(){return{...this.options}}compileValidations(G){return this.validations.map((J)=>{return{ruleFnId:G.track({validator:J.rule.validator,options:J.options}),implicit:J.rule.implicit,isAsync:J.rule.isAsync}})}parse(G){return this.options.parse=G,this}use(G){return this.validations.push(C6 in G?G[C6]():G),this}bail(G){return this.options.bail=G,this}},oF=class G extends R7{#G;#J=!1;[N8]="vine.array";[e8]=(J)=>{return Array.isArray(J)};constructor(J,Y,Z){super(Y,Z);this.#G=J}allowUnknownProperties(){return this.#J=!0,this}clone(){let J=new G(this.#G.map((Y)=>Y.clone()),this.cloneOptions(),this.cloneValidations());if(this.#J)J.allowUnknownProperties();return J}[y0](J,Y,Z){return{type:"tuple",fieldName:J,propertyName:Z.toCamelCase?d1(J):J,bail:this.options.bail,allowNull:this.options.allowNull,isOptional:this.options.isOptional,allowUnknownProperties:this.#J,parseFnId:this.options.parse?Y.trackParser(this.options.parse):void 0,validations:this.compileValidations(Y),properties:this.#G.map((X,H)=>X[y0](String(H),Y,Z))}}},mM=K0((G,J,Y)=>{if(!Y.isValid)return;if(G.length<J.min)Y.report(H0["array.minLength"],"array.minLength",Y,J)}),cM=K0((G,J,Y)=>{if(!Y.isValid)return;if(G.length>J.max)Y.report(H0["array.maxLength"],"array.maxLength",Y,J)}),lM=K0((G,J,Y)=>{if(!Y.isValid)return;if(G.length!==J.size)Y.report(H0["array.fixedLength"],"array.fixedLength",Y,J)}),pM=K0((G,J,Y)=>{if(!Y.isValid)return;if(G.length<=0)Y.report(H0.notEmpty,"notEmpty",Y)}),dM=K0((G,J,Y)=>{if(!Y.isValid)return;if(!I0.isDistinct(G,J.fields))Y.report(H0.distinct,"distinct",Y,J)}),iM=K0((G,J,Y)=>{if(!Y.isValid)return;Y.mutate(G.filter((Z)=>I0.exists(Z)&&Z!==""),Y)}),eF=class G extends R7{static rules={compact:iM,notEmpty:pM,distinct:dM,minLength:mM,maxLength:cM,fixedLength:lM};#G;[N8]="vine.array";[e8]=(J)=>{return Array.isArray(J)};constructor(J,Y,Z){super(Y,Z);this.#G=J}minLength(J){return this.use(mM({min:J}))}maxLength(J){return this.use(cM({max:J}))}fixedLength(J){return this.use(lM({size:J}))}notEmpty(){return this.use(pM())}distinct(J){return this.use(dM({fields:J}))}compact(){return this.use(iM())}clone(){return new G(this.#G.clone(),this.cloneOptions(),this.cloneValidations())}[y0](J,Y,Z){return{type:"array",fieldName:J,propertyName:Z.toCamelCase?d1(J):J,bail:this.options.bail,allowNull:this.options.allowNull,isOptional:this.options.isOptional,each:this.#G[y0]("*",Y,Z),parseFnId:this.options.parse?Y.trackParser(this.options.parse):void 0,validations:this.compileValidations(Y)}}},Rx=class G extends O7{#G;[N8]="types.object";[e8]=(J)=>{return J!==null&&typeof J==="object"&&!Array.isArray(J)};constructor(J){super();this.#G=J}clone(){return new G(this.#G.clone())}[y0](J,Y,Z){return Z.toCamelCase=!0,this.#G[y0](J,Y,Z)}},Gq=class G extends R7{#G;#J=[];#Y=!1;[N8]="vine.object";[e8]=(J)=>{return J!==null&&typeof J==="object"&&!Array.isArray(J)};constructor(J,Y,Z){super(Y,Z);this.#G=J}getProperties(){return Object.keys(this.#G).reduce((J,Y)=>{return J[Y]=this.#G[Y].clone(),J},{})}allowUnknownProperties(){return this.#Y=!0,this}merge(J){return this.#J.push(J),this}clone(){let J=new G(this.getProperties(),this.cloneOptions(),this.cloneValidations());if(this.#J.forEach((Y)=>J.merge(Y)),this.#Y)J.allowUnknownProperties();return J}toCamelCase(){return new Rx(this)}[y0](J,Y,Z){return{type:"object",fieldName:J,propertyName:Z.toCamelCase?d1(J):J,bail:this.options.bail,allowNull:this.options.allowNull,isOptional:this.options.isOptional,parseFnId:this.options.parse?Y.trackParser(this.options.parse):void 0,allowUnknownProperties:this.#Y,validations:this.compileValidations(Y),properties:Object.keys(this.#G).map((X)=>{return this.#G[X][y0](X,Y,Z)}),groups:this.#J.map((X)=>{return X[y0](Y,Z)})}}},aM=K0((G,J,Y)=>{if(!Y.isValid)return;if(Object.keys(G).length<J.min)Y.report(H0["record.minLength"],"record.minLength",Y,J)}),rM=K0((G,J,Y)=>{if(!Y.isValid)return;if(Object.keys(G).length>J.max)Y.report(H0["record.maxLength"],"record.maxLength",Y,J)}),sM=K0((G,J,Y)=>{if(!Y.isValid)return;if(Object.keys(G).length!==J.size)Y.report(H0["record.fixedLength"],"record.fixedLength",Y,J)}),nM=K0((G,J,Y)=>{if(!Y.isValid)return;J(Object.keys(G),Y)}),Jq=class G extends R7{static rules={maxLength:rM,minLength:aM,fixedLength:sM,validateKeys:nM};#G;[N8]="vine.object";[e8]=(J)=>{return J!==null&&typeof J==="object"&&!Array.isArray(J)};constructor(J,Y,Z){super(Y,Z);this.#G=J}minLength(J){return this.use(aM({min:J}))}maxLength(J){return this.use(rM({max:J}))}fixedLength(J){return this.use(sM({size:J}))}validateKeys(...J){return this.use(nM(...J))}clone(){return new G(this.#G.clone(),this.cloneOptions(),this.cloneValidations())}[y0](J,Y,Z){return{type:"record",fieldName:J,propertyName:Z.toCamelCase?d1(J):J,bail:this.options.bail,allowNull:this.options.allowNull,isOptional:this.options.isOptional,each:this.#G[y0]("*",Y,Z),parseFnId:this.options.parse?Y.trackParser(this.options.parse):void 0,validations:this.compileValidations(Y)}}},tM=K0((G,J,Y)=>{if(typeof G!=="string")Y.report(H0.string,"string",Y)}),oM=K0((G,J,Y)=>{if(!Y.isValid)return;if(!I0.isEmail(G,J))Y.report(H0.email,"email",Y)}),eM=K0((G,J,Y)=>{if(!Y.isValid)return;let Z=J&&typeof J==="function"?J(Y):J,X=Z?.locale||"any";if(!I0.isMobilePhone(G,X,Z))Y.report(H0.mobile,"mobile",Y)}),GF=K0((G,J,Y)=>{if(!Y.isValid)return;if(!I0.isIP(G,J?.version))Y.report(H0.ipAddress,"ipAddress",Y)}),JF=K0((G,J,Y)=>{if(!Y.isValid)return;if(!J.test(G))Y.report(H0.regex,"regex",Y)}),YF=K0((G,J,Y)=>{if(!Y.isValid)return;if(!I0.isHexColor(G))Y.report(H0.hexCode,"hexCode",Y)}),ZF=K0((G,J,Y)=>{if(!Y.isValid)return;if(!I0.isURL(G,J))Y.report(H0.url,"url",Y)}),XF=K0(async(G,J,Y)=>{if(!Y.isValid)return;if(!await I0.isActiveURL(G))Y.report(H0.activeUrl,"activeUrl",Y)}),HF=K0((G,J,Y)=>{if(!Y.isValid)return;let Z="a-zA-Z";if(J){if(J.allowSpaces)Z+="\\s";if(J.allowDashes)Z+="-";if(J.allowUnderscores)Z+="_"}if(!new RegExp(`^[${Z}]+\$`).test(G))Y.report(H0.alpha,"alpha",Y)}),WF=K0((G,J,Y)=>{if(!Y.isValid)return;let Z="a-zA-Z0-9";if(J){if(J.allowSpaces)Z+="\\s";if(J.allowDashes)Z+="-";if(J.allowUnderscores)Z+="_"}if(!new RegExp(`^[${Z}]+\$`).test(G))Y.report(H0.alphaNumeric,"alphaNumeric",Y)}),$F=K0((G,J,Y)=>{if(!Y.isValid)return;if(G.length<J.min)Y.report(H0.minLength,"minLength",Y,J)}),KF=K0((G,J,Y)=>{if(!Y.isValid)return;if(G.length>J.max)Y.report(H0.maxLength,"maxLength",Y,J)}),zF=K0((G,J,Y)=>{if(!Y.isValid)return;if(G.length!==J.size)Y.report(H0.fixedLength,"fixedLength",Y,J)}),UF=K0((G,J,Y)=>{if(!Y.isValid)return;if(!G.endsWith(J.substring))Y.report(H0.endsWith,"endsWith",Y,J)}),VF=K0((G,J,Y)=>{if(!Y.isValid)return;if(!G.startsWith(J.substring))Y.report(H0.startsWith,"startsWith",Y,J)}),QF=K0((G,J,Y)=>{if(!Y.isValid)return;if(I0.getNestedValue(J.otherField,Y)!==G){Y.report(H0.sameAs,"sameAs",Y,J);return}}),MF=K0((G,J,Y)=>{if(!Y.isValid)return;if(I0.getNestedValue(J.otherField,Y)===G){Y.report(H0.notSameAs,"notSameAs",Y,J);return}}),FF=K0((G,J,Y)=>{if(!Y.isValid)return;let Z=J?.confirmationField||`${Y.name}_confirmation`;if(Y.parent[Z]!==G){Y.report(H0.confirmed,"confirmed",Y,{otherField:Z});return}}),qF=K0((G,J,Y)=>{if(!Y.isValid)return;Y.mutate(G.trim(),Y)}),OF=K0((G,J,Y)=>{if(!Y.isValid)return;Y.mutate(Zq.default.default(G,J),Y)}),RF=K0((G,J,Y)=>{if(!Y.isValid)return;Y.mutate(G.toLocaleUpperCase(J),Y)}),AF=K0((G,J,Y)=>{if(!Y.isValid)return;Y.mutate(G.toLocaleLowerCase(J),Y)}),IF=K0((G,J,Y)=>{if(!Y.isValid)return;Y.mutate(d1(G),Y)}),DF=K0((G,J,Y)=>{if(!Y.isValid)return;Y.mutate(Yq.default.default(G),Y)}),LF=K0((G,J,Y)=>{if(!Y.isValid)return;Y.mutate(fX(G,J),Y)}),jF=K0((G,J,Y)=>{if(!Y.isValid)return;if(!(typeof J.choices==="function"?J.choices(Y):J.choices).includes(G)){Y.report(H0.in,"in",Y,J);return}}),TF=K0((G,J,Y)=>{if(!Y.isValid)return;if((typeof J.list==="function"?J.list(Y):J.list).includes(G)){Y.report(H0.notIn,"notIn",Y,J);return}}),BF=K0((G,J,Y)=>{if(!Y.isValid)return;let Z=J?typeof J==="function"?J(Y)?.provider||[]:J.provider:[];if(!Z.length){if(!I0.isCreditCard(G))Y.report(H0.creditCard,"creditCard",Y,{providersList:"credit"})}else if(!Z.find((H)=>I0.isCreditCard(G,{provider:H})))Y.report(H0.creditCard,"creditCard",Y,{providers:Z,providersList:Z.join("/")})}),PF=K0((G,J,Y)=>{if(!Y.isValid)return;let Z=typeof J==="function"?J(Y).countryCode:J.countryCode;if(!Z.find((H)=>I0.isPassportNumber(G,H)))Y.report(H0.passport,"passport",Y,{countryCodes:Z})}),SF=K0((G,J,Y)=>{if(!Y.isValid)return;let Z=J?typeof J==="function"?J(Y)?.countryCode||[]:J.countryCode:[];if(!Z.length){if(!I0.isPostalCode(G,"any"))Y.report(H0.postalCode,"postalCode",Y)}else if(!Z.find((H)=>I0.isPostalCode(G,H)))Y.report(H0.postalCode,"postalCode",Y,{countryCodes:Z})}),wF=K0((G,J,Y)=>{if(!Y.isValid)return;if(!J||!J.version){if(!I0.isUUID(G))Y.report(H0.uuid,"uuid",Y)}else if(!J.version.find((X)=>I0.isUUID(G,X)))Y.report(H0.uuid,"uuid",Y,J)}),CF=K0((G,J,Y)=>{if(!Y.isValid)return;if(!I0.isAscii(G))Y.report(H0.ascii,"ascii",Y)}),NF=K0((G,J,Y)=>{if(!Y.isValid)return;if(!I0.isIBAN(G))Y.report(H0.iban,"iban",Y)}),EF=K0((G,J,Y)=>{if(!Y.isValid)return;if(!I0.isJWT(G))Y.report(H0.jwt,"jwt",Y)}),_F=K0((G,J,Y)=>{if(!Y.isValid)return;if(!I0.isLatLong(G))Y.report(H0.coordinates,"coordinates",Y)}),pG=class G extends m4{static rules={in:jF,jwt:EF,url:ZF,iban:NF,uuid:wF,trim:qF,email:oM,alpha:HF,ascii:CF,notIn:TF,regex:JF,escape:DF,sameAs:QF,mobile:eM,string:tM,hexCode:YF,passport:PF,endsWith:UF,confirmed:FF,activeUrl:XF,minLength:$F,notSameAs:MF,maxLength:KF,ipAddress:GF,creditCard:BF,postalCode:SF,startsWith:VF,toUpperCase:RF,toLowerCase:AF,toCamelCase:IF,fixedLength:zF,coordinates:_F,normalizeUrl:LF,alphaNumeric:WF,normalizeEmail:OF};[N8]="vine.string";[e8]=(J)=>{return typeof J==="string"};constructor(J,Y){super(J,Y||[tM()])}url(...J){return this.use(ZF(...J))}activeUrl(){return this.use(XF())}email(...J){return this.use(oM(...J))}mobile(...J){return this.use(eM(...J))}ipAddress(J){return this.use(GF(J?{version:J}:void 0))}hexCode(){return this.use(YF())}regex(J){return this.use(JF(J))}alpha(J){return this.use(HF(J))}alphaNumeric(J){return this.use(WF(J))}minLength(J){return this.use($F({min:J}))}maxLength(J){return this.use(KF({max:J}))}fixedLength(J){return this.use(zF({size:J}))}confirmed(J){return this.use(FF(J))}trim(){return this.use(qF())}normalizeEmail(J){return this.use(OF(J))}toUpperCase(){return this.use(RF())}toLowerCase(){return this.use(AF())}toCamelCase(){return this.use(IF())}escape(){return this.use(DF())}normalizeUrl(...J){return this.use(LF(...J))}startsWith(J){return this.use(VF({substring:J}))}endsWith(J){return this.use(UF({substring:J}))}sameAs(J){return this.use(QF({otherField:J}))}notSameAs(J){return this.use(MF({otherField:J}))}in(J){return this.use(jF({choices:J}))}notIn(J){return this.use(TF({list:J}))}creditCard(...J){return this.use(BF(...J))}passport(...J){return this.use(PF(...J))}postalCode(...J){return this.use(SF(...J))}uuid(...J){return this.use(wF(...J))}ascii(){return this.use(CF())}iban(){return this.use(NF())}jwt(){return this.use(EF())}coordinates(){return this.use(_F())}clone(){return new G(this.cloneOptions(),this.cloneValidations())}},kF=K0((G,J,Y)=>{let Z=J.strict?G:I0.asNumber(G);if(typeof Z!=="number"||Number.isNaN(Z)||Z===Number.POSITIVE_INFINITY||Z===Number.NEGATIVE_INFINITY){Y.report(H0.number,"number",Y);return}Y.mutate(Z,Y)}),bF=K0((G,J,Y)=>{if(!Y.isValid)return;if(G<J.min)Y.report(H0.min,"min",Y,J)}),vF=K0((G,J,Y)=>{if(!Y.isValid)return;if(G>J.max)Y.report(H0.max,"max",Y,J)}),fF=K0((G,J,Y)=>{if(!Y.isValid)return;if(G<J.min||G>J.max)Y.report(H0.range,"range",Y,J)}),hF=K0((G,J,Y)=>{if(!Y.isValid)return;if(G<0)Y.report(H0.positive,"positive",Y)}),yF=K0((G,J,Y)=>{if(!Y.isValid)return;if(G>=0)Y.report(H0.negative,"negative",Y)}),gF=K0((G,J,Y)=>{if(!Y.isValid)return;if(!I0.isDecimal(String(G),{force_decimal:J.range[0]!==0,decimal_digits:J.range.join(",")}))Y.report(H0.decimal,"decimal",Y,{digits:J.range.join("-")})}),xF=K0((G,J,Y)=>{if(!Y.isValid)return;if(!Number.isInteger(G))Y.report(H0.withoutDecimals,"withoutDecimals",Y)}),uF=K0((G,J,Y)=>{if(!Y.isValid)return;if(!J.values.includes(G))Y.report(H0["number.in"],"in",Y,J)}),E9=class G extends m4{static rules={in:uF,max:vF,min:bF,range:fF,number:kF,decimal:gF,negative:yF,positive:hF,withoutDecimals:xF};[N8]="vine.number";[e8]=(J)=>{let Y=I0.asNumber(J);return!Number.isNaN(Y)};constructor(J,Y){super(J,Y||[kF(J||{})])}min(J){return this.use(bF({min:J}))}max(J){return this.use(vF({max:J}))}range(J){return this.use(fF({min:J[0],max:J[1]}))}positive(){return this.use(hF())}negative(){return this.use(yF())}decimal(J){return this.use(gF({range:Array.isArray(J)?J:[J]}))}withoutDecimals(){return this.use(xF())}clone(){return new G(this.cloneOptions(),this.cloneValidations())}in(J){return this.use(uF({values:J}))}},mF=K0((G,J,Y)=>{let Z=J.strict===!0?G:I0.asBoolean(G);if(typeof Z!=="boolean"){Y.report(H0.boolean,"boolean",Y);return}Y.mutate(Z,Y)}),_9=class G extends m4{static rules={boolean:mF};[N8]="vine.boolean";[e8]=(J)=>{return typeof(this.options.strict===!0?J:I0.asBoolean(J))==="boolean"};constructor(J,Y){super(J,Y||[mF(J||{})])}clone(){return new G(this.cloneOptions(),this.cloneValidations())}},cF=K0((G,J,Y)=>{let Z=G;if(typeof J.expectedValue==="boolean")Z=I0.asBoolean(G);else if(typeof J.expectedValue==="number")Z=I0.asNumber(G);if(Z!==J.expectedValue){Y.report(H0.literal,"literal",Y,J);return}Y.mutate(Z,Y)}),Xq=class G extends m4{static rules={equals:cF};#G;constructor(J,Y,Z){super(Y,Z||[cF({expectedValue:J})]);this.#G=J}clone(){return new G(this.#G,this.cloneOptions(),this.cloneValidations())}},Ax=["on","1","yes","true",!0,1],lF=K0((G,J,Y)=>{if(!Ax.includes(G))Y.report(H0.accepted,"accepted",Y)}),Hq=class G extends m4{static rules={accepted:lF};constructor(J,Y){super(J,Y||[lF()])}clone(){return new G(this.cloneOptions(),this.cloneValidations())}},Ix=class G{#G;#J=(J,Y)=>{Y.report(H0.unionGroup,"unionGroup",Y)};constructor(J){this.#G=J}clone(){let J=new G(this.#G);return J.otherwise(this.#J),J}otherwise(J){return this.#J=J,this}[y0](J,Y){return{type:"group",elseConditionalFnRefId:J.trackConditional(this.#J),conditions:this.#G.map((Z)=>Z[y0](J,Y))}}},Wq=class{#G;#J;constructor(G,J){this.#G=J,this.#J=G}[y0](G,J){return{schema:{type:"sub_object",properties:Object.keys(this.#G).map((Y)=>{return this.#G[Y][y0](Y,G,J)}),groups:[]},conditionalFnRefId:G.trackConditional(this.#J)}}};function mX(G){return new Ix(G)}mX.if=function G(J,Y){return new Wq(J,Y)};mX.else=function G(J){return new Wq(()=>!0,J)};var Dx=class G extends m4{static rules={enum:cG};#G;constructor(J,Y,Z){super(Y,Z||[cG({choices:Object.values(J)})]);this.#G=J}clone(){return new G(this.#G,this.cloneOptions(),this.cloneValidations())}},Lx=class G{#G;#J=(J,Y)=>{Y.report(H0.unionOfTypes,"unionOfTypes",Y)};constructor(J){this.#G=J}otherwise(J){return this.#J=J,this}clone(){let J=new G(this.#G);return J.otherwise(this.#J),J}[y0](J,Y,Z){return{type:"union",fieldName:J,propertyName:Z.toCamelCase?d1(J):J,elseConditionalFnRefId:Y.trackConditional(this.#J),conditions:this.#G.map((X)=>{return{conditionalFnRefId:Y.trackConditional((H,W)=>{return X[e8](H,W)}),schema:X[y0](J,Y,Z)}})}}},jx=class extends S9{group=mX;union=uX;string(){return new pG}boolean(G){return new _9(G)}accepted(){return new Hq}number(G){return new E9(G)}date(G){return new xX(G)}literal(G){return new Xq(G)}object(G){return new Gq(G)}array(G){return new eF(G)}tuple(G){return new oF(G)}record(G){return new Jq(G)}enum(G){if(Array.isArray(G)||typeof G==="function")return new N9(G);return new Dx(G)}any(){return new dF}unionOfTypes(G){let J=new Set;return G.forEach((Y)=>{if(!Y[e8]||!Y[N8])throw new Error(`Cannot use "${Y.constructor.name}". The schema type is not compatible for use with "vine.unionOfTypes"`);if(J.has(Y[N8]))throw new Error(`Cannot use duplicate schema "${Y[N8]}". "vine.unionOfTypes" needs distinct schema types only`);J.add(Y[N8])}),J.clear(),new Lx(G)}},Tx={required:H0.required,array:H0.array,object:H0.object},gX=class{#G;messagesProvider;errorReporter;#J(G){let J=wM();return{compilerNode:{type:"root",schema:G[y0]("",J,{toCamelCase:!1})},refs:J.toJSON()}}constructor(G,J){let{compilerNode:Y,refs:Z}=this.#J(G);this.#G={schema:Y,refs:Z};let X=J.metaDataValidator,H=new SM(Y,{convertEmptyStringsToNull:J.convertEmptyStringsToNull,messages:Tx}).compile();if(this.errorReporter=J.errorReporter,this.messagesProvider=J.messagesProvider,X)this.validate=(W,K)=>{let z=K??{},U=z.meta??{},V=z.errorReporter??this.errorReporter,M=z.messagesProvider??this.messagesProvider;return X(U),H(W,U,Z,M,V())};else this.validate=(W,K)=>{let z=K??{},U=z.meta??{},V=z.errorReporter??this.errorReporter,M=z.messagesProvider??this.messagesProvider;return H(W,U,Z,M,V())}}async tryValidate(G,...[J]){try{return[null,await this.validate(G,J)]}catch(Y){if(Y instanceof jX)return[Y,null];throw Y}}toJSON(){let{schema:G,refs:J}=this.#G;return{schema:structuredClone(G),refs:J}}},$q=class extends jx{messagesProvider=new Q7(H0,rV);errorReporter=()=>new TX;convertEmptyStringsToNull=!1;helpers=I0;createRule=K0;compile(G){return new gX(G,{convertEmptyStringsToNull:this.convertEmptyStringsToNull,messagesProvider:this.messagesProvider,errorReporter:this.errorReporter})}withMetaData(G){return{compile:(J)=>{return new gX(J,{convertEmptyStringsToNull:this.convertEmptyStringsToNull,messagesProvider:this.messagesProvider,errorReporter:this.errorReporter,metaDataValidator:G})}}}validate(G){return this.compile(G.schema).validate(G.data,G)}tryValidate(G){return this.compile(G.schema).tryValidate(G.data,G)}},Bx=new $q,O0=Bx;import{path as Ov1}from"@stacksjs/path";import{snakeCase as Av1}from"@stacksjs/strings";class cX{static isTestEnvironment=!1;static shouldExitProcess=!0;static handle(G,J){if(this.shouldExitProcess=J?.shouldExit!==!1,J?.silent!==!0)this.writeErrorToConsole(G);let Y;if(J?.message)Y=J.message;else if(G instanceof Error)Y=G.message;else if(typeof G==="string")Y=G;else Y=JSON.stringify(G);let Z=new Error(Y);if(G instanceof Error)Object.assign(Z,G);return this.writeErrorToFile(Z).catch((X)=>console.error(X)),Z}static handleError(G,J){return this.handle(G,J),G}static async writeErrorToFile(G){if(!(G instanceof Error)){console.error("Error is not an instance of Error:",G);return}let J=`[${new Date().toISOString()}] ${G.name}: ${G.message}\n`,Y=A7.logsPath("stacks.log")??A7.logsPath("errors.log");try{await Uq(A7.dirname(Y),{recursive:!0}),await zq(Y,J)}catch(Z){console.error("Failed to write to error file:",Z)}}static writeErrorToConsole(G){console.error(G);let J=typeof G==="string"?G:G instanceof Error?G.message:JSON.stringify(G);if(J.includes("bunx --bun cdk destroy")||J===`Failed to execute command: ${Kq("bunx --bun eslint . --fix")}`||J===`Failed to execute command: ${Kq("bun storage/framework/core/actions/src/lint/fix.ts")}`){if(!this.isTestEnvironment)console.log("No need to worry. The edge function is currently being destroyed. Please run `buddy undeploy` shortly again, and continue doing so until it succeeds running."),console.log("Hoping to see you back soon!")}if(this.shouldExitProcess)wx.exit(1)}}function k9(G,J){let Y;if(WG(G))Y=G;else if(G instanceof Error)Y=G.message;else if(J instanceof Error)Y=J.message;else Y=String(G);return Ex(`ERROR: ${Cx(Y)}`),cX.handle(G,J)}async function Ex(G,J){let Y=`[${new Date().toISOString()}] ${G}\n`;try{let Z=J?.logFile??Nx.logging.logsPath??"storage/logs/stacks.log";try{await Px(Z)}catch{await Uq(Sx(Z),{recursive:!0})}await zq(Z,Y)}catch(Z){console.error("Failed to write to log file:",Z)}}var _x={withStackTrace:!1},Mq=(G,J,Y=_x)=>{let Z=J.isOk()?{type:"Ok",value:J.value}:{type:"Err",value:J.error},X=Y.withStackTrace?new Error().stack:void 0;return{data:Z,message:G,stack:X}};function b9(G,J,Y,Z){function X(H){return H instanceof Y?H:new Y(function(W){W(H)})}return new(Y||(Y=Promise))(function(H,W){function K(V){try{U(Z.next(V))}catch(M){W(M)}}function z(V){try{U(Z.throw(V))}catch(M){W(M)}}function U(V){V.done?H(V.value):X(V.value).then(K,z)}U((Z=Z.apply(G,J||[])).next())})}function Vq(G){var J=typeof Symbol==="function"&&Symbol.iterator,Y=J&&G[J],Z=0;if(Y)return Y.call(G);if(G&&typeof G.length==="number")return{next:function(){if(G&&Z>=G.length)G=void 0;return{value:G&&G[Z++],done:!G}}};throw new TypeError(J?"Object is not iterable.":"Symbol.iterator is not defined.")}function c4(G){return this instanceof c4?(this.v=G,this):new c4(G)}function Qq(G,J,Y){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var Z=Y.apply(G,J||[]),X,H=[];return X=Object.create((typeof AsyncIterator==="function"?AsyncIterator:Object).prototype),K("next"),K("throw"),K("return",W),X[Symbol.asyncIterator]=function(){return this},X;function W(A){return function(R){return Promise.resolve(R).then(A,M)}}function K(A,R){if(Z[A]){if(X[A]=function(w){return new Promise(function(C,D){H.push([A,w,C,D])>1||z(A,w)})},R)X[A]=R(X[A])}}function z(A,R){try{U(Z[A](R))}catch(w){O(H[0][3],w)}}function U(A){A.value instanceof c4?Promise.resolve(A.value.v).then(V,M):O(H[0][2],A)}function V(A){z("next",A)}function M(A){z("throw",A)}function O(A,R){if(A(R),H.shift(),H.length)z(H[0][0],H[0][1])}}function kx(G){var J,Y;return J={},Z("next"),Z("throw",function(X){throw X}),Z("return"),J[Symbol.iterator]=function(){return this},J;function Z(X,H){J[X]=G[X]?function(W){return(Y=!Y)?{value:c4(G[X](W)),done:!1}:H?H(W):W}:H}}function bx(G){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var J=G[Symbol.asyncIterator],Y;return J?J.call(G):(G=typeof Vq==="function"?Vq(G):G[Symbol.iterator](),Y={},Z("next"),Z("throw"),Z("return"),Y[Symbol.asyncIterator]=function(){return this},Y);function Z(H){Y[H]=G[H]&&function(W){return new Promise(function(K,z){W=G[H](W),X(K,z,W.done,W.value)})}}function X(H,W,K,z){Promise.resolve(z).then(function(U){H({value:U,done:K})},W)}}class h1{constructor(G){this._promise=G}static fromSafePromise(G){let J=G.then((Y)=>new B4(Y));return new h1(J)}static fromPromise(G,J){let Y=G.then((Z)=>new B4(Z)).catch((Z)=>new G4(J(Z)));return new h1(Y)}static fromThrowable(G,J){return(...Y)=>{return new h1((()=>b9(this,void 0,void 0,function*(){try{return new B4(yield G(...Y))}catch(Z){return new G4(J?J(Z):Z)}}))())}}static combine(G){return hx(G)}static combineWithAllErrors(G){return yx(G)}map(G){return new h1(this._promise.then((J)=>b9(this,void 0,void 0,function*(){if(J.isErr())return new G4(J.error);return new B4(yield G(J.value))})))}andThrough(G){return new h1(this._promise.then((J)=>b9(this,void 0,void 0,function*(){if(J.isErr())return new G4(J.error);let Y=yield G(J.value);if(Y.isErr())return new G4(Y.error);return new B4(J.value)})))}andTee(G){return new h1(this._promise.then((J)=>b9(this,void 0,void 0,function*(){if(J.isErr())return new G4(J.error);try{yield G(J.value)}catch(Y){}return new B4(J.value)})))}mapErr(G){return new h1(this._promise.then((J)=>b9(this,void 0,void 0,function*(){if(J.isOk())return new B4(J.value);return new G4(yield G(J.error))})))}andThen(G){return new h1(this._promise.then((J)=>{if(J.isErr())return new G4(J.error);let Y=G(J.value);return Y instanceof h1?Y._promise:Y}))}orElse(G){return new h1(this._promise.then((J)=>b9(this,void 0,void 0,function*(){if(J.isErr())return G(J.error);return new B4(J.value)})))}match(G,J){return this._promise.then((Y)=>Y.match(G,J))}unwrapOr(G){return this._promise.then((J)=>J.unwrapOr(G))}safeUnwrap(){return Qq(this,arguments,function*G(){return yield c4(yield c4(yield*kx(bx(yield c4(this._promise.then((J)=>J.safeUnwrap()))))))})}then(G,J){return this._promise.then(G,J)}[Symbol.asyncIterator](){return Qq(this,arguments,function*G(){let J=yield c4(this._promise);if(J.isErr())yield yield c4(I7(J.error));return yield c4(J.value)})}}var I7=(G)=>new h1(Promise.resolve(new G4(G))),vx=h1.fromPromise,fx=h1.fromSafePromise,mv1=h1.fromThrowable,Fq=(G)=>{let J=y1([]);for(let Y of G)if(Y.isErr()){J=E8(Y.error);break}else J.map((Z)=>Z.push(Y.value));return J},hx=(G)=>h1.fromSafePromise(Promise.all(G)).andThen(Fq),qq=(G)=>{let J=y1([]);for(let Y of G)if(Y.isErr()&&J.isErr())J.error.push(Y.error);else if(Y.isErr()&&J.isOk())J=E8([Y.error]);else if(Y.isOk()&&J.isOk())J.value.push(Y.value);return J},yx=(G)=>h1.fromSafePromise(Promise.all(G)).andThen(qq),dG;(function(G){function J(X,H){return(...W)=>{try{let K=X(...W);return y1(K)}catch(K){return E8(H?H(K):K)}}}G.fromThrowable=J;function Y(X){return Fq(X)}G.combine=Y;function Z(X){return qq(X)}G.combineWithAllErrors=Z})(dG||(dG={}));var y1=(G)=>new B4(G);function E8(G){return new G4(G)}class B4{constructor(G){this.value=G}isOk(){return!0}isErr(){return!this.isOk()}map(G){return y1(G(this.value))}mapErr(G){return y1(this.value)}andThen(G){return G(this.value)}andThrough(G){return G(this.value).map((J)=>this.value)}andTee(G){try{G(this.value)}catch(J){}return y1(this.value)}orElse(G){return y1(this.value)}asyncAndThen(G){return G(this.value)}asyncAndThrough(G){return G(this.value).map(()=>this.value)}asyncMap(G){return h1.fromSafePromise(G(this.value))}unwrapOr(G){return this.value}match(G,J){return G(this.value)}safeUnwrap(){let G=this.value;return function*(){return G}()}_unsafeUnwrap(G){return this.value}_unsafeUnwrapErr(G){throw Mq("Called `_unsafeUnwrapErr` on an Ok",this,G)}*[Symbol.iterator](){return this.value}}class G4{constructor(G){this.error=G}isOk(){return!1}isErr(){return!this.isOk()}map(G){return E8(this.error)}mapErr(G){return E8(G(this.error))}andThrough(G){return E8(this.error)}andTee(G){return E8(this.error)}andThen(G){return E8(this.error)}orElse(G){return G(this.error)}asyncAndThen(G){return I7(this.error)}asyncAndThrough(G){return I7(this.error)}asyncMap(G){return I7(this.error)}unwrapOr(G){return G}match(G,J){return J(this.error)}safeUnwrap(){let G=this.error;return function*(){throw yield E8(G),new Error("Do not use this generator out of `safeTry`")}()}_unsafeUnwrap(G){throw Mq("Called `_unsafeUnwrap` on an Err",this,G)}_unsafeUnwrapErr(G){return this.error}*[Symbol.iterator](){let G=this;return yield G,G}}var gx=dG.fromThrowable;import{bold as Kc1,dim as zc1,green as Uc1,italic as Vc1,log as Qc1}from"@stacksjs/cli";import{path as Fc1}from"@stacksjs/path";import{fs as Oc1,glob as Rc1}from"@stacksjs/storage";var pP=k0(qW(),1),dP=k0(kJ(),1),iP=k0(r7(),1);import{italic as jc1,log as Tc1}from"@stacksjs/cli";import{path as H3}from"@stacksjs/path";import{fs as am0,globSync as rm0}from"@stacksjs/storage";import{pascalCase as Cc1,plural as KY,singular as sm0,snakeCase as aP}from"@stacksjs/strings";async function rP(G){if(typeof G==="string")G=(await import(G)).default;return G.table??aP(KY(G?.name||""))}function P2(G,J){if(G.name)return G.name;return H3.basename(J).replace(/\.ts$/,"")}function i1(G,J){if(G.table)return G.table;return aP(KY(P2(G,J)))}function nm0(G,J){let Y=[G,J];return Y.sort(),Y[0]=sm0(Y[0]||""),Y.join("_")}function tm0(G,J){return J in G}async function om0(G,J){let Y=["hasOne","belongsTo","hasMany","belongsToMany","hasOneThrough"],Z=[];for(let X of Y)if(tm0(G,X))for(let H of G[X]||[]){let W=H.model,K;if(WG(H))W=H;let z=H3.userModelsPath(`${W}.ts`),U=H3.storagePath(`framework/database/models/generated/${W}.ts`);if(am0.existsSync(z))K=(await import(z)).default;else K=(await import(U)).default;let V=i1(K,z),M=P2(K,z),O=J.toLowerCase(),A=M.toLowerCase();Z.push({relationship:X,model:W,table:V,foreignKey:H.foreignKey||`${O}_id`,modelKey:`${A}_id`,relationName:H.relationName||"",throughModel:H.through||"",throughForeignKey:H.throughForeignKey||"",pivotTable:H?.pivotTable||nm0(KY(O),KY(K.table||""))})}return Z}async function S2(G,J){let Y=[];if("belongsToMany"in G){let Z=G.belongsToMany||[];for(let X of Z){let W=(await import(H3.userModelsPath(`${X}.ts`))).default,K=P2(G,J),z=K.toLowerCase(),U=typeof X==="object"&&"firstForeignKey"in X?X.firstForeignKey:`${K.toLowerCase()}_${G.primaryKey}`,V=typeof X==="object"&&"secondForeignKey"in X?X.secondForeignKey:`${W.name?.toLowerCase()}_${G.primaryKey}`;Y.push({table:(typeof X==="object"&&"pivotTable"in X?X.pivotTable:void 0)??`${z}_${W.table}`,firstForeignKey:U,secondForeignKey:V})}return Y}return[]}async function X6(G){let J=rm0([H3.userModelsPath("*.ts")],{absolute:!0}),Y=[];for(let Z=0;Z<J.length;Z++){let X=J[Z],H=await import(X);if(G===H.default.name)continue;let W=P2(H,X),K=await om0(H.default,W);if(!K.length)continue;let z=K.find((U)=>U.model===G);if(z)Y.push(z)}return Y}import{path as i$}from"@stacksjs/path";import{fs as Bc0,globSync as Pc0}from"@stacksjs/storage";import{plural as Sc0,snakeCase as wc0}from"@stacksjs/strings";import{italic as sP,log as N4}from"@stacksjs/cli";import{path as K4}from"@stacksjs/path";import{fs as W3,globSync as em0}from"@stacksjs/storage";import{snakeCase as $3}from"@stacksjs/strings";async function nP(){let G=await VY();for(let X of G)await c0.schema.dropTable(X).ifExists().execute();await c0.schema.dropTable("migrations").ifExists().execute(),await c0.schema.dropTable("migration_locks").ifExists().execute(),await c0.schema.dropTable("migrations").ifExists().execute();let J=await W3.readdir(K4.userMigrationsPath()),Y=await W3.readdir(K4.frameworkPath("database/models")),Z=em0([K4.userModelsPath("*.ts")],{absolute:!0});for(let X of Z){let H=(await import(X)).default,W=await S2(H,X);for(let K of W)await c0.schema.dropTable(K.table).ifExists().execute()}if(Y.length){for(let X of Y)if(X.endsWith(".ts")){let H=K4.frameworkPath(`database/models/${X}`);if(W3.existsSync(H))await Bun.$`rm ${H}`}}if(J.length){for(let X of J)if(X.endsWith(".ts")){let H=K4.userMigrationsPath(`${X}`);if(W3.existsSync(H))await Bun.$`rm ${H}`}}return y1("All tables dropped successfully!")}async function tP(G){let J=(await import(G)).default,Y=K4.basename(G),Z=i1(J,G),X=JSON.stringify(J.attributes,null,2),H=K4.frameworkPath(`database/models/${Y}`),W=!1;if(W3.existsSync(H)){N4.info(`Fields have already been generated for ${Z}`);let z=await n4(Y);if(JSON.stringify(z,null,2)===X){N4.debug(`Fields have not changed for ${Z}`);return}W=!0,N4.debug(`Fields have changed for ${Z}`)}else N4.debug(`Fields have not been generated for ${Z}`);await Bun.$`cp ${G} ${H}`;let K=await z4(Z);if(N4.debug(`Has ${Z} been migrated? ${K}`),W)await Xc0(G);else await Gc0(G)}async function Gc0(G){N4.debug("createTableMigration modelPath:",G);let J=(await import(G)).default,Y=i1(J,G),Z=J.traits?.useAuth&&typeof J.traits.useAuth!=="boolean"?J.traits.useAuth.useTwoFactor:!1;await Zc0(J,G);let X=await X6(J,G),H=J?.traits?.useTimestamps??J?.traits?.timestampable??!0,W=J?.traits?.useSoftDeletes??J?.traits?.softDeletable??!1,K=(typeof J.traits?.useAuth==="object"&&J.traits.useAuth.usePasskey)??!1,z=J.traits?.billable||!1;if(K)await Jc0();if(K)await Yc0();let U="import type { Database } from '@stacksjs/database'\n";U+="import { sql } from '@stacksjs/database'\n\n",U+="export async function up(db: Database<any>) {\n",U+=" await db.schema\n",U+=` .createTable('${Y}')\n`,U+=" .addColumn('id', 'integer', col => col.primaryKey().autoIncrement())\n";for(let[A,R]of H6(J.attributes)){let w=R,C=$3(A),D=w2(w.validation?.rule);if(U+=` .addColumn('${C}', ${D}`,w.unique||w?.required){if(U+=", col => col",w.unique)U+=".unique()";if(w?.required)U+=".notNull()";U+=""}U+=")\n"}if(Z!==!1&&Z)U+=" .addColumn('two_factor_secret', 'varchar(255)')\n";if(z)U+=" .addColumn('stripe_id', 'varchar(255)')\n";if(X?.length)for(let A of X)U+=` .addColumn('${A.foreignKey}', 'integer', (col) =>
148
148
  col.references('${A.relationTable}.id').onDelete('cascade')
149
149
  ) \n`;if(K)U+=" .addColumn('public_passkey', 'text')\n";if(H)U+=" .addColumn('created_at', 'timestamp', col => col.notNull().defaultTo(sql.raw('CURRENT_TIMESTAMP')))\n",U+=" .addColumn('updated_at', 'timestamp')\n";if(W)U+=" .addColumn('deleted_at', 'timestamp')\n";U+=" .execute()\n",U+="}\n";let M=`${new Date().getTime().toString()}-create-${Y}-table.ts`,O=K4.userMigrationsPath(M);console.log(O),Bun.write(O,U),N4.success(`Created migration: ${sP(M)}`)}async function Jc0(){if(await z4("users"))return;let J="import type { Database } from '@stacksjs/database'\n";J+="export async function up(db: Database<any>) {\n",J+=" await db.schema\n",J+=" .createTable('passkeys')\n",J+=" .addColumn('id', 'integer', col => col.primaryKey().autoIncrement())\n",J+=" .addColumn('cred_public_key', 'text')\n",J+=" .addColumn('user_id', 'integer')\n",J+=" .addColumn('webauthn_user_id', 'varchar(255)')\n",J+=" .addColumn('counter', 'integer')\n",J+=" .addColumn('device_type', 'varchar(255)')\n",J+=" .addColumn('backup_eligible', 'boolean')\n",J+=" .addColumn('backup_status', 'boolean')\n",J+=" .addColumn('transports', 'varchar(255)')\n",J+=" .addColumn('last_used_at', 'text')\n",J+=" .addColumn('created_at', 'timestamp', col => col.notNull().defaultTo(sql.raw('CURRENT_TIMESTAMP')))\n",J+=" .execute()\n",J+=" }\n";let Z=`${new Date().getTime().toString()}-create-passkeys-table.ts`,X=K4.userMigrationsPath(Z);Bun.write(X,J),N4.success(`Created pivot migration: ${Z}`)}async function Yc0(){if(await z4("users"))return;let J="import type { Database } from '@stacksjs/database'\n import { sql } from '@stacksjs/database'\n\n";J+="export async function up(db: Database<any>) {\n",J+=" await db.schema\n",J+=" .createTable('subscriptions')\n",J+=" .addColumn('id', 'integer', col => col.primaryKey().autoIncrement())\n",J+=" .addColumn('user_id', 'integer', col => col.notNull())\n",J+=" .addColumn('type', 'varchar(255)', col => col.notNull())\n",J+=" .addColumn('stripe_id', 'varchar(255)', col => col.notNull().unique())\n",J+=" .addColumn('stripe_status', 'varchar(255)', col => col.notNull())\n",J+=" .addColumn('stripe_price', 'varchar(255)')\n",J+=" .addColumn('quantity', 'integer')\n",J+=" .addColumn('trial_ends_at', 'timestamp')\n",J+=" .addColumn('ends_at', 'timestamp')\n",J+=" .addColumn('last_used_at', 'text')\n",J+=" .addColumn('updated_at', 'timestamp', col => col.notNull())\n",J+=" .addColumn('created_at', 'timestamp', col => col.notNull().defaultTo(sql.raw('CURRENT_TIMESTAMP')))\n",J+=" .execute()\n",J+=" }\n";let Z=`${new Date().getTime().toString()}-create-stripe-subscriptions-table.ts`,X=K4.userMigrationsPath(Z);Bun.write(X,J),N4.success("Created subscriptions table")}async function Zc0(G,J){let Y=await S2(G,J);if(!Y.length)return;for(let Z of Y){if(await X5(Z.table))return;let H="import type { Database } from '@stacksjs/database'\n";H+="export async function up(db: Database<any>) {\n",H+=" await db.schema\n",H+=` .createTable('${Z.table}')\n`,H+=" .addColumn('id', 'integer', col => col.primaryKey().autoIncrement())\n",H+=` .addColumn('${Z.firstForeignKey}', 'integer')\n`,H+=` .addColumn('${Z.secondForeignKey}', 'integer')\n`,H+=" .execute()\n",H+=" }\n";let K=`${new Date().getTime().toString()}-create-${Z.table}-table.ts`,z=K4.userMigrationsPath(K);Bun.write(z,H),N4.success(`Created pivot migration: ${K}`)}}async function Xc0(G){let J=(await import(G)).default,Y=P2(J,G),Z=i1(J,G),X=!1,W=await n4(Y)??{},K=J.attributes,z=H5(Object.keys(W),Object.keys(K)),U=z?.added||[],V=z?.removed||[],M="import type { Database } from '@stacksjs/database'\n";if(M+="import { sql } from '@stacksjs/database'\n\n",M+="export async function up(db: Database<any>) {\n",U.length||V.length)X=!0,M+=` await db.schema.alterTable('${Z}')\n`;let O=UY(W,K);for(let P of O){X=!0;let y=$3(P.key);M+=`await sql\`
150
150
  ALTER TABLE ${Z}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/database",
3
3
  "type": "module",
4
- "version": "0.68.0",
4
+ "version": "0.68.2",
5
5
  "description": "The Stacks database integration.",
6
6
  "author": "Chris Breuer",
7
7
  "contributors": ["Chris Breuer <chris@stacksjs.org>"],
@@ -42,21 +42,21 @@
42
42
  "prepublishOnly": "bun run build"
43
43
  },
44
44
  "dependencies": {
45
- "@stacksjs/cli": "0.67.0",
46
- "@stacksjs/config": "0.67.0",
47
- "@stacksjs/faker": "0.67.0",
48
- "@stacksjs/path": "0.67.0",
49
- "@stacksjs/query-builder": "0.67.0",
50
- "@stacksjs/storage": "0.67.0",
51
- "@stacksjs/strings": "0.67.0",
52
- "@stacksjs/utils": "0.67.0",
45
+ "@stacksjs/cli": "0.68.1",
46
+ "@stacksjs/config": "0.68.1",
47
+ "@stacksjs/faker": "0.68.1",
48
+ "@stacksjs/path": "0.68.1",
49
+ "@stacksjs/query-builder": "0.68.1",
50
+ "@stacksjs/storage": "0.68.1",
51
+ "@stacksjs/strings": "0.68.1",
52
+ "@stacksjs/utils": "0.68.1",
53
53
  "kysely-bun-worker": "^0.6.3"
54
54
  },
55
55
  "optionalDependencies": {
56
56
  "mysql2": "^3.11.3"
57
57
  },
58
58
  "devDependencies": {
59
- "@stacksjs/development": "0.67.0",
59
+ "@stacksjs/development": "0.68.1",
60
60
  "@types/tar": "^6.1.13",
61
61
  "debug": "^4.3.7",
62
62
  "mkdirp": "^3.0.1",