@opra/common 1.0.0-beta.2 → 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.
- 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/rpc-controller.decorator.js +69 -0
- package/cjs/document/decorators/rpc-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/rpc-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/http/http-operation.js +6 -0
- package/cjs/document/index.js +8 -0
- package/cjs/document/rpc/rpc-api.js +54 -0
- package/cjs/document/rpc/rpc-controller.js +116 -0
- package/cjs/document/rpc/rpc-header.js +40 -0
- package/cjs/document/rpc/rpc-operation-response.js +58 -0
- package/cjs/document/rpc/rpc-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/opra-schema.js +3 -0
- package/cjs/schema/rpc/rpc-controller.interface.js +11 -0
- package/cjs/schema/rpc/rpc-header.interface.js +2 -0
- package/cjs/schema/rpc/rpc-operation.interface.js +7 -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/rpc-controller.decorator.js +65 -0
- package/esm/document/decorators/rpc-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/rpc-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/http/http-operation.js +6 -0
- package/esm/document/index.js +8 -0
- package/esm/document/rpc/rpc-api.js +50 -0
- package/esm/document/rpc/rpc-controller.js +113 -0
- package/esm/document/rpc/rpc-header.js +37 -0
- package/esm/document/rpc/rpc-operation-response.js +54 -0
- package/esm/document/rpc/rpc-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/opra-schema.js +3 -0
- package/esm/schema/rpc/rpc-controller.interface.js +8 -0
- package/esm/schema/rpc/rpc-header.interface.js +1 -0
- package/esm/schema/rpc/rpc-operation.interface.js +4 -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/rpc-controller.decorator.d.ts +20 -0
- package/types/document/decorators/rpc-operation.decorator.d.ts +32 -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/rpc-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 +11 -0
- package/types/document/rpc/rpc-api.d.ts +27 -0
- package/types/document/rpc/rpc-controller.d.ts +89 -0
- package/types/document/rpc/rpc-header.d.ts +47 -0
- package/types/document/rpc/rpc-operation-response.d.ts +41 -0
- package/types/document/rpc/rpc-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 +25 -4
- package/types/schema/opra-schema.d.ts +3 -0
- package/types/schema/rpc/rpc-controller.interface.d.ts +22 -0
- package/types/schema/rpc/rpc-header.interface.d.ts +19 -0
- package/types/schema/rpc/rpc-operation.interface.d.ts +26 -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
package/types/index.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export * from './document/index.js';
|
|
2
|
+
export * from './enums/index.js';
|
|
2
3
|
export * from './exception/index.js';
|
|
3
4
|
export * from './filter/index.js';
|
|
4
5
|
export * from './helpers/index.js';
|
|
5
|
-
export * from './http/index.js';
|
|
6
6
|
export * from './i18n/index.js';
|
|
7
7
|
export * from './schema/index.js';
|
|
8
8
|
export * from './types.js';
|
package/types/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export * from './document/index.js';
|
|
2
|
+
export * from './enums/index.js';
|
|
2
3
|
export * from './exception/index.js';
|
|
3
4
|
export * from './filter/index.js';
|
|
4
5
|
export * from './helpers/index.js';
|
|
5
|
-
export * from './http/index.js';
|
|
6
6
|
export * from './i18n/index.js';
|
|
7
7
|
export * from './schema/index.js';
|
|
8
8
|
export * from './types.js';
|
|
@@ -1,7 +1,14 @@
|
|
|
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 { RpcController } from './rpc/rpc-controller.interface.js';
|
|
5
|
+
export type Transport =
|
|
6
|
+
/** HTTP **/
|
|
7
|
+
'http'
|
|
8
|
+
/** WebSocket*/
|
|
9
|
+
| 'ws'
|
|
10
|
+
/** Remote Procedure Call (Kafka, RabbitMQ, MQTT etc) */
|
|
11
|
+
| 'rpc';
|
|
5
12
|
/**
|
|
6
13
|
* @interface ApiDocument
|
|
7
14
|
*/
|
|
@@ -11,7 +18,7 @@ export interface ApiDocument extends DataTypeContainer {
|
|
|
11
18
|
url?: string;
|
|
12
19
|
info?: DocumentInfo;
|
|
13
20
|
references?: Record<string, DocumentReference>;
|
|
14
|
-
api?: HttpApi;
|
|
21
|
+
api?: HttpApi | RpcApi;
|
|
15
22
|
}
|
|
16
23
|
/**
|
|
17
24
|
* @interface DocumentInfo
|
|
@@ -49,7 +56,7 @@ export interface DocumentReference extends Pick<ApiDocument, 'id' | 'url' | 'inf
|
|
|
49
56
|
* @interface Api
|
|
50
57
|
*/
|
|
51
58
|
export interface Api extends DataTypeContainer {
|
|
52
|
-
|
|
59
|
+
transport: Transport;
|
|
53
60
|
/**
|
|
54
61
|
* Name of the api. Should be a computer friendly name
|
|
55
62
|
*/
|
|
@@ -57,11 +64,25 @@ export interface Api extends DataTypeContainer {
|
|
|
57
64
|
description?: string;
|
|
58
65
|
}
|
|
59
66
|
/**
|
|
67
|
+
* HTTP Api
|
|
60
68
|
* @interface HttpApi
|
|
61
69
|
*/
|
|
62
70
|
export interface HttpApi extends Api {
|
|
63
|
-
|
|
71
|
+
transport: 'http';
|
|
64
72
|
description?: string;
|
|
65
73
|
url?: string;
|
|
66
74
|
controllers: Record<string, HttpController>;
|
|
67
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* Message Api (Kafka, RabbitMQ, MQTT etc)
|
|
78
|
+
* @interface RpcApi
|
|
79
|
+
*/
|
|
80
|
+
export interface RpcApi extends Api {
|
|
81
|
+
transport: 'rpc';
|
|
82
|
+
/**
|
|
83
|
+
* Name of the platform. (Kafka, RabbitMQ, etc.)
|
|
84
|
+
*/
|
|
85
|
+
platform: string;
|
|
86
|
+
description?: string;
|
|
87
|
+
controllers: Record<string, RpcController>;
|
|
88
|
+
}
|
|
@@ -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 './rpc/rpc-controller.interface.js';
|
|
20
|
+
export * from './rpc/rpc-header.interface.js';
|
|
21
|
+
export * from './rpc/rpc-operation.interface.js';
|
|
19
22
|
export * from './type-guards.js';
|
|
20
23
|
export * from './types.js';
|
|
21
24
|
export * from './value.interface.js';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { DataTypeContainer } from '../data-type-container.interface.js';
|
|
2
|
+
import type { RpcHeader } from './rpc-header.interface.js';
|
|
3
|
+
import type { RpcOperation } from './rpc-operation.interface.js';
|
|
4
|
+
/**
|
|
5
|
+
* RPC Controller
|
|
6
|
+
* @interface RpcController
|
|
7
|
+
*/
|
|
8
|
+
export interface RpcController extends DataTypeContainer {
|
|
9
|
+
kind: RpcController.Kind;
|
|
10
|
+
description?: string;
|
|
11
|
+
operations?: Record<string, RpcOperation>;
|
|
12
|
+
headers?: RpcHeader[];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
* @namespace RpcController
|
|
17
|
+
*/
|
|
18
|
+
export declare namespace RpcController {
|
|
19
|
+
type Name = string;
|
|
20
|
+
const Kind = "RpcController";
|
|
21
|
+
type Kind = 'RpcController';
|
|
22
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Value } from '../value.interface.js';
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @interface RpcHeader
|
|
5
|
+
*/
|
|
6
|
+
export interface RpcHeader 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 { RpcHeader } from './rpc-header.interface.js';
|
|
4
|
+
/**
|
|
5
|
+
* @interface RpcOperation
|
|
6
|
+
*/
|
|
7
|
+
export interface RpcOperation extends DataTypeContainer {
|
|
8
|
+
kind: RpcOperation.Kind;
|
|
9
|
+
description?: string;
|
|
10
|
+
channel: string | RegExp | (string | RegExp)[];
|
|
11
|
+
payloadType: string | DataType;
|
|
12
|
+
keyType?: string | DataType;
|
|
13
|
+
headers?: RpcHeader[];
|
|
14
|
+
response?: RpcOperationResponse;
|
|
15
|
+
}
|
|
16
|
+
export interface RpcOperationResponse {
|
|
17
|
+
description?: string;
|
|
18
|
+
channel?: string | RegExp | (string | RegExp)[];
|
|
19
|
+
payloadType: string | DataType;
|
|
20
|
+
keyType?: string | DataType;
|
|
21
|
+
headers?: RpcHeader[];
|
|
22
|
+
}
|
|
23
|
+
export declare namespace RpcOperation {
|
|
24
|
+
const Kind = "RpcOperation";
|
|
25
|
+
type Kind = 'RpcOperation';
|
|
26
|
+
}
|
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
|