@lunora/d1 1.0.0-alpha.103 → 1.0.0-alpha.104
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/dialect.d.mts
CHANGED
|
@@ -1,3 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The optimistic-concurrency row version every global table carries alongside
|
|
3
|
+
* `id`/`_creationTime`.
|
|
4
|
+
*
|
|
5
|
+
* The CAS used to bind one parameter per physical column of the snapshot, so an
|
|
6
|
+
* `UPDATE` on a wide table bound `2N+2` parameters — over D1's 100-per-statement
|
|
7
|
+
* ceiling (workerd's `SQLITE_LIMIT_VARIABLE_NUMBER`) from 50 declared fields up,
|
|
8
|
+
* while `INSERT` at the same width stayed under it. The table provisioned, rows
|
|
9
|
+
* inserted, and the first `patch`/`replace`/soft-`delete` died with a raw
|
|
10
|
+
* `too many SQL variables` that redacts to "Internal error" on the way out.
|
|
11
|
+
*
|
|
12
|
+
* Guarding on this one column instead makes the CAS cost two parameters at any
|
|
13
|
+
* width. Every guarded write bumps it in SQL (`COALESCE(<col>, 0) + 1`), which
|
|
14
|
+
* costs no parameter of its own; `INSERT` leaves it NULL, and the NULL-safe
|
|
15
|
+
* comparison handles both that and rows written before the column existed.
|
|
16
|
+
*
|
|
17
|
+
* Not decoded into documents — `decodeGlobalRow` builds its result from the
|
|
18
|
+
* declared shape, so an undeclared physical column is invisible to callers.
|
|
19
|
+
*
|
|
20
|
+
* Bundler-inlined rather than owned by one package because BOTH producers of
|
|
21
|
+
* global-table DDL name it: `@lunora/sql-store`'s auto-provisioner (which runs
|
|
22
|
+
* the CAS) and `@lunora/d1/dialect`, which `lunora migrate generate` derives its
|
|
23
|
+
* `CREATE TABLE` from. Importing `@lunora/sql-store` would pull drizzle into the
|
|
24
|
+
* dependency-free dialect module the CLI reads; a second copy of the string is
|
|
25
|
+
* how the two shapes drift.
|
|
26
|
+
*/
|
|
27
|
+
declare const OCC_VERSION_COLUMN = "_version";
|
|
1
28
|
/**
|
|
2
29
|
* Canonical SQL identifier quoter shared by `@lunora/d1` and `@lunora/do`.
|
|
3
30
|
*
|
|
@@ -48,4 +75,4 @@ declare const frameworkColumnDdl: () => ReadonlyArray<string>;
|
|
|
48
75
|
declare const columnRef: (field: string) => string;
|
|
49
76
|
/** Physical index identifier — `<table>_<name>`, so two tables' like-named indexes don't collide in SQLite's flat index namespace. */
|
|
50
77
|
declare const physicalIndexName: (tableName: string, indexName: string) => string;
|
|
51
|
-
export { MAX_D1_TABLE_COLUMNS, SqlAffinity, columnRef, frameworkColumnDdl, physicalIndexName, quoteIdentifier, sqlAffinityForKind };
|
|
78
|
+
export { MAX_D1_TABLE_COLUMNS, OCC_VERSION_COLUMN, SqlAffinity, columnRef, frameworkColumnDdl, physicalIndexName, quoteIdentifier, sqlAffinityForKind };
|
package/dist/dialect.d.ts
CHANGED
|
@@ -1,3 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The optimistic-concurrency row version every global table carries alongside
|
|
3
|
+
* `id`/`_creationTime`.
|
|
4
|
+
*
|
|
5
|
+
* The CAS used to bind one parameter per physical column of the snapshot, so an
|
|
6
|
+
* `UPDATE` on a wide table bound `2N+2` parameters — over D1's 100-per-statement
|
|
7
|
+
* ceiling (workerd's `SQLITE_LIMIT_VARIABLE_NUMBER`) from 50 declared fields up,
|
|
8
|
+
* while `INSERT` at the same width stayed under it. The table provisioned, rows
|
|
9
|
+
* inserted, and the first `patch`/`replace`/soft-`delete` died with a raw
|
|
10
|
+
* `too many SQL variables` that redacts to "Internal error" on the way out.
|
|
11
|
+
*
|
|
12
|
+
* Guarding on this one column instead makes the CAS cost two parameters at any
|
|
13
|
+
* width. Every guarded write bumps it in SQL (`COALESCE(<col>, 0) + 1`), which
|
|
14
|
+
* costs no parameter of its own; `INSERT` leaves it NULL, and the NULL-safe
|
|
15
|
+
* comparison handles both that and rows written before the column existed.
|
|
16
|
+
*
|
|
17
|
+
* Not decoded into documents — `decodeGlobalRow` builds its result from the
|
|
18
|
+
* declared shape, so an undeclared physical column is invisible to callers.
|
|
19
|
+
*
|
|
20
|
+
* Bundler-inlined rather than owned by one package because BOTH producers of
|
|
21
|
+
* global-table DDL name it: `@lunora/sql-store`'s auto-provisioner (which runs
|
|
22
|
+
* the CAS) and `@lunora/d1/dialect`, which `lunora migrate generate` derives its
|
|
23
|
+
* `CREATE TABLE` from. Importing `@lunora/sql-store` would pull drizzle into the
|
|
24
|
+
* dependency-free dialect module the CLI reads; a second copy of the string is
|
|
25
|
+
* how the two shapes drift.
|
|
26
|
+
*/
|
|
27
|
+
declare const OCC_VERSION_COLUMN = "_version";
|
|
1
28
|
/**
|
|
2
29
|
* Canonical SQL identifier quoter shared by `@lunora/d1` and `@lunora/do`.
|
|
3
30
|
*
|
|
@@ -48,4 +75,4 @@ declare const frameworkColumnDdl: () => ReadonlyArray<string>;
|
|
|
48
75
|
declare const columnRef: (field: string) => string;
|
|
49
76
|
/** Physical index identifier — `<table>_<name>`, so two tables' like-named indexes don't collide in SQLite's flat index namespace. */
|
|
50
77
|
declare const physicalIndexName: (tableName: string, indexName: string) => string;
|
|
51
|
-
export { MAX_D1_TABLE_COLUMNS, SqlAffinity, columnRef, frameworkColumnDdl, physicalIndexName, quoteIdentifier, sqlAffinityForKind };
|
|
78
|
+
export { MAX_D1_TABLE_COLUMNS, OCC_VERSION_COLUMN, SqlAffinity, columnRef, frameworkColumnDdl, physicalIndexName, quoteIdentifier, sqlAffinityForKind };
|
package/dist/dialect.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{quoteIdentifier as
|
|
1
|
+
import{quoteIdentifier as r}from"./packem_shared/quoteIdentifier-CObIFRhb.mjs";import{OCC_VERSION_COLUMN as T}from"./packem_shared/OCC_VERSION_COLUMN-ByC64Jgx.mjs";const o=e=>{switch(e){case"boolean":return"INTEGER";case"bytes":return"BLOB";case"date":case"number":case"timestamp":return"REAL";default:return"TEXT"}},i=100,c=()=>[`${r("id")} TEXT PRIMARY KEY`,`${r("_creationTime")} REAL NOT NULL`],a=e=>e==="_id"||e==="id"?r("id"):e==="_creationTime"?r("_creationTime"):r(e),s=(e,t)=>r(`${e}_${t}`);export{i as MAX_D1_TABLE_COLUMNS,T as OCC_VERSION_COLUMN,a as columnRef,c as frameworkColumnDdl,s as physicalIndexName,r as quoteIdentifier,o as sqlAffinityForKind};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const o="_version";export{o as OCC_VERSION_COLUMN};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/d1",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.104",
|
|
4
4
|
"description": "D1 adapter for Lunora .global() tables, wrapping the Sessions API for read-your-writes",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -50,10 +50,10 @@
|
|
|
50
50
|
"access": "public"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@lunora/errors": "1.0.0-alpha.
|
|
54
|
-
"@lunora/platform": "1.0.0-alpha.
|
|
55
|
-
"@lunora/shard-engine": "1.0.0-alpha.
|
|
56
|
-
"@lunora/sql-store": "1.0.0-alpha.
|
|
53
|
+
"@lunora/errors": "1.0.0-alpha.30",
|
|
54
|
+
"@lunora/platform": "1.0.0-alpha.25",
|
|
55
|
+
"@lunora/shard-engine": "1.0.0-alpha.53",
|
|
56
|
+
"@lunora/sql-store": "1.0.0-alpha.106",
|
|
57
57
|
"drizzle-orm": "^0.45.2"
|
|
58
58
|
},
|
|
59
59
|
"engines": {
|