@prover-coder-ai/openapi-effect 1.0.19 → 1.0.20

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/README.md CHANGED
@@ -10,7 +10,7 @@ pnpm add @prover-coder-ai/openapi-effect
10
10
 
11
11
  ## Usage (Promise API)
12
12
 
13
- This package re-exports `openapi-fetch`, so most code can be migrated by changing only the import.
13
+ This package implements an `openapi-fetch` compatible API, so most code can be migrated by changing only the import.
14
14
 
15
15
  ```ts
16
16
  import createClient from "@prover-coder-ai/openapi-effect"
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export*from"openapi-fetch";import{default as Se,default as He}from"openapi-fetch";import*as fe from"@effect/platform/FetchHttpClient";import*as C from"@effect/platform/HttpBody";import*as D from"@effect/platform/HttpClient";import*as i from"@effect/platform/HttpClientRequest";import{Effect as c,Match as a}from"effect";const he=e=>{throw new Error(`Unexpected value: ${JSON.stringify(e)}`)},R=e=>e,v=e=>e,O=e=>e,H=e=>e,T=e=>e,b=e=>e,U=e=>e,w=e=>c.gen(function*(){const t=yield*D.HttpClient,r=A(e),n=yield*c.mapError(c.gen(function*(){const s=yield*t.execute(r),o=yield*s.text;return O({status:s.status,headers:k(s.headers),text:o})}),s=>({_tag:"TransportError",error:s instanceof Error?s:new Error(String(s))}));return yield*e.dispatcher(n)}),A=e=>{let n=({get:i.get,post:i.post,put:i.put,patch:i.patch,delete:i.del,head:i.head,options:i.options}[e.method]??i.get)(e.url);if(e.headers!==void 0){const s=q(e.headers);n=i.setHeaders(n,s)}if(e.body!==void 0){const s=typeof e.body=="string"?e.body:JSON.stringify(e.body);n=i.setBody(n,C.text(s))}return n},q=e=>{if(e instanceof Headers){const t={};for(const[r,n]of e.entries())t[r]=n;return t}if(Array.isArray(e)){const t={};for(const r of e){const[n,s]=r;t[n]=s}return t}return e},k=e=>{const t=new Headers;for(const[r,n]of Object.entries(e))t.set(r,n);return t},y=e=>H(t=>{const r=t.headers.get("content-type")??void 0;return e(t.status,r,t.text)}),m=(e,t,r)=>c.try({try:()=>R(JSON.parse(r)),catch:n=>({_tag:"ParseError",status:e,contentType:t,error:n instanceof Error?n:new Error(String(n)),body:r})}),h=(e,t)=>({_tag:"UnexpectedStatus",status:e,body:t}),E=(e,t,r,n)=>({_tag:"UnexpectedContentType",status:e,expected:t,actual:r,body:n}),ge=()=>{const e=(t,r,n)=>{let s=`${n.baseUrl}${String(r)}`;if(n.params!==void 0)for(const[d,f]of Object.entries(n.params))s=s.replace(`{${d}}`,encodeURIComponent(String(f)));if(n.query!==void 0){const d=new URLSearchParams;for(const[f,g]of Object.entries(n.query))d.append(f,String(g));s=`${s}?${d.toString()}`}const o=T({method:t,url:s,dispatcher:n.dispatcher,...n.headers!==void 0&&{headers:n.headers},...n.body!==void 0&&{body:n.body},...n.signal!==void 0&&{signal:n.signal}});return w(o)};return{GET:(t,r)=>e("get",t,r),POST:(t,r)=>e("post",t,r),PUT:(t,r)=>e("put",t,r),PATCH:(t,r)=>e("patch",t,r),DELETE:(t,r)=>e("delete",t,r)}},B=()=>H(e=>{const t=e.headers.get("content-type")??void 0,r=e.status>=200&&e.status<300;if(e.text===""||e.status===204){const n={status:e.status,contentType:"none",body:void 0};return r?c.succeed(n):c.fail({_tag:"HttpError",...n})}return t?.includes("application/json")?c.gen(function*(){const n=yield*m(e.status,"application/json",e.text),s={status:e.status,contentType:"application/json",body:n};return r?s:yield*c.fail({_tag:"HttpError",...s})}):c.fail(E(e.status,["application/json"],t,e.text))});let _;const J=e=>{_=e},N=()=>{if(_===void 0)throw new Error("Default dispatchers are not registered. Import generated dispatchers module.");return U(_)},x=(e,t)=>{if(t===void 0)return e;let r=e;for(const[n,s]of Object.entries(t))r=r.replace("{"+n+"}",encodeURIComponent(String(s)));return r},L=e=>{if(e===void 0)return"";const t=new URLSearchParams;for(const[r,n]of Object.entries(e)){if(Array.isArray(n)){for(const s of n)t.append(r,String(s));continue}t.set(r,String(n))}return t.toString()},M=(e,t)=>t.length===0?e:e.includes("?")?e+"&"+t:e+"?"+t,$=(e,t)=>e===void 0||e===""?t:new URL(t,e).toString(),F=(e,t,r,n)=>{const s=x(t,r),o=L(n),d=M(s,o);return $(e,d)},W=e=>typeof e=="string"||e instanceof Blob||e instanceof ArrayBuffer||e instanceof ReadableStream||e instanceof FormData||e instanceof URLSearchParams,I=e=>e===void 0||W(e)?e:JSON.stringify(e),V=e=>e!==void 0&&typeof e!="string"&&!(e instanceof Blob)&&!(e instanceof FormData),z=e=>{const t=new Headers;for(const[r,n]of Object.entries(e))if(n!=null){if(Array.isArray(n)){t.set(r,n.map(String).join(","));continue}t.set(r,String(n))}return t},S=e=>e===void 0?new Headers:e instanceof Headers?new Headers(e):Array.isArray(e)?new Headers(e):z(e),G=(e,t)=>{const r=S(e),n=S(t);for(const[s,o]of n.entries())r.set(s,o);return r},j=(e,t)=>(r,n,s)=>{const o=F(t.baseUrl,r,s?.params,s?.query),d=G(t.headers,s?.headers),f=I(s?.body);V(s?.body)&&d.set("Content-Type","application/json");const g=T({method:e,url:o,dispatcher:n,headers:d,body:f,signal:s?.signal});return w(g)},u=(e,t,r)=>(n,s)=>j(e,t)(n,r[n][e],s),_e=(e,t)=>{const r=t??N();return b({GET:u("get",e,r),POST:u("post",e,r),PUT:u("put",e,r),DELETE:u("delete",e,r),PATCH:u("patch",e,r),HEAD:u("head",e,r),OPTIONS:u("options",e,r)})},Q=(e,t)=>(r,n)=>j(e,t)(r,B(),n),K=e=>typeof e=="object"&&e!==null&&"_tag"in e&&Reflect.get(e,"_tag")==="HttpError",X=e=>e.pipe(c.catchIf(t=>K(t),t=>c.succeed(t))),l=(e,t)=>(r,n)=>X(Q(e,t)(r,n)),ve=e=>b({GET:l("get",e),POST:l("post",e),PUT:l("put",e),DELETE:l("delete",e),PATCH:l("patch",e),HEAD:l("head",e),OPTIONS:l("options",e)}),Y=(e,t,r,n)=>c.succeed(n),Z=(e,t,r,n)=>c.succeed(n),ee=(e,t,r,n)=>c.succeed(n),te=(e,t,r,n)=>c.succeed(n),re=(e,t,r,n)=>c.succeed(n),ne=(e,t,r,n)=>c.succeed(n),se=(e,t,r,n)=>c.succeed(n),ce=(e,t,r,n)=>c.succeed(n),ae=(e,t,r,n)=>c.succeed(n),oe=(e,t,r,n)=>c.succeed(n),P=(e,t,r,n)=>t?.includes("application/json")?c.gen(function*(){const s=yield*m(e,"application/json",r),o=yield*n(e,"application/json",r,s);return v({status:e,contentType:"application/json",body:o})}):c.fail(E(e,["application/json"],t,r)),p=(e,t,r,n)=>t?.includes("application/json")?c.gen(function*(){const s=yield*m(e,"application/json",r),o=yield*n(e,"application/json",r,s);return yield*c.fail(v({_tag:"HttpError",status:e,contentType:"application/json",body:o}))}):c.fail(E(e,["application/json"],t,r)),ie=y((e,t,r)=>a.value(e).pipe(a.when(200,()=>P(200,t,r,Y)),a.when(500,()=>p(500,t,r,Z)),a.orElse(()=>c.fail(h(e,r))))),de=y((e,t,r)=>a.value(e).pipe(a.when(201,()=>P(201,t,r,ee)),a.when(400,()=>p(400,t,r,te)),a.when(500,()=>p(500,t,r,re)),a.orElse(()=>c.fail(h(e,r))))),ue=y((e,t,r)=>a.value(e).pipe(a.when(200,()=>P(200,t,r,ne)),a.when(404,()=>p(404,t,r,se)),a.when(500,()=>p(500,t,r,ce)),a.orElse(()=>c.fail(h(e,r))))),le=y((e,t,r)=>a.value(e).pipe(a.when(204,()=>c.succeed(v({status:204,contentType:"none",body:void 0}))),a.when(404,()=>p(404,t,r,ae)),a.when(500,()=>p(500,t,r,oe)),a.orElse(()=>c.fail(h(e,r))))),pe={"/pets":{get:ie,post:de},"/pets/{petId}":{get:ue,delete:le}};J(pe);export{fe as FetchHttpClient,he as assertNever,Se as createClient,ve as createClientEffect,_e as createClientStrict,y as createDispatcher,ge as createStrictClient,B as createUniversalDispatcher,ee as decodecreatePet_201,te as decodecreatePet_400,re as decodecreatePet_500,ae as decodedeletePet_404,oe as decodedeletePet_500,ne as decodegetPet_200,se as decodegetPet_404,ce as decodegetPet_500,Y as decodelistPets_200,Z as decodelistPets_500,He as default,de as dispatchercreatePet,le as dispatcherdeletePet,ue as dispatchergetPet,ie as dispatcherlistPets,pe as dispatchersByPath,w as executeRequest,m as parseJSON,J as registerDefaultDispatchers,E as unexpectedContentType,h as unexpectedStatus};
1
+ import*as Rt from"@effect/platform/FetchHttpClient";import*as G from"@effect/platform/HttpBody";import*as Y from"@effect/platform/HttpClient";import*as d from"@effect/platform/HttpClientRequest";import{Effect as o,Match as c}from"effect";const xt=e=>{throw new Error(`Unexpected value: ${JSON.stringify(e)}`)},x=e=>e,w=e=>e,K=e=>e,I=e=>e,Q=e=>e,y=e=>e,X=e=>o.gen(function*(){const t=yield*Y.HttpClient,r=Z(e),n=yield*o.mapError(o.gen(function*(){const s=yield*t.execute(r),i=yield*s.text;return K({status:s.status,headers:te(s.headers),text:i})}),s=>({_tag:"TransportError",error:s instanceof Error?s:new Error(String(s))}));return yield*e.dispatcher(n)}),Z=e=>{let n=({get:d.get,post:d.post,put:d.put,patch:d.patch,delete:d.del,head:d.head,options:d.options}[e.method]??d.get)(e.url);if(e.headers!==void 0){const s=ee(e.headers);n=d.setHeaders(n,s)}if(e.body!==void 0){const s=typeof e.body=="string"?e.body:JSON.stringify(e.body);n=d.setBody(n,G.text(s))}return n},ee=e=>{if(e instanceof Headers){const t={};for(const[r,n]of e.entries())t[r]=n;return t}if(Array.isArray(e)){const t={};for(const r of e){const[n,s]=r;t[n]=s}return t}return e},te=e=>{const t=new Headers;for(const[r,n]of Object.entries(e))t.set(r,n);return t},h=e=>I(t=>{const r=t.headers.get("content-type")??void 0;return e(t.status,r,t.text)}),g=(e,t,r)=>o.try({try:()=>x(JSON.parse(r)),catch:n=>({_tag:"ParseError",status:e,contentType:t,error:n instanceof Error?n:new Error(String(n)),body:r})}),m=(e,t)=>({_tag:"UnexpectedStatus",status:e,body:t}),P=(e,t,r,n)=>({_tag:"UnexpectedContentType",status:e,expected:t,actual:r,body:n}),wt=()=>{const e=(t,r,n)=>{let s=`${n.baseUrl}${String(r)}`;if(n.params!==void 0)for(const[a,l]of Object.entries(n.params))s=s.replace(`{${a}}`,encodeURIComponent(String(l)));if(n.query!==void 0){const a=new URLSearchParams;for(const[l,f]of Object.entries(n.query))a.append(l,String(f));s=`${s}?${a.toString()}`}const i=Q({method:t,url:s,dispatcher:n.dispatcher,...n.headers!==void 0&&{headers:n.headers},...n.body!==void 0&&{body:n.body},...n.signal!==void 0&&{signal:n.signal}});return X(i)};return{GET:(t,r)=>e("get",t,r),POST:(t,r)=>e("post",t,r),PUT:(t,r)=>e("put",t,r),PATCH:(t,r)=>e("patch",t,r),DELETE:(t,r)=>e("delete",t,r)}},gt=()=>I(e=>{const t=e.headers.get("content-type")??void 0,r=e.status>=200&&e.status<300;if(e.text===""||e.status===204){const n={status:e.status,contentType:"none",body:void 0};return r?o.succeed(n):o.fail({_tag:"HttpError",...n})}return t?.includes("application/json")?o.gen(function*(){const n=yield*g(e.status,"application/json",e.text),s={status:e.status,contentType:"application/json",body:n};return r?s:yield*o.fail({_tag:"HttpError",...s})}):o.fail(P(e.status,["application/json"],t,e.text))}),u=e=>e instanceof Error?e:new Error(String(e)),re=e=>e.length===0?o.void:o.try({try:()=>x(JSON.parse(e)),catch:u}),$=e=>o.tryPromise({try:()=>e.text(),catch:u}),ne=(e,t,r)=>t==="stream"?o.succeed(e.body):t==="text"?o.tryPromise({try:()=>e.text(),catch:u}):t==="blob"?o.tryPromise({try:()=>e.blob(),catch:u}):t==="arrayBuffer"?o.tryPromise({try:()=>e.arrayBuffer(),catch:u}):r===null?$(e).pipe(o.flatMap(n=>re(n))):o.tryPromise({try:()=>e.json(),catch:u}),se=e=>$(e).pipe(o.flatMap(t=>o.match(o.try({try:()=>x(JSON.parse(t)),catch:u}),{onFailure:()=>t,onSuccess:r=>r}))),oe=e=>e.headers.get("Transfer-Encoding")?.includes("chunked")===!0,ie=(e,t,r)=>t.status===204||e.method==="HEAD"||r==="0"&&!oe(t),ae=(e,t,r)=>{const n=t.headers.get("Content-Length");return ie(e,t,n)?t.ok?o.succeed({data:void 0,response:t}):o.succeed({error:void 0,response:t}):t.ok?ne(t,r,n).pipe(o.map(s=>({data:s,response:t}))):se(t).pipe(o.map(s=>({error:s,response:t})))},ce=e=>typeof e=="object"&&e!==null&&"then"in e&&typeof Reflect.get(e,"then")=="function",q=e=>ce(e)?o.async(t=>{e.then(r=>{t(o.succeed(r))},r=>{t(o.fail(u(r)))})}):o.succeed(e),D=e=>{const t=[];for(let r=e.length-1;r>=0;r-=1){const n=e[r];n!==void 0&&t.push(n)}return t},_=(e,t)=>({request:e,schemaPath:t.schemaPath,params:t.params,options:t.options,id:t.id}),le=(e,t)=>o.gen(function*(){let r=e;for(const n of t.middleware){if(typeof n.onRequest!="function")continue;const s=yield*q(n.onRequest(_(r,t)));if(s!==void 0){if(s instanceof Request){r=s;continue}return s instanceof Response?{request:r,response:s}:yield*o.fail(new Error("onRequest: must return new Request() or Response() when modifying the request"))}}return{request:r}}),de=(e,t,r)=>o.gen(function*(){let n=t;for(const s of D(r.middleware)){if(typeof s.onResponse!="function")continue;const i=yield*q(s.onResponse({..._(e,r),response:n}));if(i!==void 0){if(!(i instanceof Response))return yield*o.fail(new Error("onResponse: must return new Response() when modifying the response"));n=i}}return n}),ue=e=>e===void 0||e instanceof Response||e instanceof Error?o.succeed(e):o.fail(new Error("onError: must return new Response() or instance of Error")),fe=(e,t,r)=>o.gen(function*(){let n=t;for(const s of D(r.middleware)){if(typeof s.onError!="function")continue;const i=yield*q(s.onError({..._(e,r),error:n})),a=yield*ue(i);if(a instanceof Response)return a;a instanceof Error&&(n=a)}return yield*o.fail(n)}),E=e=>typeof e=="string"||typeof e=="number"||typeof e=="boolean",b=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),pe={simple:",",label:".",matrix:";",form:"&",deepObject:"&"},j={simple:{explodeFalse:",",explodeTrue:","},label:{explodeFalse:",",explodeTrue:"."},matrix:{explodeFalse:",",explodeTrue:";"},form:{explodeFalse:",",explodeTrue:"&"},spaceDelimited:{explodeFalse:"%20",explodeTrue:"&"},pipeDelimited:{explodeFalse:"|",explodeTrue:"&"}},z=(e,t)=>t?String(e):encodeURIComponent(String(e)),ye=(e,t,r)=>t==="simple"?r:t==="label"?`.${r}`:t==="matrix"?`;${e}=${r}`:`${e}=${r}`,he=(e,t,r)=>e==="label"||e==="matrix"?`${t}${r}`:r,me=e=>{const t=[];for(const r of e)E(r)&&t.push(r);return t},Ee=e=>b(e)?Object.entries(e):[],be=(e,t,r,n,s)=>{const i=[];for(const[a,l]of Object.entries(t)){if(!E(l))continue;if(!n){i.push(a,z(l,r));continue}const f=s==="deepObject"?`${e}[${a}]`:a;i.push(S(f,l,{allowReserved:r}))}return i},Se=(e,t,r,n,s)=>{const i=[];for(const a of me(t)){if(s&&r!=="simple"&&r!=="label"){i.push(S(e,a,{allowReserved:n}));continue}i.push(z(a,n))}return i},M=e=>{const t=e.explode?e.joinerWhenExplodeTrue:e.joinerWhenExplodeFalse,r=e.values.join(t);return e.explode?he(e.style,e.joinerWhenExplodeTrue,r):ye(e.name,e.style,r)},S=(e,t,r)=>`${e}=${z(t,r?.allowReserved===!0)}`,v=(e,t,r)=>{if(!b(t))return"";const n=be(e,t,r.allowReserved===!0,r.explode,r.style);return M({name:e,style:r.style,explode:r.explode,values:n,joinerWhenExplodeFalse:",",joinerWhenExplodeTrue:pe[r.style]})},N=(e,t,r)=>{if(!Array.isArray(t))return"";const n=Se(e,t,r.style,r.allowReserved===!0,r.explode);return M({name:e,style:r.style,explode:r.explode,values:n,joinerWhenExplodeFalse:j[r.style].explodeFalse,joinerWhenExplodeTrue:j[r.style].explodeTrue})},Re=(e,t,r)=>{if(t!=null)return Array.isArray(t)?Te(e,t,r):xe(e,t,r)},Te=(e,t,r)=>{if(t.length!==0)return N(e,t,{style:"form",explode:!0,...r?.array,allowReserved:r?.allowReserved===!0})},xe=(e,t,r)=>{if(b(t))return v(e,t,{style:"deepObject",explode:!0,...r?.object,allowReserved:r?.allowReserved===!0});if(E(t))return S(e,t,r)},O=e=>t=>{const r=[];for(const[n,s]of Ee(t)){const i=Re(n,s,e);i!==void 0&&r.push(i)}return r.join("&")},we=/\{[^{}]+\}/g,ge=e=>{let t=e,r=!1,n="simple";return t.endsWith("*")&&(r=!0,t=t.slice(0,Math.max(0,t.length-1))),t.startsWith(".")?(n="label",t=t.slice(1)):t.startsWith(";")&&(n="matrix",t=t.slice(1)),{name:t,explode:r,style:n}},Pe=(e,t,r)=>{if(Array.isArray(t))return N(e,t,{style:r.style,explode:r.explode});if(b(t))return v(e,t,{style:r.style,explode:r.explode});if(!E(t))return;if(r.style==="matrix")return`;${S(e,t)}`;const n=encodeURIComponent(String(t));return r.style==="label"?`.${n}`:n},qe=(e,t)=>{let r=e;for(const n of e.match(we)??[]){const s=n.slice(1,-1),i=ge(s),a=t[i.name];if(a==null)continue;const l=Pe(i.name,a,i);l!==void 0&&(r=r.replace(n,l))}return r},_e=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),ze=e=>{if(!_e(e))return{};const t={};for(const[r,n]of Object.entries(e))t[r]=String(n);return t},F=e=>!(e instanceof Headers)&&!Array.isArray(e),C=(e,t)=>{if(e===void 0)return;if(e instanceof Headers)return e.get(t)??void 0;if(!F(e))return;const r=e[t];if(!(r==null||Array.isArray(r)))return String(r)},Ae=e=>JSON.stringify(e),je=(e,t)=>e===void 0?"":(C(t,"Content-Type")??C(t,"content-type"))==="application/x-www-form-urlencoded"?new URLSearchParams(ze(e)).toString():Ae(e),Oe=(e,t)=>{let r=`${t.baseUrl}${e}`;t.params.path&&(r=t.pathSerializer(r,t.params.path));let n=t.querySerializer(t.params.query??{});return n.startsWith("?")&&(n=n.slice(1)),n.length>0&&(r=`${r}?${n}`),r},Ce=(e,t,r)=>{if(r===null){e.delete(t);return}if(Array.isArray(r)){for(const n of r)e.append(t,String(n));return}r!==void 0&&e.set(t,String(r))},He=(e,t)=>{if(t instanceof Headers){for(const[r,n]of t.entries())e.set(r,n);return}if(F(t))for(const[r,n]of Object.entries(t))Ce(e,r,n)},H=(...e)=>{const t=new Headers;for(const r of e)r===void 0||typeof r!="object"||He(t,r);return t},L=e=>e.endsWith("/")?e.slice(0,Math.max(0,e.length-1)):e,Ue=()=>typeof process=="object"&&Number.parseInt(process.versions.node.slice(0,2),10)>=18&&typeof process.versions.undici=="string",Be=()=>globalThis.crypto.randomUUID().replaceAll("-","").slice(0,9),Ie=e=>e!==void 0&&typeof e=="object",$e=(e,t)=>{let r=typeof e=="function"?e:O(e);return t&&(r=typeof t=="function"?t:O({...Ie(e)?e:{},...t})),r},U=e=>typeof e=="string"||typeof e=="number"||typeof e=="boolean",De=e=>{if(e===void 0)return{};const t={};for(const[r,n]of Object.entries(e)){if(n==null||U(n)){t[r]=n;continue}Array.isArray(n)&&(t[r]=n.filter(s=>U(s)))}return t},Me=e=>typeof e=="string"||e instanceof Blob||e instanceof URLSearchParams||e instanceof ArrayBuffer||e instanceof FormData||e instanceof ReadableStream,ve=(e,t,r)=>e===void 0?{hasBody:!1}:Me(e)?{hasBody:!0,value:e}:{hasBody:!0,value:t(e,r)},Ne=(e,t)=>{for(const r in t)r in e||Reflect.set(e,r,t[r])},B=(e,t,r)=>{const n=y(e);return o.tryPromise({try:()=>n(t,r),catch:u})},Fe=e=>Object.freeze({baseUrl:e.baseUrl,parseAs:e.parseAs,querySerializer:e.querySerializer,bodySerializer:e.bodySerializer,pathSerializer:e.pathSerializer,fetch:y(e.fetch)}),Le=(e,t)=>t?L(t):e,ke=(e,t)=>t??e??je,Je=(e,t)=>t??e??qe,We=(e,t)=>[...e,...t],Ve=(e,t)=>{const{Request:r=e.Request,baseUrl:n,body:s,bodySerializer:i,fetch:a=e.fetch,headers:l,middleware:f=[],params:R={},parseAs:T="json",pathSerializer:J,querySerializer:W,...V}=t??{};return{Request:r,fetch:a,parseAs:T,params:R,body:s,bodySerializer:ke(e.bodySerializer,i),headers:l,init:V,finalBaseUrl:Le(e.baseUrl,n),pathSerializer:Je(e.pathSerializer,J),querySerializer:$e(e.querySerializer,W),middleware:We(e.globalMiddlewares,f)}},Ge=(e,t)=>{const r=De(t.params.header),n=ve(t.body,t.bodySerializer,H(e.headers,t.headers,r)),s=H(!n.hasBody||n.value instanceof FormData?{}:{"Content-Type":"application/json"},e.headers,t.headers,r);return{serializedBody:n,finalHeaders:s}},Ye=(e,t,r,n)=>{const s={redirect:"follow",...e.baseOptions,...r.init,...n.serializedBody.hasBody?{body:n.serializedBody.value}:{},headers:n.finalHeaders},i=new r.Request(Oe(t,{baseUrl:r.finalBaseUrl,params:r.params,querySerializer:r.querySerializer,pathSerializer:r.pathSerializer}),s);return Ne(i,r.init),i},Ke=(e,t)=>({schemaPath:e,params:t.params,id:Be(),options:Fe({baseUrl:t.finalBaseUrl,parseAs:t.parseAs,querySerializer:t.querySerializer,bodySerializer:t.bodySerializer,pathSerializer:t.pathSerializer,fetch:t.fetch}),middleware:t.middleware}),Qe=(e,t,r)=>{const n=Ve(e,r),s=Ge(e,n);return{request:Ye(e,t,n,s),fetch:n.fetch,parseAs:n.parseAs,middleware:n.middleware,requestInitExt:e.requestInitExt,context:Ke(t,n)}},Xe=e=>e.middleware.length===0?B(e.fetch,e.request,e.requestInitExt).pipe(o.map(t=>({request:e.request,response:t}))):o.gen(function*(){const t=yield*le(e.request,e.context),r=t.request,n=t.response??(yield*B(e.fetch,r,e.requestInitExt).pipe(o.matchEffect({onFailure:i=>fe(r,i,e.context),onSuccess:i=>o.succeed(i)}))),s=yield*de(r,n,e.context);return{request:r,response:s}}),Ze=e=>(t,r)=>o.gen(function*(){const n=Qe(e,t,r),s=yield*Xe(n);return yield*ae(s.request,s.response,n.parseAs)}),et=e=>"onRequest"in e||"onResponse"in e||"onError"in e,tt=(e,t)=>{const{Request:r=globalThis.Request,baseUrl:n="",bodySerializer:s,fetch:i=globalThis.fetch,headers:a,pathSerializer:l,querySerializer:f,requestInitExt:R,...T}={...e};return{Request:r,baseUrl:L(n),bodySerializer:s,fetch:i,headers:a,pathSerializer:l,querySerializer:f,requestInitExt:Ue()?R:void 0,baseOptions:T,globalMiddlewares:t}},rt=(e,t)=>({request:(r,n,s)=>e(n,{...s,method:r.toUpperCase()}),GET:(r,n)=>e(r,{...n,method:"GET"}),PUT:(r,n)=>e(r,{...n,method:"PUT"}),POST:(r,n)=>e(r,{...n,method:"POST"}),DELETE:(r,n)=>e(r,{...n,method:"DELETE"}),OPTIONS:(r,n)=>e(r,{...n,method:"OPTIONS"}),HEAD:(r,n)=>e(r,{...n,method:"HEAD"}),PATCH:(r,n)=>e(r,{...n,method:"PATCH"}),TRACE:(r,n)=>e(r,{...n,method:"TRACE"}),use:(...r)=>{for(const n of r){if(!et(n))throw new Error("Middleware must be an object with one of `onRequest()`, `onResponse() or `onError()`");t.push(n)}},eject:(...r)=>{for(const n of r){const s=t.indexOf(n);s!==-1&&t.splice(s,1)}}}),nt=e=>{const t=[],r=tt(e,t),n=Ze(r);return rt(n,t)},k=e=>y(nt(e));class st{constructor(t,r){this.client=t,this.url=r}call=(t,r)=>this.client[t](this.url,r);GET=t=>this.call("GET",t);PUT=t=>this.call("PUT",t);POST=t=>this.call("POST",t);DELETE=t=>this.call("DELETE",t);OPTIONS=t=>this.call("OPTIONS",t);HEAD=t=>this.call("HEAD",t);PATCH=t=>this.call("PATCH",t);TRACE=t=>this.call("TRACE",t)}const ot=e=>{const t=new Map,r=y({});return new Proxy(r,{get:(n,s)=>{if(typeof s!="string")return;const i=t.get(s);if(i!==void 0)return i;const a=new st(y(e),s);return t.set(s,a),a}})},Pt=e=>ot(k(e)),qt=e=>k(e),_t=e=>{},it=(e,t,r,n)=>o.succeed(n),at=(e,t,r,n)=>o.succeed(n),ct=(e,t,r,n)=>o.succeed(n),lt=(e,t,r,n)=>o.succeed(n),dt=(e,t,r,n)=>o.succeed(n),ut=(e,t,r,n)=>o.succeed(n),ft=(e,t,r,n)=>o.succeed(n),pt=(e,t,r,n)=>o.succeed(n),yt=(e,t,r,n)=>o.succeed(n),ht=(e,t,r,n)=>o.succeed(n),A=(e,t,r,n)=>t?.includes("application/json")?o.gen(function*(){const s=yield*g(e,"application/json",r),i=yield*n(e,"application/json",r,s);return w({status:e,contentType:"application/json",body:i})}):o.fail(P(e,["application/json"],t,r)),p=(e,t,r,n)=>t?.includes("application/json")?o.gen(function*(){const s=yield*g(e,"application/json",r),i=yield*n(e,"application/json",r,s);return yield*o.fail(w({_tag:"HttpError",status:e,contentType:"application/json",body:i}))}):o.fail(P(e,["application/json"],t,r)),mt=h((e,t,r)=>c.value(e).pipe(c.when(200,()=>A(200,t,r,it)),c.when(500,()=>p(500,t,r,at)),c.orElse(()=>o.fail(m(e,r))))),Et=h((e,t,r)=>c.value(e).pipe(c.when(201,()=>A(201,t,r,ct)),c.when(400,()=>p(400,t,r,lt)),c.when(500,()=>p(500,t,r,dt)),c.orElse(()=>o.fail(m(e,r))))),bt=h((e,t,r)=>c.value(e).pipe(c.when(200,()=>A(200,t,r,ut)),c.when(404,()=>p(404,t,r,ft)),c.when(500,()=>p(500,t,r,pt)),c.orElse(()=>o.fail(m(e,r))))),St=h((e,t,r)=>c.value(e).pipe(c.when(204,()=>o.succeed(w({status:204,contentType:"none",body:void 0}))),c.when(404,()=>p(404,t,r,yt)),c.when(500,()=>p(500,t,r,ht)),c.orElse(()=>o.fail(m(e,r))))),zt={"/pets":{get:mt,post:Et},"/pets/{petId}":{get:bt,delete:St}};export{Rt as FetchHttpClient,xt as assertNever,k as createClient,qt as createClientEffect,h as createDispatcher,Oe as createFinalURL,Pt as createPathBasedClient,O as createQuerySerializer,wt as createStrictClient,gt as createUniversalDispatcher,ct as decodecreatePet_201,lt as decodecreatePet_400,dt as decodecreatePet_500,yt as decodedeletePet_404,ht as decodedeletePet_500,ut as decodegetPet_200,ft as decodegetPet_404,pt as decodegetPet_500,it as decodelistPets_200,at as decodelistPets_500,k as default,je as defaultBodySerializer,qe as defaultPathSerializer,Et as dispatchercreatePet,St as dispatcherdeletePet,bt as dispatchergetPet,mt as dispatcherlistPets,zt as dispatchersByPath,X as executeRequest,H as mergeHeaders,g as parseJSON,_t as registerDefaultDispatchers,L as removeTrailingSlash,N as serializeArrayParam,v as serializeObjectParam,S as serializePrimitiveParam,P as unexpectedContentType,m as unexpectedStatus};
2
2
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/core/api-client/strict-types.ts","../src/core/axioms.ts","../src/shell/api-client/strict-client.ts","../src/shell/api-client/create-client.ts","../src/generated/decoders.ts","../src/generated/dispatch.ts","../src/generated/dispatchers-by-path.ts"],"sourcesContent":["// CHANGE: Define core type-level operations for extracting OpenAPI types\n// WHY: Enable compile-time type safety without runtime overhead through pure type transformations\n// QUOTE(ТЗ): \"Success / HttpError являются коррелированными суммами (status → точный тип body) строго из OpenAPI типов\"\n// REF: issue-2, section 3.1, 4.1-4.3\n// SOURCE: n/a\n// FORMAT THEOREM: ∀ Op ∈ Operations: ResponseVariant<Op> = Success<Op> ⊎ Failure<Op>\n// PURITY: CORE\n// INVARIANT: All types computed at compile time, no runtime operations\n// COMPLEXITY: O(1) compile-time / O(0) runtime\n\nimport type { HttpMethod, PathsWithMethod } from \"openapi-typescript-helpers\"\n\n/**\n * Extract all paths that support a given HTTP method\n *\n * @pure true - compile-time only\n * @invariant Result ⊆ paths\n */\nexport type PathsForMethod<\n Paths extends object,\n Method extends HttpMethod\n> = PathsWithMethod<Paths, Method>\n\n/**\n * Extract operation definition for a path and method\n *\n * @pure true - compile-time only\n * @invariant ∀ path ∈ Paths, method ∈ Methods: Operation<Paths, path, method> = Paths[path][method]\n */\nexport type OperationFor<\n Paths extends object,\n Path extends keyof Paths,\n Method extends HttpMethod\n> = Method extends keyof Paths[Path] ? Paths[Path][Method] : never\n\n/**\n * Extract all response definitions from an operation\n *\n * @pure true - compile-time only\n */\nexport type ResponsesFor<Op> = Op extends { responses: infer R } ? R : never\n\n// ============================================================================\n// Request-side typing (path/method → params/query/body)\n// ============================================================================\n\n/**\n * Extract path parameters from operation\n *\n * @pure true - compile-time only\n * @invariant Returns path params type or undefined if none\n */\nexport type PathParamsFor<Op> = Op extends { parameters: { path: infer P } }\n ? P extends Record<string, infer V> ? Record<string, V>\n : never\n : undefined\n\n/**\n * Extract query parameters from operation\n *\n * @pure true - compile-time only\n * @invariant Returns query params type or undefined if none\n */\nexport type QueryParamsFor<Op> = Op extends { parameters: { query?: infer Q } } ? Q\n : undefined\n\n/**\n * Extract request body type from operation\n *\n * @pure true - compile-time only\n * @invariant Returns body type or undefined if no requestBody\n */\nexport type RequestBodyFor<Op> = Op extends { requestBody: { content: infer C } }\n ? C extends { \"application/json\": infer J } ? J\n : C extends { [key: string]: infer V } ? V\n : never\n : undefined\n\n/**\n * Check if path params are required\n *\n * @pure true - compile-time only\n */\n\nexport type HasRequiredPathParams<Op> = Op extends { parameters: { path: infer P } }\n ? P extends Record<PropertyKey, string | number | boolean> ? keyof P extends never ? false : true\n : false\n : false\n\n/**\n * Check if request body is required\n *\n * @pure true - compile-time only\n */\nexport type HasRequiredBody<Op> = Op extends { requestBody: infer RB } ? RB extends { content: object } ? true\n : false\n : false\n\n/**\n * Build request options type from operation with all constraints\n * - params: required if path has required parameters\n * - query: optional, typed from operation\n * - body: required if operation has requestBody (accepts typed object OR string)\n *\n * For request body:\n * - Users can pass either the typed object (preferred, for type safety)\n * - Or a pre-stringified JSON string with headers (for backwards compatibility)\n *\n * @pure true - compile-time only\n * @invariant Options type is fully derived from operation definition\n */\nexport type RequestOptionsFor<Op> =\n & (HasRequiredPathParams<Op> extends true ? { readonly params: PathParamsFor<Op> }\n : { readonly params?: PathParamsFor<Op> })\n & (HasRequiredBody<Op> extends true ? { readonly body: RequestBodyFor<Op> | BodyInit }\n : { readonly body?: RequestBodyFor<Op> | BodyInit })\n & { readonly query?: QueryParamsFor<Op> }\n & { readonly headers?: HeadersInit }\n & { readonly signal?: AbortSignal }\n\n/**\n * Extract status codes from responses\n *\n * @pure true - compile-time only\n * @invariant Result = { s | s ∈ keys(Responses) }\n */\nexport type StatusCodes<Responses> = keyof Responses & (number | string)\n\n/**\n * Extract content types for a specific status code\n *\n * @pure true - compile-time only\n */\nexport type ContentTypesFor<\n Responses,\n Status extends StatusCodes<Responses>\n> = Status extends keyof Responses ? Responses[Status] extends { content: infer C } ? keyof C & string\n : \"none\"\n : never\n\n/**\n * Extract body type for a specific status and content-type\n *\n * @pure true - compile-time only\n * @invariant Strict correlation: Body type depends on both status and content-type\n */\nexport type BodyFor<\n Responses,\n Status extends StatusCodes<Responses>,\n ContentType extends ContentTypesFor<Responses, Status>\n> = Status extends keyof Responses\n ? Responses[Status] extends { content: infer C } ? ContentType extends keyof C ? C[ContentType]\n : never\n : ContentType extends \"none\" ? undefined\n : never\n : never\n\n/**\n * Build a correlated success response variant (status + contentType + body)\n * Used for 2xx responses that go to the success channel.\n *\n * @pure true - compile-time only\n * @invariant ∀ variant: variant.body = BodyFor<Responses, variant.status, variant.contentType>\n */\nexport type ResponseVariant<\n Responses,\n Status extends StatusCodes<Responses>,\n ContentType extends ContentTypesFor<Responses, Status>\n> = {\n readonly status: Status\n readonly contentType: ContentType\n readonly body: BodyFor<Responses, Status, ContentType>\n}\n\n/**\n * Build a correlated HTTP error response variant (status + contentType + body + _tag)\n * Used for non-2xx responses (4xx, 5xx) that go to the error channel.\n *\n * The `_tag: \"HttpError\"` discriminator allows distinguishing HTTP errors from BoundaryErrors.\n *\n * @pure true - compile-time only\n * @invariant ∀ variant: variant.body = BodyFor<Responses, variant.status, variant.contentType>\n */\nexport type HttpErrorResponseVariant<\n Responses,\n Status extends StatusCodes<Responses>,\n ContentType extends ContentTypesFor<Responses, Status>\n> = {\n readonly _tag: \"HttpError\"\n readonly status: Status\n readonly contentType: ContentType\n readonly body: BodyFor<Responses, Status, ContentType>\n}\n\n/**\n * Build all response variants for given responses\n *\n * @pure true - compile-time only\n */\ntype AllResponseVariants<Responses> = StatusCodes<Responses> extends infer Status\n ? Status extends StatusCodes<Responses>\n ? ContentTypesFor<Responses, Status> extends infer CT\n ? CT extends ContentTypesFor<Responses, Status> ? ResponseVariant<Responses, Status, CT>\n : never\n : never\n : never\n : never\n\n/**\n * Generic 2xx status detection without hardcoding\n * Uses template literal type to check if status string starts with \"2\"\n *\n * Works with any 2xx status including non-standard ones like 250.\n *\n * @pure true - compile-time only\n * @invariant Is2xx<S> = true ⟺ 200 ≤ S < 300\n */\nexport type Is2xx<S extends string | number> = `${S}` extends `2${string}` ? true : false\n\n/**\n * Filter response variants to success statuses (2xx)\n * Uses generic Is2xx instead of hardcoded status list.\n *\n * @pure true - compile-time only\n * @invariant ∀ v ∈ SuccessVariants: Is2xx<v.status> = true\n */\nexport type SuccessVariants<Responses> = AllResponseVariants<Responses> extends infer V\n ? V extends ResponseVariant<Responses, infer S, infer CT> ? Is2xx<S> extends true ? ResponseVariant<Responses, S, CT>\n : never\n : never\n : never\n\n/**\n * Filter response variants to error statuses (non-2xx from schema)\n * Returns HttpErrorResponseVariant with `_tag: \"HttpError\"` for discrimination.\n * Uses generic Is2xx instead of hardcoded status list.\n *\n * @pure true - compile-time only\n * @invariant ∀ v ∈ HttpErrorVariants: Is2xx<v.status> = false ∧ v.status ∈ Schema ∧ v._tag = \"HttpError\"\n */\nexport type HttpErrorVariants<Responses> = AllResponseVariants<Responses> extends infer V\n ? V extends ResponseVariant<Responses, infer S, infer CT> ? Is2xx<S> extends true ? never\n : HttpErrorResponseVariant<Responses, S, CT>\n : never\n : never\n\n/**\n * Boundary errors - always present regardless of schema\n *\n * @pure true - compile-time only\n * @invariant These errors represent protocol/parsing failures, not business logic\n */\nexport type TransportError = {\n readonly _tag: \"TransportError\"\n readonly error: Error\n}\n\nexport type UnexpectedStatus = {\n readonly _tag: \"UnexpectedStatus\"\n readonly status: number\n readonly body: string\n}\n\nexport type UnexpectedContentType = {\n readonly _tag: \"UnexpectedContentType\"\n readonly status: number\n readonly expected: ReadonlyArray<string>\n readonly actual: string | undefined\n readonly body: string\n}\n\nexport type ParseError = {\n readonly _tag: \"ParseError\"\n readonly status: number\n readonly contentType: string\n readonly error: Error\n readonly body: string\n}\n\nexport type DecodeError = {\n readonly _tag: \"DecodeError\"\n readonly status: number\n readonly contentType: string\n readonly error: Error\n readonly body: string\n}\n\nexport type BoundaryError =\n | TransportError\n | UnexpectedStatus\n | UnexpectedContentType\n | ParseError\n | DecodeError\n\n/**\n * Success type for an operation (2xx statuses only)\n *\n * Goes to the **success channel** of Effect.\n * Developers receive this directly without needing to handle errors.\n *\n * @pure true - compile-time only\n * @invariant ∀ v ∈ ApiSuccess: v.status ∈ [200..299]\n */\nexport type ApiSuccess<Responses> = SuccessVariants<Responses>\n\n/**\n * HTTP error responses from schema (non-2xx statuses like 400, 404, 500)\n *\n * Goes to the **error channel** of Effect, forcing explicit handling.\n * These are business-level errors defined in the OpenAPI schema.\n *\n * @pure true - compile-time only\n * @invariant ∀ v ∈ HttpError: v.status ∉ [200..299] ∧ v.status ∈ Schema\n */\nexport type HttpError<Responses> = HttpErrorVariants<Responses>\n\n/**\n * Complete failure type for API operations\n *\n * Includes both schema-defined HTTP errors (4xx, 5xx) and boundary errors.\n * All failures go to the **error channel** of Effect, forcing explicit handling.\n *\n * @pure true - compile-time only\n * @invariant ApiFailure = HttpError ⊎ BoundaryError\n *\n * BREAKING CHANGE: Previously, HTTP errors (404, 500) were in success channel.\n * Now they are in error channel, requiring explicit handling with Effect.catchTag\n * or Effect.match pattern.\n */\nexport type ApiFailure<Responses> = HttpError<Responses> | BoundaryError\n\n/**\n * @deprecated Use ApiSuccess<Responses> for success channel\n * and ApiFailure<Responses> for error channel instead.\n *\n * ApiResponse mixed success and error statuses in one type.\n * New API separates them into proper Effect channels.\n */\nexport type ApiResponse<Responses> = SuccessVariants<Responses> | HttpErrorVariants<Responses>\n\n/**\n * Helper to ensure exhaustive pattern matching\n *\n * @pure true\n * @throws Compile-time error if called with non-never type\n */\nexport const assertNever = (x: never): never => {\n throw new Error(`Unexpected value: ${JSON.stringify(x)}`)\n}\n","// CHANGE: Create axioms module for type-safe cast operations\n// WHY: Centralize all type assertions in a single auditable location per CLAUDE.md\n// QUOTE(ТЗ): \"as: запрещён в обычном коде; допускается ТОЛЬКО в одном аксиоматическом модуле\"\n// REF: issue-2, section 3.1\n// SOURCE: n/a\n// FORMAT THEOREM: ∀ cast ∈ Axioms: cast(x) → typed(x) ∨ runtime_validated(x)\n// PURITY: CORE\n// EFFECT: none - pure type-level operations\n// INVARIANT: All casts auditable in single file\n// COMPLEXITY: O(1)\n\n/**\n * JSON value type - result of JSON.parse()\n * This is the fundamental type for all parsed JSON values\n */\n/**\n * Cast function for dispatcher factory\n * AXIOM: Dispatcher factory receives valid classify function\n *\n * This enables generated dispatchers to work with heterogeneous Effect unions.\n * The cast is safe because:\n * 1. The classify function is generated from OpenAPI schema\n * 2. All status/content-type combinations are exhaustively covered\n * 3. The returned Effect conforms to Dispatcher signature\n *\n * @pure true\n */\nimport type { Effect } from \"effect\"\nimport type { ApiFailure, ApiSuccess, TransportError } from \"./api-client/strict-types.js\"\n\nexport type Json =\n | null\n | boolean\n | number\n | string\n | ReadonlyArray<Json>\n | { readonly [k: string]: Json }\n\n/**\n * Cast parsed JSON value to typed Json\n * AXIOM: JSON.parse returns a valid Json value\n *\n * @precondition value is result of JSON.parse on valid JSON string\n * @postcondition result conforms to Json type\n * @pure true\n */\nexport const asJson = (value: unknown): Json => value as Json\n\n/**\n * Cast a value to a specific type with const assertion\n * Used for creating literal typed objects in generated code\n *\n * @pure true\n */\nexport const asConst = <T>(value: T): T => value\n\n/**\n * Create a typed RawResponse from raw values\n * AXIOM: HTTP response structure is known at runtime\n *\n * @pure true\n */\nexport type RawResponse = {\n readonly status: number\n readonly headers: Headers\n readonly text: string\n}\n\nexport const asRawResponse = (value: {\n status: number\n headers: Headers\n text: string\n}): RawResponse => value as RawResponse\n\n/**\n * Dispatcher classifies response and applies decoder\n *\n * NEW DESIGN (Effect-native):\n * - Success channel: `ApiSuccess<Responses>` (2xx responses only)\n * - Error channel: `ApiFailure<Responses>` (non-2xx schema errors + boundary errors)\n *\n * This forces developers to explicitly handle HTTP errors (404, 500, etc.)\n * using Effect.catchTag, Effect.match, or similar patterns.\n *\n * @pure false - applies decoders\n * @effect Effect<ApiSuccess, HttpError | BoundaryError, never>\n * @invariant Must handle all statuses and content-types from schema\n */\nexport type Dispatcher<Responses> = (\n response: RawResponse\n) => Effect.Effect<\n ApiSuccess<Responses>,\n Exclude<ApiFailure<Responses>, TransportError>\n>\n\nexport const asDispatcher = <Responses>(\n fn: (response: RawResponse) => Effect.Effect<unknown, unknown>\n): Dispatcher<Responses> => fn as Dispatcher<Responses>\n\n/**\n * Cast for StrictRequestInit config object\n * AXIOM: Config object has correct structure when all properties assigned\n *\n * @pure true\n */\nexport const asStrictRequestInit = <T>(config: object): T => config as T\n\n/**\n * Classifier function type for dispatcher creation\n * AXIOM: Classify function returns Effect with heterogeneous union types\n *\n * This type uses `unknown` to allow the classify function to return\n * heterogeneous Effect unions from switch statements. The actual types\n * are enforced by the generated dispatcher code.\n *\n * @pure true\n */\nexport type ClassifyFn = (\n status: number,\n contentType: string | undefined,\n text: string\n) => Effect.Effect<unknown, unknown>\n\n/**\n * Cast internal client implementation to typed StrictApiClient\n * AXIOM: Client implementation correctly implements all method constraints\n *\n * This cast is safe because:\n * 1. StrictApiClient type enforces path/method constraints at call sites\n * 2. The runtime implementation correctly builds requests for any path/method\n * 3. Type checking happens at the call site, not in the implementation\n *\n * @pure true\n */\nexport const asStrictApiClient = <T>(client: object): T => client as T\n\n/**\n * Cast default dispatchers registry to specific schema type\n * AXIOM: Default dispatcher registry was registered for the current Paths type\n *\n * @pure true\n */\nexport const asDispatchersFor = <T>(value: unknown): T => value as T\n","// CHANGE: Implement Effect-based HTTP client with Effect-native error handling\n// WHY: Force explicit handling of HTTP errors (4xx, 5xx) via Effect error channel\n// QUOTE(ТЗ): \"каждый запрос возвращает Effect<Success, Failure, never>; Failure включает все инварианты протокола и схемы\"\n// REF: issue-2, section 2, 4, 5.1\n// SOURCE: n/a\n// FORMAT THEOREM: ∀ req ∈ Requests: execute(req) → Effect<ApiSuccess, ApiFailure, R>\n// PURITY: SHELL\n// EFFECT: Effect<ApiSuccess<Op>, ApiFailure<Op>, HttpClient.HttpClient>\n// INVARIANT: 2xx → success channel, non-2xx → error channel (forced handling)\n// COMPLEXITY: O(1) per request / O(n) for body size\n\nimport * as HttpBody from \"@effect/platform/HttpBody\"\nimport * as HttpClient from \"@effect/platform/HttpClient\"\nimport * as HttpClientRequest from \"@effect/platform/HttpClientRequest\"\nimport { Effect } from \"effect\"\nimport type { HttpMethod } from \"openapi-typescript-helpers\"\n\nimport type {\n ApiFailure,\n ApiSuccess,\n DecodeError,\n OperationFor,\n ParseError,\n ResponsesFor,\n TransportError,\n UnexpectedContentType,\n UnexpectedStatus\n} from \"../../core/api-client/strict-types.js\"\nimport {\n asDispatcher,\n asJson,\n asRawResponse,\n asStrictRequestInit,\n type ClassifyFn,\n type Dispatcher,\n type Json,\n type RawResponse\n} from \"../../core/axioms.js\"\n\n// Re-export Dispatcher type for consumers\n\n/**\n * Decoder for response body\n *\n * @pure false - may perform validation\n * @effect Effect<T, DecodeError, never>\n */\nexport type Decoder<T> = (\n status: number,\n contentType: string,\n body: string\n) => Effect.Effect<T, DecodeError>\n\n/**\n * Configuration for a strict API client request\n */\nexport type StrictRequestInit<Responses> = {\n readonly method: HttpMethod\n readonly url: string\n readonly dispatcher: Dispatcher<Responses>\n readonly headers?: HeadersInit\n readonly body?: BodyInit\n readonly signal?: AbortSignal\n}\n\n/**\n * Execute HTTP request with Effect-native error handling\n *\n * @param config - Request configuration with dispatcher\n * @returns Effect with success (2xx) and failures (non-2xx + boundary errors)\n *\n * **Effect Channel Design:**\n * - Success channel: `ApiSuccess<Responses>` - 2xx responses only\n * - Error channel: `ApiFailure<Responses>` - HTTP errors (4xx, 5xx) + boundary errors\n *\n * This forces developers to explicitly handle HTTP errors using:\n * - `Effect.catchTag` for specific error types\n * - `Effect.match` for exhaustive handling\n * - `Effect.catchAll` for generic error handling\n *\n * @pure false - performs HTTP request\n * @effect Effect<ApiSuccess<Responses>, ApiFailure<Responses>, HttpClient.HttpClient>\n * @invariant 2xx → success channel, non-2xx → error channel\n * @precondition config.dispatcher handles all schema statuses\n * @postcondition ∀ response: success(2xx) ∨ httpError(non-2xx) ∨ boundaryError\n * @complexity O(1) + O(|body|) for text extraction\n */\nexport const executeRequest = <Responses>(\n config: StrictRequestInit<Responses>\n): Effect.Effect<ApiSuccess<Responses>, ApiFailure<Responses>, HttpClient.HttpClient> =>\n Effect.gen(function*() {\n // STEP 1: Get HTTP client from context\n const client = yield* HttpClient.HttpClient\n\n // STEP 2: Build request based on method\n const request = buildRequest(config)\n\n // STEP 3: Execute request with error mapping\n const rawResponse = yield* Effect.mapError(\n Effect.gen(function*() {\n const response = yield* client.execute(request)\n const text = yield* response.text\n return asRawResponse({\n status: response.status,\n headers: toNativeHeaders(response.headers),\n text\n })\n }),\n (error): TransportError => ({\n _tag: \"TransportError\",\n error: error instanceof Error ? error : new Error(String(error))\n })\n )\n\n // STEP 4: Delegate classification to dispatcher (handles status/content-type/decode)\n return yield* config.dispatcher(rawResponse)\n })\n\n/**\n * Build HTTP request from config\n *\n * @pure true\n */\nconst buildRequest = <Responses>(config: StrictRequestInit<Responses>): HttpClientRequest.HttpClientRequest => {\n const methodMap: Record<string, (url: string) => HttpClientRequest.HttpClientRequest> = {\n get: HttpClientRequest.get,\n post: HttpClientRequest.post,\n put: HttpClientRequest.put,\n patch: HttpClientRequest.patch,\n delete: HttpClientRequest.del,\n head: HttpClientRequest.head,\n options: HttpClientRequest.options\n }\n\n const createRequest = methodMap[config.method] ?? HttpClientRequest.get\n let request = createRequest(config.url)\n\n // Add headers if provided\n if (config.headers !== undefined) {\n const headers = toRecordHeaders(config.headers)\n request = HttpClientRequest.setHeaders(request, headers)\n }\n\n // Add body if provided\n if (config.body !== undefined) {\n const bodyText = typeof config.body === \"string\" ? config.body : JSON.stringify(config.body)\n request = HttpClientRequest.setBody(request, HttpBody.text(bodyText))\n }\n\n return request\n}\n\n/**\n * Convert Headers to Record<string, string>\n *\n * @pure true\n */\nconst toRecordHeaders = (headers: HeadersInit): Record<string, string> => {\n if (headers instanceof Headers) {\n const result: Record<string, string> = {}\n for (const [key, value] of headers.entries()) {\n result[key] = value\n }\n return result\n }\n if (Array.isArray(headers)) {\n const result: Record<string, string> = {}\n for (const headerPair of headers) {\n const [headerKey, headerValue] = headerPair\n result[headerKey] = headerValue\n }\n return result\n }\n return headers\n}\n\n/**\n * Convert @effect/platform Headers to native Headers\n *\n * @pure true\n */\nconst toNativeHeaders = (platformHeaders: { readonly [key: string]: string }): Headers => {\n const headers = new Headers()\n for (const [key, value] of Object.entries(platformHeaders)) {\n headers.set(key, value)\n }\n return headers\n}\n\n/**\n * Helper to create dispatcher from switch-based classifier\n *\n * This function uses a permissive type signature to allow generated code\n * to work with any response variant without requiring exact type matching.\n * The classify function can return any Effect with union types for success/error.\n *\n * NOTE: Uses axioms module for type casts to allow heterogeneous Effect\n * unions from switch statements. The returned Dispatcher is properly typed.\n *\n * @pure true - returns pure function\n * @complexity O(1)\n */\n\nexport const createDispatcher = <Responses>(\n classify: ClassifyFn\n): Dispatcher<Responses> => {\n return asDispatcher<Responses>((response: RawResponse) => {\n const contentType = response.headers.get(\"content-type\") ?? undefined\n return classify(response.status, contentType, response.text)\n })\n}\n\n/**\n * Helper to parse JSON with error handling\n *\n * @pure false - performs parsing\n * @effect Effect<Json, ParseError, never>\n */\nexport const parseJSON = (\n status: number,\n contentType: string,\n text: string\n): Effect.Effect<Json, ParseError> =>\n Effect.try({\n try: () => asJson(JSON.parse(text)),\n catch: (error): ParseError => ({\n _tag: \"ParseError\",\n status,\n contentType,\n error: error instanceof Error ? error : new Error(String(error)),\n body: text\n })\n })\n\n/**\n * Helper to create UnexpectedStatus error\n *\n * @pure true\n */\nexport const unexpectedStatus = (status: number, body: string): UnexpectedStatus => ({\n _tag: \"UnexpectedStatus\",\n status,\n body\n})\n\n/**\n * Helper to create UnexpectedContentType error\n *\n * @pure true\n */\nexport const unexpectedContentType = (\n status: number,\n expected: ReadonlyArray<string>,\n actual: string | undefined,\n body: string\n): UnexpectedContentType => ({\n _tag: \"UnexpectedContentType\",\n status,\n expected,\n actual,\n body\n})\n\n/**\n * Generic client interface for any OpenAPI schema with Effect-native error handling\n *\n * **Effect Channel Design:**\n * - Success channel: `ApiSuccess<Op>` - 2xx responses\n * - Error channel: `ApiFailure<Op>` - HTTP errors (4xx, 5xx) + boundary errors\n *\n * @pure false - performs HTTP requests\n * @effect Effect<ApiSuccess<Op>, ApiFailure<Op>, HttpClient.HttpClient>\n */\nexport type StrictClient<Paths extends object> = {\n readonly GET: <Path extends keyof Paths>(\n path: Path,\n options: RequestOptions<Paths, Path, \"get\">\n ) => Effect.Effect<\n ApiSuccess<ResponsesFor<OperationFor<Paths, Path, \"get\">>>,\n ApiFailure<ResponsesFor<OperationFor<Paths, Path, \"get\">>>,\n HttpClient.HttpClient\n >\n\n readonly POST: <Path extends keyof Paths>(\n path: Path,\n options: RequestOptions<Paths, Path, \"post\">\n ) => Effect.Effect<\n ApiSuccess<ResponsesFor<OperationFor<Paths, Path, \"post\">>>,\n ApiFailure<ResponsesFor<OperationFor<Paths, Path, \"post\">>>,\n HttpClient.HttpClient\n >\n\n readonly PUT: <Path extends keyof Paths>(\n path: Path,\n options: RequestOptions<Paths, Path, \"put\">\n ) => Effect.Effect<\n ApiSuccess<ResponsesFor<OperationFor<Paths, Path, \"put\">>>,\n ApiFailure<ResponsesFor<OperationFor<Paths, Path, \"put\">>>,\n HttpClient.HttpClient\n >\n\n readonly PATCH: <Path extends keyof Paths>(\n path: Path,\n options: RequestOptions<Paths, Path, \"patch\">\n ) => Effect.Effect<\n ApiSuccess<ResponsesFor<OperationFor<Paths, Path, \"patch\">>>,\n ApiFailure<ResponsesFor<OperationFor<Paths, Path, \"patch\">>>,\n HttpClient.HttpClient\n >\n\n readonly DELETE: <Path extends keyof Paths>(\n path: Path,\n options: RequestOptions<Paths, Path, \"delete\">\n ) => Effect.Effect<\n ApiSuccess<ResponsesFor<OperationFor<Paths, Path, \"delete\">>>,\n ApiFailure<ResponsesFor<OperationFor<Paths, Path, \"delete\">>>,\n HttpClient.HttpClient\n >\n}\n\n/**\n * Request options for a specific operation\n */\nexport type RequestOptions<\n Paths extends object,\n Path extends keyof Paths,\n Method extends HttpMethod\n> = {\n readonly dispatcher: Dispatcher<ResponsesFor<OperationFor<Paths, Path, Method>>>\n readonly baseUrl: string\n readonly params?: Record<string, string | number>\n readonly query?: Record<string, string | number>\n readonly headers?: HeadersInit\n readonly body?: BodyInit\n readonly signal?: AbortSignal\n}\n\n/**\n * Create a strict client for an OpenAPI schema\n *\n * @pure true - returns pure client object\n * @complexity O(1)\n */\nexport const createStrictClient = <Paths extends object>(): StrictClient<\n Paths\n> => {\n const makeRequest = <Path extends keyof Paths, Method extends HttpMethod>(\n method: Method,\n path: Path,\n options: RequestOptions<Paths, Path, Method>\n ) => {\n let url = `${options.baseUrl}${String(path)}`\n\n // Replace path parameters\n if (options.params !== undefined) {\n for (const [key, value] of Object.entries(options.params)) {\n url = url.replace(`{${key}}`, encodeURIComponent(String(value)))\n }\n }\n\n // Add query parameters\n if (options.query !== undefined) {\n const params = new URLSearchParams()\n for (const [key, value] of Object.entries(options.query)) {\n params.append(key, String(value))\n }\n url = `${url}?${params.toString()}`\n }\n\n // Build config object, only including optional properties if they are defined\n // This satisfies exactOptionalPropertyTypes constraint\n const config = asStrictRequestInit<StrictRequestInit<ResponsesFor<OperationFor<Paths, Path, Method>>>>({\n method,\n url,\n dispatcher: options.dispatcher,\n ...(options.headers !== undefined && { headers: options.headers }),\n ...(options.body !== undefined && { body: options.body }),\n ...(options.signal !== undefined && { signal: options.signal })\n })\n\n return executeRequest(config)\n }\n\n return {\n GET: (path, options) => makeRequest(\"get\", path, options),\n POST: (path, options) => makeRequest(\"post\", path, options),\n PUT: (path, options) => makeRequest(\"put\", path, options),\n PATCH: (path, options) => makeRequest(\"patch\", path, options),\n DELETE: (path, options) => makeRequest(\"delete\", path, options)\n } satisfies StrictClient<Paths>\n}\n\n// CHANGE: Add universal dispatcher that handles any OpenAPI responses generically\n// WHY: Enable createClient<Paths>(options) without code generation or manual dispatcher wiring\n// QUOTE(ТЗ): \"Я не хочу создавать какие-то дополнительные модули\"\n// REF: issue-5\n// SOURCE: n/a\n// FORMAT THEOREM: ∀ status, ct: universalDispatcher(status, ct, text) → success(2xx) ∨ httpError(non-2xx) ∨ boundaryError\n// PURITY: SHELL\n// EFFECT: Effect<ApiSuccess<Responses>, Exclude<ApiFailure<Responses>, TransportError>, never>\n// INVARIANT: 2xx → success channel, non-2xx → error channel, no-content → body: undefined\n// COMPLEXITY: O(1) per dispatch + O(|text|) for JSON parsing\n\n/**\n * Create a universal dispatcher that handles any OpenAPI response generically\n *\n * The universal dispatcher classifies responses by status code range:\n * - 2xx → success channel (ApiSuccess)\n * - non-2xx → error channel (HttpError)\n *\n * For JSON content types, it parses the body. For no-content responses (empty body),\n * it returns undefined body with contentType \"none\".\n *\n * This enables using createClient<Paths>(options) without generating\n * per-operation dispatchers, fulfilling the zero-boilerplate DSL requirement.\n *\n * @pure true - returns pure dispatcher function\n * @complexity O(1) creation + O(|body|) per dispatch\n */\nexport const createUniversalDispatcher = <Responses>(): Dispatcher<Responses> => {\n return asDispatcher<Responses>((response: RawResponse) => {\n const contentType = response.headers.get(\"content-type\") ?? undefined\n const is2xx = response.status >= 200 && response.status < 300\n\n // No-content response (empty body or 204)\n if (response.text === \"\" || response.status === 204) {\n const variant = {\n status: response.status,\n contentType: \"none\" as const,\n body: undefined\n } as const\n\n return is2xx\n ? Effect.succeed(variant)\n : Effect.fail({\n _tag: \"HttpError\" as const,\n ...variant\n })\n }\n\n // JSON content type\n if (contentType?.includes(\"application/json\")) {\n return Effect.gen(function*() {\n const parsed = yield* parseJSON(response.status, \"application/json\", response.text)\n const variant = {\n status: response.status,\n contentType: \"application/json\" as const,\n body: parsed\n } as const\n\n if (is2xx) {\n return variant\n }\n return yield* Effect.fail({\n _tag: \"HttpError\" as const,\n ...variant\n })\n })\n }\n\n // Unknown content type\n return Effect.fail(unexpectedContentType(\n response.status,\n [\"application/json\"],\n contentType,\n response.text\n ))\n })\n}\n\nexport { type Dispatcher, type RawResponse } from \"../../core/axioms.js\"\n","// CHANGE: Type-safe createClient API with full request-side enforcement\n// WHY: Ensure path/method → operation → request types are all linked\n// QUOTE(ТЗ): \"path + method определяют operation, и из неё выводятся request/response types\"\n// REF: PR#3 blocking review sections 3.2, 3.3\n// SOURCE: n/a\n// PURITY: SHELL\n// EFFECT: Creates Effect-based API client\n// INVARIANT: All operations are type-safe from path → operation → request → response\n// COMPLEXITY: O(1) client creation\n\nimport type * as HttpClient from \"@effect/platform/HttpClient\"\nimport { Effect } from \"effect\"\nimport type { HttpMethod } from \"openapi-typescript-helpers\"\n\nimport { asDispatchersFor, asStrictApiClient, asStrictRequestInit, type Dispatcher } from \"../../core/axioms.js\"\nimport type {\n ClientEffect,\n ClientOptions,\n DispatchersFor,\n DispatchersForMethod,\n StrictApiClientWithDispatchers\n} from \"./create-client-types.js\"\nimport type { StrictRequestInit } from \"./strict-client.js\"\nimport { createUniversalDispatcher, executeRequest } from \"./strict-client.js\"\n\nexport type {\n ClientEffect,\n ClientOptions,\n DispatchersFor,\n StrictApiClient,\n StrictApiClientWithDispatchers\n} from \"./create-client-types.js\"\nexport { createUniversalDispatcher } from \"./strict-client.js\"\n\n/**\n * Primitive value type for path/query parameters\n *\n * @pure true - type alias only\n */\ntype ParamValue = string | number | boolean\n\n/**\n * Query parameter value - can be primitive or array of primitives\n *\n * @pure true - type alias only\n */\ntype QueryValue = ParamValue | ReadonlyArray<ParamValue>\n\n// CHANGE: Add default dispatcher registry for auto-dispatching createClient\n// WHY: Allow createClient(options) without explicitly passing dispatcher map\n// QUOTE(ТЗ): \"const apiClient = createClient<Paths>(clientOptions)\"\n// REF: user-msg-4\n// SOURCE: n/a\n// FORMAT THEOREM: ∀ call: defaultDispatchers = dispatchersByPath ⇒ createClient uses dispatcher(path, method)\n// PURITY: SHELL\n// EFFECT: none\n// INVARIANT: defaultDispatchers is set before createClient use\n// COMPLEXITY: O(1)\nlet defaultDispatchers: DispatchersFor<object> | undefined\n\n/**\n * Register default dispatcher map used by createClient(options)\n *\n * @pure false - mutates module-level registry\n * @invariant defaultDispatchers set exactly once per app boot\n */\nexport const registerDefaultDispatchers = <Paths extends object>(\n dispatchers: DispatchersFor<Paths>\n): void => {\n defaultDispatchers = dispatchers\n}\n\n/**\n * Resolve default dispatcher map or fail fast\n *\n * @pure false - reads module-level registry\n * @invariant defaultDispatchers must be set for auto-dispatching client\n */\nconst resolveDefaultDispatchers = <Paths extends object>(): DispatchersFor<Paths> => {\n if (defaultDispatchers === undefined) {\n throw new Error(\"Default dispatchers are not registered. Import generated dispatchers module.\")\n }\n return asDispatchersFor<DispatchersFor<Paths>>(defaultDispatchers)\n}\n\nconst applyPathParams = (path: string, params?: Record<string, ParamValue>): string => {\n if (params === undefined) {\n return path\n }\n\n let url = path\n for (const [key, value] of Object.entries(params)) {\n url = url.replace(\"{\" + key + \"}\", encodeURIComponent(String(value)))\n }\n return url\n}\n\nconst buildQueryString = (query?: Record<string, QueryValue>): string => {\n if (query === undefined) {\n return \"\"\n }\n\n const searchParams = new URLSearchParams()\n for (const [key, value] of Object.entries(query)) {\n if (Array.isArray(value)) {\n for (const item of value) {\n searchParams.append(key, String(item))\n }\n continue\n }\n searchParams.set(key, String(value))\n }\n return searchParams.toString()\n}\n\nconst appendQueryString = (url: string, queryString: string): string => {\n if (queryString.length === 0) {\n return url\n }\n return url.includes(\"?\") ? url + \"&\" + queryString : url + \"?\" + queryString\n}\n\nconst withBaseUrl = (baseUrl: string | undefined, url: string): string => {\n // If baseUrl is not provided, keep a relative URL (browser-friendly)\n if (baseUrl === undefined || baseUrl === \"\") {\n return url\n }\n\n // Construct full URL\n return new URL(url, baseUrl).toString()\n}\n\n/**\n * Build URL with path parameters and query string\n *\n * @param baseUrl - Base URL for the API\n * @param path - Path template with placeholders\n * @param params - Path parameters to substitute\n * @param query - Query parameters to append\n * @returns Fully constructed URL\n *\n * @pure true\n * @complexity O(n + m) where n = |params|, m = |query|\n */\nconst buildUrl = (\n baseUrl: string | undefined,\n path: string,\n params?: Record<string, ParamValue>,\n query?: Record<string, QueryValue>\n): string => {\n const urlWithParams = applyPathParams(path, params)\n const queryString = buildQueryString(query)\n const urlWithQuery = appendQueryString(urlWithParams, queryString)\n return withBaseUrl(baseUrl, urlWithQuery)\n}\n\n/**\n * Check if body is already a BodyInit type (not a plain object needing serialization)\n *\n * @pure true\n */\nconst isBodyInit = (body: BodyInit | object): body is BodyInit =>\n typeof body === \"string\"\n || body instanceof Blob\n || body instanceof ArrayBuffer\n || body instanceof ReadableStream\n || body instanceof FormData\n || body instanceof URLSearchParams\n\n/**\n * Serialize body to BodyInit - passes through BodyInit types, JSON-stringifies objects\n *\n * @pure true\n * @returns BodyInit or undefined, with consistent return path\n */\nconst serializeBody = (body: BodyInit | object | undefined): BodyInit | undefined => {\n // Early return for undefined\n if (body === undefined) {\n return body\n }\n // Pass through existing BodyInit types\n if (isBodyInit(body)) {\n return body\n }\n // Plain object - serialize to JSON string (which is a valid BodyInit)\n const serialized: BodyInit = JSON.stringify(body)\n return serialized\n}\n\n/**\n * Check if body requires JSON Content-Type header\n *\n * @pure true\n */\nconst needsJsonContentType = (body: BodyInit | object | undefined): boolean =>\n body !== undefined\n && typeof body !== \"string\"\n && !(body instanceof Blob)\n && !(body instanceof FormData)\n\nconst toHeadersFromRecord = (\n headersInit: Record<\n string,\n | string\n | number\n | boolean\n | ReadonlyArray<string | number | boolean>\n | null\n | undefined\n >\n): Headers => {\n const headers = new Headers()\n\n for (const [key, value] of Object.entries(headersInit)) {\n if (value === null || value === undefined) {\n continue\n }\n if (Array.isArray(value)) {\n headers.set(key, value.map(String).join(\",\"))\n continue\n }\n headers.set(key, String(value))\n }\n\n return headers\n}\n\n/**\n * Merge headers from client options and request options\n *\n * @pure true\n * @complexity O(n) where n = number of headers\n */\nconst toHeaders = (headersInit: ClientOptions[\"headers\"] | undefined): Headers => {\n if (headersInit === undefined) {\n return new Headers()\n }\n\n if (headersInit instanceof Headers) {\n return new Headers(headersInit)\n }\n\n if (Array.isArray(headersInit)) {\n return new Headers(headersInit)\n }\n\n return toHeadersFromRecord(headersInit)\n}\n\nconst mergeHeaders = (\n clientHeaders: ClientOptions[\"headers\"] | undefined,\n requestHeaders: ClientOptions[\"headers\"] | undefined\n): Headers => {\n const headers = toHeaders(clientHeaders)\n const optHeaders = toHeaders(requestHeaders)\n for (const [key, value] of optHeaders.entries()) {\n headers.set(key, value)\n }\n return headers\n}\n\n/**\n * Request options type for method handlers\n *\n * @pure true - type alias only\n */\ntype MethodHandlerOptions = {\n params?: Record<string, ParamValue> | undefined\n query?: Record<string, QueryValue> | undefined\n body?: BodyInit | object | undefined\n headers?: ClientOptions[\"headers\"] | undefined\n signal?: AbortSignal | undefined\n}\n\n/**\n * Create HTTP method handler with full type constraints\n *\n * @param method - HTTP method\n * @param clientOptions - Client configuration\n * @returns Method handler function\n *\n * @pure false - creates function that performs HTTP requests\n * @complexity O(1) handler creation\n */\nconst createMethodHandler = (\n method: HttpMethod,\n clientOptions: ClientOptions\n) =>\n<Responses>(\n path: string,\n dispatcher: Dispatcher<Responses>,\n options?: MethodHandlerOptions\n) => {\n const url = buildUrl(clientOptions.baseUrl, path, options?.params, options?.query)\n const headers = mergeHeaders(clientOptions.headers, options?.headers)\n const body = serializeBody(options?.body)\n\n if (needsJsonContentType(options?.body)) {\n headers.set(\"Content-Type\", \"application/json\")\n }\n\n const config: StrictRequestInit<Responses> = asStrictRequestInit({\n method,\n url,\n dispatcher,\n headers,\n body,\n signal: options?.signal\n })\n\n return executeRequest(config)\n}\n\n/**\n * Create method handler that infers dispatcher from map\n *\n * @pure false - creates function that performs HTTP requests\n * @complexity O(1) handler creation\n */\nconst createMethodHandlerWithDispatchers = <Paths extends object, Method extends HttpMethod>(\n method: Method,\n clientOptions: ClientOptions,\n dispatchers: DispatchersForMethod<Paths, Method>\n) =>\n<Path extends keyof DispatchersForMethod<Paths, Method> & string>(\n path: Path,\n options?: MethodHandlerOptions\n) =>\n createMethodHandler(method, clientOptions)(\n path,\n dispatchers[path][method],\n options\n )\n\n// CHANGE: Create method handler that infers dispatcher from map\n// WHY: Allow per-call API without passing dispatcher parameter\n// QUOTE(ТЗ): \"Зачем передавать что либо в GET\"\n// REF: user-msg-1\n// SOURCE: n/a\n// FORMAT THEOREM: ∀ path ∈ PathsForMethod<Paths, method>: dispatchers[path][method] = Dispatcher<ResponsesFor<Op>>\n// PURITY: SHELL\n// EFFECT: Effect<ApiSuccess<Responses>, ApiFailure<Responses>, HttpClient>\n// INVARIANT: Dispatcher lookup is total for all operations in Paths\n// COMPLEXITY: O(1) runtime + O(1) dispatcher lookup\n/**\n * Create type-safe Effect-based API client\n *\n * The client enforces:\n * 1. Method availability: GET only on paths with `get`, POST only on paths with `post`\n * 2. Dispatcher correlation: must match operation's responses\n * 3. Request options: params/query/body typed from operation\n *\n * @typeParam Paths - OpenAPI paths type from openapi-typescript\n * @param options - Client configuration\n * @returns API client with typed methods for all operations\n *\n * @pure false - creates client that performs HTTP requests\n * @effect Client methods return Effect<Success, Failure, HttpClient>\n * @invariant ∀ path, method: path ∈ PathsForMethod<Paths, method>\n * @complexity O(1) client creation\n *\n * @example\n * ```typescript\n * import createClient from \"openapi-effect\"\n * import type { Paths } from \"./generated/schema\"\n * import \"./generated/dispatchers-by-path\" // registers default dispatchers\n *\n * const client = createClient<Paths>({\n * baseUrl: \"https://api.example.com\",\n * credentials: \"include\"\n * })\n *\n * // Type-safe call - dispatcher inferred from path+method\n * const result = yield* client.GET(\"/pets/{petId}\", {\n * params: { petId: \"123\" } // Required because getPet has path params\n * })\n *\n * // Compile error: \"/pets/{petId}\" has no \"put\" method\n * // client.PUT(\"/pets/{petId}\", ...) // Type error!\n * ```\n */\nexport const createClient = <Paths extends object>(\n options: ClientOptions,\n dispatchers?: DispatchersFor<Paths>\n): StrictApiClientWithDispatchers<Paths> => {\n const resolvedDispatchers = dispatchers ?? resolveDefaultDispatchers<Paths>()\n\n return asStrictApiClient<StrictApiClientWithDispatchers<Paths>>({\n GET: createMethodHandlerWithDispatchers(\"get\", options, resolvedDispatchers),\n POST: createMethodHandlerWithDispatchers(\"post\", options, resolvedDispatchers),\n PUT: createMethodHandlerWithDispatchers(\"put\", options, resolvedDispatchers),\n DELETE: createMethodHandlerWithDispatchers(\"delete\", options, resolvedDispatchers),\n PATCH: createMethodHandlerWithDispatchers(\"patch\", options, resolvedDispatchers),\n HEAD: createMethodHandlerWithDispatchers(\"head\", options, resolvedDispatchers),\n OPTIONS: createMethodHandlerWithDispatchers(\"options\", options, resolvedDispatchers)\n })\n}\n\n// CHANGE: Add createMethodHandlerWithUniversalDispatcher for zero-boilerplate client\n// WHY: Enable createClientEffect<Paths>(options) without code generation or dispatcher registry\n// QUOTE(ТЗ): \"Я не хочу создавать какие-то дополнительные модули\"\n// REF: issue-5\n// SOURCE: n/a\n// FORMAT THEOREM: ∀ path, method: universalDispatcher handles response classification generically\n// PURITY: SHELL\n// EFFECT: Effect<ApiSuccess<Responses>, ApiFailure<Responses>, HttpClient>\n// INVARIANT: 2xx → success channel, non-2xx → error channel\n// COMPLEXITY: O(1) handler creation + O(1) universal dispatcher creation per call\nconst createMethodHandlerWithUniversalDispatcher = (\n method: HttpMethod,\n clientOptions: ClientOptions\n) =>\n(\n path: string,\n options?: MethodHandlerOptions\n) =>\n createMethodHandler(method, clientOptions)(\n path,\n createUniversalDispatcher(),\n options\n )\n\ntype HttpErrorTag = { readonly _tag: \"HttpError\" }\n\nconst isHttpErrorValue = (error: unknown): error is HttpErrorTag =>\n typeof error === \"object\"\n && error !== null\n && \"_tag\" in error\n && Reflect.get(error, \"_tag\") === \"HttpError\"\n\nconst exposeHttpErrorsAsValues = <A, E>(\n request: Effect.Effect<A, E, HttpClient.HttpClient>\n): Effect.Effect<\n A | Extract<E, HttpErrorTag>,\n Exclude<E, Extract<E, HttpErrorTag>>,\n HttpClient.HttpClient\n> =>\n request.pipe(\n Effect.catchIf(\n (error): error is Extract<E, HttpErrorTag> => isHttpErrorValue(error),\n (error) => Effect.succeed(error)\n )\n )\n\nconst createMethodHandlerWithUniversalDispatcherValue = (\n method: HttpMethod,\n clientOptions: ClientOptions\n) =>\n(\n path: string,\n options?: MethodHandlerOptions\n) =>\n exposeHttpErrorsAsValues(\n createMethodHandlerWithUniversalDispatcher(method, clientOptions)(path, options)\n )\n\n// CHANGE: Add createClientEffect — zero-boilerplate Effect-based API client\n// WHY: Enable the user's desired DSL without any generated code or dispatcher setup\n// QUOTE(ТЗ): \"const apiClientEffect = createClientEffect<Paths>(clientOptions); apiClientEffect.POST('/api/auth/login', { body: credentials })\"\n// REF: issue-5\n// SOURCE: n/a\n// FORMAT THEOREM: ∀ Paths, options: createClientEffect<Paths>(options) → ClientEffect<Paths>\n// PURITY: SHELL\n// EFFECT: Client methods return Effect<ApiSuccess | HttpError, BoundaryError, HttpClient>\n// INVARIANT: ∀ path, method: path ∈ PathsForMethod<Paths, method> (compile-time) ∧ response classified by status range (runtime)\n// COMPLEXITY: O(1) client creation\n/**\n * Create type-safe Effect-based API client with zero boilerplate\n *\n * Uses a universal dispatcher and exposes HTTP statuses as values:\n * - 2xx → success value (ApiSuccess)\n * - non-2xx schema statuses → success value (HttpError with _tag)\n * - boundary/protocol failures stay in error channel\n * - JSON parsed automatically for application/json content types\n *\n * **No code generation needed.** No dispatcher registry needed.\n * Just pass your OpenAPI Paths type and client options.\n *\n * @typeParam Paths - OpenAPI paths type from openapi-typescript\n * @param options - Client configuration (baseUrl, credentials, headers, etc.)\n * @returns API client with typed methods for all operations\n *\n * @pure false - creates client that performs HTTP requests\n * @effect Client methods return Effect<Success, Failure, HttpClient>\n * @invariant ∀ path, method: path ∈ PathsForMethod<Paths, method>\n * @complexity O(1) client creation\n *\n * @example\n * ```typescript\n * import { createClientEffect, type ClientOptions } from \"openapi-effect\"\n * import type { paths } from \"./openapi.d.ts\"\n *\n * const clientOptions: ClientOptions = {\n * baseUrl: \"https://petstore.example.com\",\n * credentials: \"include\"\n * }\n * const apiClientEffect = createClientEffect<paths>(clientOptions)\n *\n * // Type-safe call — path, method, and body all enforced at compile time\n * const result = yield* apiClientEffect.POST(\"/api/auth/login\", {\n * body: { email: \"user@example.com\", password: \"secret\" }\n * })\n * ```\n */\nexport const createClientEffect = <Paths extends object>(\n options: ClientOptions\n): ClientEffect<Paths> => {\n return asStrictApiClient<ClientEffect<Paths>>({\n GET: createMethodHandlerWithUniversalDispatcherValue(\"get\", options),\n POST: createMethodHandlerWithUniversalDispatcherValue(\"post\", options),\n PUT: createMethodHandlerWithUniversalDispatcherValue(\"put\", options),\n DELETE: createMethodHandlerWithUniversalDispatcherValue(\"delete\", options),\n PATCH: createMethodHandlerWithUniversalDispatcherValue(\"patch\", options),\n HEAD: createMethodHandlerWithUniversalDispatcherValue(\"head\", options),\n OPTIONS: createMethodHandlerWithUniversalDispatcherValue(\"options\", options)\n })\n}\n","// CHANGE: Auto-generated decoder stubs for all operations\n// WHY: Provide type-safe runtime validation entry points\n// QUOTE(ТЗ): \"при изменении схемы сборка обязана падать, пока декодеры не обновлены\"\n// REF: issue-2, section 5.2\n// SOURCE: Generated from tests/fixtures/petstore.openapi.json\n// FORMAT THEOREM: ∀ op, status: decoder(op, status) → Effect<T, DecodeError, never>\n// PURITY: SHELL\n// EFFECT: Effect<T, DecodeError, never>\n// INVARIANT: All decoders return typed DecodeError on failure\n// COMPLEXITY: O(n) where n = size of parsed object\n\nimport { Effect } from \"effect\"\nimport type { DecodeError } from \"../core/api-client/strict-types.js\"\n\n/**\n * JSON value type - result of JSON.parse()\n */\ntype Json = null | boolean | number | string | ReadonlyArray<Json> | { readonly [k: string]: Json }\n\n/**\n * Decoder for listPets status 200 (application/json)\n * STUB: Replace with real schema decoder when needed\n *\n * @pure false - performs validation\n * @effect Effect<T, DecodeError, never>\n */\nexport const decodelistPets_200 = (\n _status: number,\n _contentType: string,\n _body: string,\n parsed: Json\n): Effect.Effect<Json, DecodeError> => {\n // STUB: Always succeeds with parsed value\n // Replace with: Schema.decodeUnknown(YourSchema)(parsed)\n return Effect.succeed(parsed)\n\n // Example of real decoder:\n // return Effect.mapError(\n // Schema.decodeUnknown(YourSchema)(parsed),\n // (error): DecodeError => ({\n // _tag: \"DecodeError\",\n // status,\n // contentType,\n // error,\n // body\n // })\n // )\n}\n\n/**\n * Decoder for listPets status 500 (application/json)\n * STUB: Replace with real schema decoder when needed\n *\n * @pure false - performs validation\n * @effect Effect<T, DecodeError, never>\n */\nexport const decodelistPets_500 = (\n _status: number,\n _contentType: string,\n _body: string,\n parsed: Json\n): Effect.Effect<Json, DecodeError> => {\n // STUB: Always succeeds with parsed value\n // Replace with: Schema.decodeUnknown(YourSchema)(parsed)\n return Effect.succeed(parsed)\n\n // Example of real decoder:\n // return Effect.mapError(\n // Schema.decodeUnknown(YourSchema)(parsed),\n // (error): DecodeError => ({\n // _tag: \"DecodeError\",\n // status,\n // contentType,\n // error,\n // body\n // })\n // )\n}\n\n/**\n * Decoder for createPet status 201 (application/json)\n * STUB: Replace with real schema decoder when needed\n *\n * @pure false - performs validation\n * @effect Effect<T, DecodeError, never>\n */\nexport const decodecreatePet_201 = (\n _status: number,\n _contentType: string,\n _body: string,\n parsed: Json\n): Effect.Effect<Json, DecodeError> => {\n // STUB: Always succeeds with parsed value\n // Replace with: Schema.decodeUnknown(YourSchema)(parsed)\n return Effect.succeed(parsed)\n\n // Example of real decoder:\n // return Effect.mapError(\n // Schema.decodeUnknown(YourSchema)(parsed),\n // (error): DecodeError => ({\n // _tag: \"DecodeError\",\n // status,\n // contentType,\n // error,\n // body\n // })\n // )\n}\n\n/**\n * Decoder for createPet status 400 (application/json)\n * STUB: Replace with real schema decoder when needed\n *\n * @pure false - performs validation\n * @effect Effect<T, DecodeError, never>\n */\nexport const decodecreatePet_400 = (\n _status: number,\n _contentType: string,\n _body: string,\n parsed: Json\n): Effect.Effect<Json, DecodeError> => {\n // STUB: Always succeeds with parsed value\n // Replace with: Schema.decodeUnknown(YourSchema)(parsed)\n return Effect.succeed(parsed)\n\n // Example of real decoder:\n // return Effect.mapError(\n // Schema.decodeUnknown(YourSchema)(parsed),\n // (error): DecodeError => ({\n // _tag: \"DecodeError\",\n // status,\n // contentType,\n // error,\n // body\n // })\n // )\n}\n\n/**\n * Decoder for createPet status 500 (application/json)\n * STUB: Replace with real schema decoder when needed\n *\n * @pure false - performs validation\n * @effect Effect<T, DecodeError, never>\n */\nexport const decodecreatePet_500 = (\n _status: number,\n _contentType: string,\n _body: string,\n parsed: Json\n): Effect.Effect<Json, DecodeError> => {\n // STUB: Always succeeds with parsed value\n // Replace with: Schema.decodeUnknown(YourSchema)(parsed)\n return Effect.succeed(parsed)\n\n // Example of real decoder:\n // return Effect.mapError(\n // Schema.decodeUnknown(YourSchema)(parsed),\n // (error): DecodeError => ({\n // _tag: \"DecodeError\",\n // status,\n // contentType,\n // error,\n // body\n // })\n // )\n}\n\n/**\n * Decoder for getPet status 200 (application/json)\n * STUB: Replace with real schema decoder when needed\n *\n * @pure false - performs validation\n * @effect Effect<T, DecodeError, never>\n */\nexport const decodegetPet_200 = (\n _status: number,\n _contentType: string,\n _body: string,\n parsed: Json\n): Effect.Effect<Json, DecodeError> => {\n // STUB: Always succeeds with parsed value\n // Replace with: Schema.decodeUnknown(YourSchema)(parsed)\n return Effect.succeed(parsed)\n\n // Example of real decoder:\n // return Effect.mapError(\n // Schema.decodeUnknown(YourSchema)(parsed),\n // (error): DecodeError => ({\n // _tag: \"DecodeError\",\n // status,\n // contentType,\n // error,\n // body\n // })\n // )\n}\n\n/**\n * Decoder for getPet status 404 (application/json)\n * STUB: Replace with real schema decoder when needed\n *\n * @pure false - performs validation\n * @effect Effect<T, DecodeError, never>\n */\nexport const decodegetPet_404 = (\n _status: number,\n _contentType: string,\n _body: string,\n parsed: Json\n): Effect.Effect<Json, DecodeError> => {\n // STUB: Always succeeds with parsed value\n // Replace with: Schema.decodeUnknown(YourSchema)(parsed)\n return Effect.succeed(parsed)\n\n // Example of real decoder:\n // return Effect.mapError(\n // Schema.decodeUnknown(YourSchema)(parsed),\n // (error): DecodeError => ({\n // _tag: \"DecodeError\",\n // status,\n // contentType,\n // error,\n // body\n // })\n // )\n}\n\n/**\n * Decoder for getPet status 500 (application/json)\n * STUB: Replace with real schema decoder when needed\n *\n * @pure false - performs validation\n * @effect Effect<T, DecodeError, never>\n */\nexport const decodegetPet_500 = (\n _status: number,\n _contentType: string,\n _body: string,\n parsed: Json\n): Effect.Effect<Json, DecodeError> => {\n // STUB: Always succeeds with parsed value\n // Replace with: Schema.decodeUnknown(YourSchema)(parsed)\n return Effect.succeed(parsed)\n\n // Example of real decoder:\n // return Effect.mapError(\n // Schema.decodeUnknown(YourSchema)(parsed),\n // (error): DecodeError => ({\n // _tag: \"DecodeError\",\n // status,\n // contentType,\n // error,\n // body\n // })\n // )\n}\n\n/**\n * Decoder for deletePet status 404 (application/json)\n * STUB: Replace with real schema decoder when needed\n *\n * @pure false - performs validation\n * @effect Effect<T, DecodeError, never>\n */\nexport const decodedeletePet_404 = (\n _status: number,\n _contentType: string,\n _body: string,\n parsed: Json\n): Effect.Effect<Json, DecodeError> => {\n // STUB: Always succeeds with parsed value\n // Replace with: Schema.decodeUnknown(YourSchema)(parsed)\n return Effect.succeed(parsed)\n\n // Example of real decoder:\n // return Effect.mapError(\n // Schema.decodeUnknown(YourSchema)(parsed),\n // (error): DecodeError => ({\n // _tag: \"DecodeError\",\n // status,\n // contentType,\n // error,\n // body\n // })\n // )\n}\n\n/**\n * Decoder for deletePet status 500 (application/json)\n * STUB: Replace with real schema decoder when needed\n *\n * @pure false - performs validation\n * @effect Effect<T, DecodeError, never>\n */\nexport const decodedeletePet_500 = (\n _status: number,\n _contentType: string,\n _body: string,\n parsed: Json\n): Effect.Effect<Json, DecodeError> => {\n // STUB: Always succeeds with parsed value\n // Replace with: Schema.decodeUnknown(YourSchema)(parsed)\n return Effect.succeed(parsed)\n\n // Example of real decoder:\n // return Effect.mapError(\n // Schema.decodeUnknown(YourSchema)(parsed),\n // (error): DecodeError => ({\n // _tag: \"DecodeError\",\n // status,\n // contentType,\n // error,\n // body\n // })\n // )\n}\n","// CHANGE: Auto-generated dispatchers for all operations with Effect-native error handling\n// WHY: Maintain compile-time correlation between status codes and body types\n// QUOTE(ТЗ): \"реализует switch(status) по всем статусам схемы; Failure включает все инварианты протокола и схемы\"\n// REF: issue-2, section 5.2, 4.1-4.3\n// SOURCE: Generated from tests/fixtures/petstore.openapi.json\n// FORMAT THEOREM: ∀ op ∈ Operations: dispatcher(op) → Effect<ApiSuccess, HttpError | BoundaryError>\n// PURITY: SHELL\n// EFFECT: Effect<ApiSuccess<Responses>, HttpError<Responses> | BoundaryError, never>\n// INVARIANT: 2xx → success channel, non-2xx → error channel (forced handling)\n// COMPLEXITY: O(1) per dispatch (Match lookup)\n\nimport { Effect, Match } from \"effect\"\nimport type { Operations } from \"../../tests/fixtures/petstore.openapi.js\"\nimport type { DecodeError, ResponsesFor } from \"../core/api-client/strict-types.js\"\nimport { asConst, type Json } from \"../core/axioms.js\"\nimport {\n createDispatcher,\n parseJSON,\n unexpectedContentType,\n unexpectedStatus\n} from \"../shell/api-client/strict-client.js\"\nimport * as Decoders from \"./decoders.js\"\n\n// Response types for each operation - used for type inference\ntype ListPetsResponses = ResponsesFor<Operations[\"listPets\"]>\ntype CreatePetResponses = ResponsesFor<Operations[\"createPet\"]>\ntype GetPetResponses = ResponsesFor<Operations[\"getPet\"]>\ntype DeletePetResponses = ResponsesFor<Operations[\"deletePet\"]>\n\n/**\n * Helper: process JSON content type for a given status - returns SUCCESS variant\n * Used for 2xx responses that go to the success channel\n */\nconst processJsonContentSuccess = <S extends number, D>(\n status: S,\n contentType: string | undefined,\n text: string,\n decoder: (\n s: number,\n ct: string,\n body: string,\n parsed: Json\n ) => Effect.Effect<D, DecodeError>\n) =>\n contentType?.includes(\"application/json\")\n ? Effect.gen(function*() {\n const parsed = yield* parseJSON(status, \"application/json\", text)\n const decoded = yield* decoder(status, \"application/json\", text, parsed)\n return asConst({\n status,\n contentType: \"application/json\" as const,\n body: decoded\n })\n })\n : Effect.fail(unexpectedContentType(status, [\"application/json\"], contentType, text))\n\n/**\n * Helper: process JSON content type for a given status - returns HTTP ERROR variant\n * Used for non-2xx responses (4xx, 5xx) that go to the error channel.\n *\n * Adds `_tag: \"HttpError\"` discriminator to distinguish from BoundaryError.\n */\nconst processJsonContentError = <S extends number, D>(\n status: S,\n contentType: string | undefined,\n text: string,\n decoder: (\n s: number,\n ct: string,\n body: string,\n parsed: Json\n ) => Effect.Effect<D, DecodeError>\n) =>\n contentType?.includes(\"application/json\")\n ? Effect.gen(function*() {\n const parsed = yield* parseJSON(status, \"application/json\", text)\n const decoded = yield* decoder(status, \"application/json\", text, parsed)\n // Non-2xx: Return as FAILURE with _tag discriminator (goes to error channel)\n return yield* Effect.fail(asConst({\n _tag: \"HttpError\" as const,\n status,\n contentType: \"application/json\" as const,\n body: decoded\n }))\n })\n : Effect.fail(unexpectedContentType(status, [\"application/json\"], contentType, text))\n\n/**\n * Dispatcher for listPets\n * Handles statuses: 200 (success), 500 (error)\n *\n * Effect channel mapping:\n * - 200: success channel → ApiSuccess\n * - 500: error channel → HttpError (forces explicit handling)\n *\n * @pure false - applies decoders\n * @invariant Exhaustive coverage of all schema statuses\n */\nexport const dispatcherlistPets = createDispatcher<ListPetsResponses>((status, contentType, text) =>\n Match.value(status).pipe(\n Match.when(200, () => processJsonContentSuccess(200, contentType, text, Decoders.decodelistPets_200)),\n Match.when(500, () => processJsonContentError(500, contentType, text, Decoders.decodelistPets_500)),\n Match.orElse(() => Effect.fail(unexpectedStatus(status, text)))\n )\n)\n\n/**\n * Dispatcher for createPet\n * Handles statuses: 201 (success), 400 (error), 500 (error)\n *\n * Effect channel mapping:\n * - 201: success channel → ApiSuccess\n * - 400, 500: error channel → HttpError (forces explicit handling)\n *\n * @pure false - applies decoders\n * @invariant Exhaustive coverage of all schema statuses\n */\nexport const dispatchercreatePet = createDispatcher<CreatePetResponses>((status, contentType, text) =>\n Match.value(status).pipe(\n Match.when(201, () => processJsonContentSuccess(201, contentType, text, Decoders.decodecreatePet_201)),\n Match.when(400, () => processJsonContentError(400, contentType, text, Decoders.decodecreatePet_400)),\n Match.when(500, () => processJsonContentError(500, contentType, text, Decoders.decodecreatePet_500)),\n Match.orElse(() => Effect.fail(unexpectedStatus(status, text)))\n )\n)\n\n/**\n * Dispatcher for getPet\n * Handles statuses: 200 (success), 404 (error), 500 (error)\n *\n * Effect channel mapping:\n * - 200: success channel → ApiSuccess\n * - 404, 500: error channel → HttpError (forces explicit handling)\n *\n * @pure false - applies decoders\n * @invariant Exhaustive coverage of all schema statuses\n */\nexport const dispatchergetPet = createDispatcher<GetPetResponses>((status, contentType, text) =>\n Match.value(status).pipe(\n Match.when(200, () => processJsonContentSuccess(200, contentType, text, Decoders.decodegetPet_200)),\n Match.when(404, () => processJsonContentError(404, contentType, text, Decoders.decodegetPet_404)),\n Match.when(500, () => processJsonContentError(500, contentType, text, Decoders.decodegetPet_500)),\n Match.orElse(() => Effect.fail(unexpectedStatus(status, text)))\n )\n)\n\n/**\n * Dispatcher for deletePet\n * Handles statuses: 204 (success), 404 (error), 500 (error)\n *\n * Effect channel mapping:\n * - 204: success channel → ApiSuccess (no content)\n * - 404, 500: error channel → HttpError (forces explicit handling)\n *\n * @pure false - applies decoders\n * @invariant Exhaustive coverage of all schema statuses\n */\nexport const dispatcherdeletePet = createDispatcher<DeletePetResponses>((status, contentType, text) =>\n Match.value(status).pipe(\n Match.when(204, () =>\n Effect.succeed(\n asConst({\n status: 204,\n contentType: \"none\" as const,\n body: undefined\n })\n )),\n Match.when(404, () => processJsonContentError(404, contentType, text, Decoders.decodedeletePet_404)),\n Match.when(500, () => processJsonContentError(500, contentType, text, Decoders.decodedeletePet_500)),\n Match.orElse(() => Effect.fail(unexpectedStatus(status, text)))\n )\n)\n","// CHANGE: Auto-generated dispatcher map by path+method\n// WHY: Provide a single dispatcher registry without manual wiring in examples\n// QUOTE(ТЗ): \"Этого в плане вообще не должно быть\"\n// REF: user-msg-3\n// SOURCE: Generated from tests/fixtures/petstore.openapi.json\n// FORMAT THEOREM: ∀ path, method: dispatchersByPath[path][method] = dispatcher(op)\n// PURITY: SHELL\n// EFFECT: none\n// INVARIANT: dispatcher map is total for all operations in Paths\n// COMPLEXITY: O(1)\n\nimport type { Paths } from \"../../tests/fixtures/petstore.openapi.js\"\nimport { type DispatchersFor, registerDefaultDispatchers } from \"../shell/api-client/create-client.js\"\nimport { dispatchercreatePet, dispatcherdeletePet, dispatchergetPet, dispatcherlistPets } from \"./dispatch.js\"\n\n/**\n * Dispatcher map keyed by OpenAPI path and HTTP method\n */\nexport const dispatchersByPath: DispatchersFor<Paths> = {\n \"/pets\": {\n get: dispatcherlistPets,\n post: dispatchercreatePet\n },\n \"/pets/{petId}\": {\n get: dispatchergetPet,\n delete: dispatcherdeletePet\n }\n}\n\n// CHANGE: Register default dispatchers at module load\n// WHY: Enable createClient(options) without passing dispatcher map\n// QUOTE(ТЗ): \"const apiClient = createClient<Paths>(clientOptions)\"\n// REF: user-msg-4\n// SOURCE: n/a\n// FORMAT THEOREM: ∀ call: createClient(options) uses dispatchersByPath\n// PURITY: SHELL\n// EFFECT: none\n// INVARIANT: registerDefaultDispatchers is called exactly once per module load\n// COMPLEXITY: O(1)\nregisterDefaultDispatchers(dispatchersByPath)\n"],"names":["assertNever","x","asJson","value","asConst","asRawResponse","asDispatcher","fn","asStrictRequestInit","config","asStrictApiClient","client","asDispatchersFor","executeRequest","Effect","HttpClient","request","buildRequest","rawResponse","response","text","toNativeHeaders","error","HttpClientRequest","headers","toRecordHeaders","bodyText","HttpBody","result","key","headerPair","headerKey","headerValue","platformHeaders","createDispatcher","classify","contentType","parseJSON","status","unexpectedStatus","body","unexpectedContentType","expected","actual","createStrictClient","makeRequest","method","path","options","url","params","createUniversalDispatcher","is2xx","variant","parsed","defaultDispatchers","registerDefaultDispatchers","dispatchers","resolveDefaultDispatchers","applyPathParams","buildQueryString","query","searchParams","item","appendQueryString","queryString","withBaseUrl","baseUrl","buildUrl","urlWithParams","urlWithQuery","isBodyInit","serializeBody","needsJsonContentType","toHeadersFromRecord","headersInit","toHeaders","mergeHeaders","clientHeaders","requestHeaders","optHeaders","createMethodHandler","clientOptions","dispatcher","createMethodHandlerWithDispatchers","createClient","resolvedDispatchers","createMethodHandlerWithUniversalDispatcher","isHttpErrorValue","exposeHttpErrorsAsValues","createMethodHandlerWithUniversalDispatcherValue","createClientEffect","decodelistPets_200","_status","_contentType","_body","decodelistPets_500","decodecreatePet_201","decodecreatePet_400","decodecreatePet_500","decodegetPet_200","decodegetPet_404","decodegetPet_500","decodedeletePet_404","decodedeletePet_500","processJsonContentSuccess","decoder","decoded","processJsonContentError","dispatcherlistPets","Match","Decoders.decodelistPets_200","Decoders.decodelistPets_500","dispatchercreatePet","Decoders.decodecreatePet_201","Decoders.decodecreatePet_400","Decoders.decodecreatePet_500","dispatchergetPet","Decoders.decodegetPet_200","Decoders.decodegetPet_404","Decoders.decodegetPet_500","dispatcherdeletePet","Decoders.decodedeletePet_404","Decoders.decodedeletePet_500","dispatchersByPath"],"mappings":"gUA0VO,MAAMA,GAAeC,GAAoB,CAC9C,MAAM,IAAI,MAAM,qBAAqB,KAAK,UAAUA,CAAC,CAAC,EAAE,CAC1D,EC9SaC,EAAUC,GAAyBA,EAQnCC,EAAcD,GAAgBA,EAc9BE,EAAiBF,GAIXA,EAuBNG,EACXC,GAC0BA,EAQfC,EAA0BC,GAAsBA,EA6BhDC,EAAwBC,GAAsBA,EAQ9CC,EAAuBT,GAAsBA,ECvD7CU,EACXJ,GAEAK,EAAO,IAAI,WAAY,CAErB,MAAMH,EAAS,MAAOI,EAAW,WAG3BC,EAAUC,EAA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lB,CAAI,CAAC,CAAC,CAAA,CAElE,ECzJawG,GAA2C,CACtD,QAAS,CACP,IAAKf,GACL,KAAMI,EAAA,EAER,gBAAiB,CACf,IAAKI,GACL,OAAQI,EAAA,CAEZ,EAYAjE,EAA2BoE,EAAiB"}
1
+ {"version":3,"file":"index.js","sources":["../src/core/api-client/strict-types.ts","../src/core/axioms.ts","../src/shell/api-client/strict-client.ts","../src/shell/api-client/create-client-response.ts","../src/shell/api-client/create-client-middleware.ts","../src/shell/api-client/openapi-compat-value-guards.ts","../src/shell/api-client/openapi-compat-serializers.ts","../src/shell/api-client/openapi-compat-path.ts","../src/shell/api-client/openapi-compat-request.ts","../src/shell/api-client/create-client-runtime-helpers.ts","../src/shell/api-client/create-client-runtime.ts","../src/shell/api-client/create-client.ts","../src/generated/decoders.ts","../src/generated/dispatch.ts","../src/generated/dispatchers-by-path.ts"],"sourcesContent":["// CHANGE: Define core type-level operations for extracting OpenAPI types\n// WHY: Enable compile-time type safety without runtime overhead through pure type transformations\n// QUOTE(ТЗ): \"Success / HttpError являются коррелированными суммами (status → точный тип body) строго из OpenAPI типов\"\n// REF: issue-2, section 3.1, 4.1-4.3\n// SOURCE: n/a\n// FORMAT THEOREM: ∀ Op ∈ Operations: ResponseVariant<Op> = Success<Op> ⊎ Failure<Op>\n// PURITY: CORE\n// INVARIANT: All types computed at compile time, no runtime operations\n// COMPLEXITY: O(1) compile-time / O(0) runtime\n\nimport type { HttpMethod, PathsWithMethod } from \"openapi-typescript-helpers\"\n\n/**\n * Extract all paths that support a given HTTP method\n *\n * @pure true - compile-time only\n * @invariant Result ⊆ paths\n */\nexport type PathsForMethod<\n Paths extends object,\n Method extends HttpMethod\n> = PathsWithMethod<Paths, Method>\n\n/**\n * Extract operation definition for a path and method\n *\n * @pure true - compile-time only\n * @invariant ∀ path ∈ Paths, method ∈ Methods: Operation<Paths, path, method> = Paths[path][method]\n */\nexport type OperationFor<\n Paths extends object,\n Path extends keyof Paths,\n Method extends HttpMethod\n> = Method extends keyof Paths[Path] ? Paths[Path][Method] : never\n\n/**\n * Extract all response definitions from an operation\n *\n * @pure true - compile-time only\n */\nexport type ResponsesFor<Op> = Op extends { responses: infer R } ? R : never\n\n// ============================================================================\n// Request-side typing (path/method → params/query/body)\n// ============================================================================\n\n/**\n * Extract path parameters from operation\n *\n * @pure true - compile-time only\n * @invariant Returns path params type or undefined if none\n */\nexport type PathParamsFor<Op> = Op extends { parameters: { path: infer P } }\n ? P extends Record<string, infer V> ? Record<string, V>\n : never\n : undefined\n\n/**\n * Extract query parameters from operation\n *\n * @pure true - compile-time only\n * @invariant Returns query params type or undefined if none\n */\nexport type QueryParamsFor<Op> = Op extends { parameters: { query?: infer Q } } ? Q\n : undefined\n\n/**\n * Extract request body type from operation\n *\n * @pure true - compile-time only\n * @invariant Returns body type or undefined if no requestBody\n */\nexport type RequestBodyFor<Op> = Op extends { requestBody: { content: infer C } }\n ? C extends { \"application/json\": infer J } ? J\n : C extends { [key: string]: infer V } ? V\n : never\n : undefined\n\n/**\n * Check if path params are required\n *\n * @pure true - compile-time only\n */\n\nexport type HasRequiredPathParams<Op> = Op extends { parameters: { path: infer P } }\n ? P extends Record<PropertyKey, string | number | boolean> ? keyof P extends never ? false : true\n : false\n : false\n\n/**\n * Check if request body is required\n *\n * @pure true - compile-time only\n */\nexport type HasRequiredBody<Op> = Op extends { requestBody: infer RB } ? RB extends { content: object } ? true\n : false\n : false\n\n/**\n * Build request options type from operation with all constraints\n * - params: required if path has required parameters\n * - query: optional, typed from operation\n * - body: required if operation has requestBody (accepts typed object OR string)\n *\n * For request body:\n * - Users can pass either the typed object (preferred, for type safety)\n * - Or a pre-stringified JSON string with headers (for backwards compatibility)\n *\n * @pure true - compile-time only\n * @invariant Options type is fully derived from operation definition\n */\nexport type RequestOptionsFor<Op> =\n & (HasRequiredPathParams<Op> extends true ? { readonly params: PathParamsFor<Op> }\n : { readonly params?: PathParamsFor<Op> })\n & (HasRequiredBody<Op> extends true ? { readonly body: RequestBodyFor<Op> | BodyInit }\n : { readonly body?: RequestBodyFor<Op> | BodyInit })\n & { readonly query?: QueryParamsFor<Op> }\n & { readonly headers?: HeadersInit }\n & { readonly signal?: AbortSignal }\n\n/**\n * Extract status codes from responses\n *\n * @pure true - compile-time only\n * @invariant Result = { s | s ∈ keys(Responses) }\n */\nexport type StatusCodes<Responses> = keyof Responses & (number | string)\n\n/**\n * Extract content types for a specific status code\n *\n * @pure true - compile-time only\n */\nexport type ContentTypesFor<\n Responses,\n Status extends StatusCodes<Responses>\n> = Status extends keyof Responses ? Responses[Status] extends { content: infer C } ? keyof C & string\n : \"none\"\n : never\n\n/**\n * Extract body type for a specific status and content-type\n *\n * @pure true - compile-time only\n * @invariant Strict correlation: Body type depends on both status and content-type\n */\nexport type BodyFor<\n Responses,\n Status extends StatusCodes<Responses>,\n ContentType extends ContentTypesFor<Responses, Status>\n> = Status extends keyof Responses\n ? Responses[Status] extends { content: infer C } ? ContentType extends keyof C ? C[ContentType]\n : never\n : ContentType extends \"none\" ? undefined\n : never\n : never\n\n/**\n * Build a correlated success response variant (status + contentType + body)\n * Used for 2xx responses that go to the success channel.\n *\n * @pure true - compile-time only\n * @invariant ∀ variant: variant.body = BodyFor<Responses, variant.status, variant.contentType>\n */\nexport type ResponseVariant<\n Responses,\n Status extends StatusCodes<Responses>,\n ContentType extends ContentTypesFor<Responses, Status>\n> = {\n readonly status: Status\n readonly contentType: ContentType\n readonly body: BodyFor<Responses, Status, ContentType>\n}\n\n/**\n * Build a correlated HTTP error response variant (status + contentType + body + _tag)\n * Used for non-2xx responses (4xx, 5xx) that go to the error channel.\n *\n * The `_tag: \"HttpError\"` discriminator allows distinguishing HTTP errors from BoundaryErrors.\n *\n * @pure true - compile-time only\n * @invariant ∀ variant: variant.body = BodyFor<Responses, variant.status, variant.contentType>\n */\nexport type HttpErrorResponseVariant<\n Responses,\n Status extends StatusCodes<Responses>,\n ContentType extends ContentTypesFor<Responses, Status>\n> = {\n readonly _tag: \"HttpError\"\n readonly status: Status\n readonly contentType: ContentType\n readonly body: BodyFor<Responses, Status, ContentType>\n}\n\n/**\n * Build all response variants for given responses\n *\n * @pure true - compile-time only\n */\ntype AllResponseVariants<Responses> = StatusCodes<Responses> extends infer Status\n ? Status extends StatusCodes<Responses>\n ? ContentTypesFor<Responses, Status> extends infer CT\n ? CT extends ContentTypesFor<Responses, Status> ? ResponseVariant<Responses, Status, CT>\n : never\n : never\n : never\n : never\n\n/**\n * Generic 2xx status detection without hardcoding\n * Uses template literal type to check if status string starts with \"2\"\n *\n * Works with any 2xx status including non-standard ones like 250.\n *\n * @pure true - compile-time only\n * @invariant Is2xx<S> = true ⟺ 200 ≤ S < 300\n */\nexport type Is2xx<S extends string | number> = `${S}` extends `2${string}` ? true : false\n\n/**\n * Filter response variants to success statuses (2xx)\n * Uses generic Is2xx instead of hardcoded status list.\n *\n * @pure true - compile-time only\n * @invariant ∀ v ∈ SuccessVariants: Is2xx<v.status> = true\n */\nexport type SuccessVariants<Responses> = AllResponseVariants<Responses> extends infer V\n ? V extends ResponseVariant<Responses, infer S, infer CT> ? Is2xx<S> extends true ? ResponseVariant<Responses, S, CT>\n : never\n : never\n : never\n\n/**\n * Filter response variants to error statuses (non-2xx from schema)\n * Returns HttpErrorResponseVariant with `_tag: \"HttpError\"` for discrimination.\n * Uses generic Is2xx instead of hardcoded status list.\n *\n * @pure true - compile-time only\n * @invariant ∀ v ∈ HttpErrorVariants: Is2xx<v.status> = false ∧ v.status ∈ Schema ∧ v._tag = \"HttpError\"\n */\nexport type HttpErrorVariants<Responses> = AllResponseVariants<Responses> extends infer V\n ? V extends ResponseVariant<Responses, infer S, infer CT> ? Is2xx<S> extends true ? never\n : HttpErrorResponseVariant<Responses, S, CT>\n : never\n : never\n\n/**\n * Boundary errors - always present regardless of schema\n *\n * @pure true - compile-time only\n * @invariant These errors represent protocol/parsing failures, not business logic\n */\nexport type TransportError = {\n readonly _tag: \"TransportError\"\n readonly error: Error\n}\n\nexport type UnexpectedStatus = {\n readonly _tag: \"UnexpectedStatus\"\n readonly status: number\n readonly body: string\n}\n\nexport type UnexpectedContentType = {\n readonly _tag: \"UnexpectedContentType\"\n readonly status: number\n readonly expected: ReadonlyArray<string>\n readonly actual: string | undefined\n readonly body: string\n}\n\nexport type ParseError = {\n readonly _tag: \"ParseError\"\n readonly status: number\n readonly contentType: string\n readonly error: Error\n readonly body: string\n}\n\nexport type DecodeError = {\n readonly _tag: \"DecodeError\"\n readonly status: number\n readonly contentType: string\n readonly error: Error\n readonly body: string\n}\n\nexport type BoundaryError =\n | TransportError\n | UnexpectedStatus\n | UnexpectedContentType\n | ParseError\n | DecodeError\n\n/**\n * Success type for an operation (2xx statuses only)\n *\n * Goes to the **success channel** of Effect.\n * Developers receive this directly without needing to handle errors.\n *\n * @pure true - compile-time only\n * @invariant ∀ v ∈ ApiSuccess: v.status ∈ [200..299]\n */\nexport type ApiSuccess<Responses> = SuccessVariants<Responses>\n\n/**\n * HTTP error responses from schema (non-2xx statuses like 400, 404, 500)\n *\n * Goes to the **error channel** of Effect, forcing explicit handling.\n * These are business-level errors defined in the OpenAPI schema.\n *\n * @pure true - compile-time only\n * @invariant ∀ v ∈ HttpError: v.status ∉ [200..299] ∧ v.status ∈ Schema\n */\nexport type HttpError<Responses> = HttpErrorVariants<Responses>\n\n/**\n * Complete failure type for API operations\n *\n * Includes both schema-defined HTTP errors (4xx, 5xx) and boundary errors.\n * All failures go to the **error channel** of Effect, forcing explicit handling.\n *\n * @pure true - compile-time only\n * @invariant ApiFailure = HttpError ⊎ BoundaryError\n *\n * BREAKING CHANGE: Previously, HTTP errors (404, 500) were in success channel.\n * Now they are in error channel, requiring explicit handling with Effect.catchTag\n * or Effect.match pattern.\n */\nexport type ApiFailure<Responses> = HttpError<Responses> | BoundaryError\n\n/**\n * @deprecated Use ApiSuccess<Responses> for success channel\n * and ApiFailure<Responses> for error channel instead.\n *\n * ApiResponse mixed success and error statuses in one type.\n * New API separates them into proper Effect channels.\n */\nexport type ApiResponse<Responses> = SuccessVariants<Responses> | HttpErrorVariants<Responses>\n\n/**\n * Helper to ensure exhaustive pattern matching\n *\n * @pure true\n * @throws Compile-time error if called with non-never type\n */\nexport const assertNever = (x: never): never => {\n throw new Error(`Unexpected value: ${JSON.stringify(x)}`)\n}\n","// CHANGE: Create axioms module for type-safe cast operations\n// WHY: Centralize all type assertions in a single auditable location per CLAUDE.md\n// QUOTE(ТЗ): \"as: запрещён в обычном коде; допускается ТОЛЬКО в одном аксиоматическом модуле\"\n// REF: issue-2, section 3.1\n// SOURCE: n/a\n// FORMAT THEOREM: ∀ cast ∈ Axioms: cast(x) → typed(x) ∨ runtime_validated(x)\n// PURITY: CORE\n// EFFECT: none - pure type-level operations\n// INVARIANT: All casts auditable in single file\n// COMPLEXITY: O(1)\n\n/**\n * JSON value type - result of JSON.parse()\n * This is the fundamental type for all parsed JSON values\n */\n/**\n * Cast function for dispatcher factory\n * AXIOM: Dispatcher factory receives valid classify function\n *\n * This enables generated dispatchers to work with heterogeneous Effect unions.\n * The cast is safe because:\n * 1. The classify function is generated from OpenAPI schema\n * 2. All status/content-type combinations are exhaustively covered\n * 3. The returned Effect conforms to Dispatcher signature\n *\n * @pure true\n */\nimport type { Effect } from \"effect\"\nimport type { ApiFailure, ApiSuccess, TransportError } from \"./api-client/strict-types.js\"\n\nexport type Json =\n | null\n | boolean\n | number\n | string\n | ReadonlyArray<Json>\n | { readonly [k: string]: Json }\n\n/**\n * Cast parsed JSON value to typed Json\n * AXIOM: JSON.parse returns a valid Json value\n *\n * @precondition value is result of JSON.parse on valid JSON string\n * @postcondition result conforms to Json type\n * @pure true\n */\nexport const asJson = (value: unknown): Json => value as Json\n\n/**\n * Cast a value to a specific type with const assertion\n * Used for creating literal typed objects in generated code\n *\n * @pure true\n */\nexport const asConst = <T>(value: T): T => value\n\n/**\n * Create a typed RawResponse from raw values\n * AXIOM: HTTP response structure is known at runtime\n *\n * @pure true\n */\nexport type RawResponse = {\n readonly status: number\n readonly headers: Headers\n readonly text: string\n}\n\nexport const asRawResponse = (value: {\n status: number\n headers: Headers\n text: string\n}): RawResponse => value as RawResponse\n\n/**\n * Dispatcher classifies response and applies decoder\n *\n * NEW DESIGN (Effect-native):\n * - Success channel: `ApiSuccess<Responses>` (2xx responses only)\n * - Error channel: `ApiFailure<Responses>` (non-2xx schema errors + boundary errors)\n *\n * This forces developers to explicitly handle HTTP errors (404, 500, etc.)\n * using Effect.catchTag, Effect.match, or similar patterns.\n *\n * @pure false - applies decoders\n * @effect Effect<ApiSuccess, HttpError | BoundaryError, never>\n * @invariant Must handle all statuses and content-types from schema\n */\nexport type Dispatcher<Responses> = (\n response: RawResponse\n) => Effect.Effect<\n ApiSuccess<Responses>,\n Exclude<ApiFailure<Responses>, TransportError>\n>\n\nexport const asDispatcher = <Responses>(\n fn: (response: RawResponse) => Effect.Effect<unknown, unknown>\n): Dispatcher<Responses> => fn as Dispatcher<Responses>\n\n/**\n * Cast for StrictRequestInit config object\n * AXIOM: Config object has correct structure when all properties assigned\n *\n * @pure true\n */\nexport const asStrictRequestInit = <T>(config: object): T => config as T\n\n/**\n * Classifier function type for dispatcher creation\n * AXIOM: Classify function returns Effect with heterogeneous union types\n *\n * This type uses `unknown` to allow the classify function to return\n * heterogeneous Effect unions from switch statements. The actual types\n * are enforced by the generated dispatcher code.\n *\n * @pure true\n */\nexport type ClassifyFn = (\n status: number,\n contentType: string | undefined,\n text: string\n) => Effect.Effect<unknown, unknown>\n\n/**\n * Cast internal client implementation to typed StrictApiClient\n * AXIOM: Client implementation correctly implements all method constraints\n *\n * This cast is safe because:\n * 1. StrictApiClient type enforces path/method constraints at call sites\n * 2. The runtime implementation correctly builds requests for any path/method\n * 3. Type checking happens at the call site, not in the implementation\n *\n * @pure true\n */\nexport const asStrictApiClient = <T>(client: object): T => client as T\n\n/**\n * Cast default dispatchers registry to specific schema type\n * AXIOM: Default dispatcher registry was registered for the current Paths type\n *\n * @pure true\n */\nexport const asDispatchersFor = <T>(value: unknown): T => value as T\n","// CHANGE: Implement Effect-based HTTP client with Effect-native error handling\n// WHY: Force explicit handling of HTTP errors (4xx, 5xx) via Effect error channel\n// QUOTE(ТЗ): \"каждый запрос возвращает Effect<Success, Failure, never>; Failure включает все инварианты протокола и схемы\"\n// REF: issue-2, section 2, 4, 5.1\n// SOURCE: n/a\n// FORMAT THEOREM: ∀ req ∈ Requests: execute(req) → Effect<ApiSuccess, ApiFailure, R>\n// PURITY: SHELL\n// EFFECT: Effect<ApiSuccess<Op>, ApiFailure<Op>, HttpClient.HttpClient>\n// INVARIANT: 2xx → success channel, non-2xx → error channel (forced handling)\n// COMPLEXITY: O(1) per request / O(n) for body size\n\nimport * as HttpBody from \"@effect/platform/HttpBody\"\nimport * as HttpClient from \"@effect/platform/HttpClient\"\nimport * as HttpClientRequest from \"@effect/platform/HttpClientRequest\"\nimport { Effect } from \"effect\"\nimport type { HttpMethod } from \"openapi-typescript-helpers\"\n\nimport type {\n ApiFailure,\n ApiSuccess,\n DecodeError,\n OperationFor,\n ParseError,\n ResponsesFor,\n TransportError,\n UnexpectedContentType,\n UnexpectedStatus\n} from \"../../core/api-client/strict-types.js\"\nimport {\n asDispatcher,\n asJson,\n asRawResponse,\n asStrictRequestInit,\n type ClassifyFn,\n type Dispatcher,\n type Json,\n type RawResponse\n} from \"../../core/axioms.js\"\n\n// Re-export Dispatcher type for consumers\n\n/**\n * Decoder for response body\n *\n * @pure false - may perform validation\n * @effect Effect<T, DecodeError, never>\n */\nexport type Decoder<T> = (\n status: number,\n contentType: string,\n body: string\n) => Effect.Effect<T, DecodeError>\n\n/**\n * Configuration for a strict API client request\n */\nexport type StrictRequestInit<Responses> = {\n readonly method: HttpMethod\n readonly url: string\n readonly dispatcher: Dispatcher<Responses>\n readonly headers?: HeadersInit\n readonly body?: BodyInit\n readonly signal?: AbortSignal\n}\n\n/**\n * Execute HTTP request with Effect-native error handling\n *\n * @param config - Request configuration with dispatcher\n * @returns Effect with success (2xx) and failures (non-2xx + boundary errors)\n *\n * **Effect Channel Design:**\n * - Success channel: `ApiSuccess<Responses>` - 2xx responses only\n * - Error channel: `ApiFailure<Responses>` - HTTP errors (4xx, 5xx) + boundary errors\n *\n * This forces developers to explicitly handle HTTP errors using:\n * - `Effect.catchTag` for specific error types\n * - `Effect.match` for exhaustive handling\n * - `Effect.catchAll` for generic error handling\n *\n * @pure false - performs HTTP request\n * @effect Effect<ApiSuccess<Responses>, ApiFailure<Responses>, HttpClient.HttpClient>\n * @invariant 2xx → success channel, non-2xx → error channel\n * @precondition config.dispatcher handles all schema statuses\n * @postcondition ∀ response: success(2xx) ∨ httpError(non-2xx) ∨ boundaryError\n * @complexity O(1) + O(|body|) for text extraction\n */\nexport const executeRequest = <Responses>(\n config: StrictRequestInit<Responses>\n): Effect.Effect<ApiSuccess<Responses>, ApiFailure<Responses>, HttpClient.HttpClient> =>\n Effect.gen(function*() {\n // STEP 1: Get HTTP client from context\n const client = yield* HttpClient.HttpClient\n\n // STEP 2: Build request based on method\n const request = buildRequest(config)\n\n // STEP 3: Execute request with error mapping\n const rawResponse = yield* Effect.mapError(\n Effect.gen(function*() {\n const response = yield* client.execute(request)\n const text = yield* response.text\n return asRawResponse({\n status: response.status,\n headers: toNativeHeaders(response.headers),\n text\n })\n }),\n (error): TransportError => ({\n _tag: \"TransportError\",\n error: error instanceof Error ? error : new Error(String(error))\n })\n )\n\n // STEP 4: Delegate classification to dispatcher (handles status/content-type/decode)\n return yield* config.dispatcher(rawResponse)\n })\n\n/**\n * Build HTTP request from config\n *\n * @pure true\n */\nconst buildRequest = <Responses>(config: StrictRequestInit<Responses>): HttpClientRequest.HttpClientRequest => {\n const methodMap: Record<string, (url: string) => HttpClientRequest.HttpClientRequest> = {\n get: HttpClientRequest.get,\n post: HttpClientRequest.post,\n put: HttpClientRequest.put,\n patch: HttpClientRequest.patch,\n delete: HttpClientRequest.del,\n head: HttpClientRequest.head,\n options: HttpClientRequest.options\n }\n\n const createRequest = methodMap[config.method] ?? HttpClientRequest.get\n let request = createRequest(config.url)\n\n // Add headers if provided\n if (config.headers !== undefined) {\n const headers = toRecordHeaders(config.headers)\n request = HttpClientRequest.setHeaders(request, headers)\n }\n\n // Add body if provided\n if (config.body !== undefined) {\n const bodyText = typeof config.body === \"string\" ? config.body : JSON.stringify(config.body)\n request = HttpClientRequest.setBody(request, HttpBody.text(bodyText))\n }\n\n return request\n}\n\n/**\n * Convert Headers to Record<string, string>\n *\n * @pure true\n */\nconst toRecordHeaders = (headers: HeadersInit): Record<string, string> => {\n if (headers instanceof Headers) {\n const result: Record<string, string> = {}\n for (const [key, value] of headers.entries()) {\n result[key] = value\n }\n return result\n }\n if (Array.isArray(headers)) {\n const result: Record<string, string> = {}\n for (const headerPair of headers) {\n const [headerKey, headerValue] = headerPair\n result[headerKey] = headerValue\n }\n return result\n }\n return headers\n}\n\n/**\n * Convert @effect/platform Headers to native Headers\n *\n * @pure true\n */\nconst toNativeHeaders = (platformHeaders: { readonly [key: string]: string }): Headers => {\n const headers = new Headers()\n for (const [key, value] of Object.entries(platformHeaders)) {\n headers.set(key, value)\n }\n return headers\n}\n\n/**\n * Helper to create dispatcher from switch-based classifier\n *\n * This function uses a permissive type signature to allow generated code\n * to work with any response variant without requiring exact type matching.\n * The classify function can return any Effect with union types for success/error.\n *\n * NOTE: Uses axioms module for type casts to allow heterogeneous Effect\n * unions from switch statements. The returned Dispatcher is properly typed.\n *\n * @pure true - returns pure function\n * @complexity O(1)\n */\n\nexport const createDispatcher = <Responses>(\n classify: ClassifyFn\n): Dispatcher<Responses> => {\n return asDispatcher<Responses>((response: RawResponse) => {\n const contentType = response.headers.get(\"content-type\") ?? undefined\n return classify(response.status, contentType, response.text)\n })\n}\n\n/**\n * Helper to parse JSON with error handling\n *\n * @pure false - performs parsing\n * @effect Effect<Json, ParseError, never>\n */\nexport const parseJSON = (\n status: number,\n contentType: string,\n text: string\n): Effect.Effect<Json, ParseError> =>\n Effect.try({\n try: () => asJson(JSON.parse(text)),\n catch: (error): ParseError => ({\n _tag: \"ParseError\",\n status,\n contentType,\n error: error instanceof Error ? error : new Error(String(error)),\n body: text\n })\n })\n\n/**\n * Helper to create UnexpectedStatus error\n *\n * @pure true\n */\nexport const unexpectedStatus = (status: number, body: string): UnexpectedStatus => ({\n _tag: \"UnexpectedStatus\",\n status,\n body\n})\n\n/**\n * Helper to create UnexpectedContentType error\n *\n * @pure true\n */\nexport const unexpectedContentType = (\n status: number,\n expected: ReadonlyArray<string>,\n actual: string | undefined,\n body: string\n): UnexpectedContentType => ({\n _tag: \"UnexpectedContentType\",\n status,\n expected,\n actual,\n body\n})\n\n/**\n * Generic client interface for any OpenAPI schema with Effect-native error handling\n *\n * **Effect Channel Design:**\n * - Success channel: `ApiSuccess<Op>` - 2xx responses\n * - Error channel: `ApiFailure<Op>` - HTTP errors (4xx, 5xx) + boundary errors\n *\n * @pure false - performs HTTP requests\n * @effect Effect<ApiSuccess<Op>, ApiFailure<Op>, HttpClient.HttpClient>\n */\nexport type StrictClient<Paths extends object> = {\n readonly GET: <Path extends keyof Paths>(\n path: Path,\n options: RequestOptions<Paths, Path, \"get\">\n ) => Effect.Effect<\n ApiSuccess<ResponsesFor<OperationFor<Paths, Path, \"get\">>>,\n ApiFailure<ResponsesFor<OperationFor<Paths, Path, \"get\">>>,\n HttpClient.HttpClient\n >\n\n readonly POST: <Path extends keyof Paths>(\n path: Path,\n options: RequestOptions<Paths, Path, \"post\">\n ) => Effect.Effect<\n ApiSuccess<ResponsesFor<OperationFor<Paths, Path, \"post\">>>,\n ApiFailure<ResponsesFor<OperationFor<Paths, Path, \"post\">>>,\n HttpClient.HttpClient\n >\n\n readonly PUT: <Path extends keyof Paths>(\n path: Path,\n options: RequestOptions<Paths, Path, \"put\">\n ) => Effect.Effect<\n ApiSuccess<ResponsesFor<OperationFor<Paths, Path, \"put\">>>,\n ApiFailure<ResponsesFor<OperationFor<Paths, Path, \"put\">>>,\n HttpClient.HttpClient\n >\n\n readonly PATCH: <Path extends keyof Paths>(\n path: Path,\n options: RequestOptions<Paths, Path, \"patch\">\n ) => Effect.Effect<\n ApiSuccess<ResponsesFor<OperationFor<Paths, Path, \"patch\">>>,\n ApiFailure<ResponsesFor<OperationFor<Paths, Path, \"patch\">>>,\n HttpClient.HttpClient\n >\n\n readonly DELETE: <Path extends keyof Paths>(\n path: Path,\n options: RequestOptions<Paths, Path, \"delete\">\n ) => Effect.Effect<\n ApiSuccess<ResponsesFor<OperationFor<Paths, Path, \"delete\">>>,\n ApiFailure<ResponsesFor<OperationFor<Paths, Path, \"delete\">>>,\n HttpClient.HttpClient\n >\n}\n\n/**\n * Request options for a specific operation\n */\nexport type RequestOptions<\n Paths extends object,\n Path extends keyof Paths,\n Method extends HttpMethod\n> = {\n readonly dispatcher: Dispatcher<ResponsesFor<OperationFor<Paths, Path, Method>>>\n readonly baseUrl: string\n readonly params?: Record<string, string | number>\n readonly query?: Record<string, string | number>\n readonly headers?: HeadersInit\n readonly body?: BodyInit\n readonly signal?: AbortSignal\n}\n\n/**\n * Create a strict client for an OpenAPI schema\n *\n * @pure true - returns pure client object\n * @complexity O(1)\n */\nexport const createStrictClient = <Paths extends object>(): StrictClient<\n Paths\n> => {\n const makeRequest = <Path extends keyof Paths, Method extends HttpMethod>(\n method: Method,\n path: Path,\n options: RequestOptions<Paths, Path, Method>\n ) => {\n let url = `${options.baseUrl}${String(path)}`\n\n // Replace path parameters\n if (options.params !== undefined) {\n for (const [key, value] of Object.entries(options.params)) {\n url = url.replace(`{${key}}`, encodeURIComponent(String(value)))\n }\n }\n\n // Add query parameters\n if (options.query !== undefined) {\n const params = new URLSearchParams()\n for (const [key, value] of Object.entries(options.query)) {\n params.append(key, String(value))\n }\n url = `${url}?${params.toString()}`\n }\n\n // Build config object, only including optional properties if they are defined\n // This satisfies exactOptionalPropertyTypes constraint\n const config = asStrictRequestInit<StrictRequestInit<ResponsesFor<OperationFor<Paths, Path, Method>>>>({\n method,\n url,\n dispatcher: options.dispatcher,\n ...(options.headers !== undefined && { headers: options.headers }),\n ...(options.body !== undefined && { body: options.body }),\n ...(options.signal !== undefined && { signal: options.signal })\n })\n\n return executeRequest(config)\n }\n\n return {\n GET: (path, options) => makeRequest(\"get\", path, options),\n POST: (path, options) => makeRequest(\"post\", path, options),\n PUT: (path, options) => makeRequest(\"put\", path, options),\n PATCH: (path, options) => makeRequest(\"patch\", path, options),\n DELETE: (path, options) => makeRequest(\"delete\", path, options)\n } satisfies StrictClient<Paths>\n}\n\n// CHANGE: Add universal dispatcher that handles any OpenAPI responses generically\n// WHY: Enable createClient<Paths>(options) without code generation or manual dispatcher wiring\n// QUOTE(ТЗ): \"Я не хочу создавать какие-то дополнительные модули\"\n// REF: issue-5\n// SOURCE: n/a\n// FORMAT THEOREM: ∀ status, ct: universalDispatcher(status, ct, text) → success(2xx) ∨ httpError(non-2xx) ∨ boundaryError\n// PURITY: SHELL\n// EFFECT: Effect<ApiSuccess<Responses>, Exclude<ApiFailure<Responses>, TransportError>, never>\n// INVARIANT: 2xx → success channel, non-2xx → error channel, no-content → body: undefined\n// COMPLEXITY: O(1) per dispatch + O(|text|) for JSON parsing\n\n/**\n * Create a universal dispatcher that handles any OpenAPI response generically\n *\n * The universal dispatcher classifies responses by status code range:\n * - 2xx → success channel (ApiSuccess)\n * - non-2xx → error channel (HttpError)\n *\n * For JSON content types, it parses the body. For no-content responses (empty body),\n * it returns undefined body with contentType \"none\".\n *\n * This enables using createClient<Paths>(options) without generating\n * per-operation dispatchers, fulfilling the zero-boilerplate DSL requirement.\n *\n * @pure true - returns pure dispatcher function\n * @complexity O(1) creation + O(|body|) per dispatch\n */\nexport const createUniversalDispatcher = <Responses>(): Dispatcher<Responses> => {\n return asDispatcher<Responses>((response: RawResponse) => {\n const contentType = response.headers.get(\"content-type\") ?? undefined\n const is2xx = response.status >= 200 && response.status < 300\n\n // No-content response (empty body or 204)\n if (response.text === \"\" || response.status === 204) {\n const variant = {\n status: response.status,\n contentType: \"none\" as const,\n body: undefined\n } as const\n\n return is2xx\n ? Effect.succeed(variant)\n : Effect.fail({\n _tag: \"HttpError\" as const,\n ...variant\n })\n }\n\n // JSON content type\n if (contentType?.includes(\"application/json\")) {\n return Effect.gen(function*() {\n const parsed = yield* parseJSON(response.status, \"application/json\", response.text)\n const variant = {\n status: response.status,\n contentType: \"application/json\" as const,\n body: parsed\n } as const\n\n if (is2xx) {\n return variant\n }\n return yield* Effect.fail({\n _tag: \"HttpError\" as const,\n ...variant\n })\n })\n }\n\n // Unknown content type\n return Effect.fail(unexpectedContentType(\n response.status,\n [\"application/json\"],\n contentType,\n response.text\n ))\n })\n}\n\nexport { type Dispatcher, type RawResponse } from \"../../core/axioms.js\"\n","import { Effect } from \"effect\"\n\nimport { asJson } from \"../../core/axioms.js\"\nimport type { ParseAs } from \"./create-client-types.js\"\n\ntype RuntimeFetchResponse = {\n data?: unknown\n error?: unknown\n response: Response\n}\n\nexport const toError = (error: unknown): Error => (\n error instanceof Error ? error : new Error(String(error))\n)\n\nconst parseJsonText = (rawText: string): Effect.Effect<unknown, Error> => (\n rawText.length === 0\n ? Effect.void\n : Effect.try({\n try: () => asJson(JSON.parse(rawText)),\n catch: toError\n })\n)\n\nconst readResponseText = (response: Response): Effect.Effect<string, Error> => (\n Effect.tryPromise({\n try: () => response.text(),\n catch: toError\n })\n)\n\nconst parseSuccessData = (\n response: Response,\n parseAs: ParseAs,\n contentLength: string | null\n): Effect.Effect<unknown, Error> => {\n if (parseAs === \"stream\") {\n return Effect.succeed(response.body)\n }\n\n if (parseAs === \"text\") {\n return Effect.tryPromise({ try: () => response.text(), catch: toError })\n }\n\n if (parseAs === \"blob\") {\n return Effect.tryPromise({ try: () => response.blob(), catch: toError })\n }\n\n if (parseAs === \"arrayBuffer\") {\n return Effect.tryPromise({ try: () => response.arrayBuffer(), catch: toError })\n }\n\n if (contentLength === null) {\n return readResponseText(response).pipe(\n Effect.flatMap((rawText) => parseJsonText(rawText))\n )\n }\n\n return Effect.tryPromise({ try: () => response.json(), catch: toError })\n}\n\nconst parseErrorData = (response: Response): Effect.Effect<unknown, Error> => (\n readResponseText(response).pipe(\n Effect.flatMap((rawText) =>\n Effect.match(\n Effect.try({\n try: () => asJson(JSON.parse(rawText)),\n catch: toError\n }),\n {\n onFailure: () => rawText,\n onSuccess: (parsed) => parsed\n }\n )\n )\n )\n)\n\nconst hasChunkedTransferEncoding = (response: Response): boolean => (\n response.headers.get(\"Transfer-Encoding\")?.includes(\"chunked\") === true\n)\n\nconst isEmptyResponse = (\n request: Request,\n response: Response,\n contentLength: string | null\n): boolean => (\n response.status === 204\n || request.method === \"HEAD\"\n || (contentLength === \"0\" && !hasChunkedTransferEncoding(response))\n)\n\nexport const createResponseEnvelope = (\n request: Request,\n response: Response,\n parseAs: ParseAs\n): Effect.Effect<RuntimeFetchResponse, Error> => {\n const contentLength = response.headers.get(\"Content-Length\")\n\n if (isEmptyResponse(request, response, contentLength)) {\n return response.ok\n ? Effect.succeed({ data: undefined, response })\n : Effect.succeed({ error: undefined, response })\n }\n\n if (response.ok) {\n return parseSuccessData(response, parseAs, contentLength).pipe(\n Effect.map((data) => ({ data, response }))\n )\n }\n\n return parseErrorData(response).pipe(\n Effect.map((error) => ({ error, response }))\n )\n}\n","import { Effect } from \"effect\"\n\nimport { toError } from \"./create-client-response.js\"\nimport type { AsyncValue, MergedOptions, Middleware, MiddlewareRequestParams, Thenable } from \"./create-client-types.js\"\n\nconst isThenable = <T>(value: unknown): value is Thenable<T> => (\n typeof value === \"object\"\n && value !== null\n && \"then\" in value\n && typeof Reflect.get(value, \"then\") === \"function\"\n)\n\nexport const toPromiseEffect = <T>(value: AsyncValue<T>): Effect.Effect<T, Error> => (\n isThenable(value)\n ? Effect.async<T, Error>((resume) => {\n value.then(\n (result) => {\n resume(Effect.succeed(result))\n },\n (error) => {\n resume(Effect.fail(toError(error)))\n }\n )\n })\n : Effect.succeed(value)\n)\n\nexport type MiddlewareContext = {\n schemaPath: string\n params: MiddlewareRequestParams\n options: MergedOptions\n id: string\n middleware: Array<Middleware>\n}\n\nconst reverseMiddleware = (middleware: Array<Middleware>): Array<Middleware> => {\n const output: Array<Middleware> = []\n\n for (let index = middleware.length - 1; index >= 0; index -= 1) {\n const item = middleware[index]\n if (item !== undefined) {\n output.push(item)\n }\n }\n\n return output\n}\n\ntype RequestMiddlewareResult = {\n request: Request\n response?: Response\n}\n\nconst createMiddlewareParams = (\n request: Request,\n context: MiddlewareContext\n): {\n request: Request\n schemaPath: string\n params: MiddlewareRequestParams\n options: MergedOptions\n id: string\n} => ({\n request,\n schemaPath: context.schemaPath,\n params: context.params,\n options: context.options,\n id: context.id\n})\n\nexport const applyRequestMiddleware = (\n request: Request,\n context: MiddlewareContext\n): Effect.Effect<RequestMiddlewareResult, Error> =>\n Effect.gen(function*() {\n let nextRequest = request\n\n for (const item of context.middleware) {\n if (typeof item.onRequest !== \"function\") {\n continue\n }\n\n const result = yield* toPromiseEffect(item.onRequest(createMiddlewareParams(nextRequest, context)))\n\n if (result === undefined) {\n continue\n }\n\n if (result instanceof Request) {\n nextRequest = result\n continue\n }\n\n if (result instanceof Response) {\n return { request: nextRequest, response: result }\n }\n\n return yield* Effect.fail(\n new Error(\"onRequest: must return new Request() or Response() when modifying the request\")\n )\n }\n\n return { request: nextRequest }\n })\n\nexport const applyResponseMiddleware = (\n request: Request,\n response: Response,\n context: MiddlewareContext\n): Effect.Effect<Response, Error> =>\n Effect.gen(function*() {\n let nextResponse = response\n\n for (const item of reverseMiddleware(context.middleware)) {\n if (typeof item.onResponse !== \"function\") {\n continue\n }\n\n const result = yield* toPromiseEffect(item.onResponse({\n ...createMiddlewareParams(request, context),\n response: nextResponse\n }))\n\n if (result === undefined) {\n continue\n }\n\n if (!(result instanceof Response)) {\n return yield* Effect.fail(\n new Error(\"onResponse: must return new Response() when modifying the response\")\n )\n }\n\n nextResponse = result\n }\n\n return nextResponse\n })\n\nconst normalizeErrorResult = (\n result: Response | Error | undefined\n): Effect.Effect<Response | Error | undefined, Error> => {\n if (result === undefined || result instanceof Response || result instanceof Error) {\n return Effect.succeed(result)\n }\n\n return Effect.fail(new Error(\"onError: must return new Response() or instance of Error\"))\n}\n\nexport const applyErrorMiddleware = (\n request: Request,\n fetchError: Error,\n context: MiddlewareContext\n): Effect.Effect<Response, Error> =>\n Effect.gen(function*() {\n let nextError: Error = fetchError\n\n for (const item of reverseMiddleware(context.middleware)) {\n if (typeof item.onError !== \"function\") {\n continue\n }\n\n const rawResult = yield* toPromiseEffect(item.onError({\n ...createMiddlewareParams(request, context),\n error: nextError\n }))\n\n const result = yield* normalizeErrorResult(rawResult)\n if (result instanceof Response) {\n return result\n }\n\n if (result instanceof Error) {\n nextError = result\n }\n }\n\n return yield* Effect.fail(nextError)\n })\n","export type Primitive = string | number | boolean\n\nexport const isPrimitive = (value: unknown): value is Primitive => (\n typeof value === \"string\" || typeof value === \"number\" || typeof value === \"boolean\"\n)\n\nexport const isRecord = (value: unknown): value is Record<string, unknown> => (\n value !== null && typeof value === \"object\" && !Array.isArray(value)\n)\n","import type { QuerySerializer, QuerySerializerOptions } from \"./create-client-types.js\"\nimport { isPrimitive, isRecord, type Primitive } from \"./openapi-compat-value-guards.js\"\n\ntype PathStyle = \"simple\" | \"label\" | \"matrix\"\ntype ObjectParamStyle = PathStyle | \"form\" | \"deepObject\"\ntype ArrayParamStyle = PathStyle | \"form\" | \"spaceDelimited\" | \"pipeDelimited\"\n\nconst OBJECT_JOINER_BY_STYLE: Readonly<Record<ObjectParamStyle, string>> = {\n simple: \",\",\n label: \".\",\n matrix: \";\",\n form: \"&\",\n deepObject: \"&\"\n}\n\nconst ARRAY_JOINER_BY_STYLE: Readonly<\n Record<ArrayParamStyle, { explodeFalse: string; explodeTrue: string }>\n> = {\n simple: { explodeFalse: \",\", explodeTrue: \",\" },\n label: { explodeFalse: \",\", explodeTrue: \".\" },\n matrix: { explodeFalse: \",\", explodeTrue: \";\" },\n form: { explodeFalse: \",\", explodeTrue: \"&\" },\n spaceDelimited: { explodeFalse: \"%20\", explodeTrue: \"&\" },\n pipeDelimited: { explodeFalse: \"|\", explodeTrue: \"&\" }\n}\n\nconst encodeValue = (value: Primitive, allowReserved: boolean): string => (\n allowReserved ? String(value) : encodeURIComponent(String(value))\n)\n\nconst formatExplodeFalse = (\n name: string,\n style: ObjectParamStyle | ArrayParamStyle,\n value: string\n): string => {\n if (style === \"simple\") {\n return value\n }\n if (style === \"label\") {\n return `.${value}`\n }\n if (style === \"matrix\") {\n return `;${name}=${value}`\n }\n return `${name}=${value}`\n}\n\nconst formatExplodeTrue = (\n style: ObjectParamStyle | ArrayParamStyle,\n joiner: string,\n value: string\n): string => (\n style === \"label\" || style === \"matrix\" ? `${joiner}${value}` : value\n)\n\nconst toPrimitiveList = (value: Array<unknown>): Array<Primitive> => {\n const items: Array<Primitive> = []\n for (const item of value) {\n if (isPrimitive(item)) {\n items.push(item)\n }\n }\n return items\n}\n\nconst getQueryEntries = (queryParams: unknown): Array<[string, unknown]> => (\n isRecord(queryParams) ? Object.entries(queryParams) : []\n)\n\nconst toObjectPairs = (\n name: string,\n value: Record<string, unknown>,\n allowReserved: boolean,\n explode: boolean,\n style: ObjectParamStyle\n): Array<string> => {\n const entries: Array<string> = []\n\n for (const [key, rawValue] of Object.entries(value)) {\n if (!isPrimitive(rawValue)) {\n continue\n }\n\n if (!explode) {\n entries.push(key, encodeValue(rawValue, allowReserved))\n continue\n }\n\n const nextName = style === \"deepObject\" ? `${name}[${key}]` : key\n entries.push(\n serializePrimitiveParam(nextName, rawValue, {\n allowReserved\n })\n )\n }\n\n return entries\n}\n\nconst toArrayValues = (\n name: string,\n value: Array<unknown>,\n style: ArrayParamStyle,\n allowReserved: boolean,\n explode: boolean\n): Array<string> => {\n const entries: Array<string> = []\n\n for (const item of toPrimitiveList(value)) {\n if (explode && style !== \"simple\" && style !== \"label\") {\n entries.push(\n serializePrimitiveParam(name, item, {\n allowReserved\n })\n )\n continue\n }\n\n entries.push(encodeValue(item, allowReserved))\n }\n\n return entries\n}\n\nconst finalizeSerializedParam = (options: {\n name: string\n style: ObjectParamStyle | ArrayParamStyle\n explode: boolean\n values: Array<string>\n joinerWhenExplodeFalse: string\n joinerWhenExplodeTrue: string\n}): string => {\n const joiner = options.explode ? options.joinerWhenExplodeTrue : options.joinerWhenExplodeFalse\n const serializedValue = options.values.join(joiner)\n\n return options.explode\n ? formatExplodeTrue(options.style, options.joinerWhenExplodeTrue, serializedValue)\n : formatExplodeFalse(options.name, options.style, serializedValue)\n}\n\nexport const serializePrimitiveParam = (\n name: string,\n value: Primitive,\n options?: { allowReserved?: boolean }\n): string => (\n `${name}=${encodeValue(value, options?.allowReserved === true)}`\n)\n\nexport const serializeObjectParam = (\n name: string,\n value: unknown,\n options: {\n style: ObjectParamStyle\n explode: boolean\n allowReserved?: boolean\n }\n): string => {\n if (!isRecord(value)) {\n return \"\"\n }\n\n const pairs = toObjectPairs(\n name,\n value,\n options.allowReserved === true,\n options.explode,\n options.style\n )\n\n return finalizeSerializedParam({\n name,\n style: options.style,\n explode: options.explode,\n values: pairs,\n joinerWhenExplodeFalse: \",\",\n joinerWhenExplodeTrue: OBJECT_JOINER_BY_STYLE[options.style]\n })\n}\n\nexport const serializeArrayParam = (\n name: string,\n value: Array<unknown>,\n options: {\n style: ArrayParamStyle\n explode: boolean\n allowReserved?: boolean\n }\n): string => {\n if (!Array.isArray(value)) {\n return \"\"\n }\n\n const values = toArrayValues(\n name,\n value,\n options.style,\n options.allowReserved === true,\n options.explode\n )\n\n return finalizeSerializedParam({\n name,\n style: options.style,\n explode: options.explode,\n values,\n joinerWhenExplodeFalse: ARRAY_JOINER_BY_STYLE[options.style].explodeFalse,\n joinerWhenExplodeTrue: ARRAY_JOINER_BY_STYLE[options.style].explodeTrue\n })\n}\n\nconst serializeQueryEntry = (\n name: string,\n value: unknown,\n options?: QuerySerializerOptions\n): string | undefined => {\n if (value === undefined || value === null) {\n return\n }\n\n return Array.isArray(value)\n ? serializeArrayQueryEntry(name, value, options)\n : serializeNonArrayQueryEntry(name, value, options)\n}\n\nconst serializeArrayQueryEntry = (\n name: string,\n value: Array<unknown>,\n options?: QuerySerializerOptions\n): string | undefined => {\n if (value.length === 0) {\n return\n }\n\n return serializeArrayParam(name, value, {\n style: \"form\",\n explode: true,\n ...options?.array,\n allowReserved: options?.allowReserved === true\n })\n}\n\nconst serializeNonArrayQueryEntry = (\n name: string,\n value: unknown,\n options?: QuerySerializerOptions\n): string | undefined => {\n if (isRecord(value)) {\n return serializeObjectParam(name, value, {\n style: \"deepObject\",\n explode: true,\n ...options?.object,\n allowReserved: options?.allowReserved === true\n })\n }\n\n if (isPrimitive(value)) {\n return serializePrimitiveParam(name, value, options)\n }\n\n return undefined\n}\n\nexport const createQuerySerializer = <T = unknown>(\n options?: QuerySerializerOptions\n): QuerySerializer<T> =>\n(queryParams) => {\n const serialized: Array<string> = []\n\n for (const [name, value] of getQueryEntries(queryParams)) {\n const entry = serializeQueryEntry(name, value, options)\n if (entry !== undefined) {\n serialized.push(entry)\n }\n }\n\n return serialized.join(\"&\")\n}\n","import { serializeArrayParam, serializeObjectParam, serializePrimitiveParam } from \"./openapi-compat-serializers.js\"\nimport { isPrimitive, isRecord } from \"./openapi-compat-value-guards.js\"\n\nconst PATH_PARAM_RE = /\\{[^{}]+\\}/g\n\ntype PathStyle = \"simple\" | \"label\" | \"matrix\"\n\ntype PathTokenMeta = {\n name: string\n explode: boolean\n style: PathStyle\n}\n\nconst toPathTokenMeta = (rawName: string): PathTokenMeta => {\n let name = rawName\n let explode = false\n let style: PathStyle = \"simple\"\n\n if (name.endsWith(\"*\")) {\n explode = true\n name = name.slice(0, Math.max(0, name.length - 1))\n }\n\n if (name.startsWith(\".\")) {\n style = \"label\"\n name = name.slice(1)\n } else if (name.startsWith(\";\")) {\n style = \"matrix\"\n name = name.slice(1)\n }\n\n return { name, explode, style }\n}\n\nconst serializePathValue = (\n name: string,\n value: unknown,\n meta: PathTokenMeta\n): string | undefined => {\n if (Array.isArray(value)) {\n return serializeArrayParam(name, value, { style: meta.style, explode: meta.explode })\n }\n\n if (isRecord(value)) {\n return serializeObjectParam(name, value, { style: meta.style, explode: meta.explode })\n }\n\n if (!isPrimitive(value)) {\n return\n }\n\n if (meta.style === \"matrix\") {\n return `;${serializePrimitiveParam(name, value)}`\n }\n\n const encoded = encodeURIComponent(String(value))\n return meta.style === \"label\" ? `.${encoded}` : encoded\n}\n\nexport const defaultPathSerializer = (\n pathname: string,\n pathParams: Record<string, unknown>\n): string => {\n let nextURL = pathname\n\n for (const match of pathname.match(PATH_PARAM_RE) ?? []) {\n const rawName = match.slice(1, -1)\n const meta = toPathTokenMeta(rawName)\n const value = pathParams[meta.name]\n\n if (value === undefined || value === null) {\n continue\n }\n\n const serializedValue = serializePathValue(meta.name, value, meta)\n if (serializedValue !== undefined) {\n nextURL = nextURL.replace(match, serializedValue)\n }\n }\n\n return nextURL\n}\n","import type { HeadersOptions, PathSerializer, QuerySerializer } from \"./create-client-types.js\"\n\nconst isRecord = (value: unknown): value is Record<string, unknown> => (\n value !== null && typeof value === \"object\" && !Array.isArray(value)\n)\n\nconst toFormRecord = (value: unknown): Record<string, string> => {\n if (!isRecord(value)) {\n return {}\n }\n\n const formRecord: Record<string, string> = {}\n for (const [key, item] of Object.entries(value)) {\n formRecord[key] = String(item)\n }\n\n return formRecord\n}\n\ntype HeaderRecord = Record<\n string,\n string | number | boolean | Array<string | number | boolean> | null | undefined\n>\n\nconst isHeaderRecord = (headers: HeadersOptions): headers is HeaderRecord => (\n !(headers instanceof Headers) && !Array.isArray(headers)\n)\n\nconst getHeaderValue = (headers: Headers | HeadersOptions | undefined, key: string): string | undefined => {\n if (headers === undefined) {\n return\n }\n\n if (headers instanceof Headers) {\n return headers.get(key) ?? undefined\n }\n\n if (!isHeaderRecord(headers)) {\n return\n }\n\n const value = headers[key]\n if (value === undefined || value === null || Array.isArray(value)) {\n return\n }\n\n return String(value)\n}\n\nconst stringifyBody = (body: unknown): string => {\n return JSON.stringify(body)\n}\n\nexport const defaultBodySerializer = (\n body: unknown,\n headers?: Headers | HeadersOptions\n): string => {\n if (body === undefined) {\n return \"\"\n }\n\n const contentType = getHeaderValue(headers, \"Content-Type\") ?? getHeaderValue(headers, \"content-type\")\n if (contentType === \"application/x-www-form-urlencoded\") {\n return new URLSearchParams(toFormRecord(body)).toString()\n }\n\n return stringifyBody(body)\n}\n\nexport const createFinalURL = (\n pathname: string,\n options: {\n baseUrl: string\n params: {\n query?: Record<string, unknown>\n path?: Record<string, unknown>\n }\n querySerializer: QuerySerializer<object>\n pathSerializer: PathSerializer\n }\n): string => {\n let finalURL = `${options.baseUrl}${pathname}`\n\n if (options.params.path) {\n finalURL = options.pathSerializer(finalURL, options.params.path)\n }\n\n let queryString = options.querySerializer(options.params.query ?? {})\n if (queryString.startsWith(\"?\")) {\n queryString = queryString.slice(1)\n }\n\n if (queryString.length > 0) {\n finalURL = `${finalURL}?${queryString}`\n }\n\n return finalURL\n}\n\nconst applyHeaderValue = (target: Headers, key: string, value: HeaderRecord[string]): void => {\n if (value === null) {\n target.delete(key)\n return\n }\n\n if (Array.isArray(value)) {\n for (const item of value) {\n target.append(key, String(item))\n }\n return\n }\n\n if (value !== undefined) {\n target.set(key, String(value))\n }\n}\n\nconst mergeHeaderSource = (target: Headers, source: HeadersOptions): void => {\n if (source instanceof Headers) {\n for (const [key, value] of source.entries()) {\n target.set(key, value)\n }\n return\n }\n\n if (!isHeaderRecord(source)) {\n return\n }\n\n for (const [key, value] of Object.entries(source)) {\n applyHeaderValue(target, key, value)\n }\n}\n\nexport const mergeHeaders = (\n ...allHeaders: Array<HeadersOptions | undefined>\n): Headers => {\n const finalHeaders = new Headers()\n\n for (const source of allHeaders) {\n if (source === undefined || typeof source !== \"object\") {\n continue\n }\n\n mergeHeaderSource(finalHeaders, source)\n }\n\n return finalHeaders\n}\n\nexport const removeTrailingSlash = (url: string): string => (\n url.endsWith(\"/\") ? url.slice(0, Math.max(0, url.length - 1)) : url\n)\n","import { Effect } from \"effect\"\n\nimport { asStrictApiClient } from \"../../core/axioms.js\"\nimport { toError } from \"./create-client-response.js\"\nimport type { FetchWithRequestInitExt, HeaderRecord } from \"./create-client-runtime-types.js\"\nimport type {\n BodySerializer,\n ClientOptions,\n MergedOptions,\n MiddlewareRequestParams,\n ParseAs,\n PathSerializer,\n QuerySerializer,\n QuerySerializerOptions\n} from \"./create-client-types.js\"\nimport { createQuerySerializer } from \"./openapi-compat-utils.js\"\n\nexport const supportsRequestInitExt = (): boolean => (\n typeof process === \"object\"\n && Number.parseInt(process.versions.node.slice(0, 2), 10) >= 18\n && typeof process.versions[\"undici\"] === \"string\"\n)\n\nexport const randomID = (): string => (\n globalThis.crypto.randomUUID().replaceAll(\"-\", \"\").slice(0, 9)\n)\n\nconst isQuerySerializerOptions = (\n value: QuerySerializer<unknown> | QuerySerializerOptions | undefined\n): value is QuerySerializerOptions => (\n value !== undefined && typeof value === \"object\"\n)\n\nexport const resolveQuerySerializer = (\n globalQuerySerializer: ClientOptions[\"querySerializer\"],\n requestQuerySerializer: QuerySerializer<unknown> | QuerySerializerOptions | undefined\n): QuerySerializer<unknown> => {\n let serializer = typeof globalQuerySerializer === \"function\"\n ? globalQuerySerializer\n : createQuerySerializer(globalQuerySerializer)\n\n if (requestQuerySerializer) {\n serializer = typeof requestQuerySerializer === \"function\"\n ? requestQuerySerializer\n : createQuerySerializer({\n ...(isQuerySerializerOptions(globalQuerySerializer) ? globalQuerySerializer : {}),\n ...requestQuerySerializer\n })\n }\n\n return serializer\n}\n\nconst isHeaderPrimitive = (value: unknown): value is string | number | boolean => (\n typeof value === \"string\" || typeof value === \"number\" || typeof value === \"boolean\"\n)\n\nexport const toHeaderOverrides = (headers: MiddlewareRequestParams[\"header\"]): HeaderRecord => {\n if (headers === undefined) {\n return {}\n }\n\n const normalized: HeaderRecord = {}\n for (const [key, rawValue] of Object.entries(headers)) {\n if (rawValue === undefined || rawValue === null || isHeaderPrimitive(rawValue)) {\n normalized[key] = rawValue\n continue\n }\n\n if (Array.isArray(rawValue)) {\n normalized[key] = rawValue.filter((item) => isHeaderPrimitive(item))\n }\n }\n\n return normalized\n}\n\nconst isBodyInit = (value: BodyInit | object): value is BodyInit => (\n typeof value === \"string\"\n || value instanceof Blob\n || value instanceof URLSearchParams\n || value instanceof ArrayBuffer\n || value instanceof FormData\n || value instanceof ReadableStream\n)\n\nexport type SerializedBody =\n | { hasBody: false }\n | { hasBody: true; value: BodyInit }\n\nexport const serializeBody = (\n body: BodyInit | object | undefined,\n serializer: BodySerializer<unknown>,\n headers: Headers\n): SerializedBody => {\n if (body === undefined) {\n return { hasBody: false }\n }\n\n if (isBodyInit(body)) {\n return { hasBody: true, value: body }\n }\n\n return { hasBody: true, value: serializer(body, headers) }\n}\n\nexport const setCustomRequestFields = (request: Request, init: Record<string, unknown>): void => {\n for (const key in init) {\n if (!(key in request)) {\n Reflect.set(request, key, init[key])\n }\n }\n}\n\nexport const invokeFetch = (\n fetch: NonNullable<ClientOptions[\"fetch\"]>,\n request: Request,\n requestInitExt?: Record<string, unknown>\n): Effect.Effect<Response, Error> => {\n const fetchWithExt = asStrictApiClient<FetchWithRequestInitExt>(fetch)\n return Effect.tryPromise({\n try: () => fetchWithExt(request, requestInitExt),\n catch: toError\n })\n}\n\nexport const createMergedOptions = (options: {\n baseUrl: string\n parseAs: ParseAs\n querySerializer: QuerySerializer<unknown>\n bodySerializer: BodySerializer<unknown>\n pathSerializer: PathSerializer\n fetch: NonNullable<ClientOptions[\"fetch\"]>\n}): MergedOptions =>\n Object.freeze<MergedOptions>({\n baseUrl: options.baseUrl,\n parseAs: options.parseAs,\n querySerializer: options.querySerializer,\n bodySerializer: options.bodySerializer,\n pathSerializer: options.pathSerializer,\n fetch: asStrictApiClient<typeof globalThis.fetch>(options.fetch)\n })\n","import { Effect } from \"effect\"\n\nimport { applyErrorMiddleware, applyRequestMiddleware, applyResponseMiddleware } from \"./create-client-middleware.js\"\nimport { createResponseEnvelope } from \"./create-client-response.js\"\nimport {\n createMergedOptions,\n invokeFetch,\n randomID,\n resolveQuerySerializer,\n serializeBody,\n setCustomRequestFields,\n supportsRequestInitExt,\n toHeaderOverrides\n} from \"./create-client-runtime-helpers.js\"\nimport type { SerializedBody } from \"./create-client-runtime-helpers.js\"\nimport type {\n BaseRuntimeConfig,\n PreparedRequest,\n RuntimeClient,\n RuntimeFetchOptions,\n RuntimeFetchResponse\n} from \"./create-client-runtime-types.js\"\nimport type {\n BodySerializer,\n ClientOptions,\n Middleware,\n MiddlewareRequestParams,\n ParseAs,\n PathSerializer,\n QuerySerializer\n} from \"./create-client-types.js\"\nimport {\n createFinalURL,\n defaultBodySerializer,\n defaultPathSerializer,\n mergeHeaders,\n removeTrailingSlash\n} from \"./openapi-compat-utils.js\"\n\ntype ResolvedFetchConfig = {\n Request: typeof Request\n fetch: NonNullable<ClientOptions[\"fetch\"]>\n parseAs: ParseAs\n params: MiddlewareRequestParams\n body: BodyInit | object | undefined\n bodySerializer: BodySerializer<unknown>\n headers: ClientOptions[\"headers\"]\n init: Record<string, unknown>\n finalBaseUrl: string\n pathSerializer: PathSerializer\n querySerializer: QuerySerializer<unknown>\n middleware: Array<Middleware>\n}\n\nconst resolveBaseUrl = (baseUrl: string, localBaseUrl: string | undefined): string => (\n localBaseUrl ? removeTrailingSlash(localBaseUrl) : baseUrl\n)\n\nconst resolveBodySerializer = (\n globalBodySerializer: BodySerializer<unknown> | undefined,\n requestBodySerializer: BodySerializer<unknown> | undefined\n): BodySerializer<unknown> => (\n requestBodySerializer ?? globalBodySerializer ?? defaultBodySerializer\n)\n\nconst resolvePathSerializer = (\n globalPathSerializer: PathSerializer | undefined,\n requestPathSerializer: PathSerializer | undefined\n): PathSerializer => (\n requestPathSerializer ?? globalPathSerializer ?? defaultPathSerializer\n)\n\nconst joinMiddleware = (\n globalMiddlewares: Array<Middleware>,\n requestMiddlewares: Array<Middleware>\n): Array<Middleware> => [...globalMiddlewares, ...requestMiddlewares]\n\nconst resolveFetchConfig = (\n config: BaseRuntimeConfig,\n fetchOptions?: RuntimeFetchOptions\n): ResolvedFetchConfig => {\n const {\n Request = config.Request,\n baseUrl: localBaseUrl,\n body,\n bodySerializer: requestBodySerializer,\n fetch = config.fetch,\n headers,\n middleware: requestMiddlewares = [],\n params = {},\n parseAs = \"json\",\n pathSerializer: requestPathSerializer,\n querySerializer: requestQuerySerializer,\n ...init\n } = fetchOptions ?? {}\n\n return {\n Request,\n fetch,\n parseAs,\n params,\n body,\n bodySerializer: resolveBodySerializer(config.bodySerializer, requestBodySerializer),\n headers,\n init,\n finalBaseUrl: resolveBaseUrl(config.baseUrl, localBaseUrl),\n pathSerializer: resolvePathSerializer(config.pathSerializer, requestPathSerializer),\n querySerializer: resolveQuerySerializer(config.querySerializer, requestQuerySerializer),\n middleware: joinMiddleware(config.globalMiddlewares, requestMiddlewares)\n }\n}\n\ntype ResolvedHeaders = {\n serializedBody: SerializedBody\n finalHeaders: Headers\n}\n\nconst resolveHeaders = (\n config: BaseRuntimeConfig,\n resolved: ResolvedFetchConfig\n): ResolvedHeaders => {\n const headerOverrides = toHeaderOverrides(resolved.params.header)\n const serializedBody = serializeBody(\n resolved.body,\n resolved.bodySerializer,\n mergeHeaders(config.headers, resolved.headers, headerOverrides)\n )\n\n const finalHeaders = mergeHeaders(\n !serializedBody.hasBody || serializedBody.value instanceof FormData\n ? {}\n : { \"Content-Type\": \"application/json\" },\n config.headers,\n resolved.headers,\n headerOverrides\n )\n\n return { serializedBody, finalHeaders }\n}\n\nconst createRequest = (\n config: BaseRuntimeConfig,\n schemaPath: string,\n resolved: ResolvedFetchConfig,\n resolvedHeaders: ResolvedHeaders\n): Request => {\n const requestInit: RequestInit = {\n redirect: \"follow\",\n ...config.baseOptions,\n ...resolved.init,\n ...(resolvedHeaders.serializedBody.hasBody\n ? { body: resolvedHeaders.serializedBody.value }\n : {}),\n headers: resolvedHeaders.finalHeaders\n }\n\n const request = new resolved.Request(\n createFinalURL(schemaPath, {\n baseUrl: resolved.finalBaseUrl,\n params: resolved.params,\n querySerializer: resolved.querySerializer,\n pathSerializer: resolved.pathSerializer\n }),\n requestInit\n )\n\n setCustomRequestFields(request, resolved.init)\n return request\n}\n\nconst createPreparedContext = (\n schemaPath: string,\n resolved: ResolvedFetchConfig\n): PreparedRequest[\"context\"] => ({\n schemaPath,\n params: resolved.params,\n id: randomID(),\n options: createMergedOptions({\n baseUrl: resolved.finalBaseUrl,\n parseAs: resolved.parseAs,\n querySerializer: resolved.querySerializer,\n bodySerializer: resolved.bodySerializer,\n pathSerializer: resolved.pathSerializer,\n fetch: resolved.fetch\n }),\n middleware: resolved.middleware\n})\n\nconst prepareRequest = (\n config: BaseRuntimeConfig,\n schemaPath: string,\n fetchOptions?: RuntimeFetchOptions\n): PreparedRequest => {\n const resolved = resolveFetchConfig(config, fetchOptions)\n const requestHeaders = resolveHeaders(config, resolved)\n const request = createRequest(config, schemaPath, resolved, requestHeaders)\n\n return {\n request,\n fetch: resolved.fetch,\n parseAs: resolved.parseAs,\n middleware: resolved.middleware,\n requestInitExt: config.requestInitExt,\n context: createPreparedContext(schemaPath, resolved)\n }\n}\n\nconst executeFetch = (\n prepared: PreparedRequest\n): Effect.Effect<{ request: Request; response: Response }, Error> => {\n if (prepared.middleware.length === 0) {\n return invokeFetch(prepared.fetch, prepared.request, prepared.requestInitExt).pipe(\n Effect.map((response) => ({ request: prepared.request, response }))\n )\n }\n\n return Effect.gen(function*() {\n const requestPhase = yield* applyRequestMiddleware(prepared.request, prepared.context)\n const request = requestPhase.request\n\n const response = requestPhase.response ?? (\n yield* invokeFetch(prepared.fetch, request, prepared.requestInitExt).pipe(\n Effect.matchEffect({\n onFailure: (fetchError) => applyErrorMiddleware(request, fetchError, prepared.context),\n onSuccess: (response) => Effect.succeed(response)\n })\n )\n )\n\n const responseAfterMiddleware = yield* applyResponseMiddleware(request, response, prepared.context)\n return { request, response: responseAfterMiddleware }\n })\n}\n\nconst createCoreFetch = (config: BaseRuntimeConfig) =>\n(\n schemaPath: string,\n fetchOptions?: RuntimeFetchOptions\n): Effect.Effect<RuntimeFetchResponse, Error> =>\n Effect.gen(function*() {\n const prepared = prepareRequest(config, schemaPath, fetchOptions)\n const execution = yield* executeFetch(prepared)\n return yield* createResponseEnvelope(execution.request, execution.response, prepared.parseAs)\n })\n\nconst hasMiddlewareHook = (value: Middleware): boolean => (\n \"onRequest\" in value || \"onResponse\" in value || \"onError\" in value\n)\n\nconst createBaseRuntimeConfig = (\n clientOptions: ClientOptions | undefined,\n globalMiddlewares: Array<Middleware>\n): BaseRuntimeConfig => {\n const {\n Request = globalThis.Request,\n baseUrl: rawBaseUrl = \"\",\n bodySerializer,\n fetch = globalThis.fetch,\n headers,\n pathSerializer,\n querySerializer,\n requestInitExt: rawRequestInitExt,\n ...baseOptions\n } = { ...clientOptions }\n\n return {\n Request,\n baseUrl: removeTrailingSlash(rawBaseUrl),\n bodySerializer,\n fetch,\n headers,\n pathSerializer,\n querySerializer,\n requestInitExt: supportsRequestInitExt() ? rawRequestInitExt : undefined,\n baseOptions,\n globalMiddlewares\n }\n}\n\nconst createClientMethods = (\n coreFetch: ReturnType<typeof createCoreFetch>,\n globalMiddlewares: Array<Middleware>\n): RuntimeClient => ({\n request: (method, url, init) => coreFetch(url, { ...init, method: method.toUpperCase() }),\n GET: (url, init) => coreFetch(url, { ...init, method: \"GET\" }),\n PUT: (url, init) => coreFetch(url, { ...init, method: \"PUT\" }),\n POST: (url, init) => coreFetch(url, { ...init, method: \"POST\" }),\n DELETE: (url, init) => coreFetch(url, { ...init, method: \"DELETE\" }),\n OPTIONS: (url, init) => coreFetch(url, { ...init, method: \"OPTIONS\" }),\n HEAD: (url, init) => coreFetch(url, { ...init, method: \"HEAD\" }),\n PATCH: (url, init) => coreFetch(url, { ...init, method: \"PATCH\" }),\n TRACE: (url, init) => coreFetch(url, { ...init, method: \"TRACE\" }),\n use: (...middleware) => {\n for (const item of middleware) {\n if (!hasMiddlewareHook(item)) {\n throw new Error(\"Middleware must be an object with one of `onRequest()`, `onResponse() or `onError()`\")\n }\n globalMiddlewares.push(item)\n }\n },\n eject: (...middleware) => {\n for (const item of middleware) {\n const index = globalMiddlewares.indexOf(item)\n if (index !== -1) {\n globalMiddlewares.splice(index, 1)\n }\n }\n }\n})\n\nexport const createRuntimeClient = (clientOptions?: ClientOptions): RuntimeClient => {\n const globalMiddlewares: Array<Middleware> = []\n const config = createBaseRuntimeConfig(clientOptions, globalMiddlewares)\n const coreFetch = createCoreFetch(config)\n return createClientMethods(coreFetch, globalMiddlewares)\n}\n","import type { MediaType } from \"openapi-typescript-helpers\"\n\nimport { asStrictApiClient } from \"../../core/axioms.js\"\nimport type { RuntimeClient, RuntimeFetchOptions } from \"./create-client-runtime-types.js\"\nimport { createRuntimeClient } from \"./create-client-runtime.js\"\nimport type { Client, ClientEffect, ClientOptions, DispatchersFor, PathBasedClient } from \"./create-client-types.js\"\n\nexport type {\n Client,\n ClientEffect,\n ClientForPath,\n ClientMethod,\n ClientOptions,\n ClientPathsWithMethod,\n ClientRequestMethod,\n DispatchersFor,\n FetchOptions,\n FetchResponse,\n HeadersOptions,\n MethodResponse,\n Middleware,\n MiddlewareCallbackParams,\n ParseAs,\n PathBasedClient,\n QuerySerializer,\n QuerySerializerOptions,\n RequestBodyOption,\n RequestOptions,\n StrictApiClient,\n StrictApiClientWithDispatchers\n} from \"./create-client-types.js\"\n\nexport {\n createFinalURL,\n createQuerySerializer,\n defaultBodySerializer,\n defaultPathSerializer,\n mergeHeaders,\n removeTrailingSlash,\n serializeArrayParam,\n serializeObjectParam,\n serializePrimitiveParam\n} from \"./openapi-compat-utils.js\"\n\nexport const createClient = <Paths extends object, Media extends MediaType = MediaType>(\n clientOptions?: ClientOptions\n): Client<Paths, Media> => asStrictApiClient<Client<Paths, Media>>(createRuntimeClient(clientOptions))\n\nclass PathCallForwarder {\n constructor(\n private readonly client: RuntimeClient,\n private readonly url: string\n ) {}\n\n private readonly call = (\n method: \"GET\" | \"PUT\" | \"POST\" | \"DELETE\" | \"OPTIONS\" | \"HEAD\" | \"PATCH\" | \"TRACE\",\n init?: RuntimeFetchOptions\n ) => this.client[method](this.url, init)\n\n public readonly GET = (init?: RuntimeFetchOptions) => this.call(\"GET\", init)\n public readonly PUT = (init?: RuntimeFetchOptions) => this.call(\"PUT\", init)\n public readonly POST = (init?: RuntimeFetchOptions) => this.call(\"POST\", init)\n public readonly DELETE = (init?: RuntimeFetchOptions) => this.call(\"DELETE\", init)\n public readonly OPTIONS = (init?: RuntimeFetchOptions) => this.call(\"OPTIONS\", init)\n public readonly HEAD = (init?: RuntimeFetchOptions) => this.call(\"HEAD\", init)\n public readonly PATCH = (init?: RuntimeFetchOptions) => this.call(\"PATCH\", init)\n public readonly TRACE = (init?: RuntimeFetchOptions) => this.call(\"TRACE\", init)\n}\n\nexport const wrapAsPathBasedClient = <\n Paths extends Record<string | number, unknown>,\n Media extends MediaType = MediaType\n>(\n client: Client<Paths, Media>\n): PathBasedClient<Paths, Media> => {\n const cache = new Map<string, object>()\n const target = asStrictApiClient<PathBasedClient<Paths, Media>>({})\n\n return new Proxy(target, {\n get: (_target, property) => {\n if (typeof property !== \"string\") {\n return\n }\n\n const cached = cache.get(property)\n if (cached !== undefined) {\n return cached\n }\n\n const forwarder = new PathCallForwarder(asStrictApiClient<RuntimeClient>(client), property)\n cache.set(property, forwarder)\n return forwarder\n }\n })\n}\n\nexport const createPathBasedClient = <\n Paths extends Record<string | number, unknown>,\n Media extends MediaType = MediaType\n>(\n clientOptions?: ClientOptions\n): PathBasedClient<Paths, Media> => wrapAsPathBasedClient(createClient<Paths, Media>(clientOptions))\n\nexport const createClientEffect = <Paths extends object>(\n clientOptions?: ClientOptions\n): ClientEffect<Paths> => createClient<Paths>(clientOptions)\n\nexport const registerDefaultDispatchers = <Paths extends object>(\n _dispatchers: DispatchersFor<Paths>\n): void => {}\n","// CHANGE: Auto-generated decoder stubs for all operations\n// WHY: Provide type-safe runtime validation entry points\n// QUOTE(ТЗ): \"при изменении схемы сборка обязана падать, пока декодеры не обновлены\"\n// REF: issue-2, section 5.2\n// SOURCE: Generated from tests/fixtures/petstore.openapi.json\n// FORMAT THEOREM: ∀ op, status: decoder(op, status) → Effect<T, DecodeError, never>\n// PURITY: SHELL\n// EFFECT: Effect<T, DecodeError, never>\n// INVARIANT: All decoders return typed DecodeError on failure\n// COMPLEXITY: O(n) where n = size of parsed object\n\nimport { Effect } from \"effect\"\nimport type { DecodeError } from \"../core/api-client/strict-types.js\"\n\n/**\n * JSON value type - result of JSON.parse()\n */\ntype Json = null | boolean | number | string | ReadonlyArray<Json> | { readonly [k: string]: Json }\n\n/**\n * Decoder for listPets status 200 (application/json)\n * STUB: Replace with real schema decoder when needed\n *\n * @pure false - performs validation\n * @effect Effect<T, DecodeError, never>\n */\nexport const decodelistPets_200 = (\n _status: number,\n _contentType: string,\n _body: string,\n parsed: Json\n): Effect.Effect<Json, DecodeError> => {\n // STUB: Always succeeds with parsed value\n // Replace with: Schema.decodeUnknown(YourSchema)(parsed)\n return Effect.succeed(parsed)\n\n // Example of real decoder:\n // return Effect.mapError(\n // Schema.decodeUnknown(YourSchema)(parsed),\n // (error): DecodeError => ({\n // _tag: \"DecodeError\",\n // status,\n // contentType,\n // error,\n // body\n // })\n // )\n}\n\n/**\n * Decoder for listPets status 500 (application/json)\n * STUB: Replace with real schema decoder when needed\n *\n * @pure false - performs validation\n * @effect Effect<T, DecodeError, never>\n */\nexport const decodelistPets_500 = (\n _status: number,\n _contentType: string,\n _body: string,\n parsed: Json\n): Effect.Effect<Json, DecodeError> => {\n // STUB: Always succeeds with parsed value\n // Replace with: Schema.decodeUnknown(YourSchema)(parsed)\n return Effect.succeed(parsed)\n\n // Example of real decoder:\n // return Effect.mapError(\n // Schema.decodeUnknown(YourSchema)(parsed),\n // (error): DecodeError => ({\n // _tag: \"DecodeError\",\n // status,\n // contentType,\n // error,\n // body\n // })\n // )\n}\n\n/**\n * Decoder for createPet status 201 (application/json)\n * STUB: Replace with real schema decoder when needed\n *\n * @pure false - performs validation\n * @effect Effect<T, DecodeError, never>\n */\nexport const decodecreatePet_201 = (\n _status: number,\n _contentType: string,\n _body: string,\n parsed: Json\n): Effect.Effect<Json, DecodeError> => {\n // STUB: Always succeeds with parsed value\n // Replace with: Schema.decodeUnknown(YourSchema)(parsed)\n return Effect.succeed(parsed)\n\n // Example of real decoder:\n // return Effect.mapError(\n // Schema.decodeUnknown(YourSchema)(parsed),\n // (error): DecodeError => ({\n // _tag: \"DecodeError\",\n // status,\n // contentType,\n // error,\n // body\n // })\n // )\n}\n\n/**\n * Decoder for createPet status 400 (application/json)\n * STUB: Replace with real schema decoder when needed\n *\n * @pure false - performs validation\n * @effect Effect<T, DecodeError, never>\n */\nexport const decodecreatePet_400 = (\n _status: number,\n _contentType: string,\n _body: string,\n parsed: Json\n): Effect.Effect<Json, DecodeError> => {\n // STUB: Always succeeds with parsed value\n // Replace with: Schema.decodeUnknown(YourSchema)(parsed)\n return Effect.succeed(parsed)\n\n // Example of real decoder:\n // return Effect.mapError(\n // Schema.decodeUnknown(YourSchema)(parsed),\n // (error): DecodeError => ({\n // _tag: \"DecodeError\",\n // status,\n // contentType,\n // error,\n // body\n // })\n // )\n}\n\n/**\n * Decoder for createPet status 500 (application/json)\n * STUB: Replace with real schema decoder when needed\n *\n * @pure false - performs validation\n * @effect Effect<T, DecodeError, never>\n */\nexport const decodecreatePet_500 = (\n _status: number,\n _contentType: string,\n _body: string,\n parsed: Json\n): Effect.Effect<Json, DecodeError> => {\n // STUB: Always succeeds with parsed value\n // Replace with: Schema.decodeUnknown(YourSchema)(parsed)\n return Effect.succeed(parsed)\n\n // Example of real decoder:\n // return Effect.mapError(\n // Schema.decodeUnknown(YourSchema)(parsed),\n // (error): DecodeError => ({\n // _tag: \"DecodeError\",\n // status,\n // contentType,\n // error,\n // body\n // })\n // )\n}\n\n/**\n * Decoder for getPet status 200 (application/json)\n * STUB: Replace with real schema decoder when needed\n *\n * @pure false - performs validation\n * @effect Effect<T, DecodeError, never>\n */\nexport const decodegetPet_200 = (\n _status: number,\n _contentType: string,\n _body: string,\n parsed: Json\n): Effect.Effect<Json, DecodeError> => {\n // STUB: Always succeeds with parsed value\n // Replace with: Schema.decodeUnknown(YourSchema)(parsed)\n return Effect.succeed(parsed)\n\n // Example of real decoder:\n // return Effect.mapError(\n // Schema.decodeUnknown(YourSchema)(parsed),\n // (error): DecodeError => ({\n // _tag: \"DecodeError\",\n // status,\n // contentType,\n // error,\n // body\n // })\n // )\n}\n\n/**\n * Decoder for getPet status 404 (application/json)\n * STUB: Replace with real schema decoder when needed\n *\n * @pure false - performs validation\n * @effect Effect<T, DecodeError, never>\n */\nexport const decodegetPet_404 = (\n _status: number,\n _contentType: string,\n _body: string,\n parsed: Json\n): Effect.Effect<Json, DecodeError> => {\n // STUB: Always succeeds with parsed value\n // Replace with: Schema.decodeUnknown(YourSchema)(parsed)\n return Effect.succeed(parsed)\n\n // Example of real decoder:\n // return Effect.mapError(\n // Schema.decodeUnknown(YourSchema)(parsed),\n // (error): DecodeError => ({\n // _tag: \"DecodeError\",\n // status,\n // contentType,\n // error,\n // body\n // })\n // )\n}\n\n/**\n * Decoder for getPet status 500 (application/json)\n * STUB: Replace with real schema decoder when needed\n *\n * @pure false - performs validation\n * @effect Effect<T, DecodeError, never>\n */\nexport const decodegetPet_500 = (\n _status: number,\n _contentType: string,\n _body: string,\n parsed: Json\n): Effect.Effect<Json, DecodeError> => {\n // STUB: Always succeeds with parsed value\n // Replace with: Schema.decodeUnknown(YourSchema)(parsed)\n return Effect.succeed(parsed)\n\n // Example of real decoder:\n // return Effect.mapError(\n // Schema.decodeUnknown(YourSchema)(parsed),\n // (error): DecodeError => ({\n // _tag: \"DecodeError\",\n // status,\n // contentType,\n // error,\n // body\n // })\n // )\n}\n\n/**\n * Decoder for deletePet status 404 (application/json)\n * STUB: Replace with real schema decoder when needed\n *\n * @pure false - performs validation\n * @effect Effect<T, DecodeError, never>\n */\nexport const decodedeletePet_404 = (\n _status: number,\n _contentType: string,\n _body: string,\n parsed: Json\n): Effect.Effect<Json, DecodeError> => {\n // STUB: Always succeeds with parsed value\n // Replace with: Schema.decodeUnknown(YourSchema)(parsed)\n return Effect.succeed(parsed)\n\n // Example of real decoder:\n // return Effect.mapError(\n // Schema.decodeUnknown(YourSchema)(parsed),\n // (error): DecodeError => ({\n // _tag: \"DecodeError\",\n // status,\n // contentType,\n // error,\n // body\n // })\n // )\n}\n\n/**\n * Decoder for deletePet status 500 (application/json)\n * STUB: Replace with real schema decoder when needed\n *\n * @pure false - performs validation\n * @effect Effect<T, DecodeError, never>\n */\nexport const decodedeletePet_500 = (\n _status: number,\n _contentType: string,\n _body: string,\n parsed: Json\n): Effect.Effect<Json, DecodeError> => {\n // STUB: Always succeeds with parsed value\n // Replace with: Schema.decodeUnknown(YourSchema)(parsed)\n return Effect.succeed(parsed)\n\n // Example of real decoder:\n // return Effect.mapError(\n // Schema.decodeUnknown(YourSchema)(parsed),\n // (error): DecodeError => ({\n // _tag: \"DecodeError\",\n // status,\n // contentType,\n // error,\n // body\n // })\n // )\n}\n","// CHANGE: Auto-generated dispatchers for all operations with Effect-native error handling\n// WHY: Maintain compile-time correlation between status codes and body types\n// QUOTE(ТЗ): \"реализует switch(status) по всем статусам схемы; Failure включает все инварианты протокола и схемы\"\n// REF: issue-2, section 5.2, 4.1-4.3\n// SOURCE: Generated from tests/fixtures/petstore.openapi.json\n// FORMAT THEOREM: ∀ op ∈ Operations: dispatcher(op) → Effect<ApiSuccess, HttpError | BoundaryError>\n// PURITY: SHELL\n// EFFECT: Effect<ApiSuccess<Responses>, HttpError<Responses> | BoundaryError, never>\n// INVARIANT: 2xx → success channel, non-2xx → error channel (forced handling)\n// COMPLEXITY: O(1) per dispatch (Match lookup)\n\nimport { Effect, Match } from \"effect\"\nimport type { Operations } from \"../../tests/fixtures/petstore.openapi.js\"\nimport type { DecodeError, ResponsesFor } from \"../core/api-client/strict-types.js\"\nimport { asConst, type Json } from \"../core/axioms.js\"\nimport {\n createDispatcher,\n parseJSON,\n unexpectedContentType,\n unexpectedStatus\n} from \"../shell/api-client/strict-client.js\"\nimport * as Decoders from \"./decoders.js\"\n\n// Response types for each operation - used for type inference\ntype ListPetsResponses = ResponsesFor<Operations[\"listPets\"]>\ntype CreatePetResponses = ResponsesFor<Operations[\"createPet\"]>\ntype GetPetResponses = ResponsesFor<Operations[\"getPet\"]>\ntype DeletePetResponses = ResponsesFor<Operations[\"deletePet\"]>\n\n/**\n * Helper: process JSON content type for a given status - returns SUCCESS variant\n * Used for 2xx responses that go to the success channel\n */\nconst processJsonContentSuccess = <S extends number, D>(\n status: S,\n contentType: string | undefined,\n text: string,\n decoder: (\n s: number,\n ct: string,\n body: string,\n parsed: Json\n ) => Effect.Effect<D, DecodeError>\n) =>\n contentType?.includes(\"application/json\")\n ? Effect.gen(function*() {\n const parsed = yield* parseJSON(status, \"application/json\", text)\n const decoded = yield* decoder(status, \"application/json\", text, parsed)\n return asConst({\n status,\n contentType: \"application/json\" as const,\n body: decoded\n })\n })\n : Effect.fail(unexpectedContentType(status, [\"application/json\"], contentType, text))\n\n/**\n * Helper: process JSON content type for a given status - returns HTTP ERROR variant\n * Used for non-2xx responses (4xx, 5xx) that go to the error channel.\n *\n * Adds `_tag: \"HttpError\"` discriminator to distinguish from BoundaryError.\n */\nconst processJsonContentError = <S extends number, D>(\n status: S,\n contentType: string | undefined,\n text: string,\n decoder: (\n s: number,\n ct: string,\n body: string,\n parsed: Json\n ) => Effect.Effect<D, DecodeError>\n) =>\n contentType?.includes(\"application/json\")\n ? Effect.gen(function*() {\n const parsed = yield* parseJSON(status, \"application/json\", text)\n const decoded = yield* decoder(status, \"application/json\", text, parsed)\n // Non-2xx: Return as FAILURE with _tag discriminator (goes to error channel)\n return yield* Effect.fail(asConst({\n _tag: \"HttpError\" as const,\n status,\n contentType: \"application/json\" as const,\n body: decoded\n }))\n })\n : Effect.fail(unexpectedContentType(status, [\"application/json\"], contentType, text))\n\n/**\n * Dispatcher for listPets\n * Handles statuses: 200 (success), 500 (error)\n *\n * Effect channel mapping:\n * - 200: success channel → ApiSuccess\n * - 500: error channel → HttpError (forces explicit handling)\n *\n * @pure false - applies decoders\n * @invariant Exhaustive coverage of all schema statuses\n */\nexport const dispatcherlistPets = createDispatcher<ListPetsResponses>((status, contentType, text) =>\n Match.value(status).pipe(\n Match.when(200, () => processJsonContentSuccess(200, contentType, text, Decoders.decodelistPets_200)),\n Match.when(500, () => processJsonContentError(500, contentType, text, Decoders.decodelistPets_500)),\n Match.orElse(() => Effect.fail(unexpectedStatus(status, text)))\n )\n)\n\n/**\n * Dispatcher for createPet\n * Handles statuses: 201 (success), 400 (error), 500 (error)\n *\n * Effect channel mapping:\n * - 201: success channel → ApiSuccess\n * - 400, 500: error channel → HttpError (forces explicit handling)\n *\n * @pure false - applies decoders\n * @invariant Exhaustive coverage of all schema statuses\n */\nexport const dispatchercreatePet = createDispatcher<CreatePetResponses>((status, contentType, text) =>\n Match.value(status).pipe(\n Match.when(201, () => processJsonContentSuccess(201, contentType, text, Decoders.decodecreatePet_201)),\n Match.when(400, () => processJsonContentError(400, contentType, text, Decoders.decodecreatePet_400)),\n Match.when(500, () => processJsonContentError(500, contentType, text, Decoders.decodecreatePet_500)),\n Match.orElse(() => Effect.fail(unexpectedStatus(status, text)))\n )\n)\n\n/**\n * Dispatcher for getPet\n * Handles statuses: 200 (success), 404 (error), 500 (error)\n *\n * Effect channel mapping:\n * - 200: success channel → ApiSuccess\n * - 404, 500: error channel → HttpError (forces explicit handling)\n *\n * @pure false - applies decoders\n * @invariant Exhaustive coverage of all schema statuses\n */\nexport const dispatchergetPet = createDispatcher<GetPetResponses>((status, contentType, text) =>\n Match.value(status).pipe(\n Match.when(200, () => processJsonContentSuccess(200, contentType, text, Decoders.decodegetPet_200)),\n Match.when(404, () => processJsonContentError(404, contentType, text, Decoders.decodegetPet_404)),\n Match.when(500, () => processJsonContentError(500, contentType, text, Decoders.decodegetPet_500)),\n Match.orElse(() => Effect.fail(unexpectedStatus(status, text)))\n )\n)\n\n/**\n * Dispatcher for deletePet\n * Handles statuses: 204 (success), 404 (error), 500 (error)\n *\n * Effect channel mapping:\n * - 204: success channel → ApiSuccess (no content)\n * - 404, 500: error channel → HttpError (forces explicit handling)\n *\n * @pure false - applies decoders\n * @invariant Exhaustive coverage of all schema statuses\n */\nexport const dispatcherdeletePet = createDispatcher<DeletePetResponses>((status, contentType, text) =>\n Match.value(status).pipe(\n Match.when(204, () =>\n Effect.succeed(\n asConst({\n status: 204,\n contentType: \"none\" as const,\n body: undefined\n })\n )),\n Match.when(404, () => processJsonContentError(404, contentType, text, Decoders.decodedeletePet_404)),\n Match.when(500, () => processJsonContentError(500, contentType, text, Decoders.decodedeletePet_500)),\n Match.orElse(() => Effect.fail(unexpectedStatus(status, text)))\n )\n)\n","// CHANGE: Auto-generated dispatcher map by path+method\n// WHY: Provide a single dispatcher registry without manual wiring in examples\n// QUOTE(ТЗ): \"Этого в плане вообще не должно быть\"\n// REF: user-msg-3\n// SOURCE: Generated from tests/fixtures/petstore.openapi.json\n// FORMAT THEOREM: ∀ path, method: dispatchersByPath[path][method] = dispatcher(op)\n// PURITY: SHELL\n// EFFECT: none\n// INVARIANT: dispatcher map is total for all operations in Paths\n// COMPLEXITY: O(1)\n\nimport type { Paths } from \"../../tests/fixtures/petstore.openapi.js\"\nimport { type DispatchersFor, registerDefaultDispatchers } from \"../shell/api-client/create-client.js\"\nimport { dispatchercreatePet, dispatcherdeletePet, dispatchergetPet, dispatcherlistPets } from \"./dispatch.js\"\n\n/**\n * Dispatcher map keyed by OpenAPI path and HTTP method\n */\nexport const dispatchersByPath: DispatchersFor<Paths> = {\n \"/pets\": {\n get: dispatcherlistPets,\n post: dispatchercreatePet\n },\n \"/pets/{petId}\": {\n get: dispatchergetPet,\n delete: dispatcherdeletePet\n }\n}\n\n// CHANGE: Register default dispatchers at module load\n// WHY: Enable createClient(options) without passing dispatcher map\n// QUOTE(ТЗ): \"const apiClient = createClient<Paths>(clientOptions)\"\n// REF: user-msg-4\n// SOURCE: n/a\n// FORMAT THEOREM: ∀ call: createClient(options) uses dispatchersByPath\n// PURITY: SHELL\n// EFFECT: none\n// INVARIANT: registerDefaultDispatchers is called exactly once per module load\n// COMPLEXITY: O(1)\nregisterDefaultDispatchers(dispatchersByPath)\n"],"names":["assertNever","x","asJson","value","asConst","asRawResponse","asDispatcher","fn","asStrictRequestInit","config","asStrictApiClient","client","executeRequest","Effect","HttpClient","request","buildRequest","rawResponse","response","text","toNativeHeaders","error","HttpClientRequest","headers","toRecordHeaders","bodyText","HttpBody","result","key","headerPair","headerKey","headerValue","platformHeaders","createDispatcher","classify","contentType","parseJSON","status","unexpectedStatus","body","unexpectedContentType","expected","actual","createStrictClient","makeRequest","method","path","options","url","params","createUniversalDispatcher","is2xx","variant","parsed","toError","parseJsonText","rawText","readResponseText","parseSuccessData","parseAs","contentLength","parseErrorData","hasChunkedTransferEncoding","isEmptyResponse","createResponseEnvelope","data","isThenable","toPromiseEffect","resume","reverseMiddleware","middleware","output","index","item","createMiddlewareParams","context","applyRequestMiddleware","nextRequest","applyResponseMiddleware","nextResponse","normalizeErrorResult","applyErrorMiddleware","fetchError","nextError","rawResult","isPrimitive","isRecord","OBJECT_JOINER_BY_STYLE","ARRAY_JOINER_BY_STYLE","encodeValue","allowReserved","formatExplodeFalse","name","style","formatExplodeTrue","joiner","toPrimitiveList","items","getQueryEntries","queryParams","toObjectPairs","explode","entries","rawValue","nextName","serializePrimitiveParam","toArrayValues","finalizeSerializedParam","serializedValue","serializeObjectParam","pairs","serializeArrayParam","values","serializeQueryEntry","serializeArrayQueryEntry","serializeNonArrayQueryEntry","createQuerySerializer","serialized","entry","PATH_PARAM_RE","toPathTokenMeta","rawName","serializePathValue","meta","encoded","defaultPathSerializer","pathname","pathParams","nextURL","match","toFormRecord","formRecord","isHeaderRecord","getHeaderValue","stringifyBody","defaultBodySerializer","createFinalURL","finalURL","queryString","applyHeaderValue","target","mergeHeaderSource","source","mergeHeaders","allHeaders","finalHeaders","removeTrailingSlash","supportsRequestInitExt","randomID","isQuerySerializerOptions","resolveQuerySerializer","globalQuerySerializer","requestQuerySerializer","serializer","isHeaderPrimitive","toHeaderOverrides","normalized","isBodyInit","serializeBody","setCustomRequestFields","init","invokeFetch","fetch","requestInitExt","fetchWithExt","createMergedOptions","resolveBaseUrl","baseUrl","localBaseUrl","resolveBodySerializer","globalBodySerializer","requestBodySerializer","resolvePathSerializer","globalPathSerializer","requestPathSerializer","joinMiddleware","globalMiddlewares","requestMiddlewares","resolveFetchConfig","fetchOptions","Request","resolveHeaders","resolved","headerOverrides","serializedBody","createRequest","schemaPath","resolvedHeaders","requestInit","createPreparedContext","prepareRequest","requestHeaders","executeFetch","prepared","requestPhase","responseAfterMiddleware","createCoreFetch","execution","hasMiddlewareHook","createBaseRuntimeConfig","clientOptions","rawBaseUrl","bodySerializer","pathSerializer","querySerializer","rawRequestInitExt","baseOptions","createClientMethods","coreFetch","createRuntimeClient","createClient","PathCallForwarder","wrapAsPathBasedClient","cache","_target","property","cached","forwarder","createPathBasedClient","createClientEffect","registerDefaultDispatchers","_dispatchers","decodelistPets_200","_status","_contentType","_body","decodelistPets_500","decodecreatePet_201","decodecreatePet_400","decodecreatePet_500","decodegetPet_200","decodegetPet_404","decodegetPet_500","decodedeletePet_404","decodedeletePet_500","processJsonContentSuccess","decoder","decoded","processJsonContentError","dispatcherlistPets","Match","Decoders.decodelistPets_200","Decoders.decodelistPets_500","dispatchercreatePet","Decoders.decodecreatePet_201","Decoders.decodecreatePet_400","Decoders.decodecreatePet_500","dispatchergetPet","Decoders.decodegetPet_200","Decoders.decodegetPet_404","Decoders.decodegetPet_500","dispatcherdeletePet","Decoders.decodedeletePet_404","Decoders.decodedeletePet_500","dispatchersByPath"],"mappings":"8OA0VO,MAAMA,GAAeC,GAAoB,CAC9C,MAAM,IAAI,MAAM,qBAAqB,KAAK,UAAUA,CAAC,CAAC,EAAE,CAC1D,EC9SaC,EAAUC,GAAyBA,EAQnCC,EAAcD,GAAgBA,EAc9BE,EAAiBF,GAIXA,EAuBNG,EACXC,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,EAAahB,EAAMqO,EAAyB,CAAC,EAClGR,EAAM,KAAK,IAAK,IAAMF,EAAwB,IAAK3M,EAAahB,EAAMsO,EAAyB,CAAC,EAChGT,EAAM,KAAK,IAAK,IAAMF,EAAwB,IAAK3M,EAAahB,EAAMuO,EAAyB,CAAC,EAChGV,EAAM,OAAO,IAAMnO,EAAO,KAAKyB,EAAiBD,EAAQlB,CAAI,CAAC,CAAC,CAAA,CAElE,EAaawO,GAAsB1N,EAAqC,CAACI,EAAQF,EAAahB,IAC5F6N,EAAM,MAAM3M,CAAM,EAAE,KAClB2M,EAAM,KAAK,IAAK,IACdnO,EAAO,QACLT,EAAQ,CACN,OAAQ,IACR,YAAa,OACb,KAAM,MAAA,CACP,CAAA,CACF,EACH4O,EAAM,KAAK,IAAK,IAAMF,EAAwB,IAAK3M,EAAahB,EAAMyO,EAA4B,CAAC,EACnGZ,EAAM,KAAK,IAAK,IAAMF,EAAwB,IAAK3M,EAAahB,EAAM0O,EAA4B,CAAC,EACnGb,EAAM,OAAO,IAAMnO,EAAO,KAAKyB,EAAiBD,EAAQlB,CAAI,CAAC,CAAC,CAAA,CAElE,ECzJa2O,GAA2C,CACtD,QAAS,CACP,IAAKf,GACL,KAAMI,EAAA,EAER,gBAAiB,CACf,IAAKI,GACL,OAAQI,EAAA,CAEZ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prover-coder-ai/openapi-effect",
3
- "version": "1.0.19",
3
+ "version": "1.0.20",
4
4
  "description": "Drop-in replacement for openapi-fetch with an opt-in Effect API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -38,8 +38,7 @@
38
38
  "@effect/platform": "^0.94.4",
39
39
  "@effect/platform-node": "^0.104.1",
40
40
  "@effect/schema": "^0.75.5",
41
- "effect": "^3.19.16",
42
- "openapi-fetch": "^0.15.2"
41
+ "effect": "^3.19.16"
43
42
  },
44
43
  "scripts": {
45
44
  "build": "vite build",