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