tspace-mysql 1.5.0 → 1.5.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/README.md +1856 -701
- package/build/cli/dump/db.js +3 -2
- package/build/cli/generate/make.js +17 -15
- package/build/cli/generate/modelDecorator.d.ts +1 -1
- package/build/cli/generate/modelDecorator.js +2 -3
- package/build/cli/index.js +45 -27
- package/build/cli/migrate/make.d.ts +1 -1
- package/build/cli/migrate/make.js +2 -2
- package/build/cli/migrations/make-db.d.ts +4 -0
- package/build/cli/migrations/make-db.js +58 -0
- package/build/cli/migrations/make.d.ts +2 -0
- package/build/cli/migrations/make.js +201 -0
- package/build/lib/Interface.d.ts +24 -5
- package/build/lib/connection/index.d.ts +5 -1
- package/build/lib/connection/index.js +65 -8
- package/build/lib/connection/options.js +2 -2
- package/build/lib/constants/index.js +13 -3
- package/build/lib/{tspace → core}/Abstracts/AbstractBuilder.d.ts +1 -1
- package/build/lib/{tspace → core}/Abstracts/AbstractModel.d.ts +15 -13
- package/build/lib/{tspace → core}/Blueprint.d.ts +14 -3
- package/build/lib/{tspace → core}/Blueprint.js +30 -4
- package/build/lib/{tspace → core}/Builder.d.ts +140 -44
- package/build/lib/{tspace → core}/Builder.js +772 -459
- package/build/lib/{tspace → core}/DB.d.ts +20 -4
- package/build/lib/{tspace → core}/DB.js +73 -39
- package/build/lib/{tspace → core}/Decorator.js +2 -2
- package/build/lib/{tspace → core/Handlers}/Logger.d.ts +3 -3
- package/build/lib/{tspace → core/Handlers}/Logger.js +4 -4
- package/build/lib/{tspace → core}/Handlers/Proxy.js +2 -2
- package/build/lib/{tspace → core}/Handlers/Relation.d.ts +2 -4
- package/build/lib/{tspace → core}/Handlers/Relation.js +69 -48
- package/build/lib/{tspace → core}/Handlers/State.d.ts +1 -1
- package/build/lib/{tspace → core}/Handlers/State.js +3 -3
- package/build/lib/{tspace → core}/Model.d.ts +358 -133
- package/build/lib/{tspace → core}/Model.js +1316 -558
- package/build/lib/core/Schema.d.ts +137 -0
- package/build/lib/{tspace → core}/Schema.js +147 -52
- package/build/lib/core/Type.d.ts +6 -0
- package/build/lib/core/Type.js +2 -0
- package/build/lib/{tspace → core}/index.d.ts +2 -1
- package/build/lib/{tspace → core}/index.js +3 -2
- package/build/lib/index.d.ts +2 -2
- package/build/lib/index.js +2 -2
- package/build/lib/utils/index.d.ts +1 -0
- package/build/lib/utils/index.js +17 -7
- package/package.json +6 -4
- package/build/lib/tspace/Schema.d.ts +0 -70
- /package/build/lib/{tspace → core}/Abstracts/AbstractBuilder.js +0 -0
- /package/build/lib/{tspace → core}/Abstracts/AbstractDB.d.ts +0 -0
- /package/build/lib/{tspace → core}/Abstracts/AbstractDB.js +0 -0
- /package/build/lib/{tspace → core}/Abstracts/AbstractModel.js +0 -0
- /package/build/lib/{tspace → core}/Decorator.d.ts +0 -0
- /package/build/lib/{tspace → core}/Handlers/Proxy.d.ts +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AbstractDB } from './Abstracts/AbstractDB';
|
|
2
|
-
import { Backup, BackupTableToFile, BackupToFile, Connection, ConnectionOptions, ConnectionTransaction } from '../Interface';
|
|
2
|
+
import { Backup, BackupTableToFile, BackupToFile, Connection, ConnectionOptions, ConnectionTransaction, Operator } from '../Interface';
|
|
3
3
|
/**
|
|
4
4
|
* 'DB' Class is a component of the database system
|
|
5
5
|
* @param {string?} table table name
|
|
@@ -116,9 +116,9 @@ declare class DB extends AbstractDB {
|
|
|
116
116
|
*/
|
|
117
117
|
static camelCase(value: string): string;
|
|
118
118
|
/**
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
119
|
+
* The 'escape' methid is used to escaping SQL injections.
|
|
120
|
+
* @return {string} string
|
|
121
|
+
*/
|
|
122
122
|
escape(value: string): string;
|
|
123
123
|
/**
|
|
124
124
|
* The 'escape' methid is used to escaping SQL injections.
|
|
@@ -148,6 +148,22 @@ declare class DB extends AbstractDB {
|
|
|
148
148
|
* @return {string} string
|
|
149
149
|
*/
|
|
150
150
|
static raw(sql: string): string;
|
|
151
|
+
/**
|
|
152
|
+
* The 'op' methid is used to operator for where conditions.
|
|
153
|
+
* @static
|
|
154
|
+
* @param {string} picked
|
|
155
|
+
* @param {any} value
|
|
156
|
+
* @return {string} string
|
|
157
|
+
*/
|
|
158
|
+
op<T extends keyof Operator>(picked: T, value: any): string;
|
|
159
|
+
/**
|
|
160
|
+
* The 'op' methid is used to operator for where conditions.
|
|
161
|
+
* @static
|
|
162
|
+
* @param {string} operatorPicked
|
|
163
|
+
* @param {any} value
|
|
164
|
+
* @return {string} string
|
|
165
|
+
*/
|
|
166
|
+
static op<T extends keyof Operator>(operatorPicked: T, value: any): string;
|
|
151
167
|
/**
|
|
152
168
|
* The 'getConnection' method is used to get a pool connection.
|
|
153
169
|
* @param {Object} options options for connection database with credentials
|
|
@@ -50,7 +50,7 @@ class DB extends AbstractDB_1.AbstractDB {
|
|
|
50
50
|
* @return {this} this
|
|
51
51
|
*/
|
|
52
52
|
table(table) {
|
|
53
|
-
this.
|
|
53
|
+
this.$state.set('TABLE_NAME', `\`${table}\``);
|
|
54
54
|
return this;
|
|
55
55
|
}
|
|
56
56
|
/**
|
|
@@ -209,9 +209,9 @@ class DB extends AbstractDB_1.AbstractDB {
|
|
|
209
209
|
return new this().$utils.camelCase(value);
|
|
210
210
|
}
|
|
211
211
|
/**
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
212
|
+
* The 'escape' methid is used to escaping SQL injections.
|
|
213
|
+
* @return {string} string
|
|
214
|
+
*/
|
|
215
215
|
escape(value) {
|
|
216
216
|
return this.$utils.escape(value);
|
|
217
217
|
}
|
|
@@ -242,7 +242,7 @@ class DB extends AbstractDB_1.AbstractDB {
|
|
|
242
242
|
* @return {string} string
|
|
243
243
|
*/
|
|
244
244
|
raw(sql) {
|
|
245
|
-
return `${this.$constants('RAW')}
|
|
245
|
+
return `${this.$constants('RAW')}${sql}`;
|
|
246
246
|
}
|
|
247
247
|
/**
|
|
248
248
|
* The 'raw' methid is used to allow for raw sql queries to some method in 'DB' or 'Model'.
|
|
@@ -253,6 +253,40 @@ class DB extends AbstractDB_1.AbstractDB {
|
|
|
253
253
|
static raw(sql) {
|
|
254
254
|
return `${new this().raw(sql)}`;
|
|
255
255
|
}
|
|
256
|
+
/**
|
|
257
|
+
* The 'op' methid is used to operator for where conditions.
|
|
258
|
+
* @static
|
|
259
|
+
* @param {string} picked
|
|
260
|
+
* @param {any} value
|
|
261
|
+
* @return {string} string
|
|
262
|
+
*/
|
|
263
|
+
op(picked, value) {
|
|
264
|
+
const operator = {
|
|
265
|
+
equals: '=',
|
|
266
|
+
notEquals: '<>',
|
|
267
|
+
greaterThan: '>',
|
|
268
|
+
lessThan: '<',
|
|
269
|
+
greaterThanOrEqual: '>=',
|
|
270
|
+
lessThanOrEqual: '<=',
|
|
271
|
+
like: 'LIKE',
|
|
272
|
+
notLike: 'NOT LIKE',
|
|
273
|
+
in: 'IN',
|
|
274
|
+
notIn: 'NOT IN',
|
|
275
|
+
isNull: 'IS NULL',
|
|
276
|
+
isNotNull: 'IS NOT NULL',
|
|
277
|
+
};
|
|
278
|
+
return `${this.$constants('OP')}${operator[picked]} ${value}`;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* The 'op' methid is used to operator for where conditions.
|
|
282
|
+
* @static
|
|
283
|
+
* @param {string} operatorPicked
|
|
284
|
+
* @param {any} value
|
|
285
|
+
* @return {string} string
|
|
286
|
+
*/
|
|
287
|
+
static op(operatorPicked, value) {
|
|
288
|
+
return new this().op(operatorPicked, value);
|
|
289
|
+
}
|
|
256
290
|
/**
|
|
257
291
|
* The 'getConnection' method is used to get a pool connection.
|
|
258
292
|
* @param {Object} options options for connection database with credentials
|
|
@@ -409,15 +443,15 @@ class DB extends AbstractDB_1.AbstractDB {
|
|
|
409
443
|
* @return {Promise<boolean>}
|
|
410
444
|
*/
|
|
411
445
|
cloneDB(database) {
|
|
412
|
-
var _a;
|
|
413
446
|
return __awaiter(this, void 0, void 0, function* () {
|
|
447
|
+
var _a;
|
|
414
448
|
const db = yield this._queryStatement(`${this.$constants('SHOW_DATABASES')} ${this.$constants('LIKE')} '${database}'`);
|
|
415
449
|
if (Object.values((_a = db[0]) !== null && _a !== void 0 ? _a : []).length)
|
|
416
450
|
throw new Error(`This database : '${database}' is already exists`);
|
|
417
451
|
const tables = yield this.showTables();
|
|
418
452
|
const backup = yield this._backup({ tables, database });
|
|
419
453
|
yield this._queryStatement(`${this.$constants('CREATE_DATABASE_NOT_EXISTS')} \`${database}\``);
|
|
420
|
-
const creating = (
|
|
454
|
+
const creating = (_b) => __awaiter(this, [_b], void 0, function* ({ table, values }) {
|
|
421
455
|
try {
|
|
422
456
|
yield this._queryStatement(table);
|
|
423
457
|
if (values != null && values !== '')
|
|
@@ -452,8 +486,8 @@ class DB extends AbstractDB_1.AbstractDB {
|
|
|
452
486
|
* @property {string} backup.to.password
|
|
453
487
|
* @return {Promise<void>}
|
|
454
488
|
*/
|
|
455
|
-
backup(
|
|
456
|
-
return __awaiter(this,
|
|
489
|
+
backup(_a) {
|
|
490
|
+
return __awaiter(this, arguments, void 0, function* ({ database, to }) {
|
|
457
491
|
if (to != null && Object.keys(to).length)
|
|
458
492
|
this.connection(Object.assign(Object.assign({}, to), { database }));
|
|
459
493
|
return this.cloneDB(database);
|
|
@@ -471,8 +505,8 @@ class DB extends AbstractDB_1.AbstractDB {
|
|
|
471
505
|
* @property {string} backup.to.password
|
|
472
506
|
* @return {Promise<void>}
|
|
473
507
|
*/
|
|
474
|
-
static backup(
|
|
475
|
-
return __awaiter(this,
|
|
508
|
+
static backup(_a) {
|
|
509
|
+
return __awaiter(this, arguments, void 0, function* ({ database, to }) {
|
|
476
510
|
return new this().backup({ database, to });
|
|
477
511
|
});
|
|
478
512
|
}
|
|
@@ -490,9 +524,9 @@ class DB extends AbstractDB_1.AbstractDB {
|
|
|
490
524
|
* @property {string} backup.connection.password
|
|
491
525
|
* @return {Promise<void>}
|
|
492
526
|
*/
|
|
493
|
-
backupToFile(
|
|
494
|
-
|
|
495
|
-
|
|
527
|
+
backupToFile(_a) {
|
|
528
|
+
return __awaiter(this, arguments, void 0, function* ({ filePath, database, connection }) {
|
|
529
|
+
var _b;
|
|
496
530
|
const tables = yield this.showTables();
|
|
497
531
|
const backup = (yield this._backup({ tables, database }))
|
|
498
532
|
.map(b => {
|
|
@@ -505,7 +539,7 @@ class DB extends AbstractDB_1.AbstractDB {
|
|
|
505
539
|
values: b.values !== '' ? b.values + "\n" : ""
|
|
506
540
|
};
|
|
507
541
|
});
|
|
508
|
-
if (connection != null && ((
|
|
542
|
+
if (connection != null && ((_b = Object.keys(connection)) === null || _b === void 0 ? void 0 : _b.length))
|
|
509
543
|
this.connection(connection);
|
|
510
544
|
let sql = [
|
|
511
545
|
`SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";`,
|
|
@@ -538,8 +572,8 @@ class DB extends AbstractDB_1.AbstractDB {
|
|
|
538
572
|
* @property {string} backup.connection.password
|
|
539
573
|
* @return {Promise<void>}
|
|
540
574
|
*/
|
|
541
|
-
static backupToFile(
|
|
542
|
-
return __awaiter(this,
|
|
575
|
+
static backupToFile(_a) {
|
|
576
|
+
return __awaiter(this, arguments, void 0, function* ({ filePath, database, connection }) {
|
|
543
577
|
return new this().backupToFile({ filePath, database, connection });
|
|
544
578
|
});
|
|
545
579
|
}
|
|
@@ -557,10 +591,10 @@ class DB extends AbstractDB_1.AbstractDB {
|
|
|
557
591
|
* @property {string} backup.connection.password
|
|
558
592
|
* @return {Promise<void>}
|
|
559
593
|
*/
|
|
560
|
-
backupSchemaToFile(
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
if (connection != null && ((
|
|
594
|
+
backupSchemaToFile(_a) {
|
|
595
|
+
return __awaiter(this, arguments, void 0, function* ({ filePath, database, connection }) {
|
|
596
|
+
var _b;
|
|
597
|
+
if (connection != null && ((_b = Object.keys(connection)) === null || _b === void 0 ? void 0 : _b.length))
|
|
564
598
|
this.connection(connection);
|
|
565
599
|
const tables = yield this.showTables();
|
|
566
600
|
const backup = (yield this._backup({ tables, database }))
|
|
@@ -600,8 +634,8 @@ class DB extends AbstractDB_1.AbstractDB {
|
|
|
600
634
|
* @property {string} backup.connection.password
|
|
601
635
|
* @return {Promise<void>}
|
|
602
636
|
*/
|
|
603
|
-
static backupSchemaToFile(
|
|
604
|
-
return __awaiter(this,
|
|
637
|
+
static backupSchemaToFile(_a) {
|
|
638
|
+
return __awaiter(this, arguments, void 0, function* ({ filePath, database, connection }) {
|
|
605
639
|
return new this().backupSchemaToFile({ filePath, database, connection });
|
|
606
640
|
});
|
|
607
641
|
}
|
|
@@ -619,10 +653,10 @@ class DB extends AbstractDB_1.AbstractDB {
|
|
|
619
653
|
* @property {string} backup.connection.password
|
|
620
654
|
* @return {Promise<void>}
|
|
621
655
|
*/
|
|
622
|
-
backupTableToFile(
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
if (connection != null && ((
|
|
656
|
+
backupTableToFile(_a) {
|
|
657
|
+
return __awaiter(this, arguments, void 0, function* ({ filePath, table, connection }) {
|
|
658
|
+
var _b;
|
|
659
|
+
if (connection != null && ((_b = Object.keys(connection)) === null || _b === void 0 ? void 0 : _b.length))
|
|
626
660
|
this.connection(connection);
|
|
627
661
|
const schemas = yield this.showSchema(table);
|
|
628
662
|
const createTableSQL = [
|
|
@@ -668,8 +702,8 @@ class DB extends AbstractDB_1.AbstractDB {
|
|
|
668
702
|
* @property {string} backup.connection.password
|
|
669
703
|
* @return {Promise<void>}
|
|
670
704
|
*/
|
|
671
|
-
static backupTableToFile(
|
|
672
|
-
return __awaiter(this,
|
|
705
|
+
static backupTableToFile(_a) {
|
|
706
|
+
return __awaiter(this, arguments, void 0, function* ({ filePath, table, connection }) {
|
|
673
707
|
return new this().backupTableToFile({ filePath, table, connection });
|
|
674
708
|
});
|
|
675
709
|
}
|
|
@@ -687,9 +721,9 @@ class DB extends AbstractDB_1.AbstractDB {
|
|
|
687
721
|
* @property {string} backup.connection.password
|
|
688
722
|
* @return {Promise<void>}
|
|
689
723
|
*/
|
|
690
|
-
backupTableSchemaToFile(
|
|
691
|
-
|
|
692
|
-
|
|
724
|
+
backupTableSchemaToFile(_a) {
|
|
725
|
+
return __awaiter(this, arguments, void 0, function* ({ filePath, table, connection }) {
|
|
726
|
+
var _b;
|
|
693
727
|
const schemas = yield this.showSchema(table);
|
|
694
728
|
const createTableSQL = [
|
|
695
729
|
`${this.$constants('CREATE_TABLE_NOT_EXISTS')}`,
|
|
@@ -698,7 +732,7 @@ class DB extends AbstractDB_1.AbstractDB {
|
|
|
698
732
|
`${this.$constants('ENGINE')};`,
|
|
699
733
|
];
|
|
700
734
|
const sql = [createTableSQL.join(' ')];
|
|
701
|
-
if (connection != null && ((
|
|
735
|
+
if (connection != null && ((_b = Object.keys(connection)) === null || _b === void 0 ? void 0 : _b.length))
|
|
702
736
|
this.connection(connection);
|
|
703
737
|
fs_1.default.writeFileSync(filePath, (0, sql_formatter_1.format)(sql.join('\n'), {
|
|
704
738
|
language: 'spark',
|
|
@@ -722,13 +756,13 @@ class DB extends AbstractDB_1.AbstractDB {
|
|
|
722
756
|
* @property {string} backup.connection.password
|
|
723
757
|
* @return {Promise<void>}
|
|
724
758
|
*/
|
|
725
|
-
static backupTableSchemaToFile(
|
|
726
|
-
return __awaiter(this,
|
|
759
|
+
static backupTableSchemaToFile(_a) {
|
|
760
|
+
return __awaiter(this, arguments, void 0, function* ({ filePath, table, connection }) {
|
|
727
761
|
return new this().backupTableSchemaToFile({ filePath, table, connection });
|
|
728
762
|
});
|
|
729
763
|
}
|
|
730
|
-
_backup(
|
|
731
|
-
return __awaiter(this,
|
|
764
|
+
_backup(_a) {
|
|
765
|
+
return __awaiter(this, arguments, void 0, function* ({ tables, database }) {
|
|
732
766
|
const backup = [];
|
|
733
767
|
for (const table of tables) {
|
|
734
768
|
const schemas = yield this.showSchema(table);
|
|
@@ -736,7 +770,7 @@ class DB extends AbstractDB_1.AbstractDB {
|
|
|
736
770
|
`${this.$constants('CREATE_TABLE_NOT_EXISTS')}`,
|
|
737
771
|
`\`${database}\`.\`${table}\``,
|
|
738
772
|
`(${schemas.join(', ')})`,
|
|
739
|
-
`${this.$constants('ENGINE')}
|
|
773
|
+
`${this.$constants('ENGINE')};`,
|
|
740
774
|
];
|
|
741
775
|
const values = yield this.showValues(table);
|
|
742
776
|
let valueSQL = [];
|
|
@@ -746,7 +780,7 @@ class DB extends AbstractDB_1.AbstractDB {
|
|
|
746
780
|
`${this.$constants('INSERT')}`,
|
|
747
781
|
`\`${database}\`.\`${table}\``,
|
|
748
782
|
`(${columns.map((column) => `\`${column}\``).join(', ')})`,
|
|
749
|
-
`${this.$constants('VALUES')} ${values.join(', ')}
|
|
783
|
+
`${this.$constants('VALUES')} ${values.join(', ')};`
|
|
750
784
|
];
|
|
751
785
|
}
|
|
752
786
|
backup.push({
|
|
@@ -18,7 +18,7 @@ const TableSingular = () => {
|
|
|
18
18
|
return (constructor) => {
|
|
19
19
|
if (constructor.prototype == null)
|
|
20
20
|
return;
|
|
21
|
-
const name = String(constructor.name).replace(/([A-Z])/g, (str) =>
|
|
21
|
+
const name = String(constructor.name).replace(/([A-Z])/g, (str) => `_${str.toLowerCase()}`).slice(1);
|
|
22
22
|
constructor.prototype.$table = pluralize_1.default.singular(name);
|
|
23
23
|
};
|
|
24
24
|
};
|
|
@@ -27,7 +27,7 @@ const TablePlural = () => {
|
|
|
27
27
|
return (constructor) => {
|
|
28
28
|
if (constructor.prototype == null)
|
|
29
29
|
return;
|
|
30
|
-
const name = constructor.name.replace(/([A-Z])/g, (str) =>
|
|
30
|
+
const name = constructor.name.replace(/([A-Z])/g, (str) => `_${str.toLowerCase()}`).slice(1);
|
|
31
31
|
constructor.prototype.$table = pluralize_1.default.plural(name);
|
|
32
32
|
};
|
|
33
33
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
declare class
|
|
1
|
+
declare class LoggerHandler {
|
|
2
2
|
private SELF;
|
|
3
3
|
private PROP;
|
|
4
4
|
constructor(self: Record<string, any>, prop: string);
|
|
5
5
|
private initialize;
|
|
6
6
|
}
|
|
7
|
-
export {
|
|
8
|
-
export default
|
|
7
|
+
export { LoggerHandler };
|
|
8
|
+
export default LoggerHandler;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
class
|
|
3
|
+
exports.LoggerHandler = void 0;
|
|
4
|
+
class LoggerHandler {
|
|
5
5
|
constructor(self, prop) {
|
|
6
6
|
this.PROP = '';
|
|
7
7
|
this.SELF = self;
|
|
@@ -45,5 +45,5 @@ class Logger {
|
|
|
45
45
|
return (_a = this.SELF.$logger) === null || _a === void 0 ? void 0 : _a.set(this.PROP);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
exports.
|
|
49
|
-
exports.default =
|
|
48
|
+
exports.LoggerHandler = LoggerHandler;
|
|
49
|
+
exports.default = LoggerHandler;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.proxyHandler = void 0;
|
|
4
|
-
const Logger_1 = require("
|
|
4
|
+
const Logger_1 = require("./Logger");
|
|
5
5
|
const proxyHandler = {
|
|
6
6
|
set: (self, name, value) => {
|
|
7
7
|
var _a;
|
|
@@ -13,7 +13,7 @@ const proxyHandler = {
|
|
|
13
13
|
get: (self, prop, value) => {
|
|
14
14
|
var _a, _b, _c, _d;
|
|
15
15
|
try {
|
|
16
|
-
new Logger_1.
|
|
16
|
+
new Logger_1.LoggerHandler(self, prop);
|
|
17
17
|
switch (prop) {
|
|
18
18
|
case 'tableName': return (_b = (_a = self.$db) === null || _a === void 0 ? void 0 : _a.get('TABLE_NAME')) === null || _b === void 0 ? void 0 : _b.replace(/`/g, '');
|
|
19
19
|
case 'attributes': return self[`$${prop}`];
|
|
@@ -7,8 +7,8 @@ declare class RelationHandler {
|
|
|
7
7
|
constructor(model: Model);
|
|
8
8
|
load(parents: Record<string, any>[], relation: Relation): Promise<any[]>;
|
|
9
9
|
loadExists(): string;
|
|
10
|
-
apply(nameRelations:
|
|
11
|
-
callback(nameRelation:
|
|
10
|
+
apply(nameRelations: any[], type: 'all' | 'exists' | 'trashed' | 'count' | 'default'): Relation[];
|
|
11
|
+
callback(nameRelation: any, cb: Function): void;
|
|
12
12
|
hasOne({ name, as, model, localKey, foreignKey, freezeTable }: Relation): void;
|
|
13
13
|
hasMany({ name, as, model, localKey, foreignKey, freezeTable }: Relation): void;
|
|
14
14
|
belongsTo({ name, as, model, localKey, foreignKey, freezeTable }: Relation): void;
|
|
@@ -25,8 +25,6 @@ declare class RelationHandler {
|
|
|
25
25
|
private _valueInRelation;
|
|
26
26
|
protected _valuePattern(value: string): string;
|
|
27
27
|
private _assertError;
|
|
28
|
-
protected _getState(key: string): any;
|
|
29
|
-
protected _setState(key: string, value: any): void;
|
|
30
28
|
}
|
|
31
29
|
export { RelationHandler };
|
|
32
30
|
export default RelationHandler;
|