@anthonyalayo/drizzle-kit 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.
Files changed (161) hide show
  1. package/.gitignore +25 -0
  2. package/README.md +79 -0
  3. package/build.dev.ts +51 -0
  4. package/build.ts +112 -0
  5. package/imports-checker/analyze.ts +78 -0
  6. package/imports-checker/checker.ts +296 -0
  7. package/imports-checker/grammar/grammar.ohm +121 -0
  8. package/imports-checker/grammar/grammar.ohm-bundle.d.ts +164 -0
  9. package/imports-checker/grammar/grammar.ohm-bundle.js +753 -0
  10. package/imports-checker/index.ts +48 -0
  11. package/package.json +142 -0
  12. package/patches/difflib@0.2.4.patch +31 -0
  13. package/src/@types/utils.ts +58 -0
  14. package/src/api.ts +504 -0
  15. package/src/cli/commands/_es5.ts +2 -0
  16. package/src/cli/commands/check.ts +52 -0
  17. package/src/cli/commands/drop.ts +60 -0
  18. package/src/cli/commands/introspect.ts +772 -0
  19. package/src/cli/commands/libSqlPushUtils.ts +355 -0
  20. package/src/cli/commands/migrate.ts +1526 -0
  21. package/src/cli/commands/mysqlIntrospect.ts +53 -0
  22. package/src/cli/commands/mysqlPushUtils.ts +352 -0
  23. package/src/cli/commands/mysqlUp.ts +102 -0
  24. package/src/cli/commands/pgIntrospect.ts +55 -0
  25. package/src/cli/commands/pgPushUtils.ts +269 -0
  26. package/src/cli/commands/pgUp.ts +217 -0
  27. package/src/cli/commands/push.ts +637 -0
  28. package/src/cli/commands/singlestoreIntrospect.ts +53 -0
  29. package/src/cli/commands/singlestorePushUtils.ts +456 -0
  30. package/src/cli/commands/singlestoreUp.ts +1 -0
  31. package/src/cli/commands/sqliteIntrospect.ts +96 -0
  32. package/src/cli/commands/sqlitePushUtils.ts +322 -0
  33. package/src/cli/commands/sqliteUp.ts +52 -0
  34. package/src/cli/commands/utils.ts +858 -0
  35. package/src/cli/connections.ts +914 -0
  36. package/src/cli/index.ts +48 -0
  37. package/src/cli/schema.ts +794 -0
  38. package/src/cli/selector-ui.ts +38 -0
  39. package/src/cli/utils.ts +112 -0
  40. package/src/cli/validations/cli.ts +79 -0
  41. package/src/cli/validations/common.ts +193 -0
  42. package/src/cli/validations/libsql.ts +27 -0
  43. package/src/cli/validations/mysql.ts +61 -0
  44. package/src/cli/validations/outputs.ts +91 -0
  45. package/src/cli/validations/postgres.ts +83 -0
  46. package/src/cli/validations/singlestore.ts +61 -0
  47. package/src/cli/validations/sqlite.ts +104 -0
  48. package/src/cli/validations/studio.ts +24 -0
  49. package/src/cli/views.ts +658 -0
  50. package/src/extensions/getTablesFilterByExtensions.ts +16 -0
  51. package/src/extensions/vector.ts +10 -0
  52. package/src/global.ts +61 -0
  53. package/src/index.ts +326 -0
  54. package/src/introspect-mysql.ts +1030 -0
  55. package/src/introspect-pg.ts +1435 -0
  56. package/src/introspect-singlestore.ts +913 -0
  57. package/src/introspect-sqlite.ts +533 -0
  58. package/src/jsonDiffer.js +882 -0
  59. package/src/jsonStatements.ts +3590 -0
  60. package/src/loader.mjs +57 -0
  61. package/src/migrationPreparator.ts +217 -0
  62. package/src/schemaValidator.ts +23 -0
  63. package/src/serializer/index.ts +142 -0
  64. package/src/serializer/mysqlImports.ts +38 -0
  65. package/src/serializer/mysqlSchema.ts +423 -0
  66. package/src/serializer/mysqlSerializer.ts +999 -0
  67. package/src/serializer/pgImports.ts +106 -0
  68. package/src/serializer/pgSchema.ts +937 -0
  69. package/src/serializer/pgSerializer.ts +2223 -0
  70. package/src/serializer/singlestoreImports.ts +38 -0
  71. package/src/serializer/singlestoreSchema.ts +257 -0
  72. package/src/serializer/singlestoreSerializer.ts +767 -0
  73. package/src/serializer/sqliteImports.ts +41 -0
  74. package/src/serializer/sqliteSchema.ts +352 -0
  75. package/src/serializer/sqliteSerializer.ts +931 -0
  76. package/src/serializer/studio.ts +694 -0
  77. package/src/serializer/utils.ts +45 -0
  78. package/src/simulator.ts +157 -0
  79. package/src/snapshotsDiffer.ts +4398 -0
  80. package/src/sqlgenerator.ts +4212 -0
  81. package/src/statementCombiner.ts +597 -0
  82. package/src/utils/certs.ts +44 -0
  83. package/src/utils/words.ts +1333 -0
  84. package/src/utils.ts +370 -0
  85. package/tests/bin.test.ts +58 -0
  86. package/tests/cli/d1http.config.ts +12 -0
  87. package/tests/cli/drizzle.config.ts +9 -0
  88. package/tests/cli/durable-sqlite.config.ts +7 -0
  89. package/tests/cli/expo.config.ts +7 -0
  90. package/tests/cli/postgres.config.ts +13 -0
  91. package/tests/cli/postgres2.config.ts +17 -0
  92. package/tests/cli/schema.ts +1 -0
  93. package/tests/cli/turso.config.ts +10 -0
  94. package/tests/cli-export.test.ts +79 -0
  95. package/tests/cli-generate.test.ts +259 -0
  96. package/tests/cli-migrate.test.ts +103 -0
  97. package/tests/cli-push.test.ts +126 -0
  98. package/tests/common.ts +15 -0
  99. package/tests/indexes/common.ts +21 -0
  100. package/tests/indexes/pg.test.ts +245 -0
  101. package/tests/introspect/libsql.test.ts +35 -0
  102. package/tests/introspect/mysql.test.ts +319 -0
  103. package/tests/introspect/pg.test.ts +894 -0
  104. package/tests/introspect/singlestore.test.ts +275 -0
  105. package/tests/introspect/sqlite.test.ts +122 -0
  106. package/tests/libsql-checks.test.ts +308 -0
  107. package/tests/libsql-statements.test.ts +989 -0
  108. package/tests/libsql-views.test.ts +218 -0
  109. package/tests/migrate/libsq-schema.ts +6 -0
  110. package/tests/migrate/libsql-migrate.test.ts +58 -0
  111. package/tests/migrate/migrations/0000_little_blizzard.sql +4 -0
  112. package/tests/migrate/migrations/0001_nebulous_storm.sql +10 -0
  113. package/tests/migrate/migrations/meta/0000_snapshot.json +40 -0
  114. package/tests/migrate/migrations/meta/0001_snapshot.json +40 -0
  115. package/tests/migrate/migrations/meta/_journal.json +20 -0
  116. package/tests/mysql-checks.test.ts +291 -0
  117. package/tests/mysql-generated.test.ts +1290 -0
  118. package/tests/mysql-schemas.test.ts +156 -0
  119. package/tests/mysql-views.test.ts +553 -0
  120. package/tests/mysql.test.ts +863 -0
  121. package/tests/pg-array.test.ts +368 -0
  122. package/tests/pg-checks.test.ts +329 -0
  123. package/tests/pg-columns.test.ts +484 -0
  124. package/tests/pg-domains.test.ts +306 -0
  125. package/tests/pg-enums.test.ts +751 -0
  126. package/tests/pg-generated.test.ts +529 -0
  127. package/tests/pg-identity.test.ts +447 -0
  128. package/tests/pg-schemas.test.ts +105 -0
  129. package/tests/pg-sequences.test.ts +298 -0
  130. package/tests/pg-tables.test.ts +1021 -0
  131. package/tests/pg-views.test.ts +1929 -0
  132. package/tests/push/common.ts +58 -0
  133. package/tests/push/libsql.test.ts +1400 -0
  134. package/tests/push/mysql-push.test.ts +345 -0
  135. package/tests/push/mysql.test.ts +788 -0
  136. package/tests/push/pg.test.ts +4341 -0
  137. package/tests/push/singlestore-push.test.ts +894 -0
  138. package/tests/push/singlestore.test.ts +444 -0
  139. package/tests/push/sqlite.test.ts +1613 -0
  140. package/tests/rls/pg-policy.test.ts +1656 -0
  141. package/tests/rls/pg-role.test.ts +234 -0
  142. package/tests/schemaDiffer.ts +2852 -0
  143. package/tests/singlestore-generated.test.ts +1290 -0
  144. package/tests/singlestore-schemas.test.ts +155 -0
  145. package/tests/singlestore.test.ts +978 -0
  146. package/tests/sqlite-checks.test.ts +308 -0
  147. package/tests/sqlite-columns.test.ts +1049 -0
  148. package/tests/sqlite-generated.test.ts +1726 -0
  149. package/tests/sqlite-tables.test.ts +637 -0
  150. package/tests/sqlite-views.test.ts +218 -0
  151. package/tests/statements-combiner/libsql-statements-combiner.test.ts +1812 -0
  152. package/tests/statements-combiner/singlestore-statements-combiner.test.ts +882 -0
  153. package/tests/statements-combiner/sqlite-statements-combiner.test.ts +1211 -0
  154. package/tests/test/sqlite.test.ts +39 -0
  155. package/tests/testsinglestore.ts +29 -0
  156. package/tests/validations.test.ts +869 -0
  157. package/tests/wrap-param.test.ts +16 -0
  158. package/tsconfig.build.json +4 -0
  159. package/tsconfig.cli-types.json +9 -0
  160. package/tsconfig.json +28 -0
  161. package/vitest.config.ts +34 -0
