@usequark/quark-create-app 1.25.0 → 1.25.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usequark/quark-create-app",
3
- "version": "1.25.0",
3
+ "version": "1.25.1",
4
4
  "description": "CLI to scaffold new Quark projects with Next.js, Prisma, BullMQ, and Railway deployment",
5
5
  "keywords": [
6
6
  "quark",
@@ -5,6 +5,8 @@
5
5
  */
6
6
 
7
7
  import {
8
+ ConflictError,
9
+ createLogger,
8
10
  createStorage,
9
11
  ForbiddenError,
10
12
  NotFoundError,
@@ -15,16 +17,30 @@ import { NextResponse } from "next/server";
15
17
  import { requireAuth } from "@/lib/auth-middleware";
16
18
  import { handleError } from "../../error-handler";
17
19
 
20
+ const logger = createLogger("files");
21
+
18
22
  /**
19
23
  * GET /api/files/[id]
20
- * Serve / download a file by its database ID.
21
- * Public endpoint (no auth required) - access control is by knowledge of ID.
24
+ * Serve / download a file by its database ID or its storage key.
25
+ * Public endpoint (no auth required) - access control is by knowledge of the
26
+ * identifier.
27
+ *
28
+ * Both identifier forms are accepted because `getAssetUrl()` in
29
+ * `@usequark/quark-core` builds `/api/files/<key>` from a storage key, and
30
+ * nothing in this app ever called it with anything else. Serving only by id
31
+ * made every URL that function produces a 404.
22
32
  */
23
33
  export async function GET(_request, { params }) {
24
34
  try {
25
35
  const { id } = await params;
26
36
 
27
- const record = await file.findById(id);
37
+ // The two forms are disjoint: a cuid never contains "/", and a storage key
38
+ // always does (`<prefix>/<year>/<month>/<id>-<name>`). An id lookup that
39
+ // misses is followed by a key lookup, so the id path costs no extra query.
40
+ let record = await file.findById(id);
41
+ if (!record && id.includes("/")) {
42
+ record = await file.findByStorageKey(id);
43
+ }
28
44
  if (!record) {
29
45
  throw new NotFoundError("File not found");
30
46
  }
@@ -35,7 +51,13 @@ export async function GET(_request, { params }) {
35
51
  const headers = new Headers();
36
52
  headers.set("Content-Type", contentType || record.mimeType);
37
53
  headers.set("Content-Length", String(body.length));
38
- headers.set("Cache-Control", "public, max-age=31536000, immutable");
54
+ // Bounded, not `immutable`. The URL carries no version segment and nothing
55
+ // in the path is content-addressed, so `immutable` (never revalidate for a
56
+ // year) was a promise this route cannot keep: any code path that reuses an
57
+ // identifier — admin tooling, a seed, a restore from backup — would leave
58
+ // every browser and CDN holding the old bytes indefinitely. A bounded
59
+ // max-age bounds that window instead.
60
+ headers.set("Cache-Control", "public, max-age=3600");
39
61
 
40
62
  // Inline display for images; attachment download for everything else
41
63
  const isImage = record.mimeType.startsWith("image/");
@@ -57,6 +79,20 @@ export async function GET(_request, { params }) {
57
79
  /**
58
80
  * DELETE /api/files/[id]
59
81
  * Delete a file. Only the uploader or an admin can delete.
82
+ *
83
+ * Order matters: the database row goes first, the storage object second.
84
+ *
85
+ * `File` has no incoming relations today, so nothing can make the row delete
86
+ * fail on a foreign key — but a future incoming relation with a restrictive
87
+ * `onDelete` will, and at that point this ordering is what keeps the storage
88
+ * object intact. The old order (storage, then row) destroyed the bytes first,
89
+ * so a refused row delete left a row pointing at a blob that no longer existed:
90
+ * unrecoverable, because the bytes are the only copy and they are already gone.
91
+ *
92
+ * `deleteIfPresent` also closes the concurrent-delete race. Two overlapping
93
+ * requests both pass the ownership check above; the row delete reports how many
94
+ * rows it removed, so only the request that actually removed the row goes on to
95
+ * delete the storage object. The loser returns 404 without touching storage.
60
96
  */
61
97
  export const DELETE = withCsrfProtection(async (_request, { params }) => {
62
98
  try {
@@ -75,12 +111,42 @@ export const DELETE = withCsrfProtection(async (_request, { params }) => {
75
111
  throw new ForbiddenError("You can only delete your own files");
76
112
  }
77
113
 
78
- // Remove from storage
79
- const storage = createStorage();
80
- await storage.delete(record.storageKey);
114
+ // Remove the database record first. This is the reversible step: if the
115
+ // storage delete below fails, we have an orphaned blob, which is junk but
116
+ // harmless. The reverse order risks a row whose bytes are already gone.
117
+ let deleted;
118
+ try {
119
+ ({ count: deleted } = await file.deleteIfPresent(record.id));
120
+ } catch (error) {
121
+ // P2003: a foreign key still references this row. Reachable once File
122
+ // gains incoming relations; the storage object is untouched at this point.
123
+ if (error?.code === "P2003") {
124
+ throw new ConflictError("File is referenced and cannot be deleted");
125
+ }
126
+ throw error;
127
+ }
81
128
 
82
- // Remove database record
83
- await file.delete(record.id);
129
+ // count === 0 means a concurrent request already removed the row. It owns
130
+ // the storage cleanup; touching it here would race that request's delete.
131
+ if (deleted === 0) {
132
+ throw new NotFoundError("File not found");
133
+ }
134
+
135
+ // Row is gone, so the blob is now unreferenced. This is the irreversible
136
+ // step and deliberately last.
137
+ const storage = createStorage();
138
+ try {
139
+ await storage.delete(record.storageKey);
140
+ } catch (error) {
141
+ // The row is already deleted, so the delete as a whole succeeded from the
142
+ // caller's point of view. Reporting an error would be a lie the client
143
+ // cannot act on, and the leftover blob is recoverable via the existing
144
+ // orphaned-file cleanup job. Log it rather than swallow it.
145
+ logger.error("Failed to remove file from storage", {
146
+ fileId: record.id,
147
+ error: error?.message ?? String(error),
148
+ });
149
+ }
84
150
 
85
151
  return NextResponse.json({ message: "File deleted" });
86
152
  } catch (error) {
@@ -1,4 +1,5 @@
1
1
  import "./globals.css";
2
+ import { ThemeProvider } from "@usequark/quark-ui";
2
3
  import {
3
4
  THEME_ATTR,
4
5
  THEME_STORAGE_KEY,
@@ -48,7 +49,11 @@ export default function RootLayout({ children }) {
48
49
  ) : null}
49
50
  </head>
50
51
  <body>
51
- {children}
52
+ {/* ThemeProvider renders no markup. It publishes theme state to
53
+ React consumers (useTheme/ThemeToggle) and syncs data-theme
54
+ after hydration via useLayoutEffect, which is why it must
55
+ coexist with the blocking script above rather than replace it. */}
56
+ <ThemeProvider>{children}</ThemeProvider>
52
57
  {umamiConfig.enabled ? <UmamiWebVitals /> : null}
53
58
  {umamiConfig.replayEnabled ? <UmamiReplayRecorder /> : null}
54
59
  </body>
@@ -283,6 +283,23 @@ export const file = {
283
283
  delete: (id) => {
284
284
  return prisma.file.delete({ where: { id } });
285
285
  },
286
+ /**
287
+ * Deletes a File row and reports whether this call was the one that removed
288
+ * it.
289
+ *
290
+ * `delete()` throws P2025 when the row is already gone, which is the normal
291
+ * outcome of two concurrent DELETEs of the same file and is not an error
292
+ * worth surfacing. This returns `{ count }` instead so the caller can tell
293
+ * "I deleted it" from "someone beat me to it" and skip the destructive
294
+ * follow-up (removing the storage object) in the second case.
295
+ *
296
+ * A count of 1 means the caller owns the cleanup. Any incoming relation
297
+ * added later still surfaces here as a P2003 foreign-key error, before the
298
+ * storage object has been touched.
299
+ */
300
+ deleteIfPresent: (id) => {
301
+ return prisma.file.deleteMany({ where: { id } });
302
+ },
286
303
  deleteMany: (ids) => {
287
304
  return prisma.file.deleteMany({ where: { id: { in: ids } } });
288
305
  },
@@ -31,7 +31,18 @@ function collectTests(targetPath) {
31
31
  continue;
32
32
  }
33
33
 
34
- if (!entry.isFile() || !entry.name.endsWith(".test.js")) {
34
+ // `*.integration-test.js` renders components through jsdom + react-dom,
35
+ // so it must be collected too. It was previously skipped, which meant
36
+ // those suites never ran in CI - a real gap, not a naming preference:
37
+ // every one of them passed locally but was invisible to the pipeline.
38
+ // Note the file suffix is `-integration-test.js`, so
39
+ // `*.integration.test.js` (a different, separately-excluded name) is
40
+ // still only picked up by the plain `.test.js` rule below.
41
+ if (
42
+ !entry.isFile() ||
43
+ (!entry.name.endsWith(".test.js") &&
44
+ !entry.name.endsWith(".integration-test.js"))
45
+ ) {
35
46
  continue;
36
47
  }
37
48
 
@@ -57,7 +57,8 @@ test("FormField - renders label and input", async () => {
57
57
  assert.ok(input, "should render an input");
58
58
  assert.strictEqual(label.textContent, "Name");
59
59
  assert.strictEqual(input.getAttribute("name"), "name");
60
- root.unmount();
60
+ await act(() => root.unmount());
61
+ container.remove();
61
62
  });
62
63
 
63
64
  test("FormField - connects label to input via htmlFor/id", async () => {
@@ -76,7 +77,8 @@ test("FormField - connects label to input via htmlFor/id", async () => {
76
77
  const input = container.querySelector("input");
77
78
  assert.strictEqual(label.getAttribute("for"), "custom-id");
78
79
  assert.strictEqual(input.getAttribute("id"), "custom-id");
79
- root.unmount();
80
+ await act(() => root.unmount());
81
+ container.remove();
80
82
  });
81
83
 
82
84
  test("FormField - renders error message with role alert", async () => {
@@ -94,7 +96,8 @@ test("FormField - renders error message with role alert", async () => {
94
96
  const errorEl = container.querySelector("[role='alert']");
95
97
  assert.ok(errorEl, "should render an error element with role alert");
96
98
  assert.strictEqual(errorEl.textContent, "Required");
97
- root.unmount();
99
+ await act(() => root.unmount());
100
+ container.remove();
98
101
  });
99
102
 
100
103
  test("FormField - sets aria-invalid and aria-describedby when error present", async () => {
@@ -110,13 +113,127 @@ test("FormField - sets aria-invalid and aria-describedby when error present", as
110
113
  }),
111
114
  ),
112
115
  );
113
- const wrapper = container.querySelector('[aria-invalid="true"]');
114
- assert.ok(wrapper, "should set aria-invalid on wrapper");
115
- const errorId = wrapper.getAttribute("aria-describedby");
116
- assert.ok(errorId, "should set aria-describedby");
116
+ const input = container.querySelector("input");
117
+ assert.ok(input, "should render an input");
118
+ assert.strictEqual(
119
+ input.getAttribute("aria-invalid"),
120
+ "true",
121
+ "aria-invalid must be on the focusable control",
122
+ );
123
+ assert.ok(
124
+ !container.querySelector("div[aria-invalid]"),
125
+ "aria-invalid on a non-interactive wrapper has no effect",
126
+ );
127
+ const errorId = input.getAttribute("aria-describedby");
128
+ assert.ok(errorId, "should set aria-describedby on the input");
129
+ assert.strictEqual(errorId, "email-field-error");
117
130
  const errorEl = container.querySelector(`#${errorId}`);
118
131
  assert.ok(errorEl, "aria-describedby should point to existing error element");
119
- root.unmount();
132
+ await act(() => root.unmount());
133
+ container.remove();
134
+ });
135
+
136
+ test("FormField - applies className to the control, not the wrapper", async () => {
137
+ const container = setupContainer();
138
+ const root = createRoot(container);
139
+ await act(() =>
140
+ root.render(
141
+ createElement(FormField, {
142
+ label: "Name",
143
+ name: "name",
144
+ className: "w-72",
145
+ }),
146
+ ),
147
+ );
148
+ const input = container.querySelector("input");
149
+ assert.match(input.getAttribute("class"), /\bw-72\b/);
150
+ assert.doesNotMatch(
151
+ container.firstElementChild.getAttribute("class"),
152
+ /\bw-72\b/,
153
+ "className targets the control; the wrapper is layout-only",
154
+ );
155
+ await act(() => root.unmount());
156
+ container.remove();
157
+ });
158
+
159
+ test("FormField - wrapperClassName styles the layout container", async () => {
160
+ const container = setupContainer();
161
+ const root = createRoot(container);
162
+ await act(() =>
163
+ root.render(
164
+ createElement(FormField, {
165
+ label: "Name",
166
+ name: "name",
167
+ wrapperClassName: "sm:col-span-2",
168
+ }),
169
+ ),
170
+ );
171
+ assert.match(
172
+ container.firstElementChild.getAttribute("class"),
173
+ /\bsm:col-span-2\b/,
174
+ );
175
+ await act(() => root.unmount());
176
+ container.remove();
177
+ });
178
+
179
+ test("FormField - forwards error ARIA to a custom child control", async () => {
180
+ const container = setupContainer();
181
+ const root = createRoot(container);
182
+ await act(() =>
183
+ root.render(
184
+ createElement(
185
+ FormField,
186
+ { label: "Bio", name: "bio", error: "Too short", id: "bio" },
187
+ createElement("textarea", { id: "bio", "data-testid": "custom" }),
188
+ ),
189
+ ),
190
+ );
191
+ const textarea = container.querySelector("textarea");
192
+ assert.strictEqual(textarea.getAttribute("aria-invalid"), "true");
193
+ assert.strictEqual(textarea.getAttribute("aria-describedby"), "bio-error");
194
+ assert.ok(
195
+ container.querySelector("#bio-error"),
196
+ "describedby target must exist",
197
+ );
198
+ assert.strictEqual(
199
+ textarea.getAttribute("name"),
200
+ "bio",
201
+ "name should be forwarded to the custom control",
202
+ );
203
+ await act(() => root.unmount());
204
+ container.remove();
205
+ });
206
+
207
+ test("FormField - preserves a custom child's own className", async () => {
208
+ const container = setupContainer();
209
+ const root = createRoot(container);
210
+ await act(() =>
211
+ root.render(
212
+ createElement(
213
+ FormField,
214
+ { label: "Bio", name: "bio", className: "h-40" },
215
+ createElement("textarea", { className: "resize-y" }),
216
+ ),
217
+ ),
218
+ );
219
+ const cls = container.querySelector("textarea").getAttribute("class");
220
+ assert.match(cls, /\bresize-y\b/);
221
+ assert.match(cls, /\bh-40\b/);
222
+ await act(() => root.unmount());
223
+ container.remove();
224
+ });
225
+
226
+ test("FormField - leaves aria-invalid off when there is no error", async () => {
227
+ const container = setupContainer();
228
+ const root = createRoot(container);
229
+ await act(() =>
230
+ root.render(createElement(FormField, { label: "Name", name: "name" })),
231
+ );
232
+ const input = container.querySelector("input");
233
+ assert.strictEqual(input.getAttribute("aria-invalid"), null);
234
+ assert.strictEqual(input.getAttribute("aria-describedby"), null);
235
+ await act(() => root.unmount());
236
+ container.remove();
120
237
  });
121
238
 
122
239
  test("FormField - renders children instead of default input", async () => {
@@ -138,5 +255,6 @@ test("FormField - renders children instead of default input", async () => {
138
255
  null,
139
256
  "should not render default input",
140
257
  );
141
- root.unmount();
258
+ await act(() => root.unmount());
259
+ container.remove();
142
260
  });
@@ -3,12 +3,33 @@ import React, { useId } from "react";
3
3
  import { Input } from "./input.js";
4
4
  import { Label } from "./label.js";
5
5
 
6
+ /**
7
+ * Label + control + error message, wired together for accessibility.
8
+ *
9
+ * `className` is applied to the control, matching every other component in this
10
+ * package (`Input`, `Textarea`, `Select`, `Card`, …), where it extends the
11
+ * component's own root element. Use `wrapperClassName` to style the layout
12
+ * container instead.
13
+ *
14
+ * The error association (`aria-invalid` / `aria-describedby`) always lands on
15
+ * the focusable control, never on a wrapper element, so a screen reader that is
16
+ * sitting on the control actually announces it.
17
+ *
18
+ * @param {object} props
19
+ * @param {React.ReactNode} [props.label]
20
+ * @param {string} [props.name]
21
+ * @param {string} [props.error]
22
+ * @param {React.ReactNode} [props.children] custom control, e.g. a <Textarea>
23
+ * @param {string} [props.className] classes for the control
24
+ * @param {string} [props.wrapperClassName] classes for the layout container
25
+ */
6
26
  export function FormField({
7
27
  label,
8
28
  name,
9
29
  error,
10
30
  children,
11
31
  className = "",
32
+ wrapperClassName = "",
12
33
  ...props
13
34
  }) {
14
35
  const generatedId = useId();
@@ -16,25 +37,44 @@ export function FormField({
16
37
 
17
38
  const errorId = `${fieldId}-error`;
18
39
 
19
- const inputProps = { id: fieldId, name, ...props };
20
- if (error) {
21
- inputProps["aria-invalid"] = true;
22
- inputProps["aria-describedby"] = errorId;
23
- }
40
+ const ariaProps = error
41
+ ? { "aria-invalid": true, "aria-describedby": errorId }
42
+ : {};
24
43
 
25
- const childrenWrapperProps = {};
26
- if (error) {
27
- childrenWrapperProps["aria-invalid"] = true;
28
- childrenWrapperProps["aria-describedby"] = errorId;
29
- }
44
+ const control = children
45
+ ? // A caller-supplied control already owns its own markup; forward the
46
+ // accessibility wiring to it so the attributes land on the element
47
+ // that can receive focus. Explicit props on the child win, so a
48
+ // caller can still override them.
49
+ React.Children.map(children, (child) => {
50
+ if (!React.isValidElement(child)) return child;
51
+ const merged = [child.props.className, className]
52
+ .filter(Boolean)
53
+ .join(" ");
54
+ return React.cloneElement(child, {
55
+ id: child.props.id ?? fieldId,
56
+ name: child.props.name ?? name,
57
+ // Omitted entirely when empty so a bare child is not given a
58
+ // meaningless class="" attribute.
59
+ ...(merged ? { className: merged } : {}),
60
+ ...ariaProps,
61
+ });
62
+ })
63
+ : React.createElement(Input, {
64
+ id: fieldId,
65
+ name,
66
+ className,
67
+ ...ariaProps,
68
+ ...props,
69
+ });
30
70
 
31
71
  return React.createElement(
32
72
  "div",
33
- { className: `min-w-0 space-y-1.5 ${className}`.trim() },
73
+ {
74
+ className: `min-w-0 space-y-1.5 ${wrapperClassName}`.trim(),
75
+ },
34
76
  label ? React.createElement(Label, { htmlFor: fieldId }, label) : null,
35
- children
36
- ? React.createElement("div", childrenWrapperProps, children)
37
- : React.createElement(Input, inputProps),
77
+ control,
38
78
  error
39
79
  ? React.createElement(
40
80
  "p",
@@ -56,7 +56,8 @@ test("Lightbox - renders nothing when closed", async () => {
56
56
  const root = createRoot(container);
57
57
  await act(() => root.render(createElement(Lightbox, { open: false })));
58
58
  assert.strictEqual(container.innerHTML, "");
59
- root.unmount();
59
+ await act(() => root.unmount());
60
+ container.remove();
60
61
  });
61
62
 
62
63
  test("Lightbox - renders overlay when open", async () => {
@@ -76,7 +77,8 @@ test("Lightbox - renders overlay when open", async () => {
76
77
  assert.ok(img, "should render an img element");
77
78
  assert.strictEqual(img.getAttribute("src"), "/test.jpg");
78
79
  assert.strictEqual(img.getAttribute("alt"), "Test image");
79
- root.unmount();
80
+ await act(() => root.unmount());
81
+ container.remove();
80
82
  });
81
83
 
82
84
  test("Lightbox - calls onClose when close button clicked", async () => {
@@ -100,7 +102,8 @@ test("Lightbox - calls onClose when close button clicked", async () => {
100
102
  assert.ok(closeBtn, "should have a close button");
101
103
  await act(() => closeBtn.click());
102
104
  assert.ok(closed, "onClose should be called");
103
- root.unmount();
105
+ await act(() => root.unmount());
106
+ container.remove();
104
107
  });
105
108
 
106
109
  test("Lightbox - shows prev/next buttons and counter", async () => {
@@ -127,7 +130,8 @@ test("Lightbox - shows prev/next buttons and counter", async () => {
127
130
  );
128
131
  assert.ok(container.textContent.includes("Next"), "should show Next button");
129
132
  assert.ok(container.textContent.includes("2 / 5"), "should show counter");
130
- root.unmount();
133
+ await act(() => root.unmount());
134
+ container.remove();
131
135
  });
132
136
 
133
137
  test("Lightbox - calls onPrevious and onNext on button clicks", async () => {
@@ -163,5 +167,6 @@ test("Lightbox - calls onPrevious and onNext on button clicks", async () => {
163
167
  assert.ok(prev, "onPrevious should be called");
164
168
  await act(() => nextBtn.click());
165
169
  assert.ok(next, "onNext should be called");
166
- root.unmount();
170
+ await act(() => root.unmount());
171
+ container.remove();
167
172
  });
@@ -13,7 +13,11 @@ import {
13
13
  THEME_STORAGE_KEY,
14
14
  } from "./theme-constants.js";
15
15
 
16
- const ThemeCtx = createContext({ theme: "dark", setTheme: () => {} });
16
+ // `undefined` means "no ThemeProvider above this consumer". It must not be a
17
+ // usable default: a plausible-looking default ({ theme, setTheme: noop }) turns a
18
+ // missing provider into a silently broken toggle that still renders and still
19
+ // reports a theme. See useTheme().
20
+ const ThemeCtx = createContext(undefined);
17
21
 
18
22
  /**
19
23
  * Wraps a subtree with a shared theme value.
@@ -90,18 +94,29 @@ export function ThemeProvider({ defaultTheme, children }) {
90
94
 
91
95
  /**
92
96
  * Returns the current theme and a setter from the nearest ThemeProvider.
93
- * Falls back to `{ theme: 'dark' }` when used outside a provider.
97
+ *
98
+ * Throws when there is no ThemeProvider above the caller. A missing provider is
99
+ * a wiring bug, not a state to default: `ThemeToggle` renders a labelled,
100
+ * focusable button either way, so a silent fallback yields a control that looks
101
+ * real, reports the wrong theme, and does nothing when clicked.
94
102
  *
95
103
  * @returns {{ theme: 'light' | 'dark', setTheme: (t: string) => void }}
104
+ * @throws {Error} if called outside a ThemeProvider
96
105
  */
97
106
  export function useTheme() {
98
- return useContext(ThemeCtx);
107
+ const ctx = useContext(ThemeCtx);
108
+ if (ctx === undefined) {
109
+ throw new Error(
110
+ "useTheme() must be used within a ThemeProvider. Wrap your app in <ThemeProvider> (import it from @scope/ui) around the tree containing this component.",
111
+ );
112
+ }
113
+ return ctx;
99
114
  }
100
115
 
101
116
  /**
102
117
  * Labeled pill button that shows the current theme and switches on click.
103
118
  * Displays "🌙 Dark Mode" when dark, "☀ Light Mode" when light.
104
- * Must be rendered inside a ThemeProvider.
119
+ * Must be rendered inside a ThemeProvider — outside one, `useTheme()` throws.
105
120
  */
106
121
  export function ThemeToggle({ className = "" }) {
107
122
  const { theme, setTheme } = useTheme();
@@ -37,8 +37,16 @@ export async function handleCleanupOrphanedFiles(bullJob, logger) {
37
37
 
38
38
  for (const record of orphaned) {
39
39
  try {
40
+ // Row first, storage second — same ordering as DELETE /api/files/[id].
41
+ // Storage-first means a failed row delete leaves a row pointing at bytes
42
+ // that are already gone, which cannot be recovered: the blob was the only
43
+ // copy. A failed storage delete here leaves an orphaned blob instead, and
44
+ // this very job is what sweeps those up on a later pass.
45
+ const { count } = await file.deleteIfPresent(record.id);
46
+ // A concurrent request (or an earlier pass of this job) already took it.
47
+ if (count === 0) continue;
48
+
40
49
  await storage.delete(record.storageKey);
41
- await file.delete(record.id);
42
50
  deleted++;
43
51
  } catch (err) {
44
52
  errors.push({ id: record.id, error: err.message });