@lunora/sql-store 1.0.0-alpha.3 → 1.0.0-alpha.30
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/LICENSE.md +6 -0
- package/README.md +80 -1
- package/__assets__/package-og.svg +1 -1
- package/dist/dialect.d.mts +12 -2
- package/dist/dialect.d.ts +12 -2
- package/dist/index.d.mts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.mjs +2 -2
- package/dist/packem_shared/{createSqlCtxDb-CQFYyQLP.mjs → createSqlCtxDb-KdluzmSA.mjs} +191 -66
- package/package.json +4 -3
- /package/dist/packem_shared/{sqliteEncode-Dedu92k4.mjs → decodeBigint-Dedu92k4.mjs} +0 -0
package/dist/dialect.d.mts
CHANGED
|
@@ -46,9 +46,19 @@ interface SqlDialect {
|
|
|
46
46
|
real: string;
|
|
47
47
|
text: string;
|
|
48
48
|
};
|
|
49
|
-
/**
|
|
49
|
+
/**
|
|
50
|
+
* Map a stored value back to its JS form, by effective validator `kind`
|
|
51
|
+
* (inverse of `encode`). NOTE: currently **unused** by the store core, which
|
|
52
|
+
* hard-codes `sqliteDecode` in `decodeGlobalRow` on every engine. Kept on the
|
|
53
|
+
* seam for a future engine-native codec; an override here does not run today.
|
|
54
|
+
*/
|
|
50
55
|
decode: (value: unknown, kind: string | undefined) => unknown;
|
|
51
|
-
/**
|
|
56
|
+
/**
|
|
57
|
+
* Map a JS value to its bound storage form (boolean→1/0, bigint→string,
|
|
58
|
+
* object→JSON on SQLite). NOTE: currently **unused** by the store core, which
|
|
59
|
+
* hard-codes `sqliteEncode` as `serializeColumnValue` on every engine. Kept on
|
|
60
|
+
* the seam for a future engine-native codec; an override here does not run today.
|
|
61
|
+
*/
|
|
52
62
|
encode: (value: unknown) => unknown;
|
|
53
63
|
/** The framework columns every global table carries — the `id` primary key and `_creationTime` — as `{ name, type }` so the DDL builder can quote each name through the engine's dialect. */
|
|
54
64
|
frameworkColumns: () => ReadonlyArray<{
|
package/dist/dialect.d.ts
CHANGED
|
@@ -46,9 +46,19 @@ interface SqlDialect {
|
|
|
46
46
|
real: string;
|
|
47
47
|
text: string;
|
|
48
48
|
};
|
|
49
|
-
/**
|
|
49
|
+
/**
|
|
50
|
+
* Map a stored value back to its JS form, by effective validator `kind`
|
|
51
|
+
* (inverse of `encode`). NOTE: currently **unused** by the store core, which
|
|
52
|
+
* hard-codes `sqliteDecode` in `decodeGlobalRow` on every engine. Kept on the
|
|
53
|
+
* seam for a future engine-native codec; an override here does not run today.
|
|
54
|
+
*/
|
|
50
55
|
decode: (value: unknown, kind: string | undefined) => unknown;
|
|
51
|
-
/**
|
|
56
|
+
/**
|
|
57
|
+
* Map a JS value to its bound storage form (boolean→1/0, bigint→string,
|
|
58
|
+
* object→JSON on SQLite). NOTE: currently **unused** by the store core, which
|
|
59
|
+
* hard-codes `sqliteEncode` as `serializeColumnValue` on every engine. Kept on
|
|
60
|
+
* the seam for a future engine-native codec; an override here does not run today.
|
|
61
|
+
*/
|
|
52
62
|
encode: (value: unknown) => unknown;
|
|
53
63
|
/** The framework columns every global table carries — the `id` primary key and `_creationTime` — as `{ name, type }` so the DDL builder can quote each name through the engine's dialect. */
|
|
54
64
|
frameworkColumns: () => ReadonlyArray<{
|
package/dist/index.d.mts
CHANGED
|
@@ -168,6 +168,12 @@ declare const effectiveColumnKind: (validator: ValidatorLike) => string | undefi
|
|
|
168
168
|
* - `object`/`array`/`record`: JSON string → parsed value.
|
|
169
169
|
* - `union`/`any`: parsed back only when the stored string is a JSON non-scalar
|
|
170
170
|
* (a scalar union member round-trips through SQLite's native column type).
|
|
171
|
+
* CAVEAT: a union/any member is stored verbatim by {@link sqliteEncode}, so a
|
|
172
|
+
* legitimate *string* value that itself looks like JSON (`'{"a":1}'`, `'[1,2]'`)
|
|
173
|
+
* is ambiguous on read and decodes back to the parsed object/array, not the
|
|
174
|
+
* original string. This is inherent to sharing one TEXT column between a string
|
|
175
|
+
* and an object member; disambiguating would require a breaking storage-format
|
|
176
|
+
* change (tagging encoded non-scalars), so it is documented rather than fixed.
|
|
171
177
|
* - everything else (string/number/date/timestamp/id/literal): verbatim.
|
|
172
178
|
*/
|
|
173
179
|
declare const sqliteDecode: (raw: unknown, kind: string | undefined) => unknown;
|
package/dist/index.d.ts
CHANGED
|
@@ -168,6 +168,12 @@ declare const effectiveColumnKind: (validator: ValidatorLike) => string | undefi
|
|
|
168
168
|
* - `object`/`array`/`record`: JSON string → parsed value.
|
|
169
169
|
* - `union`/`any`: parsed back only when the stored string is a JSON non-scalar
|
|
170
170
|
* (a scalar union member round-trips through SQLite's native column type).
|
|
171
|
+
* CAVEAT: a union/any member is stored verbatim by {@link sqliteEncode}, so a
|
|
172
|
+
* legitimate *string* value that itself looks like JSON (`'{"a":1}'`, `'[1,2]'`)
|
|
173
|
+
* is ambiguous on read and decodes back to the parsed object/array, not the
|
|
174
|
+
* original string. This is inherent to sharing one TEXT column between a string
|
|
175
|
+
* and an object member; disambiguating would require a breaking storage-format
|
|
176
|
+
* change (tagging encoded non-scalars), so it is documented rather than fixed.
|
|
171
177
|
* - everything else (string/number/date/timestamp/id/literal): verbatim.
|
|
172
178
|
*/
|
|
173
179
|
declare const sqliteDecode: (raw: unknown, kind: string | undefined) => unknown;
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { createSqlCtxDb, decodeGlobalRow, readSqlCdcChanges, runSqlAggregateMigrations, runSqlCdcMigration, runSqlGlobalTableMigrations, runSqlRankMigrations, runSqlSearchMigrations, trimSqlCdcChanges } from './packem_shared/createSqlCtxDb-
|
|
2
|
-
export { decodeBigint, effectiveColumnKind, sqliteDecode, sqliteEncode, tryJsonParse } from './packem_shared/
|
|
1
|
+
export { createSqlCtxDb, decodeGlobalRow, readSqlCdcChanges, runSqlAggregateMigrations, runSqlCdcMigration, runSqlGlobalTableMigrations, runSqlRankMigrations, runSqlSearchMigrations, trimSqlCdcChanges } from './packem_shared/createSqlCtxDb-KdluzmSA.mjs';
|
|
2
|
+
export { decodeBigint, effectiveColumnKind, sqliteDecode, sqliteEncode, tryJsonParse } from './packem_shared/decodeBigint-Dedu92k4.mjs';
|