@hesed/mysql 0.2.1 → 0.3.0
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/README.md +107 -32
- package/dist/commands/mysql/auth/add.d.ts +2 -18
- package/dist/commands/mysql/auth/add.js +16 -57
- package/dist/commands/mysql/auth/delete.d.ts +2 -0
- package/dist/commands/mysql/auth/delete.js +2 -0
- package/dist/commands/mysql/auth/list.d.ts +2 -0
- package/dist/commands/mysql/auth/list.js +2 -0
- package/dist/commands/mysql/auth/profile.d.ts +2 -0
- package/dist/commands/mysql/auth/profile.js +2 -0
- package/dist/commands/mysql/auth/test.d.ts +2 -12
- package/dist/commands/mysql/auth/test.js +16 -41
- package/dist/commands/mysql/auth/update.d.ts +2 -18
- package/dist/commands/mysql/auth/update.js +16 -74
- package/dist/commands/mysql/databases.js +2 -10
- package/dist/commands/mysql/describe-table.js +2 -10
- package/dist/commands/mysql/explain-query.js +2 -10
- package/dist/commands/mysql/indexes.js +2 -10
- package/dist/commands/mysql/query.js +2 -10
- package/dist/commands/mysql/tables.js +2 -10
- package/dist/mysql/config-loader.d.ts +8 -17
- package/dist/mysql/config-loader.js +0 -7
- package/dist/mysql/database.d.ts +0 -31
- package/dist/mysql/database.js +0 -4
- package/dist/mysql/formatters.d.ts +5 -0
- package/dist/mysql/formatters.js +76 -0
- package/dist/mysql/index.d.ts +1 -3
- package/dist/mysql/index.js +1 -1
- package/dist/mysql/mysql-client.d.ts +8 -57
- package/dist/mysql/mysql-client.js +44 -101
- package/dist/mysql/mysql-utils.d.ts +2 -52
- package/dist/mysql/mysql-utils.js +31 -177
- package/dist/mysql/query-validator.d.ts +0 -19
- package/dist/mysql/query-validator.js +0 -19
- package/oclif.manifest.json +176 -59
- package/package.json +3 -2
- package/dist/config.d.ts +0 -13
- package/dist/config.js +0 -18
package/oclif.manifest.json
CHANGED
|
@@ -291,10 +291,10 @@
|
|
|
291
291
|
"mysql:auth:add": {
|
|
292
292
|
"aliases": [],
|
|
293
293
|
"args": {},
|
|
294
|
-
"description": "Add
|
|
294
|
+
"description": "Add MySQL authentication",
|
|
295
295
|
"examples": [
|
|
296
296
|
"<%= config.bin %> <%= command.id %>",
|
|
297
|
-
"<%= config.bin %> <%= command.id %>
|
|
297
|
+
"<%= config.bin %> <%= command.id %> -p prod"
|
|
298
298
|
],
|
|
299
299
|
"flags": {
|
|
300
300
|
"json": {
|
|
@@ -304,10 +304,10 @@
|
|
|
304
304
|
"allowNo": false,
|
|
305
305
|
"type": "boolean"
|
|
306
306
|
},
|
|
307
|
-
"
|
|
308
|
-
"char": "
|
|
309
|
-
"description": "
|
|
310
|
-
"name": "
|
|
307
|
+
"profile": {
|
|
308
|
+
"char": "p",
|
|
309
|
+
"description": "Profile name",
|
|
310
|
+
"name": "profile",
|
|
311
311
|
"required": true,
|
|
312
312
|
"hasDynamicHelp": false,
|
|
313
313
|
"multiple": false,
|
|
@@ -321,27 +321,35 @@
|
|
|
321
321
|
"multiple": false,
|
|
322
322
|
"type": "option"
|
|
323
323
|
},
|
|
324
|
-
"
|
|
325
|
-
"
|
|
326
|
-
"
|
|
327
|
-
"name": "password",
|
|
324
|
+
"port": {
|
|
325
|
+
"description": "MySQL port",
|
|
326
|
+
"name": "port",
|
|
328
327
|
"required": true,
|
|
329
328
|
"hasDynamicHelp": false,
|
|
330
329
|
"multiple": false,
|
|
331
330
|
"type": "option"
|
|
332
331
|
},
|
|
333
|
-
"
|
|
334
|
-
"char": "
|
|
335
|
-
"description": "
|
|
336
|
-
"name": "
|
|
332
|
+
"user": {
|
|
333
|
+
"char": "u",
|
|
334
|
+
"description": "Username",
|
|
335
|
+
"name": "user",
|
|
337
336
|
"required": true,
|
|
338
337
|
"hasDynamicHelp": false,
|
|
339
338
|
"multiple": false,
|
|
340
339
|
"type": "option"
|
|
341
340
|
},
|
|
342
|
-
"
|
|
343
|
-
"description": "
|
|
344
|
-
"name": "
|
|
341
|
+
"password": {
|
|
342
|
+
"description": "Password",
|
|
343
|
+
"name": "password",
|
|
344
|
+
"required": true,
|
|
345
|
+
"hasDynamicHelp": false,
|
|
346
|
+
"multiple": false,
|
|
347
|
+
"type": "option"
|
|
348
|
+
},
|
|
349
|
+
"database": {
|
|
350
|
+
"char": "d",
|
|
351
|
+
"description": "Database name",
|
|
352
|
+
"name": "database",
|
|
345
353
|
"required": true,
|
|
346
354
|
"hasDynamicHelp": false,
|
|
347
355
|
"multiple": false,
|
|
@@ -350,15 +358,124 @@
|
|
|
350
358
|
"ssl": {
|
|
351
359
|
"description": "Use SSL",
|
|
352
360
|
"name": "ssl",
|
|
361
|
+
"required": true,
|
|
362
|
+
"allowNo": false,
|
|
363
|
+
"type": "boolean"
|
|
364
|
+
}
|
|
365
|
+
},
|
|
366
|
+
"hasDynamicHelp": false,
|
|
367
|
+
"hiddenAliases": [],
|
|
368
|
+
"id": "mysql:auth:add",
|
|
369
|
+
"pluginAlias": "@hesed/mysql",
|
|
370
|
+
"pluginName": "@hesed/mysql",
|
|
371
|
+
"pluginType": "core",
|
|
372
|
+
"strict": true,
|
|
373
|
+
"enableJsonFlag": true,
|
|
374
|
+
"isESM": true,
|
|
375
|
+
"relativePath": [
|
|
376
|
+
"dist",
|
|
377
|
+
"commands",
|
|
378
|
+
"mysql",
|
|
379
|
+
"auth",
|
|
380
|
+
"add.js"
|
|
381
|
+
]
|
|
382
|
+
},
|
|
383
|
+
"mysql:auth:delete": {
|
|
384
|
+
"aliases": [],
|
|
385
|
+
"args": {},
|
|
386
|
+
"description": "Delete an authentication profile",
|
|
387
|
+
"examples": [
|
|
388
|
+
"<%= config.bin %> <%= command.id %>",
|
|
389
|
+
"<%= config.bin %> <%= command.id %> -p prod"
|
|
390
|
+
],
|
|
391
|
+
"flags": {
|
|
392
|
+
"json": {
|
|
393
|
+
"description": "Format output as json.",
|
|
394
|
+
"helpGroup": "GLOBAL",
|
|
395
|
+
"name": "json",
|
|
396
|
+
"allowNo": false,
|
|
397
|
+
"type": "boolean"
|
|
398
|
+
},
|
|
399
|
+
"profile": {
|
|
400
|
+
"char": "p",
|
|
401
|
+
"description": "Profile to delete",
|
|
402
|
+
"name": "profile",
|
|
353
403
|
"required": false,
|
|
354
|
-
"
|
|
404
|
+
"hasDynamicHelp": false,
|
|
405
|
+
"multiple": false,
|
|
406
|
+
"type": "option"
|
|
407
|
+
}
|
|
408
|
+
},
|
|
409
|
+
"hasDynamicHelp": false,
|
|
410
|
+
"hiddenAliases": [],
|
|
411
|
+
"id": "mysql:auth:delete",
|
|
412
|
+
"pluginAlias": "@hesed/mysql",
|
|
413
|
+
"pluginName": "@hesed/mysql",
|
|
414
|
+
"pluginType": "core",
|
|
415
|
+
"strict": true,
|
|
416
|
+
"enableJsonFlag": true,
|
|
417
|
+
"isESM": true,
|
|
418
|
+
"relativePath": [
|
|
419
|
+
"dist",
|
|
420
|
+
"commands",
|
|
421
|
+
"mysql",
|
|
422
|
+
"auth",
|
|
423
|
+
"delete.js"
|
|
424
|
+
]
|
|
425
|
+
},
|
|
426
|
+
"mysql:auth:list": {
|
|
427
|
+
"aliases": [],
|
|
428
|
+
"args": {},
|
|
429
|
+
"description": "List authentication profiles",
|
|
430
|
+
"examples": [
|
|
431
|
+
"<%= config.bin %> <%= command.id %>"
|
|
432
|
+
],
|
|
433
|
+
"flags": {
|
|
434
|
+
"json": {
|
|
435
|
+
"description": "Format output as json.",
|
|
436
|
+
"helpGroup": "GLOBAL",
|
|
437
|
+
"name": "json",
|
|
438
|
+
"allowNo": false,
|
|
439
|
+
"type": "boolean"
|
|
440
|
+
}
|
|
441
|
+
},
|
|
442
|
+
"hasDynamicHelp": false,
|
|
443
|
+
"hiddenAliases": [],
|
|
444
|
+
"id": "mysql:auth:list",
|
|
445
|
+
"pluginAlias": "@hesed/mysql",
|
|
446
|
+
"pluginName": "@hesed/mysql",
|
|
447
|
+
"pluginType": "core",
|
|
448
|
+
"strict": true,
|
|
449
|
+
"enableJsonFlag": true,
|
|
450
|
+
"isESM": true,
|
|
451
|
+
"relativePath": [
|
|
452
|
+
"dist",
|
|
453
|
+
"commands",
|
|
454
|
+
"mysql",
|
|
455
|
+
"auth",
|
|
456
|
+
"list.js"
|
|
457
|
+
]
|
|
458
|
+
},
|
|
459
|
+
"mysql:auth:profile": {
|
|
460
|
+
"aliases": [],
|
|
461
|
+
"args": {},
|
|
462
|
+
"description": "Set or show the default authentication profile",
|
|
463
|
+
"examples": [
|
|
464
|
+
"<%= config.bin %> <%= command.id %>",
|
|
465
|
+
"<%= config.bin %> <%= command.id %> --default test"
|
|
466
|
+
],
|
|
467
|
+
"flags": {
|
|
468
|
+
"json": {
|
|
469
|
+
"description": "Format output as json.",
|
|
470
|
+
"helpGroup": "GLOBAL",
|
|
471
|
+
"name": "json",
|
|
472
|
+
"allowNo": false,
|
|
355
473
|
"type": "boolean"
|
|
356
474
|
},
|
|
357
|
-
"
|
|
358
|
-
"
|
|
359
|
-
"
|
|
360
|
-
"
|
|
361
|
-
"required": true,
|
|
475
|
+
"default": {
|
|
476
|
+
"description": "Profile to set as default",
|
|
477
|
+
"name": "default",
|
|
478
|
+
"required": false,
|
|
362
479
|
"hasDynamicHelp": false,
|
|
363
480
|
"multiple": false,
|
|
364
481
|
"type": "option"
|
|
@@ -366,7 +483,7 @@
|
|
|
366
483
|
},
|
|
367
484
|
"hasDynamicHelp": false,
|
|
368
485
|
"hiddenAliases": [],
|
|
369
|
-
"id": "mysql:auth:
|
|
486
|
+
"id": "mysql:auth:profile",
|
|
370
487
|
"pluginAlias": "@hesed/mysql",
|
|
371
488
|
"pluginName": "@hesed/mysql",
|
|
372
489
|
"pluginType": "core",
|
|
@@ -378,16 +495,16 @@
|
|
|
378
495
|
"commands",
|
|
379
496
|
"mysql",
|
|
380
497
|
"auth",
|
|
381
|
-
"
|
|
498
|
+
"profile.js"
|
|
382
499
|
]
|
|
383
500
|
},
|
|
384
501
|
"mysql:auth:test": {
|
|
385
502
|
"aliases": [],
|
|
386
503
|
"args": {},
|
|
387
|
-
"description": "Test
|
|
504
|
+
"description": "Test authentication and connection",
|
|
388
505
|
"examples": [
|
|
389
506
|
"<%= config.bin %> <%= command.id %>",
|
|
390
|
-
"<%= config.bin %> <%= command.id %>
|
|
507
|
+
"<%= config.bin %> <%= command.id %> -p prod"
|
|
391
508
|
],
|
|
392
509
|
"flags": {
|
|
393
510
|
"json": {
|
|
@@ -398,7 +515,8 @@
|
|
|
398
515
|
"type": "boolean"
|
|
399
516
|
},
|
|
400
517
|
"profile": {
|
|
401
|
-
"
|
|
518
|
+
"char": "p",
|
|
519
|
+
"description": "Authentication profile name",
|
|
402
520
|
"name": "profile",
|
|
403
521
|
"required": false,
|
|
404
522
|
"hasDynamicHelp": false,
|
|
@@ -426,10 +544,10 @@
|
|
|
426
544
|
"mysql:auth:update": {
|
|
427
545
|
"aliases": [],
|
|
428
546
|
"args": {},
|
|
429
|
-
"description": "Update
|
|
547
|
+
"description": "Update MySQL authentication",
|
|
430
548
|
"examples": [
|
|
431
|
-
"<%= config.bin %> <%= command.id %>
|
|
432
|
-
"<%= config.bin %> <%= command.id %>
|
|
549
|
+
"<%= config.bin %> <%= command.id %>",
|
|
550
|
+
"<%= config.bin %> <%= command.id %> -p test"
|
|
433
551
|
],
|
|
434
552
|
"flags": {
|
|
435
553
|
"json": {
|
|
@@ -439,10 +557,10 @@
|
|
|
439
557
|
"allowNo": false,
|
|
440
558
|
"type": "boolean"
|
|
441
559
|
},
|
|
442
|
-
"
|
|
443
|
-
"char": "
|
|
444
|
-
"description": "
|
|
445
|
-
"name": "
|
|
560
|
+
"profile": {
|
|
561
|
+
"char": "p",
|
|
562
|
+
"description": "Profile name",
|
|
563
|
+
"name": "profile",
|
|
446
564
|
"required": true,
|
|
447
565
|
"hasDynamicHelp": false,
|
|
448
566
|
"multiple": false,
|
|
@@ -456,47 +574,46 @@
|
|
|
456
574
|
"multiple": false,
|
|
457
575
|
"type": "option"
|
|
458
576
|
},
|
|
459
|
-
"
|
|
460
|
-
"
|
|
461
|
-
"
|
|
462
|
-
"name": "password",
|
|
577
|
+
"port": {
|
|
578
|
+
"description": "MySQL port",
|
|
579
|
+
"name": "port",
|
|
463
580
|
"required": true,
|
|
464
581
|
"hasDynamicHelp": false,
|
|
465
582
|
"multiple": false,
|
|
466
583
|
"type": "option"
|
|
467
584
|
},
|
|
468
|
-
"
|
|
469
|
-
"char": "
|
|
470
|
-
"description": "
|
|
471
|
-
"name": "
|
|
585
|
+
"user": {
|
|
586
|
+
"char": "u",
|
|
587
|
+
"description": "Username",
|
|
588
|
+
"name": "user",
|
|
472
589
|
"required": true,
|
|
473
590
|
"hasDynamicHelp": false,
|
|
474
591
|
"multiple": false,
|
|
475
592
|
"type": "option"
|
|
476
593
|
},
|
|
477
|
-
"
|
|
478
|
-
"description": "
|
|
479
|
-
"name": "
|
|
480
|
-
"required":
|
|
594
|
+
"password": {
|
|
595
|
+
"description": "Password",
|
|
596
|
+
"name": "password",
|
|
597
|
+
"required": true,
|
|
481
598
|
"hasDynamicHelp": false,
|
|
482
599
|
"multiple": false,
|
|
483
600
|
"type": "option"
|
|
484
601
|
},
|
|
485
|
-
"
|
|
486
|
-
"
|
|
487
|
-
"
|
|
488
|
-
"
|
|
489
|
-
"allowNo": true,
|
|
490
|
-
"type": "boolean"
|
|
491
|
-
},
|
|
492
|
-
"user": {
|
|
493
|
-
"char": "u",
|
|
494
|
-
"description": "Username",
|
|
495
|
-
"name": "user",
|
|
602
|
+
"database": {
|
|
603
|
+
"char": "d",
|
|
604
|
+
"description": "Database name",
|
|
605
|
+
"name": "database",
|
|
496
606
|
"required": true,
|
|
497
607
|
"hasDynamicHelp": false,
|
|
498
608
|
"multiple": false,
|
|
499
609
|
"type": "option"
|
|
610
|
+
},
|
|
611
|
+
"ssl": {
|
|
612
|
+
"description": "Use SSL",
|
|
613
|
+
"name": "ssl",
|
|
614
|
+
"required": true,
|
|
615
|
+
"allowNo": false,
|
|
616
|
+
"type": "boolean"
|
|
500
617
|
}
|
|
501
618
|
},
|
|
502
619
|
"hasDynamicHelp": false,
|
|
@@ -517,5 +634,5 @@
|
|
|
517
634
|
]
|
|
518
635
|
}
|
|
519
636
|
},
|
|
520
|
-
"version": "0.
|
|
637
|
+
"version": "0.3.0"
|
|
521
638
|
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hesed/mysql",
|
|
3
3
|
"description": "CLI for MySQL database interaction",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.3.0",
|
|
5
5
|
"author": "Hesed",
|
|
6
6
|
"bin": {
|
|
7
7
|
"mq": "./bin/run.js"
|
|
8
8
|
},
|
|
9
9
|
"bugs": "https://github.com/hesedcasa/mysql/issues",
|
|
10
10
|
"dependencies": {
|
|
11
|
+
"@hesed/plugin-lib": "^0.7.0",
|
|
11
12
|
"@inquirer/prompts": "^8.3.0",
|
|
12
13
|
"@oclif/core": "^4",
|
|
13
14
|
"@toon-format/toon": "^2.1.0",
|
|
@@ -33,7 +34,7 @@
|
|
|
33
34
|
"oclif": "^4",
|
|
34
35
|
"prettier": "^3.8.1",
|
|
35
36
|
"shx": "^0.4.0",
|
|
36
|
-
"sinon": "^
|
|
37
|
+
"sinon": "^22.0.0",
|
|
37
38
|
"ts-node": "^10",
|
|
38
39
|
"ts-prune": "^0.10.3",
|
|
39
40
|
"typescript": "^5"
|
package/dist/config.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export interface DatabaseProfile {
|
|
2
|
-
database: string;
|
|
3
|
-
host: string;
|
|
4
|
-
password: string;
|
|
5
|
-
port: number;
|
|
6
|
-
ssl?: boolean;
|
|
7
|
-
user: string;
|
|
8
|
-
}
|
|
9
|
-
export interface MySQLJsonConfig {
|
|
10
|
-
defaultProfile: string;
|
|
11
|
-
profiles: Record<string, DatabaseProfile>;
|
|
12
|
-
}
|
|
13
|
-
export declare function readConfig(configDir: string, log: (message: string) => void): Promise<MySQLJsonConfig | undefined>;
|
package/dist/config.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { default as fs } from 'fs-extra';
|
|
2
|
-
import { default as path } from 'node:path';
|
|
3
|
-
export async function readConfig(configDir, log) {
|
|
4
|
-
const configPath = path.join(configDir, 'mysql-config.json');
|
|
5
|
-
try {
|
|
6
|
-
return await fs.readJSON(configPath);
|
|
7
|
-
}
|
|
8
|
-
catch (error) {
|
|
9
|
-
const msg = error instanceof Error ? error.message : String(error);
|
|
10
|
-
if (msg.toLowerCase().includes('no such file or directory')) {
|
|
11
|
-
log('Missing connection config');
|
|
12
|
-
}
|
|
13
|
-
else {
|
|
14
|
-
log(msg);
|
|
15
|
-
}
|
|
16
|
-
return undefined;
|
|
17
|
-
}
|
|
18
|
-
}
|