@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
@@ -0,0 +1,148 @@
1
+ /**
2
+ * The hidden `_uc_*` secondary index the store materializes per non-derived
3
+ * UNIQUE constraint that no explicit index already covers, so a plain UNIQUE
4
+ * enforces via a point seek rather than a full scan — plus the reuse test that
5
+ * decides when an existing index already serves that role.
6
+ */
7
+ import { normalizeCollationName, } from '@quereus/quereus';
8
+ /**
9
+ * Deterministic name of the implicit covering index materialized for a
10
+ * NON-DERIVED UNIQUE constraint `uc`: the constraint's own name when it has one,
11
+ * else the auto-name `_uc_<colNames>`. This MUST equal the engine's
12
+ * `catalog.ts` `implicitIndexName`, so a name that ever reaches the catalog
13
+ * bundle generator is recognized as hidden / exposed-implicit rather than a user
14
+ * index.
15
+ */
16
+ export function implicitUniqueIndexName(schema, uc) {
17
+ return uc.name ?? `_uc_${uc.columns.map(i => schema.columns[i]?.name ?? String(i)).join('_')}`;
18
+ }
19
+ /**
20
+ * True when every column of `idx` carries the same effective collation as the
21
+ * column `uc` declares — the reuse gate of {@link findReusableIndexForUnique}.
22
+ *
23
+ * Positions align because the caller has already matched the column SET
24
+ * (`idx.columns[i]` ↔ `uc.columns[i]`). An index column with no explicit COLLATE
25
+ * has `collation === undefined` and falls back to the declared column collation,
26
+ * so the common `create index ix on t(email)` case stays reuse-eligible.
27
+ *
28
+ * Load-bearing: store index KEYS are encoded under each column's own effective
29
+ * collation (`resolveIndexKeyCollations` — index COLLATE ?? table column collation
30
+ * ?? BINARY), so a collation-mismatched index holds DIFFERENT bytes than the
31
+ * `_uc_*` it would replace. Reusing a BINARY-collated index for a NOCASE-declared
32
+ * UNIQUE would make the enforcement seek UNDER-fetch and silently accept a
33
+ * duplicate. Also mirrors `MemoryTableManager.indexCollationsMatchDeclared`, so
34
+ * both backends reuse the same set of indexes. The cost of the strictness is one
35
+ * duplicate hidden index in a rare declaration.
36
+ */
37
+ function indexCollationsMatchDeclared(schema, idx, uc) {
38
+ return uc.columns.every((colIdx, i) => {
39
+ const declared = normalizeCollationName(schema.columns[colIdx]?.collation ?? 'BINARY');
40
+ const indexCollation = normalizeCollationName(idx.columns[i]?.collation ?? schema.columns[colIdx]?.collation ?? 'BINARY');
41
+ return indexCollation === declared;
42
+ });
43
+ }
44
+ /**
45
+ * The existing `schema.indexes` entry that already realizes `uc`, or undefined
46
+ * when none does and {@link withImplicitUniqueIndexes} must materialize a hidden
47
+ * `_uc_*` of its own.
48
+ *
49
+ * A FULL (non-partial) index over exactly the constrained columns physically
50
+ * holds an entry for every live row, keyed by the same bytes the `_uc_*` would
51
+ * use — so `StoreTableConstraints.findUniqueConflictViaIndex` can seek it directly and
52
+ * a second identical structure would only double DML maintenance. Reuse is
53
+ * refused for:
54
+ *
55
+ * - an index-DERIVED UC (`derivedFromIndex`) — it already names its index;
56
+ * - a PARTIAL UNIQUE (`uc.predicate`) — the co-scoped `_uc_*` carries the SAME
57
+ * predicate OBJECT, which `StoreTableConstraints.findIndexForUniqueConstraint`
58
+ * matches on identity; a user index with an equal-but-distinct predicate
59
+ * physically omits rows the constraint still covers;
60
+ * - a PARTIAL index — it omits out-of-scope rows a full UNIQUE still covers;
61
+ * - a collation-mismatched index (see {@link indexCollationsMatchDeclared}).
62
+ *
63
+ * A DESC index IS reusable: every writer and reader of an index derives its
64
+ * direction flags from that index's own `columns[].desc`
65
+ * (`StoreTableConstraints.updateSecondaryIndexes`,
66
+ * `StoreTableConstraints.findUniqueConflictViaIndex`), so the enforcement probe lands
67
+ * on the same window a DESC-encoded entry was written to.
68
+ *
69
+ * Reuse makes a plain UNIQUE's hidden index depend on the set of EXPLICIT
70
+ * indexes, so `StoreModule.createIndex` / `dropIndex` must reconcile the physical
71
+ * `_uc_*` store on the transition — see
72
+ * `StoreModule.reconcileImplicitUniqueIndexStores`.
73
+ */
74
+ export function findReusableIndexForUnique(schema, uc) {
75
+ if (uc.derivedFromIndex || uc.predicate)
76
+ return undefined;
77
+ // Skip the constraint's OWN `_uc_*`, so an ALREADY-MATERIALIZED schema answers the
78
+ // same as its engine-facing original: without this a UC would "reuse" the very index
79
+ // it asked for, and a caller diffing the implicit set
80
+ // (`StoreModule.implicitUniqueIndexNameMap`) would conclude the `_uc_*` is not needed
81
+ // and tear its store down.
82
+ const ownName = implicitUniqueIndexName(schema, uc).toLowerCase();
83
+ return (schema.indexes ?? []).find(idx => idx.name.toLowerCase() !== ownName
84
+ && !idx.predicate
85
+ && idx.columns.length === uc.columns.length
86
+ && idx.columns.every((col, i) => col.index === uc.columns[i])
87
+ && indexCollationsMatchDeclared(schema, idx, uc));
88
+ }
89
+ /**
90
+ * Return `schema` with a synthetic secondary index materialized into
91
+ * `schema.indexes` for every NON-DERIVED UNIQUE constraint that lacks one — the
92
+ * store analogue of `MemoryTableManager.ensureUniqueConstraintIndexes`.
93
+ *
94
+ * This is what lets a plain column- or table-level `UNIQUE` be enforced by a
95
+ * bounded index point-seek (`StoreTableConstraints.findUniqueConflictViaIndex`)
96
+ * instead of an O(rows) full scan: DML maintenance
97
+ * (`StoreTableConstraints.updateSecondaryIndexes`) and the UNIQUE check both iterate
98
+ * `schema.indexes`, so once the `_uc_*` entry is present the physical index is
99
+ * maintained and seeked with no new code path.
100
+ *
101
+ * The result is held ONLY in `StoreTableBase.materializedSchema` (the
102
+ * enforcement copy), never in the engine-facing `tableSchema` the store returns
103
+ * from `getSchema()` / registers with the engine. So the read-query planner and
104
+ * the catalog bundle never see `_uc_*` (it is fully derived on open from
105
+ * `uniqueConstraints`); like the memory backend, a plain UNIQUE gets no read-side
106
+ * plan from `_uc_*`, only enforcement / maintenance.
107
+ *
108
+ * Idempotent — a name already present is left untouched — and returns a frozen
109
+ * schema (or the input unchanged when there is nothing to add). A
110
+ * `derivedFromIndex` UC is skipped (its `CREATE UNIQUE INDEX` is already in
111
+ * `schema.indexes`). A partial UNIQUE's synthetic index carries the SAME
112
+ * `uc.predicate` object reference, which
113
+ * `StoreTableConstraints.findIndexForUniqueConstraint` matches on identity.
114
+ *
115
+ * A UC whose columns are already covered by a collation-compatible EXPLICIT full
116
+ * index is left WITHOUT a `_uc_*` — that index enforces it (see
117
+ * {@link findReusableIndexForUnique}), so building a byte-identical twin would
118
+ * only double the work of every INSERT / UPDATE / DELETE.
119
+ */
120
+ export function withImplicitUniqueIndexes(schema) {
121
+ const ucs = schema.uniqueConstraints;
122
+ if (!ucs || ucs.length === 0)
123
+ return schema;
124
+ const existing = schema.indexes ?? [];
125
+ const present = new Set(existing.map(idx => idx.name.toLowerCase()));
126
+ const additions = [];
127
+ for (const uc of ucs) {
128
+ if (uc.derivedFromIndex)
129
+ continue;
130
+ const name = implicitUniqueIndexName(schema, uc);
131
+ if (present.has(name.toLowerCase()))
132
+ continue;
133
+ if (findReusableIndexForUnique(schema, uc))
134
+ continue;
135
+ present.add(name.toLowerCase());
136
+ additions.push({
137
+ name,
138
+ columns: uc.columns.map(idx => ({ index: idx, collation: schema.columns[idx]?.collation })),
139
+ // SAME reference as `uc.predicate` (undefined for a full UNIQUE) — load-bearing:
140
+ // findIndexForUniqueConstraint admits a partial `_uc_*` by `ix.predicate === uc.predicate`.
141
+ predicate: uc.predicate,
142
+ });
143
+ }
144
+ if (additions.length === 0)
145
+ return schema;
146
+ return Object.freeze({ ...schema, indexes: Object.freeze([...existing, ...additions]) });
147
+ }
148
+ //# sourceMappingURL=implicit-unique-index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"implicit-unique-index.js","sourceRoot":"","sources":["../../../src/common/implicit-unique-index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACN,sBAAsB,GAItB,MAAM,kBAAkB,CAAC;AAE1B;;;;;;;GAOG;AACH,MAAM,UAAU,uBAAuB,CAAC,MAAmB,EAAE,EAA0B;IACtF,OAAO,EAAE,CAAC,IAAI,IAAI,OAAO,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,IAAI,IAAI,MAAM,CAAC,CAAC,CAAC,C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,CAAC,CAAC;YAC3F,iFAAiF;YACjF,4FAA4F;YAC5F,SAAS,EAAE,EAAE,CAAC,SAAS;SACvB,CAAC,CAAC;IACJ,CAAC;IACD,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,MAAM,CAAC;IAC1C,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,QAAQ,EAAE,GAAG,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC;AAC1F,CAAC"}
@@ -4,17 +4,21 @@
4
4
  export type { KVStore, KVEntry, WriteBatch, WriteOptions, BatchOp, AtomicBatch, IterateOptions, KVStoreFactory, KVStoreOptions, KVStoreProvider, } from './kv-store.js';
