@everystack/api 0.4.14 → 0.4.15

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
@@ -4,6 +4,12 @@ All notable changes to `@everystack/api` are documented here.
4
4
 
5
5
  Format based on [Keep a Changelog](https://keepachangelog.com/).
6
6
 
7
+ ## [0.4.15] - 2026-11-05
8
+
9
+ ### BREAKING CHANGES
10
+
11
+ - afterRestore runs for a row deleted before batches existed
12
+
7
13
  ## [0.4.14] - 2026-11-04
8
14
 
9
15
  ### BREAKING CHANGES
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everystack/api",
3
- "version": "0.4.14",
3
+ "version": "0.4.15",
4
4
  "description": "PostgREST-compatible HTTP handler + typed fetch client for Drizzle ORM",
5
5
  "license": "AGPL-3.0-only",
6
6
  "author": "Scalable Technology, Inc. <licensing@scalable.technology>",
@@ -279,8 +279,9 @@ export interface HookConfig {
279
279
  * Each lifecycle row carries its own deletedBatch; ctx.batch is null for a delete request. */
280
280
  afterDelete?: AfterLifecycleHook;
281
281
  /** Lifecycle tables only: after `POST {table}/restore` COMMITS, with `[{ <key>: id }]` (the id as
282
- * the request sent it), `ctx.batch` and `ctx.counts`. Not called for a row deleted before batches
283
- * existed (batch null). Best-effort: a throw goes to onError and never changes the response. */
282
+ * the request sent it), `ctx.batch` and `ctx.counts`. `ctx.batch` is null for a row deleted before
283
+ * batches existed: that row came back alone. Best-effort: a throw goes to onError and never changes
284
+ * the response. */
284
285
  afterRestore?: AfterLifecycleHook;
285
286
  /** Reserved for a future release: createHandler refuses it, so it is never silently ignored. */
286
287
  beforeRestore?: never;
@@ -3260,10 +3261,10 @@ async function handleRestore(
3260
3261
  // After the commit (executeWithSettings has returned). Best-effort: never changes the response.
3261
3262
  const hook = ownEntry(options?.hooks, tableName);
3262
3263
  const r = result as { restored?: unknown; skipped?: unknown; batch?: unknown } | null;
3263
- if (hook?.afterRestore && r && typeof r.batch === 'string') {
3264
+ if (hook?.afterRestore && r) {
3264
3265
  try {
3265
3266
  await hook.afterRestore([{ [columnPropertyName(table, key.name) ?? key.name]: id }], {
3266
- phase: 'restore', batch: r.batch, user, client,
3267
+ phase: 'restore', batch: typeof r.batch === 'string' ? r.batch : null, user, client,
3267
3268
  counts: { restored: Number(r.restored), skipped: Number(r.skipped) },
3268
3269
  });
3269
3270
  } catch (err) {