@ez4/gateway 0.37.0 → 0.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/library.cjs +250 -243
- package/dist/library.mjs +363 -354
- package/dist/metadata/http/defaults.d.ts +1 -1
- package/dist/metadata/http/types.d.ts +5 -9
- package/dist/metadata/ws/types.d.ts +6 -16
- package/dist/services/defaults.d.ts +9 -0
- package/dist/services/http/contract.d.ts +1 -1
- package/dist/services/http/incoming.d.ts +5 -1
- package/dist/services/target.d.ts +9 -0
- package/dist/services/ws/incoming.d.ts +5 -1
- package/dist/utils.cjs +10 -10
- package/dist/utils.mjs +26 -26
- package/package.json +8 -8
package/dist/library.mjs
CHANGED
|
@@ -1,205 +1,207 @@
|
|
|
1
|
-
var Ht=Object.defineProperty;var i=(e,t)=>Ht(e,"name",{value:t,configurable:!0});import{registerTriggers as
|
|
2
|
-
import{tryCreateTrigger as Ze}from"@ez4/project/library";import{createServiceMetadata as Et}from"@ez4/project/library";var w="@ez4/ws",u="Ws",
|
|
3
|
-
services:{}}),"createWsService");import{DuplicateServiceError as
|
|
4
|
-
isClassDeclaration as
|
|
5
|
-
hasHeritageType as
|
|
6
|
-
import{isObjectWith as
|
|
1
|
+
var Ht=Object.defineProperty;var i=(e,t)=>Ht(e,"name",{value:t,configurable:!0});import{registerTriggers as Xc}from"@ez4/common/library";import{registerTriggers as Zc}from"@ez4/schema/library";
|
|
2
|
+
import{tryCreateTrigger as Ze}from"@ez4/project/library";import{createServiceMetadata as Et}from"@ez4/project/library";var w="@ez4/ws",u="Ws",om=i(e=>e.type===w,"isWsService"),Le=i(e=>({...Et(w,e),variables:{},
|
|
3
|
+
services:{}}),"createWsService");import{DuplicateServiceError as ws,InvalidServicePropertyError as Cs,isExternalDeclaration as Ds,
|
|
4
|
+
isClassDeclaration as Fs,getModelMembers as Ns,getPropertyString as _r,getReferenceName as qs,
|
|
5
|
+
hasHeritageType as Bs}from"@ez4/common/library";import{isModelProperty as Us,isTypeReference as _s}from"@ez4/reflection";
|
|
6
|
+
import{isObjectWith as Ys}from"@ez4/utils";import{IncompleteTypeError as It,TypeCollisionError as xt}from"@ez4/common/library";var h=class extends It{static{i(this,"IncompleteServiceError")}constructor(t,r){
|
|
7
7
|
super("Incomplete service",t,r)}},C=class extends xt{static{i(this,"ServiceColli\
|
|
8
|
-
sionError")}constructor(t,r){super("Service error",t,r)}};var m=i((e,t)=>`${e}.${t}`,"getFullTypeName"),er=i(e=>`@${e}`,"getValidatorName");import{createServiceMetadata as rr}from"@ez4/project/library";var D="@ez4/http",F="@ez4/import:http",l="Http",
|
|
8
|
+
sionError")}constructor(t,r){super("Service error",t,r)}};var m=i((e,t)=>`${e}.${t}`,"getFullTypeName"),er=i(e=>`@${e}`,"getValidatorName");import{createServiceMetadata as rr}from"@ez4/project/library";var D="@ez4/http",F="@ez4/import:http",l="Http",um=i(e=>e.type===D,"isHttpServic\
|
|
9
9
|
e"),tr=i(e=>({...rr(D,e),variables:{},services:{}}),"createHttpService"),or=i(e=>e.
|
|
10
|
-
type===F,"isHttpImport"),nr=i(e=>rr(F,e),"createHttpImport");import{InvalidServicePropertyError as Ot,isModelDeclaration as
|
|
10
|
+
type===F,"isHttpImport"),nr=i(e=>rr(F,e),"createHttpImport");import{InvalidServicePropertyError as Ot,isModelDeclaration as Wt,getObjectMembers as jt,
|
|
11
11
|
getModelMembers as zt,getReferenceType as wt,getPropertyStringIn as Ct,getPropertyString as Dt,
|
|
12
12
|
hasHeritageType as Ft}from"@ez4/common/library";import{isModelProperty as Nt,isTypeObject as qt,
|
|
13
|
-
isTypeReference as Bt}from"@ez4/reflection";import{isAnyString as
|
|
14
|
-
super("Incomplete authorization",t,r)}},q=class extends
|
|
13
|
+
isTypeReference as Bt}from"@ez4/reflection";import{isAnyString as Ut,isObjectWith as _t}from"@ez4/utils";import{IncompleteTypeError as At,IncorrectTypeError as Pt,InvalidTypeError as kt}from"@ez4/common/library";var N=class extends At{static{i(this,"IncompleteAuthorizationError")}constructor(t,r){
|
|
14
|
+
super("Incomplete authorization",t,r)}},q=class extends kt{constructor(r,o){super(
|
|
15
15
|
"Invalid authorization",void 0,r,o);this.baseType=r}static{i(this,"InvalidAuthor\
|
|
16
16
|
izationTypeError")}},B=class extends Pt{constructor(r,o,n){super("Incorrect auth\
|
|
17
17
|
orization",r,o,n);this.authorizationType=r;this.baseType=o}static{i(this,"Incorr\
|
|
18
18
|
ectAuthorizationTypeError")}};var Se=m(l,"Authorization"),Yt=i(e=>Ft(e,Se),"isHttpAuthorizationDeclaration"),pr=i(
|
|
19
19
|
(e,t,r,o)=>{if(!Bt(e))return ir(e,t,o);let n=wt(e,r);if(n)return ir(n,t,o)},"get\
|
|
20
|
-
HttpAuthorizationMetadata"),Vt=i(e=>
|
|
21
|
-
(e,t,r)=>{if(qt(e))return sr(e,t,jt(e),r);if(!
|
|
20
|
+
HttpAuthorizationMetadata"),Vt=i(e=>_t(e,["value"]),"isCompleteAuthorization"),ir=i(
|
|
21
|
+
(e,t,r)=>{if(qt(e))return sr(e,t,jt(e),r);if(!Wt(e)){r.push(new q(Se,t.file));return}
|
|
22
22
|
if(!Yt(e)){r.push(new B(e.name,Se,t.file));return}return sr(e,t,zt(e),r)},"getTy\
|
|
23
23
|
peAuthorization"),sr=i((e,t,r,o)=>{let n=new Set(["value"]),s={type:"bearer",header:"\
|
|
24
|
-
authorization"};for(let p of r)if(Nt(p))switch(p.name){default:o.push(new Ot(t.
|
|
25
|
-
p.name,t.file));break
|
|
26
|
-
header":{let a=Dt(p);
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
hasHeritageType as
|
|
30
|
-
isTypeReference as Wo}from"@ez4/reflection";import{IncorrectTypeError as Qt,InvalidTypeError as $t}from"@ez4/common/library";var E=class extends $t{constructor(r,o){super("Invalid defaults",void 0,r,o);this.
|
|
24
|
+
authorization"};for(let p of r)if(Nt(p))switch(p.name){default:{o.push(new Ot(t.
|
|
25
|
+
name,p.name,t.file));break}case"type":{s.type=Ct(p,["bearer"]);break}case"value":case"\
|
|
26
|
+
header":{let a=Dt(p);Ut(a)&&(s[p.name]=a,n.delete(p.name));break}}if(!Vt(s)){o.push(
|
|
27
|
+
new N([...n],e.file));return}return s},"getTypeFromMembers");import{InvalidServicePropertyError as Mo,isModelDeclaration as vo,getPropertyNumber as So,
|
|
28
|
+
getObjectMembers as Ro,getModelMembers as Ho,getServiceListener as Eo,getServiceArchitecture as Io,
|
|
29
|
+
getServiceRuntime as xo,tryGetReferenceType as Ao,hasHeritageType as Po}from"@ez4/common/library";
|
|
30
|
+
import{isModelProperty as ko,isTypeObject as Oo,isTypeReference as Wo}from"@ez4/reflection";import{IncorrectTypeError as Qt,InvalidTypeError as $t}from"@ez4/common/library";var E=class extends $t{constructor(r,o){super("Invalid defaults",void 0,r,o);this.
|
|
31
31
|
baseType=r}static{i(this,"InvalidDefaultsTypeError")}},I=class extends Qt{constructor(r,o,n){
|
|
32
32
|
super("Incorrect defaults",r,o,n);this.defaultsType=r;this.baseType=o}static{i(this,
|
|
33
33
|
"IncorrectDefaultsTypeError")}};import{InvalidServicePropertyError as Kt,isModelDeclaration as Xt,getObjectMembers as Zt,
|
|
34
34
|
getModelMembers as Lt,getReferenceType as eo,getPropertyStringIn as ro,hasHeritageType as to}from"@ez4/common/library";
|
|
35
35
|
import{isModelProperty as oo,isTypeObject as no,isTypeReference as io}from"@ez4/reflection";
|
|
36
|
-
import{NamingStyle as O}from"@ez4/schema";import{IncorrectTypeError as Gt,InvalidTypeError as Jt}from"@ez4/common/library";var
|
|
37
|
-
this.baseType=r}static{i(this,"InvalidPreferencesTypeError")}},
|
|
36
|
+
import{NamingStyle as O}from"@ez4/schema";import{IncorrectTypeError as Gt,InvalidTypeError as Jt}from"@ez4/common/library";var U=class extends Jt{constructor(r,o){super("Invalid preferences",void 0,r,o);
|
|
37
|
+
this.baseType=r}static{i(this,"InvalidPreferencesTypeError")}},_=class extends Gt{constructor(r,o,n){
|
|
38
38
|
super("Incorrect preferences",r,o,n);this.preferencesType=r;this.baseType=o}static{
|
|
39
39
|
i(this,"IncorrectPreferencesTypeError")}};var Re="Preferences",so=i((e,t)=>to(e,m(t,Re)),"isWebPreferencesDeclaration"),y=i(
|
|
40
40
|
(e,t,r,o,n)=>{if(!io(e))return ar(e,t,o,n);let s=eo(e,r);if(s)return ar(s,t,o,n)},
|
|
41
41
|
"getWebPreferencesMetadata"),ar=i((e,t,r,o)=>{if(no(e))return cr(t,Zt(e),r);if(!Xt(
|
|
42
|
-
e)){r.push(new
|
|
42
|
+
e)){r.push(new U(m(o,Re),t.file));return}if(!so(e,o)){r.push(new _(e.name,m(o,Re),
|
|
43
43
|
t.file));return}return cr(t,Lt(e),r)},"getPreferencesType"),cr=i((e,t,r)=>{let o={};
|
|
44
|
-
for(let n of t)if(oo(n))switch(n.name){default:r.push(new Kt(e.name,n.name,e.file));
|
|
45
|
-
break
|
|
46
|
-
O.SnakeCase,O.KebabCase]);break}return o},"getTypeFromMembers");import{InvalidServicePropertyError as co,getObjectMembers as mo,getPropertyTuple as lo,
|
|
44
|
+
for(let n of t)if(oo(n))switch(n.name){default:{r.push(new Kt(e.name,n.name,e.file));
|
|
45
|
+
break}case"namingStyle":{o.namingStyle=ro(n,[O.Preserve,O.CamelCase,O.PascalCase,
|
|
46
|
+
O.SnakeCase,O.KebabCase]);break}}return o},"getTypeFromMembers");import{InvalidServicePropertyError as co,getObjectMembers as mo,getPropertyTuple as lo,
|
|
47
47
|
getReferenceType as lr}from"@ez4/common/library";import{isModelProperty as uo,isTypeClass as fo,
|
|
48
48
|
isTypeObject as yo,isTypeReference as ur}from"@ez4/reflection";import{isAnyNumber as To,
|
|
49
49
|
isEmptyObject as go}from"@ez4/utils";import{IncompleteTypeError as po,TypeError as ao}from"@ez4/common/library";var Y=class extends po{static{i(this,"IncompleteRouteError")}constructor(t,r){super(
|
|
50
|
-
"Incomplete route",t,r)}},
|
|
50
|
+
"Incomplete route",t,r)}},W=class extends ao{static{i(this,"InvalidRouteErrorTyp\
|
|
51
51
|
eError")}constructor(t){super("Invalid route error type.",t)}};var V=i((e,t,r,o)=>{if(!ur(e))return mr(e,t,r,o);let n=lr(e,r);if(n)return mr(n,
|
|
52
52
|
t,r,o)},"getHttpErrorsMetadata"),mr=i((e,t,r,o)=>{if(yo(e))return bo(e,t,mo(e),r,
|
|
53
53
|
o)},"getErrorsType"),bo=i((e,t,r,o,n)=>{let s={};for(let p of r){if(!uo(p)||p.inherited)
|
|
54
54
|
continue;let a=parseInt(p.name,10);To(a)||n.push(new co(t.name,p.name,e.file));let c=ho(
|
|
55
55
|
p,a,t,o,n);c&&Object.assign(s,c)}if(!go(s))return s},"getTypeFromMembers"),ho=i(
|
|
56
|
-
(e,t,r,o,n)=>{let s=lo(e)??[],p={};for(let a of s){if(!ur(a)){n.push(new
|
|
57
|
-
continue}let c=lr(a,o);if(!c||!fo(c)){n.push(new
|
|
58
|
-
return p},"getErrorClasses");var He=m(l,"Defaults"),
|
|
59
|
-
if(!Wo(e))return dr(e,t,r,o);let n=
|
|
60
|
-
ultsMetadata"),dr=i((e,t,r,o)=>{if(
|
|
61
|
-
new E(He,t.file));return}if(!
|
|
62
|
-
t,
|
|
63
|
-
s)||s.inherited))switch(s.name){default:o.push(new Mo(e.name,s.name,e.file));break
|
|
64
|
-
preferences":n.preferences=y(s.value,e,r,o,l);break
|
|
65
|
-
V(s.value,e,r,o);break
|
|
66
|
-
s);break
|
|
67
|
-
|
|
68
|
-
import{
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
56
|
+
(e,t,r,o,n)=>{let s=lo(e)??[],p={};for(let a of s){if(!ur(a)){n.push(new W(r.file));
|
|
57
|
+
continue}let c=lr(a,o);if(!c||!fo(c)){n.push(new W(r.file));continue}p[c.name]=t}
|
|
58
|
+
return p},"getErrorClasses");var He=m(l,"Defaults"),jo=i(e=>Po(e,He),"isHttpDefaultsDeclaration"),Q=i((e,t,r,o)=>{
|
|
59
|
+
if(!Wo(e))return dr(e,t,r,o);let n=Ao(e,r);if(n)return dr(n,t,r,o)},"getHttpDefa\
|
|
60
|
+
ultsMetadata"),dr=i((e,t,r,o)=>{if(Oo(e))return fr(t,Ro(e),r,o);if(!vo(e)){o.push(
|
|
61
|
+
new E(He,t.file));return}if(!jo(e)){o.push(new I(e.name,He,t.file));return}return fr(
|
|
62
|
+
t,Ho(e),r,o)},"getDefaultsType"),fr=i((e,t,r,o)=>{let n={};for(let s of t)if(!(!ko(
|
|
63
|
+
s)||s.inherited))switch(s.name){default:{o.push(new Mo(e.name,s.name,e.file));break}case"\
|
|
64
|
+
preferences":{n.preferences=y(s.value,e,r,o,l);break}case"httpErrors":{n.httpErrors=
|
|
65
|
+
V(s.value,e,r,o);break}case"memory":case"logRetention":case"timeout":{n[s.name]=
|
|
66
|
+
So(s);break}case"architecture":{n[s.name]=Io(s);break}case"runtime":{n[s.name]=xo(
|
|
67
|
+
s);break}case"listener":{n.listener=Eo(s.value,o);break}}return n},"getTypeFromM\
|
|
68
|
+
embers");import{isModelProperty as Ts,isTypeObject as gs,isTypeReference as Dr,isTypeTuple as Fr}from"@ez4/reflection";
|
|
69
|
+
import{isObjectWith as bs}from"@ez4/utils";import{InvalidServicePropertyError as hs,
|
|
70
|
+
isModelDeclaration as Ms,getLinkedVariableList as vs,getPropertyBoolean as Ss,getPropertyNumber as Rs,
|
|
71
|
+
getPropertyString as zr,getObjectMembers as Hs,getModelMembers as Es,getServiceListener as Is,
|
|
72
|
+
getServiceArchitecture as xs,getServiceRuntime as As,getReferenceType as Nr,getPropertyTuple as Ps,
|
|
73
|
+
hasHeritageType as ks}from"@ez4/common/library";import{IncorrectTypeError as zo,InvalidTypeError as wo,TypeError as Co}from"@ez4/common/library";var $=class extends wo{constructor(r,o){super("Invalid path parameters",void 0,r,
|
|
74
|
+
o);this.baseType=r}static{i(this,"InvalidParameterTypeError")}},G=class extends zo{constructor(r,o,n){
|
|
73
75
|
super("Incorrect path parameters",r,o,n);this.parametersType=r;this.baseType=o}static{
|
|
74
|
-
i(this,"IncorrectParameterTypeError")}},J=class extends
|
|
75
|
-
...
|
|
76
|
+
i(this,"IncorrectParameterTypeError")}},J=class extends Co{constructor(r,o){var t=(...il)=>(super(
|
|
77
|
+
...il),this.parameterNames=r,this);r.length>1?t(`Path parameters ${r} are a mism\
|
|
76
78
|
atch.`,o):t(`Path parameter ${r} is a mismatch.`,o)}static{i(this,"MismatchParam\
|
|
77
|
-
etersTypeError")}};import{isTypeCallback as
|
|
78
|
-
isFunctionSignature as
|
|
79
|
-
super("Incomplete authorizer handler",t,r)}};import{isModelDeclaration as
|
|
80
|
-
getLinkedVariableList as
|
|
81
|
-
isModelProperty as
|
|
82
|
-
baseType=r}static{i(this,"InvalidProviderTypeError")}},Z=class extends
|
|
79
|
+
etersTypeError")}};import{isTypeCallback as li,isTypeFunction as ui}from"@ez4/reflection";import{getFunctionSignature as di,
|
|
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(t,r){
|
|
81
|
+
super("Incomplete authorizer handler",t,r)}};import{isModelDeclaration as qo,getModelMembers as Bo,getReferenceType as Uo,getLinkedServiceList as _o,
|
|
82
|
+
getLinkedVariableList as Yo,hasHeritageType as fl}from"@ez4/common/library";import{
|
|
83
|
+
isModelProperty as Vo,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(r,o){super("Invalid provider",void 0,r,o);this.
|
|
84
|
+
baseType=r}static{i(this,"InvalidProviderTypeError")}},Z=class extends Fo{static{
|
|
83
85
|
i(this,"IncompleteProviderError")}constructor(t,r){super("Incomplete provider",t,
|
|
84
|
-
r)}};var
|
|
85
|
-
s,t,r,o,n)},"getWebProviderMetadata")
|
|
86
|
-
ider"),yr=i((e,t,r,o,n)=>{if(!
|
|
87
|
-
e,
|
|
88
|
-
for(let p of t)if(!(!
|
|
89
|
-
|
|
90
|
-
n))
|
|
91
|
-
getModelMembers as
|
|
92
|
-
import{isModelProperty as
|
|
93
|
-
import{isObjectWith as
|
|
94
|
-
baseType=r}static{i(this,"InvalidResponseTypeError")}},v=class extends
|
|
86
|
+
r)}};var Go="Provider";var L=i((e,t,r,o,n)=>{if(!Qo(e))return yr(e,t,r,o,n);let s=Uo(e,r);if(s)return yr(
|
|
87
|
+
s,t,r,o,n)},"getWebProviderMetadata"),Jo=i(e=>$o(e,["services"]),"isCompleteProv\
|
|
88
|
+
ider"),yr=i((e,t,r,o,n)=>{if(!qo(e)){o.push(new X(m(n,Go),t.file));return}return Ko(
|
|
89
|
+
e,Bo(e),r,o)},"getProviderType"),Ko=i((e,t,r,o)=>{let n={},s=new Set(["services"]);
|
|
90
|
+
for(let p of t)if(!(!Vo(p)||p.inherited))switch(p.name){case"variables":{n.variables=
|
|
91
|
+
Yo(p,o);break}case"services":{(n.services=_o(p,r,o))&&s.delete(p.name);break}}if(!Jo(
|
|
92
|
+
n)){o.push(new Z([...s],e.file));return}return n},"getTypeFromMembers");import{InvalidServicePropertyError as yn,isModelDeclaration as Tn,hasHeritageType as gn,
|
|
93
|
+
getModelMembers as bn,getObjectMembers as hn,getReferenceType as Mn}from"@ez4/common/library";
|
|
94
|
+
import{isModelProperty as vn,isTypeObject as Sn,isTypeReference as Rn}from"@ez4/reflection";
|
|
95
|
+
import{isObjectWith as Hn}from"@ez4/utils";import{IncorrectTypeError as Xo,InvalidTypeError as Zo}from"@ez4/common/library";var M=class extends Zo{constructor(r,o){super("Invalid response",void 0,r,o);this.
|
|
96
|
+
baseType=r}static{i(this,"InvalidResponseTypeError")}},v=class extends Xo{constructor(r,o,n){
|
|
95
97
|
super("Incorrect response",r,o,n);this.responseType=r;this.baseType=o}static{i(this,
|
|
96
|
-
"IncorrectResponseTypeError")}};import{getReferenceType as
|
|
97
|
-
import{isTypeIntersection as
|
|
98
|
-
isTypeUnion as
|
|
99
|
-
baseType=r}static{i(this,"InvalidIdentityTypeError")}},re=class extends
|
|
98
|
+
"IncorrectResponseTypeError")}};import{getReferenceType as on,hasHeritageType as nn,isModelDeclaration as sn}from"@ez4/common/library";
|
|
99
|
+
import{isTypeIntersection as pn,isTypeObject as an,isTypeReference as cn,isTypeUndefined as mn,
|
|
100
|
+
isTypeUnion as ln}from"@ez4/reflection";import{createUnionSchema as un}from"@ez4/schema/library";import{IncorrectTypeError as Lo,InvalidTypeError as en}from"@ez4/common/library";var ee=class extends en{constructor(r,o){super("Invalid identity",void 0,r,o);this.
|
|
101
|
+
baseType=r}static{i(this,"InvalidIdentityTypeError")}},re=class extends Lo{constructor(r,o,n){
|
|
100
102
|
super("Incorrect identity",r,o,n);this.identityType=r;this.baseType=o}static{i(this,
|
|
101
|
-
"IncorrectIdentityTypeError")}};import{getIntersectionSchema as
|
|
102
|
-
import{isObjectSchema as Tr}from"@ez4/schema";var T=i((e,t)=>{let r=
|
|
103
|
-
f=i((e,t)=>{let r=
|
|
104
|
-
if(
|
|
105
|
-
r,o,n)},"getAuthIdentityMetadata"),gr=i((e,t,r,o,n)=>{if(
|
|
106
|
-
e))return
|
|
107
|
-
m(n,Ee),t.file));return}if(!
|
|
103
|
+
"IncorrectIdentityTypeError")}};import{getIntersectionSchema as rn,getObjectSchema as tn}from"@ez4/schema/library";
|
|
104
|
+
import{isObjectSchema as Tr}from"@ez4/schema";var T=i((e,t)=>{let r=rn(e,t);if(r&&Tr(r))return r},"getSchemaFromIntersection"),
|
|
105
|
+
f=i((e,t)=>{let r=tn(e,t);if(r&&Tr(r))return r},"getSchemaFromObject");var Ee="Identity",dn=i((e,t)=>nn(e,m(t,Ee)),"isAuthIdentityDeclaration"),b=i((e,t,r,o,n)=>{
|
|
106
|
+
if(mn(e))return;if(!cn(e))return gr(e,t,r,o,n);let s=on(e,r);if(s)return gr(s,t,
|
|
107
|
+
r,o,n)},"getAuthIdentityMetadata"),gr=i((e,t,r,o,n)=>{if(an(e))return f(e,r);if(ln(
|
|
108
|
+
e))return fn(e.elements,t,r,o,n);if(pn(e))return T(e,r);if(!sn(e)){o.push(new ee(
|
|
109
|
+
m(n,Ee),t.file));return}if(!dn(e,n)){o.push(new re(e.name,m(n,Ee),t.file));return}
|
|
108
110
|
let s=f(e,r);return s&&(s.definitions={...s.definitions,extensible:!0}),s},"getI\
|
|
109
|
-
dentityType"),
|
|
110
|
-
s.push(a)}return s.length>1?
|
|
111
|
-
(e,t,r,o,n)=>{if(!
|
|
112
|
-
o,n)},"getAuthResponseMetadata"),
|
|
113
|
-
br=i((e,t,r,o,n)=>{if(
|
|
114
|
-
n,Ie),t.file));return}if(!
|
|
115
|
-
e,t,
|
|
116
|
-
if(!(!
|
|
117
|
-
break
|
|
118
|
-
identity.description=a.description);break}}if(
|
|
119
|
-
|
|
120
|
-
import{InvalidServicePropertyError as
|
|
121
|
-
getObjectMembers as
|
|
122
|
-
baseType=r}static{i(this,"InvalidRequestTypeError")}},R=class extends
|
|
111
|
+
dentityType"),fn=i((e,t,r,o,n)=>{let s=[];for(let p of e){let a=b(p,t,r,o,n);a&&
|
|
112
|
+
s.push(a)}return s.length>1?un({elements:s}):s[0]},"getIdentityFromUnion");var Ie="AuthResponse",En=i((e,t)=>gn(e,m(t,Ie)),"isAuthResponseDeclaration"),Mr=i(
|
|
113
|
+
(e,t,r,o,n)=>{if(!Rn(e))return br(e,t,r,o,n);let s=Mn(e,r);if(s)return br(s,t,r,
|
|
114
|
+
o,n)},"getAuthResponseMetadata"),In=i(e=>Hn(e,["identity"]),"isCompleteResponse"),
|
|
115
|
+
br=i((e,t,r,o,n)=>{if(Sn(e))return hr(e,t,hn(e),r,o,n);if(!Tn(e)){o.push(new M(m(
|
|
116
|
+
n,Ie),t.file));return}if(!En(e,n)){o.push(new v(e.name,m(n,Ie),e.file));return}return hr(
|
|
117
|
+
e,t,bn(e),r,o,n)},"getResponseType"),hr=i((e,t,r,o,n,s)=>{let p={};for(let a of r)
|
|
118
|
+
if(!(!vn(a)||a.inherited))switch(a.name){default:{n.push(new yn(t.name,a.name,e.
|
|
119
|
+
file));break}case"identity":{p.identity=b(a.value,e,o,n,s),p.identity&&a.description&&
|
|
120
|
+
(p.identity.description=a.description);break}}if(In(p))return p},"getTypeFromMem\
|
|
121
|
+
bers");import{isModelProperty as ei,isTypeIntersection as ri,isTypeObject as ti,isTypeReference as oi}from"@ez4/reflection";
|
|
122
|
+
import{InvalidServicePropertyError as ni,isModelDeclaration as ii,hasHeritageType as si,
|
|
123
|
+
getObjectMembers as pi,getModelMembers as ai,getReferenceType as ci}from"@ez4/common/library";import{IncorrectTypeError as xn,InvalidTypeError as An}from"@ez4/common/library";var S=class extends An{constructor(r,o){super("Invalid request",void 0,r,o);this.
|
|
124
|
+
baseType=r}static{i(this,"InvalidRequestTypeError")}},R=class extends xn{constructor(r,o,n){
|
|
123
125
|
super("Incorrect request",r,o,n);this.requestType=r;this.baseType=o}static{i(this,
|
|
124
|
-
"IncorrectRequestTypeError")}};import{isTypeIntersection as
|
|
125
|
-
import{getReferenceType as Wn,hasHeritageType as
|
|
126
|
-
te=i((e,t,r,o,n)=>{if(!
|
|
127
|
-
t,r,o,n)},"getWebParametersMetadata"),vr=i((e,t,r,o,n)=>{if(
|
|
128
|
-
if(
|
|
126
|
+
"IncorrectRequestTypeError")}};import{isTypeIntersection as Pn,isTypeObject as kn,isTypeReference as On}from"@ez4/reflection";
|
|
127
|
+
import{getReferenceType as Wn,hasHeritageType as jn,isModelDeclaration as zn}from"@ez4/common/library";var xe="PathParameters",wn=i((e,t)=>jn(e,m(t,xe)),"isWebParametersDeclaration"),
|
|
128
|
+
te=i((e,t,r,o,n)=>{if(!On(e))return vr(e,t,r,o,n);let s=Wn(e,r);if(s)return vr(s,
|
|
129
|
+
t,r,o,n)},"getWebParametersMetadata"),vr=i((e,t,r,o,n)=>{if(kn(e))return f(e,r);
|
|
130
|
+
if(Pn(e))return T(e,r);if(!zn(e)){o.push(new $(m(n,xe),t.file));return}if(!wn(e,
|
|
129
131
|
n)){o.push(new G(e.name,m(n,xe),e.file));return}return f(e,r)},"getParametersTyp\
|
|
130
|
-
e");import{isTypeIntersection as
|
|
131
|
-
import{getReferenceType as
|
|
132
|
-
baseType=r}static{i(this,"InvalidHeadersTypeError")}},ne=class extends
|
|
132
|
+
e");import{isTypeIntersection as Fn,isTypeObject as Nn,isTypeReference as qn}from"@ez4/reflection";
|
|
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(r,o){super("Invalid headers",void 0,r,o);this.
|
|
134
|
+
baseType=r}static{i(this,"InvalidHeadersTypeError")}},ne=class extends Cn{constructor(r,o,n){
|
|
133
135
|
super("Incorrect headers",r,o,n);this.headersType=r;this.baseType=o}static{i(this,
|
|
134
|
-
"IncorrectHeadersTypeError")}};var Ae="Headers",
|
|
135
|
-
if(!
|
|
136
|
-
eadersMetadata"),Sr=i((e,t,r,o,n)=>{if(
|
|
137
|
-
if(!
|
|
138
|
-
m(n,Ae),t.file));return}return f(e,r)},"resolveHeadersType");import{getReferenceType as
|
|
139
|
-
import{isTypeIntersection as
|
|
140
|
-
o);this.baseType=r}static{i(this,"InvalidQueryTypeError")}},se=class extends
|
|
136
|
+
"IncorrectHeadersTypeError")}};var Ae="Headers",Yn=i((e,t)=>Un(e,m(t,Ae)),"isWebHeadersDeclaration"),H=i((e,t,r,o,n)=>{
|
|
137
|
+
if(!qn(e))return Sr(e,t,r,o,n);let s=Bn(e,r);if(s)return Sr(s,t,r,o,n)},"getWebH\
|
|
138
|
+
eadersMetadata"),Sr=i((e,t,r,o,n)=>{if(Nn(e))return f(e,r);if(Fn(e))return T(e,r);
|
|
139
|
+
if(!_n(e)){o.push(new oe(m(n,Ae),t.file));return}if(!Yn(e,n)){o.push(new ne(e.name,
|
|
140
|
+
m(n,Ae),t.file));return}return f(e,r)},"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 Vn,InvalidTypeError as Qn}from"@ez4/common/library";var ie=class extends Qn{constructor(r,o){super("Invalid query strings",void 0,r,
|
|
142
|
+
o);this.baseType=r}static{i(this,"InvalidQueryTypeError")}},se=class extends Vn{constructor(r,o,n){
|
|
141
143
|
super("Incorrect query strings",r,o,n);this.queryType=r;this.baseType=o}static{i(
|
|
142
|
-
this,"IncorrectQueryTypeError")}};var Pe="QueryStrings",
|
|
143
|
-
if(!
|
|
144
|
-
ueryMetadata"),Rr=i((e,t,r,o,n)=>{if(
|
|
145
|
-
if(
|
|
146
|
-
m(n,Pe),t.file));return}return f(e,r)},"getQueryType");var
|
|
147
|
-
(e,t,r,o,n)=>{if(
|
|
148
|
-
e))return Hr(e,t,r,o,n);let s=
|
|
149
|
-
Metadata"),Hr=i((e,t,r,o,n)=>{if(
|
|
150
|
-
new S(m(n,
|
|
151
|
-
return}return Er(e,t,
|
|
152
|
-
for(let a of r)if(!(!
|
|
153
|
-
name,a.name,e.file));break
|
|
144
|
+
this,"IncorrectQueryTypeError")}};var Pe="QueryStrings",Ln=i((e,t)=>Gn(e,m(t,Pe)),"isWebQueryDeclaration"),x=i((e,t,r,o,n)=>{
|
|
145
|
+
if(!Zn(e))return Rr(e,t,r,o,n);let s=$n(e,r);if(s)return Rr(s,t,r,o,n)},"getWebQ\
|
|
146
|
+
ueryMetadata"),Rr=i((e,t,r,o,n)=>{if(Xn(e))return f(e,r);if(Kn(e))return T(e,r);
|
|
147
|
+
if(!Jn(e)){o.push(new ie(m(n,Pe),t.file));return}if(!Ln(e,n)){o.push(new se(e.name,
|
|
148
|
+
m(n,Pe),t.file));return}return f(e,r)},"getQueryType");var ke="AuthRequest",mi=i((e,t)=>si(e,m(t,ke)),"isAuthRequestDeclaration"),Oe=i(
|
|
149
|
+
(e,t,r,o,n)=>{if(ri(e)&&e.elements.length>0)return Oe(e.elements[0],t,r,o,n);if(!oi(
|
|
150
|
+
e))return Hr(e,t,r,o,n);let s=ci(e,r);if(s)return Hr(s,t,r,o,n)},"getAuthRequest\
|
|
151
|
+
Metadata"),Hr=i((e,t,r,o,n)=>{if(ti(e))return Er(e,t,pi(e),r,o,n);if(!ii(e)){o.push(
|
|
152
|
+
new S(m(n,ke),t.file));return}if(!mi(e,n)){o.push(new R(e.name,m(n,ke),e.file));
|
|
153
|
+
return}return Er(e,t,ai(e),r,o,n)},"getRequestType"),Er=i((e,t,r,o,n,s)=>{let p={};
|
|
154
|
+
for(let a of r)if(!(!ei(a)||a.inherited))switch(a.name){default:{n.push(new ni(t.
|
|
155
|
+
name,a.name,e.file));break}case"headers":{p.headers=H(a.value,e,o,n,s),p.headers&&
|
|
154
156
|
a.description&&(p.headers.description=a.description);break}case"parameters":{p.parameters=
|
|
155
157
|
te(a.value,e,o,n,s),p.parameters&&a.description&&(p.parameters.description=a.description);
|
|
156
158
|
break}case"query":{p.query=x(a.value,e,o,n,s),p.query&&a.description&&(p.query.description=
|
|
157
|
-
a.description);break}}return p},"getTypeFromMembers");var
|
|
158
|
-
return;let s={...
|
|
159
|
+
a.description);break}}return p},"getTypeFromMembers");var Ti=i(e=>li(e)||ui(e),"isAuthHandlerDeclaration"),pe=i((e,t,r,o,n)=>{if(!Ti(e))
|
|
160
|
+
return;let s={...di(e)},p=new Set(["response"]);if(e.parameters){let[{value:a},c]=e.
|
|
159
161
|
parameters;s.request=Oe(a,t,r,o,n),c&&(s.provider=L(c.value,t,r,o,n))}if(e.return&&
|
|
160
|
-
(s.response=Mr(e.return,t,r,o,n))&&p.delete("response"),!
|
|
161
|
-
e.file));return}return s},"getAuthHandlerMetadata"),
|
|
162
|
-
|
|
163
|
-
t]=e.split(" ",2);return
|
|
164
|
-
isFunctionSignature as
|
|
165
|
-
super("Incomplete handler",t,r)}};import{InvalidServicePropertyError as
|
|
166
|
-
getObjectMembers as
|
|
167
|
-
hasHeritageType as
|
|
168
|
-
isTypeReference as
|
|
169
|
-
import{getReferenceType as
|
|
170
|
-
import{isTypeArray as
|
|
171
|
-
isTypeScalar as Wi,isTypeUndefined as xr,isTypeUnion as
|
|
172
|
-
r}static{i(this,"InvalidBodyTypeError")}},ce=class extends
|
|
162
|
+
(s.response=Mr(e.return,t,r,o,n))&&p.delete("response"),!gi(s)){o.push(new K([...p],
|
|
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"]),Ir=i(e=>{let[
|
|
165
|
+
t]=e.split(" ",2);return bi.has(t)},"isHttpPath");import{isTypeCallback as cs,isTypeFunction as ms}from"@ez4/reflection";import{getFunctionSignature as ls,
|
|
166
|
+
isFunctionSignature as us}from"@ez4/common/library";import{isObjectWith as ds}from"@ez4/utils";import{IncompleteTypeError as hi}from"@ez4/common/library";var A=class extends hi{static{i(this,"IncompleteHandlerError")}constructor(t,r){
|
|
167
|
+
super("Incomplete handler",t,r)}};import{InvalidServicePropertyError as Di,isModelDeclaration as Fi,getModelMembers as Ni,
|
|
168
|
+
getObjectMembers as qi,getPropertyNumber as Bi,getPropertyNumberList as Ui,getReferenceType as _i,
|
|
169
|
+
hasHeritageType as Yi}from"@ez4/common/library";import{isModelProperty as Vi,isTypeObject as Qi,
|
|
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
|
+
import{getReferenceType as Ei,hasHeritageType as Ii,isModelDeclaration as xi}from"@ez4/common/library";
|
|
172
|
+
import{isTypeArray as Ai,isTypeIntersection as Pi,isTypeObject as ki,isTypeReference as Oi,
|
|
173
|
+
isTypeScalar as Wi,isTypeUndefined as xr,isTypeUnion as ji}from"@ez4/reflection";import{IncorrectTypeError as Mi,InvalidTypeError as vi}from"@ez4/common/library";var ae=class extends vi{constructor(r,o){super("Invalid body",void 0,r,o);this.baseType=
|
|
174
|
+
r}static{i(this,"InvalidBodyTypeError")}},ce=class extends Mi{constructor(r,o,n){
|
|
173
175
|
super("Incorrect body",r,o,n);this.bodyType=r;this.baseType=o}static{i(this,"Inc\
|
|
174
|
-
orrectBodyTypeError")}};var
|
|
175
|
-
e,r,s=>je(s)??ze(s,t,r,o,n)),"getWebBodyMetadata"),we=i((e,t,r)=>{if(!xr(e)){if(!
|
|
176
|
-
e))return r(e);let o=
|
|
177
|
-
return
|
|
178
|
-
e))return
|
|
179
|
-
e))return
|
|
180
|
-
t.file));return}if(!
|
|
181
|
-
e,r)},"getCompoundTypeBody"),
|
|
176
|
+
orrectBodyTypeError")}};var We="JsonBody",zi=i((e,t)=>Ii(e,m(t,We)),"isWebBodyDeclaration"),g=i((e,t,r,o,n)=>we(
|
|
177
|
+
e,r,s=>je(s)??ze(s,t,r,o,n)),"getWebBodyMetadata"),we=i((e,t,r)=>{if(!xr(e)){if(!Oi(
|
|
178
|
+
e))return r(e);let o=Ei(e,t);if(o)return r(o)}},"getBodyType"),je=i(e=>{if(Wi(e))
|
|
179
|
+
return Ri(e)},"getScalarTypeBody"),ze=i((e,t,r,o,n)=>{if(ki(e))return f(e,r);if(ji(
|
|
180
|
+
e))return wi(e.elements,r,s=>je(s)??ze(s,t,r,o,n));if(Pi(e))return T(e,r);if(Ai(
|
|
181
|
+
e))return Ci(e.element,r,s=>je(s)??ze(s,t,r,o,n));if(!xi(e)){o.push(new ae(m(n,We),
|
|
182
|
+
t.file));return}if(!zi(e,n)){o.push(new ce(e.name,m(n,We),e.file));return}return f(
|
|
183
|
+
e,r)},"getCompoundTypeBody"),wi=i((e,t,r)=>{let o={optional:!1,elements:[]};for(let n of e){
|
|
182
184
|
if(xr(n)){o.optional=!0;continue}let s=we(n,t,r);s&&o.elements.push(s)}if(o.elements.
|
|
183
|
-
length)return
|
|
184
|
-
{element:o})},"getArrayTypeBody");var Ce=m(l,"Response"),
|
|
185
|
-
if(
|
|
186
|
-
onseMetadata"),
|
|
187
|
-
mpleteResponse"),Ar=i((e,t,r,o)=>{if(
|
|
188
|
-
push(new M(Ce,t.file));return}if(!
|
|
189
|
-
return Pr(e,t,
|
|
190
|
-
if(!(!
|
|
191
|
-
break
|
|
192
|
-
e,o,n,l),s.headers&&p.description&&(s.headers.description=p.description);
|
|
193
|
-
body":{s.body=g(p.value,e,o,n,l),s.body&&p.description&&(s.body.description=
|
|
194
|
-
break}}if(
|
|
195
|
-
import{InvalidServicePropertyError as
|
|
196
|
-
getModelMembers as
|
|
197
|
-
if(
|
|
198
|
-
e,t,r,o);let n=
|
|
199
|
-
if(
|
|
200
|
-
e)){o.push(new R(e.name,De,e.file));return}return
|
|
201
|
-
Type"),
|
|
202
|
-
name){default:n.push(new
|
|
185
|
+
length)return Si(o)},"getUnionTypeBody"),Ci=i((e,t,r)=>{let o=we(e,t,r);if(o)return Hi(
|
|
186
|
+
{element:o})},"getArrayTypeBody");var Ce=m(l,"Response"),Ki=i(e=>Yi(e,Ce),"isHttpResponseDeclaration"),kr=i((e,t,r,o)=>{
|
|
187
|
+
if(!$i(e))return Ar(e,t,r,o);let n=_i(e,r);if(n)return Ar(n,t,r,o)},"getHttpResp\
|
|
188
|
+
onseMetadata"),Xi=i(e=>Ji(e,["status"])&&(Gi(e.status)||!!e.status.length),"isCo\
|
|
189
|
+
mpleteResponse"),Ar=i((e,t,r,o)=>{if(Qi(e))return Pr(e,t,qi(e),r,o);if(!Fi(e)){o.
|
|
190
|
+
push(new M(Ce,t.file));return}if(!Ki(e)){o.push(new v(e.name,Ce,e.file));return}
|
|
191
|
+
return Pr(e,t,Ni(e),r,o)},"getResponseType"),Pr=i((e,t,r,o,n)=>{let s={};for(let p of r)
|
|
192
|
+
if(!(!Vi(p)||p.inherited))switch(p.name){default:{n.push(new Di(t.name,p.name,e.
|
|
193
|
+
file));break}case"status":{s.status=Bi(p)??Ui(p);break}case"headers":{s.headers=
|
|
194
|
+
H(p.value,e,o,n,l),s.headers&&p.description&&(s.headers.description=p.description);
|
|
195
|
+
break}case"body":{s.body=g(p.value,e,o,n,l),s.body&&p.description&&(s.body.description=
|
|
196
|
+
p.description);break}}if(Xi(s))return s},"getTypeFromMembers");import{isModelProperty as Zi,isTypeIntersection as Li,isTypeObject as es,isTypeReference as rs}from"@ez4/reflection";
|
|
197
|
+
import{InvalidServicePropertyError as ts,isModelDeclaration as os,getObjectMembers as ns,
|
|
198
|
+
getModelMembers as is,getReferenceType as ss,hasHeritageType as ps}from"@ez4/common/library";var De=m(l,"Request"),as=i(e=>ps(e,De),"isHttpRequestDeclaration"),Fe=i((e,t,r,o)=>{
|
|
199
|
+
if(Li(e)&&e.elements.length>0)return Fe(e.elements[0],t,r,o);if(!rs(e))return Or(
|
|
200
|
+
e,t,r,o);let n=ss(e,r);if(n)return Or(n,t,r,o)},"getHttpRequestMetadata"),Or=i((e,t,r,o)=>{
|
|
201
|
+
if(es(e))return Wr(e,t,ns(e),r,o);if(!os(e)){o.push(new S(De,t.file));return}if(!as(
|
|
202
|
+
e)){o.push(new R(e.name,De,e.file));return}return Wr(e,t,is(e),r,o)},"getRequest\
|
|
203
|
+
Type"),Wr=i((e,t,r,o,n)=>{let s={};for(let p of r)if(!(!Zi(p)||p.inherited))switch(p.
|
|
204
|
+
name){default:{n.push(new ts(t.name,p.name,e.file));break}case"headers":{s.headers=
|
|
203
205
|
H(p.value,e,o,n,l),s.headers&&p.description&&(s.headers.description=p.description);
|
|
204
206
|
break}case"identity":{s.identity=b(p.value,e,o,n,l),s.identity&&p.description&&(s.
|
|
205
207
|
identity.description=p.description);break}case"query":{s.query=x(p.value,e,o,n,l),
|
|
@@ -207,241 +209,248 @@ s.query&&p.description&&(s.query.description=p.description);break}case"parameter
|
|
|
207
209
|
s":{s.parameters=te(p.value,e,o,n,l),s.parameters&&p.description&&(s.parameters.
|
|
208
210
|
description=p.description);break}case"body":{s.body=g(p.value,e,o,n,l),s.body&&p.
|
|
209
211
|
description&&(s.body.description=p.description);break}}return s},"getTypeFromMem\
|
|
210
|
-
bers");var
|
|
211
|
-
return;let s={...
|
|
212
|
+
bers");var fs=i(e=>cs(e)||ms(e),"isHttpHandlerDeclaration"),jr=i((e,t,r,o,n)=>{if(!fs(e))
|
|
213
|
+
return;let s={...ls(e)},p=new Set(["response"]);if(e.parameters){let[{value:a},c]=e.
|
|
212
214
|
parameters;s.request=Fe(a,t,r,o),c&&!n&&(s.provider=L(c.value,t,r,o,l))}if(e.return&&
|
|
213
|
-
(s.response=
|
|
214
|
-
e.file));return}return s},"getHttpHandlerMetadata"),
|
|
215
|
-
|
|
216
|
-
e,t,r,o,!1),"getHttpLocalRoutes"),Br=i((e,t,r,o)=>
|
|
217
|
-
outes"),
|
|
215
|
+
(s.response=kr(e.return,t,r,o))&&p.delete("response"),!ys(s)){o.push(new A([...p],
|
|
216
|
+
e.file));return}return s},"getHttpHandlerMetadata"),ys=i(e=>ds(e,["response"])&&
|
|
217
|
+
us(e),"isCompleteHandler");var Os=i(e=>Ms(e)&&ks(e,m(l,"Route")),"isHttpRouteDeclaration"),qr=i((e,t,r,o)=>Ur(
|
|
218
|
+
e,t,r,o,!1),"getHttpLocalRoutes"),Br=i((e,t,r,o)=>Ur(e,t,r,o,!0),"getHttpRemoteR\
|
|
219
|
+
outes"),Ur=i((e,t,r,o,n)=>{if(!Dr(t.value))return Ne(Ps(t)??[],e,r,o,n);let s=Nr(
|
|
218
220
|
t.value,r);if(s&&Fr(s))return Ne(s.elements,e,r,o,n)},"getHttpRoutes"),Ne=i((e,t,r,o,n)=>{
|
|
219
|
-
let s=[];for(let p of e){let a=
|
|
220
|
-
push(a)}return s},"getRouteFromTuple"),
|
|
221
|
-
t,r,o,n);let s=Nr(e,r);if(s)return wr(s,t,r,o,n)},"getTypeFromRoute"),
|
|
222
|
-
e,["path","handler"]),"isCompleteRoute"),wr=i((e,t,r,o,n)=>{if(
|
|
223
|
-
t,
|
|
221
|
+
let s=[];for(let p of e){let a=Ws(p,t,r,o,n);Array.isArray(a)?s.push(...a):a&&s.
|
|
222
|
+
push(a)}return s},"getRouteFromTuple"),Ws=i((e,t,r,o,n)=>{if(!Dr(e))return wr(e,
|
|
223
|
+
t,r,o,n);let s=Nr(e,r);if(s)return wr(s,t,r,o,n)},"getTypeFromRoute"),js=i(e=>bs(
|
|
224
|
+
e,["path","handler"]),"isCompleteRoute"),wr=i((e,t,r,o,n)=>{if(Os(e))return Cr(e,
|
|
225
|
+
t,Es(e),r,o,n);if(gs(e))return Cr(e,t,Hs(e),r,o,n);if(Fr(e)&&e.spread)return Ne(
|
|
224
226
|
e.elements,t,r,o,n)},"getRouteType"),Cr=i((e,t,r,o,n,s)=>{let p={},a=new Set(["p\
|
|
225
|
-
ath","handler"]);for(let d of r)if(!(!
|
|
226
|
-
n.push(new
|
|
227
|
-
|
|
228
|
-
handler=jr(d.value,t,o,n,s))&&a.delete(d.name);break
|
|
229
|
-
pe(d.value,t,o,n,l);break
|
|
230
|
-
httpErrors":p.httpErrors=V(d.value,t,o,n);break
|
|
231
|
-
timeout":p[d.name]=
|
|
232
|
-
|
|
233
|
-
|
|
227
|
+
ath","handler"]);for(let d of r)if(!(!Ts(d)||d.inherited))switch(d.name){default:{
|
|
228
|
+
n.push(new hs(t.name,d.name,e.file));break}case"name":{p.name=zr(d);break}case"p\
|
|
229
|
+
ath":{let ve=zr(d);ve&&Ir(ve)&&(a.delete(d.name),p.path=ve);break}case"handler":{
|
|
230
|
+
(p.handler=jr(d.value,t,o,n,s))&&a.delete(d.name);break}case"authorizer":{p.authorizer=
|
|
231
|
+
pe(d.value,t,o,n,l);break}case"preferences":{p.preferences=y(d.value,t,o,n,l);break}case"\
|
|
232
|
+
httpErrors":{p.httpErrors=V(d.value,t,o,n);break}case"memory":case"logRetention":case"\
|
|
233
|
+
timeout":{p[d.name]=Rs(d);break}case"architecture":{p[d.name]=xs(d);break}case"r\
|
|
234
|
+
untime":{p[d.name]=As(d);break}case"cors":case"disabled":{p[d.name]=Ss(d);break}case"\
|
|
235
|
+
listener":{p.listener=Is(d.value,n);break}case"variables":{p.variables=vs(d,n);break}}
|
|
236
|
+
if(!js(p)){n.push(new Y([...a],e.file));return}let c=zs(p.path,p.handler.request?.
|
|
234
237
|
parameters);if(c.length){n.push(new J(c,t.file));return}return p},"getTypeFromMe\
|
|
235
|
-
mbers"),
|
|
236
|
-
|
|
237
|
-
r=[];for(let o in e){let n=e[o];if(!qe(n)||
|
|
238
|
+
mbers"),zs=i((e,t)=>{let r=e.matchAll(/\{([\w_-]+)\}/g),o=[];for(let n of r){let[
|
|
239
|
+
,s]=n;t?.properties[s]||o.push(s)}return o},"getMismatchParameters");var qe=i(e=>Fs(e)&&Bs(e,m(l,"Import")),"isHttpImportDeclaration"),Yr=i(e=>{let t={},
|
|
240
|
+
r=[];for(let o in e){let n=e[o];if(!qe(n)||Ds(n))continue;let s=nr(n.name),p=new Set(
|
|
238
241
|
["project","reference","routes"]),a=n.file;n.description&&(s.description=n.description);
|
|
239
|
-
for(let c of
|
|
240
|
-
s.name,c.name,a));break
|
|
241
|
-
c.value),p.delete(c.name));break
|
|
242
|
-
c.value,n,e,r));break
|
|
243
|
-
name);break
|
|
244
|
-
inherited&&(s.routes=Br(n,c,e,r))&&p.delete(c.name);break
|
|
245
|
-
(s.defaults=Q(c.value,n,e,r));break}if(!
|
|
246
|
-
if(t[n.name]){r.push(new
|
|
247
|
-
"getHttpImportsMetadata"),
|
|
248
|
-
leteService");import{DuplicateServiceError as
|
|
249
|
-
isClassDeclaration as
|
|
250
|
-
getPropertyString as
|
|
251
|
-
import{isModelProperty as
|
|
242
|
+
for(let c of Ns(n,!0))if(Us(c))switch(c.name){default:{c.inherited||r.push(new Cs(
|
|
243
|
+
s.name,c.name,a));break}case"reference":{c.inherited&&_s(c.value)&&(s[c.name]=qs(
|
|
244
|
+
c.value),p.delete(c.name));break}case"authorization":{c.inherited||(s[c.name]=pr(
|
|
245
|
+
c.value,n,e,r));break}case"project":{!c.inherited&&(s.project=_r(c))&&p.delete(c.
|
|
246
|
+
name);break}case"name":{c.inherited&&(s.displayName=_r(c,e));break}case"routes":{
|
|
247
|
+
c.inherited&&(s.routes=Br(n,c,e,r))&&p.delete(c.name);break}case"defaults":{c.inherited&&
|
|
248
|
+
(s.defaults=Q(c.value,n,e,r));break}}if(!Vs(s)){r.push(new h([...p],a));continue}
|
|
249
|
+
if(t[n.name]){r.push(new ws(n.name,a));continue}t[n.name]=s}return{services:t,errors:r}},
|
|
250
|
+
"getHttpImportsMetadata"),Vs=i(e=>Ys(e,["project","reference","routes"]),"isComp\
|
|
251
|
+
leteService");import{DuplicateServiceError as Vp,InvalidServicePropertyError as Qp,isExternalDeclaration as $p,
|
|
252
|
+
isClassDeclaration as Gp,getLinkedServiceList as Jp,getLinkedVariableList as Kp,
|
|
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 ra}from"@ez4/utils";import{getSchemaCustomValidation as Qs}from"@ez4/schema";var P=i((e,t)=>{let{request:r}=e;r&&("headers"in r&&r.headers&&j(t,r.headers),"q\
|
|
252
255
|
uery"in r&&r.query&&j(t,r.query),"identity"in r&&r.identity&&j(t,r.identity),"pa\
|
|
253
256
|
rameters"in r&&r.parameters&&j(t,r.parameters),"body"in r&&r.body&&j(t,r.body))},
|
|
254
|
-
"attachValidatorLinkedServices"),j=i((e,t)=>{let r=
|
|
257
|
+
"attachValidatorLinkedServices"),j=i((e,t)=>{let r=Qs(t);for(let o of r){let n=er(
|
|
255
258
|
o);e[n]=o}},"attachSchemaValidatorServices");var z=i((e,t,r,o)=>{let{provider:n,request:s}=e;if(n?.services){s&&P(e,n.services);
|
|
256
259
|
for(let p in n.services){let a=n.services[p],c=t[p];if(!c){t[p]=a;continue}c!==a&&
|
|
257
|
-
r.push(new C(p,o))}}},"attachProviderLinkedServices");import{InvalidServicePropertyError as
|
|
258
|
-
getObjectMembers as
|
|
259
|
-
import{isModelProperty as
|
|
260
|
-
import{isAnyNumber as
|
|
261
|
-
super("Incomplete access",t,r)}},le=class extends
|
|
262
|
-
sTypeError")}constructor(t){super("Invalid access",void 0,"Http.Access",t)}},ue=class extends
|
|
260
|
+
r.push(new C(p,o))}}},"attachProviderLinkedServices");import{InvalidServicePropertyError as Ks,isModelDeclaration as Xs,getModelMembers as Zs,
|
|
261
|
+
getObjectMembers as Ls,getPropertyNumber as ep,getReferenceType as rp,hasHeritageType as tp}from"@ez4/common/library";
|
|
262
|
+
import{isModelProperty as op,isTypeObject as np,isTypeReference as ip}from"@ez4/reflection";
|
|
263
|
+
import{isAnyNumber as sp,isObjectWith as pp}from"@ez4/utils";import{IncompleteTypeError as $s,IncorrectTypeError as Gs,InvalidTypeError as Js}from"@ez4/common/library";var me=class extends $s{static{i(this,"IncompleteAccessError")}constructor(t,r){
|
|
264
|
+
super("Incomplete access",t,r)}},le=class extends Js{static{i(this,"InvalidAcces\
|
|
265
|
+
sTypeError")}constructor(t){super("Invalid access",void 0,"Http.Access",t)}},ue=class extends Gs{constructor(r,o){
|
|
263
266
|
super("Incorrect access",r,"Http.Access",o);this.cacheType=r}static{i(this,"Inco\
|
|
264
|
-
rrectAccessTypeError")}};var
|
|
265
|
-
e))return Vr(e,t,o);let n=
|
|
266
|
-
|
|
267
|
-
e,t,
|
|
268
|
-
name,e.file));return}return Qr(e,t,
|
|
269
|
-
s=new Set(["logRetention"]);for(let p of r)if(!(!
|
|
270
|
-
o.push(new
|
|
271
|
-
(n[p.name]=a,s.delete(p.name));break}}if(
|
|
272
|
-
"getTypeFromMembers");import{InvalidServicePropertyError as
|
|
273
|
-
getObjectMembers as
|
|
274
|
-
import{isModelProperty as
|
|
275
|
-
import{isAnyNumber as
|
|
276
|
-
"Incomplete cache",t,r)}},fe=class extends
|
|
277
|
-
che",void 0,r,o);this.baseType=r}static{i(this,"InvalidCacheTypeError")}},ye=class extends
|
|
267
|
+
rrectAccessTypeError")}};var ap=i(e=>tp(e,m(l,"Access")),"isHttpAccessDeclaration"),$r=i((e,t,r,o)=>{if(!ip(
|
|
268
|
+
e))return Vr(e,t,o);let n=rp(e,r);if(n)return Vr(n,t,o)},"getHttpAccessMetadata"),
|
|
269
|
+
cp=i(e=>pp(e,["logRetention"]),"isCompleteAccess"),Vr=i((e,t,r)=>{if(np(e))return Qr(
|
|
270
|
+
e,t,Ls(e),r);if(!Xs(e)){r.push(new le(t.file));return}if(!ap(e)){r.push(new ue(e.
|
|
271
|
+
name,e.file));return}return Qr(e,t,Zs(e),r)},"getAccessType"),Qr=i((e,t,r,o)=>{let n={},
|
|
272
|
+
s=new Set(["logRetention"]);for(let p of r)if(!(!op(p)||p.inherited))switch(p.name){default:{
|
|
273
|
+
o.push(new Ks(t.name,p.name,e.file));break}case"logRetention":{let a=ep(p);sp(a)&&
|
|
274
|
+
(n[p.name]=a,s.delete(p.name));break}}if(!cp(n)){o.push(new me([...s],e.file));return}
|
|
275
|
+
return n},"getTypeFromMembers");import{InvalidServicePropertyError as dp,isModelDeclaration as fp,getModelMembers as yp,
|
|
276
|
+
getObjectMembers as Tp,getPropertyNumber as gp,getReferenceType as bp,hasHeritageType as hp}from"@ez4/common/library";
|
|
277
|
+
import{isModelProperty as Mp,isTypeObject as vp,isTypeReference as Sp}from"@ez4/reflection";
|
|
278
|
+
import{isAnyNumber as Rp,isObjectWith as Hp}from"@ez4/utils";import{IncompleteTypeError as mp,IncorrectTypeError as lp,InvalidTypeError as up}from"@ez4/common/library";var de=class extends mp{static{i(this,"IncompleteCacheError")}constructor(t,r){super(
|
|
279
|
+
"Incomplete cache",t,r)}},fe=class extends up{constructor(r,o){super("Invalid ca\
|
|
280
|
+
che",void 0,r,o);this.baseType=r}static{i(this,"InvalidCacheTypeError")}},ye=class extends lp{constructor(r,o,n){
|
|
278
281
|
super("Incorrect cache",r,o,n);this.cacheType=r;this.baseType=o}static{i(this,"I\
|
|
279
|
-
ncorrectCacheTypeError")}};var Be=m(l,"Cache"),
|
|
280
|
-
if(!
|
|
281
|
-
adata"),
|
|
282
|
-
e))return Jr(e,t,
|
|
283
|
-
r.push(new ye(e.name,Be,e.file));return}return Jr(e,t,
|
|
284
|
-
Jr=i((e,t,r,o)=>{let n={},s=new Set(["authorizerTTL"]);for(let p of r)if(!(!
|
|
285
|
-
p.inherited))switch(p.name){default:o.push(new
|
|
286
|
-
authorizerTTL":{let a=
|
|
287
|
-
|
|
288
|
-
getObjectMembers as
|
|
289
|
-
getReferenceType as
|
|
290
|
-
isTypeObject as
|
|
291
|
-
"Incomplete CORS",t,r)}},ge=class extends
|
|
292
|
-
S",void 0,r,o);this.baseType=r}static{i(this,"InvalidCorsTypeError")}},be=class extends
|
|
282
|
+
ncorrectCacheTypeError")}};var Be=m(l,"Cache"),Ep=i(e=>hp(e,Be),"isHttpCacheDeclaration"),Kr=i((e,t,r,o)=>{
|
|
283
|
+
if(!Sp(e))return Gr(e,t,o);let n=bp(e,r);if(n)return Gr(n,t,o)},"getHttpCacheMet\
|
|
284
|
+
adata"),Ip=i(e=>Hp(e,["authorizerTTL"]),"isCompleteCache"),Gr=i((e,t,r)=>{if(vp(
|
|
285
|
+
e))return Jr(e,t,Tp(e),r);if(!fp(e)){r.push(new fe(Be,t.file));return}if(!Ep(e)){
|
|
286
|
+
r.push(new ye(e.name,Be,e.file));return}return Jr(e,t,yp(e),r)},"getCacheType"),
|
|
287
|
+
Jr=i((e,t,r,o)=>{let n={},s=new Set(["authorizerTTL"]);for(let p of r)if(!(!Mp(p)||
|
|
288
|
+
p.inherited))switch(p.name){default:{o.push(new dp(t.name,p.name,e.file));break}case"\
|
|
289
|
+
authorizerTTL":{let a=gp(p);Rp(a)&&(n[p.name]=a,s.delete(p.name));break}}if(!Ip(
|
|
290
|
+
n)){o.push(new de([...s],e.file));return}return n},"getTypeFromMembers");import{InvalidServicePropertyError as kp,isModelDeclaration as Op,getModelMembers as Wp,
|
|
291
|
+
getObjectMembers as jp,getPropertyBoolean as zp,getPropertyStringList as wp,getPropertyNumber as Cp,
|
|
292
|
+
getReferenceType as Dp,hasHeritageType as Fp}from"@ez4/common/library";import{isModelProperty as Np,
|
|
293
|
+
isTypeObject as qp,isTypeReference as Bp}from"@ez4/reflection";import{isObjectWith as Up}from"@ez4/utils";import{IncompleteTypeError as xp,IncorrectTypeError as Ap,InvalidTypeError as Pp}from"@ez4/common/library";var Te=class extends xp{static{i(this,"IncompleteCorsError")}constructor(t,r){super(
|
|
294
|
+
"Incomplete CORS",t,r)}},ge=class extends Pp{constructor(r,o){super("Invalid COR\
|
|
295
|
+
S",void 0,r,o);this.baseType=r}static{i(this,"InvalidCorsTypeError")}},be=class extends Ap{constructor(r,o,n){
|
|
293
296
|
super("Incorrect CORS",r,o,n);this.corsType=r;this.baseType=o}static{i(this,"Inc\
|
|
294
|
-
orrectCorsTypeError")}};var
|
|
295
|
-
e))return Xr(e,t,o);let n=
|
|
296
|
-
|
|
297
|
-
if(
|
|
298
|
-
e)){r.push(new be(e.name,
|
|
299
|
-
Zr=i((e,t,r,o)=>{let n={},s=new Set(["allowOrigins"]);for(let p of r)if(!(!
|
|
300
|
-
p.inherited))switch(p.name){default:o.push(new
|
|
301
|
-
allowOrigins":case"allowMethods":case"allowHeaders":case"exposeHeaders":n[p.name]=
|
|
302
|
-
|
|
303
|
-
maxAge=
|
|
304
|
-
|
|
305
|
-
r=[];for(let o in e){let n=e[o];if(!
|
|
306
|
-
["routes"]),a=n.file;n.description&&(s.description=n.description);for(let c of
|
|
307
|
-
n))if(!(!
|
|
308
|
-
a));break
|
|
309
|
-
s.displayName=
|
|
310
|
-
cache":s.cache=Kr(c.value,n,e,r);break
|
|
311
|
-
cors":s.cors=Lr(c.value,n,e,r);break
|
|
312
|
-
services":s.services=
|
|
313
|
-
if(t[n.name]){r.push(new
|
|
314
|
-
errors:r}},"getHttpServicesMetadata"),
|
|
315
|
-
|
|
316
|
-
t,r),o.authorizer&&z(o.authorizer,e.services,t,r)},
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
import{isObjectWith as
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
297
|
+
orrectCorsTypeError")}};var Ue=m(l,"Cors"),_p=i(e=>Fp(e,Ue),"isHttpCorsDeclaration"),Lr=i((e,t,r,o)=>{if(!Bp(
|
|
298
|
+
e))return Xr(e,t,o);let n=Dp(e,r);if(n)return Xr(n,t,o)},"getHttpCorsMetadata"),
|
|
299
|
+
Yp=i(e=>Up(e,["allowOrigins"])&&!!e.allowOrigins.length,"isCompleteCors"),Xr=i((e,t,r)=>{
|
|
300
|
+
if(qp(e))return Zr(e,t,jp(e),r);if(!Op(e)){r.push(new ge(Ue,t.file));return}if(!_p(
|
|
301
|
+
e)){r.push(new be(e.name,Ue,e.file));return}return Zr(e,t,Wp(e),r)},"getCorsType"),
|
|
302
|
+
Zr=i((e,t,r,o)=>{let n={},s=new Set(["allowOrigins"]);for(let p of r)if(!(!Np(p)||
|
|
303
|
+
p.inherited))switch(p.name){default:{o.push(new kp(t.name,p.name,e.file));break}case"\
|
|
304
|
+
allowOrigins":case"allowMethods":case"allowHeaders":case"exposeHeaders":{n[p.name]=
|
|
305
|
+
wp(p);break}case"allowCredentials":{n.allowCredentials=zp(p);break}case"maxAge":{
|
|
306
|
+
n.maxAge=Cp(p);break}}if(!Yp(n)){o.push(new Te([...s],e.file));return}return n},
|
|
307
|
+
"getTypeFromMembers");var _e=i(e=>Gp(e)&&Lp(e,m(l,"Service")),"isHttpServiceDeclaration"),et=i(e=>{let t={},
|
|
308
|
+
r=[];for(let o in e){let n=e[o];if(!_e(n)||$p(n))continue;let s=tr(n.name),p=new Set(
|
|
309
|
+
["routes"]),a=n.file;n.description&&(s.description=n.description);for(let c of Zp(
|
|
310
|
+
n))if(!(!ea(c)||c.inherited))switch(c.name){default:{r.push(new Qp(s.name,c.name,
|
|
311
|
+
a));break}case"routes":{(s.routes=qr(n,c,e,r))&&p.delete(c.name);break}case"name":{
|
|
312
|
+
s.displayName=Xp(c);break}case"defaults":{s.defaults=Q(c.value,n,e,r);break}case"\
|
|
313
|
+
cache":{s.cache=Kr(c.value,n,e,r);break}case"access":{s.access=$r(c.value,n,e,r);
|
|
314
|
+
break}case"cors":{s.cors=Lr(c.value,n,e,r);break}case"variables":{s.variables=Kp(
|
|
315
|
+
c,r);break}case"services":{s.services=Jp(c,e,r);break}}if(!ta(s)){r.push(new h([
|
|
316
|
+
...p],a));continue}if(t[n.name]){r.push(new Vp(n.name,a));continue}oa(s,r,a),t[n.
|
|
317
|
+
name]=s}return{services:t,errors:r}},"getHttpServicesMetadata"),ta=i(e=>ra(e,["r\
|
|
318
|
+
outes","variables","services"]),"isCompleteService"),oa=i((e,t,r)=>{for(let o of e.
|
|
319
|
+
routes)z(o.handler,e.services,t,r),o.authorizer&&z(o.authorizer,e.services,t,r)},
|
|
320
|
+
"attachLinkedServices");import{DuplicateServiceError as Nc,InvalidServicePropertyError as qc,isExternalDeclaration as Bc,
|
|
321
|
+
isClassDeclaration as Uc,getLinkedServiceList as _c,getLinkedVariableList as Yc,
|
|
322
|
+
getModelMembers as Vc,getPropertyString as vt,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 Ya,isTypeObject as Va,isTypeReference as Qa}from"@ez4/reflection";
|
|
324
|
+
import{isObjectWith as $a}from"@ez4/utils";import{InvalidServicePropertyError as Ga,
|
|
325
|
+
getLinkedVariableList as Ja,getPropertyNumber as Ka,getObjectMembers as Xa,getModelMembers as Za,
|
|
326
|
+
getServiceListener as La,getServiceArchitecture as ec,getServiceRuntime as rc,getReferenceType as tc,
|
|
327
|
+
isModelDeclaration as oc,hasHeritageType as lt}from"@ez4/common/library";import{IncompleteTypeError as na}from"@ez4/common/library";var k=class extends na{static{i(this,"IncompleteTargetError")}constructor(t,r){super(
|
|
328
|
+
"Incomplete target",t,r)}};import{isTypeCallback as Na,isTypeFunction as qa}from"@ez4/reflection";import{getFunctionSignature as Ba,
|
|
329
|
+
isFunctionSignature as Ua}from"@ez4/common/library";import{InvalidServicePropertyError as ia,isModelDeclaration as sa,hasHeritageType as pa,
|
|
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 Ye=m(u,"Response"),fa=i(e=>pa(e,Ye),"isWsResponseDeclaration"),ot=i((e,t,r,o)=>{
|
|
332
|
+
if(!da(e))return rt(e,t,r,o);let n=ma(e,r);if(n)return rt(n,t,r,o)},"getWsRespon\
|
|
333
|
+
seMetadata"),rt=i((e,t,r,o)=>{if(ua(e))return tt(e,t,ca(e),r,o);if(!sa(e)){o.push(
|
|
334
|
+
new M(Ye,t.file));return}if(!fa(e)){o.push(new v(e.name,Ye,e.file));return}return tt(
|
|
335
|
+
e,t,aa(e),r,o)},"getResponseType"),tt=i((e,t,r,o,n)=>{let s={};for(let p of r)if(!(!la(
|
|
336
|
+
p)||p.inherited))switch(p.name){default:{n.push(new ia(t.name,p.name,e.file));break}case"\
|
|
332
337
|
body":{s.body=g(p.value,e,o,n,u),s.body&&p.description&&(s.body.description=p.description);
|
|
333
|
-
break}}return s},"getTypeFromMembers");import{isModelProperty as
|
|
334
|
-
import{InvalidServicePropertyError as
|
|
335
|
-
getObjectMembers as
|
|
336
|
-
if(
|
|
337
|
-
e,t,r,o);let n=
|
|
338
|
-
if(
|
|
339
|
-
e)){o.push(new R(e.name,Ve,e.file));return}return it(e,t,
|
|
340
|
-
Type"),it=i((e,t,r,o,n)=>{let s={};for(let p of r)if(!(!
|
|
341
|
-
name){default:n.push(new
|
|
338
|
+
break}}return s},"getTypeFromMembers");import{isModelProperty as ya,isTypeIntersection as Ta,isTypeObject as ga,isTypeReference as ba}from"@ez4/reflection";
|
|
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 Ve=m(u,"Request"),Ea=i(e=>va(e,Ve),"isWsRequestDeclaration"),Qe=i((e,t,r,o)=>{
|
|
341
|
+
if(Ta(e)&&e.elements.length>0)return Qe(e.elements[0],t,r,o);if(!ba(e))return nt(
|
|
342
|
+
e,t,r,o);let n=Ha(e,r);if(n)return nt(n,t,r,o)},"getWsRequestMetadata"),nt=i((e,t,r,o)=>{
|
|
343
|
+
if(ga(e))return it(e,t,Sa(e),r,o);if(!Ma(e)){o.push(new S(Ve,t.file));return}if(!Ea(
|
|
344
|
+
e)){o.push(new R(e.name,Ve,e.file));return}return it(e,t,Ra(e),r,o)},"getRequest\
|
|
345
|
+
Type"),it=i((e,t,r,o,n)=>{let s={};for(let p of r)if(!(!ya(p)||p.inherited))switch(p.
|
|
346
|
+
name){default:{n.push(new ha(t.name,p.name,e.file));break}case"identity":{s.identity=
|
|
342
347
|
b(p.value,e,o,n,u),s.identity&&p.description&&(s.identity.description=p.description);
|
|
343
348
|
break}case"body":{s.body=g(p.value,e,o,n,u),s.body&&p.description&&(s.body.description=
|
|
344
|
-
p.description);break}}return s},"getTypeFromMembers");import{isModelProperty as
|
|
345
|
-
import{InvalidServicePropertyError as
|
|
346
|
-
getModelMembers as
|
|
347
|
-
baseType=r}static{i(this,"InvalidEventTypeError")}},Me=class extends
|
|
349
|
+
p.description);break}}return s},"getTypeFromMembers");import{isModelProperty as Aa,isTypeIntersection as Pa,isTypeObject as ka,isTypeReference as Oa}from"@ez4/reflection";
|
|
350
|
+
import{InvalidServicePropertyError as Wa,isModelDeclaration as ja,getObjectMembers as za,
|
|
351
|
+
getModelMembers as wa,getReferenceType as Ca,hasHeritageType as Da}from"@ez4/common/library";import{IncorrectTypeError as Ia,InvalidTypeError as xa}from"@ez4/common/library";var he=class extends xa{constructor(r,o){super("Invalid event",void 0,r,o);this.
|
|
352
|
+
baseType=r}static{i(this,"InvalidEventTypeError")}},Me=class extends Ia{constructor(r,o,n){
|
|
348
353
|
super("Incorrect event",r,o,n);this.eventType=r;this.baseType=o}static{i(this,"I\
|
|
349
|
-
ncorrectEventTypeError")}};var $e=m(u,"Event"),
|
|
350
|
-
e)&&e.elements.length>0)return Ge(e.elements[0],t,r,o);if(!
|
|
351
|
-
o);let n=
|
|
352
|
-
if(
|
|
353
|
-
e)){o.push(new Me(e.name,$e,e.file));return}return pt(e,t,
|
|
354
|
-
ype"),pt=i((e,t,r,o,n)=>{let s={};for(let p of r)if(!(!
|
|
355
|
-
name){default:n.push(new
|
|
354
|
+
ncorrectEventTypeError")}};var $e=m(u,"Event"),Fa=i(e=>Da(e,$e),"isWsEventDeclaration"),Ge=i((e,t,r,o)=>{if(Pa(
|
|
355
|
+
e)&&e.elements.length>0)return Ge(e.elements[0],t,r,o);if(!Oa(e))return st(e,t,r,
|
|
356
|
+
o);let n=Ca(e,r);if(n)return st(n,t,r,o)},"getWsEventMetadata"),st=i((e,t,r,o)=>{
|
|
357
|
+
if(ka(e))return pt(e,t,za(e),r,o);if(!ja(e)){o.push(new he($e,t.file));return}if(!Fa(
|
|
358
|
+
e)){o.push(new Me(e.name,$e,e.file));return}return pt(e,t,wa(e),r,o)},"getEventT\
|
|
359
|
+
ype"),pt=i((e,t,r,o,n)=>{let s={};for(let p of r)if(!(!Aa(p)||p.inherited))switch(p.
|
|
360
|
+
name){default:{n.push(new Wa(t.name,p.name,e.file));break}case"headers":{s.headers=
|
|
356
361
|
H(p.value,e,o,n,u),s.headers&&p.description&&(s.headers.description=p.description);
|
|
357
362
|
break}case"identity":{s.identity=b(p.value,e,o,n,u),s.identity&&p.description&&(s.
|
|
358
363
|
identity.description=p.description);break}case"query":{s.query=x(p.value,e,o,n,u),
|
|
359
364
|
s.query&&p.description&&(s.query.description=p.description);break}}return s},"ge\
|
|
360
|
-
tTypeFromMembers");var
|
|
365
|
+
tTypeFromMembers");var _a=i(e=>Na(e)||qa(e),"isWsHandlerDeclaration"),at=i((e,t,r,o)=>mt(e,t,r,o,n=>Ge(
|
|
361
366
|
n,t,r,o)),"getWsConnectionHandler"),ct=i((e,t,r,o)=>mt(e,t,r,o,n=>Qe(n,t,r,o)),"\
|
|
362
|
-
getWsMessageHandler"),mt=i((e,t,r,o,n)=>{if(!
|
|
367
|
+
getWsMessageHandler"),mt=i((e,t,r,o,n)=>{if(!_a(e))return;let s={...Ba(e)},p=new Set;
|
|
363
368
|
if(e.parameters){let[{value:a}]=e.parameters;(s.request=n(a))||p.add("request")}
|
|
364
|
-
if(e.return&&!(s.response=ot(e.return,t,r,o))&&p.add("response")
|
|
365
|
-
new A([...p],e.file));return}return s},"getWsHandler");var
|
|
366
|
-
isWsConnectionDeclaration"),ft=i((e,t,r,o)=>{if(!
|
|
367
|
-
e,r);if(n)return ut(n,t,r,o)},"getWsConnectionMetadata"),
|
|
368
|
-
"isCompleteWsConnection"),ut=i((e,t,r,o)=>{if(
|
|
369
|
-
e))return dt(e,t,
|
|
370
|
-
["handler"]);for(let a of r)if(!(!
|
|
371
|
-
new
|
|
372
|
-
p.delete(a.name);break
|
|
373
|
-
preferences":s.preferences=y(a.value,t,o,n,u);break
|
|
374
|
-
|
|
375
|
-
break
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
t
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
break}
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
369
|
+
if(e.return&&!(s.response=ot(e.return,t,r,o))&&p.add("response"),p.size||!Ua(s)){
|
|
370
|
+
o.push(new A([...p],e.file));return}return s},"getWsHandler");var nc=m(u,"Connect"),ic=m(u,"Disconnect"),sc=i(e=>oc(e)&&(lt(e,nc)||lt(e,ic)),"\
|
|
371
|
+
isWsConnectionDeclaration"),ft=i((e,t,r,o)=>{if(!Qa(e))return ut(e,t,r,o);let n=tc(
|
|
372
|
+
e,r);if(n)return ut(n,t,r,o)},"getWsConnectionMetadata"),pc=i(e=>$a(e,["handler"]),
|
|
373
|
+
"isCompleteWsConnection"),ut=i((e,t,r,o)=>{if(sc(e))return dt(e,t,Za(e),r,o);if(Va(
|
|
374
|
+
e))return dt(e,t,Xa(e),r,o)},"getConnectionType"),dt=i((e,t,r,o,n)=>{let s={},p=new Set(
|
|
375
|
+
["handler"]);for(let a of r)if(!(!Ya(a)||a.inherited))switch(a.name){default:{n.
|
|
376
|
+
push(new Ga(t.name,a.name,e.file));break}case"handler":{(s.handler=at(a.value,t,
|
|
377
|
+
o,n))&&p.delete(a.name);break}case"authorizer":{s.authorizer=pe(a.value,t,o,n,u);
|
|
378
|
+
break}case"preferences":{s.preferences=y(a.value,t,o,n,u);break}case"memory":case"\
|
|
379
|
+
logRetention":case"timeout":{s[a.name]=Ka(a);break}case"architecture":{s[a.name]=
|
|
380
|
+
ec(a);break}case"runtime":{s[a.name]=rc(a);break}case"listener":{s.listener=La(a.
|
|
381
|
+
value,n);break}case"variables":{s.variables=Ja(a,n);break}}if(!pc(s)){n.push(new k(
|
|
382
|
+
[...p],e.file));return}return s},"getTypeFromMembers");import{InvalidServicePropertyError as ac,isModelDeclaration as cc,getPropertyNumber as mc,
|
|
383
|
+
getObjectMembers as lc,getModelMembers as uc,getServiceListener as dc,getServiceArchitecture as fc,
|
|
384
|
+
getServiceRuntime as yc,tryGetReferenceType as Tc,hasHeritageType as gc}from"@ez4/common/library";
|
|
385
|
+
import{isModelProperty as bc,isTypeObject as hc,isTypeReference as Mc}from"@ez4/reflection";var Je=m(u,"Defaults"),vc=i(e=>gc(e,Je),"isWsDefaultsDeclaration"),gt=i((e,t,r,o)=>{
|
|
386
|
+
if(!Mc(e))return yt(e,t,r,o);let n=Tc(e,r);if(n)return yt(n,t,r,o)},"getWsDefaul\
|
|
387
|
+
tsMetadata"),yt=i((e,t,r,o)=>{if(hc(e))return Tt(t,lc(e),r,o);if(!cc(e)){o.push(
|
|
388
|
+
new E(Je,t.file));return}if(!vc(e)){o.push(new I(e.name,Je,t.file));return}return Tt(
|
|
389
|
+
t,uc(e),r,o)},"getDefaultsType"),Tt=i((e,t,r,o)=>{let n={};for(let s of t)if(!(!bc(
|
|
390
|
+
s)||s.inherited))switch(s.name){default:{o.push(new ac(e.name,s.name,e.file));break}case"\
|
|
391
|
+
preferences":{n.preferences=y(s.value,e,r,o,u);break}case"memory":case"logRetent\
|
|
392
|
+
ion":case"timeout":{n[s.name]=mc(s);break}case"architecture":{n[s.name]=fc(s);break}case"\
|
|
393
|
+
runtime":{n[s.name]=yc(s);break}case"listener":{n.listener=dc(s.value,o);break}}
|
|
394
|
+
return n},"getTypeFromMembers");import{isModelProperty as Sc,isTypeObject as Rc,isTypeReference as Hc}from"@ez4/reflection";
|
|
395
|
+
import{isObjectWith as Ec}from"@ez4/utils";import{InvalidServicePropertyError as Ic,
|
|
396
|
+
getLinkedVariableList as xc,getPropertyNumber as Ac,getObjectMembers as Pc,getModelMembers as kc,
|
|
397
|
+
getServiceListener as Oc,getServiceArchitecture as Wc,getServiceRuntime as jc,getReferenceType as zc,
|
|
398
|
+
isModelDeclaration as wc,hasHeritageType as Cc}from"@ez4/common/library";var Dc=i(e=>wc(e)&&Cc(e,m(u,"Message")),"isWsMessageDeclaration"),Mt=i((e,t,r,o)=>{
|
|
399
|
+
if(!Hc(e))return bt(e,t,r,o);let n=zc(e,r);if(n)return bt(n,t,r,o)},"getWsMessag\
|
|
400
|
+
eMetadata"),Fc=i(e=>Ec(e,["handler"]),"isCompleteWsMessage"),bt=i((e,t,r,o)=>{if(Dc(
|
|
401
|
+
e))return ht(e,t,kc(e),r,o);if(Rc(e))return ht(e,t,Pc(e),r,o)},"getMessageType"),
|
|
402
|
+
ht=i((e,t,r,o,n)=>{let s={},p=new Set(["handler"]);for(let a of r)if(!(!Sc(a)||a.
|
|
403
|
+
inherited))switch(a.name){default:{n.push(new Ic(t.name,a.name,e.file));break}case"\
|
|
404
|
+
handler":{(s.handler=ct(a.value,t,o,n))&&p.delete(a.name);break}case"preferences":{
|
|
405
|
+
s.preferences=y(a.value,t,o,n,u);break}case"memory":case"logRetention":case"time\
|
|
406
|
+
out":{s[a.name]=Ac(a);break}case"architecture":{s[a.name]=Wc(a);break}case"runti\
|
|
407
|
+
me":{s[a.name]=jc(a);break}case"listener":{s.listener=Oc(a.value,n);break}case"v\
|
|
408
|
+
ariables":{s.variables=xc(a,n);break}}if(!Fc(s)){n.push(new k([...p],e.file));return}
|
|
409
|
+
return s},"getTypeFromMembers");var Ke=i(e=>Uc(e)&&Qc(e,m(u,"Service")),"isWsServiceDeclaration"),St=i(e=>{let t={},
|
|
410
|
+
r=[];for(let o in e){let n=e[o];if(!Ke(n)||Bc(n))continue;let s=Le(n.name),p=new Set(
|
|
402
411
|
["schema","connect","disconnect","message"]),a=n.file;n.description&&(s.description=
|
|
403
|
-
n.description);for(let c of
|
|
404
|
-
s.name,c.name,a));break
|
|
405
|
-
vt(c));break
|
|
406
|
-
inherited||(s.defaults=gt(c.value,n,e,r));break
|
|
407
|
-
n,e,r,u))&&p.delete(c.name);break
|
|
408
|
-
name]=ft(c.value,n,e,r))&&p.delete(c.name);break
|
|
409
|
-
name]=Mt(c.value,n,e,r))&&p.delete(c.name);break
|
|
410
|
-
{}:s.variables=
|
|
411
|
-
|
|
412
|
-
new
|
|
413
|
-
|
|
414
|
-
variables","services"]),"isCompleteService"),
|
|
415
|
-
message:s}=e;P(o.handler,e.services),P(n.handler,e.services),P(s.handler,
|
|
416
|
-
o.authorizer&&z(o.authorizer,e.services,t,r)},"attachLinkedServices");var Xe=i(e=>
|
|
417
|
-
"getLinkedImport");var
|
|
412
|
+
n.description);for(let c of Vc(n,!0))if($c(c))switch(c.name){default:{r.push(new qc(
|
|
413
|
+
s.name,c.name,a));break}case"client":break;case"name":{c.inherited||(s.displayName=
|
|
414
|
+
vt(c));break}case"stage":{c.inherited||(s.stageName=vt(c));break}case"defaults":{
|
|
415
|
+
c.inherited||(s.defaults=gt(c.value,n,e,r));break}case"schema":{(s.schema=g(c.value,
|
|
416
|
+
n,e,r,u))&&p.delete(c.name);break}case"connect":case"disconnect":{!c.inherited&&
|
|
417
|
+
(s[c.name]=ft(c.value,n,e,r))&&p.delete(c.name);break}case"message":{!c.inherited&&
|
|
418
|
+
(s[c.name]=Mt(c.value,n,e,r))&&p.delete(c.name);break}case"variables":{c.inherited?
|
|
419
|
+
s.variables={}:s.variables=Yc(c,r);break}case"services":{c.inherited?s.services=
|
|
420
|
+
{}:s.services=_c(c,e,r);break}}if(!Jc(s)){r.push(new h([...p],a));continue}if(t[n.
|
|
421
|
+
name]){r.push(new Nc(n.name,a));continue}Kc(s,r,a),t[n.name]=s}return{services:t,
|
|
422
|
+
errors:r}},"getWsServicesMetadata"),Jc=i(e=>Gc(e,["schema","connect","disconnect",
|
|
423
|
+
"message","variables","services"]),"isCompleteService"),Kc=i((e,t,r)=>{let{connect:o,
|
|
424
|
+
disconnect:n,message:s}=e;P(o.handler,e.services),P(n.handler,e.services),P(s.handler,
|
|
425
|
+
e.services),o.authorizer&&z(o.authorizer,e.services,t,r)},"attachLinkedServices");var Xe=i(e=>_e(e)||Ke(e)?e.name:null,"getLinkedService"),Rt=i(e=>qe(e)?e.name:null,
|
|
426
|
+
"getLinkedImport");var ZT=i(()=>{Xc(),Zc(),Ze(w,{"metadata:getServices":St,"metadata:getLinkedServi\
|
|
418
427
|
ce":Xe}),Ze(D,{"metadata:getServices":et,"metadata:getLinkedService":Xe}),Ze(F,{
|
|
419
|
-
"metadata:getServices":Yr,"metadata:getLinkedService":Rt})},"registerTriggers");var
|
|
428
|
+
"metadata:getServices":Yr,"metadata:getLinkedService":Rt})},"registerTriggers");var rg=i(e=>{let{authorization:t}=e;if(t)switch(t.type){default:throw new Error(
|
|
420
429
|
`Authorization type ${t.type} isn't supported.`);case"bearer":return{header:t.header,
|
|
421
|
-
value:`Bearer ${t.value}`}}},"getClientAuthorization");import{getObjectSchemaProperty as
|
|
430
|
+
value:`Bearer ${t.value}`}}},"getClientAuthorization");import{getObjectSchemaProperty as Lc}from"@ez4/schema";var sg=i(e=>{let t={},r=e.defaults?.preferences?.namingStyle,o=or(e)?e.authorization?.
|
|
422
431
|
header:void 0;for(let n of e.routes){if(!n.name)continue;let[s,p]=n.path.split("\
|
|
423
|
-
",2),{handler:a,preferences:c}=n;t[n.name]={authorize:
|
|
432
|
+
",2),{handler:a,preferences:c}=n;t[n.name]={authorize:em(n,o),namingStyle:c?.namingStyle??
|
|
424
433
|
r,bodySchema:a.request?.body,responseSchema:a.response.body,querySchema:a.request?.
|
|
425
|
-
query,method:s,path:p}}return t},"getClientOperations"),
|
|
426
|
-
request?.headers;if(!r||!t)return!1;let o=
|
|
434
|
+
query,method:s,path:p}}return t},"getClientOperations"),em=i((e,t)=>{let r=e.authorizer?.
|
|
435
|
+
request?.headers;if(!r||!t)return!1;let o=Lc(r,t);return!(!o||o.optional)},"shou\
|
|
427
436
|
ldUseAuthorization");export{F as HttpImportType,l as HttpNamespaceType,D as HttpServiceType,me as IncompleteAccessError,
|
|
428
437
|
N as IncompleteAuthorizationError,K as IncompleteAuthorizerHandlerError,de as IncompleteCacheError,
|
|
429
438
|
Te as IncompleteCorsError,A as IncompleteHandlerError,Z as IncompleteProviderError,
|
|
430
|
-
Y as IncompleteRouteError,h as IncompleteServiceError,
|
|
439
|
+
Y as IncompleteRouteError,h as IncompleteServiceError,k as IncompleteTargetError,
|
|
431
440
|
ue as IncorrectAccessTypeError,B as IncorrectAuthorizationTypeError,ce as IncorrectBodyTypeError,
|
|
432
441
|
ye as IncorrectCacheTypeError,be as IncorrectCorsTypeError,I as IncorrectDefaultsTypeError,
|
|
433
442
|
Me as IncorrectEventTypeError,ne as IncorrectHeadersTypeError,re as IncorrectIdentityTypeError,
|
|
434
|
-
G as IncorrectParameterTypeError,
|
|
443
|
+
G as IncorrectParameterTypeError,_ as IncorrectPreferencesTypeError,se as IncorrectQueryTypeError,
|
|
435
444
|
R as IncorrectRequestTypeError,v as IncorrectResponseTypeError,le as InvalidAccessTypeError,
|
|
436
445
|
q as InvalidAuthorizationTypeError,ae as InvalidBodyTypeError,fe as InvalidCacheTypeError,
|
|
437
446
|
ge as InvalidCorsTypeError,E as InvalidDefaultsTypeError,he as InvalidEventTypeError,
|
|
438
447
|
oe as InvalidHeadersTypeError,ee as InvalidIdentityTypeError,$ as InvalidParameterTypeError,
|
|
439
|
-
|
|
440
|
-
S as InvalidRequestTypeError,M as InvalidResponseTypeError,
|
|
448
|
+
U as InvalidPreferencesTypeError,X as InvalidProviderTypeError,ie as InvalidQueryTypeError,
|
|
449
|
+
S as InvalidRequestTypeError,M as InvalidResponseTypeError,W as InvalidRouteErrorTypeError,
|
|
441
450
|
J as MismatchParametersTypeError,C as ServiceCollisionError,u as WsNamespaceType,
|
|
442
451
|
w as WsServiceType,nr as createHttpImport,tr as createHttpService,Le as createWsService,
|
|
443
|
-
|
|
452
|
+
rg as getClientAuthorization,sg as getClientOperations,Yr as getHttpImportsMetadata,
|
|
444
453
|
et as getHttpServicesMetadata,St as getWsServicesMetadata,or as isHttpImport,qe as isHttpImportDeclaration,
|
|
445
|
-
|
|
446
|
-
|
|
454
|
+
um as isHttpService,_e as isHttpServiceDeclaration,om as isWsService,Ke as isWsServiceDeclaration,
|
|
455
|
+
ZT as registerTriggers};
|
|
447
456
|
//# sourceMappingURL=library.mjs.map
|