@ez4/gateway 0.33.0 → 0.35.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/client/authorization.d.ts +6 -0
- package/dist/client/operations.d.ts +3 -1
- package/dist/errors/authorization.d.ts +11 -0
- package/dist/library.cjs +277 -256
- package/dist/library.d.ts +3 -12
- package/dist/library.mjs +270 -249
- package/dist/main.cjs +18 -17
- package/dist/main.d.ts +2 -1
- package/dist/main.mjs +13 -13
- package/dist/metadata/authorization.d.ts +3 -0
- package/dist/metadata/schema.d.ts +2 -1
- package/dist/metadata/utils.d.ts +1 -0
- package/dist/services/access.d.ts +9 -0
- package/dist/services/authorization.d.ts +25 -0
- package/dist/services/cache.d.ts +9 -0
- package/dist/services/client.d.ts +71 -26
- package/dist/services/common.d.ts +19 -98
- package/dist/services/contract.d.ts +56 -92
- package/dist/services/cors.d.ts +29 -0
- package/dist/services/defaults.d.ts +31 -0
- package/dist/services/preferences.d.ts +10 -0
- package/dist/services/provider.d.ts +11 -0
- package/dist/services/route.d.ts +56 -0
- package/dist/services/utils.d.ts +3 -3
- package/dist/types/common.d.ts +7 -0
- package/dist/types/import.d.ts +2 -1
- package/dist/utils/body.d.ts +6 -1
- package/dist/utils/client.d.ts +9 -5
- package/dist/utils/parameters.d.ts +1 -0
- package/dist/utils/query.d.ts +3 -4
- package/dist/utils.cjs +52 -48
- package/dist/utils.mjs +53 -49
- package/package.json +8 -8
- package/dist/errors/context.d.ts +0 -8
- package/dist/metadata/context.d.ts +0 -3
- package/dist/utils/request.d.ts +0 -6
package/dist/library.mjs
CHANGED
|
@@ -1,274 +1,295 @@
|
|
|
1
|
-
var
|
|
2
|
-
import{tryCreateTrigger as
|
|
3
|
-
getLinkedVariableList as
|
|
4
|
-
import{isModelProperty as
|
|
5
|
-
super("Incomplete service",t,r)}},
|
|
6
|
-
sionError")}constructor(t,r){super("Service error",t,r)}};import{InvalidServicePropertyError as
|
|
7
|
-
getObjectMembers as
|
|
8
|
-
import{isModelProperty as
|
|
9
|
-
getModelMembers as
|
|
10
|
-
import{isModelProperty as
|
|
11
|
-
import{
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
(e,t,r,o
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
if(!(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
getReferenceType as
|
|
51
|
-
|
|
52
|
-
|
|
1
|
+
var Fr=Object.defineProperty;var p=(e,t)=>Fr(e,"name",{value:t,configurable:!0});import{registerTriggers as Np}from"@ez4/common/library";import{registerTriggers as Bp}from"@ez4/schema/library";
|
|
2
|
+
import{tryCreateTrigger as Dr}from"@ez4/project/library";var y="@ez4/import:http",ye=p(e=>e.type===y,"isHttpImport");var T="@ez4/http",Yp=p(e=>e.type===T,"isHttpService");import{DuplicateServiceError as sp,isExternalDeclaration as cp,getLinkedServiceList as mp,
|
|
3
|
+
getLinkedVariableList as ap,getModelMembers as up,getPropertyString as lp,InvalidServicePropertyError as dp}from"@ez4/common/library";
|
|
4
|
+
import{isModelProperty as fp}from"@ez4/reflection";import{IncompleteTypeError as Nr,TypeCollisionError as Br}from"@ez4/common/library";var f=class extends Nr{static{p(this,"IncompleteServiceError")}constructor(t,r){
|
|
5
|
+
super("Incomplete service",t,r)}},b=class extends Br{static{p(this,"ServiceColli\
|
|
6
|
+
sionError")}constructor(t,r){super("Service error",t,r)}};import{InvalidServicePropertyError as at,isModelDeclaration as ut,getPropertyNumber as lt,
|
|
7
|
+
getObjectMembers as dt,getModelMembers as ft,getServiceListener as yt,tryGetReferenceType as Tt}from"@ez4/common/library";
|
|
8
|
+
import{isModelProperty as gt,isTypeObject as ht,isTypeReference as Mt}from"@ez4/reflection";import{InvalidServicePropertyError as Gr,isModelDeclaration as $r,getObjectMembers as Kr,
|
|
9
|
+
getModelMembers as Yr,getReferenceType as Wr,getPropertyStringIn as Xr}from"@ez4/common/library";
|
|
10
|
+
import{isModelProperty as Zr,isTypeObject as _r,isTypeReference as Lr}from"@ez4/reflection";
|
|
11
|
+
import{NamingStyle as g}from"@ez4/schema";import{IncorrectTypeError as Ur,InvalidTypeError as Vr}from"@ez4/common/library";var H=class extends Vr{static{p(this,"InvalidPreferencesTypeError")}constructor(t){
|
|
12
|
+
super("Invalid preferences",void 0,"Http.Preferences",t)}},S=class extends Ur{constructor(r,o){
|
|
13
|
+
super("Incorrect preferences",r,"Http.Preferences",o);this.preferencesType=r}static{
|
|
14
|
+
p(this,"IncorrectPreferencesTypeError")}};import{hasHeritageType as u,isClassDeclaration as Te,isModelDeclaration as Qr}from"@ez4/common/library";
|
|
15
|
+
import{isTypeCallback as ge,isTypeFunction as he}from"@ez4/reflection";var Jr=new Set(["ANY","GET","POST","PUT","PATCH","DELETE","OPTIONS"]),Me=p(e=>{let[
|
|
16
|
+
t]=e.split(" ",2);return Jr.has(t)},"isHttpPath"),I=p(e=>Te(e)&&u(e,"Http.Servic\
|
|
17
|
+
e"),"isHttpService"),v=p(e=>Te(e)&&u(e,"Http.Import"),"isHttpImport");var be=p(e=>Qr(e)&&u(e,"Http.Route"),"isHttpRoute");var He=p(e=>u(e,"Http.Defaults"),"isHttpDefaults"),Se=p(e=>u(e,"Http.Authorizati\
|
|
18
|
+
on"),"isHttpAuthorization"),Ie=p(e=>u(e,"Http.Preferences"),"isHttpPreferences"),
|
|
19
|
+
ve=p(e=>u(e,"Http.Headers"),"isHttpHeaders"),xe=p(e=>u(e,"Http.Identity"),"isHtt\
|
|
20
|
+
pIdentity"),Ae=p(e=>u(e,"Http.QueryStrings"),"isHttpQuery"),Ee=p(e=>u(e,"Http.Pa\
|
|
21
|
+
thParameters"),"isHttpParameters"),Pe=p(e=>u(e,"Http.JsonBody"),"isJsonBody"),Re=p(
|
|
22
|
+
e=>u(e,"Http.Cache"),"isHttpCache"),ze=p(e=>u(e,"Http.Access"),"isHttpAccess"),we=p(
|
|
23
|
+
e=>u(e,"Http.Cors"),"isHttpCors"),Oe=p(e=>ge(e)||he(e),"isHttpAuthorizer"),je=p(
|
|
24
|
+
e=>ge(e)||he(e),"isHttpHandler");var x=p((e,t,r,o)=>{if(!Lr(e))return ke(e,t,o);let n=Wr(e,r);if(n)return ke(n,t,
|
|
25
|
+
o)},"getHttpPreferences"),ke=p((e,t,r)=>{if(_r(e))return Ce(t,Kr(e),r);if(!$r(e)){
|
|
26
|
+
r.push(new H(t.file));return}if(!Ie(e)){r.push(new S(e.name,t.file));return}return Ce(
|
|
27
|
+
t,Yr(e),r)},"getTypePreferences"),Ce=p((e,t,r)=>{let o={};for(let n of t)if(Zr(n))
|
|
28
|
+
switch(n.name){default:r.push(new Gr(e.name,n.name,e.file));break;case"namingSty\
|
|
29
|
+
le":o.namingStyle=Xr(n,[g.Preserve,g.CamelCase,g.PascalCase,g.SnakeCase,g.KebabCase]);
|
|
30
|
+
break}return o},"getTypeFromMembers");import{InvalidServicePropertyError as et,getObjectMembers as rt,getPropertyTuple as tt,
|
|
31
|
+
getReferenceType as De}from"@ez4/common/library";import{isAnyNumber as ot,isEmptyObject as nt}from"@ez4/utils";
|
|
32
|
+
import{isModelProperty as pt,isTypeClass as it,isTypeObject as st,isTypeReference as Fe}from"@ez4/reflection";var A=p((e,t,r,o)=>{if(!Fe(e))return qe(e,t,r,o);let n=De(e,r);if(n)return qe(n,
|
|
33
|
+
t,r,o)},"getHttpErrors"),qe=p((e,t,r,o)=>{if(st(e))return ct(e,t,rt(e),r,o)},"ge\
|
|
34
|
+
tTypeErrors"),ct=p((e,t,r,o,n)=>{let s={};for(let i of r){if(!pt(i)||i.inherited)
|
|
35
|
+
continue;let m=parseInt(i.name,10);ot(m)||n.push(new et(t.name,i.name,e.file));let c=mt(
|
|
36
|
+
i,m,t,o,n);c&&Object.assign(s,c)}if(!nt(s))return s},"getTypeFromMembers"),mt=p(
|
|
37
|
+
(e,t,r,o,n)=>{let s=tt(e)??[],i={};for(let m of s){if(!Fe(m)){n.push(new h(r.file));
|
|
38
|
+
continue}let c=De(m,o);if(!c||!it(c)){n.push(new h(r.file));continue}i[c.name]=t}
|
|
39
|
+
return i},"getErrorClasses");var E=p((e,t,r,o)=>{if(!Mt(e))return Ne(e,t,r,o);let n=Tt(e,r);if(n)return Ne(n,
|
|
40
|
+
t,r,o)},"getHttpDefaults"),Ne=p((e,t,r,o)=>{if(ht(e))return Be(t,dt(e),r,o);if(!ut(
|
|
41
|
+
e)){o.push(new P(t.file));return}if(!He(e)){o.push(new R(e.name,t.file));return}
|
|
42
|
+
return Be(t,ft(e),r,o)},"getTypeDefaults"),Be=p((e,t,r,o)=>{let n={};for(let s of t)
|
|
43
|
+
if(!(!gt(s)||s.inherited))switch(s.name){default:o.push(new at(e.name,s.name,e.file));
|
|
44
|
+
break;case"httpErrors":n.httpErrors=A(s.value,e,r,o);break;case"preferences":n.preferences=
|
|
45
|
+
x(s.value,e,r,o);break;case"memory":case"logRetention":case"timeout":n[s.name]=lt(
|
|
46
|
+
s);break;case"listener":n.listener=yt(s.value,o);break}return n},"getTypeFromMem\
|
|
47
|
+
bers");import{isModelProperty as cn,isTypeObject as mn,isTypeReference as ur,isTypeTuple as lr}from"@ez4/reflection";
|
|
48
|
+
import{InvalidServicePropertyError as an,getLinkedVariableList as un,getPropertyBoolean as ln,
|
|
49
|
+
getPropertyNumber as dn,getPropertyString as cr,getObjectMembers as fn,getModelMembers as yn,
|
|
50
|
+
getServiceListener as Tn,getReferenceType as dr,getPropertyTuple as gn}from"@ez4/common/library";import{IncompleteTypeError as bt,TypeError as Ht}from"@ez4/common/library";var z=class extends bt{static{p(this,"IncompleteRouteError")}constructor(t,r){super(
|
|
51
|
+
"Incomplete gateway route",t,r)}},h=class extends Ht{static{p(this,"InvalidRoute\
|
|
52
|
+
ErrorTypeError")}constructor(t){super("Invalid route error type.",t)}};import{IncompleteTypeError as St}from"@ez4/common/library";var w=class extends St{static{p(this,"IncompleteAuthorizerError")}constructor(t,r){
|
|
53
|
+
super("Incomplete route authorizer",t,r)}};import{InvalidServicePropertyError as io,isModelDeclaration as so,hasHeritageType as co,
|
|
54
|
+
getModelMembers as mo,getObjectMembers as ao,getPropertyNumber as uo,getPropertyNumberList as lo,
|
|
55
|
+
getReferenceType as fo}from"@ez4/common/library";import{isModelProperty as yo,isTypeObject as To,
|
|
56
|
+
isTypeReference as go}from"@ez4/reflection";import{isAnyNumber as ho}from"@ez4/utils";import{IncorrectTypeError as It,InvalidTypeError as vt}from"@ez4/common/library";var O=class extends vt{constructor(r,o){super("Invalid route response",void 0,r,
|
|
57
|
+
o);this.baseType=r}static{p(this,"InvalidResponseTypeError")}},j=class extends It{constructor(r,o,n){
|
|
53
58
|
super("Incorrect route response",r,o,n);this.responseType=r;this.baseType=o}static{
|
|
54
|
-
p(this,"IncorrectResponseTypeError")}};import{
|
|
55
|
-
|
|
56
|
-
import{createUnionSchema as
|
|
57
|
-
super("Invalid identity",void 0,"Http.Identity",t)}},
|
|
59
|
+
p(this,"IncorrectResponseTypeError")}};import{getReferenceType as Rt,isModelDeclaration as zt}from"@ez4/common/library";
|
|
60
|
+
import{isTypeIntersection as wt,isTypeObject as Ot,isTypeReference as jt,isTypeUndefined as kt,
|
|
61
|
+
isTypeUnion as Ct}from"@ez4/reflection";import{createUnionSchema as qt}from"@ez4/schema/library";import{IncorrectTypeError as xt,InvalidTypeError as At}from"@ez4/common/library";var k=class extends At{static{p(this,"InvalidIdentityTypeError")}constructor(t){
|
|
62
|
+
super("Invalid identity",void 0,"Http.Identity",t)}},C=class extends xt{constructor(r,o){
|
|
58
63
|
super("Incorrect identity",r,"Http.Identity",o);this.identityType=r}static{p(this,
|
|
59
|
-
"IncorrectIdentityTypeError")}};import{getObjectSchema as
|
|
60
|
-
|
|
61
|
-
t,r,o)
|
|
62
|
-
e))
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
64
|
+
"IncorrectIdentityTypeError")}};import{getIntersectionSchema as Et,getObjectSchema as Pt,isObjectSchema as Ue}from"@ez4/schema/library";var l=p((e,t)=>{let r=Et(e,t);if(r&&Ue(r))return r},"getSchemaFromIntersection"),
|
|
65
|
+
a=p((e,t)=>{let r=Pt(e,t);if(r&&Ue(r))return r},"getSchemaFromObject");var M=p((e,t,r,o)=>{if(kt(e))return;if(!jt(e))return Ve(e,t,r,o);let n=Rt(e,r);if(n)
|
|
66
|
+
return Ve(n,t,r,o)},"getHttpIdentity"),Ve=p((e,t,r,o)=>{if(Ot(e))return a(e,r);if(Ct(
|
|
67
|
+
e))return Dt(e.elements,t,r,o);if(wt(e))return l(e,r);if(!zt(e)){o.push(new k(t.
|
|
68
|
+
file));return}if(!xe(e)){o.push(new C(e.name,t.file));return}let n=a(e,r);return n&&
|
|
69
|
+
(n.definitions={...n.definitions,extensible:!0}),n},"getTypeIdentity"),Dt=p((e,t,r,o)=>{
|
|
70
|
+
let n=[];for(let s of e){let i=M(s,t,r,o);i&&n.push(i)}return n.length>1?qt({elements:n}):
|
|
71
|
+
n[0]},"getIdentityFromUnion");import{isTypeIntersection as Bt,isTypeObject as Ut,isTypeReference as Vt}from"@ez4/reflection";
|
|
72
|
+
import{getReferenceType as Qt,isModelDeclaration as Jt}from"@ez4/common/library";import{IncorrectTypeError as Ft,InvalidTypeError as Nt}from"@ez4/common/library";var q=class extends Nt{static{p(this,"InvalidHeadersTypeError")}constructor(t){super(
|
|
73
|
+
"Invalid headers",void 0,"Http.Headers",t)}},D=class extends Ft{constructor(r,o){
|
|
68
74
|
super("Incorrect headers",r,"Http.Headers",o);this.headersType=r}static{p(this,"\
|
|
69
|
-
IncorrectHeadersTypeError")}};var
|
|
70
|
-
t,r,o)},"getHttpHeaders"),
|
|
71
|
-
e)){o.push(new
|
|
72
|
-
return a(e,r)},"getTypeHeaders");import{createUnionSchema as
|
|
73
|
-
import{getReferenceType as
|
|
74
|
-
import{isTypeArray as
|
|
75
|
-
isTypeScalar as
|
|
76
|
-
"Invalid body",void 0,"Http.JsonBody",t)}},
|
|
75
|
+
IncorrectHeadersTypeError")}};var F=p((e,t,r,o)=>{if(!Vt(e))return Qe(e,t,r,o);let n=Qt(e,r);if(n)return Qe(n,
|
|
76
|
+
t,r,o)},"getHttpHeaders"),Qe=p((e,t,r,o)=>{if(Ut(e))return a(e,r);if(Bt(e))return l(
|
|
77
|
+
e,r);if(!Jt(e)){o.push(new q(t.file));return}if(!ve(e)){o.push(new D(e.name,t.file));
|
|
78
|
+
return}return a(e,r)},"getTypeHeaders");import{createUnionSchema as Kt,getScalarSchema as Yt,createArraySchema as Wt}from"@ez4/schema/library";
|
|
79
|
+
import{getReferenceType as Xt,isModelDeclaration as Zt}from"@ez4/common/library";
|
|
80
|
+
import{isTypeArray as _t,isTypeIntersection as Lt,isTypeObject as eo,isTypeReference as ro,
|
|
81
|
+
isTypeScalar as to,isTypeUndefined as Je,isTypeUnion as oo}from"@ez4/reflection";import{IncorrectTypeError as Gt,InvalidTypeError as $t}from"@ez4/common/library";var N=class extends $t{static{p(this,"InvalidBodyTypeError")}constructor(t){super(
|
|
82
|
+
"Invalid body",void 0,"Http.JsonBody",t)}},B=class extends Gt{constructor(r,o){super(
|
|
77
83
|
"Incorrect body",r,"Http.JsonBody",o);this.bodyType=r}static{p(this,"IncorrectBo\
|
|
78
|
-
dyTypeError")}};var U=p((e,t,r,o)=>
|
|
79
|
-
e)){if(!
|
|
80
|
-
if(
|
|
81
|
-
e.elements,r,n=>
|
|
82
|
-
|
|
83
|
-
if(!
|
|
84
|
-
|
|
85
|
-
optional=!0;continue}let s=
|
|
86
|
-
return
|
|
87
|
-
{element:o})},"getArrayTypeBody");var
|
|
88
|
-
"getHttpAuthResponse"),
|
|
89
|
-
|
|
90
|
-
e,t,r,o,n);let s=
|
|
91
|
-
identity,"isValidAuthResponse"),
|
|
92
|
-
sValidHandlerResponse"),
|
|
93
|
-
e)){o.push(new O(n,t.file));return}if(!
|
|
94
|
-
return
|
|
95
|
-
if(!(!
|
|
96
|
-
break;case"status":s.status
|
|
84
|
+
dyTypeError")}};var U=p((e,t,r,o)=>ue(e,r,n=>me(n)??ae(n,t,r,o)),"getHttpBody"),ue=p((e,t,r)=>{if(!Je(
|
|
85
|
+
e)){if(!ro(e))return r(e);let o=Xt(e,t);if(o)return r(o)}},"getTypeBody"),me=p(e=>{
|
|
86
|
+
if(to(e))return Yt(e)},"getScalarTypeBody"),ae=p((e,t,r,o)=>{if(eo(e))return a(e,
|
|
87
|
+
r);if(oo(e))return no(e.elements,r,n=>me(n)??ae(n,t,r,o));if(Lt(e))return l(e,r);
|
|
88
|
+
if(_t(e))return po(e.element,r,n=>me(n)??ae(n,t,r,o));if(!Zt(e)){o.push(new N(t.
|
|
89
|
+
file));return}if(!Pe(e)){o.push(new B(e.name,e.file));return}return a(e,r)},"get\
|
|
90
|
+
CompoundTypeBody"),no=p((e,t,r)=>{let o={optional:!1,elements:[]};for(let n of e){
|
|
91
|
+
if(Je(n)){o.optional=!0;continue}let s=ue(n,t,r);s&&o.elements.push(s)}if(o.elements.
|
|
92
|
+
length)return Kt(o)},"getUnionTypeBody"),po=p((e,t,r)=>{let o=ue(e,t,r);if(o)return Wt(
|
|
93
|
+
{element:o})},"getArrayTypeBody");var Ke=p((e,t,r,o)=>{let n=We(e,t,r,o,"Http.AuthResponse");if(n&&Mo(n))return n},
|
|
94
|
+
"getHttpAuthResponse"),Ye=p((e,t,r,o)=>{let n=We(e,t,r,o,"Http.Response");if(n&&
|
|
95
|
+
bo(n))return n},"getHttpHandlerResponse"),We=p((e,t,r,o,n)=>{if(!go(e))return Ge(
|
|
96
|
+
e,t,r,o,n);let s=fo(e,r);if(s)return Ge(s,t,r,o,n)},"getHttpResponse"),Mo=p(e=>!!e.
|
|
97
|
+
identity,"isValidAuthResponse"),bo=p(e=>ho(e.status)||Array.isArray(e.status),"i\
|
|
98
|
+
sValidHandlerResponse"),Ge=p((e,t,r,o,n)=>{if(To(e))return $e(e,t,ao(e),r,o);if(!so(
|
|
99
|
+
e)){o.push(new O(n,t.file));return}if(!co(e,n)){o.push(new j(e.name,n,e.file));return}
|
|
100
|
+
return $e(e,t,mo(e),r,o)},"getTypeResponse"),$e=p((e,t,r,o,n)=>{let s={};for(let i of r)
|
|
101
|
+
if(!(!yo(i)||i.inherited))switch(i.name){default:n.push(new io(t.name,i.name,e.file));
|
|
102
|
+
break;case"status":s.status=uo(i)??lo(i);break;case"headers":{s.headers=F(i.value,
|
|
97
103
|
e,o,n),s.headers&&i.description&&(s.headers.description=i.description);break}case"\
|
|
98
104
|
identity":{s.identity=M(i.value,e,o,n),s.identity&&i.description&&(s.identity.description=
|
|
99
105
|
i.description);break}case"body":{s.body=U(i.value,e,o,n),s.body&&i.description&&
|
|
100
|
-
(s.body.description=i.description);break}}return s},"getTypeFromMembers");import{isModelProperty as
|
|
101
|
-
import{InvalidServicePropertyError as
|
|
102
|
-
getObjectMembers as
|
|
103
|
-
this.baseType=r}static{p(this,"InvalidRequestTypeError")}},
|
|
106
|
+
(s.body.description=i.description);break}}return s},"getTypeFromMembers");import{isModelProperty as Do,isTypeIntersection as Fo,isTypeObject as No,isTypeReference as Bo}from"@ez4/reflection";
|
|
107
|
+
import{InvalidServicePropertyError as Uo,isModelDeclaration as Vo,hasHeritageType as Qo,
|
|
108
|
+
getObjectMembers as Jo,getModelMembers as Go,getReferenceType as $o}from"@ez4/common/library";import{IncorrectTypeError as Ho,InvalidTypeError as So}from"@ez4/common/library";var V=class extends So{constructor(r,o){super("Invalid route request",void 0,r,o);
|
|
109
|
+
this.baseType=r}static{p(this,"InvalidRequestTypeError")}},Q=class extends Ho{constructor(r,o,n){
|
|
104
110
|
super("Incorrect route request",r,o,n);this.requestType=r;this.baseType=o}static{
|
|
105
|
-
p(this,"IncorrectRequestTypeError")}};import{isTypeIntersection as
|
|
106
|
-
import{getReferenceType as
|
|
107
|
-
super("Invalid request parameters",void 0,"Http.PathParameters",t)}},
|
|
111
|
+
p(this,"IncorrectRequestTypeError")}};import{isTypeIntersection as xo,isTypeObject as Ao,isTypeReference as Eo}from"@ez4/reflection";
|
|
112
|
+
import{getReferenceType as Po,isModelDeclaration as Ro}from"@ez4/common/library";import{IncorrectTypeError as Io,InvalidTypeError as vo}from"@ez4/common/library";var J=class extends vo{static{p(this,"InvalidParameterTypeError")}constructor(t){
|
|
113
|
+
super("Invalid request parameters",void 0,"Http.PathParameters",t)}},G=class extends Io{constructor(r,o){
|
|
108
114
|
super("Incorrect request parameters",r,"Http.PathParameters",o);this.parametersType=
|
|
109
|
-
r}static{p(this,"IncorrectParameterTypeError")}};var
|
|
110
|
-
t,r,o)},"getHttpParameters"),
|
|
111
|
-
e)){o.push(new
|
|
112
|
-
return a(e,r)},"getTypeParameter");import{isTypeIntersection as
|
|
113
|
-
import{getReferenceType as
|
|
114
|
-
"Invalid request query strings",void 0,"Http.QueryStrings",t)}},K=class extends
|
|
115
|
+
r}static{p(this,"IncorrectParameterTypeError")}};var Ze=p((e,t,r,o)=>{if(!Eo(e))return Xe(e,t,r,o);let n=Po(e,r);if(n)return Xe(n,
|
|
116
|
+
t,r,o)},"getHttpParameters"),Xe=p((e,t,r,o)=>{if(Ao(e))return a(e,r);if(xo(e))return l(
|
|
117
|
+
e,r);if(!Ro(e)){o.push(new J(t.file));return}if(!Ee(e)){o.push(new G(e.name,e.file));
|
|
118
|
+
return}return a(e,r)},"getTypeParameter");import{isTypeIntersection as Oo,isTypeObject as jo,isTypeReference as ko}from"@ez4/reflection";
|
|
119
|
+
import{getReferenceType as Co,isModelDeclaration as qo}from"@ez4/common/library";import{IncorrectTypeError as zo,InvalidTypeError as wo}from"@ez4/common/library";var $=class extends wo{static{p(this,"InvalidQueryTypeError")}constructor(t){super(
|
|
120
|
+
"Invalid request query strings",void 0,"Http.QueryStrings",t)}},K=class extends zo{constructor(r,o){
|
|
115
121
|
super("Incorrect request query strings",r,"Http.QueryStrings",o);this.queryType=
|
|
116
|
-
r}static{p(this,"IncorrectQueryTypeError")}};var
|
|
117
|
-
t,r,o)},"getHttpQuery"),
|
|
118
|
-
o.push(new
|
|
119
|
-
e,r)},"getTypeQuery");var
|
|
120
|
-
e,t,r,o,"Http.Request"),"getHttpHandlerRequest"),
|
|
121
|
-
elements.length>0)return
|
|
122
|
-
let s
|
|
123
|
-
e))return
|
|
124
|
-
o.push(new
|
|
125
|
-
|
|
126
|
-
n.push(new
|
|
122
|
+
r}static{p(this,"IncorrectQueryTypeError")}};var Le=p((e,t,r,o)=>{if(!ko(e))return _e(e,t,r,o);let n=Co(e,r);if(n)return _e(n,
|
|
123
|
+
t,r,o)},"getHttpQuery"),_e=p((e,t,r,o)=>{if(jo(e))return a(e,r);if(Oo(e))return l(
|
|
124
|
+
e,r);if(!qo(e)){o.push(new $(t.file));return}if(!Ae(e)){o.push(new K(e.name,t.file));
|
|
125
|
+
return}return a(e,r)},"getTypeQuery");var tr=p((e,t,r,o)=>le(e,t,r,o,"Http.AuthRequest"),"getHttpAuthRequest"),or=p((e,t,r,o)=>le(
|
|
126
|
+
e,t,r,o,"Http.Request"),"getHttpHandlerRequest"),le=p((e,t,r,o,n)=>{if(Fo(e)&&e.
|
|
127
|
+
elements.length>0)return le(e.elements[0],t,r,o,n);if(!Bo(e))return er(e,t,r,o,n);
|
|
128
|
+
let s=$o(e,r);if(s)return er(s,t,r,o,n)},"getHttpRequest"),er=p((e,t,r,o,n)=>{if(No(
|
|
129
|
+
e))return rr(e,t,Jo(e),r,o);if(!Vo(e)){o.push(new V(n,t.file));return}if(!Qo(e,n)){
|
|
130
|
+
o.push(new Q(e.name,n,e.file));return}return rr(e,t,Go(e),r,o)},"getTypeRequest"),
|
|
131
|
+
rr=p((e,t,r,o,n)=>{let s={};for(let i of r)if(!(!Do(i)||i.inherited))switch(i.name){default:
|
|
132
|
+
n.push(new Uo(t.name,i.name,e.file));break;case"headers":{s.headers=F(i.value,e,
|
|
127
133
|
o,n),s.headers&&i.description&&(s.headers.description=i.description);break}case"\
|
|
128
134
|
identity":{s.identity=M(i.value,e,o,n),s.identity&&i.description&&(s.identity.description=
|
|
129
|
-
i.description);break}case"query":{s.query=
|
|
130
|
-
(s.query.description=i.description);break}case"parameters":{s.parameters=
|
|
135
|
+
i.description);break}case"query":{s.query=Le(i.value,e,o,n),s.query&&i.description&&
|
|
136
|
+
(s.query.description=i.description);break}case"parameters":{s.parameters=Ze(i.value,
|
|
131
137
|
e,o,n),s.parameters&&i.description&&(s.parameters.description=i.description);break}case"\
|
|
132
138
|
body":{s.body=U(i.value,e,o,n),s.body&&i.description&&(s.body.description=i.description);
|
|
133
|
-
break}}return s},"getTypeFromMembers");var
|
|
139
|
+
break}}return s},"getTypeFromMembers");var nr=p((e,t,r,o)=>{if(!Oe(e))return;let{description:n,module:s}=e,i={...n&&{description:n},
|
|
134
140
|
...s&&{module:s}},m=new Set(["name","file"]);if((i.name=e.name)&&m.delete("name"),
|
|
135
141
|
(i.file=e.file)&&m.delete("file"),e.parameters){let[{value:c}]=e.parameters;i.request=
|
|
136
|
-
|
|
137
|
-
[...m],e.file))},"getHttpAuthorizer"),
|
|
138
|
-
zer");import{IncompleteTypeError as
|
|
139
|
-
super("Incomplete route handler",t,r)}};import{isModelDeclaration as
|
|
140
|
-
getLinkedVariableList as
|
|
141
|
-
isTypeReference as
|
|
142
|
-
o);this.baseType=r}static{p(this,"InvalidProviderTypeError")}},X=class extends
|
|
142
|
+
tr(c,t,r,o)}if(e.return&&(i.response=Ke(e.return,t,r,o)),Ko(i))return i;o.push(new w(
|
|
143
|
+
[...m],e.file))},"getHttpAuthorizer"),Ko=p(e=>!!e.name&&!!e.file,"isValidAuthori\
|
|
144
|
+
zer");import{IncompleteTypeError as Yo}from"@ez4/common/library";var Y=class extends Yo{static{p(this,"IncompleteHandlerError")}constructor(t,r){
|
|
145
|
+
super("Incomplete route handler",t,r)}};import{isModelDeclaration as Zo,getModelMembers as _o,getReferenceType as Lo,getLinkedServiceList as en,
|
|
146
|
+
getLinkedVariableList as rn}from"@ez4/common/library";import{isModelProperty as tn,
|
|
147
|
+
isTypeReference as on}from"@ez4/reflection";import{IncompleteTypeError as Wo,InvalidTypeError as Xo}from"@ez4/common/library";var W=class extends Xo{constructor(r,o){super("Invalid route provider",void 0,r,
|
|
148
|
+
o);this.baseType=r}static{p(this,"InvalidProviderTypeError")}},X=class extends Wo{static{
|
|
143
149
|
p(this,"IncompleteProviderError")}constructor(t,r){super("Incomplete route provi\
|
|
144
|
-
der",t,r)}};var
|
|
145
|
-
if(n)return
|
|
146
|
-
"isValidProvider")
|
|
147
|
-
return
|
|
148
|
-
"services"]);for(let i of t)if(!(!
|
|
149
|
-
les":n.variables=
|
|
150
|
-
i.name);break}}if(
|
|
151
|
-
rs");var
|
|
150
|
+
der",t,r)}};var ir=p((e,t,r,o)=>{if(!on(e))return pr(e,t,r,o,"Http.Provider");let n=Lo(e,r);
|
|
151
|
+
if(n)return pr(n,t,r,o,"Http.Provider")},"getHttpProvider"),nn=p(e=>!!e.services,
|
|
152
|
+
"isValidProvider"),pr=p((e,t,r,o,n)=>{if(!Zo(e)){o.push(new W(n,t.file));return}
|
|
153
|
+
return pn(e,_o(e),r,o)},"getProviderType"),pn=p((e,t,r,o)=>{let n={},s=new Set([
|
|
154
|
+
"services"]);for(let i of t)if(!(!tn(i)||i.inherited))switch(i.name){case"variab\
|
|
155
|
+
les":n.variables=rn(i,o);break;case"services":{(n.services=en(i,r,o))&&s.delete(
|
|
156
|
+
i.name);break}}if(nn(n))return n;o.push(new X([...s],e.file))},"getTypeFromMembe\
|
|
157
|
+
rs");var sr=p((e,t,r,o,n)=>{if(!je(e))return;let{description:s,module:i}=e,m={...s&&{
|
|
152
158
|
description:s},...i&&{module:i}},c=new Set(["name","file","response"]);if((m.name=
|
|
153
|
-
e.name)&&c.delete("name"),(m.file=e.file)&&c.delete("file"),e.parameters){let[{value:
|
|
154
|
-
|
|
155
|
-
return){let
|
|
156
|
-
return m;o.push(new Y([...c],e.file))},"getHttpHandler"),
|
|
157
|
-
!!e.response,"isValidHandler");var
|
|
158
|
-
r,o,!0),"getHttpRemoteRoutes"),
|
|
159
|
-
[],e,r,o,n);let s=
|
|
160
|
-
ttpRoutes"),
|
|
161
|
-
isArray(m)?s.push(...m):m&&s.push(m)}return s},"getRouteFromTuple"),
|
|
162
|
-
if(!
|
|
163
|
-
FromRoute"),
|
|
164
|
-
e))return
|
|
165
|
-
return
|
|
166
|
-
["path","handler"]);for(let c of r)if(!(!
|
|
167
|
-
n.push(new
|
|
168
|
-
th":{let
|
|
169
|
-
|
|
170
|
-
value,t,o,n);break;case"httpErrors":i.httpErrors=
|
|
171
|
-
ferences":i.preferences=
|
|
172
|
-
timeout":i[c.name]=
|
|
173
|
-
|
|
174
|
-
n.push(new
|
|
175
|
-
getObjectMembers as dn,getPropertyNumber as fn,getReferenceType as yn}from"@ez4/common/library";
|
|
176
|
-
import{isModelProperty as Tn,isTypeObject as gn,isTypeReference as Mn}from"@ez4/reflection";
|
|
177
|
-
import{isAnyNumber as lr}from"@ez4/utils";import{IncompleteTypeError as sn,IncorrectTypeError as cn,InvalidTypeError as mn}from"@ez4/common/library";var Z=class extends sn{static{p(this,"IncompleteCacheError")}constructor(t,r){super(
|
|
178
|
-
"Incomplete gateway cache",t,r)}},_=class extends mn{static{p(this,"InvalidCache\
|
|
179
|
-
TypeError")}constructor(t){super("Invalid gateway cache type",void 0,"Http.Cache",
|
|
180
|
-
t)}},$=class extends cn{constructor(r,o){super("Incorrect gateway cache type",r,
|
|
181
|
-
"Http.Cache",o);this.cacheType=r}static{p(this,"IncorrectCacheTypeError")}};var dr=p((e,t,r,o)=>{if(!Mn(e))return ar(e,t,o);let n=yn(e,r);if(n)return ar(n,t,
|
|
182
|
-
o)},"getHttpCache"),Hn=p(e=>lr(e.authorizerTTL),"isValidCache"),ar=p((e,t,r)=>{if(gn(
|
|
183
|
-
e))return ur(e,t,dn(e),r);if(!un(e)){r.push(new _(t.file));return}if(!ve(e)){r.push(
|
|
184
|
-
new $(e.name,e.file));return}return ur(e,t,ln(e),r)},"getTypeCache"),ur=p((e,t,r,o)=>{
|
|
185
|
-
let n={},s=new Set(["authorizerTTL"]);for(let i of r)if(!(!Tn(i)||i.inherited))switch(i.
|
|
186
|
-
name){default:o.push(new an(t.name,i.name,e.file));break;case"authorizerTTL":{let m=fn(
|
|
187
|
-
i);lr(m)&&(n[i.name]=m,s.delete(i.name));break}}if(Hn(n))return n;o.push(new Z([
|
|
188
|
-
...s],e.file))},"getTypeFromMembers");import{InvalidServicePropertyError as vn,isModelDeclaration as In,getModelMembers as xn,
|
|
159
|
+
e.name)&&c.delete("name"),(m.file=e.file)&&c.delete("file"),e.parameters){let[{value:d},
|
|
160
|
+
fe]=e.parameters;m.request=or(d,t,r,o),fe&&!n&&(m.provider=ir(fe.value,t,r,o))}if(e.
|
|
161
|
+
return){let d=Ye(e.return,t,r,o);d&&(m.response=d,c.delete("response"))}if(sn(m))
|
|
162
|
+
return m;o.push(new Y([...c],e.file))},"getHttpHandler"),sn=p(e=>!!e.name&&!!e.file&&
|
|
163
|
+
!!e.response,"isValidHandler");var fr=p((e,t,r,o)=>Tr(e,t,r,o,!1),"getHttpLocalRoutes"),yr=p((e,t,r,o)=>Tr(e,t,
|
|
164
|
+
r,o,!0),"getHttpRemoteRoutes"),Tr=p((e,t,r,o,n)=>{if(!ur(t.value))return de(gn(t)??
|
|
165
|
+
[],e,r,o,n);let s=dr(t.value,r);if(s&&lr(s))return de(s.elements,e,r,o,n)},"getH\
|
|
166
|
+
ttpRoutes"),de=p((e,t,r,o,n)=>{let s=[];for(let i of e){let m=hn(i,t,r,o,n);Array.
|
|
167
|
+
isArray(m)?s.push(...m):m&&s.push(m)}return s},"getRouteFromTuple"),hn=p((e,t,r,o,n)=>{
|
|
168
|
+
if(!ur(e))return mr(e,t,r,o,n);let s=dr(e,r);if(s)return mr(s,t,r,o,n)},"getType\
|
|
169
|
+
FromRoute"),Mn=p(e=>!!e.path&&!!e.handler,"isValidRoute"),mr=p((e,t,r,o,n)=>{if(be(
|
|
170
|
+
e))return ar(e,t,yn(e),r,o,n);if(mn(e))return ar(e,t,fn(e),r,o,n);if(lr(e)&&e.spread)
|
|
171
|
+
return de(e.elements,t,r,o,n)},"getRouteType"),ar=p((e,t,r,o,n,s)=>{let i={},m=new Set(
|
|
172
|
+
["path","handler"]);for(let c of r)if(!(!cn(c)||c.inherited))switch(c.name){default:
|
|
173
|
+
n.push(new an(t.name,c.name,e.file));break;case"name":i.name=cr(c);break;case"pa\
|
|
174
|
+
th":{let d=cr(c);d&&Me(d)&&(m.delete(c.name),i.path=d);break}case"handler":(i.handler=
|
|
175
|
+
sr(c.value,t,o,n,s))&&m.delete(c.name);break;case"authorizer":i.authorizer=nr(c.
|
|
176
|
+
value,t,o,n);break;case"httpErrors":i.httpErrors=A(c.value,t,o,n);break;case"pre\
|
|
177
|
+
ferences":i.preferences=x(c.value,t,o,n);break;case"memory":case"logRetention":case"\
|
|
178
|
+
timeout":i[c.name]=dn(c);break;case"cors":case"disabled":i[c.name]=ln(c);break;case"\
|
|
179
|
+
listener":i.listener=Tn(c.value,n);break;case"variables":i.variables=un(c,n);break}
|
|
180
|
+
if(Mn(i))return i;n.push(new z([...m],e.file))},"getTypeFromMembers");import{InvalidServicePropertyError as In,isModelDeclaration as vn,getModelMembers as xn,
|
|
189
181
|
getObjectMembers as An,getPropertyNumber as En,getReferenceType as Pn}from"@ez4/common/library";
|
|
190
|
-
import{isModelProperty as Rn,isTypeObject as
|
|
191
|
-
import{isAnyNumber as
|
|
192
|
-
"Incomplete gateway access",t,r)}},
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
e)
|
|
200
|
-
|
|
201
|
-
i
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
"
|
|
208
|
-
|
|
182
|
+
import{isModelProperty as Rn,isTypeObject as zn,isTypeReference as wn}from"@ez4/reflection";
|
|
183
|
+
import{isAnyNumber as Mr}from"@ez4/utils";import{IncompleteTypeError as bn,IncorrectTypeError as Hn,InvalidTypeError as Sn}from"@ez4/common/library";var Z=class extends bn{static{p(this,"IncompleteAccessError")}constructor(t,r){super(
|
|
184
|
+
"Incomplete gateway access",t,r)}},_=class extends Sn{static{p(this,"InvalidAcce\
|
|
185
|
+
ssTypeError")}constructor(t){super("Invalid gateway access type",void 0,"Http.Ac\
|
|
186
|
+
cess",t)}},L=class extends Hn{constructor(r,o){super("Incorrect gateway access t\
|
|
187
|
+
ype",r,"Http.Access",o);this.cacheType=r}static{p(this,"IncorrectAccessTypeError")}};var br=p((e,t,r,o)=>{if(!wn(e))return gr(e,t,o);let n=Pn(e,r);if(n)return gr(n,t,
|
|
188
|
+
o)},"getHttpAccess"),On=p(e=>Mr(e.logRetention),"isValidAccess"),gr=p((e,t,r)=>{
|
|
189
|
+
if(zn(e))return hr(e,t,An(e),r);if(!vn(e)){r.push(new _(t.file));return}if(!ze(e)){
|
|
190
|
+
r.push(new L(e.name,e.file));return}return hr(e,t,xn(e),r)},"getTypeAccess"),hr=p(
|
|
191
|
+
(e,t,r,o)=>{let n={},s=new Set(["logRetention"]);for(let i of r)if(!(!Rn(i)||i.inherited))
|
|
192
|
+
switch(i.name){default:o.push(new In(t.name,i.name,e.file));break;case"logRetent\
|
|
193
|
+
ion":{let m=En(i);Mr(m)&&(n[i.name]=m,s.delete(i.name));break}}if(On(n))return n;
|
|
194
|
+
o.push(new Z([...s],e.file))},"getTypeFromMembers");import{InvalidServicePropertyError as qn,isModelDeclaration as Dn,getModelMembers as Fn,
|
|
195
|
+
getObjectMembers as Nn,getPropertyNumber as Bn,getReferenceType as Un}from"@ez4/common/library";
|
|
196
|
+
import{isModelProperty as Vn,isTypeObject as Qn,isTypeReference as Jn}from"@ez4/reflection";
|
|
197
|
+
import{isAnyNumber as Ir}from"@ez4/utils";import{IncompleteTypeError as jn,IncorrectTypeError as kn,InvalidTypeError as Cn}from"@ez4/common/library";var ee=class extends jn{static{p(this,"IncompleteCacheError")}constructor(t,r){super(
|
|
198
|
+
"Incomplete gateway cache",t,r)}},re=class extends Cn{static{p(this,"InvalidCach\
|
|
199
|
+
eTypeError")}constructor(t){super("Invalid gateway cache type",void 0,"Http.Cach\
|
|
200
|
+
e",t)}},te=class extends kn{constructor(r,o){super("Incorrect gateway cache type",
|
|
201
|
+
r,"Http.Cache",o);this.cacheType=r}static{p(this,"IncorrectCacheTypeError")}};var vr=p((e,t,r,o)=>{if(!Jn(e))return Hr(e,t,o);let n=Un(e,r);if(n)return Hr(n,t,
|
|
202
|
+
o)},"getHttpCache"),Gn=p(e=>Ir(e.authorizerTTL),"isValidCache"),Hr=p((e,t,r)=>{if(Qn(
|
|
203
|
+
e))return Sr(e,t,Nn(e),r);if(!Dn(e)){r.push(new re(t.file));return}if(!Re(e)){r.
|
|
204
|
+
push(new te(e.name,e.file));return}return Sr(e,t,Fn(e),r)},"getTypeCache"),Sr=p(
|
|
205
|
+
(e,t,r,o)=>{let n={},s=new Set(["authorizerTTL"]);for(let i of r)if(!(!Vn(i)||i.
|
|
206
|
+
inherited))switch(i.name){default:o.push(new qn(t.name,i.name,e.file));break;case"\
|
|
207
|
+
authorizerTTL":{let m=Bn(i);Ir(m)&&(n[i.name]=m,s.delete(i.name));break}}if(Gn(n))
|
|
208
|
+
return n;o.push(new ee([...s],e.file))},"getTypeFromMembers");import{InvalidServicePropertyError as Wn,isModelDeclaration as Xn,getModelMembers as Zn,
|
|
209
|
+
getObjectMembers as _n,getPropertyBoolean as Ln,getPropertyStringList as ep,getPropertyNumber as rp,
|
|
210
|
+
getReferenceType as tp}from"@ez4/common/library";import{isModelProperty as op,isTypeObject as np,
|
|
211
|
+
isTypeReference as pp}from"@ez4/reflection";import{IncompleteTypeError as $n,IncorrectTypeError as Kn,InvalidTypeError as Yn}from"@ez4/common/library";var oe=class extends $n{static{p(this,"IncompleteCorsError")}constructor(t,r){super(
|
|
212
|
+
"Incomplete HTTP CORS",t,r)}},ne=class extends Yn{static{p(this,"InvalidCorsType\
|
|
213
|
+
Error")}constructor(t){super("Invalid HTTP CORS type",void 0,"Http.Cors",t)}},pe=class extends Kn{constructor(r,o){
|
|
209
214
|
super("Incorrect HTTP CORS type",r,"Http.Cors",o);this.fallbackType=r}static{p(this,
|
|
210
|
-
"IncorrectCorsTypeError")}};var
|
|
211
|
-
o)},"getHttpCors"),
|
|
212
|
-
if(
|
|
213
|
-
e)){r.push(new
|
|
214
|
-
|
|
215
|
-
i.inherited))switch(i.name){default:o.push(new
|
|
215
|
+
"IncorrectCorsTypeError")}};var Er=p((e,t,r,o)=>{if(!pp(e))return xr(e,t,o);let n=tp(e,r);if(n)return xr(n,t,
|
|
216
|
+
o)},"getHttpCors"),ip=p(e=>!!e.allowOrigins?.length,"isValidCors"),xr=p((e,t,r)=>{
|
|
217
|
+
if(np(e))return Ar(e,t,_n(e),r);if(!Xn(e)){r.push(new ne(t.file));return}if(!we(
|
|
218
|
+
e)){r.push(new pe(e.name,e.file));return}return Ar(e,t,Zn(e),r)},"getTypeCors"),
|
|
219
|
+
Ar=p((e,t,r,o)=>{let n={},s=new Set(["allowOrigins"]);for(let i of r)if(!(!op(i)||
|
|
220
|
+
i.inherited))switch(i.name){default:o.push(new Wn(t.name,i.name,e.file));break;case"\
|
|
216
221
|
allowOrigins":case"allowMethods":case"allowHeaders":case"exposeHeaders":n[i.name]=
|
|
217
|
-
|
|
218
|
-
maxAge=
|
|
219
|
-
Members");var
|
|
220
|
-
type:
|
|
221
|
-
description=n.description);for(let c of
|
|
222
|
-
name){default:r.push(new
|
|
223
|
-
c,e,r))&&i.delete(c.name);break;case"name":s.displayName=
|
|
224
|
-
ts":s.defaults=
|
|
225
|
-
access":s.access=
|
|
226
|
-
variables":s.variables=
|
|
227
|
-
s)){r.push(new
|
|
228
|
-
|
|
229
|
-
name&&!!e.routes&&!!e.context,"isValidService"),
|
|
222
|
+
ep(i);break;case"allowCredentials":n.allowCredentials=Ln(i);break;case"maxAge":n.
|
|
223
|
+
maxAge=rp(i);break}if(ip(n))return n;o.push(new oe([...s],e.file))},"getTypeFrom\
|
|
224
|
+
Members");var Pr=p(e=>{let t={},r=[];for(let o in e){let n=e[o];if(!I(n)||cp(n))continue;let s={
|
|
225
|
+
type:T,context:{}},i=new Set(["routes"]),m=n.file;s.name=n.name,n.description&&(s.
|
|
226
|
+
description=n.description);for(let c of up(n))if(!(!fp(c)||c.inherited))switch(c.
|
|
227
|
+
name){default:r.push(new dp(s.name,c.name,m));break;case"routes":(s.routes=fr(n,
|
|
228
|
+
c,e,r))&&i.delete(c.name);break;case"name":s.displayName=lp(c);break;case"defaul\
|
|
229
|
+
ts":s.defaults=E(c.value,n,e,r);break;case"cache":s.cache=vr(c.value,n,e,r);break;case"\
|
|
230
|
+
access":s.access=br(c.value,n,e,r);break;case"cors":s.cors=Er(c.value,n,e,r);break;case"\
|
|
231
|
+
variables":s.variables=ap(c,r);break;case"services":s.services=mp(c,e,r);break}if(!yp(
|
|
232
|
+
s)){r.push(new f([...i],m));continue}if(t[n.name]){r.push(new sp(n.name,m));continue}
|
|
233
|
+
Tp(s,r,m),t[n.name]=s}return{services:t,errors:r}},"getHttpServices"),yp=p(e=>!!e.
|
|
234
|
+
name&&!!e.routes&&!!e.context,"isValidService"),Tp=p((e,t,r)=>{for(let o of e.routes){
|
|
230
235
|
let n=o.handler.provider;if(n?.services){e.services||(e.services={});for(let s in n.
|
|
231
236
|
services){let i=e.services[s],m=n.services[s];if(!i){e.services[s]=m;continue}i!==
|
|
232
|
-
m&&t.push(new
|
|
233
|
-
getModelMembers as
|
|
234
|
-
import{isModelProperty as
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
(
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
r
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
237
|
+
m&&t.push(new b(s,r))}}}},"assignProviderServices");import{DuplicateServiceError as wp,InvalidServicePropertyError as Op,isExternalDeclaration as jp,
|
|
238
|
+
getModelMembers as kp,getPropertyString as jr,getReferenceName as Cp}from"@ez4/common/library";
|
|
239
|
+
import{isModelProperty as qp,isTypeReference as Dp}from"@ez4/reflection";import{InvalidServicePropertyError as bp,isModelDeclaration as Hp,getObjectMembers as Sp,
|
|
240
|
+
getModelMembers as Ip,getReferenceType as vp,getPropertyStringIn as xp,getPropertyString as Ap}from"@ez4/common/library";
|
|
241
|
+
import{isModelProperty as Ep,isTypeObject as Pp,isTypeReference as Rp}from"@ez4/reflection";
|
|
242
|
+
import{isAnyString as wr}from"@ez4/utils";import{IncompleteTypeError as gp,IncorrectTypeError as hp,InvalidTypeError as Mp}from"@ez4/common/library";var ie=class extends gp{static{p(this,"IncompleteAuthorizationError")}constructor(t,r){
|
|
243
|
+
super("Incomplete gateway authorization",t,r)}},se=class extends Mp{static{p(this,
|
|
244
|
+
"InvalidAuthorizationTypeError")}constructor(t){super("Invalid authorization",void 0,
|
|
245
|
+
"Http.Authorization",t)}},ce=class extends hp{constructor(r,o){super("Incorrect \
|
|
246
|
+
authorization",r,"Http.Authorization",o);this.authorizationType=r}static{p(this,
|
|
247
|
+
"IncorrectAuthorizationTypeError")}};var Or=p((e,t,r,o)=>{if(!Rp(e))return Rr(e,t,o);let n=vp(e,r);if(n)return Rr(n,t,
|
|
248
|
+
o)},"getHttpAuthorization"),zp=p(e=>wr(e.value),"isValidAuthorization"),Rr=p((e,t,r)=>{
|
|
249
|
+
if(Pp(e))return zr(e,t,Sp(e),r);if(!Hp(e)){r.push(new se(t.file));return}if(!Se(
|
|
250
|
+
e)){r.push(new ce(e.name,t.file));return}return zr(e,t,Ip(e),r)},"getTypeAuthori\
|
|
251
|
+
zation"),zr=p((e,t,r,o)=>{let n=new Set(["value"]),s={type:"bearer",header:"auth\
|
|
252
|
+
orization"};for(let i of r)if(Ep(i))switch(i.name){default:o.push(new bp(t.name,
|
|
253
|
+
i.name,t.file));break;case"type":s.type=xp(i,["bearer"]);break;case"value":case"\
|
|
254
|
+
header":{let m=Ap(i);wr(m)&&(s[i.name]=m,n.delete(i.name));break}}if(zp(s))return s;
|
|
255
|
+
o.push(new ie([...n],e.file))},"getTypeFromMembers");var kr=p(e=>{let t={},r=[];for(let o in e){let n=e[o];if(!v(n)||jp(n))continue;let s={
|
|
256
|
+
type:y},i=new Set(["reference","project","routes"]),m=n.file;s.name=n.name,n.description&&
|
|
257
|
+
(s.description=n.description);for(let c of kp(n,!0))if(qp(c))switch(c.name){default:
|
|
258
|
+
c.inherited||r.push(new Op(s.name,c.name,m));break;case"reference":c.inherited&&
|
|
259
|
+
Dp(c.value)&&(s[c.name]=Cp(c.value),i.delete(c.name));break;case"authorization":
|
|
260
|
+
c.inherited||(s[c.name]=Or(c.value,n,e,r));break;case"project":!c.inherited&&(s.
|
|
261
|
+
project=jr(c))&&i.delete(c.name);break;case"name":c.inherited&&(s.displayName=jr(
|
|
262
|
+
c,e));break;case"routes":c.inherited&&(s.routes=yr(n,c,e,r))&&i.delete(c.name);break;case"\
|
|
263
|
+
defaults":c.inherited&&(s.defaults=E(c.value,n,e,r));break}if(!Fp(s)){r.push(new f(
|
|
264
|
+
[...i],m));continue}if(t[n.name]){r.push(new wp(n.name,m));continue}t[n.name]=s}
|
|
265
|
+
return{services:t,errors:r}},"getHttpImports"),Fp=p(e=>!!e.name&&!!e.reference&&
|
|
266
|
+
!!e.project&&!!e.routes,"isValidImport");var Cr=p(e=>I(e)?e.name:null,"getLinkedService"),qr=p(e=>v(e)?e.name:null,"getLi\
|
|
267
|
+
nkedImport");var na=p(()=>{Np(),Bp(),Dr(T,{"metadata:getServices":Pr,"metadata:getLinkedServi\
|
|
268
|
+
ce":Cr}),Dr(y,{"metadata:getServices":kr,"metadata:getLinkedService":qr})},"regi\
|
|
269
|
+
sterTriggers");var sa=p(e=>{let{authorization:t}=e;if(t)switch(t.type){default:throw new Error(
|
|
270
|
+
`Authorization type ${t.type} isn't supported.`);case"bearer":return{header:t.header,
|
|
271
|
+
value:`Bearer ${t.value}`}}},"getClientAuthorization");import{getObjectSchemaProperty as Up}from"@ez4/schema";var la=p(e=>{let t={},r=e.defaults?.preferences?.namingStyle,o=ye(e)?e.authorization?.
|
|
272
|
+
header:void 0;for(let n of e.routes){if(!n.name)continue;let[s,i]=n.path.split("\
|
|
273
|
+
",2),{handler:m,preferences:c}=n;t[n.name]={authorize:Vp(n,o),namingStyle:c?.namingStyle??
|
|
274
|
+
r,bodySchema:m.request?.body,responseSchema:m.response.body,querySchema:m.request?.
|
|
275
|
+
query,method:s,path:i}}return t},"getClientOperations"),Vp=p((e,t)=>{let r=e.authorizer?.
|
|
276
|
+
request?.headers;if(!r||!t)return!1;let o=Up(r,t);return!(!o||o.optional)},"shou\
|
|
277
|
+
ldUseAuthorization");import{IncorrectTypeError as Qp,InvalidTypeError as Jp}from"@ez4/common/library";var P=class extends Jp{static{p(this,"InvalidDefaultsTypeError")}constructor(t){
|
|
278
|
+
super("Invalid defaults",void 0,"Http.Defaults",t)}},R=class extends Qp{constructor(r,o){
|
|
253
279
|
super("Incorrect defaults",r,"Http.Defaults",o);this.defaultsType=r}static{p(this,
|
|
254
|
-
"IncorrectDefaultsTypeError")}};
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
y as ServiceType,hm as getClientOperations,Xe as getHttpAuthRequest,Ue as getHttpAuthResponse,
|
|
270
|
-
_e as getHttpAuthorizer,U as getHttpBody,dr as getHttpCache,br as getHttpCors,er as getHttpHandler,
|
|
271
|
-
Ze as getHttpHandlerRequest,Be as getHttpHandlerResponse,D as getHttpHeaders,M as getHttpIdentity,
|
|
272
|
-
ir as getHttpLocalRoutes,Je as getHttpParameters,Ke as getHttpQuery,cr as getHttpRemoteRoutes,
|
|
273
|
-
hr as getHttpServices,Hp as isHttpImport,Sp as isHttpService,Mm as registerTriggers};
|
|
280
|
+
"IncorrectDefaultsTypeError")}};export{y as ImportType,Z as IncompleteAccessError,ie as IncompleteAuthorizationError,
|
|
281
|
+
w as IncompleteAuthorizerError,ee as IncompleteCacheError,oe as IncompleteCorsError,
|
|
282
|
+
Y as IncompleteHandlerError,X as IncompleteProviderError,z as IncompleteRouteError,
|
|
283
|
+
f as IncompleteServiceError,L as IncorrectAccessTypeError,ce as IncorrectAuthorizationTypeError,
|
|
284
|
+
B as IncorrectBodyTypeError,te as IncorrectCacheTypeError,pe as IncorrectCorsTypeError,
|
|
285
|
+
R as IncorrectDefaultsTypeError,D as IncorrectHeadersTypeError,C as IncorrectIdentityTypeError,
|
|
286
|
+
G as IncorrectParameterTypeError,S as IncorrectPreferencesTypeError,K as IncorrectQueryTypeError,
|
|
287
|
+
Q as IncorrectRequestTypeError,j as IncorrectResponseTypeError,_ as InvalidAccessTypeError,
|
|
288
|
+
se as InvalidAuthorizationTypeError,N as InvalidBodyTypeError,re as InvalidCacheTypeError,
|
|
289
|
+
ne as InvalidCorsTypeError,P as InvalidDefaultsTypeError,q as InvalidHeadersTypeError,
|
|
290
|
+
k as InvalidIdentityTypeError,J as InvalidParameterTypeError,H as InvalidPreferencesTypeError,
|
|
291
|
+
W as InvalidProviderTypeError,$ as InvalidQueryTypeError,V as InvalidRequestTypeError,
|
|
292
|
+
O as InvalidResponseTypeError,h as InvalidRouteErrorTypeError,b as ServiceCollisionError,
|
|
293
|
+
T as ServiceType,sa as getClientAuthorization,la as getClientOperations,kr as getHttpImports,
|
|
294
|
+
Pr as getHttpServices,ye as isHttpImport,Yp as isHttpService,na as registerTriggers};
|
|
274
295
|
//# sourceMappingURL=library.mjs.map
|