@stacksjs/api 0.75.85 → 0.75.87
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +12 -12
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var
|
|
3
|
-
${["query","header","path","cookie"].map((n)=>{let r=e.filter((s)=>s.in===n);if(!r.length)return` ${n}?: never`;let o=r.map((s)=>`${JSON.stringify(s.name)}${s.required?"":"?"}: ${
|
|
2
|
+
var ee=Object.defineProperty;var te=(e)=>e;function ne(e,t){this[e]=te.bind(null,t)}var re=(e,t)=>{for(var n in t)ee(e,n,{get:t[n],enumerable:!0,configurable:!0,set:ne.bind(t,n)})};var x=(e,t,n)=>()=>{if(e)try{t=e(e=0)}catch(r){n=[r]}if(n)throw n[0];return t};function oe(e){return typeof e==="string"?JSON.stringify(e):String(e)}function O(e){if(!e)return"unknown";if(e.enum?.length)return e.enum.map(oe).join(" | ");if(e.type==="string")return"string";if(e.type==="number"||e.type==="integer")return"number";if(e.type==="boolean")return"boolean";if(e.type==="null")return"null";if(e.type==="array")return`Array<${O(e.items)}>`;if(e.type==="object"||e.properties||e.additionalProperties){let t=new Set(e.required||[]),n=Object.entries(e.properties||{}).map(([r,o])=>`${JSON.stringify(r)}${t.has(r)?"":"?"}: ${O(o)}`);if(e.additionalProperties){let r=e.additionalProperties===!0?"unknown":O(e.additionalProperties);n.push(`[key: string]: ${r}`)}return n.length?`{ ${n.join("; ")} }`:"Record<string, unknown>"}return"unknown"}function ie(e=[]){return` parameters: {
|
|
3
|
+
${["query","header","path","cookie"].map((n)=>{let r=e.filter((s)=>s.in===n);if(!r.length)return` ${n}?: never`;let o=r.map((s)=>`${JSON.stringify(s.name)}${s.required?"":"?"}: ${O(s.schema)}`);return` ${n}${r.every((s)=>!s.required)?"?":""}: { ${o.join("; ")} }`}).join(`
|
|
4
4
|
`)}
|
|
5
|
-
}`}function
|
|
6
|
-
requestBody${e.requestBody.required?"":"?"}: { content: ${
|
|
7
|
-
requestBody?: never`,n=Object.entries(e.responses||{}).map(([r,o])=>` ${JSON.stringify(r)}: { content: ${
|
|
8
|
-
${
|
|
5
|
+
}`}function J(e){if(!e||!Object.keys(e).length)return"never";return`{ ${Object.entries(e).map(([t,n])=>`${JSON.stringify(t)}: ${O(n.schema)}`).join("; ")} }`}function ae(e){let t=e.requestBody?`
|
|
6
|
+
requestBody${e.requestBody.required?"":"?"}: { content: ${J(e.requestBody.content)} }`:`
|
|
7
|
+
requestBody?: never`,n=Object.entries(e.responses||{}).map(([r,o])=>` ${JSON.stringify(r)}: { content: ${J(o.content)} }`);return`{
|
|
8
|
+
${ie(e.parameters)}${t}
|
|
9
9
|
responses: {
|
|
10
10
|
${n.join(`
|
|
11
11
|
`)}
|
|
12
12
|
}
|
|
13
|
-
}`}function
|
|
13
|
+
}`}function F(e){let t=Object.entries(e.paths||{}).map(([r,o])=>{let s=se.map((a)=>{let c=o[a];return c?` ${a}: ${ae(c)}`:` ${a}?: never`});return` ${JSON.stringify(r)}: {
|
|
14
14
|
${s.join(`
|
|
15
15
|
`)}
|
|
16
|
-
}`}),n=Object.entries(e.components?.schemas||{}).map(([r,o])=>` ${JSON.stringify(r)}: ${
|
|
16
|
+
}`}),n=Object.entries(e.components?.schemas||{}).map(([r,o])=>` ${JSON.stringify(r)}: ${O(o)}`);return`/**
|
|
17
17
|
* Generated from storage/framework/api/openapi.json by @stacksjs/api.
|
|
18
18
|
* Do not edit this file directly; run bun run docs:artifacts to regenerate it.
|
|
19
19
|
*/
|
|
@@ -29,13 +29,13 @@ ${n.join(`
|
|
|
29
29
|
`)}
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
`}var
|
|
32
|
+
`}var se;var D=x(()=>{se=["get","put","post","delete","options","head","patch","trace"]});function ue(e){let t=e.replace(/[{}]/g,"").split(/[^a-z0-9]+/i).filter(Boolean),n=t[0]?.toLowerCase()==="api"?t.slice(1):t[1]?.toLowerCase()==="api"?[t[0],...t.slice(2)]:t,[r,...o]=n;if(!r)return"call";let s=r.charAt(0).toLowerCase()+r.slice(1),a=o.map((p)=>p.charAt(0).toUpperCase()+p.slice(1)),c=[s,...a].join("");return/^[a-z_$]/i.test(c)?c:`call${c.charAt(0).toUpperCase()}${c.slice(1)}`}function pe(e){let t=e.responses??{},n=Object.keys(t).find((s)=>s.startsWith("2"));if(!n)return"unknown";let r=t[n]?.content,o=r?.["application/json"]??Object.values(r??{})[0];return o?.schema?O(o.schema):"unknown"}function de(e,t=" "){let n=e.filter(Boolean);if(!n.length)return"";return`${t}/**
|
|
33
33
|
${n.map((r)=>`${t} * ${r}`).join(`
|
|
34
34
|
`)}
|
|
35
35
|
${t} */
|
|
36
|
-
`}function
|
|
36
|
+
`}function le(e,t,n,r){let o=n.parameters??[],s=o.filter((d)=>d.in==="path"),a=o.filter((d)=>d.in==="query"),c=n.requestBody?.content?.["application/json"]?.schema,p=Boolean(n.requestBody?.required),l=[];for(let d of[...s,...a]){let g=d.in==="path"||d.required;l.push(`${JSON.stringify(d.name)}${g?"":"?"}: ${O(d.schema)}`)}if(c)l.push(`body${p?"":"?"}: ${O(c)}`);let m=[...s,...a].every((d)=>d.in!=="path"&&!d.required)&&(!c||!p),y=l.length?`input${m?"?":""}: { ${l.join("; ")} }, `:"",i=a.length?`[${a.map((d)=>JSON.stringify(d.name)).join(", ")}]`:"[]";return`${de([n.summary&&n.summary!==e?n.summary:`${t.toUpperCase()} ${e}`,n.description??""])} ${r}(${y}options?: RequestOptions): Promise<ApiResult<${pe(n)}>> {
|
|
37
37
|
return request(config, ${JSON.stringify(t.toUpperCase())}, ${JSON.stringify(e)}, ${l.length?"input ?? {}":"{}"}, ${i}, ${c?"true":"false"}, options)
|
|
38
|
-
},`}function H(e,t={}){let n=t.name??"API",r=new Map,o=[];for(let[s,a]of Object.entries(e.paths??{}))for(let c of
|
|
38
|
+
},`}function H(e,t={}){let n=t.name??"API",r=new Map,o=[];for(let[s,a]of Object.entries(e.paths??{}))for(let c of ce){let p=a[c];if(!p)continue;let l=ue(p.operationId??`${c}_${s}`),m=r.get(l)??0;r.set(l,m+1),o.push(le(s,c,p,m===0?l:`${l}${m+1}`))}return`/* eslint-disable */
|
|
39
39
|
/**
|
|
40
40
|
* ${n} client, generated from the OpenAPI document.
|
|
41
41
|
*
|
|
@@ -136,4 +136,4 @@ ${o.join(`
|
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
export type Client = ReturnType<typeof createClient>
|
|
139
|
-
`}var ae;var _=x(()=>{D();ae=["get","put","post","delete","options","head","patch"]});var I=()=>{};var W={};ne(W,{loadModelRegistry:()=>me,modelFiles:()=>V});import{readdirSync as le}from"fs";import{basename as he,extname as U,join as fe}from"path";function V(e){let t=[],n=(r)=>{let o;try{o=le(r,{withFileTypes:!0})}catch{return}for(let s of o){let a=fe(r,s.name);if(s.isDirectory()){n(a);continue}if(![".ts",".js"].includes(U(s.name)))continue;if(s.name.startsWith(".")||s.name.startsWith("index"))continue;t.push(a)}};return n(e),t.sort()}async function L(e,t,n){for(let r of V(e))try{let o=U(r),s=await import(`${r}?t=${Date.now()}`),a=s.default??s,c=a.name??he(r,o);t[c]={...a,name:c}}catch(o){n?.(r,o)}}async function me(e){let t={};return await L(e.defaultsRoot,t,e.onImportError),await L(e.userRoot,t,e.onImportError),t}var z=()=>{};class N{data;status;headers;isOk;constructor(e,t,n,r){this.data=e;this.status=t;this.headers=n;this.isOk=r}ok(){return this.status===200}created(){return this.status===201}accepted(){return this.status===202}noContent(){return this.status===204}movedPermanently(){return this.status===301}found(){return this.status===302}badRequest(){return this.status===400}unauthorized(){return this.status===401}paymentRequired(){return this.status===402}forbidden(){return this.status===403}notFound(){return this.status===404}requestTimeout(){return this.status===408}conflict(){return this.status===409}unprocessableEntity(){return this.status===422}tooManyRequests(){return this.status===429}serverError(){return this.status===500}}class J{defaultHeaders={Accept:"application/json","Content-Type":"application/json"};queryParams;bodyData;isFormData=!1;customHeaders={};attachments=[];isMultipart=!1;digestAuth;withQueryParams(e){return this.queryParams=e,this}withHeaders(e){return this.customHeaders={...this.customHeaders,...e},this}accept(e){return this.defaultHeaders.Accept=e,this}acceptJson(){return this.accept("application/json")}withToken(e){return this.customHeaders.Authorization=`Bearer ${e}`,this}withBasicAuth(e,t){let n=btoa(`${e}:${t}`);return this.customHeaders.Authorization=`Basic ${n}`,this}withDigestAuth(e,t){return this.digestAuth={username:e,password:t},this}withBody(e){return this.bodyData=e,this}asForm(){return this.isFormData=!0,this.defaultHeaders["Content-Type"]="application/x-www-form-urlencoded",this}attach(e,t,n,r){let o=typeof t==="string"?new Blob([t],{type:r?.["Content-Type"]||"text/plain"}):t;return this.attachments.push({name:e,content:o,filename:n,headers:r}),this.isMultipart=!0,delete this.defaultHeaders["Content-Type"],this}getHeaders(){return{...this.defaultHeaders,...this.customHeaders}}addQueryParams(e){if(!this.queryParams)return e;let t=new URLSearchParams;Object.entries(this.queryParams).forEach(([o,s])=>{if(s!=null)t.append(o,String(s))});let n=t.toString();if(!n)return e;let r=e.includes("?");return e+(r?"&":"?")+n}async formatBody(e){let t=e||this.bodyData;if(this.isMultipart){let n=new FormData;if(t)Object.entries(t).forEach(([r,o])=>{n.append(r,String(o))});for(let r of this.attachments)if(r.headers){let o=r.content instanceof Blob?new Blob([r.content],{type:r.headers["Content-Type"]}):r.content;n.append(r.name,o,r.filename)}else n.append(r.name,r.content,r.filename);return n}if(this.isFormData&&t){let n=new URLSearchParams;return Object.entries(t).forEach(([r,o])=>{if(o!=null)n.append(r,String(o))}),n.toString()}return t?JSON.stringify(t):void 0}resetState(){this.queryParams=void 0,this.bodyData=void 0,this.isFormData=!1,this.isMultipart=!1,this.customHeaders={},this.attachments=[],this.digestAuth=void 0,this.defaultHeaders["Content-Type"]="application/json"}async handleDigestAuth(e,t,n,r){if(e.status!==401||!this.digestAuth)return e;let o=e.headers.get("WWW-Authenticate");if(!o?.startsWith("Digest "))return e;let s=o.substring(7).split(",").reduce((u,p)=>{let[O,k]=p.trim().split("=");if(O)u[O]=k?.replace(/["']/g,"")??"";return u},{}),a=await this.generateMD5(`${this.digestAuth.username}:${s.realm}:${this.digestAuth.password}`),c=await this.generateMD5(`${n}:${t}`),d="00000001",l=await this.generateMD5(Date.now().toString()).then((u)=>u.substring(0,8)),m=await this.generateMD5(`${a}:${s.nonce}:${d}:${l}:${s.qop}:${c}`),g={username:`"${this.digestAuth.username}"`,realm:`"${s.realm}"`,nonce:`"${s.nonce}"`,uri:`"${t}"`,algorithm:s.algorithm?`"${s.algorithm}"`:void 0,qop:`"${s.qop}"`,nc:d,cnonce:`"${l}"`,response:`"${m}"`,opaque:s.opaque?`"${s.opaque}"`:void 0},i=Object.entries(g).filter(([u,p])=>p!==void 0).map(([u,p])=>`${u}=${p}`).join(", ");return this.customHeaders.Authorization=`Digest ${i}`,fetch(t,{method:n,headers:this.getHeaders(),body:r?await this.formatBody(r):void 0})}async generateMD5(e){let n=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",n);return Array.from(new Uint8Array(r)).map((s)=>s.toString(16).padStart(2,"0")).join("")}async request(e,t,n){let r=this.addQueryParams(e),o=await this.formatBody(n),s=await fetch(r,{method:t,headers:this.getHeaders(),body:o});if(this.digestAuth)s=await this.handleDigestAuth(s,r,t,n);let a=await s.json();return this.resetState(),new N(a,s.status,s.headers,s.ok)}async get(e){return this.request(e,"GET")}async post(e,t){return this.request(e,"POST",t)}async put(e,t){return this.request(e,"PUT",t)}async patch(e,t){return this.request(e,"PATCH",t)}async delete(e){return this.request(e,"DELETE")}}var $e=new J;_();import{path as T}from"@stacksjs/path";function G(e){if(!e||typeof e!=="object")return{type:"string"};let t=e,n=Array.isArray(t.rules)?t.rules:[],r=(m)=>n.find((g)=>g.name===m),o=(m,g)=>{let i=r(m)?.params?.[g];return typeof i==="number"?i:void 0},s=t.name??t._type??"string",a={type:s==="enum"?"string":s},c=o("min","min")??(typeof t._min==="number"?t._min:void 0),d=o("max","max")??(typeof t._max==="number"?t._max:void 0);if(c!==void 0)a[s==="string"?"minLength":"minimum"]=c;if(d!==void 0)a[s==="string"?"maxLength":"maximum"]=d;if(r("email")||t._email)a.format="email";if(r("url")||t._url)a.format="uri";if(r("uuid")||t._uuid)a.format="uuid";let l=Array.isArray(t.allowedValues)?t.allowedValues:Array.isArray(t._enum)?t._enum:null;if(l)a.enum=l;return a}function ge(e){if(!e||typeof e!=="object")return!1;let t=e;return Boolean(t.isRequired??t._required)}function Q(e){return e.replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/([A-Z])([A-Z][a-z])/g,"$1_$2").toLowerCase()}function ye(e){let t={id:{type:"integer"}},n=["id"];if(e.traits?.useUuid)t.uuid={type:"string",format:"uuid"},n.push("uuid");for(let[r,o]of Object.entries(e.attributes??{})){if(o.hidden===!0)continue;let s=Q(r);if(t[s]=G(o.validation?.rule),o.required===!0)n.push(s)}for(let r of e.belongsTo??[]){if(typeof r!=="string"||!r.trim())continue;let o=`${Q(r.trim())}_id`;t[o]??={type:"integer"}}if(e.traits?.useTimestamps!==!1)t.created_at={type:"string",format:"date-time"},t.updated_at={type:"string",format:"date-time"};if(e.traits?.useSoftDeletes)t.deleted_at={type:"string",format:"date-time",nullable:!0};return{type:"object",properties:t,required:[...new Set(n)]}}function be(e){let t=e.traits?.useApi;if(!t||typeof t!=="object"||!t.uri)return null;let n=String(t.prefix||"").replace(/^\/+|\/+$/g,""),r=String(t.uri).replace(/^\/+|\/+$/g,"");return`/api/${n?`${n}/`:""}${r}`}function Re(e,t){let n={...t},r=e?.responses;if(r&&typeof r==="object")for(let[s,a]of Object.entries(r)){let c=a;if(!c||typeof c!=="object"||typeof c.description!=="string")continue;n[String(s)]={description:c.description,...c.schema&&typeof c.schema==="object"?{content:{"application/json":{schema:c.schema}}}:{}}}let o=e?.responseHeaders;if(o&&typeof o==="object"){let s={};for(let[a,c]of Object.entries(o)){let d=c;if(!d||typeof d!=="object"||typeof d.description!=="string")continue;s[a]={description:d.description,...d.schema&&typeof d.schema==="object"?{schema:d.schema}:{}}}if(Object.keys(s).length>0)for(let a of Object.keys(n))n[a]={...n[a],headers:s}}return n}async function we(e){if(typeof e!=="string"||!e||e.includes(".."))return null;try{let{path:t}=await import("@stacksjs/path"),n=[t.appPath(`${e}.ts`),t.storagePath(`framework/defaults/app/${e}.ts`)];for(let r of n)try{if(!await Bun.file(r).exists())continue;let a=(await import(r)).default;return a&&typeof a==="object"?a:null}catch{}}catch{}return null}async function De(e={}){let t=e.portable??!0,{listRegisteredRoutes:n}=await import("@stacksjs/router"),r=t?process.env.APP_ENV:void 0,o=t&&"APP_ENV"in process.env;if(t)process.env.APP_ENV="production";try{try{let{appRouteRegistry:i,loadRoutes:u}=await import("@stacksjs/router");await u(await i())}catch(i){let u=i instanceof Error?i.message:String(i);if(t)throw Error(`[generateOpenApi] Refusing to emit a partial spec: failed to load routes/api.ts + framework routes: ${u}`);console.warn(`[generateOpenApi] Failed to load routes/api.ts + framework routes: ${u}`)}try{try{await import("@stacksjs/orm/routes")}catch{await Promise.resolve().then(() => (I(),{}))}}catch(i){let u=i instanceof Error?i.message:String(i);if(t)throw Error(`[generateOpenApi] Refusing to emit a partial spec: failed to load useApi-generated ORM routes: ${u}`);console.warn(`[generateOpenApi] Failed to load useApi-generated ORM routes: ${u}`)}}finally{if(t)if(o)process.env.APP_ENV=r;else delete process.env.APP_ENV}let s={};try{let u;try{u=await import("@stacksjs/orm/model-registry")}catch{u=await Promise.resolve().then(() => (z(),W))}s=await u.loadModelRegistry({defaultsRoot:T.storagePath("framework/defaults/app/Models"),userRoot:T.projectPath("app/Models")})}catch(i){let u=i instanceof Error?i.message:String(i);if(t)throw Error(`[generateOpenApi] Refusing to emit model-free schemas: ${u}`);console.warn(`[generateOpenApi] Failed to load model schemas: ${u}`)}let a=(i)=>i.replace(/(^|\/):(\w+)(?=$|\/)/g,"$1{$2}"),c=[...n()].map((i)=>({route:i,oasPath:a(i.path),method:i.method.toLowerCase()})).sort((i,u)=>{if(i.oasPath!==u.oasPath)return i.oasPath<u.oasPath?-1:1;return i.method<u.method?-1:i.method>u.method?1:0});if(t&&c.length===0)throw Error("[generateOpenApi] Refusing to emit an empty spec: no routes were registered. This usually means route loading failed silently rather than that the app has no API.");let d="Stacks API";if(!t)try{let{config:i}=await import("@stacksjs/config");if(i.app?.name)d=`${i.app.name} API`}catch{}let l={openapi:"3.0.0",info:{title:d,version:"1.0.0"},paths:{},components:{schemas:{}}},m=Object.values(s).map((i)=>({name:String(i.name),path:be(i),schema:ye(i)})).filter((i)=>i.path!==null).sort((i,u)=>i.name<u.name?-1:i.name>u.name?1:0);for(let i of m)l.components.schemas[i.name]=i.schema;let g=new Set;for(let{route:i,oasPath:u,method:p}of c){if(!l.paths[u])l.paths[u]={};let O=[];for(let h of i.path.matchAll(/\{(\w+)\}/g))if(h[1])O.push(h[1]);for(let h of i.path.matchAll(/(?:^|\/):(\w+)(?=$|\/)/g))if(h[1])O.push(h[1]);let k=i.name??`${p}_${u.replace(/[^a-z0-9]/gi,"_")}`,j=k;if(g.has(j)){j=`${k}_${p}`;let h=2;while(g.has(j))j=`${k}_${p}_${h++}`}g.add(j);let b={summary:i.name??i.path,operationId:j,parameters:O.map((h)=>({name:h,in:"path",required:!0,schema:{type:"string"}})),responses:{200:{description:"Successful response",content:{"application/json":{schema:{type:"object"}}}},422:{description:"Validation failed"},500:{description:"Server error"}}},P=m.find((h)=>u===h.path||u===`${h.path}/{id}`);if(P){let h=u===P.path&&p==="get"?{type:"array",items:P.schema}:P.schema;if(b.responses[200].content={"application/json":{schema:{type:"object",properties:{data:h},required:["data"]}}},p==="post"&&u===P.path)b.responses[201]={...b.responses[200],description:"Created"},delete b.responses[200]}let q=i.action??(i.handler?await we(i.handler):null),B=q&&typeof q.validations==="object"&&q.validations!==null?q.validations:null;b.responses=Re(q,b.responses);let C=q?.requestHeaders;if(C&&typeof C==="object")for(let[h,R]of Object.entries(C)){let f=R;if(!f||typeof f!=="object"||typeof f.description!=="string")continue;b.parameters?.push({name:h,in:"header",description:f.description,required:f.required===!0,schema:f.schema&&typeof f.schema==="object"?f.schema:{type:"string"}})}if(B&&Object.keys(B).length>0){let h=Object.entries(B).map(([R,f])=>{let A=f?.rule;return{field:R,schema:G(A),required:ge(A)}});if(p==="get"||p==="head"||p==="delete"){let R=new Set(O);for(let{field:f,schema:A,required:S}of h){if(R.has(f))continue;b.parameters?.push({name:f,in:"query",required:S,schema:A})}}else{let R={type:"object",properties:{},required:[]},{properties:f,required:A}=R;for(let S of h)if(f[S.field]=S.schema,S.required)A.push(S.field);if(A.length===0)delete R.required;b.requestBody={required:A.length>0,content:{"application/json":{schema:R}}}}}l.paths[u][p]=b}if(e.write!==!1){await Bun.write(T.frameworkPath("api/openapi.json"),JSON.stringify(l,null,2));await Promise.resolve().then(() => D());await Promise.resolve().then(() => _());await Bun.write(T.frameworkPath("api/api-types.ts"),M(l)),await Bun.write(T.frameworkPath("api/client.ts"),H(l,{name:l.info.title}))}return l}D();class y{static instance=new y;isMissing(){return!0}}class v{data;constructor(e){this.data=e}}class Z{condition;value;defaultValue;constructor(e,t,n=new y){this.condition=e;this.value=t;this.defaultValue=n}resolve(){return(typeof this.condition==="function"?this.condition():this.condition)?this.value:this.defaultValue}}class X{resource;additional={};request;static wrap="data";static additionalMeta={};constructor(e){this.resource=e}withRequest(e){return this.request=e,this}withAdditional(e){return this.additional={...this.additional,...e},this}resolve(e){let t=this.toArray(e||this.request);return this.filterAndResolve(t)}toResponse(e){let t=this.resolve(e),n=this.constructor.wrap;if(n)return{[n]:t,...this.additional};return{...t,...this.additional}}toJson(e){return JSON.stringify(this.toResponse(e))}toJSON(){return this.toResponse()}static collection(e){return new E(e,this)}when(e,t,n){if(typeof e==="function"?e():e)return typeof t==="function"?t():t;return n!==void 0?n:y.instance}whenNotNull(e,t){if(e===null||e===void 0)return y.instance;return t?t(e):e}whenLoaded(e,t,n){let r=this.resource;if(!((e in r)&&r[e]!==void 0))return n!==void 0?n:y.instance;if(t!==void 0)return typeof t==="function"?t():t;return r[e]}whenCounted(e,t){let n=this.resource,r=`${e}_count`;if(r in n)return Number(n[r]);return t!==void 0?t:y.instance}merge(e){return new v(e)}mergeWhen(e,t){if(!(typeof e==="function"?e():e))return y.instance;let r=typeof t==="function"?t():t;return new v(r)}static MAX_RESOLVE_DEPTH=20;filterAndResolve(e,t=0){if(t>=X.MAX_RESOLVE_DEPTH)return e;let n={};for(let[r,o]of Object.entries(e)){if(o instanceof y)continue;if(o instanceof v){Object.assign(n,this.filterAndResolve(o.data,t+1));continue}if(o instanceof Z){let s=o.resolve();if(!(s instanceof y))n[r]=s;continue}if(o!==null&&typeof o==="object"&&!Array.isArray(o)&&!(o instanceof Date)){n[r]=this.filterAndResolve(o,t+1);continue}if(Array.isArray(o)){n[r]=o.filter((s)=>!(s instanceof y)).map((s)=>{if(s instanceof v)return s.data;if(s!==null&&typeof s==="object"&&!(s instanceof Date))return this.filterAndResolve(s,t+1);return s});continue}n[r]=o}return n}static withoutWrapping(){this.wrap=null}static wrapWith(e){this.wrap=e}}class E{resources;ResourceClass;additional={};request;static wrap="data";constructor(e,t){this.resources=e,this.ResourceClass=t}withRequest(e){return this.request=e,this}withAdditional(e){return this.additional={...this.additional,...e},this}resolve(e){let t=e||this.request;return this.resources.map((n)=>{let r=new this.ResourceClass(n);if(t)r.withRequest(t);return r.resolve(t)})}toResponse(e){let t=this.resolve(e),n=this.constructor.wrap;if(n)return{[n]:t,...this.additional};return{data:t,...this.additional}}toJson(e){return JSON.stringify(this.toResponse(e))}count(){return this.resources.length}isEmpty(){return this.resources.length===0}isNotEmpty(){return this.resources.length>0}}class K extends E{meta;links;constructor(e,t){super(e.data,t);this.meta=e.meta,this.links=e.links}static fromPagination(e,t,n){let{currentPage:r,perPage:o,total:s,baseUrl:a=""}=n,c=Math.ceil(s/o),d=s>0?(r-1)*o+1:null,l=s>0?Math.min(r*o,s):null;return new K({data:e,meta:{current_page:r,from:d,last_page:c,per_page:o,to:l,total:s},links:{first:`${a}?page=1`,last:`${a}?page=${c}`,prev:r>1?`${a}?page=${r-1}`:null,next:r<c?`${a}?page=${r+1}`:null}},t)}toResponse(e){return{data:this.resolve(e),meta:this.meta,links:this.links,...this.additional}}}function Ce(e,t){let n=t(e);return{toResponse:()=>({data:n}),toJson:()=>JSON.stringify({data:n})}}function _e(e,t){let n=e.map(t);return{toResponse:()=>({data:n}),toJson:()=>JSON.stringify({data:n})}}export{Z as ConditionalValue,X as JsonResource,v as MergeValue,y as MissingValue,K as PaginatedResourceCollection,E as ResourceCollection,_e as collection,Re as describedResponses,$e as fetcher,De as generateOpenApi,ce as methodName,ye as modelDefinitionToSchema,H as renderApiClient,M as renderOpenApiTypes,Ce as resource,ge as ruleIsRequired,G as ruleToSchema,w as schemaType};
|
|
139
|
+
`}var ce;var C=x(()=>{D();ce=["get","put","post","delete","options","head","patch"]});var L=()=>{};var z={};re(z,{loadModelRegistry:()=>ge,loadModelRegistryWithOrigins:()=>W,modelFiles:()=>V,resolveModelApiSelection:()=>ye,selectApiModels:()=>Re});import{readdirSync as he}from"fs";import{basename as fe,extname as U,join as me}from"path";function V(e){let t=[],n=(r)=>{let o;try{o=he(r,{withFileTypes:!0})}catch{return}for(let s of o){let a=me(r,s.name);if(s.isDirectory()){n(a);continue}if(![".ts",".js"].includes(U(s.name)))continue;if(s.name.startsWith(".")||s.name.startsWith("index"))continue;t.push(a)}};return n(e),t.sort()}async function I(e,t,n,r){for(let o of V(e))try{let s=U(o),a=await import(`${o}?t=${Date.now()}`),c=a.default??a,p=c.name??fe(o,s);n.models[p]={...c,name:p},n.origins[p]=t}catch(s){r?.(o,s)}}async function W(e){let t={models:{},origins:{}};return await I(e.defaultsRoot,"default",t,e.onImportError),await I(e.userRoot,"app",t,e.onImportError),t}async function ge(e){return(await W(e)).models}function ye(e,t){let n,r="default";if(t!==void 0&&t!==null)n=t.split(","),r="env";else if(typeof e==="string")n=[e],r="config";else if(Array.isArray(e)&&e.every((s)=>typeof s==="string"))n=e,r="config";if(n===void 0)return{all:!0,own:!1,names:new Set,source:r};let o=n.map((s)=>s.trim().toLowerCase()).filter(Boolean);if(o.length===0||o.includes("none"))return{all:!1,own:!1,names:new Set,source:r};if(o.includes("all"))return{all:!0,own:!1,names:new Set,source:r};return{all:!1,own:o.includes("own"),names:new Set(o.filter((s)=>s!=="own")),source:r}}function Re(e,t){let n={},r=new Set;for(let[o,s]of Object.entries(e.models)){if(!s?.traits?.useApi)continue;let a=o.toLowerCase(),c=t.names.has(a);if(c)r.add(a);if(t.all||c||t.own&&e.origins[o]==="app")n[o]=s}return{models:n,unmatched:[...t.names].filter((o)=>!r.has(o)).sort()}}var Q=()=>{};class E{data;status;headers;isOk;constructor(e,t,n,r){this.data=e;this.status=t;this.headers=n;this.isOk=r}ok(){return this.status===200}created(){return this.status===201}accepted(){return this.status===202}noContent(){return this.status===204}movedPermanently(){return this.status===301}found(){return this.status===302}badRequest(){return this.status===400}unauthorized(){return this.status===401}paymentRequired(){return this.status===402}forbidden(){return this.status===403}notFound(){return this.status===404}requestTimeout(){return this.status===408}conflict(){return this.status===409}unprocessableEntity(){return this.status===422}tooManyRequests(){return this.status===429}serverError(){return this.status===500}}class N{defaultHeaders={Accept:"application/json","Content-Type":"application/json"};queryParams;bodyData;isFormData=!1;customHeaders={};attachments=[];isMultipart=!1;digestAuth;withQueryParams(e){return this.queryParams=e,this}withHeaders(e){return this.customHeaders={...this.customHeaders,...e},this}accept(e){return this.defaultHeaders.Accept=e,this}acceptJson(){return this.accept("application/json")}withToken(e){return this.customHeaders.Authorization=`Bearer ${e}`,this}withBasicAuth(e,t){let n=btoa(`${e}:${t}`);return this.customHeaders.Authorization=`Basic ${n}`,this}withDigestAuth(e,t){return this.digestAuth={username:e,password:t},this}withBody(e){return this.bodyData=e,this}asForm(){return this.isFormData=!0,this.defaultHeaders["Content-Type"]="application/x-www-form-urlencoded",this}attach(e,t,n,r){let o=typeof t==="string"?new Blob([t],{type:r?.["Content-Type"]||"text/plain"}):t;return this.attachments.push({name:e,content:o,filename:n,headers:r}),this.isMultipart=!0,delete this.defaultHeaders["Content-Type"],this}getHeaders(){return{...this.defaultHeaders,...this.customHeaders}}addQueryParams(e){if(!this.queryParams)return e;let t=new URLSearchParams;Object.entries(this.queryParams).forEach(([o,s])=>{if(s!=null)t.append(o,String(s))});let n=t.toString();if(!n)return e;let r=e.includes("?");return e+(r?"&":"?")+n}async formatBody(e){let t=e||this.bodyData;if(this.isMultipart){let n=new FormData;if(t)Object.entries(t).forEach(([r,o])=>{n.append(r,String(o))});for(let r of this.attachments)if(r.headers){let o=r.content instanceof Blob?new Blob([r.content],{type:r.headers["Content-Type"]}):r.content;n.append(r.name,o,r.filename)}else n.append(r.name,r.content,r.filename);return n}if(this.isFormData&&t){let n=new URLSearchParams;return Object.entries(t).forEach(([r,o])=>{if(o!=null)n.append(r,String(o))}),n.toString()}return t?JSON.stringify(t):void 0}resetState(){this.queryParams=void 0,this.bodyData=void 0,this.isFormData=!1,this.isMultipart=!1,this.customHeaders={},this.attachments=[],this.digestAuth=void 0,this.defaultHeaders["Content-Type"]="application/json"}async handleDigestAuth(e,t,n,r){if(e.status!==401||!this.digestAuth)return e;let o=e.headers.get("WWW-Authenticate");if(!o?.startsWith("Digest "))return e;let s=o.substring(7).split(",").reduce((u,d)=>{let[g,S]=d.trim().split("=");if(g)u[g]=S?.replace(/["']/g,"")??"";return u},{}),a=await this.generateMD5(`${this.digestAuth.username}:${s.realm}:${this.digestAuth.password}`),c=await this.generateMD5(`${n}:${t}`),p="00000001",l=await this.generateMD5(Date.now().toString()).then((u)=>u.substring(0,8)),m=await this.generateMD5(`${a}:${s.nonce}:${p}:${l}:${s.qop}:${c}`),y={username:`"${this.digestAuth.username}"`,realm:`"${s.realm}"`,nonce:`"${s.nonce}"`,uri:`"${t}"`,algorithm:s.algorithm?`"${s.algorithm}"`:void 0,qop:`"${s.qop}"`,nc:p,cnonce:`"${l}"`,response:`"${m}"`,opaque:s.opaque?`"${s.opaque}"`:void 0},i=Object.entries(y).filter(([u,d])=>d!==void 0).map(([u,d])=>`${u}=${d}`).join(", ");return this.customHeaders.Authorization=`Digest ${i}`,fetch(t,{method:n,headers:this.getHeaders(),body:r?await this.formatBody(r):void 0})}async generateMD5(e){let n=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",n);return Array.from(new Uint8Array(r)).map((s)=>s.toString(16).padStart(2,"0")).join("")}async request(e,t,n){let r=this.addQueryParams(e),o=await this.formatBody(n),s=await fetch(r,{method:t,headers:this.getHeaders(),body:o});if(this.digestAuth)s=await this.handleDigestAuth(s,r,t,n);let a=await s.json();return this.resetState(),new E(a,s.status,s.headers,s.ok)}async get(e){return this.request(e,"GET")}async post(e,t){return this.request(e,"POST",t)}async put(e,t){return this.request(e,"PUT",t)}async patch(e,t){return this.request(e,"PATCH",t)}async delete(e){return this.request(e,"DELETE")}}var je=new N;C();import{path as P}from"@stacksjs/path";function Z(e){if(!e||typeof e!=="object")return{type:"string"};let t=e,n=Array.isArray(t.rules)?t.rules:[],r=(m)=>n.find((y)=>y.name===m),o=(m,y)=>{let i=r(m)?.params?.[y];return typeof i==="number"?i:void 0},s=t.name??t._type??"string",a={type:s==="enum"?"string":s},c=o("min","min")??(typeof t._min==="number"?t._min:void 0),p=o("max","max")??(typeof t._max==="number"?t._max:void 0);if(c!==void 0)a[s==="string"?"minLength":"minimum"]=c;if(p!==void 0)a[s==="string"?"maxLength":"maximum"]=p;if(r("email")||t._email)a.format="email";if(r("url")||t._url)a.format="uri";if(r("uuid")||t._uuid)a.format="uuid";let l=Array.isArray(t.allowedValues)?t.allowedValues:Array.isArray(t._enum)?t._enum:null;if(l)a.enum=l;return a}function be(e){if(!e||typeof e!=="object")return!1;let t=e;return Boolean(t.isRequired??t._required)}function G(e){return e.replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/([A-Z])([A-Z][a-z])/g,"$1_$2").toLowerCase()}function we(e){let t={id:{type:"integer"}},n=["id"];if(e.traits?.useUuid)t.uuid={type:"string",format:"uuid"},n.push("uuid");for(let[r,o]of Object.entries(e.attributes??{})){if(o.hidden===!0)continue;let s=G(r);if(t[s]=Z(o.validation?.rule),o.required===!0)n.push(s)}for(let r of e.belongsTo??[]){if(typeof r!=="string"||!r.trim())continue;let o=`${G(r.trim())}_id`;t[o]??={type:"integer"}}if(e.traits?.useTimestamps!==!1)t.created_at={type:"string",format:"date-time"},t.updated_at={type:"string",format:"date-time"};if(e.traits?.useSoftDeletes)t.deleted_at={type:"string",format:"date-time",nullable:!0};return{type:"object",properties:t,required:[...new Set(n)]}}function Oe(e){let t=e.traits?.useApi;if(!t||typeof t!=="object"||!t.uri)return null;let n=String(t.prefix||"").replace(/^\/+|\/+$/g,""),r=String(t.uri).replace(/^\/+|\/+$/g,"");return`/api/${n?`${n}/`:""}${r}`}function Ae(e,t){let n={...t},r=e?.responses;if(r&&typeof r==="object")for(let[s,a]of Object.entries(r)){let c=a;if(!c||typeof c!=="object"||typeof c.description!=="string")continue;n[String(s)]={description:c.description,...c.schema&&typeof c.schema==="object"?{content:{"application/json":{schema:c.schema}}}:{}}}let o=e?.responseHeaders;if(o&&typeof o==="object"){let s={};for(let[a,c]of Object.entries(o)){let p=c;if(!p||typeof p!=="object"||typeof p.description!=="string")continue;s[a]={description:p.description,...p.schema&&typeof p.schema==="object"?{schema:p.schema}:{}}}if(Object.keys(s).length>0)for(let a of Object.keys(n))n[a]={...n[a],headers:s}}return n}async function $e(e){if(typeof e!=="string"||!e||e.includes(".."))return null;try{let{path:t}=await import("@stacksjs/path"),n=[t.appPath(`${e}.ts`),t.storagePath(`framework/defaults/app/${e}.ts`)];for(let r of n)try{if(!await Bun.file(r).exists())continue;let a=(await import(r)).default;return a&&typeof a==="object"?a:null}catch{}}catch{}return null}async function Ce(e={}){let t=e.portable??!0,{listRegisteredRoutes:n}=await import("@stacksjs/router"),r=t?process.env.APP_ENV:void 0,o=t&&"APP_ENV"in process.env;if(t)process.env.APP_ENV="production";try{try{let{appRouteRegistry:i,loadRoutes:u}=await import("@stacksjs/router");await u(await i())}catch(i){let u=i instanceof Error?i.message:String(i);if(t)throw Error(`[generateOpenApi] Refusing to emit a partial spec: failed to load routes/api.ts + framework routes: ${u}`);console.warn(`[generateOpenApi] Failed to load routes/api.ts + framework routes: ${u}`)}try{try{await import("@stacksjs/orm/routes")}catch{await Promise.resolve().then(() => (L(),{}))}}catch(i){let u=i instanceof Error?i.message:String(i);if(t)throw Error(`[generateOpenApi] Refusing to emit a partial spec: failed to load useApi-generated ORM routes: ${u}`);console.warn(`[generateOpenApi] Failed to load useApi-generated ORM routes: ${u}`)}}finally{if(t)if(o)process.env.APP_ENV=r;else delete process.env.APP_ENV}let s={};try{let u;try{u=await import("@stacksjs/orm/model-registry")}catch{u=await Promise.resolve().then(() => (Q(),z))}let d=await u.loadModelRegistryWithOrigins({defaultsRoot:P.storagePath("framework/defaults/app/Models"),userRoot:P.projectPath("app/Models")}),g;try{g=(await import(P.projectPath("config/security.ts"))).default?.api}catch{}let S=u.resolveModelApiSelection(g?.models,process.env.STACKS_MODEL_APIS);s=u.selectApiModels(d,S).models}catch(i){let u=i instanceof Error?i.message:String(i);if(t)throw Error(`[generateOpenApi] Refusing to emit model-free schemas: ${u}`);console.warn(`[generateOpenApi] Failed to load model schemas: ${u}`)}let a=(i)=>i.replace(/(^|\/):(\w+)(?=$|\/)/g,"$1{$2}"),c=[...n()].map((i)=>({route:i,oasPath:a(i.path),method:i.method.toLowerCase()})).sort((i,u)=>{if(i.oasPath!==u.oasPath)return i.oasPath<u.oasPath?-1:1;return i.method<u.method?-1:i.method>u.method?1:0});if(t&&c.length===0)throw Error("[generateOpenApi] Refusing to emit an empty spec: no routes were registered. This usually means route loading failed silently rather than that the app has no API.");let p="Stacks API";if(!t)try{let{config:i}=await import("@stacksjs/config");if(i.app?.name)p=`${i.app.name} API`}catch{}let l={openapi:"3.0.0",info:{title:p,version:"1.0.0"},paths:{},components:{schemas:{}}},m=Object.values(s).map((i)=>({name:String(i.name),path:Oe(i),schema:we(i)})).filter((i)=>i.path!==null).sort((i,u)=>i.name<u.name?-1:i.name>u.name?1:0);for(let i of m)l.components.schemas[i.name]=i.schema;let y=new Set;for(let{route:i,oasPath:u,method:d}of c){if(!l.paths[u])l.paths[u]={};let g=[];for(let h of i.path.matchAll(/\{(\w+)\}/g))if(h[1])g.push(h[1]);for(let h of i.path.matchAll(/(?:^|\/):(\w+)(?=$|\/)/g))if(h[1])g.push(h[1]);let S=i.name??`${d}_${u.replace(/[^a-z0-9]/gi,"_")}`,j=S;if(y.has(j)){j=`${S}_${d}`;let h=2;while(y.has(j))j=`${S}_${d}_${h++}`}y.add(j);let b={summary:i.name??i.path,operationId:j,parameters:g.map((h)=>({name:h,in:"path",required:!0,schema:{type:"string"}})),responses:{200:{description:"Successful response",content:{"application/json":{schema:{type:"object"}}}},422:{description:"Validation failed"},500:{description:"Server error"}}},v=m.find((h)=>u===h.path||u===`${h.path}/{id}`);if(v){let h=u===v.path&&d==="get"?{type:"array",items:v.schema}:v.schema;if(b.responses[200].content={"application/json":{schema:{type:"object",properties:{data:h},required:["data"]}}},d==="post"&&u===v.path)b.responses[201]={...b.responses[200],description:"Created"},delete b.responses[200]}let q=i.action??(i.handler?await $e(i.handler):null),M=q&&typeof q.validations==="object"&&q.validations!==null?q.validations:null;b.responses=Ae(q,b.responses);let B=q?.requestHeaders;if(B&&typeof B==="object")for(let[h,w]of Object.entries(B)){let f=w;if(!f||typeof f!=="object"||typeof f.description!=="string")continue;b.parameters?.push({name:h,in:"header",description:f.description,required:f.required===!0,schema:f.schema&&typeof f.schema==="object"?f.schema:{type:"string"}})}if(M&&Object.keys(M).length>0){let h=Object.entries(M).map(([w,f])=>{let A=f?.rule;return{field:w,schema:Z(A),required:be(A)}});if(d==="get"||d==="head"||d==="delete"){let w=new Set(g);for(let{field:f,schema:A,required:k}of h){if(w.has(f))continue;b.parameters?.push({name:f,in:"query",required:k,schema:A})}}else{let w={type:"object",properties:{},required:[]},{properties:f,required:A}=w;for(let k of h)if(f[k.field]=k.schema,k.required)A.push(k.field);if(A.length===0)delete w.required;b.requestBody={required:A.length>0,content:{"application/json":{schema:w}}}}}l.paths[u][d]=b}if(e.write!==!1){await Bun.write(P.frameworkPath("api/openapi.json"),JSON.stringify(l,null,2));await Promise.resolve().then(() => D());await Promise.resolve().then(() => C());await Bun.write(P.frameworkPath("api/api-types.ts"),F(l)),await Bun.write(P.frameworkPath("api/client.ts"),H(l,{name:l.info.title}))}return l}D();class R{static instance=new R;isMissing(){return!0}}class T{data;constructor(e){this.data=e}}class K{condition;value;defaultValue;constructor(e,t,n=new R){this.condition=e;this.value=t;this.defaultValue=n}resolve(){return(typeof this.condition==="function"?this.condition():this.condition)?this.value:this.defaultValue}}class X{resource;additional={};request;static wrap="data";static additionalMeta={};constructor(e){this.resource=e}withRequest(e){return this.request=e,this}withAdditional(e){return this.additional={...this.additional,...e},this}resolve(e){let t=this.toArray(e||this.request);return this.filterAndResolve(t)}toResponse(e){let t=this.resolve(e),n=this.constructor.wrap;if(n)return{[n]:t,...this.additional};return{...t,...this.additional}}toJson(e){return JSON.stringify(this.toResponse(e))}toJSON(){return this.toResponse()}static collection(e){return new _(e,this)}when(e,t,n){if(typeof e==="function"?e():e)return typeof t==="function"?t():t;return n!==void 0?n:R.instance}whenNotNull(e,t){if(e===null||e===void 0)return R.instance;return t?t(e):e}whenLoaded(e,t,n){let r=this.resource;if(!((e in r)&&r[e]!==void 0))return n!==void 0?n:R.instance;if(t!==void 0)return typeof t==="function"?t():t;return r[e]}whenCounted(e,t){let n=this.resource,r=`${e}_count`;if(r in n)return Number(n[r]);return t!==void 0?t:R.instance}merge(e){return new T(e)}mergeWhen(e,t){if(!(typeof e==="function"?e():e))return R.instance;let r=typeof t==="function"?t():t;return new T(r)}static MAX_RESOLVE_DEPTH=20;filterAndResolve(e,t=0){if(t>=X.MAX_RESOLVE_DEPTH)return e;let n={};for(let[r,o]of Object.entries(e)){if(o instanceof R)continue;if(o instanceof T){Object.assign(n,this.filterAndResolve(o.data,t+1));continue}if(o instanceof K){let s=o.resolve();if(!(s instanceof R))n[r]=s;continue}if(o!==null&&typeof o==="object"&&!Array.isArray(o)&&!(o instanceof Date)){n[r]=this.filterAndResolve(o,t+1);continue}if(Array.isArray(o)){n[r]=o.filter((s)=>!(s instanceof R)).map((s)=>{if(s instanceof T)return s.data;if(s!==null&&typeof s==="object"&&!(s instanceof Date))return this.filterAndResolve(s,t+1);return s});continue}n[r]=o}return n}static withoutWrapping(){this.wrap=null}static wrapWith(e){this.wrap=e}}class _{resources;ResourceClass;additional={};request;static wrap="data";constructor(e,t){this.resources=e,this.ResourceClass=t}withRequest(e){return this.request=e,this}withAdditional(e){return this.additional={...this.additional,...e},this}resolve(e){let t=e||this.request;return this.resources.map((n)=>{let r=new this.ResourceClass(n);if(t)r.withRequest(t);return r.resolve(t)})}toResponse(e){let t=this.resolve(e),n=this.constructor.wrap;if(n)return{[n]:t,...this.additional};return{data:t,...this.additional}}toJson(e){return JSON.stringify(this.toResponse(e))}count(){return this.resources.length}isEmpty(){return this.resources.length===0}isNotEmpty(){return this.resources.length>0}}class Y extends _{meta;links;constructor(e,t){super(e.data,t);this.meta=e.meta,this.links=e.links}static fromPagination(e,t,n){let{currentPage:r,perPage:o,total:s,baseUrl:a=""}=n,c=Math.ceil(s/o),p=s>0?(r-1)*o+1:null,l=s>0?Math.min(r*o,s):null;return new Y({data:e,meta:{current_page:r,from:p,last_page:c,per_page:o,to:l,total:s},links:{first:`${a}?page=1`,last:`${a}?page=${c}`,prev:r>1?`${a}?page=${r-1}`:null,next:r<c?`${a}?page=${r+1}`:null}},t)}toResponse(e){return{data:this.resolve(e),meta:this.meta,links:this.links,...this.additional}}}function Ee(e,t){let n=t(e);return{toResponse:()=>({data:n}),toJson:()=>JSON.stringify({data:n})}}function Ne(e,t){let n=e.map(t);return{toResponse:()=>({data:n}),toJson:()=>JSON.stringify({data:n})}}export{K as ConditionalValue,X as JsonResource,T as MergeValue,R as MissingValue,Y as PaginatedResourceCollection,_ as ResourceCollection,Ne as collection,Ae as describedResponses,je as fetcher,Ce as generateOpenApi,ue as methodName,we as modelDefinitionToSchema,H as renderApiClient,F as renderOpenApiTypes,Ee as resource,be as ruleIsRequired,Z as ruleToSchema,O as schemaType};
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@stacksjs/api",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "0.75.
|
|
5
|
+
"version": "0.75.87",
|
|
6
6
|
"description": "The Stacks API utilities.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
8
8
|
"contributors": [
|
|
@@ -61,15 +61,15 @@
|
|
|
61
61
|
"prepublishOnly": "bun run build"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@stacksjs/config": "0.75.
|
|
65
|
-
"@stacksjs/path": "0.75.
|
|
64
|
+
"@stacksjs/config": "0.75.87",
|
|
65
|
+
"@stacksjs/path": "0.75.87"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@stacksjs/utils": "0.75.
|
|
68
|
+
"@stacksjs/utils": "0.75.87",
|
|
69
69
|
"better-dx": "^0.2.24"
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|
|
72
|
-
"@stacksjs/router": "0.75.
|
|
72
|
+
"@stacksjs/router": "0.75.87"
|
|
73
73
|
},
|
|
74
74
|
"peerDependenciesMeta": {
|
|
75
75
|
"@stacksjs/router": {
|