5
5
  export { encodeValue, encodeCompositeKey, decodeValue, decodeCompositeKey, BUILTIN_KEY_NORMALIZER_RESOLVER, assertNoUnpairedSurrogate, findUnpairedSurrogate, type EncodeOptions, type KeyValueTransform, } from './encoding.js';
6
6
  export { serializeRow, deserializeRow, serializeValue, deserializeValue, serializeStats, deserializeStats, type TableStats, } from './serialization.js';
7
- export { STORE_SUFFIX, CATALOG_STORE_NAME, STATS_STORE_NAME, buildDataStoreName, buildIndexStoreName, buildStatsStoreName, buildStatsKey, buildDataKey, buildIndexKey, buildCatalogKey, buildViewCatalogKey, buildMaterializedViewCatalogKey, parseMaterializedViewCatalogKey, buildMetaCatalogKey, CLEAN_SHUTDOWN_META_NAME, STALE_MVS_META_NAME, classifyCatalogKey, type CatalogEntryKind, buildFullScanBounds, buildIndexPrefixBounds, buildPkPrefixBounds, buildCatalogScanBounds, KEY_PREFIX, buildTablePrefix, buildTableScanBounds, buildIndexScanBounds, buildMetaKey, buildMetaScanBounds, } from './key-builder.js';
7
+ export { STORE_SUFFIX, CATALOG_STORE_NAME, STATS_STORE_NAME, buildDataStoreName, buildIndexStoreName, buildStatsStoreName, buildStatsKey, buildDataKey, buildIndexKey, type IndexKeyHalf, buildCatalogKey, buildViewCatalogKey, buildMaterializedViewCatalogKey, parseMaterializedViewCatalogKey, buildMetaCatalogKey, CLEAN_SHUTDOWN_META_NAME, STALE_MVS_META_NAME, classifyCatalogKey, type CatalogEntryKind, buildFullScanBounds, buildIndexPrefixBounds, buildPkPrefixBounds, buildCatalogScanBounds, KEY_PREFIX, buildTablePrefix, buildTableScanBounds, buildIndexScanBounds, buildMetaKey, buildMetaScanBounds, } from './key-builder.js';
8
8
  export { StoreEventEmitter, type SchemaChangeEvent, type DataChangeEvent, type SchemaChangeListener, type DataChangeListener, } from './events.js';
