@ez4/gateway 0.34.0 → 0.35.0

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