@ez4/gateway 0.15.0 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/library.mjs CHANGED
@@ -1,151 +1,157 @@
1
- import{registerTriggers as $r}from"@ez4/common/library";import{registerTriggers as Lr}from"@ez4/schema/library";
2
- import{createTrigger as eo}from"@ez4/project/library";import{DuplicateServiceError as Vr,isExternalStatement as Qr,getLinkedServiceList as Jr,
3
- getLinkedVariableList as Gr,getModelMembers as Yr,getPropertyString as Kr,getPropertyTuple as Wr}from"@ez4/common/library";
4
- import{isModelProperty as Xr}from"@ez4/reflection";var k="@ez4/http",oo=e=>e.type===k;import{IncompleteTypeError as De}from"@ez4/common/library";var m=class extends De{constructor(o,t){
5
- super("Incomplete service",o,t)}};import{isModelDeclaration as Ue,getPropertyNumber as Ne,getObjectMembers as Ve,getModelMembers as Qe,
6
- getServiceListener as Je}from"@ez4/common/library";import{isModelProperty as Ge,
7
- isTypeObject as Ye,isTypeReference as Ke}from"@ez4/reflection";import{isAnyNumber as We}from"@ez4/utils";import{hasHeritageType as c,isClassDeclaration as Be,isModelDeclaration as B}from"@ez4/common/library";
8
- import{isTypeCallback as F,isTypeFunction as U}from"@ez4/reflection";var Fe=new Set(
9
- ["ANY","GET","POST","PUT","PATCH","DELETE","OPTIONS"]),N=e=>{let[o]=e.split(" ",
10
- 2);return Fe.has(o)},V=e=>Be(e)&&c(e,"Http.Service"),Q=e=>B(e)&&c(e,"Http.Route");var J=e=>c(e,"Http.Defaults"),G=e=>c(e,"Http.Headers"),Y=e=>c(e,"Http.Identity"),
11
- K=e=>c(e,"Http.QueryStrings"),W=e=>c(e,"Http.PathParameters"),X=e=>c(e,"Http.Jso\
12
- nBody"),Z=e=>B(e)&&c(e,"Http.Cors"),_=e=>F(e)||U(e),$=e=>F(e)||U(e);var te=(e,o,t,r)=>{if(!Ke(e))return L(e,o,r);let n=t[e.path];return n?L(n,o,r):null},
13
- L=(e,o,t)=>Ye(e)?ee(Ve(e),t):Ue(e)?J(e)?ee(Qe(e),t):(t.push(new a(e.name,o.file)),
14
- null):(t.push(new u(o.file)),null),ee=(e,o)=>{let t={};for(let r of e)if(!(!Ge(r)||
15
- r.inherited))switch(r.name){case"timeout":case"memory":{let n=Ne(r);We(n)&&(t[r.
16
- name]=n);break}case"listener":{let n=Je(r.value,o);n&&(t.listener=n);break}}return t};import{isModelProperty as ar,isTypeObject as fr,isTypeReference as dr}from"@ez4/reflection";
17
- import{isAnyBoolean as yr,isAnyNumber as Tr}from"@ez4/utils";import{getLinkedVariableList as gr,
18
- getPropertyBoolean as Hr,getPropertyNumber as br,getPropertyString as hr,getObjectMembers as Mr,
19
- getModelMembers as Sr,getServiceListener as xr}from"@ez4/common/library";import{IncompleteTypeError as Xe}from"@ez4/common/library";var f=class extends Xe{constructor(o,t){
20
- super("Incomplete service route",o,t)}};import{IncompleteTypeError as Ze}from"@ez4/common/library";var d=class extends Ze{constructor(o,t){
21
- super("Incomplete route authorizer",o,t)}};import{getModelMembers as Et,getObjectMembers as Pt,getPropertyNumber as zt,hasHeritageType as wt,
22
- isModelDeclaration as kt}from"@ez4/common/library";import{isModelProperty as qt,
23
- isTypeObject as Ct,isTypeReference as Dt}from"@ez4/reflection";import{isAnyNumber as ae}from"@ez4/utils";import{IncorrectTypeError as _e,InvalidTypeError as $e}from"@ez4/common/library";
24
- var y=class extends $e{constructor(t,r){super("Invalid route response",void 0,t,
25
- r);this.baseType=t}},T=class extends _e{constructor(t,r,n){super("Incorrect rout\
26
- e response",t,r,n);this.responseType=t;this.baseType=r}};import{isTypeObject as tt,isTypeReference as rt}from"@ez4/reflection";import{getObjectSchema as ot,
27
- isObjectSchema as nt}from"@ez4/schema/library";import{isModelDeclaration as pt}from"@ez4/common/library";import{IncorrectTypeError as Le,InvalidTypeError as et}from"@ez4/common/library";
28
- var g=class extends et{constructor(o){super("Invalid headers",void 0,"Http.Heade\
29
- rs",o)}},H=class extends Le{constructor(t,r){super("Incorrect headers",t,"Http.H\
30
- eaders",r);this.headersType=t}};var b=(e,o,t,r)=>{if(!rt(e))return re(e,o,t,r);let n=t[e.path];return n?re(n,o,t,
31
- r):null},re=(e,o,t,r)=>tt(e)?oe(e,t):pt(e)?G(e)?oe(e,t):(r.push(new H(e.name,o.file)),
32
- null):(r.push(new g(o.file)),null),oe=(e,o)=>{let t=ot(e,o);return t&&nt(t)?t:null};import{isModelDeclaration as ct}from"@ez4/common/library";import{createUnionSchema as lt,
33
- getObjectSchema as mt,getScalarSchema as ut,isObjectSchema as at}from"@ez4/schema/library";
34
- import{isTypeObject as ft,isTypeReference as dt,isTypeScalar as yt,isTypeUndefined as Tt,
35
- isTypeUnion as gt}from"@ez4/reflection";import{IncorrectTypeError as st,InvalidTypeError as it}from"@ez4/common/library";
36
- var h=class extends it{constructor(o){super("Invalid body",void 0,"Http.JsonBody",
37
- o)}},M=class extends st{constructor(t,r){super("Incorrect body",t,"Http.JsonBody",
38
- r);this.bodyType=t}};var pe=(e,o,t,r)=>q(e,o,t,(n,p)=>C(n,p,t,r)),se=(e,o,t,r)=>q(e,o,t,(n,p)=>ie(n)??
39
- C(n,p,t,r)),q=(e,o,t,r)=>{if(Tt(e))return null;if(!dt(e))return r(e,o);let n=t[e.
40
- path];return n?r(n,o):null},ie=e=>yt(e)?ut(e):null,C=(e,o,t,r)=>gt(e)?Ht(e.elements,
41
- o,t,(n,p)=>ie(n)??C(n,p,t,r)):ft(e)?ne(e,t):ct(e)?X(e)?ne(e,t):(r.push(new M(e.name,
42
- e.file)),null):(r.push(new h(o.file)),null),Ht=(e,o,t,r)=>{let n=[];for(let p of e){
43
- let s=q(p,o,t,r);s&&n.push(s)}return n.length?lt({elements:n}):null},ne=(e,o)=>{
44
- let t=mt(e,o);return t&&at(t)?t:null};import{isTypeObject as Mt,isTypeReference as St,isTypeUndefined as xt,isTypeUnion as At}from"@ez4/reflection";
45
- import{createUnionSchema as vt,getObjectSchema as It,isObjectSchema as jt}from"@ez4/schema/library";
46
- import{isModelDeclaration as Rt}from"@ez4/common/library";import{IncorrectTypeError as bt,InvalidTypeError as ht}from"@ez4/common/library";
47
- var S=class extends ht{constructor(o){super("Invalid identity",void 0,"Http.Iden\
48
- tity",o)}},x=class extends bt{constructor(t,r){super("Incorrect identity",t,"Htt\
49
- p.Identity",r);this.identityType=t}};var l=(e,o,t,r)=>{if(xt(e))return null;if(!St(e))return ce(e,o,t,r);let n=t[e.path];
50
- return n?ce(n,o,t,r):null},ce=(e,o,t,r)=>{if(At(e))return Ot(e.elements,o,t,r);if(Mt(
51
- e))return le(e,t);if(!Rt(e))return r.push(new S(o.file)),null;if(!Y(e))return r.
52
- push(new x(e.name,o.file)),null;let n=le(e,t);return n&&(n.definitions={...n.definitions,
53
- extensible:!0}),n},Ot=(e,o,t,r)=>{let n=[];for(let p of e){let s=l(p,o,t,r);s&&n.
54
- push(s)}return n.length>1?vt({elements:n}):n[0]},le=(e,o)=>{let t=It(e,o);return t&&
55
- jt(t)?t:null};var fe=(e,o,t,r)=>{let n=ye(e,o,t,r,"Http.AuthResponse");return n&&Bt(n)?n:null},
56
- de=(e,o,t,r)=>{let n=ye(e,o,t,r,"Http.Response");return n&&Ft(n)?n:null},ye=(e,o,t,r,n)=>{
57
- if(!Dt(e))return me(e,o,t,r,n);let p=t[e.path];return p?me(p,o,t,r,n):null},Bt=e=>!!e.
58
- identity,Ft=e=>ae(e.status),me=(e,o,t,r,n)=>Ct(e)?ue(e,Pt(e),t,r):kt(e)?wt(e,n)?
59
- ue(e,Et(e),t,r):(r.push(new T(e.name,n,e.file)),null):(r.push(new y(n,o.file)),null),
60
- ue=(e,o,t,r)=>{let n={};for(let p of o)if(!(!qt(p)||p.inherited))switch(p.name){case"\
61
- status":{let s=zt(p);ae(s)&&(n[p.name]=s);break}case"headers":{n.headers=b(p.value,
62
- e,t,r),n.headers&&p.description&&(n.headers.description=p.description);break}case"\
63
- identity":{n.identity=l(p.value,e,t,r),n.identity&&p.description&&(n.identity.description=
64
- p.description);break}case"body":{n.body=se(p.value,e,t,r),n.body&&p.description&&
65
- (n.body.description=p.description);break}}return n};import{isModelDeclaration as rr,getModelMembers as or,getObjectMembers as nr,hasHeritageType as pr}from"@ez4/common/library";
66
- import{isModelProperty as sr,isTypeObject as ir,isTypeReference as cr}from"@ez4/reflection";import{IncorrectTypeError as Ut,InvalidTypeError as Nt}from"@ez4/common/library";
67
- var A=class extends Nt{constructor(t,r){super("Invalid route request",void 0,t,r);
68
- this.baseType=t}},v=class extends Ut{constructor(t,r,n){super("Incorrect route r\
69
- equest",t,r,n);this.requestType=t;this.baseType=r}};import{isTypeObject as Jt,isTypeReference as Gt}from"@ez4/reflection";import{getObjectSchema as Yt,
70
- isObjectSchema as Kt}from"@ez4/schema/library";import{isModelDeclaration as Wt}from"@ez4/common/library";import{IncorrectTypeError as Vt,InvalidTypeError as Qt}from"@ez4/common/library";
71
- var I=class extends Qt{constructor(o){super("Invalid request parameters",void 0,
72
- "Http.PathParameters",o)}},j=class extends Vt{constructor(t,r){super("Incorrect \
73
- request parameters",t,"Http.PathParameters",r);this.parametersType=t}};var He=(e,o,t,r)=>{if(!Gt(e))return Te(e,o,t,r);let n=t[e.path];return n?Te(n,o,
74
- t,r):null},Te=(e,o,t,r)=>Jt(e)?ge(e,t):Wt(e)?W(e)?ge(e,t):(r.push(new j(e.name,e.
75
- file)),null):(r.push(new I(o.file)),null),ge=(e,o)=>{let t=Yt(e,o);return t&&Kt(
76
- t)?t:null};import{isTypeObject as _t,isTypeReference as $t}from"@ez4/reflection";import{getObjectSchema as Lt,
77
- isObjectSchema as er}from"@ez4/schema/library";import{isModelDeclaration as tr}from"@ez4/common/library";import{IncorrectTypeError as Xt,InvalidTypeError as Zt}from"@ez4/common/library";
78
- var R=class extends Zt{constructor(o){super("Invalid request query strings",void 0,
79
- "Http.QueryStrings",o)}},O=class extends Xt{constructor(t,r){super("Incorrect re\
80
- quest query strings",t,"Http.QueryStrings",r);this.queryType=t}};var Me=(e,o,t,r)=>{if(!$t(e))return be(e,o,t,r);let n=t[e.path];return n?be(n,o,
81
- t,r):null},be=(e,o,t,r)=>_t(e)?he(e,t):tr(e)?K(e)?he(e,t):(r.push(new O(e.name,o.
82
- file)),null):(r.push(new R(o.file)),null),he=(e,o)=>{let t=Lt(e,o);return t&&er(
83
- t)?t:null};var Ae=(e,o,t,r)=>Ie(e,o,t,r,"Http.AuthRequest"),ve=(e,o,t,r)=>Ie(e,o,t,r,"Http.\
84
- Request"),Ie=(e,o,t,r,n)=>{if(!cr(e))return Se(e,o,t,r,n);let p=t[e.path];return p?
85
- Se(p,o,t,r,n):null},Se=(e,o,t,r,n)=>ir(e)?xe(e,nr(e),t,r):rr(e)?pr(e,n)?xe(e,or(
86
- e),t,r):(r.push(new v(e.name,n,e.file)),null):(r.push(new A(n,o.file)),null),xe=(e,o,t,r)=>{
87
- let n={};for(let p of o)if(!(!sr(p)||p.inherited))switch(p.name){case"headers":{
88
- n.headers=b(p.value,e,t,r),n.headers&&p.description&&(n.headers.description=p.description);
89
- break}case"identity":{n.identity=l(p.value,e,t,r),n.identity&&p.description&&(n.
90
- identity.description=p.description);break}case"query":{n.query=Me(p.value,e,t,r),
91
- n.query&&p.description&&(n.query.description=p.description);break}case"parameter\
92
- s":{n.parameters=He(p.value,e,t,r),n.parameters&&p.description&&(n.parameters.description=
93
- p.description);break}case"body":{n.body=pe(p.value,e,t,r),n.body&&p.description&&
94
- (n.body.description=p.description);break}}return n};var je=(e,o,t)=>{if(!_(e))return null;let r={},n=new Set(["name","file"]);if(e.description&&
95
- (r.description=e.description),(r.name=e.name)&&n.delete("name"),(r.file=e.file)&&
96
- n.delete("file"),e.parameters){let[{value:p}]=e.parameters;r.request=Ae(p,e,o,t)}
97
- return e.return&&(r.response=fe(e.return,e,o,t)),lr(r)?r:(t.push(new d([...n],e.
98
- file)),null)},lr=e=>!!e.name&&!!e.file;import{IncompleteTypeError as mr}from"@ez4/common/library";var E=class extends mr{constructor(o,t){
99
- super("Incomplete route handler",o,t)}};var Re=(e,o,t)=>{if(!$(e))return null;let r={},n=new Set(["name","file","respons\
100
- e"]);if(e.description&&(r.description=e.description),(r.name=e.name)&&n.delete("\
101
- name"),(r.file=e.file)&&n.delete("file"),e.parameters){let[{value:p}]=e.parameters;
102
- r.request=ve(p,e,o,t)}if(e.return){let p=de(e.return,e,o,t);p&&(r.response=p,n.delete(
103
- "response"))}return ur(r)?r:(t.push(new E([...n],e.file)),null)},ur=e=>!!e.name&&
104
- !!e.file&&!!e.response;var Pe=(e,o,t)=>{if(!dr(e))return Oe(e,o,t);let r=o[e.path];return r?Oe(r,o,t):null},
105
- Ar=e=>!!e.path&&!!e.handler,Oe=(e,o,t)=>Q(e)?Ee(e,Sr(e),o,t):fr(e)?Ee(e,Mr(e),o,
106
- t):null,Ee=(e,o,t,r)=>{let n={},p=new Set(["path","handler"]);for(let s of o)if(!(!ar(
107
- s)||s.inherited))switch(s.name){case"path":{let i=hr(s);i&&N(i)&&(p.delete(s.name),
108
- n.path=i);break}case"timeout":case"memory":{let i=br(s);Tr(i)&&(n[s.name]=i);break}case"\
109
- cors":{let i=Hr(s);yr(i)&&(n[s.name]=i);break}case"authorizer":{let i=je(s.value,
110
- t,r);i&&(n.authorizer=i);break}case"listener":{let i=xr(s.value,r);i&&(n.listener=
111
- i);break}case"handler":(n.handler=Re(s.value,t,r))&&p.delete(s.name);break;case"\
112
- variables":n.variables=gr(s,r);break}return Ar(n)?n:(r.push(new f([...p],e.file)),
113
- null)};import{getLiteralString as Rr,getModelMembers as Or,getObjectMembers as Er,getPropertyBoolean as Pr,
114
- getPropertyNumber as zr,getPropertyTuple as wr,isModelDeclaration as kr}from"@ez4/common/library";
115
- import{isModelProperty as qr,isTypeObject as Cr,isTypeReference as Dr}from"@ez4/reflection";
116
- import{isAnyBoolean as Br,isAnyNumber as Fr}from"@ez4/utils";import{IncompleteTypeError as vr,IncorrectTypeError as Ir,InvalidTypeError as jr}from"@ez4/common/library";
117
- var P=class extends vr{constructor(o,t){super("Incomplete HTTP CORS",o,t)}},z=class extends jr{constructor(o){
118
- super("Invalid HTTP CORS type",void 0,"Http.Cors",o)}},w=class extends Ir{constructor(t,r){
119
- super("Incorrect HTTP CORS type",t,"Http.Cors",r);this.fallbackType=t}};var ke=(e,o,t,r)=>{if(!Dr(e))return ze(e,o,r);let n=t[e.path];return n?ze(n,o,r):
120
- null},Ur=e=>!!e.allowOrigins?.length,ze=(e,o,t)=>Cr(e)?we(e,Er(e),t):kr(e)?Z(e)?
121
- we(e,Or(e),t):(t.push(new w(e.name,e.file)),null):(t.push(new z(o.file)),null),we=(e,o,t)=>{
122
- let r={},n=new Set(["allowOrigins"]);for(let p of o)if(!(!qr(p)||p.inherited))switch(p.
123
- name){case"allowOrigins":case"allowMethods":case"allowHeaders":case"exposeHeader\
124
- s":{let s=Nr(p);s.length&&(r[p.name]=s);break}case"allowCredentials":{let s=Pr(p);
125
- Br(s)&&(r[p.name]=s);break}case"maxAge":{let s=zr(p);Fr(s)&&(r[p.name]=s);break}}
126
- return Ur(r)?r:(t.push(new P([...n],e.file)),null)},Nr=e=>{let o=wr(e)??[],t=[];
127
- for(let r of o){let n=Rr(r);n&&t.push(n)}return t};var qe=e=>{let o={},t=[];for(let r in e){let n=e[r];if(!V(n)||Qr(n))continue;let p={
128
- type:k},s=new Set(["routes"]);p.name=n.name,n.description&&(p.description=n.description);
129
- for(let i of Yr(n))if(!(!Xr(i)||i.inherited))switch(i.name){case"name":{let D=Kr(
130
- i);if(D){p.displayName=D;break}}case"defaults":p.defaults=te(i.value,n,e,t);break;case"\
131
- routes":(p.routes=_r(i,e,t))&&s.delete(i.name);break;case"cors":p.cors=ke(i.value,
132
- n,e,t);break;case"variables":p.variables=Gr(i,t);break;case"services":p.services=
133
- Jr(i,e,t);break}if(!Zr(p)){t.push(new m([...s],n.file));continue}if(o[n.name]){t.
134
- push(new Vr(n.name,n.file));continue}o[n.name]=p}return{services:o,errors:t}},Zr=e=>!!e.
135
- name&&!!e.routes,_r=(e,o,t)=>{let r=Wr(e)??[],n=[];for(let p of r){let s=Pe(p,o,
136
- t);s&&n.push(s)}return n};var Ce=!1,Tp=()=>{Ce||($r(),Lr(),eo("@ez4/gateway",{"metadata:getServices":qe}),
137
- Ce=!1)};import{IncorrectTypeError as to,InvalidTypeError as ro}from"@ez4/common/library";
138
- var u=class extends ro{constructor(o){super("Invalid defaults",void 0,"Http.Defa\
139
- ults",o)}},a=class extends to{constructor(t,r){super("Incorrect defaults",t,"Htt\
140
- p.Defaults",r);this.defaultsType=t}};export{d as IncompleteAuthorizerError,P as IncompleteCorsError,E as IncompleteHandlerError,
141
- f as IncompleteRouteError,m as IncompleteServiceError,M as IncorrectBodyTypeError,
142
- w as IncorrectCorsTypeError,a as IncorrectDefaultsTypeError,H as IncorrectHeadersTypeError,
143
- x as IncorrectIdentityTypeError,j as IncorrectParameterTypeError,O as IncorrectQueryTypeError,
144
- v as IncorrectRequestTypeError,T as IncorrectResponseTypeError,h as InvalidBodyTypeError,
145
- z as InvalidCorsTypeError,u as InvalidDefaultsTypeError,g as InvalidHeadersTypeError,
146
- S as InvalidIdentityTypeError,I as InvalidParameterTypeError,R as InvalidQueryTypeError,
147
- A as InvalidRequestTypeError,y as InvalidResponseTypeError,k as ServiceType,Ae as getHttpAuthRequest,
148
- fe as getHttpAuthResponse,je as getHttpAuthorizer,ke as getHttpCors,Re as getHttpHandler,
149
- ve as getHttpHandlerRequest,de as getHttpHandlerResponse,b as getHttpHeaders,l as getHttpIdentity,
150
- He as getHttpParameters,Me as getHttpQuery,pe as getHttpRequestBody,se as getHttpResponseBody,
151
- Pe as getHttpRoute,qe as getHttpServices,oo as isHttpService,Tp as registerTriggers};
1
+ import{registerTriggers as lo}from"@ez4/common/library";import{registerTriggers as mo}from"@ez4/schema/library";
2
+ import{createTrigger as uo}from"@ez4/project/library";import{DuplicateServiceError as $t,isExternalStatement as Lt,getLinkedServiceList as eo,
3
+ getLinkedVariableList as ro,getModelMembers as to,getPropertyString as oo,getPropertyTuple as no,
4
+ InvalidServicePropertyError as so}from"@ez4/common/library";import{isModelProperty as po}from"@ez4/reflection";var q="@ez4/http",yo=e=>e.type===q;import{IncompleteTypeError as Ce}from"@ez4/common/library";var u=class extends Ce{constructor(t,r){
5
+ super("Incomplete service",t,r)}};import{InvalidServicePropertyError as Ue,isModelDeclaration as Ve,getPropertyNumber as Fe,
6
+ getObjectMembers as Ne,getModelMembers as Qe,getServiceListener as Je,getReferenceType as Ge}from"@ez4/common/library";
7
+ import{isModelProperty as Ye,isTypeObject as Ke,isTypeReference as We}from"@ez4/reflection";import{hasHeritageType as l,isClassDeclaration as De,isModelDeclaration as B}from"@ez4/common/library";
8
+ import{isTypeCallback as U,isTypeFunction as V}from"@ez4/reflection";var Be=new Set(
9
+ ["ANY","GET","POST","PUT","PATCH","DELETE","OPTIONS"]),F=e=>{let[t]=e.split(" ",
10
+ 2);return Be.has(t)},N=e=>De(e)&&l(e,"Http.Service"),Q=e=>B(e)&&l(e,"Http.Route");var J=e=>l(e,"Http.Defaults"),G=e=>l(e,"Http.Headers"),Y=e=>l(e,"Http.Identity"),
11
+ K=e=>l(e,"Http.QueryStrings"),W=e=>l(e,"Http.PathParameters"),X=e=>l(e,"Http.Jso\
12
+ nBody"),Z=e=>B(e)&&l(e,"Http.Cors"),_=e=>U(e)||V(e),$=e=>U(e)||V(e);var re=(e,t,r,n)=>{if(!We(e))return L(e,t,n);let o=Ge(e,r);return o?L(o,t,n):null},
13
+ L=(e,t,r)=>Ke(e)?ee(t,Ne(e),r):Ve(e)?J(e)?ee(t,Qe(e),r):(r.push(new f(e.name,t.file)),
14
+ null):(r.push(new a(t.file)),null),ee=(e,t,r)=>{let n={};for(let o of t)if(!(!Ye(
15
+ o)||o.inherited))switch(o.name){default:r.push(new Ue(e.name,o.name,e.file));break;case"\
16
+ memory":case"timeout":n[o.name]=Fe(o);break;case"listener":n.listener=Je(o.value,
17
+ r);break}return n};import{isModelProperty as St,isTypeObject as xt,isTypeReference as At}from"@ez4/reflection";
18
+ import{InvalidServicePropertyError as It,getLinkedVariableList as vt,getPropertyBoolean as Rt,
19
+ getPropertyNumber as Et,getPropertyString as jt,getObjectMembers as Ot,getModelMembers as Pt,
20
+ getServiceListener as wt,getReferenceType as zt}from"@ez4/common/library";import{IncompleteTypeError as Xe}from"@ez4/common/library";var d=class extends Xe{constructor(t,r){
21
+ super("Incomplete service route",t,r)}};import{IncompleteTypeError as Ze}from"@ez4/common/library";var y=class extends Ze{constructor(t,r){
22
+ super("Incomplete route authorizer",t,r)}};import{InvalidServicePropertyError as zr,isModelDeclaration as kr,hasHeritageType as qr,
23
+ getModelMembers as Cr,getObjectMembers as Dr,getPropertyNumber as Br,getReferenceType as Ur}from"@ez4/common/library";
24
+ import{isModelProperty as Vr,isTypeObject as Fr,isTypeReference as Nr}from"@ez4/reflection";
25
+ import{isAnyNumber as Qr}from"@ez4/utils";import{IncorrectTypeError as _e,InvalidTypeError as $e}from"@ez4/common/library";
26
+ var T=class extends $e{constructor(r,n){super("Invalid route response",void 0,r,
27
+ n);this.baseType=r}},g=class extends _e{constructor(r,n,o){super("Incorrect rout\
28
+ e response",r,n,o);this.responseType=r;this.baseType=n}};import{getReferenceType as rr,isModelDeclaration as tr}from"@ez4/common/library";
29
+ import{isObjectSchema as or,createUnionSchema as nr,getObjectSchema as sr,getScalarSchema as pr}from"@ez4/schema/library";
30
+ import{isTypeObject as ir,isTypeReference as cr,isTypeScalar as lr,isTypeUndefined as mr,
31
+ isTypeUnion as ur}from"@ez4/reflection";import{IncorrectTypeError as Le,InvalidTypeError as er}from"@ez4/common/library";
32
+ var H=class extends er{constructor(t){super("Invalid body",void 0,"Http.JsonBody",
33
+ t)}},M=class extends Le{constructor(r,n){super("Incorrect body",r,"Http.JsonBody",
34
+ n);this.bodyType=r}};var oe=(e,t,r,n)=>C(e,t,r,(o,s)=>D(o,s,r,n)),ne=(e,t,r,n)=>C(e,t,r,(o,s)=>se(o)??
35
+ D(o,s,r,n)),C=(e,t,r,n)=>{if(mr(e))return null;if(!cr(e))return n(e,t);let o=rr(
36
+ e,r);return o?n(o,t):null},se=e=>lr(e)?pr(e):null,D=(e,t,r,n)=>ur(e)?ar(e.elements,
37
+ t,r,(o,s)=>se(o)??D(o,s,r,n)):ir(e)?te(e,r):tr(e)?X(e)?te(e,r):(n.push(new M(e.name,
38
+ e.file)),null):(n.push(new H(t.file)),null),ar=(e,t,r,n)=>{let o=[];for(let s of e){
39
+ let p=C(s,t,r,n);p&&o.push(p)}return o.length?nr({elements:o}):null},te=(e,t)=>{
40
+ let r=sr(e,t);return r&&or(r)?r:null};import{isTypeObject as yr,isTypeReference as Tr,isTypeUndefined as gr,isTypeUnion as Hr}from"@ez4/reflection";
41
+ import{createUnionSchema as Mr,getObjectSchema as br,isObjectSchema as hr}from"@ez4/schema/library";
42
+ import{getReferenceType as Sr,isModelDeclaration as xr}from"@ez4/common/library";import{IncorrectTypeError as fr,InvalidTypeError as dr}from"@ez4/common/library";
43
+ var b=class extends dr{constructor(t){super("Invalid identity",void 0,"Http.Iden\
44
+ tity",t)}},h=class extends fr{constructor(r,n){super("Incorrect identity",r,"Htt\
45
+ p.Identity",n);this.identityType=r}};var m=(e,t,r,n)=>{if(gr(e))return null;if(!Tr(e))return pe(e,t,r,n);let o=Sr(e,r);
46
+ return o?pe(o,t,r,n):null},pe=(e,t,r,n)=>{if(Hr(e))return Ar(e.elements,t,r,n);if(yr(
47
+ e))return ie(e,r);if(!xr(e))return n.push(new b(t.file)),null;if(!Y(e))return n.
48
+ push(new h(e.name,t.file)),null;let o=ie(e,r);return o&&(o.definitions={...o.definitions,
49
+ extensible:!0}),o},Ar=(e,t,r,n)=>{let o=[];for(let s of e){let p=m(s,t,r,n);p&&o.
50
+ push(p)}return o.length>1?Mr({elements:o}):o[0]},ie=(e,t)=>{let r=br(e,t);return r&&
51
+ hr(r)?r:null};import{getReferenceType as Rr,isModelDeclaration as Er}from"@ez4/common/library";
52
+ import{getObjectSchema as jr,isObjectSchema as Or}from"@ez4/schema/library";import{
53
+ isTypeObject as Pr,isTypeReference as wr}from"@ez4/reflection";import{IncorrectTypeError as Ir,InvalidTypeError as vr}from"@ez4/common/library";
54
+ var S=class extends vr{constructor(t){super("Invalid headers",void 0,"Http.Heade\
55
+ rs",t)}},x=class extends Ir{constructor(r,n){super("Incorrect headers",r,"Http.H\
56
+ eaders",n);this.headersType=r}};var A=(e,t,r,n)=>{if(!wr(e))return ce(e,t,r,n);let o=Rr(e,r);return o?ce(o,t,r,n):
57
+ null},ce=(e,t,r,n)=>Pr(e)?le(e,r):Er(e)?G(e)?le(e,r):(n.push(new x(e.name,t.file)),
58
+ null):(n.push(new S(t.file)),null),le=(e,t)=>{let r=jr(e,t);return r&&Or(r)?r:null};var ae=(e,t,r,n)=>{let o=de(e,t,r,n,"Http.AuthResponse");return o&&Jr(o)?o:null},
59
+ fe=(e,t,r,n)=>{let o=de(e,t,r,n,"Http.Response");return o&&Gr(o)?o:null},de=(e,t,r,n,o)=>{
60
+ if(!Nr(e))return me(e,t,r,n,o);let s=Ur(e,r);return s?me(s,t,r,n,o):null},Jr=e=>!!e.
61
+ identity,Gr=e=>Qr(e.status),me=(e,t,r,n,o)=>Fr(e)?ue(e,t,Dr(e),r,n):kr(e)?qr(e,o)?
62
+ ue(e,t,Cr(e),r,n):(n.push(new g(e.name,o,e.file)),null):(n.push(new T(o,t.file)),
63
+ null),ue=(e,t,r,n,o)=>{let s={};for(let p of r)if(!(!Vr(p)||p.inherited))switch(p.
64
+ name){default:o.push(new zr(t.name,p.name,e.file));break;case"status":s.status=Br(
65
+ p);break;case"headers":{s.headers=A(p.value,e,n,o),s.headers&&p.description&&(s.
66
+ headers.description=p.description);break}case"identity":{s.identity=m(p.value,e,
67
+ n,o),s.identity&&p.description&&(s.identity.description=p.description);break}case"\
68
+ body":{s.body=ne(p.value,e,n,o),s.body&&p.description&&(s.body.description=p.description);
69
+ break}}return s};import{InvalidServicePropertyError as mt,isModelDeclaration as ut,hasHeritageType as at,
70
+ getModelMembers as ft,getObjectMembers as dt,getReferenceType as yt}from"@ez4/common/library";
71
+ import{isModelProperty as Tt,isTypeObject as gt,isTypeReference as Ht}from"@ez4/reflection";import{IncorrectTypeError as Yr,InvalidTypeError as Kr}from"@ez4/common/library";
72
+ var I=class extends Kr{constructor(r,n){super("Invalid route request",void 0,r,n);
73
+ this.baseType=r}},v=class extends Yr{constructor(r,n,o){super("Incorrect route r\
74
+ equest",r,n,o);this.requestType=r;this.baseType=n}};import{getReferenceType as Zr,isModelDeclaration as _r}from"@ez4/common/library";
75
+ import{getObjectSchema as $r,isObjectSchema as Lr}from"@ez4/schema/library";import{
76
+ isTypeObject as et,isTypeReference as rt}from"@ez4/reflection";import{IncorrectTypeError as Wr,InvalidTypeError as Xr}from"@ez4/common/library";
77
+ var R=class extends Xr{constructor(t){super("Invalid request parameters",void 0,
78
+ "Http.PathParameters",t)}},E=class extends Wr{constructor(r,n){super("Incorrect \
79
+ request parameters",r,"Http.PathParameters",n);this.parametersType=r}};var ge=(e,t,r,n)=>{if(!rt(e))return ye(e,t,r,n);let o=Zr(e,r);return o?ye(o,t,r,
80
+ n):null},ye=(e,t,r,n)=>et(e)?Te(e,r):_r(e)?W(e)?Te(e,r):(n.push(new E(e.name,e.file)),
81
+ null):(n.push(new R(t.file)),null),Te=(e,t)=>{let r=$r(e,t);return r&&Lr(r)?r:null};import{getReferenceType as nt,isModelDeclaration as st}from"@ez4/common/library";
82
+ import{getObjectSchema as pt,isObjectSchema as it}from"@ez4/schema/library";import{
83
+ isTypeObject as ct,isTypeReference as lt}from"@ez4/reflection";import{IncorrectTypeError as tt,InvalidTypeError as ot}from"@ez4/common/library";
84
+ var j=class extends ot{constructor(t){super("Invalid request query strings",void 0,
85
+ "Http.QueryStrings",t)}},O=class extends tt{constructor(r,n){super("Incorrect re\
86
+ quest query strings",r,"Http.QueryStrings",n);this.queryType=r}};var be=(e,t,r,n)=>{if(!lt(e))return He(e,t,r,n);let o=nt(e,r);return o?He(o,t,r,
87
+ n):null},He=(e,t,r,n)=>ct(e)?Me(e,r):st(e)?K(e)?Me(e,r):(n.push(new O(e.name,t.file)),
88
+ null):(n.push(new j(t.file)),null),Me=(e,t)=>{let r=pt(e,t);return r&&it(r)?r:null};var xe=(e,t,r,n)=>Ie(e,t,r,n,"Http.AuthRequest"),Ae=(e,t,r,n)=>Ie(e,t,r,n,"Http.\
89
+ Request"),Ie=(e,t,r,n,o)=>{if(!Ht(e))return he(e,t,r,n,o);let s=yt(e,r);return s?
90
+ he(s,t,r,n,o):null},he=(e,t,r,n,o)=>gt(e)?Se(e,t,dt(e),r,n):ut(e)?at(e,o)?Se(e,t,
91
+ ft(e),r,n):(n.push(new v(e.name,o,e.file)),null):(n.push(new I(o,t.file)),null),
92
+ Se=(e,t,r,n,o)=>{let s={};for(let p of r)if(!(!Tt(p)||p.inherited))switch(p.name){default:
93
+ o.push(new mt(t.name,p.name,e.file));break;case"headers":{s.headers=A(p.value,e,
94
+ n,o),s.headers&&p.description&&(s.headers.description=p.description);break}case"\
95
+ identity":{s.identity=m(p.value,e,n,o),s.identity&&p.description&&(s.identity.description=
96
+ p.description);break}case"query":{s.query=be(p.value,e,n,o),s.query&&p.description&&
97
+ (s.query.description=p.description);break}case"parameters":{s.parameters=ge(p.value,
98
+ e,n,o),s.parameters&&p.description&&(s.parameters.description=p.description);break}case"\
99
+ body":{s.body=oe(p.value,e,n,o),s.body&&p.description&&(s.body.description=p.description);
100
+ break}}return s};var ve=(e,t,r,n)=>{if(!_(e))return null;let o={},s=new Set(["name","file"]);if(e.
101
+ description&&(o.description=e.description),(o.name=e.name)&&s.delete("name"),(o.
102
+ file=e.file)&&s.delete("file"),e.parameters){let[{value:p}]=e.parameters;o.request=
103
+ xe(p,t,r,n)}return e.return&&(o.response=ae(e.return,t,r,n)),Mt(o)?o:(n.push(new y(
104
+ [...s],e.file)),null)},Mt=e=>!!e.name&&!!e.file;import{IncompleteTypeError as bt}from"@ez4/common/library";var P=class extends bt{constructor(t,r){
105
+ super("Incomplete route handler",t,r)}};var Re=(e,t,r,n)=>{if(!$(e))return null;let o={},s=new Set(["name","file","respo\
106
+ nse"]);if(e.description&&(o.description=e.description),(o.name=e.name)&&s.delete(
107
+ "name"),(o.file=e.file)&&s.delete("file"),e.parameters){let[{value:p}]=e.parameters;
108
+ o.request=Ae(p,t,r,n)}if(e.return){let p=fe(e.return,t,r,n);p&&(o.response=p,s.delete(
109
+ "response"))}return ht(o)?o:(n.push(new P([...s],e.file)),null)},ht=e=>!!e.name&&
110
+ !!e.file&&!!e.response;var Oe=(e,t,r,n)=>{if(!At(e))return Ee(e,t,r,n);let o=zt(e,r);return o?Ee(o,t,r,
111
+ n):null},kt=e=>!!e.path&&!!e.handler,Ee=(e,t,r,n)=>Q(e)?je(e,t,Pt(e),r,n):xt(e)?
112
+ je(e,t,Ot(e),r,n):null,je=(e,t,r,n,o)=>{let s={},p=new Set(["path","handler"]);for(let i of r)
113
+ if(!(!St(i)||i.inherited))switch(i.name){default:o.push(new It(t.name,i.name,e.file));
114
+ break;case"path":{let c=jt(i);c&&F(c)&&(p.delete(i.name),s.path=c);break}case"ha\
115
+ ndler":(s.handler=Re(i.value,t,n,o))&&p.delete(i.name);break;case"timeout":case"\
116
+ memory":s[i.name]=Et(i);break;case"cors":s.cors=Rt(i);break;case"authorizer":s.authorizer=
117
+ ve(i.value,t,n,o);break;case"listener":s.listener=wt(i.value,o);break;case"varia\
118
+ bles":s.variables=vt(i,o);break}return kt(s)?s:(o.push(new d([...p],e.file)),null)};import{InvalidServicePropertyError as Bt,isModelDeclaration as Ut,getLiteralString as Vt,
119
+ getModelMembers as Ft,getObjectMembers as Nt,getPropertyBoolean as Qt,getPropertyNumber as Jt,
120
+ getPropertyTuple as Gt,getReferenceType as Yt}from"@ez4/common/library";import{isModelProperty as Kt,
121
+ isTypeObject as Wt,isTypeReference as Xt}from"@ez4/reflection";import{IncompleteTypeError as qt,IncorrectTypeError as Ct,InvalidTypeError as Dt}from"@ez4/common/library";
122
+ var w=class extends qt{constructor(t,r){super("Incomplete HTTP CORS",t,r)}},z=class extends Dt{constructor(t){
123
+ super("Invalid HTTP CORS type",void 0,"Http.Cors",t)}},k=class extends Ct{constructor(r,n){
124
+ super("Incorrect HTTP CORS type",r,"Http.Cors",n);this.fallbackType=r}};var ze=(e,t,r,n)=>{if(!Xt(e))return Pe(e,t,n);let o=Yt(e,r);return o?Pe(o,t,n):null},
125
+ Zt=e=>!!e.allowOrigins?.length,Pe=(e,t,r)=>Wt(e)?we(e,t,Nt(e),r):Ut(e)?Z(e)?we(e,
126
+ t,Ft(e),r):(r.push(new k(e.name,e.file)),null):(r.push(new z(t.file)),null),we=(e,t,r,n)=>{
127
+ let o={},s=new Set(["allowOrigins"]);for(let p of r)if(!(!Kt(p)||p.inherited))switch(p.
128
+ name){default:n.push(new Bt(t.name,p.name,e.file));break;case"allowOrigins":case"\
129
+ allowMethods":case"allowHeaders":case"exposeHeaders":o[p.name]=_t(p);break;case"\
130
+ allowCredentials":o.allowCredentials=Qt(p);break;case"maxAge":o.maxAge=Jt(p);break}
131
+ return Zt(o)?o:(n.push(new w([...s],e.file)),null)},_t=e=>{let t=Gt(e)??[],r=[];
132
+ for(let n of t){let o=Vt(n);o&&r.push(o)}return r};var ke=e=>{let t={},r=[];for(let n in e){let o=e[n];if(!N(o)||Lt(o))continue;let s={
133
+ type:q,extras:{}},p=new Set(["routes"]),i=o.file;s.name=o.name,o.description&&(s.
134
+ description=o.description);for(let c of to(o))if(!(!po(c)||c.inherited))switch(c.
135
+ name){default:r.push(new so(s.name,c.name,i));break;case"routes":(s.routes=co(o,
136
+ c,e,r))&&p.delete(c.name);break;case"name":s.displayName=oo(c);break;case"defaul\
137
+ ts":s.defaults=re(c.value,o,e,r);break;case"cors":s.cors=ze(c.value,o,e,r);break;case"\
138
+ variables":s.variables=ro(c,r);break;case"services":s.services=eo(c,e,r);break}if(!io(
139
+ s)){r.push(new u([...p],i));continue}if(t[o.name]){r.push(new $t(o.name,i));continue}
140
+ t[o.name]=s}return{services:t,errors:r}},io=e=>!!e.name&&!!e.routes&&!!e.extras,
141
+ co=(e,t,r,n)=>{let o=no(t)??[],s=[];for(let p of o){let i=Oe(p,e,r,n);i&&s.push(
142
+ i)}return s};var qe=!1,As=()=>{qe||(lo(),mo(),uo("@ez4/gateway",{"metadata:getServices":ke}),
143
+ qe=!1)};import{IncorrectTypeError as ao,InvalidTypeError as fo}from"@ez4/common/library";
144
+ var a=class extends fo{constructor(t){super("Invalid defaults",void 0,"Http.Defa\
145
+ ults",t)}},f=class extends ao{constructor(r,n){super("Incorrect defaults",r,"Htt\
146
+ p.Defaults",n);this.defaultsType=r}};export{y as IncompleteAuthorizerError,w as IncompleteCorsError,P as IncompleteHandlerError,
147
+ d as IncompleteRouteError,u as IncompleteServiceError,M as IncorrectBodyTypeError,
148
+ k as IncorrectCorsTypeError,f as IncorrectDefaultsTypeError,x as IncorrectHeadersTypeError,
149
+ h as IncorrectIdentityTypeError,E as IncorrectParameterTypeError,O as IncorrectQueryTypeError,
150
+ v as IncorrectRequestTypeError,g as IncorrectResponseTypeError,H as InvalidBodyTypeError,
151
+ z as InvalidCorsTypeError,a as InvalidDefaultsTypeError,S as InvalidHeadersTypeError,
152
+ b as InvalidIdentityTypeError,R as InvalidParameterTypeError,j as InvalidQueryTypeError,
153
+ I as InvalidRequestTypeError,T as InvalidResponseTypeError,q as ServiceType,xe as getHttpAuthRequest,
154
+ ae as getHttpAuthResponse,ve as getHttpAuthorizer,ze as getHttpCors,Re as getHttpHandler,
155
+ Ae as getHttpHandlerRequest,fe as getHttpHandlerResponse,A as getHttpHeaders,m as getHttpIdentity,
156
+ ge as getHttpParameters,be as getHttpQuery,oe as getHttpRequestBody,ne as getHttpResponseBody,
157
+ Oe as getHttpRoute,ke as getHttpServices,yo as isHttpService,As as registerTriggers};
@@ -1,3 +1,3 @@
1
- import type { AllType, SourceMap } from '@ez4/reflection';
1
+ import type { AllType, SourceMap, TypeModel } from '@ez4/reflection';
2
2
  import type { HttpAuthorizer } from '../types/common.js';
3
- export declare const getHttpAuthorizer: (type: AllType, reflection: SourceMap, errorList: Error[]) => HttpAuthorizer | null;
3
+ export declare const getHttpAuthorizer: (type: AllType, parent: TypeModel, reflection: SourceMap, errorList: Error[]) => HttpAuthorizer | null;
@@ -2,5 +2,5 @@ import type { AllType, SourceMap, TypeModel, TypeObject } from '@ez4/reflection'
2
2
  import type { ObjectSchema, UnionSchema } from '@ez4/schema/library';
3
3
  type TypeParent = TypeObject | TypeModel;
4
4
  export declare const getHttpRequestBody: (type: AllType, parent: TypeParent, reflection: SourceMap, errorList: Error[]) => ObjectSchema | UnionSchema | null;
5
- export declare const getHttpResponseBody: (type: AllType, parent: TypeParent, reflection: SourceMap, errorList: Error[]) => ObjectSchema | UnionSchema | import("@ez4/schema/library").NumberSchema | import("@ez4/schema/library").StringSchema | import("@ez4/schema/library").BooleanSchema | null;
5
+ export declare const getHttpResponseBody: (type: AllType, parent: TypeParent, reflection: SourceMap, errorList: Error[]) => ObjectSchema | UnionSchema | import("@ez4/schema/library").BooleanSchema | import("@ez4/schema/library").NumberSchema | import("@ez4/schema/library").StringSchema | null;
6
6
  export {};
@@ -1,5 +1,3 @@
1
- import type { AllType, SourceMap, TypeModel, TypeObject } from '@ez4/reflection';
1
+ import type { AllType, SourceMap, TypeModel } from '@ez4/reflection';
2
2
  import type { HttpCors } from '../types/common.js';
3
- type TypeParent = TypeModel | TypeObject;
4
- export declare const getHttpCors: (type: AllType, parent: TypeParent, reflection: SourceMap, errorList: Error[]) => HttpCors | null;
5
- export {};
3
+ export declare const getHttpCors: (type: AllType, parent: TypeModel, reflection: SourceMap, errorList: Error[]) => HttpCors | null;
@@ -1,3 +1,3 @@
1
- import type { AllType, SourceMap, TypeModel, TypeObject } from '@ez4/reflection';
1
+ import type { AllType, SourceMap, TypeModel } from '@ez4/reflection';
2
2
  import type { HttpDefaults } from '../types/common.js';
3
- export declare const getHttpDefaults: (type: AllType, parent: TypeObject | TypeModel, reflection: SourceMap, errorList: Error[]) => HttpDefaults | null;
3
+ export declare const getHttpDefaults: (type: AllType, parent: TypeModel, reflection: SourceMap, errorList: Error[]) => HttpDefaults | null;
@@ -1,3 +1,3 @@
1
- import type { AllType, SourceMap } from '@ez4/reflection';
1
+ import type { AllType, SourceMap, TypeModel } from '@ez4/reflection';
2
2
  import type { HttpHandler } from '../types/common.js';
3
- export declare const getHttpHandler: (type: AllType, reflection: SourceMap, errorList: Error[]) => HttpHandler | null;
3
+ export declare const getHttpHandler: (type: AllType, parent: TypeModel, reflection: SourceMap, errorList: Error[]) => HttpHandler | null;
@@ -1,6 +1,4 @@
1
+ import type { AllType, SourceMap, TypeModel } from '@ez4/reflection';
1
2
  import type { HttpAuthRequest, HttpRequest } from '../types/common.js';
2
- import type { AllType, SourceMap, TypeCallback, TypeFunction, TypeModel } from '@ez4/reflection';
3
- type TypeParent = TypeModel | TypeCallback | TypeFunction;
4
- export declare const getHttpAuthRequest: (type: AllType, parent: TypeParent, reflection: SourceMap, errorList: Error[]) => (HttpAuthRequest & HttpRequest) | null;
5
- export declare const getHttpHandlerRequest: (type: AllType, parent: TypeParent, reflection: SourceMap, errorList: Error[]) => (HttpAuthRequest & HttpRequest) | null;
6
- export {};
3
+ export declare const getHttpAuthRequest: (type: AllType, parent: TypeModel, reflection: SourceMap, errorList: Error[]) => (HttpAuthRequest & HttpRequest) | null;
4
+ export declare const getHttpHandlerRequest: (type: AllType, parent: TypeModel, reflection: SourceMap, errorList: Error[]) => (HttpAuthRequest & HttpRequest) | null;
@@ -1,7 +1,5 @@
1
+ import type { AllType, SourceMap, TypeModel } from '@ez4/reflection';
1
2
  import type { Incomplete } from '@ez4/utils';
2
3
  import type { HttpAuthResponse, HttpResponse } from '../types/common.js';
3
- import type { AllType, SourceMap, TypeCallback, TypeFunction, TypeModel } from '@ez4/reflection';
4
- type TypeParent = TypeModel | TypeCallback | TypeFunction;
5
- export declare const getHttpAuthResponse: (type: AllType, parent: TypeParent, reflection: SourceMap, errorList: Error[]) => Incomplete<HttpAuthResponse & HttpResponse> | null;
6
- export declare const getHttpHandlerResponse: (type: AllType, parent: TypeParent, reflection: SourceMap, errorList: Error[]) => HttpResponse | null;
7
- export {};
4
+ export declare const getHttpAuthResponse: (type: AllType, parent: TypeModel, reflection: SourceMap, errorList: Error[]) => Incomplete<HttpAuthResponse & HttpResponse> | null;
5
+ export declare const getHttpHandlerResponse: (type: AllType, parent: TypeModel, reflection: SourceMap, errorList: Error[]) => HttpResponse | null;
@@ -1,3 +1,3 @@
1
- import type { AllType, SourceMap } from '@ez4/reflection';
1
+ import type { AllType, SourceMap, TypeModel } from '@ez4/reflection';
2
2
  import type { HttpRoute } from '../types/common.js';
3
- export declare const getHttpRoute: (type: AllType, reflection: SourceMap, errorList: Error[]) => HttpRoute | null;
3
+ export declare const getHttpRoute: (type: AllType, parent: TypeModel, reflection: SourceMap, errorList: Error[]) => HttpRoute | null;
@@ -48,9 +48,9 @@ export type HttpRoute = {
48
48
  cors?: boolean;
49
49
  };
50
50
  export type HttpDefaults = {
51
- listener?: ServiceListener;
52
- timeout?: number;
53
- memory?: number;
51
+ listener?: ServiceListener | null;
52
+ timeout?: number | null;
53
+ memory?: number | null;
54
54
  };
55
55
  export type HttpCors = {
56
56
  allowOrigins: string[];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ez4/gateway",
3
3
  "description": "EZ4: Components to build gateway services",
4
- "version": "0.15.0",
4
+ "version": "0.16.0",
5
5
  "author": "Silas B.",
6
6
  "license": "MIT",
7
7
  "type": "module",
@@ -14,7 +14,7 @@
14
14
  "directory": "packages/gateway"
15
15
  },
16
16
  "engines": {
17
- "node": ">=20.15.0"
17
+ "node": ">=22.3.0"
18
18
  },
19
19
  "exports": {
20
20
  ".": {
@@ -42,10 +42,10 @@
42
42
  "live:publish": "npm run test && npm publish --access public"
43
43
  },
44
44
  "dependencies": {
45
- "@ez4/common": "^0.15.0",
46
- "@ez4/project": "^0.15.0",
47
- "@ez4/reflection": "^0.15.0",
48
- "@ez4/schema": "^0.15.0",
49
- "@ez4/utils": "^0.15.0"
45
+ "@ez4/common": "^0.16.0",
46
+ "@ez4/project": "^0.16.0",
47
+ "@ez4/reflection": "^0.16.0",
48
+ "@ez4/schema": "^0.16.0",
49
+ "@ez4/utils": "^0.16.0"
50
50
  }
51
51
  }
@@ -1,3 +0,0 @@
1
- import type { AllType } from '@ez4/reflection';
2
- import type { HttpHandler } from '../types/common.js';
3
- export declare const getHttpCatcher: (type: AllType, errorList: Error[]) => HttpHandler | null;
@@ -1,29 +0,0 @@
1
- /**
2
- * HTTP CORS configuration.
3
- */
4
- export interface HttpCors {
5
- /**
6
- * List of allowed origins.
7
- */
8
- allowOrigins: string[];
9
- /**
10
- * List of allowed methods.
11
- */
12
- allowMethods?: string[];
13
- /**
14
- * Determines whether or not requests can be made with credentials.
15
- */
16
- allowCredentials?: boolean;
17
- /**
18
- * List of allowed headers.
19
- */
20
- allowHeaders?: string[];
21
- /**
22
- * List of exposed headers.
23
- */
24
- exposeHeaders?: string[];
25
- /**
26
- * Determines how long the preflight result can be cached.
27
- */
28
- maxAge?: number;
29
- }
@@ -1,7 +0,0 @@
1
- import type { ArrayRest, IsArrayEmpty, IsAny } from '@ez4/utils';
2
- import type { Http } from './http.js';
3
- /**
4
- * Given an array of requests `T` and a union of responses `U`, it returns a union of
5
- * `Http.Route` for each request.
6
- */
7
- export type RouteTypes<T extends Http.Request[]> = IsAny<T> extends true ? any : IsArrayEmpty<T> extends true ? Http.Route<Http.Request> : Http.Route<T[0]> | RouteTypes<ArrayRest<T>>;