directus-extension-api-docs 1.9.1 → 1.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +10 -10
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e,t;!function(e){e.assertEqual=e=>e,e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const s of e)t[s]=s;return t},e.getValidEnumValues=t=>{const s=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),a={};for(const e of s)a[e]=t[e];return e.objectValues(a)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.push(s);return t},e.find=(e,t)=>{for(const s of e)if(t(s))return s},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(e||(e={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(t||(t={}));const s=e.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),a=e=>{switch(typeof e){case"undefined":return s.undefined;case"string":return s.string;case"number":return isNaN(e)?s.nan:s.number;case"boolean":return s.boolean;case"function":return s.function;case"bigint":return s.bigint;case"symbol":return s.symbol;case"object":return Array.isArray(e)?s.array:null===e?s.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?s.promise:"undefined"!=typeof Map&&e instanceof Map?s.map:"undefined"!=typeof Set&&e instanceof Set?s.set:"undefined"!=typeof Date&&e instanceof Date?s.date:s.object;default:return s.unknown}},n=e.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class r extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(e){return e.message},s={_errors:[]},a=e=>{for(const n of e.issues)if("invalid_union"===n.code)n.unionErrors.map(a);else if("invalid_return_type"===n.code)a(n.returnTypeError);else if("invalid_arguments"===n.code)a(n.argumentsError);else if(0===n.path.length)s._errors.push(t(n));else{let e=s,a=0;for(;a<n.path.length;){const s=n.path[a];a===n.path.length-1?(e[s]=e[s]||{_errors:[]},e[s]._errors.push(t(n))):e[s]=e[s]||{_errors:[]},e=e[s],a++}}};return a(this),s}toString(){return this.message}get message(){return JSON.stringify(this.issues,e.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=(e=>e.message)){const t={},s=[];for(const a of this.issues)a.path.length>0?(t[a.path[0]]=t[a.path[0]]||[],t[a.path[0]].push(e(a))):s.push(e(a));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}}r.create=e=>new r(e);const i=(t,a)=>{let r;switch(t.code){case n.invalid_type:r=t.received===s.undefined?"Required":`Expected ${t.expected}, received ${t.received}`;break;case n.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,e.jsonStringifyReplacer)}`;break;case n.unrecognized_keys:r=`Unrecognized key(s) in object: ${e.joinValues(t.keys,", ")}`;break;case n.invalid_union:r="Invalid input";break;case n.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${e.joinValues(t.options)}`;break;case n.invalid_enum_value:r=`Invalid enum value. Expected ${e.joinValues(t.options)}, received '${t.received}'`;break;case n.invalid_arguments:r="Invalid function arguments";break;case n.invalid_return_type:r="Invalid function return type";break;case n.invalid_date:r="Invalid date";break;case n.invalid_string:"object"==typeof t.validation?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,"number"==typeof t.validation.position&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:e.assertNever(t.validation):r="regex"!==t.validation?`Invalid ${t.validation}`:"Invalid";break;case n.too_small:r="array"===t.type?`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:"string"===t.type?`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:"number"===t.type?`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:"date"===t.type?`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:"Invalid input";break;case n.too_big:r="array"===t.type?`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:"string"===t.type?`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:"number"===t.type?`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:"bigint"===t.type?`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:"date"===t.type?`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:"Invalid input";break;case n.custom:r="Invalid input";break;case n.invalid_intersection_types:r="Intersection results could not be merged";break;case n.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case n.not_finite:r="Number must be finite";break;default:r=a.defaultError,e.assertNever(t)}return{message:r}};let o=i;function d(){return o}const c=e=>{const{data:t,path:s,errorMaps:a,issueData:n}=e,r=[...s,...n.path||[]],i={...n,path:r};let o="";const d=a.filter((e=>!!e)).slice().reverse();for(const e of d)o=e(i,{data:t,defaultError:o}).message;return{...n,path:r,message:n.message||o}};function u(e,t){const s=c({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,d(),i].filter((e=>!!e))});e.common.issues.push(s)}class l{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const s=[];for(const a of t){if("aborted"===a.status)return p;"dirty"===a.status&&e.dirty(),s.push(a.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){const s=[];for(const e of t)s.push({key:await e.key,value:await e.value});return l.mergeObjectSync(e,s)}static mergeObjectSync(e,t){const s={};for(const a of t){const{key:t,value:n}=a;if("aborted"===t.status)return p;if("aborted"===n.status)return p;"dirty"===t.status&&e.dirty(),"dirty"===n.status&&e.dirty(),"__proto__"===t.value||void 0===n.value&&!a.alwaysSet||(s[t.value]=n.value)}return{status:e.value,value:s}}}const p=Object.freeze({status:"aborted"}),h=e=>({status:"dirty",value:e}),m=e=>({status:"valid",value:e}),f=e=>"aborted"===e.status,y=e=>"dirty"===e.status,g=e=>"valid"===e.status,_=e=>"undefined"!=typeof Promise&&e instanceof Promise;var v;!function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(v||(v={}));class x{constructor(e,t,s,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=a}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const b=(e,t)=>{if(g(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new r(e.common.issues);return this._error=t,this._error}}};function k(e){if(!e)return{};const{errorMap:t,invalid_type_error:s,required_error:a,description:n}=e;if(t&&(s||a))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:n};return{errorMap:(e,t)=>"invalid_type"!==e.code?{message:t.defaultError}:void 0===t.data?{message:null!=a?a:t.defaultError}:{message:null!=s?s:t.defaultError},description:n}}class w{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return a(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:a(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new l,ctx:{common:e.parent.common,data:e.data,parsedType:a(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(_(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){var s;const n={common:{issues:[],async:null!==(s=null==t?void 0:t.async)&&void 0!==s&&s,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:a(e)},r=this._parseSync({data:e,path:n.path,parent:n});return b(n,r)}async parseAsync(e,t){const s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){const s={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:a(e)},n=this._parse({data:e,path:s.path,parent:s}),r=await(_(n)?n:Promise.resolve(n));return b(s,r)}refine(e,t){const s=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,a)=>{const r=e(t),i=()=>a.addIssue({code:n.custom,...s(t)});return"undefined"!=typeof Promise&&r instanceof Promise?r.then((e=>!!e||(i(),!1))):!!r||(i(),!1)}))}refinement(e,t){return this._refinement(((s,a)=>!!e(s)||(a.addIssue("function"==typeof t?t(s,a):t),!1)))}_refinement(e){return new ue({schema:this,typeName:ke.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return le.create(this,this._def)}nullable(){return pe.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return F.create(this,this._def)}promise(){return ce.create(this,this._def)}or(e){return J.create([this,e],this._def)}and(e){return X.create(this,e,this._def)}transform(e){return new ue({...k(this._def),schema:this,typeName:ke.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new he({...k(this._def),innerType:this,defaultValue:t,typeName:ke.ZodDefault})}brand(){return new ge({typeName:ke.ZodBranded,type:this,...k(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new me({...k(this._def),innerType:this,catchValue:t,typeName:ke.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return _e.create(this,e)}readonly(){return ve.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Z=/^c[^\s-]{8,}$/i,T=/^[a-z][a-z0-9]*$/,O=/^[0-9A-HJKMNP-TV-Z]{26}$/,S=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,j=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let N;const C=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,E=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;class I extends w{_parse(t){this._def.coerce&&(t.data=String(t.data));if(this._getType(t)!==s.string){const e=this._getOrReturnCtx(t);return u(e,{code:n.invalid_type,expected:s.string,received:e.parsedType}),p}const a=new l;let r;for(const s of this._def.checks)if("min"===s.kind)t.data.length<s.value&&(r=this._getOrReturnCtx(t,r),u(r,{code:n.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),a.dirty());else if("max"===s.kind)t.data.length>s.value&&(r=this._getOrReturnCtx(t,r),u(r,{code:n.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),a.dirty());else if("length"===s.kind){const e=t.data.length>s.value,i=t.data.length<s.value;(e||i)&&(r=this._getOrReturnCtx(t,r),e?u(r,{code:n.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):i&&u(r,{code:n.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),a.dirty())}else if("email"===s.kind)j.test(t.data)||(r=this._getOrReturnCtx(t,r),u(r,{validation:"email",code:n.invalid_string,message:s.message}),a.dirty());else if("emoji"===s.kind)N||(N=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),N.test(t.data)||(r=this._getOrReturnCtx(t,r),u(r,{validation:"emoji",code:n.invalid_string,message:s.message}),a.dirty());else if("uuid"===s.kind)S.test(t.data)||(r=this._getOrReturnCtx(t,r),u(r,{validation:"uuid",code:n.invalid_string,message:s.message}),a.dirty());else if("cuid"===s.kind)Z.test(t.data)||(r=this._getOrReturnCtx(t,r),u(r,{validation:"cuid",code:n.invalid_string,message:s.message}),a.dirty());else if("cuid2"===s.kind)T.test(t.data)||(r=this._getOrReturnCtx(t,r),u(r,{validation:"cuid2",code:n.invalid_string,message:s.message}),a.dirty());else if("ulid"===s.kind)O.test(t.data)||(r=this._getOrReturnCtx(t,r),u(r,{validation:"ulid",code:n.invalid_string,message:s.message}),a.dirty());else if("url"===s.kind)try{new URL(t.data)}catch(e){r=this._getOrReturnCtx(t,r),u(r,{validation:"url",code:n.invalid_string,message:s.message}),a.dirty()}else if("regex"===s.kind){s.regex.lastIndex=0;s.regex.test(t.data)||(r=this._getOrReturnCtx(t,r),u(r,{validation:"regex",code:n.invalid_string,message:s.message}),a.dirty())}else if("trim"===s.kind)t.data=t.data.trim();else if("includes"===s.kind)t.data.includes(s.value,s.position)||(r=this._getOrReturnCtx(t,r),u(r,{code:n.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),a.dirty());else if("toLowerCase"===s.kind)t.data=t.data.toLowerCase();else if("toUpperCase"===s.kind)t.data=t.data.toUpperCase();else if("startsWith"===s.kind)t.data.startsWith(s.value)||(r=this._getOrReturnCtx(t,r),u(r,{code:n.invalid_string,validation:{startsWith:s.value},message:s.message}),a.dirty());else if("endsWith"===s.kind)t.data.endsWith(s.value)||(r=this._getOrReturnCtx(t,r),u(r,{code:n.invalid_string,validation:{endsWith:s.value},message:s.message}),a.dirty());else if("datetime"===s.kind){((d=s).precision?d.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${d.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${d.precision}}Z$`):0===d.precision?d.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):d.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$")).test(t.data)||(r=this._getOrReturnCtx(t,r),u(r,{code:n.invalid_string,validation:"datetime",message:s.message}),a.dirty())}else"ip"===s.kind?(i=t.data,("v4"!==(o=s.version)&&o||!C.test(i))&&("v6"!==o&&o||!E.test(i))&&(r=this._getOrReturnCtx(t,r),u(r,{validation:"ip",code:n.invalid_string,message:s.message}),a.dirty())):e.assertNever(s);var i,o,d;return{status:a.value,value:t.data}}_regex(e,t,s){return this.refinement((t=>e.test(t)),{validation:t,code:n.invalid_string,...v.errToObj(s)})}_addCheck(e){return new I({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...v.errToObj(e)})}url(e){return this._addCheck({kind:"url",...v.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...v.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...v.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...v.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...v.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...v.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...v.errToObj(e)})}datetime(e){var t;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,...v.errToObj(null==e?void 0:e.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...v.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...v.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...v.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...v.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...v.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...v.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...v.errToObj(t)})}nonempty(e){return this.min(1,v.errToObj(e))}trim(){return new I({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new I({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new I({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function P(e,t){const s=(e.toString().split(".")[1]||"").length,a=(t.toString().split(".")[1]||"").length,n=s>a?s:a;return parseInt(e.toFixed(n).replace(".",""))%parseInt(t.toFixed(n).replace(".",""))/Math.pow(10,n)}I.create=e=>{var t;return new I({checks:[],typeName:ke.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...k(e)})};class R extends w{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){this._def.coerce&&(t.data=Number(t.data));if(this._getType(t)!==s.number){const e=this._getOrReturnCtx(t);return u(e,{code:n.invalid_type,expected:s.number,received:e.parsedType}),p}let a;const r=new l;for(const s of this._def.checks)if("int"===s.kind)e.isInteger(t.data)||(a=this._getOrReturnCtx(t,a),u(a,{code:n.invalid_type,expected:"integer",received:"float",message:s.message}),r.dirty());else if("min"===s.kind){(s.inclusive?t.data<s.value:t.data<=s.value)&&(a=this._getOrReturnCtx(t,a),u(a,{code:n.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty())}else if("max"===s.kind){(s.inclusive?t.data>s.value:t.data>=s.value)&&(a=this._getOrReturnCtx(t,a),u(a,{code:n.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty())}else"multipleOf"===s.kind?0!==P(t.data,s.value)&&(a=this._getOrReturnCtx(t,a),u(a,{code:n.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):"finite"===s.kind?Number.isFinite(t.data)||(a=this._getOrReturnCtx(t,a),u(a,{code:n.not_finite,message:s.message}),r.dirty()):e.assertNever(s);return{status:r.value,value:t.data}}gte(e,t){return this.setLimit("min",e,!0,v.toString(t))}gt(e,t){return this.setLimit("min",e,!1,v.toString(t))}lte(e,t){return this.setLimit("max",e,!0,v.toString(t))}lt(e,t){return this.setLimit("max",e,!1,v.toString(t))}setLimit(e,t,s,a){return new R({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:v.toString(a)}]})}_addCheck(e){return new R({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:v.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:v.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:v.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:v.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:v.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:v.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:v.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:v.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:v.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find((t=>"int"===t.kind||"multipleOf"===t.kind&&e.isInteger(t.value)))}get isFinite(){let e=null,t=null;for(const s of this._def.checks){if("finite"===s.kind||"int"===s.kind||"multipleOf"===s.kind)return!0;"min"===s.kind?(null===t||s.value>t)&&(t=s.value):"max"===s.kind&&(null===e||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}}R.create=e=>new R({checks:[],typeName:ke.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...k(e)});class A extends w{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){this._def.coerce&&(t.data=BigInt(t.data));if(this._getType(t)!==s.bigint){const e=this._getOrReturnCtx(t);return u(e,{code:n.invalid_type,expected:s.bigint,received:e.parsedType}),p}let a;const r=new l;for(const s of this._def.checks)if("min"===s.kind){(s.inclusive?t.data<s.value:t.data<=s.value)&&(a=this._getOrReturnCtx(t,a),u(a,{code:n.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty())}else if("max"===s.kind){(s.inclusive?t.data>s.value:t.data>=s.value)&&(a=this._getOrReturnCtx(t,a),u(a,{code:n.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty())}else"multipleOf"===s.kind?t.data%s.value!==BigInt(0)&&(a=this._getOrReturnCtx(t,a),u(a,{code:n.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):e.assertNever(s);return{status:r.value,value:t.data}}gte(e,t){return this.setLimit("min",e,!0,v.toString(t))}gt(e,t){return this.setLimit("min",e,!1,v.toString(t))}lte(e,t){return this.setLimit("max",e,!0,v.toString(t))}lt(e,t){return this.setLimit("max",e,!1,v.toString(t))}setLimit(e,t,s,a){return new A({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:v.toString(a)}]})}_addCheck(e){return new A({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:v.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:v.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:v.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:v.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:v.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}A.create=e=>{var t;return new A({checks:[],typeName:ke.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...k(e)})};class $ extends w{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==s.boolean){const t=this._getOrReturnCtx(e);return u(t,{code:n.invalid_type,expected:s.boolean,received:t.parsedType}),p}return m(e.data)}}$.create=e=>new $({typeName:ke.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...k(e)});class M extends w{_parse(t){this._def.coerce&&(t.data=new Date(t.data));if(this._getType(t)!==s.date){const e=this._getOrReturnCtx(t);return u(e,{code:n.invalid_type,expected:s.date,received:e.parsedType}),p}if(isNaN(t.data.getTime())){return u(this._getOrReturnCtx(t),{code:n.invalid_date}),p}const a=new l;let r;for(const s of this._def.checks)"min"===s.kind?t.data.getTime()<s.value&&(r=this._getOrReturnCtx(t,r),u(r,{code:n.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),a.dirty()):"max"===s.kind?t.data.getTime()>s.value&&(r=this._getOrReturnCtx(t,r),u(r,{code:n.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),a.dirty()):e.assertNever(s);return{status:a.value,value:new Date(t.data.getTime())}}_addCheck(e){return new M({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:v.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:v.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}M.create=e=>new M({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:ke.ZodDate,...k(e)});class L extends w{_parse(e){if(this._getType(e)!==s.symbol){const t=this._getOrReturnCtx(e);return u(t,{code:n.invalid_type,expected:s.symbol,received:t.parsedType}),p}return m(e.data)}}L.create=e=>new L({typeName:ke.ZodSymbol,...k(e)});class D extends w{_parse(e){if(this._getType(e)!==s.undefined){const t=this._getOrReturnCtx(e);return u(t,{code:n.invalid_type,expected:s.undefined,received:t.parsedType}),p}return m(e.data)}}D.create=e=>new D({typeName:ke.ZodUndefined,...k(e)});class V extends w{_parse(e){if(this._getType(e)!==s.null){const t=this._getOrReturnCtx(e);return u(t,{code:n.invalid_type,expected:s.null,received:t.parsedType}),p}return m(e.data)}}V.create=e=>new V({typeName:ke.ZodNull,...k(e)});class z extends w{constructor(){super(...arguments),this._any=!0}_parse(e){return m(e.data)}}z.create=e=>new z({typeName:ke.ZodAny,...k(e)});class U extends w{constructor(){super(...arguments),this._unknown=!0}_parse(e){return m(e.data)}}U.create=e=>new U({typeName:ke.ZodUnknown,...k(e)});class K extends w{_parse(e){const t=this._getOrReturnCtx(e);return u(t,{code:n.invalid_type,expected:s.never,received:t.parsedType}),p}}K.create=e=>new K({typeName:ke.ZodNever,...k(e)});class q extends w{_parse(e){if(this._getType(e)!==s.undefined){const t=this._getOrReturnCtx(e);return u(t,{code:n.invalid_type,expected:s.void,received:t.parsedType}),p}return m(e.data)}}q.create=e=>new q({typeName:ke.ZodVoid,...k(e)});class F extends w{_parse(e){const{ctx:t,status:a}=this._processInputParams(e),r=this._def;if(t.parsedType!==s.array)return u(t,{code:n.invalid_type,expected:s.array,received:t.parsedType}),p;if(null!==r.exactLength){const e=t.data.length>r.exactLength.value,s=t.data.length<r.exactLength.value;(e||s)&&(u(t,{code:e?n.too_big:n.too_small,minimum:s?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),a.dirty())}if(null!==r.minLength&&t.data.length<r.minLength.value&&(u(t,{code:n.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),a.dirty()),null!==r.maxLength&&t.data.length>r.maxLength.value&&(u(t,{code:n.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),a.dirty()),t.common.async)return Promise.all([...t.data].map(((e,s)=>r.type._parseAsync(new x(t,e,t.path,s))))).then((e=>l.mergeArray(a,e)));const i=[...t.data].map(((e,s)=>r.type._parseSync(new x(t,e,t.path,s))));return l.mergeArray(a,i)}get element(){return this._def.type}min(e,t){return new F({...this._def,minLength:{value:e,message:v.toString(t)}})}max(e,t){return new F({...this._def,maxLength:{value:e,message:v.toString(t)}})}length(e,t){return new F({...this._def,exactLength:{value:e,message:v.toString(t)}})}nonempty(e){return this.min(1,e)}}function B(e){if(e instanceof W){const t={};for(const s in e.shape){const a=e.shape[s];t[s]=le.create(B(a))}return new W({...e._def,shape:()=>t})}return e instanceof F?new F({...e._def,type:B(e.element)}):e instanceof le?le.create(B(e.unwrap())):e instanceof pe?pe.create(B(e.unwrap())):e instanceof Q?Q.create(e.items.map((e=>B(e)))):e}F.create=(e,t)=>new F({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ke.ZodArray,...k(t)});class W extends w{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const t=this._def.shape(),s=e.objectKeys(t);return this._cached={shape:t,keys:s}}_parse(e){if(this._getType(e)!==s.object){const t=this._getOrReturnCtx(e);return u(t,{code:n.invalid_type,expected:s.object,received:t.parsedType}),p}const{status:t,ctx:a}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof K&&"strip"===this._def.unknownKeys))for(const e in a.data)i.includes(e)||o.push(e);const d=[];for(const e of i){const t=r[e],s=a.data[e];d.push({key:{status:"valid",value:e},value:t._parse(new x(a,s,a.path,e)),alwaysSet:e in a.data})}if(this._def.catchall instanceof K){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of o)d.push({key:{status:"valid",value:e},value:{status:"valid",value:a.data[e]}});else if("strict"===e)o.length>0&&(u(a,{code:n.unrecognized_keys,keys:o}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of o){const s=a.data[t];d.push({key:{status:"valid",value:t},value:e._parse(new x(a,s,a.path,t)),alwaysSet:t in a.data})}}return a.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of d){const s=await t.key;e.push({key:s,value:await t.value,alwaysSet:t.alwaysSet})}return e})).then((e=>l.mergeObjectSync(t,e))):l.mergeObjectSync(t,d)}get shape(){return this._def.shape()}strict(e){return v.errToObj,new W({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,s)=>{var a,n,r,i;const o=null!==(r=null===(n=(a=this._def).errorMap)||void 0===n?void 0:n.call(a,t,s).message)&&void 0!==r?r:s.defaultError;return"unrecognized_keys"===t.code?{message:null!==(i=v.errToObj(e).message)&&void 0!==i?i:o}:{message:o}}}:{}})}strip(){return new W({...this._def,unknownKeys:"strip"})}passthrough(){return new W({...this._def,unknownKeys:"passthrough"})}extend(e){return new W({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new W({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ke.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new W({...this._def,catchall:e})}pick(t){const s={};return e.objectKeys(t).forEach((e=>{t[e]&&this.shape[e]&&(s[e]=this.shape[e])})),new W({...this._def,shape:()=>s})}omit(t){const s={};return e.objectKeys(this.shape).forEach((e=>{t[e]||(s[e]=this.shape[e])})),new W({...this._def,shape:()=>s})}deepPartial(){return B(this)}partial(t){const s={};return e.objectKeys(this.shape).forEach((e=>{const a=this.shape[e];t&&!t[e]?s[e]=a:s[e]=a.optional()})),new W({...this._def,shape:()=>s})}required(t){const s={};return e.objectKeys(this.shape).forEach((e=>{if(t&&!t[e])s[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof le;)t=t._def.innerType;s[e]=t}})),new W({...this._def,shape:()=>s})}keyof(){return ie(e.objectKeys(this.shape))}}W.create=(e,t)=>new W({shape:()=>e,unknownKeys:"strip",catchall:K.create(),typeName:ke.ZodObject,...k(t)}),W.strictCreate=(e,t)=>new W({shape:()=>e,unknownKeys:"strict",catchall:K.create(),typeName:ke.ZodObject,...k(t)}),W.lazycreate=(e,t)=>new W({shape:e,unknownKeys:"strip",catchall:K.create(),typeName:ke.ZodObject,...k(t)});class J extends w{_parse(e){const{ctx:t}=this._processInputParams(e),s=this._def.options;if(t.common.async)return Promise.all(s.map((async e=>{const s={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:s}),ctx:s}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const s of e)if("dirty"===s.result.status)return t.common.issues.push(...s.ctx.common.issues),s.result;const s=e.map((e=>new r(e.ctx.common.issues)));return u(t,{code:n.invalid_union,unionErrors:s}),p}));{let e;const a=[];for(const n of s){const s={...t,common:{...t.common,issues:[]},parent:null},r=n._parseSync({data:t.data,path:t.path,parent:s});if("valid"===r.status)return r;"dirty"!==r.status||e||(e={result:r,ctx:s}),s.common.issues.length&&a.push(s.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const i=a.map((e=>new r(e)));return u(t,{code:n.invalid_union,unionErrors:i}),p}}get options(){return this._def.options}}J.create=(e,t)=>new J({options:e,typeName:ke.ZodUnion,...k(t)});const G=e=>e instanceof ne?G(e.schema):e instanceof ue?G(e.innerType()):e instanceof re?[e.value]:e instanceof oe?e.options:e instanceof de?Object.keys(e.enum):e instanceof he?G(e._def.innerType):e instanceof D?[void 0]:e instanceof V?[null]:null;class H extends w{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==s.object)return u(t,{code:n.invalid_type,expected:s.object,received:t.parsedType}),p;const a=this.discriminator,r=t.data[a],i=this.optionsMap.get(r);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(u(t,{code:n.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[a]}),p)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){const a=new Map;for(const s of t){const t=G(s.shape[e]);if(!t)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const n of t){if(a.has(n))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(n)}`);a.set(n,s)}}return new H({typeName:ke.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...k(s)})}}function Y(t,n){const r=a(t),i=a(n);if(t===n)return{valid:!0,data:t};if(r===s.object&&i===s.object){const s=e.objectKeys(n),a=e.objectKeys(t).filter((e=>-1!==s.indexOf(e))),r={...t,...n};for(const e of a){const s=Y(t[e],n[e]);if(!s.valid)return{valid:!1};r[e]=s.data}return{valid:!0,data:r}}if(r===s.array&&i===s.array){if(t.length!==n.length)return{valid:!1};const e=[];for(let s=0;s<t.length;s++){const a=Y(t[s],n[s]);if(!a.valid)return{valid:!1};e.push(a.data)}return{valid:!0,data:e}}return r===s.date&&i===s.date&&+t==+n?{valid:!0,data:t}:{valid:!1}}class X extends w{_parse(e){const{status:t,ctx:s}=this._processInputParams(e),a=(e,a)=>{if(f(e)||f(a))return p;const r=Y(e.value,a.value);return r.valid?((y(e)||y(a))&&t.dirty(),{status:t.value,value:r.data}):(u(s,{code:n.invalid_intersection_types}),p)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then((([e,t])=>a(e,t))):a(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}X.create=(e,t,s)=>new X({left:e,right:t,typeName:ke.ZodIntersection,...k(s)});class Q extends w{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==s.array)return u(a,{code:n.invalid_type,expected:s.array,received:a.parsedType}),p;if(a.data.length<this._def.items.length)return u(a,{code:n.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),p;!this._def.rest&&a.data.length>this._def.items.length&&(u(a,{code:n.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const r=[...a.data].map(((e,t)=>{const s=this._def.items[t]||this._def.rest;return s?s._parse(new x(a,e,a.path,t)):null})).filter((e=>!!e));return a.common.async?Promise.all(r).then((e=>l.mergeArray(t,e))):l.mergeArray(t,r)}get items(){return this._def.items}rest(e){return new Q({...this._def,rest:e})}}Q.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Q({items:e,typeName:ke.ZodTuple,rest:null,...k(t)})};class ee extends w{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==s.object)return u(a,{code:n.invalid_type,expected:s.object,received:a.parsedType}),p;const r=[],i=this._def.keyType,o=this._def.valueType;for(const e in a.data)r.push({key:i._parse(new x(a,e,a.path,e)),value:o._parse(new x(a,a.data[e],a.path,e))});return a.common.async?l.mergeObjectAsync(t,r):l.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,s){return new ee(t instanceof w?{keyType:e,valueType:t,typeName:ke.ZodRecord,...k(s)}:{keyType:I.create(),valueType:e,typeName:ke.ZodRecord,...k(t)})}}class te extends w{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==s.map)return u(a,{code:n.invalid_type,expected:s.map,received:a.parsedType}),p;const r=this._def.keyType,i=this._def.valueType,o=[...a.data.entries()].map((([e,t],s)=>({key:r._parse(new x(a,e,a.path,[s,"key"])),value:i._parse(new x(a,t,a.path,[s,"value"]))})));if(a.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const s of o){const a=await s.key,n=await s.value;if("aborted"===a.status||"aborted"===n.status)return p;"dirty"!==a.status&&"dirty"!==n.status||t.dirty(),e.set(a.value,n.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const s of o){const a=s.key,n=s.value;if("aborted"===a.status||"aborted"===n.status)return p;"dirty"!==a.status&&"dirty"!==n.status||t.dirty(),e.set(a.value,n.value)}return{status:t.value,value:e}}}}te.create=(e,t,s)=>new te({valueType:t,keyType:e,typeName:ke.ZodMap,...k(s)});class se extends w{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==s.set)return u(a,{code:n.invalid_type,expected:s.set,received:a.parsedType}),p;const r=this._def;null!==r.minSize&&a.data.size<r.minSize.value&&(u(a,{code:n.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),null!==r.maxSize&&a.data.size>r.maxSize.value&&(u(a,{code:n.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());const i=this._def.valueType;function o(e){const s=new Set;for(const a of e){if("aborted"===a.status)return p;"dirty"===a.status&&t.dirty(),s.add(a.value)}return{status:t.value,value:s}}const d=[...a.data.values()].map(((e,t)=>i._parse(new x(a,e,a.path,t))));return a.common.async?Promise.all(d).then((e=>o(e))):o(d)}min(e,t){return new se({...this._def,minSize:{value:e,message:v.toString(t)}})}max(e,t){return new se({...this._def,maxSize:{value:e,message:v.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}se.create=(e,t)=>new se({valueType:e,minSize:null,maxSize:null,typeName:ke.ZodSet,...k(t)});class ae extends w{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==s.function)return u(t,{code:n.invalid_type,expected:s.function,received:t.parsedType}),p;function a(e,s){return c({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,d(),i].filter((e=>!!e)),issueData:{code:n.invalid_arguments,argumentsError:s}})}function o(e,s){return c({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,d(),i].filter((e=>!!e)),issueData:{code:n.invalid_return_type,returnTypeError:s}})}const l={errorMap:t.common.contextualErrorMap},h=t.data;if(this._def.returns instanceof ce){const e=this;return m((async function(...t){const s=new r([]),n=await e._def.args.parseAsync(t,l).catch((e=>{throw s.addIssue(a(t,e)),s})),i=await Reflect.apply(h,this,n);return await e._def.returns._def.type.parseAsync(i,l).catch((e=>{throw s.addIssue(o(i,e)),s}))}))}{const e=this;return m((function(...t){const s=e._def.args.safeParse(t,l);if(!s.success)throw new r([a(t,s.error)]);const n=Reflect.apply(h,this,s.data),i=e._def.returns.safeParse(n,l);if(!i.success)throw new r([o(n,i.error)]);return i.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ae({...this._def,args:Q.create(e).rest(U.create())})}returns(e){return new ae({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new ae({args:e||Q.create([]).rest(U.create()),returns:t||U.create(),typeName:ke.ZodFunction,...k(s)})}}class ne extends w{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}ne.create=(e,t)=>new ne({getter:e,typeName:ke.ZodLazy,...k(t)});class re extends w{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return u(t,{received:t.data,code:n.invalid_literal,expected:this._def.value}),p}return{status:"valid",value:e.data}}get value(){return this._def.value}}function ie(e,t){return new oe({values:e,typeName:ke.ZodEnum,...k(t)})}re.create=(e,t)=>new re({value:e,typeName:ke.ZodLiteral,...k(t)});class oe extends w{_parse(t){if("string"!=typeof t.data){const s=this._getOrReturnCtx(t),a=this._def.values;return u(s,{expected:e.joinValues(a),received:s.parsedType,code:n.invalid_type}),p}if(-1===this._def.values.indexOf(t.data)){const e=this._getOrReturnCtx(t),s=this._def.values;return u(e,{received:e.data,code:n.invalid_enum_value,options:s}),p}return m(t.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e){return oe.create(e)}exclude(e){return oe.create(this.options.filter((t=>!e.includes(t))))}}oe.create=ie;class de extends w{_parse(t){const a=e.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==s.string&&r.parsedType!==s.number){const t=e.objectValues(a);return u(r,{expected:e.joinValues(t),received:r.parsedType,code:n.invalid_type}),p}if(-1===a.indexOf(t.data)){const t=e.objectValues(a);return u(r,{received:r.data,code:n.invalid_enum_value,options:t}),p}return m(t.data)}get enum(){return this._def.values}}de.create=(e,t)=>new de({values:e,typeName:ke.ZodNativeEnum,...k(t)});class ce extends w{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==s.promise&&!1===t.common.async)return u(t,{code:n.invalid_type,expected:s.promise,received:t.parsedType}),p;const a=t.parsedType===s.promise?t.data:Promise.resolve(t.data);return m(a.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}ce.create=(e,t)=>new ce({type:e,typeName:ke.ZodPromise,...k(t)});class ue extends w{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ke.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:s,ctx:a}=this._processInputParams(t),n=this._def.effect||null,r={addIssue:e=>{u(a,e),e.fatal?s.abort():s.dirty()},get path(){return a.path}};if(r.addIssue=r.addIssue.bind(r),"preprocess"===n.type){const e=n.transform(a.data,r);return a.common.issues.length?{status:"dirty",value:a.data}:a.common.async?Promise.resolve(e).then((e=>this._def.schema._parseAsync({data:e,path:a.path,parent:a}))):this._def.schema._parseSync({data:e,path:a.path,parent:a})}if("refinement"===n.type){const e=e=>{const t=n.refinement(e,r);if(a.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===a.common.async){const t=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return"aborted"===t.status?p:("dirty"===t.status&&s.dirty(),e(t.value),{status:s.value,value:t.value})}return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then((t=>"aborted"===t.status?p:("dirty"===t.status&&s.dirty(),e(t.value).then((()=>({status:s.value,value:t.value}))))))}if("transform"===n.type){if(!1===a.common.async){const e=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if(!g(e))return e;const t=n.transform(e.value,r);if(t instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:s.value,value:t}}return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then((e=>g(e)?Promise.resolve(n.transform(e.value,r)).then((e=>({status:s.value,value:e}))):e))}e.assertNever(n)}}ue.create=(e,t,s)=>new ue({schema:e,typeName:ke.ZodEffects,effect:t,...k(s)}),ue.createWithPreprocess=(e,t,s)=>new ue({schema:t,effect:{type:"preprocess",transform:e},typeName:ke.ZodEffects,...k(s)});class le extends w{_parse(e){return this._getType(e)===s.undefined?m(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}le.create=(e,t)=>new le({innerType:e,typeName:ke.ZodOptional,...k(t)});class pe extends w{_parse(e){return this._getType(e)===s.null?m(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}pe.create=(e,t)=>new pe({innerType:e,typeName:ke.ZodNullable,...k(t)});class he extends w{_parse(e){const{ctx:t}=this._processInputParams(e);let a=t.data;return t.parsedType===s.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}he.create=(e,t)=>new he({innerType:e,typeName:ke.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...k(t)});class me extends w{_parse(e){const{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return _(a)?a.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new r(s.common.issues)},input:s.data})}))):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new r(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}me.create=(e,t)=>new me({innerType:e,typeName:ke.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...k(t)});class fe extends w{_parse(e){if(this._getType(e)!==s.nan){const t=this._getOrReturnCtx(e);return u(t,{code:n.invalid_type,expected:s.nan,received:t.parsedType}),p}return{status:"valid",value:e.data}}}fe.create=e=>new fe({typeName:ke.ZodNaN,...k(e)});const ye=Symbol("zod_brand");class ge extends w{_parse(e){const{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}}class _e extends w{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return"aborted"===e.status?p:"dirty"===e.status?(t.dirty(),h(e.value)):this._def.out._parseAsync({data:e.value,path:s.path,parent:s})})()}{const e=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return"aborted"===e.status?p:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:s.path,parent:s})}}static create(e,t){return new _e({in:e,out:t,typeName:ke.ZodPipeline})}}class ve extends w{_parse(e){const t=this._def.innerType._parse(e);return g(t)&&(t.value=Object.freeze(t.value)),t}}ve.create=(e,t)=>new ve({innerType:e,typeName:ke.ZodReadonly,...k(t)});const xe=(e,t={},s)=>e?z.create().superRefine(((a,n)=>{var r,i;if(!e(a)){const e="function"==typeof t?t(a):"string"==typeof t?{message:t}:t,o=null===(i=null!==(r=e.fatal)&&void 0!==r?r:s)||void 0===i||i,d="string"==typeof e?{message:e}:e;n.addIssue({code:"custom",...d,fatal:o})}})):z.create(),be={object:W.lazycreate};var ke;!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(ke||(ke={}));const we=I.create,Ze=R.create,Te=fe.create,Oe=A.create,Se=$.create,je=M.create,Ne=L.create,Ce=D.create,Ee=V.create,Ie=z.create,Pe=U.create,Re=K.create,Ae=q.create,$e=F.create,Me=W.create,Le=W.strictCreate,De=J.create,Ve=H.create,ze=X.create,Ue=Q.create,Ke=ee.create,qe=te.create,Fe=se.create,Be=ae.create,We=ne.create,Je=re.create,Ge=oe.create,He=de.create,Ye=ce.create,Xe=ue.create,Qe=le.create,et=pe.create,tt=ue.createWithPreprocess,st=_e.create,at={string:e=>I.create({...e,coerce:!0}),number:e=>R.create({...e,coerce:!0}),boolean:e=>$.create({...e,coerce:!0}),bigint:e=>A.create({...e,coerce:!0}),date:e=>M.create({...e,coerce:!0})},nt=p;var rt=Object.freeze({__proto__:null,defaultErrorMap:i,setErrorMap:function(e){o=e},getErrorMap:d,makeIssue:c,EMPTY_PATH:[],addIssueToContext:u,ParseStatus:l,INVALID:p,DIRTY:h,OK:m,isAborted:f,isDirty:y,isValid:g,isAsync:_,get util(){return e},get objectUtil(){return t},ZodParsedType:s,getParsedType:a,ZodType:w,ZodString:I,ZodNumber:R,ZodBigInt:A,ZodBoolean:$,ZodDate:M,ZodSymbol:L,ZodUndefined:D,ZodNull:V,ZodAny:z,ZodUnknown:U,ZodNever:K,ZodVoid:q,ZodArray:F,ZodObject:W,ZodUnion:J,ZodDiscriminatedUnion:H,ZodIntersection:X,ZodTuple:Q,ZodRecord:ee,ZodMap:te,ZodSet:se,ZodFunction:ae,ZodLazy:ne,ZodLiteral:re,ZodEnum:oe,ZodNativeEnum:de,ZodPromise:ce,ZodEffects:ue,ZodTransformer:ue,ZodOptional:le,ZodNullable:pe,ZodDefault:he,ZodCatch:me,ZodNaN:fe,BRAND:ye,ZodBranded:ge,ZodPipeline:_e,ZodReadonly:ve,custom:xe,Schema:w,ZodSchema:w,late:be,get ZodFirstPartyTypeKind(){return ke},coerce:at,any:Ie,array:$e,bigint:Oe,boolean:Se,date:je,discriminatedUnion:Ve,effect:Xe,enum:Ge,function:Be,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>xe((t=>t instanceof e),t),intersection:ze,lazy:We,literal:Je,map:qe,nan:Te,nativeEnum:He,never:Re,null:Ee,nullable:et,number:Ze,object:Me,oboolean:()=>Se().optional(),onumber:()=>Ze().optional(),optional:Qe,ostring:()=>we().optional(),pipeline:st,preprocess:tt,promise:Ye,record:Ke,set:Fe,strictObject:Le,string:we,symbol:Ne,transformer:Xe,tuple:Ue,undefined:Ce,union:De,unknown:Pe,void:Ae,NEVER:nt,ZodIssueCode:n,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:r}),it=["interface","display","layout","module","panel","theme"],ot=["hook","endpoint"],dt=["operation"],ct="directus:extension",ut=rt.object({app:rt.string(),api:rt.string()}),lt=rt.object({request:rt.optional(rt.object({urls:rt.array(rt.string()),methods:rt.array(rt.union([rt.literal("GET"),rt.literal("POST"),rt.literal("PATCH"),rt.literal("PUT"),rt.literal("DELETE")]))})),log:rt.optional(rt.object({})),sleep:rt.optional(rt.object({}))}),pt=rt.optional(rt.object({enabled:rt.boolean(),requestedScopes:lt})),ht=rt.union([rt.object({type:rt.enum(ot),name:rt.string(),source:rt.string()}),rt.object({type:rt.enum(it),name:rt.string(),source:rt.string()}),rt.object({type:rt.enum(dt),name:rt.string(),source:ut})]),mt=rt.object({host:rt.string(),hidden:rt.boolean().optional()}),ft=rt.object({type:rt.enum(it),path:rt.string(),source:rt.string()}),yt=rt.object({type:rt.enum(ot),path:rt.string(),source:rt.string(),sandbox:pt}),gt=rt.object({type:rt.enum(dt),path:ut,source:ut,sandbox:pt}),_t=rt.object({type:rt.literal("bundle"),partial:rt.boolean().optional(),path:ut,entries:rt.array(ht)});rt.array(ht);var vt=mt.and(rt.union([ft,yt,gt,_t]));rt.object({name:rt.string(),version:rt.string(),type:rt.union([rt.literal("module"),rt.literal("commonjs")]).optional(),description:rt.string().optional(),icon:rt.string().optional(),dependencies:rt.record(rt.string()).optional(),devDependencies:rt.record(rt.string()).optional(),[ct]:vt});const{findWorkspaceDir:xt}=require("@pnpm/find-workspace-dir"),bt=require("js-yaml"),kt=require("path"),wt=require("fs"),Zt=()=>process.cwd();let Tt;async function Ot(e,t){if(Tt)return JSON.parse(Tt);const{SpecificationService:s}=e,a=new s({accountability:{admin:!0},schema:t});return Tt=JSON.stringify(await a.oas.generate()),JSON.parse(Tt)}function St(e,t){return Object.entries(t).reduce(((e,[t,s])=>(e[t]=s&&"object"==typeof s?St(e[t]=e[t]||(Array.isArray(s)?[]:{}),s):s,e)),e)}const jt=require("swagger-ui-express"),Nt=require("express-openapi-validator"),Ct=function(){const e=function(){const e={docsPath:"api-docs",info:{},tags:[],publishedTags:[],paths:{},components:{}};try{const t=kt.join(Zt(),"./extensions/endpoints/oasconfig.yaml"),s=bt.load(wt.readFileSync(t,{encoding:"utf-8"}));return s.docsPath=s.docsPath||e.docsPath,s.info=s.info||e.info,s.tags=s.tags||e.tags,s.paths=s.paths||e.paths,s.components=s.components||e.components,s}catch{return e}}();try{const t=kt.join(Zt(),"./extensions/endpoints"),s=wt.readdirSync(t,{withFileTypes:!0});for(const a of s){const s=`${t}/${a.name}/oas.yaml`;if(a.isDirectory()&&wt.existsSync(s)){const t=bt.load(wt.readFileSync(s,{encoding:"utf-8"}));e.tags=[...e.tags,...t.tags||[]],e.paths={...e.paths,...t.paths||{}},e.components=St(e.components||{},t.components||{})}}return e}catch(t){return e}}(),Et=Ct.docsPath;var It={id:Et,validate:async function(e,t,s,a){if(null==Ct?void 0:Ct.paths){const n=await Ot(t,s);if(a)for(const e of a)n.paths[e]=Ct.paths[e];else n.paths=Ct.paths;Ct.components?n.components=Ct.components:(delete n.components.definitions,delete n.components.schemas),e.use(Nt.middleware({apiSpec:n})),e.use(((e,t,s,a)=>{s.status(e.status||500).json({message:e.message,errors:e.errors})}))}return e},handler:(e,{services:t,logger:s,getSchema:a})=>{const n={swaggerOptions:{url:`/${Et}/oas`}};e.use("/",jt.serve),e.get("/",jt.setup({},n)),e.get("/oas",(async(e,n,r)=>{var i;try{const e=await a(),r=await Ot(t,e),o=await async function(){try{const e=await xt(".");return require(`${e||Zt()}/package.json`)}catch(e){return{}}}();r.info.title=Ct.info.title||(null==o?void 0:o.name)||r.info.title,r.info.version=Ct.info.version||(null==o?void 0:o.version)||r.info.version,r.info.description=Ct.info.description||(null==o?void 0:o.description)||r.info.description;try{for(const e in Ct.paths)r.paths[e]=Ct.paths[e];for(const e of Ct.tags)r.tags.push(e);r.components=St(Ct.components,r.components)}catch(e){s.info("No custom definitions")}(null==(i=Ct.publishedTags)?void 0:i.length)&&function(e,t){for(const s in t.paths)for(const a in t.paths[s]){let n=!1;const r=t.paths[s][a].tags||[];r.forEach((t=>{n=n||e.publishedTags.includes(t)})),t.paths[s][a].tags=r.filter((t=>e.publishedTags.includes(t))),n||delete t.paths[s][a]}t.tags=t.tags.filter((t=>e.publishedTags.includes(t.name)))}(Ct,r),n.json(r)}catch(e){return r(new Error(e.message||e[0].message))}}))}};module.exports=It;
1
+ import{defineEndpoint as s}from"@directus/extensions-sdk";const{findWorkspaceDir:t}=require("@pnpm/find-workspace-dir"),e=require("js-yaml"),n=require("path"),o=require("fs"),i=()=>process.cwd();let a;async function r(s,t){if(a)return JSON.parse(a);const{SpecificationService:e}=s,n=new e({accountability:{admin:!0},schema:t});return a=JSON.stringify(await n.oas.generate()),JSON.parse(a)}function c(s,t){return Object.entries(t).reduce(((s,[t,e])=>(s[t]=e&&"object"==typeof e?c(s[t]=s[t]||(Array.isArray(e)?[]:{}),e):e,s)),s)}const p=require("swagger-ui-express"),u=require("express-openapi-validator"),d=function(){const s=function(){const s={docsPath:"api-docs",info:{},tags:[],publishedTags:[],paths:{},components:{}};try{const t=n.join(i(),"./extensions/endpoints/oasconfig.yaml"),a=e.load(o.readFileSync(t,{encoding:"utf-8"}));return a.docsPath=a.docsPath||s.docsPath,a.info=a.info||s.info,a.tags=a.tags||s.tags,a.paths=a.paths||s.paths,a.components=a.components||s.components,a}catch{return s}}();try{const t=n.join(i(),"./extensions/endpoints"),a=o.readdirSync(t,{withFileTypes:!0});for(const n of a){const i=`${t}/${n.name}/oas.yaml`;if(n.isDirectory()&&o.existsSync(i)){const t=e.load(o.readFileSync(i,{encoding:"utf-8"}));s.tags=[...s.tags,...t.tags||[]],s.paths={...s.paths,...t.paths||{}},s.components=c(s.components||{},t.components||{})}}return s}catch(t){return s}}(),f=d.docsPath;var l={id:f,validate:async function(s,t,e,n){if(null==d?void 0:d.paths){const o=await r(t,e);if(n)for(const s of n)o.paths[s]=d.paths[s];else o.paths=d.paths;d.components?o.components=d.components:(delete o.components.definitions,delete o.components.schemas),s.use(u.middleware({apiSpec:o})),s.use(((s,t,e,n)=>{e.status(s.status||500).json({message:s.message,errors:s.errors})}))}return s},handler:s(((s,{services:e,logger:n,getSchema:o})=>{const a={swaggerOptions:{url:`/${f}/oas`}};s.use("/",p.serve),s.get("/",p.setup({},a)),s.get("/oas",(async(s,a,p)=>{var u;try{const s=await o(),p=await r(e,s),f=await async function(){try{const s=await t(".");return require(`${s||i()}/package.json`)}catch(s){return{}}}();p.info.title=d.info.title||(null==f?void 0:f.name)||p.info.title,p.info.version=d.info.version||(null==f?void 0:f.version)||p.info.version,p.info.description=d.info.description||(null==f?void 0:f.description)||p.info.description;try{for(const s in d.paths)p.paths[s]=d.paths[s];for(const s of d.tags)p.tags.push(s);p.components=c(d.components,p.components)}catch(s){n.info("No custom definitions")}(null==(u=d.publishedTags)?void 0:u.length)&&function(s,t){for(const e in t.paths)for(const n in t.paths[e]){let o=!1;const i=t.paths[e][n].tags||[];i.forEach((t=>{o=o||s.publishedTags.includes(t)})),t.paths[e][n].tags=i.filter((t=>s.publishedTags.includes(t))),o||delete t.paths[e][n]}t.tags=t.tags.filter((t=>s.publishedTags.includes(t.name)))}(d,p),a.json(p)}catch(s){return p(new Error(s.message||s[0].message))}}))}))};export{l as default};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "directus-extension-api-docs",
3
- "version": "1.9.1",
4
- "description": "directus extension for swagger interface and custom endpoints definitions",
3
+ "version": "1.9.3",
4
+ "description": "directus extension for swagger interface and openapi including custom endpoints definitions // custom endpoint validations middleware based on openapi",
5
5
  "licence": "MIT",
