|
| 1 | +--- |
| 2 | +'@cipherstash/stack': minor |
| 3 | +--- |
| 4 | + |
| 5 | +Restore the EQL v3 envelope and `Result` types the adapters were erasing. |
| 6 | + |
| 7 | +Both v3 adapters typed their operand-encryption paths as `unknown` and dropped |
| 8 | +the `Result` wrapper, so the query-type encoding and the failure channel were |
| 9 | +invisible to the type system: |
| 10 | + |
| 11 | +- `eql/v3/drizzle/operators.ts` typed the client's `encrypt`/`bulkEncrypt` as |
| 12 | + returning `unknown`, collapsed the operation's `Result` to |
| 13 | + `{ data?: unknown; failure?: { message } }`, and cast the bulk response to |
| 14 | + `Array<{ data: unknown }>`. |
| 15 | +- `supabase/query-builder-v3.ts` returned `Promise<unknown[]>` from |
| 16 | + `encryptCollectedTerms`, `bulkEncryptGroup` and `encryptGroupPerTerm`, and the |
| 17 | + base `query-builder.ts` did the same. |
| 18 | + |
| 19 | +These now carry the SDK's real types — `Encrypted` (the storage envelope union, |
| 20 | +which includes every v3 per-domain payload), `BulkEncryptedData`, and |
| 21 | +`EncryptedQueryResult` — threaded through a properly-typed operation surface that |
| 22 | +resolves `Result<T, EncryptionError>`. The Supabase divergence the erasure hid is |
| 23 | +now explicit: the v2 path yields `encryptQuery` composite literals and the v3 |
| 24 | +path yields `JSON.stringify`'d envelope strings, and both are `EncryptedQueryResult`. |
| 25 | + |
| 26 | +Bumped `minor`, not `patch`: `createEncryptionOperatorsV3` is a public export |
| 27 | +(`@cipherstash/stack/eql/v3/drizzle`), and tightening its client contract from |
| 28 | +`unknown` to a typed operation surface is a compile-time breaking change — a |
| 29 | +downstream consumer passing a loosely-typed (`unknown`-returning) client double |
| 30 | +will now fail `tsc`. That tightening has teeth: `operators.test-d.ts` pins it |
| 31 | +with a negative type-test asserting an `unknown`-returning `{ encrypt }` double |
| 32 | +is rejected (a positive "correctly-typed double is accepted" assertion cannot |
| 33 | +catch a re-erasure, since a correct value is assignable to `unknown`). |
| 34 | + |
| 35 | +Behaviour is otherwise unchanged, with one addition: the Supabase v3 bulk path |
| 36 | +now rejects a `null` envelope returned by `bulkEncrypt` (the restored |
| 37 | +`Encrypted | null` type makes that arm reachable, and a `null` would otherwise |
| 38 | +be `JSON.stringify`'d to the literal `"null"` and sent as a filter operand). |
0 commit comments