@ez4/gateway 0.36.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.
Files changed (93) hide show
  1. package/README.md +3 -4
  2. package/dist/library.cjs +429 -417
  3. package/dist/library.d.ts +10 -10
  4. package/dist/library.mjs +431 -413
  5. package/dist/main.cjs +19 -18
  6. package/dist/main.mjs +8 -6
  7. package/dist/metadata/auth/handler.d.ts +2 -2
  8. package/dist/metadata/auth/identity.d.ts +3 -3
  9. package/dist/metadata/auth/request.d.ts +2 -2
  10. package/dist/metadata/auth/response.d.ts +2 -2
  11. package/dist/metadata/auth/types.d.ts +8 -5
  12. package/dist/metadata/body.d.ts +6 -0
  13. package/dist/metadata/headers.d.ts +5 -0
  14. package/dist/metadata/http/access.d.ts +2 -2
  15. package/dist/metadata/http/authorization.d.ts +2 -2
  16. package/dist/metadata/http/cache.d.ts +2 -2
  17. package/dist/metadata/http/cors.d.ts +2 -2
  18. package/dist/metadata/http/defaults.d.ts +3 -3
  19. package/dist/metadata/http/errors.d.ts +3 -3
  20. package/dist/metadata/http/handler.d.ts +2 -2
  21. package/dist/metadata/http/import.d.ts +2 -2
  22. package/dist/metadata/http/request.d.ts +2 -2
  23. package/dist/metadata/http/response.d.ts +2 -2
  24. package/dist/metadata/http/routes.d.ts +3 -3
  25. package/dist/metadata/http/service.d.ts +2 -2
  26. package/dist/metadata/http/types.d.ts +27 -20
  27. package/dist/metadata/parameters.d.ts +5 -0
  28. package/dist/metadata/{web/preferences.d.ts → preferences.d.ts} +2 -2
  29. package/dist/metadata/provider.d.ts +4 -0
  30. package/dist/metadata/query.d.ts +5 -0
  31. package/dist/metadata/utils/{type.d.ts → name.d.ts} +1 -0
  32. package/dist/metadata/utils/provider.d.ts +4 -0
  33. package/dist/metadata/utils/schema.d.ts +3 -3
  34. package/dist/metadata/utils/validator.d.ts +5 -0
  35. package/dist/metadata/ws/connection.d.ts +2 -2
  36. package/dist/metadata/ws/defaults.d.ts +2 -2
  37. package/dist/metadata/ws/event.d.ts +2 -2
  38. package/dist/metadata/ws/handlers.d.ts +3 -4
  39. package/dist/metadata/ws/message.d.ts +2 -2
  40. package/dist/metadata/ws/request.d.ts +2 -2
  41. package/dist/metadata/ws/response.d.ts +2 -2
  42. package/dist/metadata/ws/service.d.ts +2 -2
  43. package/dist/metadata/ws/types.d.ts +23 -22
  44. package/dist/services/auth/request.d.ts +3 -3
  45. package/dist/services/{web/defaults.d.ts → defaults.d.ts} +9 -0
  46. package/dist/services/errors.d.ts +6 -0
  47. package/dist/services/http/contract.d.ts +8 -6
  48. package/dist/services/http/defaults.d.ts +1 -1
  49. package/dist/services/http/incoming.d.ts +5 -1
  50. package/dist/services/http/request.d.ts +4 -4
  51. package/dist/services/http/response.d.ts +2 -2
  52. package/dist/services/http/route.d.ts +1 -1
  53. package/dist/services/{web/target.d.ts → target.d.ts} +9 -0
  54. package/dist/services/ws/connect.d.ts +1 -1
  55. package/dist/services/ws/contract.d.ts +6 -4
  56. package/dist/services/ws/defaults.d.ts +1 -1
  57. package/dist/services/ws/disconnect.d.ts +1 -1
  58. package/dist/services/ws/event.d.ts +2 -2
  59. package/dist/services/ws/incoming.d.ts +5 -1
  60. package/dist/services/ws/message.d.ts +1 -1
  61. package/dist/services/ws/request.d.ts +1 -1
  62. package/dist/services/ws/response.d.ts +1 -1
  63. package/dist/utils/body.d.ts +3 -2
  64. package/dist/utils/headers.d.ts +2 -1
  65. package/dist/utils/identity.d.ts +2 -1
  66. package/dist/utils/parameters.d.ts +2 -1
  67. package/dist/utils/query.d.ts +2 -1
  68. package/dist/utils/validation.d.ts +2 -0
  69. package/dist/utils.cjs +62 -55
  70. package/dist/utils.d.ts +2 -1
  71. package/dist/utils.mjs +54 -52
  72. package/package.json +8 -8
  73. package/dist/metadata/http/provider.d.ts +0 -4
  74. package/dist/metadata/web/body.d.ts +0 -6
  75. package/dist/metadata/web/headers.d.ts +0 -5
  76. package/dist/metadata/web/parameters.d.ts +0 -5
  77. package/dist/metadata/web/query.d.ts +0 -5
  78. /package/dist/errors/{web/body.d.ts → body.d.ts} +0 -0
  79. /package/dist/errors/{web/defaults.d.ts → defaults.d.ts} +0 -0
  80. /package/dist/errors/{web/handler.d.ts → handler.d.ts} +0 -0
  81. /package/dist/errors/{web/headers.d.ts → headers.d.ts} +0 -0
  82. /package/dist/errors/{web/parameters.d.ts → parameters.d.ts} +0 -0
  83. /package/dist/errors/{web/preferences.d.ts → preferences.d.ts} +0 -0
  84. /package/dist/errors/{web/query.d.ts → query.d.ts} +0 -0
  85. /package/dist/errors/{web/request.d.ts → request.d.ts} +0 -0
  86. /package/dist/errors/{web/response.d.ts → response.d.ts} +0 -0
  87. /package/dist/errors/{web/service.d.ts → service.d.ts} +0 -0
  88. /package/dist/metadata/{web/types.d.ts → types.d.ts} +0 -0
  89. /package/dist/services/{web/body.d.ts → body.d.ts} +0 -0
  90. /package/dist/services/{web/headers.d.ts → headers.d.ts} +0 -0
  91. /package/dist/services/{web/parameters.d.ts → parameters.d.ts} +0 -0
  92. /package/dist/services/{web/preferences.d.ts → preferences.d.ts} +0 -0
  93. /package/dist/services/{web/query.d.ts → query.d.ts} +0 -0
