@nocobase/database 1.2.12-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,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 __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 database_utils_exports = {};
|
|
39
|
-
__export(database_utils_exports, {
|
|
40
|
-
default: () => DatabaseUtils
|
|
41
|
-
});
|
|
42
|
-
module.exports = __toCommonJS(database_utils_exports);
|
|
43
|
-
var import_lodash = __toESM(require("lodash"));
|
|
44
|
-
const _DatabaseUtils = class _DatabaseUtils {
|
|
45
|
-
constructor(db) {
|
|
46
|
-
this.db = db;
|
|
47
|
-
}
|
|
48
|
-
addSchema(tableName, schema) {
|
|
49
|
-
if (!this.db.inDialect("postgres"))
|
|
50
|
-
return tableName;
|
|
51
|
-
if (this.db.options.schema && !schema) {
|
|
52
|
-
schema = this.db.options.schema;
|
|
53
|
-
}
|
|
54
|
-
if (schema) {
|
|
55
|
-
tableName = this.db.sequelize.getQueryInterface().queryGenerator.addSchema({
|
|
56
|
-
tableName,
|
|
57
|
-
_schema: schema
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
return tableName;
|
|
61
|
-
}
|
|
62
|
-
quoteTable(tableName) {
|
|
63
|
-
const queryGenerator = this.db.sequelize.getQueryInterface().queryGenerator;
|
|
64
|
-
tableName = queryGenerator.quoteTable(import_lodash.default.isPlainObject(tableName) ? tableName : this.addSchema(tableName));
|
|
65
|
-
return tableName;
|
|
66
|
-
}
|
|
67
|
-
schema() {
|
|
68
|
-
if (!this.db.inDialect("postgres")) {
|
|
69
|
-
return void 0;
|
|
70
|
-
}
|
|
71
|
-
return this.db.options.schema || "public";
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
__name(_DatabaseUtils, "DatabaseUtils");
|
|
75
|
-
let DatabaseUtils = _DatabaseUtils;
|
package/lib/database.d.ts
DELETED
|
@@ -1,228 +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
|
-
/// <reference types="node" />
|
|
10
|
-
import { Logger, LoggerOptions } from '@nocobase/logger';
|
|
11
|
-
import { AsyncEmitter } from '@nocobase/utils';
|
|
12
|
-
import merge from 'deepmerge';
|
|
13
|
-
import { EventEmitter } from 'events';
|
|
14
|
-
import { ModelStatic, Options, QueryInterfaceDropAllTablesOptions, QueryOptions, Sequelize, SyncOptions, Transactionable } from 'sequelize';
|
|
15
|
-
import { Umzug } from 'umzug';
|
|
16
|
-
import { Collection, CollectionOptions, RepositoryType } from './collection';
|
|
17
|
-
import { CollectionFactory } from './collection-factory';
|
|
18
|
-
import { CollectionGroupManager } from './collection-group-manager';
|
|
19
|
-
import { ImportFileExtension } from './collection-importer';
|
|
20
|
-
import DatabaseUtils from './database-utils';
|
|
21
|
-
import ReferencesMap from './features/references-map';
|
|
22
|
-
import { ArrayFieldRepository } from './field-repository/array-field-repository';
|
|
23
|
-
import * as FieldTypes from './fields';
|
|
24
|
-
import { Field, FieldContext, RelationField } from './fields';
|
|
25
|
-
import InheritanceMap from './inherited-map';
|
|
26
|
-
import { InterfaceManager } from './interface-manager';
|
|
27
|
-
import { MigrationItem, Migrations } from './migration';
|
|
28
|
-
import { Model } from './model';
|
|
29
|
-
import { ModelHook } from './model-hook';
|
|
30
|
-
import QueryInterface from './query-interface/query-interface';
|
|
31
|
-
import { RelationRepository } from './relation-repository/relation-repository';
|
|
32
|
-
import { Repository } from './repository';
|
|
33
|
-
import { AfterDefineCollectionListener, BeforeDefineCollectionListener, CreateListener, CreateWithAssociationsListener, DatabaseAfterDefineCollectionEventType, DatabaseAfterRemoveCollectionEventType, DatabaseBeforeDefineCollectionEventType, DatabaseBeforeRemoveCollectionEventType, DestroyListener, EventType, ModelCreateEventTypes, ModelCreateWithAssociationsEventTypes, ModelDestroyEventTypes, ModelSaveEventTypes, ModelSaveWithAssociationsEventTypes, ModelUpdateEventTypes, ModelUpdateWithAssociationsEventTypes, ModelValidateEventTypes, RemoveCollectionListener, SaveListener, SaveWithAssociationsListener, SyncListener, UpdateListener, UpdateWithAssociationsListener, ValidateListener } from './types';
|
|
34
|
-
import { BaseValueParser } from './value-parsers';
|
|
35
|
-
export type MergeOptions = merge.Options;
|
|
36
|
-
export interface PendingOptions {
|
|
37
|
-
field: RelationField;
|
|
38
|
-
model: ModelStatic<Model>;
|
|
39
|
-
}
|
|
40
|
-
interface MapOf<T> {
|
|
41
|
-
[key: string]: T;
|
|
42
|
-
}
|
|
43
|
-
export interface IDatabaseOptions extends Options {
|
|
44
|
-
tablePrefix?: string;
|
|
45
|
-
migrator?: any;
|
|
46
|
-
usingBigIntForId?: boolean;
|
|
47
|
-
underscored?: boolean;
|
|
48
|
-
logger?: LoggerOptions | Logger;
|
|
49
|
-
customHooks?: any;
|
|
50
|
-
instanceId?: string;
|
|
51
|
-
}
|
|
52
|
-
export type DatabaseOptions = IDatabaseOptions;
|
|
53
|
-
interface RegisterOperatorsContext {
|
|
54
|
-
db?: Database;
|
|
55
|
-
path?: string;
|
|
56
|
-
field?: Field;
|
|
57
|
-
app?: any;
|
|
58
|
-
}
|
|
59
|
-
export interface CleanOptions extends QueryInterfaceDropAllTablesOptions {
|
|
60
|
-
drop?: boolean;
|
|
61
|
-
}
|
|
62
|
-
export type AddMigrationsOptions = {
|
|
63
|
-
context?: any;
|
|
64
|
-
namespace?: string;
|
|
65
|
-
extensions?: string[];
|
|
66
|
-
directory: string;
|
|
67
|
-
};
|
|
68
|
-
type OperatorFunc = (value: any, ctx?: RegisterOperatorsContext) => any;
|
|
69
|
-
export declare const DialectVersionAccessors: {
|
|
70
|
-
sqlite: {
|
|
71
|
-
sql: string;
|
|
72
|
-
get: (v: string) => string;
|
|
73
|
-
};
|
|
74
|
-
mysql: {
|
|
75
|
-
sql: string;
|
|
76
|
-
get: (v: string) => string;
|
|
77
|
-
};
|
|
78
|
-
mariadb: {
|
|
79
|
-
sql: string;
|
|
80
|
-
get: (v: string) => string;
|
|
81
|
-
};
|
|
82
|
-
postgres: {
|
|
83
|
-
sql: string;
|
|
84
|
-
get: (v: string) => string;
|
|
85
|
-
};
|
|
86
|
-
};
|
|
87
|
-
export declare class Database extends EventEmitter implements AsyncEmitter {
|
|
88
|
-
sequelize: Sequelize;
|
|
89
|
-
migrator: Umzug;
|
|
90
|
-
migrations: Migrations;
|
|
91
|
-
fieldTypes: Map<any, any>;
|
|
92
|
-
fieldValueParsers: Map<any, any>;
|
|
93
|
-
options: IDatabaseOptions;
|
|
94
|
-
models: Map<string, ModelStatic<Model<any, any>>>;
|
|
95
|
-
repositories: Map<string, typeof Repository>;
|
|
96
|
-
operators: Map<any, any>;
|
|
97
|
-
collections: Map<string, Collection<any, any>>;
|
|
98
|
-
pendingFields: Map<string, FieldTypes.RelationField[]>;
|
|
99
|
-
modelCollection: Map<ModelStatic<any>, Collection<any, any>>;
|
|
100
|
-
tableNameCollectionMap: Map<string, Collection<any, any>>;
|
|
101
|
-
context: any;
|
|
102
|
-
queryInterface: QueryInterface;
|
|
103
|
-
utils: DatabaseUtils;
|
|
104
|
-
referenceMap: ReferencesMap;
|
|
105
|
-
inheritanceMap: InheritanceMap;
|
|
106
|
-
importedFrom: Map<string, Set<string>>;
|
|
107
|
-
modelHook: ModelHook;
|
|
108
|
-
delayCollectionExtend: Map<string, {
|
|
109
|
-
collectionOptions: CollectionOptions;
|
|
110
|
-
mergeOptions?: any;
|
|
111
|
-
}[]>;
|
|
112
|
-
logger: Logger;
|
|
113
|
-
collectionGroupManager: CollectionGroupManager;
|
|
114
|
-
interfaceManager: InterfaceManager;
|
|
115
|
-
collectionFactory: CollectionFactory;
|
|
116
|
-
emitAsync: (event: string | symbol, ...args: any[]) => Promise<boolean>;
|
|
117
|
-
constructor(options: DatabaseOptions);
|
|
118
|
-
_instanceId: string;
|
|
119
|
-
get instanceId(): string;
|
|
120
|
-
/**
|
|
121
|
-
* @internal
|
|
122
|
-
*/
|
|
123
|
-
createMigrator({ migrations }: {
|
|
124
|
-
migrations: any;
|
|
125
|
-
}): Umzug<any>;
|
|
126
|
-
/**
|
|
127
|
-
* @internal
|
|
128
|
-
*/
|
|
129
|
-
setContext(context: any): void;
|
|
130
|
-
/**
|
|
131
|
-
* @internal
|
|
132
|
-
*/
|
|
133
|
-
sequelizeOptions(options: any): any;
|
|
134
|
-
/**
|
|
135
|
-
* @internal
|
|
136
|
-
*/
|
|
137
|
-
initListener(): void;
|
|
138
|
-
addMigration(item: MigrationItem): void;
|
|
139
|
-
addMigrations(options: AddMigrationsOptions): void;
|
|
140
|
-
inDialect(...dialect: string[]): boolean;
|
|
141
|
-
isMySQLCompatibleDialect(): boolean;
|
|
142
|
-
/**
|
|
143
|
-
* Add collection to database
|
|
144
|
-
* @param options
|
|
145
|
-
*/
|
|
146
|
-
collection<Attributes = any, CreateAttributes = Attributes>(options: CollectionOptions): Collection<Attributes, CreateAttributes>;
|
|
147
|
-
getTablePrefix(): string;
|
|
148
|
-
getFieldByPath(path: string): any;
|
|
149
|
-
/**
|
|
150
|
-
* get exists collection by its name
|
|
151
|
-
* @param name
|
|
152
|
-
*/
|
|
153
|
-
getCollection(name: string): Collection;
|
|
154
|
-
hasCollection(name: string): boolean;
|
|
155
|
-
removeCollection(name: string): Collection<any, any>;
|
|
156
|
-
getModel<M extends Model>(name: string): ModelStatic<M>;
|
|
157
|
-
getRepository<R extends Repository>(name: string): R;
|
|
158
|
-
getRepository<R extends RelationRepository>(name: string, relationId: string | number): R;
|
|
159
|
-
getRepository<R extends ArrayFieldRepository>(name: string, relationId: string | number): R;
|
|
160
|
-
/**
|
|
161
|
-
* @internal
|
|
162
|
-
*/
|
|
163
|
-
addPendingField(field: RelationField): void;
|
|
164
|
-
/**
|
|
165
|
-
* @internal
|
|
166
|
-
*/
|
|
167
|
-
removePendingField(field: RelationField): void;
|
|
168
|
-
registerFieldTypes(fieldTypes: MapOf<typeof Field>): void;
|
|
169
|
-
registerFieldValueParsers(parsers: MapOf<any>): void;
|
|
170
|
-
buildFieldValueParser<T extends BaseValueParser>(field: Field, ctx: any): T;
|
|
171
|
-
registerModels(models: MapOf<ModelStatic<any>>): void;
|
|
172
|
-
registerRepositories(repositories: MapOf<RepositoryType>): void;
|
|
173
|
-
/**
|
|
174
|
-
* @internal
|
|
175
|
-
*/
|
|
176
|
-
initOperators(): void;
|
|
177
|
-
registerOperators(operators: MapOf<OperatorFunc>): void;
|
|
178
|
-
/**
|
|
179
|
-
* @internal
|
|
180
|
-
*/
|
|
181
|
-
buildField(options: any, context: FieldContext): any;
|
|
182
|
-
sync(options?: SyncOptions): Promise<Sequelize>;
|
|
183
|
-
clean(options: CleanOptions): Promise<void>;
|
|
184
|
-
collectionExistsInDb(name: string, options?: Transactionable): Promise<boolean>;
|
|
185
|
-
isSqliteMemory(): boolean;
|
|
186
|
-
auth(options?: Omit<QueryOptions, 'retry'> & {
|
|
187
|
-
retry?: number | Pick<QueryOptions, 'retry'>;
|
|
188
|
-
}): Promise<void>;
|
|
189
|
-
/**
|
|
190
|
-
* @internal
|
|
191
|
-
*/
|
|
192
|
-
checkVersion(): Promise<boolean>;
|
|
193
|
-
/**
|
|
194
|
-
* @internal
|
|
195
|
-
*/
|
|
196
|
-
prepare(): Promise<void>;
|
|
197
|
-
reconnect(): Promise<void>;
|
|
198
|
-
closed(): any;
|
|
199
|
-
close(): Promise<void>;
|
|
200
|
-
on(event: EventType, listener: any): this;
|
|
201
|
-
on(event: ModelValidateEventTypes, listener: SyncListener): this;
|
|
202
|
-
on(event: ModelValidateEventTypes, listener: ValidateListener): this;
|
|
203
|
-
on(event: ModelCreateEventTypes, listener: CreateListener): this;
|
|
204
|
-
on(event: ModelUpdateEventTypes, listener: UpdateListener): this;
|
|
205
|
-
on(event: ModelSaveEventTypes, listener: SaveListener): this;
|
|
206
|
-
on(event: ModelDestroyEventTypes, listener: DestroyListener): this;
|
|
207
|
-
on(event: ModelCreateWithAssociationsEventTypes, listener: CreateWithAssociationsListener): this;
|
|
208
|
-
on(event: ModelUpdateWithAssociationsEventTypes, listener: UpdateWithAssociationsListener): this;
|
|
209
|
-
on(event: ModelSaveWithAssociationsEventTypes, listener: SaveWithAssociationsListener): this;
|
|
210
|
-
on(event: DatabaseBeforeDefineCollectionEventType, listener: BeforeDefineCollectionListener): this;
|
|
211
|
-
on(event: DatabaseAfterDefineCollectionEventType, listener: AfterDefineCollectionListener): this;
|
|
212
|
-
on(event: DatabaseBeforeRemoveCollectionEventType | DatabaseAfterRemoveCollectionEventType, listener: RemoveCollectionListener): this;
|
|
213
|
-
extendCollection(collectionOptions: CollectionOptions, mergeOptions?: MergeOptions): void;
|
|
214
|
-
import(options: {
|
|
215
|
-
directory: string;
|
|
216
|
-
from?: string;
|
|
217
|
-
extensions?: ImportFileExtension[];
|
|
218
|
-
}): Promise<Map<string, Collection>>;
|
|
219
|
-
private registerCollectionType;
|
|
220
|
-
}
|
|
221
|
-
export declare function extendCollection(collectionOptions: CollectionOptions, mergeOptions?: MergeOptions): {
|
|
222
|
-
collectionOptions: CollectionOptions;
|
|
223
|
-
mergeOptions: merge.Options;
|
|
224
|
-
extend: boolean;
|
|
225
|
-
};
|
|
226
|
-
export declare const extend: typeof extendCollection;
|
|
227
|
-
export declare const defineCollection: (collectionOptions: CollectionOptions) => CollectionOptions;
|
|
228
|
-
export default Database;
|