tspace-mysql 1.0.0 → 1.0.3

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 (42) hide show
  1. package/README.md +14 -15
  2. package/dist/cli/index.d.ts +2 -0
  3. package/dist/cli/index.js +10 -6
  4. package/dist/cli/migrate/make.d.ts +4 -0
  5. package/dist/cli/migrate/make.js +9 -9
  6. package/dist/cli/models/make.d.ts +4 -0
  7. package/dist/cli/models/make.js +14 -17
  8. package/dist/cli/models/model.d.ts +2 -0
  9. package/dist/cli/models/model.js +1 -1
  10. package/dist/cli/tables/make.d.ts +4 -0
  11. package/dist/cli/tables/make.js +21 -22
  12. package/dist/cli/tables/table.d.ts +2 -0
  13. package/dist/cli/tables/table.js +1 -1
  14. package/dist/lib/config/env.d.ts +8 -0
  15. package/dist/lib/config/env.js +1 -1
  16. package/dist/lib/connections/index.d.ts +2 -0
  17. package/dist/lib/connections/index.js +1 -1
  18. package/dist/lib/connections/options.d.ts +4 -0
  19. package/dist/lib/constants/index.d.ts +4 -0
  20. package/dist/lib/{utils/constant.js → constants/index.js} +0 -2
  21. package/dist/lib/index.d.ts +8 -0
  22. package/dist/lib/index.js +6 -2
  23. package/dist/lib/tspace/AbstractDB.d.ts +7 -0
  24. package/dist/lib/tspace/AbstractDatabase.d.ts +102 -0
  25. package/dist/lib/tspace/AbstractModel.d.ts +20 -0
  26. package/dist/lib/tspace/DB.d.ts +15 -0
  27. package/dist/lib/tspace/DB.js +10 -7
  28. package/dist/lib/tspace/Database.d.ts +155 -0
  29. package/dist/lib/tspace/Database.js +232 -168
  30. package/dist/lib/tspace/Interface.d.ts +25 -0
  31. package/dist/lib/tspace/Logger.d.ts +1 -0
  32. package/dist/lib/tspace/Logger.js +4 -3
  33. package/dist/lib/tspace/Model.d.ts +233 -0
  34. package/dist/lib/tspace/Model.js +247 -236
  35. package/dist/lib/tspace/ProxyHandler.d.ts +5 -0
  36. package/dist/lib/tspace/ProxyHandler.js +2 -2
  37. package/dist/lib/tspace/Schema.d.ts +45 -0
  38. package/dist/lib/tspace/Schema.js +9 -11
  39. package/dist/lib/tspace/index.d.ts +14 -0
  40. package/dist/lib/utils/index.d.ts +17 -0
  41. package/dist/lib/utils/index.js +8 -8
  42. package/package.json +3 -6