9
9
  export { generateTableDDL, generateIndexDDL, generateViewDDL, generateMaintainedTableDDL, generateIndexTagsDDL } from '@quereus/quereus';
10
10
  export { TransactionCoordinator, type TransactionCallbacks, type PendingStoreOps, type OrderedPendingOps, } from './transaction.js';
11
11
  export { bytesToHex, bytesEqual, compareBytes } from './bytes.js';
12
12
  export { InMemoryKVStore } from './memory-store.js';
13
13
  export { CachedKVStore, type CacheOptions } from './cached-kv-store.js';
14
- export { StoreTable, resolvePkKeyCollations, resolvePkKeyTransforms, resolveIndexKeyTransforms, storeSemanticKeyTransform, type StoreTableConfig, type StoreTableModule, type ExternalRowOp, } from './store-table.js';
14
+ export { StoreTable, type ExternalRowOp } from './store-table.js';
15
+ export { type StoreTableConfig, type StoreTableModule } from './store-table-base.js';
16
+ export { resolvePkKeyCollations, resolvePkKeyTransforms, resolveIndexKeyCollations, resolveIndexKeyTransforms, storeSemanticKeyTransform, } from './pk-key-resolution.js';
15
17
  export { jsonStructuralKey } from './json-key.js';
16
18
  export { StoreConnection } from './store-connection.js';
17
19
  export { StoreBackingHost } from './backing-host.js';
18
- export { StoreModule, type StoreModuleConfig, type RehydrationResult, type RehydrationError, type LensDeploymentListener } from './store-module.js';
20
+ export { StoreModule } from './store-module.js';
21
+ export { type StoreModuleConfig, type LensDeploymentListener } from './store-module-base.js';
22
+ export { type RehydrationResult, type RehydrationError } from './store-module-schema-sync.js';
19
23
  export { createIsolatedStoreModule, hasIsolation, type IsolatedStoreModuleConfig, } from './isolated-store.js';
20
24
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/common/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,YAAY,EACV,OAAO,EACP,OAAO,EACP,UAAU,EACV,YAAY,EACZ,OAAO,EACP,WAAW,EACX,cAAc,EACd,cAAc,EACd,cAAc,EACd,eAAe,GAChB,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,WAAW,EACX,kBAAkB,EAClB,+BAA+B,EAC/B,yBAAyB,EACzB,qBAAqB,EACrB,KAAK,aAAa,EAClB,KAAK,iBAAiB,GACvB,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,YAAY,EACZ,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,KAAK,UAAU,GAChB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACN,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,EACb,YAAY,EACZ,aAAa,EACb,eAAe,EACf,mBAAmB,EACnB,+BAA+B,EAC/B,+BAA+B,EAC/B,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,kBAAkB,EAClB,KAAK,gBAAgB,EACrB,mBAAmB,EACnB,sBAAsB,EACtB,mBAAmB,EACnB,sBAAsB,EAEtB,UAAU,EACV,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,YAAY,EACZ,mBAAmB,GACnB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,iBAAiB,EACjB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,GACxB,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,gBAAgB,EAAE,gBAAgB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UAAU,EAAE,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAGrF,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,yBAAyB,EACzB,yBAAyB,EACzB,yBAAyB,GAC1B,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAGxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAIrD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAC7F,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAG9F,OAAO,EACN,yBAAyB,EACzB,YAAY,EACZ,KAAK,yBAAyB,GAC9B,MAAM,qBAAqB,CAAC"}
@@ -22,13 +22,16 @@ export { InMemoryKVStore } from './memory-store.js';
22
22
  // Cached KV store wrapper
