@ez4/gateway 0.35.0 → 0.36.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/README.md +121 -2
- package/dist/client/authorization.d.ts +1 -1
- package/dist/client/operations.d.ts +1 -2
- package/dist/errors/auth/authorizer.d.ts +4 -0
- package/dist/errors/{identity.d.ts → auth/identity.d.ts} +4 -2
- package/dist/errors/{authorization.d.ts → http/authorization.d.ts} +4 -2
- package/dist/errors/{cache.d.ts → http/cache.d.ts} +4 -2
- package/dist/errors/{cors.d.ts → http/cors.d.ts} +5 -3
- package/dist/errors/{body.d.ts → web/body.d.ts} +4 -2
- package/dist/errors/{defaults.d.ts → web/defaults.d.ts} +4 -2
- package/dist/errors/{headers.d.ts → web/headers.d.ts} +4 -2
- package/dist/errors/web/parameters.d.ts +14 -0
- package/dist/errors/{preferences.d.ts → web/preferences.d.ts} +4 -2
- package/dist/errors/{query.d.ts → web/query.d.ts} +4 -2
- package/dist/errors/ws/event.d.ts +10 -0
- package/dist/errors/{authorizer.d.ts → ws/target.d.ts} +1 -1
- package/dist/library.cjs +460 -311
- package/dist/library.d.ts +26 -23
- package/dist/library.mjs +436 -293
- package/dist/main.cjs +17 -17
- package/dist/main.d.ts +5 -3
- package/dist/main.mjs +8 -8
- package/dist/metadata/auth/handler.d.ts +4 -0
- package/dist/metadata/auth/identity.d.ts +6 -0
- package/dist/metadata/auth/request.d.ts +4 -0
- package/dist/metadata/auth/response.d.ts +4 -0
- package/dist/metadata/auth/types.d.ts +17 -0
- package/dist/metadata/http/access.d.ts +4 -0
- package/dist/metadata/http/authorization.d.ts +4 -0
- package/dist/metadata/http/cache.d.ts +4 -0
- package/dist/metadata/http/cors.d.ts +4 -0
- package/dist/metadata/http/defaults.d.ts +4 -0
- package/dist/metadata/{errors.d.ts → http/errors.d.ts} +2 -2
- package/dist/metadata/http/handler.d.ts +4 -0
- package/dist/metadata/http/import.d.ts +7 -0
- package/dist/metadata/http/provider.d.ts +4 -0
- package/dist/metadata/http/request.d.ts +4 -0
- package/dist/metadata/http/response.d.ts +4 -0
- package/dist/metadata/{route.d.ts → http/routes.d.ts} +3 -2
- package/dist/metadata/http/service.d.ts +7 -0
- package/dist/{types/common.d.ts → metadata/http/types.d.ts} +33 -22
- package/dist/metadata/utils/path.d.ts +2 -0
- package/dist/metadata/utils/type.d.ts +1 -0
- package/dist/metadata/web/body.d.ts +6 -0
- package/dist/metadata/web/headers.d.ts +5 -0
- package/dist/metadata/web/parameters.d.ts +5 -0
- package/dist/metadata/web/preferences.d.ts +4 -0
- package/dist/metadata/web/query.d.ts +5 -0
- package/dist/metadata/web/types.d.ts +4 -0
- package/dist/metadata/ws/connection.d.ts +4 -0
- package/dist/metadata/ws/defaults.d.ts +5 -0
- package/dist/metadata/ws/event.d.ts +4 -0
- package/dist/metadata/ws/handlers.d.ts +5 -0
- package/dist/metadata/ws/message.d.ts +4 -0
- package/dist/metadata/ws/request.d.ts +4 -0
- package/dist/metadata/ws/response.d.ts +4 -0
- package/dist/metadata/ws/service.d.ts +7 -0
- package/dist/metadata/ws/types.d.ts +72 -0
- package/dist/services/auth/cache.d.ts +9 -0
- package/dist/services/auth/handler.d.ts +9 -0
- package/dist/services/auth/identity.d.ts +5 -0
- package/dist/services/auth/incoming.d.ts +22 -0
- package/dist/services/auth/provider.d.ts +11 -0
- package/dist/services/auth/request.d.ts +20 -0
- package/dist/services/auth/response.d.ts +10 -0
- package/dist/services/{client.d.ts → http/client.d.ts} +3 -3
- package/dist/services/{contract.d.ts → http/contract.d.ts} +42 -30
- package/dist/services/http/defaults.d.ts +17 -0
- package/dist/services/http/errors.d.ts +6 -0
- package/dist/services/http/handler.d.ts +10 -0
- package/dist/services/http/incoming.d.ts +30 -0
- package/dist/services/http/listener.d.ts +9 -0
- package/dist/services/http/path.d.ts +2 -0
- package/dist/services/http/request.d.ts +30 -0
- package/dist/services/http/response.d.ts +19 -0
- package/dist/services/http/route.d.ts +45 -0
- package/dist/services/{utils.d.ts → http/utils.d.ts} +13 -5
- package/dist/services/web/body.d.ts +13 -0
- package/dist/services/web/defaults.d.ts +22 -0
- package/dist/services/web/headers.d.ts +10 -0
- package/dist/services/web/parameters.d.ts +5 -0
- package/dist/services/{preferences.d.ts → web/preferences.d.ts} +2 -2
- package/dist/services/web/query.d.ts +5 -0
- package/dist/services/web/target.d.ts +27 -0
- package/dist/services/ws/client.d.ts +19 -0
- package/dist/services/ws/connect.d.ts +23 -0
- package/dist/services/ws/contract.d.ts +108 -0
- package/dist/services/ws/defaults.d.ts +13 -0
- package/dist/services/ws/disconnect.d.ts +17 -0
- package/dist/services/ws/event.d.ts +20 -0
- package/dist/services/ws/handler.d.ts +10 -0
- package/dist/services/ws/incoming.d.ts +19 -0
- package/dist/services/ws/listener.d.ts +9 -0
- package/dist/services/ws/message.d.ts +17 -0
- package/dist/services/ws/request.d.ts +15 -0
- package/dist/services/ws/response.d.ts +10 -0
- package/dist/services/ws/utils.d.ts +11 -0
- package/dist/utils/body.d.ts +1 -1
- package/dist/utils/client.d.ts +4 -4
- package/dist/utils/errors.d.ts +1 -0
- package/dist/utils/headers.d.ts +1 -1
- package/dist/utils/identity.d.ts +1 -1
- package/dist/utils/parameters.d.ts +1 -1
- package/dist/utils/query.d.ts +1 -1
- package/dist/utils.cjs +2 -2
- package/dist/utils.mjs +5 -5
- package/package.json +8 -8
- package/dist/errors/parameters.d.ts +0 -8
- package/dist/metadata/access.d.ts +0 -3
- package/dist/metadata/authorization.d.ts +0 -3
- package/dist/metadata/authorizer.d.ts +0 -3
- package/dist/metadata/body.d.ts +0 -5
- package/dist/metadata/cache.d.ts +0 -3
- package/dist/metadata/cors.d.ts +0 -3
- package/dist/metadata/defaults.d.ts +0 -3
- package/dist/metadata/handler.d.ts +0 -3
- package/dist/metadata/headers.d.ts +0 -4
- package/dist/metadata/identity.d.ts +0 -5
- package/dist/metadata/import.d.ts +0 -6
- package/dist/metadata/parameters.d.ts +0 -4
- package/dist/metadata/preferences.d.ts +0 -3
- package/dist/metadata/provider.d.ts +0 -3
- package/dist/metadata/query.d.ts +0 -4
- package/dist/metadata/request.d.ts +0 -4
- package/dist/metadata/response.d.ts +0 -4
- package/dist/metadata/service.d.ts +0 -6
- package/dist/metadata/utils.d.ts +0 -24
- package/dist/services/cache.d.ts +0 -9
- package/dist/services/common.d.ts +0 -143
- package/dist/services/defaults.d.ts +0 -31
- package/dist/services/route.d.ts +0 -56
- package/dist/types/import.d.ts +0 -14
- package/dist/types/service.d.ts +0 -14
- /package/dist/errors/{access.d.ts → http/access.d.ts} +0 -0
- /package/dist/errors/{provider.d.ts → http/provider.d.ts} +0 -0
- /package/dist/errors/{route.d.ts → http/route.d.ts} +0 -0
- /package/dist/errors/{handler.d.ts → web/handler.d.ts} +0 -0
- /package/dist/errors/{request.d.ts → web/request.d.ts} +0 -0
- /package/dist/errors/{response.d.ts → web/response.d.ts} +0 -0
- /package/dist/errors/{service.d.ts → web/service.d.ts} +0 -0
- /package/dist/metadata/{schema.d.ts → utils/schema.d.ts} +0 -0
- /package/dist/services/{access.d.ts → http/access.d.ts} +0 -0
- /package/dist/services/{authorization.d.ts → http/authorization.d.ts} +0 -0
- /package/dist/services/{cors.d.ts → http/cors.d.ts} +0 -0
- /package/dist/services/{provider.d.ts → http/provider.d.ts} +0 -0
package/dist/main.cjs
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
"use strict";var a=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var
|
|
2
|
-
typeof e=="object"||typeof e=="function")for(let p of
|
|
3
|
-
a(
|
|
4
|
-
HttpForbiddenError:()=>
|
|
5
|
-
HttpUnprocessableEntityError:()=>
|
|
6
|
-
exports=g(
|
|
7
|
-
o(this,"HttpError")}},i=class extends s{static{o(this,"HttpBadRequestError")}constructor(e,
|
|
8
|
-
super(400,e||"Bad request",
|
|
9
|
-
dError")}constructor(e,
|
|
10
|
-
o(this,"HttpForbiddenError")}constructor(e,
|
|
11
|
-
o(this,"HttpNotFoundError")}constructor(e,
|
|
12
|
-
o(this,"HttpUnsupportedMediaTypeError")}constructor(e,
|
|
13
|
-
ed media type",
|
|
14
|
-
r")}constructor(e,
|
|
15
|
-
o(this,"HttpInternalServerError")}constructor(e,
|
|
16
|
-
error",
|
|
1
|
+
"use strict";var a=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var W=Object.prototype.hasOwnProperty;var o=(t,e)=>a(t,"name",{value:e,configurable:!0});var v=(t,e)=>{for(var r in e)a(t,r,{get:e[r],enumerable:!0})},H=(t,e,r,n)=>{if(e&&
|
|
2
|
+
typeof e=="object"||typeof e=="function")for(let p of b(e))!W.call(t,p)&&p!==r&&
|
|
3
|
+
a(t,p,{get:()=>e[p],enumerable:!(n=h(e,p))||n.enumerable});return t};var g=t=>H(a({},"__esModule",{value:!0}),t);var q={};v(q,{AuthorizationType:()=>y,Http:()=>R,HttpBadRequestError:()=>i,HttpError:()=>s,
|
|
4
|
+
HttpForbiddenError:()=>m,HttpInternalServerError:()=>l,HttpNotFoundError:()=>u,HttpUnauthorizedError:()=>c,
|
|
5
|
+
HttpUnprocessableEntityError:()=>x,HttpUnsupportedMediaTypeError:()=>d,Ws:()=>f});
|
|
6
|
+
module.exports=g(q);var y=(e=>(e.Bearer="bearer",e))(y||{});var f;(t=>{})(f||={});var R;(t=>{})(R||={});var T=require("@ez4/common");var s=class extends T.ServiceError{constructor(r,n,p){super(n,p);this.status=r}static{
|
|
7
|
+
o(this,"HttpError")}},i=class extends s{static{o(this,"HttpBadRequestError")}constructor(e,r){
|
|
8
|
+
super(400,e||"Bad request",r)}},c=class extends s{static{o(this,"HttpUnauthorize\
|
|
9
|
+
dError")}constructor(e,r){super(401,e||"Unauthorized",r)}},m=class extends s{static{
|
|
10
|
+
o(this,"HttpForbiddenError")}constructor(e,r){super(403,e||"Forbidden",r)}},u=class extends s{static{
|
|
11
|
+
o(this,"HttpNotFoundError")}constructor(e,r){super(404,e||"Not found",r)}},d=class extends s{static{
|
|
12
|
+
o(this,"HttpUnsupportedMediaTypeError")}constructor(e,r){super(415,e||"Unsupport\
|
|
13
|
+
ed media type",r)}},x=class extends s{static{o(this,"HttpUnprocessableEntityErro\
|
|
14
|
+
r")}constructor(e,r){super(422,e||"Unprocessable entity",r)}},l=class extends s{static{
|
|
15
|
+
o(this,"HttpInternalServerError")}constructor(e,r){super(500,e||"Internal server\
|
|
16
|
+
error",r)}};0&&(module.exports={AuthorizationType,Http,HttpBadRequestError,HttpError,HttpForbiddenError,
|
|
17
17
|
HttpInternalServerError,HttpNotFoundError,HttpUnauthorizedError,HttpUnprocessableEntityError,
|
|
18
|
-
HttpUnsupportedMediaTypeError});
|
|
18
|
+
HttpUnsupportedMediaTypeError,Ws});
|
|
19
19
|
//# sourceMappingURL=main.cjs.map
|
package/dist/main.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export
|
|
1
|
+
export { AuthorizationType } from './services/http/authorization';
|
|
2
|
+
export { HttpClient, HttpClientRequest, HttpClientResponse } from './services/http/client';
|
|
3
|
+
export { WsClient } from './services/ws/client';
|
|
4
|
+
export * from './services/ws/contract';
|
|
5
|
+
export * from './services/http/contract';
|
|
4
6
|
export * from './services/errors';
|
package/dist/main.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
var l=Object.defineProperty;var s=(r,e)=>l(r,"name",{value:e,configurable:!0});var p=(e=>(e.Bearer="bearer",e))(p||{});var
|
|
1
|
+
var l=Object.defineProperty;var s=(r,e)=>l(r,"name",{value:e,configurable:!0});var p=(e=>(e.Bearer="bearer",e))(p||{});var f;(r=>{})(f||={});var R;(r=>{})(R||={});import{ServiceError as T}from"@ez4/common";var o=class extends T{constructor(t,d,x){super(d,x);this.status=t}static{s(this,
|
|
2
2
|
"HttpError")}},n=class extends o{static{s(this,"HttpBadRequestError")}constructor(e,t){
|
|
3
3
|
super(400,e||"Bad request",t)}},a=class extends o{static{s(this,"HttpUnauthorize\
|
|
4
|
-
dError")}constructor(e,t){super(401,e||"Unauthorized",t)}},
|
|
4
|
+
dError")}constructor(e,t){super(401,e||"Unauthorized",t)}},y=class extends o{static{
|
|
5
5
|
s(this,"HttpForbiddenError")}constructor(e,t){super(403,e||"Forbidden",t)}},i=class extends o{static{
|
|
6
|
-
s(this,"HttpNotFoundError")}constructor(e,t){super(404,e||"Not found",t)}},
|
|
6
|
+
s(this,"HttpNotFoundError")}constructor(e,t){super(404,e||"Not found",t)}},c=class extends o{static{
|
|
7
7
|
s(this,"HttpUnsupportedMediaTypeError")}constructor(e,t){super(415,e||"Unsupport\
|
|
8
|
-
ed media type",t)}},
|
|
9
|
-
r")}constructor(e,t){super(422,e||"Unprocessable entity",t)}},
|
|
8
|
+
ed media type",t)}},m=class extends o{static{s(this,"HttpUnprocessableEntityErro\
|
|
9
|
+
r")}constructor(e,t){super(422,e||"Unprocessable entity",t)}},u=class extends o{static{
|
|
10
10
|
s(this,"HttpInternalServerError")}constructor(e,t){super(500,e||"Internal server\
|
|
11
|
-
error",t)}};export{p as AuthorizationType,
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
error",t)}};export{p as AuthorizationType,R as Http,n as HttpBadRequestError,o as HttpError,
|
|
12
|
+
y as HttpForbiddenError,u as HttpInternalServerError,i as HttpNotFoundError,a as HttpUnauthorizedError,
|
|
13
|
+
m as HttpUnprocessableEntityError,c as HttpUnsupportedMediaTypeError,f as Ws};
|
|
14
14
|
//# sourceMappingURL=main.mjs.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AllType, SourceMap, TypeCallback, TypeFunction, TypeModel } from '@ez4/reflection';
|
|
2
|
+
import type { AuthHandler } from './types';
|
|
3
|
+
export declare const isAuthHandlerDeclaration: (type: AllType) => type is TypeCallback | TypeFunction;
|
|
4
|
+
export declare const getAuthHandlerMetadata: (type: AllType, parent: TypeModel, reflection: SourceMap, errorList: Error[], namespace: string) => AuthHandler | undefined;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { AllType, SourceMap, TypeIntersection, TypeModel, TypeObject } from '@ez4/reflection';
|
|
2
|
+
import type { ObjectSchema, UnionSchema } from '@ez4/schema/library';
|
|
3
|
+
type TypeParent = TypeObject | TypeModel | TypeIntersection;
|
|
4
|
+
export declare const isAuthIdentityDeclaration: (type: TypeModel, namespace: string) => boolean;
|
|
5
|
+
export declare const getAuthIdentityMetadata: (type: AllType, parent: TypeParent, reflection: SourceMap, errorList: Error[], namespace: string) => ObjectSchema | UnionSchema | undefined;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AllType, SourceMap, TypeModel } from '@ez4/reflection';
|
|
2
|
+
import type { AuthRequest } from '../auth/types';
|
|
3
|
+
export declare const isAuthRequestDeclaration: (type: TypeModel, namespace: string) => boolean;
|
|
4
|
+
export declare const getAuthRequestMetadata: (type: AllType, parent: TypeModel, reflection: SourceMap, errorList: Error[], namespace: string) => AuthRequest | undefined;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AllType, SourceMap, TypeModel } from '@ez4/reflection';
|
|
2
|
+
import type { AuthResponse } from '../auth/types';
|
|
3
|
+
export declare const isAuthResponseDeclaration: (type: TypeModel, namespace: string) => boolean;
|
|
4
|
+
export declare const getAuthResponseMetadata: (type: AllType, parent: TypeModel, reflection: SourceMap, errorList: Error[], namespace: string) => AuthResponse | undefined;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ObjectSchema, UnionSchema } from '@ez4/schema';
|
|
2
|
+
export type AuthHandler = {
|
|
3
|
+
name: string;
|
|
4
|
+
module?: string;
|
|
5
|
+
file: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
response?: AuthResponse;
|
|
8
|
+
request?: AuthRequest;
|
|
9
|
+
};
|
|
10
|
+
export type AuthResponse = {
|
|
11
|
+
identity?: ObjectSchema | UnionSchema;
|
|
12
|
+
};
|
|
13
|
+
export type AuthRequest = {
|
|
14
|
+
headers?: ObjectSchema;
|
|
15
|
+
parameters?: ObjectSchema;
|
|
16
|
+
query?: ObjectSchema;
|
|
17
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AllType, SourceMap, TypeModel } from '@ez4/reflection';
|
|
2
|
+
import type { HttpAccess } from './types';
|
|
3
|
+
export declare const isHttpAccessDeclaration: (type: TypeModel) => boolean;
|
|
4
|
+
export declare const getHttpAccessMetadata: (type: AllType, parent: TypeModel, reflection: SourceMap, errorList: Error[]) => HttpAccess | undefined;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AllType, SourceMap, TypeModel } from '@ez4/reflection';
|
|
2
|
+
import type { HttpAuthorization } from './types';
|
|
3
|
+
export declare const isHttpAuthorizationDeclaration: (type: TypeModel) => boolean;
|
|
4
|
+
export declare const getHttpAuthorizationMetadata: (type: AllType, parent: TypeModel, reflection: SourceMap, errorList: Error[]) => HttpAuthorization | undefined;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AllType, SourceMap, TypeModel } from '@ez4/reflection';
|
|
2
|
+
import type { HttpCache } from './types';
|
|
3
|
+
export declare const isHttpCacheDeclaration: (type: TypeModel) => boolean;
|
|
4
|
+
export declare const getHttpCacheMetadata: (type: AllType, parent: TypeModel, reflection: SourceMap, errorList: Error[]) => HttpCache | undefined;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AllType, SourceMap, TypeModel } from '@ez4/reflection';
|
|
2
|
+
import type { HttpCors } from './types';
|
|
3
|
+
export declare const isHttpCorsDeclaration: (type: TypeModel) => boolean;
|
|
4
|
+
export declare const getHttpCorsMetadata: (type: AllType, parent: TypeModel, reflection: SourceMap, errorList: Error[]) => HttpCors | undefined;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AllType, SourceMap, TypeModel } from '@ez4/reflection';
|
|
2
|
+
import { type HttpDefaults } from './types';
|
|
3
|
+
export declare const isHttpDefaultsDeclaration: (type: TypeModel) => boolean;
|
|
4
|
+
export declare const getHttpDefaultsMetadata: (type: AllType, parent: TypeModel, reflection: SourceMap, errorList: Error[]) => HttpDefaults | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { AllType, ModelProperty, SourceMap, TypeModel } from '@ez4/reflection';
|
|
2
|
-
import type { HttpErrors } from '
|
|
3
|
-
export declare const
|
|
2
|
+
import type { HttpErrors } from './types';
|
|
3
|
+
export declare const getHttpErrorsMetadata: (type: AllType, parent: TypeModel, reflection: SourceMap, errorList: Error[]) => HttpErrors | undefined;
|
|
4
4
|
export declare const getErrorClasses: (member: ModelProperty, errorCode: number, parent: TypeModel, reflection: SourceMap, errorList: Error[]) => HttpErrors;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AllType, SourceMap, TypeCallback, TypeFunction, TypeModel } from '@ez4/reflection';
|
|
2
|
+
import type { HttpHandler } from './types';
|
|
3
|
+
export declare const isHttpHandlerDeclaration: (type: AllType) => type is TypeCallback | TypeFunction;
|
|
4
|
+
export declare const getHttpHandlerMetadata: (type: AllType, parent: TypeModel, reflection: SourceMap, errorList: Error[], external: boolean) => HttpHandler | undefined;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { AllType, SourceMap, TypeClass } from '@ez4/reflection';
|
|
2
|
+
import type { HttpImport } from './types';
|
|
3
|
+
export declare const isHttpImportDeclaration: (type: AllType) => type is TypeClass;
|
|
4
|
+
export declare const getHttpImportsMetadata: (reflection: SourceMap) => {
|
|
5
|
+
services: Record<string, HttpImport>;
|
|
6
|
+
errors: Error[];
|
|
7
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AllType, SourceMap, TypeModel } from '@ez4/reflection';
|
|
2
|
+
import type { HttpProvider } from './types';
|
|
3
|
+
export declare const isHttpProviderDeclaration: (type: AllType) => type is TypeModel;
|
|
4
|
+
export declare const getHttpProviderMetadata: (type: AllType, parent: TypeModel, reflection: SourceMap, errorList: Error[]) => HttpProvider | undefined;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AllType, SourceMap, TypeModel } from '@ez4/reflection';
|
|
2
|
+
import type { HttpRequest } from './types';
|
|
3
|
+
export declare const isHttpRequestDeclaration: (type: TypeModel) => boolean;
|
|
4
|
+
export declare const getHttpRequestMetadata: (type: AllType, parent: TypeModel, reflection: SourceMap, errorList: Error[]) => HttpRequest | undefined;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AllType, SourceMap, TypeModel } from '@ez4/reflection';
|
|
2
|
+
import type { HttpResponse } from './types';
|
|
3
|
+
export declare const isHttpResponseDeclaration: (type: TypeModel) => boolean;
|
|
4
|
+
export declare const getHttpResponseMetadata: (type: AllType, parent: TypeModel, reflection: SourceMap, errorList: Error[]) => HttpResponse | undefined;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { ModelProperty, SourceMap, TypeModel } from '@ez4/reflection';
|
|
2
|
-
import type { HttpRoute } from '
|
|
1
|
+
import type { AllType, ModelProperty, SourceMap, TypeModel } from '@ez4/reflection';
|
|
2
|
+
import type { HttpRoute } from './types';
|
|
3
|
+
export declare const isHttpRouteDeclaration: (type: AllType) => type is TypeModel;
|
|
3
4
|
export declare const getHttpLocalRoutes: (parent: TypeModel, member: ModelProperty, reflection: SourceMap, errorList: Error[]) => HttpRoute[] | undefined;
|
|
4
5
|
export declare const getHttpRemoteRoutes: (parent: TypeModel, member: ModelProperty, reflection: SourceMap, errorList: Error[]) => HttpRoute[] | undefined;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { AllType, SourceMap, TypeClass } from '@ez4/reflection';
|
|
2
|
+
import type { HttpService } from './types';
|
|
3
|
+
export declare const isHttpServiceDeclaration: (type: AllType) => type is TypeClass;
|
|
4
|
+
export declare const getHttpServicesMetadata: (reflection: SourceMap) => {
|
|
5
|
+
services: Record<string, HttpService>;
|
|
6
|
+
errors: Error[];
|
|
7
|
+
};
|
|
@@ -1,9 +1,36 @@
|
|
|
1
1
|
import type { ArraySchema, NamingStyle, ObjectSchema, ScalarSchema, UnionSchema } from '@ez4/schema';
|
|
2
2
|
import type { LinkedServices, LinkedVariables } from '@ez4/project/library';
|
|
3
|
+
import type { ServiceMetadata } from '@ez4/project/library';
|
|
3
4
|
import type { ServiceListener } from '@ez4/common/library';
|
|
4
|
-
import type { AuthorizationType } from '
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
import type { AuthorizationType } from '../../services/http/authorization';
|
|
6
|
+
import type { AuthHandler } from '../auth/types';
|
|
7
|
+
import type { HttpPath } from '../../services/http/path';
|
|
8
|
+
export declare const HttpServiceType = "@ez4/http";
|
|
9
|
+
export declare const HttpImportType = "@ez4/import:http";
|
|
10
|
+
export declare const HttpNamespaceType = "Http";
|
|
11
|
+
export declare const isHttpService: (service: ServiceMetadata) => service is HttpService;
|
|
12
|
+
export declare const isHttpImport: (service: ServiceMetadata) => service is HttpImport;
|
|
13
|
+
export type HttpDataSchema = ObjectSchema | UnionSchema | ArraySchema | ScalarSchema;
|
|
14
|
+
export type HttpService = ServiceMetadata & {
|
|
15
|
+
type: typeof HttpServiceType;
|
|
16
|
+
displayName?: string;
|
|
17
|
+
description?: string;
|
|
18
|
+
defaults?: HttpDefaults;
|
|
19
|
+
routes: HttpRoute[];
|
|
20
|
+
cache?: HttpCache;
|
|
21
|
+
access?: HttpAccess;
|
|
22
|
+
cors?: HttpCors;
|
|
23
|
+
};
|
|
24
|
+
export type HttpImport = ServiceMetadata & {
|
|
25
|
+
type: typeof HttpImportType;
|
|
26
|
+
reference: string;
|
|
27
|
+
project: string;
|
|
28
|
+
displayName?: string;
|
|
29
|
+
description?: string;
|
|
30
|
+
defaults?: HttpDefaults;
|
|
31
|
+
authorization?: HttpAuthorization;
|
|
32
|
+
routes: HttpRoute[];
|
|
33
|
+
};
|
|
7
34
|
export type HttpPreferences = {
|
|
8
35
|
namingStyle?: NamingStyle;
|
|
9
36
|
};
|
|
@@ -12,25 +39,17 @@ export type HttpAuthorization = {
|
|
|
12
39
|
header: string;
|
|
13
40
|
value: string;
|
|
14
41
|
};
|
|
15
|
-
export type HttpAuthRequest = {
|
|
16
|
-
headers?: ObjectSchema;
|
|
17
|
-
parameters?: ObjectSchema;
|
|
18
|
-
query?: ObjectSchema;
|
|
19
|
-
};
|
|
20
|
-
export type HttpAuthResponse = {
|
|
21
|
-
identity?: ObjectSchema | UnionSchema;
|
|
22
|
-
};
|
|
23
42
|
export type HttpRequest = {
|
|
24
43
|
identity?: ObjectSchema | UnionSchema;
|
|
25
44
|
headers?: ObjectSchema;
|
|
26
45
|
parameters?: ObjectSchema;
|
|
27
46
|
query?: ObjectSchema;
|
|
28
|
-
body?:
|
|
47
|
+
body?: HttpDataSchema;
|
|
29
48
|
};
|
|
30
49
|
export type HttpResponse = {
|
|
31
50
|
status: number | number[];
|
|
32
51
|
headers?: ObjectSchema;
|
|
33
|
-
body?:
|
|
52
|
+
body?: HttpDataSchema;
|
|
34
53
|
};
|
|
35
54
|
export type HttpHandler = {
|
|
36
55
|
name: string;
|
|
@@ -41,14 +60,6 @@ export type HttpHandler = {
|
|
|
41
60
|
request?: HttpRequest;
|
|
42
61
|
provider?: HttpProvider;
|
|
43
62
|
};
|
|
44
|
-
export type HttpAuthorizer = {
|
|
45
|
-
name: string;
|
|
46
|
-
module?: string;
|
|
47
|
-
file: string;
|
|
48
|
-
description?: string;
|
|
49
|
-
response?: HttpAuthResponse;
|
|
50
|
-
request?: HttpAuthRequest;
|
|
51
|
-
};
|
|
52
63
|
export type HttpErrors = {
|
|
53
64
|
[name: string]: number;
|
|
54
65
|
};
|
|
@@ -57,7 +68,7 @@ export type HttpRoute = {
|
|
|
57
68
|
path: HttpPath;
|
|
58
69
|
handler: HttpHandler;
|
|
59
70
|
listener?: ServiceListener;
|
|
60
|
-
authorizer?:
|
|
71
|
+
authorizer?: AuthHandler;
|
|
61
72
|
variables?: LinkedVariables;
|
|
62
73
|
httpErrors?: HttpErrors;
|
|
63
74
|
preferences?: HttpPreferences;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getFullTypeName: (namespace: string, type: string) => string;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { AllType, SourceMap, TypeIntersection, TypeModel, TypeObject } from '@ez4/reflection';
|
|
2
|
+
import type { ArraySchema, ObjectSchema, UnionSchema } from '@ez4/schema/library';
|
|
3
|
+
type TypeParent = TypeObject | TypeModel | TypeIntersection;
|
|
4
|
+
export declare const isWebBodyDeclaration: (type: TypeModel, namespace: string) => boolean;
|
|
5
|
+
export declare const getWebBodyMetadata: (type: AllType, parent: TypeParent, reflection: SourceMap, errorList: Error[], namespace: string) => import("@ez4/schema").BooleanSchema | import("@ez4/schema").NumberSchema | import("@ez4/schema").StringSchema | ObjectSchema | UnionSchema | ArraySchema | undefined;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AllType, SourceMap, TypeIntersection, TypeModel, TypeObject } from '@ez4/reflection';
|
|
2
|
+
type TypeParent = TypeObject | TypeModel | TypeIntersection;
|
|
3
|
+
export declare const isWebHeadersDeclaration: (type: TypeModel, namespace: string) => boolean;
|
|
4
|
+
export declare const getWebHeadersMetadata: (type: AllType, parent: TypeParent, reflection: SourceMap, errorList: Error[], namespace: string) => import("@ez4/schema").ObjectSchema | undefined;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AllType, SourceMap, TypeIntersection, TypeModel, TypeObject } from '@ez4/reflection';
|
|
2
|
+
type TypeParent = TypeObject | TypeModel | TypeIntersection;
|
|
3
|
+
export declare const isWebParametersDeclaration: (type: TypeModel, namespace: string) => boolean;
|
|
4
|
+
export declare const getWebParametersMetadata: (type: AllType, parent: TypeParent, reflection: SourceMap, errorList: Error[], namespace: string) => import("@ez4/schema").ObjectSchema | undefined;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AllType, SourceMap, TypeModel } from '@ez4/reflection';
|
|
2
|
+
import type { WebPreferences } from './types';
|
|
3
|
+
export declare const isWebPreferencesDeclaration: (type: TypeModel, namespace: string) => boolean;
|
|
4
|
+
export declare const getWebPreferencesMetadata: (type: AllType, parent: TypeModel, reflection: SourceMap, errorList: Error[], namespace: string) => WebPreferences | undefined;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AllType, SourceMap, TypeIntersection, TypeModel, TypeObject } from '@ez4/reflection';
|
|
2
|
+
type TypeParent = TypeObject | TypeModel | TypeIntersection;
|
|
3
|
+
export declare const isWebQueryDeclaration: (type: TypeModel, namespace: string) => boolean;
|
|
4
|
+
export declare const getWebQueryMetadata: (type: AllType, parent: TypeParent, reflection: SourceMap, errorList: Error[], namespace: string) => import("@ez4/schema").ObjectSchema | undefined;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AllType, SourceMap, TypeClass, TypeModel } from '@ez4/reflection';
|
|
2
|
+
import type { WsConnection } from './types';
|
|
3
|
+
export declare const isWsConnectionDeclaration: (type: AllType) => type is TypeClass;
|
|
4
|
+
export declare const getWsConnectionMetadata: (type: AllType, parent: TypeModel, reflection: SourceMap, errorList: Error[]) => WsConnection | undefined;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AllType, SourceMap, TypeModel } from '@ez4/reflection';
|
|
2
|
+
import type { WsDefaults } from './types';
|
|
3
|
+
export declare const FULL_BASE_TYPE: string;
|
|
4
|
+
export declare const isWsDefaultsDeclaration: (type: TypeModel) => boolean;
|
|
5
|
+
export declare const getWsDefaultsMetadata: (type: AllType, parent: TypeModel, reflection: SourceMap, errorList: Error[]) => WsDefaults | undefined;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AllType, SourceMap, TypeModel } from '@ez4/reflection';
|
|
2
|
+
import type { WsEvent } from './types';
|
|
3
|
+
export declare const isWsEventDeclaration: (type: TypeModel) => boolean;
|
|
4
|
+
export declare const getWsEventMetadata: (type: AllType, parent: TypeModel, reflection: SourceMap, errorList: Error[]) => WsEvent | undefined;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AllType, TypeCallback, TypeFunction, TypeModel, SourceMap } from '@ez4/reflection';
|
|
2
|
+
import type { WsHandler } from './types';
|
|
3
|
+
export declare const isWsHandlerDeclaration: (type: AllType) => type is TypeCallback | TypeFunction;
|
|
4
|
+
export declare const getWsConnectionHandler: (type: AllType, parent: TypeModel, reflection: SourceMap, errorList: Error[]) => WsHandler | undefined;
|
|
5
|
+
export declare const getWsMessageHandler: (type: AllType, parent: TypeModel, reflection: SourceMap, errorList: Error[]) => WsHandler | undefined;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AllType, SourceMap, TypeClass, TypeModel } from '@ez4/reflection';
|
|
2
|
+
import type { WsMessage } from './types';
|
|
3
|
+
export declare const isWsMessageDeclaration: (type: AllType) => type is TypeClass;
|
|
4
|
+
export declare const getWsMessageMetadata: (type: AllType, parent: TypeModel, reflection: SourceMap, errorList: Error[]) => WsMessage | undefined;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AllType, SourceMap, TypeModel } from '@ez4/reflection';
|
|
2
|
+
import type { WsRequest } from './types';
|
|
3
|
+
export declare const isWsRequestDeclaration: (type: TypeModel) => boolean;
|
|
4
|
+
export declare const getWsRequestMetadata: (type: AllType, parent: TypeModel, reflection: SourceMap, errorList: Error[]) => WsRequest | undefined;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AllType, SourceMap, TypeModel } from '@ez4/reflection';
|
|
2
|
+
import type { WsResponse } from './types';
|
|
3
|
+
export declare const isWsResponseDeclaration: (type: TypeModel) => boolean;
|
|
4
|
+
export declare const getWsResponseMetadata: (type: AllType, parent: TypeModel, reflection: SourceMap, errorList: Error[]) => WsResponse | undefined;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { AllType, SourceMap, TypeClass } from '@ez4/reflection';
|
|
2
|
+
import type { WsService } from './types';
|
|
3
|
+
export declare const isWsServiceDeclaration: (type: AllType) => type is TypeClass;
|
|
4
|
+
export declare const getWsServicesMetadata: (reflection: SourceMap) => {
|
|
5
|
+
services: Record<string, WsService>;
|
|
6
|
+
errors: Error[];
|
|
7
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { ArraySchema, NamingStyle, ObjectSchema, ScalarSchema, UnionSchema } from '@ez4/schema';
|
|
2
|
+
import type { LinkedVariables, ServiceMetadata } from '@ez4/project/library';
|
|
3
|
+
import type { ServiceListener } from '@ez4/common/library';
|
|
4
|
+
import type { AuthHandler } from '../auth/types';
|
|
5
|
+
export declare const WsServiceType = "@ez4/ws";
|
|
6
|
+
export declare const WsNamespaceType = "Ws";
|
|
7
|
+
export declare const isWsService: (service: ServiceMetadata) => service is WsService;
|
|
8
|
+
export type WsDataSchema = ObjectSchema | UnionSchema | ArraySchema | ScalarSchema;
|
|
9
|
+
export type WsService = ServiceMetadata & {
|
|
10
|
+
type: typeof WsServiceType;
|
|
11
|
+
displayName?: string;
|
|
12
|
+
stageName?: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
defaults?: WsDefaults;
|
|
15
|
+
schema: WsDataSchema;
|
|
16
|
+
connect: WsConnection;
|
|
17
|
+
disconnect: WsConnection;
|
|
18
|
+
message: WsMessage;
|
|
19
|
+
};
|
|
20
|
+
export type WsConnection = {
|
|
21
|
+
handler: WsHandler;
|
|
22
|
+
listener?: ServiceListener;
|
|
23
|
+
authorizer?: AuthHandler;
|
|
24
|
+
variables?: LinkedVariables;
|
|
25
|
+
preferences?: WsPreferences;
|
|
26
|
+
logRetention?: number;
|
|
27
|
+
timeout?: number;
|
|
28
|
+
memory?: number;
|
|
29
|
+
};
|
|
30
|
+
export type WsMessage = {
|
|
31
|
+
handler: WsHandler;
|
|
32
|
+
listener?: ServiceListener;
|
|
33
|
+
variables?: LinkedVariables;
|
|
34
|
+
preferences?: WsPreferences;
|
|
35
|
+
logRetention?: number;
|
|
36
|
+
timeout?: number;
|
|
37
|
+
memory?: number;
|
|
38
|
+
};
|
|
39
|
+
export type WsHandler = {
|
|
40
|
+
name: string;
|
|
41
|
+
file: string;
|
|
42
|
+
module?: string;
|
|
43
|
+
description?: string;
|
|
44
|
+
request?: WsRequest | WsEvent;
|
|
45
|
+
response?: WsResponse;
|
|
46
|
+
};
|
|
47
|
+
export type WsEvent = {
|
|
48
|
+
identity?: ObjectSchema | UnionSchema;
|
|
49
|
+
headers?: ObjectSchema;
|
|
50
|
+
query?: ObjectSchema;
|
|
51
|
+
body?: WsDataSchema;
|
|
52
|
+
};
|
|
53
|
+
export type WsRequest = {
|
|
54
|
+
identity?: ObjectSchema | UnionSchema;
|
|
55
|
+
body?: WsDataSchema;
|
|
56
|
+
};
|
|
57
|
+
export type WsResponse = {
|
|
58
|
+
body?: WsDataSchema;
|
|
59
|
+
};
|
|
60
|
+
export type WsPreferences = {
|
|
61
|
+
namingStyle?: NamingStyle;
|
|
62
|
+
};
|
|
63
|
+
export type WsDefaults = {
|
|
64
|
+
listener?: ServiceListener;
|
|
65
|
+
preferences?: WsPreferences;
|
|
66
|
+
logRetention?: number;
|
|
67
|
+
timeout?: number;
|
|
68
|
+
memory?: number;
|
|
69
|
+
};
|
|
70
|
+
export type WsCache = {
|
|
71
|
+
authorizerTTL?: number;
|
|
72
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Service } from '@ez4/common';
|
|
2
|
+
import type { AuthIncoming } from './incoming';
|
|
3
|
+
import type { AuthResponse } from './response';
|
|
4
|
+
import type { AuthRequest } from './request';
|
|
5
|
+
import type { AuthProvider } from './provider';
|
|
6
|
+
/**
|
|
7
|
+
* Authorization handler.
|
|
8
|
+
*/
|
|
9
|
+
export type AuthHandler<T extends AuthRequest> = (request: AuthIncoming<T> | T, context: Service.Context<AuthProvider>) => Promise<AuthResponse> | AuthResponse;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { AuthRequest } from './request';
|
|
2
|
+
/**
|
|
3
|
+
* Incoming authorization.
|
|
4
|
+
*/
|
|
5
|
+
export type AuthIncoming<T extends AuthRequest> = T & {
|
|
6
|
+
/**
|
|
7
|
+
* Request tracking Id.
|
|
8
|
+
*/
|
|
9
|
+
readonly requestId: string;
|
|
10
|
+
/**
|
|
11
|
+
* Request timestamp.
|
|
12
|
+
*/
|
|
13
|
+
readonly timestamp: Date;
|
|
14
|
+
/**
|
|
15
|
+
* Request method.
|
|
16
|
+
*/
|
|
17
|
+
readonly method?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Request path.
|
|
20
|
+
*/
|
|
21
|
+
readonly path?: string;
|
|
22
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { LinkedVariables } from '@ez4/project/library';
|
|
2
|
+
export interface AuthProvider {
|
|
3
|
+
/**
|
|
4
|
+
* Variables associated to the provider.
|
|
5
|
+
*/
|
|
6
|
+
readonly variables?: LinkedVariables;
|
|
7
|
+
/**
|
|
8
|
+
* All services associated to the provider.
|
|
9
|
+
*/
|
|
10
|
+
readonly services: Record<string, unknown>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { WebPathParameters } from '../web/parameters';
|
|
2
|
+
import type { WebQueryStrings } from '../web/query';
|
|
3
|
+
import type { WebHeaders } from '../web/headers';
|
|
4
|
+
/**
|
|
5
|
+
* Authorization request.
|
|
6
|
+
*/
|
|
7
|
+
export interface AuthRequest {
|
|
8
|
+
/**
|
|
9
|
+
* Expected HTTP headers.
|
|
10
|
+
*/
|
|
11
|
+
readonly headers?: WebHeaders;
|
|
12
|
+
/**
|
|
13
|
+
* Expected HTTP path parameters.
|
|
14
|
+
*/
|
|
15
|
+
readonly parameters?: WebPathParameters;
|
|
16
|
+
/**
|
|
17
|
+
* Expected HTTP query strings.
|
|
18
|
+
*/
|
|
19
|
+
readonly query?: WebQueryStrings;
|
|
20
|
+
}
|
|
@@ -3,7 +3,7 @@ import type { Http } from './contract';
|
|
|
3
3
|
/**
|
|
4
4
|
* HTTP client.
|
|
5
5
|
*/
|
|
6
|
-
export type
|
|
6
|
+
export type HttpClient<T extends Http.Service | Http.Import<any>> = {
|
|
7
7
|
[P in ClientRoutes<T> as P extends {
|
|
8
8
|
name: infer N;
|
|
9
9
|
} ? (N extends string ? N : never) : never]: P extends {
|
|
@@ -16,7 +16,7 @@ export type Client<T extends Http.Service | Http.Import<any>> = {
|
|
|
16
16
|
/**
|
|
17
17
|
* Default HTTP client request.
|
|
18
18
|
*/
|
|
19
|
-
export type
|
|
19
|
+
export type HttpClientRequest = RequestOptions & {
|
|
20
20
|
readonly headers?: Record<string, string>;
|
|
21
21
|
readonly parameters?: Record<string, string>;
|
|
22
22
|
readonly query?: Record<string, unknown>;
|
|
@@ -25,7 +25,7 @@ export type ClientRequest = RequestOptions & {
|
|
|
25
25
|
/**
|
|
26
26
|
* Default HTTP response.
|
|
27
27
|
*/
|
|
28
|
-
export type
|
|
28
|
+
export type HttpClientResponse = {
|
|
29
29
|
readonly status: number;
|
|
30
30
|
readonly headers?: Record<string, string | undefined>;
|
|
31
31
|
readonly body?: unknown;
|