@nocobase/database 0.11.0-alpha.1 → 0.11.1-alpha.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.
- package/lib/collection.d.ts +1 -0
- package/lib/collection.js +2 -2
- package/lib/database.d.ts +4 -4
- package/lib/database.js +4 -4
- package/lib/decorators/must-have-filter-decorator.js +4 -4
- package/lib/decorators/target-collection-decorator.d.ts +2 -0
- package/lib/decorators/target-collection-decorator.js +28 -0
- package/lib/eager-loading/eager-loading-tree.d.ts +1 -0
- package/lib/eager-loading/eager-loading-tree.js +25 -12
- package/lib/fields/field.d.ts +1 -0
- package/lib/inherited-collection.d.ts +1 -1
- package/lib/inherited-collection.js +1 -1
- package/lib/listeners/append-child-collection-name-after-repository-find.d.ts +2 -1
- package/lib/listeners/append-child-collection-name-after-repository-find.js +31 -6
- package/lib/options-parser.js +21 -8
- package/lib/query-interface/mysql-query-interface.d.ts +4 -2
- package/lib/query-interface/mysql-query-interface.js +19 -10
- package/lib/query-interface/postgres-query-interface.d.ts +3 -1
- package/lib/query-interface/postgres-query-interface.js +38 -12
- package/lib/query-interface/query-interface.d.ts +4 -2
- package/lib/query-interface/sqlite-query-interface.d.ts +3 -1
- package/lib/query-interface/sqlite-query-interface.js +22 -11
- package/lib/relation-repository/belongs-to-many-repository.d.ts +3 -19
- package/lib/relation-repository/belongs-to-repository.d.ts +5 -15
- package/lib/relation-repository/belongs-to-repository.js +14 -1
- package/lib/relation-repository/hasmany-repository.d.ts +3 -16
- package/lib/relation-repository/hasone-repository.d.ts +5 -14
- package/lib/relation-repository/hasone-repository.js +9 -1
- package/lib/relation-repository/multiple-relation-repository.js +22 -43
- package/lib/relation-repository/single-relation-repository.d.ts +2 -0
- package/lib/relation-repository/single-relation-repository.js +13 -28
- package/lib/{tree-repository → repositories/tree-repository}/adjacency-list-repository.d.ts +1 -1
- package/lib/{tree-repository → repositories/tree-repository}/adjacency-list-repository.js +8 -10
- package/lib/repositories/view-repository.d.ts +3 -0
- package/lib/repositories/view-repository.js +9 -0
- package/lib/repository.d.ts +6 -2
- package/lib/repository.js +10 -9
- package/lib/sql-parser/postgres.js +672 -37
- package/lib/update-associations.js +167 -175
- package/lib/value-parsers/string-value-parser.js +8 -3
- package/lib/view/view-inference.js +1 -1
- package/lib/view-collection.d.ts +1 -1
- package/lib/view-collection.js +3 -3
- package/package.json +5 -4
- package/src/__tests__/relation-repository/belongs-to-many-repository.test.ts +8 -4
- package/src/__tests__/repository.test.ts +31 -0
- package/src/__tests__/tree.test.ts +1 -1
- package/src/__tests__/view/view-collection.test.ts +109 -3
- package/src/__tests__/view/view-inference.test.ts +0 -1
- package/src/collection.ts +4 -5
- package/src/database.ts +6 -7
- package/src/decorators/must-have-filter-decorator.ts +4 -4
- package/src/decorators/target-collection-decorator.ts +20 -0
- package/src/eager-loading/eager-loading-tree.ts +23 -5
- package/src/fields/field.ts +1 -1
- package/src/inherited-collection.ts +1 -1
- package/src/listeners/append-child-collection-name-after-repository-find.ts +25 -7
- package/src/options-parser.ts +9 -0
- package/src/query-interface/mysql-query-interface.ts +16 -9
- package/src/query-interface/postgres-query-interface.ts +22 -10
- package/src/query-interface/query-interface.ts +6 -2
- package/src/query-interface/sqlite-query-interface.ts +25 -15
- package/src/relation-repository/belongs-to-many-repository.ts +3 -40
- package/src/relation-repository/belongs-to-repository.ts +10 -18
- package/src/relation-repository/hasmany-repository.ts +3 -32
- package/src/relation-repository/hasone-repository.ts +11 -19
- package/src/relation-repository/multiple-relation-repository.ts +23 -58
- package/src/relation-repository/single-relation-repository.ts +16 -33
- package/src/{tree-repository → repositories/tree-repository}/adjacency-list-repository.ts +8 -10
- package/src/repositories/view-repository.ts +3 -0
- package/src/repository.ts +18 -12
- package/src/sql-parser/postgres.js +14289 -12149
- package/src/update-associations.ts +146 -154
- package/src/value-parsers/string-value-parser.ts +8 -3
- package/src/view/view-inference.ts +2 -1
- package/src/view-collection.ts +4 -4
package/lib/collection.d.ts
CHANGED
|
@@ -30,6 +30,7 @@ export interface CollectionOptions extends Omit<ModelOptions, 'name' | 'hooks'>
|
|
|
30
30
|
tableName?: string;
|
|
31
31
|
inherits?: string[] | string;
|
|
32
32
|
viewName?: string;
|
|
33
|
+
writableView?: boolean;
|
|
33
34
|
filterTargetKey?: string;
|
|
34
35
|
fields?: FieldOptions[];
|
|
35
36
|
model?: string | ModelStatic<Model>;
|
package/lib/collection.js
CHANGED
|
@@ -33,9 +33,9 @@ function _sequelize() {
|
|
|
33
33
|
return data;
|
|
34
34
|
}
|
|
35
35
|
var _model = require("./model");
|
|
36
|
+
var _adjacencyListRepository = require("./repositories/tree-repository/adjacency-list-repository");
|
|
36
37
|
var _repository = require("./repository");
|
|
37
38
|
var _utils = require("./utils");
|
|
38
|
-
var _adjacencyListRepository = require("./tree-repository/adjacency-list-repository");
|
|
39
39
|
const _excluded = ["name"],
|
|
40
40
|
_excluded2 = ["name"];
|
|
41
41
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -243,7 +243,7 @@ class Collection extends _events().EventEmitter {
|
|
|
243
243
|
if (!sourceField) {
|
|
244
244
|
this.db.logger.warn(`source field "${sourceFieldName}" not found for field "${name}" at collection "${this.name}"`);
|
|
245
245
|
} else {
|
|
246
|
-
options = _objectSpread(_objectSpread({}, sourceField.options), options);
|
|
246
|
+
options = _objectSpread(_objectSpread({}, _lodash().default.omit(sourceField.options, 'name')), options);
|
|
247
247
|
}
|
|
248
248
|
}
|
|
249
249
|
this.emit('field.beforeAdd', name, options, {
|
package/lib/database.d.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
import { Logger } from '@nocobase/logger';
|
|
2
3
|
import { AsyncEmitter } from '@nocobase/utils';
|
|
3
4
|
import merge from 'deepmerge';
|
|
4
5
|
import { EventEmitter } from 'events';
|
|
5
6
|
import { ModelStatic, Options, QueryInterfaceDropAllTablesOptions, QueryOptions, Sequelize, SyncOptions, Transactionable } from 'sequelize';
|
|
6
7
|
import { Umzug } from 'umzug';
|
|
7
8
|
import { Collection, CollectionOptions, RepositoryType } from './collection';
|
|
9
|
+
import { CollectionGroupManager } from './collection-group-manager';
|
|
8
10
|
import { ImportFileExtension } from './collection-importer';
|
|
11
|
+
import DatabaseUtils from './database-utils';
|
|
9
12
|
import ReferencesMap from './features/ReferencesMap';
|
|
10
13
|
import { ArrayFieldRepository } from './field-repository/array-field-repository';
|
|
11
14
|
import * as FieldTypes from './fields';
|
|
@@ -14,13 +17,10 @@ import InheritanceMap from './inherited-map';
|
|
|
14
17
|
import { MigrationItem, Migrations } from './migration';
|
|
15
18
|
import { Model } from './model';
|
|
16
19
|
import { ModelHook } from './model-hook';
|
|
20
|
+
import QueryInterface from './query-interface/query-interface';
|
|
17
21
|
import { RelationRepository } from './relation-repository/relation-repository';
|
|
18
22
|
import { Repository } from './repository';
|
|
19
23
|
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';
|
|
20
|
-
import { Logger } from '@nocobase/logger';
|
|
21
|
-
import { CollectionGroupManager } from './collection-group-manager';
|
|
22
|
-
import DatabaseUtils from './database-utils';
|
|
23
|
-
import QueryInterface from './query-interface/query-interface';
|
|
24
24
|
import { BaseValueParser } from './value-parsers';
|
|
25
25
|
export type MergeOptions = merge.Options;
|
|
26
26
|
export interface PendingOptions {
|
package/lib/database.js
CHANGED
|
@@ -62,20 +62,20 @@ function _umzug() {
|
|
|
62
62
|
return data;
|
|
63
63
|
}
|
|
64
64
|
var _collection = require("./collection");
|
|
65
|
+
var _collectionGroupManager = require("./collection-group-manager");
|
|
65
66
|
var _collectionImporter = require("./collection-importer");
|
|
67
|
+
var _databaseUtils = _interopRequireDefault(require("./database-utils"));
|
|
66
68
|
var _ReferencesMap = _interopRequireDefault(require("./features/ReferencesMap"));
|
|
67
69
|
var _referentialIntegrityCheck = require("./features/referential-integrity-check");
|
|
68
70
|
var FieldTypes = _interopRequireWildcard(require("./fields"));
|
|
69
71
|
var _inheritedCollection = require("./inherited-collection");
|
|
70
72
|
var _inheritedMap = _interopRequireDefault(require("./inherited-map"));
|
|
73
|
+
var _listeners = require("./listeners");
|
|
71
74
|
var _migration = require("./migration");
|
|
72
75
|
var _modelHook = require("./model-hook");
|
|
73
76
|
var _operators = _interopRequireDefault(require("./operators"));
|
|
74
|
-
var _utils2 = require("./utils");
|
|
75
|
-
var _collectionGroupManager = require("./collection-group-manager");
|
|
76
|
-
var _databaseUtils = _interopRequireDefault(require("./database-utils"));
|
|
77
|
-
var _listeners = require("./listeners");
|
|
78
77
|
var _queryInterfaceBuilder = _interopRequireDefault(require("./query-interface/query-interface-builder"));
|
|
78
|
+
var _utils2 = require("./utils");
|
|
79
79
|
var _valueParsers = require("./value-parsers");
|
|
80
80
|
var _viewCollection = require("./view-collection");
|
|
81
81
|
const _excluded = ["drop"],
|
|
@@ -6,15 +6,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
const mustHaveFilter = () => (target, propertyKey, descriptor) => {
|
|
8
8
|
const oldValue = descriptor.value;
|
|
9
|
-
descriptor.value = function () {
|
|
10
|
-
const options =
|
|
9
|
+
descriptor.value = function (...args) {
|
|
10
|
+
const options = args[0];
|
|
11
11
|
if (Array.isArray(options.values)) {
|
|
12
|
-
return oldValue.apply(this,
|
|
12
|
+
return oldValue.apply(this, args);
|
|
13
13
|
}
|
|
14
14
|
if (!(options !== null && options !== void 0 && options.filter) && !(options !== null && options !== void 0 && options.filterByTk) && !(options !== null && options !== void 0 && options.forceUpdate)) {
|
|
15
15
|
throw new Error(`must provide filter or filterByTk for ${propertyKey} call, or set forceUpdate to true`);
|
|
16
16
|
}
|
|
17
|
-
return oldValue.apply(this,
|
|
17
|
+
return oldValue.apply(this, args);
|
|
18
18
|
};
|
|
19
19
|
return descriptor;
|
|
20
20
|
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
function _lodash() {
|
|
8
|
+
const data = _interopRequireDefault(require("lodash"));
|
|
9
|
+
_lodash = function _lodash() {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
const injectTargetCollection = (target, propertyKey, descriptor) => {
|
|
16
|
+
const oldValue = descriptor.value;
|
|
17
|
+
descriptor.value = function (...args) {
|
|
18
|
+
const options = args[0];
|
|
19
|
+
const values = options.values;
|
|
20
|
+
if (_lodash().default.isPlainObject(values) && values.__collection) {
|
|
21
|
+
options.targetCollection = values.__collection;
|
|
22
|
+
}
|
|
23
|
+
return oldValue.apply(this, args);
|
|
24
|
+
};
|
|
25
|
+
return descriptor;
|
|
26
|
+
};
|
|
27
|
+
var _default = injectTargetCollection;
|
|
28
|
+
exports.default = _default;
|
|
@@ -4,22 +4,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.EagerLoadingTree = void 0;
|
|
7
|
-
function
|
|
8
|
-
const data = require("
|
|
9
|
-
|
|
7
|
+
function _lodash() {
|
|
8
|
+
const data = _interopRequireDefault(require("lodash"));
|
|
9
|
+
_lodash = function _lodash() {
|
|
10
10
|
return data;
|
|
11
11
|
};
|
|
12
12
|
return data;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
const data =
|
|
16
|
-
|
|
14
|
+
function _sequelize() {
|
|
15
|
+
const data = require("sequelize");
|
|
16
|
+
_sequelize = function _sequelize() {
|
|
17
17
|
return data;
|
|
18
18
|
};
|
|
19
19
|
return data;
|
|
20
20
|
}
|
|
21
|
-
var _optionsParser = require("../options-parser");
|
|
22
21
|
var _appendChildCollectionNameAfterRepositoryFind = require("../listeners/append-child-collection-name-after-repository-find");
|
|
22
|
+
var _optionsParser = require("../options-parser");
|
|
23
23
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
24
24
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
25
25
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
@@ -89,7 +89,7 @@ class EagerLoadingTree {
|
|
|
89
89
|
if (include.fromFilter) {
|
|
90
90
|
continue;
|
|
91
91
|
}
|
|
92
|
-
const association = eagerLoadingTreeParent.model.associations[include.association];
|
|
92
|
+
const association = _lodash().default.isString(include.association) ? eagerLoadingTreeParent.model.associations[include.association] : include.association;
|
|
93
93
|
const associationType = association.associationType;
|
|
94
94
|
const child = buildNode({
|
|
95
95
|
model: association.target,
|
|
@@ -97,6 +97,7 @@ class EagerLoadingTree {
|
|
|
97
97
|
rawAttributes: _lodash().default.cloneDeep(include.attributes),
|
|
98
98
|
attributes: _lodash().default.cloneDeep(include.attributes),
|
|
99
99
|
parent: eagerLoadingTreeParent,
|
|
100
|
+
where: include.where,
|
|
100
101
|
children: []
|
|
101
102
|
});
|
|
102
103
|
if (associationType == 'HasOne' || associationType == 'HasMany') {
|
|
@@ -167,10 +168,16 @@ class EagerLoadingTree {
|
|
|
167
168
|
if (associationType == 'HasOne' || associationType == 'HasMany') {
|
|
168
169
|
const foreignKey = association.foreignKey;
|
|
169
170
|
const foreignKeyValues = node.parent.instances.map(instance => instance.get(association.sourceKey));
|
|
171
|
+
let where = {
|
|
172
|
+
[foreignKey]: foreignKeyValues
|
|
173
|
+
};
|
|
174
|
+
if (node.where) {
|
|
175
|
+
where = {
|
|
176
|
+
[_sequelize().Op.and]: [where, node.where]
|
|
177
|
+
};
|
|
178
|
+
}
|
|
170
179
|
const findOptions = {
|
|
171
|
-
where
|
|
172
|
-
[foreignKey]: foreignKeyValues
|
|
173
|
-
},
|
|
180
|
+
where,
|
|
174
181
|
attributes: node.attributes,
|
|
175
182
|
order: orderOption(association),
|
|
176
183
|
transaction
|
|
@@ -258,7 +265,8 @@ class EagerLoadingTree {
|
|
|
258
265
|
}
|
|
259
266
|
}
|
|
260
267
|
if (associationType == 'HasOne') {
|
|
261
|
-
|
|
268
|
+
const key = association.options.realAs || association.as;
|
|
269
|
+
parentInstance[key] = parentInstance.dataValues[key] = instance;
|
|
262
270
|
}
|
|
263
271
|
}
|
|
264
272
|
}
|
|
@@ -346,6 +354,7 @@ class EagerLoadingTree {
|
|
|
346
354
|
yield loadRecursive(_this.root, pks);
|
|
347
355
|
const appendChildCollectionName = (0, _appendChildCollectionNameAfterRepositoryFind.appendChildCollectionNameAfterRepositoryFind)(_this.db);
|
|
348
356
|
const setInstanceAttributes = node => {
|
|
357
|
+
var _node$association;
|
|
349
358
|
if (node.inspectInheritAttribute) {
|
|
350
359
|
appendChildCollectionName({
|
|
351
360
|
findOptions: {},
|
|
@@ -353,6 +362,10 @@ class EagerLoadingTree {
|
|
|
353
362
|
dataCollection: _this.db.modelCollection.get(node.model)
|
|
354
363
|
});
|
|
355
364
|
}
|
|
365
|
+
// skip pivot attributes
|
|
366
|
+
if (((_node$association = node.association) === null || _node$association === void 0 ? void 0 : _node$association.as) == '_pivot_') {
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
356
369
|
// if no attributes are specified, return empty fields
|
|
357
370
|
const nodeRawAttributes = node.rawAttributes || [];
|
|
358
371
|
if (!_lodash().default.isArray(nodeRawAttributes)) {
|
package/lib/fields/field.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export interface FieldContext {
|
|
|
9
9
|
export interface BaseFieldOptions {
|
|
10
10
|
name?: string;
|
|
11
11
|
hidden?: boolean;
|
|
12
|
+
translation?: boolean;
|
|
12
13
|
[key: string]: any;
|
|
13
14
|
}
|
|
14
15
|
export interface BaseColumnFieldOptions extends BaseFieldOptions, Omit<ModelAttributeColumnOptions, 'type'> {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Collection, CollectionContext, CollectionOptions } from './collection';
|
|
2
1
|
import { Field } from '.';
|
|
2
|
+
import { Collection, CollectionContext, CollectionOptions } from './collection';
|
|
3
3
|
export declare class InheritedCollection extends Collection {
|
|
4
4
|
parents?: Collection[];
|
|
5
5
|
constructor(options: CollectionOptions, context: CollectionContext);
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.InheritedCollection = void 0;
|
|
7
|
-
var _collection = require("./collection");
|
|
8
7
|
function _lodash() {
|
|
9
8
|
const data = _interopRequireDefault(require("lodash"));
|
|
10
9
|
_lodash = function _lodash() {
|
|
@@ -12,6 +11,7 @@ function _lodash() {
|
|
|
12
11
|
};
|
|
13
12
|
return data;
|
|
14
13
|
}
|
|
14
|
+
var _collection = require("./collection");
|
|
15
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
16
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
17
17
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import Database from '../database';
|
|
2
|
+
export declare const appendChildCollectionNameAfterRepositoryFind: (db: Database) => ({ findOptions, dataCollection, data }: {
|
|
2
3
|
findOptions: any;
|
|
3
4
|
dataCollection: any;
|
|
4
5
|
data: any;
|
|
@@ -7,18 +7,45 @@ exports.appendChildCollectionNameAfterRepositoryFind = void 0;
|
|
|
7
7
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
8
8
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
9
9
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
10
|
+
const setRowAttribute = (row, attribute, value, raw) => {
|
|
11
|
+
if (raw) {
|
|
12
|
+
row[attribute] = value;
|
|
13
|
+
} else {
|
|
14
|
+
row.set(attribute, value, {
|
|
15
|
+
raw: true
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
};
|
|
10
19
|
const appendChildCollectionNameAfterRepositoryFind = db => {
|
|
11
20
|
return ({
|
|
12
21
|
findOptions,
|
|
13
22
|
dataCollection,
|
|
14
23
|
data
|
|
15
24
|
}) => {
|
|
16
|
-
if (
|
|
25
|
+
if (findOptions.targetCollection) {
|
|
26
|
+
const collection = db.getCollection(findOptions.targetCollection);
|
|
17
27
|
var _iterator = _createForOfIteratorHelper(data),
|
|
18
28
|
_step;
|
|
19
29
|
try {
|
|
20
30
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
21
31
|
const row = _step.value;
|
|
32
|
+
setRowAttribute(row, '__collection', collection.name, findOptions.raw);
|
|
33
|
+
setRowAttribute(row, '__schemaName', collection.collectionSchema(), findOptions.raw);
|
|
34
|
+
setRowAttribute(row, '__tableName', collection.model.tableName, findOptions.raw);
|
|
35
|
+
}
|
|
36
|
+
} catch (err) {
|
|
37
|
+
_iterator.e(err);
|
|
38
|
+
} finally {
|
|
39
|
+
_iterator.f();
|
|
40
|
+
}
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
if (dataCollection.isParent()) {
|
|
44
|
+
var _iterator2 = _createForOfIteratorHelper(data),
|
|
45
|
+
_step2;
|
|
46
|
+
try {
|
|
47
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
48
|
+
const row = _step2.value;
|
|
22
49
|
if (row.__collection) {
|
|
23
50
|
continue;
|
|
24
51
|
}
|
|
@@ -29,14 +56,12 @@ const appendChildCollectionNameAfterRepositoryFind = db => {
|
|
|
29
56
|
return;
|
|
30
57
|
}
|
|
31
58
|
const rowCollectionName = rowCollection.name;
|
|
32
|
-
|
|
33
|
-
raw: true
|
|
34
|
-
});
|
|
59
|
+
setRowAttribute(row, '__collection', rowCollectionName, findOptions.raw);
|
|
35
60
|
}
|
|
36
61
|
} catch (err) {
|
|
37
|
-
|
|
62
|
+
_iterator2.e(err);
|
|
38
63
|
} finally {
|
|
39
|
-
|
|
64
|
+
_iterator2.f();
|
|
40
65
|
}
|
|
41
66
|
}
|
|
42
67
|
};
|
package/lib/options-parser.js
CHANGED
|
@@ -4,6 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.OptionsParser = void 0;
|
|
7
|
+
function _lodash() {
|
|
8
|
+
const data = _interopRequireDefault(require("lodash"));
|
|
9
|
+
_lodash = function _lodash() {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
7
14
|
function _sequelize() {
|
|
8
15
|
const data = require("sequelize");
|
|
9
16
|
_sequelize = function _sequelize() {
|
|
@@ -63,7 +70,7 @@ class OptionsParser {
|
|
|
63
70
|
return this.isAssociation(path.split('.')[0]);
|
|
64
71
|
}
|
|
65
72
|
toSequelizeParams() {
|
|
66
|
-
var _this$options;
|
|
73
|
+
var _this$options, _this$options2;
|
|
67
74
|
const queryParams = this.filterParser.toSequelizeParams();
|
|
68
75
|
if ((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.filterByTk) {
|
|
69
76
|
queryParams.where = {
|
|
@@ -72,6 +79,12 @@ class OptionsParser {
|
|
|
72
79
|
}]
|
|
73
80
|
};
|
|
74
81
|
}
|
|
82
|
+
if ((_this$options2 = this.options) !== null && _this$options2 !== void 0 && _this$options2.include) {
|
|
83
|
+
if (!queryParams.include) {
|
|
84
|
+
queryParams.include = [];
|
|
85
|
+
}
|
|
86
|
+
queryParams.include.push(..._lodash().default.castArray(this.options.include));
|
|
87
|
+
}
|
|
75
88
|
return this.parseSort(this.parseFields(queryParams));
|
|
76
89
|
}
|
|
77
90
|
/**
|
|
@@ -80,8 +93,8 @@ class OptionsParser {
|
|
|
80
93
|
* @protected
|
|
81
94
|
*/
|
|
82
95
|
parseSort(filterParams) {
|
|
83
|
-
var _this$
|
|
84
|
-
let sort = ((_this$
|
|
96
|
+
var _this$options3;
|
|
97
|
+
let sort = ((_this$options3 = this.options) === null || _this$options3 === void 0 ? void 0 : _this$options3.sort) || [];
|
|
85
98
|
if (typeof sort === 'string') {
|
|
86
99
|
sort = sort.split(',');
|
|
87
100
|
}
|
|
@@ -127,10 +140,10 @@ class OptionsParser {
|
|
|
127
140
|
return filterParams;
|
|
128
141
|
}
|
|
129
142
|
parseFields(filterParams) {
|
|
130
|
-
var _this$
|
|
131
|
-
const appends = ((_this$
|
|
143
|
+
var _this$options4, _this$options5, _this$options6, _this$options7;
|
|
144
|
+
const appends = ((_this$options4 = this.options) === null || _this$options4 === void 0 ? void 0 : _this$options4.appends) || [];
|
|
132
145
|
const except = [];
|
|
133
|
-
if ((_this$
|
|
146
|
+
if ((_this$options5 = this.options) !== null && _this$options5 !== void 0 && _this$options5.attributes) {
|
|
134
147
|
return {
|
|
135
148
|
attributes: this.options.attributes
|
|
136
149
|
};
|
|
@@ -142,7 +155,7 @@ class OptionsParser {
|
|
|
142
155
|
if (this.collection.isParent()) {
|
|
143
156
|
OptionsParser.appendInheritInspectAttribute(attributes.include, this.collection);
|
|
144
157
|
}
|
|
145
|
-
if ((_this$
|
|
158
|
+
if ((_this$options6 = this.options) !== null && _this$options6 !== void 0 && _this$options6.fields) {
|
|
146
159
|
attributes = [];
|
|
147
160
|
if (this.collection.isParent()) {
|
|
148
161
|
OptionsParser.appendInheritInspectAttribute(attributes, this.collection);
|
|
@@ -167,7 +180,7 @@ class OptionsParser {
|
|
|
167
180
|
_iterator2.f();
|
|
168
181
|
}
|
|
169
182
|
}
|
|
170
|
-
if ((_this$
|
|
183
|
+
if ((_this$options7 = this.options) !== null && _this$options7 !== void 0 && _this$options7.except) {
|
|
171
184
|
var _iterator3 = _createForOfIteratorHelper(this.options.except),
|
|
172
185
|
_step3;
|
|
173
186
|
try {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import QueryInterface from './query-interface';
|
|
2
|
-
import { Collection } from '../collection';
|
|
3
1
|
import { Transactionable } from 'sequelize';
|
|
2
|
+
import { Collection } from '../collection';
|
|
3
|
+
import QueryInterface from './query-interface';
|
|
4
4
|
export default class MysqlQueryInterface extends QueryInterface {
|
|
5
5
|
constructor(db: any);
|
|
6
6
|
collectionTableExists(collection: Collection, options?: Transactionable): Promise<boolean>;
|
|
@@ -15,4 +15,6 @@ export default class MysqlQueryInterface extends QueryInterface {
|
|
|
15
15
|
table_schema?: string;
|
|
16
16
|
};
|
|
17
17
|
}>;
|
|
18
|
+
parseSQL(sql: string): any;
|
|
19
|
+
viewDef(viewName: string): Promise<string>;
|
|
18
20
|
}
|
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _queryInterface = _interopRequireDefault(require("./query-interface"));
|
|
8
7
|
var _sqlParser = _interopRequireDefault(require("../sql-parser"));
|
|
8
|
+
var _queryInterface = _interopRequireDefault(require("./query-interface"));
|
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
10
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
11
11
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
@@ -49,15 +49,8 @@ class MysqlQueryInterface extends _queryInterface.default {
|
|
|
49
49
|
var _this3 = this;
|
|
50
50
|
return _asyncToGenerator(function* () {
|
|
51
51
|
try {
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
});
|
|
55
|
-
const createView = viewDefinition[0]['Create View'];
|
|
56
|
-
const regex = /(?<=AS\s)([\s\S]*)/i;
|
|
57
|
-
const match = createView.match(regex);
|
|
58
|
-
const sql = match[0];
|
|
59
|
-
const _sqlParser$parse = _sqlParser.default.parse(sql),
|
|
60
|
-
ast = _sqlParser$parse.ast;
|
|
52
|
+
const _this3$parseSQL = _this3.parseSQL(yield _this3.viewDef(options.viewName)),
|
|
53
|
+
ast = _this3$parseSQL.ast;
|
|
61
54
|
const columns = ast.columns;
|
|
62
55
|
const results = [];
|
|
63
56
|
var _iterator = _createForOfIteratorHelper(columns),
|
|
@@ -84,5 +77,21 @@ class MysqlQueryInterface extends _queryInterface.default {
|
|
|
84
77
|
}
|
|
85
78
|
})();
|
|
86
79
|
}
|
|
80
|
+
parseSQL(sql) {
|
|
81
|
+
return _sqlParser.default.parse(sql);
|
|
82
|
+
}
|
|
83
|
+
viewDef(viewName) {
|
|
84
|
+
var _this4 = this;
|
|
85
|
+
return _asyncToGenerator(function* () {
|
|
86
|
+
const viewDefinition = yield _this4.db.sequelize.query(`SHOW CREATE VIEW ${viewName}`, {
|
|
87
|
+
type: 'SELECT'
|
|
88
|
+
});
|
|
89
|
+
const createView = viewDefinition[0]['Create View'];
|
|
90
|
+
const regex = /(?<=AS\s)([\s\S]*)/i;
|
|
91
|
+
const match = createView.match(regex);
|
|
92
|
+
const sql = match[0];
|
|
93
|
+
return sql;
|
|
94
|
+
})();
|
|
95
|
+
}
|
|
87
96
|
}
|
|
88
97
|
exports.default = MysqlQueryInterface;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import QueryInterface from './query-interface';
|
|
2
1
|
import { Collection } from '../collection';
|
|
2
|
+
import QueryInterface from './query-interface';
|
|
3
3
|
export default class PostgresQueryInterface extends QueryInterface {
|
|
4
4
|
constructor(db: any);
|
|
5
5
|
collectionTableExists(collection: Collection, options?: any): Promise<any>;
|
|
6
6
|
listViews(): Promise<[unknown[], unknown]>;
|
|
7
|
+
viewDef(viewName: string): Promise<string>;
|
|
8
|
+
parseSQL(sql: string): any;
|
|
7
9
|
viewColumnUsage(options: any): Promise<{
|
|
8
10
|
[view_column_name: string]: {
|
|
9
11
|
column_name: string;
|
|
@@ -4,14 +4,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
7
|
+
function _lodash() {
|
|
8
|
+
const data = _interopRequireDefault(require("lodash"));
|
|
9
|
+
_lodash = function _lodash() {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
8
14
|
var _postgres = _interopRequireDefault(require("../sql-parser/postgres"));
|
|
15
|
+
var _queryInterface = _interopRequireDefault(require("./query-interface"));
|
|
9
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
17
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
11
18
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
12
19
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
13
20
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
14
21
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
22
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
23
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
24
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
25
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
26
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
27
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
15
28
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
16
29
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
17
30
|
class PostgresQueryInterface extends _queryInterface.default {
|
|
@@ -49,8 +62,26 @@ class PostgresQueryInterface extends _queryInterface.default {
|
|
|
49
62
|
});
|
|
50
63
|
})();
|
|
51
64
|
}
|
|
52
|
-
|
|
65
|
+
viewDef(viewName) {
|
|
53
66
|
var _this3 = this;
|
|
67
|
+
return _asyncToGenerator(function* () {
|
|
68
|
+
const _viewName$split = viewName.split('.'),
|
|
69
|
+
_viewName$split2 = _slicedToArray(_viewName$split, 2),
|
|
70
|
+
schema = _viewName$split2[0],
|
|
71
|
+
name = _viewName$split2[1];
|
|
72
|
+
const viewDefQuery = yield _this3.db.sequelize.query(`
|
|
73
|
+
select pg_get_viewdef(format('%I.%I', '${schema}', '${name}')::regclass, true) as definition
|
|
74
|
+
`, {
|
|
75
|
+
type: 'SELECT'
|
|
76
|
+
});
|
|
77
|
+
return _lodash().default.trim(viewDefQuery[0]['definition']);
|
|
78
|
+
})();
|
|
79
|
+
}
|
|
80
|
+
parseSQL(sql) {
|
|
81
|
+
return _postgres.default.parse(sql);
|
|
82
|
+
}
|
|
83
|
+
viewColumnUsage(options) {
|
|
84
|
+
var _this4 = this;
|
|
54
85
|
return _asyncToGenerator(function* () {
|
|
55
86
|
const viewName = options.viewName,
|
|
56
87
|
_options$schema = options.schema,
|
|
@@ -61,18 +92,13 @@ class PostgresQueryInterface extends _queryInterface.default {
|
|
|
61
92
|
WHERE view_schema = '${schema}'
|
|
62
93
|
AND view_name = '${viewName}';
|
|
63
94
|
`;
|
|
64
|
-
const columnUsages = yield
|
|
65
|
-
type: 'SELECT'
|
|
66
|
-
});
|
|
67
|
-
const viewDefQuery = yield _this3.db.sequelize.query(`
|
|
68
|
-
select pg_get_viewdef(format('%I.%I', '${schema}', '${viewName}')::regclass, true) as definition
|
|
69
|
-
`, {
|
|
95
|
+
const columnUsages = yield _this4.db.sequelize.query(sql, {
|
|
70
96
|
type: 'SELECT'
|
|
71
97
|
});
|
|
72
|
-
const def =
|
|
98
|
+
const def = yield _this4.viewDef(`${schema}.${viewName}`);
|
|
73
99
|
try {
|
|
74
|
-
const
|
|
75
|
-
ast =
|
|
100
|
+
const _this4$parseSQL = _this4.parseSQL(def),
|
|
101
|
+
ast = _this4$parseSQL.ast;
|
|
76
102
|
const columns = ast[0].columns;
|
|
77
103
|
const usages = columns.map(column => {
|
|
78
104
|
const fieldAlias = column.as || column.expr.column;
|
|
@@ -90,7 +116,7 @@ class PostgresQueryInterface extends _queryInterface.default {
|
|
|
90
116
|
}).filter(([, columnUsage]) => columnUsage !== null);
|
|
91
117
|
return Object.fromEntries(usages);
|
|
92
118
|
} catch (e) {
|
|
93
|
-
|
|
119
|
+
console.log(e);
|
|
94
120
|
return {};
|
|
95
121
|
}
|
|
96
122
|
})();
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import Database from '../database';
|
|
2
|
-
import { Collection } from '../collection';
|
|
3
1
|
import { QueryInterface as SequelizeQueryInterface, Transactionable } from 'sequelize';
|
|
2
|
+
import { Collection } from '../collection';
|
|
3
|
+
import Database from '../database';
|
|
4
4
|
export default abstract class QueryInterface {
|
|
5
5
|
db: Database;
|
|
6
6
|
sequelizeQueryInterface: SequelizeQueryInterface;
|
|
7
7
|
protected constructor(db: Database);
|
|
8
8
|
abstract collectionTableExists(collection: Collection, options?: Transactionable): Promise<boolean>;
|
|
9
9
|
abstract listViews(): any;
|
|
10
|
+
abstract viewDef(viewName: string): Promise<string>;
|
|
10
11
|
abstract viewColumnUsage(options: {
|
|
11
12
|
viewName: string;
|
|
12
13
|
schema?: string;
|
|
@@ -17,5 +18,6 @@ export default abstract class QueryInterface {
|
|
|
17
18
|
table_schema?: string;
|
|
18
19
|
};
|
|
19
20
|
}>;
|
|
21
|
+
abstract parseSQL(sql: string): any;
|
|
20
22
|
dropAll(options: any): Promise<void>;
|
|
21
23
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import QueryInterface from './query-interface';
|
|
2
1
|
import { Collection } from '../collection';
|
|
2
|
+
import QueryInterface from './query-interface';
|
|
3
3
|
export default class SqliteQueryInterface extends QueryInterface {
|
|
4
4
|
constructor(db: any);
|
|
5
5
|
collectionTableExists(collection: Collection, options?: any): Promise<boolean>;
|
|
@@ -14,4 +14,6 @@ export default class SqliteQueryInterface extends QueryInterface {
|
|
|
14
14
|
table_schema?: string;
|
|
15
15
|
};
|
|
16
16
|
}>;
|
|
17
|
+
parseSQL(sql: string): any;
|
|
18
|
+
viewDef(viewName: string): Promise<string>;
|
|
17
19
|
}
|