@ez4/gateway 0.23.0 → 0.24.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/errors/preferences.d.ts +8 -0
- package/dist/library.cjs +221 -207
- package/dist/library.d.ts +1 -0
- package/dist/library.mjs +195 -182
- package/dist/main.cjs +16 -16
- package/dist/main.mjs +13 -13
- package/dist/metadata/body.d.ts +1 -1
- package/dist/metadata/preferences.d.ts +3 -0
- package/dist/metadata/utils.d.ts +1 -0
- package/dist/services/common.d.ts +23 -1
- package/dist/services/contract.d.ts +13 -8
- package/dist/services/types.d.ts +9 -0
- package/dist/types/common.d.ts +12 -5
- package/dist/utils/body.d.ts +2 -2
- package/dist/utils/query.d.ts +1 -1
- package/dist/utils.cjs +21 -19
- package/dist/utils.mjs +24 -18
- package/package.json +9 -6
package/dist/library.mjs
CHANGED
|
@@ -1,197 +1,210 @@
|
|
|
1
|
-
var
|
|
2
|
-
import{createTrigger as
|
|
3
|
-
getLinkedVariableList as
|
|
4
|
-
import{isModelProperty as
|
|
5
|
-
super("Incomplete service",t,r)}};import{InvalidServicePropertyError as
|
|
6
|
-
getObjectMembers as
|
|
7
|
-
import{isModelProperty as
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
1
|
+
var $e=Object.defineProperty;var p=(e,t)=>$e(e,"name",{value:t,configurable:!0});import{registerTriggers as cn}from"@ez4/common/library";import{registerTriggers as ln}from"@ez4/schema/library";
|
|
2
|
+
import{createTrigger as mn}from"@ez4/project/library";import{DuplicateServiceError as $o,isExternalDeclaration as Lo,getLinkedServiceList as en,
|
|
3
|
+
getLinkedVariableList as rn,getModelMembers as tn,getPropertyString as on,InvalidServicePropertyError as nn}from"@ez4/common/library";
|
|
4
|
+
import{isModelProperty as pn}from"@ez4/reflection";var Y="@ez4/http",Tn=p(e=>e.type===Y,"isHttpService");import{IncompleteTypeError as Le}from"@ez4/common/library";var y=class extends Le{static{p(this,"IncompleteServiceError")}constructor(t,r){
|
|
5
|
+
super("Incomplete service",t,r)}};import{InvalidServicePropertyError as Sr,isModelDeclaration as xr,getPropertyNumber as Ir,
|
|
6
|
+
getObjectMembers as Er,getModelMembers as Ar,getServiceListener as vr,getReferenceType as Rr}from"@ez4/common/library";
|
|
7
|
+
import{isModelProperty as Pr,isTypeObject as jr,isTypeReference as wr}from"@ez4/reflection";import{InvalidServicePropertyError as or,isModelDeclaration as nr,getObjectMembers as pr,
|
|
8
|
+
getModelMembers as sr,getReferenceType as ir,getPropertyStringIn as cr}from"@ez4/common/library";
|
|
9
|
+
import{isModelProperty as lr,isTypeObject as mr,isTypeReference as ar}from"@ez4/reflection";import{hasHeritageType as a,isClassDeclaration as er,isModelDeclaration as rr}from"@ez4/common/library";
|
|
10
|
+
import{isTypeCallback as $,isTypeFunction as L}from"@ez4/reflection";var tr=new Set(["ANY","GET","POST","PUT","PATCH","DELETE","OPTIONS"]),ee=p(e=>{let[
|
|
11
|
+
t]=e.split(" ",2);return tr.has(t)},"isHttpPath"),re=p(e=>er(e)&&a(e,"Http.Servi\
|
|
12
|
+
ce"),"isHttpService"),te=p(e=>rr(e)&&a(e,"Http.Route"),"isHttpRoute");var oe=p(e=>a(e,"Http.Defaults"),"isHttpDefaults"),ne=p(e=>a(e,"Http.Preferences"),
|
|
13
|
+
"isHttpPreferences"),pe=p(e=>a(e,"Http.Headers"),"isHttpHeaders"),se=p(e=>a(e,"H\
|
|
14
|
+
ttp.Identity"),"isHttpIdentity"),ie=p(e=>a(e,"Http.QueryStrings"),"isHttpQuery"),
|
|
15
|
+
ce=p(e=>a(e,"Http.PathParameters"),"isHttpParameters"),le=p(e=>a(e,"Http.JsonBod\
|
|
16
|
+
y"),"isJsonBody"),me=p(e=>a(e,"Http.Cors"),"isHttpCors"),ae=p(e=>a(e,"Http.Cache"),
|
|
17
|
+
"isHttpCache"),ue=p(e=>$(e)||L(e),"isHttpAuthorizer"),fe=p(e=>$(e)||L(e),"isHttp\
|
|
18
|
+
Handler");import{NamingStyle as d}from"@ez4/schema";var T=p((e,t,r,o)=>{if(!ar(e))return ye(e,t,o);let n=ir(e,r);if(n)return ye(n,t,
|
|
19
|
+
o)},"getHttpPreferences"),ye=p((e,t,r)=>{if(mr(e))return de(t,pr(e),r);if(!nr(e)){
|
|
20
|
+
r.push(new g(t.file));return}if(!ne(e)){r.push(new M(e.name,t.file));return}return de(
|
|
21
|
+
t,sr(e),r)},"getTypePreferences"),de=p((e,t,r)=>{let o={};for(let n of t)if(lr(n))
|
|
22
|
+
switch(n.name){default:r.push(new or(e.name,n.name,e.file));break;case"namingSty\
|
|
23
|
+
le":o.namingStyle=cr(n,[d.CamelCase,d.PascalCase,d.SnakeCase,d.KebabCase]);break}
|
|
24
|
+
return o},"getTypeFromMembers");import{InvalidServicePropertyError as ur,getObjectMembers as fr,getPropertyTuple as yr,
|
|
25
|
+
getReferenceType as ge}from"@ez4/common/library";import{isAnyNumber as dr,isEmptyObject as Tr}from"@ez4/utils";
|
|
26
|
+
import{isModelProperty as gr,isTypeClass as Mr,isTypeObject as Hr,isTypeReference as Me}from"@ez4/reflection";var H=p((e,t,r,o)=>{if(!Me(e))return Te(e,t,r,o);let n=ge(e,r);return n?Te(n,t,r,
|
|
27
|
+
o):null},"getHttpErrors"),Te=p((e,t,r,o)=>Hr(e)?br(e,t,fr(e),r,o):null,"getTypeE\
|
|
28
|
+
rrors"),br=p((e,t,r,o,n)=>{let s={};for(let i of r){if(!gr(i)||i.inherited)continue;
|
|
29
|
+
let c=parseInt(i.name,10);dr(c)||n.push(new ur(t.name,i.name,e.file));let l=hr(i,
|
|
30
|
+
c,t,o,n);l&&Object.assign(s,l)}return Tr(s)?null:s},"getTypeFromMembers"),hr=p((e,t,r,o,n)=>{
|
|
31
|
+
let s=yr(e)??[],i={};for(let c of s){if(!Me(c)){n.push(new u(r.file));continue}let l=ge(
|
|
32
|
+
c,o);if(!l||!Mr(l)){n.push(new u(r.file));continue}i[l.name]=t}return i},"getErr\
|
|
33
|
+
orClasses");var he=p((e,t,r,o)=>{if(!wr(e))return He(e,t,r,o);let n=Rr(e,r);return n?He(n,t,
|
|
34
|
+
r,o):null},"getHttpDefaults"),He=p((e,t,r,o)=>jr(e)?be(t,Er(e),r,o):xr(e)?oe(e)?
|
|
35
|
+
be(t,Ar(e),r,o):(o.push(new h(e.name,t.file)),null):(o.push(new b(t.file)),null),
|
|
36
|
+
"getTypeDefaults"),be=p((e,t,r,o)=>{let n={};for(let s of t)if(!(!Pr(s)||s.inherited))
|
|
37
|
+
switch(s.name){default:o.push(new Sr(e.name,s.name,e.file));break;case"httpError\
|
|
38
|
+
s":n.httpErrors=H(s.value,e,r,o);break;case"preferences":n.preferences=T(s.value,
|
|
39
|
+
e,r,o);break;case"memory":case"logRetention":case"timeout":n[s.name]=Ir(s);break;case"\
|
|
40
|
+
listener":n.listener=vr(s.value,o);break}return n},"getTypeFromMembers");import{isModelProperty as io,isTypeObject as co,isTypeReference as lo,isTypeTuple as mo}from"@ez4/reflection";
|
|
41
|
+
import{InvalidServicePropertyError as ao,getLinkedVariableList as uo,getPropertyBoolean as fo,
|
|
42
|
+
getPropertyNumber as yo,getPropertyString as To,getObjectMembers as go,getModelMembers as Mo,
|
|
43
|
+
getServiceListener as Ho,getReferenceType as bo,getPropertyTuple as ho}from"@ez4/common/library";import{IncompleteTypeError as Or,TypeError as zr}from"@ez4/common/library";var S=class extends Or{static{p(this,"IncompleteRouteError")}constructor(t,r){super(
|
|
44
|
+
"Incomplete gateway route",t,r)}},u=class extends zr{static{p(this,"InvalidRoute\
|
|
45
|
+
ErrorTypeError")}constructor(t){super("Invalid route error type.",t)}};import{IncompleteTypeError as Cr}from"@ez4/common/library";var x=class extends Cr{static{p(this,"IncompleteAuthorizerError")}constructor(t,r){
|
|
46
|
+
super("Incomplete route authorizer",t,r)}};import{InvalidServicePropertyError as Ht,isModelDeclaration as bt,hasHeritageType as ht,
|
|
47
|
+
getModelMembers as St,getObjectMembers as xt,getPropertyNumber as It,getReferenceType as Et}from"@ez4/common/library";
|
|
48
|
+
import{isModelProperty as At,isTypeObject as vt,isTypeReference as Rt}from"@ez4/reflection";
|
|
49
|
+
import{isAnyNumber as Pt}from"@ez4/utils";import{IncorrectTypeError as kr,InvalidTypeError as qr}from"@ez4/common/library";var I=class extends qr{constructor(r,o){super("Invalid route response",void 0,r,
|
|
50
|
+
o);this.baseType=r}static{p(this,"InvalidResponseTypeError")}},E=class extends kr{constructor(r,o,n){
|
|
42
51
|
super("Incorrect route response",r,o,n);this.responseType=r;this.baseType=o}static{
|
|
43
|
-
p(this,"IncorrectResponseTypeError")}};import{isTypeIntersection as
|
|
44
|
-
isTypeUnion as
|
|
45
|
-
import{createUnionSchema as
|
|
46
|
-
super("Invalid identity",void 0,"Http.Identity",t)}},
|
|
52
|
+
p(this,"IncorrectResponseTypeError")}};import{isTypeIntersection as Ur,isTypeObject as Vr,isTypeReference as Qr,isTypeUndefined as Jr,
|
|
53
|
+
isTypeUnion as Gr}from"@ez4/reflection";import{getReferenceType as Kr,isModelDeclaration as Yr}from"@ez4/common/library";
|
|
54
|
+
import{createUnionSchema as Wr}from"@ez4/schema/library";import{IncorrectTypeError as Dr,InvalidTypeError as Fr}from"@ez4/common/library";var A=class extends Fr{static{p(this,"InvalidIdentityTypeError")}constructor(t){
|
|
55
|
+
super("Invalid identity",void 0,"Http.Identity",t)}},v=class extends Dr{constructor(r,o){
|
|
47
56
|
super("Incorrect identity",r,"Http.Identity",o);this.identityType=r}static{p(this,
|
|
48
|
-
"IncorrectIdentityTypeError")}};import{getObjectSchema as
|
|
49
|
-
r);return n?
|
|
50
|
-
e.elements,t,r,o);if(
|
|
51
|
-
file)),null;if(!
|
|
52
|
-
(n.definitions={...n.definitions,extensible:!0}),n},"getTypeIdentity"),
|
|
53
|
-
let n=[];for(let s of e){let i=f(s,t,r,o);i&&n.push(i)}return n.length>1?
|
|
54
|
-
n[0]},"getIdentityFromUnion");import{isTypeIntersection as
|
|
55
|
-
import{getReferenceType as
|
|
56
|
-
"Invalid headers",void 0,"Http.Headers",t)}},
|
|
57
|
+
"IncorrectIdentityTypeError")}};import{getObjectSchema as Br,isObjectSchema as Nr}from"@ez4/schema/library";var m=p((e,t)=>{let r=Br(e,t);return r&&Nr(r)?r:null},"getSchemaFromType");var f=p((e,t,r,o)=>{if(Jr(e))return null;if(!Qr(e))return Se(e,t,r,o);let n=Kr(e,
|
|
58
|
+
r);return n?Se(n,t,r,o):null},"getHttpIdentity"),Se=p((e,t,r,o)=>{if(Gr(e))return Xr(
|
|
59
|
+
e.elements,t,r,o);if(Vr(e)||Ur(e))return m(e,r);if(!Yr(e))return o.push(new A(t.
|
|
60
|
+
file)),null;if(!se(e))return o.push(new v(e.name,t.file)),null;let n=m(e,r);return n&&
|
|
61
|
+
(n.definitions={...n.definitions,extensible:!0}),n},"getTypeIdentity"),Xr=p((e,t,r,o)=>{
|
|
62
|
+
let n=[];for(let s of e){let i=f(s,t,r,o);i&&n.push(i)}return n.length>1?Wr({elements:n}):
|
|
63
|
+
n[0]},"getIdentityFromUnion");import{isTypeIntersection as $r,isTypeObject as Lr,isTypeReference as et}from"@ez4/reflection";
|
|
64
|
+
import{getReferenceType as rt,isModelDeclaration as tt}from"@ez4/common/library";import{IncorrectTypeError as Zr,InvalidTypeError as _r}from"@ez4/common/library";var R=class extends _r{static{p(this,"InvalidHeadersTypeError")}constructor(t){super(
|
|
65
|
+
"Invalid headers",void 0,"Http.Headers",t)}},P=class extends Zr{constructor(r,o){
|
|
57
66
|
super("Incorrect headers",r,"Http.Headers",o);this.headersType=r}static{p(this,"\
|
|
58
|
-
IncorrectHeadersTypeError")}};var
|
|
59
|
-
o):null},"getHttpHeaders"),
|
|
60
|
-
(o.push(new
|
|
61
|
-
import{getReferenceType as
|
|
62
|
-
import{isTypeArray as
|
|
63
|
-
isTypeScalar as
|
|
64
|
-
"Invalid body",void 0,"Http.JsonBody",t)}},
|
|
67
|
+
IncorrectHeadersTypeError")}};var j=p((e,t,r,o)=>{if(!et(e))return xe(e,t,r,o);let n=rt(e,r);return n?xe(n,t,r,
|
|
68
|
+
o):null},"getHttpHeaders"),xe=p((e,t,r,o)=>Lr(e)||$r(e)?m(e,r):tt(e)?pe(e)?m(e,r):
|
|
69
|
+
(o.push(new P(e.name,t.file)),null):(o.push(new R(t.file)),null),"getTypeHeaders");import{createUnionSchema as pt,getScalarSchema as st,createArraySchema as it}from"@ez4/schema/library";
|
|
70
|
+
import{getReferenceType as ct,isModelDeclaration as lt}from"@ez4/common/library";
|
|
71
|
+
import{isTypeArray as mt,isTypeIntersection as at,isTypeObject as ut,isTypeReference as ft,
|
|
72
|
+
isTypeScalar as yt,isTypeUndefined as dt,isTypeUnion as Tt}from"@ez4/reflection";import{IncorrectTypeError as ot,InvalidTypeError as nt}from"@ez4/common/library";var w=class extends nt{static{p(this,"InvalidBodyTypeError")}constructor(t){super(
|
|
73
|
+
"Invalid body",void 0,"Http.JsonBody",t)}},O=class extends ot{constructor(r,o){super(
|
|
65
74
|
"Incorrect body",r,"Http.JsonBody",o);this.bodyType=r}static{p(this,"IncorrectBo\
|
|
66
|
-
dyTypeError")}};var
|
|
67
|
-
e))return null;if(!
|
|
68
|
-
ody"),
|
|
69
|
-
r,n=>
|
|
70
|
-
e,r):
|
|
71
|
-
null),"getCompoundTypeBody"),
|
|
72
|
-
r);s&&o.push(s)}return o.length?
|
|
73
|
-
(e,t,r)=>{let o=
|
|
74
|
-
"getHttpAuthResponse"),
|
|
75
|
-
|
|
76
|
-
t,r,o,n);let s=
|
|
77
|
-
identity,"isValidAuthResponse"),
|
|
78
|
-
(e,t,r,o,n)=>
|
|
79
|
-
e.name,n,e.file)),null):(o.push(new
|
|
80
|
-
let s={};for(let i of r)if(!(!
|
|
81
|
-
new
|
|
82
|
-
rs":{s.headers=
|
|
75
|
+
dyTypeError")}};var z=p((e,t,r,o)=>Z(e,r,n=>W(n)??X(n,t,r,o)),"getHttpBody"),Z=p((e,t,r)=>{if(dt(
|
|
76
|
+
e))return null;if(!ft(e))return r(e);let o=ct(e,t);return o?r(o):null},"getTypeB\
|
|
77
|
+
ody"),W=p(e=>yt(e)?st(e):null,"getScalarTypeBody"),X=p((e,t,r,o)=>Tt(e)?gt(e.elements,
|
|
78
|
+
r,n=>W(n)??X(n,t,r,o)):mt(e)?Mt(e.element,r,n=>W(n)??X(n,t,r,o)):ut(e)||at(e)?m(
|
|
79
|
+
e,r):lt(e)?le(e)?m(e,r):(o.push(new O(e.name,e.file)),null):(o.push(new w(t.file)),
|
|
80
|
+
null),"getCompoundTypeBody"),gt=p((e,t,r)=>{let o=[];for(let n of e){let s=Z(n,t,
|
|
81
|
+
r);s&&o.push(s)}return o.length?pt({elements:o}):null},"getUnionTypeBody"),Mt=p(
|
|
82
|
+
(e,t,r)=>{let o=Z(e,t,r);return o?it({element:o}):null},"getArrayTypeBody");var Ae=p((e,t,r,o)=>{let n=Re(e,t,r,o,"Http.AuthResponse");return n&&jt(n)?n:null},
|
|
83
|
+
"getHttpAuthResponse"),ve=p((e,t,r,o)=>{let n=Re(e,t,r,o,"Http.Response");return n&&
|
|
84
|
+
wt(n)?n:null},"getHttpHandlerResponse"),Re=p((e,t,r,o,n)=>{if(!Rt(e))return Ie(e,
|
|
85
|
+
t,r,o,n);let s=Et(e,r);return s?Ie(s,t,r,o,n):null},"getHttpResponse"),jt=p(e=>!!e.
|
|
86
|
+
identity,"isValidAuthResponse"),wt=p(e=>Pt(e.status),"isValidHandlerResponse"),Ie=p(
|
|
87
|
+
(e,t,r,o,n)=>vt(e)?Ee(e,t,xt(e),r,o):bt(e)?ht(e,n)?Ee(e,t,St(e),r,o):(o.push(new E(
|
|
88
|
+
e.name,n,e.file)),null):(o.push(new I(n,t.file)),null),"getTypeResponse"),Ee=p((e,t,r,o,n)=>{
|
|
89
|
+
let s={};for(let i of r)if(!(!At(i)||i.inherited))switch(i.name){default:n.push(
|
|
90
|
+
new Ht(t.name,i.name,e.file));break;case"status":s.status=It(i);break;case"heade\
|
|
91
|
+
rs":{s.headers=j(i.value,e,o,n),s.headers&&i.description&&(s.headers.description=
|
|
83
92
|
i.description);break}case"identity":{s.identity=f(i.value,e,o,n),s.identity&&i.description&&
|
|
84
|
-
(s.identity.description=i.description);break}case"body":{s.body=
|
|
93
|
+
(s.identity.description=i.description);break}case"body":{s.body=z(i.value,e,o,n),
|
|
85
94
|
s.body&&i.description&&(s.body.description=i.description);break}}return s},"getT\
|
|
86
|
-
ypeFromMembers");import{isModelProperty as
|
|
87
|
-
import{InvalidServicePropertyError as
|
|
88
|
-
getObjectMembers as
|
|
89
|
-
this.baseType=r}static{p(this,"InvalidRequestTypeError")}},
|
|
95
|
+
ypeFromMembers");import{isModelProperty as Wt,isTypeIntersection as Xt,isTypeObject as Zt,isTypeReference as _t}from"@ez4/reflection";
|
|
96
|
+
import{InvalidServicePropertyError as $t,isModelDeclaration as Lt,hasHeritageType as eo,
|
|
97
|
+
getObjectMembers as ro,getModelMembers as to,getReferenceType as oo}from"@ez4/common/library";import{IncorrectTypeError as Ot,InvalidTypeError as zt}from"@ez4/common/library";var C=class extends zt{constructor(r,o){super("Invalid route request",void 0,r,o);
|
|
98
|
+
this.baseType=r}static{p(this,"InvalidRequestTypeError")}},k=class extends Ot{constructor(r,o,n){
|
|
90
99
|
super("Incorrect route request",r,o,n);this.requestType=r;this.baseType=o}static{
|
|
91
|
-
p(this,"IncorrectRequestTypeError")}};import{isTypeIntersection as
|
|
92
|
-
import{getReferenceType as
|
|
93
|
-
super("Invalid request parameters",void 0,"Http.PathParameters",t)}},
|
|
100
|
+
p(this,"IncorrectRequestTypeError")}};import{isTypeIntersection as qt,isTypeObject as Dt,isTypeReference as Ft}from"@ez4/reflection";
|
|
101
|
+
import{getReferenceType as Bt,isModelDeclaration as Nt}from"@ez4/common/library";import{IncorrectTypeError as Ct,InvalidTypeError as kt}from"@ez4/common/library";var q=class extends kt{static{p(this,"InvalidParameterTypeError")}constructor(t){
|
|
102
|
+
super("Invalid request parameters",void 0,"Http.PathParameters",t)}},D=class extends Ct{constructor(r,o){
|
|
94
103
|
super("Incorrect request parameters",r,"Http.PathParameters",o);this.parametersType=
|
|
95
|
-
r}static{p(this,"IncorrectParameterTypeError")}};var
|
|
96
|
-
r,o):null},"getHttpParameters"),
|
|
97
|
-
m(e,r):(o.push(new
|
|
98
|
-
Parameter");import{isTypeIntersection as
|
|
99
|
-
import{getReferenceType as
|
|
100
|
-
"Invalid request query strings",void 0,"Http.QueryStrings",t)}},
|
|
104
|
+
r}static{p(this,"IncorrectParameterTypeError")}};var je=p((e,t,r,o)=>{if(!Ft(e))return Pe(e,t,r,o);let n=Bt(e,r);return n?Pe(n,t,
|
|
105
|
+
r,o):null},"getHttpParameters"),Pe=p((e,t,r,o)=>Dt(e)||qt(e)?m(e,r):Nt(e)?ce(e)?
|
|
106
|
+
m(e,r):(o.push(new D(e.name,e.file)),null):(o.push(new q(t.file)),null),"getType\
|
|
107
|
+
Parameter");import{isTypeIntersection as Qt,isTypeObject as Jt,isTypeReference as Gt}from"@ez4/reflection";
|
|
108
|
+
import{getReferenceType as Kt,isModelDeclaration as Yt}from"@ez4/common/library";import{IncorrectTypeError as Ut,InvalidTypeError as Vt}from"@ez4/common/library";var F=class extends Vt{static{p(this,"InvalidQueryTypeError")}constructor(t){super(
|
|
109
|
+
"Invalid request query strings",void 0,"Http.QueryStrings",t)}},B=class extends Ut{constructor(r,o){
|
|
101
110
|
super("Incorrect request query strings",r,"Http.QueryStrings",o);this.queryType=
|
|
102
|
-
r}static{p(this,"IncorrectQueryTypeError")}};var
|
|
103
|
-
r,o):null},"getHttpQuery"),
|
|
104
|
-
(o.push(new
|
|
105
|
-
e,t,r,o,"Http.Request"),"getHttpHandlerRequest"),
|
|
106
|
-
length>0)return
|
|
107
|
-
e,r);return s?
|
|
108
|
-
t,
|
|
109
|
-
(o.push(new
|
|
110
|
-
if(!(!
|
|
111
|
-
break;case"headers":{s.headers=
|
|
111
|
+
r}static{p(this,"IncorrectQueryTypeError")}};var Oe=p((e,t,r,o)=>{if(!Gt(e))return we(e,t,r,o);let n=Kt(e,r);return n?we(n,t,
|
|
112
|
+
r,o):null},"getHttpQuery"),we=p((e,t,r,o)=>Jt(e)||Qt(e)?m(e,r):Yt(e)?ie(e)?m(e,r):
|
|
113
|
+
(o.push(new B(e.name,t.file)),null):(o.push(new F(t.file)),null),"getTypeQuery");var ke=p((e,t,r,o)=>_(e,t,r,o,"Http.AuthRequest"),"getHttpAuthRequest"),qe=p((e,t,r,o)=>_(
|
|
114
|
+
e,t,r,o,"Http.Request"),"getHttpHandlerRequest"),_=p((e,t,r,o,n)=>{if(Xt(e)&&e.elements.
|
|
115
|
+
length>0)return _(e.elements[0],t,r,o,n);if(!_t(e))return ze(e,t,r,o,n);let s=oo(
|
|
116
|
+
e,r);return s?ze(s,t,r,o,n):null},"getHttpRequest"),ze=p((e,t,r,o,n)=>Zt(e)?Ce(e,
|
|
117
|
+
t,ro(e),r,o):Lt(e)?eo(e,n)?Ce(e,t,to(e),r,o):(o.push(new k(e.name,n,e.file)),null):
|
|
118
|
+
(o.push(new C(n,t.file)),null),"getTypeRequest"),Ce=p((e,t,r,o,n)=>{let s={};for(let i of r)
|
|
119
|
+
if(!(!Wt(i)||i.inherited))switch(i.name){default:n.push(new $t(t.name,i.name,e.file));
|
|
120
|
+
break;case"headers":{s.headers=j(i.value,e,o,n),s.headers&&i.description&&(s.headers.
|
|
112
121
|
description=i.description);break}case"identity":{s.identity=f(i.value,e,o,n),s.identity&&
|
|
113
122
|
i.description&&(s.identity.description=i.description);break}case"query":{s.query=
|
|
114
|
-
|
|
115
|
-
parameters":{s.parameters=
|
|
116
|
-
description=i.description);break}case"body":{s.body=
|
|
117
|
-
(s.body.description=i.description);break}}return s},"getTypeFromMembers");var
|
|
118
|
-
description&&(
|
|
119
|
-
file=e.file)&&
|
|
120
|
-
|
|
121
|
-
[...
|
|
122
|
-
|
|
123
|
-
super("Incomplete route handler",t,r)}};var
|
|
124
|
-
|
|
125
|
-
"name"),(
|
|
126
|
-
|
|
127
|
-
"response"))}return
|
|
128
|
-
|
|
129
|
-
let n=[];for(let s of e){let i=
|
|
130
|
-
i)}return n},"getRouteFromTuple"),
|
|
131
|
-
let n=
|
|
132
|
-
handler,"isValidRoute"),
|
|
133
|
-
r,o):
|
|
134
|
-
let s={},i=new Set(["path","handler"]);for(let c of r)if(!(!
|
|
135
|
-
switch(c.name){default:n.push(new
|
|
136
|
-
c);l&&
|
|
137
|
-
t,o,n))&&i.delete(c.name);break;case"authorizer":s.authorizer=
|
|
138
|
-
break;case"httpErrors":s.httpErrors=
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
return
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
"
|
|
146
|
-
|
|
123
|
+
Oe(i.value,e,o,n),s.query&&i.description&&(s.query.description=i.description);break}case"\
|
|
124
|
+
parameters":{s.parameters=je(i.value,e,o,n),s.parameters&&i.description&&(s.parameters.
|
|
125
|
+
description=i.description);break}case"body":{s.body=z(i.value,e,o,n),s.body&&i.description&&
|
|
126
|
+
(s.body.description=i.description);break}}return s},"getTypeFromMembers");var De=p((e,t,r,o)=>{if(!ue(e))return null;let{description:n,module:s}=e,i={...n&&
|
|
127
|
+
{description:n},...s&&{module:s}},c=new Set(["name","file"]);if((i.name=e.name)&&
|
|
128
|
+
c.delete("name"),(i.file=e.file)&&c.delete("file"),e.parameters){let[{value:l}]=e.
|
|
129
|
+
parameters;i.request=ke(l,t,r,o)}return e.return&&(i.response=Ae(e.return,t,r,o)),
|
|
130
|
+
no(i)?i:(o.push(new x([...c],e.file)),null)},"getHttpAuthorizer"),no=p(e=>!!e.name&&
|
|
131
|
+
!!e.file,"isValidAuthorizer");import{IncompleteTypeError as po}from"@ez4/common/library";var N=class extends po{static{p(this,"IncompleteHandlerError")}constructor(t,r){
|
|
132
|
+
super("Incomplete route handler",t,r)}};var Fe=p((e,t,r,o)=>{if(!fe(e))return null;let{description:n,module:s}=e,i={...n&&
|
|
133
|
+
{description:n},...s&&{module:s}},c=new Set(["name","file","response"]);if((i.name=
|
|
134
|
+
e.name)&&c.delete("name"),(i.file=e.file)&&c.delete("file"),e.parameters){let[{value:l}]=e.
|
|
135
|
+
parameters;i.request=qe(l,t,r,o)}if(e.return){let l=ve(e.return,t,r,o);l&&(i.response=
|
|
136
|
+
l,c.delete("response"))}return so(i)?i:(o.push(new N([...c],e.file)),null)},"get\
|
|
137
|
+
HttpHandler"),so=p(e=>!!e.name&&!!e.file&&!!e.response,"isValidHandler");var Ue=p((e,t,r,o)=>{let n=ho(t)??[];return Ve(n,e,r,o)},"getHttpRoutes"),Ve=p((e,t,r,o)=>{
|
|
138
|
+
let n=[];for(let s of e){let i=So(s,t,r,o);Array.isArray(i)?n.push(...i):i&&n.push(
|
|
139
|
+
i)}return n},"getRouteFromTuple"),So=p((e,t,r,o)=>{if(!lo(e))return Be(e,t,r,o);
|
|
140
|
+
let n=bo(e,r);return n?Be(n,t,r,o):null},"getTypeFromRoute"),xo=p(e=>!!e.path&&!!e.
|
|
141
|
+
handler,"isValidRoute"),Be=p((e,t,r,o)=>te(e)?Ne(e,t,Mo(e),r,o):co(e)?Ne(e,t,go(
|
|
142
|
+
e),r,o):mo(e)&&e.spread?Ve(e.elements,t,r,o):null,"getRouteType"),Ne=p((e,t,r,o,n)=>{
|
|
143
|
+
let s={},i=new Set(["path","handler"]);for(let c of r)if(!(!io(c)||c.inherited))
|
|
144
|
+
switch(c.name){default:n.push(new ao(t.name,c.name,e.file));break;case"path":{let l=To(
|
|
145
|
+
c);l&&ee(l)&&(i.delete(c.name),s.path=l);break}case"handler":(s.handler=Fe(c.value,
|
|
146
|
+
t,o,n))&&i.delete(c.name);break;case"authorizer":s.authorizer=De(c.value,t,o,n);
|
|
147
|
+
break;case"httpErrors":s.httpErrors=H(c.value,t,o,n);break;case"preferences":s.preferences=
|
|
148
|
+
T(c.value,t,o,n);break;case"memory":case"logRetention":case"timeout":s[c.name]=yo(
|
|
149
|
+
c);break;case"cors":s.cors=fo(c);break;case"listener":s.listener=Ho(c.value,n);break;case"\
|
|
150
|
+
variables":s.variables=uo(c,n);break}return xo(s)?s:(n.push(new S([...i],e.file)),
|
|
151
|
+
null)},"getTypeFromMembers");import{InvalidServicePropertyError as vo,isModelDeclaration as Ro,getModelMembers as Po,
|
|
152
|
+
getObjectMembers as jo,getPropertyBoolean as wo,getPropertyStringList as Oo,getPropertyNumber as zo,
|
|
153
|
+
getReferenceType as Co}from"@ez4/common/library";import{isModelProperty as ko,isTypeObject as qo,
|
|
154
|
+
isTypeReference as Do}from"@ez4/reflection";import{IncompleteTypeError as Io,IncorrectTypeError as Eo,InvalidTypeError as Ao}from"@ez4/common/library";var U=class extends Io{static{p(this,"IncompleteCorsError")}constructor(t,r){super(
|
|
155
|
+
"Incomplete HTTP CORS",t,r)}},V=class extends Ao{static{p(this,"InvalidCorsTypeE\
|
|
156
|
+
rror")}constructor(t){super("Invalid HTTP CORS type",void 0,"Http.Cors",t)}},Q=class extends Eo{constructor(r,o){
|
|
147
157
|
super("Incorrect HTTP CORS type",r,"Http.Cors",o);this.fallbackType=r}static{p(this,
|
|
148
|
-
"IncorrectCorsTypeError")}};var
|
|
149
|
-
null},"getHttpCors"),
|
|
150
|
-
e)?
|
|
151
|
-
(r.push(new
|
|
152
|
-
["allowOrigins"]);for(let i of r)if(!(!
|
|
153
|
-
o.push(new
|
|
154
|
-
allowHeaders":case"exposeHeaders":n[i.name]=
|
|
155
|
-
allowCredentials=
|
|
156
|
-
push(new
|
|
157
|
-
getObjectMembers as
|
|
158
|
-
import{isModelProperty as
|
|
159
|
-
import{isAnyNumber as
|
|
160
|
-
"Incomplete gateway cache",t,r)}},
|
|
158
|
+
"IncorrectCorsTypeError")}};var Ge=p((e,t,r,o)=>{if(!Do(e))return Qe(e,t,o);let n=Co(e,r);return n?Qe(n,t,o):
|
|
159
|
+
null},"getHttpCors"),Fo=p(e=>!!e.allowOrigins?.length,"isValidCors"),Qe=p((e,t,r)=>qo(
|
|
160
|
+
e)?Je(e,t,jo(e),r):Ro(e)?me(e)?Je(e,t,Po(e),r):(r.push(new Q(e.name,e.file)),null):
|
|
161
|
+
(r.push(new V(t.file)),null),"getTypeCors"),Je=p((e,t,r,o)=>{let n={},s=new Set(
|
|
162
|
+
["allowOrigins"]);for(let i of r)if(!(!ko(i)||i.inherited))switch(i.name){default:
|
|
163
|
+
o.push(new vo(t.name,i.name,e.file));break;case"allowOrigins":case"allowMethods":case"\
|
|
164
|
+
allowHeaders":case"exposeHeaders":n[i.name]=Oo(i);break;case"allowCredentials":n.
|
|
165
|
+
allowCredentials=wo(i);break;case"maxAge":n.maxAge=zo(i);break}return Fo(n)?n:(o.
|
|
166
|
+
push(new U([...s],e.file)),null)},"getTypeFromMembers");import{InvalidServicePropertyError as Vo,isModelDeclaration as Qo,getModelMembers as Jo,
|
|
167
|
+
getObjectMembers as Go,getPropertyNumber as Ko,getReferenceType as Yo}from"@ez4/common/library";
|
|
168
|
+
import{isModelProperty as Wo,isTypeObject as Xo,isTypeReference as Zo}from"@ez4/reflection";
|
|
169
|
+
import{isAnyNumber as We}from"@ez4/utils";import{IncompleteTypeError as Bo,IncorrectTypeError as No,InvalidTypeError as Uo}from"@ez4/common/library";var J=class extends Bo{static{p(this,"IncompleteCacheError")}constructor(t,r){super(
|
|
170
|
+
"Incomplete gateway cache",t,r)}},G=class extends Uo{static{p(this,"InvalidCache\
|
|
161
171
|
TypeError")}constructor(t){super("Invalid gateway cache type",void 0,"Http.Cache",
|
|
162
|
-
t)}},
|
|
163
|
-
"Http.Cache",o);this.cacheType=r}static{p(this,"IncorrectCacheTypeError")}};var
|
|
164
|
-
null},"getHttpCache"),
|
|
165
|
-
e)?
|
|
166
|
-
(r.push(new
|
|
167
|
-
["authorizerTTL"]);for(let i of r)if(!(!
|
|
168
|
-
o.push(new
|
|
169
|
-
(n[i.name]=c,s.delete(i.name));break}}return
|
|
170
|
-
null)},"getTypeFromMembers");var
|
|
171
|
-
type:
|
|
172
|
-
description=n.description);for(let l of
|
|
173
|
-
name){default:r.push(new
|
|
174
|
-
l,e,r))&&i.delete(l.name);break;case"name":s.displayName=
|
|
175
|
-
ts":s.defaults=
|
|
176
|
-
cors":s.cors=
|
|
177
|
-
services":s.services=
|
|
178
|
-
if(t[n.name]){r.push(new
|
|
179
|
-
"getHttpServices"),
|
|
180
|
-
|
|
181
|
-
super("Invalid defaults",void 0,"Http.Defaults",t)}},
|
|
172
|
+
t)}},K=class extends No{constructor(r,o){super("Incorrect gateway cache type",r,
|
|
173
|
+
"Http.Cache",o);this.cacheType=r}static{p(this,"IncorrectCacheTypeError")}};var Xe=p((e,t,r,o)=>{if(!Zo(e))return Ke(e,t,o);let n=Yo(e,r);return n?Ke(n,t,o):
|
|
174
|
+
null},"getHttpCache"),_o=p(e=>We(e.authorizerTTL),"isValidCache"),Ke=p((e,t,r)=>Xo(
|
|
175
|
+
e)?Ye(e,t,Go(e),r):Qo(e)?ae(e)?Ye(e,t,Jo(e),r):(r.push(new K(e.name,e.file)),null):
|
|
176
|
+
(r.push(new G(t.file)),null),"getTypeCache"),Ye=p((e,t,r,o)=>{let n={},s=new Set(
|
|
177
|
+
["authorizerTTL"]);for(let i of r)if(!(!Wo(i)||i.inherited))switch(i.name){default:
|
|
178
|
+
o.push(new Vo(t.name,i.name,e.file));break;case"authorizerTTL":{let c=Ko(i);We(c)&&
|
|
179
|
+
(n[i.name]=c,s.delete(i.name));break}}return _o(n)?n:(o.push(new J([...s],e.file)),
|
|
180
|
+
null)},"getTypeFromMembers");var Ze=p(e=>{let t={},r=[];for(let o in e){let n=e[o];if(!re(n)||Lo(n))continue;
|
|
181
|
+
let s={type:Y,extras:{}},i=new Set(["routes"]),c=n.file;s.name=n.name,n.description&&
|
|
182
|
+
(s.description=n.description);for(let l of tn(n))if(!(!pn(l)||l.inherited))switch(l.
|
|
183
|
+
name){default:r.push(new nn(s.name,l.name,c));break;case"routes":(s.routes=Ue(n,
|
|
184
|
+
l,e,r))&&i.delete(l.name);break;case"name":s.displayName=on(l);break;case"defaul\
|
|
185
|
+
ts":s.defaults=he(l.value,n,e,r);break;case"cache":s.cache=Xe(l.value,n,e,r);break;case"\
|
|
186
|
+
cors":s.cors=Ge(l.value,n,e,r);break;case"variables":s.variables=rn(l,r);break;case"\
|
|
187
|
+
services":s.services=en(l,e,r);break}if(!sn(s)){r.push(new y([...i],c));continue}
|
|
188
|
+
if(t[n.name]){r.push(new $o(n.name,c));continue}t[n.name]=s}return{services:t,errors:r}},
|
|
189
|
+
"getHttpServices"),sn=p(e=>!!e.name&&!!e.routes&&!!e.extras,"isValidService");var _e=!1,ji=p(()=>{_e||(cn(),ln(),mn("@ez4/gateway",{"metadata:getServices":Ze}),
|
|
190
|
+
_e=!0)},"registerTriggers");import{IncorrectTypeError as an,InvalidTypeError as un}from"@ez4/common/library";var b=class extends un{static{p(this,"InvalidDefaultsTypeError")}constructor(t){
|
|
191
|
+
super("Invalid defaults",void 0,"Http.Defaults",t)}},h=class extends an{constructor(r,o){
|
|
182
192
|
super("Incorrect defaults",r,"Http.Defaults",o);this.defaultsType=r}static{p(this,
|
|
183
|
-
"IncorrectDefaultsTypeError")}};
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
193
|
+
"IncorrectDefaultsTypeError")}};import{IncorrectTypeError as fn,InvalidTypeError as yn}from"@ez4/common/library";var g=class extends yn{static{p(this,"InvalidPreferencesTypeError")}constructor(t){
|
|
194
|
+
super("Invalid preferences",void 0,"Http.Preferences",t)}},M=class extends fn{constructor(r,o){
|
|
195
|
+
super("Incorrect preferences",r,"Http.Preferences",o);this.preferencesType=r}static{
|
|
196
|
+
p(this,"IncorrectPreferencesTypeError")}};export{x as IncompleteAuthorizerError,J as IncompleteCacheError,U as IncompleteCorsError,
|
|
197
|
+
N as IncompleteHandlerError,S as IncompleteRouteError,y as IncompleteServiceError,
|
|
198
|
+
O as IncorrectBodyTypeError,K as IncorrectCacheTypeError,Q as IncorrectCorsTypeError,
|
|
199
|
+
h as IncorrectDefaultsTypeError,P as IncorrectHeadersTypeError,v as IncorrectIdentityTypeError,
|
|
200
|
+
D as IncorrectParameterTypeError,M as IncorrectPreferencesTypeError,B as IncorrectQueryTypeError,
|
|
201
|
+
k as IncorrectRequestTypeError,E as IncorrectResponseTypeError,w as InvalidBodyTypeError,
|
|
202
|
+
G as InvalidCacheTypeError,V as InvalidCorsTypeError,b as InvalidDefaultsTypeError,
|
|
203
|
+
R as InvalidHeadersTypeError,A as InvalidIdentityTypeError,q as InvalidParameterTypeError,
|
|
204
|
+
g as InvalidPreferencesTypeError,F as InvalidQueryTypeError,C as InvalidRequestTypeError,
|
|
205
|
+
I as InvalidResponseTypeError,u as InvalidRouteErrorTypeError,Y as ServiceType,ke as getHttpAuthRequest,
|
|
206
|
+
Ae as getHttpAuthResponse,De as getHttpAuthorizer,z as getHttpBody,Xe as getHttpCache,
|
|
207
|
+
Ge as getHttpCors,Fe as getHttpHandler,qe as getHttpHandlerRequest,ve as getHttpHandlerResponse,
|
|
208
|
+
j as getHttpHeaders,f as getHttpIdentity,je as getHttpParameters,Oe as getHttpQuery,
|
|
209
|
+
Ue as getHttpRoutes,Ze as getHttpServices,Tn as isHttpService,ji as registerTriggers};
|
|
197
210
|
//# sourceMappingURL=library.mjs.map
|
package/dist/main.cjs
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
"use strict";var u=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var p=(s,
|
|
2
|
-
typeof
|
|
3
|
-
u(s,o,{get:()=>
|
|
4
|
-
HttpInternalServerError:()=>
|
|
5
|
-
HttpUnprocessableEntityError:()=>
|
|
6
|
-
exports=q(b);var H;(s=>{})(H||={});var r=class extends Error{constructor(
|
|
7
|
-
n;this.details=o}static{p(this,"HttpError")}},
|
|
8
|
-
ttpBadRequestError")}constructor(t
|
|
9
|
-
p(this,"HttpUnauthorizedError")}constructor(t
|
|
10
|
-
a=class extends r{static{p(this,"HttpForbiddenError")}constructor(t
|
|
11
|
-
|
|
12
|
-
super(404,
|
|
13
|
-
diaTypeError")}constructor(t
|
|
14
|
-
p(this,"HttpUnprocessableEntityError")}constructor(t
|
|
15
|
-
ble entity",
|
|
16
|
-
super(500,
|
|
1
|
+
"use strict";var u=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var p=(s,e)=>u(s,"name",{value:e,configurable:!0});var g=(s,e)=>{for(var t in e)u(s,t,{get:e[t],enumerable:!0})},S=(s,e,t,n)=>{if(e&&
|
|
2
|
+
typeof e=="object"||typeof e=="function")for(let o of l(e))!h.call(s,o)&&o!==t&&
|
|
3
|
+
u(s,o,{get:()=>e[o],enumerable:!(n=R(e,o))||n.enumerable});return s};var q=s=>S(u({},"__esModule",{value:!0}),s);var b={};g(b,{Http:()=>H,HttpBadRequestError:()=>c,HttpError:()=>r,HttpForbiddenError:()=>a,
|
|
4
|
+
HttpInternalServerError:()=>d,HttpNotFoundError:()=>x,HttpUnauthorizedError:()=>i,
|
|
5
|
+
HttpUnprocessableEntityError:()=>y,HttpUnsupportedMediaTypeError:()=>m});module.
|
|
6
|
+
exports=q(b);var H;(s=>{})(H||={});var r=class extends Error{constructor(t,n,o){super(n);this.status=t;this.message=
|
|
7
|
+
n;this.details=o}static{p(this,"HttpError")}},c=class extends r{static{p(this,"H\
|
|
8
|
+
ttpBadRequestError")}constructor(e,t){super(400,e||"Bad request",t)}},i=class extends r{static{
|
|
9
|
+
p(this,"HttpUnauthorizedError")}constructor(e,t){super(401,e||"Unauthorized",t)}},
|
|
10
|
+
a=class extends r{static{p(this,"HttpForbiddenError")}constructor(e,t){super(403,
|
|
11
|
+
e||"Forbidden",t)}},x=class extends r{static{p(this,"HttpNotFoundError")}constructor(e,t){
|
|
12
|
+
super(404,e||"Not found",t)}},m=class extends r{static{p(this,"HttpUnsupportedMe\
|
|
13
|
+
diaTypeError")}constructor(e,t){super(415,e||"Unsupported media type",t)}},y=class extends r{static{
|
|
14
|
+
p(this,"HttpUnprocessableEntityError")}constructor(e,t){super(422,e||"Unprocessa\
|
|
15
|
+
ble entity",t)}},d=class extends r{static{p(this,"HttpInternalServerError")}constructor(e,t){
|
|
16
|
+
super(500,e||"Internal server error",t)}};0&&(module.exports={Http,HttpBadRequestError,HttpError,HttpForbiddenError,HttpInternalServerError,
|
|
17
17
|
HttpNotFoundError,HttpUnauthorizedError,HttpUnprocessableEntityError,HttpUnsupportedMediaTypeError});
|
|
18
18
|
//# sourceMappingURL=main.cjs.map
|
package/dist/main.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
ttpBadRequestError")}constructor(t
|
|
4
|
-
r(this,"HttpUnauthorizedError")}constructor(t
|
|
5
|
-
u=class extends p{static{r(this,"HttpForbiddenError")}constructor(t
|
|
6
|
-
|
|
7
|
-
super(404,
|
|
8
|
-
diaTypeError")}constructor(t
|
|
9
|
-
r(this,"HttpUnprocessableEntityError")}constructor(t
|
|
10
|
-
ble entity",
|
|
11
|
-
super(500,
|
|
12
|
-
x as HttpInternalServerError,
|
|
13
|
-
|
|
1
|
+
var y=Object.defineProperty;var r=(s,e)=>y(s,"name",{value:e,configurable:!0});var d;(s=>{})(d||={});var p=class extends Error{constructor(t,m,H){super(m);this.status=t;this.message=
|
|
2
|
+
m;this.details=H}static{r(this,"HttpError")}},o=class extends p{static{r(this,"H\
|
|
3
|
+
ttpBadRequestError")}constructor(e,t){super(400,e||"Bad request",t)}},n=class extends p{static{
|
|
4
|
+
r(this,"HttpUnauthorizedError")}constructor(e,t){super(401,e||"Unauthorized",t)}},
|
|
5
|
+
u=class extends p{static{r(this,"HttpForbiddenError")}constructor(e,t){super(403,
|
|
6
|
+
e||"Forbidden",t)}},c=class extends p{static{r(this,"HttpNotFoundError")}constructor(e,t){
|
|
7
|
+
super(404,e||"Not found",t)}},i=class extends p{static{r(this,"HttpUnsupportedMe\
|
|
8
|
+
diaTypeError")}constructor(e,t){super(415,e||"Unsupported media type",t)}},a=class extends p{static{
|
|
9
|
+
r(this,"HttpUnprocessableEntityError")}constructor(e,t){super(422,e||"Unprocessa\
|
|
10
|
+
ble entity",t)}},x=class extends p{static{r(this,"HttpInternalServerError")}constructor(e,t){
|
|
11
|
+
super(500,e||"Internal server error",t)}};export{d as Http,o as HttpBadRequestError,p as HttpError,u as HttpForbiddenError,
|
|
12
|
+
x as HttpInternalServerError,c as HttpNotFoundError,n as HttpUnauthorizedError,a as HttpUnprocessableEntityError,
|
|
13
|
+
i as HttpUnsupportedMediaTypeError};
|
|
14
14
|
//# sourceMappingURL=main.mjs.map
|
package/dist/metadata/body.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AllType, SourceMap, TypeIntersection, TypeModel, TypeObject } from '@ez4/reflection';
|
|
2
2
|
import type { ArraySchema, ObjectSchema, UnionSchema } from '@ez4/schema/library';
|
|
3
3
|
type TypeParent = TypeObject | TypeModel | TypeIntersection;
|
|
4
|
-
export declare const getHttpBody: (type: AllType, parent: TypeParent, reflection: SourceMap, errorList: Error[]) =>
|
|
4
|
+
export declare const getHttpBody: (type: AllType, parent: TypeParent, reflection: SourceMap, errorList: Error[]) => import("@ez4/schema/library").BooleanSchema | import("@ez4/schema/library").NumberSchema | import("@ez4/schema/library").StringSchema | ObjectSchema | UnionSchema | ArraySchema | null;
|
|
5
5
|
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { AllType, SourceMap, TypeModel } from '@ez4/reflection';
|
|
2
|
+
import type { HttpPreferences } from '../types/common.js';
|
|
3
|
+
export declare const getHttpPreferences: (type: AllType, parent: TypeModel, reflection: SourceMap, errorList: Error[]) => HttpPreferences | undefined;
|
package/dist/metadata/utils.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export declare const isHttpHandlerRequest: (type: TypeModel) => boolean;
|
|
|
8
8
|
export declare const isHttpAuthorizerResponse: (type: TypeModel) => boolean;
|
|
9
9
|
export declare const isHttpHandlerResponse: (type: TypeModel) => boolean;
|
|
10
10
|
export declare const isHttpDefaults: (type: TypeModel) => boolean;
|
|
11
|
+
export declare const isHttpPreferences: (type: TypeModel) => boolean;
|
|
11
12
|
export declare const isHttpHeaders: (type: TypeModel) => boolean;
|
|
12
13
|
export declare const isHttpIdentity: (type: TypeModel) => boolean;
|
|
13
14
|
export declare const isHttpQuery: (type: TypeModel) => boolean;
|