oak-db 1.0.1 → 1.0.2

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.
@@ -1,9 +1,10 @@
1
1
  import { EntityDict, Context, DeduceCreateSingleOperation, DeduceRemoveOperation, DeduceUpdateOperation, OperateOption, OperationResult, SelectionResult, TxnOption, SelectRowShape, StorageSchema, DeduceCreateMultipleOperation, SelectOption } from 'oak-domain/lib/types';
2
+ import { EntityDict as BaseEntityDict } from 'oak-domain/lib/base-app-domain';
2
3
  import { CascadeStore } from 'oak-domain/lib/store/CascadeStore';
3
4
  import { MySQLConfiguration } from './types/Configuration';
4
5
  import { MySqlConnector } from './connector';
5
6
  import { MySqlTranslator, MySqlSelectOption, MysqlOperateOption } from './translator';
6
- export declare class MysqlStore<ED extends EntityDict, Cxt extends Context<ED>> extends CascadeStore<ED, Cxt> {
7
+ export declare class MysqlStore<ED extends EntityDict & BaseEntityDict, Cxt extends Context<ED>> extends CascadeStore<ED, Cxt> {
7
8
  connector: MySqlConnector;
8
9
  translator: MySqlTranslator<ED>;
9
10
  constructor(storageSchema: StorageSchema<ED>, configuration: MySQLConfiguration);
@@ -12,9 +13,9 @@ export declare class MysqlStore<ED extends EntityDict, Cxt extends Context<ED>>
12
13
  private formResult;
13
14
  protected selectAbjointRow<T extends keyof ED, S extends ED[T]['Selection']>(entity: T, selection: S, context: Cxt, option?: MySqlSelectOption): Promise<SelectRowShape<ED[T]['Schema'], S['data']>[]>;
14
15
  protected updateAbjointRow<T extends keyof ED>(entity: T, operation: DeduceCreateMultipleOperation<ED[T]['Schema']> | DeduceCreateSingleOperation<ED[T]['Schema']> | DeduceUpdateOperation<ED[T]['Schema']> | DeduceRemoveOperation<ED[T]['Schema']>, context: Cxt, option?: MysqlOperateOption): Promise<number>;
15
- operate<T extends keyof ED>(entity: T, operation: ED[T]['Operation'], context: Cxt, params?: OperateOption): Promise<OperationResult<ED>>;
16
- select<T extends keyof ED, S extends ED[T]['Selection']>(entity: T, selection: S, context: Cxt, option?: SelectOption): Promise<SelectionResult<ED[T]['Schema'], S['data']>>;
17
- count<T extends keyof ED>(entity: T, selection: Pick<ED[T]['Selection'], 'filter' | 'count'>, context: Cxt, option?: SelectOption): Promise<number>;
16
+ operate<T extends keyof ED>(entity: T, operation: ED[T]['Operation'], context: Cxt, option: OperateOption): Promise<OperationResult<ED>>;
17
+ select<T extends keyof ED, S extends ED[T]['Selection']>(entity: T, selection: S, context: Cxt, option: SelectOption): Promise<SelectionResult<ED[T]['Schema'], S['data']>>;
18
+ count<T extends keyof ED>(entity: T, selection: Pick<ED[T]['Selection'], 'filter' | 'count'>, context: Cxt, option: SelectOption): Promise<number>;
18
19
  begin(option?: TxnOption): Promise<string>;
19
20
  commit(txnId: string): Promise<void>;
20
21
  rollback(txnId: string): Promise<void>;
@@ -231,7 +231,7 @@ var MysqlStore = /** @class */ (function (_super) {
231
231
  });
232
232
  });
233
233
  };
234
- MysqlStore.prototype.operate = function (entity, operation, context, params) {
234
+ MysqlStore.prototype.operate = function (entity, operation, context, option) {
235
235
  return tslib_1.__awaiter(this, void 0, void 0, function () {
236
236
  var action;
237
237
  return tslib_1.__generator(this, function (_a) {
@@ -239,7 +239,7 @@ var MysqlStore = /** @class */ (function (_super) {
239
239
  case 0:
240
240
  action = operation.action;
241
241
  (0, assert_1.default)(!['select', 'download', 'stat'].includes(action), '现在不支持使用select operation');
242
- return [4 /*yield*/, this.cascadeUpdate(entity, operation, context, params)];
242
+ return [4 /*yield*/, this.cascadeUpdate(entity, operation, context, option)];
243
243
  case 1: return [2 /*return*/, _a.sent()];
244
244
  }
245
245
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oak-db",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "oak-db",
5
5
  "main": "src/index.ts",
6
6
  "author": {
@@ -19,7 +19,7 @@
19
19
  "luxon": "^2.4.0",
20
20
  "mysql": "^2.18.1",
21
21
  "mysql2": "^2.3.3",
22
- "oak-domain": "^1.0.4",
22
+ "oak-domain": "^1.1.0",
23
23
  "uuid": "^8.3.2"
24
24
  },
25
25
  "license": "ISC",
@@ -30,7 +30,7 @@
30
30
  "@types/node": "^17.0.42",
31
31
  "@types/uuid": "^8.3.4",
32
32
  "mocha": "^10.0.0",
33
- "oak-general-business": "^1.0.2",
33
+ "oak-general-business": "^1.0.5",
34
34
  "ts-node": "~10.9.1",
35
35
  "tslib": "^2.4.0",
36
36
  "typescript": "~4.7.4"