@ez4/gateway 0.34.0 → 0.35.1
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 -27
- package/dist/services/common.d.ts +23 -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.cjs
CHANGED
|
@@ -1,293 +1,314 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
typeof t=="object"||typeof t=="function")for(let n of
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
super("
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
e
|
|
26
|
-
|
|
27
|
-
e,"Http.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
e
|
|
35
|
-
|
|
36
|
-
e,
|
|
37
|
-
e)
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
e.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
e,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
e,
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
e.
|
|
59
|
-
|
|
1
|
+
"use strict";var De=Object.defineProperty;var qt=Object.getOwnPropertyDescriptor;var Dt=Object.getOwnPropertyNames;var Ft=Object.prototype.hasOwnProperty;var p=(e,t)=>De(e,"name",{value:t,configurable:!0});var Nt=(e,t)=>{for(var r in t)De(e,r,{get:t[r],enumerable:!0})},Bt=(e,t,r,o)=>{if(t&&
|
|
2
|
+
typeof t=="object"||typeof t=="function")for(let n of Dt(t))!Ft.call(e,n)&&n!==r&&
|
|
3
|
+
De(e,n,{get:()=>t[n],enumerable:!(o=qt(t,n))||o.enumerable});return e};var Ut=e=>Bt(De({},"__esModule",{value:!0}),e);var yo={};Nt(yo,{ImportType:()=>k,IncompleteAccessError:()=>xe,IncompleteAuthorizationError:()=>ke,
|
|
4
|
+
IncompleteAuthorizerError:()=>ie,IncompleteCacheError:()=>Pe,IncompleteCorsError:()=>we,
|
|
5
|
+
IncompleteHandlerError:()=>Se,IncompleteProviderError:()=>ve,IncompleteRouteError:()=>pe,
|
|
6
|
+
IncompleteServiceError:()=>O,IncorrectAccessTypeError:()=>Ee,IncorrectAuthorizationTypeError:()=>qe,
|
|
7
|
+
IncorrectBodyTypeError:()=>ye,IncorrectCacheTypeError:()=>ze,IncorrectCorsTypeError:()=>je,
|
|
8
|
+
IncorrectDefaultsTypeError:()=>ne,IncorrectHeadersTypeError:()=>de,IncorrectIdentityTypeError:()=>ae,
|
|
9
|
+
IncorrectParameterTypeError:()=>Me,IncorrectPreferencesTypeError:()=>te,IncorrectQueryTypeError:()=>He,
|
|
10
|
+
IncorrectRequestTypeError:()=>ge,IncorrectResponseTypeError:()=>ce,InvalidAccessTypeError:()=>Ae,
|
|
11
|
+
InvalidAuthorizationTypeError:()=>Ce,InvalidBodyTypeError:()=>fe,InvalidCacheTypeError:()=>Re,
|
|
12
|
+
InvalidCorsTypeError:()=>Oe,InvalidDefaultsTypeError:()=>oe,InvalidHeadersTypeError:()=>le,
|
|
13
|
+
InvalidIdentityTypeError:()=>me,InvalidParameterTypeError:()=>he,InvalidPreferencesTypeError:()=>re,
|
|
14
|
+
InvalidProviderTypeError:()=>Ie,InvalidQueryTypeError:()=>be,InvalidRequestTypeError:()=>Te,
|
|
15
|
+
InvalidResponseTypeError:()=>se,InvalidRouteErrorTypeError:()=>N,ServiceCollisionError:()=>ee,
|
|
16
|
+
ServiceType:()=>C,getClientAuthorization:()=>uo,getClientOperations:()=>lo,getHttpImports:()=>Hr,
|
|
17
|
+
getHttpServices:()=>Mr,isHttpImport:()=>ur,isHttpService:()=>Vt,registerTriggers:()=>ao});
|
|
18
|
+
module.exports=Ut(yo);var jt=require("@ez4/common/library"),kt=require("@ez4/schema/library"),Sr=require("@ez4/project/library");var k="@ez4/import:http",ur=p(e=>e.type===k,"isHttpImport");var C="@ez4/http",Vt=p(e=>e.type===C,"isHttpService");var g=require("@ez4/common/library"),Et=require("@ez4/reflection");var Fe=require("@ez4/common/library");var O=class extends Fe.IncompleteTypeError{static{p(this,"IncompleteServiceError")}constructor(t,r){
|
|
19
|
+
super("Incomplete service",t,r)}},ee=class extends Fe.TypeCollisionError{static{
|
|
20
|
+
p(this,"ServiceCollisionError")}constructor(t,r){super("Service error",t,r)}};var T=require("@ez4/common/library"),B=require("@ez4/reflection");var b=require("@ez4/common/library"),F=require("@ez4/reflection"),D=require("@ez4/schema");var Ne=require("@ez4/common/library");var re=class extends Ne.InvalidTypeError{static{p(this,"InvalidPreferencesTypeEr\
|
|
21
|
+
ror")}constructor(t){super("Invalid preferences",void 0,"Http.Preferences",t)}},
|
|
22
|
+
te=class extends Ne.IncorrectTypeError{constructor(r,o){super("Incorrect prefere\
|
|
23
|
+
nces",r,"Http.Preferences",o);this.preferencesType=r}static{p(this,"IncorrectPre\
|
|
24
|
+
ferencesTypeError")}};var u=require("@ez4/common/library"),q=require("@ez4/reflection");var Qt=new Set(["ANY","GET","POST","PUT","PATCH","DELETE","OPTIONS"]),vr=p(e=>{let[
|
|
25
|
+
t]=e.split(" ",2);return Qt.has(t)},"isHttpPath"),Be=p(e=>(0,u.isClassDeclaration)(
|
|
26
|
+
e)&&(0,u.hasHeritageType)(e,"Http.Service"),"isHttpService"),Ue=p(e=>(0,u.isClassDeclaration)(
|
|
27
|
+
e)&&(0,u.hasHeritageType)(e,"Http.Import"),"isHttpImport");var xr=p(e=>(0,u.isModelDeclaration)(e)&&(0,u.hasHeritageType)(e,"Http.Route"),"\
|
|
28
|
+
isHttpRoute");var Ar=p(e=>(0,u.hasHeritageType)(e,"Http.Defaults"),"isHttpDefaults"),Er=p(e=>(0,u.hasHeritageType)(
|
|
29
|
+
e,"Http.Authorization"),"isHttpAuthorization"),Pr=p(e=>(0,u.hasHeritageType)(e,"\
|
|
30
|
+
Http.Preferences"),"isHttpPreferences"),Rr=p(e=>(0,u.hasHeritageType)(e,"Http.He\
|
|
31
|
+
aders"),"isHttpHeaders"),zr=p(e=>(0,u.hasHeritageType)(e,"Http.Identity"),"isHtt\
|
|
32
|
+
pIdentity"),wr=p(e=>(0,u.hasHeritageType)(e,"Http.QueryStrings"),"isHttpQuery"),
|
|
33
|
+
Or=p(e=>(0,u.hasHeritageType)(e,"Http.PathParameters"),"isHttpParameters"),jr=p(
|
|
34
|
+
e=>(0,u.hasHeritageType)(e,"Http.JsonBody"),"isJsonBody"),kr=p(e=>(0,u.hasHeritageType)(
|
|
35
|
+
e,"Http.Cache"),"isHttpCache"),Cr=p(e=>(0,u.hasHeritageType)(e,"Http.Access"),"i\
|
|
36
|
+
sHttpAccess"),qr=p(e=>(0,u.hasHeritageType)(e,"Http.Cors"),"isHttpCors"),Dr=p(e=>(0,q.isTypeCallback)(
|
|
37
|
+
e)||(0,q.isTypeFunction)(e),"isHttpAuthorizer"),Fr=p(e=>(0,q.isTypeCallback)(e)||
|
|
38
|
+
(0,q.isTypeFunction)(e),"isHttpHandler");var Ve=p((e,t,r,o)=>{if(!(0,F.isTypeReference)(e))return Nr(e,t,o);let n=(0,b.getReferenceType)(
|
|
39
|
+
e,r);if(n)return Nr(n,t,o)},"getHttpPreferences"),Nr=p((e,t,r)=>{if((0,F.isTypeObject)(
|
|
40
|
+
e))return Br(t,(0,b.getObjectMembers)(e),r);if(!(0,b.isModelDeclaration)(e)){r.push(
|
|
41
|
+
new re(t.file));return}if(!Pr(e)){r.push(new te(e.name,t.file));return}return Br(
|
|
42
|
+
t,(0,b.getModelMembers)(e),r)},"getTypePreferences"),Br=p((e,t,r)=>{let o={};for(let n of t)
|
|
43
|
+
if((0,F.isModelProperty)(n))switch(n.name){default:r.push(new b.InvalidServicePropertyError(
|
|
44
|
+
e.name,n.name,e.file));break;case"namingStyle":o.namingStyle=(0,b.getPropertyStringIn)(
|
|
45
|
+
n,[D.NamingStyle.Preserve,D.NamingStyle.CamelCase,D.NamingStyle.PascalCase,D.NamingStyle.
|
|
46
|
+
SnakeCase,D.NamingStyle.KebabCase]);break}return o},"getTypeFromMembers");var P=require("@ez4/common/library"),Qe=require("@ez4/utils"),R=require("@ez4/reflection");var Je=p((e,t,r,o)=>{if(!(0,R.isTypeReference)(e))return Ur(e,t,r,o);let n=(0,P.getReferenceType)(
|
|
47
|
+
e,r);if(n)return Ur(n,t,r,o)},"getHttpErrors"),Ur=p((e,t,r,o)=>{if((0,R.isTypeObject)(
|
|
48
|
+
e))return Jt(e,t,(0,P.getObjectMembers)(e),r,o)},"getTypeErrors"),Jt=p((e,t,r,o,n)=>{
|
|
49
|
+
let s={};for(let i of r){if(!(0,R.isModelProperty)(i)||i.inherited)continue;let m=parseInt(
|
|
50
|
+
i.name,10);(0,Qe.isAnyNumber)(m)||n.push(new P.InvalidServicePropertyError(t.name,
|
|
51
|
+
i.name,e.file));let c=Gt(i,m,t,o,n);c&&Object.assign(s,c)}if(!(0,Qe.isEmptyObject)(
|
|
52
|
+
s))return s},"getTypeFromMembers"),Gt=p((e,t,r,o,n)=>{let s=(0,P.getPropertyTuple)(
|
|
53
|
+
e)??[],i={};for(let m of s){if(!(0,R.isTypeReference)(m)){n.push(new N(r.file));
|
|
54
|
+
continue}let c=(0,P.getReferenceType)(m,o);if(!c||!(0,R.isTypeClass)(c)){n.push(
|
|
55
|
+
new N(r.file));continue}i[c.name]=t}return i},"getErrorClasses");var Ge=p((e,t,r,o)=>{if(!(0,B.isTypeReference)(e))return Vr(e,t,r,o);let n=(0,T.tryGetReferenceType)(
|
|
56
|
+
e,r);if(n)return Vr(n,t,r,o)},"getHttpDefaults"),Vr=p((e,t,r,o)=>{if((0,B.isTypeObject)(
|
|
57
|
+
e))return Qr(t,(0,T.getObjectMembers)(e),r,o);if(!(0,T.isModelDeclaration)(e)){o.
|
|
58
|
+
push(new oe(t.file));return}if(!Ar(e)){o.push(new ne(e.name,t.file));return}return Qr(
|
|
59
|
+
t,(0,T.getModelMembers)(e),r,o)},"getTypeDefaults"),Qr=p((e,t,r,o)=>{let n={};for(let s of t)
|
|
60
|
+
if(!(!(0,B.isModelProperty)(s)||s.inherited))switch(s.name){default:o.push(new T.InvalidServicePropertyError(
|
|
61
|
+
e.name,s.name,e.file));break;case"httpErrors":n.httpErrors=Je(s.value,e,r,o);break;case"\
|
|
62
|
+
preferences":n.preferences=Ve(s.value,e,r,o);break;case"memory":case"logRetentio\
|
|
60
63
|
n":case"timeout":n[s.name]=(0,T.getPropertyNumber)(s);break;case"listener":n.listener=
|
|
61
|
-
(0,T.getServiceListener)(s.value,o);break}return n},"getTypeFromMembers");var
|
|
62
|
-
super("Incomplete gateway route",t,r)}},
|
|
63
|
-
"InvalidRouteErrorTypeError")}constructor(t){super("Invalid route error type.",t)}};var
|
|
64
|
-
rror")}constructor(t,r){super("Incomplete route authorizer",t,r)}};var l=require("@ez4/common/library"),
|
|
64
|
+
(0,T.getServiceListener)(s.value,o);break}return n},"getTypeFromMembers");var E=require("@ez4/reflection"),a=require("@ez4/common/library");var $e=require("@ez4/common/library");var pe=class extends $e.IncompleteTypeError{static{p(this,"IncompleteRouteError")}constructor(t,r){
|
|
65
|
+
super("Incomplete gateway route",t,r)}},N=class extends $e.TypeError{static{p(this,
|
|
66
|
+
"InvalidRouteErrorTypeError")}constructor(t){super("Invalid route error type.",t)}};var Jr=require("@ez4/common/library");var ie=class extends Jr.IncompleteTypeError{static{p(this,"IncompleteAuthorizerE\
|
|
67
|
+
rror")}constructor(t,r){super("Incomplete route authorizer",t,r)}};var l=require("@ez4/common/library"),Q=require("@ez4/reflection"),Xr=require("@ez4/utils");var Ke=require("@ez4/common/library");var se=class extends Ke.InvalidTypeError{constructor(r,o){super("Invalid route r\
|
|
65
68
|
esponse",void 0,r,o);this.baseType=r}static{p(this,"InvalidResponseTypeError")}},
|
|
66
|
-
|
|
69
|
+
ce=class extends Ke.IncorrectTypeError{constructor(r,o,n){super("Incorrect route\
|
|
67
70
|
response",r,o,n);this.responseType=r;this.baseType=o}static{p(this,"IncorrectRe\
|
|
68
|
-
sponseTypeError")}};var
|
|
69
|
-
super("Invalid identity",void 0,"Http.Identity",t)}},
|
|
71
|
+
sponseTypeError")}};var We=require("@ez4/common/library"),x=require("@ez4/reflection"),$r=require("@ez4/schema/library");var Ye=require("@ez4/common/library");var me=class extends Ye.InvalidTypeError{static{p(this,"InvalidIdentityTypeError")}constructor(t){
|
|
72
|
+
super("Invalid identity",void 0,"Http.Identity",t)}},ae=class extends Ye.IncorrectTypeError{constructor(r,o){
|
|
70
73
|
super("Incorrect identity",r,"Http.Identity",o);this.identityType=r}static{p(this,
|
|
71
|
-
"IncorrectIdentityTypeError")}};var
|
|
72
|
-
return r},"
|
|
73
|
-
e))return
|
|
74
|
-
|
|
75
|
-
t,r,o)
|
|
76
|
-
e))
|
|
74
|
+
"IncorrectIdentityTypeError")}};var j=require("@ez4/schema/library");var v=p((e,t)=>{let r=(0,j.getIntersectionSchema)(e,t);if(r&&(0,j.isObjectSchema)(
|
|
75
|
+
r))return r},"getSchemaFromIntersection"),f=p((e,t)=>{let r=(0,j.getObjectSchema)(
|
|
76
|
+
e,t);if(r&&(0,j.isObjectSchema)(r))return r},"getSchemaFromObject");var ue=p((e,t,r,o)=>{if((0,x.isTypeUndefined)(e))return;if(!(0,x.isTypeReference)(
|
|
77
|
+
e))return Gr(e,t,r,o);let n=(0,We.getReferenceType)(e,r);if(n)return Gr(n,t,r,o)},
|
|
78
|
+
"getHttpIdentity"),Gr=p((e,t,r,o)=>{if((0,x.isTypeObject)(e))return f(e,r);if((0,x.isTypeUnion)(
|
|
79
|
+
e))return $t(e.elements,t,r,o);if((0,x.isTypeIntersection)(e))return v(e,r);if(!(0,We.isModelDeclaration)(
|
|
80
|
+
e)){o.push(new me(t.file));return}if(!zr(e)){o.push(new ae(e.name,t.file));return}
|
|
77
81
|
let n=f(e,r);return n&&(n.definitions={...n.definitions,extensible:!0}),n},"getT\
|
|
78
|
-
ypeIdentity")
|
|
79
|
-
i)}return n.length>1?(0
|
|
80
|
-
omUnion");var
|
|
81
|
-
super("Invalid headers",void 0,"Http.Headers",t)}},
|
|
82
|
+
ypeIdentity"),$t=p((e,t,r,o)=>{let n=[];for(let s of e){let i=ue(s,t,r,o);i&&n.push(
|
|
83
|
+
i)}return n.length>1?(0,$r.createUnionSchema)({elements:n}):n[0]},"getIdentityFr\
|
|
84
|
+
omUnion");var U=require("@ez4/reflection"),Ze=require("@ez4/common/library");var Xe=require("@ez4/common/library");var le=class extends Xe.InvalidTypeError{static{p(this,"InvalidHeadersTypeError")}constructor(t){
|
|
85
|
+
super("Invalid headers",void 0,"Http.Headers",t)}},de=class extends Xe.IncorrectTypeError{constructor(r,o){
|
|
82
86
|
super("Incorrect headers",r,"Http.Headers",o);this.headersType=r}static{p(this,"\
|
|
83
|
-
IncorrectHeadersTypeError")}};var
|
|
84
|
-
e,r);if(n)return
|
|
85
|
-
e)
|
|
86
|
-
o.push(new
|
|
87
|
-
e,r)},"getTypeHeaders");var
|
|
88
|
-
super("Invalid body",void 0,"Http.JsonBody",t)}},
|
|
87
|
+
IncorrectHeadersTypeError")}};var _e=p((e,t,r,o)=>{if(!(0,U.isTypeReference)(e))return Kr(e,t,r,o);let n=(0,Ze.getReferenceType)(
|
|
88
|
+
e,r);if(n)return Kr(n,t,r,o)},"getHttpHeaders"),Kr=p((e,t,r,o)=>{if((0,U.isTypeObject)(
|
|
89
|
+
e))return f(e,r);if((0,U.isTypeIntersection)(e))return v(e,r);if(!(0,Ze.isModelDeclaration)(
|
|
90
|
+
e)){o.push(new le(t.file));return}if(!Rr(e)){o.push(new de(e.name,t.file));return}
|
|
91
|
+
return f(e,r)},"getTypeHeaders");var V=require("@ez4/schema/library"),er=require("@ez4/common/library"),y=require("@ez4/reflection");var Le=require("@ez4/common/library");var fe=class extends Le.InvalidTypeError{static{p(this,"InvalidBodyTypeError")}constructor(t){
|
|
92
|
+
super("Invalid body",void 0,"Http.JsonBody",t)}},ye=class extends Le.IncorrectTypeError{constructor(r,o){
|
|
89
93
|
super("Incorrect body",r,"Http.JsonBody",o);this.bodyType=r}static{p(this,"Incor\
|
|
90
|
-
rectBodyTypeError")}};var
|
|
91
|
-
if(!(0,y.isTypeUndefined)(e)){if(!(0,y.isTypeReference)(e))return r(e);let o=(0,
|
|
92
|
-
e,t);if(o)return r(o)}},"getTypeBody"),
|
|
93
|
-
e)},"getScalarTypeBody"),
|
|
94
|
-
r,n=>
|
|
95
|
-
|
|
96
|
-
if(!(0,
|
|
97
|
-
new
|
|
98
|
-
let o={optional:!1,elements:[]};for(let n of e){if((0,y.isTypeUndefined)(
|
|
99
|
-
|
|
100
|
-
o)},"getUnionTypeBody"),
|
|
101
|
-
{element:o})},"getArrayTypeBody");var
|
|
102
|
-
"getHttpAuthResponse"),
|
|
103
|
-
|
|
104
|
-
e))return
|
|
105
|
-
n)},"getHttpResponse"),
|
|
106
|
-
e.status)||Array.isArray(e.status),"isValidHandlerResponse"),
|
|
107
|
-
if((0,
|
|
108
|
-
e)){o.push(new
|
|
109
|
-
e.name,n,e.file));return}return
|
|
110
|
-
sponse"),
|
|
94
|
+
rectBodyTypeError")}};var rr=p((e,t,r,o)=>fr(e,r,n=>lr(n)??dr(n,t,r,o)),"getHttpBody"),fr=p((e,t,r)=>{
|
|
95
|
+
if(!(0,y.isTypeUndefined)(e)){if(!(0,y.isTypeReference)(e))return r(e);let o=(0,er.getReferenceType)(
|
|
96
|
+
e,t);if(o)return r(o)}},"getTypeBody"),lr=p(e=>{if((0,y.isTypeScalar)(e))return(0,V.getScalarSchema)(
|
|
97
|
+
e)},"getScalarTypeBody"),dr=p((e,t,r,o)=>{if((0,y.isTypeObject)(e))return f(e,r);
|
|
98
|
+
if((0,y.isTypeUnion)(e))return Kt(e.elements,r,n=>lr(n)??dr(n,t,r,o));if((0,y.isTypeIntersection)(
|
|
99
|
+
e))return v(e,r);if((0,y.isTypeArray)(e))return Yt(e.element,r,n=>lr(n)??dr(n,t,
|
|
100
|
+
r,o));if(!(0,er.isModelDeclaration)(e)){o.push(new fe(t.file));return}if(!jr(e)){
|
|
101
|
+
o.push(new ye(e.name,e.file));return}return f(e,r)},"getCompoundTypeBody"),Kt=p(
|
|
102
|
+
(e,t,r)=>{let o={optional:!1,elements:[]};for(let n of e){if((0,y.isTypeUndefined)(
|
|
103
|
+
n)){o.optional=!0;continue}let s=fr(n,t,r);s&&o.elements.push(s)}if(o.elements.length)
|
|
104
|
+
return(0,V.createUnionSchema)(o)},"getUnionTypeBody"),Yt=p((e,t,r)=>{let o=fr(e,
|
|
105
|
+
t,r);if(o)return(0,V.createArraySchema)({element:o})},"getArrayTypeBody");var Zr=p((e,t,r,o)=>{let n=Lr(e,t,r,o,"Http.AuthResponse");if(n&&Wt(n))return n},
|
|
106
|
+
"getHttpAuthResponse"),_r=p((e,t,r,o)=>{let n=Lr(e,t,r,o,"Http.Response");if(n&&
|
|
107
|
+
Xt(n))return n},"getHttpHandlerResponse"),Lr=p((e,t,r,o,n)=>{if(!(0,Q.isTypeReference)(
|
|
108
|
+
e))return Yr(e,t,r,o,n);let s=(0,l.getReferenceType)(e,r);if(s)return Yr(s,t,r,o,
|
|
109
|
+
n)},"getHttpResponse"),Wt=p(e=>!!e.identity,"isValidAuthResponse"),Xt=p(e=>(0,Xr.isAnyNumber)(
|
|
110
|
+
e.status)||Array.isArray(e.status),"isValidHandlerResponse"),Yr=p((e,t,r,o,n)=>{
|
|
111
|
+
if((0,Q.isTypeObject)(e))return Wr(e,t,(0,l.getObjectMembers)(e),r,o);if(!(0,l.isModelDeclaration)(
|
|
112
|
+
e)){o.push(new se(n,t.file));return}if(!(0,l.hasHeritageType)(e,n)){o.push(new ce(
|
|
113
|
+
e.name,n,e.file));return}return Wr(e,t,(0,l.getModelMembers)(e),r,o)},"getTypeRe\
|
|
114
|
+
sponse"),Wr=p((e,t,r,o,n)=>{let s={};for(let i of r)if(!(!(0,Q.isModelProperty)(
|
|
111
115
|
i)||i.inherited))switch(i.name){default:n.push(new l.InvalidServicePropertyError(
|
|
112
116
|
t.name,i.name,e.file));break;case"status":s.status=(0,l.getPropertyNumber)(i)??(0,l.getPropertyNumberList)(
|
|
113
|
-
i);break;case"headers":{s.headers=
|
|
114
|
-
headers.description=i.description);break}case"identity":{s.identity=
|
|
117
|
+
i);break;case"headers":{s.headers=_e(i.value,e,o,n),s.headers&&i.description&&(s.
|
|
118
|
+
headers.description=i.description);break}case"identity":{s.identity=ue(i.value,e,
|
|
115
119
|
o,n),s.identity&&i.description&&(s.identity.description=i.description);break}case"\
|
|
116
|
-
body":{s.body=
|
|
117
|
-
break}}return s},"getTypeFromMembers");var
|
|
118
|
-
equest",void 0,r,o);this.baseType=r}static{p(this,"InvalidRequestTypeError")}},
|
|
120
|
+
body":{s.body=rr(i.value,e,o,n),s.body&&i.description&&(s.body.description=i.description);
|
|
121
|
+
break}}return s},"getTypeFromMembers");var w=require("@ez4/reflection"),H=require("@ez4/common/library");var tr=require("@ez4/common/library");var Te=class extends tr.InvalidTypeError{constructor(r,o){super("Invalid route r\
|
|
122
|
+
equest",void 0,r,o);this.baseType=r}static{p(this,"InvalidRequestTypeError")}},ge=class extends tr.IncorrectTypeError{constructor(r,o,n){
|
|
119
123
|
super("Incorrect route request",r,o,n);this.requestType=r;this.baseType=o}static{
|
|
120
|
-
p(this,"IncorrectRequestTypeError")}};var
|
|
124
|
+
p(this,"IncorrectRequestTypeError")}};var J=require("@ez4/reflection"),nr=require("@ez4/common/library");var or=require("@ez4/common/library");var he=class extends or.InvalidTypeError{static{p(this,"InvalidParameterTypeErro\
|
|
121
125
|
r")}constructor(t){super("Invalid request parameters",void 0,"Http.PathParameter\
|
|
122
|
-
s",t)}},
|
|
126
|
+
s",t)}},Me=class extends or.IncorrectTypeError{constructor(r,o){super("Incorrect\
|
|
123
127
|
request parameters",r,"Http.PathParameters",o);this.parametersType=r}static{p(this,
|
|
124
|
-
"IncorrectParameterTypeError")}};var
|
|
125
|
-
e,r);if(n)return
|
|
126
|
-
e)
|
|
127
|
-
o.push(new
|
|
128
|
-
e,r)},"getTypeParameter");var
|
|
129
|
-
super("Invalid request query strings",void 0,"Http.QueryStrings",t)}},
|
|
128
|
+
"IncorrectParameterTypeError")}};var rt=p((e,t,r,o)=>{if(!(0,J.isTypeReference)(e))return et(e,t,r,o);let n=(0,nr.getReferenceType)(
|
|
129
|
+
e,r);if(n)return et(n,t,r,o)},"getHttpParameters"),et=p((e,t,r,o)=>{if((0,J.isTypeObject)(
|
|
130
|
+
e))return f(e,r);if((0,J.isTypeIntersection)(e))return v(e,r);if(!(0,nr.isModelDeclaration)(
|
|
131
|
+
e)){o.push(new he(t.file));return}if(!Or(e)){o.push(new Me(e.name,e.file));return}
|
|
132
|
+
return f(e,r)},"getTypeParameter");var G=require("@ez4/reflection"),ir=require("@ez4/common/library");var pr=require("@ez4/common/library");var be=class extends pr.InvalidTypeError{static{p(this,"InvalidQueryTypeError")}constructor(t){
|
|
133
|
+
super("Invalid request query strings",void 0,"Http.QueryStrings",t)}},He=class extends pr.IncorrectTypeError{constructor(r,o){
|
|
130
134
|
super("Incorrect request query strings",r,"Http.QueryStrings",o);this.queryType=
|
|
131
|
-
r}static{p(this,"IncorrectQueryTypeError")}};var
|
|
132
|
-
e,r);if(n)return
|
|
133
|
-
e)
|
|
134
|
-
o.push(new
|
|
135
|
-
e,r)},"getTypeQuery");var
|
|
136
|
-
e,t,r,o,"Http.Request"),"getHttpHandlerRequest"),
|
|
137
|
-
e)&&e.elements.length>0)return
|
|
138
|
-
e))return
|
|
139
|
-
n)},"getHttpRequest"),
|
|
140
|
-
(0,
|
|
141
|
-
t.file));return}if(!(0,
|
|
142
|
-
return}return
|
|
143
|
-
let s={};for(let i of r)if(!(!(0,
|
|
144
|
-
n.push(new
|
|
145
|
-
rs":{s.headers=
|
|
146
|
-
i.description);break}case"identity":{s.identity=
|
|
147
|
-
(s.identity.description=i.description);break}case"query":{s.query=
|
|
148
|
-
n),s.query&&i.description&&(s.query.description=i.description);break}case"
|
|
149
|
-
|
|
150
|
-
description=i.description);break}case"body":{s.body=
|
|
135
|
+
r}static{p(this,"IncorrectQueryTypeError")}};var ot=p((e,t,r,o)=>{if(!(0,G.isTypeReference)(e))return tt(e,t,r,o);let n=(0,ir.getReferenceType)(
|
|
136
|
+
e,r);if(n)return tt(n,t,r,o)},"getHttpQuery"),tt=p((e,t,r,o)=>{if((0,G.isTypeObject)(
|
|
137
|
+
e))return f(e,r);if((0,G.isTypeIntersection)(e))return v(e,r);if(!(0,ir.isModelDeclaration)(
|
|
138
|
+
e)){o.push(new be(t.file));return}if(!wr(e)){o.push(new He(e.name,t.file));return}
|
|
139
|
+
return f(e,r)},"getTypeQuery");var it=p((e,t,r,o)=>yr(e,t,r,o,"Http.AuthRequest"),"getHttpAuthRequest"),st=p((e,t,r,o)=>yr(
|
|
140
|
+
e,t,r,o,"Http.Request"),"getHttpHandlerRequest"),yr=p((e,t,r,o,n)=>{if((0,w.isTypeIntersection)(
|
|
141
|
+
e)&&e.elements.length>0)return yr(e.elements[0],t,r,o,n);if(!(0,w.isTypeReference)(
|
|
142
|
+
e))return nt(e,t,r,o,n);let s=(0,H.getReferenceType)(e,r);if(s)return nt(s,t,r,o,
|
|
143
|
+
n)},"getHttpRequest"),nt=p((e,t,r,o,n)=>{if((0,w.isTypeObject)(e))return pt(e,t,
|
|
144
|
+
(0,H.getObjectMembers)(e),r,o);if(!(0,H.isModelDeclaration)(e)){o.push(new Te(n,
|
|
145
|
+
t.file));return}if(!(0,H.hasHeritageType)(e,n)){o.push(new ge(e.name,n,e.file));
|
|
146
|
+
return}return pt(e,t,(0,H.getModelMembers)(e),r,o)},"getTypeRequest"),pt=p((e,t,r,o,n)=>{
|
|
147
|
+
let s={};for(let i of r)if(!(!(0,w.isModelProperty)(i)||i.inherited))switch(i.name){default:
|
|
148
|
+
n.push(new H.InvalidServicePropertyError(t.name,i.name,e.file));break;case"heade\
|
|
149
|
+
rs":{s.headers=_e(i.value,e,o,n),s.headers&&i.description&&(s.headers.description=
|
|
150
|
+
i.description);break}case"identity":{s.identity=ue(i.value,e,o,n),s.identity&&i.
|
|
151
|
+
description&&(s.identity.description=i.description);break}case"query":{s.query=ot(
|
|
152
|
+
i.value,e,o,n),s.query&&i.description&&(s.query.description=i.description);break}case"\
|
|
153
|
+
parameters":{s.parameters=rt(i.value,e,o,n),s.parameters&&i.description&&(s.parameters.
|
|
154
|
+
description=i.description);break}case"body":{s.body=rr(i.value,e,o,n),s.body&&i.
|
|
151
155
|
description&&(s.body.description=i.description);break}}return s},"getTypeFromMem\
|
|
152
|
-
bers");var
|
|
156
|
+
bers");var ct=p((e,t,r,o)=>{if(!Dr(e))return;let{description:n,module:s}=e,i={...n&&{description:n},
|
|
153
157
|
...s&&{module:s}},m=new Set(["name","file"]);if((i.name=e.name)&&m.delete("name"),
|
|
154
158
|
(i.file=e.file)&&m.delete("file"),e.parameters){let[{value:c}]=e.parameters;i.request=
|
|
155
|
-
|
|
156
|
-
[...m],e.file))},"getHttpAuthorizer"),
|
|
157
|
-
zer");var
|
|
158
|
-
r")}constructor(t,r){super("Incomplete route handler",t,r)}};var
|
|
159
|
+
it(c,t,r,o)}if(e.return&&(i.response=Zr(e.return,t,r,o)),Zt(i))return i;o.push(new ie(
|
|
160
|
+
[...m],e.file))},"getHttpAuthorizer"),Zt=p(e=>!!e.name&&!!e.file,"isValidAuthori\
|
|
161
|
+
zer");var mt=require("@ez4/common/library");var Se=class extends mt.IncompleteTypeError{static{p(this,"IncompleteHandlerErro\
|
|
162
|
+
r")}constructor(t,r){super("Incomplete route handler",t,r)}};var A=require("@ez4/common/library"),cr=require("@ez4/reflection");var sr=require("@ez4/common/library");var Ie=class extends sr.InvalidTypeError{constructor(r,o){super("Invalid route p\
|
|
159
163
|
rovider",void 0,r,o);this.baseType=r}static{p(this,"InvalidProviderTypeError")}},
|
|
160
|
-
|
|
161
|
-
super("Incomplete route provider",t,r)}};var
|
|
162
|
-
der");let n=(0,
|
|
163
|
-
"getHttpProvider"),
|
|
164
|
-
e)){o.push(new
|
|
165
|
-
getProviderType"),
|
|
166
|
-
if(!(!(0,
|
|
167
|
-
(0,
|
|
168
|
-
i,r,o))&&s.delete(i.name);break}}if(
|
|
169
|
-
"getTypeFromMembers");var
|
|
164
|
+
ve=class extends sr.IncompleteTypeError{static{p(this,"IncompleteProviderError")}constructor(t,r){
|
|
165
|
+
super("Incomplete route provider",t,r)}};var ut=p((e,t,r,o)=>{if(!(0,cr.isTypeReference)(e))return at(e,t,r,o,"Http.Provi\
|
|
166
|
+
der");let n=(0,A.getReferenceType)(e,r);if(n)return at(n,t,r,o,"Http.Provider")},
|
|
167
|
+
"getHttpProvider"),_t=p(e=>!!e.services,"isValidProvider"),at=p((e,t,r,o,n)=>{if(!(0,A.isModelDeclaration)(
|
|
168
|
+
e)){o.push(new Ie(n,t.file));return}return Lt(e,(0,A.getModelMembers)(e),r,o)},"\
|
|
169
|
+
getProviderType"),Lt=p((e,t,r,o)=>{let n={},s=new Set(["services"]);for(let i of t)
|
|
170
|
+
if(!(!(0,cr.isModelProperty)(i)||i.inherited))switch(i.name){case"variables":n.variables=
|
|
171
|
+
(0,A.getLinkedVariableList)(i,o);break;case"services":{(n.services=(0,A.getLinkedServiceList)(
|
|
172
|
+
i,r,o))&&s.delete(i.name);break}}if(_t(n))return n;o.push(new ve([...s],e.file))},
|
|
173
|
+
"getTypeFromMembers");var lt=p((e,t,r,o,n)=>{if(!Fr(e))return;let{description:s,module:i}=e,m={...s&&{
|
|
170
174
|
description:s},...i&&{module:i}},c=new Set(["name","file","response"]);if((m.name=
|
|
171
|
-
e.name)&&c.delete("name"),(m.file=e.file)&&c.delete("file"),e.parameters){let[{value:
|
|
172
|
-
|
|
173
|
-
return){let
|
|
174
|
-
return m;o.push(new
|
|
175
|
-
file&&!!e.response,"isValidHandler");var
|
|
176
|
-
r,o,!0),"getHttpRemoteRoutes"),
|
|
175
|
+
e.name)&&c.delete("name"),(m.file=e.file)&&c.delete("file"),e.parameters){let[{value:z},
|
|
176
|
+
Ir]=e.parameters;m.request=st(z,t,r,o),Ir&&!n&&(m.provider=ut(Ir.value,t,r,o))}if(e.
|
|
177
|
+
return){let z=_r(e.return,t,r,o);z&&(m.response=z,c.delete("response"))}if(eo(m))
|
|
178
|
+
return m;o.push(new Se([...c],e.file))},"getHttpHandler"),eo=p(e=>!!e.name&&!!e.
|
|
179
|
+
file&&!!e.response,"isValidHandler");var yt=p((e,t,r,o)=>gt(e,t,r,o,!1),"getHttpLocalRoutes"),Tt=p((e,t,r,o)=>gt(e,t,
|
|
180
|
+
r,o,!0),"getHttpRemoteRoutes"),gt=p((e,t,r,o,n)=>{if(!(0,E.isTypeReference)(t.value))
|
|
177
181
|
return Tr((0,a.getPropertyTuple)(t)??[],e,r,o,n);let s=(0,a.getReferenceType)(t.
|
|
178
|
-
value,r);if(s&&(0,
|
|
179
|
-
s"),Tr=p((e,t,r,o,n)=>{let s=[];for(let i of e){let m=
|
|
180
|
-
m)?s.push(...m):m&&s.push(m)}return s},"getRouteFromTuple"),
|
|
181
|
-
e))return
|
|
182
|
-
n)},"getTypeFromRoute"),
|
|
183
|
-
if(
|
|
184
|
-
return
|
|
185
|
-
return Tr(e.elements,t,r,o,n)},"getRouteType"),
|
|
186
|
-
["path","handler"]);for(let c of r)if(!(!(0,
|
|
182
|
+
value,r);if(s&&(0,E.isTypeTuple)(s))return Tr(s.elements,e,r,o,n)},"getHttpRoute\
|
|
183
|
+
s"),Tr=p((e,t,r,o,n)=>{let s=[];for(let i of e){let m=ro(i,t,r,o,n);Array.isArray(
|
|
184
|
+
m)?s.push(...m):m&&s.push(m)}return s},"getRouteFromTuple"),ro=p((e,t,r,o,n)=>{if(!(0,E.isTypeReference)(
|
|
185
|
+
e))return dt(e,t,r,o,n);let s=(0,a.getReferenceType)(e,r);if(s)return dt(s,t,r,o,
|
|
186
|
+
n)},"getTypeFromRoute"),to=p(e=>!!e.path&&!!e.handler,"isValidRoute"),dt=p((e,t,r,o,n)=>{
|
|
187
|
+
if(xr(e))return ft(e,t,(0,a.getModelMembers)(e),r,o,n);if((0,E.isTypeObject)(e))
|
|
188
|
+
return ft(e,t,(0,a.getObjectMembers)(e),r,o,n);if((0,E.isTypeTuple)(e)&&e.spread)
|
|
189
|
+
return Tr(e.elements,t,r,o,n)},"getRouteType"),ft=p((e,t,r,o,n,s)=>{let i={},m=new Set(
|
|
190
|
+
["path","handler"]);for(let c of r)if(!(!(0,E.isModelProperty)(c)||c.inherited))
|
|
187
191
|
switch(c.name){default:n.push(new a.InvalidServicePropertyError(t.name,c.name,e.
|
|
188
|
-
file));break;case"name":i.name=(0,a.getPropertyString)(c);break;case"path":{let
|
|
189
|
-
c);
|
|
190
|
-
t,o,n,s))&&m.delete(c.name);break;case"authorizer":i.authorizer=
|
|
191
|
-
break;case"httpErrors":i.httpErrors=
|
|
192
|
-
preferences=
|
|
193
|
-
i[c.name]=(0,a.getPropertyNumber)(c);break;case"cors":i.
|
|
192
|
+
file));break;case"name":i.name=(0,a.getPropertyString)(c);break;case"path":{let z=(0,a.getPropertyString)(
|
|
193
|
+
c);z&&vr(z)&&(m.delete(c.name),i.path=z);break}case"handler":(i.handler=lt(c.value,
|
|
194
|
+
t,o,n,s))&&m.delete(c.name);break;case"authorizer":i.authorizer=ct(c.value,t,o,n);
|
|
195
|
+
break;case"httpErrors":i.httpErrors=Je(c.value,t,o,n);break;case"preferences":i.
|
|
196
|
+
preferences=Ve(c.value,t,o,n);break;case"memory":case"logRetention":case"timeout":
|
|
197
|
+
i[c.name]=(0,a.getPropertyNumber)(c);break;case"cors":case"disabled":i[c.name]=(0,a.getPropertyBoolean)(
|
|
194
198
|
c);break;case"listener":i.listener=(0,a.getServiceListener)(c.value,n);break;case"\
|
|
195
|
-
variables":i.variables=(0,a.getLinkedVariableList)(c,n);break}if(
|
|
196
|
-
n.push(new
|
|
197
|
-
super("Incomplete gateway
|
|
198
|
-
p(this,"InvalidCacheTypeError")}constructor(t){super("Invalid gateway cache type",
|
|
199
|
-
void 0,"Http.Cache",t)}},Ie=class extends J.IncorrectTypeError{constructor(r,o){
|
|
200
|
-
super("Incorrect gateway cache type",r,"Http.Cache",o);this.cacheType=r}static{p(
|
|
201
|
-
this,"IncorrectCacheTypeError")}};var br=p((e,t,r,o)=>{if(!(0,G.isTypeReference)(e))return mt(e,t,o);let n=(0,h.getReferenceType)(
|
|
202
|
-
e,r);if(n)return mt(n,t,o)},"getHttpCache"),Jt=p(e=>(0,Hr.isAnyNumber)(e.authorizerTTL),
|
|
203
|
-
"isValidCache"),mt=p((e,t,r)=>{if((0,G.isTypeObject)(e))return at(e,t,(0,h.getObjectMembers)(
|
|
204
|
-
e),r);if(!(0,h.isModelDeclaration)(e)){r.push(new ve(t.file));return}if(!Cr(e)){
|
|
205
|
-
r.push(new Ie(e.name,e.file));return}return at(e,t,(0,h.getModelMembers)(e),r)},
|
|
206
|
-
"getTypeCache"),at=p((e,t,r,o)=>{let n={},s=new Set(["authorizerTTL"]);for(let i of r)
|
|
207
|
-
if(!(!(0,G.isModelProperty)(i)||i.inherited))switch(i.name){default:o.push(new h.InvalidServicePropertyError(
|
|
208
|
-
t.name,i.name,e.file));break;case"authorizerTTL":{let m=(0,h.getPropertyNumber)(
|
|
209
|
-
i);(0,Hr.isAnyNumber)(m)&&(n[i.name]=m,s.delete(i.name));break}}if(Jt(n))return n;
|
|
210
|
-
o.push(new Se([...s],e.file))},"getTypeFromMembers");var S=require("@ez4/common/library"),Y=require("@ez4/reflection"),hr=require("@ez4/utils");var K=require("@ez4/common/library");var xe=class extends K.IncompleteTypeError{static{p(this,"IncompleteAccessError")}constructor(t,r){
|
|
211
|
-
super("Incomplete gateway access",t,r)}},Ae=class extends K.InvalidTypeError{static{
|
|
199
|
+
variables":i.variables=(0,a.getLinkedVariableList)(c,n);break}if(to(i))return i;
|
|
200
|
+
n.push(new pe([...m],e.file))},"getTypeFromMembers");var S=require("@ez4/common/library"),K=require("@ez4/reflection"),gr=require("@ez4/utils");var $=require("@ez4/common/library");var xe=class extends $.IncompleteTypeError{static{p(this,"IncompleteAccessError")}constructor(t,r){
|
|
201
|
+
super("Incomplete gateway access",t,r)}},Ae=class extends $.InvalidTypeError{static{
|
|
212
202
|
p(this,"InvalidAccessTypeError")}constructor(t){super("Invalid gateway access ty\
|
|
213
|
-
pe",void 0,"Http.Access",t)}},Ee=class extends
|
|
203
|
+
pe",void 0,"Http.Access",t)}},Ee=class extends $.IncorrectTypeError{constructor(r,o){
|
|
214
204
|
super("Incorrect gateway access type",r,"Http.Access",o);this.cacheType=r}static{
|
|
215
|
-
p(this,"IncorrectAccessTypeError")}};var
|
|
216
|
-
e,r);if(n)return
|
|
217
|
-
"isValidAccess"),
|
|
218
|
-
e),r);if(!(0,S.isModelDeclaration)(e)){r.push(new Ae(t.file));return}if(!
|
|
219
|
-
r.push(new Ee(e.name,e.file));return}return
|
|
220
|
-
"getTypeAccess"),
|
|
221
|
-
if(!(!(0,
|
|
205
|
+
p(this,"IncorrectAccessTypeError")}};var bt=p((e,t,r,o)=>{if(!(0,K.isTypeReference)(e))return ht(e,t,o);let n=(0,S.getReferenceType)(
|
|
206
|
+
e,r);if(n)return ht(n,t,o)},"getHttpAccess"),oo=p(e=>(0,gr.isAnyNumber)(e.logRetention),
|
|
207
|
+
"isValidAccess"),ht=p((e,t,r)=>{if((0,K.isTypeObject)(e))return Mt(e,t,(0,S.getObjectMembers)(
|
|
208
|
+
e),r);if(!(0,S.isModelDeclaration)(e)){r.push(new Ae(t.file));return}if(!Cr(e)){
|
|
209
|
+
r.push(new Ee(e.name,e.file));return}return Mt(e,t,(0,S.getModelMembers)(e),r)},
|
|
210
|
+
"getTypeAccess"),Mt=p((e,t,r,o)=>{let n={},s=new Set(["logRetention"]);for(let i of r)
|
|
211
|
+
if(!(!(0,K.isModelProperty)(i)||i.inherited))switch(i.name){default:o.push(new S.InvalidServicePropertyError(
|
|
222
212
|
t.name,i.name,e.file));break;case"logRetention":{let m=(0,S.getPropertyNumber)(i);
|
|
223
|
-
(0,
|
|
224
|
-
push(new xe([...s],e.file))},"getTypeFromMembers");var
|
|
225
|
-
super("Incomplete
|
|
213
|
+
(0,gr.isAnyNumber)(m)&&(n[i.name]=m,s.delete(i.name));break}}if(oo(n))return n;o.
|
|
214
|
+
push(new xe([...s],e.file))},"getTypeFromMembers");var I=require("@ez4/common/library"),W=require("@ez4/reflection"),hr=require("@ez4/utils");var Y=require("@ez4/common/library");var Pe=class extends Y.IncompleteTypeError{static{p(this,"IncompleteCacheError")}constructor(t,r){
|
|
215
|
+
super("Incomplete gateway cache",t,r)}},Re=class extends Y.InvalidTypeError{static{
|
|
216
|
+
p(this,"InvalidCacheTypeError")}constructor(t){super("Invalid gateway cache type",
|
|
217
|
+
void 0,"Http.Cache",t)}},ze=class extends Y.IncorrectTypeError{constructor(r,o){
|
|
218
|
+
super("Incorrect gateway cache type",r,"Http.Cache",o);this.cacheType=r}static{p(
|
|
219
|
+
this,"IncorrectCacheTypeError")}};var It=p((e,t,r,o)=>{if(!(0,W.isTypeReference)(e))return Ht(e,t,o);let n=(0,I.getReferenceType)(
|
|
220
|
+
e,r);if(n)return Ht(n,t,o)},"getHttpCache"),no=p(e=>(0,hr.isAnyNumber)(e.authorizerTTL),
|
|
221
|
+
"isValidCache"),Ht=p((e,t,r)=>{if((0,W.isTypeObject)(e))return St(e,t,(0,I.getObjectMembers)(
|
|
222
|
+
e),r);if(!(0,I.isModelDeclaration)(e)){r.push(new Re(t.file));return}if(!kr(e)){
|
|
223
|
+
r.push(new ze(e.name,e.file));return}return St(e,t,(0,I.getModelMembers)(e),r)},
|
|
224
|
+
"getTypeCache"),St=p((e,t,r,o)=>{let n={},s=new Set(["authorizerTTL"]);for(let i of r)
|
|
225
|
+
if(!(!(0,W.isModelProperty)(i)||i.inherited))switch(i.name){default:o.push(new I.InvalidServicePropertyError(
|
|
226
|
+
t.name,i.name,e.file));break;case"authorizerTTL":{let m=(0,I.getPropertyNumber)(
|
|
227
|
+
i);(0,hr.isAnyNumber)(m)&&(n[i.name]=m,s.delete(i.name));break}}if(no(n))return n;
|
|
228
|
+
o.push(new Pe([...s],e.file))},"getTypeFromMembers");var d=require("@ez4/common/library"),Z=require("@ez4/reflection");var X=require("@ez4/common/library");var we=class extends X.IncompleteTypeError{static{p(this,"IncompleteCorsError")}constructor(t,r){
|
|
229
|
+
super("Incomplete HTTP CORS",t,r)}},Oe=class extends X.InvalidTypeError{static{p(
|
|
226
230
|
this,"InvalidCorsTypeError")}constructor(t){super("Invalid HTTP CORS type",void 0,
|
|
227
|
-
"Http.Cors",t)}},
|
|
231
|
+
"Http.Cors",t)}},je=class extends X.IncorrectTypeError{constructor(r,o){super("I\
|
|
228
232
|
ncorrect HTTP CORS type",r,"Http.Cors",o);this.fallbackType=r}static{p(this,"Inc\
|
|
229
|
-
orrectCorsTypeError")}};var
|
|
230
|
-
e,r);if(n)return
|
|
231
|
-
alidCors"),
|
|
232
|
-
e),r);if(!(0,d.isModelDeclaration)(e)){r.push(new
|
|
233
|
-
r.push(new
|
|
234
|
-
"getTypeCors"),
|
|
235
|
-
if(!(!(0,
|
|
233
|
+
orrectCorsTypeError")}};var At=p((e,t,r,o)=>{if(!(0,Z.isTypeReference)(e))return vt(e,t,o);let n=(0,d.getReferenceType)(
|
|
234
|
+
e,r);if(n)return vt(n,t,o)},"getHttpCors"),po=p(e=>!!e.allowOrigins?.length,"isV\
|
|
235
|
+
alidCors"),vt=p((e,t,r)=>{if((0,Z.isTypeObject)(e))return xt(e,t,(0,d.getObjectMembers)(
|
|
236
|
+
e),r);if(!(0,d.isModelDeclaration)(e)){r.push(new Oe(t.file));return}if(!qr(e)){
|
|
237
|
+
r.push(new je(e.name,e.file));return}return xt(e,t,(0,d.getModelMembers)(e),r)},
|
|
238
|
+
"getTypeCors"),xt=p((e,t,r,o)=>{let n={},s=new Set(["allowOrigins"]);for(let i of r)
|
|
239
|
+
if(!(!(0,Z.isModelProperty)(i)||i.inherited))switch(i.name){default:o.push(new d.InvalidServicePropertyError(
|
|
236
240
|
t.name,i.name,e.file));break;case"allowOrigins":case"allowMethods":case"allowHea\
|
|
237
241
|
ders":case"exposeHeaders":n[i.name]=(0,d.getPropertyStringList)(i);break;case"al\
|
|
238
242
|
lowCredentials":n.allowCredentials=(0,d.getPropertyBoolean)(i);break;case"maxAge":
|
|
239
|
-
n.maxAge=(0,d.getPropertyNumber)(i);break}if(
|
|
240
|
-
e.file))},"getTypeFromMembers");var
|
|
241
|
-
n))continue;let s={type:
|
|
243
|
+
n.maxAge=(0,d.getPropertyNumber)(i);break}if(po(n))return n;o.push(new we([...s],
|
|
244
|
+
e.file))},"getTypeFromMembers");var Mr=p(e=>{let t={},r=[];for(let o in e){let n=e[o];if(!Be(n)||(0,g.isExternalDeclaration)(
|
|
245
|
+
n))continue;let s={type:C,context:{}},i=new Set(["routes"]),m=n.file;s.name=n.name,
|
|
242
246
|
n.description&&(s.description=n.description);for(let c of(0,g.getModelMembers)(n))
|
|
243
|
-
if(!(!(0,
|
|
244
|
-
s.name,c.name,m));break;case"routes":(s.routes=
|
|
245
|
-
name":s.displayName=(0,g.getPropertyString)(c);break;case"defaults":s.defaults=
|
|
246
|
-
c.value,n,e,r);break;case"cache":s.cache=
|
|
247
|
-
access=
|
|
247
|
+
if(!(!(0,Et.isModelProperty)(c)||c.inherited))switch(c.name){default:r.push(new g.InvalidServicePropertyError(
|
|
248
|
+
s.name,c.name,m));break;case"routes":(s.routes=yt(n,c,e,r))&&i.delete(c.name);break;case"\
|
|
249
|
+
name":s.displayName=(0,g.getPropertyString)(c);break;case"defaults":s.defaults=Ge(
|
|
250
|
+
c.value,n,e,r);break;case"cache":s.cache=It(c.value,n,e,r);break;case"access":s.
|
|
251
|
+
access=bt(c.value,n,e,r);break;case"cors":s.cors=At(c.value,n,e,r);break;case"va\
|
|
248
252
|
riables":s.variables=(0,g.getLinkedVariableList)(c,r);break;case"services":s.services=
|
|
249
|
-
(0,g.getLinkedServiceList)(c,e,r);break}if(!
|
|
250
|
-
if(t[n.name]){r.push(new g.DuplicateServiceError(n.name,m));continue}
|
|
251
|
-
name]=s}return{services:t,errors:r}},"getHttpServices"),
|
|
252
|
-
!!e.context,"isValidService"),
|
|
253
|
+
(0,g.getLinkedServiceList)(c,e,r);break}if(!io(s)){r.push(new O([...i],m));continue}
|
|
254
|
+
if(t[n.name]){r.push(new g.DuplicateServiceError(n.name,m));continue}so(s,r,m),t[n.
|
|
255
|
+
name]=s}return{services:t,errors:r}},"getHttpServices"),io=p(e=>!!e.name&&!!e.routes&&
|
|
256
|
+
!!e.context,"isValidService"),so=p((e,t,r)=>{for(let o of e.routes){let n=o.handler.
|
|
253
257
|
provider;if(n?.services){e.services||(e.services={});for(let s in n.services){let i=e.
|
|
254
|
-
services[s],m=n.services[s];if(!i){e.services[s]=m;continue}i!==m&&t.push(new
|
|
255
|
-
s,r))}}}},"assignProviderServices");var M=require("@ez4/common/library"),
|
|
256
|
-
|
|
258
|
+
services[s],m=n.services[s];if(!i){e.services[s]=m;continue}i!==m&&t.push(new ee(
|
|
259
|
+
s,r))}}}},"assignProviderServices");var M=require("@ez4/common/library"),mr=require("@ez4/reflection");var h=require("@ez4/common/library"),L=require("@ez4/reflection"),br=require("@ez4/utils");var _=require("@ez4/common/library");var ke=class extends _.IncompleteTypeError{static{p(this,"IncompleteAuthorizatio\
|
|
260
|
+
nError")}constructor(t,r){super("Incomplete gateway authorization",t,r)}},Ce=class extends _.InvalidTypeError{static{
|
|
261
|
+
p(this,"InvalidAuthorizationTypeError")}constructor(t){super("Invalid authorizat\
|
|
262
|
+
ion",void 0,"Http.Authorization",t)}},qe=class extends _.IncorrectTypeError{constructor(r,o){
|
|
263
|
+
super("Incorrect authorization",r,"Http.Authorization",o);this.authorizationType=
|
|
264
|
+
r}static{p(this,"IncorrectAuthorizationTypeError")}};var zt=p((e,t,r,o)=>{if(!(0,L.isTypeReference)(e))return Pt(e,t,o);let n=(0,h.getReferenceType)(
|
|
265
|
+
e,r);if(n)return Pt(n,t,o)},"getHttpAuthorization"),co=p(e=>(0,br.isAnyString)(e.
|
|
266
|
+
value),"isValidAuthorization"),Pt=p((e,t,r)=>{if((0,L.isTypeObject)(e))return Rt(
|
|
267
|
+
e,t,(0,h.getObjectMembers)(e),r);if(!(0,h.isModelDeclaration)(e)){r.push(new Ce(
|
|
268
|
+
t.file));return}if(!Er(e)){r.push(new qe(e.name,t.file));return}return Rt(e,t,(0,h.getModelMembers)(
|
|
269
|
+
e),r)},"getTypeAuthorization"),Rt=p((e,t,r,o)=>{let n=new Set(["value"]),s={type:"\
|
|
270
|
+
bearer",header:"authorization"};for(let i of r)if((0,L.isModelProperty)(i))switch(i.
|
|
271
|
+
name){default:o.push(new h.InvalidServicePropertyError(t.name,i.name,t.file));break;case"\
|
|
272
|
+
type":s.type=(0,h.getPropertyStringIn)(i,["bearer"]);break;case"value":case"head\
|
|
273
|
+
er":{let m=(0,h.getPropertyString)(i);(0,br.isAnyString)(m)&&(s[i.name]=m,n.delete(
|
|
274
|
+
i.name));break}}if(co(s))return s;o.push(new ke([...n],e.file))},"getTypeFromMem\
|
|
275
|
+
bers");var Hr=p(e=>{let t={},r=[];for(let o in e){let n=e[o];if(!Ue(n)||(0,M.isExternalDeclaration)(
|
|
276
|
+
n))continue;let s={type:k},i=new Set(["reference","project","routes"]),m=n.file;
|
|
257
277
|
s.name=n.name,n.description&&(s.description=n.description);for(let c of(0,M.getModelMembers)(
|
|
258
|
-
n,!0))if((0,
|
|
259
|
-
s.name,c.name,m));break;case"reference":c.inherited&&(0,
|
|
260
|
-
(s[c.name]=(0,M.getReferenceName)(c.value),i.delete(c.name));break;case"
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
return{services:t,
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
278
|
+
n,!0))if((0,mr.isModelProperty)(c))switch(c.name){default:c.inherited||r.push(new M.InvalidServicePropertyError(
|
|
279
|
+
s.name,c.name,m));break;case"reference":c.inherited&&(0,mr.isTypeReference)(c.value)&&
|
|
280
|
+
(s[c.name]=(0,M.getReferenceName)(c.value),i.delete(c.name));break;case"authoriz\
|
|
281
|
+
ation":c.inherited||(s[c.name]=zt(c.value,n,e,r));break;case"project":!c.inherited&&
|
|
282
|
+
(s.project=(0,M.getPropertyString)(c))&&i.delete(c.name);break;case"name":c.inherited&&
|
|
283
|
+
(s.displayName=(0,M.getPropertyString)(c,e));break;case"routes":c.inherited&&(s.
|
|
284
|
+
routes=Tt(n,c,e,r))&&i.delete(c.name);break;case"defaults":c.inherited&&(s.defaults=
|
|
285
|
+
Ge(c.value,n,e,r));break}if(!mo(s)){r.push(new O([...i],m));continue}if(t[n.name]){
|
|
286
|
+
r.push(new M.DuplicateServiceError(n.name,m));continue}t[n.name]=s}return{services:t,
|
|
287
|
+
errors:r}},"getHttpImports"),mo=p(e=>!!e.name&&!!e.reference&&!!e.project&&!!e.routes,
|
|
288
|
+
"isValidImport");var wt=p(e=>Be(e)?e.name:null,"getLinkedService"),Ot=p(e=>Ue(e)?e.name:null,"get\
|
|
289
|
+
LinkedImport");var ao=p(()=>{(0,jt.registerTriggers)(),(0,kt.registerTriggers)(),(0,Sr.tryCreateTrigger)(
|
|
290
|
+
C,{"metadata:getServices":Mr,"metadata:getLinkedService":wt}),(0,Sr.tryCreateTrigger)(
|
|
291
|
+
k,{"metadata:getServices":Hr,"metadata:getLinkedService":Ot})},"registerTriggers");var uo=p(e=>{let{authorization:t}=e;if(t)switch(t.type){default:throw new Error(
|
|
292
|
+
`Authorization type ${t.type} isn't supported.`);case"bearer":return{header:t.header,
|
|
293
|
+
value:`Bearer ${t.value}`}}},"getClientAuthorization");var Ct=require("@ez4/schema");var lo=p(e=>{let t={},r=e.defaults?.preferences?.namingStyle,o=ur(e)?e.authorization?.
|
|
294
|
+
header:void 0;for(let n of e.routes){if(!n.name)continue;let[s,i]=n.path.split("\
|
|
295
|
+
",2),{handler:m,preferences:c}=n;t[n.name]={authorize:fo(n,o),namingStyle:c?.namingStyle??
|
|
296
|
+
r,bodySchema:m.request?.body,responseSchema:m.response.body,querySchema:m.request?.
|
|
297
|
+
query,method:s,path:i}}return t},"getClientOperations"),fo=p((e,t)=>{let r=e.authorizer?.
|
|
298
|
+
request?.headers;if(!r||!t)return!1;let o=(0,Ct.getObjectSchemaProperty)(r,t);return!(!o||
|
|
299
|
+
o.optional)},"shouldUseAuthorization");var ar=require("@ez4/common/library");var oe=class extends ar.InvalidTypeError{static{p(this,"InvalidDefaultsTypeError")}constructor(t){
|
|
300
|
+
super("Invalid defaults",void 0,"Http.Defaults",t)}},ne=class extends ar.IncorrectTypeError{constructor(r,o){
|
|
276
301
|
super("Incorrect defaults",r,"Http.Defaults",o);this.defaultsType=r}static{p(this,
|
|
277
|
-
"IncorrectDefaultsTypeError")}};
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
IncompleteServiceError,IncorrectAccessTypeError,IncorrectBodyTypeError,IncorrectCacheTypeError,
|
|
283
|
-
IncorrectCorsTypeError,IncorrectDefaultsTypeError,IncorrectHeadersTypeError,IncorrectIdentityTypeError,
|
|
302
|
+
"IncorrectDefaultsTypeError")}};0&&(module.exports={ImportType,IncompleteAccessError,IncompleteAuthorizationError,
|
|
303
|
+
IncompleteAuthorizerError,IncompleteCacheError,IncompleteCorsError,IncompleteHandlerError,
|
|
304
|
+
IncompleteProviderError,IncompleteRouteError,IncompleteServiceError,IncorrectAccessTypeError,
|
|
305
|
+
IncorrectAuthorizationTypeError,IncorrectBodyTypeError,IncorrectCacheTypeError,IncorrectCorsTypeError,
|
|
306
|
+
IncorrectDefaultsTypeError,IncorrectHeadersTypeError,IncorrectIdentityTypeError,
|
|
284
307
|
IncorrectParameterTypeError,IncorrectPreferencesTypeError,IncorrectQueryTypeError,
|
|
285
|
-
IncorrectRequestTypeError,IncorrectResponseTypeError,InvalidAccessTypeError,
|
|
286
|
-
InvalidCacheTypeError,InvalidCorsTypeError,InvalidDefaultsTypeError,
|
|
287
|
-
InvalidIdentityTypeError,InvalidParameterTypeError,InvalidPreferencesTypeError,
|
|
288
|
-
InvalidQueryTypeError,InvalidRequestTypeError,InvalidResponseTypeError,
|
|
289
|
-
ServiceCollisionError,ServiceType,
|
|
290
|
-
|
|
291
|
-
getHttpHandlerResponse,getHttpHeaders,getHttpIdentity,getHttpLocalRoutes,getHttpParameters,
|
|
292
|
-
getHttpQuery,getHttpRemoteRoutes,getHttpServices,isHttpImport,isHttpService,registerTriggers});
|
|
308
|
+
IncorrectRequestTypeError,IncorrectResponseTypeError,InvalidAccessTypeError,InvalidAuthorizationTypeError,
|
|
309
|
+
InvalidBodyTypeError,InvalidCacheTypeError,InvalidCorsTypeError,InvalidDefaultsTypeError,
|
|
310
|
+
InvalidHeadersTypeError,InvalidIdentityTypeError,InvalidParameterTypeError,InvalidPreferencesTypeError,
|
|
311
|
+
InvalidProviderTypeError,InvalidQueryTypeError,InvalidRequestTypeError,InvalidResponseTypeError,
|
|
312
|
+
InvalidRouteErrorTypeError,ServiceCollisionError,ServiceType,getClientAuthorization,
|
|
313
|
+
getClientOperations,getHttpImports,getHttpServices,isHttpImport,isHttpService,registerTriggers});
|
|
293
314
|
//# sourceMappingURL=library.cjs.map
|