oak-db 3.3.11 → 3.3.13

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,3 +1,3 @@
1
- export type CreateEntityOption = {
2
- ifExists?: 'drop' | 'omit' | 'dropIfNotStatic';
3
- };
1
+ export type CreateEntityOption = {
2
+ ifExists?: 'drop' | 'omit' | 'dropIfNotStatic';
3
+ };
@@ -1,2 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ import { PostgreSQLConfiguration } from './../PostgreSQL/types/Configuration';
2
+ import { MySQLConfiguration } from './../MySQL/types/Configuration';
3
+ export type DbConfiguration = PostgreSQLConfiguration & {
4
+ type: 'postgresql';
5
+ } | MySQLConfiguration & {
6
+ type: 'mysql';
7
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,32 @@
1
+ import { Attribute, EntityDict, Index, OperateOption, OperationResult, StorageSchema, TxnOption } from 'oak-domain/lib/types';
2
+ import { EntityDict as BaseEntityDict } from 'oak-domain/lib/base-app-domain';
3
+ import { AsyncContext, AsyncRowStore } from "oak-domain/lib/store/AsyncRowStore";
4
+ import { CreateEntityOption } from "./Translator";
5
+ import { AggregationResult, SelectOption } from "oak-domain/lib/types";
6
+ export type Plan = {
7
+ newTables: Record<string, {
8
+ attributes: Record<string, Attribute>;
9
+ }>;
10
+ newIndexes: Record<string, Index<any>[]>;
11
+ updatedTables: Record<string, {
12
+ attributes: Record<string, Attribute & {
13
+ isNew: boolean;
14
+ }>;
15
+ }>;
16
+ updatedIndexes: Record<string, Index<any>[]>;
17
+ };
18
+ export interface DbStore<ED extends EntityDict & BaseEntityDict, Cxt extends AsyncContext<ED>> extends AsyncRowStore<ED, Cxt> {
19
+ connect: () => Promise<void>;
20
+ disconnect: () => Promise<void>;
21
+ initialize(options: CreateEntityOption): Promise<void>;
22
+ aggregate<T extends keyof ED, OP extends SelectOption>(entity: T, aggregation: ED[T]['Aggregation'], context: Cxt, option: OP): Promise<AggregationResult<ED[T]['Schema']>>;
23
+ operate<T extends keyof ED>(entity: T, operation: ED[T]['Operation'], context: Cxt, option: OperateOption): Promise<OperationResult<ED>>;
24
+ select<T extends keyof ED>(entity: T, selection: ED[T]['Selection'], context: Cxt, option: SelectOption): Promise<Partial<ED[T]['Schema']>[]>;
25
+ count<T extends keyof ED>(entity: T, selection: Pick<ED[T]['Selection'], 'filter' | 'count'>, context: Cxt, option: SelectOption): Promise<number>;
26
+ begin(option?: TxnOption): Promise<string>;
27
+ commit(txnId: string): Promise<void>;
28
+ rollback(txnId: string): Promise<void>;
29
+ readSchema(): Promise<StorageSchema<ED>>;
30
+ makeUpgradePlan(): Promise<Plan>;
31
+ diffSchema(schemaOld: StorageSchema<any>, schemaNew: StorageSchema<any>): Plan;
32
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ ;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oak-db",
3
- "version": "3.3.11",
3
+ "version": "3.3.13",
4
4
  "description": "oak-db",
5
5
  "main": "lib/index",
6
6
  "author": {
@@ -10,15 +10,16 @@
10
10
  "lib/**/*"
11
11
  ],
12
12
  "scripts": {
13
- "test": "mocha",
13
+ "test": "node --stack-size=65500 ./node_modules/mocha/bin/mocha",
14
14
  "make:test:domain": "ts-node script/makeTestDomain.ts",
15
- "build": "tsc"
15
+ "build": "node --stack-size=4096 ./script/build.js"
16
16
  },
17
17
  "dependencies": {
18
18
  "lodash": "^4.17.21",
19
19
  "mysql": "^2.18.1",
20
20
  "mysql2": "^2.3.3",
21
- "oak-domain": "^5.1.28",
21
+ "oak-domain": "^5.1.34",
22
+ "pg": "^8.16.3",
22
23
  "uuid": "^8.3.2"
23
24
  },
24
25
  "license": "ISC",
@@ -27,11 +28,11 @@
27
28
  "@types/luxon": "^2.3.2",
28
29
  "@types/mocha": "^9.1.1",
29
30
  "@types/node": "^20.6.0",
31
+ "@types/pg": "^8.16.0",
30
32
  "@types/sqlstring": "^2.3.0",
31
33
  "@types/uuid": "^8.3.4",
32
34
  "cross-env": "^7.0.3",
33
35
  "mocha": "^10.2.0",
34
- "oak-general-business": "~5.5.0",
35
36
  "ts-node": "^10.9.1",
36
37
  "tslib": "^2.4.0",
37
38
  "typescript": "^5.2.2"