@ai-matrx/vault 0.1.26 → 0.1.27

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/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.27
4
+
5
+ - **`emptyReadAlarm`, `holdingsDoorIsAbsent`, `HOLDINGS_DOOR_MIGRATION` and the `HoldingRow`/`Holdings` types are exported from the root** so the web app can drop its whole-file copy (`features/secrets/empty-read.ts`). Consumer action: none.
6
+
3
7
  ## 0.1.26
4
8
 
5
9
  - **`glyphs.tsx` draws only `SafeGlyph` itself.** The other 46 vault glyphs (`KeyGlyph`, `CardGlyph`, `EyeGlyph`, `QrGlyph`, ...) are aliases of the matching `@ai-matrx/design-system/icons` glyphs, so they now render the exact lucide 1.48 drawing and carry the `lucide-<name>` optical-trim class instead of a hand-set `--matrx-glyph-air-*` style. Every export name and the `Glyph` type are unchanged. Consumer action: none.
package/dist/index.cjs CHANGED
@@ -140,6 +140,7 @@ __export(src_exports, {
140
140
  DEFAULT_LOCATION: () => DEFAULT_LOCATION,
141
141
  GenerateButton: () => GenerateButton,
142
142
  HIDDEN_ITEM_TAG: () => HIDDEN_ITEM_TAG,
143
+ HOLDINGS_DOOR_MIGRATION: () => HOLDINGS_DOOR_MIGRATION,
143
144
  IdentityGate: () => IdentityGate,
144
145
  LOCKED_MESSAGE: () => LOCKED_MESSAGE,
145
146
  VaultApp: () => VaultApp,
@@ -149,7 +150,9 @@ __export(src_exports, {
149
150
  createApiVaultPort: () => createApiVaultPort,
150
151
  createSupabaseIdentity: () => createSupabaseIdentity,
151
152
  createVaultKnobs: () => createVaultKnobs,
153
+ emptyReadAlarm: () => emptyReadAlarm,
152
154
  guardPort: () => guardPort,
155
+ holdingsDoorIsAbsent: () => holdingsDoorIsAbsent,
153
156
  inferFromUrl: () => inferFromUrl,
154
157
  isHiddenItem: () => isHiddenItem,
155
158
  itemIdAt: () => itemIdAt,
@@ -9882,4 +9885,33 @@ function vaultInventoryScope(inventory, clicked = null) {
9882
9885
  function itemIdAt(target) {
9883
9886
  return target?.closest("[data-item]")?.getAttribute("data-item") ?? null;
9884
9887
  }
9888
+
9889
+ // src/io/empty-read.ts
9890
+ var HOLDINGS_DOOR_MIGRATION = "migrations/campaign/errorshonest_s8_a_credential_says_how_much_it_holds.sql";
9891
+ function holdingsDoorIsAbsent(code) {
9892
+ return code === "PGRST202" || code === "42883";
9893
+ }
9894
+ function staleAlarm(total) {
9895
+ return `Your vault has ${total} ${total === 1 ? "item" : "items"} but none of their fields or files could be read. Either every one of these items is genuinely still empty, or the database refused the read without reporting an error \u2014 the second is a known failure mode of this screen (DD-160). Nothing has been lost: reload, and if the items are still blank, report it rather than re-entering the credentials.`;
9896
+ }
9897
+ function emptyReadAlarm(total, emptyIds, holdings) {
9898
+ if (emptyIds.length === 0) return null;
9899
+ if (holdings.state === "answered") {
9900
+ const asked = new Set(emptyIds);
9901
+ const unread = holdings.rows.filter(
9902
+ (r) => asked.has(r.credential_item_id) && (r.field_count > 0 || r.file_count > 0)
9903
+ );
9904
+ if (unread.length === 0) return null;
9905
+ const n = unread.length;
9906
+ return `${n === 1 ? "One credential" : `${n} credentials`} in this vault ${n === 1 ? "holds" : "hold"} fields or files this screen could not read \u2014 the database refused the read without reporting an error, a known failure mode of this screen (DD-160). Nothing has been lost: reload, and if ${n === 1 ? "it is" : "they are"} still blank, report it rather than re-entering the credentials.`;
9907
+ }
9908
+ if (emptyIds.length < total) return null;
9909
+ if (holdings.state === "absent") {
9910
+ console.warn(
9911
+ `[vault] users.credential_item_holdings is not on this database (${holdings.why}); the empty-read alarm falls back to the whole-vault rule until ${HOLDINGS_DOOR_MIGRATION} is applied.`
9912
+ );
9913
+ return staleAlarm(total);
9914
+ }
9915
+ return `${staleAlarm(total)} (The check that tells an empty credential from an unreadable one did not answer either: ${holdings.why})`;
9916
+ }
9885
9917
  //# sourceMappingURL=index.cjs.map