@opra/common 1.19.4 → 1.19.7
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 +11 -4
- package/cjs/document/constants.js +3 -1
- package/cjs/document/data-type/enum-type.js +4 -0
- package/cjs/document/decorators/{rpc-controller.decorator.js → mq-controller.decorator.js} +8 -8
- package/cjs/document/decorators/{rpc-operation.decorator.js → mq-operation.decorator.js} +6 -6
- package/cjs/document/decorators/ws-controller.decorator.js +51 -0
- package/cjs/document/decorators/ws-operation.decorator.js +43 -0
- package/cjs/document/factory/api-document.factory.js +3 -3
- package/cjs/document/factory/{rpc-api.factory.js → mq-api.factory.js} +28 -28
- package/cjs/document/factory/ws-api.factory.js +123 -0
- package/cjs/document/index.js +15 -8
- package/cjs/document/{rpc/rpc-api.js → mq/mq-api.js} +5 -5
- package/cjs/document/{rpc/rpc-controller.js → mq/mq-controller.js} +14 -14
- package/cjs/document/{rpc/rpc-header.js → mq/mq-header.js} +5 -5
- package/cjs/document/{rpc/rpc-operation-response.js → mq/mq-operation-response.js} +4 -4
- package/cjs/document/{rpc/rpc-operation.js → mq/mq-operation.js} +10 -10
- package/cjs/document/ws/ws-api.js +52 -0
- package/cjs/document/ws/ws-controller.js +78 -0
- package/cjs/document/ws/ws-operation.js +62 -0
- package/cjs/filter/antlr/OpraFilterLexer.js +361 -211
- package/cjs/filter/antlr/OpraFilterParser.js +174 -92
- package/cjs/schema/http/http-api.interface.js +2 -0
- package/cjs/schema/mq/mq-api.interface.js +2 -0
- package/cjs/schema/mq/mq-controller.interface.js +11 -0
- package/cjs/schema/mq/mq-header.interface.js +2 -0
- package/cjs/schema/mq/mq-operation.interface.js +7 -0
- package/cjs/schema/opra-schema.js +9 -3
- package/cjs/schema/ws/ws-api.interface.js +2 -0
- package/cjs/schema/ws/ws-controller.interface.js +11 -0
- package/cjs/schema/ws/ws-operation.interface.js +7 -0
- package/esm/document/api-document.js +11 -4
- package/esm/document/constants.js +2 -0
- package/esm/document/data-type/enum-type.js +4 -0
- package/esm/document/decorators/{rpc-controller.decorator.js → mq-controller.decorator.js} +8 -8
- package/esm/document/decorators/{rpc-operation.decorator.js → mq-operation.decorator.js} +6 -6
- package/esm/document/decorators/ws-controller.decorator.js +48 -0
- package/esm/document/decorators/ws-operation.decorator.js +40 -0
- package/esm/document/factory/api-document.factory.js +3 -3
- package/esm/document/factory/{rpc-api.factory.js → mq-api.factory.js} +27 -27
- package/esm/document/factory/ws-api.factory.js +119 -0
- package/esm/document/index.js +15 -8
- package/esm/document/{rpc/rpc-api.js → mq/mq-api.js} +3 -3
- package/esm/document/{rpc/rpc-controller.js → mq/mq-controller.js} +13 -13
- package/esm/document/{rpc/rpc-header.js → mq/mq-header.js} +4 -4
- package/esm/document/{rpc/rpc-operation-response.js → mq/mq-operation-response.js} +2 -2
- package/esm/document/{rpc/rpc-operation.js → mq/mq-operation.js} +9 -9
- package/esm/document/ws/ws-api.js +48 -0
- package/esm/document/ws/ws-controller.js +75 -0
- package/esm/document/ws/ws-operation.js +59 -0
- package/esm/filter/antlr/OpraFilterLexer.js +362 -212
- package/esm/filter/antlr/OpraFilterListener.js +1 -1
- package/esm/filter/antlr/OpraFilterParser.js +174 -92
- package/esm/schema/http/http-api.interface.js +1 -0
- package/esm/schema/mq/mq-api.interface.js +1 -0
- package/esm/schema/mq/mq-controller.interface.js +8 -0
- package/esm/schema/mq/mq-header.interface.js +1 -0
- package/esm/schema/mq/mq-operation.interface.js +4 -0
- package/esm/schema/opra-schema.js +9 -3
- package/esm/schema/ws/ws-api.interface.js +1 -0
- package/esm/schema/ws/ws-controller.interface.js +8 -0
- package/esm/schema/ws/ws-operation.interface.js +4 -0
- package/package.json +6 -6
- package/types/document/api-document.d.ts +5 -3
- package/types/document/constants.d.ts +2 -0
- package/types/document/decorators/mq-controller.decorator.d.ts +20 -0
- package/types/document/decorators/mq-operation.decorator.d.ts +32 -0
- package/types/document/decorators/ws-controller.decorator.d.ts +20 -0
- package/types/document/decorators/ws-operation.decorator.d.ts +24 -0
- package/types/document/factory/api-document.factory.d.ts +3 -2
- package/types/document/factory/mq-api.factory.d.ts +40 -0
- package/types/document/factory/ws-api.factory.d.ts +31 -0
- package/types/document/index.d.ts +20 -11
- package/types/document/mq/mq-api.d.ts +27 -0
- package/types/document/mq/mq-controller.d.ts +83 -0
- package/types/document/{rpc/rpc-header.d.ts → mq/mq-header.d.ts} +15 -15
- package/types/document/{rpc/rpc-operation-response.d.ts → mq/mq-operation-response.d.ts} +13 -13
- package/types/document/{rpc/rpc-operation.d.ts → mq/mq-operation.d.ts} +27 -27
- package/types/document/ws/ws-api.d.ts +26 -0
- package/types/document/ws/ws-controller.d.ts +79 -0
- package/types/document/ws/ws-operation.d.ts +70 -0
- package/types/filter/antlr/OpraFilterLexer.d.ts +1 -1
- package/types/filter/antlr/OpraFilterListener.d.ts +28 -28
- package/types/filter/antlr/OpraFilterVisitor.d.ts +27 -27
- package/types/schema/api-document.interface.d.ts +4 -46
- package/types/schema/api.interface.d.ts +13 -0
- package/types/schema/http/http-api.interface.d.ts +12 -0
- package/types/schema/mq/mq-api.interface.d.ts +15 -0
- package/types/schema/mq/mq-controller.interface.d.ts +22 -0
- package/types/schema/{rpc/rpc-header.interface.d.ts → mq/mq-header.interface.d.ts} +2 -2
- package/types/schema/{rpc/rpc-operation.interface.d.ts → mq/mq-operation.interface.d.ts} +11 -11
- package/types/schema/opra-schema.d.ts +9 -3
- package/types/schema/types.d.ts +11 -0
- package/types/schema/ws/ws-api.interface.d.ts +11 -0
- package/types/schema/ws/ws-controller.interface.d.ts +20 -0
- package/types/schema/ws/ws-operation.interface.d.ts +15 -0
- package/cjs/schema/rpc/rpc-controller.interface.js +0 -11
- package/cjs/schema/rpc/rpc-operation.interface.js +0 -7
- package/esm/schema/rpc/rpc-controller.interface.js +0 -8
- package/esm/schema/rpc/rpc-operation.interface.js +0 -4
- package/types/document/decorators/rpc-controller.decorator.d.ts +0 -20
- package/types/document/decorators/rpc-operation.decorator.d.ts +0 -32
- package/types/document/factory/rpc-api.factory.d.ts +0 -40
- package/types/document/rpc/rpc-api.d.ts +0 -27
- package/types/document/rpc/rpc-controller.d.ts +0 -83
- package/types/schema/rpc/rpc-controller.interface.d.ts +0 -22
- /package/cjs/schema/{rpc/rpc-header.interface.js → api.interface.js} +0 -0
- /package/esm/schema/{rpc/rpc-header.interface.js → api.interface.js} +0 -0
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
import { ParseTreeVisitor } from '@browsery/antlr4';
|
|
2
|
-
import type { RootContext } from
|
|
3
|
-
import type { ParenthesizedExpressionContext } from
|
|
4
|
-
import type { NegativeExpressionContext } from
|
|
5
|
-
import type { ComparisonExpressionContext } from
|
|
6
|
-
import type { LogicalExpressionContext } from
|
|
7
|
-
import type { ComparisonLeftContext } from
|
|
8
|
-
import type { ComparisonRightContext } from
|
|
9
|
-
import type { ParenthesizedItemContext } from
|
|
10
|
-
import type { NumberLiteralContext } from
|
|
11
|
-
import type { InfinityLiteralContext } from
|
|
12
|
-
import type { BooleanLiteralContext } from
|
|
13
|
-
import type { NullLiteralContext } from
|
|
14
|
-
import type { DateTimeLiteralContext } from
|
|
15
|
-
import type { DateLiteralContext } from
|
|
16
|
-
import type { TimeLiteralContext } from
|
|
17
|
-
import type { StringLiteralContext } from
|
|
18
|
-
import type { QualifiedIdentifierContext } from
|
|
19
|
-
import type { ExternalConstantContext } from
|
|
20
|
-
import type { IdentifierContext } from
|
|
21
|
-
import type { ArrayValueContext } from
|
|
22
|
-
import type { BooleanContext } from
|
|
23
|
-
import type { NullContext } from
|
|
24
|
-
import type { InfinityContext } from
|
|
25
|
-
import type { ArithmeticOperatorContext } from
|
|
26
|
-
import type { ComparisonOperatorContext } from
|
|
27
|
-
import type { LogicalOperatorContext } from
|
|
28
|
-
import type { PolarityOperatorContext } from
|
|
2
|
+
import type { RootContext } from './OpraFilterParser.js';
|
|
3
|
+
import type { ParenthesizedExpressionContext } from './OpraFilterParser.js';
|
|
4
|
+
import type { NegativeExpressionContext } from './OpraFilterParser.js';
|
|
5
|
+
import type { ComparisonExpressionContext } from './OpraFilterParser.js';
|
|
6
|
+
import type { LogicalExpressionContext } from './OpraFilterParser.js';
|
|
7
|
+
import type { ComparisonLeftContext } from './OpraFilterParser.js';
|
|
8
|
+
import type { ComparisonRightContext } from './OpraFilterParser.js';
|
|
9
|
+
import type { ParenthesizedItemContext } from './OpraFilterParser.js';
|
|
10
|
+
import type { NumberLiteralContext } from './OpraFilterParser.js';
|
|
11
|
+
import type { InfinityLiteralContext } from './OpraFilterParser.js';
|
|
12
|
+
import type { BooleanLiteralContext } from './OpraFilterParser.js';
|
|
13
|
+
import type { NullLiteralContext } from './OpraFilterParser.js';
|
|
14
|
+
import type { DateTimeLiteralContext } from './OpraFilterParser.js';
|
|
15
|
+
import type { DateLiteralContext } from './OpraFilterParser.js';
|
|
16
|
+
import type { TimeLiteralContext } from './OpraFilterParser.js';
|
|
17
|
+
import type { StringLiteralContext } from './OpraFilterParser.js';
|
|
18
|
+
import type { QualifiedIdentifierContext } from './OpraFilterParser.js';
|
|
19
|
+
import type { ExternalConstantContext } from './OpraFilterParser.js';
|
|
20
|
+
import type { IdentifierContext } from './OpraFilterParser.js';
|
|
21
|
+
import type { ArrayValueContext } from './OpraFilterParser.js';
|
|
22
|
+
import type { BooleanContext } from './OpraFilterParser.js';
|
|
23
|
+
import type { NullContext } from './OpraFilterParser.js';
|
|
24
|
+
import type { InfinityContext } from './OpraFilterParser.js';
|
|
25
|
+
import type { ArithmeticOperatorContext } from './OpraFilterParser.js';
|
|
26
|
+
import type { ComparisonOperatorContext } from './OpraFilterParser.js';
|
|
27
|
+
import type { LogicalOperatorContext } from './OpraFilterParser.js';
|
|
28
|
+
import type { PolarityOperatorContext } from './OpraFilterParser.js';
|
|
29
29
|
/**
|
|
30
30
|
* This interface defines a complete generic visitor for a parse tree produced
|
|
31
31
|
* by `OpraFilterParser`.
|
|
@@ -1,16 +1,8 @@
|
|
|
1
1
|
import type { SpecVersion } from './constants.js';
|
|
2
2
|
import type { DataTypeContainer } from './data-type-container.interface.js';
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
|
|
6
|
-
/** Custom **/
|
|
7
|
-
'custom'
|
|
8
|
-
/** HTTP **/
|
|
9
|
-
| 'http'
|
|
10
|
-
/** WebSocket*/
|
|
11
|
-
| 'ws'
|
|
12
|
-
/** Remote Procedure Call (Kafka, RabbitMQ, MQTT etc) */
|
|
13
|
-
| 'rpc';
|
|
3
|
+
import type { HttpApi } from './http/http-api.interface.js';
|
|
4
|
+
import type { MQApi } from './mq/mq-api.interface.js';
|
|
5
|
+
import type { WSApi } from './ws/ws-api.interface.js';
|
|
14
6
|
/**
|
|
15
7
|
* @interface ApiDocument
|
|
16
8
|
*/
|
|
@@ -20,7 +12,7 @@ export interface ApiDocument extends DataTypeContainer {
|
|
|
20
12
|
url?: string;
|
|
21
13
|
info?: DocumentInfo;
|
|
22
14
|
references?: Record<string, DocumentReference>;
|
|
23
|
-
api?: HttpApi |
|
|
15
|
+
api?: HttpApi | MQApi | WSApi;
|
|
24
16
|
}
|
|
25
17
|
/**
|
|
26
18
|
* @interface DocumentInfo
|
|
@@ -54,37 +46,3 @@ export interface LicenseInfo {
|
|
|
54
46
|
*/
|
|
55
47
|
export interface DocumentReference extends Pick<ApiDocument, 'id' | 'url' | 'info'> {
|
|
56
48
|
}
|
|
57
|
-
/**
|
|
58
|
-
* @interface Api
|
|
59
|
-
*/
|
|
60
|
-
export interface Api extends DataTypeContainer {
|
|
61
|
-
transport: Transport;
|
|
62
|
-
/**
|
|
63
|
-
* Name of the api. Should be a computer friendly name
|
|
64
|
-
*/
|
|
65
|
-
name: string;
|
|
66
|
-
description?: string;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* HTTP Api
|
|
70
|
-
* @interface HttpApi
|
|
71
|
-
*/
|
|
72
|
-
export interface HttpApi extends Api {
|
|
73
|
-
transport: 'http';
|
|
74
|
-
description?: string;
|
|
75
|
-
url?: string;
|
|
76
|
-
controllers: Record<string, HttpController>;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Message Api (Kafka, RabbitMQ, MQTT etc)
|
|
80
|
-
* @interface RpcApi
|
|
81
|
-
*/
|
|
82
|
-
export interface RpcApi extends Api {
|
|
83
|
-
transport: 'rpc';
|
|
84
|
-
/**
|
|
85
|
-
* Name of the platform. (Kafka, RabbitMQ, etc.)
|
|
86
|
-
*/
|
|
87
|
-
platform: string;
|
|
88
|
-
description?: string;
|
|
89
|
-
controllers: Record<string, RpcController>;
|
|
90
|
-
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DataTypeContainer } from './data-type-container.interface.js';
|
|
2
|
+
import { Transport } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* @interface Api
|
|
5
|
+
*/
|
|
6
|
+
export interface Api extends DataTypeContainer {
|
|
7
|
+
transport: Transport;
|
|
8
|
+
/**
|
|
9
|
+
* Name of the api. Should be a computer-friendly name
|
|
10
|
+
*/
|
|
11
|
+
name: string;
|
|
12
|
+
description?: string;
|
|
13
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Api } from '../api.interface.js';
|
|
2
|
+
import type { HttpController } from './http-controller.interface.js';
|
|
3
|
+
/**
|
|
4
|
+
* HTTP Api
|
|
5
|
+
* @interface HttpApi
|
|
6
|
+
*/
|
|
7
|
+
export interface HttpApi extends Api {
|
|
8
|
+
transport: 'http';
|
|
9
|
+
description?: string;
|
|
10
|
+
url?: string;
|
|
11
|
+
controllers: Record<string, HttpController>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Api } from '../api.interface.js';
|
|
2
|
+
import type { MQController } from './mq-controller.interface.js';
|
|
3
|
+
/**
|
|
4
|
+
* Message Queue Api
|
|
5
|
+
* @interface MQApi
|
|
6
|
+
*/
|
|
7
|
+
export interface MQApi extends Api {
|
|
8
|
+
transport: 'mq';
|
|
9
|
+
/**
|
|
10
|
+
* Name of the platform. (Kafka, RabbitMQ, etc.)
|
|
11
|
+
*/
|
|
12
|
+
platform: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
controllers: Record<string, MQController>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { DataTypeContainer } from '../data-type-container.interface.js';
|
|
2
|
+
import type { MQHeader } from './mq-header.interface.js';
|
|
3
|
+
import type { MQOperation } from './mq-operation.interface.js';
|
|
4
|
+
/**
|
|
5
|
+
* Message Queue Controller
|
|
6
|
+
* @interface MQController
|
|
7
|
+
*/
|
|
8
|
+
export interface MQController extends DataTypeContainer {
|
|
9
|
+
kind: MQController.Kind;
|
|
10
|
+
description?: string;
|
|
11
|
+
operations?: Record<string, MQOperation>;
|
|
12
|
+
headers?: MQHeader[];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
* @namespace MQController
|
|
17
|
+
*/
|
|
18
|
+
export declare namespace MQController {
|
|
19
|
+
type Name = string;
|
|
20
|
+
const Kind = "MQController";
|
|
21
|
+
type Kind = 'MQController';
|
|
22
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Value } from '../value.interface.js';
|
|
2
2
|
/**
|
|
3
3
|
*
|
|
4
|
-
* @interface
|
|
4
|
+
* @interface MQHeader
|
|
5
5
|
*/
|
|
6
|
-
export interface
|
|
6
|
+
export interface MQHeader extends Value {
|
|
7
7
|
/**
|
|
8
8
|
* Name of the parameter. RegExp pattern can be used matching parameter name
|
|
9
9
|
*/
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import { DataType } from '../data-type/data-type.interface.js';
|
|
2
2
|
import type { DataTypeContainer } from '../data-type-container.interface.js';
|
|
3
|
-
import type {
|
|
3
|
+
import type { MQHeader } from './mq-header.interface.js';
|
|
4
4
|
/**
|
|
5
|
-
* @interface
|
|
5
|
+
* @interface MQOperation
|
|
6
6
|
*/
|
|
7
|
-
export interface
|
|
8
|
-
kind:
|
|
7
|
+
export interface MQOperation extends DataTypeContainer {
|
|
8
|
+
kind: MQOperation.Kind;
|
|
9
9
|
description?: string;
|
|
10
10
|
channel: string | RegExp | (string | RegExp)[];
|
|
11
11
|
payloadType: string | DataType;
|
|
12
12
|
keyType?: string | DataType;
|
|
13
|
-
headers?:
|
|
14
|
-
response?:
|
|
13
|
+
headers?: MQHeader[];
|
|
14
|
+
response?: MQOperationResponse;
|
|
15
15
|
}
|
|
16
|
-
export interface
|
|
16
|
+
export interface MQOperationResponse {
|
|
17
17
|
description?: string;
|
|
18
18
|
channel?: string | RegExp | (string | RegExp)[];
|
|
19
19
|
payloadType: string | DataType;
|
|
20
20
|
keyType?: string | DataType;
|
|
21
|
-
headers?:
|
|
21
|
+
headers?: MQHeader[];
|
|
22
22
|
}
|
|
23
|
-
export declare namespace
|
|
24
|
-
const Kind = "
|
|
25
|
-
type Kind = '
|
|
23
|
+
export declare namespace MQOperation {
|
|
24
|
+
const Kind = "MQOperation";
|
|
25
|
+
type Kind = 'MQOperation';
|
|
26
26
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from './api.interface.js';
|
|
1
2
|
export * from './api-document.interface.js';
|
|
2
3
|
export * from './constants.js';
|
|
3
4
|
export * from './data-type/complex-type.interface.js';
|
|
@@ -9,6 +10,7 @@ export * from './data-type/mixin-type.interface.js';
|
|
|
9
10
|
export * from './data-type/simple-type.interface.js';
|
|
10
11
|
export * from './data-type/union-type.interface.js';
|
|
11
12
|
export * from './data-type-container.interface.js';
|
|
13
|
+
export * from './http/http-api.interface.js';
|
|
12
14
|
export * from './http/http-controller.interface.js';
|
|
13
15
|
export * from './http/http-media-type.interface.js';
|
|
14
16
|
export * from './http/http-multipart-field.interface.js';
|
|
@@ -17,9 +19,13 @@ export * from './http/http-operation-response.interface.js';
|
|
|
17
19
|
export * from './http/http-parameter.interface.js';
|
|
18
20
|
export * from './http/http-request-body.interface.js';
|
|
19
21
|
export * from './http/http-status-range.interface.js';
|
|
20
|
-
export * from './
|
|
21
|
-
export * from './
|
|
22
|
-
export * from './
|
|
22
|
+
export * from './mq/mq-api.interface.js';
|
|
23
|
+
export * from './mq/mq-controller.interface.js';
|
|
24
|
+
export * from './mq/mq-header.interface.js';
|
|
25
|
+
export * from './mq/mq-operation.interface.js';
|
|
23
26
|
export * from './type-guards.js';
|
|
24
27
|
export * from './types.js';
|
|
25
28
|
export * from './value.interface.js';
|
|
29
|
+
export * from './ws/ws-api.interface.js';
|
|
30
|
+
export * from './ws/ws-controller.interface.js';
|
|
31
|
+
export * from './ws/ws-operation.interface.js';
|
package/types/schema/types.d.ts
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
1
|
export type HttpMethod = 'DELETE' | 'GET' | 'HEAD' | 'OPTIONS' | 'POST' | 'PUT' | 'PATCH' | 'SEARCH';
|
|
2
2
|
export type HttpParameterLocation = 'cookie' | 'header' | 'query' | 'path';
|
|
3
3
|
export type HttpMultipartFieldType = 'field' | 'file';
|
|
4
|
+
export type Transport =
|
|
5
|
+
/** Custom **/
|
|
6
|
+
'custom'
|
|
7
|
+
/** HTTP **/
|
|
8
|
+
| 'http'
|
|
9
|
+
/** WebSocket*/
|
|
10
|
+
| 'ws'
|
|
11
|
+
/** Message Queue (Kafka, RabbitMQ, MQTT etc) */
|
|
12
|
+
| 'mq'
|
|
13
|
+
/** Remote Procedure Call (gRPC etc) */
|
|
14
|
+
| 'rpc';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Api } from '../api.interface.js';
|
|
2
|
+
import { WSController } from './ws-controller.interface.js';
|
|
3
|
+
/**
|
|
4
|
+
* WebSocket Api
|
|
5
|
+
* @interface WSApi
|
|
6
|
+
*/
|
|
7
|
+
export interface WSApi extends Api {
|
|
8
|
+
transport: 'ws';
|
|
9
|
+
description?: string;
|
|
10
|
+
controllers: Record<string, WSController>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { DataTypeContainer } from '../data-type-container.interface.js';
|
|
2
|
+
import type { WSOperation } from './ws-operation.interface.js';
|
|
3
|
+
/**
|
|
4
|
+
* WebSocket Controller
|
|
5
|
+
* @interface WSController
|
|
6
|
+
*/
|
|
7
|
+
export interface WSController extends DataTypeContainer {
|
|
8
|
+
kind: WSController.Kind;
|
|
9
|
+
description?: string;
|
|
10
|
+
operations?: Record<string, WSOperation>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @namespace WSController
|
|
15
|
+
*/
|
|
16
|
+
export declare namespace WSController {
|
|
17
|
+
type Name = string;
|
|
18
|
+
const Kind = "WSController";
|
|
19
|
+
type Kind = 'WSController';
|
|
20
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DataType } from '../data-type/data-type.interface.js';
|
|
2
|
+
import type { DataTypeContainer } from '../data-type-container.interface.js';
|
|
3
|
+
/**
|
|
4
|
+
* @interface WSOperation
|
|
5
|
+
*/
|
|
6
|
+
export interface WSOperation extends DataTypeContainer {
|
|
7
|
+
kind: WSOperation.Kind;
|
|
8
|
+
description?: string;
|
|
9
|
+
channel: string | RegExp | (string | RegExp)[];
|
|
10
|
+
payloadType: string | DataType;
|
|
11
|
+
}
|
|
12
|
+
export declare namespace WSOperation {
|
|
13
|
+
const Kind = "WSOperation";
|
|
14
|
+
type Kind = 'WSOperation';
|
|
15
|
+
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RpcController = void 0;
|
|
4
|
-
/**
|
|
5
|
-
*
|
|
6
|
-
* @namespace RpcController
|
|
7
|
-
*/
|
|
8
|
-
var RpcController;
|
|
9
|
-
(function (RpcController) {
|
|
10
|
-
RpcController.Kind = 'RpcController';
|
|
11
|
-
})(RpcController || (exports.RpcController = RpcController = {}));
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { TypeThunkAsync } from 'ts-gems';
|
|
2
|
-
import type { RpcController } from '../rpc/rpc-controller';
|
|
3
|
-
import type { RpcHeader } from '../rpc/rpc-header';
|
|
4
|
-
export interface RpcControllerDecorator<T extends RpcControllerDecorator<any> = RpcControllerDecorator<any>> extends ClassDecorator {
|
|
5
|
-
Header(name: string | RegExp, optionsOrType?: RpcHeader.Options | string | TypeThunkAsync | false): T;
|
|
6
|
-
UseType(...type: TypeThunkAsync[]): T;
|
|
7
|
-
}
|
|
8
|
-
export interface RpcControllerDecoratorFactory {
|
|
9
|
-
<T extends RpcController.Options>(options?: T): RpcControllerDecorator;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* @namespace RpcControllerDecoratorFactory
|
|
13
|
-
*/
|
|
14
|
-
export declare namespace RpcControllerDecoratorFactory {
|
|
15
|
-
type AugmentationFunction = (decorator: RpcControllerDecorator, decoratorChain: Function[], options?: RpcController.Options) => void;
|
|
16
|
-
}
|
|
17
|
-
export declare function RpcControllerDecoratorFactory<O extends RpcController.Options>(options?: O): RpcControllerDecorator;
|
|
18
|
-
export declare namespace RpcControllerDecoratorFactory {
|
|
19
|
-
var augment: (fn: RpcControllerDecoratorFactory.AugmentationFunction) => void;
|
|
20
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { ThunkAsync, Type, TypeThunkAsync } from 'ts-gems';
|
|
2
|
-
import type { RpcHeader } from '../rpc/rpc-header';
|
|
3
|
-
import type { RpcOperation } from '../rpc/rpc-operation';
|
|
4
|
-
import type { RpcOperationResponse } from '../rpc/rpc-operation-response';
|
|
5
|
-
export interface RpcOperationDecorator {
|
|
6
|
-
(target: Object, propertyKey: string): void;
|
|
7
|
-
Header(name: string | RegExp, optionsOrType?: RpcHeader.Options | string | TypeThunkAsync): this;
|
|
8
|
-
Response(payloadType: TypeThunkAsync | string, options?: RpcOperationResponse.Options): RpcOperationResponseDecorator;
|
|
9
|
-
UseType(...type: Type[]): this;
|
|
10
|
-
}
|
|
11
|
-
export interface RpcOperationResponseDecorator {
|
|
12
|
-
(target: Object, propertyKey: string): void;
|
|
13
|
-
Header(name: string | RegExp, optionsOrType?: RpcHeader.Options | string | TypeThunkAsync): this;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* @namespace RpcOperationDecoratorFactory
|
|
17
|
-
*/
|
|
18
|
-
export interface RpcOperationDecoratorFactory {
|
|
19
|
-
/**
|
|
20
|
-
* Property decorator
|
|
21
|
-
* @param decoratorChain
|
|
22
|
-
* @param payloadType
|
|
23
|
-
* @param options
|
|
24
|
-
*/ <T extends RpcOperation.Options>(decoratorChain: Function[], payloadType: ThunkAsync<Type> | string, options?: T): RpcOperationDecorator;
|
|
25
|
-
}
|
|
26
|
-
export declare namespace RpcOperationDecoratorFactory {
|
|
27
|
-
type AugmentationFunction = (decorator: RpcOperationDecorator, decoratorChain: Function[], payloadType: ThunkAsync<Type> | string, options?: RpcOperation.Options) => void;
|
|
28
|
-
}
|
|
29
|
-
export declare function RpcOperationDecoratorFactory(decoratorChain: Function[], payloadType: ThunkAsync<Type> | string | TypeThunkAsync, options?: RpcOperation.Options): RpcOperationDecorator;
|
|
30
|
-
export declare namespace RpcOperationDecoratorFactory {
|
|
31
|
-
var augment: (fn: RpcOperationDecoratorFactory.AugmentationFunction) => void;
|
|
32
|
-
}
|
|
@@ -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 { RpcApi } from '../rpc/rpc-api.js';
|
|
5
|
-
import { RpcController } from '../rpc/rpc-controller.js';
|
|
6
|
-
import { RpcOperation } from '../rpc/rpc-operation.js';
|
|
7
|
-
import { RpcOperationResponse } from '../rpc/rpc-operation-response.js';
|
|
8
|
-
export declare namespace RpcApiFactory {
|
|
9
|
-
interface InitArguments extends RpcApi.InitArguments {
|
|
10
|
-
controllers: Type[] | any[] | ((parent: any) => any) | OpraSchema.RpcApi['controllers'];
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* @class RpcApiFactory
|
|
15
|
-
*/
|
|
16
|
-
export declare class RpcApiFactory {
|
|
17
|
-
/**
|
|
18
|
-
* Generates RpcApi
|
|
19
|
-
* @param context
|
|
20
|
-
* @param init
|
|
21
|
-
*/
|
|
22
|
-
static createApi(context: DocumentInitContext, init: RpcApiFactory.InitArguments): Promise<RpcApi>;
|
|
23
|
-
protected static _createController(context: DocumentInitContext, parent: RpcApi, thunk: Type | object | Function | OpraSchema.RpcController, name?: string): Promise<RpcController | undefined | void>;
|
|
24
|
-
/**
|
|
25
|
-
* Initializes RpcOperation
|
|
26
|
-
* @param context
|
|
27
|
-
* @param operation
|
|
28
|
-
* @param metadata
|
|
29
|
-
* @protected
|
|
30
|
-
*/
|
|
31
|
-
protected static _initRpcOperation(context: DocumentInitContext, operation: RpcOperation, metadata: RpcOperation.Metadata | OpraSchema.RpcOperation): Promise<void>;
|
|
32
|
-
/**
|
|
33
|
-
* Initializes RpcOperationResponse
|
|
34
|
-
* @param context
|
|
35
|
-
* @param response
|
|
36
|
-
* @param metadata
|
|
37
|
-
* @protected
|
|
38
|
-
*/
|
|
39
|
-
protected static _initRpcOperationResponse(context: DocumentInitContext, response: RpcOperationResponse, metadata: RpcOperationResponse.Metadata | OpraSchema.RpcOperationResponse): 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 { RpcController } from './rpc-controller.js';
|
|
7
|
-
import { RpcOperation } from './rpc-operation.js';
|
|
8
|
-
export declare namespace RpcApi {
|
|
9
|
-
interface InitArguments extends ApiBase.InitArguments, StrictOmit<OpraSchema.RpcApi, 'controllers'> {
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* @class RpcApi
|
|
14
|
-
*/
|
|
15
|
-
export declare class RpcApi extends ApiBase {
|
|
16
|
-
protected _controllerReverseMap: WeakMap<Type, RpcController | null>;
|
|
17
|
-
readonly owner: ApiDocument;
|
|
18
|
-
readonly transport = "rpc";
|
|
19
|
-
platform: string;
|
|
20
|
-
controllers: ResponsiveMap<RpcController>;
|
|
21
|
-
constructor(init: RpcApi.InitArguments);
|
|
22
|
-
findController(controller: Type): RpcController | undefined;
|
|
23
|
-
findController(name: string): RpcController | undefined;
|
|
24
|
-
findOperation(controller: Type, operationName: string): RpcOperation | undefined;
|
|
25
|
-
findOperation(controllerName: string, operationName: string): RpcOperation | undefined;
|
|
26
|
-
toJSON(): OpraSchema.RpcApi;
|
|
27
|
-
}
|
|
@@ -1,83 +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 { RpcControllerDecoratorFactory } from '../decorators/rpc-controller.decorator.js';
|
|
8
|
-
import { nodeInspectCustom } from '../utils/inspect.util.js';
|
|
9
|
-
import type { RpcApi } from './rpc-api';
|
|
10
|
-
import type { RpcHeader } from './rpc-header.js';
|
|
11
|
-
import type { RpcOperation } from './rpc-operation';
|
|
12
|
-
/**
|
|
13
|
-
* @namespace RpcController
|
|
14
|
-
*/
|
|
15
|
-
export declare namespace RpcController {
|
|
16
|
-
interface Metadata extends Pick<OpraSchema.RpcController, 'description'> {
|
|
17
|
-
name: string;
|
|
18
|
-
types?: ThunkAsync<Type | EnumType.EnumObject | EnumType.EnumArray>[];
|
|
19
|
-
operations?: Record<string, RpcOperation.Metadata>;
|
|
20
|
-
headers?: RpcHeader.Metadata[];
|
|
21
|
-
}
|
|
22
|
-
interface Options extends Partial<Pick<OpraSchema.RpcController, 'description'>> {
|
|
23
|
-
name?: string;
|
|
24
|
-
}
|
|
25
|
-
interface InitArguments extends Combine<{
|
|
26
|
-
instance?: object;
|
|
27
|
-
ctor?: Type;
|
|
28
|
-
}, Pick<Metadata, 'name' | 'description'>> {
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Type definition for RpcController
|
|
33
|
-
* @class RpcController
|
|
34
|
-
*/
|
|
35
|
-
export interface RpcControllerStatic extends RpcControllerDecoratorFactory {
|
|
36
|
-
/**
|
|
37
|
-
* Class constructor of RpcController
|
|
38
|
-
* @param owner
|
|
39
|
-
* @param args
|
|
40
|
-
*/
|
|
41
|
-
new (owner: RpcApi | RpcController, args: RpcController.InitArguments): RpcController;
|
|
42
|
-
prototype: RpcController;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Type definition of RpcController prototype
|
|
46
|
-
* @interface RpcController
|
|
47
|
-
*/
|
|
48
|
-
export interface RpcController extends RpcControllerClass {
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* RpcController
|
|
52
|
-
*/
|
|
53
|
-
export declare const RpcController: RpcControllerStatic;
|
|
54
|
-
/**
|
|
55
|
-
*
|
|
56
|
-
* @class RpcController
|
|
57
|
-
*/
|
|
58
|
-
declare class RpcControllerClass extends DocumentElement {
|
|
59
|
-
protected _controllerReverseMap: WeakMap<Type, RpcController | null>;
|
|
60
|
-
readonly kind: OpraSchema.RpcController.Kind;
|
|
61
|
-
readonly name: string;
|
|
62
|
-
description?: string;
|
|
63
|
-
path: string;
|
|
64
|
-
instance?: any;
|
|
65
|
-
ctor?: Type;
|
|
66
|
-
headers: RpcHeader[];
|
|
67
|
-
operations: ResponsiveMap<RpcOperation>;
|
|
68
|
-
types: DataTypeMap;
|
|
69
|
-
findHeader(paramName: string, location?: OpraSchema.HttpParameterLocation): RpcHeader | undefined;
|
|
70
|
-
/**
|
|
71
|
-
*
|
|
72
|
-
*/
|
|
73
|
-
toString(): string;
|
|
74
|
-
/**
|
|
75
|
-
*
|
|
76
|
-
*/
|
|
77
|
-
toJSON(): OpraSchema.RpcController;
|
|
78
|
-
/**
|
|
79
|
-
*
|
|
80
|
-
*/
|
|
81
|
-
protected [nodeInspectCustom](): string;
|
|
82
|
-
}
|
|
83
|
-
export {};
|
|
@@ -1,22 +0,0 @@
|
|
|
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
|
-
}
|
|
File without changes
|
|
File without changes
|