@cerefox/memory 1.19.0 → 1.19.2

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.
@@ -5318,7 +5318,7 @@ var init_cli_core = __esm(() => {
5318
5318
  });
5319
5319
 
5320
5320
  // src/meta.ts
5321
- var PKG_VERSION = "1.19.0";
5321
+ var PKG_VERSION = "1.19.2";
5322
5322
  var init_meta = () => {};
5323
5323
 
5324
5324
  // ../../_shared/config/paths.ts
@@ -26848,7 +26848,7 @@ var init_update_check = __esm(() => {
26848
26848
  });
26849
26849
 
26850
26850
  // ../../_shared/ef-meta/index.ts
26851
- var EF_VERSION = "1.19.0", CEREFOX_VERSION = "1.19.0", EF_LAST_CHANGED = "1.19.0";
26851
+ var EF_VERSION = "1.19.2", CEREFOX_VERSION = "1.19.2", EF_LAST_CHANGED = "1.19.0";
26852
26852
  var init_ef_meta = () => {};
26853
26853
 
26854
26854
  // ../../_shared/embeddings/onnx-embedder.ts
@@ -80962,6 +80962,7 @@ var EDIT_FIELDS = new Set([
80962
80962
  "requestor",
80963
80963
  "author_type"
80964
80964
  ]);
80965
+ var METADATA_TOKEN_DEPRECATION = "deprecated: metadata was replaced without expected_metadata_revision, as last-write-wins, " + "so a concurrent metadata change may have been overwritten. Send the metadata_revision " + "you read (GET /api/v1/documents/{id}); a future release will require it.";
80965
80966
  var TRASHED_MESSAGE = "This document was moved to the trash while you were editing. " + "Restore it from the Trash page first, then save again.";
80966
80967
  function conflictBody(currentHash) {
80967
80968
  const message = "This document changed while you were editing it (another writer saved a newer version). " + "Open it again in a new tab, merge your changes, and save from there.";
@@ -81029,10 +81030,8 @@ function registerDocumentWriteRoutes(app, ctx) {
81029
81030
  }
81030
81031
  const metadataCarried = body.metadata != null;
81031
81032
  const sentRevision = typeof body.expected_metadata_revision === "number" && Number.isInteger(body.expected_metadata_revision) ? body.expected_metadata_revision : null;
81032
- if (metadataCarried && sentRevision === null && who.identity.named && !lastWriteWins) {
81033
- const message = "CEREFOX_METADATA_TOKEN_REQUIRED: this route replaces the metadata, so an identified caller " + "must send expected_metadata_revision (the metadata_revision it read) or last_write_wins.";
81034
- return c.json({ success: false, error: "expected_metadata_revision required", message, detail: message }, 400);
81035
- }
81033
+ const metadataTokenMissing = metadataCarried && sentRevision === null && !lastWriteWins;
81034
+ const warnings = metadataTokenMissing ? [METADATA_TOKEN_DEPRECATION] : undefined;
81036
81035
  const expectedMetadataRevision = sentRevision ?? (doc.metadata_revision ?? null);
81037
81036
  const proposedHash = content.trim() ? contentHash(content) : null;
81038
81037
  const contentChanged = proposedHash !== null && currentHash !== null && proposedHash !== currentHash;
@@ -81063,7 +81062,7 @@ function registerDocumentWriteRoutes(app, ctx) {
81063
81062
  expectedContentHash: expectedHash,
81064
81063
  lastWriteWins
81065
81064
  });
81066
- return c.json({ success: true, reindexed: result.reindexed });
81065
+ return c.json({ success: true, reindexed: result.reindexed, ...warnings ? { warnings } : {} });
81067
81066
  } catch (err) {
81068
81067
  if (err instanceof ConcurrencyConflictError) {
81069
81068
  return c.json(conflictBody(err.currentHash), 409);
@@ -81101,14 +81100,14 @@ function registerDocumentWriteRoutes(app, ctx) {
81101
81100
  documentId,
81102
81101
  title: body.title !== undefined && title !== doc.title ? title : undefined,
81103
81102
  metadata: metadataCarried ? metadata : undefined,
81104
- expectedMetadataRevision,
81105
- metadataLastWriteWins: lastWriteWins,
81103
+ expectedMetadataRevision: metadataTokenMissing ? null : expectedMetadataRevision,
81104
+ metadataLastWriteWins: lastWriteWins || metadataTokenMissing,
81106
81105
  projectIds: Array.isArray(body.project_ids) ? projectIds : undefined,
81107
81106
  author: who.identity.author,
81108
81107
  authorType: who.identity.authorType,
81109
81108
  accessPath: who.identity.accessPath
81110
81109
  });
81111
- return c.json({ success: true, reindexed: false, ...facets });
81110
+ return c.json({ success: true, reindexed: false, ...facets, ...warnings ? { warnings } : {} });
81112
81111
  } catch (err) {
81113
81112
  const cause = err instanceof FacetUpdateError ? err.cause : err;
81114
81113
  const msg = err instanceof Error ? err.message : String(err);