recappi 0.1.65 → 0.1.67
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.js +67 -5
- package/dist/index.js.map +1 -1
- package/package.json +2 -3
package/dist/index.js
CHANGED
|
@@ -18657,7 +18657,7 @@ import os3 from "os";
|
|
|
18657
18657
|
import path3 from "path";
|
|
18658
18658
|
import { createRequire } from "module";
|
|
18659
18659
|
var require2 = createRequire(import.meta.url);
|
|
18660
|
-
var
|
|
18660
|
+
var sqliteModule = null;
|
|
18661
18661
|
var CLI_STORE_SCHEMA_VERSION = 2;
|
|
18662
18662
|
function defaultStorePath(homeDir = os3.homedir(), env = process.env) {
|
|
18663
18663
|
const explicit = env.RECAPPI_CLI_STORE_PATH?.trim();
|
|
@@ -18689,7 +18689,7 @@ var CliLocalStore = class {
|
|
|
18689
18689
|
if (!opts.readonly && dbPath !== ":memory:") {
|
|
18690
18690
|
mkdirSync(path3.dirname(dbPath), { recursive: true, mode: 448 });
|
|
18691
18691
|
}
|
|
18692
|
-
this.db =
|
|
18692
|
+
this.db = openSqliteDatabase(dbPath, { readonly: opts.readonly === true });
|
|
18693
18693
|
this.now = opts.now ?? Date.now;
|
|
18694
18694
|
if (!opts.readonly) this.migrate();
|
|
18695
18695
|
}
|
|
@@ -18950,6 +18950,44 @@ function parseAccountPartition(input, mode) {
|
|
|
18950
18950
|
return null;
|
|
18951
18951
|
}
|
|
18952
18952
|
}
|
|
18953
|
+
function openSqliteDatabase(filename, opts) {
|
|
18954
|
+
const { DatabaseSync } = loadNodeSqlite();
|
|
18955
|
+
const db = new DatabaseSync(filename, opts.readonly ? { readOnly: true } : {});
|
|
18956
|
+
return {
|
|
18957
|
+
exec: (source) => db.exec(source),
|
|
18958
|
+
prepare: (source) => db.prepare(source),
|
|
18959
|
+
pragma: (source) => db.prepare(`PRAGMA ${source.trim().replace(/;$/, "")}`).all(),
|
|
18960
|
+
close: () => db.close()
|
|
18961
|
+
};
|
|
18962
|
+
}
|
|
18963
|
+
function loadNodeSqlite() {
|
|
18964
|
+
if (sqliteModule) return sqliteModule;
|
|
18965
|
+
sqliteModule = suppressNodeSqliteWarning(() => require2("node:sqlite"));
|
|
18966
|
+
return sqliteModule;
|
|
18967
|
+
}
|
|
18968
|
+
function suppressNodeSqliteWarning(run) {
|
|
18969
|
+
const emitWarning = process.emitWarning;
|
|
18970
|
+
process.emitWarning = function emitWarningWithoutNodeSqliteNoise(warning, ...args) {
|
|
18971
|
+
const message = typeof warning === "string" ? warning : warning.message;
|
|
18972
|
+
if (message.includes("SQLite is an experimental feature")) return;
|
|
18973
|
+
return emitWarning.call(process, warning, ...args);
|
|
18974
|
+
};
|
|
18975
|
+
try {
|
|
18976
|
+
return run();
|
|
18977
|
+
} catch (error51) {
|
|
18978
|
+
if (isMissingNodeSqlite(error51)) {
|
|
18979
|
+
throw cliError("internal.unexpected", "Local SQLite store requires Node.js 22 or newer.", {
|
|
18980
|
+
hint: "Upgrade Node.js, then retry. Cloud-only commands that do not touch local state can still run."
|
|
18981
|
+
});
|
|
18982
|
+
}
|
|
18983
|
+
throw error51;
|
|
18984
|
+
} finally {
|
|
18985
|
+
process.emitWarning = emitWarning;
|
|
18986
|
+
}
|
|
18987
|
+
}
|
|
18988
|
+
function isMissingNodeSqlite(error51) {
|
|
18989
|
+
return error51 instanceof Error && ("code" in error51 ? error51.code === "ERR_UNKNOWN_BUILTIN_MODULE" : false);
|
|
18990
|
+
}
|
|
18953
18991
|
function cleanString(value) {
|
|
18954
18992
|
const trimmed = value?.trim();
|
|
18955
18993
|
return trimmed ? trimmed : null;
|
|
@@ -22595,19 +22633,43 @@ async function runCli(deps = {}) {
|
|
|
22595
22633
|
renderSuccess("version", { version: CLI_VERSION }, render3);
|
|
22596
22634
|
return 0;
|
|
22597
22635
|
}
|
|
22598
|
-
|
|
22636
|
+
let auth = await resolveAuthContext({
|
|
22599
22637
|
origin: parsed.options.origin,
|
|
22600
22638
|
env: deps.env,
|
|
22601
22639
|
homeDir: deps.homeDir
|
|
22602
22640
|
});
|
|
22603
|
-
|
|
22641
|
+
let client = new RecappiApiClient(auth, {
|
|
22604
22642
|
fetchImpl: deps.fetchImpl,
|
|
22605
22643
|
sleep: deps.sleep,
|
|
22606
22644
|
env: deps.env,
|
|
22607
22645
|
homeDir: deps.homeDir
|
|
22608
22646
|
});
|
|
22609
22647
|
if (parsed.kind === "dashboard") {
|
|
22610
|
-
|
|
22648
|
+
let status = await client.authStatus();
|
|
22649
|
+
if (!status.loggedIn) {
|
|
22650
|
+
await loginWithDeviceCode({
|
|
22651
|
+
origin: auth.origin,
|
|
22652
|
+
homeDir: deps.homeDir,
|
|
22653
|
+
onPrompt: (message) => stderr(message),
|
|
22654
|
+
deps: {
|
|
22655
|
+
fetchImpl: deps.fetchImpl,
|
|
22656
|
+
openUrl: deps.openUrl,
|
|
22657
|
+
sleep: deps.sleep
|
|
22658
|
+
}
|
|
22659
|
+
});
|
|
22660
|
+
auth = await resolveAuthContext({
|
|
22661
|
+
origin: parsed.options.origin,
|
|
22662
|
+
env: deps.env,
|
|
22663
|
+
homeDir: deps.homeDir
|
|
22664
|
+
});
|
|
22665
|
+
client = new RecappiApiClient(auth, {
|
|
22666
|
+
fetchImpl: deps.fetchImpl,
|
|
22667
|
+
sleep: deps.sleep,
|
|
22668
|
+
env: deps.env,
|
|
22669
|
+
homeDir: deps.homeDir
|
|
22670
|
+
});
|
|
22671
|
+
status = await client.authStatus();
|
|
22672
|
+
}
|
|
22611
22673
|
const account = status.loggedIn && status.userId ? { backendOrigin: auth.origin, userId: status.userId } : null;
|
|
22612
22674
|
const recordingAudio = createRecordingAudioRuntime(client, {
|
|
22613
22675
|
account,
|