oak-db 3.3.2 → 3.3.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.
@@ -1,12 +1,12 @@
1
- export type MySQLConfiguration = {
2
- host: string;
3
- user: string;
4
- password: string;
5
- database: string;
6
- charset: 'utf8mb4_general_ci';
7
- connectionLimit: number;
8
- port?: number;
9
- };
10
- export type Configuration = {
11
- mysql: MySQLConfiguration;
12
- };
1
+ export type MySQLConfiguration = {
2
+ host: string;
3
+ user: string;
4
+ password: string;
5
+ database: string;
6
+ charset: 'utf8mb4_general_ci';
7
+ connectionLimit: number;
8
+ port?: number;
9
+ };
10
+ export type Configuration = {
11
+ mysql: MySQLConfiguration;
12
+ };
@@ -1,2 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/lib/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export * from './MySQL/store';
2
- export { MySqlSelectOption, MysqlOperateOption } from './MySQL/translator';
1
+ export * from './MySQL/store';
2
+ export { MySqlSelectOption, MysqlOperateOption } from './MySQL/translator';
package/lib/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./MySQL/store"), exports);
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./MySQL/store"), exports);
@@ -1,55 +1,55 @@
1
- import { EntityDict, OperateOption, Q_FullTextValue, Ref, RefOrExpression, SelectOption, StorageSchema } from "oak-domain/lib/types";
2
- import { EntityDict as BaseEntityDict } from 'oak-domain/lib/base-app-domain';
3
- import { DataType } from "oak-domain/lib/types/schema/DataTypes";
4
- import { CreateEntityOption } from './types/Translator';
5
- export interface SqlSelectOption extends SelectOption {
6
- }
7
- export interface SqlOperateOption extends OperateOption {
8
- }
9
- export declare abstract class SqlTranslator<ED extends EntityDict & BaseEntityDict> {
10
- readonly schema: StorageSchema<ED>;
11
- constructor(schema: StorageSchema<ED>);
12
- private makeFullSchema;
13
- protected abstract getDefaultSelectFilter<OP extends SqlSelectOption>(alias: string, option?: OP): string;
14
- protected abstract translateAttrProjection(dataType: DataType, alias: string, attr: string): string;
15
- protected abstract translateObjectProjection(projection: Record<string, any>, alias: string, attr: string, prefix: string): string;
16
- protected abstract translateAttrValue(dataType: DataType | Ref, value: any): string;
17
- protected abstract translateFullTextSearch<T extends keyof ED>(value: Q_FullTextValue, entity: T, alias: string): string;
18
- abstract translateCreateEntity<T extends keyof ED>(entity: T, option: CreateEntityOption): string[];
19
- protected abstract translateObjectPredicate(predicate: Record<string, any>, alias: string, attr: string): string;
20
- protected abstract populateSelectStmt<T extends keyof ED, OP extends SqlSelectOption>(projectionText: string, fromText: string, aliasDict: Record<string, string>, filterText: string, sorterText?: string, groupByText?: string, indexFrom?: number, count?: number, option?: OP, selection?: ED[T]['Selection'], aggregation?: ED[T]['Aggregation']): string;
21
- protected abstract populateUpdateStmt<OP extends SqlOperateOption>(updateText: string, fromText: string, aliasDict: Record<string, string>, filterText: string, sorterText?: string, indexFrom?: number, count?: number, option?: OP): string;
22
- protected abstract populateRemoveStmt<OP extends SqlOperateOption>(updateText: string, fromText: string, aliasDict: Record<string, string>, filterText: string, sorterText?: string, indexFrom?: number, count?: number, option?: OP): string;
23
- protected abstract translateExpression<T extends keyof ED>(entity: T, alias: string, expression: RefOrExpression<keyof ED[T]['OpSchema']>, refDict: Record<string, [string, keyof ED]>): string;
24
- private getStorageName;
25
- translateInsert<T extends keyof ED>(entity: T, data: ED[T]['CreateMulti']['data']): string;
26
- /**
27
- * analyze the join relations in projection/query/sort
28
- * 所有的层次关系都当成left join处理,如果有内表为空的情况,请手动处理
29
- * {
30
- * b: {
31
- * name: {
32
- * $exists: false,
33
- * }
34
- * }
35
- * }
36
- * 这样的query会把内表为空的行也返回
37
- * @param param0
38
- */
39
- private analyzeJoin;
40
- private translateComparison;
41
- private translateEvaluation;
42
- protected translatePredicate(predicate: string, value: any, type?: DataType | Ref): string;
43
- private translateFilter;
44
- private translateSorter;
45
- private translateProjection;
46
- private translateSelectInner;
47
- translateSelect<T extends keyof ED, OP extends SqlSelectOption>(entity: T, selection: ED[T]['Selection'], option?: OP): string;
48
- translateWhere<T extends keyof ED, OP extends SqlSelectOption>(entity: T, selection: ED[T]['Selection'], option?: OP): string;
49
- translateAggregate<T extends keyof ED, OP extends SqlSelectOption>(entity: T, aggregation: ED[T]['Aggregation'], option?: OP): string;
50
- translateCount<T extends keyof ED, OP extends SqlSelectOption>(entity: T, selection: Pick<ED[T]['Selection'], 'filter' | 'count'>, option?: OP): string;
51
- translateRemove<T extends keyof ED, OP extends SqlOperateOption>(entity: T, operation: ED[T]['Remove'], option?: OP): string;
52
- translateUpdate<T extends keyof ED, OP extends SqlOperateOption>(entity: T, operation: ED[T]['Update'], option?: OP): string;
53
- translateDestroyEntity(entity: string, truncate?: boolean): string;
54
- escapeStringValue(value: string): string;
55
- }
1
+ import { EntityDict, OperateOption, Q_FullTextValue, Ref, RefOrExpression, SelectOption, StorageSchema } from "oak-domain/lib/types";
2
+ import { EntityDict as BaseEntityDict } from 'oak-domain/lib/base-app-domain';
3
+ import { DataType } from "oak-domain/lib/types/schema/DataTypes";
4
+ import { CreateEntityOption } from './types/Translator';
5
+ export interface SqlSelectOption extends SelectOption {
6
+ }
7
+ export interface SqlOperateOption extends OperateOption {
8
+ }
9
+ export declare abstract class SqlTranslator<ED extends EntityDict & BaseEntityDict> {
10
+ readonly schema: StorageSchema<ED>;
11
+ constructor(schema: StorageSchema<ED>);
12
+ private makeFullSchema;
13
+ protected abstract getDefaultSelectFilter<OP extends SqlSelectOption>(alias: string, option?: OP): string;
14
+ protected abstract translateAttrProjection(dataType: DataType, alias: string, attr: string): string;
15
+ protected abstract translateObjectProjection(projection: Record<string, any>, alias: string, attr: string, prefix: string): string;
16
+ protected abstract translateAttrValue(dataType: DataType | Ref, value: any): string;
17
+ protected abstract translateFullTextSearch<T extends keyof ED>(value: Q_FullTextValue, entity: T, alias: string): string;
18
+ abstract translateCreateEntity<T extends keyof ED>(entity: T, option: CreateEntityOption): string[];
19
+ protected abstract translateObjectPredicate(predicate: Record<string, any>, alias: string, attr: string): string;
20
+ protected abstract populateSelectStmt<T extends keyof ED, OP extends SqlSelectOption>(projectionText: string, fromText: string, aliasDict: Record<string, string>, filterText: string, sorterText?: string, groupByText?: string, indexFrom?: number, count?: number, option?: OP, selection?: ED[T]['Selection'], aggregation?: ED[T]['Aggregation']): string;
21
+ protected abstract populateUpdateStmt<OP extends SqlOperateOption>(updateText: string, fromText: string, aliasDict: Record<string, string>, filterText: string, sorterText?: string, indexFrom?: number, count?: number, option?: OP): string;
22
+ protected abstract populateRemoveStmt<OP extends SqlOperateOption>(updateText: string, fromText: string, aliasDict: Record<string, string>, filterText: string, sorterText?: string, indexFrom?: number, count?: number, option?: OP): string;
23
+ protected abstract translateExpression<T extends keyof ED>(entity: T, alias: string, expression: RefOrExpression<keyof ED[T]['OpSchema']>, refDict: Record<string, [string, keyof ED]>): string;
24
+ private getStorageName;
25
+ translateInsert<T extends keyof ED>(entity: T, data: ED[T]['CreateMulti']['data']): string;
26
+ /**
27
+ * analyze the join relations in projection/query/sort
28
+ * 所有的层次关系都当成left join处理,如果有内表为空的情况,请手动处理
29
+ * {
30
+ * b: {
31
+ * name: {
32
+ * $exists: false,
33
+ * }
34
+ * }
35
+ * }
36
+ * 这样的query会把内表为空的行也返回
37
+ * @param param0
38
+ */
39
+ private analyzeJoin;
40
+ private translateComparison;
41
+ private translateEvaluation;
42
+ protected translatePredicate(predicate: string, value: any, type?: DataType | Ref): string;
43
+ private translateFilter;
44
+ private translateSorter;
45
+ private translateProjection;
46
+ private translateSelectInner;
47
+ translateSelect<T extends keyof ED, OP extends SqlSelectOption>(entity: T, selection: ED[T]['Selection'], option?: OP): string;
48
+ translateWhere<T extends keyof ED, OP extends SqlSelectOption>(entity: T, selection: ED[T]['Selection'], option?: OP): string;
49
+ translateAggregate<T extends keyof ED, OP extends SqlSelectOption>(entity: T, aggregation: ED[T]['Aggregation'], option?: OP): string;
50
+ translateCount<T extends keyof ED, OP extends SqlSelectOption>(entity: T, selection: Pick<ED[T]['Selection'], 'filter' | 'count'>, option?: OP): string;
51
+ translateRemove<T extends keyof ED, OP extends SqlOperateOption>(entity: T, operation: ED[T]['Remove'], option?: OP): string;
52
+ translateUpdate<T extends keyof ED, OP extends SqlOperateOption>(entity: T, operation: ED[T]['Update'], option?: OP): string;
53
+ translateDestroyEntity(entity: string, truncate?: boolean): string;
54
+ escapeStringValue(value: string): string;
55
+ }
@@ -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 });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oak-db",
3
- "version": "3.3.2",
3
+ "version": "3.3.3",
4
4
  "description": "oak-db",
5
5
  "main": "lib/index",
6
6
  "author": {
@@ -18,7 +18,7 @@
18
18
  "lodash": "^4.17.21",
19
19
  "mysql": "^2.18.1",
20
20
  "mysql2": "^2.3.3",
21
- "oak-domain": "^5.1.2",
21
+ "oak-domain": "^5.1.11",
22
22
  "uuid": "^8.3.2"
23
23
  },
24
24
  "license": "ISC",
@@ -31,7 +31,7 @@
31
31
  "@types/uuid": "^8.3.4",
32
32
  "cross-env": "^7.0.3",
33
33
  "mocha": "^10.2.0",
34
- "oak-general-business": "~5.5.1",
34
+ "oak-general-business": "~5.5.0",
35
35
  "ts-node": "^10.9.1",
36
36
  "tslib": "^2.4.0",
37
37
  "typescript": "^5.2.2"