oak-domain 1.1.7 → 1.1.8

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.
@@ -10,11 +10,11 @@ export declare abstract class Connector<ED extends EntityDict, Cxt extends Conte
10
10
  opRecords: OpRecord<ED>[];
11
11
  }>;
12
12
  abstract getRouter(): string;
13
- abstract parseRequest(headers: IncomingHttpHeaders, body: any, store: RowStore<ED, Cxt>): {
13
+ abstract parseRequest(headers: IncomingHttpHeaders, body: any, store: RowStore<ED, Cxt>): Promise<{
14
14
  name: string;
15
15
  params: any;
16
16
  context: Cxt;
17
- };
17
+ }>;
18
18
  abstract serializeResult(result: any, context: Cxt, headers: IncomingHttpHeaders, body: any): {
19
19
  body: any;
20
20
  headers?: Record<string, any>;
@@ -7,17 +7,17 @@ export declare class SimpleConnector<ED extends EntityDict, Cxt extends Universa
7
7
  private serverUrl;
8
8
  private makeException;
9
9
  private contextBuilder;
10
- constructor(serverUrl: string, makeException: (exceptionData: any) => OakException, contextBuilder: (str: string | undefined) => (store: RowStore<ED, Cxt>) => Cxt);
10
+ constructor(serverUrl: string, makeException: (exceptionData: any) => OakException, contextBuilder: (str: string | undefined) => (store: RowStore<ED, Cxt>) => Promise<Cxt>);
11
11
  callAspect(name: string, params: any, context: Cxt): Promise<{
12
12
  result: any;
13
13
  opRecords: OpRecord<ED>[];
14
14
  }>;
15
15
  getRouter(): string;
16
- parseRequest(headers: IncomingHttpHeaders, body: any, store: RowStore<ED, Cxt>): {
16
+ parseRequest(headers: IncomingHttpHeaders, body: any, store: RowStore<ED, Cxt>): Promise<{
17
17
  name: string;
18
18
  params: any;
19
19
  context: Cxt;
20
- };
20
+ }>;
21
21
  serializeResult(result: any, context: Cxt, headers: IncomingHttpHeaders, body: any): {
22
22
  body: any;
23
23
  headers?: Record<string, any> | undefined;
@@ -61,15 +61,25 @@ var SimpleConnector = /** @class */ (function (_super) {
61
61
  return SimpleConnector.ROUTER;
62
62
  };
63
63
  SimpleConnector.prototype.parseRequest = function (headers, body, store) {
64
- var oakCxtStr = headers["oak-cxt"], aspectName = headers["oak-aspect"];
65
- (0, assert_1.default)(typeof oakCxtStr === 'string' || oakCxtStr === undefined);
66
- (0, assert_1.default)(typeof aspectName === 'string');
67
- var context = this.contextBuilder(oakCxtStr)(store);
68
- return {
69
- name: aspectName,
70
- params: body,
71
- context: context,
72
- };
64
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
65
+ var oakCxtStr, aspectName, context;
66
+ return tslib_1.__generator(this, function (_a) {
67
+ switch (_a.label) {
68
+ case 0:
69
+ oakCxtStr = headers["oak-cxt"], aspectName = headers["oak-aspect"];
70
+ (0, assert_1.default)(typeof oakCxtStr === 'string' || oakCxtStr === undefined);
71
+ (0, assert_1.default)(typeof aspectName === 'string');
72
+ return [4 /*yield*/, this.contextBuilder(oakCxtStr)(store)];
73
+ case 1:
74
+ context = _a.sent();
75
+ return [2 /*return*/, {
76
+ name: aspectName,
77
+ params: body,
78
+ context: context,
79
+ }];
80
+ }
81
+ });
82
+ });
73
83
  };
74
84
  SimpleConnector.prototype.serializeResult = function (result, context, headers, body) {
75
85
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oak-domain",
3
- "version": "1.1.7",
3
+ "version": "1.1.8",
4
4
  "author": {
5
5
  "name": "XuChang"
6
6
  },