@ez4/gateway 0.18.0 → 0.20.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,176 +1,183 @@
1
- import{registerTriggers as zo}from"@ez4/common/library";import{registerTriggers as Co}from"@ez4/schema/library";
2
- import{createTrigger as ko}from"@ez4/project/library";import{DuplicateServiceError as Io,isExternalStatement as vo,getLinkedServiceList as Ao,
3
- getLinkedVariableList as Ro,getModelMembers as Eo,getPropertyString as jo,InvalidServicePropertyError as Oo}from"@ez4/common/library";
4
- import{isModelProperty as wo}from"@ez4/reflection";var B="@ez4/http",Bo=e=>e.type===B;import{IncompleteTypeError as Je}from"@ez4/common/library";var u=class extends Je{constructor(t,r){
5
- super("Incomplete service",t,r)}};import{InvalidServicePropertyError as We,isModelDeclaration as Xe,getPropertyNumber as Ze,
6
- getObjectMembers as _e,getModelMembers as $e,getServiceListener as Le,getReferenceType as er}from"@ez4/common/library";
7
- import{isModelProperty as rr,isTypeObject as tr,isTypeReference as or}from"@ez4/reflection";import{hasHeritageType as l,isClassDeclaration as Ge,isModelDeclaration as Ye}from"@ez4/common/library";
8
- import{isTypeCallback as N,isTypeFunction as V}from"@ez4/reflection";var Ke=new Set(
9
- ["ANY","GET","POST","PUT","PATCH","DELETE","OPTIONS"]),Q=e=>{let[t]=e.split(" ",
10
- 2);return Ke.has(t)},J=e=>Ge(e)&&l(e,"Http.Service"),G=e=>Ye(e)&&l(e,"Http.Route");var Y=e=>l(e,"Http.Defaults"),K=e=>l(e,"Http.Headers"),W=e=>l(e,"Http.Identity"),
11
- X=e=>l(e,"Http.QueryStrings"),Z=e=>l(e,"Http.PathParameters"),_=e=>l(e,"Http.Jso\
12
- nBody"),$=e=>l(e,"Http.Cors"),L=e=>l(e,"Http.Cache"),ee=e=>N(e)||V(e),re=e=>N(e)||
13
- V(e);var ne=(e,t,r,n)=>{if(!or(e))return te(e,t,n);let o=er(e,r);return o?te(o,t,n):null},
14
- te=(e,t,r)=>tr(e)?oe(t,_e(e),r):Xe(e)?Y(e)?oe(t,$e(e),r):(r.push(new f(e.name,t.
15
- file)),null):(r.push(new a(t.file)),null),oe=(e,t,r)=>{let n={};for(let o of t)if(!(!rr(
16
- o)||o.inherited))switch(o.name){default:r.push(new We(e.name,o.name,e.file));break;case"\
17
- memory":case"timeout":case"retention":n[o.name]=Ze(o);break;case"listener":n.listener=
18
- Le(o.value,r);break}return n};import{isModelProperty as wt,isTypeObject as Pt,isTypeReference as zt,isTypeTuple as Ct}from"@ez4/reflection";
19
- import{InvalidServicePropertyError as kt,getLinkedVariableList as qt,getPropertyBoolean as Dt,
20
- getPropertyNumber as Bt,getPropertyString as Ft,getObjectMembers as Ut,getModelMembers as Nt,
21
- getServiceListener as Vt,getReferenceType as Qt,getPropertyTuple as Jt}from"@ez4/common/library";import{IncompleteTypeError as nr}from"@ez4/common/library";var d=class extends nr{constructor(t,r){
22
- super("Incomplete gateway route",t,r)}};import{IncompleteTypeError as pr}from"@ez4/common/library";var y=class extends pr{constructor(t,r){
23
- super("Incomplete route authorizer",t,r)}};import{InvalidServicePropertyError as Vr,isModelDeclaration as Qr,hasHeritageType as Jr,
24
- getModelMembers as Gr,getObjectMembers as Yr,getPropertyNumber as Kr,getReferenceType as Wr}from"@ez4/common/library";
25
- import{isModelProperty as Xr,isTypeObject as Zr,isTypeReference as _r}from"@ez4/reflection";
26
- import{isAnyNumber as $r}from"@ez4/utils";import{IncorrectTypeError as sr,InvalidTypeError as ir}from"@ez4/common/library";
27
- var T=class extends ir{constructor(r,n){super("Invalid route response",void 0,r,
28
- n);this.baseType=r}},g=class extends sr{constructor(r,n,o){super("Incorrect rout\
29
- e response",r,n,o);this.responseType=r;this.baseType=n}};import{getReferenceType as mr,isModelDeclaration as ur}from"@ez4/common/library";
30
- import{isObjectSchema as ar,createUnionSchema as fr,getObjectSchema as dr,getScalarSchema as yr}from"@ez4/schema/library";
31
- import{isTypeObject as Tr,isTypeReference as gr,isTypeScalar as Mr,isTypeUndefined as Hr,
32
- isTypeUnion as hr}from"@ez4/reflection";import{IncorrectTypeError as cr,InvalidTypeError as lr}from"@ez4/common/library";
33
- var M=class extends lr{constructor(t){super("Invalid body",void 0,"Http.JsonBody",
34
- t)}},H=class extends cr{constructor(r,n){super("Incorrect body",r,"Http.JsonBody",
35
- n);this.bodyType=r}};var se=(e,t,r,n)=>F(e,t,r,(o,p)=>U(o,p,r,n)),ie=(e,t,r,n)=>F(e,t,r,(o,p)=>ce(o)??
36
- U(o,p,r,n)),F=(e,t,r,n)=>{if(Hr(e))return null;if(!gr(e))return n(e,t);let o=mr(
37
- e,r);return o?n(o,t):null},ce=e=>Mr(e)?yr(e):null,U=(e,t,r,n)=>hr(e)?br(e.elements,
38
- t,r,(o,p)=>ce(o)??U(o,p,r,n)):Tr(e)?pe(e,r):ur(e)?_(e)?pe(e,r):(n.push(new H(e.name,
39
- e.file)),null):(n.push(new M(t.file)),null),br=(e,t,r,n)=>{let o=[];for(let p of e){
40
- let s=F(p,t,r,n);s&&o.push(s)}return o.length?fr({elements:o}):null},pe=(e,t)=>{
41
- let r=dr(e,t);return r&&ar(r)?r:null};import{isTypeObject as Ir,isTypeReference as vr,isTypeUndefined as Ar,isTypeUnion as Rr}from"@ez4/reflection";
42
- import{createUnionSchema as Er,getObjectSchema as jr,isObjectSchema as Or}from"@ez4/schema/library";
43
- import{getReferenceType as wr,isModelDeclaration as Pr}from"@ez4/common/library";import{IncorrectTypeError as Sr,InvalidTypeError as xr}from"@ez4/common/library";
44
- var h=class extends xr{constructor(t){super("Invalid identity",void 0,"Http.Iden\
45
- tity",t)}},b=class extends Sr{constructor(r,n){super("Incorrect identity",r,"Htt\
46
- p.Identity",n);this.identityType=r}};var m=(e,t,r,n)=>{if(Ar(e))return null;if(!vr(e))return le(e,t,r,n);let o=wr(e,r);
47
- return o?le(o,t,r,n):null},le=(e,t,r,n)=>{if(Rr(e))return zr(e.elements,t,r,n);if(Ir(
48
- e))return me(e,r);if(!Pr(e))return n.push(new h(t.file)),null;if(!W(e))return n.
49
- push(new b(e.name,t.file)),null;let o=me(e,r);return o&&(o.definitions={...o.definitions,
50
- extensible:!0}),o},zr=(e,t,r,n)=>{let o=[];for(let p of e){let s=m(p,t,r,n);s&&o.
51
- push(s)}return o.length>1?Er({elements:o}):o[0]},me=(e,t)=>{let r=jr(e,t);return r&&
52
- Or(r)?r:null};import{getReferenceType as qr,isModelDeclaration as Dr}from"@ez4/common/library";
53
- import{getObjectSchema as Br,isObjectSchema as Fr}from"@ez4/schema/library";import{
54
- isTypeObject as Ur,isTypeReference as Nr}from"@ez4/reflection";import{IncorrectTypeError as Cr,InvalidTypeError as kr}from"@ez4/common/library";
55
- var S=class extends kr{constructor(t){super("Invalid headers",void 0,"Http.Heade\
56
- rs",t)}},x=class extends Cr{constructor(r,n){super("Incorrect headers",r,"Http.H\
57
- eaders",n);this.headersType=r}};var I=(e,t,r,n)=>{if(!Nr(e))return ue(e,t,r,n);let o=qr(e,r);return o?ue(o,t,r,n):
58
- null},ue=(e,t,r,n)=>Ur(e)?ae(e,r):Dr(e)?K(e)?ae(e,r):(n.push(new x(e.name,t.file)),
59
- null):(n.push(new S(t.file)),null),ae=(e,t)=>{let r=Br(e,t);return r&&Fr(r)?r:null};var ye=(e,t,r,n)=>{let o=ge(e,t,r,n,"Http.AuthResponse");return o&&Lr(o)?o:null},
60
- Te=(e,t,r,n)=>{let o=ge(e,t,r,n,"Http.Response");return o&&et(o)?o:null},ge=(e,t,r,n,o)=>{
61
- if(!_r(e))return fe(e,t,r,n,o);let p=Wr(e,r);return p?fe(p,t,r,n,o):null},Lr=e=>!!e.
62
- identity,et=e=>$r(e.status),fe=(e,t,r,n,o)=>Zr(e)?de(e,t,Yr(e),r,n):Qr(e)?Jr(e,o)?
63
- de(e,t,Gr(e),r,n):(n.push(new g(e.name,o,e.file)),null):(n.push(new T(o,t.file)),
64
- null),de=(e,t,r,n,o)=>{let p={};for(let s of r)if(!(!Xr(s)||s.inherited))switch(s.
65
- name){default:o.push(new Vr(t.name,s.name,e.file));break;case"status":p.status=Kr(
66
- s);break;case"headers":{p.headers=I(s.value,e,n,o),p.headers&&s.description&&(p.
67
- headers.description=s.description);break}case"identity":{p.identity=m(s.value,e,
68
- n,o),p.identity&&s.description&&(p.identity.description=s.description);break}case"\
69
- body":{p.body=ie(s.value,e,n,o),p.body&&s.description&&(p.body.description=s.description);
70
- break}}return p};import{InvalidServicePropertyError as Ht,isModelDeclaration as ht,hasHeritageType as bt,
71
- getModelMembers as St,getObjectMembers as xt,getReferenceType as It}from"@ez4/common/library";
72
- import{isModelProperty as vt,isTypeObject as At,isTypeReference as Rt}from"@ez4/reflection";import{IncorrectTypeError as rt,InvalidTypeError as tt}from"@ez4/common/library";
73
- var v=class extends tt{constructor(r,n){super("Invalid route request",void 0,r,n);
74
- this.baseType=r}},A=class extends rt{constructor(r,n,o){super("Incorrect route r\
75
- equest",r,n,o);this.requestType=r;this.baseType=n}};import{getReferenceType as pt,isModelDeclaration as st}from"@ez4/common/library";
76
- import{getObjectSchema as it,isObjectSchema as ct}from"@ez4/schema/library";import{
77
- isTypeObject as lt,isTypeReference as mt}from"@ez4/reflection";import{IncorrectTypeError as ot,InvalidTypeError as nt}from"@ez4/common/library";
78
- var R=class extends nt{constructor(t){super("Invalid request parameters",void 0,
79
- "Http.PathParameters",t)}},E=class extends ot{constructor(r,n){super("Incorrect \
80
- request parameters",r,"Http.PathParameters",n);this.parametersType=r}};var he=(e,t,r,n)=>{if(!mt(e))return Me(e,t,r,n);let o=pt(e,r);return o?Me(o,t,r,
81
- n):null},Me=(e,t,r,n)=>lt(e)?He(e,r):st(e)?Z(e)?He(e,r):(n.push(new E(e.name,e.file)),
82
- null):(n.push(new R(t.file)),null),He=(e,t)=>{let r=it(e,t);return r&&ct(r)?r:null};import{getReferenceType as ft,isModelDeclaration as dt}from"@ez4/common/library";
83
- import{getObjectSchema as yt,isObjectSchema as Tt}from"@ez4/schema/library";import{
84
- isTypeObject as gt,isTypeReference as Mt}from"@ez4/reflection";import{IncorrectTypeError as ut,InvalidTypeError as at}from"@ez4/common/library";
85
- var j=class extends at{constructor(t){super("Invalid request query strings",void 0,
86
- "Http.QueryStrings",t)}},O=class extends ut{constructor(r,n){super("Incorrect re\
87
- quest query strings",r,"Http.QueryStrings",n);this.queryType=r}};var xe=(e,t,r,n)=>{if(!Mt(e))return be(e,t,r,n);let o=ft(e,r);return o?be(o,t,r,
88
- n):null},be=(e,t,r,n)=>gt(e)?Se(e,r):dt(e)?X(e)?Se(e,r):(n.push(new O(e.name,t.file)),
89
- null):(n.push(new j(t.file)),null),Se=(e,t)=>{let r=yt(e,t);return r&&Tt(r)?r:null};var Ae=(e,t,r,n)=>Ee(e,t,r,n,"Http.AuthRequest"),Re=(e,t,r,n)=>Ee(e,t,r,n,"Http.\
90
- Request"),Ee=(e,t,r,n,o)=>{if(!Rt(e))return Ie(e,t,r,n,o);let p=It(e,r);return p?
91
- Ie(p,t,r,n,o):null},Ie=(e,t,r,n,o)=>At(e)?ve(e,t,xt(e),r,n):ht(e)?bt(e,o)?ve(e,t,
92
- St(e),r,n):(n.push(new A(e.name,o,e.file)),null):(n.push(new v(o,t.file)),null),
93
- ve=(e,t,r,n,o)=>{let p={};for(let s of r)if(!(!vt(s)||s.inherited))switch(s.name){default:
94
- o.push(new Ht(t.name,s.name,e.file));break;case"headers":{p.headers=I(s.value,e,
95
- n,o),p.headers&&s.description&&(p.headers.description=s.description);break}case"\
96
- identity":{p.identity=m(s.value,e,n,o),p.identity&&s.description&&(p.identity.description=
97
- s.description);break}case"query":{p.query=xe(s.value,e,n,o),p.query&&s.description&&
98
- (p.query.description=s.description);break}case"parameters":{p.parameters=he(s.value,
99
- e,n,o),p.parameters&&s.description&&(p.parameters.description=s.description);break}case"\
100
- body":{p.body=se(s.value,e,n,o),p.body&&s.description&&(p.body.description=s.description);
101
- break}}return p};var je=(e,t,r,n)=>{if(!ee(e))return null;let o={},p=new Set(["name","file"]);if(e.
102
- description&&(o.description=e.description),(o.name=e.name)&&p.delete("name"),(o.
103
- file=e.file)&&p.delete("file"),e.parameters){let[{value:s}]=e.parameters;o.request=
104
- Ae(s,t,r,n)}return e.return&&(o.response=ye(e.return,t,r,n)),Et(o)?o:(n.push(new y(
105
- [...p],e.file)),null)},Et=e=>!!e.name&&!!e.file;import{IncompleteTypeError as jt}from"@ez4/common/library";var w=class extends jt{constructor(t,r){
106
- super("Incomplete route handler",t,r)}};var Oe=(e,t,r,n)=>{if(!re(e))return null;let o={},p=new Set(["name","file","resp\
107
- onse"]);if(e.description&&(o.description=e.description),(o.name=e.name)&&p.delete(
108
- "name"),(o.file=e.file)&&p.delete("file"),e.parameters){let[{value:s}]=e.parameters;
109
- o.request=Re(s,t,r,n)}if(e.return){let s=Te(e.return,t,r,n);s&&(o.response=s,p.delete(
110
- "response"))}return Ot(o)?o:(n.push(new w([...p],e.file)),null)},Ot=e=>!!e.name&&
111
- !!e.file&&!!e.response;var ze=(e,t,r,n)=>{let o=Jt(t)??[];return Ce(o,e,r,n)},Ce=(e,t,r,n)=>{let o=[];for(let p of e){
112
- let s=Gt(p,t,r,n);Array.isArray(s)?o.push(...s):s&&o.push(s)}return o},Gt=(e,t,r,n)=>{
113
- if(!zt(e))return we(e,t,r,n);let o=Qt(e,r);return o?we(o,t,r,n):null},Yt=e=>!!e.
114
- path&&!!e.handler,we=(e,t,r,n)=>G(e)?Pe(e,t,Nt(e),r,n):Pt(e)?Pe(e,t,Ut(e),r,n):Ct(
115
- e)&&e.spread?Ce(e.elements,t,r,n):null,Pe=(e,t,r,n,o)=>{let p={},s=new Set(["pat\
116
- h","handler"]);for(let i of r)if(!(!wt(i)||i.inherited))switch(i.name){default:o.
117
- push(new kt(t.name,i.name,e.file));break;case"path":{let c=Ft(i);c&&Q(c)&&(s.delete(
118
- i.name),p.path=c);break}case"handler":(p.handler=Oe(i.value,t,n,o))&&s.delete(i.
119
- name);break;case"memory":case"timeout":case"retention":p[i.name]=Bt(i);break;case"\
120
- cors":p.cors=Dt(i);break;case"authorizer":p.authorizer=je(i.value,t,n,o);break;case"\
121
- listener":p.listener=Vt(i.value,o);break;case"variables":p.variables=qt(i,o);break}
122
- return Yt(p)?p:(o.push(new d([...s],e.file)),null)};import{InvalidServicePropertyError as Zt,isModelDeclaration as _t,getLiteralString as $t,
123
- getModelMembers as Lt,getObjectMembers as eo,getPropertyBoolean as ro,getPropertyNumber as to,
124
- getPropertyTuple as oo,getReferenceType as no}from"@ez4/common/library";import{isModelProperty as po,
125
- isTypeObject as so,isTypeReference as io}from"@ez4/reflection";import{IncompleteTypeError as Kt,IncorrectTypeError as Wt,InvalidTypeError as Xt}from"@ez4/common/library";
126
- var P=class extends Kt{constructor(t,r){super("Incomplete HTTP CORS",t,r)}},z=class extends Xt{constructor(t){
127
- super("Invalid HTTP CORS type",void 0,"Http.Cors",t)}},C=class extends Wt{constructor(r,n){
128
- super("Incorrect HTTP CORS type",r,"Http.Cors",n);this.fallbackType=r}};var De=(e,t,r,n)=>{if(!io(e))return ke(e,t,n);let o=no(e,r);return o?ke(o,t,n):null},
129
- co=e=>!!e.allowOrigins?.length,ke=(e,t,r)=>so(e)?qe(e,t,eo(e),r):_t(e)?$(e)?qe(e,
130
- t,Lt(e),r):(r.push(new C(e.name,e.file)),null):(r.push(new z(t.file)),null),qe=(e,t,r,n)=>{
131
- let o={},p=new Set(["allowOrigins"]);for(let s of r)if(!(!po(s)||s.inherited))switch(s.
132
- name){default:n.push(new Zt(t.name,s.name,e.file));break;case"allowOrigins":case"\
133
- allowMethods":case"allowHeaders":case"exposeHeaders":o[s.name]=lo(s);break;case"\
134
- allowCredentials":o.allowCredentials=ro(s);break;case"maxAge":o.maxAge=to(s);break}
135
- return co(o)?o:(n.push(new P([...p],e.file)),null)},lo=e=>{let t=oo(e)??[],r=[];
136
- for(let n of t){let o=$t(n);o&&r.push(o)}return r};import{InvalidServicePropertyError as fo,isModelDeclaration as yo,getModelMembers as To,
137
- getObjectMembers as go,getPropertyNumber as Mo,getReferenceType as Ho}from"@ez4/common/library";
138
- import{isModelProperty as ho,isTypeObject as bo,isTypeReference as So}from"@ez4/reflection";
139
- import{isAnyNumber as Ue}from"@ez4/utils";import{IncompleteTypeError as mo,IncorrectTypeError as uo,InvalidTypeError as ao}from"@ez4/common/library";
140
- var k=class extends mo{constructor(t,r){super("Incomplete gateway cache",t,r)}},
141
- q=class extends ao{constructor(t){super("Invalid gateway cache type",void 0,"Htt\
142
- p.Cache",t)}},D=class extends uo{constructor(r,n){super("Incorrect gateway cache\
143
- type",r,"Http.Cache",n);this.cacheType=r}};var Ne=(e,t,r,n)=>{if(!So(e))return Be(e,t,n);let o=Ho(e,r);return o?Be(o,t,n):null},
144
- xo=e=>Ue(e.authorizerTTL),Be=(e,t,r)=>bo(e)?Fe(e,t,go(e),r):yo(e)?L(e)?Fe(e,t,To(
145
- e),r):(r.push(new D(e.name,e.file)),null):(r.push(new q(t.file)),null),Fe=(e,t,r,n)=>{
146
- let o={},p=new Set(["authorizerTTL"]);for(let s of r)if(!(!ho(s)||s.inherited))switch(s.
147
- name){default:n.push(new fo(t.name,s.name,e.file));break;case"authorizerTTL":{let i=Mo(
148
- s);Ue(i)&&(o[s.name]=i,p.delete(s.name));break}}return xo(o)?o:(n.push(new k([...p],
149
- e.file)),null)};var Ve=e=>{let t={},r=[];for(let n in e){let o=e[n];if(!J(o)||vo(o))continue;let p={
150
- type:B,extras:{}},s=new Set(["routes"]),i=o.file;p.name=o.name,o.description&&(p.
151
- description=o.description);for(let c of Eo(o))if(!(!wo(c)||c.inherited))switch(c.
152
- name){default:r.push(new Oo(p.name,c.name,i));break;case"routes":(p.routes=ze(o,
153
- c,e,r))&&s.delete(c.name);break;case"name":p.displayName=jo(c);break;case"defaul\
154
- ts":p.defaults=ne(c.value,o,e,r);break;case"cors":p.cors=De(c.value,o,e,r);break;case"\
155
- cache":p.cache=Ne(c.value,o,e,r);break;case"variables":p.variables=Ro(c,r);break;case"\
156
- services":p.services=Ao(c,e,r);break}if(!Po(p)){r.push(new u([...s],i));continue}
157
- if(t[o.name]){r.push(new Io(o.name,i));continue}t[o.name]=p}return{services:t,errors:r}},
158
- Po=e=>!!e.name&&!!e.routes&&!!e.extras;var Qe=!1,ts=()=>{Qe||(zo(),Co(),ko("@ez4/gateway",{"metadata:getServices":Ve}),
159
- Qe=!1)};import{IncorrectTypeError as qo,InvalidTypeError as Do}from"@ez4/common/library";
160
- var a=class extends Do{constructor(t){super("Invalid defaults",void 0,"Http.Defa\
161
- ults",t)}},f=class extends qo{constructor(r,n){super("Incorrect defaults",r,"Htt\
162
- p.Defaults",n);this.defaultsType=r}};export{y as IncompleteAuthorizerError,k as IncompleteCacheError,P as IncompleteCorsError,
163
- w as IncompleteHandlerError,d as IncompleteRouteError,u as IncompleteServiceError,
164
- H as IncorrectBodyTypeError,D as IncorrectCacheTypeError,C as IncorrectCorsTypeError,
165
- f as IncorrectDefaultsTypeError,x as IncorrectHeadersTypeError,b as IncorrectIdentityTypeError,
166
- E as IncorrectParameterTypeError,O as IncorrectQueryTypeError,A as IncorrectRequestTypeError,
167
- g as IncorrectResponseTypeError,M as InvalidBodyTypeError,q as InvalidCacheTypeError,
168
- z as InvalidCorsTypeError,a as InvalidDefaultsTypeError,S as InvalidHeadersTypeError,
169
- h as InvalidIdentityTypeError,R as InvalidParameterTypeError,j as InvalidQueryTypeError,
170
- v as InvalidRequestTypeError,T as InvalidResponseTypeError,B as ServiceType,Ae as getHttpAuthRequest,
171
- ye as getHttpAuthResponse,je as getHttpAuthorizer,Ne as getHttpCache,De as getHttpCors,
172
- Oe as getHttpHandler,Re as getHttpHandlerRequest,Te as getHttpHandlerResponse,I as getHttpHeaders,
173
- m as getHttpIdentity,he as getHttpParameters,xe as getHttpQuery,se as getHttpRequestBody,
174
- ie as getHttpResponseBody,ze as getHttpRoutes,Ve as getHttpServices,Bo as isHttpService,
175
- ts as registerTriggers};
1
+ import{registerTriggers as Jo}from"@ez4/common/library";import{registerTriggers as Go}from"@ez4/schema/library";
2
+ import{createTrigger as Yo}from"@ez4/project/library";import{DuplicateServiceError as ko,isExternalDeclaration as qo,getLinkedServiceList as Do,
3
+ getLinkedVariableList as Fo,getModelMembers as Bo,getPropertyString as No,InvalidServicePropertyError as Uo}from"@ez4/common/library";
4
+ import{isModelProperty as Vo}from"@ez4/reflection";var Q="@ez4/http",Xo=e=>e.type===Q;import{IncompleteTypeError as Ge}from"@ez4/common/library";var f=class extends Ge{constructor(t,r){
5
+ super("Incomplete service",t,r)}};import{InvalidServicePropertyError as pr,isModelDeclaration as sr,getPropertyNumber as ir,
6
+ getObjectMembers as cr,getModelMembers as lr,getServiceListener as mr,getReferenceType as ar}from"@ez4/common/library";
7
+ import{isModelProperty as ur,isTypeObject as fr,isTypeReference as yr}from"@ez4/reflection";import{hasHeritageType as m,isClassDeclaration as Ye,isModelDeclaration as Ke}from"@ez4/common/library";
8
+ import{isTypeCallback as Y,isTypeFunction as K}from"@ez4/reflection";var We=new Set(
9
+ ["ANY","GET","POST","PUT","PATCH","DELETE","OPTIONS"]),W=e=>{let[t]=e.split(" ",
10
+ 2);return We.has(t)},X=e=>Ye(e)&&m(e,"Http.Service"),Z=e=>Ke(e)&&m(e,"Http.Route");var _=e=>m(e,"Http.Defaults"),$=e=>m(e,"Http.Headers"),L=e=>m(e,"Http.Identity"),
11
+ ee=e=>m(e,"Http.QueryStrings"),re=e=>m(e,"Http.PathParameters"),te=e=>m(e,"Http.\
12
+ JsonBody"),oe=e=>m(e,"Http.Cors"),ne=e=>m(e,"Http.Cache"),pe=e=>Y(e)||K(e),se=e=>Y(
13
+ e)||K(e);import{InvalidServicePropertyError as Xe,getObjectMembers as Ze,getPropertyTuple as _e,
14
+ getReferenceType as ce}from"@ez4/common/library";import{isAnyNumber as $e,isEmptyObject as Le}from"@ez4/utils";
15
+ import{isModelProperty as er,isTypeClass as rr,isTypeObject as tr,isTypeReference as le}from"@ez4/reflection";var y=(e,t,r,o)=>{if(!le(e))return ie(e,t,r,o);let n=ce(e,r);return n?ie(n,t,r,o):
16
+ null},ie=(e,t,r,o)=>tr(e)?or(e,t,Ze(e),r,o):null,or=(e,t,r,o,n)=>{let p={};for(let s of r){
17
+ if(!er(s)||s.inherited)continue;let i=parseInt(s.name,10);$e(i)||n.push(new Xe(t.
18
+ name,s.name,e.file));let c=nr(s,i,t,o,n);c&&Object.assign(p,c)}return Le(p)?null:
19
+ p},nr=(e,t,r,o,n)=>{let p=_e(e)??[],s={};for(let i of p){if(!le(i)){n.push(new a(
20
+ r.file));continue}let c=ce(i,o);if(!c||!rr(c)){n.push(new a(r.file));continue}s[c.
21
+ name]=t}return s};var ue=(e,t,r,o)=>{if(!yr(e))return me(e,t,r,o);let n=ar(e,r);return n?me(n,t,r,
22
+ o):null},me=(e,t,r,o)=>fr(e)?ae(t,cr(e),r,o):sr(e)?_(e)?ae(t,lr(e),r,o):(o.push(
23
+ new T(e.name,t.file)),null):(o.push(new d(t.file)),null),ae=(e,t,r,o)=>{let n={};
24
+ for(let p of t)if(!(!ur(p)||p.inherited))switch(p.name){default:o.push(new pr(e.
25
+ name,p.name,e.file));break;case"httpErrors":n.httpErrors=y(p.value,e,r,o);break;case"\
26
+ memory":case"logRetention":case"timeout":n[p.name]=ir(p);break;case"listener":n.
27
+ listener=mr(p.value,o);break}return n};import{isModelProperty as Jt,isTypeObject as Gt,isTypeReference as Yt,isTypeTuple as Kt}from"@ez4/reflection";
28
+ import{InvalidServicePropertyError as Wt,getLinkedVariableList as Xt,getPropertyBoolean as Zt,
29
+ getPropertyNumber as _t,getPropertyString as $t,getObjectMembers as Lt,getModelMembers as eo,
30
+ getServiceListener as ro,getReferenceType as to,getPropertyTuple as oo}from"@ez4/common/library";import{IncompleteTypeError as dr,TypeError as Tr}from"@ez4/common/library";var g=class extends dr{constructor(t,r){
31
+ super("Incomplete gateway route",t,r)}},a=class extends Tr{constructor(t){super(
32
+ "Invalid route error type.",t)}};import{IncompleteTypeError as gr}from"@ez4/common/library";var M=class extends gr{constructor(t,r){
33
+ super("Incomplete route authorizer",t,r)}};import{InvalidServicePropertyError as tt,isModelDeclaration as ot,hasHeritageType as nt,
34
+ getModelMembers as pt,getObjectMembers as st,getPropertyNumber as it,getReferenceType as ct}from"@ez4/common/library";
35
+ import{isModelProperty as lt,isTypeObject as mt,isTypeReference as at}from"@ez4/reflection";
36
+ import{isAnyNumber as ut}from"@ez4/utils";import{IncorrectTypeError as Mr,InvalidTypeError as Hr}from"@ez4/common/library";
37
+ var H=class extends Hr{constructor(r,o){super("Invalid route response",void 0,r,
38
+ o);this.baseType=r}},h=class extends Mr{constructor(r,o,n){super("Incorrect rout\
39
+ e response",r,o,n);this.responseType=r;this.baseType=o}};import{createUnionSchema as Ir,getScalarSchema as Ar,createArraySchema as Er}from"@ez4/schema/library";
40
+ import{getReferenceType as vr,isModelDeclaration as Rr}from"@ez4/common/library";
41
+ import{isTypeArray as Pr,isTypeIntersection as jr,isTypeObject as wr,isTypeReference as Or,
42
+ isTypeScalar as zr,isTypeUndefined as Cr,isTypeUnion as kr}from"@ez4/reflection";import{IncorrectTypeError as hr,InvalidTypeError as br}from"@ez4/common/library";
43
+ var b=class extends br{constructor(t){super("Invalid body",void 0,"Http.JsonBody",
44
+ t)}},S=class extends hr{constructor(r,o){super("Incorrect body",r,"Http.JsonBody",
45
+ o);this.bodyType=r}};import{getObjectSchema as Sr,isObjectSchema as xr}from"@ez4/schema/library";var l=(e,t)=>{
46
+ let r=Sr(e,t);return r&&xr(r)?r:null};var fe=(e,t,r,o)=>I(e,r,n=>x(n,t,r,o)),ye=(e,t,r,o)=>I(e,r,n=>J(n)??x(n,t,r,o)),
47
+ I=(e,t,r)=>{if(Cr(e))return null;if(!Or(e))return r(e);let o=vr(e,t);return o?r(
48
+ o):null},J=e=>zr(e)?Ar(e):null,x=(e,t,r,o)=>kr(e)?qr(e.elements,r,n=>J(n)??x(n,t,
49
+ r,o)):Pr(e)?Dr(e.element,r,n=>J(n)??x(n,t,r,o)):wr(e)||jr(e)?l(e,r):Rr(e)?te(e)?
50
+ l(e,r):(o.push(new S(e.name,e.file)),null):(o.push(new b(t.file)),null),qr=(e,t,r)=>{
51
+ let o=[];for(let n of e){let p=I(n,t,r);p&&o.push(p)}return o.length?Ir({elements:o}):
52
+ null},Dr=(e,t,r)=>{let o=I(e,t,r);return o?Er({element:o}):null};import{isTypeIntersection as Nr,isTypeObject as Ur,isTypeReference as Vr,isTypeUndefined as Qr,
53
+ isTypeUnion as Jr}from"@ez4/reflection";import{getReferenceType as Gr,isModelDeclaration as Yr}from"@ez4/common/library";
54
+ import{createUnionSchema as Kr}from"@ez4/schema/library";import{IncorrectTypeError as Fr,InvalidTypeError as Br}from"@ez4/common/library";
55
+ var A=class extends Br{constructor(t){super("Invalid identity",void 0,"Http.Iden\
56
+ tity",t)}},E=class extends Fr{constructor(r,o){super("Incorrect identity",r,"Htt\
57
+ p.Identity",o);this.identityType=r}};var u=(e,t,r,o)=>{if(Qr(e))return null;if(!Vr(e))return de(e,t,r,o);let n=Gr(e,r);
58
+ return n?de(n,t,r,o):null},de=(e,t,r,o)=>{if(Jr(e))return Wr(e.elements,t,r,o);if(Ur(
59
+ e)||Nr(e))return l(e,r);if(!Yr(e))return o.push(new A(t.file)),null;if(!L(e))return o.
60
+ push(new E(e.name,t.file)),null;let n=l(e,r);return n&&(n.definitions={...n.definitions,
61
+ extensible:!0}),n},Wr=(e,t,r,o)=>{let n=[];for(let p of e){let s=u(p,t,r,o);s&&n.
62
+ push(s)}return n.length>1?Kr({elements:n}):n[0]};import{isTypeIntersection as _r,isTypeObject as $r,isTypeReference as Lr}from"@ez4/reflection";
63
+ import{getReferenceType as et,isModelDeclaration as rt}from"@ez4/common/library";import{IncorrectTypeError as Xr,InvalidTypeError as Zr}from"@ez4/common/library";
64
+ var v=class extends Zr{constructor(t){super("Invalid headers",void 0,"Http.Heade\
65
+ rs",t)}},R=class extends Xr{constructor(r,o){super("Incorrect headers",r,"Http.H\
66
+ eaders",o);this.headersType=r}};var P=(e,t,r,o)=>{if(!Lr(e))return Te(e,t,r,o);let n=et(e,r);return n?Te(n,t,r,o):
67
+ null},Te=(e,t,r,o)=>$r(e)||_r(e)?l(e,r):rt(e)?$(e)?l(e,r):(o.push(new R(e.name,t.
68
+ file)),null):(o.push(new v(t.file)),null);var He=(e,t,r,o)=>{let n=be(e,t,r,o,"Http.AuthResponse");return n&&ft(n)?n:null},
69
+ he=(e,t,r,o)=>{let n=be(e,t,r,o,"Http.Response");return n&&yt(n)?n:null},be=(e,t,r,o,n)=>{
70
+ if(!at(e))return ge(e,t,r,o,n);let p=ct(e,r);return p?ge(p,t,r,o,n):null},ft=e=>!!e.
71
+ identity,yt=e=>ut(e.status),ge=(e,t,r,o,n)=>mt(e)?Me(e,t,st(e),r,o):ot(e)?nt(e,n)?
72
+ Me(e,t,pt(e),r,o):(o.push(new h(e.name,n,e.file)),null):(o.push(new H(n,t.file)),
73
+ null),Me=(e,t,r,o,n)=>{let p={};for(let s of r)if(!(!lt(s)||s.inherited))switch(s.
74
+ name){default:n.push(new tt(t.name,s.name,e.file));break;case"status":p.status=it(
75
+ s);break;case"headers":{p.headers=P(s.value,e,o,n),p.headers&&s.description&&(p.
76
+ headers.description=s.description);break}case"identity":{p.identity=u(s.value,e,
77
+ o,n),p.identity&&s.description&&(p.identity.description=s.description);break}case"\
78
+ body":{p.body=ye(s.value,e,o,n),p.body&&s.description&&(p.body.description=s.description);
79
+ break}}return p};import{isModelProperty as wt,isTypeIntersection as Ot,isTypeObject as zt,isTypeReference as Ct}from"@ez4/reflection";
80
+ import{InvalidServicePropertyError as kt,isModelDeclaration as qt,hasHeritageType as Dt,
81
+ getObjectMembers as Ft,getModelMembers as Bt,getReferenceType as Nt}from"@ez4/common/library";import{IncorrectTypeError as dt,InvalidTypeError as Tt}from"@ez4/common/library";
82
+ var j=class extends Tt{constructor(r,o){super("Invalid route request",void 0,r,o);
83
+ this.baseType=r}},w=class extends dt{constructor(r,o,n){super("Incorrect route r\
84
+ equest",r,o,n);this.requestType=r;this.baseType=o}};import{isTypeIntersection as Ht,isTypeObject as ht,isTypeReference as bt}from"@ez4/reflection";
85
+ import{getReferenceType as St,isModelDeclaration as xt}from"@ez4/common/library";import{IncorrectTypeError as gt,InvalidTypeError as Mt}from"@ez4/common/library";
86
+ var O=class extends Mt{constructor(t){super("Invalid request parameters",void 0,
87
+ "Http.PathParameters",t)}},z=class extends gt{constructor(r,o){super("Incorrect \
88
+ request parameters",r,"Http.PathParameters",o);this.parametersType=r}};var xe=(e,t,r,o)=>{if(!bt(e))return Se(e,t,r,o);let n=St(e,r);return n?Se(n,t,r,
89
+ o):null},Se=(e,t,r,o)=>ht(e)||Ht(e)?l(e,r):xt(e)?re(e)?l(e,r):(o.push(new z(e.name,
90
+ e.file)),null):(o.push(new O(t.file)),null);import{isTypeIntersection as Et,isTypeObject as vt,isTypeReference as Rt}from"@ez4/reflection";
91
+ import{getReferenceType as Pt,isModelDeclaration as jt}from"@ez4/common/library";import{IncorrectTypeError as It,InvalidTypeError as At}from"@ez4/common/library";
92
+ var C=class extends At{constructor(t){super("Invalid request query strings",void 0,
93
+ "Http.QueryStrings",t)}},k=class extends It{constructor(r,o){super("Incorrect re\
94
+ quest query strings",r,"Http.QueryStrings",o);this.queryType=r}};var Ae=(e,t,r,o)=>{if(!Rt(e))return Ie(e,t,r,o);let n=Pt(e,r);return n?Ie(n,t,r,
95
+ o):null},Ie=(e,t,r,o)=>vt(e)||Et(e)?l(e,r):jt(e)?ee(e)?l(e,r):(o.push(new k(e.name,
96
+ t.file)),null):(o.push(new C(t.file)),null);var Re=(e,t,r,o)=>G(e,t,r,o,"Http.AuthRequest"),Pe=(e,t,r,o)=>G(e,t,r,o,"Http.Re\
97
+ quest"),G=(e,t,r,o,n)=>{if(Ot(e)&&e.elements.length>0)return G(e.elements[0],t,r,
98
+ o,n);if(!Ct(e))return Ee(e,t,r,o,n);let p=Nt(e,r);return p?Ee(p,t,r,o,n):null},Ee=(e,t,r,o,n)=>zt(
99
+ e)?ve(e,t,Ft(e),r,o):qt(e)?Dt(e,n)?ve(e,t,Bt(e),r,o):(o.push(new w(e.name,n,e.file)),
100
+ null):(o.push(new j(n,t.file)),null),ve=(e,t,r,o,n)=>{let p={};for(let s of r)if(!(!wt(
101
+ s)||s.inherited))switch(s.name){default:n.push(new kt(t.name,s.name,e.file));break;case"\
102
+ headers":{p.headers=P(s.value,e,o,n),p.headers&&s.description&&(p.headers.description=
103
+ s.description);break}case"identity":{p.identity=u(s.value,e,o,n),p.identity&&s.description&&
104
+ (p.identity.description=s.description);break}case"query":{p.query=Ae(s.value,e,o,
105
+ n),p.query&&s.description&&(p.query.description=s.description);break}case"parame\
106
+ ters":{p.parameters=xe(s.value,e,o,n),p.parameters&&s.description&&(p.parameters.
107
+ description=s.description);break}case"body":{p.body=fe(s.value,e,o,n),p.body&&s.
108
+ description&&(p.body.description=s.description);break}}return p};var je=(e,t,r,o)=>{if(!pe(e))return null;let n={},p=new Set(["name","file"]);if(e.
109
+ description&&(n.description=e.description),(n.name=e.name)&&p.delete("name"),(n.
110
+ file=e.file)&&p.delete("file"),e.parameters){let[{value:s}]=e.parameters;n.request=
111
+ Re(s,t,r,o)}return e.return&&(n.response=He(e.return,t,r,o)),Ut(n)?n:(o.push(new M(
112
+ [...p],e.file)),null)},Ut=e=>!!e.name&&!!e.file;import{IncompleteTypeError as Vt}from"@ez4/common/library";var q=class extends Vt{constructor(t,r){
113
+ super("Incomplete route handler",t,r)}};var we=(e,t,r,o)=>{if(!se(e))return null;let n={},p=new Set(["name","file","resp\
114
+ onse"]);if(e.description&&(n.description=e.description),(n.name=e.name)&&p.delete(
115
+ "name"),(n.file=e.file)&&p.delete("file"),e.parameters){let[{value:s}]=e.parameters;
116
+ n.request=Pe(s,t,r,o)}if(e.return){let s=he(e.return,t,r,o);s&&(n.response=s,p.delete(
117
+ "response"))}return Qt(n)?n:(o.push(new q([...p],e.file)),null)},Qt=e=>!!e.name&&
118
+ !!e.file&&!!e.response;var Ce=(e,t,r,o)=>{let n=oo(t)??[];return ke(n,e,r,o)},ke=(e,t,r,o)=>{let n=[];for(let p of e){
119
+ let s=no(p,t,r,o);Array.isArray(s)?n.push(...s):s&&n.push(s)}return n},no=(e,t,r,o)=>{
120
+ if(!Yt(e))return Oe(e,t,r,o);let n=to(e,r);return n?Oe(n,t,r,o):null},po=e=>!!e.
121
+ path&&!!e.handler,Oe=(e,t,r,o)=>Z(e)?ze(e,t,eo(e),r,o):Gt(e)?ze(e,t,Lt(e),r,o):Kt(
122
+ e)&&e.spread?ke(e.elements,t,r,o):null,ze=(e,t,r,o,n)=>{let p={},s=new Set(["pat\
123
+ h","handler"]);for(let i of r)if(!(!Jt(i)||i.inherited))switch(i.name){default:n.
124
+ push(new Wt(t.name,i.name,e.file));break;case"path":{let c=$t(i);c&&W(c)&&(s.delete(
125
+ i.name),p.path=c);break}case"handler":(p.handler=we(i.value,t,o,n))&&s.delete(i.
126
+ name);break;case"authorizer":p.authorizer=je(i.value,t,o,n);break;case"httpError\
127
+ s":p.httpErrors=y(i.value,t,o,n);break;case"memory":case"logRetention":case"time\
128
+ out":p[i.name]=_t(i);break;case"cors":p.cors=Zt(i);break;case"listener":p.listener=
129
+ ro(i.value,n);break;case"variables":p.variables=Xt(i,n);break}return po(p)?p:(n.
130
+ push(new g([...s],e.file)),null)};import{InvalidServicePropertyError as lo,isModelDeclaration as mo,getModelMembers as ao,
131
+ getObjectMembers as uo,getPropertyBoolean as fo,getPropertyStringList as yo,getPropertyNumber as To,
132
+ getReferenceType as go}from"@ez4/common/library";import{isModelProperty as Mo,isTypeObject as Ho,
133
+ isTypeReference as ho}from"@ez4/reflection";import{IncompleteTypeError as so,IncorrectTypeError as io,InvalidTypeError as co}from"@ez4/common/library";
134
+ var D=class extends so{constructor(t,r){super("Incomplete HTTP CORS",t,r)}},F=class extends co{constructor(t){
135
+ super("Invalid HTTP CORS type",void 0,"Http.Cors",t)}},B=class extends io{constructor(r,o){
136
+ super("Incorrect HTTP CORS type",r,"Http.Cors",o);this.fallbackType=r}};var Fe=(e,t,r,o)=>{if(!ho(e))return qe(e,t,o);let n=go(e,r);return n?qe(n,t,o):null},
137
+ bo=e=>!!e.allowOrigins?.length,qe=(e,t,r)=>Ho(e)?De(e,t,uo(e),r):mo(e)?oe(e)?De(
138
+ e,t,ao(e),r):(r.push(new B(e.name,e.file)),null):(r.push(new F(t.file)),null),De=(e,t,r,o)=>{
139
+ let n={},p=new Set(["allowOrigins"]);for(let s of r)if(!(!Mo(s)||s.inherited))switch(s.
140
+ name){default:o.push(new lo(t.name,s.name,e.file));break;case"allowOrigins":case"\
141
+ allowMethods":case"allowHeaders":case"exposeHeaders":n[s.name]=yo(s);break;case"\
142
+ allowCredentials":n.allowCredentials=fo(s);break;case"maxAge":n.maxAge=To(s);break}
143
+ return bo(n)?n:(o.push(new D([...p],e.file)),null)};import{InvalidServicePropertyError as Ao,isModelDeclaration as Eo,getModelMembers as vo,
144
+ getObjectMembers as Ro,getPropertyNumber as Po,getReferenceType as jo}from"@ez4/common/library";
145
+ import{isModelProperty as wo,isTypeObject as Oo,isTypeReference as zo}from"@ez4/reflection";
146
+ import{isAnyNumber as Ue}from"@ez4/utils";import{IncompleteTypeError as So,IncorrectTypeError as xo,InvalidTypeError as Io}from"@ez4/common/library";
147
+ var N=class extends So{constructor(t,r){super("Incomplete gateway cache",t,r)}},
148
+ U=class extends Io{constructor(t){super("Invalid gateway cache type",void 0,"Htt\
149
+ p.Cache",t)}},V=class extends xo{constructor(r,o){super("Incorrect gateway cache\
150
+ type",r,"Http.Cache",o);this.cacheType=r}};var Ve=(e,t,r,o)=>{if(!zo(e))return Be(e,t,o);let n=jo(e,r);return n?Be(n,t,o):null},
151
+ Co=e=>Ue(e.authorizerTTL),Be=(e,t,r)=>Oo(e)?Ne(e,t,Ro(e),r):Eo(e)?ne(e)?Ne(e,t,vo(
152
+ e),r):(r.push(new V(e.name,e.file)),null):(r.push(new U(t.file)),null),Ne=(e,t,r,o)=>{
153
+ let n={},p=new Set(["authorizerTTL"]);for(let s of r)if(!(!wo(s)||s.inherited))switch(s.
154
+ name){default:o.push(new Ao(t.name,s.name,e.file));break;case"authorizerTTL":{let i=Po(
155
+ s);Ue(i)&&(n[s.name]=i,p.delete(s.name));break}}return Co(n)?n:(o.push(new N([...p],
156
+ e.file)),null)};var Qe=e=>{let t={},r=[];for(let o in e){let n=e[o];if(!X(n)||qo(n))continue;let p={
157
+ type:Q,extras:{}},s=new Set(["routes"]),i=n.file;p.name=n.name,n.description&&(p.
158
+ description=n.description);for(let c of Bo(n))if(!(!Vo(c)||c.inherited))switch(c.
159
+ name){default:r.push(new Uo(p.name,c.name,i));break;case"routes":(p.routes=Ce(n,
160
+ c,e,r))&&s.delete(c.name);break;case"name":p.displayName=No(c);break;case"defaul\
161
+ ts":p.defaults=ue(c.value,n,e,r);break;case"cache":p.cache=Ve(c.value,n,e,r);break;case"\
162
+ cors":p.cors=Fe(c.value,n,e,r);break;case"variables":p.variables=Fo(c,r);break;case"\
163
+ services":p.services=Do(c,e,r);break}if(!Qo(p)){r.push(new f([...s],i));continue}
164
+ if(t[n.name]){r.push(new ko(n.name,i));continue}t[n.name]=p}return{services:t,errors:r}},
165
+ Qo=e=>!!e.name&&!!e.routes&&!!e.extras;var Je=!1,Is=()=>{Je||(Jo(),Go(),Yo("@ez4/gateway",{"metadata:getServices":Qe}),
166
+ Je=!1)};import{IncorrectTypeError as Ko,InvalidTypeError as Wo}from"@ez4/common/library";
167
+ var d=class extends Wo{constructor(t){super("Invalid defaults",void 0,"Http.Defa\
168
+ ults",t)}},T=class extends Ko{constructor(r,o){super("Incorrect defaults",r,"Htt\
169
+ p.Defaults",o);this.defaultsType=r}};export{M as IncompleteAuthorizerError,N as IncompleteCacheError,D as IncompleteCorsError,
170
+ q as IncompleteHandlerError,g as IncompleteRouteError,f as IncompleteServiceError,
171
+ S as IncorrectBodyTypeError,V as IncorrectCacheTypeError,B as IncorrectCorsTypeError,
172
+ T as IncorrectDefaultsTypeError,R as IncorrectHeadersTypeError,E as IncorrectIdentityTypeError,
173
+ z as IncorrectParameterTypeError,k as IncorrectQueryTypeError,w as IncorrectRequestTypeError,
174
+ h as IncorrectResponseTypeError,b as InvalidBodyTypeError,U as InvalidCacheTypeError,
175
+ F as InvalidCorsTypeError,d as InvalidDefaultsTypeError,v as InvalidHeadersTypeError,
176
+ A as InvalidIdentityTypeError,O as InvalidParameterTypeError,C as InvalidQueryTypeError,
177
+ j as InvalidRequestTypeError,H as InvalidResponseTypeError,a as InvalidRouteErrorTypeError,
178
+ Q as ServiceType,Re as getHttpAuthRequest,He as getHttpAuthResponse,je as getHttpAuthorizer,
179
+ Ve as getHttpCache,Fe as getHttpCors,we as getHttpHandler,Pe as getHttpHandlerRequest,
180
+ he as getHttpHandlerResponse,P as getHttpHeaders,u as getHttpIdentity,xe as getHttpParameters,
181
+ Ae as getHttpQuery,fe as getHttpRequestBody,ye as getHttpResponseBody,Ce as getHttpRoutes,
182
+ Qe as getHttpServices,Xo as isHttpService,Is as registerTriggers};
176
183
  //# sourceMappingURL=library.mjs.map
package/dist/main.cjs CHANGED
@@ -1,15 +1,15 @@
1
- "use strict";var o=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var R=(s,e)=>{for(var t in e)o(s,t,{get:e[t],enumerable:!0})},g=(s,e,t,p)=>{if(e&&
2
- typeof e=="object"||typeof e=="function")for(let n of H(e))!h.call(s,n)&&n!==t&&
3
- o(s,n,{get:()=>e[n],enumerable:!(p=l(e,n))||p.enumerable});return s};var q=s=>g(o({},"__esModule",{value:!0}),s);var b={};R(b,{Http:()=>y,HttpBadRequestError:()=>u,HttpError:()=>r,HttpForbiddenError:()=>a,
4
- HttpInternalServerError:()=>d,HttpNotFoundError:()=>c,HttpUnauthorizedError:()=>i,
5
- HttpUnprocessableEntityError:()=>m,HttpUnsupportedMediaTypeError:()=>x});module.
6
- exports=q(b);var y;(s=>{})(y||={});var r=class extends Error{constructor(t,p,n){super(p);this.status=t;this.message=
7
- p;this.details=n}},u=class extends r{constructor(e,t){super(400,e||"Bad request",
8
- t)}},i=class extends r{constructor(e,t){super(401,e||"Unauthorized",t)}},a=class extends r{constructor(e,t){
9
- super(403,e||"Forbidden",t)}},c=class extends r{constructor(e,t){super(404,e||"N\
10
- ot found",t)}},x=class extends r{constructor(e,t){super(415,e||"Unsupported medi\
11
- a type",t)}},m=class extends r{constructor(e,t){super(422,e||"Unprocessable enti\
12
- ty",t)}},d=class extends r{constructor(e,t){super(500,e||"Internal server error",
13
- t)}};0&&(module.exports={Http,HttpBadRequestError,HttpError,HttpForbiddenError,HttpInternalServerError,
1
+ "use strict";var n=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var R=(r,t)=>{for(var e in t)n(r,e,{get:t[e],enumerable:!0})},g=(r,t,e,o)=>{if(t&&
2
+ typeof t=="object"||typeof t=="function")for(let p of l(t))!h.call(r,p)&&p!==e&&
3
+ n(r,p,{get:()=>t[p],enumerable:!(o=H(t,p))||o.enumerable});return r};var q=r=>g(n({},"__esModule",{value:!0}),r);var b={};R(b,{Http:()=>y,HttpBadRequestError:()=>u,HttpError:()=>s,HttpForbiddenError:()=>a,
4
+ HttpInternalServerError:()=>m,HttpNotFoundError:()=>c,HttpUnauthorizedError:()=>i,
5
+ HttpUnprocessableEntityError:()=>d,HttpUnsupportedMediaTypeError:()=>x});module.
6
+ exports=q(b);var y;(r=>{})(y||={});var s=class extends Error{constructor(e,o,p){super(o);this.status=e;this.message=
7
+ o;this.details=p}},u=class extends s{constructor(t,e){super(400,t||"Bad request",
8
+ e)}},i=class extends s{constructor(t,e){super(401,t||"Unauthorized",e)}},a=class extends s{constructor(t,e){
9
+ super(403,t||"Forbidden",e)}},c=class extends s{constructor(t,e){super(404,t||"N\
10
+ ot found",e)}},x=class extends s{constructor(t,e){super(415,t||"Unsupported medi\
11
+ a type",e)}},d=class extends s{constructor(t,e){super(422,t||"Unprocessable enti\
12
+ ty",e)}},m=class extends s{constructor(t,e){super(500,t||"Internal server error",
13
+ e)}};0&&(module.exports={Http,HttpBadRequestError,HttpError,HttpForbiddenError,HttpInternalServerError,
14
14
  HttpNotFoundError,HttpUnauthorizedError,HttpUnprocessableEntityError,HttpUnsupportedMediaTypeError});
15
15
  //# sourceMappingURL=main.cjs.map
package/dist/main.mjs CHANGED
@@ -1,11 +1,11 @@
1
- var m;(r=>{})(m||={});var s=class extends Error{constructor(t,x,d){super(x);this.status=t;this.message=
2
- x;this.details=d}},n=class extends s{constructor(e,t){super(400,e||"Bad request",
3
- t)}},p=class extends s{constructor(e,t){super(401,e||"Unauthorized",t)}},o=class extends s{constructor(e,t){
4
- super(403,e||"Forbidden",t)}},u=class extends s{constructor(e,t){super(404,e||"N\
5
- ot found",t)}},i=class extends s{constructor(e,t){super(415,e||"Unsupported medi\
6
- a type",t)}},a=class extends s{constructor(e,t){super(422,e||"Unprocessable enti\
7
- ty",t)}},c=class extends s{constructor(e,t){super(500,e||"Internal server error",
8
- t)}};export{m as Http,n as HttpBadRequestError,s as HttpError,o as HttpForbiddenError,
9
- c as HttpInternalServerError,u as HttpNotFoundError,p as HttpUnauthorizedError,a as HttpUnprocessableEntityError,
1
+ var d;(s=>{})(d||={});var r=class extends Error{constructor(e,x,m){super(x);this.status=e;this.message=
2
+ x;this.details=m}},p=class extends r{constructor(t,e){super(400,t||"Bad request",
3
+ e)}},o=class extends r{constructor(t,e){super(401,t||"Unauthorized",e)}},n=class extends r{constructor(t,e){
4
+ super(403,t||"Forbidden",e)}},u=class extends r{constructor(t,e){super(404,t||"N\
5
+ ot found",e)}},i=class extends r{constructor(t,e){super(415,t||"Unsupported medi\
6
+ a type",e)}},a=class extends r{constructor(t,e){super(422,t||"Unprocessable enti\
7
+ ty",e)}},c=class extends r{constructor(t,e){super(500,t||"Internal server error",
8
+ e)}};export{d as Http,p as HttpBadRequestError,r as HttpError,n as HttpForbiddenError,
9
+ c as HttpInternalServerError,u as HttpNotFoundError,o as HttpUnauthorizedError,a as HttpUnprocessableEntityError,
10
10
  i as HttpUnsupportedMediaTypeError};
11
11
  //# sourceMappingURL=main.mjs.map
@@ -1,6 +1,6 @@
1
- import type { AllType, SourceMap, TypeModel, TypeObject } from '@ez4/reflection';
2
- import type { ObjectSchema, UnionSchema } from '@ez4/schema/library';
3
- type TypeParent = TypeObject | TypeModel;
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[]) => import("@ez4/schema/library").BooleanSchema | import("@ez4/schema/library").NumberSchema | import("@ez4/schema/library").StringSchema | ObjectSchema | UnionSchema | null;
1
+ import type { AllType, SourceMap, TypeIntersection, TypeModel, TypeObject } from '@ez4/reflection';
2
+ import type { ArraySchema, ObjectSchema, UnionSchema } from '@ez4/schema/library';
3
+ type TypeParent = TypeObject | TypeModel | TypeIntersection;
4
+ export declare const getHttpRequestBody: (type: AllType, parent: TypeParent, reflection: SourceMap, errorList: Error[]) => ObjectSchema | UnionSchema | ArraySchema | null;
5
+ export declare const getHttpResponseBody: (type: AllType, parent: TypeParent, reflection: SourceMap, errorList: Error[]) => ObjectSchema | UnionSchema | ArraySchema | import("@ez4/schema/library").BooleanSchema | import("@ez4/schema/library").NumberSchema | import("@ez4/schema/library").StringSchema | null;
6
6
  export {};
@@ -0,0 +1,4 @@
1
+ import type { AllType, ModelProperty, SourceMap, TypeModel } from '@ez4/reflection';
2
+ import type { HttpErrors } from '../types/common.js';
3
+ export declare const getHttpErrors: (type: AllType, parent: TypeModel, reflection: SourceMap, errorList: Error[]) => HttpErrors | null;
4
+ export declare const getErrorClasses: (member: ModelProperty, errorCode: number, parent: TypeModel, reflection: SourceMap, errorList: Error[]) => HttpErrors;
@@ -1,2 +1,4 @@
1
- import type { AllType, SourceMap, TypeModel, TypeObject } from '@ez4/reflection';
2
- export declare const getHttpHeaders: (type: AllType, parent: TypeObject | TypeModel, reflection: SourceMap, errorList: Error[]) => import("@ez4/schema/library").ObjectSchema | null;
1
+ import type { AllType, SourceMap, TypeIntersection, TypeModel, TypeObject } from '@ez4/reflection';
2
+ type TypeParent = TypeObject | TypeModel | TypeIntersection;
3
+ export declare const getHttpHeaders: (type: AllType, parent: TypeParent, reflection: SourceMap, errorList: Error[]) => import("@ez4/schema").ObjectSchema | null;
4
+ export {};
@@ -1,3 +1,5 @@
1
- import type { AllType, SourceMap, TypeModel, TypeObject } from '@ez4/reflection';
1
+ import type { AllType, SourceMap, TypeIntersection, TypeModel, TypeObject } from '@ez4/reflection';
2
2
  import type { ObjectSchema, UnionSchema } from '@ez4/schema/library';
3
- export declare const getHttpIdentity: (type: AllType, parent: TypeObject | TypeModel, reflection: SourceMap, errorList: Error[]) => ObjectSchema | UnionSchema | null;
3
+ type TypeParent = TypeObject | TypeModel | TypeIntersection;
4
+ export declare const getHttpIdentity: (type: AllType, parent: TypeParent, reflection: SourceMap, errorList: Error[]) => ObjectSchema | UnionSchema | null;
5
+ export {};
@@ -1,2 +1,4 @@
1
- import type { AllType, SourceMap, TypeModel, TypeObject } from '@ez4/reflection';
2
- export declare const getHttpParameters: (type: AllType, parent: TypeObject | TypeModel, reflection: SourceMap, errorList: Error[]) => import("@ez4/schema/library").ObjectSchema | null;
1
+ import type { AllType, SourceMap, TypeIntersection, TypeModel, TypeObject } from '@ez4/reflection';
2
+ type TypeParent = TypeObject | TypeModel | TypeIntersection;
3
+ export declare const getHttpParameters: (type: AllType, parent: TypeParent, reflection: SourceMap, errorList: Error[]) => import("@ez4/schema").ObjectSchema | null;
4
+ export {};
@@ -1,2 +1,4 @@
1
- import type { AllType, SourceMap, TypeModel, TypeObject } from '@ez4/reflection';
2
- export declare const getHttpQuery: (type: AllType, parent: TypeObject | TypeModel, reflection: SourceMap, errorList: Error[]) => import("@ez4/schema/library").ObjectSchema | null;
1
+ import type { AllType, SourceMap, TypeIntersection, TypeModel, TypeObject } from '@ez4/reflection';
2
+ type TypeParent = TypeObject | TypeModel | TypeIntersection;
3
+ export declare const getHttpQuery: (type: AllType, parent: TypeParent, reflection: SourceMap, errorList: Error[]) => import("@ez4/schema").ObjectSchema | null;
4
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { SourceMap, TypeIntersection, TypeModel, TypeObject } from '@ez4/reflection';
2
+ export declare const getSchemaFromType: (type: TypeObject | TypeModel | TypeIntersection, reflection: SourceMap) => import("@ez4/schema/library").ObjectSchema | null;