@ez4/gateway 0.15.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/library.cjs +151 -149
- package/dist/library.mjs +157 -151
- package/dist/metadata/authorizer.d.ts +2 -2
- package/dist/metadata/body.d.ts +1 -1
- package/dist/metadata/cors.d.ts +2 -4
- package/dist/metadata/defaults.d.ts +2 -2
- package/dist/metadata/handler.d.ts +2 -2
- package/dist/metadata/request.d.ts +3 -5
- package/dist/metadata/response.d.ts +3 -5
- package/dist/metadata/route.d.ts +2 -2
- package/dist/types/common.d.ts +3 -3
- package/package.json +7 -7
- package/dist/metadata/catcher.d.ts +0 -3
- package/dist/services/cors.d.ts +0 -29
- package/dist/services/helpers.d.ts +0 -7
- package/dist/services/http.d.ts +0 -106
- package/dist/services/request.d.ts +0 -43
- package/dist/services/response.d.ts +0 -27
- package/dist/types/authorizer.d.ts +0 -9
- package/dist/types/cors.d.ts +0 -8
- package/dist/types/handler.d.ts +0 -9
- package/dist/types/path.d.ts +0 -9
- package/dist/types/request.d.ts +0 -13
- package/dist/types/response.d.ts +0 -9
- package/dist/types/route.d.ts +0 -13
package/dist/library.cjs
CHANGED
|
@@ -1,152 +1,154 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
typeof
|
|
3
|
-
|
|
4
|
-
IncompleteRouteError:()=>
|
|
5
|
-
IncorrectCorsTypeError:()=>
|
|
6
|
-
IncorrectIdentityTypeError:()=>
|
|
7
|
-
IncorrectRequestTypeError:()=>
|
|
8
|
-
InvalidCorsTypeError:()=>
|
|
9
|
-
InvalidIdentityTypeError:()=>
|
|
10
|
-
InvalidRequestTypeError:()=>N,InvalidResponseTypeError:()=>z,ServiceType:()
|
|
11
|
-
getHttpAuthResponse:()=>
|
|
12
|
-
getHttpHandlerRequest:()=>
|
|
13
|
-
getHttpIdentity:()=>
|
|
14
|
-
getHttpResponseBody:()=>
|
|
15
|
-
registerTriggers:()=>
|
|
16
|
-
super("Incomplete service",r
|
|
17
|
-
NY","GET","POST","PUT","PATCH","DELETE","OPTIONS"]),
|
|
18
|
-
return
|
|
19
|
-
tp.Service"),
|
|
20
|
-
ute");var
|
|
21
|
-
"Http.Headers"),
|
|
22
|
-
e,"Http.QueryStrings"),
|
|
23
|
-
e,"Http.JsonBody"),
|
|
24
|
-
ttp.Cors"),
|
|
25
|
-
e)||(0,
|
|
26
|
-
return o?
|
|
27
|
-
e),
|
|
28
|
-
e.name,
|
|
29
|
-
if(!(!(0,b.isModelProperty)(
|
|
30
|
-
|
|
31
|
-
listener":
|
|
32
|
-
super("Incomplete service route",r
|
|
33
|
-
super("Incomplete route authorizer",r
|
|
34
|
-
super("Invalid route response",void 0,
|
|
35
|
-
super("Incorrect route response",
|
|
36
|
-
super("Invalid
|
|
37
|
-
super("Incorrect
|
|
38
|
-
|
|
39
|
-
e)
|
|
40
|
-
|
|
41
|
-
t
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
e)
|
|
46
|
-
|
|
47
|
-
r,
|
|
48
|
-
e)
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
e
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
null};var
|
|
62
|
-
|
|
63
|
-
if(!(0,
|
|
64
|
-
r,t,n,o):null},
|
|
65
|
-
|
|
66
|
-
e,o)?
|
|
67
|
-
push(new z(o,
|
|
68
|
-
p)||p.inherited))switch(p.name){
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
e,
|
|
72
|
-
|
|
73
|
-
break}
|
|
74
|
-
|
|
75
|
-
super("
|
|
76
|
-
super("
|
|
77
|
-
super("
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
e)?
|
|
81
|
-
|
|
82
|
-
t
|
|
83
|
-
|
|
84
|
-
super("
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
e)?
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
e),t,n):
|
|
93
|
-
e),
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
n),
|
|
99
|
-
|
|
100
|
-
description=p.description);break}case"
|
|
101
|
-
|
|
102
|
-
description
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
"
|
|
109
|
-
|
|
110
|
-
"
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
e
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
super("
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
e
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
name]=
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
1
|
+
"use strict";var He=Object.defineProperty;var Ir=Object.getOwnPropertyDescriptor;var vr=Object.getOwnPropertyNames;var Rr=Object.prototype.hasOwnProperty;var Er=(e,t)=>{for(var r in t)He(e,r,{get:t[r],enumerable:!0})},jr=(e,t,r,n)=>{if(t&&
|
|
2
|
+
typeof t=="object"||typeof t=="function")for(let o of vr(t))!Rr.call(e,o)&&o!==r&&
|
|
3
|
+
He(e,o,{get:()=>t[o],enumerable:!(n=Ir(t,o))||n.enumerable});return e};var Or=e=>jr(He({},"__esModule",{value:!0}),e);var Gr={};Er(Gr,{IncompleteAuthorizerError:()=>w,IncompleteCorsError:()=>X,IncompleteHandlerError:()=>W,
|
|
4
|
+
IncompleteRouteError:()=>P,IncompleteServiceError:()=>E,IncorrectBodyTypeError:()=>C,
|
|
5
|
+
IncorrectCorsTypeError:()=>_,IncorrectDefaultsTypeError:()=>O,IncorrectHeadersTypeError:()=>V,
|
|
6
|
+
IncorrectIdentityTypeError:()=>B,IncorrectParameterTypeError:()=>G,IncorrectQueryTypeError:()=>K,
|
|
7
|
+
IncorrectRequestTypeError:()=>Q,IncorrectResponseTypeError:()=>k,InvalidBodyTypeError:()=>q,
|
|
8
|
+
InvalidCorsTypeError:()=>Z,InvalidDefaultsTypeError:()=>j,InvalidHeadersTypeError:()=>U,
|
|
9
|
+
InvalidIdentityTypeError:()=>D,InvalidParameterTypeError:()=>J,InvalidQueryTypeError:()=>Y,
|
|
10
|
+
InvalidRequestTypeError:()=>N,InvalidResponseTypeError:()=>z,ServiceType:()=>$,getHttpAuthRequest:()=>Re,
|
|
11
|
+
getHttpAuthResponse:()=>xe,getHttpAuthorizer:()=>je,getHttpCors:()=>we,getHttpHandler:()=>Oe,
|
|
12
|
+
getHttpHandlerRequest:()=>Ee,getHttpHandlerResponse:()=>Ae,getHttpHeaders:()=>F,
|
|
13
|
+
getHttpIdentity:()=>S,getHttpParameters:()=>Ie,getHttpQuery:()=>ve,getHttpRequestBody:()=>Me,
|
|
14
|
+
getHttpResponseBody:()=>be,getHttpRoute:()=>Pe,getHttpServices:()=>ze,isHttpService:()=>Pr,
|
|
15
|
+
registerTriggers:()=>Jr});module.exports=Or(Gr);var Sr=require("@ez4/common/library"),xr=require("@ez4/schema/library"),Ar=require("@ez4/project/library");var m=require("@ez4/common/library"),br=require("@ez4/reflection");var $="@ez4/http",Pr=e=>e.type===$;var ke=require("@ez4/common/library"),E=class extends ke.IncompleteTypeError{constructor(t,r){
|
|
16
|
+
super("Incomplete service",t,r)}};var f=require("@ez4/common/library"),b=require("@ez4/reflection");var a=require("@ez4/common/library"),M=require("@ez4/reflection"),wr=new Set(["A\
|
|
17
|
+
NY","GET","POST","PUT","PATCH","DELETE","OPTIONS"]),qe=e=>{let[t]=e.split(" ",2);
|
|
18
|
+
return wr.has(t)},Ce=e=>(0,a.isClassDeclaration)(e)&&(0,a.hasHeritageType)(e,"Ht\
|
|
19
|
+
tp.Service"),De=e=>(0,a.isModelDeclaration)(e)&&(0,a.hasHeritageType)(e,"Http.Ro\
|
|
20
|
+
ute");var Be=e=>(0,a.hasHeritageType)(e,"Http.Defaults"),Ue=e=>(0,a.hasHeritageType)(e,
|
|
21
|
+
"Http.Headers"),Ve=e=>(0,a.hasHeritageType)(e,"Http.Identity"),Fe=e=>(0,a.hasHeritageType)(
|
|
22
|
+
e,"Http.QueryStrings"),Ne=e=>(0,a.hasHeritageType)(e,"Http.PathParameters"),Qe=e=>(0,a.hasHeritageType)(
|
|
23
|
+
e,"Http.JsonBody"),Je=e=>(0,a.isModelDeclaration)(e)&&(0,a.hasHeritageType)(e,"H\
|
|
24
|
+
ttp.Cors"),Ge=e=>(0,M.isTypeCallback)(e)||(0,M.isTypeFunction)(e),Ye=e=>(0,M.isTypeCallback)(
|
|
25
|
+
e)||(0,M.isTypeFunction)(e);var Xe=(e,t,r,n)=>{if(!(0,b.isTypeReference)(e))return Ke(e,t,n);let o=(0,f.getReferenceType)(
|
|
26
|
+
e,r);return o?Ke(o,t,n):null},Ke=(e,t,r)=>(0,b.isTypeObject)(e)?We(t,(0,f.getObjectMembers)(
|
|
27
|
+
e),r):(0,f.isModelDeclaration)(e)?Be(e)?We(t,(0,f.getModelMembers)(e),r):(r.push(
|
|
28
|
+
new O(e.name,t.file)),null):(r.push(new j(t.file)),null),We=(e,t,r)=>{let n={};for(let o of t)
|
|
29
|
+
if(!(!(0,b.isModelProperty)(o)||o.inherited))switch(o.name){default:r.push(new f.InvalidServicePropertyError(
|
|
30
|
+
e.name,o.name,e.file));break;case"memory":case"timeout":n[o.name]=(0,f.getPropertyNumber)(
|
|
31
|
+
o);break;case"listener":n.listener=(0,f.getServiceListener)(o.value,r);break}return n};var I=require("@ez4/reflection"),c=require("@ez4/common/library");var Ze=require("@ez4/common/library"),P=class extends Ze.IncompleteTypeError{constructor(t,r){
|
|
32
|
+
super("Incomplete service route",t,r)}};var _e=require("@ez4/common/library"),w=class extends _e.IncompleteTypeError{constructor(t,r){
|
|
33
|
+
super("Incomplete route authorizer",t,r)}};var d=require("@ez4/common/library"),x=require("@ez4/reflection"),pr=require("@ez4/utils");var L=require("@ez4/common/library"),z=class extends L.InvalidTypeError{constructor(r,n){
|
|
34
|
+
super("Invalid route response",void 0,r,n);this.baseType=r}},k=class extends L.IncorrectTypeError{constructor(r,n,o){
|
|
35
|
+
super("Incorrect route response",r,n,o);this.responseType=r;this.baseType=n}};var re=require("@ez4/common/library"),g=require("@ez4/schema/library"),T=require("@ez4/reflection");var ee=require("@ez4/common/library"),q=class extends ee.InvalidTypeError{constructor(t){
|
|
36
|
+
super("Invalid body",void 0,"Http.JsonBody",t)}},C=class extends ee.IncorrectTypeError{constructor(r,n){
|
|
37
|
+
super("Incorrect body",r,"Http.JsonBody",n);this.bodyType=r}};var Me=(e,t,r,n)=>he(e,t,r,(o,s)=>Se(o,s,r,n)),be=(e,t,r,n)=>he(e,t,r,(o,s)=>Le(
|
|
38
|
+
o)??Se(o,s,r,n)),he=(e,t,r,n)=>{if((0,T.isTypeUndefined)(e))return null;if(!(0,T.isTypeReference)(
|
|
39
|
+
e))return n(e,t);let o=(0,re.getReferenceType)(e,r);return o?n(o,t):null},Le=e=>(0,T.isTypeScalar)(
|
|
40
|
+
e)?(0,g.getScalarSchema)(e):null,Se=(e,t,r,n)=>(0,T.isTypeUnion)(e)?zr(e.elements,
|
|
41
|
+
t,r,(o,s)=>Le(o)??Se(o,s,r,n)):(0,T.isTypeObject)(e)?$e(e,r):(0,re.isModelDeclaration)(
|
|
42
|
+
e)?Qe(e)?$e(e,r):(n.push(new C(e.name,e.file)),null):(n.push(new q(t.file)),null),
|
|
43
|
+
zr=(e,t,r,n)=>{let o=[];for(let s of e){let p=he(s,t,r,n);p&&o.push(p)}return o.
|
|
44
|
+
length?(0,g.createUnionSchema)({elements:o}):null},$e=(e,t)=>{let r=(0,g.getObjectSchema)(
|
|
45
|
+
e,t);return r&&(0,g.isObjectSchema)(r)?r:null};var H=require("@ez4/reflection"),h=require("@ez4/schema/library"),oe=require("@ez4/common/library");var te=require("@ez4/common/library"),D=class extends te.InvalidTypeError{constructor(t){
|
|
46
|
+
super("Invalid identity",void 0,"Http.Identity",t)}},B=class extends te.IncorrectTypeError{constructor(r,n){
|
|
47
|
+
super("Incorrect identity",r,"Http.Identity",n);this.identityType=r}};var S=(e,t,r,n)=>{if((0,H.isTypeUndefined)(e))return null;if(!(0,H.isTypeReference)(
|
|
48
|
+
e))return er(e,t,r,n);let o=(0,oe.getReferenceType)(e,r);return o?er(o,t,r,n):null},
|
|
49
|
+
er=(e,t,r,n)=>{if((0,H.isTypeUnion)(e))return kr(e.elements,t,r,n);if((0,H.isTypeObject)(
|
|
50
|
+
e))return rr(e,r);if(!(0,oe.isModelDeclaration)(e))return n.push(new D(t.file)),
|
|
51
|
+
null;if(!Ve(e))return n.push(new B(e.name,t.file)),null;let o=rr(e,r);return o&&
|
|
52
|
+
(o.definitions={...o.definitions,extensible:!0}),o},kr=(e,t,r,n)=>{let o=[];for(let s of e){
|
|
53
|
+
let p=S(s,t,r,n);p&&o.push(p)}return o.length>1?(0,h.createUnionSchema)({elements:o}):
|
|
54
|
+
o[0]},rr=(e,t)=>{let r=(0,h.getObjectSchema)(e,t);return r&&(0,h.isObjectSchema)(
|
|
55
|
+
r)?r:null};var se=require("@ez4/common/library"),pe=require("@ez4/schema/library"),ie=require("@ez4/reflection");var ne=require("@ez4/common/library"),U=class extends ne.InvalidTypeError{constructor(t){
|
|
56
|
+
super("Invalid headers",void 0,"Http.Headers",t)}},V=class extends ne.IncorrectTypeError{constructor(r,n){
|
|
57
|
+
super("Incorrect headers",r,"Http.Headers",n);this.headersType=r}};var F=(e,t,r,n)=>{if(!(0,ie.isTypeReference)(e))return tr(e,t,r,n);let o=(0,se.getReferenceType)(
|
|
58
|
+
e,r);return o?tr(o,t,r,n):null},tr=(e,t,r,n)=>(0,ie.isTypeObject)(e)?or(e,r):(0,se.isModelDeclaration)(
|
|
59
|
+
e)?Ue(e)?or(e,r):(n.push(new V(e.name,t.file)),null):(n.push(new U(t.file)),null),
|
|
60
|
+
or=(e,t)=>{let r=(0,pe.getObjectSchema)(e,t);return r&&(0,pe.isObjectSchema)(r)?
|
|
61
|
+
r:null};var xe=(e,t,r,n)=>{let o=ir(e,t,r,n,"Http.AuthResponse");return o&&qr(o)?o:null},
|
|
62
|
+
Ae=(e,t,r,n)=>{let o=ir(e,t,r,n,"Http.Response");return o&&Cr(o)?o:null},ir=(e,t,r,n,o)=>{
|
|
63
|
+
if(!(0,x.isTypeReference)(e))return nr(e,t,r,n,o);let s=(0,d.getReferenceType)(e,
|
|
64
|
+
r);return s?nr(s,t,r,n,o):null},qr=e=>!!e.identity,Cr=e=>(0,pr.isAnyNumber)(e.status),
|
|
65
|
+
nr=(e,t,r,n,o)=>(0,x.isTypeObject)(e)?sr(e,t,(0,d.getObjectMembers)(e),r,n):(0,d.isModelDeclaration)(
|
|
66
|
+
e)?(0,d.hasHeritageType)(e,o)?sr(e,t,(0,d.getModelMembers)(e),r,n):(n.push(new k(
|
|
67
|
+
e.name,o,e.file)),null):(n.push(new z(o,t.file)),null),sr=(e,t,r,n,o)=>{let s={};
|
|
68
|
+
for(let p of r)if(!(!(0,x.isModelProperty)(p)||p.inherited))switch(p.name){default:
|
|
69
|
+
o.push(new d.InvalidServicePropertyError(t.name,p.name,e.file));break;case"statu\
|
|
70
|
+
s":s.status=(0,d.getPropertyNumber)(p);break;case"headers":{s.headers=F(p.value,
|
|
71
|
+
e,n,o),s.headers&&p.description&&(s.headers.description=p.description);break}case"\
|
|
72
|
+
identity":{s.identity=S(p.value,e,n,o),s.identity&&p.description&&(s.identity.description=
|
|
73
|
+
p.description);break}case"body":{s.body=be(p.value,e,n,o),s.body&&p.description&&
|
|
74
|
+
(s.body.description=p.description);break}}return s};var y=require("@ez4/common/library"),A=require("@ez4/reflection");var ce=require("@ez4/common/library"),N=class extends ce.InvalidTypeError{constructor(r,n){
|
|
75
|
+
super("Invalid route request",void 0,r,n);this.baseType=r}},Q=class extends ce.IncorrectTypeError{constructor(r,n,o){
|
|
76
|
+
super("Incorrect route request",r,n,o);this.requestType=r;this.baseType=n}};var me=require("@ez4/common/library"),ue=require("@ez4/schema/library"),ae=require("@ez4/reflection");var le=require("@ez4/common/library"),J=class extends le.InvalidTypeError{constructor(t){
|
|
77
|
+
super("Invalid request parameters",void 0,"Http.PathParameters",t)}},G=class extends le.IncorrectTypeError{constructor(r,n){
|
|
78
|
+
super("Incorrect request parameters",r,"Http.PathParameters",n);this.parametersType=
|
|
79
|
+
r}};var Ie=(e,t,r,n)=>{if(!(0,ae.isTypeReference)(e))return cr(e,t,r,n);let o=(0,me.getReferenceType)(
|
|
80
|
+
e,r);return o?cr(o,t,r,n):null},cr=(e,t,r,n)=>(0,ae.isTypeObject)(e)?lr(e,r):(0,me.isModelDeclaration)(
|
|
81
|
+
e)?Ne(e)?lr(e,r):(n.push(new G(e.name,e.file)),null):(n.push(new J(t.file)),null),
|
|
82
|
+
lr=(e,t)=>{let r=(0,ue.getObjectSchema)(e,t);return r&&(0,ue.isObjectSchema)(r)?
|
|
83
|
+
r:null};var de=require("@ez4/common/library"),ye=require("@ez4/schema/library"),Te=require("@ez4/reflection");var fe=require("@ez4/common/library"),Y=class extends fe.InvalidTypeError{constructor(t){
|
|
84
|
+
super("Invalid request query strings",void 0,"Http.QueryStrings",t)}},K=class extends fe.IncorrectTypeError{constructor(r,n){
|
|
85
|
+
super("Incorrect request query strings",r,"Http.QueryStrings",n);this.queryType=
|
|
86
|
+
r}};var ve=(e,t,r,n)=>{if(!(0,Te.isTypeReference)(e))return mr(e,t,r,n);let o=(0,de.getReferenceType)(
|
|
87
|
+
e,r);return o?mr(o,t,r,n):null},mr=(e,t,r,n)=>(0,Te.isTypeObject)(e)?ur(e,r):(0,de.isModelDeclaration)(
|
|
88
|
+
e)?Fe(e)?ur(e,r):(n.push(new K(e.name,t.file)),null):(n.push(new Y(t.file)),null),
|
|
89
|
+
ur=(e,t)=>{let r=(0,ye.getObjectSchema)(e,t);return r&&(0,ye.isObjectSchema)(r)?
|
|
90
|
+
r:null};var Re=(e,t,r,n)=>dr(e,t,r,n,"Http.AuthRequest"),Ee=(e,t,r,n)=>dr(e,t,r,n,"Http.\
|
|
91
|
+
Request"),dr=(e,t,r,n,o)=>{if(!(0,A.isTypeReference)(e))return ar(e,t,r,n,o);let s=(0,y.getReferenceType)(
|
|
92
|
+
e,r);return s?ar(s,t,r,n,o):null},ar=(e,t,r,n,o)=>(0,A.isTypeObject)(e)?fr(e,t,(0,y.getObjectMembers)(
|
|
93
|
+
e),r,n):(0,y.isModelDeclaration)(e)?(0,y.hasHeritageType)(e,o)?fr(e,t,(0,y.getModelMembers)(
|
|
94
|
+
e),r,n):(n.push(new Q(e.name,o,e.file)),null):(n.push(new N(o,t.file)),null),fr=(e,t,r,n,o)=>{
|
|
95
|
+
let s={};for(let p of r)if(!(!(0,A.isModelProperty)(p)||p.inherited))switch(p.name){default:
|
|
96
|
+
o.push(new y.InvalidServicePropertyError(t.name,p.name,e.file));break;case"heade\
|
|
97
|
+
rs":{s.headers=F(p.value,e,n,o),s.headers&&p.description&&(s.headers.description=
|
|
98
|
+
p.description);break}case"identity":{s.identity=S(p.value,e,n,o),s.identity&&p.description&&
|
|
99
|
+
(s.identity.description=p.description);break}case"query":{s.query=ve(p.value,e,n,
|
|
100
|
+
o),s.query&&p.description&&(s.query.description=p.description);break}case"parame\
|
|
101
|
+
ters":{s.parameters=Ie(p.value,e,n,o),s.parameters&&p.description&&(s.parameters.
|
|
102
|
+
description=p.description);break}case"body":{s.body=Me(p.value,e,n,o),s.body&&p.
|
|
103
|
+
description&&(s.body.description=p.description);break}}return s};var je=(e,t,r,n)=>{if(!Ge(e))return null;let o={},s=new Set(["name","file"]);if(e.
|
|
104
|
+
description&&(o.description=e.description),(o.name=e.name)&&s.delete("name"),(o.
|
|
105
|
+
file=e.file)&&s.delete("file"),e.parameters){let[{value:p}]=e.parameters;o.request=
|
|
106
|
+
Re(p,t,r,n)}return e.return&&(o.response=xe(e.return,t,r,n)),Dr(o)?o:(n.push(new w(
|
|
107
|
+
[...s],e.file)),null)},Dr=e=>!!e.name&&!!e.file;var yr=require("@ez4/common/library"),W=class extends yr.IncompleteTypeError{constructor(t,r){
|
|
108
|
+
super("Incomplete route handler",t,r)}};var Oe=(e,t,r,n)=>{if(!Ye(e))return null;let o={},s=new Set(["name","file","resp\
|
|
109
|
+
onse"]);if(e.description&&(o.description=e.description),(o.name=e.name)&&s.delete(
|
|
110
|
+
"name"),(o.file=e.file)&&s.delete("file"),e.parameters){let[{value:p}]=e.parameters;
|
|
111
|
+
o.request=Ee(p,t,r,n)}if(e.return){let p=Ae(e.return,t,r,n);p&&(o.response=p,s.delete(
|
|
112
|
+
"response"))}return Br(o)?o:(n.push(new W([...s],e.file)),null)},Br=e=>!!e.name&&
|
|
113
|
+
!!e.file&&!!e.response;var Pe=(e,t,r,n)=>{if(!(0,I.isTypeReference)(e))return Tr(e,t,r,n);let o=(0,c.getReferenceType)(
|
|
114
|
+
e,r);return o?Tr(o,t,r,n):null},Ur=e=>!!e.path&&!!e.handler,Tr=(e,t,r,n)=>De(e)?
|
|
115
|
+
gr(e,t,(0,c.getModelMembers)(e),r,n):(0,I.isTypeObject)(e)?gr(e,t,(0,c.getObjectMembers)(
|
|
116
|
+
e),r,n):null,gr=(e,t,r,n,o)=>{let s={},p=new Set(["path","handler"]);for(let i of r)
|
|
117
|
+
if(!(!(0,I.isModelProperty)(i)||i.inherited))switch(i.name){default:o.push(new c.InvalidServicePropertyError(
|
|
118
|
+
t.name,i.name,e.file));break;case"path":{let u=(0,c.getPropertyString)(i);u&&qe(
|
|
119
|
+
u)&&(p.delete(i.name),s.path=u);break}case"handler":(s.handler=Oe(i.value,t,n,o))&&
|
|
120
|
+
p.delete(i.name);break;case"timeout":case"memory":s[i.name]=(0,c.getPropertyNumber)(
|
|
121
|
+
i);break;case"cors":s.cors=(0,c.getPropertyBoolean)(i);break;case"authorizer":s.
|
|
122
|
+
authorizer=je(i.value,t,n,o);break;case"listener":s.listener=(0,c.getServiceListener)(
|
|
123
|
+
i.value,o);break;case"variables":s.variables=(0,c.getLinkedVariableList)(i,o);break}
|
|
124
|
+
return Ur(s)?s:(o.push(new P([...p],e.file)),null)};var l=require("@ez4/common/library"),R=require("@ez4/reflection");var v=require("@ez4/common/library"),X=class extends v.IncompleteTypeError{constructor(t,r){
|
|
125
|
+
super("Incomplete HTTP CORS",t,r)}},Z=class extends v.InvalidTypeError{constructor(t){
|
|
126
|
+
super("Invalid HTTP CORS type",void 0,"Http.Cors",t)}},_=class extends v.IncorrectTypeError{constructor(r,n){
|
|
127
|
+
super("Incorrect HTTP CORS type",r,"Http.Cors",n);this.fallbackType=r}};var we=(e,t,r,n)=>{if(!(0,R.isTypeReference)(e))return Hr(e,t,n);let o=(0,l.getReferenceType)(
|
|
128
|
+
e,r);return o?Hr(o,t,n):null},Vr=e=>!!e.allowOrigins?.length,Hr=(e,t,r)=>(0,R.isTypeObject)(
|
|
129
|
+
e)?Mr(e,t,(0,l.getObjectMembers)(e),r):(0,l.isModelDeclaration)(e)?Je(e)?Mr(e,t,
|
|
130
|
+
(0,l.getModelMembers)(e),r):(r.push(new _(e.name,e.file)),null):(r.push(new Z(t.
|
|
131
|
+
file)),null),Mr=(e,t,r,n)=>{let o={},s=new Set(["allowOrigins"]);for(let p of r)
|
|
132
|
+
if(!(!(0,R.isModelProperty)(p)||p.inherited))switch(p.name){default:n.push(new l.InvalidServicePropertyError(
|
|
133
|
+
t.name,p.name,e.file));break;case"allowOrigins":case"allowMethods":case"allowHea\
|
|
134
|
+
ders":case"exposeHeaders":o[p.name]=Fr(p);break;case"allowCredentials":o.allowCredentials=
|
|
135
|
+
(0,l.getPropertyBoolean)(p);break;case"maxAge":o.maxAge=(0,l.getPropertyNumber)(
|
|
136
|
+
p);break}return Vr(o)?o:(n.push(new X([...s],e.file)),null)},Fr=e=>{let t=(0,l.getPropertyTuple)(
|
|
137
|
+
e)??[],r=[];for(let n of t){let o=(0,l.getLiteralString)(n);o&&r.push(o)}return r};var ze=e=>{let t={},r=[];for(let n in e){let o=e[n];if(!Ce(o)||(0,m.isExternalStatement)(
|
|
138
|
+
o))continue;let s={type:$,extras:{}},p=new Set(["routes"]),i=o.file;s.name=o.name,
|
|
139
|
+
o.description&&(s.description=o.description);for(let u of(0,m.getModelMembers)(o))
|
|
140
|
+
if(!(!(0,br.isModelProperty)(u)||u.inherited))switch(u.name){default:r.push(new m.InvalidServicePropertyError(
|
|
141
|
+
s.name,u.name,i));break;case"routes":(s.routes=Qr(o,u,e,r))&&p.delete(u.name);break;case"\
|
|
142
|
+
name":s.displayName=(0,m.getPropertyString)(u);break;case"defaults":s.defaults=Xe(
|
|
143
|
+
u.value,o,e,r);break;case"cors":s.cors=we(u.value,o,e,r);break;case"variables":s.
|
|
144
|
+
variables=(0,m.getLinkedVariableList)(u,r);break;case"services":s.services=(0,m.getLinkedServiceList)(
|
|
145
|
+
u,e,r);break}if(!Nr(s)){r.push(new E([...p],i));continue}if(t[o.name]){r.push(new m.DuplicateServiceError(
|
|
146
|
+
o.name,i));continue}t[o.name]=s}return{services:t,errors:r}},Nr=e=>!!e.name&&!!e.
|
|
147
|
+
routes&&!!e.extras,Qr=(e,t,r,n)=>{let o=(0,m.getPropertyTuple)(t)??[],s=[];for(let p of o){
|
|
148
|
+
let i=Pe(p,e,r,n);i&&s.push(i)}return s};var hr=!1,Jr=()=>{hr||((0,Sr.registerTriggers)(),(0,xr.registerTriggers)(),(0,Ar.createTrigger)(
|
|
149
|
+
"@ez4/gateway",{"metadata:getServices":ze}),hr=!1)};var ge=require("@ez4/common/library"),j=class extends ge.InvalidTypeError{constructor(t){
|
|
150
|
+
super("Invalid defaults",void 0,"Http.Defaults",t)}},O=class extends ge.IncorrectTypeError{constructor(r,n){
|
|
151
|
+
super("Incorrect defaults",r,"Http.Defaults",n);this.defaultsType=r}};0&&(module.exports={IncompleteAuthorizerError,IncompleteCorsError,IncompleteHandlerError,
|
|
150
152
|
IncompleteRouteError,IncompleteServiceError,IncorrectBodyTypeError,IncorrectCorsTypeError,
|
|
151
153
|
IncorrectDefaultsTypeError,IncorrectHeadersTypeError,IncorrectIdentityTypeError,
|
|
152
154
|
IncorrectParameterTypeError,IncorrectQueryTypeError,IncorrectRequestTypeError,IncorrectResponseTypeError,
|