@opra/common 1.0.0-beta.2 → 1.0.0-beta.3
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/browser/index.cjs +5 -5
- package/browser/index.mjs +5 -5
- package/cjs/document/api-document.js +14 -0
- package/cjs/document/common/api-base.js +5 -3
- package/cjs/document/common/document-node.js +6 -2
- package/cjs/document/constants.js +2 -1
- package/cjs/document/decorators/http-controller.decorator.js +1 -1
- package/cjs/document/decorators/http-operation-entity.decorator.js +1 -1
- package/cjs/document/decorators/http-operation.decorator.js +5 -5
- package/cjs/document/decorators/msg-controller.decorator.js +64 -0
- package/cjs/document/decorators/msg-operation.decorator.js +80 -0
- package/cjs/document/factory/api-document.factory.js +9 -3
- package/cjs/document/factory/data-type.factory.js +20 -0
- package/cjs/document/factory/http-api.factory.js +50 -77
- package/cjs/document/factory/msg-api.factory.js +202 -0
- package/cjs/document/http/http-api.js +5 -4
- package/cjs/document/http/http-controller.js +16 -0
- package/cjs/document/index.js +6 -0
- package/cjs/document/msg/msg-api.js +54 -0
- package/cjs/document/msg/msg-controller.js +116 -0
- package/cjs/document/msg/msg-header.js +40 -0
- package/cjs/document/msg/msg-operation-response.js +58 -0
- package/cjs/document/msg/msg-operation.js +80 -0
- package/cjs/enums/index.js +7 -0
- package/cjs/exception/http-errors/forbidden.error.js +1 -1
- package/cjs/exception/http-errors/resource-not.available.error.js +1 -1
- package/cjs/index.js +1 -1
- package/cjs/schema/msg/msg-controller.interface.js +11 -0
- package/cjs/schema/msg/msg-header.interface.js +2 -0
- package/cjs/schema/msg/msg-operation.interface.js +7 -0
- package/cjs/schema/opra-schema.js +3 -0
- package/esm/document/api-document.js +14 -0
- package/esm/document/common/api-base.js +5 -3
- package/esm/document/common/document-node.js +6 -2
- package/esm/document/constants.js +1 -0
- package/esm/document/decorators/http-controller.decorator.js +1 -1
- package/esm/document/decorators/http-operation-entity.decorator.js +1 -1
- package/esm/document/decorators/http-operation.decorator.js +5 -5
- package/esm/document/decorators/msg-controller.decorator.js +60 -0
- package/esm/document/decorators/msg-operation.decorator.js +76 -0
- package/esm/document/factory/api-document.factory.js +9 -3
- package/esm/document/factory/data-type.factory.js +20 -0
- package/esm/document/factory/http-api.factory.js +50 -77
- package/esm/document/factory/msg-api.factory.js +198 -0
- package/esm/document/http/http-api.js +5 -4
- package/esm/document/http/http-controller.js +17 -1
- package/esm/document/index.js +6 -0
- package/esm/document/msg/msg-api.js +50 -0
- package/esm/document/msg/msg-controller.js +113 -0
- package/esm/document/msg/msg-header.js +37 -0
- package/esm/document/msg/msg-operation-response.js +54 -0
- package/esm/document/msg/msg-operation.js +77 -0
- package/esm/enums/index.js +4 -0
- package/esm/exception/http-errors/forbidden.error.js +1 -1
- package/esm/exception/http-errors/resource-not.available.error.js +1 -1
- package/esm/index.js +1 -1
- package/esm/schema/msg/msg-controller.interface.js +8 -0
- package/esm/schema/msg/msg-header.interface.js +1 -0
- package/esm/schema/msg/msg-operation.interface.js +4 -0
- package/esm/schema/opra-schema.js +3 -0
- package/package.json +2 -2
- package/types/document/api-document.d.ts +5 -2
- package/types/document/common/api-base.d.ts +3 -2
- package/types/document/constants.d.ts +1 -0
- package/types/document/decorators/http-operation.decorator.d.ts +3 -3
- package/types/document/decorators/msg-controller.decorator.d.ts +11 -0
- package/types/document/decorators/msg-operation.decorator.d.ts +29 -0
- package/types/document/factory/api-document.factory.d.ts +2 -1
- package/types/document/factory/data-type.factory.d.ts +1 -0
- package/types/document/factory/http-api.factory.d.ts +10 -6
- package/types/document/factory/msg-api.factory.d.ts +40 -0
- package/types/document/http/http-api.d.ts +8 -3
- package/types/document/http/http-controller.d.ts +8 -2
- package/types/document/index.d.ts +8 -0
- package/types/document/msg/msg-api.d.ts +27 -0
- package/types/document/msg/msg-controller.d.ts +89 -0
- package/types/document/msg/msg-header.d.ts +47 -0
- package/types/document/msg/msg-operation-response.d.ts +41 -0
- package/types/document/msg/msg-operation.d.ts +77 -0
- package/types/enums/index.d.ts +4 -0
- package/types/exception/http-errors/forbidden.error.d.ts +1 -1
- package/types/index.d.cts +1 -1
- package/types/index.d.ts +1 -1
- package/types/schema/api-document.interface.d.ts +27 -4
- package/types/schema/msg/msg-controller.interface.d.ts +22 -0
- package/types/schema/msg/msg-header.interface.d.ts +19 -0
- package/types/schema/msg/msg-operation.interface.d.ts +26 -0
- package/types/schema/opra-schema.d.ts +3 -0
- package/cjs/http/index.js +0 -7
- package/esm/http/index.js +0 -4
- package/types/http/index.d.ts +0 -4
- /package/cjs/{http/enums → enums}/http-headers-codes.enum.js +0 -0
- /package/cjs/{http/enums → enums}/http-status-codes.enum.js +0 -0
- /package/cjs/{http/enums → enums}/http-status-messages.js +0 -0
- /package/cjs/{http/enums → enums}/mime-types.enum.js +0 -0
- /package/esm/{http/enums → enums}/http-headers-codes.enum.js +0 -0
- /package/esm/{http/enums → enums}/http-status-codes.enum.js +0 -0
- /package/esm/{http/enums → enums}/http-status-messages.js +0 -0
- /package/esm/{http/enums → enums}/mime-types.enum.js +0 -0
- /package/types/{http/enums → enums}/http-headers-codes.enum.d.ts +0 -0
- /package/types/{http/enums → enums}/http-status-codes.enum.d.ts +0 -0
- /package/types/{http/enums → enums}/http-status-messages.d.ts +0 -0
- /package/types/{http/enums → enums}/mime-types.enum.d.ts +0 -0
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
import type { SpecVersion } from './constants.js';
|
|
2
2
|
import type { DataTypeContainer } from './data-type-container.interface.js';
|
|
3
3
|
import type { HttpController } from './http/http-controller.interface.js';
|
|
4
|
-
|
|
4
|
+
import type { MsgController } from './msg/msg-controller.interface.js';
|
|
5
|
+
export type Transport =
|
|
6
|
+
/** HTTP **/
|
|
7
|
+
'http'
|
|
8
|
+
/** WebSocket*/
|
|
9
|
+
| 'ws'
|
|
10
|
+
/** Remote Procedure Call */
|
|
11
|
+
| 'rpc'
|
|
12
|
+
/** Message (Kafka, RabbitMQ, MQTT etc) */
|
|
13
|
+
| 'msg';
|
|
5
14
|
/**
|
|
6
15
|
* @interface ApiDocument
|
|
7
16
|
*/
|
|
@@ -11,7 +20,7 @@ export interface ApiDocument extends DataTypeContainer {
|
|
|
11
20
|
url?: string;
|
|
12
21
|
info?: DocumentInfo;
|
|
13
22
|
references?: Record<string, DocumentReference>;
|
|
14
|
-
api?: HttpApi;
|
|
23
|
+
api?: HttpApi | MsgApi;
|
|
15
24
|
}
|
|
16
25
|
/**
|
|
17
26
|
* @interface DocumentInfo
|
|
@@ -49,7 +58,7 @@ export interface DocumentReference extends Pick<ApiDocument, 'id' | 'url' | 'inf
|
|
|
49
58
|
* @interface Api
|
|
50
59
|
*/
|
|
51
60
|
export interface Api extends DataTypeContainer {
|
|
52
|
-
|
|
61
|
+
transport: Transport;
|
|
53
62
|
/**
|
|
54
63
|
* Name of the api. Should be a computer friendly name
|
|
55
64
|
*/
|
|
@@ -57,11 +66,25 @@ export interface Api extends DataTypeContainer {
|
|
|
57
66
|
description?: string;
|
|
58
67
|
}
|
|
59
68
|
/**
|
|
69
|
+
* HTTP Api
|
|
60
70
|
* @interface HttpApi
|
|
61
71
|
*/
|
|
62
72
|
export interface HttpApi extends Api {
|
|
63
|
-
|
|
73
|
+
transport: 'http';
|
|
64
74
|
description?: string;
|
|
65
75
|
url?: string;
|
|
66
76
|
controllers: Record<string, HttpController>;
|
|
67
77
|
}
|
|
78
|
+
/**
|
|
79
|
+
* Message Api (Kafka, RabbitMQ, MQTT etc)
|
|
80
|
+
* @interface MsgApi
|
|
81
|
+
*/
|
|
82
|
+
export interface MsgApi extends Api {
|
|
83
|
+
transport: 'msg';
|
|
84
|
+
/**
|
|
85
|
+
* Name of the message platform. (Kafka, RabbitMQ, etc.)
|
|
86
|
+
*/
|
|
87
|
+
platform: string;
|
|
88
|
+
description?: string;
|
|
89
|
+
controllers: Record<string, MsgController>;
|
|
90
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Value } from '../value.interface.js';
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @interface MsgHeader
|
|
5
|
+
*/
|
|
6
|
+
export interface MsgHeader extends Value {
|
|
7
|
+
/**
|
|
8
|
+
* Name of the parameter. RegExp pattern can be used matching parameter name
|
|
9
|
+
*/
|
|
10
|
+
name: string | RegExp;
|
|
11
|
+
/**
|
|
12
|
+
* Indicates if parameter value required
|
|
13
|
+
*/
|
|
14
|
+
required?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Indicates if the parameter is deprecated and can be removed in the next
|
|
17
|
+
*/
|
|
18
|
+
deprecated?: boolean | string;
|
|
19
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { DataType } from '../data-type/data-type.interface.js';
|
|
2
|
+
import type { DataTypeContainer } from '../data-type-container.interface.js';
|
|
3
|
+
import type { MsgHeader } from './msg-header.interface.js';
|
|
4
|
+
/**
|
|
5
|
+
* @interface MsgOperation
|
|
6
|
+
*/
|
|
7
|
+
export interface MsgOperation extends DataTypeContainer {
|
|
8
|
+
kind: MsgOperation.Kind;
|
|
9
|
+
description?: string;
|
|
10
|
+
channel: string | RegExp | (string | RegExp)[];
|
|
11
|
+
payloadType: string | DataType;
|
|
12
|
+
keyType?: string | DataType;
|
|
13
|
+
headers?: MsgHeader[];
|
|
14
|
+
response?: MsgOperationResponse;
|
|
15
|
+
}
|
|
16
|
+
export interface MsgOperationResponse {
|
|
17
|
+
description?: string;
|
|
18
|
+
channel?: string | RegExp | (string | RegExp)[];
|
|
19
|
+
payloadType: string | DataType;
|
|
20
|
+
keyType?: string | DataType;
|
|
21
|
+
headers?: MsgHeader[];
|
|
22
|
+
}
|
|
23
|
+
export declare namespace MsgOperation {
|
|
24
|
+
const Kind = "MsgOperation";
|
|
25
|
+
type Kind = 'MsgOperation';
|
|
26
|
+
}
|
|
@@ -16,6 +16,9 @@ export * from './http/http-operation-response.interface.js';
|
|
|
16
16
|
export * from './http/http-parameter.interface.js';
|
|
17
17
|
export * from './http/http-request-body.interface.js';
|
|
18
18
|
export * from './http/http-status-range.interface.js';
|
|
19
|
+
export * from './msg/msg-controller.interface.js';
|
|
20
|
+
export * from './msg/msg-header.interface.js';
|
|
21
|
+
export * from './msg/msg-operation.interface.js';
|
|
19
22
|
export * from './type-guards.js';
|
|
20
23
|
export * from './types.js';
|
|
21
24
|
export * from './value.interface.js';
|
package/cjs/http/index.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
tslib_1.__exportStar(require("./enums/http-headers-codes.enum.js"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./enums/http-status-codes.enum.js"), exports);
|
|
6
|
-
tslib_1.__exportStar(require("./enums/http-status-messages.js"), exports);
|
|
7
|
-
tslib_1.__exportStar(require("./enums/mime-types.enum.js"), exports);
|
package/esm/http/index.js
DELETED
package/types/http/index.d.ts
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|