23
23
  export { CachedKVStore } from './cached-kv-store.js';
24
24
  // Generic store table and connection
25
- export { StoreTable, resolvePkKeyCollations, resolvePkKeyTransforms, resolveIndexKeyTransforms, storeSemanticKeyTransform, } from './store-table.js';
25
+ export { StoreTable } from './store-table.js';
26
+ // Physical key properties of primary-key / index columns
27
+ export { resolvePkKeyCollations, resolvePkKeyTransforms, resolveIndexKeyCollations, resolveIndexKeyTransforms, storeSemanticKeyTransform, } from './pk-key-resolution.js';
26
28
  // Structural key encoding for declared-JSON key members
27
29
  export { jsonStructuralKey } from './json-key.js';
28
30
  export { StoreConnection } from './store-connection.js';
29
31
  // Materialized-view backing host (engine backing-host capability over a store table)
30
32
  export { StoreBackingHost } from './backing-host.js';
31
- // Generic store module
33
+ // Generic store module. The class is layered across a chain of files (see the header of
34
+ // store-module.ts); these three own the names the package exports.
32
35
  export { StoreModule } from './store-module.js';
33
36
  // Isolation layer utilities
34
37
  export { createIsolatedStoreModule, hasIsolation, } from './isolated-store.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/common/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAgBH,eAAe;AACf,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,WAAW,EACX,kBAAkB,EAClB,+BAA+B,EAC/B,yBAAyB,EACzB,qBAAqB,GAGtB,MAAM,eAAe,CAAC;AAEvB,oBAAoB;AACpB,OAAO,EACL,YAAY,EACZ,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,gBAAgB,GAEjB,MAAM,oBAAoB,CAAC;AAE5B,yBAAyB;AACzB,OAAO,EACN,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,EACb,YAAY,EACZ,aAAa,EACb,eAAe,EACf,mBAAmB,EACnB,+BAA+B,EAC/B,+BAA+B,EAC/B,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,kBAAkB,EAElB,mBAAmB,EACnB,sBAAsB,EACtB,mBAAmB,EACnB,sBAAsB;AACtB,8BAA8B;AAC9B,UAAU,EACV,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,YAAY,EACZ,mBAAmB,GACnB,MAAM,kBAAkB,CAAC;AAE1B,SAAS;AACT,OAAO,EACL,iBAAiB,GAKlB,MAAM,aAAa,CAAC;AAErB,sEAAsE;AACtE,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,eAAe,EAAE,0BAA0B,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAEzI,sBAAsB;AACtB,OAAO,EACL,sBAAsB,GAIvB,MAAM,kBAAkB,CAAC;AAE1B,gCAAgC;AAChC,OAAO,E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 +57,7 @@
57
57
  * `compareCodePoints` (BINARY) for a string-vs-string pair when no collation is
