@orkestrel/database 0.0.14 → 0.0.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.
@@ -144,7 +144,7 @@ var DatabaseError = class extends Error {
144
144
  * ```
145
145
  */
146
146
  function isDatabaseError(value) {
147
- return value instanceof DatabaseError;
147
+ return (0, _orkestrel_contract.isInstance)(value, DatabaseError);
148
148
  }
149
149
  //#endregion
150
150
  //#region src/core/validators.ts
@@ -155,7 +155,7 @@ function isDatabaseError(value) {
155
155
  * @returns True if `value` is a string or a finite number; false otherwise
156
156
  */
157
157
  function isKey(value) {
158
- return typeof value === "string" || typeof value === "number" && Number.isFinite(value);
158
+ return (0, _orkestrel_contract.isString)(value) || (0, _orkestrel_contract.isFiniteNumber)(value);
159
159
  }
160
160
  /**
161
161
  * Checks whether a value is a portable column schema.
@@ -168,13 +168,11 @@ function isKey(value) {
168
168
  * @returns True if `value` is a complete {@link ColumnSchema}; false otherwise
169
169
  */
170
170
  function isColumnSchema(value) {
171
- try {
171
+ return (0, _orkestrel_contract.holds)(() => {
172
172
  const column = (0, _orkestrel_contract.cloneJSONRecord)(value);
173
173
  const keys = Object.keys(column);
174
- return keys.length === 4 && keys.includes("name") && keys.includes("storage") && keys.includes("optional") && keys.includes("nullable") && typeof column.name === "string" && column.name.length > 0 && (column.storage === "text" || column.storage === "integer" || column.storage === "real" || column.storage === "boolean" || column.storage === "json" || column.storage === "blob") && typeof column.optional === "boolean" && typeof column.nullable === "boolean";
175
- } catch {
176
- return false;
177
- }
174
+ return keys.length === 4 && keys.includes("name") && keys.includes("storage") && keys.includes("optional") && keys.includes("nullable") && (0, _orkestrel_contract.isString)(column.name) && column.name.length > 0 && (column.storage === "text" || column.storage === "integer" || column.storage === "real" || column.storage === "boolean" || column.storage === "json" || column.storage === "blob") && (0, _orkestrel_contract.isBoolean)(column.optional) && (0, _orkestrel_contract.isBoolean)(column.nullable);
175
+ });
178
176
  }
179
177
  /**
180
178
  * Checks whether a value is a portable table schema.
@@ -187,17 +185,15 @@ function isColumnSchema(value) {
187
185
  * @returns True if `value` is a complete {@link TableSchema}; false otherwise
188
186
  */
189
187
  function isTableSchema(value) {
190
- try {
188
+ return (0, _orkestrel_contract.holds)(() => {
191
189
  const table = (0, _orkestrel_contract.cloneJSONRecord)(value);
192
190
  const keys = Object.keys(table);
193
- if (keys.length !== 4 || !keys.includes("name") || !keys.includes("primary") || !keys.includes("columns") || !keys.includes("indexes") || typeof table.name !== "string" || table.name.length === 0 || typeof table.primary !== "string" || table.primary.length === 0 || !Array.isArray(table.columns) || !Array.isArray(table.indexes) || !table.columns.every(isColumnSchema)) return false;
191
+ if (keys.length !== 4 || !keys.includes("name") || !keys.includes("primary") || !keys.includes("columns") || !keys.includes("indexes") || !(0, _orkestrel_contract.isString)(table.name) || table.name.length === 0 || !(0, _orkestrel_contract.isString)(table.primary) || table.primary.length === 0 || !(0, _orkestrel_contract.arrayOf)(isColumnSchema)(table.columns) || !(0, _orkestrel_contract.isArray)(table.indexes)) return false;
194
192
  const names = table.columns.map((column) => column.name);
195
- if (new Set(names).size !== names.length || !names.includes(table.primary) || !table.indexes.every((index) => Array.isArray(index) && index.length > 0 && index.every((column) => typeof column === "string" && names.includes(column)))) return false;
193
+ if (new Set(names).size !== names.length || !names.includes(table.primary) || !table.indexes.every((index) => (0, _orkestrel_contract.isArray)(index) && index.length > 0 && index.every((column) => (0, _orkestrel_contract.isString)(column) && names.includes(column)))) return false;
196
194
  const indexes = table.indexes.map((index) => JSON.stringify(index));
197
195
  return new Set(indexes).size === indexes.length;
198
- } catch {
199
- return false;
200
- }
196
+ });
201
197
  }
202
198
  /**
203
199
  * Checks whether a value is a complete portable driver schema.
@@ -210,14 +206,12 @@ function isTableSchema(value) {
210
206
  * @returns True if `value` is a table-schema collection with unique table names; false otherwise
211
207
  */
212
208
  function isDriverSchema(value) {
213
- try {
209
+ return (0, _orkestrel_contract.holds)(() => {
214
210
  const schema = (0, _orkestrel_contract.cloneJSONValue)(value);
215
- if (!Array.isArray(schema) || !schema.every(isTableSchema)) return false;
211
+ if (!(0, _orkestrel_contract.arrayOf)(isTableSchema)(schema)) return false;
216
212
  const names = schema.map((table) => table.name);
217
213
  return new Set(names).size === names.length;
218
- } catch {
219
- return false;
220
- }
214
+ });
221
215
  }
222
216
  /**
223
217
  * Checks whether a value is one ordered migration step.
@@ -230,22 +224,20 @@ function isDriverSchema(value) {
230
224
  * @returns True if `value` is a complete {@link MigrationStep}; false otherwise
231
225
  */
232
226
  function isMigrationStep(value) {
233
- try {
227
+ return (0, _orkestrel_contract.holds)(() => {
234
228
  const step = (0, _orkestrel_contract.cloneJSONRecord)(value);
235
- if (typeof step.operation !== "string") return false;
229
+ if (!(0, _orkestrel_contract.isString)(step.operation)) return false;
236
230
  const keys = Object.keys(step);
237
231
  switch (step.operation) {
238
232
  case "table.add": return keys.length === 2 && keys.includes("operation") && keys.includes("table") && isTableSchema(step.table);
239
- case "table.remove": return keys.length === 2 && keys.includes("operation") && keys.includes("table") && typeof step.table === "string" && step.table.length > 0;
240
- case "column.add": return keys.length === 3 && keys.includes("operation") && keys.includes("table") && keys.includes("column") && typeof step.table === "string" && step.table.length > 0 && isColumnSchema(step.column);
241
- case "column.remove": return keys.length === 3 && keys.includes("operation") && keys.includes("table") && keys.includes("column") && typeof step.table === "string" && step.table.length > 0 && typeof step.column === "string" && step.column.length > 0;
233
+ case "table.remove": return keys.length === 2 && keys.includes("operation") && keys.includes("table") && (0, _orkestrel_contract.isString)(step.table) && step.table.length > 0;
234
+ case "column.add": return keys.length === 3 && keys.includes("operation") && keys.includes("table") && keys.includes("column") && (0, _orkestrel_contract.isString)(step.table) && step.table.length > 0 && isColumnSchema(step.column);
235
+ case "column.remove": return keys.length === 3 && keys.includes("operation") && keys.includes("table") && keys.includes("column") && (0, _orkestrel_contract.isString)(step.table) && step.table.length > 0 && (0, _orkestrel_contract.isString)(step.column) && step.column.length > 0;
242
236
  case "index.add":
243
- case "index.remove": return keys.length === 3 && keys.includes("operation") && keys.includes("table") && keys.includes("index") && typeof step.table === "string" && step.table.length > 0 && Array.isArray(step.index) && step.index.length > 0 && step.index.every((column) => typeof column === "string" && column.length > 0);
237
+ case "index.remove": return keys.length === 3 && keys.includes("operation") && keys.includes("table") && keys.includes("index") && (0, _orkestrel_contract.isString)(step.table) && step.table.length > 0 && (0, _orkestrel_contract.isArray)(step.index) && step.index.length > 0 && step.index.every((column) => (0, _orkestrel_contract.isString)(column) && column.length > 0);
244
238
  default: return false;
245
239
  }
246
- } catch {
247
- return false;
248
- }
240
+ });
249
241
  }
250
242
  /**
251
243
  * Checks whether a value is an ordered migration plan.
@@ -258,13 +250,11 @@ function isMigrationStep(value) {
258
250
  * @returns True if `value` is a complete {@link Migration}; false otherwise
259
251
  */
260
252
  function isMigration(value) {
261
- try {
253
+ return (0, _orkestrel_contract.holds)(() => {
262
254
  const migration = (0, _orkestrel_contract.cloneJSONRecord)(value);
263
255
  const keys = Object.keys(migration);
264
- return keys.length === 3 && keys.includes("from") && keys.includes("to") && keys.includes("steps") && typeof migration.from === "number" && Number.isFinite(migration.from) && typeof migration.to === "number" && Number.isFinite(migration.to) && Array.isArray(migration.steps) && migration.steps.every(isMigrationStep);
265
- } catch {
266
- return false;
267
- }
256
+ return keys.length === 3 && keys.includes("from") && keys.includes("to") && keys.includes("steps") && (0, _orkestrel_contract.isFiniteNumber)(migration.from) && (0, _orkestrel_contract.isFiniteNumber)(migration.to) && (0, _orkestrel_contract.isArray)(migration.steps) && migration.steps.every(isMigrationStep);
257
+ });
268
258
  }
269
259
  /**
270
260
  * Checks whether a value is persisted driver metadata.
@@ -279,13 +269,11 @@ function isMigration(value) {
279
269
  * @returns True if `value` is complete {@link DriverMetadata}; false otherwise
280
270
  */
281
271
  function isDriverMetadata(value) {
282
- try {
272
+ return (0, _orkestrel_contract.holds)(() => {
283
273
  const metadata = (0, _orkestrel_contract.cloneJSONRecord)(value);
284
274
  const keys = Object.keys(metadata);
285
- return keys.length === 2 && keys.includes("version") && keys.includes("schema") && typeof metadata.version === "number" && Number.isFinite(metadata.version) && isDriverSchema(metadata.schema);
286
- } catch {
287
- return false;
288
- }
275
+ return keys.length === 2 && keys.includes("version") && keys.includes("schema") && (0, _orkestrel_contract.isFiniteNumber)(metadata.version) && isDriverSchema(metadata.schema);
276
+ });
289
277
  }
290
278
  /**
291
279
  * Checks whether a value is one atomic migration request.
@@ -298,13 +286,11 @@ function isDriverMetadata(value) {
298
286
  * @returns True if `value` is a complete {@link MigrationInput}; false otherwise
299
287
  */
300
288
  function isMigrationInput(value) {
301
- try {
289
+ return (0, _orkestrel_contract.holds)(() => {
302
290
  const input = (0, _orkestrel_contract.cloneJSONRecord)(value);
303
291
  const keys = Object.keys(input);
304
292
  return (keys.length === 1 || keys.length === 2) && keys.includes("plan") && (keys.length === 1 || keys.includes("metadata")) && isMigration(input.plan) && (input.metadata === void 0 || isDriverMetadata(input.metadata));
305
- } catch {
306
- return false;
307
- }
293
+ });
308
294
  }
309
295
  //#endregion
310
296
  //#region src/core/cloners.ts
@@ -325,7 +311,7 @@ function cloneDriverMetadata(value) {
325
311
  if (isDriverMetadata(metadata)) return metadata;
326
312
  throw new DatabaseError("VALIDATION", "Driver metadata is invalid", { path: "metadata" });
327
313
  } catch (error) {
328
- if (error instanceof DatabaseError) throw error;
314
+ if (isDatabaseError(error)) throw error;
329
315
  throw new DatabaseError("VALIDATION", "Driver metadata is invalid", {
330
316
  path: "metadata",
331
317
  cause: error
@@ -349,7 +335,7 @@ function cloneDriverSchema(value) {
349
335
  if (isDriverSchema(schema)) return schema;
350
336
  throw new DatabaseError("VALIDATION", "Driver schema is invalid", { path: "schema" });
351
337
  } catch (error) {
352
- if (error instanceof DatabaseError) throw error;
338
+ if (isDatabaseError(error)) throw error;
353
339
  throw new DatabaseError("VALIDATION", "Driver schema is invalid", {
354
340
  path: "schema",
355
341
  cause: error
@@ -373,7 +359,7 @@ function cloneMigrationInput(value) {
373
359
  if (isMigrationInput(input)) return input;
374
360
  throw new DatabaseError("VALIDATION", "Migration input is invalid", { path: "migration" });
375
361
  } catch (error) {
376
- if (error instanceof DatabaseError) throw error;
362
+ if (isDatabaseError(error)) throw error;
377
363
  throw new DatabaseError("VALIDATION", "Migration input is invalid", {
378
364
  path: "migration",
379
365
  cause: error
@@ -396,14 +382,14 @@ function cloneMigrationInput(value) {
396
382
  */
397
383
  function validatePage(input) {
398
384
  const limit = input?.limit;
399
- if (limit !== void 0 && (!Number.isInteger(limit) || limit < 0)) throw new DatabaseError("VALIDATION", "Query limit must be a nonnegative integer", {
385
+ if (limit !== void 0 && (!(0, _orkestrel_contract.isInteger)(limit) || limit < 0)) throw new DatabaseError("VALIDATION", "Query limit must be a nonnegative integer", {
400
386
  field: "limit",
401
- value: Number.isFinite(limit) ? limit : String(limit)
387
+ value: (0, _orkestrel_contract.isFiniteNumber)(limit) ? limit : String(limit)
402
388
  });
403
389
  const offset = input?.offset;
404
- if (offset !== void 0 && (!Number.isInteger(offset) || offset < 0)) throw new DatabaseError("VALIDATION", "Query offset must be a nonnegative integer", {
390
+ if (offset !== void 0 && (!(0, _orkestrel_contract.isInteger)(offset) || offset < 0)) throw new DatabaseError("VALIDATION", "Query offset must be a nonnegative integer", {
405
391
  field: "offset",
406
- value: Number.isFinite(offset) ? offset : String(offset)
392
+ value: (0, _orkestrel_contract.isFiniteNumber)(offset) ? offset : String(offset)
407
393
  });
408
394
  }
409
395
  /**
@@ -421,14 +407,14 @@ function validatePage(input) {
421
407
  * @returns `-1`, `0`, or `1`
422
408
  */
423
409
  function compareValues(left, right) {
424
- const [leftRank = 5, rightRank = 5] = [left, right].map((value) => value === void 0 ? 0 : value === null ? 1 : typeof value === "boolean" ? 2 : typeof value === "number" ? 3 : typeof value === "string" ? 4 : 5);
410
+ const [leftRank = 5, rightRank = 5] = [left, right].map((value) => value === void 0 ? 0 : value === null ? 1 : (0, _orkestrel_contract.isBoolean)(value) ? 2 : (0, _orkestrel_contract.isNumber)(value) ? 3 : (0, _orkestrel_contract.isString)(value) ? 4 : 5);
425
411
  if (leftRank !== rightRank) return leftRank < rightRank ? -1 : 1;
426
- if (typeof left === "number" && typeof right === "number") {
412
+ if ((0, _orkestrel_contract.isNumber)(left) && (0, _orkestrel_contract.isNumber)(right)) {
427
413
  if (Number.isNaN(left) || Number.isNaN(right)) return Number.isNaN(left) ? Number.isNaN(right) ? 0 : 1 : -1;
428
414
  return left < right ? -1 : left > right ? 1 : 0;
429
415
  }
430
- if (typeof left === "string" && typeof right === "string") return left < right ? -1 : left > right ? 1 : 0;
431
- if (typeof left === "boolean" && typeof right === "boolean") return left === right ? 0 : left ? 1 : -1;
416
+ if ((0, _orkestrel_contract.isString)(left) && (0, _orkestrel_contract.isString)(right)) return left < right ? -1 : left > right ? 1 : 0;
417
+ if ((0, _orkestrel_contract.isBoolean)(left) && (0, _orkestrel_contract.isBoolean)(right)) return left === right ? 0 : left ? 1 : -1;
432
418
  return 0;
433
419
  }
434
420
  /**
@@ -467,13 +453,13 @@ function equalsValue(left, right) {
467
453
  const pair = pending.pop();
468
454
  if (pair === void 0) continue;
469
455
  const [currentLeft, currentRight] = pair;
470
- if (typeof currentLeft === "number" && typeof currentRight === "number") {
456
+ if ((0, _orkestrel_contract.isNumber)(currentLeft) && (0, _orkestrel_contract.isNumber)(currentRight)) {
471
457
  if (Number.isNaN(currentLeft) && Number.isNaN(currentRight) || currentLeft === currentRight) continue;
472
458
  return false;
473
459
  }
474
460
  if (currentLeft === currentRight) continue;
475
- const leftArray = Array.isArray(currentLeft);
476
- const rightArray = Array.isArray(currentRight);
461
+ const leftArray = (0, _orkestrel_contract.isArray)(currentLeft);
462
+ const rightArray = (0, _orkestrel_contract.isArray)(currentRight);
477
463
  const leftRecord = (0, _orkestrel_contract.isRecord)(currentLeft);
478
464
  const rightRecord = (0, _orkestrel_contract.isRecord)(currentRight);
479
465
  if (leftArray !== rightArray || leftRecord !== rightRecord) return false;
@@ -838,8 +824,8 @@ function shapeToColumnStorage(shape) {
838
824
  case "number": return shape.integer === true ? "integer" : "real";
839
825
  case "boolean": return "boolean";
840
826
  case "literal":
841
- if (shape.values.every((value) => typeof value === "boolean")) return "boolean";
842
- if (shape.values.every((value) => typeof value === "number")) return shape.values.every((value) => Number.isInteger(value)) ? "integer" : "real";
827
+ if (shape.values.every((value) => (0, _orkestrel_contract.isBoolean)(value))) return "boolean";
828
+ if (shape.values.every((value) => (0, _orkestrel_contract.isNumber)(value))) return shape.values.every((value) => (0, _orkestrel_contract.isInteger)(value)) ? "integer" : "real";
843
829
  return "text";
844
830
  case "optional":
845
831
  case "nullable": return shapeToColumnStorage(shape.inner);
@@ -988,7 +974,7 @@ function checkAbort(signal) {
988
974
  * ```
989
975
  */
990
976
  function planMigration(deployed, declared, from = 0, to = 1) {
991
- if (!Number.isFinite(from) || !Number.isFinite(to)) throw new DatabaseError("MIGRATION", "Migration versions must be finite", {
977
+ if (!(0, _orkestrel_contract.isFiniteNumber)(from) || !(0, _orkestrel_contract.isFiniteNumber)(to)) throw new DatabaseError("MIGRATION", "Migration versions must be finite", {
992
978
  from,
993
979
  to
994
980
  });
@@ -1292,7 +1278,7 @@ async function* scanDriver(factory) {
1292
1278
  } catch (error) {
1293
1279
  yield {
1294
1280
  check: "open-close",
1295
- message: error instanceof Error ? error.message : String(error),
1281
+ message: (0, _orkestrel_contract.isError)(error) ? error.message : String(error),
1296
1282
  context: { error }
1297
1283
  };
1298
1284
  }
@@ -1313,7 +1299,7 @@ async function* scanDriver(factory) {
1313
1299
  } catch (error) {
1314
1300
  yield {
1315
1301
  check: "read-missing",
1316
- message: error instanceof Error ? error.message : String(error),
1302
+ message: (0, _orkestrel_contract.isError)(error) ? error.message : String(error),
1317
1303
  context: { error }
1318
1304
  };
1319
1305
  }
@@ -1389,7 +1375,7 @@ async function* scanDriver(factory) {
1389
1375
  } catch (error) {
1390
1376
  yield {
1391
1377
  check: "write-read",
1392
- message: error instanceof Error ? error.message : String(error),
1378
+ message: (0, _orkestrel_contract.isError)(error) ? error.message : String(error),
1393
1379
  context: { error }
1394
1380
  };
1395
1381
  }
@@ -1430,7 +1416,7 @@ async function* scanDriver(factory) {
1430
1416
  } catch (error) {
1431
1417
  yield {
1432
1418
  check: "insert-atomic",
1433
- message: error instanceof Error ? error.message : String(error),
1419
+ message: (0, _orkestrel_contract.isError)(error) ? error.message : String(error),
1434
1420
  context: { error }
1435
1421
  };
1436
1422
  }
@@ -1470,7 +1456,7 @@ async function* scanDriver(factory) {
1470
1456
  } catch (error) {
1471
1457
  yield {
1472
1458
  check: "delete",
1473
- message: error instanceof Error ? error.message : String(error),
1459
+ message: (0, _orkestrel_contract.isError)(error) ? error.message : String(error),
1474
1460
  context: { error }
1475
1461
  };
1476
1462
  }
@@ -1533,7 +1519,7 @@ async function* scanDriver(factory) {
1533
1519
  } catch (error) {
1534
1520
  yield {
1535
1521
  check: "mutation-abort",
1536
- message: error instanceof Error ? error.message : String(error),
1522
+ message: (0, _orkestrel_contract.isError)(error) ? error.message : String(error),
1537
1523
  context: { error }
1538
1524
  };
1539
1525
  }
@@ -1592,7 +1578,7 @@ async function* scanDriver(factory) {
1592
1578
  } catch (error) {
1593
1579
  yield {
1594
1580
  check: "order",
1595
- message: error instanceof Error ? error.message : String(error),
1581
+ message: (0, _orkestrel_contract.isError)(error) ? error.message : String(error),
1596
1582
  context: { error }
1597
1583
  };
1598
1584
  }
@@ -1636,7 +1622,7 @@ async function* scanDriver(factory) {
1636
1622
  } catch (error) {
1637
1623
  yield {
1638
1624
  check: "clear",
1639
- message: error instanceof Error ? error.message : String(error),
1625
+ message: (0, _orkestrel_contract.isError)(error) ? error.message : String(error),
1640
1626
  context: { error }
1641
1627
  };
1642
1628
  }
@@ -1685,7 +1671,7 @@ async function* scanDriver(factory) {
1685
1671
  } catch (error) {
1686
1672
  yield {
1687
1673
  check: "snapshot",
1688
- message: error instanceof Error ? error.message : String(error),
1674
+ message: (0, _orkestrel_contract.isError)(error) ? error.message : String(error),
1689
1675
  context: { error }
1690
1676
  };
1691
1677
  }
@@ -1723,7 +1709,7 @@ async function* scanDriver(factory) {
1723
1709
  } catch (error) {
1724
1710
  yield {
1725
1711
  check: "snapshot-nested",
1726
- message: error instanceof Error ? error.message : String(error),
1712
+ message: (0, _orkestrel_contract.isError)(error) ? error.message : String(error),
1727
1713
  context: { error }
1728
1714
  };
1729
1715
  }
@@ -1749,7 +1735,7 @@ async function* scanDriver(factory) {
1749
1735
  } catch (error) {
1750
1736
  yield {
1751
1737
  check: "non-id-primary",
1752
- message: error instanceof Error ? error.message : String(error),
1738
+ message: (0, _orkestrel_contract.isError)(error) ? error.message : String(error),
1753
1739
  context: { error }
1754
1740
  };
1755
1741
  }
@@ -1780,7 +1766,7 @@ async function* scanDriver(factory) {
1780
1766
  } catch (error) {
1781
1767
  yield {
1782
1768
  check: "nested-roundtrip",
1783
- message: error instanceof Error ? error.message : String(error),
1769
+ message: (0, _orkestrel_contract.isError)(error) ? error.message : String(error),
1784
1770
  context: { error }
1785
1771
  };
1786
1772
  }
@@ -1845,7 +1831,7 @@ async function* scanDriver(factory) {
1845
1831
  } catch (error) {
1846
1832
  yield {
1847
1833
  check: "migrate",
1848
- message: error instanceof Error ? error.message : String(error),
1834
+ message: (0, _orkestrel_contract.isError)(error) ? error.message : String(error),
1849
1835
  context: { error }
1850
1836
  };
1851
1837
  }
@@ -1910,7 +1896,7 @@ async function* scanDriver(factory) {
1910
1896
  } catch (error) {
1911
1897
  yield {
1912
1898
  check: "stream",
1913
- message: error instanceof Error ? error.message : String(error),
1899
+ message: (0, _orkestrel_contract.isError)(error) ? error.message : String(error),
1914
1900
  context: { error }
1915
1901
  };
1916
1902
  }
@@ -1971,7 +1957,7 @@ async function* scanDriver(factory) {
1971
1957
  } catch (error) {
1972
1958
  yield {
1973
1959
  check: "transaction",
1974
- message: error instanceof Error ? error.message : String(error),
1960
+ message: (0, _orkestrel_contract.isError)(error) ? error.message : String(error),
1975
1961
  context: { error }
1976
1962
  };
1977
1963
  }
@@ -2010,7 +1996,7 @@ async function* scanDriver(factory) {
2010
1996
  } catch (error) {
2011
1997
  yield {
2012
1998
  check: "metadata-stamp",
2013
- message: error instanceof Error ? error.message : String(error),
1999
+ message: (0, _orkestrel_contract.isError)(error) ? error.message : String(error),
2014
2000
  context: { error }
2015
2001
  };
2016
2002
  }
@@ -2065,7 +2051,7 @@ async function* scanDriver(factory) {
2065
2051
  } catch (error) {
2066
2052
  yield {
2067
2053
  check: "snapshot-scoped",
2068
- message: error instanceof Error ? error.message : String(error),
2054
+ message: (0, _orkestrel_contract.isError)(error) ? error.message : String(error),
2069
2055
  context: { error }
2070
2056
  };
2071
2057
  }