@@ -0,0 +1,155 @@
1
+ import AbstractDatabase from './AbstractDatabase';
2
+ declare class Database extends AbstractDatabase {
3
+ except(...params: Array<string>): this;
4
+ only(...params: Array<string>): this;
5
+ distinct(column?: string): this;
6
+ select(...params: string[]): this;
7
+ chunk(chunk: number): this;
8
+ when(value: string | number | undefined | null, cb: Function): this;
9
+ whereRaw(query: string): this;
10
+ where(column: string, operator?: any, value?: any): this;
11
+ whereId(id: number): this;
12
+ whereEmail(email: string): this;
13
+ whereUser(id: number): this;
14
+ orWhere(column: string, operator?: any, value?: any): this;
15
+ whereIn(column: string, arrayValues: Array<any>): this;
16
+ orWhereIn(column: string, arrayValues: Array<any>): this;
17
+ whereNotIn(column: string, arrayValues: Array<any>): this;
18
+ whereSubQuery(column: string, subQuery: string): this;
19
+ whereNotInSubQuery(column: string, subQuery: string): this;
20
+ orWhereSubQuery(column: string, subQuery: string): this;
21
+ whereBetween(column: string, arrayValue: Array<any>): this;
22
+ whereNull(column: string): this;
23
+ whereNotNull(column: string): this;
24
+ whereSensitive(column: string, operator?: any, value?: any): this;
25
+ whereGroupStart(column: string, operator?: any, value?: any): this;
26
+ orWhereGroupStart(column: string, operator?: any, value?: any): this;
27
+ whereGroupEnd(column: string, operator?: any, value?: any): this;
28
+ orWhereGroupEnd(column: string, operator?: any, value?: any): this;
29
+ having(condition: string): this;
30
+ join(pk: string, fk: string): this;
31
+ rightJoin(pk: string, fk: string): this;
32
+ leftJoin(pk: string, fk: string): this;
33
+ crossJoin(pk: string, fk: string): this;
34
+ orderBy(column: string, order?: any): this;
35
+ latest(column?: string): this;
36
+ oldest(column?: string): this;
37
+ groupBy(column: string): this;
38
+ limit(number?: number): this;
39
+ offset(number?: number): this;
40
+ hidden(...columns: Array<string>): this;
41
+ update(objects: object): this;
42
+ insert(objects: object): this;
43
+ create(objects: object): this;
44
+ createMultiple(data: Array<any>): this;
45
+ insertMultiple(data: Array<any>): this;
46
+ toString(): string;
47
+ toSQL(): string;
48
+ debug(debug?: boolean): this;
49
+ dump(debug?: boolean): this;
50
+ dd(debug?: boolean): this;
51
+ createNotExists(objects: object): this;
52
+ insertNotExists(objects: object): this;
53
+ upsert(objects: object): this;
54
+ updateOrCreate(objects: object): this;
55
+ updateOrInsert(objects: object): this;
56
+ insertOrUpdate(objects: object): this;
57
+ createOrUpdate(objects: object): this;
58
+ rawQuery(sql: string): Promise<any>;
59
+ increment(column?: string, value?: number): Promise<any>;
60
+ decrement(column?: string, value?: number): Promise<any>;
61
+ all(): Promise<any>;
62
+ find(id: number): Promise<any>;
63
+ pagination({ limit, page }?: {
64
+ limit?: number | undefined;
65
+ page?: number | undefined;
66
+ }): Promise<{
67
+ meta: {
68
+ total: number;
69
+ limit: number;
70
+ total_page: number;
71
+ current_page: number;
72
+ last_page: number;
73
+ next_page: number;
74
+ prev_page: number;
75
+ };
76
+ data: never[];
77
+ } | {
78
+ meta: {
79
+ total: number;
80
+ limit: number;
81
+ current_page: number;
82
+ last_page: number;
83
+ next_page: number;
84
+ prev_page: number;
85
+ total_page?: undefined;
86
+ };
87
+ data: any[];
88
+ }>;
89
+ paginate({ limit, page }?: {
90
+ limit?: number | undefined;
91
+ page?: number | undefined;
92
+ }): Promise<{
93
+ meta: {
94
+ total: number;
95
+ limit: number;
96
+ total_page: number;
97
+ current_page: number;
98
+ last_page: number;
99
+ next_page: number;
100
+ prev_page: number;
101
+ };
102
+ data: never[];
103
+ } | {
104
+ meta: {
105
+ total: number;
106
+ limit: number;
107
+ current_page: number;
108
+ last_page: number;
109
+ next_page: number;
110
+ prev_page: number;
111
+ total_page?: undefined;
112
+ };
113
+ data: any[];
114
+ }>;
115
+ first(): Promise<any>;
116
+ findOne(): Promise<any>;
117
+ get(): Promise<any[]>;
118
+ findMany(): Promise<any[]>;
119
+ toJSON(): Promise<string | never[]>;
120
+ toArray(column?: string): Promise<any[]>;
121
+ count(column?: string): Promise<any>;
122
+ exists(): Promise<boolean>;
123
+ avg(column?: string): Promise<any>;
124
+ sum(column?: string): Promise<any>;
125
+ max(column?: string): Promise<any>;
126
+ min(column?: string): Promise<any>;
127
+ delete(): Promise<boolean>;
128
+ forceDelete(): Promise<boolean>;
129
+ getGroupBy(column: string): Promise<any>;
130
+ findManyGroupBy(column: string): Promise<any>;
131
+ save(transaction?: {
132
+ query: {
133
+ table: string;
134
+ id: string;
135
+ }[];
136
+ }): Promise<any>;
137
+ faker(rounds?: number): Promise<any>;
138
+ truncate(): Promise<boolean>;
139
+ drop(): Promise<boolean>;
140
+ private _insertNotExists;
141
+ private _queryStatement;
142
+ private _actionStatement;
143
+ private _create;
144
+ private _createMultiple;
145
+ private _updateOrInsert;
146
+ private _update;
147
+ private _hiddenColumn;
148
+ private _queryUpdate;
149
+ private _queryInsert;
150
+ private _queryInsertMultiple;
151
+ private _valueAndOperator;
152
+ private _valueTrueFalse;
153
+ private _getSQL;
154
+ }
155
+ export default Database;