@nocobase/database 1.2.13-alpha → 1.3.0-alpha.20240710084543
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/package.json +4 -4
- package/lib/collection-factory.d.ts +0 -25
- package/lib/collection-factory.js +0 -61
- package/lib/collection-group-manager.d.ts +0 -34
- package/lib/collection-group-manager.js +0 -66
- package/lib/collection-importer.d.ts +0 -15
- package/lib/collection-importer.js +0 -83
- package/lib/collection.d.ts +0 -145
- package/lib/collection.js +0 -663
- package/lib/database-utils/index.d.ts +0 -16
- package/lib/database-utils/index.js +0 -75
- package/lib/database.d.ts +0 -228
- package/lib/database.js +0 -795
- package/lib/decorators/must-have-filter-decorator.d.ts +0 -10
- package/lib/decorators/must-have-filter-decorator.js +0 -48
- package/lib/decorators/target-collection-decorator.d.ts +0 -10
- package/lib/decorators/target-collection-decorator.js +0 -56
- package/lib/decorators/transaction-decorator.d.ts +0 -9
- package/lib/decorators/transaction-decorator.js +0 -95
- package/lib/eager-loading/eager-loading-tree.d.ts +0 -39
- package/lib/eager-loading/eager-loading-tree.js +0 -448
- package/lib/errors/identifier-error.d.ts +0 -11
- package/lib/errors/identifier-error.js +0 -44
- package/lib/errors/zero-column-table-error.d.ts +0 -10
- package/lib/errors/zero-column-table-error.js +0 -40
- package/lib/features/references-map.d.ts +0 -29
- package/lib/features/references-map.js +0 -120
- package/lib/features/referential-integrity-check.d.ts +0 -16
- package/lib/features/referential-integrity-check.js +0 -86
- package/lib/field-repository/array-field-repository.d.ts +0 -36
- package/lib/field-repository/array-field-repository.js +0 -179
- package/lib/fields/array-field.d.ts +0 -19
- package/lib/fields/array-field.js +0 -66
- package/lib/fields/belongs-to-field.d.ts +0 -25
- package/lib/fields/belongs-to-field.js +0 -166
- package/lib/fields/belongs-to-many-field.d.ts +0 -28
- package/lib/fields/belongs-to-many-field.js +0 -196
- package/lib/fields/boolean-field.d.ts +0 -16
- package/lib/fields/boolean-field.js +0 -45
- package/lib/fields/context-field.d.ts +0 -22
- package/lib/fields/context-field.js +0 -79
- package/lib/fields/date-field.d.ts +0 -21
- package/lib/fields/date-field.js +0 -73
- package/lib/fields/field.d.ts +0 -52
- package/lib/fields/field.js +0 -168
- package/lib/fields/has-inverse-field.d.ts +0 -12
- package/lib/fields/has-inverse-field.js +0 -24
- package/lib/fields/has-many-field.d.ts +0 -76
- package/lib/fields/has-many-field.js +0 -165
- package/lib/fields/has-one-field.d.ts +0 -76
- package/lib/fields/has-one-field.js +0 -159
- package/lib/fields/index.d.ts +0 -54
- package/lib/fields/index.js +0 -74
- package/lib/fields/json-field.d.ts +0 -22
- package/lib/fields/json-field.js +0 -63
- package/lib/fields/nanoid-field.d.ts +0 -22
- package/lib/fields/nanoid-field.js +0 -65
- package/lib/fields/number-field.d.ts +0 -49
- package/lib/fields/number-field.js +0 -94
- package/lib/fields/password-field.d.ts +0 -29
- package/lib/fields/password-field.js +0 -106
- package/lib/fields/radio-field.d.ts +0 -24
- package/lib/fields/radio-field.js +0 -75
- package/lib/fields/relation-field.d.ts +0 -31
- package/lib/fields/relation-field.js +0 -94
- package/lib/fields/set-field.d.ts +0 -18
- package/lib/fields/set-field.js +0 -55
- package/lib/fields/sort-field.d.ts +0 -22
- package/lib/fields/sort-field.js +0 -197
- package/lib/fields/string-field.d.ts +0 -16
- package/lib/fields/string-field.js +0 -45
- package/lib/fields/text-field.d.ts +0 -18
- package/lib/fields/text-field.js +0 -53
- package/lib/fields/time-field.d.ts +0 -16
- package/lib/fields/time-field.js +0 -45
- package/lib/fields/uid-field.d.ts +0 -21
- package/lib/fields/uid-field.js +0 -72
- package/lib/fields/uuid-field.d.ts +0 -20
- package/lib/fields/uuid-field.js +0 -63
- package/lib/fields/virtual-field.d.ts +0 -16
- package/lib/fields/virtual-field.js +0 -45
- package/lib/filter-match.d.ts +0 -9
- package/lib/filter-match.js +0 -75
- package/lib/filter-parser.d.ts +0 -29
- package/lib/filter-parser.js +0 -238
- package/lib/helpers.d.ts +0 -11
- package/lib/helpers.js +0 -182
- package/lib/index.d.ts +0 -37
- package/lib/index.js +0 -138
- package/lib/inherited-collection.d.ts +0 -22
- package/lib/inherited-collection.js +0 -147
- package/lib/inherited-map.d.ts +0 -29
- package/lib/inherited-map.js +0 -125
- package/lib/inherited-sync-runner.d.ts +0 -12
- package/lib/inherited-sync-runner.js +0 -184
- package/lib/interface-manager.d.ts +0 -17
- package/lib/interface-manager.js +0 -50
- package/lib/interfaces/base-interface.d.ts +0 -33
- package/lib/interfaces/base-interface.js +0 -80
- package/lib/interfaces/boolean-interface.d.ts +0 -13
- package/lib/interfaces/boolean-interface.js +0 -70
- package/lib/interfaces/checkboxes-interface.d.ts +0 -11
- package/lib/interfaces/checkboxes-interface.js +0 -41
- package/lib/interfaces/datetime-interface.d.ts +0 -13
- package/lib/interfaces/datetime-interface.js +0 -108
- package/lib/interfaces/index.d.ts +0 -14
- package/lib/interfaces/index.js +0 -40
- package/lib/interfaces/integer-interface.d.ts +0 -12
- package/lib/interfaces/integer-interface.js +0 -44
- package/lib/interfaces/json-interface.d.ts +0 -13
- package/lib/interfaces/json-interface.js +0 -47
- package/lib/interfaces/many-to-many-interface.d.ts +0 -11
- package/lib/interfaces/many-to-many-interface.js +0 -41
- package/lib/interfaces/many-to-one-interface.d.ts +0 -11
- package/lib/interfaces/many-to-one-interface.js +0 -41
- package/lib/interfaces/multiple-select-interface.d.ts +0 -13
- package/lib/interfaces/multiple-select-interface.js +0 -76
- package/lib/interfaces/number-interface.d.ts +0 -15
- package/lib/interfaces/number-interface.js +0 -72
- package/lib/interfaces/one-belongs-to-one-interface.d.ts +0 -11
- package/lib/interfaces/one-belongs-to-one-interface.js +0 -41
- package/lib/interfaces/one-has-one-interface.d.ts +0 -11
- package/lib/interfaces/one-has-one-interface.js +0 -41
- package/lib/interfaces/one-to-many-interface.d.ts +0 -11
- package/lib/interfaces/one-to-many-interface.js +0 -41
- package/lib/interfaces/percent-interface.d.ts +0 -13
- package/lib/interfaces/percent-interface.js +0 -55
- package/lib/interfaces/select-interface.d.ts +0 -13
- package/lib/interfaces/select-interface.js +0 -63
- package/lib/interfaces/to-many-interface.d.ts +0 -12
- package/lib/interfaces/to-many-interface.js +0 -61
- package/lib/interfaces/to-one-interface.d.ts +0 -13
- package/lib/interfaces/to-one-interface.js +0 -61
- package/lib/interfaces/utils.d.ts +0 -10
- package/lib/interfaces/utils.js +0 -72
- package/lib/listeners/adjacency-list.d.ts +0 -10
- package/lib/listeners/adjacency-list.js +0 -51
- package/lib/listeners/append-child-collection-name-after-repository-find.d.ts +0 -14
- package/lib/listeners/append-child-collection-name-after-repository-find.js +0 -75
- package/lib/listeners/index.d.ts +0 -10
- package/lib/listeners/index.js +0 -42
- package/lib/magic-attribute-model.d.ts +0 -16
- package/lib/magic-attribute-model.js +0 -213
- package/lib/migration.d.ts +0 -43
- package/lib/migration.js +0 -112
- package/lib/mock-database.d.ts +0 -33
- package/lib/mock-database.js +0 -136
- package/lib/model-hook.d.ts +0 -20
- package/lib/model-hook.js +0 -96
- package/lib/model.d.ts +0 -32
- package/lib/model.js +0 -179
- package/lib/operators/array.d.ts +0 -10
- package/lib/operators/array.js +0 -196
- package/lib/operators/association.d.ts +0 -10
- package/lib/operators/association.js +0 -44
- package/lib/operators/boolean.d.ts +0 -10
- package/lib/operators/boolean.js +0 -47
- package/lib/operators/child-collection.d.ts +0 -10
- package/lib/operators/child-collection.js +0 -77
- package/lib/operators/date.d.ts +0 -10
- package/lib/operators/date.js +0 -149
- package/lib/operators/empty.d.ts +0 -13
- package/lib/operators/empty.js +0 -102
- package/lib/operators/eq.d.ts +0 -10
- package/lib/operators/eq.js +0 -44
- package/lib/operators/index.d.ts +0 -13
- package/lib/operators/index.js +0 -63
- package/lib/operators/ne.d.ts +0 -10
- package/lib/operators/ne.js +0 -49
- package/lib/operators/notIn.d.ts +0 -10
- package/lib/operators/notIn.js +0 -42
- package/lib/operators/string.d.ts +0 -10
- package/lib/operators/string.js +0 -118
- package/lib/operators/utils.d.ts +0 -12
- package/lib/operators/utils.js +0 -53
- package/lib/options-parser.d.ts +0 -45
- package/lib/options-parser.js +0 -350
- package/lib/query-interface/mysql-query-interface.d.ts +0 -44
- package/lib/query-interface/mysql-query-interface.js +0 -134
- package/lib/query-interface/postgres-query-interface.d.ts +0 -41
- package/lib/query-interface/postgres-query-interface.js +0 -207
- package/lib/query-interface/query-interface-builder.d.ts +0 -10
- package/lib/query-interface/query-interface-builder.js +0 -55
- package/lib/query-interface/query-interface.d.ts +0 -52
- package/lib/query-interface/query-interface.js +0 -59
- package/lib/query-interface/sqlite-query-interface.d.ts +0 -44
- package/lib/query-interface/sqlite-query-interface.js +0 -141
- package/lib/relation-repository/belongs-to-many-repository.d.ts +0 -28
- package/lib/relation-repository/belongs-to-many-repository.js +0 -248
- package/lib/relation-repository/belongs-to-repository.d.ts +0 -17
- package/lib/relation-repository/belongs-to-repository.js +0 -51
- package/lib/relation-repository/hasmany-repository.d.ts +0 -21
- package/lib/relation-repository/hasmany-repository.js +0 -158
- package/lib/relation-repository/hasone-repository.d.ts +0 -17
- package/lib/relation-repository/hasone-repository.js +0 -51
- package/lib/relation-repository/multiple-relation-repository.d.ts +0 -27
- package/lib/relation-repository/multiple-relation-repository.js +0 -200
- package/lib/relation-repository/relation-repository.d.ts +0 -38
- package/lib/relation-repository/relation-repository.js +0 -175
- package/lib/relation-repository/single-relation-repository.d.ts +0 -36
- package/lib/relation-repository/single-relation-repository.js +0 -151
- package/lib/relation-repository/types.d.ts +0 -15
- package/lib/relation-repository/types.js +0 -24
- package/lib/repositories/tree-repository/adjacency-list-repository.d.ts +0 -26
- package/lib/repositories/tree-repository/adjacency-list-repository.js +0 -192
- package/lib/repositories/view-repository.d.ts +0 -11
- package/lib/repositories/view-repository.js +0 -41
- package/lib/repository.d.ts +0 -214
- package/lib/repository.js +0 -609
- package/lib/sql-parser/index.d.ts +0 -13
- package/lib/sql-parser/index.js +0 -33
- package/lib/sync-runner.d.ts +0 -41
- package/lib/sync-runner.js +0 -335
- package/lib/types.d.ts +0 -57
- package/lib/types.js +0 -24
- package/lib/update-associations.d.ts +0 -68
- package/lib/update-associations.js +0 -429
- package/lib/update-guard.d.ts +0 -36
- package/lib/update-guard.js +0 -212
- package/lib/utils.d.ts +0 -15
- package/lib/utils.js +0 -136
- package/lib/value-parsers/array-value-parser.d.ts +0 -16
- package/lib/value-parsers/array-value-parser.js +0 -67
- package/lib/value-parsers/base-value-parser.d.ts +0 -20
- package/lib/value-parsers/base-value-parser.js +0 -72
- package/lib/value-parsers/boolean-value-parser.d.ts +0 -12
- package/lib/value-parsers/boolean-value-parser.js +0 -61
- package/lib/value-parsers/date-value-parser.d.ts +0 -13
- package/lib/value-parsers/date-value-parser.js +0 -99
- package/lib/value-parsers/index.d.ts +0 -20
- package/lib/value-parsers/index.js +0 -87
- package/lib/value-parsers/json-value-parser.d.ts +0 -12
- package/lib/value-parsers/json-value-parser.js +0 -56
- package/lib/value-parsers/number-value-parser.d.ts +0 -12
- package/lib/value-parsers/number-value-parser.js +0 -67
- package/lib/value-parsers/string-value-parser.d.ts +0 -16
- package/lib/value-parsers/string-value-parser.js +0 -73
- package/lib/value-parsers/to-many-value-parser.d.ts +0 -21
- package/lib/value-parsers/to-many-value-parser.js +0 -117
- package/lib/value-parsers/to-one-value-parser.d.ts +0 -12
- package/lib/value-parsers/to-one-value-parser.js +0 -57
- package/lib/view/field-type-map.d.ts +0 -109
- package/lib/view/field-type-map.js +0 -101
- package/lib/view/view-inference.d.ts +0 -40
- package/lib/view/view-inference.js +0 -157
- package/lib/view-collection.d.ts +0 -14
- package/lib/view-collection.js +0 -54
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
var __defProp = Object.defineProperty;
|
|
11
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
15
|
-
var __export = (target, all) => {
|
|
16
|
-
for (var name in all)
|
|
17
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
18
|
-
};
|
|
19
|
-
var __copyProps = (to, from, except, desc) => {
|
|
20
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
21
|
-
for (let key of __getOwnPropNames(from))
|
|
22
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
23
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
24
|
-
}
|
|
25
|
-
return to;
|
|
26
|
-
};
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
var adjacency_list_exports = {};
|
|
29
|
-
__export(adjacency_list_exports, {
|
|
30
|
-
beforeDefineAdjacencyListCollection: () => beforeDefineAdjacencyListCollection
|
|
31
|
-
});
|
|
32
|
-
module.exports = __toCommonJS(adjacency_list_exports);
|
|
33
|
-
const beforeDefineAdjacencyListCollection = /* @__PURE__ */ __name((options) => {
|
|
34
|
-
if (!options.tree) {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
(options.fields || []).forEach((field) => {
|
|
38
|
-
if (field.treeParent || field.treeChildren) {
|
|
39
|
-
if (!field.target) {
|
|
40
|
-
field.target = options.name;
|
|
41
|
-
}
|
|
42
|
-
if (!field.foreignKey) {
|
|
43
|
-
field.foreignKey = "parentId";
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
}, "beforeDefineAdjacencyListCollection");
|
|
48
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
49
|
-
0 && (module.exports = {
|
|
50
|
-
beforeDefineAdjacencyListCollection
|
|
51
|
-
});
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
import Database from '../database';
|
|
10
|
-
export declare const appendChildCollectionNameAfterRepositoryFind: (db: Database) => ({ findOptions, dataCollection, data }: {
|
|
11
|
-
findOptions: any;
|
|
12
|
-
dataCollection: any;
|
|
13
|
-
data: any;
|
|
14
|
-
}) => void;
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
var __defProp = Object.defineProperty;
|
|
11
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
15
|
-
var __export = (target, all) => {
|
|
16
|
-
for (var name in all)
|
|
17
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
18
|
-
};
|
|
19
|
-
var __copyProps = (to, from, except, desc) => {
|
|
20
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
21
|
-
for (let key of __getOwnPropNames(from))
|
|
22
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
23
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
24
|
-
}
|
|
25
|
-
return to;
|
|
26
|
-
};
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
var append_child_collection_name_after_repository_find_exports = {};
|
|
29
|
-
__export(append_child_collection_name_after_repository_find_exports, {
|
|
30
|
-
appendChildCollectionNameAfterRepositoryFind: () => appendChildCollectionNameAfterRepositoryFind
|
|
31
|
-
});
|
|
32
|
-
module.exports = __toCommonJS(append_child_collection_name_after_repository_find_exports);
|
|
33
|
-
const setRowAttribute = /* @__PURE__ */ __name((row, attribute, value, raw) => {
|
|
34
|
-
if (raw) {
|
|
35
|
-
row[attribute] = value;
|
|
36
|
-
} else {
|
|
37
|
-
row.set(attribute, value, { raw: true });
|
|
38
|
-
}
|
|
39
|
-
}, "setRowAttribute");
|
|
40
|
-
const appendChildCollectionNameAfterRepositoryFind = /* @__PURE__ */ __name((db) => {
|
|
41
|
-
return ({ findOptions, dataCollection, data }) => {
|
|
42
|
-
if (findOptions.targetCollection) {
|
|
43
|
-
const collection = db.getCollection(findOptions.targetCollection);
|
|
44
|
-
for (const row of data) {
|
|
45
|
-
setRowAttribute(row, "__collection", collection.name, findOptions.raw);
|
|
46
|
-
setRowAttribute(row, "__schemaName", collection.collectionSchema(), findOptions.raw);
|
|
47
|
-
setRowAttribute(row, "__tableName", collection.model.tableName, findOptions.raw);
|
|
48
|
-
}
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
if (dataCollection.isParent()) {
|
|
52
|
-
for (const row of data) {
|
|
53
|
-
if (row.__collection) {
|
|
54
|
-
continue;
|
|
55
|
-
}
|
|
56
|
-
const fullTableName = findOptions.raw ? `${row["__schemaName"]}.${row["__tableName"]}` : `${row.get("__schemaName")}.${row.get("__tableName")}`;
|
|
57
|
-
const rowCollection = db.tableNameCollectionMap.get(fullTableName);
|
|
58
|
-
if (!rowCollection) {
|
|
59
|
-
db.logger.warn(
|
|
60
|
-
`Can not find collection by table name ${JSON.stringify(row)}, current collections: ${Array.from(
|
|
61
|
-
db.tableNameCollectionMap.keys()
|
|
62
|
-
).join(", ")}`
|
|
63
|
-
);
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
const rowCollectionName = rowCollection.name;
|
|
67
|
-
setRowAttribute(row, "__collection", rowCollectionName, findOptions.raw);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
}, "appendChildCollectionNameAfterRepositoryFind");
|
|
72
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
73
|
-
0 && (module.exports = {
|
|
74
|
-
appendChildCollectionNameAfterRepositoryFind
|
|
75
|
-
});
|
package/lib/listeners/index.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
import { Database } from '../database';
|
|
10
|
-
export declare const registerBuiltInListeners: (db: Database) => void;
|
package/lib/listeners/index.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
var __defProp = Object.defineProperty;
|
|
11
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
15
|
-
var __export = (target, all) => {
|
|
16
|
-
for (var name in all)
|
|
17
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
18
|
-
};
|
|
19
|
-
var __copyProps = (to, from, except, desc) => {
|
|
20
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
21
|
-
for (let key of __getOwnPropNames(from))
|
|
22
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
23
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
24
|
-
}
|
|
25
|
-
return to;
|
|
26
|
-
};
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
var listeners_exports = {};
|
|
29
|
-
__export(listeners_exports, {
|
|
30
|
-
registerBuiltInListeners: () => registerBuiltInListeners
|
|
31
|
-
});
|
|
32
|
-
module.exports = __toCommonJS(listeners_exports);
|
|
33
|
-
var import_adjacency_list = require("./adjacency-list");
|
|
34
|
-
var import_append_child_collection_name_after_repository_find = require("./append-child-collection-name-after-repository-find");
|
|
35
|
-
const registerBuiltInListeners = /* @__PURE__ */ __name((db) => {
|
|
36
|
-
db.on("beforeDefineCollection", import_adjacency_list.beforeDefineAdjacencyListCollection);
|
|
37
|
-
db.on("afterRepositoryFind", (0, import_append_child_collection_name_after_repository_find.appendChildCollectionNameAfterRepositoryFind)(db));
|
|
38
|
-
}, "registerBuiltInListeners");
|
|
39
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
40
|
-
0 && (module.exports = {
|
|
41
|
-
registerBuiltInListeners
|
|
42
|
-
});
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
import { Model } from './model';
|
|
10
|
-
export declare class MagicAttributeModel extends Model {
|
|
11
|
-
get magicAttribute(): string;
|
|
12
|
-
set(key: any, value?: any, options?: any): this;
|
|
13
|
-
setV1(key?: any, value?: any, options?: any): this;
|
|
14
|
-
get(key?: any, value?: any): any;
|
|
15
|
-
update(values?: any, options?: any): Promise<this>;
|
|
16
|
-
}
|
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
var __create = Object.create;
|
|
11
|
-
var __defProp = Object.defineProperty;
|
|
12
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
15
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
17
|
-
var __export = (target, all) => {
|
|
18
|
-
for (var name in all)
|
|
19
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
20
|
-
};
|
|
21
|
-
var __copyProps = (to, from, except, desc) => {
|
|
22
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
23
|
-
for (let key of __getOwnPropNames(from))
|
|
24
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
25
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
26
|
-
}
|
|
27
|
-
return to;
|
|
28
|
-
};
|
|
29
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
30
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
31
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
32
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
33
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
34
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
35
|
-
mod
|
|
36
|
-
));
|
|
37
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
38
|
-
var magic_attribute_model_exports = {};
|
|
39
|
-
__export(magic_attribute_model_exports, {
|
|
40
|
-
MagicAttributeModel: () => MagicAttributeModel
|
|
41
|
-
});
|
|
42
|
-
module.exports = __toCommonJS(magic_attribute_model_exports);
|
|
43
|
-
var import_utils = require("@nocobase/utils");
|
|
44
|
-
var import_lodash = __toESM(require("lodash"));
|
|
45
|
-
var import_sequelize = require("sequelize");
|
|
46
|
-
var import_model = require("./model");
|
|
47
|
-
const Dottie = require("dottie");
|
|
48
|
-
const _MagicAttributeModel = class _MagicAttributeModel extends import_model.Model {
|
|
49
|
-
get magicAttribute() {
|
|
50
|
-
const db = this.constructor.database;
|
|
51
|
-
const collection = db.getCollection(this.constructor.name);
|
|
52
|
-
return collection.options.magicAttribute || "options";
|
|
53
|
-
}
|
|
54
|
-
set(key, value, options) {
|
|
55
|
-
if (typeof key === "string") {
|
|
56
|
-
const [column] = key.split(".");
|
|
57
|
-
if (this.constructor.hasAlias(column)) {
|
|
58
|
-
return this.setV1(key, value, options);
|
|
59
|
-
}
|
|
60
|
-
if (this.constructor.rawAttributes[column]) {
|
|
61
|
-
return this.setV1(key, value, options);
|
|
62
|
-
}
|
|
63
|
-
if (import_lodash.default.isPlainObject(value)) {
|
|
64
|
-
const opts = super.get(this.magicAttribute) || {};
|
|
65
|
-
return this.setV1(`${this.magicAttribute}.${key}`, (0, import_utils.merge)(opts == null ? void 0 : opts[key], value), options);
|
|
66
|
-
}
|
|
67
|
-
return this.setV1(`${this.magicAttribute}.${key}`, value, options);
|
|
68
|
-
} else {
|
|
69
|
-
if (!key) {
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
Object.keys(key).forEach((k) => {
|
|
73
|
-
this.setV1(k, key[k], options);
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
return this.setV1(key, value, options);
|
|
77
|
-
}
|
|
78
|
-
setV1(key, value, options) {
|
|
79
|
-
let values;
|
|
80
|
-
let originalValue;
|
|
81
|
-
if (typeof key === "object" && key !== null) {
|
|
82
|
-
values = key;
|
|
83
|
-
options = value || {};
|
|
84
|
-
if (options.reset) {
|
|
85
|
-
this.dataValues = {};
|
|
86
|
-
for (const key2 in values) {
|
|
87
|
-
this.changed(key2, false);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
if (options.raw && // @ts-ignore
|
|
91
|
-
!(this._options && this._options.include) && !(options && options.attributes) && // @ts-ignore
|
|
92
|
-
!this.constructor._hasDateAttributes && // @ts-ignore
|
|
93
|
-
!this.constructor._hasBooleanAttributes) {
|
|
94
|
-
if (Object.keys(this.dataValues).length) {
|
|
95
|
-
Object.assign(this.dataValues, values);
|
|
96
|
-
} else {
|
|
97
|
-
this.dataValues = values;
|
|
98
|
-
}
|
|
99
|
-
this._previousDataValues = { ...this.dataValues };
|
|
100
|
-
} else {
|
|
101
|
-
if (options.attributes) {
|
|
102
|
-
const setKeys = /* @__PURE__ */ __name((data) => {
|
|
103
|
-
for (const k of data) {
|
|
104
|
-
if (values[k] === void 0) {
|
|
105
|
-
continue;
|
|
106
|
-
}
|
|
107
|
-
this.set(k, values[k], options);
|
|
108
|
-
}
|
|
109
|
-
}, "setKeys");
|
|
110
|
-
setKeys(options.attributes);
|
|
111
|
-
if (this.constructor._hasVirtualAttributes) {
|
|
112
|
-
setKeys(this.constructor._virtualAttributes);
|
|
113
|
-
}
|
|
114
|
-
if (this._options.includeNames) {
|
|
115
|
-
setKeys(this._options.includeNames);
|
|
116
|
-
}
|
|
117
|
-
} else {
|
|
118
|
-
for (const key2 in values) {
|
|
119
|
-
this.set(key2, values[key2], options);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
if (options.raw) {
|
|
123
|
-
this._previousDataValues = { ...this.dataValues };
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
return this;
|
|
127
|
-
}
|
|
128
|
-
if (!options)
|
|
129
|
-
options = {};
|
|
130
|
-
if (!options.raw) {
|
|
131
|
-
originalValue = this.dataValues[key];
|
|
132
|
-
}
|
|
133
|
-
if (!options.raw && this._customSetters[key]) {
|
|
134
|
-
this._customSetters[key].call(this, value, key);
|
|
135
|
-
const newValue = this.dataValues[key];
|
|
136
|
-
if (!import_lodash.default.isEqual(newValue, originalValue)) {
|
|
137
|
-
this._previousDataValues[key] = originalValue;
|
|
138
|
-
this.changed(key, true);
|
|
139
|
-
}
|
|
140
|
-
} else {
|
|
141
|
-
if (this._options && this._options.include && this._options.includeNames.includes(key)) {
|
|
142
|
-
this._setInclude(key, value, options);
|
|
143
|
-
return this;
|
|
144
|
-
}
|
|
145
|
-
if (!options.raw) {
|
|
146
|
-
if (!this._isAttribute(key)) {
|
|
147
|
-
if (key.includes(".") && this.constructor._jsonAttributes.has(key.split(".")[0])) {
|
|
148
|
-
const previousNestedValue = Dottie.get(this.dataValues, key);
|
|
149
|
-
if (!import_lodash.default.isEqual(previousNestedValue, value)) {
|
|
150
|
-
this._previousDataValues = import_lodash.default.cloneDeep(this._previousDataValues);
|
|
151
|
-
Dottie.set(this.dataValues, key, value);
|
|
152
|
-
this.changed(key.split(".")[0], true);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
return this;
|
|
156
|
-
}
|
|
157
|
-
if (this.constructor._hasPrimaryKeys && originalValue && this.constructor._isPrimaryKey(key)) {
|
|
158
|
-
return this;
|
|
159
|
-
}
|
|
160
|
-
if (!this.isNewRecord && // @ts-ignore
|
|
161
|
-
this.constructor._hasReadOnlyAttributes && // @ts-ignore
|
|
162
|
-
this.constructor._readOnlyAttributes.has(key)) {
|
|
163
|
-
return this;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
if (!(value instanceof import_sequelize.Utils.SequelizeMethod) && // @ts-ignore
|
|
167
|
-
Object.prototype.hasOwnProperty.call(this.constructor._dataTypeSanitizers, key)) {
|
|
168
|
-
value = this.constructor._dataTypeSanitizers[key].call(this, value, options);
|
|
169
|
-
}
|
|
170
|
-
if (!options.raw && // True when sequelize method
|
|
171
|
-
(value instanceof import_sequelize.Utils.SequelizeMethod || // Check for data type type comparators
|
|
172
|
-
// @ts-ignore
|
|
173
|
-
!(value instanceof import_sequelize.Utils.SequelizeMethod) && // @ts-ignore
|
|
174
|
-
this.constructor._dataTypeChanges[key] && // @ts-ignore
|
|
175
|
-
this.constructor._dataTypeChanges[key].call(this, value, originalValue, options) || // Check default
|
|
176
|
-
// @ts-ignore
|
|
177
|
-
!this.constructor._dataTypeChanges[key] && !import_lodash.default.isEqual(value, originalValue))) {
|
|
178
|
-
this._previousDataValues[key] = originalValue;
|
|
179
|
-
this.changed(key, true);
|
|
180
|
-
}
|
|
181
|
-
this.dataValues[key] = value;
|
|
182
|
-
}
|
|
183
|
-
return this;
|
|
184
|
-
}
|
|
185
|
-
get(key, value) {
|
|
186
|
-
if (typeof key === "string") {
|
|
187
|
-
const [column] = key.split(".");
|
|
188
|
-
if (this.constructor.hasAlias(column)) {
|
|
189
|
-
return super.get(key, value);
|
|
190
|
-
}
|
|
191
|
-
if (this.constructor.rawAttributes[column]) {
|
|
192
|
-
return super.get(key, value);
|
|
193
|
-
}
|
|
194
|
-
const options = super.get(this.magicAttribute, value);
|
|
195
|
-
return import_lodash.default.get(options, key);
|
|
196
|
-
}
|
|
197
|
-
const data = super.get(key, value);
|
|
198
|
-
return {
|
|
199
|
-
...import_lodash.default.omit(data, this.magicAttribute),
|
|
200
|
-
...data[this.magicAttribute]
|
|
201
|
-
};
|
|
202
|
-
}
|
|
203
|
-
async update(values, options) {
|
|
204
|
-
this._changed = /* @__PURE__ */ new Set();
|
|
205
|
-
return super.update(values, options);
|
|
206
|
-
}
|
|
207
|
-
};
|
|
208
|
-
__name(_MagicAttributeModel, "MagicAttributeModel");
|
|
209
|
-
let MagicAttributeModel = _MagicAttributeModel;
|
|
210
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
211
|
-
0 && (module.exports = {
|
|
212
|
-
MagicAttributeModel
|
|
213
|
-
});
|
package/lib/migration.d.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
import { QueryInterface, Sequelize } from 'sequelize';
|
|
10
|
-
import Database from './database';
|
|
11
|
-
export interface MigrationContext {
|
|
12
|
-
db: Database;
|
|
13
|
-
queryInterface: QueryInterface;
|
|
14
|
-
sequelize: Sequelize;
|
|
15
|
-
}
|
|
16
|
-
export declare class Migration {
|
|
17
|
-
name: string;
|
|
18
|
-
context: {
|
|
19
|
-
db: Database;
|
|
20
|
-
[key: string]: any;
|
|
21
|
-
};
|
|
22
|
-
constructor(context: MigrationContext);
|
|
23
|
-
get db(): Database;
|
|
24
|
-
get sequelize(): Sequelize;
|
|
25
|
-
get queryInterface(): QueryInterface;
|
|
26
|
-
up(): Promise<void>;
|
|
27
|
-
down(): Promise<void>;
|
|
28
|
-
}
|
|
29
|
-
export interface MigrationItem {
|
|
30
|
-
name: string;
|
|
31
|
-
migration?: typeof Migration | string;
|
|
32
|
-
context?: any;
|
|
33
|
-
up?: any;
|
|
34
|
-
down?: any;
|
|
35
|
-
}
|
|
36
|
-
export declare class Migrations {
|
|
37
|
-
items: any[];
|
|
38
|
-
context: any;
|
|
39
|
-
constructor(context: any);
|
|
40
|
-
clear(): void;
|
|
41
|
-
add(item: MigrationItem): void;
|
|
42
|
-
callback(): (ctx: any) => Promise<any[]>;
|
|
43
|
-
}
|
package/lib/migration.js
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
var __create = Object.create;
|
|
11
|
-
var __defProp = Object.defineProperty;
|
|
12
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
15
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
17
|
-
var __export = (target, all) => {
|
|
18
|
-
for (var name in all)
|
|
19
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
20
|
-
};
|
|
21
|
-
var __copyProps = (to, from, except, desc) => {
|
|
22
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
23
|
-
for (let key of __getOwnPropNames(from))
|
|
24
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
25
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
26
|
-
}
|
|
27
|
-
return to;
|
|
28
|
-
};
|
|
29
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
30
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
31
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
32
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
33
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
34
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
35
|
-
mod
|
|
36
|
-
));
|
|
37
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
38
|
-
var migration_exports = {};
|
|
39
|
-
__export(migration_exports, {
|
|
40
|
-
Migration: () => Migration,
|
|
41
|
-
Migrations: () => Migrations
|
|
42
|
-
});
|
|
43
|
-
module.exports = __toCommonJS(migration_exports);
|
|
44
|
-
var import_utils = require("@nocobase/utils");
|
|
45
|
-
var import_lodash = __toESM(require("lodash"));
|
|
46
|
-
const _Migration = class _Migration {
|
|
47
|
-
name;
|
|
48
|
-
context;
|
|
49
|
-
constructor(context) {
|
|
50
|
-
this.context = context;
|
|
51
|
-
}
|
|
52
|
-
get db() {
|
|
53
|
-
return this.context.db;
|
|
54
|
-
}
|
|
55
|
-
get sequelize() {
|
|
56
|
-
return this.context.db.sequelize;
|
|
57
|
-
}
|
|
58
|
-
get queryInterface() {
|
|
59
|
-
return this.context.db.sequelize.getQueryInterface();
|
|
60
|
-
}
|
|
61
|
-
async up() {
|
|
62
|
-
}
|
|
63
|
-
async down() {
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
__name(_Migration, "Migration");
|
|
67
|
-
let Migration = _Migration;
|
|
68
|
-
const _Migrations = class _Migrations {
|
|
69
|
-
items = [];
|
|
70
|
-
context;
|
|
71
|
-
constructor(context) {
|
|
72
|
-
this.context = context;
|
|
73
|
-
}
|
|
74
|
-
clear() {
|
|
75
|
-
this.items = [];
|
|
76
|
-
}
|
|
77
|
-
add(item) {
|
|
78
|
-
const Migration2 = item.migration;
|
|
79
|
-
if (Migration2 && typeof Migration2 === "function") {
|
|
80
|
-
const migration = new Migration2({ ...this.context, ...item.context });
|
|
81
|
-
migration.name = item.name;
|
|
82
|
-
this.items.push(migration);
|
|
83
|
-
} else {
|
|
84
|
-
this.items.push(item);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
callback() {
|
|
88
|
-
return async (ctx) => {
|
|
89
|
-
return await Promise.all(
|
|
90
|
-
import_lodash.default.sortBy(this.items, (item) => {
|
|
91
|
-
const keys = item.name.split("/");
|
|
92
|
-
return keys.pop() || item.name;
|
|
93
|
-
}).map(async (item) => {
|
|
94
|
-
if (typeof item.migration === "string") {
|
|
95
|
-
const Migration2 = await (0, import_utils.importModule)(item.migration);
|
|
96
|
-
const migration = new Migration2({ ...this.context, ...item.context });
|
|
97
|
-
migration.name = item.name;
|
|
98
|
-
return migration;
|
|
99
|
-
}
|
|
100
|
-
return item;
|
|
101
|
-
})
|
|
102
|
-
);
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
__name(_Migrations, "Migrations");
|
|
107
|
-
let Migrations = _Migrations;
|
|
108
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
109
|
-
0 && (module.exports = {
|
|
110
|
-
Migration,
|
|
111
|
-
Migrations
|
|
112
|
-
});
|
package/lib/mock-database.d.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
import { Database, IDatabaseOptions } from './database';
|
|
10
|
-
export declare class MockDatabase extends Database {
|
|
11
|
-
constructor(options: IDatabaseOptions);
|
|
12
|
-
}
|
|
13
|
-
export declare function getConfigByEnv(): {
|
|
14
|
-
username: string;
|
|
15
|
-
password: string;
|
|
16
|
-
database: string;
|
|
17
|
-
host: string;
|
|
18
|
-
port: string;
|
|
19
|
-
dialect: string;
|
|
20
|
-
logging: boolean | typeof customLogger;
|
|
21
|
-
storage: string;
|
|
22
|
-
define: {
|
|
23
|
-
charset: string;
|
|
24
|
-
collate: string;
|
|
25
|
-
};
|
|
26
|
-
timezone: string;
|
|
27
|
-
underscored: boolean;
|
|
28
|
-
schema: string;
|
|
29
|
-
dialectOptions: {};
|
|
30
|
-
};
|
|
31
|
-
declare function customLogger(queryString: any, queryObject: any): void;
|
|
32
|
-
export declare function mockDatabase(options?: IDatabaseOptions): MockDatabase;
|
|
33
|
-
export {};
|