@ez4/gateway 0.18.0 → 0.19.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.cjs CHANGED
@@ -1,6 +1,6 @@
1
- "use strict";var Ie=Object.defineProperty;var Dr=Object.getOwnPropertyDescriptor;var Br=Object.getOwnPropertyNames;var Fr=Object.prototype.hasOwnProperty;var Ur=(e,t)=>{for(var r in t)Ie(e,r,{get:t[r],enumerable:!0})},Nr=(e,t,r,n)=>{if(t&&
1
+ "use strict";var ve=Object.defineProperty;var Dr=Object.getOwnPropertyDescriptor;var Br=Object.getOwnPropertyNames;var Fr=Object.prototype.hasOwnProperty;var Ur=(e,t)=>{for(var r in t)ve(e,r,{get:t[r],enumerable:!0})},Nr=(e,t,r,n)=>{if(t&&
2
2
  typeof t=="object"||typeof t=="function")for(let o of Br(t))!Fr.call(e,o)&&o!==r&&
3
- Ie(e,o,{get:()=>t[o],enumerable:!(n=Dr(t,o))||n.enumerable});return e};var Vr=e=>Nr(Ie({},"__esModule",{value:!0}),e);var nt={};Ur(nt,{IncompleteAuthorizerError:()=>k,IncompleteCacheError:()=>re,IncompleteCorsError:()=>$,
3
+ ve(e,o,{get:()=>t[o],enumerable:!(n=Dr(t,o))||n.enumerable});return e};var Vr=e=>Nr(ve({},"__esModule",{value:!0}),e);var pt={};Ur(pt,{IncompleteAuthorizerError:()=>k,IncompleteCacheError:()=>re,IncompleteCorsError:()=>$,
4
4
  IncompleteHandlerError:()=>_,IncompleteRouteError:()=>C,IncompleteServiceError:()=>w,
5
5
  IncorrectBodyTypeError:()=>F,IncorrectCacheTypeError:()=>oe,IncorrectCorsTypeError:()=>ee,
6
6
  IncorrectDefaultsTypeError:()=>z,IncorrectHeadersTypeError:()=>Q,IncorrectIdentityTypeError:()=>N,
@@ -9,161 +9,163 @@ IncorrectResponseTypeError:()=>D,InvalidBodyTypeError:()=>B,InvalidCacheTypeErro
9
9
  InvalidCorsTypeError:()=>L,InvalidDefaultsTypeError:()=>P,InvalidHeadersTypeError:()=>V,
10
10
  InvalidIdentityTypeError:()=>U,InvalidParameterTypeError:()=>K,InvalidQueryTypeError:()=>X,
11
11
  InvalidRequestTypeError:()=>G,InvalidResponseTypeError:()=>q,ServiceType:()=>ne,
12
- getHttpAuthRequest:()=>ze,getHttpAuthResponse:()=>je,getHttpAuthorizer:()=>ke,getHttpCache:()=>Ue,
13
- getHttpCors:()=>Be,getHttpHandler:()=>qe,getHttpHandlerRequest:()=>Ce,getHttpHandlerResponse:()=>Oe,
14
- getHttpHeaders:()=>J,getHttpIdentity:()=>I,getHttpParameters:()=>we,getHttpQuery:()=>Pe,
15
- getHttpRequestBody:()=>ve,getHttpResponseBody:()=>Ae,getHttpRoutes:()=>De,getHttpServices:()=>Ne,
16
- isHttpService:()=>Qr,registerTriggers:()=>ot});module.exports=Vr(nt);var Cr=require("@ez4/common/library"),kr=require("@ez4/schema/library"),qr=require("@ez4/project/library");var d=require("@ez4/common/library"),Pr=require("@ez4/reflection");var ne="@ez4/http",Qr=e=>e.type===ne;var Ve=require("@ez4/common/library"),w=class extends Ve.IncompleteTypeError{constructor(t,r){
12
+ getHttpAuthRequest:()=>Ce,getHttpAuthResponse:()=>Oe,getHttpAuthorizer:()=>qe,getHttpCache:()=>Ne,
13
+ getHttpCors:()=>Fe,getHttpHandler:()=>De,getHttpHandlerRequest:()=>ke,getHttpHandlerResponse:()=>we,
14
+ getHttpHeaders:()=>J,getHttpIdentity:()=>A,getHttpParameters:()=>Pe,getHttpQuery:()=>ze,
15
+ getHttpRequestBody:()=>Ee,getHttpResponseBody:()=>je,getHttpRoutes:()=>Be,getHttpServices:()=>Ve,
16
+ isHttpService:()=>Qr,registerTriggers:()=>nt});module.exports=Vr(pt);var Cr=require("@ez4/common/library"),kr=require("@ez4/schema/library"),qr=require("@ez4/project/library");var d=require("@ez4/common/library"),Pr=require("@ez4/reflection");var ne="@ez4/http",Qr=e=>e.type===ne;var Qe=require("@ez4/common/library"),w=class extends Qe.IncompleteTypeError{constructor(t,r){
17
17
  super("Incomplete service",t,r)}};var a=require("@ez4/common/library"),S=require("@ez4/reflection");var u=require("@ez4/common/library"),b=require("@ez4/reflection"),Jr=new Set(["A\
18
- NY","GET","POST","PUT","PATCH","DELETE","OPTIONS"]),Qe=e=>{let[t]=e.split(" ",2);
19
- return Jr.has(t)},Je=e=>(0,u.isClassDeclaration)(e)&&(0,u.hasHeritageType)(e,"Ht\
20
- tp.Service"),Ge=e=>(0,u.isModelDeclaration)(e)&&(0,u.hasHeritageType)(e,"Http.Ro\
21
- ute");var Ye=e=>(0,u.hasHeritageType)(e,"Http.Defaults"),Ke=e=>(0,u.hasHeritageType)(e,
22
- "Http.Headers"),We=e=>(0,u.hasHeritageType)(e,"Http.Identity"),Xe=e=>(0,u.hasHeritageType)(
23
- e,"Http.QueryStrings"),Ze=e=>(0,u.hasHeritageType)(e,"Http.PathParameters"),_e=e=>(0,u.hasHeritageType)(
24
- e,"Http.JsonBody"),$e=e=>(0,u.hasHeritageType)(e,"Http.Cors"),Le=e=>(0,u.hasHeritageType)(
25
- e,"Http.Cache"),er=e=>(0,b.isTypeCallback)(e)||(0,b.isTypeFunction)(e),rr=e=>(0,b.isTypeCallback)(
26
- e)||(0,b.isTypeFunction)(e);var nr=(e,t,r,n)=>{if(!(0,S.isTypeReference)(e))return tr(e,t,n);let o=(0,a.getReferenceType)(
27
- e,r);return o?tr(o,t,n):null},tr=(e,t,r)=>(0,S.isTypeObject)(e)?or(t,(0,a.getObjectMembers)(
28
- e),r):(0,a.isModelDeclaration)(e)?Ye(e)?or(t,(0,a.getModelMembers)(e),r):(r.push(
29
- new z(e.name,t.file)),null):(r.push(new P(t.file)),null),or=(e,t,r)=>{let n={};for(let o of t)
18
+ NY","GET","POST","PUT","PATCH","DELETE","OPTIONS"]),Je=e=>{let[t]=e.split(" ",2);
19
+ return Jr.has(t)},Ge=e=>(0,u.isClassDeclaration)(e)&&(0,u.hasHeritageType)(e,"Ht\
20
+ tp.Service"),Ye=e=>(0,u.isModelDeclaration)(e)&&(0,u.hasHeritageType)(e,"Http.Ro\
21
+ ute");var Ke=e=>(0,u.hasHeritageType)(e,"Http.Defaults"),We=e=>(0,u.hasHeritageType)(e,
22
+ "Http.Headers"),Xe=e=>(0,u.hasHeritageType)(e,"Http.Identity"),Ze=e=>(0,u.hasHeritageType)(
23
+ e,"Http.QueryStrings"),_e=e=>(0,u.hasHeritageType)(e,"Http.PathParameters"),$e=e=>(0,u.hasHeritageType)(
24
+ e,"Http.JsonBody"),Le=e=>(0,u.hasHeritageType)(e,"Http.Cors"),er=e=>(0,u.hasHeritageType)(
25
+ e,"Http.Cache"),rr=e=>(0,b.isTypeCallback)(e)||(0,b.isTypeFunction)(e),tr=e=>(0,b.isTypeCallback)(
26
+ e)||(0,b.isTypeFunction)(e);var pr=(e,t,r,n)=>{if(!(0,S.isTypeReference)(e))return or(e,t,n);let o=(0,a.getReferenceType)(
27
+ e,r);return o?or(o,t,n):null},or=(e,t,r)=>(0,S.isTypeObject)(e)?nr(t,(0,a.getObjectMembers)(
28
+ e),r):(0,a.isModelDeclaration)(e)?Ke(e)?nr(t,(0,a.getModelMembers)(e),r):(r.push(
29
+ new z(e.name,t.file)),null):(r.push(new P(t.file)),null),nr=(e,t,r)=>{let n={};for(let o of t)
30
30
  if(!(!(0,S.isModelProperty)(o)||o.inherited))switch(o.name){default:r.push(new a.InvalidServicePropertyError(
31
31
  e.name,o.name,e.file));break;case"memory":case"timeout":case"retention":n[o.name]=
32
32
  (0,a.getPropertyNumber)(o);break;case"listener":n.listener=(0,a.getServiceListener)(
33
- o.value,r);break}return n};var h=require("@ez4/reflection"),c=require("@ez4/common/library");var pr=require("@ez4/common/library"),C=class extends pr.IncompleteTypeError{constructor(t,r){
34
- super("Incomplete gateway route",t,r)}};var sr=require("@ez4/common/library"),k=class extends sr.IncompleteTypeError{constructor(t,r){
35
- super("Incomplete route authorizer",t,r)}};var f=require("@ez4/common/library"),v=require("@ez4/reflection"),yr=require("@ez4/utils");var pe=require("@ez4/common/library"),q=class extends pe.InvalidTypeError{constructor(r,n){
33
+ o.value,r);break}return n};var H=require("@ez4/reflection"),c=require("@ez4/common/library");var sr=require("@ez4/common/library"),C=class extends sr.IncompleteTypeError{constructor(t,r){
34
+ super("Incomplete gateway route",t,r)}};var ir=require("@ez4/common/library"),k=class extends ir.IncompleteTypeError{constructor(t,r){
35
+ super("Incomplete route authorizer",t,r)}};var f=require("@ez4/common/library"),I=require("@ez4/reflection"),yr=require("@ez4/utils");var pe=require("@ez4/common/library"),q=class extends pe.InvalidTypeError{constructor(r,n){
36
36
  super("Invalid route response",void 0,r,n);this.baseType=r}},D=class extends pe.IncorrectTypeError{constructor(r,n,o){
37
- super("Incorrect route response",r,n,o);this.responseType=r;this.baseType=n}};var ie=require("@ez4/common/library"),M=require("@ez4/schema/library"),g=require("@ez4/reflection");var se=require("@ez4/common/library"),B=class extends se.InvalidTypeError{constructor(t){
37
+ super("Incorrect route response",r,n,o);this.responseType=r;this.baseType=n}};var y=require("@ez4/reflection"),h=require("@ez4/schema/library"),ce=require("@ez4/common/library");var se=require("@ez4/common/library"),B=class extends se.InvalidTypeError{constructor(t){
38
38
  super("Invalid body",void 0,"Http.JsonBody",t)}},F=class extends se.IncorrectTypeError{constructor(r,n){
39
- super("Incorrect body",r,"Http.JsonBody",n);this.bodyType=r}};var ve=(e,t,r,n)=>Re(e,t,r,(o,p)=>Ee(o,p,r,n)),Ae=(e,t,r,n)=>Re(e,t,r,(o,p)=>cr(
40
- o)??Ee(o,p,r,n)),Re=(e,t,r,n)=>{if((0,g.isTypeUndefined)(e))return null;if(!(0,g.isTypeReference)(
41
- e))return n(e,t);let o=(0,ie.getReferenceType)(e,r);return o?n(o,t):null},cr=e=>(0,g.isTypeScalar)(
42
- e)?(0,M.getScalarSchema)(e):null,Ee=(e,t,r,n)=>(0,g.isTypeUnion)(e)?Gr(e.elements,
43
- t,r,(o,p)=>cr(o)??Ee(o,p,r,n)):(0,g.isTypeObject)(e)?ir(e,r):(0,ie.isModelDeclaration)(
44
- e)?_e(e)?ir(e,r):(n.push(new F(e.name,e.file)),null):(n.push(new B(t.file)),null),
45
- Gr=(e,t,r,n)=>{let o=[];for(let p of e){let s=Re(p,t,r,n);s&&o.push(s)}return o.
46
- length?(0,M.createUnionSchema)({elements:o}):null},ir=(e,t)=>{let r=(0,M.getObjectSchema)(
47
- e,t);return r&&(0,M.isObjectSchema)(r)?r:null};var H=require("@ez4/reflection"),x=require("@ez4/schema/library"),le=require("@ez4/common/library");var ce=require("@ez4/common/library"),U=class extends ce.InvalidTypeError{constructor(t){
48
- super("Invalid identity",void 0,"Http.Identity",t)}},N=class extends ce.IncorrectTypeError{constructor(r,n){
49
- super("Incorrect identity",r,"Http.Identity",n);this.identityType=r}};var I=(e,t,r,n)=>{if((0,H.isTypeUndefined)(e))return null;if(!(0,H.isTypeReference)(
50
- e))return lr(e,t,r,n);let o=(0,le.getReferenceType)(e,r);return o?lr(o,t,r,n):null},
51
- lr=(e,t,r,n)=>{if((0,H.isTypeUnion)(e))return Yr(e.elements,t,r,n);if((0,H.isTypeObject)(
52
- e))return mr(e,r);if(!(0,le.isModelDeclaration)(e))return n.push(new U(t.file)),
53
- null;if(!We(e))return n.push(new N(e.name,t.file)),null;let o=mr(e,r);return o&&
54
- (o.definitions={...o.definitions,extensible:!0}),o},Yr=(e,t,r,n)=>{let o=[];for(let p of e){
55
- let s=I(p,t,r,n);s&&o.push(s)}return o.length>1?(0,x.createUnionSchema)({elements:o}):
39
+ super("Incorrect body",r,"Http.JsonBody",n);this.bodyType=r}};var Ee=(e,t,r,n)=>le(e,r,o=>ie(o,t,r,n)),je=(e,t,r,n)=>le(e,r,o=>Re(o)??ie(o,t,r,
40
+ n)),le=(e,t,r)=>{if((0,y.isTypeUndefined)(e))return null;if(!(0,y.isTypeReference)(
41
+ e))return r(e);let n=(0,ce.getReferenceType)(e,t);return n?r(n):null},Re=e=>(0,y.isTypeScalar)(
42
+ e)?(0,h.getScalarSchema)(e):null,ie=(e,t,r,n)=>(0,y.isTypeUnion)(e)?Gr(e.elements,
43
+ r,o=>Re(o)??ie(o,t,r,n)):(0,y.isTypeArray)(e)?Yr(e.element,r,o=>Re(o)??ie(o,t,r,
44
+ n)):(0,y.isTypeObject)(e)?cr(e,r):(0,ce.isModelDeclaration)(e)?$e(e)?cr(e,r):(n.
45
+ push(new F(e.name,e.file)),null):(n.push(new B(t.file)),null),Gr=(e,t,r)=>{let n=[];
46
+ for(let o of e){let p=le(o,t,r);p&&n.push(p)}return n.length?(0,h.createUnionSchema)(
47
+ {elements:n}):null},Yr=(e,t,r)=>{let n=le(e,t,r);return n?(0,h.createArraySchema)(
48
+ {element:n}):null},cr=(e,t)=>{let r=(0,h.getObjectSchema)(e,t);return r&&(0,h.isObjectSchema)(
49
+ r)?r:null};var M=require("@ez4/reflection"),x=require("@ez4/schema/library"),ue=require("@ez4/common/library");var me=require("@ez4/common/library"),U=class extends me.InvalidTypeError{constructor(t){
50
+ super("Invalid identity",void 0,"Http.Identity",t)}},N=class extends me.IncorrectTypeError{constructor(r,n){
51
+ super("Incorrect identity",r,"Http.Identity",n);this.identityType=r}};var A=(e,t,r,n)=>{if((0,M.isTypeUndefined)(e))return null;if(!(0,M.isTypeReference)(
52
+ e))return lr(e,t,r,n);let o=(0,ue.getReferenceType)(e,r);return o?lr(o,t,r,n):null},
53
+ lr=(e,t,r,n)=>{if((0,M.isTypeUnion)(e))return Kr(e.elements,t,r,n);if((0,M.isTypeObject)(
54
+ e))return mr(e,r);if(!(0,ue.isModelDeclaration)(e))return n.push(new U(t.file)),
55
+ null;if(!Xe(e))return n.push(new N(e.name,t.file)),null;let o=mr(e,r);return o&&
56
+ (o.definitions={...o.definitions,extensible:!0}),o},Kr=(e,t,r,n)=>{let o=[];for(let p of e){
57
+ let s=A(p,t,r,n);s&&o.push(s)}return o.length>1?(0,x.createUnionSchema)({elements:o}):
56
58
  o[0]},mr=(e,t)=>{let r=(0,x.getObjectSchema)(e,t);return r&&(0,x.isObjectSchema)(
57
- r)?r:null};var ue=require("@ez4/common/library"),ae=require("@ez4/schema/library"),fe=require("@ez4/reflection");var me=require("@ez4/common/library"),V=class extends me.InvalidTypeError{constructor(t){
58
- super("Invalid headers",void 0,"Http.Headers",t)}},Q=class extends me.IncorrectTypeError{constructor(r,n){
59
- super("Incorrect headers",r,"Http.Headers",n);this.headersType=r}};var J=(e,t,r,n)=>{if(!(0,fe.isTypeReference)(e))return ur(e,t,r,n);let o=(0,ue.getReferenceType)(
60
- e,r);return o?ur(o,t,r,n):null},ur=(e,t,r,n)=>(0,fe.isTypeObject)(e)?ar(e,r):(0,ue.isModelDeclaration)(
61
- e)?Ke(e)?ar(e,r):(n.push(new Q(e.name,t.file)),null):(n.push(new V(t.file)),null),
62
- ar=(e,t)=>{let r=(0,ae.getObjectSchema)(e,t);return r&&(0,ae.isObjectSchema)(r)?
63
- r:null};var je=(e,t,r,n)=>{let o=Tr(e,t,r,n,"Http.AuthResponse");return o&&Kr(o)?o:null},
64
- Oe=(e,t,r,n)=>{let o=Tr(e,t,r,n,"Http.Response");return o&&Wr(o)?o:null},Tr=(e,t,r,n,o)=>{
65
- if(!(0,v.isTypeReference)(e))return fr(e,t,r,n,o);let p=(0,f.getReferenceType)(e,
66
- r);return p?fr(p,t,r,n,o):null},Kr=e=>!!e.identity,Wr=e=>(0,yr.isAnyNumber)(e.status),
67
- fr=(e,t,r,n,o)=>(0,v.isTypeObject)(e)?dr(e,t,(0,f.getObjectMembers)(e),r,n):(0,f.isModelDeclaration)(
59
+ r)?r:null};var fe=require("@ez4/common/library"),de=require("@ez4/schema/library"),ye=require("@ez4/reflection");var ae=require("@ez4/common/library"),V=class extends ae.InvalidTypeError{constructor(t){
60
+ super("Invalid headers",void 0,"Http.Headers",t)}},Q=class extends ae.IncorrectTypeError{constructor(r,n){
61
+ super("Incorrect headers",r,"Http.Headers",n);this.headersType=r}};var J=(e,t,r,n)=>{if(!(0,ye.isTypeReference)(e))return ur(e,t,r,n);let o=(0,fe.getReferenceType)(
62
+ e,r);return o?ur(o,t,r,n):null},ur=(e,t,r,n)=>(0,ye.isTypeObject)(e)?ar(e,r):(0,fe.isModelDeclaration)(
63
+ e)?We(e)?ar(e,r):(n.push(new Q(e.name,t.file)),null):(n.push(new V(t.file)),null),
64
+ ar=(e,t)=>{let r=(0,de.getObjectSchema)(e,t);return r&&(0,de.isObjectSchema)(r)?
65
+ r:null};var Oe=(e,t,r,n)=>{let o=Tr(e,t,r,n,"Http.AuthResponse");return o&&Wr(o)?o:null},
66
+ we=(e,t,r,n)=>{let o=Tr(e,t,r,n,"Http.Response");return o&&Xr(o)?o:null},Tr=(e,t,r,n,o)=>{
67
+ if(!(0,I.isTypeReference)(e))return fr(e,t,r,n,o);let p=(0,f.getReferenceType)(e,
68
+ r);return p?fr(p,t,r,n,o):null},Wr=e=>!!e.identity,Xr=e=>(0,yr.isAnyNumber)(e.status),
69
+ fr=(e,t,r,n,o)=>(0,I.isTypeObject)(e)?dr(e,t,(0,f.getObjectMembers)(e),r,n):(0,f.isModelDeclaration)(
68
70
  e)?(0,f.hasHeritageType)(e,o)?dr(e,t,(0,f.getModelMembers)(e),r,n):(n.push(new D(
69
71
  e.name,o,e.file)),null):(n.push(new q(o,t.file)),null),dr=(e,t,r,n,o)=>{let p={};
70
- for(let s of r)if(!(!(0,v.isModelProperty)(s)||s.inherited))switch(s.name){default:
72
+ for(let s of r)if(!(!(0,I.isModelProperty)(s)||s.inherited))switch(s.name){default:
71
73
  o.push(new f.InvalidServicePropertyError(t.name,s.name,e.file));break;case"statu\
72
74
  s":p.status=(0,f.getPropertyNumber)(s);break;case"headers":{p.headers=J(s.value,
73
75
  e,n,o),p.headers&&s.description&&(p.headers.description=s.description);break}case"\
74
- identity":{p.identity=I(s.value,e,n,o),p.identity&&s.description&&(p.identity.description=
75
- s.description);break}case"body":{p.body=Ae(s.value,e,n,o),p.body&&s.description&&
76
- (p.body.description=s.description);break}}return p};var y=require("@ez4/common/library"),A=require("@ez4/reflection");var de=require("@ez4/common/library"),G=class extends de.InvalidTypeError{constructor(r,n){
77
- super("Invalid route request",void 0,r,n);this.baseType=r}},Y=class extends de.IncorrectTypeError{constructor(r,n,o){
78
- super("Incorrect route request",r,n,o);this.requestType=r;this.baseType=n}};var Te=require("@ez4/common/library"),ge=require("@ez4/schema/library"),Me=require("@ez4/reflection");var ye=require("@ez4/common/library"),K=class extends ye.InvalidTypeError{constructor(t){
79
- super("Invalid request parameters",void 0,"Http.PathParameters",t)}},W=class extends ye.IncorrectTypeError{constructor(r,n){
76
+ identity":{p.identity=A(s.value,e,n,o),p.identity&&s.description&&(p.identity.description=
77
+ s.description);break}case"body":{p.body=je(s.value,e,n,o),p.body&&s.description&&
78
+ (p.body.description=s.description);break}}return p};var T=require("@ez4/common/library"),v=require("@ez4/reflection");var Te=require("@ez4/common/library"),G=class extends Te.InvalidTypeError{constructor(r,n){
79
+ super("Invalid route request",void 0,r,n);this.baseType=r}},Y=class extends Te.IncorrectTypeError{constructor(r,n,o){
80
+ super("Incorrect route request",r,n,o);this.requestType=r;this.baseType=n}};var he=require("@ez4/common/library"),Me=require("@ez4/schema/library"),He=require("@ez4/reflection");var ge=require("@ez4/common/library"),K=class extends ge.InvalidTypeError{constructor(t){
81
+ super("Invalid request parameters",void 0,"Http.PathParameters",t)}},W=class extends ge.IncorrectTypeError{constructor(r,n){
80
82
  super("Incorrect request parameters",r,"Http.PathParameters",n);this.parametersType=
81
- r}};var we=(e,t,r,n)=>{if(!(0,Me.isTypeReference)(e))return gr(e,t,r,n);let o=(0,Te.getReferenceType)(
82
- e,r);return o?gr(o,t,r,n):null},gr=(e,t,r,n)=>(0,Me.isTypeObject)(e)?Mr(e,r):(0,Te.isModelDeclaration)(
83
- e)?Ze(e)?Mr(e,r):(n.push(new W(e.name,e.file)),null):(n.push(new K(t.file)),null),
84
- Mr=(e,t)=>{let r=(0,ge.getObjectSchema)(e,t);return r&&(0,ge.isObjectSchema)(r)?
85
- r:null};var he=require("@ez4/common/library"),be=require("@ez4/schema/library"),Se=require("@ez4/reflection");var He=require("@ez4/common/library"),X=class extends He.InvalidTypeError{constructor(t){
86
- super("Invalid request query strings",void 0,"Http.QueryStrings",t)}},Z=class extends He.IncorrectTypeError{constructor(r,n){
83
+ r}};var Pe=(e,t,r,n)=>{if(!(0,He.isTypeReference)(e))return gr(e,t,r,n);let o=(0,he.getReferenceType)(
84
+ e,r);return o?gr(o,t,r,n):null},gr=(e,t,r,n)=>(0,He.isTypeObject)(e)?hr(e,r):(0,he.isModelDeclaration)(
85
+ e)?_e(e)?hr(e,r):(n.push(new W(e.name,e.file)),null):(n.push(new K(t.file)),null),
86
+ hr=(e,t)=>{let r=(0,Me.getObjectSchema)(e,t);return r&&(0,Me.isObjectSchema)(r)?
87
+ r:null};var Se=require("@ez4/common/library"),xe=require("@ez4/schema/library"),Ae=require("@ez4/reflection");var be=require("@ez4/common/library"),X=class extends be.InvalidTypeError{constructor(t){
88
+ super("Invalid request query strings",void 0,"Http.QueryStrings",t)}},Z=class extends be.IncorrectTypeError{constructor(r,n){
87
89
  super("Incorrect request query strings",r,"Http.QueryStrings",n);this.queryType=
88
- r}};var Pe=(e,t,r,n)=>{if(!(0,Se.isTypeReference)(e))return Hr(e,t,r,n);let o=(0,he.getReferenceType)(
89
- e,r);return o?Hr(o,t,r,n):null},Hr=(e,t,r,n)=>(0,Se.isTypeObject)(e)?hr(e,r):(0,he.isModelDeclaration)(
90
- e)?Xe(e)?hr(e,r):(n.push(new Z(e.name,t.file)),null):(n.push(new X(t.file)),null),
91
- hr=(e,t)=>{let r=(0,be.getObjectSchema)(e,t);return r&&(0,be.isObjectSchema)(r)?
92
- r:null};var ze=(e,t,r,n)=>xr(e,t,r,n,"Http.AuthRequest"),Ce=(e,t,r,n)=>xr(e,t,r,n,"Http.\
93
- Request"),xr=(e,t,r,n,o)=>{if(!(0,A.isTypeReference)(e))return br(e,t,r,n,o);let p=(0,y.getReferenceType)(
94
- e,r);return p?br(p,t,r,n,o):null},br=(e,t,r,n,o)=>(0,A.isTypeObject)(e)?Sr(e,t,(0,y.getObjectMembers)(
95
- e),r,n):(0,y.isModelDeclaration)(e)?(0,y.hasHeritageType)(e,o)?Sr(e,t,(0,y.getModelMembers)(
90
+ r}};var ze=(e,t,r,n)=>{if(!(0,Ae.isTypeReference)(e))return Mr(e,t,r,n);let o=(0,Se.getReferenceType)(
91
+ e,r);return o?Mr(o,t,r,n):null},Mr=(e,t,r,n)=>(0,Ae.isTypeObject)(e)?Hr(e,r):(0,Se.isModelDeclaration)(
92
+ e)?Ze(e)?Hr(e,r):(n.push(new Z(e.name,t.file)),null):(n.push(new X(t.file)),null),
93
+ Hr=(e,t)=>{let r=(0,xe.getObjectSchema)(e,t);return r&&(0,xe.isObjectSchema)(r)?
94
+ r:null};var Ce=(e,t,r,n)=>xr(e,t,r,n,"Http.AuthRequest"),ke=(e,t,r,n)=>xr(e,t,r,n,"Http.\
95
+ Request"),xr=(e,t,r,n,o)=>{if(!(0,v.isTypeReference)(e))return br(e,t,r,n,o);let p=(0,T.getReferenceType)(
96
+ e,r);return p?br(p,t,r,n,o):null},br=(e,t,r,n,o)=>(0,v.isTypeObject)(e)?Sr(e,t,(0,T.getObjectMembers)(
97
+ e),r,n):(0,T.isModelDeclaration)(e)?(0,T.hasHeritageType)(e,o)?Sr(e,t,(0,T.getModelMembers)(
96
98
  e),r,n):(n.push(new Y(e.name,o,e.file)),null):(n.push(new G(o,t.file)),null),Sr=(e,t,r,n,o)=>{
97
- let p={};for(let s of r)if(!(!(0,A.isModelProperty)(s)||s.inherited))switch(s.name){default:
98
- o.push(new y.InvalidServicePropertyError(t.name,s.name,e.file));break;case"heade\
99
+ let p={};for(let s of r)if(!(!(0,v.isModelProperty)(s)||s.inherited))switch(s.name){default:
100
+ o.push(new T.InvalidServicePropertyError(t.name,s.name,e.file));break;case"heade\
99
101
  rs":{p.headers=J(s.value,e,n,o),p.headers&&s.description&&(p.headers.description=
100
- s.description);break}case"identity":{p.identity=I(s.value,e,n,o),p.identity&&s.description&&
101
- (p.identity.description=s.description);break}case"query":{p.query=Pe(s.value,e,n,
102
+ s.description);break}case"identity":{p.identity=A(s.value,e,n,o),p.identity&&s.description&&
103
+ (p.identity.description=s.description);break}case"query":{p.query=ze(s.value,e,n,
102
104
  o),p.query&&s.description&&(p.query.description=s.description);break}case"parame\
103
- ters":{p.parameters=we(s.value,e,n,o),p.parameters&&s.description&&(p.parameters.
104
- description=s.description);break}case"body":{p.body=ve(s.value,e,n,o),p.body&&s.
105
- description&&(p.body.description=s.description);break}}return p};var ke=(e,t,r,n)=>{if(!er(e))return null;let o={},p=new Set(["name","file"]);if(e.
105
+ ters":{p.parameters=Pe(s.value,e,n,o),p.parameters&&s.description&&(p.parameters.
106
+ description=s.description);break}case"body":{p.body=Ee(s.value,e,n,o),p.body&&s.
107
+ description&&(p.body.description=s.description);break}}return p};var qe=(e,t,r,n)=>{if(!rr(e))return null;let o={},p=new Set(["name","file"]);if(e.
106
108
  description&&(o.description=e.description),(o.name=e.name)&&p.delete("name"),(o.
107
109
  file=e.file)&&p.delete("file"),e.parameters){let[{value:s}]=e.parameters;o.request=
108
- ze(s,t,r,n)}return e.return&&(o.response=je(e.return,t,r,n)),Xr(o)?o:(n.push(new k(
109
- [...p],e.file)),null)},Xr=e=>!!e.name&&!!e.file;var Ir=require("@ez4/common/library"),_=class extends Ir.IncompleteTypeError{constructor(t,r){
110
- super("Incomplete route handler",t,r)}};var qe=(e,t,r,n)=>{if(!rr(e))return null;let o={},p=new Set(["name","file","resp\
110
+ Ce(s,t,r,n)}return e.return&&(o.response=Oe(e.return,t,r,n)),Zr(o)?o:(n.push(new k(
111
+ [...p],e.file)),null)},Zr=e=>!!e.name&&!!e.file;var Ar=require("@ez4/common/library"),_=class extends Ar.IncompleteTypeError{constructor(t,r){
112
+ super("Incomplete route handler",t,r)}};var De=(e,t,r,n)=>{if(!tr(e))return null;let o={},p=new Set(["name","file","resp\
111
113
  onse"]);if(e.description&&(o.description=e.description),(o.name=e.name)&&p.delete(
112
114
  "name"),(o.file=e.file)&&p.delete("file"),e.parameters){let[{value:s}]=e.parameters;
113
- o.request=Ce(s,t,r,n)}if(e.return){let s=Oe(e.return,t,r,n);s&&(o.response=s,p.delete(
114
- "response"))}return Zr(o)?o:(n.push(new _([...p],e.file)),null)},Zr=e=>!!e.name&&
115
- !!e.file&&!!e.response;var De=(e,t,r,n)=>{let o=(0,c.getPropertyTuple)(t)??[];return Rr(o,e,r,n)},Rr=(e,t,r,n)=>{
116
- let o=[];for(let p of e){let s=_r(p,t,r,n);Array.isArray(s)?o.push(...s):s&&o.push(
117
- s)}return o},_r=(e,t,r,n)=>{if(!(0,h.isTypeReference)(e))return vr(e,t,r,n);let o=(0,c.getReferenceType)(
118
- e,r);return o?vr(o,t,r,n):null},$r=e=>!!e.path&&!!e.handler,vr=(e,t,r,n)=>Ge(e)?
119
- Ar(e,t,(0,c.getModelMembers)(e),r,n):(0,h.isTypeObject)(e)?Ar(e,t,(0,c.getObjectMembers)(
120
- e),r,n):(0,h.isTypeTuple)(e)&&e.spread?Rr(e.elements,t,r,n):null,Ar=(e,t,r,n,o)=>{
121
- let p={},s=new Set(["path","handler"]);for(let i of r)if(!(!(0,h.isModelProperty)(
115
+ o.request=ke(s,t,r,n)}if(e.return){let s=we(e.return,t,r,n);s&&(o.response=s,p.delete(
116
+ "response"))}return _r(o)?o:(n.push(new _([...p],e.file)),null)},_r=e=>!!e.name&&
117
+ !!e.file&&!!e.response;var Be=(e,t,r,n)=>{let o=(0,c.getPropertyTuple)(t)??[];return Rr(o,e,r,n)},Rr=(e,t,r,n)=>{
118
+ let o=[];for(let p of e){let s=$r(p,t,r,n);Array.isArray(s)?o.push(...s):s&&o.push(
119
+ s)}return o},$r=(e,t,r,n)=>{if(!(0,H.isTypeReference)(e))return Ir(e,t,r,n);let o=(0,c.getReferenceType)(
120
+ e,r);return o?Ir(o,t,r,n):null},Lr=e=>!!e.path&&!!e.handler,Ir=(e,t,r,n)=>Ye(e)?
121
+ vr(e,t,(0,c.getModelMembers)(e),r,n):(0,H.isTypeObject)(e)?vr(e,t,(0,c.getObjectMembers)(
122
+ e),r,n):(0,H.isTypeTuple)(e)&&e.spread?Rr(e.elements,t,r,n):null,vr=(e,t,r,n,o)=>{
123
+ let p={},s=new Set(["path","handler"]);for(let i of r)if(!(!(0,H.isModelProperty)(
122
124
  i)||i.inherited))switch(i.name){default:o.push(new c.InvalidServicePropertyError(
123
- t.name,i.name,e.file));break;case"path":{let m=(0,c.getPropertyString)(i);m&&Qe(
124
- m)&&(s.delete(i.name),p.path=m);break}case"handler":(p.handler=qe(i.value,t,n,o))&&
125
+ t.name,i.name,e.file));break;case"path":{let m=(0,c.getPropertyString)(i);m&&Je(
126
+ m)&&(s.delete(i.name),p.path=m);break}case"handler":(p.handler=De(i.value,t,n,o))&&
125
127
  s.delete(i.name);break;case"memory":case"timeout":case"retention":p[i.name]=(0,c.getPropertyNumber)(
126
128
  i);break;case"cors":p.cors=(0,c.getPropertyBoolean)(i);break;case"authorizer":p.
127
- authorizer=ke(i.value,t,n,o);break;case"listener":p.listener=(0,c.getServiceListener)(
129
+ authorizer=qe(i.value,t,n,o);break;case"listener":p.listener=(0,c.getServiceListener)(
128
130
  i.value,o);break;case"variables":p.variables=(0,c.getLinkedVariableList)(i,o);break}
129
- return $r(p)?p:(o.push(new C([...s],e.file)),null)};var l=require("@ez4/common/library"),E=require("@ez4/reflection");var R=require("@ez4/common/library"),$=class extends R.IncompleteTypeError{constructor(t,r){
131
+ return Lr(p)?p:(o.push(new C([...s],e.file)),null)};var l=require("@ez4/common/library"),E=require("@ez4/reflection");var R=require("@ez4/common/library"),$=class extends R.IncompleteTypeError{constructor(t,r){
130
132
  super("Incomplete HTTP CORS",t,r)}},L=class extends R.InvalidTypeError{constructor(t){
131
133
  super("Invalid HTTP CORS type",void 0,"Http.Cors",t)}},ee=class extends R.IncorrectTypeError{constructor(r,n){
132
- super("Incorrect HTTP CORS type",r,"Http.Cors",n);this.fallbackType=r}};var Be=(e,t,r,n)=>{if(!(0,E.isTypeReference)(e))return Er(e,t,n);let o=(0,l.getReferenceType)(
133
- e,r);return o?Er(o,t,n):null},Lr=e=>!!e.allowOrigins?.length,Er=(e,t,r)=>(0,E.isTypeObject)(
134
- e)?jr(e,t,(0,l.getObjectMembers)(e),r):(0,l.isModelDeclaration)(e)?$e(e)?jr(e,t,
134
+ super("Incorrect HTTP CORS type",r,"Http.Cors",n);this.fallbackType=r}};var Fe=(e,t,r,n)=>{if(!(0,E.isTypeReference)(e))return Er(e,t,n);let o=(0,l.getReferenceType)(
135
+ e,r);return o?Er(o,t,n):null},et=e=>!!e.allowOrigins?.length,Er=(e,t,r)=>(0,E.isTypeObject)(
136
+ e)?jr(e,t,(0,l.getObjectMembers)(e),r):(0,l.isModelDeclaration)(e)?Le(e)?jr(e,t,
135
137
  (0,l.getModelMembers)(e),r):(r.push(new ee(e.name,e.file)),null):(r.push(new L(t.
136
138
  file)),null),jr=(e,t,r,n)=>{let o={},p=new Set(["allowOrigins"]);for(let s of r)
137
139
  if(!(!(0,E.isModelProperty)(s)||s.inherited))switch(s.name){default:n.push(new l.InvalidServicePropertyError(
138
140
  t.name,s.name,e.file));break;case"allowOrigins":case"allowMethods":case"allowHea\
139
- ders":case"exposeHeaders":o[s.name]=et(s);break;case"allowCredentials":o.allowCredentials=
141
+ ders":case"exposeHeaders":o[s.name]=rt(s);break;case"allowCredentials":o.allowCredentials=
140
142
  (0,l.getPropertyBoolean)(s);break;case"maxAge":o.maxAge=(0,l.getPropertyNumber)(
141
- s);break}return Lr(o)?o:(n.push(new $([...p],e.file)),null)},et=e=>{let t=(0,l.getPropertyTuple)(
142
- e)??[],r=[];for(let n of t){let o=(0,l.getLiteralString)(n);o&&r.push(o)}return r};var T=require("@ez4/common/library"),O=require("@ez4/reflection"),Fe=require("@ez4/utils");var j=require("@ez4/common/library"),re=class extends j.IncompleteTypeError{constructor(t,r){
143
+ s);break}return et(o)?o:(n.push(new $([...p],e.file)),null)},rt=e=>{let t=(0,l.getPropertyTuple)(
144
+ e)??[],r=[];for(let n of t){let o=(0,l.getLiteralString)(n);o&&r.push(o)}return r};var g=require("@ez4/common/library"),O=require("@ez4/reflection"),Ue=require("@ez4/utils");var j=require("@ez4/common/library"),re=class extends j.IncompleteTypeError{constructor(t,r){
143
145
  super("Incomplete gateway cache",t,r)}},te=class extends j.InvalidTypeError{constructor(t){
144
146
  super("Invalid gateway cache type",void 0,"Http.Cache",t)}},oe=class extends j.IncorrectTypeError{constructor(r,n){
145
- super("Incorrect gateway cache type",r,"Http.Cache",n);this.cacheType=r}};var Ue=(e,t,r,n)=>{if(!(0,O.isTypeReference)(e))return Or(e,t,n);let o=(0,T.getReferenceType)(
146
- e,r);return o?Or(o,t,n):null},rt=e=>(0,Fe.isAnyNumber)(e.authorizerTTL),Or=(e,t,r)=>(0,O.isTypeObject)(
147
- e)?wr(e,t,(0,T.getObjectMembers)(e),r):(0,T.isModelDeclaration)(e)?Le(e)?wr(e,t,
148
- (0,T.getModelMembers)(e),r):(r.push(new oe(e.name,e.file)),null):(r.push(new te(
147
+ super("Incorrect gateway cache type",r,"Http.Cache",n);this.cacheType=r}};var Ne=(e,t,r,n)=>{if(!(0,O.isTypeReference)(e))return Or(e,t,n);let o=(0,g.getReferenceType)(
148
+ e,r);return o?Or(o,t,n):null},tt=e=>(0,Ue.isAnyNumber)(e.authorizerTTL),Or=(e,t,r)=>(0,O.isTypeObject)(
149
+ e)?wr(e,t,(0,g.getObjectMembers)(e),r):(0,g.isModelDeclaration)(e)?er(e)?wr(e,t,
150
+ (0,g.getModelMembers)(e),r):(r.push(new oe(e.name,e.file)),null):(r.push(new te(
149
151
  t.file)),null),wr=(e,t,r,n)=>{let o={},p=new Set(["authorizerTTL"]);for(let s of r)
150
- if(!(!(0,O.isModelProperty)(s)||s.inherited))switch(s.name){default:n.push(new T.InvalidServicePropertyError(
151
- t.name,s.name,e.file));break;case"authorizerTTL":{let i=(0,T.getPropertyNumber)(
152
- s);(0,Fe.isAnyNumber)(i)&&(o[s.name]=i,p.delete(s.name));break}}return rt(o)?o:(n.
153
- push(new re([...p],e.file)),null)};var Ne=e=>{let t={},r=[];for(let n in e){let o=e[n];if(!Je(o)||(0,d.isExternalStatement)(
152
+ if(!(!(0,O.isModelProperty)(s)||s.inherited))switch(s.name){default:n.push(new g.InvalidServicePropertyError(
153
+ t.name,s.name,e.file));break;case"authorizerTTL":{let i=(0,g.getPropertyNumber)(
154
+ s);(0,Ue.isAnyNumber)(i)&&(o[s.name]=i,p.delete(s.name));break}}return tt(o)?o:(n.
155
+ push(new re([...p],e.file)),null)};var Ve=e=>{let t={},r=[];for(let n in e){let o=e[n];if(!Ge(o)||(0,d.isExternalStatement)(
154
156
  o))continue;let p={type:ne,extras:{}},s=new Set(["routes"]),i=o.file;p.name=o.name,
155
157
  o.description&&(p.description=o.description);for(let m of(0,d.getModelMembers)(o))
156
158
  if(!(!(0,Pr.isModelProperty)(m)||m.inherited))switch(m.name){default:r.push(new d.InvalidServicePropertyError(
157
- p.name,m.name,i));break;case"routes":(p.routes=De(o,m,e,r))&&s.delete(m.name);break;case"\
158
- name":p.displayName=(0,d.getPropertyString)(m);break;case"defaults":p.defaults=nr(
159
- m.value,o,e,r);break;case"cors":p.cors=Be(m.value,o,e,r);break;case"cache":p.cache=
160
- Ue(m.value,o,e,r);break;case"variables":p.variables=(0,d.getLinkedVariableList)(
161
- m,r);break;case"services":p.services=(0,d.getLinkedServiceList)(m,e,r);break}if(!tt(
159
+ p.name,m.name,i));break;case"routes":(p.routes=Be(o,m,e,r))&&s.delete(m.name);break;case"\
160
+ name":p.displayName=(0,d.getPropertyString)(m);break;case"defaults":p.defaults=pr(
161
+ m.value,o,e,r);break;case"cors":p.cors=Fe(m.value,o,e,r);break;case"cache":p.cache=
162
+ Ne(m.value,o,e,r);break;case"variables":p.variables=(0,d.getLinkedVariableList)(
163
+ m,r);break;case"services":p.services=(0,d.getLinkedServiceList)(m,e,r);break}if(!ot(
162
164
  p)){r.push(new w([...s],i));continue}if(t[o.name]){r.push(new d.DuplicateServiceError(
163
- o.name,i));continue}t[o.name]=p}return{services:t,errors:r}},tt=e=>!!e.name&&!!e.
164
- routes&&!!e.extras;var zr=!1,ot=()=>{zr||((0,Cr.registerTriggers)(),(0,kr.registerTriggers)(),(0,qr.createTrigger)(
165
- "@ez4/gateway",{"metadata:getServices":Ne}),zr=!1)};var xe=require("@ez4/common/library"),P=class extends xe.InvalidTypeError{constructor(t){
166
- super("Invalid defaults",void 0,"Http.Defaults",t)}},z=class extends xe.IncorrectTypeError{constructor(r,n){
165
+ o.name,i));continue}t[o.name]=p}return{services:t,errors:r}},ot=e=>!!e.name&&!!e.
166
+ routes&&!!e.extras;var zr=!1,nt=()=>{zr||((0,Cr.registerTriggers)(),(0,kr.registerTriggers)(),(0,qr.createTrigger)(
167
+ "@ez4/gateway",{"metadata:getServices":Ve}),zr=!1)};var Ie=require("@ez4/common/library"),P=class extends Ie.InvalidTypeError{constructor(t){
168
+ super("Invalid defaults",void 0,"Http.Defaults",t)}},z=class extends Ie.IncorrectTypeError{constructor(r,n){
167
169
  super("Incorrect defaults",r,"Http.Defaults",n);this.defaultsType=r}};0&&(module.exports={IncompleteAuthorizerError,IncompleteCacheError,IncompleteCorsError,
168
170
  IncompleteHandlerError,IncompleteRouteError,IncompleteServiceError,IncorrectBodyTypeError,
169
171
  IncorrectCacheTypeError,IncorrectCorsTypeError,IncorrectDefaultsTypeError,IncorrectHeadersTypeError,
package/dist/library.mjs CHANGED
@@ -1,176 +1,177 @@
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){
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
5
  super("Incomplete service",t,r)}};import{InvalidServicePropertyError as We,isModelDeclaration as Xe,getPropertyNumber as Ze,
6
6
  getObjectMembers as _e,getModelMembers as $e,getServiceListener as Le,getReferenceType as er}from"@ez4/common/library";
