@cuboapp/database 1.0.0 → 1.0.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cuboapp/database",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Database methods",
5
5
  "main": "src/index.ts",
6
6
  "repository": "git@cuboapp.gitlab.yandexcloud.net:cubo/database.git",
@@ -11,7 +11,6 @@
11
11
  "access": "public"
12
12
  },
13
13
  "dependencies": {
14
- "pg": "^8.16.3",
15
14
  "sequelize": "^6.37.7"
16
15
  },
17
16
  "devDependencies": {
package/src/db/index.ts CHANGED
@@ -3,6 +3,10 @@ import { Options, QueryTypes, Sequelize, Transaction } from 'sequelize'
3
3
  import { DatabaseOptions } from './types'
4
4
  import { dbPrepareInsertQueryString, dbPrepareUpdateQueryString } from './utils'
5
5
 
6
+ export * from 'sequelize'
7
+ export * from './types'
8
+ export * from './utils'
9
+
6
10
  export class Database {
7
11
  public connection: Sequelize
8
12
 
@@ -40,7 +44,7 @@ export class Database {
40
44
  return this.connection.close()
41
45
  }
42
46
 
43
- public async create<T = number | string>(
47
+ public async create<T extends number | string = number>(
44
48
  table: string,
45
49
  arInsert: any,
46
50
  opts?: { log?: boolean; transaction?: Transaction; pk_key?: string; pk_type?: 'string' | 'number' }
package/src/db/utils.ts CHANGED
@@ -1,4 +1,7 @@
1
- import { QueryTypes, Sequelize, Transaction } from 'sequelize'
1
+ import { Options, QueryTypes, Sequelize, Transaction } from 'sequelize'
2
+
3
+ import { Database } from '.'
4
+ import { DatabaseOptions } from './types'
2
5
 
3
6
  export function dbPrepareUpdateQueryString(obj: Record<string, any>, prefix = '') {
4
7
  const keys: string[] = []
@@ -126,3 +129,7 @@ export async function dbUpdate(
126
129
  })
127
130
  }
128
131
  }
132
+
133
+ export function createDatabase(opts: Options, otherOptions?: DatabaseOptions) {
134
+ return new Database(opts, otherOptions)
135
+ }
package/pnpm-lock.yaml DELETED
@@ -1,314 +0,0 @@
1
- lockfileVersion: '9.0'
2
-
3
- settings:
4
- autoInstallPeers: true
5
- excludeLinksFromLockfile: false
6
-
7
- importers:
8
-
9
- .:
10
- dependencies:
11
- pg:
12
- specifier: ^8.16.3
13
- version: 8.16.3
14
- sequelize:
15
- specifier: ^6.37.7
16
- version: 6.37.7(pg@8.16.3)
17
- devDependencies:
18
- '@types/node':
19
- specifier: ^24.0.0
20
- version: 24.8.1
21
- typescript:
22
- specifier: ^5.9.3
23
- version: 5.9.3
24
-
25
- packages:
26
-
27
- '@types/debug@4.1.12':
28
- resolution: {integrity: sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==}
29
-
30
- '@types/ms@2.1.0':
31
- resolution: {integrity: sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==}
32
-
33
- '@types/node@24.8.1':
34
- resolution: {integrity: sha512-alv65KGRadQVfVcG69MuB4IzdYVpRwMG/mq8KWOaoOdyY617P5ivaDiMCGOFDWD2sAn5Q0mR3mRtUOgm99hL9Q==}
35
-
36
- '@types/validator@13.15.3':
37
- resolution: {integrity: sha512-7bcUmDyS6PN3EuD9SlGGOxM77F8WLVsrwkxyWxKnxzmXoequ6c7741QBrANq6htVRGOITJ7z72mTP6Z4XyuG+Q==}
38
-
39
- debug@4.4.3:
40
- resolution: {integrity: sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==}
41
- engines: {node: '>=6.0'}
42
- peerDependencies:
43
- supports-color: '*'
44
- peerDependenciesMeta:
45
- supports-color:
46
- optional: true
47
-
48
- dottie@2.0.6:
49
- resolution: {integrity: sha512-iGCHkfUc5kFekGiqhe8B/mdaurD+lakO9txNnTvKtA6PISrw86LgqHvRzWYPyoE2Ph5aMIrCw9/uko6XHTKCwA==}
50
-
51
- inflection@1.13.4:
52
- resolution: {integrity: sha512-6I/HUDeYFfuNCVS3td055BaXBwKYuzw7K3ExVMStBowKo9oOAMJIXIHvdyR3iboTCp1b+1i5DSkIZTcwIktuDw==}
53
- engines: {'0': node >= 0.4.0}
54
-
55
- lodash@4.17.21:
56
- resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==}
57
-
58
- moment-timezone@0.5.48:
59
- resolution: {integrity: sha512-f22b8LV1gbTO2ms2j2z13MuPogNoh5UzxL3nzNAYKGraILnbGc9NEE6dyiiiLv46DGRb8A4kg8UKWLjPthxBHw==}
60
-
61
- moment@2.30.1:
62
- resolution: {integrity: sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==}
63
-
64
- ms@2.1.3:
65
- resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==}
66
-
67
- pg-cloudflare@1.2.7:
68
- resolution: {integrity: sha512-YgCtzMH0ptvZJslLM1ffsY4EuGaU0cx4XSdXLRFae8bPP4dS5xL1tNB3k2o/N64cHJpwU7dxKli/nZ2lUa5fLg==}
69
-
70
- pg-connection-string@2.9.1:
71
- resolution: {integrity: sha512-nkc6NpDcvPVpZXxrreI/FOtX3XemeLl8E0qFr6F2Lrm/I8WOnaWNhIPK2Z7OHpw7gh5XJThi6j6ppgNoaT1w4w==}
72
-
73
- pg-int8@1.0.1:
74
- resolution: {integrity: sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==}
75
- engines: {node: '>=4.0.0'}
76
-
77
- pg-pool@3.10.1:
78
- resolution: {integrity: sha512-Tu8jMlcX+9d8+QVzKIvM/uJtp07PKr82IUOYEphaWcoBhIYkoHpLXN3qO59nAI11ripznDsEzEv8nUxBVWajGg==}
79
- peerDependencies:
80
- pg: '>=8.0'
81
-
82
- pg-protocol@1.10.3:
83
- resolution: {integrity: sha512-6DIBgBQaTKDJyxnXaLiLR8wBpQQcGWuAESkRBX/t6OwA8YsqP+iVSiond2EDy6Y/dsGk8rh/jtax3js5NeV7JQ==}
84
-
85
- pg-types@2.2.0:
86
- resolution: {integrity: sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==}
87
- engines: {node: '>=4'}
88
-
89
- pg@8.16.3:
90
- resolution: {integrity: sha512-enxc1h0jA/aq5oSDMvqyW3q89ra6XIIDZgCX9vkMrnz5DFTw/Ny3Li2lFQ+pt3L6MCgm/5o2o8HW9hiJji+xvw==}
91
- engines: {node: '>= 16.0.0'}
92
- peerDependencies:
93
- pg-native: '>=3.0.1'
94
- peerDependenciesMeta:
95
- pg-native:
96
- optional: true
97
-
98
- pgpass@1.0.5:
99
- resolution: {integrity: sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug==}
100
-
101
- postgres-array@2.0.0:
102
- resolution: {integrity: sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA==}
103
- engines: {node: '>=4'}
104
-
105
- postgres-bytea@1.0.0:
106
- resolution: {integrity: sha512-xy3pmLuQqRBZBXDULy7KbaitYqLcmxigw14Q5sj8QBVLqEwXfeybIKVWiqAXTlcvdvb0+xkOtDbfQMOf4lST1w==}
107
- engines: {node: '>=0.10.0'}
108
-
109
- postgres-date@1.0.7:
110
- resolution: {integrity: sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q==}
111
- engines: {node: '>=0.10.0'}
112
-
113
- postgres-interval@1.2.0:
114
- resolution: {integrity: sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ==}
115
- engines: {node: '>=0.10.0'}
116
-
117
- retry-as-promised@7.1.1:
118
- resolution: {integrity: sha512-hMD7odLOt3LkTjcif8aRZqi/hybjpLNgSk5oF5FCowfCjok6LukpN2bDX7R5wDmbgBQFn7YoBxSagmtXHaJYJw==}
119
-
120
- semver@7.7.3:
121
- resolution: {integrity: sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==}
122
- engines: {node: '>=10'}
123
- hasBin: true
124
-
125
- sequelize-pool@7.1.0:
126
- resolution: {integrity: sha512-G9c0qlIWQSK29pR/5U2JF5dDQeqqHRragoyahj/Nx4KOOQ3CPPfzxnfqFPCSB7x5UgjOgnZ61nSxz+fjDpRlJg==}
127
- engines: {node: '>= 10.0.0'}
128
-
129
- sequelize@6.37.7:
130
- resolution: {integrity: sha512-mCnh83zuz7kQxxJirtFD7q6Huy6liPanI67BSlbzSYgVNl5eXVdE2CN1FuAeZwG1SNpGsNRCV+bJAVVnykZAFA==}
131
- engines: {node: '>=10.0.0'}
132
- peerDependencies:
133
- ibm_db: '*'
134
- mariadb: '*'
135
- mysql2: '*'
136
- oracledb: '*'
137
- pg: '*'
138
- pg-hstore: '*'
139
- snowflake-sdk: '*'
140
- sqlite3: '*'
141
- tedious: '*'
142
- peerDependenciesMeta:
143
- ibm_db:
144
- optional: true
145
- mariadb:
146
- optional: true
147
- mysql2:
148
- optional: true
149
- oracledb:
150
- optional: true
151
- pg:
152
- optional: true
153
- pg-hstore:
154
- optional: true
155
- snowflake-sdk:
156
- optional: true
157
- sqlite3:
158
- optional: true
159
- tedious:
160
- optional: true
161
-
162
- split2@4.2.0:
163
- resolution: {integrity: sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==}
164
- engines: {node: '>= 10.x'}
165
-
166
- toposort-class@1.0.1:
167
- resolution: {integrity: sha512-OsLcGGbYF3rMjPUf8oKktyvCiUxSbqMMS39m33MAjLTC1DVIH6x3WSt63/M77ihI09+Sdfk1AXvfhCEeUmC7mg==}
168
-
169
- typescript@5.9.3:
170
- resolution: {integrity: sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==}
171
- engines: {node: '>=14.17'}
172
- hasBin: true
173
-
174
- undici-types@7.14.0:
175
- resolution: {integrity: sha512-QQiYxHuyZ9gQUIrmPo3IA+hUl4KYk8uSA7cHrcKd/l3p1OTpZcM0Tbp9x7FAtXdAYhlasd60ncPpgu6ihG6TOA==}
176
-
177
- uuid@8.3.2:
178
- resolution: {integrity: sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==}
179
- hasBin: true
180
-
181
- validator@13.15.15:
182
- resolution: {integrity: sha512-BgWVbCI72aIQy937xbawcs+hrVaN/CZ2UwutgaJ36hGqRrLNM+f5LUT/YPRbo8IV/ASeFzXszezV+y2+rq3l8A==}
183
- engines: {node: '>= 0.10'}
184
-
185
- wkx@0.5.0:
186
- resolution: {integrity: sha512-Xng/d4Ichh8uN4l0FToV/258EjMGU9MGcA0HV2d9B/ZpZB3lqQm7nkOdZdm5GhKtLLhAE7PiVQwN4eN+2YJJUg==}
187
-
188
- xtend@4.0.2:
189
- resolution: {integrity: sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==}
190
- engines: {node: '>=0.4'}
191
-
192
- snapshots:
193
-
194
- '@types/debug@4.1.12':
195
- dependencies:
196
- '@types/ms': 2.1.0
197
-
198
- '@types/ms@2.1.0': {}
199
-
200
- '@types/node@24.8.1':
201
- dependencies:
202
- undici-types: 7.14.0
203
-
204
- '@types/validator@13.15.3': {}
205
-
206
- debug@4.4.3:
207
- dependencies:
208
- ms: 2.1.3
209
-
210
- dottie@2.0.6: {}
211
-
212
- inflection@1.13.4: {}
213
-
214
- lodash@4.17.21: {}
215
-
216
- moment-timezone@0.5.48:
217
- dependencies:
218
- moment: 2.30.1
219
-
220
- moment@2.30.1: {}
221
-
222
- ms@2.1.3: {}
223
-
224
- pg-cloudflare@1.2.7:
225
- optional: true
226
-
227
- pg-connection-string@2.9.1: {}
228
-
229
- pg-int8@1.0.1: {}
230
-
231
- pg-pool@3.10.1(pg@8.16.3):
232
- dependencies:
233
- pg: 8.16.3
234
-
235
- pg-protocol@1.10.3: {}
236
-
237
- pg-types@2.2.0:
238
- dependencies:
239
- pg-int8: 1.0.1
240
- postgres-array: 2.0.0
241
- postgres-bytea: 1.0.0
242
- postgres-date: 1.0.7
243
- postgres-interval: 1.2.0
244
-
245
- pg@8.16.3:
246
- dependencies:
247
- pg-connection-string: 2.9.1
248
- pg-pool: 3.10.1(pg@8.16.3)
249
- pg-protocol: 1.10.3
250
- pg-types: 2.2.0
251
- pgpass: 1.0.5
252
- optionalDependencies:
253
- pg-cloudflare: 1.2.7
254
-
255
- pgpass@1.0.5:
256
- dependencies:
257
- split2: 4.2.0
258
-
259
- postgres-array@2.0.0: {}
260
-
261
- postgres-bytea@1.0.0: {}
262
-
263
- postgres-date@1.0.7: {}
264
-
265
- postgres-interval@1.2.0:
266
- dependencies:
267
- xtend: 4.0.2
268
-
269
- retry-as-promised@7.1.1: {}
270
-
271
- semver@7.7.3: {}
272
-
273
- sequelize-pool@7.1.0: {}
274
-
275
- sequelize@6.37.7(pg@8.16.3):
276
- dependencies:
277
- '@types/debug': 4.1.12
278
- '@types/validator': 13.15.3
279
- debug: 4.4.3
280
- dottie: 2.0.6
281
- inflection: 1.13.4
282
- lodash: 4.17.21
283
- moment: 2.30.1
284
- moment-timezone: 0.5.48
285
- pg-connection-string: 2.9.1
286
- retry-as-promised: 7.1.1
287
- semver: 7.7.3
288
- sequelize-pool: 7.1.0
289
- toposort-class: 1.0.1
290
- uuid: 8.3.2
291
- validator: 13.15.15
292
- wkx: 0.5.0
293
- optionalDependencies:
294
- pg: 8.16.3
295
- transitivePeerDependencies:
296
- - supports-color
297
-
298
- split2@4.2.0: {}
299
-
300
- toposort-class@1.0.1: {}
301
-
302
- typescript@5.9.3: {}
303
-
304
- undici-types@7.14.0: {}
305
-
306
- uuid@8.3.2: {}
307
-
308
- validator@13.15.15: {}
309
-
310
- wkx@0.5.0:
311
- dependencies:
312
- '@types/node': 24.8.1
313
-
314
- xtend@4.0.2: {}