tspace-mysql 1.2.9 → 1.3.1

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.
Files changed (56) hide show
  1. package/README.md +64 -14
  2. package/dist/cli/dump/db.d.ts +4 -4
  3. package/dist/cli/dump/db.js +25 -25
  4. package/dist/cli/generate/make.d.ts +4 -4
  5. package/dist/cli/generate/make.js +45 -45
  6. package/dist/cli/generate/model.d.ts +2 -2
  7. package/dist/cli/generate/model.js +6 -6
  8. package/dist/cli/index.d.ts +2 -2
  9. package/dist/cli/index.js +58 -58
  10. package/dist/cli/migrate/make.d.ts +4 -4
  11. package/dist/cli/migrate/make.js +30 -30
  12. package/dist/cli/models/make.d.ts +4 -4
  13. package/dist/cli/models/make.js +51 -51
  14. package/dist/cli/models/model.d.ts +2 -2
  15. package/dist/cli/models/model.js +20 -11
  16. package/dist/cli/query/index.d.ts +4 -4
  17. package/dist/cli/query/index.js +7 -7
  18. package/dist/cli/tables/make.d.ts +4 -4
  19. package/dist/cli/tables/make.js +26 -26
  20. package/dist/cli/tables/table.d.ts +2 -2
  21. package/dist/cli/tables/table.js +6 -6
  22. package/dist/lib/connection/index.d.ts +30 -30
  23. package/dist/lib/connection/index.js +144 -143
  24. package/dist/lib/connection/options.d.ts +15 -4
  25. package/dist/lib/connection/options.js +43 -42
  26. package/dist/lib/constants/index.d.ts +5 -8
  27. package/dist/lib/constants/index.js +162 -158
  28. package/dist/lib/index.d.ts +8 -8
  29. package/dist/lib/index.js +36 -36
  30. package/dist/lib/tspace/{AbstractDatabase.d.ts → AbstractBuilder.d.ts} +124 -116
  31. package/dist/lib/tspace/{AbstractDatabase.js → AbstractBuilder.js} +36 -34
  32. package/dist/lib/tspace/AbstractDB.d.ts +18 -18
  33. package/dist/lib/tspace/AbstractDB.js +11 -11
  34. package/dist/lib/tspace/AbstractModel.d.ts +41 -41
  35. package/dist/lib/tspace/AbstractModel.js +11 -11
  36. package/dist/lib/tspace/Blueprint.d.ts +136 -136
  37. package/dist/lib/tspace/Blueprint.js +228 -228
  38. package/dist/lib/tspace/{Database.d.ts → Builder.d.ts} +833 -706
  39. package/dist/lib/tspace/{Database.js → Builder.js} +2556 -2363
  40. package/dist/lib/tspace/DB.d.ts +152 -126
  41. package/dist/lib/tspace/DB.js +373 -264
  42. package/dist/lib/tspace/Interface.d.ts +110 -109
  43. package/dist/lib/tspace/Interface.js +2 -2
  44. package/dist/lib/tspace/Logger.d.ts +8 -8
  45. package/dist/lib/tspace/Logger.js +49 -49
  46. package/dist/lib/tspace/Model.d.ts +708 -609
  47. package/dist/lib/tspace/Model.js +2520 -2477
  48. package/dist/lib/tspace/ProxyHandler.d.ts +14 -14
  49. package/dist/lib/tspace/ProxyHandler.js +31 -31
  50. package/dist/lib/tspace/Schema.d.ts +8 -8
  51. package/dist/lib/tspace/Schema.js +45 -44
  52. package/dist/lib/tspace/index.d.ts +15 -15
  53. package/dist/lib/tspace/index.js +20 -20
  54. package/dist/lib/utils/index.d.ts +15 -15
  55. package/dist/lib/utils/index.js +155 -165
  56. package/package.json +2 -4
