@vibes.diy/base 14.3.380 → 14.3.382

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.
@@ -2,7 +2,7 @@ import { Result } from "@adviser/cement";
2
2
  import type { PromptAttachment } from "./attachment-types.js";
3
3
  export declare const HELD_ATTACHMENTS_DB = "vibes-held-attachments";
4
4
  export interface HeldAttachmentStore {
5
- put(appKey: string, payloads: readonly PromptAttachment[]): Promise<void>;
5
+ put(appKey: string, payloads: readonly PromptAttachment[]): Promise<boolean>;
6
6
  drop(appKey: string): Promise<void>;
7
7
  peek(appKey: string): Promise<Result<readonly PromptAttachment[]>>;
8
8
  holds(appKey: string): boolean;
@@ -101,7 +101,7 @@ export function idbHeldAttachments(opts = {}) {
101
101
  const files = await Promise.all(payloads.map(toRow));
102
102
  const db = await open();
103
103
  if (generations.get(appKey) !== gen)
104
- return;
104
+ return false;
105
105
  const tx = db.transaction(ROWS, "readwrite");
106
106
  const rows = tx.objectStore(ROWS);
107
107
  const at = now();
@@ -116,6 +116,7 @@ export function idbHeldAttachments(opts = {}) {
116
116
  cursor.continue();
117
117
  };
118
118
  await done(tx);
119
+ return generations.get(appKey) === gen;
119
120
  }
120
121
  async function readRow(token) {
121
122
  const db = await open();
@@ -142,13 +143,16 @@ export function idbHeldAttachments(opts = {}) {
142
143
  }
143
144
  return {
144
145
  async put(appKey, payloads) {
145
- if (payloads.length === 0)
146
- return drop(appKey);
146
+ if (payloads.length === 0) {
147
+ await drop(appKey);
148
+ return true;
149
+ }
147
150
  const gen = nextGeneration(appKey);
148
151
  const token = mintToken(appKey);
149
152
  if (token === undefined)
150
- return;
151
- await exception2Result(() => writeRow({ appKey, gen, token, payloads }));
153
+ return false;
154
+ const wrote = await exception2Result(() => writeRow({ appKey, gen, token, payloads }));
155
+ return wrote.isOk() && wrote.Ok();
152
156
  },
153
157
  drop,
154
158
  async peek(appKey) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibes.diy/base",
3
- "version": "14.3.380",
3
+ "version": "14.3.382",
4
4
  "license": "SEE LICENSE IN LICENSE.md",
5
5
  "type": "module",
6
6
  "main": "./index.js",
@@ -10,10 +10,10 @@
10
10
  "dependencies": {
11
11
  "@adviser/cement": "~0.5.37",
12
12
  "@emotion/css": "~11.13.5",
13
- "@vibes.diy/api-types": "14.3.380",
14
- "@vibes.diy/use-vibes-types": "14.3.380",
15
- "@vibes.diy/vibe-runtime": "14.3.380",
16
- "@vibes.diy/vibe-types": "14.3.380",
13
+ "@vibes.diy/api-types": "14.3.382",
14
+ "@vibes.diy/use-vibes-types": "14.3.382",
15
+ "@vibes.diy/vibe-runtime": "14.3.382",
16
+ "@vibes.diy/vibe-types": "14.3.382",
17
17
  "arktype": "~2.2.9",
18
18
  "officeparser": "~8.7.1",
19
19
  "qrcode-generator": "~2.0.4",