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