@osaas/cli 0.9.0 → 0.10.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/dist/cli.js +2 -0
- package/dist/cli.js.map +1 -1
- package/dist/db/cmd.d.ts +3 -0
- package/dist/db/cmd.d.ts.map +1 -0
- package/dist/db/cmd.js +87 -0
- package/dist/db/cmd.js.map +1 -0
- package/dist/transcribe/cmd.js +2 -2
- package/dist/transcribe/cmd.js.map +1 -1
- package/package.json +4 -3
- package/src/cli.ts +2 -0
- package/src/db/cmd.ts +92 -0
- package/src/transcribe/cmd.ts +2 -2
package/dist/cli.js
CHANGED
|
@@ -36,6 +36,7 @@ const cmd_4 = __importDefault(require("./packager/cmd"));
|
|
|
36
36
|
const cmd_5 = __importDefault(require("./live/cmd"));
|
|
37
37
|
const cmd_6 = __importDefault(require("./intercom/cmd"));
|
|
38
38
|
const cmd_7 = __importDefault(require("./transcribe/cmd"));
|
|
39
|
+
const cmd_8 = __importDefault(require("./db/cmd"));
|
|
39
40
|
const cli = new commander_1.Command();
|
|
40
41
|
cli
|
|
41
42
|
.configureHelp({ showGlobalOptions: true })
|
|
@@ -50,5 +51,6 @@ cli.addCommand((0, cmd_3.default)());
|
|
|
50
51
|
cli.addCommand((0, cmd_5.default)());
|
|
51
52
|
cli.addCommand((0, cmd_6.default)());
|
|
52
53
|
cli.addCommand((0, cmd_7.default)());
|
|
54
|
+
cli.addCommand((0, cmd_8.default)());
|
|
53
55
|
cli.parse(process.argv);
|
|
54
56
|
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,yCAAoC;AACpC,sDAAmC;AACnC,oDAAsC;AACtC,0DAA2C;AAC3C,qDAAoC;AACpC,yDAAyC;AACzC,qDAAiC;AACjC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@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cmd.d.ts","sourceRoot":"","sources":["../../src/db/cmd.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA6BpC,MAAM,CAAC,OAAO,UAAU,KAAK,YA4D5B"}
|
package/dist/db/cmd.js
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const client_core_1 = require("@osaas/client-core");
|
|
4
|
+
const client_db_1 = require("@osaas/client-db");
|
|
5
|
+
const commander_1 = require("commander");
|
|
6
|
+
const util_1 = require("../user/util");
|
|
7
|
+
function createDb(context, type, name) {
|
|
8
|
+
if (type === 'valkey') {
|
|
9
|
+
return new client_db_1.ValkeyDb({ context, name });
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
throw new Error('Unsupported database type: ' + type);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
async function listDb(context, type) {
|
|
16
|
+
const databases = [];
|
|
17
|
+
if (type === 'valkey') {
|
|
18
|
+
const dbs = await client_db_1.ValkeyDb.list(context);
|
|
19
|
+
for (const db of dbs) {
|
|
20
|
+
const url = await db.getRedisUrl();
|
|
21
|
+
databases.push({ name: db.getName(), url });
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
throw new Error('Unsupported database type: ' + type);
|
|
26
|
+
}
|
|
27
|
+
return databases;
|
|
28
|
+
}
|
|
29
|
+
function cmdDb() {
|
|
30
|
+
const db = new commander_1.Command('db');
|
|
31
|
+
db.command('create')
|
|
32
|
+
.description('Create a new database')
|
|
33
|
+
.argument('<type>', 'The database type (available: valkey)')
|
|
34
|
+
.argument('<name>', 'The database name')
|
|
35
|
+
.action(async (type, name, options, command) => {
|
|
36
|
+
try {
|
|
37
|
+
const globalOpts = command.optsWithGlobals();
|
|
38
|
+
const environment = globalOpts?.env || 'prod';
|
|
39
|
+
const ctx = new client_core_1.Context({ environment });
|
|
40
|
+
const db = createDb(ctx, type, name);
|
|
41
|
+
const redisUrl = await db.getRedisUrl();
|
|
42
|
+
if (redisUrl) {
|
|
43
|
+
console.log(redisUrl?.toString());
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
catch (err) {
|
|
47
|
+
console.log(err.message);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
db.command('remove')
|
|
51
|
+
.description('Remove a database')
|
|
52
|
+
.argument('<type>', 'The database type (available: valkey)')
|
|
53
|
+
.argument('<name>', 'The database name')
|
|
54
|
+
.action(async (type, name, options, command) => {
|
|
55
|
+
try {
|
|
56
|
+
const globalOpts = command.optsWithGlobals();
|
|
57
|
+
const environment = globalOpts?.env || 'prod';
|
|
58
|
+
const ctx = new client_core_1.Context({ environment });
|
|
59
|
+
const db = createDb(ctx, type, name);
|
|
60
|
+
await (0, util_1.confirm)('Are you sure you want to remove this database? (yes/no) ');
|
|
61
|
+
await db.destroy();
|
|
62
|
+
}
|
|
63
|
+
catch (err) {
|
|
64
|
+
console.log(err.message);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
db.command('list')
|
|
68
|
+
.description('List all databases')
|
|
69
|
+
.argument('<type>', 'The database type (available: valkey)')
|
|
70
|
+
.action(async (type, options, command) => {
|
|
71
|
+
try {
|
|
72
|
+
const globalOpts = command.optsWithGlobals();
|
|
73
|
+
const environment = globalOpts?.env || 'prod';
|
|
74
|
+
const ctx = new client_core_1.Context({ environment });
|
|
75
|
+
const dbs = await listDb(ctx, type);
|
|
76
|
+
dbs.forEach((db) => {
|
|
77
|
+
console.log(db.name + ': ' + db.url?.toString());
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
catch (err) {
|
|
81
|
+
console.log(err.message);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
return db;
|
|
85
|
+
}
|
|
86
|
+
exports.default = cmdDb;
|
|
87
|
+
//# sourceMapping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E,CAAC,OAAO,EAAE,CAAC;SACpB;QAAC,OAAO,GAAG,EAAE;YACZ,OAAO,CAAC,GAAG,CAAE,GAAa,CAAC,OAAO,CAAC,CAAC;SACrC;IACH,CAAC,CAAC,CAAC;IAEL,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,oBAAoB,CAAC;SACjC,QAAQ,CAAC,QAAQ,EAAE,uCAAuC,CAAC;SAC3D,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE;QACvC,IAAI;YACF,MAAM,UAAU,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;YAC7C,MAAM,WAAW,GAAG,UAAU,EAAE,GAAG,IAAI,MAAM,CAAC;YAC9C,MAAM,GAAG,GAAG,IAAI,qBAAO,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC;YACzC,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;YACpC,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE;gBACjB,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,GAAG,IAAI,GAAG,EAAE,CAAC,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC;YACnD,CAAC,CAAC,CAAC;SACJ;QAAC,OAAO,GAAG,EAAE;YACZ,OAAO,CAAC,GAAG,CAAE,GAAa,CAAC,OAAO,CAAC,CAAC;SACrC;IACH,CAAC,CAAC,CAAC;IAEL,OAAO,EAAE,CAAC;AACZ,CAAC;AA5DD,wBA4DC"}
|
package/dist/transcribe/cmd.js
CHANGED
|
@@ -8,8 +8,8 @@ function cmdTranscribe() {
|
|
|
8
8
|
transcriber
|
|
9
9
|
.description('Generate subtitles from video or audio using Open AI Whisper')
|
|
10
10
|
.argument('<source>', 'Source URL (supported protocols: http, https)')
|
|
11
|
-
.option('-f, --format', 'Output format (default: vtt)')
|
|
12
|
-
.option('-l, --language', 'Language (default: en)')
|
|
11
|
+
.option('-f, --format <format>', 'Output format (default: vtt)')
|
|
12
|
+
.option('-l, --language <language>', 'Language (default: en)')
|
|
13
13
|
.action(async (source, options, command) => {
|
|
14
14
|
try {
|
|
15
15
|
const globalOpts = command.optsWithGlobals();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cmd.js","sourceRoot":"","sources":["../../src/transcribe/cmd.ts"],"names":[],"mappings":";;AAAA,oDAA6C;AAC7C,8DAAyD;AACzD,yCAAoC;AAEpC,SAAwB,aAAa;IACnC,MAAM,WAAW,GAAG,IAAI,mBAAO,CAAC,YAAY,CAAC,CAAC;IAE9C,WAAW;SACR,WAAW,CAAC,8DAA8D,CAAC;SAC3E,QAAQ,CAAC,UAAU,EAAE,+CAA+C,CAAC;SACrE,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"cmd.js","sourceRoot":"","sources":["../../src/transcribe/cmd.ts"],"names":[],"mappings":";;AAAA,oDAA6C;AAC7C,8DAAyD;AACzD,yCAAoC;AAEpC,SAAwB,aAAa;IACnC,MAAM,WAAW,GAAG,IAAI,mBAAO,CAAC,YAAY,CAAC,CAAC;IAE9C,WAAW;SACR,WAAW,CAAC,8DAA8D,CAAC;SAC3E,QAAQ,CAAC,UAAU,EAAE,+CAA+C,CAAC;SACrE,MAAM,CAAC,uBAAuB,EAAE,8BAA8B,CAAC;SAC/D,MAAM,CAAC,2BAA2B,EAAE,wBAAwB,CAAC;SAC7D,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE;QACzC,IAAI;YACF,MAAM,UAAU,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;YAC7C,MAAM,WAAW,GAAG,UAAU,EAAE,GAAG,IAAI,MAAM,CAAC;YAC9C,MAAM,GAAG,GAAG,IAAI,qBAAO,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC;YACzC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,KAAK,CAAC;YACvC,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,IAAI,CAAC;YAC1C,MAAM,IAAI,GAAG,IAAI,iCAAc,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC;YAC3D,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE;gBAC/B,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;aAChE;YACD,MAAM,IAAI,CAAC,IAAI,CAAC;gBACd,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc;aACtC,CAAC,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;YACxE,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;SACrB;QAAC,OAAO,GAAG,EAAE;YACZ,OAAO,CAAC,GAAG,CAAE,GAAa,CAAC,OAAO,CAAC,CAAC;SACrC;IACH,CAAC,CAAC,CAAC;IACL,OAAO,WAAW,CAAC;AACrB,CAAC;AA7BD,gCA6BC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@osaas/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "Open Source Cloud CLI",
|
|
5
5
|
"author": "Eyevinn Technology <work@eyevinn.se>",
|
|
6
6
|
"homepage": "https://www.osaas.io",
|
|
@@ -22,8 +22,9 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@osaas/client-core": "^0.8.0",
|
|
25
|
+
"@osaas/client-db": "^0.1.0",
|
|
25
26
|
"@osaas/client-intercom": "^0.1.0",
|
|
26
|
-
"@osaas/client-transcode": "^0.7.
|
|
27
|
+
"@osaas/client-transcode": "^0.7.1",
|
|
27
28
|
"chalk": "4.1.2",
|
|
28
29
|
"commander": "^12.1.0",
|
|
29
30
|
"fast-jwt": "^4.0.1"
|
|
@@ -31,5 +32,5 @@
|
|
|
31
32
|
"publishConfig": {
|
|
32
33
|
"access": "public"
|
|
33
34
|
},
|
|
34
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "779baa027421ac20b4c05b0c11fd88278d316f09"
|
|
35
36
|
}
|
package/src/cli.ts
CHANGED
|
@@ -9,6 +9,7 @@ import cmdPackager from './packager/cmd';
|
|
|
9
9
|
import cmdLive from './live/cmd';
|
|
10
10
|
import cmdIntercom from './intercom/cmd';
|
|
11
11
|
import cmdTranscribe from './transcribe/cmd';
|
|
12
|
+
import cmdDb from './db/cmd';
|
|
12
13
|
|
|
13
14
|
const cli = new Command();
|
|
14
15
|
|
|
@@ -25,4 +26,5 @@ cli.addCommand(cmdCompare());
|
|
|
25
26
|
cli.addCommand(cmdLive());
|
|
26
27
|
cli.addCommand(cmdIntercom());
|
|
27
28
|
cli.addCommand(cmdTranscribe());
|
|
29
|
+
cli.addCommand(cmdDb());
|
|
28
30
|
cli.parse(process.argv);
|
package/src/db/cmd.ts
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { Context } from '@osaas/client-core';
|
|
2
|
+
import { ValkeyDb } from '@osaas/client-db';
|
|
3
|
+
import { Command } from 'commander';
|
|
4
|
+
import { confirm } from '../user/util';
|
|
5
|
+
|
|
6
|
+
function createDb(context: Context, type: string, name: string) {
|
|
7
|
+
if (type === 'valkey') {
|
|
8
|
+
return new ValkeyDb({ context, name });
|
|
9
|
+
} else {
|
|
10
|
+
throw new Error('Unsupported database type: ' + type);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
async function listDb(
|
|
15
|
+
context: Context,
|
|
16
|
+
type: string
|
|
17
|
+
): Promise<{ name: string; url?: URL }[]> {
|
|
18
|
+
const databases: { name: string; url?: URL }[] = [];
|
|
19
|
+
|
|
20
|
+
if (type === 'valkey') {
|
|
21
|
+
const dbs = await ValkeyDb.list(context);
|
|
22
|
+
for (const db of dbs) {
|
|
23
|
+
const url = await db.getRedisUrl();
|
|
24
|
+
databases.push({ name: db.getName(), url });
|
|
25
|
+
}
|
|
26
|
+
} else {
|
|
27
|
+
throw new Error('Unsupported database type: ' + type);
|
|
28
|
+
}
|
|
29
|
+
return databases;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export default function cmdDb() {
|
|
33
|
+
const db = new Command('db');
|
|
34
|
+
db.command('create')
|
|
35
|
+
.description('Create a new database')
|
|
36
|
+
.argument('<type>', 'The database type (available: valkey)')
|
|
37
|
+
.argument('<name>', 'The database name')
|
|
38
|
+
.action(async (type, name, options, command) => {
|
|
39
|
+
try {
|
|
40
|
+
const globalOpts = command.optsWithGlobals();
|
|
41
|
+
const environment = globalOpts?.env || 'prod';
|
|
42
|
+
const ctx = new Context({ environment });
|
|
43
|
+
|
|
44
|
+
const db = createDb(ctx, type, name);
|
|
45
|
+
const redisUrl = await db.getRedisUrl();
|
|
46
|
+
if (redisUrl) {
|
|
47
|
+
console.log(redisUrl?.toString());
|
|
48
|
+
}
|
|
49
|
+
} catch (err) {
|
|
50
|
+
console.log((err as Error).message);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
db.command('remove')
|
|
55
|
+
.description('Remove a database')
|
|
56
|
+
.argument('<type>', 'The database type (available: valkey)')
|
|
57
|
+
.argument('<name>', 'The database name')
|
|
58
|
+
.action(async (type, name, options, command) => {
|
|
59
|
+
try {
|
|
60
|
+
const globalOpts = command.optsWithGlobals();
|
|
61
|
+
const environment = globalOpts?.env || 'prod';
|
|
62
|
+
const ctx = new Context({ environment });
|
|
63
|
+
|
|
64
|
+
const db = createDb(ctx, type, name);
|
|
65
|
+
await confirm(
|
|
66
|
+
'Are you sure you want to remove this database? (yes/no) '
|
|
67
|
+
);
|
|
68
|
+
await db.destroy();
|
|
69
|
+
} catch (err) {
|
|
70
|
+
console.log((err as Error).message);
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
db.command('list')
|
|
75
|
+
.description('List all databases')
|
|
76
|
+
.argument('<type>', 'The database type (available: valkey)')
|
|
77
|
+
.action(async (type, options, command) => {
|
|
78
|
+
try {
|
|
79
|
+
const globalOpts = command.optsWithGlobals();
|
|
80
|
+
const environment = globalOpts?.env || 'prod';
|
|
81
|
+
const ctx = new Context({ environment });
|
|
82
|
+
const dbs = await listDb(ctx, type);
|
|
83
|
+
dbs.forEach((db) => {
|
|
84
|
+
console.log(db.name + ': ' + db.url?.toString());
|
|
85
|
+
});
|
|
86
|
+
} catch (err) {
|
|
87
|
+
console.log((err as Error).message);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
return db;
|
|
92
|
+
}
|
package/src/transcribe/cmd.ts
CHANGED
|
@@ -8,8 +8,8 @@ export default function cmdTranscribe() {
|
|
|
8
8
|
transcriber
|
|
9
9
|
.description('Generate subtitles from video or audio using Open AI Whisper')
|
|
10
10
|
.argument('<source>', 'Source URL (supported protocols: http, https)')
|
|
11
|
-
.option('-f, --format', 'Output format (default: vtt)')
|
|
12
|
-
.option('-l, --language', 'Language (default: en)')
|
|
11
|
+
.option('-f, --format <format>', 'Output format (default: vtt)')
|
|
12
|
+
.option('-l, --language <language>', 'Language (default: en)')
|
|
13
13
|
.action(async (source, options, command) => {
|
|
14
14
|
try {
|
|
15
15
|
const globalOpts = command.optsWithGlobals();
|