@@ -1,109 +1,110 @@
1
- export interface Relation {
2
- name: string;
3
- model: any;
4
- as?: string;
5
- localKey?: string | undefined;
6
- foreignKey?: string | undefined;
7
- freezeTable?: string | undefined;
8
- pivot?: string | undefined;
9
- query?: any | undefined;
10
- relation?: Object | undefined;
11
- exists?: boolean | undefined;
12
- oldVersion?: boolean | undefined;
13
- }
14
- export interface RelationQuery {
15
- name?: string;
16
- model: any;
17
- as?: string;
18
- localKey?: string | undefined;
19
- foreignKey?: string | undefined;
20
- freezeTable?: string | undefined;
21
- pivot?: string | undefined;
22
- query?: any | undefined;
23
- relation?: Object | undefined;
24
- }
25
- export interface RelationShip {
26
- hasOne: string;
27
- hasMany: string;
28
- belongsTo: string;
29
- belongsToMany: string;
30
- }
31
- export interface Pagination {
32
- meta: {
33
- total: number;
34
- limit: number;
35
- total_page: number;
36
- current_page: number;
37
- last_page: number;
38
- next_page: number;
39
- prev_page: number;
40
- };
41
- data: any[];
42
- }
43
- export interface Backup {
44
- database: string;
45
- to?: {
46
- host: string;
47
- port: number;
48
- database: string;
49
- username: string;
50
- password: string;
51
- };
52
- }
53
- export interface BackupToFile {
54
- database: string;
55
- filePath: string;
56
- connection?: {
57
- host: string;
58
- port: number;
59
- database: string;
60
- username: string;
61
- password: string;
62
- };
63
- }
64
- export interface ConnectionOptions {
65
- connectionLimit?: number;
66
- dateStrings?: boolean;
67
- waitForConnections?: boolean;
68
- charset?: string;
69
- host: string;
70
- port: number;
71
- database: string;
72
- username: string;
73
- password: string;
74
- }
75
- export interface PoolCallback {
76
- query: (sql: string, callback: (err: any, result: any) => void) => void;
77
- release: () => void;
78
- }
79
- export interface ConnectionTransaction {
80
- query: (sql: string) => Promise<any>;
81
- startTransaction: () => Promise<any>;
82
- commit: () => Promise<any>;
83
- rollback: () => Promise<any>;
84
- }
85
- export interface Connection {
86
- query: (sql: string) => Promise<any>;
87
- connection: () => Promise<ConnectionTransaction>;
88
- }
89
- export interface Options {
90
- [key: string]: any;
91
- connectionLimit?: number;
92
- dateStrings?: boolean;
93
- waitForConnections?: boolean;
94
- charset?: string;
95
- host: string;
96
- port: number;
97
- database: string;
98
- user: string;
99
- password: string;
100
- }
101
- export interface Execute {
102
- sql: string;
103
- type: string;
104
- message?: string;
105
- options?: {
106
- [key: string]: any;
107
- };
108
- }
109
- export declare type Pattern = 'snake_case' | 'camelCase';
1
+ export interface Relation {
2
+ name: string;
3
+ model: any;
4
+ as?: string;
5
+ localKey?: string | undefined;
6
+ foreignKey?: string | undefined;
7
+ freezeTable?: string | undefined;
8
+ pivot?: string | undefined;
9
+ query?: any | undefined;
10
+ relation?: Object | undefined;
11
+ exists?: boolean | undefined;
12
+ trashed?: boolean | undefined;
13
+ oldVersion?: boolean | undefined;
14
+ }
15
+ export interface RelationQuery {
16
+ name?: string;
17
+ model: any;
18
+ as?: string;
19
+ localKey?: string | undefined;
20
+ foreignKey?: string | undefined;
21
+ freezeTable?: string | undefined;
22
+ pivot?: string | undefined;
23
+ query?: any | undefined;
24
+ relation?: Object | undefined;
25
+ }
26
+ export interface RelationShip {
27
+ hasOne: string;
28
+ hasMany: string;
29
+ belongsTo: string;
30
+ belongsToMany: string;
31
+ }
32
+ export interface Pagination {
33
+ meta: {
34
+ total: number;
35
+ limit: number;
36
+ total_page: number;
37
+ current_page: number;
38
+ last_page: number;
39
+ next_page: number;
40
+ prev_page: number;
41
+ };
42
+ data: any[];
43
+ }
44
+ export interface Backup {
45
+ database: string;
46
+ to?: {
47
+ host: string;
48
+ port: number;
49
+ database: string;
50
+ username: string;
51
+ password: string;
52
+ };
53
+ }
54
+ export interface BackupToFile {
55
+ database: string;
56
+ filePath: string;
57
+ connection?: {
58
+ host: string;
59
+ port: number;
60
+ database: string;
61
+ username: string;
62
+ password: string;
63
+ };
64
+ }
65
+ export interface ConnectionOptions {
66
+ connectionLimit?: number;
67
+ dateStrings?: boolean;
68
+ waitForConnections?: boolean;
69
+ charset?: string;
70
+ host: string;
71
+ port: number;
72
+ database: string;
73
+ username: string;
74
+ password: string;
75
+ }
76
+ export interface PoolCallback {
77
+ query: (sql: string, callback: (err: any, result: any) => void) => void;
78
+ release: () => void;
79
+ }
80
+ export interface ConnectionTransaction {
81
+ query: (sql: string) => Promise<any>;
82
+ startTransaction: () => Promise<any>;
83
+ commit: () => Promise<any>;
84
+ rollback: () => Promise<any>;
85
+ }
86
+ export interface Connection {
87
+ query: (sql: string) => Promise<any>;
88
+ connection: () => Promise<ConnectionTransaction>;
89
+ }
90
+ export interface Options {
91
+ [key: string]: any;
92
+ connectionLimit?: number;
93
+ dateStrings?: boolean;
94
+ waitForConnections?: boolean;
95
+ charset?: string;
96
+ host: string;
97
+ port: number;
98
+ database: string;
99
+ user: string;
100
+ password: string;
101
+ }
102
+ export interface Execute {
103
+ sql: string;
104
+ type: string;
105
+ message?: string;
106
+ options?: {
107
+ [key: string]: any;
108
+ };
109
+ }
110
+ export type Pattern = 'snake_case' | 'camelCase';
@@ -1,2 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,8 +1,8 @@
1
- declare class Logger {
2
- private SELF;
3
- private PROP;
4
- constructor(self: any, prop: string);
5
- private initialize;
6
- }
7
- export { Logger };
8
- export default Logger;
1
+ declare class Logger {
2
+ private SELF;
3
+ private PROP;
4
+ constructor(self: Record<string, any>, prop: string);
5
+ private initialize;
6
+ }
7
+ export { Logger };
8
+ export default Logger;
@@ -1,49 +1,49 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Logger = void 0;
4
- class Logger {
5
- constructor(self, prop) {
6
- this.PROP = '';
7
- this.SELF = self;
8
- this.PROP = prop;
9
- return this.initialize();
10
- }
11
- initialize() {
12
- var _a;
13
- if (this.SELF == null)
14
- return;
15
- const runing = this.SELF[this.PROP];
16
- if (runing == null)
17
- return;
18
- const _function = typeof runing;
19
- if (_function !== 'function')
20
- return;
21
- if (this.SELF.$logger == null)
22
- return;
23
- const ignores = [
24
- 'table',
25
- 'hasOne',
26
- 'belongsTo',
27
- 'hasMany',
28
- 'belongsToMany',
29
- 'constructor',
30
- 'boot',
31
- 'define'
32
- ];
33
- const _use = this.PROP.substring(0, 3) !== 'use';
34
- const _private = this.PROP.charAt(0) !== '_';
35
- const _setter = this.PROP.charAt(0) !== '$';
36
- const _ignore = ignores.indexOf(this.PROP) === -1;
37
- const conditions = [
38
- _use,
39
- _private,
40
- _ignore,
41
- _setter
42
- ].every((data) => data === true);
43
- if (!conditions)
44
- return;
45
- return (_a = this.SELF.$logger) === null || _a === void 0 ? void 0 : _a.set(this.PROP);
46
- }
47
- }
48
- exports.Logger = Logger;
49
- exports.default = Logger;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Logger = void 0;
4
+ class Logger {
5
+ constructor(self, prop) {
6
+ this.PROP = '';
7
+ this.SELF = self;
8
+ this.PROP = prop;
9
+ return this.initialize();
10
+ }
11
+ initialize() {
12
+ var _a;
13
+ if (this.SELF == null)
14
+ return;
15
+ const runing = this.SELF[this.PROP];
16
+ if (runing == null)
17
+ return;
18
+ const _function = typeof runing;
19
+ if (_function !== 'function')
20
+ return;
21
+ if (this.SELF.$logger == null)
22
+ return;
23
+ const ignores = [
24
+ 'table',
25
+ 'hasOne',
26
+ 'belongsTo',
27
+ 'hasMany',
28
+ 'belongsToMany',
29
+ 'constructor',
30
+ 'boot',
31
+ 'define'
32
+ ];
33
+ const _use = this.PROP.substring(0, 3) !== 'use';
34
+ const _private = this.PROP.charAt(0) !== '_';
35
+ const _setter = this.PROP.charAt(0) !== '$';
36
+ const _ignore = ignores.indexOf(this.PROP) === -1;
37
+ const conditions = [
38
+ _use,
39
+ _private,
40
+ _ignore,
41
+ _setter
42
+ ].every((data) => data === true);
43
+ if (!conditions)
44
+ return;
45
+ return (_a = this.SELF.$logger) === null || _a === void 0 ? void 0 : _a.set(this.PROP);
46
+ }
47
+ }
48
+ exports.Logger = Logger;
49
+ exports.default = Logger;