@ez4/gateway 0.23.0 → 0.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/library.mjs CHANGED
@@ -1,197 +1,211 @@
1
- var Ge=Object.defineProperty;var p=(e,t)=>Ge(e,"name",{value:t,configurable:!0});import{registerTriggers as Go}from"@ez4/common/library";import{registerTriggers as Yo}from"@ez4/schema/library";
2
- import{createTrigger as Ko}from"@ez4/project/library";import{DuplicateServiceError as qo,isExternalDeclaration as Do,getLinkedServiceList as Fo,
3
- getLinkedVariableList as Bo,getModelMembers as No,getPropertyString as Uo,InvalidServicePropertyError as Vo}from"@ez4/common/library";
4
- import{isModelProperty as Qo}from"@ez4/reflection";var Q="@ez4/http",_o=p(e=>e.type===Q,"isHttpService");import{IncompleteTypeError as Ye}from"@ez4/common/library";var y=class extends Ye{static{p(this,"IncompleteServiceError")}constructor(t,r){
5
- super("Incomplete service",t,r)}};import{InvalidServicePropertyError as sr,isModelDeclaration as ir,getPropertyNumber as cr,
6
- getObjectMembers as lr,getModelMembers as mr,getServiceListener as ar,getReferenceType as ur}from"@ez4/common/library";
7
- import{isModelProperty as fr,isTypeObject as yr,isTypeReference as dr}from"@ez4/reflection";import{hasHeritageType as a,isClassDeclaration as Ke,isModelDeclaration as We}from"@ez4/common/library";
8
- import{isTypeCallback as W,isTypeFunction as X}from"@ez4/reflection";var Xe=new Set(["ANY","GET","POST","PUT","PATCH","DELETE","OPTIONS"]),Z=p(e=>{let[
9
- t]=e.split(" ",2);return Xe.has(t)},"isHttpPath"),_=p(e=>Ke(e)&&a(e,"Http.Servic\
10
- e"),"isHttpService"),$=p(e=>We(e)&&a(e,"Http.Route"),"isHttpRoute");var L=p(e=>a(e,"Http.Defaults"),"isHttpDefaults"),ee=p(e=>a(e,"Http.Headers"),"i\
11
- sHttpHeaders"),re=p(e=>a(e,"Http.Identity"),"isHttpIdentity"),te=p(e=>a(e,"Http.\
12
- QueryStrings"),"isHttpQuery"),oe=p(e=>a(e,"Http.PathParameters"),"isHttpParamete\
13
- rs"),ne=p(e=>a(e,"Http.JsonBody"),"isJsonBody"),pe=p(e=>a(e,"Http.Cors"),"isHttp\
14
- Cors"),se=p(e=>a(e,"Http.Cache"),"isHttpCache"),ie=p(e=>W(e)||X(e),"isHttpAuthor\
15
- izer"),ce=p(e=>W(e)||X(e),"isHttpHandler");import{InvalidServicePropertyError as Ze,getObjectMembers as _e,getPropertyTuple as $e,
16
- getReferenceType as me}from"@ez4/common/library";import{isAnyNumber as Le,isEmptyObject as er}from"@ez4/utils";
17
- import{isModelProperty as rr,isTypeClass as tr,isTypeObject as or,isTypeReference as ae}from"@ez4/reflection";var d=p((e,t,r,o)=>{if(!ae(e))return le(e,t,r,o);let n=me(e,r);return n?le(n,t,r,
18
- o):null},"getHttpErrors"),le=p((e,t,r,o)=>or(e)?nr(e,t,_e(e),r,o):null,"getTypeE\
19
- rrors"),nr=p((e,t,r,o,n)=>{let s={};for(let i of r){if(!rr(i)||i.inherited)continue;
20
- let c=parseInt(i.name,10);Le(c)||n.push(new Ze(t.name,i.name,e.file));let l=pr(i,
21
- c,t,o,n);l&&Object.assign(s,l)}return er(s)?null:s},"getTypeFromMembers"),pr=p((e,t,r,o,n)=>{
22
- let s=$e(e)??[],i={};for(let c of s){if(!ae(c)){n.push(new u(r.file));continue}let l=me(
23
- c,o);if(!l||!tr(l)){n.push(new u(r.file));continue}i[l.name]=t}return i},"getErr\
24
- orClasses");var ye=p((e,t,r,o)=>{if(!dr(e))return ue(e,t,r,o);let n=ur(e,r);return n?ue(n,t,
25
- r,o):null},"getHttpDefaults"),ue=p((e,t,r,o)=>yr(e)?fe(t,lr(e),r,o):ir(e)?L(e)?fe(
26
- t,mr(e),r,o):(o.push(new g(e.name,t.file)),null):(o.push(new T(t.file)),null),"g\
27
- etTypeDefaults"),fe=p((e,t,r,o)=>{let n={};for(let s of t)if(!(!fr(s)||s.inherited))
28
- switch(s.name){default:o.push(new sr(e.name,s.name,e.file));break;case"httpError\
29
- s":n.httpErrors=d(s.value,e,r,o);break;case"memory":case"logRetention":case"time\
30
- out":n[s.name]=cr(s);break;case"listener":n.listener=ar(s.value,o);break}return n},
31
- "getTypeFromMembers");import{isModelProperty as Gt,isTypeObject as Yt,isTypeReference as Kt,isTypeTuple as Wt}from"@ez4/reflection";
32
- import{InvalidServicePropertyError as Xt,getLinkedVariableList as Zt,getPropertyBoolean as _t,
33
- getPropertyNumber as $t,getPropertyString as Lt,getObjectMembers as eo,getModelMembers as ro,
34
- getServiceListener as to,getReferenceType as oo,getPropertyTuple as no}from"@ez4/common/library";import{IncompleteTypeError as Tr,TypeError as gr}from"@ez4/common/library";var M=class extends Tr{static{p(this,"IncompleteRouteError")}constructor(t,r){super(
35
- "Incomplete gateway route",t,r)}},u=class extends gr{static{p(this,"InvalidRoute\
36
- ErrorTypeError")}constructor(t){super("Invalid route error type.",t)}};import{IncompleteTypeError as Mr}from"@ez4/common/library";var H=class extends Mr{static{p(this,"IncompleteAuthorizerError")}constructor(t,r){
37
- super("Incomplete route authorizer",t,r)}};import{InvalidServicePropertyError as ot,isModelDeclaration as nt,hasHeritageType as pt,
38
- getModelMembers as st,getObjectMembers as it,getPropertyNumber as ct,getReferenceType as lt}from"@ez4/common/library";
39
- import{isModelProperty as mt,isTypeObject as at,isTypeReference as ut}from"@ez4/reflection";
40
- import{isAnyNumber as ft}from"@ez4/utils";import{IncorrectTypeError as Hr,InvalidTypeError as hr}from"@ez4/common/library";var h=class extends hr{constructor(r,o){super("Invalid route response",void 0,r,
41
- o);this.baseType=r}static{p(this,"InvalidResponseTypeError")}},b=class extends Hr{constructor(r,o,n){
1
+ var Le=Object.defineProperty;var p=(e,t)=>Le(e,"name",{value:t,configurable:!0});import{registerTriggers as cn}from"@ez4/common/library";import{registerTriggers as ln}from"@ez4/schema/library";
2
+ import{createTrigger as mn}from"@ez4/project/library";import{DuplicateServiceError as $o,isExternalDeclaration as Lo,getLinkedServiceList as en,
3
+ getLinkedVariableList as rn,getModelMembers as tn,getPropertyString as on,InvalidServicePropertyError as nn}from"@ez4/common/library";
4
+ import{isModelProperty as pn}from"@ez4/reflection";var Y="@ez4/http",Tn=p(e=>e.type===Y,"isHttpService");import{IncompleteTypeError as er}from"@ez4/common/library";var d=class extends er{static{p(this,"IncompleteServiceError")}constructor(t,r){
5
+ super("Incomplete service",t,r)}};import{InvalidServicePropertyError as xr,isModelDeclaration as Ir,getPropertyNumber as Er,
6
+ getObjectMembers as vr,getModelMembers as Ar,getServiceListener as Rr,getReferenceType as Pr}from"@ez4/common/library";
7
+ import{isModelProperty as jr,isTypeObject as wr,isTypeReference as Or}from"@ez4/reflection";import{InvalidServicePropertyError as nr,isModelDeclaration as pr,getObjectMembers as sr,
8
+ getModelMembers as ir,getReferenceType as cr,getPropertyStringIn as lr}from"@ez4/common/library";
9
+ import{isModelProperty as mr,isTypeObject as ar,isTypeReference as ur}from"@ez4/reflection";import{hasHeritageType as a,isClassDeclaration as rr,isModelDeclaration as tr}from"@ez4/common/library";
10
+ import{isTypeCallback as $,isTypeFunction as L}from"@ez4/reflection";var or=new Set(["ANY","GET","POST","PUT","PATCH","DELETE","OPTIONS"]),ee=p(e=>{let[
11
+ t]=e.split(" ",2);return or.has(t)},"isHttpPath"),re=p(e=>rr(e)&&a(e,"Http.Servi\
12
+ ce"),"isHttpService"),te=p(e=>tr(e)&&a(e,"Http.Route"),"isHttpRoute");var oe=p(e=>a(e,"Http.Defaults"),"isHttpDefaults"),ne=p(e=>a(e,"Http.Preferences"),
13
+ "isHttpPreferences"),pe=p(e=>a(e,"Http.Headers"),"isHttpHeaders"),se=p(e=>a(e,"H\
14
+ ttp.Identity"),"isHttpIdentity"),ie=p(e=>a(e,"Http.QueryStrings"),"isHttpQuery"),
15
+ ce=p(e=>a(e,"Http.PathParameters"),"isHttpParameters"),le=p(e=>a(e,"Http.JsonBod\
16
+ y"),"isJsonBody"),me=p(e=>a(e,"Http.Cors"),"isHttpCors"),ae=p(e=>a(e,"Http.Cache"),
17
+ "isHttpCache"),ue=p(e=>$(e)||L(e),"isHttpAuthorizer"),fe=p(e=>$(e)||L(e),"isHttp\
18
+ Handler");import{NamingStyle as u}from"@ez4/schema";var T=p((e,t,r,o)=>{if(!ur(e))return ye(e,t,o);let n=cr(e,r);if(n)return ye(n,t,
19
+ o)},"getHttpPreferences"),ye=p((e,t,r)=>{if(ar(e))return de(t,sr(e),r);if(!pr(e)){
20
+ r.push(new g(t.file));return}if(!ne(e)){r.push(new M(e.name,t.file));return}return de(
21
+ t,ir(e),r)},"getTypePreferences"),de=p((e,t,r)=>{let o={};for(let n of t)if(mr(n))
22
+ switch(n.name){default:r.push(new nr(e.name,n.name,e.file));break;case"namingSty\
23
+ le":o.namingStyle=lr(n,[u.Preserve,u.CamelCase,u.PascalCase,u.SnakeCase,u.KebabCase]);
24
+ break}return o},"getTypeFromMembers");import{InvalidServicePropertyError as fr,getObjectMembers as yr,getPropertyTuple as dr,
25
+ getReferenceType as ge}from"@ez4/common/library";import{isAnyNumber as Tr,isEmptyObject as gr}from"@ez4/utils";
26
+ import{isModelProperty as Mr,isTypeClass as Hr,isTypeObject as br,isTypeReference as Me}from"@ez4/reflection";var H=p((e,t,r,o)=>{if(!Me(e))return Te(e,t,r,o);let n=ge(e,r);return n?Te(n,t,r,
27
+ o):null},"getHttpErrors"),Te=p((e,t,r,o)=>br(e)?hr(e,t,yr(e),r,o):null,"getTypeE\
28
+ rrors"),hr=p((e,t,r,o,n)=>{let s={};for(let i of r){if(!Mr(i)||i.inherited)continue;
29
+ let c=parseInt(i.name,10);Tr(c)||n.push(new fr(t.name,i.name,e.file));let l=Sr(i,
30
+ c,t,o,n);l&&Object.assign(s,l)}return gr(s)?null:s},"getTypeFromMembers"),Sr=p((e,t,r,o,n)=>{
31
+ let s=dr(e)??[],i={};for(let c of s){if(!Me(c)){n.push(new f(r.file));continue}let l=ge(
32
+ c,o);if(!l||!Hr(l)){n.push(new f(r.file));continue}i[l.name]=t}return i},"getErr\
33
+ orClasses");var he=p((e,t,r,o)=>{if(!Or(e))return He(e,t,r,o);let n=Pr(e,r);return n?He(n,t,
34
+ r,o):null},"getHttpDefaults"),He=p((e,t,r,o)=>wr(e)?be(t,vr(e),r,o):Ir(e)?oe(e)?
35
+ be(t,Ar(e),r,o):(o.push(new h(e.name,t.file)),null):(o.push(new b(t.file)),null),
36
+ "getTypeDefaults"),be=p((e,t,r,o)=>{let n={};for(let s of t)if(!(!jr(s)||s.inherited))
37
+ switch(s.name){default:o.push(new xr(e.name,s.name,e.file));break;case"httpError\
38
+ s":n.httpErrors=H(s.value,e,r,o);break;case"preferences":n.preferences=T(s.value,
39
+ e,r,o);break;case"memory":case"logRetention":case"timeout":n[s.name]=Er(s);break;case"\
40
+ listener":n.listener=Rr(s.value,o);break}return n},"getTypeFromMembers");import{isModelProperty as io,isTypeObject as co,isTypeReference as lo,isTypeTuple as mo}from"@ez4/reflection";
41
+ import{InvalidServicePropertyError as ao,getLinkedVariableList as uo,getPropertyBoolean as fo,
42
+ getPropertyNumber as yo,getPropertyString as To,getObjectMembers as go,getModelMembers as Mo,
43
+ getServiceListener as Ho,getReferenceType as bo,getPropertyTuple as ho}from"@ez4/common/library";import{IncompleteTypeError as zr,TypeError as Cr}from"@ez4/common/library";var S=class extends zr{static{p(this,"IncompleteRouteError")}constructor(t,r){super(
44
+ "Incomplete gateway route",t,r)}},f=class extends Cr{static{p(this,"InvalidRoute\
45
+ ErrorTypeError")}constructor(t){super("Invalid route error type.",t)}};import{IncompleteTypeError as kr}from"@ez4/common/library";var x=class extends kr{static{p(this,"IncompleteAuthorizerError")}constructor(t,r){
46
+ super("Incomplete route authorizer",t,r)}};import{InvalidServicePropertyError as Ht,isModelDeclaration as bt,hasHeritageType as ht,
47
+ getModelMembers as St,getObjectMembers as xt,getPropertyNumber as It,getReferenceType as Et}from"@ez4/common/library";
48
+ import{isModelProperty as vt,isTypeObject as At,isTypeReference as Rt}from"@ez4/reflection";
49
+ import{isAnyNumber as Pt}from"@ez4/utils";import{IncorrectTypeError as qr,InvalidTypeError as Dr}from"@ez4/common/library";var I=class extends Dr{constructor(r,o){super("Invalid route response",void 0,r,
50
+ o);this.baseType=r}static{p(this,"InvalidResponseTypeError")}},E=class extends qr{constructor(r,o,n){
42
51
  super("Incorrect route response",r,o,n);this.responseType=r;this.baseType=o}static{
43
- p(this,"IncorrectResponseTypeError")}};import{isTypeIntersection as Ar,isTypeObject as Er,isTypeReference as vr,isTypeUndefined as Rr,
44
- isTypeUnion as Pr}from"@ez4/reflection";import{getReferenceType as jr,isModelDeclaration as wr}from"@ez4/common/library";
45
- import{createUnionSchema as Or}from"@ez4/schema/library";import{IncorrectTypeError as br,InvalidTypeError as Sr}from"@ez4/common/library";var S=class extends Sr{static{p(this,"InvalidIdentityTypeError")}constructor(t){
46
- super("Invalid identity",void 0,"Http.Identity",t)}},x=class extends br{constructor(r,o){
52
+ p(this,"IncorrectResponseTypeError")}};import{isTypeIntersection as Vr,isTypeObject as Qr,isTypeReference as Jr,isTypeUndefined as Gr,
53
+ isTypeUnion as Kr}from"@ez4/reflection";import{getReferenceType as Yr,isModelDeclaration as Wr}from"@ez4/common/library";
54
+ import{createUnionSchema as Xr}from"@ez4/schema/library";import{IncorrectTypeError as Fr,InvalidTypeError as Br}from"@ez4/common/library";var v=class extends Br{static{p(this,"InvalidIdentityTypeError")}constructor(t){
55
+ super("Invalid identity",void 0,"Http.Identity",t)}},A=class extends Fr{constructor(r,o){
47
56
  super("Incorrect identity",r,"Http.Identity",o);this.identityType=r}static{p(this,
48
- "IncorrectIdentityTypeError")}};import{getObjectSchema as xr,isObjectSchema as Ir}from"@ez4/schema/library";var m=p((e,t)=>{let r=xr(e,t);return r&&Ir(r)?r:null},"getSchemaFromType");var f=p((e,t,r,o)=>{if(Rr(e))return null;if(!vr(e))return de(e,t,r,o);let n=jr(e,
49
- r);return n?de(n,t,r,o):null},"getHttpIdentity"),de=p((e,t,r,o)=>{if(Pr(e))return zr(
50
- e.elements,t,r,o);if(Er(e)||Ar(e))return m(e,r);if(!wr(e))return o.push(new S(t.
51
- file)),null;if(!re(e))return o.push(new x(e.name,t.file)),null;let n=m(e,r);return n&&
52
- (n.definitions={...n.definitions,extensible:!0}),n},"getTypeIdentity"),zr=p((e,t,r,o)=>{
53
- let n=[];for(let s of e){let i=f(s,t,r,o);i&&n.push(i)}return n.length>1?Or({elements:n}):
54
- n[0]},"getIdentityFromUnion");import{isTypeIntersection as qr,isTypeObject as Dr,isTypeReference as Fr}from"@ez4/reflection";
55
- import{getReferenceType as Br,isModelDeclaration as Nr}from"@ez4/common/library";import{IncorrectTypeError as Cr,InvalidTypeError as kr}from"@ez4/common/library";var I=class extends kr{static{p(this,"InvalidHeadersTypeError")}constructor(t){super(
56
- "Invalid headers",void 0,"Http.Headers",t)}},A=class extends Cr{constructor(r,o){
57
+ "IncorrectIdentityTypeError")}};import{getObjectSchema as Ur,isObjectSchema as Nr}from"@ez4/schema/library";var m=p((e,t)=>{let r=Ur(e,t);return r&&Nr(r)?r:null},"getSchemaFromType");var y=p((e,t,r,o)=>{if(Gr(e))return null;if(!Jr(e))return Se(e,t,r,o);let n=Yr(e,
58
+ r);return n?Se(n,t,r,o):null},"getHttpIdentity"),Se=p((e,t,r,o)=>{if(Kr(e))return Zr(
59
+ e.elements,t,r,o);if(Qr(e)||Vr(e))return m(e,r);if(!Wr(e))return o.push(new v(t.
60
+ file)),null;if(!se(e))return o.push(new A(e.name,t.file)),null;let n=m(e,r);return n&&
61
+ (n.definitions={...n.definitions,extensible:!0}),n},"getTypeIdentity"),Zr=p((e,t,r,o)=>{
62
+ let n=[];for(let s of e){let i=y(s,t,r,o);i&&n.push(i)}return n.length>1?Xr({elements:n}):
63
+ n[0]},"getIdentityFromUnion");import{isTypeIntersection as Lr,isTypeObject as et,isTypeReference as rt}from"@ez4/reflection";
64
+ import{getReferenceType as tt,isModelDeclaration as ot}from"@ez4/common/library";import{IncorrectTypeError as _r,InvalidTypeError as $r}from"@ez4/common/library";var R=class extends $r{static{p(this,"InvalidHeadersTypeError")}constructor(t){super(
65
+ "Invalid headers",void 0,"Http.Headers",t)}},P=class extends _r{constructor(r,o){
57
66
  super("Incorrect headers",r,"Http.Headers",o);this.headersType=r}static{p(this,"\
58
- IncorrectHeadersTypeError")}};var E=p((e,t,r,o)=>{if(!Fr(e))return Te(e,t,r,o);let n=Br(e,r);return n?Te(n,t,r,
59
- o):null},"getHttpHeaders"),Te=p((e,t,r,o)=>Dr(e)||qr(e)?m(e,r):Nr(e)?ee(e)?m(e,r):
60
- (o.push(new A(e.name,t.file)),null):(o.push(new I(t.file)),null),"getTypeHeaders");import{createUnionSchema as Qr,getScalarSchema as Jr,createArraySchema as Gr}from"@ez4/schema/library";
61
- import{getReferenceType as Yr,isModelDeclaration as Kr}from"@ez4/common/library";
62
- import{isTypeArray as Wr,isTypeIntersection as Xr,isTypeObject as Zr,isTypeReference as _r,
63
- isTypeScalar as $r,isTypeUndefined as Lr,isTypeUnion as et}from"@ez4/reflection";import{IncorrectTypeError as Ur,InvalidTypeError as Vr}from"@ez4/common/library";var v=class extends Vr{static{p(this,"InvalidBodyTypeError")}constructor(t){super(
64
- "Invalid body",void 0,"Http.JsonBody",t)}},R=class extends Ur{constructor(r,o){super(
67
+ IncorrectHeadersTypeError")}};var j=p((e,t,r,o)=>{if(!rt(e))return xe(e,t,r,o);let n=tt(e,r);return n?xe(n,t,r,
68
+ o):null},"getHttpHeaders"),xe=p((e,t,r,o)=>et(e)||Lr(e)?m(e,r):ot(e)?pe(e)?m(e,r):
69
+ (o.push(new P(e.name,t.file)),null):(o.push(new R(t.file)),null),"getTypeHeaders");import{createUnionSchema as st,getScalarSchema as it,createArraySchema as ct}from"@ez4/schema/library";
70
+ import{getReferenceType as lt,isModelDeclaration as mt}from"@ez4/common/library";
71
+ import{isTypeArray as at,isTypeIntersection as ut,isTypeObject as ft,isTypeReference as yt,
72
+ isTypeScalar as dt,isTypeUndefined as Ie,isTypeUnion as Tt}from"@ez4/reflection";import{IncorrectTypeError as nt,InvalidTypeError as pt}from"@ez4/common/library";var w=class extends pt{static{p(this,"InvalidBodyTypeError")}constructor(t){super(
73
+ "Invalid body",void 0,"Http.JsonBody",t)}},O=class extends nt{constructor(r,o){super(
65
74
  "Incorrect body",r,"Http.JsonBody",o);this.bodyType=r}static{p(this,"IncorrectBo\
66
- dyTypeError")}};var P=p((e,t,r,o)=>Y(e,r,n=>J(n)??G(n,t,r,o)),"getHttpBody"),Y=p((e,t,r)=>{if(Lr(
67
- e))return null;if(!_r(e))return r(e);let o=Yr(e,t);return o?r(o):null},"getTypeB\
68
- ody"),J=p(e=>$r(e)?Jr(e):null,"getScalarTypeBody"),G=p((e,t,r,o)=>et(e)?rt(e.elements,
69
- r,n=>J(n)??G(n,t,r,o)):Wr(e)?tt(e.element,r,n=>J(n)??G(n,t,r,o)):Zr(e)||Xr(e)?m(
70
- e,r):Kr(e)?ne(e)?m(e,r):(o.push(new R(e.name,e.file)),null):(o.push(new v(t.file)),
71
- null),"getCompoundTypeBody"),rt=p((e,t,r)=>{let o=[];for(let n of e){let s=Y(n,t,
72
- r);s&&o.push(s)}return o.length?Qr({elements:o}):null},"getUnionTypeBody"),tt=p(
73
- (e,t,r)=>{let o=Y(e,t,r);return o?Gr({element:o}):null},"getArrayTypeBody");var He=p((e,t,r,o)=>{let n=be(e,t,r,o,"Http.AuthResponse");return n&&yt(n)?n:null},
74
- "getHttpAuthResponse"),he=p((e,t,r,o)=>{let n=be(e,t,r,o,"Http.Response");return n&&
75
- dt(n)?n:null},"getHttpHandlerResponse"),be=p((e,t,r,o,n)=>{if(!ut(e))return ge(e,
76
- t,r,o,n);let s=lt(e,r);return s?ge(s,t,r,o,n):null},"getHttpResponse"),yt=p(e=>!!e.
77
- identity,"isValidAuthResponse"),dt=p(e=>ft(e.status),"isValidHandlerResponse"),ge=p(
78
- (e,t,r,o,n)=>at(e)?Me(e,t,it(e),r,o):nt(e)?pt(e,n)?Me(e,t,st(e),r,o):(o.push(new b(
79
- e.name,n,e.file)),null):(o.push(new h(n,t.file)),null),"getTypeResponse"),Me=p((e,t,r,o,n)=>{
80
- let s={};for(let i of r)if(!(!mt(i)||i.inherited))switch(i.name){default:n.push(
81
- new ot(t.name,i.name,e.file));break;case"status":s.status=ct(i);break;case"heade\
82
- rs":{s.headers=E(i.value,e,o,n),s.headers&&i.description&&(s.headers.description=
83
- i.description);break}case"identity":{s.identity=f(i.value,e,o,n),s.identity&&i.description&&
84
- (s.identity.description=i.description);break}case"body":{s.body=P(i.value,e,o,n),
75
+ dyTypeError")}};var z=p((e,t,r,o)=>Z(e,r,n=>W(n)??X(n,t,r,o)),"getHttpBody"),Z=p((e,t,r)=>{if(Ie(
76
+ e))return null;if(!yt(e))return r(e);let o=lt(e,t);return o?r(o):null},"getTypeB\
77
+ ody"),W=p(e=>dt(e)?it(e):null,"getScalarTypeBody"),X=p((e,t,r,o)=>Tt(e)?gt(e.elements,
78
+ r,n=>W(n)??X(n,t,r,o)):at(e)?Mt(e.element,r,n=>W(n)??X(n,t,r,o)):ft(e)||ut(e)?m(
79
+ e,r):mt(e)?le(e)?m(e,r):(o.push(new O(e.name,e.file)),null):(o.push(new w(t.file)),
80
+ null),"getCompoundTypeBody"),gt=p((e,t,r)=>{let o={optional:!1,elements:[]};for(let n of e){
81
+ if(Ie(n)){o.optional=!0;continue}let s=Z(n,t,r);s&&o.elements.push(s)}return o.elements.
82
+ length?st(o):null},"getUnionTypeBody"),Mt=p((e,t,r)=>{let o=Z(e,t,r);return o?ct(
83
+ {element:o}):null},"getArrayTypeBody");var Ae=p((e,t,r,o)=>{let n=Pe(e,t,r,o,"Http.AuthResponse");return n&&jt(n)?n:null},
84
+ "getHttpAuthResponse"),Re=p((e,t,r,o)=>{let n=Pe(e,t,r,o,"Http.Response");return n&&
85
+ wt(n)?n:null},"getHttpHandlerResponse"),Pe=p((e,t,r,o,n)=>{if(!Rt(e))return Ee(e,
86
+ t,r,o,n);let s=Et(e,r);return s?Ee(s,t,r,o,n):null},"getHttpResponse"),jt=p(e=>!!e.
87
+ identity,"isValidAuthResponse"),wt=p(e=>Pt(e.status),"isValidHandlerResponse"),Ee=p(
88
+ (e,t,r,o,n)=>At(e)?ve(e,t,xt(e),r,o):bt(e)?ht(e,n)?ve(e,t,St(e),r,o):(o.push(new E(
89
+ e.name,n,e.file)),null):(o.push(new I(n,t.file)),null),"getTypeResponse"),ve=p((e,t,r,o,n)=>{
90
+ let s={};for(let i of r)if(!(!vt(i)||i.inherited))switch(i.name){default:n.push(
91
+ new Ht(t.name,i.name,e.file));break;case"status":s.status=It(i);break;case"heade\
92
+ rs":{s.headers=j(i.value,e,o,n),s.headers&&i.description&&(s.headers.description=
93
+ i.description);break}case"identity":{s.identity=y(i.value,e,o,n),s.identity&&i.description&&
94
+ (s.identity.description=i.description);break}case"body":{s.body=z(i.value,e,o,n),
85
95
  s.body&&i.description&&(s.body.description=i.description);break}}return s},"getT\
86
- ypeFromMembers");import{isModelProperty as Ot,isTypeIntersection as zt,isTypeObject as Ct,isTypeReference as kt}from"@ez4/reflection";
87
- import{InvalidServicePropertyError as qt,isModelDeclaration as Dt,hasHeritageType as Ft,
88
- getObjectMembers as Bt,getModelMembers as Nt,getReferenceType as Ut}from"@ez4/common/library";import{IncorrectTypeError as Tt,InvalidTypeError as gt}from"@ez4/common/library";var j=class extends gt{constructor(r,o){super("Invalid route request",void 0,r,o);
89
- this.baseType=r}static{p(this,"InvalidRequestTypeError")}},w=class extends Tt{constructor(r,o,n){
96
+ ypeFromMembers");import{isModelProperty as Wt,isTypeIntersection as Xt,isTypeObject as Zt,isTypeReference as _t}from"@ez4/reflection";
97
+ import{InvalidServicePropertyError as $t,isModelDeclaration as Lt,hasHeritageType as eo,
98
+ getObjectMembers as ro,getModelMembers as to,getReferenceType as oo}from"@ez4/common/library";import{IncorrectTypeError as Ot,InvalidTypeError as zt}from"@ez4/common/library";var C=class extends zt{constructor(r,o){super("Invalid route request",void 0,r,o);
99
+ this.baseType=r}static{p(this,"InvalidRequestTypeError")}},k=class extends Ot{constructor(r,o,n){
90
100
  super("Incorrect route request",r,o,n);this.requestType=r;this.baseType=o}static{
91
- p(this,"IncorrectRequestTypeError")}};import{isTypeIntersection as ht,isTypeObject as bt,isTypeReference as St}from"@ez4/reflection";
92
- import{getReferenceType as xt,isModelDeclaration as It}from"@ez4/common/library";import{IncorrectTypeError as Mt,InvalidTypeError as Ht}from"@ez4/common/library";var O=class extends Ht{static{p(this,"InvalidParameterTypeError")}constructor(t){
93
- super("Invalid request parameters",void 0,"Http.PathParameters",t)}},z=class extends Mt{constructor(r,o){
101
+ p(this,"IncorrectRequestTypeError")}};import{isTypeIntersection as qt,isTypeObject as Dt,isTypeReference as Ft}from"@ez4/reflection";
102
+ import{getReferenceType as Bt,isModelDeclaration as Ut}from"@ez4/common/library";import{IncorrectTypeError as Ct,InvalidTypeError as kt}from"@ez4/common/library";var q=class extends kt{static{p(this,"InvalidParameterTypeError")}constructor(t){
103
+ super("Invalid request parameters",void 0,"Http.PathParameters",t)}},D=class extends Ct{constructor(r,o){
94
104
  super("Incorrect request parameters",r,"Http.PathParameters",o);this.parametersType=
95
- r}static{p(this,"IncorrectParameterTypeError")}};var xe=p((e,t,r,o)=>{if(!St(e))return Se(e,t,r,o);let n=xt(e,r);return n?Se(n,t,
96
- r,o):null},"getHttpParameters"),Se=p((e,t,r,o)=>bt(e)||ht(e)?m(e,r):It(e)?oe(e)?
97
- m(e,r):(o.push(new z(e.name,e.file)),null):(o.push(new O(t.file)),null),"getType\
98
- Parameter");import{isTypeIntersection as vt,isTypeObject as Rt,isTypeReference as Pt}from"@ez4/reflection";
99
- import{getReferenceType as jt,isModelDeclaration as wt}from"@ez4/common/library";import{IncorrectTypeError as At,InvalidTypeError as Et}from"@ez4/common/library";var C=class extends Et{static{p(this,"InvalidQueryTypeError")}constructor(t){super(
100
- "Invalid request query strings",void 0,"Http.QueryStrings",t)}},k=class extends At{constructor(r,o){
105
+ r}static{p(this,"IncorrectParameterTypeError")}};var we=p((e,t,r,o)=>{if(!Ft(e))return je(e,t,r,o);let n=Bt(e,r);return n?je(n,t,
106
+ r,o):null},"getHttpParameters"),je=p((e,t,r,o)=>Dt(e)||qt(e)?m(e,r):Ut(e)?ce(e)?
107
+ m(e,r):(o.push(new D(e.name,e.file)),null):(o.push(new q(t.file)),null),"getType\
108
+ Parameter");import{isTypeIntersection as Qt,isTypeObject as Jt,isTypeReference as Gt}from"@ez4/reflection";
109
+ import{getReferenceType as Kt,isModelDeclaration as Yt}from"@ez4/common/library";import{IncorrectTypeError as Nt,InvalidTypeError as Vt}from"@ez4/common/library";var F=class extends Vt{static{p(this,"InvalidQueryTypeError")}constructor(t){super(
110
+ "Invalid request query strings",void 0,"Http.QueryStrings",t)}},B=class extends Nt{constructor(r,o){
101
111
  super("Incorrect request query strings",r,"Http.QueryStrings",o);this.queryType=
102
- r}static{p(this,"IncorrectQueryTypeError")}};var Ae=p((e,t,r,o)=>{if(!Pt(e))return Ie(e,t,r,o);let n=jt(e,r);return n?Ie(n,t,
103
- r,o):null},"getHttpQuery"),Ie=p((e,t,r,o)=>Rt(e)||vt(e)?m(e,r):wt(e)?te(e)?m(e,r):
104
- (o.push(new k(e.name,t.file)),null):(o.push(new C(t.file)),null),"getTypeQuery");var Re=p((e,t,r,o)=>K(e,t,r,o,"Http.AuthRequest"),"getHttpAuthRequest"),Pe=p((e,t,r,o)=>K(
105
- e,t,r,o,"Http.Request"),"getHttpHandlerRequest"),K=p((e,t,r,o,n)=>{if(zt(e)&&e.elements.
106
- length>0)return K(e.elements[0],t,r,o,n);if(!kt(e))return Ee(e,t,r,o,n);let s=Ut(
107
- e,r);return s?Ee(s,t,r,o,n):null},"getHttpRequest"),Ee=p((e,t,r,o,n)=>Ct(e)?ve(e,
108
- t,Bt(e),r,o):Dt(e)?Ft(e,n)?ve(e,t,Nt(e),r,o):(o.push(new w(e.name,n,e.file)),null):
109
- (o.push(new j(n,t.file)),null),"getTypeRequest"),ve=p((e,t,r,o,n)=>{let s={};for(let i of r)
110
- if(!(!Ot(i)||i.inherited))switch(i.name){default:n.push(new qt(t.name,i.name,e.file));
111
- break;case"headers":{s.headers=E(i.value,e,o,n),s.headers&&i.description&&(s.headers.
112
- description=i.description);break}case"identity":{s.identity=f(i.value,e,o,n),s.identity&&
112
+ r}static{p(this,"IncorrectQueryTypeError")}};var ze=p((e,t,r,o)=>{if(!Gt(e))return Oe(e,t,r,o);let n=Kt(e,r);return n?Oe(n,t,
113
+ r,o):null},"getHttpQuery"),Oe=p((e,t,r,o)=>Jt(e)||Qt(e)?m(e,r):Yt(e)?ie(e)?m(e,r):
114
+ (o.push(new B(e.name,t.file)),null):(o.push(new F(t.file)),null),"getTypeQuery");var qe=p((e,t,r,o)=>_(e,t,r,o,"Http.AuthRequest"),"getHttpAuthRequest"),De=p((e,t,r,o)=>_(
115
+ e,t,r,o,"Http.Request"),"getHttpHandlerRequest"),_=p((e,t,r,o,n)=>{if(Xt(e)&&e.elements.
116
+ length>0)return _(e.elements[0],t,r,o,n);if(!_t(e))return Ce(e,t,r,o,n);let s=oo(
117
+ e,r);return s?Ce(s,t,r,o,n):null},"getHttpRequest"),Ce=p((e,t,r,o,n)=>Zt(e)?ke(e,
118
+ t,ro(e),r,o):Lt(e)?eo(e,n)?ke(e,t,to(e),r,o):(o.push(new k(e.name,n,e.file)),null):
119
+ (o.push(new C(n,t.file)),null),"getTypeRequest"),ke=p((e,t,r,o,n)=>{let s={};for(let i of r)
120
+ if(!(!Wt(i)||i.inherited))switch(i.name){default:n.push(new $t(t.name,i.name,e.file));
121
+ break;case"headers":{s.headers=j(i.value,e,o,n),s.headers&&i.description&&(s.headers.
122
+ description=i.description);break}case"identity":{s.identity=y(i.value,e,o,n),s.identity&&
113
123
  i.description&&(s.identity.description=i.description);break}case"query":{s.query=
114
- Ae(i.value,e,o,n),s.query&&i.description&&(s.query.description=i.description);break}case"\
115
- parameters":{s.parameters=xe(i.value,e,o,n),s.parameters&&i.description&&(s.parameters.
116
- description=i.description);break}case"body":{s.body=P(i.value,e,o,n),s.body&&i.description&&
117
- (s.body.description=i.description);break}}return s},"getTypeFromMembers");var je=p((e,t,r,o)=>{if(!ie(e))return null;let n={},s=new Set(["name","file"]);if(e.
118
- description&&(n.description=e.description),(n.name=e.name)&&s.delete("name"),(n.
119
- file=e.file)&&s.delete("file"),e.parameters){let[{value:i}]=e.parameters;n.request=
120
- Re(i,t,r,o)}return e.return&&(n.response=He(e.return,t,r,o)),Vt(n)?n:(o.push(new H(
121
- [...s],e.file)),null)},"getHttpAuthorizer"),Vt=p(e=>!!e.name&&!!e.file,"isValidA\
122
- uthorizer");import{IncompleteTypeError as Qt}from"@ez4/common/library";var q=class extends Qt{static{p(this,"IncompleteHandlerError")}constructor(t,r){
123
- super("Incomplete route handler",t,r)}};var we=p((e,t,r,o)=>{if(!ce(e))return null;let n={},s=new Set(["name","file","re\
124
- sponse"]);if(e.description&&(n.description=e.description),(n.name=e.name)&&s.delete(
125
- "name"),(n.file=e.file)&&s.delete("file"),e.parameters){let[{value:i}]=e.parameters;
126
- n.request=Pe(i,t,r,o)}if(e.return){let i=he(e.return,t,r,o);i&&(n.response=i,s.delete(
127
- "response"))}return Jt(n)?n:(o.push(new q([...s],e.file)),null)},"getHttpHandler"),
128
- Jt=p(e=>!!e.name&&!!e.file&&!!e.response,"isValidHandler");var Ce=p((e,t,r,o)=>{let n=no(t)??[];return ke(n,e,r,o)},"getHttpRoutes"),ke=p((e,t,r,o)=>{
129
- let n=[];for(let s of e){let i=po(s,t,r,o);Array.isArray(i)?n.push(...i):i&&n.push(
130
- i)}return n},"getRouteFromTuple"),po=p((e,t,r,o)=>{if(!Kt(e))return Oe(e,t,r,o);
131
- let n=oo(e,r);return n?Oe(n,t,r,o):null},"getTypeFromRoute"),so=p(e=>!!e.path&&!!e.
132
- handler,"isValidRoute"),Oe=p((e,t,r,o)=>$(e)?ze(e,t,ro(e),r,o):Yt(e)?ze(e,t,eo(e),
133
- r,o):Wt(e)&&e.spread?ke(e.elements,t,r,o):null,"getRouteType"),ze=p((e,t,r,o,n)=>{
134
- let s={},i=new Set(["path","handler"]);for(let c of r)if(!(!Gt(c)||c.inherited))
135
- switch(c.name){default:n.push(new Xt(t.name,c.name,e.file));break;case"path":{let l=Lt(
136
- c);l&&Z(l)&&(i.delete(c.name),s.path=l);break}case"handler":(s.handler=we(c.value,
137
- t,o,n))&&i.delete(c.name);break;case"authorizer":s.authorizer=je(c.value,t,o,n);
138
- break;case"httpErrors":s.httpErrors=d(c.value,t,o,n);break;case"memory":case"log\
139
- Retention":case"timeout":s[c.name]=$t(c);break;case"cors":s.cors=_t(c);break;case"\
140
- listener":s.listener=to(c.value,n);break;case"variables":s.variables=Zt(c,n);break}
141
- return so(s)?s:(n.push(new M([...i],e.file)),null)},"getTypeFromMembers");import{InvalidServicePropertyError as mo,isModelDeclaration as ao,getModelMembers as uo,
142
- getObjectMembers as fo,getPropertyBoolean as yo,getPropertyStringList as To,getPropertyNumber as go,
143
- getReferenceType as Mo}from"@ez4/common/library";import{isModelProperty as Ho,isTypeObject as ho,
144
- isTypeReference as bo}from"@ez4/reflection";import{IncompleteTypeError as io,IncorrectTypeError as co,InvalidTypeError as lo}from"@ez4/common/library";var D=class extends io{static{p(this,"IncompleteCorsError")}constructor(t,r){super(
145
- "Incomplete HTTP CORS",t,r)}},F=class extends lo{static{p(this,"InvalidCorsTypeE\
146
- rror")}constructor(t){super("Invalid HTTP CORS type",void 0,"Http.Cors",t)}},B=class extends co{constructor(r,o){
124
+ ze(i.value,e,o,n),s.query&&i.description&&(s.query.description=i.description);break}case"\
125
+ parameters":{s.parameters=we(i.value,e,o,n),s.parameters&&i.description&&(s.parameters.
126
+ description=i.description);break}case"body":{s.body=z(i.value,e,o,n),s.body&&i.description&&
127
+ (s.body.description=i.description);break}}return s},"getTypeFromMembers");var Fe=p((e,t,r,o)=>{if(!ue(e))return null;let{description:n,module:s}=e,i={...n&&
128
+ {description:n},...s&&{module:s}},c=new Set(["name","file"]);if((i.name=e.name)&&
129
+ c.delete("name"),(i.file=e.file)&&c.delete("file"),e.parameters){let[{value:l}]=e.
130
+ parameters;i.request=qe(l,t,r,o)}return e.return&&(i.response=Ae(e.return,t,r,o)),
131
+ no(i)?i:(o.push(new x([...c],e.file)),null)},"getHttpAuthorizer"),no=p(e=>!!e.name&&
132
+ !!e.file,"isValidAuthorizer");import{IncompleteTypeError as po}from"@ez4/common/library";var U=class extends po{static{p(this,"IncompleteHandlerError")}constructor(t,r){
133
+ super("Incomplete route handler",t,r)}};var Be=p((e,t,r,o)=>{if(!fe(e))return null;let{description:n,module:s}=e,i={...n&&
134
+ {description:n},...s&&{module:s}},c=new Set(["name","file","response"]);if((i.name=
135
+ e.name)&&c.delete("name"),(i.file=e.file)&&c.delete("file"),e.parameters){let[{value:l}]=e.
136
+ parameters;i.request=De(l,t,r,o)}if(e.return){let l=Re(e.return,t,r,o);l&&(i.response=
137
+ l,c.delete("response"))}return so(i)?i:(o.push(new U([...c],e.file)),null)},"get\
138
+ HttpHandler"),so=p(e=>!!e.name&&!!e.file&&!!e.response,"isValidHandler");var Ve=p((e,t,r,o)=>{let n=ho(t)??[];return Qe(n,e,r,o)},"getHttpRoutes"),Qe=p((e,t,r,o)=>{
139
+ let n=[];for(let s of e){let i=So(s,t,r,o);Array.isArray(i)?n.push(...i):i&&n.push(
140
+ i)}return n},"getRouteFromTuple"),So=p((e,t,r,o)=>{if(!lo(e))return Ue(e,t,r,o);
141
+ let n=bo(e,r);return n?Ue(n,t,r,o):null},"getTypeFromRoute"),xo=p(e=>!!e.path&&!!e.
142
+ handler,"isValidRoute"),Ue=p((e,t,r,o)=>te(e)?Ne(e,t,Mo(e),r,o):co(e)?Ne(e,t,go(
143
+ e),r,o):mo(e)&&e.spread?Qe(e.elements,t,r,o):null,"getRouteType"),Ne=p((e,t,r,o,n)=>{
144
+ let s={},i=new Set(["path","handler"]);for(let c of r)if(!(!io(c)||c.inherited))
145
+ switch(c.name){default:n.push(new ao(t.name,c.name,e.file));break;case"path":{let l=To(
146
+ c);l&&ee(l)&&(i.delete(c.name),s.path=l);break}case"handler":(s.handler=Be(c.value,
147
+ t,o,n))&&i.delete(c.name);break;case"authorizer":s.authorizer=Fe(c.value,t,o,n);
148
+ break;case"httpErrors":s.httpErrors=H(c.value,t,o,n);break;case"preferences":s.preferences=
149
+ T(c.value,t,o,n);break;case"memory":case"logRetention":case"timeout":s[c.name]=yo(
150
+ c);break;case"cors":s.cors=fo(c);break;case"listener":s.listener=Ho(c.value,n);break;case"\
151
+ variables":s.variables=uo(c,n);break}return xo(s)?s:(n.push(new S([...i],e.file)),
152
+ null)},"getTypeFromMembers");import{InvalidServicePropertyError as Ao,isModelDeclaration as Ro,getModelMembers as Po,
153
+ getObjectMembers as jo,getPropertyBoolean as wo,getPropertyStringList as Oo,getPropertyNumber as zo,
154
+ getReferenceType as Co}from"@ez4/common/library";import{isModelProperty as ko,isTypeObject as qo,
155
+ isTypeReference as Do}from"@ez4/reflection";import{IncompleteTypeError as Io,IncorrectTypeError as Eo,InvalidTypeError as vo}from"@ez4/common/library";var N=class extends Io{static{p(this,"IncompleteCorsError")}constructor(t,r){super(
156
+ "Incomplete HTTP CORS",t,r)}},V=class extends vo{static{p(this,"InvalidCorsTypeE\
157
+ rror")}constructor(t){super("Invalid HTTP CORS type",void 0,"Http.Cors",t)}},Q=class extends Eo{constructor(r,o){
147
158
  super("Incorrect HTTP CORS type",r,"Http.Cors",o);this.fallbackType=r}static{p(this,
148
- "IncorrectCorsTypeError")}};var Fe=p((e,t,r,o)=>{if(!bo(e))return qe(e,t,o);let n=Mo(e,r);return n?qe(n,t,o):
149
- null},"getHttpCors"),So=p(e=>!!e.allowOrigins?.length,"isValidCors"),qe=p((e,t,r)=>ho(
150
- e)?De(e,t,fo(e),r):ao(e)?pe(e)?De(e,t,uo(e),r):(r.push(new B(e.name,e.file)),null):
151
- (r.push(new F(t.file)),null),"getTypeCors"),De=p((e,t,r,o)=>{let n={},s=new Set(
152
- ["allowOrigins"]);for(let i of r)if(!(!Ho(i)||i.inherited))switch(i.name){default:
153
- o.push(new mo(t.name,i.name,e.file));break;case"allowOrigins":case"allowMethods":case"\
154
- allowHeaders":case"exposeHeaders":n[i.name]=To(i);break;case"allowCredentials":n.
155
- allowCredentials=yo(i);break;case"maxAge":n.maxAge=go(i);break}return So(n)?n:(o.
156
- push(new D([...s],e.file)),null)},"getTypeFromMembers");import{InvalidServicePropertyError as Eo,isModelDeclaration as vo,getModelMembers as Ro,
157
- getObjectMembers as Po,getPropertyNumber as jo,getReferenceType as wo}from"@ez4/common/library";
158
- import{isModelProperty as Oo,isTypeObject as zo,isTypeReference as Co}from"@ez4/reflection";
159
- import{isAnyNumber as Ue}from"@ez4/utils";import{IncompleteTypeError as xo,IncorrectTypeError as Io,InvalidTypeError as Ao}from"@ez4/common/library";var N=class extends xo{static{p(this,"IncompleteCacheError")}constructor(t,r){super(
160
- "Incomplete gateway cache",t,r)}},U=class extends Ao{static{p(this,"InvalidCache\
159
+ "IncorrectCorsTypeError")}};var Ke=p((e,t,r,o)=>{if(!Do(e))return Je(e,t,o);let n=Co(e,r);return n?Je(n,t,o):
160
+ null},"getHttpCors"),Fo=p(e=>!!e.allowOrigins?.length,"isValidCors"),Je=p((e,t,r)=>qo(
161
+ e)?Ge(e,t,jo(e),r):Ro(e)?me(e)?Ge(e,t,Po(e),r):(r.push(new Q(e.name,e.file)),null):
162
+ (r.push(new V(t.file)),null),"getTypeCors"),Ge=p((e,t,r,o)=>{let n={},s=new Set(
163
+ ["allowOrigins"]);for(let i of r)if(!(!ko(i)||i.inherited))switch(i.name){default:
164
+ o.push(new Ao(t.name,i.name,e.file));break;case"allowOrigins":case"allowMethods":case"\
165
+ allowHeaders":case"exposeHeaders":n[i.name]=Oo(i);break;case"allowCredentials":n.
166
+ allowCredentials=wo(i);break;case"maxAge":n.maxAge=zo(i);break}return Fo(n)?n:(o.
167
+ push(new N([...s],e.file)),null)},"getTypeFromMembers");import{InvalidServicePropertyError as Vo,isModelDeclaration as Qo,getModelMembers as Jo,
168
+ getObjectMembers as Go,getPropertyNumber as Ko,getReferenceType as Yo}from"@ez4/common/library";
169
+ import{isModelProperty as Wo,isTypeObject as Xo,isTypeReference as Zo}from"@ez4/reflection";
170
+ import{isAnyNumber as Xe}from"@ez4/utils";import{IncompleteTypeError as Bo,IncorrectTypeError as Uo,InvalidTypeError as No}from"@ez4/common/library";var J=class extends Bo{static{p(this,"IncompleteCacheError")}constructor(t,r){super(
171
+ "Incomplete gateway cache",t,r)}},G=class extends No{static{p(this,"InvalidCache\
161
172
  TypeError")}constructor(t){super("Invalid gateway cache type",void 0,"Http.Cache",
162
- t)}},V=class extends Io{constructor(r,o){super("Incorrect gateway cache type",r,
163
- "Http.Cache",o);this.cacheType=r}static{p(this,"IncorrectCacheTypeError")}};var Ve=p((e,t,r,o)=>{if(!Co(e))return Be(e,t,o);let n=wo(e,r);return n?Be(n,t,o):
164
- null},"getHttpCache"),ko=p(e=>Ue(e.authorizerTTL),"isValidCache"),Be=p((e,t,r)=>zo(
165
- e)?Ne(e,t,Po(e),r):vo(e)?se(e)?Ne(e,t,Ro(e),r):(r.push(new V(e.name,e.file)),null):
166
- (r.push(new U(t.file)),null),"getTypeCache"),Ne=p((e,t,r,o)=>{let n={},s=new Set(
167
- ["authorizerTTL"]);for(let i of r)if(!(!Oo(i)||i.inherited))switch(i.name){default:
168
- o.push(new Eo(t.name,i.name,e.file));break;case"authorizerTTL":{let c=jo(i);Ue(c)&&
169
- (n[i.name]=c,s.delete(i.name));break}}return ko(n)?n:(o.push(new N([...s],e.file)),
170
- null)},"getTypeFromMembers");var Qe=p(e=>{let t={},r=[];for(let o in e){let n=e[o];if(!_(n)||Do(n))continue;let s={
171
- type:Q,extras:{}},i=new Set(["routes"]),c=n.file;s.name=n.name,n.description&&(s.
172
- description=n.description);for(let l of No(n))if(!(!Qo(l)||l.inherited))switch(l.
173
- name){default:r.push(new Vo(s.name,l.name,c));break;case"routes":(s.routes=Ce(n,
174
- l,e,r))&&i.delete(l.name);break;case"name":s.displayName=Uo(l);break;case"defaul\
175
- ts":s.defaults=ye(l.value,n,e,r);break;case"cache":s.cache=Ve(l.value,n,e,r);break;case"\
176
- cors":s.cors=Fe(l.value,n,e,r);break;case"variables":s.variables=Bo(l,r);break;case"\
177
- services":s.services=Fo(l,e,r);break}if(!Jo(s)){r.push(new y([...i],c));continue}
178
- if(t[n.name]){r.push(new qo(n.name,c));continue}t[n.name]=s}return{services:t,errors:r}},
179
- "getHttpServices"),Jo=p(e=>!!e.name&&!!e.routes&&!!e.extras,"isValidService");var Je=!1,oi=p(()=>{Je||(Go(),Yo(),Ko("@ez4/gateway",{"metadata:getServices":Qe}),
180
- Je=!0)},"registerTriggers");import{IncorrectTypeError as Wo,InvalidTypeError as Xo}from"@ez4/common/library";var T=class extends Xo{static{p(this,"InvalidDefaultsTypeError")}constructor(t){
181
- super("Invalid defaults",void 0,"Http.Defaults",t)}},g=class extends Wo{constructor(r,o){
173
+ t)}},K=class extends Uo{constructor(r,o){super("Incorrect gateway cache type",r,
174
+ "Http.Cache",o);this.cacheType=r}static{p(this,"IncorrectCacheTypeError")}};var Ze=p((e,t,r,o)=>{if(!Zo(e))return Ye(e,t,o);let n=Yo(e,r);return n?Ye(n,t,o):
175
+ null},"getHttpCache"),_o=p(e=>Xe(e.authorizerTTL),"isValidCache"),Ye=p((e,t,r)=>Xo(
176
+ e)?We(e,t,Go(e),r):Qo(e)?ae(e)?We(e,t,Jo(e),r):(r.push(new K(e.name,e.file)),null):
177
+ (r.push(new G(t.file)),null),"getTypeCache"),We=p((e,t,r,o)=>{let n={},s=new Set(
178
+ ["authorizerTTL"]);for(let i of r)if(!(!Wo(i)||i.inherited))switch(i.name){default:
179
+ o.push(new Vo(t.name,i.name,e.file));break;case"authorizerTTL":{let c=Ko(i);Xe(c)&&
180
+ (n[i.name]=c,s.delete(i.name));break}}return _o(n)?n:(o.push(new J([...s],e.file)),
181
+ null)},"getTypeFromMembers");var _e=p(e=>{let t={},r=[];for(let o in e){let n=e[o];if(!re(n)||Lo(n))continue;
182
+ let s={type:Y,extras:{}},i=new Set(["routes"]),c=n.file;s.name=n.name,n.description&&
183
+ (s.description=n.description);for(let l of tn(n))if(!(!pn(l)||l.inherited))switch(l.
184
+ name){default:r.push(new nn(s.name,l.name,c));break;case"routes":(s.routes=Ve(n,
185
+ l,e,r))&&i.delete(l.name);break;case"name":s.displayName=on(l);break;case"defaul\
186
+ ts":s.defaults=he(l.value,n,e,r);break;case"cache":s.cache=Ze(l.value,n,e,r);break;case"\
187
+ cors":s.cors=Ke(l.value,n,e,r);break;case"variables":s.variables=rn(l,r);break;case"\
188
+ services":s.services=en(l,e,r);break}if(!sn(s)){r.push(new d([...i],c));continue}
189
+ if(t[n.name]){r.push(new $o(n.name,c));continue}t[n.name]=s}return{services:t,errors:r}},
190
+ "getHttpServices"),sn=p(e=>!!e.name&&!!e.routes&&!!e.extras,"isValidService");var $e=!1,ji=p(()=>{$e||(cn(),ln(),mn("@ez4/gateway",{"metadata:getServices":_e}),
191
+ $e=!0)},"registerTriggers");import{IncorrectTypeError as an,InvalidTypeError as un}from"@ez4/common/library";var b=class extends un{static{p(this,"InvalidDefaultsTypeError")}constructor(t){
192
+ super("Invalid defaults",void 0,"Http.Defaults",t)}},h=class extends an{constructor(r,o){
182
193
  super("Incorrect defaults",r,"Http.Defaults",o);this.defaultsType=r}static{p(this,
183
- "IncorrectDefaultsTypeError")}};export{H as IncompleteAuthorizerError,N as IncompleteCacheError,D as IncompleteCorsError,
184
- q as IncompleteHandlerError,M as IncompleteRouteError,y as IncompleteServiceError,
185
- R as IncorrectBodyTypeError,V as IncorrectCacheTypeError,B as IncorrectCorsTypeError,
186
- g as IncorrectDefaultsTypeError,A as IncorrectHeadersTypeError,x as IncorrectIdentityTypeError,
187
- z as IncorrectParameterTypeError,k as IncorrectQueryTypeError,w as IncorrectRequestTypeError,
188
- b as IncorrectResponseTypeError,v as InvalidBodyTypeError,U as InvalidCacheTypeError,
189
- F as InvalidCorsTypeError,T as InvalidDefaultsTypeError,I as InvalidHeadersTypeError,
190
- S as InvalidIdentityTypeError,O as InvalidParameterTypeError,C as InvalidQueryTypeError,
191
- j as InvalidRequestTypeError,h as InvalidResponseTypeError,u as InvalidRouteErrorTypeError,
192
- Q as ServiceType,Re as getHttpAuthRequest,He as getHttpAuthResponse,je as getHttpAuthorizer,
193
- P as getHttpBody,Ve as getHttpCache,Fe as getHttpCors,we as getHttpHandler,Pe as getHttpHandlerRequest,
194
- he as getHttpHandlerResponse,E as getHttpHeaders,f as getHttpIdentity,xe as getHttpParameters,
195
- Ae as getHttpQuery,Ce as getHttpRoutes,Qe as getHttpServices,_o as isHttpService,
196
- oi as registerTriggers};
194
+ "IncorrectDefaultsTypeError")}};import{IncorrectTypeError as fn,InvalidTypeError as yn}from"@ez4/common/library";var g=class extends yn{static{p(this,"InvalidPreferencesTypeError")}constructor(t){
195
+ super("Invalid preferences",void 0,"Http.Preferences",t)}},M=class extends fn{constructor(r,o){
196
+ super("Incorrect preferences",r,"Http.Preferences",o);this.preferencesType=r}static{
197
+ p(this,"IncorrectPreferencesTypeError")}};export{x as IncompleteAuthorizerError,J as IncompleteCacheError,N as IncompleteCorsError,
198
+ U as IncompleteHandlerError,S as IncompleteRouteError,d as IncompleteServiceError,
199
+ O as IncorrectBodyTypeError,K as IncorrectCacheTypeError,Q as IncorrectCorsTypeError,
200
+ h as IncorrectDefaultsTypeError,P as IncorrectHeadersTypeError,A as IncorrectIdentityTypeError,
201
+ D as IncorrectParameterTypeError,M as IncorrectPreferencesTypeError,B as IncorrectQueryTypeError,
202
+ k as IncorrectRequestTypeError,E as IncorrectResponseTypeError,w as InvalidBodyTypeError,
203
+ G as InvalidCacheTypeError,V as InvalidCorsTypeError,b as InvalidDefaultsTypeError,
204
+ R as InvalidHeadersTypeError,v as InvalidIdentityTypeError,q as InvalidParameterTypeError,
205
+ g as InvalidPreferencesTypeError,F as InvalidQueryTypeError,C as InvalidRequestTypeError,
206
+ I as InvalidResponseTypeError,f as InvalidRouteErrorTypeError,Y as ServiceType,qe as getHttpAuthRequest,
207
+ Ae as getHttpAuthResponse,Fe as getHttpAuthorizer,z as getHttpBody,Ze as getHttpCache,
208
+ Ke as getHttpCors,Be as getHttpHandler,De as getHttpHandlerRequest,Re as getHttpHandlerResponse,
209
+ j as getHttpHeaders,y as getHttpIdentity,we as getHttpParameters,ze as getHttpQuery,
210
+ Ve as getHttpRoutes,_e as getHttpServices,Tn as isHttpService,ji as registerTriggers};
197
211
  //# sourceMappingURL=library.mjs.map
