@opra/core 0.26.1 → 0.26.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/cjs/execution-context.host.js +0 -1
- package/cjs/http/http-adapter-host.js +1 -1
- package/cjs/platform-adapter.host.js +1 -1
- package/cjs/request-context.js +0 -1
- package/esm/execution-context.host.js +0 -1
- package/esm/http/http-adapter-host.js +1 -1
- package/esm/platform-adapter.host.js +1 -1
- package/esm/request-context.js +0 -1
- package/package.json +2 -2
- package/types/augmentation/collection.augmentation.d.ts +8 -8
- package/types/augmentation/container.augmentation.d.ts +1 -1
- package/types/augmentation/resource.augmentation.d.ts +1 -1
- package/types/augmentation/singleton.augmentation.d.ts +5 -5
- package/types/augmentation/storage.augmentation.d.ts +4 -4
- package/types/execution-context.d.ts +1 -2
- package/types/execution-context.host.d.ts +1 -2
- package/types/request-context.d.ts +1 -1
|
@@ -174,7 +174,7 @@ class HttpAdapterHost extends platform_adapter_host_js_1.PlatformAdapterHost {
|
|
|
174
174
|
return new request_host_js_1.RequestHost({
|
|
175
175
|
endpoint,
|
|
176
176
|
operation: 'action',
|
|
177
|
-
action:
|
|
177
|
+
action: endpoint.name,
|
|
178
178
|
controller,
|
|
179
179
|
handler,
|
|
180
180
|
http: incoming,
|
|
@@ -110,7 +110,7 @@ class PlatformAdapterHost extends strict_typed_events_1.AsyncEventEmitter {
|
|
|
110
110
|
const endpoint = (resource instanceof common_1.CrudResource && resource.operations.get(operationOrAction)) ||
|
|
111
111
|
resource.actions.get(operationOrAction);
|
|
112
112
|
if (endpoint) {
|
|
113
|
-
const handler = typeof controller[
|
|
113
|
+
const handler = typeof controller[endpoint.name] === 'function' ? controller[endpoint.name] : undefined;
|
|
114
114
|
if (handler)
|
|
115
115
|
return { controller, endpoint, handler };
|
|
116
116
|
}
|
package/cjs/request-context.js
CHANGED
|
@@ -106,7 +106,7 @@ export class PlatformAdapterHost extends AsyncEventEmitter {
|
|
|
106
106
|
const endpoint = (resource instanceof CrudResource && resource.operations.get(operationOrAction)) ||
|
|
107
107
|
resource.actions.get(operationOrAction);
|
|
108
108
|
if (endpoint) {
|
|
109
|
-
const handler = typeof controller[
|
|
109
|
+
const handler = typeof controller[endpoint.name] === 'function' ? controller[endpoint.name] : undefined;
|
|
110
110
|
if (handler)
|
|
111
111
|
return { controller, endpoint, handler };
|
|
112
112
|
}
|
package/esm/request-context.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opra/core",
|
|
3
|
-
"version": "0.26.
|
|
3
|
+
"version": "0.26.3",
|
|
4
4
|
"description": "Opra schema package",
|
|
5
5
|
"author": "Panates",
|
|
6
6
|
"license": "MIT",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"clean:cover": "rimraf ../../coverage/core"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@opra/common": "^0.26.
|
|
30
|
+
"@opra/common": "^0.26.3",
|
|
31
31
|
"accepts": "^1.3.8",
|
|
32
32
|
"content-disposition": "^0.5.4",
|
|
33
33
|
"content-type": "^1.0.5",
|
|
@@ -8,7 +8,7 @@ declare module "@opra/common" {
|
|
|
8
8
|
operation: 'action';
|
|
9
9
|
action: string;
|
|
10
10
|
}
|
|
11
|
-
interface Context
|
|
11
|
+
interface Context extends Resource.Context {
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
namespace Create {
|
|
@@ -22,7 +22,7 @@ declare module "@opra/common" {
|
|
|
22
22
|
[key: string]: any;
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
-
interface Context
|
|
25
|
+
interface Context extends RequestContext {
|
|
26
26
|
request: Request;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
@@ -31,7 +31,7 @@ declare module "@opra/common" {
|
|
|
31
31
|
operation: 'delete';
|
|
32
32
|
key: any;
|
|
33
33
|
}
|
|
34
|
-
interface Context
|
|
34
|
+
interface Context extends RequestContext {
|
|
35
35
|
request: Request;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
@@ -43,7 +43,7 @@ declare module "@opra/common" {
|
|
|
43
43
|
[key: string]: any;
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
|
-
interface Context
|
|
46
|
+
interface Context extends RequestContext {
|
|
47
47
|
request: Request;
|
|
48
48
|
}
|
|
49
49
|
}
|
|
@@ -63,7 +63,7 @@ declare module "@opra/common" {
|
|
|
63
63
|
[key: string]: any;
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
|
-
interface Context
|
|
66
|
+
interface Context extends RequestContext {
|
|
67
67
|
request: Request;
|
|
68
68
|
}
|
|
69
69
|
}
|
|
@@ -78,7 +78,7 @@ declare module "@opra/common" {
|
|
|
78
78
|
[key: string]: any;
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
|
-
interface Context
|
|
81
|
+
interface Context extends RequestContext {
|
|
82
82
|
request: Request;
|
|
83
83
|
}
|
|
84
84
|
}
|
|
@@ -94,7 +94,7 @@ declare module "@opra/common" {
|
|
|
94
94
|
[key: string]: any;
|
|
95
95
|
};
|
|
96
96
|
}
|
|
97
|
-
interface Context
|
|
97
|
+
interface Context extends RequestContext {
|
|
98
98
|
request: Request;
|
|
99
99
|
}
|
|
100
100
|
}
|
|
@@ -107,7 +107,7 @@ declare module "@opra/common" {
|
|
|
107
107
|
[key: string]: any;
|
|
108
108
|
};
|
|
109
109
|
}
|
|
110
|
-
interface Context
|
|
110
|
+
interface Context extends RequestContext {
|
|
111
111
|
request: Request;
|
|
112
112
|
}
|
|
113
113
|
}
|
|
@@ -8,7 +8,7 @@ declare module "@opra/common" {
|
|
|
8
8
|
operation: 'action';
|
|
9
9
|
action: string;
|
|
10
10
|
}
|
|
11
|
-
interface Context
|
|
11
|
+
interface Context extends Resource.Context {
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
namespace Create {
|
|
@@ -21,7 +21,7 @@ declare module "@opra/common" {
|
|
|
21
21
|
include?: string[];
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
-
interface Context
|
|
24
|
+
interface Context extends RequestContext {
|
|
25
25
|
request: Request;
|
|
26
26
|
}
|
|
27
27
|
}
|
|
@@ -29,7 +29,7 @@ declare module "@opra/common" {
|
|
|
29
29
|
interface Request extends _Request {
|
|
30
30
|
operation: 'delete';
|
|
31
31
|
}
|
|
32
|
-
interface Context
|
|
32
|
+
interface Context extends RequestContext {
|
|
33
33
|
request: Request;
|
|
34
34
|
}
|
|
35
35
|
}
|
|
@@ -42,7 +42,7 @@ declare module "@opra/common" {
|
|
|
42
42
|
include?: string[];
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
|
-
interface Context
|
|
45
|
+
interface Context extends RequestContext {
|
|
46
46
|
request: Request;
|
|
47
47
|
}
|
|
48
48
|
}
|
|
@@ -56,7 +56,7 @@ declare module "@opra/common" {
|
|
|
56
56
|
include?: string[];
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
|
-
interface Context
|
|
59
|
+
interface Context extends RequestContext {
|
|
60
60
|
request: Request;
|
|
61
61
|
}
|
|
62
62
|
}
|
|
@@ -8,7 +8,7 @@ declare module "@opra/common" {
|
|
|
8
8
|
operation: 'action';
|
|
9
9
|
action: string;
|
|
10
10
|
}
|
|
11
|
-
interface Context
|
|
11
|
+
interface Context extends Resource.Context {
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
namespace Delete {
|
|
@@ -16,7 +16,7 @@ declare module "@opra/common" {
|
|
|
16
16
|
operation: 'delete';
|
|
17
17
|
path?: string;
|
|
18
18
|
}
|
|
19
|
-
interface Context
|
|
19
|
+
interface Context extends RequestContext {
|
|
20
20
|
request: Request;
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -25,7 +25,7 @@ declare module "@opra/common" {
|
|
|
25
25
|
operation: 'get';
|
|
26
26
|
path?: string;
|
|
27
27
|
}
|
|
28
|
-
interface Context
|
|
28
|
+
interface Context extends RequestContext {
|
|
29
29
|
request: Request;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
@@ -35,7 +35,7 @@ declare module "@opra/common" {
|
|
|
35
35
|
path?: string;
|
|
36
36
|
parts: MultipartIterator;
|
|
37
37
|
}
|
|
38
|
-
interface Context
|
|
38
|
+
interface Context extends RequestContext {
|
|
39
39
|
request: Request;
|
|
40
40
|
}
|
|
41
41
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type { HttpServerRequest } from './http/http-server-request.js';
|
|
2
2
|
import type { HttpServerResponse } from './http/http-server-response.js';
|
|
3
3
|
import type { Protocol } from './platform-adapter.js';
|
|
4
|
-
export interface ExecutionContext
|
|
4
|
+
export interface ExecutionContext {
|
|
5
5
|
readonly protocol: Protocol;
|
|
6
6
|
readonly platform: string;
|
|
7
|
-
session: TSession;
|
|
8
7
|
errors: Error[];
|
|
9
8
|
switchToHttp(): HttpMessageContext;
|
|
10
9
|
switchToWs(): WsMessageContext;
|
|
@@ -4,7 +4,7 @@ import type { ExecutionContext, HttpMessageContext, RpcMessageContext, WsMessage
|
|
|
4
4
|
import type { HttpServerRequest } from './http/http-server-request.js';
|
|
5
5
|
import type { HttpServerResponse } from './http/http-server-response.js';
|
|
6
6
|
import { Protocol } from './platform-adapter.js';
|
|
7
|
-
export declare class ExecutionContextHost
|
|
7
|
+
export declare class ExecutionContextHost extends AsyncEventEmitter implements ExecutionContext {
|
|
8
8
|
readonly api: ApiDocument;
|
|
9
9
|
readonly platform: string;
|
|
10
10
|
readonly protocol: Protocol;
|
|
@@ -12,7 +12,6 @@ export declare class ExecutionContextHost<TSession extends {} = {}> extends Asyn
|
|
|
12
12
|
readonly ws?: WsMessageContext;
|
|
13
13
|
readonly rpc?: RpcMessageContext;
|
|
14
14
|
errors: Error[];
|
|
15
|
-
session: TSession;
|
|
16
15
|
constructor(api: ApiDocument, platform: string, protocol: {
|
|
17
16
|
http?: {
|
|
18
17
|
incoming: HttpServerRequest;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ExecutionContext } from './execution-context.js';
|
|
2
2
|
import type { Request } from './request.js';
|
|
3
3
|
import type { Response } from './response.js';
|
|
4
|
-
export interface RequestContext
|
|
4
|
+
export interface RequestContext extends ExecutionContext {
|
|
5
5
|
request: Request;
|
|
6
6
|
response: Response;
|
|
7
7
|
}
|