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