58
58
  * supplied. So the ORDERING paths (the isolation merge, UNIQUE enforcement, the
59
59
  * memory BTree's collation-carrying comparator) and the PK-EQUALITY-only paths
60
- * (`resolvePkSemanticEquality` in store-table.ts, the isolation layer's
60
+ * (`resolvePkSemanticEquality` in pk-key-resolution.ts, the isolation layer's
61
61
  * `getPkSemanticComparators`) all agree with these key bytes for JSON string leaves.
62
62
  *
63
63
  * ## Identity
@@ -88,9 +88,37 @@
88
88
  import { type SqlValue } from '@quereus/quereus';
89
89
  /**
90
90
  * Encode a JSON value into structural key bytes — the store's key transform for
91
- * columns declared `json` (see `storeSemanticKeyTransform` in store-table.ts).
91
+ * columns declared `json` (see `storeSemanticKeyTransform` in pk-key-resolution.ts).
92
92
  * NULL never reaches a key transform (`encodeCompositeKey` exempts it), but a
93
93
  * NESTED JSON null is a real node and encodes with its own tag.
94
94
  */
95
95
  export declare function jsonStructuralKey(value: SqlValue): SqlValue;
96
+ /**
97
+ * True when `value` has a faithful position in {@link jsonStructuralKey}'s byte order —
98
+ * the probe-side gate every re-opened seek window (range bound AND equality probe)
99
+ * consults before encoding (`semanticProbeIsKeyFaithful` in pk-key-resolution.ts, whose
100
+ * doc states how each arm degrades on `false`). Stored values never need this check:
101
+ * they are `JSON_TYPE.parse` outputs, which contain neither node kind declined here.
102
+ * Only a QUERY-supplied probe can carry one, and nothing coerces a probe to the
103
+ * column's declared type.
104
+ *
105
+ * Declines exactly two node kinds, anywhere in the value:
106
+ * - a `Uint8Array` — {@link pushJsonNode} raises `INTERNAL` for one, while the residual
107
+ * comparator (`createTypedComparator`) happily ranks it by storage class (BLOB,
108
+ * between TEXT and OBJECT). Declining degrades the arm instead of erroring, so
109
+ * `where j > x'01'` returns its rows and `where j = x'01'` its (empty) row set.
110
+ * - a `bigint` — the encoder folds it to its nearest double (lossy above 2^53), while
111
+ * `deepCompareJson`'s `jsonTypeOrder` drops a bigint into its `default:` arm at the
112
+ * OBJECT rank, so the bytes and the comparator place it in two different regions
113
+ * entirely.
114
+ *
115
+ * An unpaired surrogate in a string leaf or object key is deliberately NOT declined:
116
+ * {@link jsonStructuralKey} raises for one and must keep raising — a bound with no
117
+ * faithful byte position is refused, never silently widened or narrowed. That is the
118
+ * same rule a text PK's seek bounds already carry (lone-surrogate-keys.spec.ts).
119
+ *
120
+ * Kept beside {@link pushJsonNode} so the two node-kind switches stay visibly paired.
121
+ * Runs on probe values only — a handful per query.
122
+ */
123
+ export declare function jsonKeyEncodable(value: SqlValue): boolean;
96
124
  //# sourceMappingURL=json-key.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"json-key.d.ts","sourceRoot":"","sources":["../../../src/common/json-key.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsFG;AAEH,OAAO,EAA+C,KAAK,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAiB9F;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,QAAQ,GAAG,QAAQ,CAQ3D"}
1
+ {"version":3,"file":"json-key.d.ts","sourceRoot":"","sources":["../../../src/common/json-key.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsFG;AAEH,OAAO,EAA+C,KAAK,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAiB9F;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,QAAQ,GAAG,QAAQ,CAQ3D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAgBzD"}
@@ -57,7 +57,7 @@
57
57
  * `compareCodePoints` (BINARY) for a string-vs-string pair when no collation is
58
58
  * supplied. So the ORDERING paths (the isolation merge, UNIQUE enforcement, the
59
59
  * memory BTree's collation-carrying comparator) and the PK-EQUALITY-only paths
60
- * (`resolvePkSemanticEquality` in store-table.ts, the isolation layer's
60
+ * (`resolvePkSemanticEquality` in pk-key-resolution.ts, the isolation layer's
61
61
  * `getPkSemanticComparators`) all agree with these key bytes for JSON string leaves.
62
62
  *
63
63
  * ## Identity
@@ -100,7 +100,7 @@ const KEY_MARKER = 0x01;
100
100
  const utf8 = new TextEncoder();
101
101
  /**
102
102
  * Encode a JSON value into structural key bytes — the store's key transform for
103
- * columns declared `json` (see `storeSemanticKeyTransform` in store-table.ts).
103
+ * columns declared `json` (see `storeSemanticKeyTransform` in pk-key-resolution.ts).
104
104
  * NULL never reaches a key transform (`encodeCompositeKey` exempts it), but a
105
105
  * NESTED JSON null is a real node and encodes with its own tag.
106
106
  */
@@ -113,6 +113,53 @@ export function jsonStructuralKey(value) {
113
113
  pushJsonNode(out, value);
114
114
  return Uint8Array.from(out);
115
115
  }
116
+ /**
117
+ * True when `value` has a faithful position in {@link jsonStructuralKey}'s byte order —
118
+ * the probe-side gate every re-opened seek window (range bound AND equality probe)
119
+ * consults before encoding (`semanticProbeIsKeyFaithful` in pk-key-resolution.ts, whose
120
+ * doc states how each arm degrades on `false`). Stored values never need this check:
121
+ * they are `JSON_TYPE.parse` outputs, which contain neither node kind declined here.
122
+ * Only a QUERY-supplied probe can carry one, and nothing coerces a probe to the
123
+ * column's declared type.
124
+ *
125
+ * Declines exactly two node kinds, anywhere in the value:
126
+ * - a `Uint8Array` — {@link pushJsonNode} raises `INTERNAL` for one, while the residual
127
+ * comparator (`createTypedComparator`) happily ranks it by storage class (BLOB,
128
+ * between TEXT and OBJECT). Declining degrades the arm instead of erroring, so
129
+ * `where j > x'01'` returns its rows and `where j = x'01'` its (empty) row set.
130
+ * - a `bigint` — the encoder folds it to its nearest double (lossy above 2^53), while
131
+ * `deepCompareJson`'s `jsonTypeOrder` drops a bigint into its `default:` arm at the
132
+ * OBJECT rank, so the bytes and the comparator place it in two different regions
133
+ * entirely.
134
+ *
135
+ * An unpaired surrogate in a string leaf or object key is deliberately NOT declined:
136
+ * {@link jsonStructuralKey} raises for one and must keep raising — a bound with no
137
+ * faithful byte position is refused, never silently widened or narrowed. That is the
138
+ * same rule a text PK's seek bounds already carry (lone-surrogate-keys.spec.ts).
139
+ *
140
+ * Kept beside {@link pushJsonNode} so the two node-kind switches stay visibly paired.
141
+ * Runs on probe values only — a handful per query.
142
+ */
143
+ export function jsonKeyEncodable(value) {
144
+ if (value === null)
145
+ return true;
146
+ switch (typeof value) {
147
+ case 'boolean':
148
+ case 'number':
149
+ case 'string':
150
+ return true;
151
+ case 'bigint':
152
+ return false;
153
+ default:
154
+ break;
155
+ }
156
+ if (value instanceof Uint8Array)
157
+ return false;
158
+ if (Array.isArray(value))
159
+ return value.every(jsonKeyEncodable);
160
+ // Object keys are always strings — only the values can hold a declined node.
161
+ return Object.values(value).every(jsonKeyEncodable);
162
+ }
116
163
  /** Append `value`'s tagged, self-delimiting encoding to `out`. */
117
164
  function pushJsonNode(out, value) {
118
165
  if (value === null) {
@@ -1 +1 @@
1
- {"version":3,"file":"json-key.js","sourceRoot":"","sources":["../../../src/common/json-key.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsFG;AAEH,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,UAAU,EAAiB,MAAM,kBAAkB,CAAC;AAC9F,OAAO,EAAE,yBAAyB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAE/E,MAAM,QAAQ,GAAG,IAAI,CAAC;AACtB,MAAM,WAAW,GAAG,IAAI,CAAC;AACzB,MAAM,UAAU,GAAG,IAAI,CAAC;AACxB,MAAM,UAAU,GAAG,IAAI,CAAC;AACxB,MAAM,SA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,CAAC;QACxB,yBAAyB,CAAC,GAAG,EAAE,mBAAmB,CAAC,CAAC;QACpD,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACrB,WAAW,CAAC,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;QACnC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACtB,CAAC;IACD,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACrB,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACxB,YAAY,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;IAC/B,CAAC;AACF,CAAC;AAED;;;;GAIG;AACH,SAAS,WAAW,CAAC,GAAa,EAAE,KAAiB;IACpD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QAC1B,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;YACnB,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACtB,CAAC;aAAM,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;YAC1B,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACtB,CAAC;aAAM,CAAC;YACP,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAChB,CAAC;IACF,CAAC;AACF,CAAC"}
@@ -81,25 +81,38 @@ export declare function buildStatsKey(schemaName: string, tableName: string): Ui
81
81
  * semantic-ordering member ('PT1H' / 'PT60M') land on one key.
82
82
  */
83
83
  export declare function buildDataKey(pkValues: SqlValue[], options?: EncodeOptions, directions?: ReadonlyArray<boolean>, collations?: ReadonlyArray<string | undefined>, transforms?: ReadonlyArray<KeyValueTransform | undefined>): Uint8Array;
84
+ /**
85
+ * One half of a secondary-index key — the index-column prefix or the PK suffix.
86
+ * Each half carries its own per-column DESC `directions`, key `collations`
87
+ * (overriding `options.collation`; see {@link encodeCompositeKey}), and
88
+ * {@link KeyValueTransform}s, positionally aligned with `values`.
89
+ */
90
+ export interface IndexKeyHalf {
91
+ values: SqlValue[];
92
+ directions?: ReadonlyArray<boolean>;
93
+ collations?: ReadonlyArray<string | undefined>;
94
+ transforms?: ReadonlyArray<KeyValueTransform | undefined>;
95
+ }
84
96
  /**
85
97
  * Build a secondary index key.
86
98
  * Format: {encoded_index_cols}{encoded_pk}
87
99
  *
88
100
  * The index columns come first for range scans, followed by PK for uniqueness.
89
- * `indexDirections` and `pkDirections` independently control DESC bit-inversion
90
- * for each half so ordered index scans honor per-column direction.
101
+ * The two halves are symmetric {@link IndexKeyHalf}s:
91
102
  *
92
- * `pkCollations[i]`, when defined, encodes the PK-suffix column i under its own
93
- * key collation (overriding `options.collation`). The PK suffix MUST be encoded
94
- * with the same per-column collations as the data key (see `buildDataKey`), so
95
- * index maintenance (delete-then-insert on UPDATE/DELETE) addresses the same
96
- * bytes the data store keys by. Index columns keep `options.collation`.
97
- *
98
- * `indexTransforms` / `pkTransforms` canonicalize each half's values before
99
- * encoding (see {@link KeyValueTransform}); the PK-suffix transforms MUST match
100
- * the data key's for the same reason as the collations above.
103
+ * - `index.collations` encodes each index column under its own key collation
104
+ * (`resolveIndexKeyCollations` — the index column's COLLATE, else the table
105
+ * column's declared collation, else BINARY), so the stored bytes agree with the
106
+ * collation everything that COMPARES those values uses (`matchesFilters`, the
107
+ * planner's cover analysis, UNIQUE enforcement).
108
+ * - `pk.collations` MUST be the same per-column collations as the data key (see
109
+ * `buildDataKey` / `resolvePkKeyCollations`), so index maintenance
110
+ * (delete-then-insert on UPDATE/DELETE) addresses the same bytes the data store
111
+ * keys by.
112
+ * - Each half's `transforms` canonicalize its values before encoding; the PK
113
+ * suffix's MUST match the data key's for the same reason as its collations.
101
114
  */
102
- export declare function buildIndexKey(indexValues: SqlValue[], pkValues: SqlValue[], options?: EncodeOptions, indexDirections?: ReadonlyArray<boolean>, pkDirections?: ReadonlyArray<boolean>, pkCollations?: ReadonlyArray<string | undefined>, indexTransforms?: ReadonlyArray<KeyValueTransform | undefined>, pkTransforms?: ReadonlyArray<KeyValueTransform | undefined>): Uint8Array;
115
+ export declare function buildIndexKey(index: IndexKeyHalf, pk: IndexKeyHalf, options?: EncodeOptions): Uint8Array;
103
116
  /**
104
117
  * Build a catalog key for DDL storage.
105
118
  * Format: {schema}.{table}
@@ -201,6 +214,12 @@ export declare function buildFullScanBounds(): {
201
214
  * `directions[i] === true` flips bytes of prefix component i to match DESC
202
215
  * encoding in the stored index keys.
203
216
  *
217
+ * `collations[i]`, when defined, encodes prefix component i under its own key
218
+ * collation (overriding `options.collation`) — MUST be the same per-column index
219
+ * key collations `buildIndexKey`'s index half was written under
220
+ * (`resolveIndexKeyCollations`), or the bounds address different bytes than the
221
+ * stored entries. Same parameter order as {@link buildPkPrefixBounds}.
222
+ *
204
223
  * `lt` is omitted when the encoded prefix is all-0xff bytes (e.g. a single
205
224
  * leading DESC NULL, whose type byte inverts to 0xff) — no finite exclusive
206
225
  * upper bound exists, so the scan runs to the end of the store.
@@ -212,15 +231,16 @@ export declare function buildFullScanBounds(): {
212
231
  * for data stores.
213
232
  *
214
233
  * NOTE: all three `StoreTable` callers (`analyzeIndexAccess`, `buildIndexRangeBounds`,
215
- * `scanMultiSeek`) pass NO `transforms` — sound only because each declines a
216
- * semantic-ordering column before it gets here (the EQ-prefix loop breaks on
217
- * `hasSemanticOrdering`; the range arm is gated on `keyOrderMatchesCollation`; the
218
- * multi-seek throws INTERNAL, its plan having already been declined by
219
- * `StoreModule.tryIndexAccessPlan`). If backlog `feat-reopen-timespan-store-seeks`
220
- * re-opens any arm, thread the column's transforms through first or the bounds will
221
- * address raw-value bytes while the index holds transformed ones.
234
+ * `scanMultiSeek`) thread the index's per-column key `transforms`
235
+ * (`StoreTableScan.indexKeyTransforms`, backed by `resolveIndexKeyTransforms`), so the
236
+ * bounds address the same transformed bytes `buildIndexKey` wrote. That threading is
237
+ * load-bearing for the range arm's semantic-ordering seeks (a window over raw-value
238
+ * bytes while the index holds transformed ones under-fetches silently — a range window
239
+ * carries no residual able to resurrect a skipped row); the point and multi-seek arms
240
+ * only ever see `undefined` entries today (they still decline semantic-ordering
241
+ * prefixes), but thread uniformly so a later re-open cannot miss it.
222
242
  */
223
- export declare function buildIndexPrefixBounds(prefixValues: SqlValue[], options?: EncodeOptions, directions?: ReadonlyArray<boolean>, transforms?: ReadonlyArray<KeyValueTransform | undefined>): {
243
+ export declare function buildIndexPrefixBounds(prefixValues: SqlValue[], options?: EncodeOptions, directions?: ReadonlyArray<boolean>, collations?: ReadonlyArray<string | undefined>, transforms?: ReadonlyArray<KeyValueTransform | undefined>): {
224
244
  gte: Uint8Array;
225
245
  lt?: Uint8Array;
226
246
  };
@@ -1 +1 @@
1
- {"version":3,"file":"key-builder.d.ts","sourceRoot":"","sources":["../../../src/common/key-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAiD,KAAK,aAAa,EAAE,KAAK,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAK1H;;GAEG;AACH,eAAO,MAAM,YAAY;;;CAGf,CAAC;AAEX,mCAAmC;AACnC,eAAO,MAAM,kBAAkB,gBAAgB,CAAC;AAEhD,iCAAiC;AACjC,eAAO,MAAM,gBAAgB,cAAc,CAAC;AAgB5C;;;;;;;;;;;;;;;;;;GAkBG;AASH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAGhF;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAClC,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,GACf,MAAM,CAGR;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAEjF;AAED;;;GAGG;A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CAAC,EAAE,QAAQ,EAAE,EACzB,OAAO,CAAC,EAAE,aAAa,GACrB;IAAE,GAAG,EAAE,UAAU,CAAC;IAAC,EAAE,CAAC,EAAE,UAAU,CAAA;CAAE,CAEtC;AAED,8CAA8C;AAC9C,wBAAgB,YAAY,CAC3B,SAAS,EAAE,KAAK,GAAG,OAAO,GAAG,OAAO,EACpC,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,QAAQ,CAAC,EAAE,MAAM,GACf,UAAU,CAEZ;AAED,qDAAqD;AACrD,wBAAgB,mBAAmB,CAClC,SAAS,EAAE,KAAK,GAAG,OAAO,GAAG,OAAO,EACpC,UAAU,CAAC,EAAE,MAAM,GACjB;IAAE,GAAG,EAAE,UAAU,CAAC;IAAC,EAAE,EAAE,UAAU,CAAA;CAAE,CAErC"}
@@ -121,22 +121,23 @@ export function buildDataKey(pkValues, options, directions, collations, transfor
121
121
  * Format: {encoded_index_cols}{encoded_pk}
122
122
  *
123
123
  * The index columns come first for range scans, followed by PK for uniqueness.
124
- * `indexDirections` and `pkDirections` independently control DESC bit-inversion
125
- * for each half so ordered index scans honor per-column direction.
124
+ * The two halves are symmetric {@link IndexKeyHalf}s:
126
125
  *
127
- * `pkCollations[i]`, when defined, encodes the PK-suffix column i under its own
128
- * key collation (overriding `options.collation`). The PK suffix MUST be encoded
129
- * with the same per-column collations as the data key (see `buildDataKey`), so
130
- * index maintenance (delete-then-insert on UPDATE/DELETE) addresses the same
131
- * bytes the data store keys by. Index columns keep `options.collation`.
132
- *
133
- * `indexTransforms` / `pkTransforms` canonicalize each half's values before
134
- * encoding (see {@link KeyValueTransform}); the PK-suffix transforms MUST match
135
- * the data key's for the same reason as the collations above.
126
+ * - `index.collations` encodes each index column under its own key collation
127
+ * (`resolveIndexKeyCollations` — the index column's COLLATE, else the table
128
+ * column's declared collation, else BINARY), so the stored bytes agree with the
129
+ * collation everything that COMPARES those values uses (`matchesFilters`, the
130
+ * planner's cover analysis, UNIQUE enforcement).
131
+ * - `pk.collations` MUST be the same per-column collations as the data key (see
132
+ * `buildDataKey` / `resolvePkKeyCollations`), so index maintenance
133
+ * (delete-then-insert on UPDATE/DELETE) addresses the same bytes the data store
134
+ * keys by.
135
+ * - Each half's `transforms` canonicalize its values before encoding; the PK
136
+ * suffix's MUST match the data key's for the same reason as its collations.
136
137
  */
137
- export function buildIndexKey(indexValues, pkValues, options, indexDirections, pkDirections, pkCollations, indexTransforms, pkTransforms) {
138
- const indexEncoded = encodeCompositeKey(indexValues, options, indexDirections, undefined, indexTransforms);
139
- const pkEncoded = encodeCompositeKey(pkValues, options, pkDirections, pkCollations, pkTransforms);
138
+ export function buildIndexKey(index, pk, options) {
139
+ const indexEncoded = encodeCompositeKey(index.values, options, index.directions, index.collations, index.transforms);
140
+ const pkEncoded = encodeCompositeKey(pk.values, options, pk.directions, pk.collations, pk.transforms);
140
141
  return concatBytes(indexEncoded, pkEncoded);
141
142
  }
142
143
  /**
@@ -295,6 +296,12 @@ export function buildFullScanBounds() {
295
296
  * `directions[i] === true` flips bytes of prefix component i to match DESC
296
297
  * encoding in the stored index keys.
297
298
  *
299
+ * `collations[i]`, when defined, encodes prefix component i under its own key
300
+ * collation (overriding `options.collation`) — MUST be the same per-column index
301
+ * key collations `buildIndexKey`'s index half was written under
302
+ * (`resolveIndexKeyCollations`), or the bounds address different bytes than the
303
+ * stored entries. Same parameter order as {@link buildPkPrefixBounds}.
304
+ *
298
305
  * `lt` is omitted when the encoded prefix is all-0xff bytes (e.g. a single
299
306
  * leading DESC NULL, whose type byte inverts to 0xff) — no finite exclusive
300
307
  * upper bound exists, so the scan runs to the end of the store.
@@ -306,19 +313,20 @@ export function buildFullScanBounds() {
306
313
  * for data stores.
307
314
  *
308
315
  * NOTE: all three `StoreTable` callers (`analyzeIndexAccess`, `buildIndexRangeBounds`,
309
- * `scanMultiSeek`) pass NO `transforms` — sound only because each declines a
310
- * semantic-ordering column before it gets here (the EQ-prefix loop breaks on
311
- * `hasSemanticOrdering`; the range arm is gated on `keyOrderMatchesCollation`; the
312
- * multi-seek throws INTERNAL, its plan having already been declined by
313
- * `StoreModule.tryIndexAccessPlan`). If backlog `feat-reopen-timespan-store-seeks`
314
- * re-opens any arm, thread the column's transforms through first or the bounds will
315
- * address raw-value bytes while the index holds transformed ones.
316
+ * `scanMultiSeek`) thread the index's per-column key `transforms`
317
+ * (`StoreTableScan.indexKeyTransforms`, backed by `resolveIndexKeyTransforms`), so the
318
+ * bounds address the same transformed bytes `buildIndexKey` wrote. That threading is
319
+ * load-bearing for the range arm's semantic-ordering seeks (a window over raw-value
320
+ * bytes while the index holds transformed ones under-fetches silently — a range window
321
+ * carries no residual able to resurrect a skipped row); the point and multi-seek arms
322
+ * only ever see `undefined` entries today (they still decline semantic-ordering
323
+ * prefixes), but thread uniformly so a later re-open cannot miss it.
316
324
  */
317
- export function buildIndexPrefixBounds(prefixValues, options, directions, transforms) {
325
+ export function buildIndexPrefixBounds(prefixValues, options, directions, collations, transforms) {
318
326
  if (prefixValues.length === 0) {
319
327
  return buildFullScanBounds();
320
328
  }
321
- const prefixEncoded = encodeCompositeKey(prefixValues, options, directions, undefined, transforms);
329
+ const prefixEncoded = encodeCompositeKey(prefixValues, options, directions, collations, transforms);
322
330
  return {
323
331
  gte: prefixEncoded,
324
332
  lt: incrementLastByte(prefixEncoded),
@@ -1 +1 @@
1
- {"version":3,"file":"key-builder.js","sourceRoot":"","sources":["../../../src/common/key-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,kBAAkB,EAAE,yBAAyB,EAA8C,MAAM,eAAe,CAAC;AAE1H,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;AAClC,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;AAElC;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC3B,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,QAAQ;CACN,CAAC;AAEX,mCAAmC;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