@withone/cli 1.43.2 → 1.43.3

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.
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-MRGKKO54.js";
7
7
  import {
8
8
  getBackend
9
- } from "./chunk-5TT27ORC.js";
9
+ } from "./chunk-IAFQVFCB.js";
10
10
 
11
11
  // src/commands/mem/sql.ts
12
12
  async function memSqlCommand(sql) {
@@ -10,7 +10,7 @@ import {
10
10
  import {
11
11
  getBackend,
12
12
  upsertRecord
13
- } from "./chunk-5TT27ORC.js";
13
+ } from "./chunk-IAFQVFCB.js";
14
14
 
15
15
  // src/commands/mem/migrate.ts
16
16
  import fs4 from "fs";
@@ -1648,6 +1648,15 @@ function bootstrapMemoryDefaults() {
1648
1648
  function resetBackendSingleton() {
1649
1649
  cached = null;
1650
1650
  }
1651
+ async function closeBackendIfCached() {
1652
+ if (!cached) return;
1653
+ try {
1654
+ const backend = await cached;
1655
+ await backend.close();
1656
+ } catch {
1657
+ }
1658
+ cached = null;
1659
+ }
1651
1660
  async function addRecord(input, opts = {}) {
1652
1661
  const backend = await getBackend();
1653
1662
  const { searchable_text, content_hash, embedding, embedding_model } = await prepareRecord(input, opts, "add");
@@ -1693,6 +1702,7 @@ export {
1693
1702
  loadBackendFromConfig,
1694
1703
  getBackend,
1695
1704
  resetBackendSingleton,
1705
+ closeBackendIfCached,
1696
1706
  addRecord,
1697
1707
  upsertRecord
1698
1708
  };
package/dist/index.js CHANGED
@@ -21,7 +21,7 @@ import {
21
21
  } from "./chunk-EMAQVPRD.js";
22
22
  import {
23
23
  memSqlCommand
24
- } from "./chunk-7N5EJTYW.js";
24
+ } from "./chunk-3ZJVO4GP.js";
25
25
  import {
26
26
  countRecords,
27
27
  deleteDatabase,
@@ -46,7 +46,7 @@ import {
46
46
  upsertRecords,
47
47
  writeDraftProfile,
48
48
  writeProfile
49
- } from "./chunk-AD4QM6R5.js";
49
+ } from "./chunk-C3ORS3RG.js";
50
50
  import {
51
51
  getByDotPath
52
52
  } from "./chunk-44CV5IMX.js";
@@ -73,12 +73,13 @@ import {
73
73
  import {
74
74
  SCHEMA_VERSION,
75
75
  addRecord,
76
+ closeBackendIfCached,
76
77
  getBackend,
77
78
  getBackendPlugin,
78
79
  listBackendPlugins,
79
80
  loadBackendFromConfig,
80
81
  upsertRecord
81
- } from "./chunk-5TT27ORC.js";
82
+ } from "./chunk-IAFQVFCB.js";
82
83
  import {
83
84
  DEFAULT_MEMORY_CONFIG,
84
85
  configExists,
@@ -5681,7 +5682,7 @@ async function syncModel(api, profile, options) {
5681
5682
  updateModelState(platform, model, { status: "failed", pagesProcessed, lastCursor }),
5682
5683
  (async () => {
5683
5684
  try {
5684
- const { getBackend: getBackend2 } = await import("./runtime-O3PX562N.js");
5685
+ const { getBackend: getBackend2 } = await import("./runtime-NVC7KAJZ.js");
5685
5686
  const backend = await getBackend2();
5686
5687
  await Promise.race([
5687
5688
  backend.close(),
@@ -6036,7 +6037,7 @@ async function syncModel(api, profile, options) {
6036
6037
  db.exec(`DROP TABLE IF EXISTS _seen_ids`);
6037
6038
  }
6038
6039
  if (options.toMemory !== false) {
6039
- const backend = await (await import("./runtime-O3PX562N.js")).getBackend();
6040
+ const backend = await (await import("./runtime-NVC7KAJZ.js")).getBackend();
6040
6041
  const type = `${platform}/${model}`;
6041
6042
  const existing = await backend.listKeysByType(type);
6042
6043
  const sourcePrefix = `${type}:`;
@@ -6116,7 +6117,7 @@ async function syncModel(api, profile, options) {
6116
6117
  let statusCounts;
6117
6118
  if (options.toMemory !== false) {
6118
6119
  try {
6119
- const backend = await (await import("./runtime-O3PX562N.js")).getBackend();
6120
+ const backend = await (await import("./runtime-NVC7KAJZ.js")).getBackend();
6120
6121
  const typeName = `${platform}/${model}`;
6121
6122
  const [active, archived] = await Promise.all([
6122
6123
  backend.count(typeName, { status: "active" }),
@@ -7735,7 +7736,7 @@ ${result.total} results`);
7735
7736
  }
7736
7737
  }
7737
7738
  async function syncSqlCommand(platformModel, sql) {
7738
- const { syncSqlCommand: runSyncSql } = await import("./sql-JEBAPGJP.js");
7739
+ const { syncSqlCommand: runSyncSql } = await import("./sql-EGTWQIU5.js");
7739
7740
  await runSyncSql(platformModel, sql);
7740
7741
  }
7741
7742
  async function syncDeleteCommand(platformModel, options) {
@@ -7813,7 +7814,7 @@ async function syncDeleteCommand(platformModel, options) {
7813
7814
  async function maybeAutoMigrateLegacy(platform, models) {
7814
7815
  const dbSize = getDatabaseSize(platform);
7815
7816
  if (!dbSize || dbSize === "0 B") return;
7816
- const { getBackend: getBackend2 } = await import("./runtime-O3PX562N.js");
7817
+ const { getBackend: getBackend2 } = await import("./runtime-NVC7KAJZ.js");
7817
7818
  const backend = await getBackend2();
7818
7819
  let memoryHasData = false;
7819
7820
  for (const model of models) {
@@ -7829,7 +7830,7 @@ async function maybeAutoMigrateLegacy(platform, models) {
7829
7830
  ` detected legacy .one/sync/data/${platform}.db (${dbSize}) \u2014 auto-migrating into memory before sync.
7830
7831
  `
7831
7832
  );
7832
- const { memMigrateCommand: memMigrateCommand3 } = await import("./migrate-LHFWCO6M.js");
7833
+ const { memMigrateCommand: memMigrateCommand3 } = await import("./migrate-BEARUBLO.js");
7833
7834
  await memMigrateCommand3({ platform, yes: true });
7834
7835
  return;
7835
7836
  }
@@ -7838,7 +7839,7 @@ async function maybeAutoMigrateLegacy(platform, models) {
7838
7839
  initialValue: true
7839
7840
  });
7840
7841
  if (p7.isCancel(shouldMigrate) || !shouldMigrate) return;
7841
- const { memMigrateCommand: memMigrateCommand2 } = await import("./migrate-LHFWCO6M.js");
7842
+ const { memMigrateCommand: memMigrateCommand2 } = await import("./migrate-BEARUBLO.js");
7842
7843
  await memMigrateCommand2({ platform, yes: true });
7843
7844
  }
7844
7845
  async function syncSuggestSearchableCommand(platformModel, options = {}) {
@@ -7899,7 +7900,7 @@ async function syncSuggestSearchableCommand(platformModel, options = {}) {
7899
7900
  async function syncListCommand(platform) {
7900
7901
  const profiles = listProfiles(platform);
7901
7902
  const state = await readSyncState();
7902
- const { getBackend: getBackend2 } = await import("./runtime-O3PX562N.js");
7903
+ const { getBackend: getBackend2 } = await import("./runtime-NVC7KAJZ.js");
7903
7904
  const backend = await getBackend2();
7904
7905
  const syncs = await Promise.all(profiles.map(async (p10) => {
7905
7906
  const modelState = state[p10.platform]?.[p10.model];
@@ -10713,6 +10714,7 @@ program.hook("preAction", (thisCommand) => {
10713
10714
  }
10714
10715
  });
10715
10716
  program.hook("postAction", async () => {
10717
+ await closeBackendIfCached();
10716
10718
  if (!updateCheckPromise) return;
10717
10719
  const info = await updateCheckPromise;
10718
10720
  if (!info) return;
@@ -3,10 +3,10 @@ import {
3
3
  dotPathToJsonbExpr,
4
4
  memMigrateCommand,
5
5
  reviveStringifiedJson
6
- } from "./chunk-AD4QM6R5.js";
6
+ } from "./chunk-C3ORS3RG.js";
7
7
  import "./chunk-44CV5IMX.js";
8
8
  import "./chunk-MRGKKO54.js";
9
- import "./chunk-5TT27ORC.js";
9
+ import "./chunk-IAFQVFCB.js";
10
10
  import "./chunk-AU2ZEEMS.js";
11
11
  export {
12
12
  buildIdentityMap,
@@ -1,12 +1,14 @@
1
1
  import {
2
2
  addRecord,
3
+ closeBackendIfCached,
3
4
  getBackend,
4
5
  resetBackendSingleton,
5
6
  upsertRecord
6
- } from "./chunk-5TT27ORC.js";
7
+ } from "./chunk-IAFQVFCB.js";
7
8
  import "./chunk-AU2ZEEMS.js";
8
9
  export {
9
10
  addRecord,
11
+ closeBackendIfCached,
10
12
  getBackend,
11
13
  resetBackendSingleton,
12
14
  upsertRecord
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  memSqlCommand,
3
3
  syncSqlCommand
4
- } from "./chunk-7N5EJTYW.js";
4
+ } from "./chunk-3ZJVO4GP.js";
5
5
  import "./chunk-MRGKKO54.js";
6
- import "./chunk-5TT27ORC.js";
6
+ import "./chunk-IAFQVFCB.js";
7
7
  import "./chunk-AU2ZEEMS.js";
8
8
  export {
9
9
  memSqlCommand,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@withone/cli",
3
- "version": "1.43.2",
3
+ "version": "1.43.3",
4
4
  "description": "CLI for managing One",
5
5
  "type": "module",
6
6
  "files": [