@lunora/d1 1.0.0-alpha.24 → 1.0.0-alpha.25

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/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  export { exportGlobalRows, importGlobalRows, selectGlobalTables } from './packem_shared/exportGlobalRows-BgfNSwCG.mjs';
2
2
  export { D1Client, D1Session } from './packem_shared/D1Client-DA3flo1o.mjs';
3
3
  export { createD1CtxDb, readD1CdcChanges, runD1AggregateMigrations, runD1CdcMigration, runD1GlobalTableMigrations, runD1RankMigrations, runD1SearchMigrations, trimD1CdcChanges } from './packem_shared/createD1CtxDb-BMR8J0dT.mjs';
4
- export { facetGlobalColumn, listGlobalTables, readGlobalTablePage } from './packem_shared/facetGlobalColumn-C6u_WMIY.mjs';
4
+ export { facetGlobalColumn, listGlobalTables, readGlobalTablePage } from './packem_shared/facetGlobalColumn-DxrhOr12.mjs';
5
5
  export { MigrationRunner } from './packem_shared/MigrationRunner-BQx8HAGh.mjs';
6
6
  export { default as sqliteDialect } from './packem_shared/sqliteDialect-DqYnHPuu.mjs';
7
7
  export { createSqlCtxDb } from '@lunora/sql-store';
@@ -1,3 +1,4 @@
1
+ import { LunoraError } from '@lunora/errors';
1
2
  import { runD1GlobalTableMigrations } from './createD1CtxDb-BMR8J0dT.mjs';
2
3
  import { decodeGlobalRow } from '@lunora/sql-store';
3
4
 
@@ -28,7 +29,7 @@ const buildEqPredicate = (schema, table, displayColumns, filters) => {
28
29
  const params = [];
29
30
  for (const filter of filters) {
30
31
  if (!displayColumns.includes(filter.column)) {
31
- throw Object.assign(new Error(`unknown column: ${filter.column}`), { code: "UNKNOWN_COLUMN", name: "LunoraError", status: 404 });
32
+ throw new LunoraError("UNKNOWN_COLUMN", `unknown column: ${filter.column}`, { status: 404 });
32
33
  }
33
34
  const quoted = quoteIdentifier(physicalColumnName(schema, table, filter.column));
34
35
  if (filter.value === null || filter.value === void 0) {
@@ -89,7 +90,7 @@ const readGlobalTablePage = async (exec, schema, options) => {
89
90
  await ensureGlobalTables(exec, schema);
90
91
  const tableNames = await listTableNames(exec);
91
92
  if (!tableNames.includes(table)) {
92
- throw Object.assign(new Error(`unknown table: ${table}`), { code: "UNKNOWN_TABLE", name: "LunoraError", status: 404 });
93
+ throw new LunoraError("UNKNOWN_TABLE", `unknown table: ${table}`, { status: 404 });
93
94
  }
94
95
  const limit = clamp(Math.trunc(options.limit ?? DEFAULT_PAGE_SIZE), 1, MAX_PAGE_SIZE);
95
96
  const offset = Math.max(0, Math.trunc(options.offset ?? 0));
@@ -109,11 +110,11 @@ const facetGlobalColumn = async (exec, schema, options) => {
109
110
  await ensureGlobalTables(exec, schema);
110
111
  const tableNames = await listTableNames(exec);
111
112
  if (!tableNames.includes(table)) {
112
- throw Object.assign(new Error(`unknown table: ${table}`), { code: "UNKNOWN_TABLE", name: "LunoraError", status: 404 });
113
+ throw new LunoraError("UNKNOWN_TABLE", `unknown table: ${table}`, { status: 404 });
113
114
  }
114
115
  const columns = await resolveColumns(exec, schema, table);
115
116
  if (!columns.includes(column)) {
116
- throw Object.assign(new Error(`unknown column: ${column}`), { code: "UNKNOWN_COLUMN", name: "LunoraError", status: 404 });
117
+ throw new LunoraError("UNKNOWN_COLUMN", `unknown column: ${column}`, { status: 404 });
117
118
  }
118
119
  const quoted = quoteIdentifier(table);
119
120
  const predicate = buildEqPredicate(schema, table, columns, options.filters);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/d1",
3
- "version": "1.0.0-alpha.24",
3
+ "version": "1.0.0-alpha.25",
4
4
  "description": "D1 adapter for Lunora .global() tables, wrapping the Sessions API for read-your-writes",
5
5
  "keywords": [
6
6
  "cloudflare",
@@ -50,9 +50,9 @@
50
50
  "access": "public"
51
51
  },
52
52
  "dependencies": {
53
- "@lunora/do": "1.0.0-alpha.24",
54
- "@lunora/errors": "1.0.0-alpha.2",
55
- "@lunora/sql-store": "1.0.0-alpha.24",
53
+ "@lunora/do": "1.0.0-alpha.26",
54
+ "@lunora/errors": "1.0.0-alpha.3",
55
+ "@lunora/sql-store": "1.0.0-alpha.26",
56
56
  "drizzle-orm": "^0.45.2"
57
57
  },
58
58
  "engines": {