@@ -0,0 +1,869 @@
1
+ import { mysqlCredentials } from 'src/cli/validations/mysql';
2
+ import { postgresCredentials } from 'src/cli/validations/postgres';
3
+ import { singlestoreCredentials } from 'src/cli/validations/singlestore';
4
+ import { sqliteCredentials } from 'src/cli/validations/sqlite';
5
+ import { expect, test } from 'vitest';
6
+
7
+ test('turso #1', () => {
8
+ sqliteCredentials.parse({
9
+ dialect: 'sqlite',
10
+ driver: 'turso',
11
+ url: 'https://turso.tech',
12
+ });
13
+ });
14
+
15
+ test('turso #2', () => {
16
+ sqliteCredentials.parse({
17
+ dialect: 'sqlite',
18
+ driver: 'turso',
19
+ url: 'https://turso.tech',
20
+ authToken: 'token',
21
+ });
22
+ });
23
+
24
+ test('turso #3', () => {
25
+ expect(() =>
26
+ sqliteCredentials.parse({
27
+ dialect: 'sqlite',
28
+ driver: 'turso',
29
+ url: 'https://turso.tech',
30
+ authToken: '',
31
+ })
32
+ ).toThrowError();
33
+ });
34
+
35
+ test('turso #4', () => {
36
+ expect(() => {
37
+ sqliteCredentials.parse({
38
+ dialect: 'sqlite',
39
+ driver: 'turso',
40
+ url: '',
41
+ authToken: 'token',
42
+ });
43
+ }).toThrowError();
44
+ });
45
+
46
+ test('turso #5', () => {
47
+ expect(() => {
48
+ sqliteCredentials.parse({
49
+ dialect: 'sqlite',
50
+ driver: 'turso',
51
+ url: '',
52
+ authToken: '',
53
+ });
54
+ }).toThrowError();
55
+ });
56
+
57
+ test('d1-http #1', () => {
58
+ sqliteCredentials.parse({
59
+ dialect: 'sqlite',
60
+ driver: 'd1-http',
61
+ accountId: 'accountId',
62
+ databaseId: 'databaseId',
63
+ token: 'token',
64
+ });
65
+ });
66
+
67
+ test('d1-http #2', () => {
68
+ expect(() =>
69
+ sqliteCredentials.parse({
70
+ dialect: 'sqlite',
71
+ driver: 'd1-http',
72
+ accountId: 'accountId',
73
+ databaseId: 'databaseId',
74
+ // token: "token",
75
+ })
76
+ ).toThrowError();
77
+ });
78
+
79
+ test('d1-http #3', () => {
80
+ expect(() =>
81
+ sqliteCredentials.parse({
82
+ dialect: 'sqlite',
83
+ driver: 'd1-http',
84
+ accountId: 'accountId',
85
+ databaseId: 'databaseId',
86
+ token: '',
87
+ })
88
+ ).toThrowError();
89
+ });
90
+
91
+ test('d1-http #4', () => {
92
+ expect(() =>
93
+ sqliteCredentials.parse({
94
+ dialect: 'sqlite',
95
+ driver: 'd1-http',
96
+ accountId: 'accountId',
97
+ // databaseId: "databaseId",
98
+ token: 'token',
99
+ })
100
+ ).toThrowError();
101
+ });
102
+
103
+ test('d1-http #5', () => {
104
+ expect(() =>
105
+ sqliteCredentials.parse({
106
+ dialect: 'sqlite',
107
+ driver: 'd1-http',
108
+ accountId: 'accountId',
109
+ databaseId: '',
110
+ token: 'token',
111
+ })
112
+ ).toThrowError();
113
+ });
114
+
115
+ test('d1-http #6', () => {
116
+ expect(() =>
117
+ sqliteCredentials.parse({
118
+ dialect: 'sqlite',
119
+ driver: 'd1-http',
120
+ // accountId: "accountId",
121
+ databaseId: 'databaseId',
122
+ token: 'token',
123
+ })
124
+ ).toThrowError();
125
+ });
126
+
127
+ test('d1-http #7', () => {
128
+ expect(() =>
129
+ sqliteCredentials.parse({
130
+ dialect: 'sqlite',
131
+ driver: 'd1-http',
132
+ accountId: '',
133
+ databaseId: 'databaseId',
134
+ token: 'token',
135
+ })
136
+ ).toThrowError();
137
+ });
138
+
139
+ // omit undefined driver
140
+ test('sqlite #1', () => {
141
+ expect(
142
+ sqliteCredentials.parse({
143
+ dialect: 'sqlite',
144
+ driver: undefined,
145
+ url: 'https://turso.tech',
146
+ }),
147
+ ).toStrictEqual({
148
+ url: 'https://turso.tech',
149
+ });
150
+ });
151
+
152
+ test('sqlite #2', () => {
153
+ expect(
154
+ sqliteCredentials.parse({
155
+ dialect: 'sqlite',
156
+ url: 'https://turso.tech',
157
+ }),
158
+ ).toStrictEqual({
159
+ url: 'https://turso.tech',
160
+ });
161
+ });
162
+
163
+ test('sqlite #3', () => {
164
+ expect(() =>
165
+ sqliteCredentials.parse({
166
+ dialect: 'sqlite',
167
+ url: '',
168
+ })
169
+ ).toThrowError();
170
+ });
171
+
172
+ test('AWS Data API #1', () => {
173
+ expect(
174
+ postgresCredentials.parse({
175
+ dialect: 'postgres',
176
+ url: 'https://turso.tech',
177
+ }),
178
+ ).toStrictEqual({
179
+ url: 'https://turso.tech',
180
+ });
181
+ });
182
+
183
+ test('AWS Data API #1', () => {
184
+ expect(
185
+ postgresCredentials.parse({
186
+ dialect: 'postgres',
187
+ driver: 'aws-data-api',
188
+ database: 'database',
189
+ secretArn: 'secretArn',
190
+ resourceArn: 'resourceArn',
191
+ }),
192
+ ).toStrictEqual({
193
+ driver: 'aws-data-api',
194
+ database: 'database',
195
+ secretArn: 'secretArn',
196
+ resourceArn: 'resourceArn',
197
+ });
198
+ });
199
+
200
+ test('AWS Data API #2', () => {
201
+ expect(() => {
202
+ postgresCredentials.parse({
203
+ dialect: 'postgres',
204
+ driver: 'aws-data-api',
205
+ database: 'database',
206
+ secretArn: '',
207
+ resourceArn: 'resourceArn',
208
+ });
209
+ }).toThrowError();
210
+ });
211
+ test('AWS Data API #3', () => {
212
+ expect(() => {
213
+ postgresCredentials.parse({
214
+ dialect: 'postgres',
215
+ driver: 'aws-data-api',
216
+ database: 'database',
217
+ secretArn: 'secretArn',
218
+ resourceArn: '',
219
+ });
220
+ }).toThrowError();
221
+ });
222
+ test('AWS Data API #4', () => {
223
+ expect(() => {
224
+ postgresCredentials.parse({
225
+ dialect: 'postgres',
226
+ driver: 'aws-data-api',
227
+ database: '',
228
+ secretArn: 'secretArn',
229
+ resourceArn: 'resourceArn',
230
+ });
231
+ }).toThrowError();
232
+ });
233
+
234
+ test('AWS Data API #5', () => {
235
+ expect(() => {
236
+ postgresCredentials.parse({
237
+ dialect: 'postgres',
238
+ driver: 'aws-data-api',
239
+ database: 'database',
240
+ resourceArn: 'resourceArn',
241
+ });
242
+ }).toThrowError();
243
+ });
244
+ test('AWS Data API #6', () => {
245
+ expect(() => {
246
+ postgresCredentials.parse({
247
+ dialect: 'postgres',
248
+ driver: 'aws-data-api',
249
+ secretArn: 'secretArn',
250
+ resourceArn: 'resourceArn',
251
+ });
252
+ }).toThrowError();
253
+ });
254
+ test('AWS Data API #7', () => {
255
+ expect(() => {
256
+ postgresCredentials.parse({
257
+ dialect: 'postgres',
258
+ driver: 'aws-data-api',
259
+ database: 'database',
260
+ secretArn: 'secretArn',
261
+ });
262
+ }).toThrowError();
263
+ });
264
+
265
+ test('AWS Data API #8', () => {
266
+ expect(() => {
267
+ postgresCredentials.parse({
268
+ dialect: 'postgres',
269
+ driver: 'aws-data-api',
270
+ });
271
+ }).toThrowError();
272
+ });
273
+
274
+ test('PGlite #1', () => {
275
+ expect(
276
+ postgresCredentials.parse({
277
+ dialect: 'postgres',
278
+ driver: 'pglite',
279
+ url: './my.db',
280
+ }),
281
+ ).toStrictEqual({
282
+ driver: 'pglite',
283
+ url: './my.db',
284
+ });
285
+ });
286
+
287
+ test('PGlite #2', () => {
288
+ expect(() => {
289
+ postgresCredentials.parse({
290
+ dialect: 'postgres',
291
+ driver: 'pglite',
292
+ url: '',
293
+ });
294
+ }).toThrowError();
295
+ });
296
+
297
+ test('PGlite #3', () => {
298
+ expect(() => {
299
+ postgresCredentials.parse({
300
+ dialect: 'postgres',
301
+ driver: 'pglite',
302
+ });
303
+ }).toThrowError();
304
+ });
305
+
306
+ test('postgres #1', () => {
307
+ expect(
308
+ postgresCredentials.parse({
309
+ dialect: 'postgres',
310
+ url: 'https://turso.tech',
311
+ }),
312
+ ).toStrictEqual({
313
+ url: 'https://turso.tech',
314
+ });
315
+ });
316
+
317
+ test('postgres #2', () => {
318
+ expect(
319
+ postgresCredentials.parse({
320
+ dialect: 'postgres',
321
+ driver: undefined,
322
+ url: 'https://turso.tech',
323
+ }),
324
+ ).toStrictEqual({
325
+ url: 'https://turso.tech',
326
+ });
327
+ });
328
+
329
+ test('postgres #3', () => {
330
+ expect(
331
+ postgresCredentials.parse({
332
+ dialect: 'postgres',
333
+ database: 'database',
334
+ host: 'host',
335
+ }),
336
+ ).toStrictEqual({
337
+ database: 'database',
338
+ host: 'host',
339
+ });
340
+ });
341
+
342
+ test('postgres #4', () => {
343
+ expect(
344
+ postgresCredentials.parse({
345
+ dialect: 'postgres',
346
+ database: 'database',
347
+ host: 'host',
348
+ }),
349
+ ).toStrictEqual({
350
+ database: 'database',
351
+ host: 'host',
352
+ });
353
+ });
354
+
355
+ test('postgres #5', () => {
356
+ expect(
357
+ postgresCredentials.parse({
358
+ dialect: 'postgres',
359
+ host: 'host',
360
+ port: 1234,
361
+ user: 'user',
362
+ password: 'password',
363
+ database: 'database',
364
+ ssl: 'require',
365
+ }),
366
+ ).toStrictEqual({
367
+ host: 'host',
368
+ port: 1234,
369
+ user: 'user',
370
+ password: 'password',
371
+ database: 'database',
372
+ ssl: 'require',
373
+ });
374
+ });
375
+
376
+ test('postgres #6', () => {
377
+ expect(
378
+ postgresCredentials.parse({
379
+ dialect: 'postgres',
380
+ host: 'host',
381
+ database: 'database',
382
+ ssl: true,
383
+ }),
384
+ ).toStrictEqual({
385
+ host: 'host',
386
+ database: 'database',
387
+ ssl: true,
388
+ });
389
+ });
390
+
391
+ test('postgres #7', () => {
392
+ expect(
393
+ postgresCredentials.parse({
394
+ dialect: 'postgres',
395
+ host: 'host',
396
+ database: 'database',
397
+ ssl: 'allow',
398
+ }),
399
+ ).toStrictEqual({
400
+ host: 'host',
401
+ database: 'database',
402
+ ssl: 'allow',
403
+ });
404
+ });
405
+
406
+ test('postgres #8', () => {
407
+ expect(
408
+ postgresCredentials.parse({
409
+ dialect: 'postgres',
410
+ host: 'host',
411
+ database: 'database',
412
+ ssl: {
413
+ ca: 'ca',
414
+ cert: 'cert',
415
+ },
416
+ }),
417
+ ).toStrictEqual({
418
+ host: 'host',
419
+ database: 'database',
420
+ ssl: {
421
+ ca: 'ca',
422
+ cert: 'cert',
423
+ },
424
+ });
425
+ });
426
+
427
+ test('postgres #9', () => {
428
+ expect(() => {
429
+ postgresCredentials.parse({
430
+ dialect: 'postgres',
431
+ });
432
+ }).toThrowError();
433
+ });
434
+
435
+ test('postgres #10', () => {
436
+ expect(() => {
437
+ postgresCredentials.parse({
438
+ dialect: 'postgres',
439
+ url: undefined,
440
+ });
441
+ }).toThrowError();
442
+ });
443
+
444
+ test('postgres #11', () => {
445
+ expect(() => {
446
+ postgresCredentials.parse({
447
+ dialect: 'postgres',
448
+ url: '',
449
+ });
450
+ }).toThrowError();
451
+ });
452
+
453
+ test('postgres #12', () => {
454
+ expect(() => {
455
+ postgresCredentials.parse({
456
+ dialect: 'postgres',
457
+ host: '',
458
+ database: '',
459
+ });
460
+ }).toThrowError();
461
+ });
462
+
463
+ test('postgres #13', () => {
464
+ expect(() => {
465
+ postgresCredentials.parse({
466
+ dialect: 'postgres',
467
+ database: '',
468
+ });
469
+ }).toThrowError();
470
+ });
471
+
472
+ test('postgres #14', () => {
473
+ expect(() => {
474
+ postgresCredentials.parse({
475
+ dialect: 'postgres',
476
+ host: '',
477
+ });
478
+ }).toThrowError();
479
+ });
480
+
481
+ test('postgres #15', () => {
482
+ expect(() => {
483
+ postgresCredentials.parse({
484
+ dialect: 'postgres',
485
+ database: ' ',
486
+ host: '',
487
+ });
488
+ }).toThrowError();
489
+ });
490
+
491
+ test('postgres #16', () => {
492
+ expect(() => {
493
+ postgresCredentials.parse({
494
+ dialect: 'postgres',
495
+ database: '',
496
+ host: ' ',
497
+ });
498
+ }).toThrowError();
499
+ });
500
+
501
+ test('postgres #17', () => {
502
+ expect(() => {
503
+ postgresCredentials.parse({
504
+ dialect: 'postgres',
505
+ database: ' ',
506
+ host: ' ',
507
+ port: '',
508
+ });
509
+ }).toThrowError();
510
+ });
511
+
512
+ test('mysql #1', () => {
513
+ expect(
514
+ mysqlCredentials.parse({
515
+ dialect: 'mysql',
516
+ url: 'https://turso.tech',
517
+ }),
518
+ ).toStrictEqual({
519
+ url: 'https://turso.tech',
520
+ });
521
+ });
522
+
523
+ test('mysql #2', () => {
524
+ expect(
525
+ mysqlCredentials.parse({
526
+ dialect: 'mysql',
527
+ driver: undefined,
528
+ url: 'https://turso.tech',
529
+ }),
530
+ ).toStrictEqual({
531
+ url: 'https://turso.tech',
532
+ });
533
+ });
534
+
535
+ test('mysql #3', () => {
536
+ expect(
537
+ mysqlCredentials.parse({
538
+ dialect: 'mysql',
539
+ database: 'database',
540
+ host: 'host',
541
+ }),
542
+ ).toStrictEqual({
543
+ database: 'database',
544
+ host: 'host',
545
+ });
546
+ });
547
+
548
+ test('mysql #4', () => {
549
+ expect(
550
+ mysqlCredentials.parse({
551
+ dialect: 'mysql',
552
+ database: 'database',
553
+ host: 'host',
554
+ }),
555
+ ).toStrictEqual({
556
+ database: 'database',
557
+ host: 'host',
558
+ });
559
+ });
560
+
561
+ test('mysql #5', () => {
562
+ expect(
563
+ mysqlCredentials.parse({
564
+ dialect: 'mysql',
565
+ host: 'host',
566
+ port: 1234,
567
+ user: 'user',
568
+ password: 'password',
569
+ database: 'database',
570
+ ssl: 'require',
571
+ }),
572
+ ).toStrictEqual({
573
+ host: 'host',
574
+ port: 1234,
575
+ user: 'user',
576
+ password: 'password',
577
+ database: 'database',
578
+ ssl: 'require',
579
+ });
580
+ });
581
+
582
+ test('mysql #7', () => {
583
+ expect(
584
+ mysqlCredentials.parse({
585
+ dialect: 'mysql',
586
+ host: 'host',
587
+ database: 'database',
588
+ ssl: 'allow',
589
+ }),
590
+ ).toStrictEqual({
591
+ host: 'host',
592
+ database: 'database',
593
+ ssl: 'allow',
594
+ });
595
+ });
596
+
597
+ test('mysql #8', () => {
598
+ expect(
599
+ mysqlCredentials.parse({
600
+ dialect: 'mysql',
601
+ host: 'host',
602
+ database: 'database',
603
+ ssl: {
604
+ ca: 'ca',
605
+ cert: 'cert',
606
+ },
607
+ }),
608
+ ).toStrictEqual({
609
+ host: 'host',
610
+ database: 'database',
611
+ ssl: {
612
+ ca: 'ca',
613
+ cert: 'cert',
614
+ },
615
+ });
616
+ });
617
+
618
+ test('mysql #9', () => {
619
+ expect(() => {
620
+ mysqlCredentials.parse({
621
+ dialect: 'mysql',
622
+ });
623
+ }).toThrowError();
624
+ });
625
+
626
+ test('mysql #10', () => {
627
+ expect(() => {
628
+ mysqlCredentials.parse({
629
+ dialect: 'mysql',
630
+ url: undefined,
631
+ });
632
+ }).toThrowError();
633
+ });
634
+
635
+ test('mysql #11', () => {
636
+ expect(() => {
637
+ mysqlCredentials.parse({
638
+ dialect: 'mysql',
639
+ url: '',
640
+ });
641
+ }).toThrowError();
642
+ });
643
+
644
+ test('mysql #12', () => {
645
+ expect(() => {
646
+ mysqlCredentials.parse({
647
+ dialect: 'mysql',
648
+ host: '',
649
+ database: '',
650
+ });
651
+ }).toThrowError();
652
+ });
653
+
654
+ test('mysql #13', () => {
655
+ expect(() => {
656
+ mysqlCredentials.parse({
657
+ dialect: 'mysql',
658
+ database: '',
659
+ });
660
+ }).toThrowError();
661
+ });
662
+
663
+ test('mysql #14', () => {
664
+ expect(() => {
665
+ mysqlCredentials.parse({
666
+ dialect: 'mysql',
667
+ host: '',
668
+ });
669
+ }).toThrowError();
670
+ });
671
+
672
+ test('mysql #15', () => {
673
+ expect(() => {
674
+ mysqlCredentials.parse({
675
+ dialect: 'mysql',
676
+ database: ' ',
677
+ host: '',
678
+ });
679
+ }).toThrowError();
680
+ });
681
+
682
+ test('mysql #16', () => {
683
+ expect(() => {
684
+ mysqlCredentials.parse({
685
+ dialect: 'mysql',
686
+ database: '',
687
+ host: ' ',
688
+ });
689
+ }).toThrowError();
690
+ });
691
+
692
+ test('mysql #17', () => {
693
+ expect(() => {
694
+ mysqlCredentials.parse({
695
+ dialect: 'mysql',
696
+ database: ' ',
697
+ host: ' ',
698
+ port: '',
699
+ });
700
+ }).toThrowError();
701
+ });
702
+
703
+ test('singlestore #1', () => {
704
+ expect(
705
+ singlestoreCredentials.parse({
706
+ dialect: 'singlestore',
707
+ database: 'database',
708
+ host: 'host',
709
+ }),
710
+ ).toStrictEqual({
711
+ database: 'database',
712
+ host: 'host',
713
+ });
714
+ });
715
+
716
+ test('singlestore #2', () => {
717
+ expect(
718
+ singlestoreCredentials.parse({
719
+ dialect: 'singlestore',
720
+ database: 'database',
721
+ host: 'host',
722
+ }),
723
+ ).toStrictEqual({
724
+ database: 'database',
725
+ host: 'host',
726
+ });
727
+ });
728
+
729
+ test('singlestore #3', () => {
730
+ expect(
731
+ singlestoreCredentials.parse({
732
+ dialect: 'singlestore',
733
+ host: 'host',
734
+ port: 1234,
735
+ user: 'user',
736
+ password: 'password',
737
+ database: 'database',
738
+ ssl: 'require',
739
+ }),
740
+ ).toStrictEqual({
741
+ host: 'host',
742
+ port: 1234,
743
+ user: 'user',
744
+ password: 'password',
745
+ database: 'database',
746
+ ssl: 'require',
747
+ });
748
+ });
749
+
750
+ test('singlestore #4', () => {
751
+ expect(
752
+ singlestoreCredentials.parse({
753
+ dialect: 'singlestore',
754
+ host: 'host',
755
+ database: 'database',
756
+ ssl: 'allow',
757
+ }),
758
+ ).toStrictEqual({
759
+ host: 'host',
760
+ database: 'database',
761
+ ssl: 'allow',
762
+ });
763
+ });
764
+
765
+ test('singlestore #5', () => {
766
+ expect(
767
+ singlestoreCredentials.parse({
768
+ dialect: 'singlestore',
769
+ host: 'host',
770
+ database: 'database',
771
+ ssl: {
772
+ ca: 'ca',
773
+ cert: 'cert',
774
+ },
775
+ }),
776
+ ).toStrictEqual({
777
+ host: 'host',
778
+ database: 'database',
779
+ ssl: {
780
+ ca: 'ca',
781
+ cert: 'cert',
782
+ },
783
+ });
784
+ });
785
+
786
+ test('singlestore #6', () => {
787
+ expect(() => {
788
+ singlestoreCredentials.parse({
789
+ dialect: 'singlestore',
790
+ });
791
+ }).toThrowError();
792
+ });
793
+
794
+ test('singlestore #7', () => {
795
+ expect(() => {
796
+ singlestoreCredentials.parse({
797
+ dialect: 'singlestore',
798
+ url: undefined,
799
+ });
800
+ }).toThrowError();
801
+ });
802
+
803
+ test('singlestore #8', () => {
804
+ expect(() => {
805
+ singlestoreCredentials.parse({
806
+ dialect: 'singlestore',
807
+ url: '',
808
+ });
809
+ }).toThrowError();
810
+ });
811
+
812
+ test('singlestore #9', () => {
813
+ expect(() => {
814
+ singlestoreCredentials.parse({
815
+ dialect: 'singlestore',
816
+ host: '',
817
+ database: '',
818
+ });
819
+ }).toThrowError();
820
+ });
821
+
822
+ test('singlestore #10', () => {
823
+ expect(() => {
824
+ singlestoreCredentials.parse({
825
+ dialect: 'singlestore',
826
+ database: '',
827
+ });
828
+ }).toThrowError();
829
+ });
830
+
831
+ test('singlestore #11', () => {
832
+ expect(() => {
833
+ singlestoreCredentials.parse({
834
+ dialect: 'singlestore',
835
+ host: '',
836
+ });
837
+ }).toThrowError();
838
+ });
839
+
840
+ test('singlestore #12', () => {
841
+ expect(() => {
842
+ singlestoreCredentials.parse({
843
+ dialect: 'singlestore',
844
+ database: ' ',
845
+ host: '',
846
+ });
847
+ }).toThrowError();
848
+ });
849
+
850
+ test('singlestore #13', () => {
851
+ expect(() => {
852
+ singlestoreCredentials.parse({
853
+ dialect: 'singlestore',
854
+ database: '',
855
+ host: ' ',
856
+ });
857
+ }).toThrowError();
858
+ });
859
+
860
+ test('singlestore #14', () => {
861
+ expect(() => {
862
+ singlestoreCredentials.parse({
863
+ dialect: 'singlestore',
864
+ database: ' ',
865
+ host: ' ',
866
+ port: '',
867
+ });
868
+ }).toThrowError();
869
+ });