@lunora/do 1.0.0-alpha.21 → 1.0.0-alpha.23

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.
Files changed (25) hide show
  1. package/dist/index.d.mts +92 -90
  2. package/dist/index.d.ts +92 -90
  3. package/dist/index.mjs +19 -19
  4. package/dist/packem_shared/{ADMIN_FUNCTIONS-DSUQ5fX9.mjs → ADMIN_FUNCTIONS-BbQdj8h1.mjs} +5 -0
  5. package/dist/packem_shared/{AGGREGATE_SQL_FUNCTION-CFk6adSu.mjs → AGGREGATE_SQL_FUNCTION-CQsu2Xga.mjs} +5 -3
  6. package/dist/packem_shared/{CDC_LOG_TABLE-DSycmnDf.mjs → CDC_LOG_TABLE-DZSVKRr7.mjs} +1 -1
  7. package/dist/packem_shared/{ConflictError-C0STs6bU.mjs → ConflictError-CLoq37xH.mjs} +4 -5
  8. package/dist/packem_shared/{CountRlsUnsupportedError-28ZvvwKS.mjs → CountRlsUnsupportedError-BGxj0pgS.mjs} +4 -4
  9. package/dist/packem_shared/{DATA_MIGRATION_STATE_TABLE-DfPxn8I0.mjs → DATA_MIGRATION_STATE_TABLE-DB3IYUR3.mjs} +3 -1
  10. package/dist/packem_shared/{DEFAULT_MAX_RELATION_KEYS-DU-Y4-LJ.mjs → DEFAULT_MAX_RELATION_KEYS-CjM9Y1_G.mjs} +8 -6
  11. package/dist/packem_shared/NotFoundError-C70b9hLw.mjs +9 -0
  12. package/dist/packem_shared/{NotUniqueError-Do5h_jiW.mjs → NotUniqueError-D1U5SBFR.mjs} +63 -55
  13. package/dist/packem_shared/{RLS_UNWRAP_SYMBOL-EtGQdC9d.mjs → RLS_UNWRAP_SYMBOL-DnjkqVgY.mjs} +6 -5
  14. package/dist/packem_shared/{ROOT_DO_SIZE_WARN_BYTES-BfPNp3Jh.mjs → ROOT_DO_SIZE_WARN_BYTES-BM4TOOvf.mjs} +388 -49
  15. package/dist/packem_shared/{applyOnDelete-BQ-8ZlZ1.mjs → applyOnDelete-CAwZfp-5.mjs} +4 -3
  16. package/dist/packem_shared/{backfillAggregateIndexes-BZsOqDXP.mjs → backfillAggregateIndexes-DDoT-UUI.mjs} +1 -1
  17. package/dist/packem_shared/{compileWhereSql-MW_Lk8nJ.mjs → compileWhereSql-DE6yfRcQ.mjs} +2 -1
  18. package/dist/packem_shared/{createSystemReader-8CzSZP9V.mjs → createSystemReader-D12eNH13.mjs} +4 -2
  19. package/dist/packem_shared/{ctx-db-shapes-0RaIOy7J.mjs → ctx-db-shapes-Cz9dHyh1.mjs} +1 -1
  20. package/dist/packem_shared/{isSourceDue-9mJRJ9Ld.mjs → isSourceDue-BptUN8CR.mjs} +3 -2
  21. package/dist/packem_shared/{materializeExternalRows-Bj6EXy50.mjs → materializeExternalRows-DNcvoLRT.mjs} +2 -2
  22. package/dist/packem_shared/{runShardMigrations-nIwoQeOK.mjs → runShardMigrations-DeZr0KZp.mjs} +1 -1
  23. package/dist/packem_shared/{serveRelationFanout-C5axmGDj.mjs → serveRelationFanout-BhZF9AuB.mjs} +1 -1
  24. package/package.json +2 -1
  25. package/dist/packem_shared/NotFoundError-CMuMZt81.mjs +0 -10