package/dist/main.cjs CHANGED
@@ -1,18 +1,18 @@
1
- "use strict";var u=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var p=(s,t)=>u(s,"name",{value:t,configurable:!0});var g=(s,t)=>{for(var e in t)u(s,e,{get:t[e],enumerable:!0})},S=(s,t,e,n)=>{if(t&&
2
- typeof t=="object"||typeof t=="function")for(let o of l(t))!h.call(s,o)&&o!==e&&
3
- u(s,o,{get:()=>t[o],enumerable:!(n=R(t,o))||n.enumerable});return s};var q=s=>S(u({},"__esModule",{value:!0}),s);var b={};g(b,{Http:()=>H,HttpBadRequestError:()=>i,HttpError:()=>r,HttpForbiddenError:()=>a,
4
- HttpInternalServerError:()=>m,HttpNotFoundError:()=>x,HttpUnauthorizedError:()=>c,
5
- HttpUnprocessableEntityError:()=>d,HttpUnsupportedMediaTypeError:()=>y});module.
6
- exports=q(b);var H;(s=>{})(H||={});var r=class extends Error{constructor(e,n,o){super(n);this.status=e;this.message=
7
- n;this.details=o}static{p(this,"HttpError")}},i=class extends r{static{p(this,"H\
8
- ttpBadRequestError")}constructor(t,e){super(400,t||"Bad request",e)}},c=class extends r{static{
9
- p(this,"HttpUnauthorizedError")}constructor(t,e){super(401,t||"Unauthorized",e)}},
10
- a=class extends r{static{p(this,"HttpForbiddenError")}constructor(t,e){super(403,
11
- t||"Forbidden",e)}},x=class extends r{static{p(this,"HttpNotFoundError")}constructor(t,e){
12
- super(404,t||"Not found",e)}},y=class extends r{static{p(this,"HttpUnsupportedMe\
13
- diaTypeError")}constructor(t,e){super(415,t||"Unsupported media type",e)}},d=class extends r{static{
14
- p(this,"HttpUnprocessableEntityError")}constructor(t,e){super(422,t||"Unprocessa\
15
- ble entity",e)}},m=class extends r{static{p(this,"HttpInternalServerError")}constructor(t,e){
16
- super(500,t||"Internal server error",e)}};0&&(module.exports={Http,HttpBadRequestError,HttpError,HttpForbiddenError,HttpInternalServerError,
1
+ "use strict";var u=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var p=(s,e)=>u(s,"name",{value:e,configurable:!0});var g=(s,e)=>{for(var t in e)u(s,t,{get:e[t],enumerable:!0})},S=(s,e,t,n)=>{if(e&&
2
+ typeof e=="object"||typeof e=="function")for(let o of l(e))!h.call(s,o)&&o!==t&&
3
+ u(s,o,{get:()=>e[o],enumerable:!(n=R(e,o))||n.enumerable});return s};var q=s=>S(u({},"__esModule",{value:!0}),s);var b={};g(b,{Http:()=>H,HttpBadRequestError:()=>c,HttpError:()=>r,HttpForbiddenError:()=>a,
4
+ HttpInternalServerError:()=>d,HttpNotFoundError:()=>x,HttpUnauthorizedError:()=>i,
5
+ HttpUnprocessableEntityError:()=>y,HttpUnsupportedMediaTypeError:()=>m});module.
6
+ exports=q(b);var H;(s=>{})(H||={});var r=class extends Error{constructor(t,n,o){super(n);this.status=t;this.message=
7
+ n;this.details=o}static{p(this,"HttpError")}},c=class extends r{static{p(this,"H\
8
+ ttpBadRequestError")}constructor(e,t){super(400,e||"Bad request",t)}},i=class extends r{static{
9
+ p(this,"HttpUnauthorizedError")}constructor(e,t){super(401,e||"Unauthorized",t)}},
10
+ a=class extends r{static{p(this,"HttpForbiddenError")}constructor(e,t){super(403,
11
+ e||"Forbidden",t)}},x=class extends r{static{p(this,"HttpNotFoundError")}constructor(e,t){
12
+ super(404,e||"Not found",t)}},m=class extends r{static{p(this,"HttpUnsupportedMe\
13
+ diaTypeError")}constructor(e,t){super(415,e||"Unsupported media type",t)}},y=class extends r{static{
14
+ p(this,"HttpUnprocessableEntityError")}constructor(e,t){super(422,e||"Unprocessa\
15
+ ble entity",t)}},d=class extends r{static{p(this,"HttpInternalServerError")}constructor(e,t){
16
+ super(500,e||"Internal server error",t)}};0&&(module.exports={Http,HttpBadRequestError,HttpError,HttpForbiddenError,HttpInternalServerError,
17
17
  HttpNotFoundError,HttpUnauthorizedError,HttpUnprocessableEntityError,HttpUnsupportedMediaTypeError});
18
18
  //# sourceMappingURL=main.cjs.map
package/dist/main.mjs CHANGED
@@ -1,14 +1,14 @@
1
- var d=Object.defineProperty;var r=(s,t)=>d(s,"name",{value:t,configurable:!0});var m;(s=>{})(m||={});var p=class extends Error{constructor(e,y,H){super(y);this.status=e;this.message=
2
- y;this.details=H}static{r(this,"HttpError")}},o=class extends p{static{r(this,"H\
3
- ttpBadRequestError")}constructor(t,e){super(400,t||"Bad request",e)}},n=class extends p{static{
4
- r(this,"HttpUnauthorizedError")}constructor(t,e){super(401,t||"Unauthorized",e)}},
5
- u=class extends p{static{r(this,"HttpForbiddenError")}constructor(t,e){super(403,
6
- t||"Forbidden",e)}},i=class extends p{static{r(this,"HttpNotFoundError")}constructor(t,e){
7
- super(404,t||"Not found",e)}},c=class extends p{static{r(this,"HttpUnsupportedMe\
8
- diaTypeError")}constructor(t,e){super(415,t||"Unsupported media type",e)}},a=class extends p{static{
9
- r(this,"HttpUnprocessableEntityError")}constructor(t,e){super(422,t||"Unprocessa\
10
- ble entity",e)}},x=class extends p{static{r(this,"HttpInternalServerError")}constructor(t,e){
11
- super(500,t||"Internal server error",e)}};export{m as Http,o as HttpBadRequestError,p as HttpError,u as HttpForbiddenError,
12
- x as HttpInternalServerError,i as HttpNotFoundError,n as HttpUnauthorizedError,a as HttpUnprocessableEntityError,
13
- c as HttpUnsupportedMediaTypeError};
1
+ var y=Object.defineProperty;var r=(s,e)=>y(s,"name",{value:e,configurable:!0});var d;(s=>{})(d||={});var p=class extends Error{constructor(t,m,H){super(m);this.status=t;this.message=
2
+ m;this.details=H}static{r(this,"HttpError")}},o=class extends p{static{r(this,"H\
3
+ ttpBadRequestError")}constructor(e,t){super(400,e||"Bad request",t)}},n=class extends p{static{
4
+ r(this,"HttpUnauthorizedError")}constructor(e,t){super(401,e||"Unauthorized",t)}},
5
+ u=class extends p{static{r(this,"HttpForbiddenError")}constructor(e,t){super(403,
6
+ e||"Forbidden",t)}},c=class extends p{static{r(this,"HttpNotFoundError")}constructor(e,t){
7
+ super(404,e||"Not found",t)}},i=class extends p{static{r(this,"HttpUnsupportedMe\
8
+ diaTypeError")}constructor(e,t){super(415,e||"Unsupported media type",t)}},a=class extends p{static{
9
+ r(this,"HttpUnprocessableEntityError")}constructor(e,t){super(422,e||"Unprocessa\
10
+ ble entity",t)}},x=class extends p{static{r(this,"HttpInternalServerError")}constructor(e,t){
11
+ super(500,e||"Internal server error",t)}};export{d as Http,o as HttpBadRequestError,p as HttpError,u as HttpForbiddenError,
12
+ x as HttpInternalServerError,c as HttpNotFoundError,n as HttpUnauthorizedError,a as HttpUnprocessableEntityError,
13
+ i as HttpUnsupportedMediaTypeError};
14
14
  //# sourceMappingURL=main.mjs.map
@@ -0,0 +1,3 @@
1
+ import type { AllType, SourceMap, TypeModel } from '@ez4/reflection';
2
+ import type { HttpPreferences } from '../types/common.js';
3
+ export declare const getHttpPreferences: (type: AllType, parent: TypeModel, reflection: SourceMap, errorList: Error[]) => HttpPreferences | undefined;
@@ -8,6 +8,7 @@ export declare const isHttpHandlerRequest: (type: TypeModel) => boolean;
8
8
  export declare const isHttpAuthorizerResponse: (type: TypeModel) => boolean;
9
9
  export declare const isHttpHandlerResponse: (type: TypeModel) => boolean;
10
10
  export declare const isHttpDefaults: (type: TypeModel) => boolean;
11
+ export declare const isHttpPreferences: (type: TypeModel) => boolean;
11
12
  export declare const isHttpHeaders: (type: TypeModel) => boolean;
12
13
  export declare const isHttpIdentity: (type: TypeModel) => boolean;
13
14
  export declare const isHttpQuery: (type: TypeModel) => boolean;