@opra/common 1.0.0-beta.3 → 1.0.0-beta.4

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 (64) hide show
  1. package/browser/index.cjs +5 -5
  2. package/browser/index.mjs +5 -5
  3. package/cjs/document/api-document.js +4 -4
  4. package/cjs/document/constants.js +2 -2
  5. package/cjs/document/decorators/{msg-controller.decorator.js → rpc-controller.decorator.js} +13 -8
  6. package/cjs/document/decorators/{msg-operation.decorator.js → rpc-operation.decorator.js} +6 -6
  7. package/cjs/document/factory/api-document.factory.js +3 -3
  8. package/cjs/document/factory/{msg-api.factory.js → rpc-api.factory.js} +28 -28
  9. package/cjs/document/http/http-operation.js +6 -0
  10. package/cjs/document/index.js +8 -6
  11. package/cjs/document/{msg/msg-api.js → rpc/rpc-api.js} +5 -5
  12. package/cjs/document/{msg/msg-controller.js → rpc/rpc-controller.js} +20 -20
  13. package/cjs/document/{msg/msg-header.js → rpc/rpc-header.js} +5 -5
  14. package/cjs/document/{msg/msg-operation-response.js → rpc/rpc-operation-response.js} +4 -4
  15. package/cjs/document/{msg/msg-operation.js → rpc/rpc-operation.js} +10 -10
  16. package/cjs/schema/opra-schema.js +3 -3
  17. package/cjs/schema/rpc/rpc-controller.interface.js +11 -0
  18. package/cjs/schema/rpc/rpc-operation.interface.js +7 -0
  19. package/esm/document/api-document.js +4 -4
  20. package/esm/document/constants.js +1 -1
  21. package/esm/document/decorators/{msg-controller.decorator.js → rpc-controller.decorator.js} +13 -8
  22. package/esm/document/decorators/{msg-operation.decorator.js → rpc-operation.decorator.js} +6 -6
  23. package/esm/document/factory/api-document.factory.js +3 -3
  24. package/esm/document/factory/{msg-api.factory.js → rpc-api.factory.js} +27 -27
  25. package/esm/document/http/http-operation.js +6 -0
  26. package/esm/document/index.js +8 -6
  27. package/esm/document/{msg/msg-api.js → rpc/rpc-api.js} +3 -3
  28. package/esm/document/{msg/msg-controller.js → rpc/rpc-controller.js} +20 -20
  29. package/esm/document/{msg/msg-header.js → rpc/rpc-header.js} +4 -4
  30. package/esm/document/{msg/msg-operation-response.js → rpc/rpc-operation-response.js} +2 -2
  31. package/esm/document/{msg/msg-operation.js → rpc/rpc-operation.js} +9 -9
  32. package/esm/schema/opra-schema.js +3 -3
  33. package/esm/schema/rpc/rpc-controller.interface.js +8 -0
  34. package/esm/schema/rpc/rpc-operation.interface.js +4 -0
  35. package/package.json +1 -1
  36. package/types/document/api-document.d.ts +3 -3
  37. package/types/document/constants.d.ts +1 -1
  38. package/types/document/decorators/rpc-controller.decorator.d.ts +20 -0
  39. package/types/document/decorators/rpc-operation.decorator.d.ts +32 -0
  40. package/types/document/factory/api-document.factory.d.ts +2 -2
  41. package/types/document/factory/rpc-api.factory.d.ts +40 -0
  42. package/types/document/index.d.ts +11 -8
  43. package/types/document/rpc/rpc-api.d.ts +27 -0
  44. package/types/document/rpc/rpc-controller.d.ts +89 -0
  45. package/types/document/{msg/msg-header.d.ts → rpc/rpc-header.d.ts} +15 -15
  46. package/types/document/{msg/msg-operation-response.d.ts → rpc/rpc-operation-response.d.ts} +13 -13
  47. package/types/document/{msg/msg-operation.d.ts → rpc/rpc-operation.d.ts} +27 -27
  48. package/types/schema/api-document.interface.d.ts +9 -11
  49. package/types/schema/opra-schema.d.ts +3 -3
  50. package/types/schema/rpc/rpc-controller.interface.d.ts +22 -0
  51. package/types/schema/{msg/msg-header.interface.d.ts → rpc/rpc-header.interface.d.ts} +2 -2
  52. package/types/schema/{msg/msg-operation.interface.d.ts → rpc/rpc-operation.interface.d.ts} +11 -11
  53. package/cjs/schema/msg/msg-controller.interface.js +0 -11
  54. package/cjs/schema/msg/msg-operation.interface.js +0 -7
  55. package/esm/schema/msg/msg-controller.interface.js +0 -8
  56. package/esm/schema/msg/msg-operation.interface.js +0 -4
  57. package/types/document/decorators/msg-controller.decorator.d.ts +0 -11
  58. package/types/document/decorators/msg-operation.decorator.d.ts +0 -29
  59. package/types/document/factory/msg-api.factory.d.ts +0 -40
  60. package/types/document/msg/msg-api.d.ts +0 -27
  61. package/types/document/msg/msg-controller.d.ts +0 -89
  62. package/types/schema/msg/msg-controller.interface.d.ts +0 -22
  63. /package/cjs/schema/{msg/msg-header.interface.js → rpc/rpc-header.interface.js} +0 -0
  64. /package/esm/schema/{msg/msg-header.interface.js → rpc/rpc-header.interface.js} +0 -0