package/dist/main.cjs CHANGED
@@ -1,19 +1,20 @@
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
- HttpInternalServerError,HttpNotFoundError,HttpUnauthorizedError,HttpUnprocessableEntityError,
18
- HttpUnsupportedMediaTypeError,Ws});
1
+ "use strict";var a=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var W=Object.getOwnPropertyNames;var A=Object.prototype.hasOwnProperty;var o=(r,e)=>a(r,"name",{value:e,configurable:!0});var g=(r,e)=>{for(var t in e)a(r,t,{get:e[t],enumerable:!0})},H=(r,e,t,n)=>{if(e&&
2
+ typeof e=="object"||typeof e=="function")for(let p of W(e))!A.call(r,p)&&p!==t&&
3
+ a(r,p,{get:()=>e[p],enumerable:!(n=v(e,p))||n.enumerable});return r};var q=r=>H(a({},"__esModule",{value:!0}),r);var b={};g(b,{AuthorizationType:()=>y,Http:()=>h,HttpBadRequestError:()=>i,HttpConflictError:()=>d,
4
+ HttpError:()=>s,HttpForbiddenError:()=>c,HttpInternalServerError:()=>f,HttpNotFoundError:()=>m,
5
+ HttpUnauthorizedError:()=>u,HttpUnprocessableEntityError:()=>l,HttpUnsupportedMediaTypeError:()=>x,
6
+ Ws:()=>R});module.exports=q(b);var y=(e=>(e.Bearer="bearer",e))(y||{});var R;(r=>{})(R||={});var h;(r=>{})(h||={});var T=require("@ez4/common");var s=class extends T.ServiceError{constructor(t,n,p){super(n,p);this.status=t}static{
7
+ o(this,"HttpError")}},i=class extends s{static{o(this,"HttpBadRequestError")}constructor(e,t){
8
+ super(400,e||"Bad request",t)}},u=class extends s{static{o(this,"HttpUnauthorize\
9
+ dError")}constructor(e,t){super(401,e||"Unauthorized",t)}},c=class extends s{static{
10
+ o(this,"HttpForbiddenError")}constructor(e,t){super(403,e||"Forbidden",t)}},m=class extends s{static{
11
+ o(this,"HttpNotFoundError")}constructor(e,t){super(404,e||"Not found",t)}},d=class extends s{static{
12
+ o(this,"HttpConflictError")}constructor(e,t){super(409,e||"Conflict",t)}},x=class extends s{static{
13
+ o(this,"HttpUnsupportedMediaTypeError")}constructor(e,t){super(415,e||"Unsupport\
14
+ ed media type",t)}},l=class extends s{static{o(this,"HttpUnprocessableEntityErro\
15
+ r")}constructor(e,t){super(422,e||"Unprocessable entity",t)}},f=class extends s{static{
16
+ o(this,"HttpInternalServerError")}constructor(e,t){super(500,e||"Internal server\
17
+ error",t)}};0&&(module.exports={AuthorizationType,Http,HttpBadRequestError,HttpConflictError,
18
+ HttpError,HttpForbiddenError,HttpInternalServerError,HttpNotFoundError,HttpUnauthorizedError,
19
+ HttpUnprocessableEntityError,HttpUnsupportedMediaTypeError,Ws});
19
20
  //# sourceMappingURL=main.cjs.map
package/dist/main.mjs CHANGED
@@ -1,14 +1,16 @@
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,
1
+ var f=Object.defineProperty;var s=(r,e)=>f(r,"name",{value:e,configurable:!0});var p=(e=>(e.Bearer="bearer",e))(p||{});var R;(r=>{})(R||={});var h;(r=>{})(h||={});import{ServiceError as T}from"@ez4/common";var o=class extends T{constructor(t,x,l){super(x,l);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
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)}},c=class extends o{static{
6
+ s(this,"HttpNotFoundError")}constructor(e,t){super(404,e||"Not found",t)}},u=class extends o{static{
7
+ s(this,"HttpConflictError")}constructor(e,t){super(409,e||"Conflict",t)}},c=class extends o{static{
7
8
  s(this,"HttpUnsupportedMediaTypeError")}constructor(e,t){super(415,e||"Unsupport\
8
9
  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
+ r")}constructor(e,t){super(422,e||"Unprocessable entity",t)}},d=class extends o{static{
10
11
  s(this,"HttpInternalServerError")}constructor(e,t){super(500,e||"Internal server\
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};
12
+ error",t)}};export{p as AuthorizationType,h as Http,n as HttpBadRequestError,u as HttpConflictError,
13
+ o as HttpError,y as HttpForbiddenError,d as HttpInternalServerError,i as HttpNotFoundError,
14
+ a as HttpUnauthorizedError,m as HttpUnprocessableEntityError,c as HttpUnsupportedMediaTypeError,
15
+ R as Ws};
14
16
  //# sourceMappingURL=main.mjs.map
@@ -1,4 +1,4 @@
1
- import type { AllType, SourceMap, TypeCallback, TypeFunction, TypeModel } from '@ez4/reflection';
1
+ import type { AllType, ReflectionTypes, TypeCallback, TypeFunction, TypeModel } from '@ez4/reflection';
2
2
  import type { AuthHandler } from './types';
3
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;
4
+ export declare const getAuthHandlerMetadata: (type: AllType, parent: TypeModel, reflection: ReflectionTypes, errorList: Error[], namespace: string) => AuthHandler | undefined;
@@ -1,6 +1,6 @@
1
- import type { AllType, SourceMap, TypeIntersection, TypeModel, TypeObject } from '@ez4/reflection';
2
- import type { ObjectSchema, UnionSchema } from '@ez4/schema/library';
1
+ import type { AllType, ReflectionTypes, TypeIntersection, TypeModel, TypeObject } from '@ez4/reflection';
2
+ import type { ObjectSchema, UnionSchema } from '@ez4/schema';
3
3
  type TypeParent = TypeObject | TypeModel | TypeIntersection;
4
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;
5
+ export declare const getAuthIdentityMetadata: (type: AllType, parent: TypeParent, reflection: ReflectionTypes, errorList: Error[], namespace: string) => ObjectSchema | UnionSchema | undefined;
6
6
  export {};
@@ -1,4 +1,4 @@
1
- import type { AllType, SourceMap, TypeModel } from '@ez4/reflection';
1
+ import type { AllType, ReflectionTypes, TypeModel } from '@ez4/reflection';
2
2
  import type { AuthRequest } from '../auth/types';
3
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;
4
+ export declare const getAuthRequestMetadata: (type: AllType, parent: TypeModel, reflection: ReflectionTypes, errorList: Error[], namespace: string) => AuthRequest | undefined;
@@ -1,4 +1,4 @@
1
- import type { AllType, SourceMap, TypeModel } from '@ez4/reflection';
1
+ import type { AllType, ReflectionTypes, TypeModel } from '@ez4/reflection';
2
2
  import type { AuthResponse } from '../auth/types';
3
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;
4
+ export declare const getAuthResponseMetadata: (type: AllType, parent: TypeModel, reflection: ReflectionTypes, errorList: Error[], namespace: string) => AuthResponse | undefined;
@@ -1,9 +1,8 @@
1
+ import type { LinkedServices, LinkedVariables } from '@ez4/project/library';
2
+ import type { FunctionSignature } from '@ez4/common/library';
1
3
  import type { ObjectSchema, UnionSchema } from '@ez4/schema';
2
- export type AuthHandler = {
3
- name: string;
4
- module?: string;
5
- file: string;
6
- description?: string;
4
+ export type AuthHandler = FunctionSignature & {
5
+ provider?: AuthProvider;
7
6
  response?: AuthResponse;
8
7
  request?: AuthRequest;
9
8
  };
@@ -15,3 +14,7 @@ export type AuthRequest = {
15
14
  parameters?: ObjectSchema;
16
15
  query?: ObjectSchema;
17
16
  };
17
+ export type AuthProvider = {
18
+ variables?: LinkedVariables;
19
+ services?: LinkedServices;
20
+ };
@@ -0,0 +1,6 @@
1
+ import type { AllType, ReflectionTypes, TypeIntersection, TypeModel, TypeObject } from '@ez4/reflection';
2
+ import type { ArraySchema, ObjectSchema, UnionSchema } from '@ez4/schema';
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: ReflectionTypes, errorList: Error[], namespace: string) => ObjectSchema | UnionSchema | ArraySchema | import("@ez4/schema").BooleanSchema | import("@ez4/schema").NumberSchema | import("@ez4/schema").StringSchema | undefined;
6
+ export {};
@@ -0,0 +1,5 @@
1
+ import type { AllType, ReflectionTypes, 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: ReflectionTypes, errorList: Error[], namespace: string) => import("@ez4/schema").ObjectSchema | undefined;
5
+ export {};
@@ -1,4 +1,4 @@
1
- import type { AllType, SourceMap, TypeModel } from '@ez4/reflection';
1
+ import type { AllType, ReflectionTypes, TypeModel } from '@ez4/reflection';
2
2
  import type { HttpAccess } from './types';
3
3
  export declare const isHttpAccessDeclaration: (type: TypeModel) => boolean;
4
- export declare const getHttpAccessMetadata: (type: AllType, parent: TypeModel, reflection: SourceMap, errorList: Error[]) => HttpAccess | undefined;
4
+ export declare const getHttpAccessMetadata: (type: AllType, parent: TypeModel, reflection: ReflectionTypes, errorList: Error[]) => HttpAccess | undefined;
@@ -1,4 +1,4 @@
1
- import type { AllType, SourceMap, TypeModel } from '@ez4/reflection';
1
+ import type { AllType, ReflectionTypes, TypeModel } from '@ez4/reflection';
2
2
  import type { HttpAuthorization } from './types';
3
3
  export declare const isHttpAuthorizationDeclaration: (type: TypeModel) => boolean;
4
- export declare const getHttpAuthorizationMetadata: (type: AllType, parent: TypeModel, reflection: SourceMap, errorList: Error[]) => HttpAuthorization | undefined;
4
+ export declare const getHttpAuthorizationMetadata: (type: AllType, parent: TypeModel, reflection: ReflectionTypes, errorList: Error[]) => HttpAuthorization | undefined;
@@ -1,4 +1,4 @@
1
- import type { AllType, SourceMap, TypeModel } from '@ez4/reflection';
1
+ import type { AllType, ReflectionTypes, TypeModel } from '@ez4/reflection';
2
2
  import type { HttpCache } from './types';
3
3
  export declare const isHttpCacheDeclaration: (type: TypeModel) => boolean;
4
- export declare const getHttpCacheMetadata: (type: AllType, parent: TypeModel, reflection: SourceMap, errorList: Error[]) => HttpCache | undefined;
4
+ export declare const getHttpCacheMetadata: (type: AllType, parent: TypeModel, reflection: ReflectionTypes, errorList: Error[]) => HttpCache | undefined;
@@ -1,4 +1,4 @@
1
- import type { AllType, SourceMap, TypeModel } from '@ez4/reflection';
1
+ import type { AllType, ReflectionTypes, TypeModel } from '@ez4/reflection';
2
2
  import type { HttpCors } from './types';
3
3
  export declare const isHttpCorsDeclaration: (type: TypeModel) => boolean;
4
- export declare const getHttpCorsMetadata: (type: AllType, parent: TypeModel, reflection: SourceMap, errorList: Error[]) => HttpCors | undefined;
4
+ export declare const getHttpCorsMetadata: (type: AllType, parent: TypeModel, reflection: ReflectionTypes, errorList: Error[]) => HttpCors | undefined;
@@ -1,4 +1,4 @@
1
- import type { AllType, SourceMap, TypeModel } from '@ez4/reflection';
2
- import { type HttpDefaults } from './types';
1
+ import type { AllType, ReflectionTypes, TypeModel } from '@ez4/reflection';
2
+ import type { HttpDefaults } from './types';
3
3
  export declare const isHttpDefaultsDeclaration: (type: TypeModel) => boolean;
4
- export declare const getHttpDefaultsMetadata: (type: AllType, parent: TypeModel, reflection: SourceMap, errorList: Error[]) => HttpDefaults | undefined;
4
+ export declare const getHttpDefaultsMetadata: (type: AllType, parent: TypeModel, reflection: ReflectionTypes, errorList: Error[]) => HttpDefaults | undefined;
@@ -1,4 +1,4 @@
1
- import type { AllType, ModelProperty, SourceMap, TypeModel } from '@ez4/reflection';
1
+ import type { AllType, ModelProperty, ReflectionTypes, TypeModel } from '@ez4/reflection';
2
2
  import type { HttpErrors } from './types';
3
- export declare const getHttpErrorsMetadata: (type: AllType, parent: TypeModel, reflection: SourceMap, errorList: Error[]) => HttpErrors | undefined;
4
- export declare const getErrorClasses: (member: ModelProperty, errorCode: number, parent: TypeModel, reflection: SourceMap, errorList: Error[]) => HttpErrors;
3
+ export declare const getHttpErrorsMetadata: (type: AllType, parent: TypeModel, reflection: ReflectionTypes, errorList: Error[]) => HttpErrors | undefined;
4
+ export declare const getErrorClasses: (member: ModelProperty, errorCode: number, parent: TypeModel, reflection: ReflectionTypes, errorList: Error[]) => HttpErrors;
@@ -1,4 +1,4 @@
1
- import type { AllType, SourceMap, TypeCallback, TypeFunction, TypeModel } from '@ez4/reflection';
1
+ import type { AllType, ReflectionTypes, TypeCallback, TypeFunction, TypeModel } from '@ez4/reflection';
2
2
  import type { HttpHandler } from './types';
3
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;
4
+ export declare const getHttpHandlerMetadata: (type: AllType, parent: TypeModel, reflection: ReflectionTypes, errorList: Error[], external: boolean) => HttpHandler | undefined;
@@ -1,7 +1,7 @@
1
- import type { AllType, SourceMap, TypeClass } from '@ez4/reflection';
1
+ import type { AllType, ReflectionTypes, TypeClass } from '@ez4/reflection';
2
2
  import type { HttpImport } from './types';
3
3
  export declare const isHttpImportDeclaration: (type: AllType) => type is TypeClass;
4
- export declare const getHttpImportsMetadata: (reflection: SourceMap) => {
4
+ export declare const getHttpImportsMetadata: (reflection: ReflectionTypes) => {
5
5
  services: Record<string, HttpImport>;
6
6
  errors: Error[];
7
7
  };
@@ -1,4 +1,4 @@
1
- import type { AllType, SourceMap, TypeModel } from '@ez4/reflection';
1
+ import type { AllType, ReflectionTypes, TypeModel } from '@ez4/reflection';
2
2
  import type { HttpRequest } from './types';
3
3
  export declare const isHttpRequestDeclaration: (type: TypeModel) => boolean;
4
- export declare const getHttpRequestMetadata: (type: AllType, parent: TypeModel, reflection: SourceMap, errorList: Error[]) => HttpRequest | undefined;
4
+ export declare const getHttpRequestMetadata: (type: AllType, parent: TypeModel, reflection: ReflectionTypes, errorList: Error[]) => HttpRequest | undefined;
@@ -1,4 +1,4 @@
1
- import type { AllType, SourceMap, TypeModel } from '@ez4/reflection';
1
+ import type { AllType, ReflectionTypes, TypeModel } from '@ez4/reflection';
2
2
  import type { HttpResponse } from './types';
3
3
  export declare const isHttpResponseDeclaration: (type: TypeModel) => boolean;
4
- export declare const getHttpResponseMetadata: (type: AllType, parent: TypeModel, reflection: SourceMap, errorList: Error[]) => HttpResponse | undefined;
4
+ export declare const getHttpResponseMetadata: (type: AllType, parent: TypeModel, reflection: ReflectionTypes, errorList: Error[]) => HttpResponse | undefined;
@@ -1,5 +1,5 @@
1
- import type { AllType, ModelProperty, SourceMap, TypeModel } from '@ez4/reflection';
1
+ import type { AllType, ModelProperty, ReflectionTypes, TypeModel } from '@ez4/reflection';
2
2
  import type { HttpRoute } from './types';
3
3
  export declare const isHttpRouteDeclaration: (type: AllType) => type is TypeModel;
4
- export declare const getHttpLocalRoutes: (parent: TypeModel, member: ModelProperty, reflection: SourceMap, errorList: Error[]) => HttpRoute[] | undefined;
5
- export declare const getHttpRemoteRoutes: (parent: TypeModel, member: ModelProperty, reflection: SourceMap, errorList: Error[]) => HttpRoute[] | undefined;
4
+ export declare const getHttpLocalRoutes: (parent: TypeModel, member: ModelProperty, reflection: ReflectionTypes, errorList: Error[]) => HttpRoute[] | undefined;
5
+ export declare const getHttpRemoteRoutes: (parent: TypeModel, member: ModelProperty, reflection: ReflectionTypes, errorList: Error[]) => HttpRoute[] | undefined;
@@ -1,7 +1,7 @@
1
- import type { AllType, SourceMap, TypeClass } from '@ez4/reflection';
1
+ import type { AllType, ReflectionTypes, TypeClass } from '@ez4/reflection';
2
2
  import type { HttpService } from './types';
3
3
  export declare const isHttpServiceDeclaration: (type: AllType) => type is TypeClass;
4
- export declare const getHttpServicesMetadata: (reflection: SourceMap) => {
4
+ export declare const getHttpServicesMetadata: (reflection: ReflectionTypes) => {
5
5
  services: Record<string, HttpService>;
6
6
  errors: Error[];
7
7
  };
@@ -1,17 +1,15 @@
1
1
  import type { ArraySchema, NamingStyle, ObjectSchema, ScalarSchema, UnionSchema } from '@ez4/schema';
2
- import type { LinkedServices, LinkedVariables } from '@ez4/project/library';
3
- import type { ServiceMetadata } from '@ez4/project/library';
4
- import type { ServiceListener } from '@ez4/common/library';
2
+ import type { LinkedServices, LinkedVariables, ServiceMetadata } from '@ez4/project/library';
3
+ import type { FunctionSignature, ServiceListener } from '@ez4/common/library';
4
+ import type { ArchitectureType, RuntimeType } from '@ez4/project';
5
5
  import type { AuthorizationType } from '../../services/http/authorization';
6
- import type { AuthHandler } from '../auth/types';
7
6
  import type { HttpPath } from '../../services/http/path';
7
+ import type { AuthHandler } from '../auth/types';
8
8
  export declare const HttpServiceType = "@ez4/http";
9
9
  export declare const HttpImportType = "@ez4/import:http";
10
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
11
  export type HttpDataSchema = ObjectSchema | UnionSchema | ArraySchema | ScalarSchema;
14
- export type HttpService = ServiceMetadata & {
12
+ export type HttpService = Omit<ServiceMetadata, 'variables' | 'services'> & Required<Pick<ServiceMetadata, 'variables' | 'services'>> & {
15
13
  type: typeof HttpServiceType;
16
14
  displayName?: string;
17
15
  description?: string;
@@ -51,30 +49,20 @@ export type HttpResponse = {
51
49
  headers?: ObjectSchema;
52
50
  body?: HttpDataSchema;
53
51
  };
54
- export type HttpHandler = {
55
- name: string;
56
- file: string;
57
- module?: string;
58
- description?: string;
52
+ export type HttpHandler = FunctionSignature & {
53
+ provider?: HttpProvider;
59
54
  response: HttpResponse;
60
55
  request?: HttpRequest;
61
- provider?: HttpProvider;
62
56
  };
63
57
  export type HttpErrors = {
64
58
  [name: string]: number;
65
59
  };
66
- export type HttpRoute = {
60
+ export type HttpRoute = HttpDefaults & {
67
61
  name?: string;
68
62
  path: HttpPath;
69
63
  handler: HttpHandler;
70
- listener?: ServiceListener;
71
64
  authorizer?: AuthHandler;
72
65
  variables?: LinkedVariables;
73
- httpErrors?: HttpErrors;
74
- preferences?: HttpPreferences;
75
- logRetention?: number;
76
- timeout?: number;
77
- memory?: number;
78
66
  cors?: boolean;
79
67
  disabled?: boolean;
80
68
  };
@@ -82,6 +70,8 @@ export type HttpDefaults = {
82
70
  listener?: ServiceListener;
83
71
  httpErrors?: HttpErrors;
84
72
  preferences?: HttpPreferences;
73
+ architecture?: ArchitectureType;
74
+ runtime?: RuntimeType;
85
75
  logRetention?: number;
86
76
  timeout?: number;
87
77
  memory?: number;
@@ -104,3 +94,20 @@ export type HttpProvider = {
104
94
  variables?: LinkedVariables;
105
95
  services?: LinkedServices;
106
96
  };
97
+ export declare const isHttpService: (service: ServiceMetadata) => service is HttpService;
98
+ export declare const createHttpService: (name: string) => {
99
+ variables: {};
100
+ services: {};
101
+ type: "@ez4/http";
102
+ name: string;
103
+ context: Record<string, import("@ez4/project/library").LinkedContext>;
104
+ displayName?: string | null | undefined;
105
+ description?: string | null | undefined;
106
+ defaults?: HttpDefaults | null | undefined;
107
+ routes?: HttpRoute[] | null | undefined;
108
+ cache?: HttpCache | null | undefined;
109
+ access?: HttpAccess | null | undefined;
110
+ cors?: HttpCors | null | undefined;
111
+ };
112
+ export declare const isHttpImport: (service: ServiceMetadata) => service is HttpImport;
113
+ export declare const createHttpImport: (name: string) => ServiceMetadata & import("@ez4/utils").Incomplete<HttpImport>;
@@ -0,0 +1,5 @@
1
+ import type { AllType, ReflectionTypes, 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: ReflectionTypes, errorList: Error[], namespace: string) => import("@ez4/schema").ObjectSchema | undefined;
5
+ export {};
@@ -1,4 +1,4 @@
1
- import type { AllType, SourceMap, TypeModel } from '@ez4/reflection';
1
+ import type { AllType, ReflectionTypes, TypeModel } from '@ez4/reflection';
2
2
  import type { WebPreferences } from './types';
3
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;
4
+ export declare const getWebPreferencesMetadata: (type: AllType, parent: TypeModel, reflection: ReflectionTypes, errorList: Error[], namespace: string) => WebPreferences | undefined;
@@ -0,0 +1,4 @@
1
+ import type { AllType, ReflectionTypes, TypeModel } from '@ez4/reflection';
2
+ import type { HttpProvider } from './http/types';
3
+ export declare const isWebProviderDeclaration: (type: AllType, namespace: string) => type is TypeModel;
4
+ export declare const getWebProviderMetadata: (type: AllType, parent: TypeModel, reflection: ReflectionTypes, errorList: Error[], namespace: string) => HttpProvider | undefined;
@@ -0,0 +1,5 @@
1
+ import type { AllType, ReflectionTypes, 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: ReflectionTypes, errorList: Error[], namespace: string) => import("@ez4/schema").ObjectSchema | undefined;
5
+ export {};
@@ -1 +1,2 @@
1
1
  export declare const getFullTypeName: (namespace: string, type: string) => string;
2
+ export declare const getValidatorName: (type: string) => string;
@@ -0,0 +1,4 @@
1
+ import type { LinkedServices } from '@ez4/project/library';
2
+ import type { AuthHandler } from '../auth/types';
3
+ import type { HttpHandler } from '../http/types';
4
+ export declare const attachProviderLinkedServices: (handler: HttpHandler | AuthHandler, services: LinkedServices, errorList: Error[], fileName?: string) => void;
@@ -1,3 +1,3 @@
1
- import type { SourceMap, TypeIntersection, TypeModel, TypeObject } from '@ez4/reflection';
2
- export declare const getSchemaFromIntersection: (type: TypeObject | TypeModel | TypeIntersection, reflection: SourceMap) => import("@ez4/schema").ObjectSchema | undefined;
3
- export declare const getSchemaFromObject: (type: TypeObject | TypeModel | TypeIntersection, reflection: SourceMap) => import("@ez4/schema").ObjectSchema | undefined;
1
+ import type { ReflectionTypes, TypeIntersection, TypeModel, TypeObject } from '@ez4/reflection';
2
+ export declare const getSchemaFromIntersection: (type: TypeObject | TypeModel | TypeIntersection, reflection: ReflectionTypes) => import("@ez4/schema").ObjectSchema | undefined;
3
+ export declare const getSchemaFromObject: (type: TypeObject | TypeModel | TypeIntersection, reflection: ReflectionTypes) => import("@ez4/schema").ObjectSchema | undefined;
@@ -0,0 +1,5 @@
1
+ import type { LinkedServices } from '@ez4/project/library';
2
+ import type { AuthHandler } from '../auth/types';
3
+ import type { HttpHandler } from '../http/types';
4
+ import type { WsHandler } from '../ws/types';
5
+ export declare const attachValidatorLinkedServices: (handler: HttpHandler | AuthHandler | WsHandler, services: LinkedServices) => void;
@@ -1,4 +1,4 @@
1
- import type { AllType, SourceMap, TypeClass, TypeModel } from '@ez4/reflection';
1
+ import type { AllType, ReflectionTypes, TypeClass, TypeModel } from '@ez4/reflection';
2
2
  import type { WsConnection } from './types';
3
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;
4
+ export declare const getWsConnectionMetadata: (type: AllType, parent: TypeModel, reflection: ReflectionTypes, errorList: Error[]) => WsConnection | undefined;
@@ -1,5 +1,5 @@
1
- import type { AllType, SourceMap, TypeModel } from '@ez4/reflection';
1
+ import type { AllType, ReflectionTypes, TypeModel } from '@ez4/reflection';
2
2
  import type { WsDefaults } from './types';
3
3
  export declare const FULL_BASE_TYPE: string;
4
4
  export declare const isWsDefaultsDeclaration: (type: TypeModel) => boolean;
5
- export declare const getWsDefaultsMetadata: (type: AllType, parent: TypeModel, reflection: SourceMap, errorList: Error[]) => WsDefaults | undefined;
5
+ export declare const getWsDefaultsMetadata: (type: AllType, parent: TypeModel, reflection: ReflectionTypes, errorList: Error[]) => WsDefaults | undefined;
@@ -1,4 +1,4 @@
1
- import type { AllType, SourceMap, TypeModel } from '@ez4/reflection';
1
+ import type { AllType, ReflectionTypes, TypeModel } from '@ez4/reflection';
2
2
  import type { WsEvent } from './types';
3
3
  export declare const isWsEventDeclaration: (type: TypeModel) => boolean;
4
- export declare const getWsEventMetadata: (type: AllType, parent: TypeModel, reflection: SourceMap, errorList: Error[]) => WsEvent | undefined;
4
+ export declare const getWsEventMetadata: (type: AllType, parent: TypeModel, reflection: ReflectionTypes, errorList: Error[]) => WsEvent | undefined;
@@ -1,5 +1,4 @@
1
- import type { AllType, TypeCallback, TypeFunction, TypeModel, SourceMap } from '@ez4/reflection';
2
- import type { WsHandler } from './types';
1
+ import type { AllType, TypeCallback, TypeFunction, TypeModel, ReflectionTypes } from '@ez4/reflection';
3
2
  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;
3
+ export declare const getWsConnectionHandler: (type: AllType, parent: TypeModel, reflection: ReflectionTypes, errorList: Error[]) => import("@ez4/common/library").FunctionSignature | undefined;
4
+ export declare const getWsMessageHandler: (type: AllType, parent: TypeModel, reflection: ReflectionTypes, errorList: Error[]) => import("@ez4/common/library").FunctionSignature | undefined;
@@ -1,4 +1,4 @@
1
- import type { AllType, SourceMap, TypeClass, TypeModel } from '@ez4/reflection';
1
+ import type { AllType, ReflectionTypes, TypeClass, TypeModel } from '@ez4/reflection';
2
2
  import type { WsMessage } from './types';
3
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;
4
+ export declare const getWsMessageMetadata: (type: AllType, parent: TypeModel, reflection: ReflectionTypes, errorList: Error[]) => WsMessage | undefined;
@@ -1,4 +1,4 @@
1
- import type { AllType, SourceMap, TypeModel } from '@ez4/reflection';
1
+ import type { AllType, ReflectionTypes, TypeModel } from '@ez4/reflection';
2
2
  import type { WsRequest } from './types';
3
3
  export declare const isWsRequestDeclaration: (type: TypeModel) => boolean;
4
- export declare const getWsRequestMetadata: (type: AllType, parent: TypeModel, reflection: SourceMap, errorList: Error[]) => WsRequest | undefined;
4
+ export declare const getWsRequestMetadata: (type: AllType, parent: TypeModel, reflection: ReflectionTypes, errorList: Error[]) => WsRequest | undefined;
@@ -1,4 +1,4 @@
1
- import type { AllType, SourceMap, TypeModel } from '@ez4/reflection';
1
+ import type { AllType, ReflectionTypes, TypeModel } from '@ez4/reflection';
2
2
  import type { WsResponse } from './types';
3
3
  export declare const isWsResponseDeclaration: (type: TypeModel) => boolean;
4
- export declare const getWsResponseMetadata: (type: AllType, parent: TypeModel, reflection: SourceMap, errorList: Error[]) => WsResponse | undefined;
4
+ export declare const getWsResponseMetadata: (type: AllType, parent: TypeModel, reflection: ReflectionTypes, errorList: Error[]) => WsResponse | undefined;
@@ -1,7 +1,7 @@
1
- import type { AllType, SourceMap, TypeClass } from '@ez4/reflection';
1
+ import type { AllType, ReflectionTypes, TypeClass } from '@ez4/reflection';
2
2
  import type { WsService } from './types';
3
3
  export declare const isWsServiceDeclaration: (type: AllType) => type is TypeClass;
4
- export declare const getWsServicesMetadata: (reflection: SourceMap) => {
4
+ export declare const getWsServicesMetadata: (reflection: ReflectionTypes) => {
5
5
  services: Record<string, WsService>;
6
6
  errors: Error[];
7
7
  };
@@ -1,12 +1,12 @@
1
1
  import type { ArraySchema, NamingStyle, ObjectSchema, ScalarSchema, UnionSchema } from '@ez4/schema';
2
+ import type { FunctionSignature, ServiceListener } from '@ez4/common/library';
2
3
  import type { LinkedVariables, ServiceMetadata } from '@ez4/project/library';
3
- import type { ServiceListener } from '@ez4/common/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";
7
- export declare const isWsService: (service: ServiceMetadata) => service is WsService;
8
8
  export type WsDataSchema = ObjectSchema | UnionSchema | ArraySchema | ScalarSchema;
9
- export type WsService = ServiceMetadata & {
9
+ export type WsService = Omit<ServiceMetadata, 'variables' | 'services'> & Required<Pick<ServiceMetadata, 'variables' | 'services'>> & {
10
10
  type: typeof WsServiceType;
11
11
  displayName?: string;
12
12
  stageName?: string;
@@ -17,30 +17,16 @@ export type WsService = ServiceMetadata & {
17
17
  disconnect: WsConnection;
18
18
  message: WsMessage;
19
19
  };
20
- export type WsConnection = {
20
+ export type WsConnection = WsDefaults & {
21
21
  handler: WsHandler;
22
- listener?: ServiceListener;
23
22
  authorizer?: AuthHandler;
24
23
  variables?: LinkedVariables;
25
- preferences?: WsPreferences;
26
- logRetention?: number;
27
- timeout?: number;
28
- memory?: number;
29
24
  };
30
- export type WsMessage = {
25
+ export type WsMessage = WsDefaults & {
31
26
  handler: WsHandler;
32
- listener?: ServiceListener;
33
27
  variables?: LinkedVariables;
34
- preferences?: WsPreferences;
35
- logRetention?: number;
36
- timeout?: number;
37
- memory?: number;
38
28
  };
39
- export type WsHandler = {
40
- name: string;
41
- file: string;
42
- module?: string;
43
- description?: string;
29
+ export type WsHandler = FunctionSignature & {
44
30
  request?: WsRequest | WsEvent;
45
31
  response?: WsResponse;
46
32
  };
@@ -63,10 +49,25 @@ export type WsPreferences = {
63
49
  export type WsDefaults = {
64
50
  listener?: ServiceListener;
65
51
  preferences?: WsPreferences;
52
+ architecture?: ArchitectureType;
53
+ runtime?: RuntimeType;
66
54
  logRetention?: number;
67
55
  timeout?: number;
68
56
  memory?: number;
69
57
  };
70
- export type WsCache = {
71
- authorizerTTL?: number;
58
+ export declare const isWsService: (service: ServiceMetadata) => service is WsService;
59
+ export declare const createWsService: (name: string) => {
60
+ variables: {};
61
+ services: {};
62
+ type: "@ez4/ws";
63
+ name: string;
64
+ context: Record<string, import("@ez4/project/library").LinkedContext>;
65
+ displayName?: string | null | undefined;
66
+ stageName?: string | null | undefined;
67
+ description?: string | null | undefined;
68
+ defaults?: WsDefaults | null | undefined;
69
+ schema?: WsDataSchema | null | undefined;
70
+ connect?: WsConnection | null | undefined;
71
+ disconnect?: WsConnection | null | undefined;
72
+ message?: WsMessage | null | undefined;
72
73
  };
@@ -1,6 +1,6 @@
1
- import type { WebPathParameters } from '../web/parameters';
2
- import type { WebQueryStrings } from '../web/query';
3
- import type { WebHeaders } from '../web/headers';
1
+ import type { WebPathParameters } from '../parameters';
2
+ import type { WebQueryStrings } from '../query';
3
+ import type { WebHeaders } from '../headers';
4
4
  /**
5
5
  * Authorization request.
6
6
  */
@@ -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
  }
@@ -30,6 +30,12 @@ export declare class HttpForbiddenError extends HttpError {
30
30
  export declare class HttpNotFoundError extends HttpError {
31
31
  constructor(message?: string, details?: string[]);
32
32
  }
33
+ /**
34
+ * HTTP Conflict error.
35
+ */
36
+ export declare class HttpConflictError extends HttpError {
37
+ constructor(message?: string, details?: string[]);
38
+ }
33
39
  /**
34
40
  * HTTP Unsupported Media Type error.
35
41
  */