@quereus/store 4.5.0 → 4.7.0

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 (107) hide show
  1. package/README.md +34 -6
  2. package/dist/src/common/encoding.d.ts +4 -3
  3. package/dist/src/common/encoding.d.ts.map +1 -1
  4. package/dist/src/common/encoding.js +17 -13
  5. package/dist/src/common/encoding.js.map +1 -1
  6. package/dist/src/common/events.d.ts +31 -25
  7. package/dist/src/common/events.d.ts.map +1 -1
  8. package/dist/src/common/events.js +38 -39
  9. package/dist/src/common/events.js.map +1 -1
  10. package/dist/src/common/implicit-unique-index.d.ts +80 -0
  11. package/dist/src/common/implicit-unique-index.d.ts.map +1 -0
  12. package/dist/src/common/implicit-unique-index.js +148 -0
  13. package/dist/src/common/implicit-unique-index.js.map +1 -0
  14. package/dist/src/common/index.d.ts +7 -3
  15. package/dist/src/common/index.d.ts.map +1 -1
  16. package/dist/src/common/index.js +5 -2
  17. package/dist/src/common/index.js.map +1 -1
  18. package/dist/src/common/json-key.d.ts +30 -2
  19. package/dist/src/common/json-key.d.ts.map +1 -1
  20. package/dist/src/common/json-key.js +49 -2
  21. package/dist/src/common/json-key.js.map +1 -1
  22. package/dist/src/common/key-builder.d.ts +40 -20
  23. package/dist/src/common/key-builder.d.ts.map +1 -1
  24. package/dist/src/common/key-builder.js +31 -23
  25. package/dist/src/common/key-builder.js.map +1 -1
  26. package/dist/src/common/kv-store.d.ts +10 -0
  27. package/dist/src/common/kv-store.d.ts.map +1 -1
  28. package/dist/src/common/pk-key-resolution.d.ts +348 -0
  29. package/dist/src/common/pk-key-resolution.d.ts.map +1 -0
  30. package/dist/src/common/pk-key-resolution.js +481 -0
  31. package/dist/src/common/pk-key-resolution.js.map +1 -0
  32. package/dist/src/common/store-module-access-plan.d.ts +32 -0
  33. package/dist/src/common/store-module-access-plan.d.ts.map +1 -0
  34. package/dist/src/common/store-module-access-plan.js +428 -0
  35. package/dist/src/common/store-module-access-plan.js.map +1 -0
  36. package/dist/src/common/store-module-alter-column.d.ts +23 -0
  37. package/dist/src/common/store-module-alter-column.d.ts.map +1 -0
  38. package/dist/src/common/store-module-alter-column.js +389 -0
  39. package/dist/src/common/store-module-alter-column.js.map +1 -0
  40. package/dist/src/common/store-module-alter.d.ts +55 -0
  41. package/dist/src/common/store-module-alter.d.ts.map +1 -0
  42. package/dist/src/common/store-module-alter.js +504 -0
  43. package/dist/src/common/store-module-alter.js.map +1 -0
  44. package/dist/src/common/store-module-base.d.ts +268 -0
  45. package/dist/src/common/store-module-base.d.ts.map +1 -0
  46. package/dist/src/common/store-module-base.js +362 -0
  47. package/dist/src/common/store-module-base.js.map +1 -0
  48. package/dist/src/common/store-module-catalog.d.ts +269 -0
  49. package/dist/src/common/store-module-catalog.d.ts.map +1 -0
  50. package/dist/src/common/store-module-catalog.js +462 -0
  51. package/dist/src/common/store-module-catalog.js.map +1 -0
  52. package/dist/src/common/store-module-index-build.d.ts +88 -0
  53. package/dist/src/common/store-module-index-build.d.ts.map +1 -0
  54. package/dist/src/common/store-module-index-build.js +280 -0
  55. package/dist/src/common/store-module-index-build.js.map +1 -0
  56. package/dist/src/common/store-module-index.d.ts +116 -0
  57. package/dist/src/common/store-module-index.d.ts.map +1 -0
  58. package/dist/src/common/store-module-index.js +373 -0
  59. package/dist/src/common/store-module-index.js.map +1 -0
  60. package/dist/src/common/store-module-rename.d.ts +49 -0
  61. package/dist/src/common/store-module-rename.d.ts.map +1 -0
  62. package/dist/src/common/store-module-rename.js +268 -0
  63. package/dist/src/common/store-module-rename.js.map +1 -0
  64. package/dist/src/common/store-module-schema-rewrite.d.ts +57 -0
  65. package/dist/src/common/store-module-schema-rewrite.d.ts.map +1 -0
  66. package/dist/src/common/store-module-schema-rewrite.js +140 -0
  67. package/dist/src/common/store-module-schema-rewrite.js.map +1 -0
  68. package/dist/src/common/store-module-schema-sync.d.ts +232 -0
  69. package/dist/src/common/store-module-schema-sync.d.ts.map +1 -0
  70. package/dist/src/common/store-module-schema-sync.js +529 -0
  71. package/dist/src/common/store-module-schema-sync.js.map +1 -0
  72. package/dist/src/common/store-module.d.ts +43 -909
  73. package/dist/src/common/store-module.d.ts.map +1 -1
  74. package/dist/src/common/store-module.js +184 -3276
  75. package/dist/src/common/store-module.js.map +1 -1
  76. package/dist/src/common/store-table-base.d.ts +539 -0
  77. package/dist/src/common/store-table-base.d.ts.map +1 -0
  78. package/dist/src/common/store-table-base.js +900 -0
  79. package/dist/src/common/store-table-base.js.map +1 -0
  80. package/dist/src/common/store-table-constraints.d.ts +237 -0
  81. package/dist/src/common/store-table-constraints.d.ts.map +1 -0
  82. package/dist/src/common/store-table-constraints.js +624 -0
  83. package/dist/src/common/store-table-constraints.js.map +1 -0
  84. package/dist/src/common/store-table-scan.d.ts +452 -0
  85. package/dist/src/common/store-table-scan.d.ts.map +1 -0
  86. package/dist/src/common/store-table-scan.js +901 -0
  87. package/dist/src/common/store-table-scan.js.map +1 -0
  88. package/dist/src/common/store-table.d.ts +71 -1144
  89. package/dist/src/common/store-table.d.ts.map +1 -1
  90. package/dist/src/common/store-table.js +168 -2385
  91. package/dist/src/common/store-table.js.map +1 -1
  92. package/dist/src/testing/index.d.ts +12 -0
  93. package/dist/src/testing/index.d.ts.map +1 -0
  94. package/dist/src/testing/index.js +12 -0
  95. package/dist/src/testing/index.js.map +1 -0
  96. package/dist/src/testing/kv-assert.d.ts +19 -0
  97. package/dist/src/testing/kv-assert.d.ts.map +1 -0
  98. package/dist/src/testing/kv-assert.js +25 -0
  99. package/dist/src/testing/kv-assert.js.map +1 -0
  100. package/dist/src/testing/kv-conformance.d.ts.map +1 -1
  101. package/dist/src/testing/kv-conformance.js +1 -15
  102. package/dist/src/testing/kv-conformance.js.map +1 -1
  103. package/dist/src/testing/kv-provider-conformance.d.ts +54 -0
  104. package/dist/src/testing/kv-provider-conformance.d.ts.map +1 -0
  105. package/dist/src/testing/kv-provider-conformance.js +183 -0
  106. package/dist/src/testing/kv-provider-conformance.js.map +1 -0
  107. package/package.json +8 -8