@@ -1,29 +0,0 @@
1
- import type { ThunkAsync, Type, TypeThunkAsync } from 'ts-gems';
2
- import type { MsgHeader } from '../msg/msg-header.js';
3
- import type { MsgOperation } from '../msg/msg-operation.js';
4
- import type { MsgOperationResponse } from '../msg/msg-operation-response.js';
5
- export interface MsgOperationDecorator {
6
- (target: Object, propertyKey: string): void;
7
- Header(name: string | RegExp, optionsOrType?: MsgHeader.Options | string | TypeThunkAsync): this;
8
- Response(payloadType: TypeThunkAsync | string, options?: MsgOperationResponse.Options): MsgOperationResponseDecorator;
9
- UseType(...type: Type[]): this;
10
- }
11
- export interface MsgOperationResponseDecorator {
12
- (target: Object, propertyKey: string): void;
13
- Header(name: string | RegExp, optionsOrType?: MsgHeader.Options | string | TypeThunkAsync): this;
14
- }
15
- export interface MsgOperationDecoratorFactory {
16
- /**
17
- * Property decorator
18
- * @param decoratorChain
19
- * @param payloadType
20
- * @param options
21
- */ <T extends MsgOperation.Options>(decoratorChain: Function[], payloadType: ThunkAsync<Type> | string, options?: T): MsgOperationDecorator;
22
- }
23
- export declare namespace MsgOperationDecoratorFactory {
24
- type AugmentationFunction = (decorator: MsgOperationDecorator, decoratorChain: Function[], payloadType: ThunkAsync<Type> | string, options?: MsgOperation.Options) => void;
25
- }
26
- export declare function MsgOperationDecoratorFactory(decoratorChain: Function[], payloadType: ThunkAsync<Type> | string | TypeThunkAsync, options?: MsgOperation.Options): MsgOperationDecorator;
27
- export declare namespace MsgOperationDecoratorFactory {
28
- var augment: (fn: MsgOperationDecoratorFactory.AugmentationFunction) => void;
29
- }
@@ -1,40 +0,0 @@
1
- import type { Type } from 'ts-gems';
2
- import { OpraSchema } from '../../schema/index.js';
3
- import { DocumentInitContext } from '../common/document-init-context.js';
4
- import { MsgApi } from '../msg/msg-api.js';
5
- import { MsgController } from '../msg/msg-controller.js';
6
- import { MsgOperation } from '../msg/msg-operation.js';
7
- import { MsgOperationResponse } from '../msg/msg-operation-response.js';
8
- export declare namespace MsgApiFactory {
9
- interface InitArguments extends MsgApi.InitArguments {
10
- controllers: Type[] | any[] | ((parent: any) => any) | OpraSchema.MsgApi['controllers'];
11
- }
12
- }
13
- /**
14
- * @class MsgApiFactory
15
- */
16
- export declare class MsgApiFactory {
17
- /**
18
- * Generates MsgApi
19
- * @param context
20
- * @param init
21
- */
22
- static createApi(context: DocumentInitContext, init: MsgApiFactory.InitArguments): Promise<MsgApi>;
23
- protected static _createController(context: DocumentInitContext, parent: MsgApi, thunk: Type | object | Function | OpraSchema.MsgController, name?: string): Promise<MsgController | undefined | void>;
24
- /**
25
- * Initializes MsgOperation
26
- * @param context
27
- * @param operation
28
- * @param metadata
29
- * @protected
30
- */
31
- protected static _initMsgOperation(context: DocumentInitContext, operation: MsgOperation, metadata: MsgOperation.Metadata | OpraSchema.MsgOperation): Promise<void>;
32
- /**
33
- * Initializes MsgOperationResponse
34
- * @param context
35
- * @param response
36
- * @param metadata
37
- * @protected
38
- */
39
- protected static _initMsgOperationResponse(context: DocumentInitContext, response: MsgOperationResponse, metadata: MsgOperationResponse.Metadata | OpraSchema.MsgOperationResponse): Promise<void>;
40
- }
@@ -1,27 +0,0 @@
1
- import type { StrictOmit, Type } from 'ts-gems';
2
- import { ResponsiveMap } from '../../helpers/index.js';
3
- import { OpraSchema } from '../../schema/index.js';
4
- import type { ApiDocument } from '../api-document';
5
- import { ApiBase } from '../common/api-base.js';
6
- import { MsgController } from './msg-controller.js';
7
- import { MsgOperation } from './msg-operation.js';
8
- export declare namespace MsgApi {
9
- interface InitArguments extends ApiBase.InitArguments, StrictOmit<OpraSchema.MsgApi, 'controllers'> {
10
- }
11
- }
12
- /**
13
- * @class MsgApi
14
- */
15
- export declare class MsgApi extends ApiBase {
16
- protected _controllerReverseMap: WeakMap<Type, MsgController | null>;
17
- readonly owner: ApiDocument;
18
- readonly transport = "msg";
19
- platform: string;
20
- controllers: ResponsiveMap<MsgController>;
21
- constructor(init: MsgApi.InitArguments);
22
- findController(controller: Type): MsgController | undefined;
23
- findController(name: string): MsgController | undefined;
24
- findOperation(controller: Type, operationName: string): MsgOperation | undefined;
25
- findOperation(controllerName: string, operationName: string): MsgOperation | undefined;
26
- toJSON(): OpraSchema.MsgApi;
27
- }
@@ -1,89 +0,0 @@
1
- import type { Combine, ThunkAsync, Type } from 'ts-gems';
2
- import { ResponsiveMap } from '../../helpers/index.js';
3
- import { OpraSchema } from '../../schema/index.js';
4
- import { DataTypeMap } from '../common/data-type-map.js';
5
- import { DocumentElement } from '../common/document-element.js';
6
- import type { EnumType } from '../data-type/enum-type.js';
7
- import { MsgControllerDecoratorFactory } from '../decorators/msg-controller.decorator.js';
8
- import { nodeInspectCustom } from '../utils/inspect.util.js';
9
- import type { MsgApi } from './msg-api.js';
10
- import type { MsgHeader } from './msg-header.js';
11
- import type { MsgOperation } from './msg-operation.js';
12
- /**
13
- * @namespace MsgController
14
- */
15
- export declare namespace MsgController {
16
- interface Metadata extends Pick<OpraSchema.MsgController, 'description'> {
17
- name: string;
18
- types?: ThunkAsync<Type | EnumType.EnumObject | EnumType.EnumArray>[];
19
- operations?: Record<string, MsgOperation.Metadata>;
20
- headers?: MsgHeader.Metadata[];
21
- onInit?: (resource: MsgController) => void;
22
- onShutdown?: (resource: MsgController) => void | Promise<void>;
23
- }
24
- interface Options extends Partial<Pick<OpraSchema.MsgController, 'description'>> {
25
- name?: string;
26
- }
27
- interface InitArguments extends Combine<{
28
- instance?: object;
29
- ctor?: Type;
30
- }, Pick<Metadata, 'name' | 'description' | 'onInit' | 'onShutdown'>> {
31
- }
32
- }
33
- /**
34
- * Type definition for MsgController
35
- * @class MsgController
36
- */
37
- export interface MsgControllerStatic extends MsgControllerDecoratorFactory {
38
- /**
39
- * Class constructor of MsgController
40
- * @param owner
41
- * @param args
42
- */
43
- new (owner: MsgApi | MsgController, args: MsgController.InitArguments): MsgController;
44
- prototype: MsgController;
45
- OnInit(): PropertyDecorator;
46
- OnShutdown(): PropertyDecorator;
47
- }
48
- /**
49
- * Type definition of MsgController prototype
50
- * @interface MsgController
51
- */
52
- export interface MsgController extends MsgControllerClass {
53
- }
54
- /**
55
- * MsgController
56
- */
57
- export declare const MsgController: MsgControllerStatic;
58
- /**
59
- *
60
- * @class MsgController
61
- */
62
- declare class MsgControllerClass extends DocumentElement {
63
- protected _controllerReverseMap: WeakMap<Type, MsgController | null>;
64
- readonly kind: OpraSchema.MsgController.Kind;
65
- readonly name: string;
66
- description?: string;
67
- path: string;
68
- instance?: any;
69
- ctor?: Type;
70
- headers: MsgHeader[];
71
- operations: ResponsiveMap<MsgOperation>;
72
- types: DataTypeMap;
73
- onInit?: (resource: MsgController) => void;
74
- onShutdown?: (resource: MsgController) => void | Promise<void>;
75
- findHeader(paramName: string, location?: OpraSchema.HttpParameterLocation): MsgHeader | undefined;
76
- /**
77
- *
78
- */
79
- toString(): string;
80
- /**
81
- *
82
- */
83
- toJSON(): OpraSchema.MsgController;
84
- /**
85
- *
86
- */
87
- protected [nodeInspectCustom](): string;
88
- }
89
- export {};
@@ -1,22 +0,0 @@
1
- import type { DataTypeContainer } from '../data-type-container.interface.js';
2
- import type { MsgHeader } from './msg-header.interface.js';
3
- import type { MsgOperation } from './msg-operation.interface.js';
4
- /**
5
- * Message Controller
6
- * @interface MsgController
7
- */
8
- export interface MsgController extends DataTypeContainer {
9
- kind: MsgController.Kind;
10
- description?: string;
11
- operations?: Record<string, MsgOperation>;
12
- headers?: MsgHeader[];
13
- }
14
- /**
15
- *
16
- * @namespace MsgController
17
- */
18
- export declare namespace MsgController {
19
- type Name = string;
20
- const Kind = "MsgController";
21
- type Kind = 'MsgController';
22
- }