@pristine-ts/mysql 0.0.336
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/LICENSE +201 -0
- package/dist/lib/cjs/clients/clients.js +18 -0
- package/dist/lib/cjs/clients/clients.js.map +1 -0
- package/dist/lib/cjs/clients/mysql.client.js +350 -0
- package/dist/lib/cjs/clients/mysql.client.js.map +1 -0
- package/dist/lib/cjs/decorators/column.decorator.js +19 -0
- package/dist/lib/cjs/decorators/column.decorator.js.map +1 -0
- package/dist/lib/cjs/decorators/decorators.js +19 -0
- package/dist/lib/cjs/decorators/decorators.js.map +1 -0
- package/dist/lib/cjs/decorators/table.decorator.js +12 -0
- package/dist/lib/cjs/decorators/table.decorator.js.map +1 -0
- package/dist/lib/cjs/enums/decorator-metadata-keyname.enum.js +9 -0
- package/dist/lib/cjs/enums/decorator-metadata-keyname.enum.js.map +1 -0
- package/dist/lib/cjs/enums/enums.js +18 -0
- package/dist/lib/cjs/enums/enums.js.map +1 -0
- package/dist/lib/cjs/interfaces/column-decorator-metadata.interface.js +3 -0
- package/dist/lib/cjs/interfaces/column-decorator-metadata.interface.js.map +1 -0
- package/dist/lib/cjs/interfaces/interfaces.js +19 -0
- package/dist/lib/cjs/interfaces/interfaces.js.map +1 -0
- package/dist/lib/cjs/interfaces/mysql-client.interface.js +3 -0
- package/dist/lib/cjs/interfaces/mysql-client.interface.js.map +1 -0
- package/dist/lib/cjs/interfaces/table-decorator-metadata.interface.js +3 -0
- package/dist/lib/cjs/interfaces/table-decorator-metadata.interface.js.map +1 -0
- package/dist/lib/cjs/mysql.module.js +86 -0
- package/dist/lib/cjs/mysql.module.js.map +1 -0
- package/dist/lib/cjs/mysql.module.keyname.js +5 -0
- package/dist/lib/cjs/mysql.module.keyname.js.map +1 -0
- package/dist/lib/cjs/strategies/camel-case-column.strategy.js +8 -0
- package/dist/lib/cjs/strategies/camel-case-column.strategy.js.map +1 -0
- package/dist/lib/cjs/strategies/snake-case-column.strategy.js +8 -0
- package/dist/lib/cjs/strategies/snake-case-column.strategy.js.map +1 -0
- package/dist/lib/cjs/strategies/strategies.js +19 -0
- package/dist/lib/cjs/strategies/strategies.js.map +1 -0
- package/dist/lib/cjs/types/column-naming-strategy.type.js +3 -0
- package/dist/lib/cjs/types/column-naming-strategy.type.js.map +1 -0
- package/dist/lib/cjs/types/types.js +18 -0
- package/dist/lib/cjs/types/types.js.map +1 -0
- package/dist/lib/esm/clients/clients.js +2 -0
- package/dist/lib/esm/clients/clients.js.map +1 -0
- package/dist/lib/esm/clients/mysql.client.js +347 -0
- package/dist/lib/esm/clients/mysql.client.js.map +1 -0
- package/dist/lib/esm/decorators/column.decorator.js +15 -0
- package/dist/lib/esm/decorators/column.decorator.js.map +1 -0
- package/dist/lib/esm/decorators/decorators.js +3 -0
- package/dist/lib/esm/decorators/decorators.js.map +1 -0
- package/dist/lib/esm/decorators/table.decorator.js +8 -0
- package/dist/lib/esm/decorators/table.decorator.js.map +1 -0
- package/dist/lib/esm/enums/decorator-metadata-keyname.enum.js +6 -0
- package/dist/lib/esm/enums/decorator-metadata-keyname.enum.js.map +1 -0
- package/dist/lib/esm/enums/enums.js +2 -0
- package/dist/lib/esm/enums/enums.js.map +1 -0
- package/dist/lib/esm/interfaces/column-decorator-metadata.interface.js +2 -0
- package/dist/lib/esm/interfaces/column-decorator-metadata.interface.js.map +1 -0
- package/dist/lib/esm/interfaces/interfaces.js +3 -0
- package/dist/lib/esm/interfaces/interfaces.js.map +1 -0
- package/dist/lib/esm/interfaces/mysql-client.interface.js +2 -0
- package/dist/lib/esm/interfaces/mysql-client.interface.js.map +1 -0
- package/dist/lib/esm/interfaces/table-decorator-metadata.interface.js +2 -0
- package/dist/lib/esm/interfaces/table-decorator-metadata.interface.js.map +1 -0
- package/dist/lib/esm/mysql.module.js +69 -0
- package/dist/lib/esm/mysql.module.js.map +1 -0
- package/dist/lib/esm/mysql.module.keyname.js +2 -0
- package/dist/lib/esm/mysql.module.keyname.js.map +1 -0
- package/dist/lib/esm/strategies/camel-case-column.strategy.js +4 -0
- package/dist/lib/esm/strategies/camel-case-column.strategy.js.map +1 -0
- package/dist/lib/esm/strategies/snake-case-column.strategy.js +4 -0
- package/dist/lib/esm/strategies/snake-case-column.strategy.js.map +1 -0
- package/dist/lib/esm/strategies/strategies.js +3 -0
- package/dist/lib/esm/strategies/strategies.js.map +1 -0
- package/dist/lib/esm/types/column-naming-strategy.type.js +2 -0
- package/dist/lib/esm/types/column-naming-strategy.type.js.map +1 -0
- package/dist/lib/esm/types/types.js +2 -0
- package/dist/lib/esm/types/types.js.map +1 -0
- package/dist/types/clients/clients.d.ts +1 -0
- package/dist/types/clients/mysql.client.d.ts +148 -0
- package/dist/types/decorators/column.decorator.d.ts +2 -0
- package/dist/types/decorators/decorators.d.ts +2 -0
- package/dist/types/decorators/table.decorator.d.ts +2 -0
- package/dist/types/enums/decorator-metadata-keyname.enum.d.ts +4 -0
- package/dist/types/enums/enums.d.ts +1 -0
- package/dist/types/interfaces/column-decorator-metadata.interface.d.ts +10 -0
- package/dist/types/interfaces/interfaces.d.ts +2 -0
- package/dist/types/interfaces/mysql-client.interface.d.ts +135 -0
- package/dist/types/interfaces/table-decorator-metadata.interface.d.ts +6 -0
- package/dist/types/mysql.module.d.ts +9 -0
- package/dist/types/mysql.module.keyname.d.ts +1 -0
- package/dist/types/strategies/camel-case-column.strategy.d.ts +2 -0
- package/dist/types/strategies/snake-case-column.strategy.d.ts +2 -0
- package/dist/types/strategies/strategies.d.ts +2 -0
- package/dist/types/types/column-naming-strategy.type.d.ts +1 -0
- package/dist/types/types/types.d.ts +1 -0
- package/package.json +69 -0
- package/readme.md +1 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./mysql.client"), exports);
|
|
18
|
+
//# sourceMappingURL=clients.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clients.js","sourceRoot":"","sources":["../../../../src/clients/clients.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B"}
|
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
15
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
16
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
17
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
18
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
19
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
20
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.MysqlClient = void 0;
|
|
25
|
+
const tsyringe_1 = require("tsyringe");
|
|
26
|
+
const metadata_1 = require("@pristine-ts/metadata");
|
|
27
|
+
const decorator_metadata_keyname_enum_1 = require("../enums/decorator-metadata-keyname.enum");
|
|
28
|
+
const mysql_module_keyname_1 = require("../mysql.module.keyname");
|
|
29
|
+
const promise_1 = require("mysql2/promise");
|
|
30
|
+
const data_mapping_common_1 = require("@pristine-ts/data-mapping-common");
|
|
31
|
+
const mysql_common_1 = require("@pristine-ts/mysql-common");
|
|
32
|
+
const common_1 = require("@pristine-ts/common");
|
|
33
|
+
let MysqlClient = class MysqlClient {
|
|
34
|
+
constructor(address, port, user, password, connectionLimit, debug, logHandler, dataMapper) {
|
|
35
|
+
this.address = address;
|
|
36
|
+
this.port = port;
|
|
37
|
+
this.user = user;
|
|
38
|
+
this.password = password;
|
|
39
|
+
this.connectionLimit = connectionLimit;
|
|
40
|
+
this.debug = debug;
|
|
41
|
+
this.logHandler = logHandler;
|
|
42
|
+
this.dataMapper = dataMapper;
|
|
43
|
+
this.pools = new Map();
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* This method returns a pool of connections to the database.
|
|
47
|
+
* @param databaseName
|
|
48
|
+
* @param force
|
|
49
|
+
*/
|
|
50
|
+
getPool(databaseName, force = false) {
|
|
51
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
if (!this.pools.has(databaseName) && !force) {
|
|
53
|
+
try {
|
|
54
|
+
const pool = (0, promise_1.createPool)({
|
|
55
|
+
connectionLimit: this.connectionLimit,
|
|
56
|
+
host: this.address,
|
|
57
|
+
port: this.port,
|
|
58
|
+
user: this.user,
|
|
59
|
+
password: this.password,
|
|
60
|
+
database: databaseName,
|
|
61
|
+
debug: this.debug,
|
|
62
|
+
});
|
|
63
|
+
this.pools.set(databaseName, pool);
|
|
64
|
+
this.logHandler.debug('MySql Adapter Pool generated successfully', {
|
|
65
|
+
connectionLimit: this.connectionLimit,
|
|
66
|
+
host: this.address,
|
|
67
|
+
user: this.user,
|
|
68
|
+
password: this.password,
|
|
69
|
+
database: databaseName,
|
|
70
|
+
pool,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
this.logHandler.error("Could not create the connection pool", { error });
|
|
75
|
+
throw error;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return this.pools.get(databaseName);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* This method returns the table metadata for a given class.
|
|
83
|
+
* @param classType
|
|
84
|
+
*/
|
|
85
|
+
getTableMetadata(classType) {
|
|
86
|
+
const tableMetadata = metadata_1.ClassMetadata.getMetadata(classType, decorator_metadata_keyname_enum_1.DecoratorMetadataKeynameEnum.Table);
|
|
87
|
+
if (!tableMetadata) {
|
|
88
|
+
throw new Error(`The class ${classType.name} does not have the @table decorator.`);
|
|
89
|
+
}
|
|
90
|
+
return tableMetadata;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* This method returns the columns metadata for a given class.
|
|
94
|
+
* @param classType
|
|
95
|
+
*/
|
|
96
|
+
getColumnsMetadata(classType) {
|
|
97
|
+
const properties = metadata_1.ClassMetadata.getInformation(classType).properties;
|
|
98
|
+
const columnsMetadata = {};
|
|
99
|
+
for (const property of properties) {
|
|
100
|
+
const columnMetadata = this.getColumnMetadata(classType, property);
|
|
101
|
+
if (columnMetadata) {
|
|
102
|
+
columnsMetadata[property] = columnMetadata;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return columnsMetadata;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* This method returns the column metadata for a given class and property name.
|
|
109
|
+
* @param classType
|
|
110
|
+
* @param propertyName
|
|
111
|
+
*/
|
|
112
|
+
getColumnMetadata(classType, propertyName) {
|
|
113
|
+
const metadata = metadata_1.PropertyMetadata.getMetadata(classType.prototype, propertyName, decorator_metadata_keyname_enum_1.DecoratorMetadataKeynameEnum.Column);
|
|
114
|
+
if (!metadata) {
|
|
115
|
+
throw new Error(`The property ${propertyName} does not have the @column decorator.`);
|
|
116
|
+
}
|
|
117
|
+
return metadata;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* This method returns the primary key property name for a given class.
|
|
121
|
+
* @param classType
|
|
122
|
+
*/
|
|
123
|
+
getPrimaryKeyPropertyName(classType) {
|
|
124
|
+
const columns = this.getColumnsMetadata(classType);
|
|
125
|
+
let primaryKeyColumn = null;
|
|
126
|
+
for (const column in columns) {
|
|
127
|
+
if (columns[column].isPrimaryKey) {
|
|
128
|
+
if (primaryKeyColumn) {
|
|
129
|
+
throw new Error(`The class ${classType.name} has more than one primary key.`);
|
|
130
|
+
}
|
|
131
|
+
primaryKeyColumn = column;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
if (!primaryKeyColumn) {
|
|
135
|
+
throw new Error(`The class ${classType.name} does not have a primary key.`);
|
|
136
|
+
}
|
|
137
|
+
return primaryKeyColumn;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* This method returns the primary key column name for a given class.
|
|
141
|
+
* @param classType
|
|
142
|
+
*/
|
|
143
|
+
getPrimaryKeyColumnName(classType) {
|
|
144
|
+
return this.getColumnName(classType, this.getPrimaryKeyPropertyName(classType));
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* This method returns the column name for a given class and property name.
|
|
148
|
+
*
|
|
149
|
+
* @param classType
|
|
150
|
+
* @param propertyName
|
|
151
|
+
*/
|
|
152
|
+
getColumnName(classType, propertyName) {
|
|
153
|
+
const columns = this.getColumnsMetadata(classType);
|
|
154
|
+
const column = this.getColumnMetadata(classType, propertyName);
|
|
155
|
+
if (column.name) {
|
|
156
|
+
return column.name;
|
|
157
|
+
}
|
|
158
|
+
const tableMetadata = this.getTableMetadata(classType);
|
|
159
|
+
if (tableMetadata.autoColumnNamingStrategy) {
|
|
160
|
+
return tableMetadata.autoColumnNamingStrategy(propertyName);
|
|
161
|
+
}
|
|
162
|
+
return propertyName;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* This method returns the column name for a given class and property name.
|
|
166
|
+
* @param databaseName
|
|
167
|
+
* @param sqlStatement
|
|
168
|
+
* @param values
|
|
169
|
+
*/
|
|
170
|
+
executeSql(databaseName, sqlStatement, values) {
|
|
171
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
172
|
+
const pool = yield this.getPool(databaseName);
|
|
173
|
+
this.logHandler.debug("Executing SQL Statement", { sqlStatement, values });
|
|
174
|
+
try {
|
|
175
|
+
const result = yield pool.query(sqlStatement, values);
|
|
176
|
+
this.logHandler.debug("Successfully executed the SQL Statement", { sqlStatement, values, result });
|
|
177
|
+
return result;
|
|
178
|
+
}
|
|
179
|
+
catch (error) {
|
|
180
|
+
this.logHandler.error("There was an error executing the SQL Statement", {
|
|
181
|
+
sqlStatement,
|
|
182
|
+
values,
|
|
183
|
+
error,
|
|
184
|
+
});
|
|
185
|
+
throw error;
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* This method maps the results to a given class type.
|
|
191
|
+
* @param classType
|
|
192
|
+
* @param results
|
|
193
|
+
*/
|
|
194
|
+
mapResults(classType, results) {
|
|
195
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
196
|
+
// Transform back the column names from the strategy
|
|
197
|
+
const tableMetadata = this.getTableMetadata(classType);
|
|
198
|
+
if (tableMetadata.autoColumnNamingStrategyReverse) {
|
|
199
|
+
results = results.map((result) => {
|
|
200
|
+
for (const key in result) {
|
|
201
|
+
const newKey = tableMetadata.autoColumnNamingStrategyReverse(key);
|
|
202
|
+
result[newKey] = result[key];
|
|
203
|
+
delete result[key];
|
|
204
|
+
}
|
|
205
|
+
return result;
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
return this.dataMapper.autoMap(results, classType);
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* This method returns a single element from the database.
|
|
213
|
+
* @param databaseName
|
|
214
|
+
* @param classType
|
|
215
|
+
* @param primaryKey
|
|
216
|
+
*/
|
|
217
|
+
get(databaseName, classType, primaryKey) {
|
|
218
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
219
|
+
const sql = `SELECT * FROM ${this.getTableMetadata(classType).tableName} WHERE ${this.getPrimaryKeyColumnName(classType)} = ?`;
|
|
220
|
+
const values = yield this.executeSql(databaseName, sql, [primaryKey]);
|
|
221
|
+
return (yield this.mapResults(classType, values))[0];
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* This method creates a new element in the database.
|
|
226
|
+
* @param databaseName
|
|
227
|
+
* @param element
|
|
228
|
+
*/
|
|
229
|
+
create(databaseName, element) {
|
|
230
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
231
|
+
const columns = this.getColumnsMetadata(element.constructor);
|
|
232
|
+
const columnNames = Object.keys(columns).map(column => this.getColumnName(element.constructor, column));
|
|
233
|
+
const columnValues = Object.keys(columns).map(column => element[column]);
|
|
234
|
+
// Generate update SQL statement:
|
|
235
|
+
const sql = `INSERT INTO ${this.getTableMetadata(element.constructor).tableName} (${columnNames.join(", ")}) VALUES (${columnValues.map(() => "?").join(", ")})`;
|
|
236
|
+
yield this.executeSql(databaseName, sql, columnValues);
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* This method updates an element in the database.
|
|
241
|
+
* @param databaseName
|
|
242
|
+
* @param element
|
|
243
|
+
*/
|
|
244
|
+
update(databaseName, element) {
|
|
245
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
246
|
+
const columns = this.getColumnsMetadata(element.constructor);
|
|
247
|
+
const primaryKeyColumnName = this.getPrimaryKeyColumnName(element.constructor);
|
|
248
|
+
const primaryKeyPropertyName = this.getPrimaryKeyPropertyName(element.constructor);
|
|
249
|
+
const primaryKeyValue = element[primaryKeyPropertyName];
|
|
250
|
+
const propertyNames = Object.keys(columns).filter(column => column !== primaryKeyPropertyName);
|
|
251
|
+
const columnNames = propertyNames.map(column => this.getColumnName(element.constructor, column));
|
|
252
|
+
const columnValues = propertyNames.map(column => element[column]);
|
|
253
|
+
// Add it since it will be the last element that will tell us which row to update.
|
|
254
|
+
columnValues.push(primaryKeyValue);
|
|
255
|
+
const sql = `UPDATE ${this.getTableMetadata(element.constructor).tableName} SET ${columnNames.join(" = ?, ")} = ? WHERE ${primaryKeyColumnName} = ?`;
|
|
256
|
+
yield this.executeSql(databaseName, sql, columnValues);
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* This method deletes an element in the database.
|
|
261
|
+
* @param databaseName
|
|
262
|
+
* @param classType
|
|
263
|
+
* @param primaryKey
|
|
264
|
+
*/
|
|
265
|
+
delete(databaseName, classType, primaryKey) {
|
|
266
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
267
|
+
const sql = `DELETE FROM ${this.getTableMetadata(classType).tableName} WHERE ${this.getPrimaryKeyColumnName(classType)} = ?`;
|
|
268
|
+
yield this.executeSql(databaseName, sql, [primaryKey]);
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* This method searches the database.
|
|
273
|
+
* @param databaseName
|
|
274
|
+
* @param classType
|
|
275
|
+
* @param query
|
|
276
|
+
*/
|
|
277
|
+
search(databaseName, classType, query) {
|
|
278
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
279
|
+
let sql = "";
|
|
280
|
+
const columns = this.getColumnsMetadata(classType);
|
|
281
|
+
const defaultSearchableFields = Object.keys(columns).filter(column => columns[column].isSearchable).map(column => this.getColumnName(classType, column));
|
|
282
|
+
const tableName = this.getTableMetadata(classType).tableName;
|
|
283
|
+
const sqlValues = [];
|
|
284
|
+
// Look in the query.fields and look for all the fields that should not be excluded, or that are included explicitly. If there are no fields that match, include `title` and `calculationKeyname` as default fields.
|
|
285
|
+
if (query.query) {
|
|
286
|
+
let fieldsToSearch = query.fields.filter(field => field.includeExplicitly === true).map(field => field.field);
|
|
287
|
+
if (fieldsToSearch.length === 0) {
|
|
288
|
+
fieldsToSearch = defaultSearchableFields;
|
|
289
|
+
}
|
|
290
|
+
// Exclude all the fields that are marked as excluded
|
|
291
|
+
fieldsToSearch = fieldsToSearch.filter(fieldName => {
|
|
292
|
+
const field = query.fields.find(field => field.field === fieldName && field.exclude);
|
|
293
|
+
if (field === undefined) {
|
|
294
|
+
return true;
|
|
295
|
+
}
|
|
296
|
+
// Exclude the excluded field.
|
|
297
|
+
return false;
|
|
298
|
+
});
|
|
299
|
+
// Converts each element in fieldsToSearch from camelCase to snakeCase
|
|
300
|
+
fieldsToSearch = fieldsToSearch.map(field => field.replace(/([A-Z])/g, "_$1").toLowerCase());
|
|
301
|
+
// For each fieldsToSearch, add a LIKE clause to the SQL
|
|
302
|
+
sql += " AND " + fieldsToSearch.map(field => field + " LIKE ?").join(" OR ");
|
|
303
|
+
fieldsToSearch.forEach(field => sqlValues.push("%" + query.query + "%"));
|
|
304
|
+
}
|
|
305
|
+
//
|
|
306
|
+
// ORDERING
|
|
307
|
+
//
|
|
308
|
+
const orderBy = [];
|
|
309
|
+
query.fields.forEach(field => {
|
|
310
|
+
if (field.order) {
|
|
311
|
+
// Convert the field from camelCase to snakeCase
|
|
312
|
+
const snakeCaseField = field.field.replace(/([A-Z])/g, "_$1").toLowerCase();
|
|
313
|
+
orderBy.push(snakeCaseField + " " + field.order.toUpperCase());
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
if (orderBy.length > 0) {
|
|
317
|
+
sql += " ORDER BY " + orderBy.join(", ");
|
|
318
|
+
}
|
|
319
|
+
const totalNumberOfResults = (yield this.executeSql(databaseName, "SELECT COUNT(*) as total_number_of_results FROM `" + tableName + "` WHERE 1=1 " + sql, sqlValues))[0]["total_number_of_results"];
|
|
320
|
+
//
|
|
321
|
+
// PAGING
|
|
322
|
+
//
|
|
323
|
+
// If there's a page, add the limit and offset
|
|
324
|
+
sql += " LIMIT " + query.maximumNumberOfResultsPerPage + " OFFSET " + (query.page - 1) * query.maximumNumberOfResultsPerPage;
|
|
325
|
+
const response = yield this.executeSql(databaseName, "SELECT * FROM `" + tableName + "` WHERE 1=1 " + sql, sqlValues);
|
|
326
|
+
const searchResult = new mysql_common_1.SearchResult();
|
|
327
|
+
searchResult.page = query.page;
|
|
328
|
+
searchResult.totalNumberOfResults = totalNumberOfResults;
|
|
329
|
+
searchResult.results = yield this.mapResults(classType, response);
|
|
330
|
+
searchResult.maximumNumberOfResultsPerPage = query.maximumNumberOfResultsPerPage;
|
|
331
|
+
searchResult.numberOfResultsReturned = response.length;
|
|
332
|
+
return searchResult;
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
};
|
|
336
|
+
exports.MysqlClient = MysqlClient;
|
|
337
|
+
exports.MysqlClient = MysqlClient = __decorate([
|
|
338
|
+
(0, common_1.tag)("MysqlClientInterface"),
|
|
339
|
+
(0, tsyringe_1.injectable)(),
|
|
340
|
+
(0, tsyringe_1.singleton)(),
|
|
341
|
+
__param(0, (0, tsyringe_1.inject)(`%${mysql_module_keyname_1.MysqlModuleKeyname}.address%`)),
|
|
342
|
+
__param(1, (0, tsyringe_1.inject)(`%${mysql_module_keyname_1.MysqlModuleKeyname}.port%`)),
|
|
343
|
+
__param(2, (0, tsyringe_1.inject)(`%${mysql_module_keyname_1.MysqlModuleKeyname}.user%`)),
|
|
344
|
+
__param(3, (0, tsyringe_1.inject)(`%${mysql_module_keyname_1.MysqlModuleKeyname}.password%`)),
|
|
345
|
+
__param(4, (0, tsyringe_1.inject)(`%${mysql_module_keyname_1.MysqlModuleKeyname}.connection_limit%`)),
|
|
346
|
+
__param(5, (0, tsyringe_1.inject)(`%${mysql_module_keyname_1.MysqlModuleKeyname}.debug%`)),
|
|
347
|
+
__param(6, (0, tsyringe_1.inject)('LogHandlerInterface')),
|
|
348
|
+
__metadata("design:paramtypes", [String, Number, String, String, Number, Boolean, Object, data_mapping_common_1.DataMapper])
|
|
349
|
+
], MysqlClient);
|
|
350
|
+
//# sourceMappingURL=mysql.client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mysql.client.js","sourceRoot":"","sources":["../../../../src/clients/mysql.client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAuD;AAEvD,oDAAsE;AACtE,8FAAsF;AAGtF,kEAA2D;AAC3D,4CAAgD;AAEhD,0EAA4D;AAC5D,4DAAoE;AACpE,gDAAwC;AAKjC,IAAM,WAAW,GAAjB,MAAM,WAAW;IAGpB,YAAuD,OAAgC,EACnC,IAA6B,EAC7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G,EAAC,sBAAsB,CAAC;IAC3B,IAAA,qBAAU,GAAE;IACZ,IAAA,oBAAS,GAAE;IAIK,WAAA,IAAA,iBAAM,EAAC,IAAI,yCAAkB,WAAW,CAAC,CAAA;IACzC,WAAA,IAAA,iBAAM,EAAC,IAAI,yCAAkB,QAAQ,CAAC,CAAA;IACtC,WAAA,IAAA,iBAAM,EAAC,IAAI,yCAAkB,QAAQ,CAAC,CAAA;IACtC,WAAA,IAAA,iBAAM,EAAC,IAAI,yCAAkB,YAAY,CAAC,CAAA;IAC1C,WAAA,IAAA,iBAAM,EAAC,IAAI,yCAAkB,oBAAoB,CAAC,CAAA;IAClD,WAAA,IAAA,iBAAM,EAAC,IAAI,yCAAkB,SAAS,CAAC,CAAA;IACvC,WAAA,IAAA,iBAAM,EAAC,qBAAqB,CAAC,CAAA;8FACD,gCAAU;GAV1C,WAAW,CAmWvB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.column = void 0;
|
|
4
|
+
const metadata_1 = require("@pristine-ts/metadata");
|
|
5
|
+
const decorator_metadata_keyname_enum_1 = require("../enums/decorator-metadata-keyname.enum");
|
|
6
|
+
const column = (element) => {
|
|
7
|
+
return (target, propertyKey) => {
|
|
8
|
+
if (!element) {
|
|
9
|
+
element = {};
|
|
10
|
+
}
|
|
11
|
+
if ((element === null || element === void 0 ? void 0 : element.isSearchable) === undefined) {
|
|
12
|
+
// Default value is true for isSearchable.
|
|
13
|
+
element.isSearchable = true;
|
|
14
|
+
}
|
|
15
|
+
metadata_1.PropertyMetadata.defineMetadata(target, propertyKey, decorator_metadata_keyname_enum_1.DecoratorMetadataKeynameEnum.Column, element !== null && element !== void 0 ? element : {});
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
exports.column = column;
|
|
19
|
+
//# sourceMappingURL=column.decorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"column.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/column.decorator.ts"],"names":[],"mappings":";;;AAAA,oDAAuD;AAEvD,8FAAsF;AAE/E,MAAM,MAAM,GAAG,CAAC,OAA0C,EAAE,EAAE;IACjE,OAAO,CAAC,MAAW,EAAE,WAAmB,EAAE,EAAE;QAExC,IAAG,CAAC,OAAO,EAAE,CAAC;YACV,OAAO,GAAG,EAAE,CAAC;QACjB,CAAC;QAED,IAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,YAAY,MAAK,SAAS,EAAE,CAAC;YACrC,0CAA0C;YAC1C,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;QAChC,CAAC;QAED,2BAAgB,CAAC,cAAc,CAAC,MAAM,EAAE,WAAW,EAAE,8DAA4B,CAAC,MAAM,EAAE,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,EAAE,CAAC,CAAA;IAC5G,CAAC,CAAA;AACL,CAAC,CAAC;AAdW,QAAA,MAAM,UAcjB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./column.decorator"), exports);
|
|
18
|
+
__exportStar(require("./table.decorator"), exports);
|
|
19
|
+
//# sourceMappingURL=decorators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../../../src/decorators/decorators.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,oDAAkC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.table = void 0;
|
|
4
|
+
const metadata_1 = require("@pristine-ts/metadata");
|
|
5
|
+
const decorator_metadata_keyname_enum_1 = require("../enums/decorator-metadata-keyname.enum");
|
|
6
|
+
const table = (parameters) => {
|
|
7
|
+
return (constructor) => {
|
|
8
|
+
metadata_1.ClassMetadata.defineMetadata(constructor, decorator_metadata_keyname_enum_1.DecoratorMetadataKeynameEnum.Table, parameters);
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
exports.table = table;
|
|
12
|
+
//# sourceMappingURL=table.decorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/table.decorator.ts"],"names":[],"mappings":";;;AACA,oDAAoD;AACpD,8FAAsF;AAE/E,MAAM,KAAK,GAAG,CAAC,UAA2C,EAAE,EAAE;IACjE,OAAO,CAAC,WAAgB,EAAE,EAAE;QACxB,wBAAa,CAAC,cAAc,CAAC,WAAW,EAAE,8DAA4B,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;IAC9F,CAAC,CAAC;AACN,CAAC,CAAC;AAJW,QAAA,KAAK,SAIhB"}
|