refactor(stack): EQL v3 types namespace on @cipherstash/stack/eql/v3#541
refactor(stack): EQL v3 types namespace on @cipherstash/stack/eql/v3#541tobyhede wants to merge 6 commits into
types namespace on @cipherstash/stack/eql/v3#541Conversation
|
| Name | Type |
|---|---|
| @cipherstash/stack | Minor |
| @cipherstash/bench | Patch |
| @cipherstash/prisma-next | Patch |
| @cipherstash/basic-example | Patch |
| @cipherstash/prisma-next-example | Patch |
| @cipherstash/e2e | Patch |
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Replace the 35 verbose `encrypted<Domain>Column` factories with a single `types` namespace whose members mirror the underlying `eql_v3.<name>` domains 1:1 (`types.TextEq`, `types.Int4Ord`, `types.Timestamptz`, …), and split the 992-line `src/schema/v3/index.ts` into a cohesive module under `src/eql/v3/` (`columns.ts`, `types.ts`, `table.ts`, curated `index.ts`). The authoring subpath is renamed `@cipherstash/stack/schema/v3` -> `@cipherstash/stack/eql/v3`; the `./v3` typed-client surface now re-exports the `types` namespace instead of the standalone factories. Behaviour is preserved: same classes, same nominal-typing mechanism, same `build()` output. - Rewire tsup entry, package.json exports/typesVersions/analyze:complexity, the `@/eql/v3` re-export, `[eql/v3]` error prefix, and fta-v3.yml paths. - Migrate all v3 tests + CJS smoke test to `types.*` and the new subpath. - Reconcile the three unreleased changesets and refresh tracked v3 design docs (supersede banners on completed-work records; correct the not-yet-built Stryker gate spec's single-file premise for the 4-file split). Verified: build emits dist/eql/v3; schema/v3 subpath and factories are gone (ERR_PACKAGE_PATH_NOT_EXPORTED, undefined on both subpaths); 101 v3 runtime + 50 type tests pass; FTA scores all 4 files (max 68.68 < 72); e2e authoring config byte-matches expected.
Two JS properties whose builders resolve to the same DB name (getName()) silently overwrote in the built config — the later column won and the first's config was dropped. Throw instead, matching the existing duplicate-tableName guard in buildEncryptConfig and the reserved-key guard in encryptedTable. Regression tests: `EncryptedTable.build()` and `buildEncryptConfig` both throw on a duplicate DB name (schema-v3.test.ts, eql_v3 encryptedTable block).
The structural builder contracts (BuildableColumn, BuildableQueryColumn, BuildableV3QueryableColumn, BuildableTable, BuildableTableColumns) and the encryptModel/bulkEncryptModels return-type mapper (EncryptedFromBuildableTable) appear in public return positions but were not re-exported from `@cipherstash/stack/types`, so consumers could not name them — an inconsistency with the already-exposed `EncryptedFromSchema`. No build breakage (the mapped types were emitted inline); this closes the nameability gap. Regression guard: types-public-surface.test-d.ts imports each contract from the public `@/types-public` entrypoint (a missing re-export fails typecheck). Note: these types are inherited from the base branch (feat/eql-v3-text-search-schema, PR #535); the export is added here in response to review feedback on the stacked PR.
The v3-matrix domain suite (catalog.ts + matrix tests) landed on the base branch via PR #540 after this branch was cut, and used the pre-refactor `@/schema/v3` path and `encrypted<Domain>Column` factories. Retarget it to `@/eql/v3` and the `types.*` namespace so the base's matrix coverage keeps working on top of the refactor. `EqlTypeForColumn` (which #540's catalog.ts consumes) is preserved — ported into eql/v3/columns.ts and re-exported from the barrel during the rebase. Post-rebase reconciliation only; no behavior change.
b98ad89 to
2a078b8
Compare
Refactors the EQL v3 authoring surface: the per-domain
encrypted<Domain>Columnfactories become a singletypesnamespace whose members mirror the underlyingeql_v3.<name>domains, on the renamed@cipherstash/stack/eql/v3subpath.Before → after — the name maps 1:1 to the EQL v3 domain:
Per-domain plaintext inference and compile-time queryability are unchanged:
The
@cipherstash/stack/v3typed client re-exportstypes(in place of the standalone builders):typesmembersOne member per generated EQL v3 domain (PascalCase of the
eql_v3.<name>):Int4Int4EqInt4OrdOreInt4Ord·Int2*·Date*·Timestamptz*·Numeric*·TextTextEqTextMatchTextOrdOreTextOrdTextSearch·Bool·Float4*Float8*(int8/bigint still omitted pending lossless FFI I/O). Each returns its concrete branded class, so per-column inference stays precise.Scope
schema/v3/index.tsintosrc/eql/v3/{columns,types,table,index}.ts.schema/v3→eql/v3(exports, tsup entry, FTA gate,./v3re-export); the old subpath and the standalone factories are removed.build()output (text_searchstays byte-identical).Verified:
schema/v3no longer resolves (ERR_PACKAGE_PATH_NOT_EXPORTED) and factories areundefinedon both subpaths; 101 v3 runtime + 50 type tests pass; FTA scores all 4 files (max 68.68 < 72). Stacked on #535.