7
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(
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
16
  o)||o.inherited))switch(o.name){default:r.push(new We(e.name,o.name,e.file));break;case"\
17
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){
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
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";
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
27
  var T=class extends ir{constructor(r,n){super("Invalid route response",void 0,r,
28
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.
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.
67
68
  headers.description=s.description);break}case"identity":{p.identity=m(s.value,e,
68
69
  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,
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,
95
96
  n,o),p.headers&&s.description&&(p.headers.description=s.description);break}case"\
96
97
  identity":{p.identity=m(s.value,e,n,o),p.identity&&s.description&&(p.identity.description=
97
98
  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
+ (p.query.description=s.description);break}case"parameters":{p.parameters=He(s.value,
99
100
  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.
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.
102
103
  description&&(o.description=e.description),(o.name=e.name)&&p.delete("name"),(o.
103
104
  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\
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\
107
108
  onse"]);if(e.description&&(o.description=e.description),(o.name=e.name)&&p.delete(
108
109
  "name"),(o.file=e.file)&&p.delete("file"),e.parameters){let[{value:s}]=e.parameters;
109
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(
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(
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(
115
116
  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(
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(
118
119
  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,
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,
171
172
  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};
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};
176
177
  //# 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",
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
8
  t)}},i=class extends r{constructor(e,t){super(401,e||"Unauthorized",t)}},a=class extends r{constructor(e,t){
9
9
  super(403,e||"Forbidden",t)}},c=class extends r{constructor(e,t){super(404,e||"N\
10
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",
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
13
  t)}};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){
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
4
  super(403,e||"Forbidden",t)}},u=class extends s{constructor(e,t){super(404,e||"N\
5
5
  ot found",t)}},i=class extends s{constructor(e,t){super(415,e||"Unsupported medi\
6
6
  a type",t)}},a=class extends s{constructor(e,t){super(422,e||"Unprocessable enti\
7
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,
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,
10
10
  i as HttpUnsupportedMediaTypeError};
11
11
  //# sourceMappingURL=main.mjs.map
@@ -1,6 +1,6 @@
1
1
  import type { AllType, SourceMap, TypeModel, TypeObject } from '@ez4/reflection';
2
- import type { ObjectSchema, UnionSchema } from '@ez4/schema/library';
2
+ import type { ArraySchema, ObjectSchema, UnionSchema } from '@ez4/schema/library';
3
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;
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;
6
6
  export {};
@@ -131,6 +131,12 @@ export interface HttpResponse {
131
131
  */
132
132
  body?: HttpJsonBody;
133
133
  }
134
+ export interface HttpProvider {
135
+ /**
136
+ * All services associated to the provider.
137
+ */
138
+ services: Record<string, unknown>;
139
+ }
134
140
  /**
135
141
  * Incoming request.
136
142
  */
@@ -155,12 +161,12 @@ export type HttpIncoming<T extends HttpRequest | HttpAuthRequest> = T & {
155
161
  /**
156
162
  * Request listener.
157
163
  */
158
- export type HttpListener<T extends HttpRequest | HttpAuthRequest> = (event: Service.Event<HttpIncoming<T>>, context: Service.Context<Http.Service>) => Promise<void> | void;
164
+ export type HttpListener<T extends HttpRequest | HttpAuthRequest> = (event: Service.Event<HttpIncoming<T>>, context: Service.Context<Http.Service | HttpProvider>) => Promise<void> | void;
159
165
  /**
160
166
  * Request authorizer.
161
167
  */
162
- export type HttpAuthorizer<T extends HttpAuthRequest> = (request: HttpIncoming<T> | T, context: Service.Context<Http.Service>) => Promise<HttpAuthResponse> | HttpAuthResponse;
168
+ export type HttpAuthorizer<T extends HttpAuthRequest> = (request: HttpIncoming<T> | T, context: Service.Context<Http.Service | HttpProvider>) => Promise<HttpAuthResponse> | HttpAuthResponse;
163
169
  /**
164
170
  * Request handler.
165
171
  */
166
- export type HttpHandler<T extends HttpRequest> = (request: HttpIncoming<T> | T, context: Service.Context<Http.Service>) => Promise<HttpResponse> | HttpResponse;
172
+ export type HttpHandler<T extends HttpRequest> = (request: HttpIncoming<T> | T, context: Service.Context<Http.Service | HttpProvider>) => Promise<HttpResponse> | HttpResponse;
@@ -1,7 +1,7 @@
1
1
  import type { Service } from '@ez4/common';
2
2
  import type { LinkedVariables } from '@ez4/project/library';
3
3
  import type { HttpPath } from '../types/common.js';
4
- import type { HttpCors, HttpHeaders, HttpIdentity, HttpPathParameters, HttpQueryStrings, HttpJsonBody, HttpAuthRequest, HttpAuthResponse, HttpRequest, HttpResponse, HttpIncoming, HttpListener, HttpAuthorizer, HttpHandler, HttpCache } from './common.js';
4
+ import type { HttpCors, HttpHeaders, HttpIdentity, HttpPathParameters, HttpQueryStrings, HttpJsonBody, HttpAuthRequest, HttpAuthResponse, HttpRequest, HttpResponse, HttpProvider, HttpIncoming, HttpListener, HttpAuthorizer, HttpHandler, HttpCache } from './common.js';
5
5
  /**
6
6
  * Provide all contracts for a self-managed HTTP service.
7
7
  */
@@ -17,6 +17,7 @@ export declare namespace Http {
17
17
  type Request = HttpRequest;
18
18
  type AuthResponse = HttpAuthResponse;
19
19
  type Response = HttpResponse;
20
+ type Provider = HttpProvider;
20
21
  type Incoming<T extends Request | AuthRequest> = HttpIncoming<T>;
21
22
  type Listener<T extends Request | AuthRequest> = HttpListener<T>;
22
23
  type Authorizer<T extends AuthRequest> = HttpAuthorizer<T>;
@@ -1,6 +1,6 @@
1
+ import type { ArraySchema, ObjectSchema, ScalarSchema, UnionSchema } from '@ez4/schema';
1
2
  import type { LinkedVariables } from '@ez4/project/library';
2
3
  import type { ServiceListener } from '@ez4/common/library';
3
- import type { BooleanSchema, NumberSchema, ObjectSchema, StringSchema, UnionSchema } from '@ez4/schema';
4
4
  export type HttpVerb = 'ANY' | 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS';
5
5
  export type HttpPath = `${HttpVerb} /${string}`;
6
6
  export type HttpAuthRequest = {
@@ -16,12 +16,12 @@ export type HttpRequest = {
16
16
  identity?: ObjectSchema | UnionSchema | null;
17
17
  parameters?: ObjectSchema | null;
18
18
  query?: ObjectSchema | null;
19
- body?: ObjectSchema | UnionSchema | null;
19
+ body?: ObjectSchema | UnionSchema | ArraySchema | null;
20
20
  };
21
21
  export type HttpResponse = {
22
22
  status: number;
23
23
  headers?: ObjectSchema | null;
24
- body?: ObjectSchema | UnionSchema | NumberSchema | StringSchema | BooleanSchema | null;
24
+ body?: ObjectSchema | UnionSchema | ArraySchema | ScalarSchema | null;
25
25
  };
26
26
  export type HttpHandler = {
27
27
  name: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ez4/gateway",
3
3
  "description": "EZ4: Components to build gateway services",
4
- "version": "0.18.0",
4
+ "version": "0.19.0",
5
5
  "author": "Silas B.",
6
6
  "license": "MIT",
7
7
  "type": "module",
@@ -42,10 +42,10 @@
42
42
  "live:publish": "npm run test && npm publish --access public"
43
43
  },
44
44
  "dependencies": {
45
- "@ez4/common": "^0.18.0",
46
- "@ez4/project": "^0.18.0",
47
- "@ez4/reflection": "^0.18.0",
48
- "@ez4/schema": "^0.18.0",
49
- "@ez4/utils": "^0.18.0"
45
+ "@ez4/common": "^0.19.0",
46
+ "@ez4/project": "^0.19.0",
47
+ "@ez4/reflection": "^0.19.0",
48
+ "@ez4/schema": "^0.19.0",
49
+ "@ez4/utils": "^0.19.0"
50
50
  }
51
51
  }