@ez4/gateway 0.37.0 → 0.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/library.cjs +250 -243
- package/dist/library.mjs +363 -354
- package/dist/metadata/http/defaults.d.ts +1 -1
- package/dist/metadata/http/types.d.ts +5 -9
- package/dist/metadata/ws/types.d.ts +6 -16
- package/dist/services/defaults.d.ts +9 -0
- package/dist/services/http/contract.d.ts +1 -1
- package/dist/services/http/incoming.d.ts +5 -1
- package/dist/services/target.d.ts +9 -0
- package/dist/services/ws/incoming.d.ts +5 -1
- package/dist/utils.cjs +10 -10
- package/dist/utils.mjs +26 -26
- package/package.json +8 -8
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { AllType, ReflectionTypes, TypeModel } from '@ez4/reflection';
|
|
2
|
-
import {
|
|
2
|
+
import type { HttpDefaults } from './types';
|
|
3
3
|
export declare const isHttpDefaultsDeclaration: (type: TypeModel) => boolean;
|
|
4
4
|
export declare const getHttpDefaultsMetadata: (type: AllType, parent: TypeModel, reflection: ReflectionTypes, errorList: Error[]) => HttpDefaults | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ArraySchema, NamingStyle, ObjectSchema, ScalarSchema, UnionSchema } from '@ez4/schema';
|
|
2
|
+
import type { LinkedServices, LinkedVariables, ServiceMetadata } from '@ez4/project/library';
|
|
2
3
|
import type { FunctionSignature, ServiceListener } from '@ez4/common/library';
|
|
3
|
-
import type {
|
|
4
|
-
import type { ServiceMetadata } from '@ez4/project/library';
|
|
4
|
+
import type { ArchitectureType, RuntimeType } from '@ez4/project';
|
|
5
5
|
import type { AuthorizationType } from '../../services/http/authorization';
|
|
6
6
|
import type { HttpPath } from '../../services/http/path';
|
|
7
7
|
import type { AuthHandler } from '../auth/types';
|
|
@@ -57,18 +57,12 @@ export type HttpHandler = FunctionSignature & {
|
|
|
57
57
|
export type HttpErrors = {
|
|
58
58
|
[name: string]: number;
|
|
59
59
|
};
|
|
60
|
-
export type HttpRoute = {
|
|
60
|
+
export type HttpRoute = HttpDefaults & {
|
|
61
61
|
name?: string;
|
|
62
62
|
path: HttpPath;
|
|
63
63
|
handler: HttpHandler;
|
|
64
|
-
listener?: ServiceListener;
|
|
65
64
|
authorizer?: AuthHandler;
|
|
66
65
|
variables?: LinkedVariables;
|
|
67
|
-
httpErrors?: HttpErrors;
|
|
68
|
-
preferences?: HttpPreferences;
|
|
69
|
-
logRetention?: number;
|
|
70
|
-
timeout?: number;
|
|
71
|
-
memory?: number;
|
|
72
66
|
cors?: boolean;
|
|
73
67
|
disabled?: boolean;
|
|
74
68
|
};
|
|
@@ -76,6 +70,8 @@ export type HttpDefaults = {
|
|
|
76
70
|
listener?: ServiceListener;
|
|
77
71
|
httpErrors?: HttpErrors;
|
|
78
72
|
preferences?: HttpPreferences;
|
|
73
|
+
architecture?: ArchitectureType;
|
|
74
|
+
runtime?: RuntimeType;
|
|
79
75
|
logRetention?: number;
|
|
80
76
|
timeout?: number;
|
|
81
77
|
memory?: number;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ArraySchema, NamingStyle, ObjectSchema, ScalarSchema, UnionSchema } from '@ez4/schema';
|
|
2
|
-
import type { LinkedVariables, ServiceMetadata } from '@ez4/project/library';
|
|
3
2
|
import type { FunctionSignature, ServiceListener } from '@ez4/common/library';
|
|
3
|
+
import type { LinkedVariables, ServiceMetadata } from '@ez4/project/library';
|
|
4
|
+
import type { ArchitectureType, RuntimeType } from '@ez4/project';
|
|
4
5
|
import type { AuthHandler } from '../auth/types';
|
|
5
6
|
export declare const WsServiceType = "@ez4/ws";
|
|
6
7
|
export declare const WsNamespaceType = "Ws";
|
|
@@ -16,24 +17,14 @@ export type WsService = Omit<ServiceMetadata, 'variables' | 'services'> & Requir
|
|
|
16
17
|
disconnect: WsConnection;
|
|
17
18
|
message: WsMessage;
|
|
18
19
|
};
|
|
19
|
-
export type WsConnection = {
|
|
20
|
+
export type WsConnection = WsDefaults & {
|
|
20
21
|
handler: WsHandler;
|
|
21
|
-
listener?: ServiceListener;
|
|
22
22
|
authorizer?: AuthHandler;
|
|
23
23
|
variables?: LinkedVariables;
|
|
24
|
-
preferences?: WsPreferences;
|
|
25
|
-
logRetention?: number;
|
|
26
|
-
timeout?: number;
|
|
27
|
-
memory?: number;
|
|
28
24
|
};
|
|
29
|
-
export type WsMessage = {
|
|
25
|
+
export type WsMessage = WsDefaults & {
|
|
30
26
|
handler: WsHandler;
|
|
31
|
-
listener?: ServiceListener;
|
|
32
27
|
variables?: LinkedVariables;
|
|
33
|
-
preferences?: WsPreferences;
|
|
34
|
-
logRetention?: number;
|
|
35
|
-
timeout?: number;
|
|
36
|
-
memory?: number;
|
|
37
28
|
};
|
|
38
29
|
export type WsHandler = FunctionSignature & {
|
|
39
30
|
request?: WsRequest | WsEvent;
|
|
@@ -58,13 +49,12 @@ export type WsPreferences = {
|
|
|
58
49
|
export type WsDefaults = {
|
|
59
50
|
listener?: ServiceListener;
|
|
60
51
|
preferences?: WsPreferences;
|
|
52
|
+
architecture?: ArchitectureType;
|
|
53
|
+
runtime?: RuntimeType;
|
|
61
54
|
logRetention?: number;
|
|
62
55
|
timeout?: number;
|
|
63
56
|
memory?: number;
|
|
64
57
|
};
|
|
65
|
-
export type WsCache = {
|
|
66
|
-
authorizerTTL?: number;
|
|
67
|
-
};
|
|
68
58
|
export declare const isWsService: (service: ServiceMetadata) => service is WsService;
|
|
69
59
|
export declare const createWsService: (name: string) => {
|
|
70
60
|
variables: {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ArchitectureType, RuntimeType } from '@ez4/project';
|
|
1
2
|
import type { WebPreferences } from './preferences';
|
|
2
3
|
/**
|
|
3
4
|
* Default service parameters.
|
|
@@ -19,4 +20,12 @@ export interface WebDefaults {
|
|
|
19
20
|
* Default amount of memory available (in megabytes) for handlers.
|
|
20
21
|
*/
|
|
21
22
|
readonly memory?: number;
|
|
23
|
+
/**
|
|
24
|
+
* Default architecture for all the API functions.
|
|
25
|
+
*/
|
|
26
|
+
readonly architecture?: ArchitectureType;
|
|
27
|
+
/**
|
|
28
|
+
* Default runtime for all the API functions.
|
|
29
|
+
*/
|
|
30
|
+
readonly runtime?: RuntimeType;
|
|
22
31
|
}
|
|
@@ -7,9 +7,9 @@ import type { AuthIdentity } from '../auth/identity';
|
|
|
7
7
|
import type { AuthCache } from '../auth/cache';
|
|
8
8
|
import type { WebHeaders } from '../headers';
|
|
9
9
|
import type { WebQueryStrings } from '../query';
|
|
10
|
-
import type { WebPreferences } from '../preferences';
|
|
11
10
|
import type { WebPathParameters } from '../parameters';
|
|
12
11
|
import type { WebJsonBody, WebRawBody } from '../body';
|
|
12
|
+
import type { WebPreferences } from '../preferences';
|
|
13
13
|
import type { HttpSuccessStatuses, HttpSuccessEmptyResponse, HttpSuccessResponse, HttpEmptyRequest } from './utils';
|
|
14
14
|
import type { HttpAuthorization } from './authorization';
|
|
15
15
|
import type { HttpDefaults } from './defaults';
|
|
@@ -4,9 +4,13 @@ import type { HttpRequest } from './request';
|
|
|
4
4
|
*/
|
|
5
5
|
export type HttpIncoming<T extends HttpRequest> = T & {
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Unique identifier for the request.
|
|
8
8
|
*/
|
|
9
9
|
readonly requestId: string;
|
|
10
|
+
/**
|
|
11
|
+
* Unique identifier across multiple services.
|
|
12
|
+
*/
|
|
13
|
+
readonly traceId?: string;
|
|
10
14
|
/**
|
|
11
15
|
* Determines whether request is base64 encoded or not.
|
|
12
16
|
*/
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ArchitectureType, RuntimeType } from '@ez4/project';
|
|
1
2
|
import type { LinkedVariables } from '@ez4/project/library';
|
|
2
3
|
import type { WebPreferences } from './preferences';
|
|
3
4
|
/**
|
|
@@ -24,4 +25,12 @@ export interface WebTarget {
|
|
|
24
25
|
* Amount of memory available (in megabytes) for the handler.
|
|
25
26
|
*/
|
|
26
27
|
readonly memory?: number;
|
|
28
|
+
/**
|
|
29
|
+
* Architecture for the API function.
|
|
30
|
+
*/
|
|
31
|
+
readonly architecture?: ArchitectureType;
|
|
32
|
+
/**
|
|
33
|
+
* Runtime for the API function.
|
|
34
|
+
*/
|
|
35
|
+
readonly runtime?: RuntimeType;
|
|
27
36
|
}
|
|
@@ -5,9 +5,13 @@ import type { WsEvent } from './event';
|
|
|
5
5
|
*/
|
|
6
6
|
export type WsIncoming<T extends WsRequest | WsEvent> = T & {
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Unique identifier for the request.
|
|
9
9
|
*/
|
|
10
10
|
readonly requestId: string;
|
|
11
|
+
/**
|
|
12
|
+
* Unique identifier across multiple services.
|
|
13
|
+
*/
|
|
14
|
+
readonly traceId?: string;
|
|
11
15
|
/**
|
|
12
16
|
* Request connection Id.
|
|
13
17
|
*/
|
package/dist/utils.cjs
CHANGED
|
@@ -17,8 +17,8 @@ for(let o in e){let n=t&&(0,b.getSchemaProperty)(t,o),s=$(e[o],n);s&&r.push(`${o
|
|
|
17
17
|
gs"),$=a((e,t)=>{if(!(0,h.isNullish)(e))return e instanceof Date?e.toISOString():
|
|
18
18
|
e instanceof Array&&(!t||!(0,b.isArraySchema)(t)||!t.definitions?.encoded)?e.map(
|
|
19
19
|
n=>$(n,t)).filter(n=>(0,h.isNotNullish)(n)).join(","):e instanceof Object?(0,h.base64Encode)(
|
|
20
|
-
JSON.stringify(e)):`${e}`},"serializeQueryStringValue");var m=require("@ez4/transform"),g=require("@ez4/validator"),
|
|
21
|
-
q=require("@ez4/utils"),M=require("@ez4/gateway");var P=a((e,t,r)=>{if(!t||(0,
|
|
20
|
+
JSON.stringify(e)):`${e}`},"serializeQueryStringValue");var m=require("@ez4/transform"),g=require("@ez4/validator"),v=require("@ez4/schema"),
|
|
21
|
+
q=require("@ez4/utils"),M=require("@ez4/gateway");var P=a((e,t,r)=>{if(!t||(0,v.isScalarSchema)(t))return{body:e.toString(),json:!1};
|
|
22
22
|
let o=(0,m.createTransformContext)({outputStyle:r?.namingStyle,convert:!1}),n=(0,m.transform)(
|
|
23
23
|
e,t,o);return{body:JSON.stringify(n),json:!0}},"prepareRequestBody"),Y=a(async(e,t,r,o)=>{
|
|
24
24
|
let n=r?.namingStyle,s=(0,m.createTransformContext)({convert:!1,inputStyle:n}),d=(0,g.createValidatorContext)(
|
|
@@ -26,8 +26,8 @@ let n=r?.namingStyle,s=(0,m.createTransformContext)({convert:!1,inputStyle:n}),d
|
|
|
26
26
|
l,y.schema,s),y):o?.(l,y),"useCustomValidation"),property:"$body",inputStyle:n}),
|
|
27
27
|
c=await(0,g.validate)(e,t,d);if(c.length){let l=(0,g.getUniqueErrorMessages)(c);
|
|
28
28
|
throw new M.HttpBadRequestError("Malformed body payload.",l)}return(0,m.transform)(
|
|
29
|
-
e,t,s)},"resolveRequestBody"),V=a((e,t,r)=>{if(!t||(0,
|
|
30
|
-
let o=JSON.parse(e),n=(0,m.createTransformContext)({outputStyle:
|
|
29
|
+
e,t,s)},"resolveRequestBody"),V=a((e,t,r)=>{if(!t||(0,v.isScalarSchema)(t))return e;
|
|
30
|
+
let o=JSON.parse(e),n=(0,m.createTransformContext)({outputStyle:v.NamingStyle.Preserve,
|
|
31
31
|
inputStyle:r?.namingStyle,convert:!1});return(0,m.transform)(o,t,n)},"prepareRes\
|
|
32
32
|
ponseBody"),Z=a((e,t,r)=>{let o=r?.namingStyle,n=(0,m.createTransformContext)({convert:!1,
|
|
33
33
|
outputStyle:o});return(0,m.transform)(e,t,n)},"resolveResponseBody");var R=require("@ez4/transform"),x=require("@ez4/validator"),Q=require("@ez4/gateway");var z=a((e,t)=>e.replaceAll(/\{(\w+)\}/g,(r,o)=>o in t?`${t[o]}`:`{${o}}`),"prep\
|
|
@@ -38,17 +38,17 @@ throw new Q.HttpBadRequestError("Malformed path parameters.",p)}return o},"resol
|
|
|
38
38
|
vePathParameters");var i=require("@ez4/gateway");var et=a(({status:e,message:t,details:r})=>({status:e,body:{type:"error",message:t,
|
|
39
39
|
details:r}}),"getJsonError"),O=a((e,t,r)=>{switch(e){case 400:return new i.HttpBadRequestError(
|
|
40
40
|
t,r);case 401:return new i.HttpUnauthorizedError(t,r);case 403:return new i.HttpForbiddenError(
|
|
41
|
-
t,r);case 404:return new i.HttpNotFoundError(t,r);case
|
|
42
|
-
t,r);case
|
|
43
|
-
e,t,r)}},"getHttpException");var rt=a((e,t,r)=>{let{parameters:o,query:n,querySchema:s,namingStyle:p}=r,d=o?z(
|
|
41
|
+
t,r);case 404:return new i.HttpNotFoundError(t,r);case 409:return new i.HttpConflictError(
|
|
42
|
+
t,r);case 415:return new i.HttpUnsupportedMediaTypeError(t,r);case 422:return new i.HttpUnprocessableEntityError(
|
|
43
|
+
t,r);default:return new i.HttpError(e,t,r)}},"getHttpException");var rt=a((e,t,r)=>{let{parameters:o,query:n,querySchema:s,namingStyle:p}=r,d=o?z(
|
|
44
44
|
t,o):t,c=n&&j(n,s,{namingStyle:p}),u=[e];return d&&u.push(d),c&&u.push("?",c),u.
|
|
45
45
|
join("")},"getClientRequestUrl"),ot=a(async(e,t,r)=>{let{authorization:o,headers:n,
|
|
46
46
|
body:s,bodySchema:p,responseSchema:d,namingStyle:c,timeout:u=20}=r,l=s?P(s,p,{namingStyle:c}):
|
|
47
47
|
void 0,y=new AbortController,F=setTimeout(()=>y?.abort("Request timed out"),u*1e3),
|
|
48
|
-
|
|
48
|
+
w=await fetch(e,{signal:y?.signal,body:l?.body,method:t,headers:{...n,...o&&{[o.
|
|
49
49
|
header]:o.value},...l?.json&&{"content-type":"application/json"}}});if(clearTimeout(
|
|
50
|
-
F),!
|
|
51
|
-
text();return{status:
|
|
50
|
+
F),!w.ok){let U=await w.json();throw O(w.status,U.message,U.details)}let A=await w.
|
|
51
|
+
text();return{status:w.status,...A&&{body:V(A,d,{namingStyle:c})}}},"sendClientR\
|
|
52
52
|
equest");var E=require("@ez4/transform"),H=require("@ez4/validator"),I=require("@ez4/gateway");var nt=a(async(e,t,r)=>{let o=(0,E.transform)(e,t,(0,E.createTransformContext)({
|
|
53
53
|
convert:!1})),n=(0,H.createValidatorContext)({property:"$header",onCustomValidation:r}),
|
|
54
54
|
s=await(0,H.validate)(o,t,n);if(s.length){let p=(0,H.getUniqueErrorMessages)(s);
|
package/dist/utils.mjs
CHANGED
|
@@ -6,51 +6,51 @@ n=H(e,t,o);return g(n,t)},"prepareQueryStrings"),vt=a(async(e,t,r,o)=>{let n=r?.
|
|
|
6
6
|
namingStyle,s=x({convert:!0,inputStyle:n}),i=H(e,t,s),m=z({property:"$query",pathStyle:n,
|
|
7
7
|
onCustomValidation:o}),p=await V(i,t,m);if(p.length){let l=O(p);throw new M("Mal\
|
|
8
8
|
formed query strings.",l)}return i},"resolveQueryStrings"),g=a((e,t)=>{let r=[];
|
|
9
|
-
for(let o in e){let n=t&&N(t,o),s=
|
|
10
|
-
s)}`)}if(r.length)return r.join("&")},"serializeQueryStrings"),
|
|
9
|
+
for(let o in e){let n=t&&N(t,o),s=w(e[o],n);s&&r.push(`${o}=${encodeURIComponent(
|
|
10
|
+
s)}`)}if(r.length)return r.join("&")},"serializeQueryStrings"),w=a((e,t)=>{if(!B(
|
|
11
11
|
e))return e instanceof Date?e.toISOString():e instanceof Array&&(!t||!$(t)||!t.definitions?.
|
|
12
|
-
encoded)?e.map(n=>
|
|
12
|
+
encoded)?e.map(n=>w(n,t)).filter(n=>U(n)).join(","):e instanceof Object?A(JSON.stringify(
|
|
13
13
|
e)):`${e}`},"serializeQueryStringValue");import{createTransformContext as f,transform as y}from"@ez4/transform";import{validate as Q,
|
|
14
14
|
createValidatorContext as I,getUniqueErrorMessages as J}from"@ez4/validator";import{
|
|
15
|
-
isScalarSchema as
|
|
16
|
-
import{HttpBadRequestError as _}from"@ez4/gateway";var T=a((e,t,r)=>{if(!t||
|
|
15
|
+
isScalarSchema as v,NamingStyle as k}from"@ez4/schema";import{isAnyArray as F,isAnyObject as D}from"@ez4/utils";
|
|
16
|
+
import{HttpBadRequestError as _}from"@ez4/gateway";var T=a((e,t,r)=>{if(!t||v(t))return{body:e.toString(),json:!1};let o=f({outputStyle:r?.
|
|
17
17
|
namingStyle,convert:!1}),n=y(e,t,o);return{body:JSON.stringify(n),json:!0}},"pre\
|
|
18
|
-
pareRequestBody"),
|
|
18
|
+
pareRequestBody"),Vt=a(async(e,t,r,o)=>{let n=r?.namingStyle,s=f({convert:!1,inputStyle:n}),
|
|
19
19
|
m=I({onCustomValidation:a((c,d)=>D(c)||F(c)?o?.(y(c,d.schema,s),d):o?.(c,d),"use\
|
|
20
20
|
CustomValidation"),property:"$body",inputStyle:n}),p=await Q(e,t,m);if(p.length){
|
|
21
21
|
let c=J(p);throw new _("Malformed body payload.",c)}return y(e,t,s)},"resolveReq\
|
|
22
|
-
uestBody"),b=a((e,t,r)=>{if(!t||
|
|
22
|
+
uestBody"),b=a((e,t,r)=>{if(!t||v(t))return e;let o=JSON.parse(e),n=f({outputStyle:k.
|
|
23
23
|
Preserve,inputStyle:r?.namingStyle,convert:!1});return y(o,t,n)},"prepareRespons\
|
|
24
|
-
eBody"),
|
|
24
|
+
eBody"),zt=a((e,t,r)=>{let o=r?.namingStyle,n=f({convert:!1,outputStyle:o});return y(
|
|
25
25
|
e,t,n)},"resolveResponseBody");import{createTransformContext as G,transform as K}from"@ez4/transform";import{validate as L,
|
|
26
26
|
getUniqueErrorMessages as W,createValidatorContext as X}from"@ez4/validator";import{
|
|
27
27
|
HttpBadRequestError as Y}from"@ez4/gateway";var q=a((e,t)=>e.replaceAll(/\{(\w+)\}/g,(r,o)=>o in t?`${t[o]}`:`{${o}}`),"prep\
|
|
28
|
-
arePathParameters")
|
|
28
|
+
arePathParameters"),$t=a(async(e,t,r)=>{let o=K(e,t,G({convert:!1})),n=X({property:"\
|
|
29
29
|
$path",onCustomValidation:r}),s=await L(o,t,n);if(s.length){let i=W(s);throw new Y(
|
|
30
30
|
"Malformed path parameters.",i)}return o},"resolvePathParameters");import{HttpBadRequestError as Z,HttpUnauthorizedError as tt,HttpForbiddenError as et,
|
|
31
|
-
HttpNotFoundError as rt,
|
|
32
|
-
HttpError as
|
|
31
|
+
HttpNotFoundError as rt,HttpConflictError as ot,HttpUnsupportedMediaTypeError as nt,
|
|
32
|
+
HttpUnprocessableEntityError as at,HttpError as st}from"@ez4/gateway";var Jt=a(({status:e,message:t,details:r})=>({status:e,body:{type:"error",message:t,
|
|
33
33
|
details:r}}),"getJsonError"),R=a((e,t,r)=>{switch(e){case 400:return new Z(t,r);case 401:
|
|
34
|
-
return new tt(t,r);case 403:return new et(t,r);case 404:return new rt(t,r);case
|
|
35
|
-
return new ot(t,r);case
|
|
36
|
-
|
|
34
|
+
return new tt(t,r);case 403:return new et(t,r);case 404:return new rt(t,r);case 409:
|
|
35
|
+
return new ot(t,r);case 415:return new nt(t,r);case 422:return new at(t,r);default:
|
|
36
|
+
return new st(e,t,r)}},"getHttpException");var Lt=a((e,t,r)=>{let{parameters:o,query:n,querySchema:s,namingStyle:i}=r,m=o?q(
|
|
37
37
|
t,o):t,p=n&&C(n,s,{namingStyle:i}),l=[e];return m&&l.push(m),p&&l.push("?",p),l.
|
|
38
|
-
join("")},"getClientRequestUrl"),
|
|
38
|
+
join("")},"getClientRequestUrl"),Wt=a(async(e,t,r)=>{let{authorization:o,headers:n,
|
|
39
39
|
body:s,bodySchema:i,responseSchema:m,namingStyle:p,timeout:l=20}=r,c=s?T(s,i,{namingStyle:p}):
|
|
40
40
|
void 0,d=new AbortController,j=setTimeout(()=>d?.abort("Request timed out"),l*1e3),
|
|
41
41
|
u=await fetch(e,{signal:d?.signal,body:c?.body,method:t,headers:{...n,...o&&{[o.
|
|
42
42
|
header]:o.value},...c?.json&&{"content-type":"application/json"}}});if(clearTimeout(
|
|
43
43
|
j),!u.ok){let h=await u.json();throw R(u.status,h.message,h.details)}let S=await u.
|
|
44
44
|
text();return{status:u.status,...S&&{body:b(S,m,{namingStyle:p})}}},"sendClientR\
|
|
45
|
-
equest");import{createTransformContext as
|
|
46
|
-
validate as
|
|
47
|
-
import{HttpBadRequestError as
|
|
48
|
-
onCustomValidation:r}),s=await
|
|
49
|
-
Malformed request headers.",i)}return o},"resolveHeaders");import{validate as
|
|
50
|
-
import{HttpBadRequestError as
|
|
51
|
-
e,t,o);if(n.length){let s=
|
|
52
|
-
return e},"resolveIdentity");var E=a(e=>`@${e}`,"getValidatorName");var
|
|
53
|
-
C as prepareQueryStrings,T as prepareRequestBody,b as prepareResponseBody,
|
|
54
|
-
|
|
55
|
-
|
|
45
|
+
equest");import{createTransformContext as it,transform as pt}from"@ez4/transform";import{
|
|
46
|
+
validate as ct,createValidatorContext as mt,getUniqueErrorMessages as lt}from"@ez4/validator";
|
|
47
|
+
import{HttpBadRequestError as dt}from"@ez4/gateway";var re=a(async(e,t,r)=>{let o=pt(e,t,it({convert:!1})),n=mt({property:"$header",
|
|
48
|
+
onCustomValidation:r}),s=await ct(o,t,n);if(s.length){let i=lt(s);throw new dt("\
|
|
49
|
+
Malformed request headers.",i)}return o},"resolveHeaders");import{validate as ut,createValidatorContext as yt,getUniqueErrorMessages as ft}from"@ez4/validator";
|
|
50
|
+
import{HttpBadRequestError as St}from"@ez4/gateway";var ie=a(async(e,t,r)=>{let o=yt({property:"$identity",onCustomValidation:r}),n=await ut(
|
|
51
|
+
e,t,o);if(n.length){let s=ft(n);throw new St("Malformed authorizer identity.",s)}
|
|
52
|
+
return e},"resolveIdentity");var E=a(e=>`@${e}`,"getValidatorName");var ue=a(async(e,t,r)=>{let o=t[E(r)];o&&await o.validate(e)},"resolveValidation");export{Lt as getClientRequestUrl,R as getHttpException,Jt as getJsonError,q as preparePathParameters,
|
|
53
|
+
C as prepareQueryStrings,T as prepareRequestBody,b as prepareResponseBody,re as resolveHeaders,
|
|
54
|
+
ie as resolveIdentity,$t as resolvePathParameters,vt as resolveQueryStrings,Vt as resolveRequestBody,
|
|
55
|
+
zt as resolveResponseBody,ue as resolveValidation,Wt as sendClientRequest};
|
|
56
56
|
//# sourceMappingURL=utils.mjs.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ez4/gateway",
|
|
3
3
|
"description": "EZ4: Components to build gateway services",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.38.0",
|
|
5
5
|
"author": "Silas B.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"type": "module",
|
|
@@ -51,12 +51,12 @@
|
|
|
51
51
|
"live:publish": "npm run build && npm publish --access public"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@ez4/common": "^0.
|
|
55
|
-
"@ez4/project": "^0.
|
|
56
|
-
"@ez4/reflection": "^0.
|
|
57
|
-
"@ez4/schema": "^0.
|
|
58
|
-
"@ez4/transform": "^0.
|
|
59
|
-
"@ez4/utils": "^0.
|
|
60
|
-
"@ez4/validator": "^0.
|
|
54
|
+
"@ez4/common": "^0.38.0",
|
|
55
|
+
"@ez4/project": "^0.38.0",
|
|
56
|
+
"@ez4/reflection": "^0.38.0",
|
|
57
|
+
"@ez4/schema": "^0.38.0",
|
|
58
|
+
"@ez4/transform": "^0.38.0",
|
|
59
|
+
"@ez4/utils": "^0.38.0",
|
|
60
|
+
"@ez4/validator": "^0.38.0"
|
|
61
61
|
}
|
|
62
62
|
}
|