@thingd/cli 0.81.0 → 0.82.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/dist/index.d.ts.map +1 -1
- package/dist/index.js +43 -2
- package/package.json +2 -2
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAeA,OAAO,EAYL,MAAM,EACN,KAAK,YAAY,EAClB,MAAM,aAAa,CAAC;AASrB,KAAK,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;AAEjD,KAAK,YAAY,GAAG;IAClB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B,CAAC;AAEF,KAAK,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC;AAE1C,MAAM,MAAM,aAAa,GAAG;IAC1B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,KAAK,CAAC,EAAE,YAAY,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAC7B,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,MAAM,EAAE,UAAU,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,YAAY,CAAC;IACrB,MAAM,EAAE,YAAY,CAAC;IACrB,KAAK,EAAE,YAAY,CAAC;IACpB,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAsCF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,MAAM,CA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pF;AAED,wBAAgB,SAAS,CAAC,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAElE"}
|
package/dist/index.js
CHANGED
|
@@ -105,6 +105,8 @@ Usage:
|
|
|
105
105
|
thingd cloud instance list <project>
|
|
106
106
|
thingd cloud api-key create <project> <name>
|
|
107
107
|
thingd db checkpoint [--path <path>]
|
|
108
|
+
thingd db compact [--path <path>]
|
|
109
|
+
thingd db repack --path <source> --destination <path>
|
|
108
110
|
thingd db integrity [--path <path>]
|
|
109
111
|
thingd db backup --out <archive.tar> [--path <path>]
|
|
110
112
|
thingd db restore --in <archive.tar> --destination <path> [--replace]
|
|
@@ -321,12 +323,20 @@ async function runCommand(context) {
|
|
|
321
323
|
if (command === "db") {
|
|
322
324
|
const sub = context.parsed.tokens[1];
|
|
323
325
|
if (!sub) {
|
|
324
|
-
throw new Error("Expected db subcommand: checkpoint, integrity");
|
|
326
|
+
throw new Error("Expected db subcommand: checkpoint, compact, repack, integrity");
|
|
325
327
|
}
|
|
326
328
|
if (sub === "checkpoint") {
|
|
327
329
|
await runDbCheckpoint(context);
|
|
328
330
|
return;
|
|
329
331
|
}
|
|
332
|
+
if (sub === "compact") {
|
|
333
|
+
await runDbCompact(context);
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
if (sub === "repack") {
|
|
337
|
+
await runDbRepack(context);
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
330
340
|
if (sub === "integrity") {
|
|
331
341
|
await runDbIntegrity(context);
|
|
332
342
|
return;
|
|
@@ -343,7 +353,7 @@ async function runCommand(context) {
|
|
|
343
353
|
await runDbReencrypt(context);
|
|
344
354
|
return;
|
|
345
355
|
}
|
|
346
|
-
throw new Error(`Unknown db subcommand: ${sub}. Expected: checkpoint, integrity, backup, restore, reencrypt`);
|
|
356
|
+
throw new Error(`Unknown db subcommand: ${sub}. Expected: checkpoint, compact, repack, integrity, backup, restore, reencrypt`);
|
|
347
357
|
}
|
|
348
358
|
throw new Error(`Unknown command: ${command}`);
|
|
349
359
|
}
|
|
@@ -426,6 +436,37 @@ async function runDbCheckpoint(context) {
|
|
|
426
436
|
writeJson(context.stdout, result, context.pretty);
|
|
427
437
|
});
|
|
428
438
|
}
|
|
439
|
+
async function runDbCompact(context) {
|
|
440
|
+
const connection = resolveConnection(context);
|
|
441
|
+
if (connection.cloud || connection.driver !== "native") {
|
|
442
|
+
throw new Error("db compact requires a local native database");
|
|
443
|
+
}
|
|
444
|
+
const db = await NativeThingStore.open(connection.path, connection.encryptionKey);
|
|
445
|
+
try {
|
|
446
|
+
await db.compact();
|
|
447
|
+
writeJson(context.stdout, { ok: true, path: connection.path }, context.pretty);
|
|
448
|
+
}
|
|
449
|
+
finally {
|
|
450
|
+
await db.close();
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
async function runDbRepack(context) {
|
|
454
|
+
const source = stringFlag(context.parsed, "path") ?? context.env.THINGD_PATH;
|
|
455
|
+
const destination = stringFlag(context.parsed, "destination");
|
|
456
|
+
if (!source || !destination) {
|
|
457
|
+
throw new Error("db repack requires --path <source> and --destination <path>");
|
|
458
|
+
}
|
|
459
|
+
if (resolve(source) === resolve(destination)) {
|
|
460
|
+
throw new Error("db repack requires different source and destination paths");
|
|
461
|
+
}
|
|
462
|
+
await NativeThingStore.repack(resolve(source), resolve(destination), context.env.THINGD_ENCRYPTION_KEY);
|
|
463
|
+
writeJson(context.stdout, {
|
|
464
|
+
ok: true,
|
|
465
|
+
source: resolve(source),
|
|
466
|
+
destination: resolve(destination),
|
|
467
|
+
format: "thingd-native",
|
|
468
|
+
}, context.pretty);
|
|
469
|
+
}
|
|
429
470
|
async function runDbIntegrity(context) {
|
|
430
471
|
await withDb(context, async (db) => {
|
|
431
472
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thingd/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.82.1",
|
|
4
4
|
"description": "CLI, Interactive TUI Dashboard, and MCP server for thingd — a fast object-first data engine for applications and AI agents.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"homepage": "https://engine.thingd.cloud",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
45
|
-
"@thingd/sdk": "^0.
|
|
45
|
+
"@thingd/sdk": "^0.82.1",
|
|
46
46
|
"cli-table3": "^0.6.5",
|
|
47
47
|
"picocolors": "^1.1.1",
|
|
48
48
|
"zod": "^4.4.3"
|