@@ -90,6 +90,16 @@ export interface WriteBatch {
90
90
  * so for one (store, key) pair the later op wins. The coordinator replays its
91
91
  * pending ops into one atomic batch without collapsing duplicates, so a
92
92
  * transaction that writes then deletes the same row depends on this.
93
+ *
94
+ * SINGLE USE: a batch is spent once `write()` resolves — queue one commit's ops, write
95
+ * once, drop it (what the coordinator does). Reuse after `write()` is deliberately
96
+ * unspecified and backends differ: LevelDB's chained batch is closed by `write()` and
97
+ * throws on any later call, while IndexedDB's merely resets its op list and keeps working.
98
+ *
99
+ * NOTE: there is also no dispose — a batch that is built and then abandoned without
100
+ * `write()` (only reachable today if queueing throws MISUSE, i.e. a programming error)
101
+ * leaks whatever the backend holds until GC. If an abandoned-batch path ever becomes
102
+ * ordinary, give this interface a `close()` and make both behaviors conformance-tested.
93
103
  */
94
104
  export interface AtomicBatch {
95
105
  /** Queue a put against the given store. */
@@ -1 +1 @@
1
- {"version":3,"file":"kv-store.d.ts","sourceRoot":"","sources":["../../../src/common/kv-store.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,gEAAgE;IAChE,GAAG,CAAC,EAAE,UAAU,CAAC;IACjB,6BAA6B;IAC7B,EAAE,CAAC,EAAE,UAAU,CAAC;IAChB,2BAA2B;IAC3B,GAAG,CAAC,EAAE,UAAU,CAAC;IACjB,wDAAwD;IACxD,EAAE,CAAC,EAAE,UAAU,CAAC;IAChB,gCAAgC;IAChC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,OAAO;IACvB,GAAG,EAAE,UAAU,CAAC;IAChB,KAAK,EAAE,UAAU,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC5B;;;;;;;;;;;;OAYG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CACf;AAED;;GAE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EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvH;;;;;;;;;;OAUG;IACH,gBAAgB,CAAC,IAAI,WAAW,GAAG,SAAS,CAAC;CAC7C"}
@@ -0,0 +1,348 @@
1
+ /**
2
+ * Resolution of the physical KEY properties of a table's primary-key and
3
+ * secondary-index columns: the per-column key collation, the key-identity value
4
+ * transform for semantic-ordering types, and the order-safety predicates that
5
+ * decide whether a byte window may stand in for a comparator range.
6
+ *
7
+ * Shared by the store table (data-key + index-maintenance encoding) and
8
+ * `StoreModule` (index rebuild, access planning) so key encoding can never drift
9
+ * between the two.
10
+ */
11
+ import { type LogicalType, type Database, type ColumnSchema, type TableSchema, type TableIndexSchema, type SqlValue } from '@quereus/quereus';
12
+ import { type KeyValueTransform } from './encoding.js';
13
+ /**
14
+ * Resolve the per-column KEY collation for each primary-key column.
15
+ *
16
+ * The store encodes PRIMARY KEY uniqueness/ordering PHYSICALLY in the key bytes, so each
17
+ * text-capable PK column's key must be encoded under the collation the engine actually
18
+ * COMPARES that column under. Returns one entry per PK member, in `pkDef` order:
19
+ * - collation-aware member (`text`, `any` — the types whose `compare` applies the
20
+ * collation it is handed, `LogicalType.collationAware`) → its declared `collation`
21
+ * (normalized upper-case), or `fallback` (the table key collation K) when the
22
+ * column carries none.
23
+ * - text-capable but collation-blind member — `json` and the temporal types
24
+ * (`date` / `time` / `datetime` / `timespan`) → hard-coded `'BINARY'`: those
25
+ * types' `compare` is not the generic storage-class + collation comparison (the
26
+ * temporals ignore the argument; JSON ranks structurally), and their empty
27
+ * `supportedCollations` list keeps a non-BINARY column COLLATE out at DDL time.
28
+ * - never-text member → `undefined`: collation is meaningless for
29
+ * integer/real/blob keys (they encode type-natively), so the encoder ignores
30
+ * it and the data/index key bytes are identical regardless.
31
+ *
32
+ * Note that `undefined` does NOT mean "encode type-natively" to `encodeValue` — it means
33
+ * "fall back to `options.collation`", the table key collation K. Only a never-text column
34
+ * may be left `undefined`, because only it never reaches the collation branch.
35
+ *
36
+ * Every name returned here is encoded through the key-normalizer resolver carried
37
+ * in `EncodeOptions.normalizers` (`db.getKeyNormalizerResolver()`), so a collation
38
+ * registered or overridden with `db.registerCollation` produces key bytes that agree
39
+ * with the comparator the store's UNIQUE enforcement uses. A collation that cannot
40
+ * key — unregistered, or registered with a comparator but no normalizer — is rejected
41
+ * at DDL time by `StoreTableBase.validateKeyCollations`, so no encode call ever has
42
+ * to fall back. Shared by `StoreTable` (data-key + index-maintenance) and
43
+ * the index rebuild `buildIndexEntries` (store-module-index-build.ts) so the PK suffix
44
+ * encoding can never drift between the two.
45
+ */
46
+ export declare function resolvePkKeyCollations(pkDef: ReadonlyArray<{
47
+ index: number;
48
+ }>, columns: ReadonlyArray<ColumnSchema>, fallback: string): (string | undefined)[];
49
+ /**
50
+ * Per-column KEY collation for a secondary index's OWN columns (the index half of
51
+ * `buildIndexKey`), positionally aligned with `index.columns` — the index twin of
52
+ * {@link resolvePkKeyCollations}. Same three-way branch, delegated to the engine's
53
+ * `pkKeyCollationName`:
54
+ * - never-text column (`integer`, `real`, `blob`) → `undefined`: encoded
55
+ * type-natively, collation is moot.
56
+ * - text-capable but collation-blind (`json`, the temporal types) → hard-coded
57
+ * `'BINARY'` — those types' `compare` is not the generic collation comparison.
58
+ * - collation-aware (`text`, `any`) → the index column's own COLLATE, else the
59
+ * table column's declared collation, else `'BINARY'`.
60
+ *
61
+ * The fallback is `BINARY`, NOT the table key collation K — deliberately asymmetric
62
+ * with {@link resolvePkKeyCollations}, whose fallback IS K. For a PK member the
63
+ * asymmetry is illusory: `reconcilePkCollations` (store-module-schema-rewrite.ts)
64
+ * rewrites an undecorated text PK column's declared collation to K at CREATE time, so
65
+ * for a PK member K *is* the declared collation. No such rewrite exists for non-PK
66
+ * columns — an undecorated `text` column genuinely compares under BINARY (in the
67
+ * engine's operators and in the store's `matchesFilters` residual alike), so BINARY is
68
+ * what its index bytes must encode under, or the stored order/equality disagrees with
69
+ * every comparison made against it.
70
+ */
71
+ export declare function resolveIndexKeyCollations(index: TableIndexSchema, columns: ReadonlyArray<ColumnSchema>): (string | undefined)[];
72
+ /**
73
+ * The store's per-type key VALUE TRANSFORM for a semantic-ordering logical type, or
74
+ * `undefined` when raw values already key faithfully.
75
+ *
76
+ * The contract is TWO-sided — identity AND order. `StoreTable` implements no
77
+ * `comparePrimaryKey`, so the isolation layer merges overlay against underlying with
78
+ * its own fallback comparator (the PK type's `compare` via `createTypedComparator`)
79
+ * and needs this table's key BYTE order to agree with it; and byte equality must be
80
+ * exactly the type's equality, or two spellings of one value land on two keys.
81
+ *
82
+ * - JSON → the store-local structural encoder ({@link jsonStructuralKey}): a
83
+ * `Uint8Array` whose memcmp order reproduces the type's structural `compare`
84
+ * (canonical-text bytes are identity-faithful but sort `[10]` before `[2]`,
85
+ * which broke overlay shadowing — see json-key.ts).
86
+ * - Everything else → the engine's {@link semanticKeyTransform} (the type's
87
+ * `groupKey`). Today that is TIMESPAN: total seconds against the same reference
88
+ * date as `TIMESPAN.compare`, so 'PT1H' and 'PT60M' collide on one key AND byte
89
+ * order is elapsed-time order.
90
+ *
91
+ * JSON deliberately gets NO engine `groupKey` — `groupKey` also drives GROUP BY /
92
+ * `IN` / hash-join identity, where canonical-text identity is already correct and a
93
+ * `Uint8Array` key would be a behaviour change for no benefit. Hence this
94
+ * store-local seam. A semantic-ordering type with NEITHER a `groupKey` nor an entry
95
+ * here cannot key a persisted structure soundly; `StoreTable` rejects it at DDL time
96
+ * (see `validateSemanticKeyTransforms`).
97
+ *
98
+ * This is the PHYSICAL KEY BYTES resolver — it feeds `buildIndexKey` / `buildDataKey`
99
+ * and its output is memcmp-ordered and persisted. {@link storeDedupeKeyTransform} is
100
+ * its build/validate-time twin: same job, but for the transient UNIQUE dedupe
101
+ * signature, which is free to leave a comparable value for `serializeKey`'s collation
102
+ * normalizer instead of committing to structural bytes.
103
+ */
104
+ export declare function storeSemanticKeyTransform(type: LogicalType | undefined): KeyValueTransform | undefined;
105
+ /**
106
+ * The build/validate-time twin of {@link storeSemanticKeyTransform}, for the UNIQUE
107
+ * dedupe SIGNATURE rather than physical key bytes (`buildIndexEntries`'s in-pass
108
+ * `seen` check and `assertNoDuplicateRows`, both in store-module-index-build.ts).
109
+ *
110
+ * The signature is a `serializeKey` call over the (possibly transformed) values, and
111
+ * `serializeKey` applies a column's collation NORMALIZER only to a raw `string` value
112
+ * — a transform that returns a `Uint8Array` (as {@link storeSemanticKeyTransform} does
113
+ * for JSON, via {@link jsonStructuralKey}) is tagged as an opaque byte array instead,
114
+ * and the normalizer never runs. For JSON that would silently drop the index
115
+ * COLLATE on exactly the case `JSON_TYPE.compare` treats as text (a string-scalar
116
+ * pair) and let a build-time UNIQUE index admit rows a write-time insert would then
117
+ * reject (bug-store-index-build-dedupe-skips-collation) — so this resolver special-
118
+ * cases JSON: a string scalar is left AS a string, so `serializeKey`'s normalizer
119
+ * still runs; every other JSON value (object, array, number, boolean, or null) falls
120
+ * back to the structural bytes, matching `JSON_TYPE.compare`'s non-text ranking.
121
+ *
122
+ * Every other semantic-ordering type (TIMESPAN today) is unaffected: its `compare`
123
+ * ignores the collation it is handed, and its `groupKey` transform already collides
124
+ * every equal-identity spelling onto one value on both the build and write paths, so
125
+ * this resolver defers to {@link storeSemanticKeyTransform} unchanged.
126
+ */
127
+ export declare function storeDedupeKeyTransform(type: LogicalType | undefined): KeyValueTransform | undefined;
128
+ /**
129
+ * Resolve the per-column key value transform for each primary-key column —
130
+ * {@link storeSemanticKeyTransform} of the member's logical type. One entry per PK
131
+ * member in `pkDef` order; `undefined` for every type whose raw value already keys
132
+ * faithfully. The companion of {@link resolvePkKeyCollations}: every call site that
133
+ * threads the collations MUST thread these too, or key identity/order drifts
134
+ * between the write path and the rebuild/lookup path.
135
+ */
136
+ export declare function resolvePkKeyTransforms(pkDef: ReadonlyArray<{
137
+ index: number;
138
+ }>, columns: ReadonlyArray<ColumnSchema>): (KeyValueTransform | undefined)[];
139
+ /**
140
+ * Per-column key value transforms for a secondary index's OWN columns (the
141
+ * index half of `buildIndexKey`), positionally aligned with `index.columns`.
142
+ * Same rule as {@link resolvePkKeyTransforms}: a semantic-ordering member
143
+ * canonicalizes through {@link storeSemanticKeyTransform}, everything else
144
+ * encodes raw.
145
+ */
146
+ export declare function resolveIndexKeyTransforms(index: TableIndexSchema, columns: ReadonlyArray<ColumnSchema>): (KeyValueTransform | undefined)[];
147
+ /**
148
+ * Per-column {@link storeDedupeKeyTransform} for an arbitrary column-index list —
149
+ * the UNIQUE dedupe-signature counterpart of {@link resolveIndexKeyTransforms},
150
+ * shared by both build/validate-time dedupe sites (`buildIndexEntries`' in-pass
151
+ * `seen` check over an index's columns, `assertNoDuplicateRows` over a constraint's)
152
+ * so the two cannot drift onto different transforms.
153
+ */
154
+ export declare function resolveDedupeKeyTransforms(colIndices: ReadonlyArray<number>, columns: ReadonlyArray<ColumnSchema>): (KeyValueTransform | undefined)[];
155
+ /**
156
+ * Per-PK-column typed equality comparator for semantic-ordering members, `undefined`
157
+ * elsewhere. Backs `StoreTableConstraints.keysEqual`: two PK arrays naming the same
158
+ * physical key under {@link resolvePkKeyTransforms} ('PT1H' / 'PT60M') must also
159
+ * answer "same row" here, or self-PK exclusion in the UNIQUE checks false-conflicts
160
+ * a row against its own differently-spelled image.
161
+ */
162
+ export declare function resolvePkSemanticEquality(pkDef: ReadonlyArray<{
163
+ index: number;
164
+ }>, columns: ReadonlyArray<ColumnSchema>): (((a: SqlValue, b: SqlValue) => number) | undefined)[];
165
+ /**
166
+ * True when `col` can produce a TEXT value at runtime, and so when its physical
167
+ * key bytes are produced by a collation normalizer rather than a type-native
168
+ * encoding. The `ColumnSchema`-shaped wrapper over the engine's
169
+ * {@link logicalTypeCanHoldText}; both collation-safety guards over the store's
170
+ * secondary indexes — the write-side `StoreTableConstraints.indexSeekHonorsEnforcementCollation`
171
+ * and the read-side {@link keyOrderMatchesCollation} — exempt a never-text column from their
172
+ * key-vs-comparison collation test, so a false "non-text" answer is a silent wrong-result
173
+ * (a seek under the wrong collation, with the residual dropped).
174
+ */
175
+ export declare function columnCanHoldText(col: ColumnSchema | undefined): boolean;
176
+ /**
177
+ * True when this semantic-ordering type's store key bytes memcmp in EXACTLY the type's
178
+ * `compare` order — and byte-equal exactly when `compare` says equal — for every value a
179
+ * store-backed table can HOLD.
180
+ *
181
+ * An explicit per-type assertion, deliberately NOT
182
+ * `storeSemanticKeyTransform(type) !== undefined`: a transform is only required to be
183
+ * identity-faithful, and `validateSemanticKeyTransforms` can check only that one exists —
184
+ * nothing forces a future type's transform to be order-preserving. A type absent here
185
+ * keeps the pre-existing blanket decline in {@link keyOrderMatchesCollation} — no byte
186
+ * window, no ordering advertisement, answered by full scan + the type-aware residual.
187
+ *
188
+ * Why the stored-value claim holds for the two listed types:
189
+ * - TIMESPAN — every write path coerces through `TIMESPAN_TYPE.parse` (row coercion,
190
+ * the engine's pre-coerced UPDATE fast path, the ALTER retype backfill's
191
+ * `validateAndParse`), which raises on anything unparseable. So every stored value
192
+ * parses, `groupKey` returns total seconds for all of them, and every stored key
193
+ * member is a fixed-width NUMERIC whose memcmp order is elapsed-time order. The
194
+ * raw-text fallback branch of `groupKey` is unreachable for stored values.
195
+ * - JSON — every stored value is a `JSON_TYPE.parse` output (never a blob, never a
196
+ * bigint), all of which {@link jsonStructuralKey} encodes; its tag order reproduces
197
+ * both `deepCompareJson`'s rank order and, for cross-storage-class pairs (where
198
+ * `createTypedComparator` short-circuits before reaching `JSON_TYPE.compare`),
199
+ * `getStorageClass`'s NULL < NUMERIC < TEXT < BLOB < OBJECT. SQL NULL never reaches
200
+ * a transform (`encodeCompositeKey` exempts it) and its `0x00` tag sorts below the
201
+ * BLOB tag the structural bytes travel under, matching NULL-first placement.
202
+ *
203
+ * Matched by NAME, not object identity, for the same dual-module-instance reason
204
+ * {@link storeSemanticKeyTransform} documents. This is a claim about values the table
205
+ * holds; a query-supplied seek bound needs {@link semanticProbeIsKeyFaithful} on top.
206
+ */
207
+ export declare function semanticKeyOrderIsFaithful(type: LogicalType | undefined): boolean;
208
+ /**
209
+ * True when `probe`'s key bytes sit at the position the type's `compare` gives it
210
+ * relative to every STORED value — the per-VALUE precondition every re-opened seek
211
+ * window (range bound AND equality probe) needs on top of
212
+ * {@link semanticKeyOrderIsFaithful}, which is a claim about stored values only. A probe
213
+ * comes from the query, and nothing coerces it to the column's declared type, so an
214
+ * unfaithful probe is reachable where an unfaithful stored value is not. Two concrete
215
+ * TIMESPAN under-fetches motivate the gate:
216
+ *
217
+ * - `where d > 5`: `createTypedComparator` short-circuits on the storage-class
218
+ * mismatch before `TIMESPAN.compare` runs, so every stored (TEXT-class) value ranks
219
+ * ABOVE the NUMERIC probe and the predicate admits every row — but `groupKey(5)`
220
+ * passes the non-string through unchanged, so the byte window is `> NUMERIC(5)` and
221
+ * a row storing 'PT1S' (total 1) falls outside it. Rows lost.
222
+ * - `where d > 'not a duration'`: `TIMESPAN.compare` falls back to BINARY text against
223
+ * the canonical stored text, while `groupKey` falls back to the raw text, which
224
+ * encodes TEXT-tagged and sorts above every NUMERIC-tagged stored key. Different
225
+ * position, rows lost.
226
+ *
227
+ * THE canonical statement of how each arm degrades on `false` — the call sites point
228
+ * here rather than restating it. A window may only ever be WIDENED, never narrowed, and
229
+ * the type-aware residual (`StoreTableScan.matchesFilters`) decides rows in every case:
230
+ *
231
+ * - a RANGE bound is SKIPPED (`buildPKRangeBounds`, `buildIndexRangeBounds`) — dropping
232
+ * one bound only widens the window, worst case back to the full scan.
233
+ * - a full-PK EQUALITY declines the WHOLE point arm (`analyzePKAccess`) — a point window
234
+ * is a single byte position, so it cannot be widened, only under-fetched.
235
+ * - a secondary index's EQ PREFIX stops SHORT at that column (`analyzeIndexAccess`) — a
236
+ * window over the columns before it is a strict superset.
237
+ * - an IN-list MULTI-SEEK has none of the three available (its merged windows are the
238
+ * whole access) and so never reaches this gate: it is declined per SCHEMA upstream.
239
+ *
240
+ * The TIMESPAN arm calls the COLUMN's own `groupKey`, not the imported singleton's,
241
+ * for the dual-module-instance reason {@link storeSemanticKeyTransform} documents.
242
+ * A semantic-ordering type outside the {@link semanticKeyOrderIsFaithful} allow-list
243
+ * answers `false`, consistent with that predicate — no window is built for it anyway.
244
+ */
245
+ export declare function semanticProbeIsKeyFaithful(type: LogicalType | undefined, probe: SqlValue): boolean;
246
+ /**
247
+ * True when a byte window — or a byte-order advertisement — over `column` is SOUND.
248
+ *
249
+ * The store physically orders rows by memcmp of each column's key bytes, which for a
250
+ * text-capable column are produced by `keyCollation`'s normalizer. A range seek (and the
251
+ * `providesOrdering` / `monotonicOn` advertisement) equates that byte order with the order
252
+ * `compareCollation`'s comparator defines. Two things must hold for that equation:
253
+ *
254
+ * - **Same collation on both sides** (`compareCollation === keyCollation`). A `keyCollation`
255
+ * merely COARSER than `compareCollation` is not enough: it would need the key normalizer
256
+ * to be monotone with respect to the OTHER collation's order. It generally is not, even
257
+ * for built-ins: with `keyCollation = NOCASE` and `compareCollation = BINARY`,
258
+ * 'K' (U+212A KELVIN SIGN) is `> 'z'` under BINARY, yet its key bytes are
259
+ * `toLowerCase('K') = 'k'`, which sorts BEFORE 'z' — the row falls outside a `> 'z'`
260
+ * window and is silently dropped.
261
+ * - **The normalizer preserves order** (`db._isCollationOrderPreserving`). `registerCollation`
262
+ * promises only that a normalizer partitions strings the way the comparator calls them
263
+ * equal; a custom pair may agree on equality and disagree on order.
264
+ *
265
+ * A never-text column is exempt: its key bytes are type-native and collation-independent.
266
+ *
267
+ * Returning `false` costs an optimization (the caller full-scans and lets the
268
+ * collation-aware `matchesFilters` residual decide); returning `true` wrongly is a silent
269
+ * wrong-result. Shared by `StoreTable`'s read arms and `StoreModule`'s access planner so the
270
+ * "mark handled" and "build a window" decisions can never disagree.
271
+ *
272
+ * The PK caller ({@link pkOrderPreservingPrefixLength}) can genuinely pass two DIFFERENT
273
+ * collations, because {@link resolvePkKeyCollations} still falls back to the table key
274
+ * collation K for an undecorated text PK member. The secondary-index caller
275
+ * ({@link indexLeadingRangeIsOrderSafe}) usually passes the same name on both sides — index
276
+ * key bytes encode under the index column's own effective collation, which is what the scan
277
+ * residual re-compares under — so for a `text` or `any` column it reduces to the
278
+ * `orderPreserving` assertion alone. The one index shape where the two sides still differ is
279
+ * a collation-blind column (`json`, the temporal types) under an index column carrying an
280
+ * explicit non-BINARY COLLATE (index DDL does not type-gate the way column DDL does): its
281
+ * key bytes are hard-`BINARY` while its residual compares under the declared name, and this
282
+ * predicate correctly declines it.
283
+ */
284
+ export declare function keyOrderMatchesCollation(db: Database, column: ColumnSchema | undefined, keyCollation: string, compareCollation: string): boolean;
285
+ /**
286
+ * True when an EQUALITY/prefix byte window over the leading `prefixLength` columns of
287
+ * secondary `index` is EXACTLY the qualifying set — the condition under which the access
288
+ * planner may claim the equality filters handled and drop the residual Filter.
289
+ *
290
+ * `keyCollations` is {@link resolveIndexKeyCollations}' output for `index` (the scan passes
291
+ * its memoized copy, the access planner resolves one on the spot): the collation each
292
+ * position's key bytes are ACTUALLY encoded under. The window equals the qualifying set iff
293
+ * that agrees, per position, with {@link indexResidualCollation}.
294
+ *
295
+ * For a `text` or `any` column the two agree by construction — both resolve to the index
296
+ * `COLLATE` else the declared collation else BINARY — so those admit, including the
297
+ * `text` column of a table whose key collation K is something else entirely, and an
298
+ * `x any collate nocase` index column (whose window is now genuinely the NOCASE-equal
299
+ * set — ANY's `compare` honors the collation, so key bytes, residual, and enforcement
300
+ * all agree). The shape that does NOT agree is a collation-blind column (`json`, the
301
+ * temporal types) under an index column carrying an explicit non-BINARY COLLATE:
302
+ * `pkKeyCollationName` keys those hard-`BINARY` while the residual still compares under
303
+ * the declared name, so the window would be byte-equal only and miss rows the residual
304
+ * admits — declined. Never-text columns are exempt — their key bytes are type-native.
305
+ */
306
+ export declare function indexPrefixSeekIsCollationExact(columns: ReadonlyArray<ColumnSchema>, index: TableIndexSchema, keyCollations: ReadonlyArray<string | undefined>, prefixLength: number): boolean;
307
+ /**
308
+ * True when a byte RANGE window over the LEADING column of secondary `index` is SOUND.
309
+ *
310
+ * Strictly stronger than {@link indexPrefixSeekIsCollationExact} at position 0: the same
311
+ * key-vs-residual collation agreement, PLUS the collation's `orderPreserving` assertion,
312
+ * because a range window also equates memcmp of the key bytes with the residual
313
+ * comparator's ORDER. Both halves are {@link keyOrderMatchesCollation}, which admits a
314
+ * semantic-ordering column only when {@link semanticKeyOrderIsFaithful} asserts its key
315
+ * bytes order as the type's `compare` does (and the collation sides agree — a `collate`
316
+ * decoration on the index column still declines it).
317
+ *
318
+ * THE shared predicate for the two decision sites: `tryIndexAccessPlan`
319
+ * (store-module-access-plan.ts) marks the range filters handled only when it holds, and
320
+ * `StoreTableScan.analyzeIndexAccess` builds a window only when it holds. They must agree —
321
+ * a plan that claims a filter the scan then declines to window loses the residual Filter and
322
+ * returns the whole table — so they call this rather than each restating it.
323
+ */
324
+ export declare function indexLeadingRangeIsOrderSafe(db: Database, columns: ReadonlyArray<ColumnSchema>, index: TableIndexSchema, keyCollations: ReadonlyArray<string | undefined>): boolean;
325
+ /**
326
+ * How many LEADING primary-key members have key bytes whose memcmp order matches their
327
+ * declared collation's comparator order, per {@link keyOrderMatchesCollation}.
328
+ *
329
+ * `pkKeyCollations` is {@link resolvePkKeyCollations}' output for this table; an `undefined`
330
+ * entry belongs to a never-text member, which {@link keyOrderMatchesCollation} exempts
331
+ * outright — `tableKeyCollation` is passed only so the exempt branch has a name to ignore.
332
+ * The comparison collation is the column's declared one, which `reconcilePkCollations` has
333
+ * already aligned with the key collation for every *textual* PK member.
334
+ *
335
+ * What the advertisement is measured against is the order the planner's `Sort` would have
336
+ * produced. For most members Sort orders under the operand's COLLATION, so a collation match
337
+ * is the question; for a member whose logical type carries SEMANTIC ordering (TIMESPAN, JSON
338
+ * — see docs/types.md "Semantic ordering") Sort ranks by `logicalType.compare`, and the
339
+ * member counts only when {@link semanticKeyOrderIsFaithful} asserts the stored key bytes
340
+ * memcmp in exactly that order (TIMESPAN's total-seconds transform, JSON's structural
341
+ * encoding). A semantic-ordering type outside that allow-list breaks the prefix, and the
342
+ * memory backend's typed BTree order remains the canonical order for it.
343
+ *
344
+ * `0` ⇒ even the leading member is unsafe: no range seek, no PK-order advertisement.
345
+ * A prefix shorter than the PK truncates the ordering advertisement rather than voiding it.
346
+ */
347
+ export declare function pkOrderPreservingPrefixLength(db: Database, schema: TableSchema, pkKeyCollations: ReadonlyArray<string | undefined>, tableKeyCollation: string): number;
348
+ //# sourceMappingURL=pk-key-resolution.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pk-key-resolution.d.ts","sourceRoot":"","sources":["../../../src/common/pk-key-resolution.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAQN,KAAK,WAAW,EAChB,KAAK,QAAQ,EAEb,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,QAAQ,EACb,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAGvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,sBAAsB,CACrC,KAAK,EAAE,aAAa,CAAC;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,EACvC,OAAO,EAAE,aAAa,CAAC,YAAY,CAAC,EACpC,QAAQ,EAAE,MAAM,GACd,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,CAUxB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,yBAAyB,CACxC,KAAK,EAAE,gBAAgB,EACvB,OAAO,EAAE,aAAa,CAAC,YAAY,CAAC,GAClC,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,CAcxB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,WAAW,GAAG,SAAS,GAAG,iBAAiB,GAAG,SAAS,CAQtG;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBA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