@@ -1,3 +1,5 @@
1
+ import { LunoraError } from '@lunora/errors';
2
+
1
3
  const toScheduledFunctionDoc = (record) => {
2
4
  const doc = {
3
5
  args: record["args"] ?? {},
@@ -40,13 +42,13 @@ const toStorageMetadata = (object) => {
40
42
  const createSystemReader = (options = {}) => {
41
43
  const requireScheduler = () => {
42
44
  if (!options.scheduler) {
43
- throw new Error('ctx.db.system.query("_scheduled_functions"): no scheduler configured. Pass `scheduler` to createShardDO().');
45
+ throw new LunoraError("INTERNAL", 'ctx.db.system.query("_scheduled_functions"): no scheduler configured. Pass `scheduler` to createShardDO().');
44
46
  }
45
47
  return options.scheduler;
46
48
  };
47
49
  const requireStorage = () => {
48
50
  if (!options.storage) {
49
- throw new Error('ctx.db.system.query("_storage"): no storage configured. Pass `storage` to createShardDO().');
51
+ throw new LunoraError("INTERNAL", 'ctx.db.system.query("_storage"): no storage configured. Pass `storage` to createShardDO().');
50
52
  }
51
53
  return options.storage;
52
54
  };
@@ -1,7 +1,7 @@
1
1
  import { sql } from 'drizzle-orm';
2
2
  import { r as runDrizzle } from './do-exec-5eQy5cEi.mjs';
3
3
  import { D as DOC_COLUMN, r as rowToDocument, j as jsonPathSql } from './do-sql-BCHCWtrD.mjs';
4
- import { compileWhereSql } from './compileWhereSql-MW_Lk8nJ.mjs';
4
+ import { compileWhereSql } from './compileWhereSql-DE6yfRcQ.mjs';
5
5
  import { s as serializeSqlValue } from './serialize-sql-BlRUoiQe.mjs';
6
6
 
7
7
  const shapeWhereStrategy = { fieldRef: jsonPathSql, serialize: serializeSqlValue };
@@ -1,10 +1,11 @@
1
- import { runExternalSourceTick } from './materializeExternalRows-Bj6EXy50.mjs';
1
+ import { LunoraError } from '@lunora/errors';
2
+ import { runExternalSourceTick } from './materializeExternalRows-DNcvoLRT.mjs';
2
3
 
3
4
  const liftSourceId = (row, options = {}) => {
4
5
  const { idColumn = "id", map } = options;
5
6
  const idValue = row[idColumn];
6
7
  if (idValue === void 0 || idValue === null) {
7
- throw new Error(`external-source: row is missing id column "${idColumn}"`);
8
+ throw new LunoraError("INTERNAL", `external-source: row is missing id column "${idColumn}"`);
8
9
  }
9
10
  if (typeof idValue !== "string" && typeof idValue !== "number" && typeof idValue !== "bigint") {
10
11
  throw new TypeError(`external-source: id column "${idColumn}" must be a string or number`);
@@ -1,5 +1,5 @@
1
- import { applyCdcChanges } from './CDC_LOG_TABLE-DSycmnDf.mjs';
2
- import { s as selectShapeRows } from './ctx-db-shapes-0RaIOy7J.mjs';
1
+ import { applyCdcChanges } from './CDC_LOG_TABLE-DZSVKRr7.mjs';
2
+ import { s as selectShapeRows } from './ctx-db-shapes-Cz9dHyh1.mjs';
3
3
  import { diffExternalSource, projectExternalSourceRow } from './diffExternalSource-Cx9HUPJj.mjs';
4
4
  import { stableStringify } from './stableStringify-MydiuScU.mjs';
5
5
 
@@ -1,6 +1,6 @@
1
1
  import { sql } from 'drizzle-orm';
2
2
  import { aggregateTableName } from './aggregateTableName-CxNqY1Sl.mjs';
3
- import { migrateCdcLog, migrateCdcMeta } from './CDC_LOG_TABLE-DSycmnDf.mjs';
3
+ import { migrateCdcLog, migrateCdcMeta } from './CDC_LOG_TABLE-DZSVKRr7.mjs';
4
4
  import { m as migrateClientWatermark, a as migrateIdempotency, b as migrateGlobalShapeSnapshot } from './ctx-db-idempotency-BdcNpvY4.mjs';
5
5
  import { r as runDrizzle } from './do-exec-5eQy5cEi.mjs';
6
6
  import { D as DOC_COLUMN, j as jsonPathSql, c as createIndexSql, t as tableColumns, i as isFtsAvailable, A as AGG_KEY, a as AGG_VALUE, b as AGG_COUNT } from './do-sql-BCHCWtrD.mjs';
@@ -1,4 +1,4 @@
1
- import { RELATION_FUNCTION_PREFIX } from './ADMIN_FUNCTIONS-DSUQ5fX9.mjs';
1
+ import { RELATION_FUNCTION_PREFIX } from './ADMIN_FUNCTIONS-BbQdj8h1.mjs';
2
2
 
3
3
  const serveRelationFanout = async (schema, database, functionPath, args) => {
4
4
  const table = typeof args["table"] === "string" ? args["table"] : "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/do",
3
- "version": "1.0.0-alpha.21",
3
+ "version": "1.0.0-alpha.23",
4
4
  "description": "Lunora Durable Objects: ShardDO (SQLite, OCC, hibernated WebSocket subscriptions) and SessionDO",
5
5
  "keywords": [
6
6
  "cloudflare",
@@ -46,6 +46,7 @@
46
46
  "access": "public"
47
47
  },
48
48
  "dependencies": {
49
+ "@lunora/errors": "1.0.0-alpha.1",
49
50
  "@visulima/redact": "3.0.0-alpha.14",
50
51
  "drizzle-orm": "^0.45.2"
51
52
  },
@@ -1,10 +0,0 @@
1
- class NotFoundError extends Error {
2
- code = "NOT_FOUND";
3
- status = 404;
4
- constructor(message = "Document not found") {
5
- super(message);
6
- this.name = "NotFoundError";
7
- }
8
- }
9
-
10
- export { NotFoundError as default };