6
6
  "author": "Giona Righini (sacconazzo)",
7
7
  "main": "dist/index.js",
@@ -23,7 +23,7 @@
23
23
  "openapi"
24
24
  ],
25
25
  "directus:extension": {
26
- "type": "endpoint",
26
+ "type": "interface",
27
27
  "path": "dist/index.js",
28
28
  "source": "src/index.ts",
29
29
  "host": "^9.19.2"
@@ -36,17 +36,17 @@
36
36
  "dev": "directus-extension build -w --no-minify"
37
37
  },
38
38
  "dependencies": {
39
- "@pnpm/find-workspace-dir": "^7.0.0",
40
- "express-openapi-validator": "^5.1.6",
39
+ "@pnpm/find-workspace-dir": "^7.0.1",
40
+ "express-openapi-validator": "^5.2.0",
41
41
  "js-yaml": "^4.1.0",
42
- "swagger-ui-express": "^5.0.0"
42
+ "swagger-ui-express": "^5.0.1"
43
43
  },
44
44
  "devDependencies": {
45
- "@directus/extensions-sdk": "^11.0.3",
45
+ "@directus/extensions-sdk": "^11.0.7",
46
46
  "@directus/shared": "^9.24.0",
47
47
  "@types/express": "^4.17.21",
48
48
  "@types/jest": "^29.5.12",
49
- "@types/node": "^18.19.31",
49
+ "@types/node": "^18.19.34",
50
50
  "@typescript-eslint/eslint-plugin": "^5.62.0",
51
51
  "@typescript-eslint/parser": "^5.62.0",
52
52
  "eslint": "^8.57.0",
@@ -61,9 +61,9 @@
61
61
  "pino": "^8.21.0",
62
62
  "prettier": "^2.8.8",
63
63
  "rollup": "2.63.0",
64
- "ts-jest": "^29.1.2",
64
+ "ts-jest": "^29.1.4",
65
65
  "ts-node": "^10.9.2",
66
66
  "typescript": "^4.9.5",
67
- "vue": "^3.4.26"
67
+ "vue": "^3.4.27"
68
68
  }
69
69
  }