@ez4/gateway 0.41.0 → 0.41.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/library.cjs +36 -36
- package/dist/library.mjs +46 -46
- package/dist/services/http/path.d.ts +1 -1
- package/package.json +1 -1
package/dist/library.cjs
CHANGED
|
@@ -3,7 +3,7 @@ typeof r=="object"||typeof r=="function")for(let n of fn(r))!yn.call(e,n)&&n!==t
|
|
|
3
3
|
bt(e,n,{get:()=>r[n],enumerable:!(o=dn(r,n))||o.enumerable});return e};var bn=e=>gn(bt({},"__esModule",{value:!0}),e);var Ei={};Tn(Ei,{HttpImportType:()=>Fe,HttpNamespaceType:()=>l,HttpServiceType:()=>De,
|
|
4
4
|
IncompleteAccessError:()=>pt,IncompleteAuthorizationError:()=>Ne,IncompleteAuthorizerHandlerError:()=>Ge,
|
|
5
5
|
IncompleteCacheError:()=>mt,IncompleteCorsError:()=>dt,IncompleteHandlerError:()=>oe,
|
|
6
|
-
IncompleteProviderError:()=>Ke,IncompleteRouteError:()=>
|
|
6
|
+
IncompleteProviderError:()=>Ke,IncompleteRouteError:()=>Ve,IncompleteServiceError:()=>U,
|
|
7
7
|
IncompleteTargetError:()=>ne,IncorrectAccessTypeError:()=>ct,IncorrectAuthorizationTypeError:()=>Be,
|
|
8
8
|
IncorrectBodyTypeError:()=>nt,IncorrectCacheTypeError:()=>ut,IncorrectCorsTypeError:()=>yt,
|
|
9
9
|
IncorrectDefaultsTypeError:()=>re,IncorrectEventTypeError:()=>gt,IncorrectHeadersTypeError:()=>et,
|
|
@@ -12,16 +12,16 @@ IncorrectQueryTypeError:()=>rt,IncorrectRequestTypeError:()=>J,IncorrectResponse
|
|
|
12
12
|
InvalidAccessTypeError:()=>at,InvalidAuthorizationTypeError:()=>qe,InvalidBodyTypeError:()=>ot,
|
|
13
13
|
InvalidCacheTypeError:()=>lt,InvalidCorsTypeError:()=>ft,InvalidDefaultsTypeError:()=>te,
|
|
14
14
|
InvalidEventTypeError:()=>Tt,InvalidHeadersTypeError:()=>Le,InvalidIdentityTypeError:()=>Xe,
|
|
15
|
-
InvalidParameterTypeError:()=>
|
|
16
|
-
InvalidQueryTypeError:()=>tt,InvalidRequestTypeError:()=>G,InvalidResponseTypeError:()=>
|
|
15
|
+
InvalidParameterTypeError:()=>Ye,InvalidPreferencesTypeError:()=>Ue,InvalidProviderTypeError:()=>Je,
|
|
16
|
+
InvalidQueryTypeError:()=>tt,InvalidRequestTypeError:()=>G,InvalidResponseTypeError:()=>Y,
|
|
17
17
|
InvalidRouteErrorTypeError:()=>ce,MismatchParametersTypeError:()=>$e,ServiceCollisionError:()=>Ce,
|
|
18
18
|
WsNamespaceType:()=>d,WsServiceType:()=>we,createHttpImport:()=>ir,createHttpService:()=>or,
|
|
19
19
|
createWsService:()=>tr,getClientAuthorization:()=>Si,getClientOperations:()=>Ri,
|
|
20
20
|
getHttpImportsMetadata:()=>Er,getHttpServicesMetadata:()=>xr,getWsServicesMetadata:()=>wr,
|
|
21
|
-
isHttpImport:()=>nr,isHttpImportDeclaration:()=>
|
|
21
|
+
isHttpImport:()=>nr,isHttpImportDeclaration:()=>Yt,isHttpService:()=>Mn,isHttpServiceDeclaration:()=>Gt,
|
|
22
22
|
isWsService:()=>hn,isWsServiceDeclaration:()=>Zt,registerTriggers:()=>vi});module.
|
|
23
23
|
exports=bn(Ei);var mn=require("@ez4/common/library"),ln=require("@ez4/schema/library"),Lt=require("@ez4/project/library");var Dr=require("@ez4/project/library");var we="@ez4/ws",d="Ws",hn=i(e=>e.type===we,"isWsService"),tr=i(e=>({...(0,Dr.createServiceMetadata)(
|
|
24
|
-
we,e),variables:{},services:{}}),"createWsService");var S=require("@ez4/common/library"),
|
|
24
|
+
we,e),variables:{},services:{}}),"createWsService");var S=require("@ez4/common/library"),Vt=require("@ez4/reflection"),Ro=require("@ez4/utils");var ht=require("@ez4/common/library");var U=class extends ht.IncompleteTypeError{static{i(this,"IncompleteServiceError")}constructor(r,t){
|
|
25
25
|
super("Incomplete service",r,t)}},Ce=class extends ht.TypeCollisionError{static{
|
|
26
26
|
i(this,"ServiceCollisionError")}constructor(r,t){super("Service error",r,t)}};var m=i((e,r)=>`${e}.${r}`,"getFullTypeName");var rr=require("@ez4/project/library");var De="@ez4/http",Fe="@ez4/import:http",l="Http",Mn=i(e=>e.type===De,"isHttpSer\
|
|
27
27
|
vice"),or=i(e=>({...(0,rr.createServiceMetadata)(De,e),variables:{},services:{}}),
|
|
@@ -60,30 +60,30 @@ e),t)},"getPreferencesType"),Ur=i((e,r,t)=>{let o={};for(let n of r)if((0,ae.isM
|
|
|
60
60
|
n))switch(n.name){default:{t.push(new I.InvalidServicePropertyError(e.name,n.name,
|
|
61
61
|
e.file));break}case"namingStyle":{o.namingStyle=(0,I.getPropertyStringIn)(n,[pe.NamingStyle.
|
|
62
62
|
Preserve,pe.NamingStyle.CamelCase,pe.NamingStyle.PascalCase,pe.NamingStyle.SnakeCase,
|
|
63
|
-
pe.NamingStyle.KebabCase]);break}}return o},"getTypeFromMembers");var _=require("@ez4/common/library"),
|
|
63
|
+
pe.NamingStyle.KebabCase]);break}}return o},"getTypeFromMembers");var _=require("@ez4/common/library"),V=require("@ez4/reflection"),Ht=require("@ez4/utils");var Rt=require("@ez4/common/library");var Ve=class extends Rt.IncompleteTypeError{static{i(this,"IncompleteRouteError")}constructor(r,t){
|
|
64
64
|
super("Incomplete route",r,t)}},ce=class extends Rt.TypeError{static{i(this,"Inv\
|
|
65
|
-
alidRouteErrorTypeError")}constructor(r){super("Invalid route error type.",r)}};var Et=i((e,r,t,o)=>{if(!(0,
|
|
66
|
-
e,t);if(n)return _r(n,r,t,o)},"getHttpErrorsMetadata"),_r=i((e,r,t,o)=>{if((0,
|
|
65
|
+
alidRouteErrorTypeError")}constructor(r){super("Invalid route error type.",r)}};var Et=i((e,r,t,o)=>{if(!(0,V.isTypeReference)(e))return _r(e,r,t,o);let n=(0,_.getReferenceType)(
|
|
66
|
+
e,t);if(n)return _r(n,r,t,o)},"getHttpErrorsMetadata"),_r=i((e,r,t,o)=>{if((0,V.isTypeObject)(
|
|
67
67
|
e))return Hn(e,r,(0,_.getObjectMembers)(e),t,o)},"getErrorsType"),Hn=i((e,r,t,o,n)=>{
|
|
68
|
-
let s={};for(let p of t){if(!(0,
|
|
68
|
+
let s={};for(let p of t){if(!(0,V.isModelProperty)(p)||p.inherited)continue;let a=parseInt(
|
|
69
69
|
p.name,10);(0,Ht.isAnyNumber)(a)||n.push(new _.InvalidServicePropertyError(r.name,
|
|
70
70
|
p.name,e.file));let c=En(p,a,r,o,n);c&&Object.assign(s,c)}if(!(0,Ht.isEmptyObject)(
|
|
71
71
|
s))return s},"getTypeFromMembers"),En=i((e,r,t,o,n)=>{let s=(0,_.getPropertyTuple)(
|
|
72
|
-
e)??[],p={};for(let a of s){if(!(0,
|
|
73
|
-
continue}let c=(0,_.getReferenceType)(a,o);if(!c||!(0,
|
|
72
|
+
e)??[],p={};for(let a of s){if(!(0,V.isTypeReference)(a)){n.push(new ce(t.file));
|
|
73
|
+
continue}let c=(0,_.getReferenceType)(a,o);if(!c||!(0,V.isTypeClass)(c)){n.push(
|
|
74
74
|
new ce(t.file));continue}p[c.name]=r}return p},"getErrorClasses");var ar=m(l,"Defaults"),An=i(e=>(0,g.hasHeritageType)(e,ar),"isHttpDefaultsDeclar\
|
|
75
|
-
ation"),At=i((e,r,t,o)=>{if(!(0,me.isTypeReference)(e))return
|
|
76
|
-
e,t);if(n)return
|
|
77
|
-
e))return
|
|
75
|
+
ation"),At=i((e,r,t,o)=>{if(!(0,me.isTypeReference)(e))return Vr(e,r,t,o);let n=(0,g.tryGetReferenceType)(
|
|
76
|
+
e,t);if(n)return Vr(n,r,t,o)},"getHttpDefaultsMetadata"),Vr=i((e,r,t,o)=>{if((0,me.isTypeObject)(
|
|
77
|
+
e))return Yr(r,(0,g.getObjectMembers)(e),t,o);if(!(0,g.isModelDeclaration)(e)){o.
|
|
78
78
|
push(new te(ar,r.file));return}if(!An(e)){o.push(new re(e.name,ar,r.file));return}
|
|
79
|
-
return
|
|
79
|
+
return Yr(r,(0,g.getModelMembers)(e),t,o)},"getDefaultsType"),Yr=i((e,r,t,o)=>{let n={};
|
|
80
80
|
for(let s of r)if(!(!(0,me.isModelProperty)(s)||s.inherited))switch(s.name){default:{
|
|
81
81
|
o.push(new g.InvalidServicePropertyError(e.name,s.name,e.file));break}case"prefe\
|
|
82
82
|
rences":{n.preferences=D(s.value,e,t,o,l);break}case"httpErrors":{n.httpErrors=Et(
|
|
83
83
|
s.value,e,t,o);break}case"memory":case"logRetention":case"timeout":{n[s.name]=(0,g.getPropertyNumber)(
|
|
84
84
|
s);break}case"architecture":{n[s.name]=(0,g.getServiceArchitecture)(s);break}case"\
|
|
85
85
|
runtime":{n[s.name]=(0,g.getServiceRuntime)(s);break}case"listener":{n.listener=
|
|
86
|
-
(0,g.getServiceListener)(s.value,o);break}}return n},"getTypeFromMembers");var B=require("@ez4/reflection"),ho=require("@ez4/utils"),u=require("@ez4/common/library");var le=require("@ez4/common/library");var
|
|
86
|
+
(0,g.getServiceListener)(s.value,o);break}}return n},"getTypeFromMembers");var B=require("@ez4/reflection"),ho=require("@ez4/utils"),u=require("@ez4/common/library");var le=require("@ez4/common/library");var Ye=class extends le.InvalidTypeError{constructor(t,o){super("Invalid path pa\
|
|
87
87
|
rameters",void 0,t,o);this.baseType=t}static{i(this,"InvalidParameterTypeError")}},
|
|
88
88
|
Qe=class extends le.IncorrectTypeError{constructor(t,o,n){super("Incorrect path \
|
|
89
89
|
parameters",t,o,n);this.parametersType=t;this.baseType=o}static{i(this,"Incorrec\
|
|
@@ -102,7 +102,7 @@ o)},"getProviderType"),Pn=i((e,r,t,o)=>{let n={},s=new Set(["services"]);for(let
|
|
|
102
102
|
if(!(!(0,xt.isModelProperty)(p)||p.inherited))switch(p.name){case"variables":{n.
|
|
103
103
|
variables=(0,C.getLinkedVariableList)(p,o);break}case"services":{(n.services=(0,C.getLinkedServiceList)(
|
|
104
104
|
p,t,o))&&s.delete(p.name);break}}if(!xn(n)){o.push(new Ke([...s],e.file));return}
|
|
105
|
-
return n},"getTypeFromMembers");var k=require("@ez4/common/library"),de=require("@ez4/reflection"),Lr=require("@ez4/utils");var kt=require("@ez4/common/library");var
|
|
105
|
+
return n},"getTypeFromMembers");var k=require("@ez4/common/library"),de=require("@ez4/reflection"),Lr=require("@ez4/utils");var kt=require("@ez4/common/library");var Y=class extends kt.InvalidTypeError{constructor(t,o){super("Invalid response",
|
|
106
106
|
void 0,t,o);this.baseType=t}static{i(this,"InvalidResponseTypeError")}},Q=class extends kt.IncorrectTypeError{constructor(t,o,n){
|
|
107
107
|
super("Incorrect response",t,o,n);this.responseType=t;this.baseType=o}static{i(this,
|
|
108
108
|
"IncorrectResponseTypeError")}};var ue=require("@ez4/common/library"),N=require("@ez4/reflection"),Kr=require("@ez4/schema/library");var Ot=require("@ez4/common/library");var Xe=class extends Ot.InvalidTypeError{constructor(t,o){super("Invalid identit\
|
|
@@ -124,7 +124,7 @@ seDeclaration"),eo=i((e,r,t,o,n)=>{if(!(0,de.isTypeReference)(e))return Xr(e,r,t
|
|
|
124
124
|
o,n);let s=(0,k.getReferenceType)(e,t);if(s)return Xr(s,r,t,o,n)},"getAuthRespon\
|
|
125
125
|
seMetadata"),jn=i(e=>(0,Lr.isObjectWith)(e,["identity"]),"isCompleteResponse"),Xr=i(
|
|
126
126
|
(e,r,t,o,n)=>{if((0,de.isTypeObject)(e))return Zr(e,r,(0,k.getObjectMembers)(e),
|
|
127
|
-
t,o,n);if(!(0,k.isModelDeclaration)(e)){o.push(new
|
|
127
|
+
t,o,n);if(!(0,k.isModelDeclaration)(e)){o.push(new Y(m(n,lr),r.file));return}if(!Wn(
|
|
128
128
|
e,n)){o.push(new Q(e.name,m(n,lr),e.file));return}return Zr(e,r,(0,k.getModelMembers)(
|
|
129
129
|
e),t,o,n)},"getResponseType"),Zr=i((e,r,t,o,n,s)=>{let p={};for(let a of t)if(!(!(0,de.isModelProperty)(
|
|
130
130
|
a)||a.inherited))switch(a.name){default:{n.push(new k.InvalidServicePropertyError(
|
|
@@ -137,7 +137,7 @@ super("Incorrect request",t,o,n);this.requestType=t;this.baseType=o}static{i(thi
|
|
|
137
137
|
metersDeclaration"),zt=i((e,r,t,o,n)=>{if(!(0,fe.isTypeReference)(e))return to(e,
|
|
138
138
|
r,t,o,n);let s=(0,ye.getReferenceType)(e,t);if(s)return to(s,r,t,o,n)},"getWebPa\
|
|
139
139
|
rametersMetadata"),to=i((e,r,t,o,n)=>{if((0,fe.isTypeObject)(e))return E(e,t);if((0,fe.isTypeIntersection)(
|
|
140
|
-
e))return F(e,t);if(!(0,ye.isModelDeclaration)(e)){o.push(new
|
|
140
|
+
e))return F(e,t);if(!(0,ye.isModelDeclaration)(e)){o.push(new Ye(m(n,ur),r.file));
|
|
141
141
|
return}if(!zn(e,n)){o.push(new Qe(e.name,m(n,ur),e.file));return}return E(e,t)},
|
|
142
142
|
"getParametersType");var Te=require("@ez4/reflection"),ge=require("@ez4/common/library");var wt=require("@ez4/common/library");var Le=class extends wt.InvalidTypeError{constructor(t,o){super("Invalid headers",
|
|
143
143
|
void 0,t,o);this.baseType=t}static{i(this,"InvalidHeadersTypeError")}},et=class extends wt.IncorrectTypeError{constructor(t,o,n){
|
|
@@ -175,8 +175,8 @@ e)},p=new Set(["response"]);if(e.parameters){let[{value:a},c]=e.parameters;s.req
|
|
|
175
175
|
Tr(a,r,t,o,n),c&&(s.provider=Pt(c.value,r,t,o,n))}if(e.return&&(s.response=eo(e.
|
|
176
176
|
return,r,t,o,n))&&p.delete("response"),!Nn(s)){o.push(new Ge([...p],e.file));return}
|
|
177
177
|
return s},"getAuthHandlerMetadata"),Nn=i(e=>(0,so.isObjectWith)(e,["response"])&&
|
|
178
|
-
(0,Ft.isFunctionSignature)(e),"isCompleteHandler");var qn=new Set(["ANY","GET","POST","PUT","PATCH","DELETE","OPTIONS"]),po=i(
|
|
179
|
-
r]=e.split(" ",2);return qn.has(r)},"isHttpPath");var Ut=require("@ez4/reflection"),_t=require("@ez4/common/library"),yo=require("@ez4/utils");var ao=require("@ez4/common/library");var oe=class extends ao.IncompleteTypeError{static{i(this,"IncompleteHandlerErro\
|
|
178
|
+
(0,Ft.isFunctionSignature)(e),"isCompleteHandler");var qn=new Set(["ANY","GET","POST","HEAD","PUT","PATCH","DELETE","OPTIONS"]),po=i(
|
|
179
|
+
e=>{let[r]=e.split(" ",2);return qn.has(r)},"isHttpPath");var Ut=require("@ez4/reflection"),_t=require("@ez4/common/library"),yo=require("@ez4/utils");var ao=require("@ez4/common/library");var oe=class extends ao.IncompleteTypeError{static{i(this,"IncompleteHandlerErro\
|
|
180
180
|
r")}constructor(r,t){super("Incomplete handler",r,t)}};var H=require("@ez4/common/library"),Re=require("@ez4/reflection"),Bt=require("@ez4/utils");var ve=require("@ez4/schema/library"),Se=require("@ez4/common/library"),A=require("@ez4/reflection");var qt=require("@ez4/common/library");var ot=class extends qt.InvalidTypeError{constructor(t,o){super("Invalid body",void 0,
|
|
181
181
|
t,o);this.baseType=t}static{i(this,"InvalidBodyTypeError")}},nt=class extends qt.IncorrectTypeError{constructor(t,o,n){
|
|
182
182
|
super("Incorrect body",t,o,n);this.bodyType=t;this.baseType=o}static{i(this,"Inc\
|
|
@@ -193,12 +193,12 @@ return E(e,t)},"getCompoundTypeBody"),Un=i((e,r,t)=>{let o={optional:!1,elements
|
|
|
193
193
|
for(let n of e){if((0,A.isTypeUndefined)(n)){o.optional=!0;continue}let s=Mr(n,r,
|
|
194
194
|
t);s&&o.elements.push(s)}if(o.elements.length)return(0,ve.createUnionSchema)(o)},
|
|
195
195
|
"getUnionTypeBody"),_n=i((e,r,t)=>{let o=Mr(e,r,t);if(o)return(0,ve.createArraySchema)(
|
|
196
|
-
{element:o})},"getArrayTypeBody");var vr=m(l,"Response"),
|
|
196
|
+
{element:o})},"getArrayTypeBody");var vr=m(l,"Response"),Vn=i(e=>(0,H.hasHeritageType)(e,vr),"isHttpResponseDeclar\
|
|
197
197
|
ation"),lo=i((e,r,t,o)=>{if(!(0,Re.isTypeReference)(e))return co(e,r,t,o);let n=(0,H.getReferenceType)(
|
|
198
|
-
e,t);if(n)return co(n,r,t,o)},"getHttpResponseMetadata"),
|
|
198
|
+
e,t);if(n)return co(n,r,t,o)},"getHttpResponseMetadata"),Yn=i(e=>(0,Bt.isObjectWith)(
|
|
199
199
|
e,["status"])&&((0,Bt.isAnyNumber)(e.status)||!!e.status.length),"isCompleteResp\
|
|
200
200
|
onse"),co=i((e,r,t,o)=>{if((0,Re.isTypeObject)(e))return mo(e,r,(0,H.getObjectMembers)(
|
|
201
|
-
e),t,o);if(!(0,H.isModelDeclaration)(e)){o.push(new
|
|
201
|
+
e),t,o);if(!(0,H.isModelDeclaration)(e)){o.push(new Y(vr,r.file));return}if(!Vn(
|
|
202
202
|
e)){o.push(new Q(e.name,vr,e.file));return}return mo(e,r,(0,H.getModelMembers)(e),
|
|
203
203
|
t,o)},"getResponseType"),mo=i((e,r,t,o,n)=>{let s={};for(let p of t)if(!(!(0,Re.isModelProperty)(
|
|
204
204
|
p)||p.inherited))switch(p.name){default:{n.push(new H.InvalidServicePropertyError(
|
|
@@ -206,7 +206,7 @@ r.name,p.name,e.file));break}case"status":{s.status=(0,H.getPropertyNumber)(p)??
|
|
|
206
206
|
(0,H.getPropertyNumberList)(p);break}case"headers":{s.headers=K(p.value,e,o,n,l),
|
|
207
207
|
s.headers&&p.description&&(s.headers.description=p.description);break}case"body":{
|
|
208
208
|
s.body=q(p.value,e,o,n,l),s.body&&p.description&&(s.body.description=p.description);
|
|
209
|
-
break}}if(
|
|
209
|
+
break}}if(Yn(s))return s},"getTypeFromMembers");var Z=require("@ez4/reflection"),W=require("@ez4/common/library");var Sr=m(l,"Request"),Qn=i(e=>(0,W.hasHeritageType)(e,Sr),"isHttpRequestDeclarat\
|
|
210
210
|
ion"),Rr=i((e,r,t,o)=>{if((0,Z.isTypeIntersection)(e)&&e.elements.length>0)return Rr(
|
|
211
211
|
e.elements[0],r,t,o);if(!(0,Z.isTypeReference)(e))return uo(e,r,t,o);let n=(0,W.getReferenceType)(
|
|
212
212
|
e,t);if(n)return uo(n,r,t,o)},"getHttpRequestMetadata"),uo=i((e,r,t,o)=>{if((0,Z.isTypeObject)(
|
|
@@ -252,15 +252,15 @@ architecture":{p[y.name]=(0,u.getServiceArchitecture)(y);break}case"runtime":{p[
|
|
|
252
252
|
name]=(0,u.getServiceRuntime)(y);break}case"cors":case"disabled":{p[y.name]=(0,u.getPropertyBoolean)(
|
|
253
253
|
y);break}case"listener":{p.listener=(0,u.getServiceListener)(y.value,n);break}case"\
|
|
254
254
|
variables":{p.variables=(0,u.getLinkedVariableList)(y,n);break}}if(!Xn(p)){n.push(
|
|
255
|
-
new
|
|
255
|
+
new Ve([...a],e.file));return}let c=Zn(p.path,p.handler.request?.parameters);if(c.
|
|
256
256
|
length){n.push(new $e(c,r.file));return}return p},"getTypeFromMembers"),Zn=i((e,r)=>{
|
|
257
257
|
let t=e.matchAll(/\{([\w_-]+)\}/g),o=[];for(let n of t){let[,s]=n;r?.properties[s]||
|
|
258
|
-
o.push(s)}return o},"getMismatchParameters");var
|
|
259
|
-
"isHttpImportDeclaration"),Er=i(e=>{let r={},t=[];for(let o in e){let n=e[o];if(!
|
|
258
|
+
o.push(s)}return o},"getMismatchParameters");var Yt=i(e=>(0,S.isClassDeclaration)(e)&&(0,S.hasHeritageType)(e,m(l,"Import")),
|
|
259
|
+
"isHttpImportDeclaration"),Er=i(e=>{let r={},t=[];for(let o in e){let n=e[o];if(!Yt(
|
|
260
260
|
n)||(0,S.isExternalDeclaration)(n))continue;let s=ir(n.name),p=new Set(["project",
|
|
261
261
|
"reference","routes"]),a=n.file;n.description&&(s.description=n.description);for(let c of(0,S.getModelMembers)(
|
|
262
|
-
n,!0))if((0,
|
|
263
|
-
s.name,c.name,a));break}case"reference":{c.inherited&&(0,
|
|
262
|
+
n,!0))if((0,Vt.isModelProperty)(c))switch(c.name){default:{c.inherited||t.push(new S.InvalidServicePropertyError(
|
|
263
|
+
s.name,c.name,a));break}case"reference":{c.inherited&&(0,Vt.isTypeReference)(c.value)&&
|
|
264
264
|
(s[c.name]=(0,S.getReferenceName)(c.value),p.delete(c.name));break}case"authoriz\
|
|
265
265
|
ation":{c.inherited||(s[c.name]=qr(c.value,n,e,t));break}case"project":{!c.inherited&&
|
|
266
266
|
(s.project=(0,S.getPropertyString)(c))&&p.delete(c.name);break}case"name":{c.inherited&&
|
|
@@ -345,7 +345,7 @@ super("Incomplete target",r,t)}};var Kt=require("@ez4/reflection"),Xt=require("@
|
|
|
345
345
|
ion"),Bo=i((e,r,t,o)=>{if(!(0,Oe.isTypeReference)(e))return No(e,r,t,o);let n=(0,j.getReferenceType)(
|
|
346
346
|
e,t);if(n)return No(n,r,t,o)},"getWsResponseMetadata"),No=i((e,r,t,o)=>{if((0,Oe.isTypeObject)(
|
|
347
347
|
e))return qo(e,r,(0,j.getObjectMembers)(e),t,o);if(!(0,j.isModelDeclaration)(e)){
|
|
348
|
-
o.push(new
|
|
348
|
+
o.push(new Y(Pr,r.file));return}if(!ai(e)){o.push(new Q(e.name,Pr,e.file));return}
|
|
349
349
|
return qo(e,r,(0,j.getModelMembers)(e),t,o)},"getResponseType"),qo=i((e,r,t,o,n)=>{
|
|
350
350
|
let s={};for(let p of t)if(!(!(0,Oe.isModelProperty)(p)||p.inherited))switch(p.name){default:{
|
|
351
351
|
n.push(new j.InvalidServicePropertyError(r.name,p.name,e.file));break}case"body":{
|
|
@@ -366,11 +366,11 @@ void 0,t,o);this.baseType=t}static{i(this,"InvalidEventTypeError")}},gt=class ex
|
|
|
366
366
|
super("Incorrect event",t,o,n);this.eventType=t;this.baseType=o}static{i(this,"I\
|
|
367
367
|
ncorrectEventTypeError")}};var Wr=m(d,"Event"),mi=i(e=>(0,w.hasHeritageType)(e,Wr),"isWsEventDeclaration"),
|
|
368
368
|
jr=i((e,r,t,o)=>{if((0,ee.isTypeIntersection)(e)&&e.elements.length>0)return jr(
|
|
369
|
-
e.elements[0],r,t,o);if(!(0,ee.isTypeReference)(e))return
|
|
370
|
-
e,t);if(n)return
|
|
371
|
-
e))return
|
|
369
|
+
e.elements[0],r,t,o);if(!(0,ee.isTypeReference)(e))return Vo(e,r,t,o);let n=(0,w.getReferenceType)(
|
|
370
|
+
e,t);if(n)return Vo(n,r,t,o)},"getWsEventMetadata"),Vo=i((e,r,t,o)=>{if((0,ee.isTypeObject)(
|
|
371
|
+
e))return Yo(e,r,(0,w.getObjectMembers)(e),t,o);if(!(0,w.isModelDeclaration)(e)){
|
|
372
372
|
o.push(new Tt(Wr,r.file));return}if(!mi(e)){o.push(new gt(e.name,Wr,e.file));return}
|
|
373
|
-
return
|
|
373
|
+
return Yo(e,r,(0,w.getModelMembers)(e),t,o)},"getEventType"),Yo=i((e,r,t,o,n)=>{
|
|
374
374
|
let s={};for(let p of t)if(!(!(0,ee.isModelProperty)(p)||p.inherited))switch(p.name){default:{
|
|
375
375
|
n.push(new w.InvalidServicePropertyError(r.name,p.name,e.file));break}case"heade\
|
|
376
376
|
rs":{s.headers=K(p.value,e,o,n,d),s.headers&&p.description&&(s.headers.description=
|
|
@@ -443,7 +443,7 @@ a));continue}Mi(s,t,a),r[n.name]=s}return{services:r,errors:t}},"getWsServicesMe
|
|
|
443
443
|
tadata"),hi=i(e=>(0,an.isObjectWith)(e,["schema","connect","disconnect","message",
|
|
444
444
|
"variables","services"]),"isCompleteService"),Mi=i((e,r,t)=>{let{connect:o,disconnect:n,
|
|
445
445
|
message:s}=e;He(o.handler,e.services),He(n.handler,e.services),He(s.handler,e.services),
|
|
446
|
-
o.authorizer&&st(o.authorizer,e.services,r,t)},"attachLinkedServices");var Cr=i(e=>Gt(e)||Zt(e)?e.name:null,"getLinkedService"),cn=i(e=>
|
|
446
|
+
o.authorizer&&st(o.authorizer,e.services,r,t)},"attachLinkedServices");var Cr=i(e=>Gt(e)||Zt(e)?e.name:null,"getLinkedService"),cn=i(e=>Yt(e)?e.name:null,
|
|
447
447
|
"getLinkedImport");var vi=i(()=>{(0,mn.registerTriggers)(),(0,ln.registerTriggers)(),(0,Lt.tryCreateTrigger)(
|
|
448
448
|
we,{"metadata:getServices":wr,"metadata:getLinkedService":Cr}),(0,Lt.tryCreateTrigger)(
|
|
449
449
|
De,{"metadata:getServices":xr,"metadata:getLinkedService":Cr}),(0,Lt.tryCreateTrigger)(
|
package/dist/library.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import{tryCreateTrigger as Ze}from"@ez4/project/library";import{createServiceMet
|
|
|
3
3
|
services:{}}),"createWsService");import{DuplicateServiceError as ws,InvalidServicePropertyError as Cs,isExternalDeclaration as Ds,
|
|
4
4
|
isClassDeclaration as Fs,getModelMembers as Ns,getPropertyString as Ut,getReferenceName as qs,
|
|
5
5
|
hasHeritageType as Bs}from"@ez4/common/library";import{isModelProperty as Us,isTypeReference as _s}from"@ez4/reflection";
|
|
6
|
-
import{isObjectWith as
|
|
6
|
+
import{isObjectWith as Vs}from"@ez4/utils";import{IncompleteTypeError as Ar,TypeCollisionError as Ir}from"@ez4/common/library";var h=class extends Ar{static{i(this,"IncompleteServiceError")}constructor(r,t){
|
|
7
7
|
super("Incomplete service",r,t)}},C=class extends Ir{static{i(this,"ServiceColli\
|
|
8
8
|
sionError")}constructor(r,t){super("Service error",r,t)}};var m=i((e,r)=>`${e}.${r}`,"getFullTypeName");import{createServiceMetadata as et}from"@ez4/project/library";var D="@ez4/http",F="@ez4/import:http",l="Http",um=i(e=>e.type===D,"isHttpServic\
|
|
9
9
|
e"),tt=i(e=>({...et(D,e),variables:{},services:{}}),"createHttpService"),rt=i(e=>e.
|
|
@@ -15,15 +15,15 @@ super("Incomplete authorization",r,t)}},q=class extends kr{constructor(t,o){supe
|
|
|
15
15
|
"Invalid authorization",void 0,t,o);this.baseType=t}static{i(this,"InvalidAuthor\
|
|
16
16
|
izationTypeError")}},B=class extends Pr{constructor(t,o,n){super("Incorrect auth\
|
|
17
17
|
orization",t,o,n);this.authorizationType=t;this.baseType=o}static{i(this,"Incorr\
|
|
18
|
-
ectAuthorizationTypeError")}};var Se=m(l,"Authorization"),
|
|
18
|
+
ectAuthorizationTypeError")}};var Se=m(l,"Authorization"),Vr=i(e=>Fr(e,Se),"isHttpAuthorizationDeclaration"),st=i(
|
|
19
19
|
(e,r,t,o)=>{if(!Br(e))return nt(e,r,o);let n=wr(e,t);if(n)return nt(n,r,o)},"get\
|
|
20
|
-
HttpAuthorizationMetadata"),
|
|
20
|
+
HttpAuthorizationMetadata"),Yr=i(e=>_r(e,["value"]),"isCompleteAuthorization"),nt=i(
|
|
21
21
|
(e,r,t)=>{if(qr(e))return it(e,r,jr(e),t);if(!Wr(e)){t.push(new q(Se,r.file));return}
|
|
22
|
-
if(!
|
|
22
|
+
if(!Vr(e)){t.push(new B(e.name,Se,r.file));return}return it(e,r,zr(e),t)},"getTy\
|
|
23
23
|
peAuthorization"),it=i((e,r,t,o)=>{let n=new Set(["value"]),s={type:"bearer",header:"\
|
|
24
24
|
authorization"};for(let p of t)if(Nr(p))switch(p.name){default:{o.push(new Or(r.
|
|
25
25
|
name,p.name,r.file));break}case"type":{s.type=Cr(p,["bearer"]);break}case"value":case"\
|
|
26
|
-
header":{let a=Dr(p);Ur(a)&&(s[p.name]=a,n.delete(p.name));break}}if(!
|
|
26
|
+
header":{let a=Dr(p);Ur(a)&&(s[p.name]=a,n.delete(p.name));break}}if(!Yr(s)){o.push(
|
|
27
27
|
new N([...n],e.file));return}return s},"getTypeFromMembers");import{InvalidServicePropertyError as Mo,isModelDeclaration as vo,getPropertyNumber as So,
|
|
28
28
|
getObjectMembers as Ro,getModelMembers as Ho,getServiceListener as Eo,getServiceArchitecture as Ao,
|
|
29
29
|
getServiceRuntime as Io,tryGetReferenceType as xo,hasHeritageType as Po}from"@ez4/common/library";
|
|
@@ -46,9 +46,9 @@ break}case"namingStyle":{o.namingStyle=to(n,[O.Preserve,O.CamelCase,O.PascalCase
|
|
|
46
46
|
O.SnakeCase,O.KebabCase]);break}}return o},"getTypeFromMembers");import{InvalidServicePropertyError as co,getObjectMembers as mo,getPropertyTuple as lo,
|
|
47
47
|
getReferenceType as mt}from"@ez4/common/library";import{isModelProperty as uo,isTypeClass as fo,
|
|
48
48
|
isTypeObject as yo,isTypeReference as lt}from"@ez4/reflection";import{isAnyNumber as To,
|
|
49
|
-
isEmptyObject as go}from"@ez4/utils";import{IncompleteTypeError as po,TypeError as ao}from"@ez4/common/library";var
|
|
49
|
+
isEmptyObject as go}from"@ez4/utils";import{IncompleteTypeError as po,TypeError as ao}from"@ez4/common/library";var V=class extends po{static{i(this,"IncompleteRouteError")}constructor(r,t){super(
|
|
50
50
|
"Incomplete route",r,t)}},W=class extends ao{static{i(this,"InvalidRouteErrorTyp\
|
|
51
|
-
eError")}constructor(r){super("Invalid route error type.",r)}};var
|
|
51
|
+
eError")}constructor(r){super("Invalid route error type.",r)}};var Y=i((e,r,t,o)=>{if(!lt(e))return ct(e,r,t,o);let n=mt(e,t);if(n)return ct(n,
|
|
52
52
|
r,t,o)},"getHttpErrorsMetadata"),ct=i((e,r,t,o)=>{if(yo(e))return bo(e,r,mo(e),t,
|
|
53
53
|
o)},"getErrorsType"),bo=i((e,r,t,o,n)=>{let s={};for(let p of t){if(!uo(p)||p.inherited)
|
|
54
54
|
continue;let a=parseInt(p.name,10);To(a)||n.push(new co(r.name,p.name,e.file));let c=ho(
|
|
@@ -62,7 +62,7 @@ new E(He,r.file));return}if(!jo(e)){o.push(new A(e.name,He,r.file));return}retur
|
|
|
62
62
|
r,Ho(e),t,o)},"getDefaultsType"),dt=i((e,r,t,o)=>{let n={};for(let s of r)if(!(!ko(
|
|
63
63
|
s)||s.inherited))switch(s.name){default:{o.push(new Mo(e.name,s.name,e.file));break}case"\
|
|
64
64
|
preferences":{n.preferences=y(s.value,e,t,o,l);break}case"httpErrors":{n.httpErrors=
|
|
65
|
-
|
|
65
|
+
Y(s.value,e,t,o);break}case"memory":case"logRetention":case"timeout":{n[s.name]=
|
|
66
66
|
So(s);break}case"architecture":{n[s.name]=Ao(s);break}case"runtime":{n[s.name]=Io(
|
|
67
67
|
s);break}case"listener":{n.listener=Eo(s.value,o);break}}return n},"getTypeFromM\
|
|
68
68
|
embers");import{isModelProperty as Ts,isTypeObject as gs,isTypeReference as Ct,isTypeTuple as Dt}from"@ez4/reflection";
|
|
@@ -79,16 +79,16 @@ atch.`,o):r(`Path parameter ${t} is a mismatch.`,o)}static{i(this,"MismatchParam
|
|
|
79
79
|
etersTypeError")}};import{isTypeCallback as li,isTypeFunction as ui}from"@ez4/reflection";import{getFunctionSignature as di,
|
|
80
80
|
isFunctionSignature as fi}from"@ez4/common/library";import{isObjectWith as yi}from"@ez4/utils";import{IncompleteTypeError as Do}from"@ez4/common/library";var K=class extends Do{static{i(this,"IncompleteAuthorizerHandlerError")}constructor(r,t){
|
|
81
81
|
super("Incomplete authorizer handler",r,t)}};import{isModelDeclaration as qo,getModelMembers as Bo,getReferenceType as Uo,getLinkedServiceList as _o,
|
|
82
|
-
getLinkedVariableList as
|
|
83
|
-
isModelProperty as
|
|
82
|
+
getLinkedVariableList as Vo,hasHeritageType as fl}from"@ez4/common/library";import{
|
|
83
|
+
isModelProperty as Yo,isTypeReference as Qo}from"@ez4/reflection";import{isObjectWith as $o}from"@ez4/utils";import{IncompleteTypeError as Fo,InvalidTypeError as No}from"@ez4/common/library";var X=class extends No{constructor(t,o){super("Invalid provider",void 0,t,o);this.
|
|
84
84
|
baseType=t}static{i(this,"InvalidProviderTypeError")}},Z=class extends Fo{static{
|
|
85
85
|
i(this,"IncompleteProviderError")}constructor(r,t){super("Incomplete provider",r,
|
|
86
86
|
t)}};var Go="Provider";var L=i((e,r,t,o,n)=>{if(!Qo(e))return ft(e,r,t,o,n);let s=Uo(e,t);if(s)return ft(
|
|
87
87
|
s,r,t,o,n)},"getWebProviderMetadata"),Jo=i(e=>$o(e,["services"]),"isCompleteProv\
|
|
88
88
|
ider"),ft=i((e,r,t,o,n)=>{if(!qo(e)){o.push(new X(m(n,Go),r.file));return}return Ko(
|
|
89
89
|
e,Bo(e),t,o)},"getProviderType"),Ko=i((e,r,t,o)=>{let n={},s=new Set(["services"]);
|
|
90
|
-
for(let p of r)if(!(!
|
|
91
|
-
|
|
90
|
+
for(let p of r)if(!(!Yo(p)||p.inherited))switch(p.name){case"variables":{n.variables=
|
|
91
|
+
Vo(p,o);break}case"services":{(n.services=_o(p,t,o))&&s.delete(p.name);break}}if(!Jo(
|
|
92
92
|
n)){o.push(new Z([...s],e.file));return}return n},"getTypeFromMembers");import{InvalidServicePropertyError as yn,isModelDeclaration as Tn,hasHeritageType as gn,
|
|
93
93
|
getModelMembers as bn,getObjectMembers as hn,getReferenceType as Mn}from"@ez4/common/library";
|
|
94
94
|
import{isModelProperty as vn,isTypeObject as Sn,isTypeReference as Rn}from"@ez4/reflection";
|
|
@@ -133,13 +133,13 @@ e");import{isTypeIntersection as Fn,isTypeObject as Nn,isTypeReference as qn}fro
|
|
|
133
133
|
import{getReferenceType as Bn,hasHeritageType as Un,isModelDeclaration as _n}from"@ez4/common/library";import{IncorrectTypeError as Cn,InvalidTypeError as Dn}from"@ez4/common/library";var oe=class extends Dn{constructor(t,o){super("Invalid headers",void 0,t,o);this.
|
|
134
134
|
baseType=t}static{i(this,"InvalidHeadersTypeError")}},ne=class extends Cn{constructor(t,o,n){
|
|
135
135
|
super("Incorrect headers",t,o,n);this.headersType=t;this.baseType=o}static{i(this,
|
|
136
|
-
"IncorrectHeadersTypeError")}};var xe="Headers",
|
|
136
|
+
"IncorrectHeadersTypeError")}};var xe="Headers",Vn=i((e,r)=>Un(e,m(r,xe)),"isWebHeadersDeclaration"),H=i((e,r,t,o,n)=>{
|
|
137
137
|
if(!qn(e))return vt(e,r,t,o,n);let s=Bn(e,t);if(s)return vt(s,r,t,o,n)},"getWebH\
|
|
138
138
|
eadersMetadata"),vt=i((e,r,t,o,n)=>{if(Nn(e))return f(e,t);if(Fn(e))return T(e,t);
|
|
139
|
-
if(!_n(e)){o.push(new oe(m(n,xe),r.file));return}if(!
|
|
139
|
+
if(!_n(e)){o.push(new oe(m(n,xe),r.file));return}if(!Vn(e,n)){o.push(new ne(e.name,
|
|
140
140
|
m(n,xe),r.file));return}return f(e,t)},"resolveHeadersType");import{getReferenceType as $n,hasHeritageType as Gn,isModelDeclaration as Jn}from"@ez4/common/library";
|
|
141
|
-
import{isTypeIntersection as Kn,isTypeObject as Xn,isTypeReference as Zn}from"@ez4/reflection";import{IncorrectTypeError as
|
|
142
|
-
o);this.baseType=t}static{i(this,"InvalidQueryTypeError")}},se=class extends
|
|
141
|
+
import{isTypeIntersection as Kn,isTypeObject as Xn,isTypeReference as Zn}from"@ez4/reflection";import{IncorrectTypeError as Yn,InvalidTypeError as Qn}from"@ez4/common/library";var ie=class extends Qn{constructor(t,o){super("Invalid query strings",void 0,t,
|
|
142
|
+
o);this.baseType=t}static{i(this,"InvalidQueryTypeError")}},se=class extends Yn{constructor(t,o,n){
|
|
143
143
|
super("Incorrect query strings",t,o,n);this.queryType=t;this.baseType=o}static{i(
|
|
144
144
|
this,"IncorrectQueryTypeError")}};var Pe="QueryStrings",Ln=i((e,r)=>Gn(e,m(r,Pe)),"isWebQueryDeclaration"),I=i((e,r,t,o,n)=>{
|
|
145
145
|
if(!Zn(e))return St(e,r,t,o,n);let s=$n(e,t);if(s)return St(s,r,t,o,n)},"getWebQ\
|
|
@@ -161,12 +161,12 @@ return;let s={...di(e)},p=new Set(["response"]);if(e.parameters){let[{value:a},c
|
|
|
161
161
|
parameters;s.request=Oe(a,r,t,o,n),c&&(s.provider=L(c.value,r,t,o,n))}if(e.return&&
|
|
162
162
|
(s.response=ht(e.return,r,t,o,n))&&p.delete("response"),!gi(s)){o.push(new K([...p],
|
|
163
163
|
e.file));return}return s},"getAuthHandlerMetadata"),gi=i(e=>yi(e,["response"])&&
|
|
164
|
-
fi(e),"isCompleteHandler");var bi=new Set(["ANY","GET","POST","PUT","PATCH","DELETE","OPTIONS"]),Et=i(
|
|
165
|
-
r]=e.split(" ",2);return bi.has(r)},"isHttpPath");import{isTypeCallback as cs,isTypeFunction as ms}from"@ez4/reflection";import{getFunctionSignature as ls,
|
|
164
|
+
fi(e),"isCompleteHandler");var bi=new Set(["ANY","GET","POST","HEAD","PUT","PATCH","DELETE","OPTIONS"]),Et=i(
|
|
165
|
+
e=>{let[r]=e.split(" ",2);return bi.has(r)},"isHttpPath");import{isTypeCallback as cs,isTypeFunction as ms}from"@ez4/reflection";import{getFunctionSignature as ls,
|
|
166
166
|
isFunctionSignature as us}from"@ez4/common/library";import{isObjectWith as ds}from"@ez4/utils";import{IncompleteTypeError as hi}from"@ez4/common/library";var x=class extends hi{static{i(this,"IncompleteHandlerError")}constructor(r,t){
|
|
167
167
|
super("Incomplete handler",r,t)}};import{InvalidServicePropertyError as Di,isModelDeclaration as Fi,getModelMembers as Ni,
|
|
168
168
|
getObjectMembers as qi,getPropertyNumber as Bi,getPropertyNumberList as Ui,getReferenceType as _i,
|
|
169
|
-
hasHeritageType as
|
|
169
|
+
hasHeritageType as Vi}from"@ez4/common/library";import{isModelProperty as Yi,isTypeObject as Qi,
|
|
170
170
|
isTypeReference as $i}from"@ez4/reflection";import{isAnyNumber as Gi,isObjectWith as Ji}from"@ez4/utils";import{createUnionSchema as Si,getScalarSchema as Ri,createArraySchema as Hi}from"@ez4/schema/library";
|
|
171
171
|
import{getReferenceType as Ei,hasHeritageType as Ai,isModelDeclaration as Ii}from"@ez4/common/library";
|
|
172
172
|
import{isTypeArray as xi,isTypeIntersection as Pi,isTypeObject as ki,isTypeReference as Oi,
|
|
@@ -183,13 +183,13 @@ r.file));return}if(!zi(e,n)){o.push(new ce(e.name,m(n,We),e.file));return}return
|
|
|
183
183
|
e,t)},"getCompoundTypeBody"),wi=i((e,r,t)=>{let o={optional:!1,elements:[]};for(let n of e){
|
|
184
184
|
if(At(n)){o.optional=!0;continue}let s=we(n,r,t);s&&o.elements.push(s)}if(o.elements.
|
|
185
185
|
length)return Si(o)},"getUnionTypeBody"),Ci=i((e,r,t)=>{let o=we(e,r,t);if(o)return Hi(
|
|
186
|
-
{element:o})},"getArrayTypeBody");var Ce=m(l,"Response"),Ki=i(e=>
|
|
186
|
+
{element:o})},"getArrayTypeBody");var Ce=m(l,"Response"),Ki=i(e=>Vi(e,Ce),"isHttpResponseDeclaration"),Pt=i((e,r,t,o)=>{
|
|
187
187
|
if(!$i(e))return It(e,r,t,o);let n=_i(e,t);if(n)return It(n,r,t,o)},"getHttpResp\
|
|
188
188
|
onseMetadata"),Xi=i(e=>Ji(e,["status"])&&(Gi(e.status)||!!e.status.length),"isCo\
|
|
189
189
|
mpleteResponse"),It=i((e,r,t,o)=>{if(Qi(e))return xt(e,r,qi(e),t,o);if(!Fi(e)){o.
|
|
190
190
|
push(new M(Ce,r.file));return}if(!Ki(e)){o.push(new v(e.name,Ce,e.file));return}
|
|
191
191
|
return xt(e,r,Ni(e),t,o)},"getResponseType"),xt=i((e,r,t,o,n)=>{let s={};for(let p of t)
|
|
192
|
-
if(!(!
|
|
192
|
+
if(!(!Yi(p)||p.inherited))switch(p.name){default:{n.push(new Di(r.name,p.name,e.
|
|
193
193
|
file));break}case"status":{s.status=Bi(p)??Ui(p);break}case"headers":{s.headers=
|
|
194
194
|
H(p.value,e,o,n,l),s.headers&&p.description&&(s.headers.description=p.description);
|
|
195
195
|
break}case"body":{s.body=g(p.value,e,o,n,l),s.body&&p.description&&(s.body.description=
|
|
@@ -229,11 +229,11 @@ n.push(new hs(r.name,d.name,e.file));break}case"name":{p.name=jt(d);break}case"p
|
|
|
229
229
|
ath":{let ve=jt(d);ve&&Et(ve)&&(a.delete(d.name),p.path=ve);break}case"handler":{
|
|
230
230
|
(p.handler=Wt(d.value,r,o,n,s))&&a.delete(d.name);break}case"authorizer":{p.authorizer=
|
|
231
231
|
pe(d.value,r,o,n,l);break}case"preferences":{p.preferences=y(d.value,r,o,n,l);break}case"\
|
|
232
|
-
httpErrors":{p.httpErrors=
|
|
232
|
+
httpErrors":{p.httpErrors=Y(d.value,r,o,n);break}case"memory":case"logRetention":case"\
|
|
233
233
|
timeout":{p[d.name]=Rs(d);break}case"architecture":{p[d.name]=Is(d);break}case"r\
|
|
234
234
|
untime":{p[d.name]=xs(d);break}case"cors":case"disabled":{p[d.name]=Ss(d);break}case"\
|
|
235
235
|
listener":{p.listener=As(d.value,n);break}case"variables":{p.variables=vs(d,n);break}}
|
|
236
|
-
if(!js(p)){n.push(new
|
|
236
|
+
if(!js(p)){n.push(new V([...a],e.file));return}let c=zs(p.path,p.handler.request?.
|
|
237
237
|
parameters);if(c.length){n.push(new J(c,r.file));return}return p},"getTypeFromMe\
|
|
238
238
|
mbers"),zs=i((e,r)=>{let t=e.matchAll(/\{([\w_-]+)\}/g),o=[];for(let n of t){let[
|
|
239
239
|
,s]=n;r?.properties[s]||o.push(s)}return o},"getMismatchParameters");var qe=i(e=>Fs(e)&&Bs(e,m(l,"Import")),"isHttpImportDeclaration"),_t=i(e=>{let r={},
|
|
@@ -245,16 +245,16 @@ c.value),p.delete(c.name));break}case"authorization":{c.inherited||(s[c.name]=st
|
|
|
245
245
|
c.value,n,e,t));break}case"project":{!c.inherited&&(s.project=Ut(c))&&p.delete(c.
|
|
246
246
|
name);break}case"name":{c.inherited&&(s.displayName=Ut(c,e));break}case"routes":{
|
|
247
247
|
c.inherited&&(s.routes=qt(n,c,e,t))&&p.delete(c.name);break}case"defaults":{c.inherited&&
|
|
248
|
-
(s.defaults=Q(c.value,n,e,t));break}}if(!
|
|
248
|
+
(s.defaults=Q(c.value,n,e,t));break}}if(!Ys(s)){t.push(new h([...p],a));continue}
|
|
249
249
|
if(r[n.name]){t.push(new ws(n.name,a));continue}r[n.name]=s}return{services:r,errors:t}},
|
|
250
|
-
"getHttpImportsMetadata"),
|
|
251
|
-
leteService");import{DuplicateServiceError as
|
|
250
|
+
"getHttpImportsMetadata"),Ys=i(e=>Vs(e,["project","reference","routes"]),"isComp\
|
|
251
|
+
leteService");import{DuplicateServiceError as Yp,InvalidServicePropertyError as Qp,isExternalDeclaration as $p,
|
|
252
252
|
isClassDeclaration as Gp,getLinkedServiceList as Jp,getLinkedVariableList as Kp,
|
|
253
253
|
getPropertyString as Xp,getModelMembers as Zp,hasHeritageType as Lp}from"@ez4/common/library";
|
|
254
|
-
import{isModelProperty as ea}from"@ez4/reflection";import{isObjectWith as ta}from"@ez4/utils";import{getSchemaCustomValidation as Qs}from"@ez4/schema";var
|
|
254
|
+
import{isModelProperty as ea}from"@ez4/reflection";import{isObjectWith as ta}from"@ez4/utils";import{getSchemaCustomValidation as Qs}from"@ez4/schema";var Vt=i(e=>`@${e}`,"getValidatorName");var P=i((e,r)=>{let{request:t}=e;t&&("headers"in t&&t.headers&&j(r,t.headers),"q\
|
|
255
255
|
uery"in t&&t.query&&j(r,t.query),"identity"in t&&t.identity&&j(r,t.identity),"pa\
|
|
256
256
|
rameters"in t&&t.parameters&&j(r,t.parameters),"body"in t&&t.body&&j(r,t.body))},
|
|
257
|
-
"attachValidatorLinkedServices"),j=i((e,r)=>{let t=Qs(r);for(let o of t){let n=
|
|
257
|
+
"attachValidatorLinkedServices"),j=i((e,r)=>{let t=Qs(r);for(let o of t){let n=Vt(
|
|
258
258
|
o);e[n]=o}},"attachSchemaValidatorServices");var z=i((e,r,t,o)=>{let{provider:n,request:s}=e;if(n?.services){s&&P(e,n.services);
|
|
259
259
|
for(let p in n.services){let a=n.services[p],c=r[p];if(!c){r[p]=a;continue}c!==a&&
|
|
260
260
|
t.push(new C(p,o))}}},"attachProviderLinkedServices");import{InvalidServicePropertyError as Ks,isModelDeclaration as Xs,getModelMembers as Zs,
|
|
@@ -265,8 +265,8 @@ super("Incomplete access",r,t)}},le=class extends Js{static{i(this,"InvalidAcces
|
|
|
265
265
|
sTypeError")}constructor(r){super("Invalid access",void 0,"Http.Access",r)}},ue=class extends Gs{constructor(t,o){
|
|
266
266
|
super("Incorrect access",t,"Http.Access",o);this.cacheType=t}static{i(this,"Inco\
|
|
267
267
|
rrectAccessTypeError")}};var ap=i(e=>rp(e,m(l,"Access")),"isHttpAccessDeclaration"),$t=i((e,r,t,o)=>{if(!ip(
|
|
268
|
-
e))return
|
|
269
|
-
cp=i(e=>pp(e,["logRetention"]),"isCompleteAccess"),
|
|
268
|
+
e))return Yt(e,r,o);let n=tp(e,t);if(n)return Yt(n,r,o)},"getHttpAccessMetadata"),
|
|
269
|
+
cp=i(e=>pp(e,["logRetention"]),"isCompleteAccess"),Yt=i((e,r,t)=>{if(np(e))return Qt(
|
|
270
270
|
e,r,Ls(e),t);if(!Xs(e)){t.push(new le(r.file));return}if(!ap(e)){t.push(new ue(e.
|
|
271
271
|
name,e.file));return}return Qt(e,r,Zs(e),t)},"getAccessType"),Qt=i((e,r,t,o)=>{let n={},
|
|
272
272
|
s=new Set(["logRetention"]);for(let p of t)if(!(!op(p)||p.inherited))switch(p.name){default:{
|
|
@@ -296,14 +296,14 @@ S",void 0,t,o);this.baseType=t}static{i(this,"InvalidCorsTypeError")}},be=class
|
|
|
296
296
|
super("Incorrect CORS",t,o,n);this.corsType=t;this.baseType=o}static{i(this,"Inc\
|
|
297
297
|
orrectCorsTypeError")}};var Ue=m(l,"Cors"),_p=i(e=>Fp(e,Ue),"isHttpCorsDeclaration"),Lt=i((e,r,t,o)=>{if(!Bp(
|
|
298
298
|
e))return Xt(e,r,o);let n=Dp(e,t);if(n)return Xt(n,r,o)},"getHttpCorsMetadata"),
|
|
299
|
-
|
|
299
|
+
Vp=i(e=>Up(e,["allowOrigins"])&&!!e.allowOrigins.length,"isCompleteCors"),Xt=i((e,r,t)=>{
|
|
300
300
|
if(qp(e))return Zt(e,r,jp(e),t);if(!Op(e)){t.push(new ge(Ue,r.file));return}if(!_p(
|
|
301
301
|
e)){t.push(new be(e.name,Ue,e.file));return}return Zt(e,r,Wp(e),t)},"getCorsType"),
|
|
302
302
|
Zt=i((e,r,t,o)=>{let n={},s=new Set(["allowOrigins"]);for(let p of t)if(!(!Np(p)||
|
|
303
303
|
p.inherited))switch(p.name){default:{o.push(new kp(r.name,p.name,e.file));break}case"\
|
|
304
304
|
allowOrigins":case"allowMethods":case"allowHeaders":case"exposeHeaders":{n[p.name]=
|
|
305
305
|
wp(p);break}case"allowCredentials":{n.allowCredentials=zp(p);break}case"maxAge":{
|
|
306
|
-
n.maxAge=Cp(p);break}}if(!
|
|
306
|
+
n.maxAge=Cp(p);break}}if(!Vp(n)){o.push(new Te([...s],e.file));return}return n},
|
|
307
307
|
"getTypeFromMembers");var _e=i(e=>Gp(e)&&Lp(e,m(l,"Service")),"isHttpServiceDeclaration"),er=i(e=>{let r={},
|
|
308
308
|
t=[];for(let o in e){let n=e[o];if(!_e(n)||$p(n))continue;let s=tt(n.name),p=new Set(
|
|
309
309
|
["routes"]),a=n.file;n.description&&(s.description=n.description);for(let c of Zp(
|
|
@@ -313,14 +313,14 @@ s.displayName=Xp(c);break}case"defaults":{s.defaults=Q(c.value,n,e,t);break}case
|
|
|
313
313
|
cache":{s.cache=Kt(c.value,n,e,t);break}case"access":{s.access=$t(c.value,n,e,t);
|
|
314
314
|
break}case"cors":{s.cors=Lt(c.value,n,e,t);break}case"variables":{s.variables=Kp(
|
|
315
315
|
c,t);break}case"services":{s.services=Jp(c,e,t);break}}if(!ra(s)){t.push(new h([
|
|
316
|
-
...p],a));continue}if(r[n.name]){t.push(new
|
|
316
|
+
...p],a));continue}if(r[n.name]){t.push(new Yp(n.name,a));continue}oa(s,t,a),r[n.
|
|
317
317
|
name]=s}return{services:r,errors:t}},"getHttpServicesMetadata"),ra=i(e=>ta(e,["r\
|
|
318
318
|
outes","variables","services"]),"isCompleteService"),oa=i((e,r,t)=>{for(let o of e.
|
|
319
319
|
routes)z(o.handler,e.services,r,t),o.authorizer&&z(o.authorizer,e.services,r,t)},
|
|
320
320
|
"attachLinkedServices");import{DuplicateServiceError as Nc,InvalidServicePropertyError as qc,isExternalDeclaration as Bc,
|
|
321
|
-
isClassDeclaration as Uc,getLinkedServiceList as _c,getLinkedVariableList as
|
|
322
|
-
getModelMembers as
|
|
323
|
-
import{isModelProperty as $c}from"@ez4/reflection";import{isObjectWith as Gc}from"@ez4/utils";import{isModelProperty as
|
|
321
|
+
isClassDeclaration as Uc,getLinkedServiceList as _c,getLinkedVariableList as Vc,
|
|
322
|
+
getModelMembers as Yc,getPropertyString as vr,hasHeritageType as Qc}from"@ez4/common/library";
|
|
323
|
+
import{isModelProperty as $c}from"@ez4/reflection";import{isObjectWith as Gc}from"@ez4/utils";import{isModelProperty as Va,isTypeObject as Ya,isTypeReference as Qa}from"@ez4/reflection";
|
|
324
324
|
import{isObjectWith as $a}from"@ez4/utils";import{InvalidServicePropertyError as Ga,
|
|
325
325
|
getLinkedVariableList as Ja,getPropertyNumber as Ka,getObjectMembers as Xa,getModelMembers as Za,
|
|
326
326
|
getServiceListener as La,getServiceArchitecture as ec,getServiceRuntime as tc,getReferenceType as rc,
|
|
@@ -328,20 +328,20 @@ isModelDeclaration as oc,hasHeritageType as lr}from"@ez4/common/library";import{
|
|
|
328
328
|
"Incomplete target",r,t)}};import{isTypeCallback as Na,isTypeFunction as qa}from"@ez4/reflection";import{getFunctionSignature as Ba,
|
|
329
329
|
isFunctionSignature as Ua}from"@ez4/common/library";import{InvalidServicePropertyError as ia,isModelDeclaration as sa,hasHeritageType as pa,
|
|
330
330
|
getModelMembers as aa,getObjectMembers as ca,getReferenceType as ma}from"@ez4/common/library";
|
|
331
|
-
import{isModelProperty as la,isTypeObject as ua,isTypeReference as da}from"@ez4/reflection";var
|
|
331
|
+
import{isModelProperty as la,isTypeObject as ua,isTypeReference as da}from"@ez4/reflection";var Ve=m(u,"Response"),fa=i(e=>pa(e,Ve),"isWsResponseDeclaration"),or=i((e,r,t,o)=>{
|
|
332
332
|
if(!da(e))return tr(e,r,t,o);let n=ma(e,t);if(n)return tr(n,r,t,o)},"getWsRespon\
|
|
333
333
|
seMetadata"),tr=i((e,r,t,o)=>{if(ua(e))return rr(e,r,ca(e),t,o);if(!sa(e)){o.push(
|
|
334
|
-
new M(
|
|
334
|
+
new M(Ve,r.file));return}if(!fa(e)){o.push(new v(e.name,Ve,e.file));return}return rr(
|
|
335
335
|
e,r,aa(e),t,o)},"getResponseType"),rr=i((e,r,t,o,n)=>{let s={};for(let p of t)if(!(!la(
|
|
336
336
|
p)||p.inherited))switch(p.name){default:{n.push(new ia(r.name,p.name,e.file));break}case"\
|
|
337
337
|
body":{s.body=g(p.value,e,o,n,u),s.body&&p.description&&(s.body.description=p.description);
|
|
338
338
|
break}}return s},"getTypeFromMembers");import{isModelProperty as ya,isTypeIntersection as Ta,isTypeObject as ga,isTypeReference as ba}from"@ez4/reflection";
|
|
339
339
|
import{InvalidServicePropertyError as ha,isModelDeclaration as Ma,hasHeritageType as va,
|
|
340
|
-
getObjectMembers as Sa,getModelMembers as Ra,getReferenceType as Ha}from"@ez4/common/library";var
|
|
340
|
+
getObjectMembers as Sa,getModelMembers as Ra,getReferenceType as Ha}from"@ez4/common/library";var Ye=m(u,"Request"),Ea=i(e=>va(e,Ye),"isWsRequestDeclaration"),Qe=i((e,r,t,o)=>{
|
|
341
341
|
if(Ta(e)&&e.elements.length>0)return Qe(e.elements[0],r,t,o);if(!ba(e))return nr(
|
|
342
342
|
e,r,t,o);let n=Ha(e,t);if(n)return nr(n,r,t,o)},"getWsRequestMetadata"),nr=i((e,r,t,o)=>{
|
|
343
|
-
if(ga(e))return ir(e,r,Sa(e),t,o);if(!Ma(e)){o.push(new S(
|
|
344
|
-
e)){o.push(new R(e.name,
|
|
343
|
+
if(ga(e))return ir(e,r,Sa(e),t,o);if(!Ma(e)){o.push(new S(Ye,r.file));return}if(!Ea(
|
|
344
|
+
e)){o.push(new R(e.name,Ye,e.file));return}return ir(e,r,Ra(e),t,o)},"getRequest\
|
|
345
345
|
Type"),ir=i((e,r,t,o,n)=>{let s={};for(let p of t)if(!(!ya(p)||p.inherited))switch(p.
|
|
346
346
|
name){default:{n.push(new ha(r.name,p.name,e.file));break}case"identity":{s.identity=
|
|
347
347
|
b(p.value,e,o,n,u),s.identity&&p.description&&(s.identity.description=p.description);
|
|
@@ -370,9 +370,9 @@ if(e.return&&!(s.response=or(e.return,r,t,o))&&p.add("response"),p.size||!Ua(s))
|
|
|
370
370
|
o.push(new x([...p],e.file));return}return s},"getWsHandler");var nc=m(u,"Connect"),ic=m(u,"Disconnect"),sc=i(e=>oc(e)&&(lr(e,nc)||lr(e,ic)),"\
|
|
371
371
|
isWsConnectionDeclaration"),fr=i((e,r,t,o)=>{if(!Qa(e))return ur(e,r,t,o);let n=rc(
|
|
372
372
|
e,t);if(n)return ur(n,r,t,o)},"getWsConnectionMetadata"),pc=i(e=>$a(e,["handler"]),
|
|
373
|
-
"isCompleteWsConnection"),ur=i((e,r,t,o)=>{if(sc(e))return dr(e,r,Za(e),t,o);if(
|
|
373
|
+
"isCompleteWsConnection"),ur=i((e,r,t,o)=>{if(sc(e))return dr(e,r,Za(e),t,o);if(Ya(
|
|
374
374
|
e))return dr(e,r,Xa(e),t,o)},"getConnectionType"),dr=i((e,r,t,o,n)=>{let s={},p=new Set(
|
|
375
|
-
["handler"]);for(let a of t)if(!(!
|
|
375
|
+
["handler"]);for(let a of t)if(!(!Va(a)||a.inherited))switch(a.name){default:{n.
|
|
376
376
|
push(new Ga(r.name,a.name,e.file));break}case"handler":{(s.handler=ar(a.value,r,
|
|
377
377
|
o,n))&&p.delete(a.name);break}case"authorizer":{s.authorizer=pe(a.value,r,o,n,u);
|
|
378
378
|
break}case"preferences":{s.preferences=y(a.value,r,o,n,u);break}case"memory":case"\
|
|
@@ -409,14 +409,14 @@ ariables":{s.variables=Ic(a,n);break}}if(!Fc(s)){n.push(new k([...p],e.file));re
|
|
|
409
409
|
return s},"getTypeFromMembers");var Ke=i(e=>Uc(e)&&Qc(e,m(u,"Service")),"isWsServiceDeclaration"),Sr=i(e=>{let r={},
|
|
410
410
|
t=[];for(let o in e){let n=e[o];if(!Ke(n)||Bc(n))continue;let s=Le(n.name),p=new Set(
|
|
411
411
|
["schema","connect","disconnect","message"]),a=n.file;n.description&&(s.description=
|
|
412
|
-
n.description);for(let c of
|
|
412
|
+
n.description);for(let c of Yc(n,!0))if($c(c))switch(c.name){default:{t.push(new qc(
|
|
413
413
|
s.name,c.name,a));break}case"client":break;case"name":{c.inherited||(s.displayName=
|
|
414
414
|
vr(c));break}case"stage":{c.inherited||(s.stageName=vr(c));break}case"defaults":{
|
|
415
415
|
c.inherited||(s.defaults=gr(c.value,n,e,t));break}case"schema":{(s.schema=g(c.value,
|
|
416
416
|
n,e,t,u))&&p.delete(c.name);break}case"connect":case"disconnect":{!c.inherited&&
|
|
417
417
|
(s[c.name]=fr(c.value,n,e,t))&&p.delete(c.name);break}case"message":{!c.inherited&&
|
|
418
418
|
(s[c.name]=Mr(c.value,n,e,t))&&p.delete(c.name);break}case"variables":{c.inherited?
|
|
419
|
-
s.variables={}:s.variables=
|
|
419
|
+
s.variables={}:s.variables=Vc(c,t);break}case"services":{c.inherited?s.services=
|
|
420
420
|
{}:s.services=_c(c,e,t);break}}if(!Jc(s)){t.push(new h([...p],a));continue}if(r[n.
|
|
421
421
|
name]){t.push(new Nc(n.name,a));continue}Kc(s,t,a),r[n.name]=s}return{services:r,
|
|
422
422
|
errors:t}},"getWsServicesMetadata"),Jc=i(e=>Gc(e,["schema","connect","disconnect",
|
|
@@ -436,7 +436,7 @@ request?.headers;if(!t||!r)return!1;let o=Lc(t,r);return!(!o||o.optional)},"shou
|
|
|
436
436
|
ldUseAuthorization");export{F as HttpImportType,l as HttpNamespaceType,D as HttpServiceType,me as IncompleteAccessError,
|
|
437
437
|
N as IncompleteAuthorizationError,K as IncompleteAuthorizerHandlerError,de as IncompleteCacheError,
|
|
438
438
|
Te as IncompleteCorsError,x as IncompleteHandlerError,Z as IncompleteProviderError,
|
|
439
|
-
|
|
439
|
+
V as IncompleteRouteError,h as IncompleteServiceError,k as IncompleteTargetError,
|
|
440
440
|
ue as IncorrectAccessTypeError,B as IncorrectAuthorizationTypeError,ce as IncorrectBodyTypeError,
|
|
441
441
|
ye as IncorrectCacheTypeError,be as IncorrectCorsTypeError,A as IncorrectDefaultsTypeError,
|
|
442
442
|
Me as IncorrectEventTypeError,ne as IncorrectHeadersTypeError,te as IncorrectIdentityTypeError,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type HttpVerb = 'ANY' | 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS';
|
|
1
|
+
export type HttpVerb = 'ANY' | 'GET' | 'POST' | 'HEAD' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS';
|
|
2
2
|
export type HttpPath = `${HttpVerb} /${string}`;
|