@cipherstash/stack 0.16.0 → 0.19.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.
- package/CHANGELOG.md +225 -0
- package/README.md +2 -2
- package/dist/{chunk-CY5B4LIF.js → chunk-36AA7IBJ.js} +303 -204
- package/dist/chunk-36AA7IBJ.js.map +1 -0
- package/dist/{chunk-MD6742R6.js → chunk-4AVL4VZD.js} +1 -1
- package/dist/chunk-4AVL4VZD.js.map +1 -0
- package/dist/{chunk-4RNBI3UH.js → chunk-BNO32ZMV.js} +1 -1
- package/dist/chunk-BNO32ZMV.js.map +1 -0
- package/dist/{chunk-6FD7OBGM.js → chunk-HQANMV7R.js} +3 -3
- package/dist/chunk-HQANMV7R.js.map +1 -0
- package/dist/chunk-IADZCZEA.js +23 -0
- package/dist/chunk-IADZCZEA.js.map +1 -0
- package/dist/chunk-IBSK6P33.js +209 -0
- package/dist/chunk-IBSK6P33.js.map +1 -0
- package/dist/chunk-JSG2AMDI.js +17 -0
- package/dist/chunk-JSG2AMDI.js.map +1 -0
- package/dist/chunk-MP3SSDNN.js +4439 -0
- package/dist/chunk-MP3SSDNN.js.map +1 -0
- package/dist/chunk-OFQ555AX.js +191 -0
- package/dist/chunk-OFQ555AX.js.map +1 -0
- package/dist/chunk-PZ5AY32C.js +10 -0
- package/dist/chunk-PZ5AY32C.js.map +1 -0
- package/dist/chunk-U66S7VIF.js +435 -0
- package/dist/chunk-U66S7VIF.js.map +1 -0
- package/dist/{client-C_7TF8EL.d.cts → client-DSGHBN-g.d.cts} +209 -72
- package/dist/{client-BLbA6aFD.d.ts → client-DfCrlHXh.d.ts} +209 -72
- package/dist/client.cjs +4103 -43
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +5 -5
- package/dist/client.d.ts +5 -5
- package/dist/client.js +3 -1
- package/dist/drizzle/index.cjs +4139 -77
- package/dist/drizzle/index.cjs.map +1 -1
- package/dist/drizzle/index.d.cts +33 -33
- package/dist/drizzle/index.d.ts +33 -33
- package/dist/drizzle/index.js +39 -33
- package/dist/drizzle/index.js.map +1 -1
- package/dist/dynamodb/index.cjs +31 -14
- package/dist/dynamodb/index.cjs.map +1 -1
- package/dist/dynamodb/index.d.cts +12 -12
- package/dist/dynamodb/index.d.ts +12 -12
- package/dist/dynamodb/index.js +16 -12
- package/dist/dynamodb/index.js.map +1 -1
- package/dist/encryption/index.cjs +4611 -257
- package/dist/encryption/index.cjs.map +1 -1
- package/dist/encryption/index.d.cts +3 -3
- package/dist/encryption/index.d.ts +3 -3
- package/dist/encryption/index.js +35 -7
- package/dist/encryption/v3.cjs +7791 -0
- package/dist/encryption/v3.cjs.map +1 -0
- package/dist/encryption/v3.d.cts +100 -0
- package/dist/encryption/v3.d.ts +100 -0
- package/dist/encryption/v3.js +161 -0
- package/dist/encryption/v3.js.map +1 -0
- package/dist/eql/v3/index.cjs +612 -0
- package/dist/eql/v3/index.cjs.map +1 -0
- package/dist/eql/v3/index.d.cts +71 -0
- package/dist/eql/v3/index.d.ts +71 -0
- package/dist/eql/v3/index.js +89 -0
- package/dist/eql/v3/index.js.map +1 -0
- package/dist/errors/index.js +1 -0
- package/dist/identity/index.cjs +55 -35
- package/dist/identity/index.cjs.map +1 -1
- package/dist/identity/index.d.cts +54 -30
- package/dist/identity/index.d.ts +54 -30
- package/dist/identity/index.js +9 -177
- package/dist/identity/index.js.map +1 -1
- package/dist/index.cjs +4625 -273
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -7
- package/dist/index.d.ts +18 -7
- package/dist/index.js +20 -5
- package/dist/index.js.map +1 -1
- package/dist/schema/index.cjs +4108 -44
- package/dist/schema/index.cjs.map +1 -1
- package/dist/schema/index.d.cts +1 -1
- package/dist/schema/index.d.ts +1 -1
- package/dist/schema/index.js +3 -1
- package/dist/supabase/index.cjs +4500 -75
- package/dist/supabase/index.cjs.map +1 -1
- package/dist/supabase/index.d.cts +113 -34
- package/dist/supabase/index.d.ts +113 -34
- package/dist/supabase/index.js +350 -32
- package/dist/supabase/index.js.map +1 -1
- package/dist/table-CIH7jZ2h.d.ts +603 -0
- package/dist/table-DihEAlxG.d.cts +603 -0
- package/dist/{types-public-Dv-r6Ik0.d.ts → types-public-CpS5KjwX.d.cts} +209 -36
- package/dist/{types-public-Dv-r6Ik0.d.cts → types-public-CpS5KjwX.d.ts} +209 -36
- package/dist/types-public.cjs.map +1 -1
- package/dist/types-public.d.cts +2 -2
- package/dist/types-public.d.ts +2 -2
- package/dist/types-public.js +2 -1
- package/dist/wasm-inline.d.ts +1269 -0
- package/dist/wasm-inline.js +4594 -0
- package/dist/wasm-inline.js.map +1 -0
- package/package.json +63 -13
- package/dist/chunk-4RNBI3UH.js.map +0 -1
- package/dist/chunk-6FD7OBGM.js.map +0 -1
- package/dist/chunk-CY5B4LIF.js.map +0 -1
- package/dist/chunk-JDZ2QUUF.js +0 -381
- package/dist/chunk-JDZ2QUUF.js.map +0 -1
- package/dist/chunk-MD6742R6.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { JsPlaintext, EncryptedPayload, newClient, EncryptedQuery as EncryptedQuery$1, EncryptedV3Query, AuthStrategy, Encrypted as Encrypted$1 } from '@cipherstash/protect-ffi';
|
|
1
2
|
import { z } from 'zod';
|
|
2
|
-
import { Encrypted as Encrypted$1, newClient, JsPlaintext } from '@cipherstash/protect-ffi';
|
|
3
3
|
|
|
4
4
|
/** Brand symbol for nominal typing */
|
|
5
5
|
declare const __brand: unique symbol;
|
|
@@ -10,8 +10,44 @@ type Brand<T, B extends string> = T & {
|
|
|
10
10
|
type Client = Awaited<ReturnType<typeof newClient>> | undefined;
|
|
11
11
|
/** A branded type representing encrypted data. Cannot be accidentally used as plaintext. */
|
|
12
12
|
type EncryptedValue = Brand<Encrypted$1, 'encrypted'>;
|
|
13
|
-
/** Structural type representing encrypted data
|
|
14
|
-
|
|
13
|
+
/** Structural type representing encrypted data stored in the database. Always
|
|
14
|
+
* carries a ciphertext. Covers BOTH wire formats: the EQL v2.3 payloads
|
|
15
|
+
* (`k: "ct"` / `k: "sv"`) and the EQL v3 payloads (flat `{v: 3, i, c, …}`
|
|
16
|
+
* scalars and `{v: 3, k: "sv", i, sv}` SteVec documents). Which format
|
|
17
|
+
* `encrypt` produces is selected by the client's
|
|
18
|
+
* {@link ClientConfig.eqlVersion}; `decrypt` accepts both regardless.
|
|
19
|
+
* v3 scalars carry no `k` discriminator, so narrow with `'k' in payload`
|
|
20
|
+
* before reading it. See also `EncryptedValue` for branded nominal typing,
|
|
21
|
+
* and {@link EncryptedQuery} for the search-term shape returned by
|
|
22
|
+
* `encryptQuery`. */
|
|
23
|
+
type Encrypted = EncryptedPayload;
|
|
24
|
+
/** Structural type representing an encrypted query term (search needle)
|
|
25
|
+
* returned by `encryptQuery` / `encryptQueryBulk` for scalar
|
|
26
|
+
* (`unique` / `match` / `ore`) lookups and `ste_vec_selector` JSON path
|
|
27
|
+
* queries, plus — under `eqlVersion: 3` — the `eql_v3.jsonb_query`
|
|
28
|
+
* containment needle. Carries no ciphertext — matched against stored
|
|
29
|
+
* values, never decrypted. v2 JSON containment queries (`ste_vec_term`)
|
|
30
|
+
* return a storage-shaped {@link Encrypted} payload instead. */
|
|
31
|
+
type EncryptedQuery = EncryptedQuery$1 | EncryptedV3Query;
|
|
32
|
+
/**
|
|
33
|
+
* Plaintext values the SDK accepts for encryption.
|
|
34
|
+
*
|
|
35
|
+
* Widens the FFI's `JsPlaintext` (`string | number | boolean |
|
|
36
|
+
* Record<string, unknown> | JsPlaintext[]`) with `Date`. `Date` is a supported
|
|
37
|
+
* cast target that is omitted from the FFI's `JsPlaintext` INPUT union, but it
|
|
38
|
+
* serializes at the boundary via `toJSON` (ISO string), so it is accepted on the
|
|
39
|
+
* way in.
|
|
40
|
+
*
|
|
41
|
+
* `bigint` is intentionally NOT included: the native `@cipherstash/protect-ffi`
|
|
42
|
+
* build cannot marshal a JS `bigint` (V8 throws "Do not know how to serialize a
|
|
43
|
+
* BigInt") and rejects a `string` for a `big_int` column. The v3 int8 domains
|
|
44
|
+
* are therefore omitted from the SDK entirely (see `eql/v3`) until the FFI
|
|
45
|
+
* supports lossless bigint I/O; `bigint` returns here alongside them.
|
|
46
|
+
*
|
|
47
|
+
* When the upstream FFI `JsPlaintext` is corrected to include `Date`, the `Date`
|
|
48
|
+
* arm can collapse back into `JsPlaintext`.
|
|
49
|
+
*/
|
|
50
|
+
type Plaintext = JsPlaintext | Date;
|
|
15
51
|
type KeysetIdentifier = {
|
|
16
52
|
name: string;
|
|
17
53
|
} | {
|
|
@@ -46,15 +82,146 @@ type ClientConfig = {
|
|
|
46
82
|
* An optional keyset identifier for multi-tenant encryption.
|
|
47
83
|
* Each keyset provides cryptographic isolation, giving each tenant its own keyspace.
|
|
48
84
|
* Specify by name (`{ name: "tenant-a" }`) or UUID (`{ id: "..." }`).
|
|
49
|
-
* Keysets are created and managed in the
|
|
85
|
+
* Keysets are created and managed in the
|
|
86
|
+
* [dashboard](https://dashboard.cipherstash.com/workspaces/_/keysets); omit to
|
|
87
|
+
* use the workspace's default keyset. A client is bound to one keyset for its
|
|
88
|
+
* lifetime, so use one client per tenant.
|
|
89
|
+
*
|
|
90
|
+
* @see {@link Encryption} for the full keysets walkthrough.
|
|
50
91
|
*/
|
|
51
92
|
keyset?: KeysetIdentifier;
|
|
93
|
+
/**
|
|
94
|
+
* An optional authentication strategy for ZeroKMS requests, from
|
|
95
|
+
* `@cipherstash/auth` (re-exported by `@cipherstash/stack`). When provided,
|
|
96
|
+
* its `getToken()` is invoked on every ZeroKMS request and takes precedence
|
|
97
|
+
* over the default `auto` strategy (the `clientKey` is still required for
|
|
98
|
+
* encryption). Use:
|
|
99
|
+
*
|
|
100
|
+
* - `OidcFederationStrategy` for per-user, identity-bound encryption —
|
|
101
|
+
* federates an end user's OIDC JWT into a CTS service token, so requests
|
|
102
|
+
* authenticate as that user. Pair with `.withLockContext({ identityClaim })`
|
|
103
|
+
* to bind the data key to a claim. This replaces the older
|
|
104
|
+
* `LockContext.identify()` ceremony.
|
|
105
|
+
* - `AccessKeyStrategy` for service-to-service / CI, or any custom
|
|
106
|
+
* `{ getToken() }` object for bespoke token acquisition / caching.
|
|
107
|
+
*
|
|
108
|
+
* Leave unset to use the default `auto` strategy, which reads credentials
|
|
109
|
+
* from the `CS_*` environment variables and falls back to the local dev
|
|
110
|
+
* profile created by `npx stash auth login`.
|
|
111
|
+
*
|
|
112
|
+
* @see {@link AuthStrategy}
|
|
113
|
+
* @see {@link Encryption} for a full walkthrough of the authentication options.
|
|
114
|
+
*/
|
|
115
|
+
authStrategy?: AuthStrategy;
|
|
116
|
+
/**
|
|
117
|
+
* @deprecated Renamed to {@link ClientConfig.authStrategy}. Still honoured for
|
|
118
|
+
* backwards compatibility — passing it logs a deprecation warning at runtime —
|
|
119
|
+
* but it will be removed in a future release. Set `authStrategy` instead.
|
|
120
|
+
*/
|
|
121
|
+
strategy?: AuthStrategy;
|
|
122
|
+
/**
|
|
123
|
+
* The EQL wire version the client emits — one FFI client always emits
|
|
124
|
+
* exactly one wire format.
|
|
125
|
+
*
|
|
126
|
+
* - `2` (the protect-ffi default): payloads target the
|
|
127
|
+
* `eql_v2_encrypted` column type.
|
|
128
|
+
* - `3`: payloads target the per-capability `eql_v3` domains
|
|
129
|
+
* (`eql_v3.text_eq`, `eql_v3.integer_ord_ore`, `eql_v3.json`, …),
|
|
130
|
+
* derived from each column's `cast_as` and indexes.
|
|
131
|
+
*
|
|
132
|
+
* When omitted, {@link Encryption} auto-detects from the schema set:
|
|
133
|
+
* EQL v3 tables (from `@cipherstash/stack/v3`, marked by
|
|
134
|
+
* `buildColumnKeyMap()`) select `3`; v2 tables leave the FFI default
|
|
135
|
+
* (`2`) untouched. Mixing v2 and v3 tables in one client is an error —
|
|
136
|
+
* split them across two clients instead.
|
|
137
|
+
*
|
|
138
|
+
* `decrypt` accepts BOTH formats regardless of this setting, so v2 and
|
|
139
|
+
* v3 data can coexist during a migration.
|
|
140
|
+
*
|
|
141
|
+
* v3 limitation (protect-ffi 0.27): `encryptQuery` supports only JSON
|
|
142
|
+
* containment queries — scalar-index and selector queries throw
|
|
143
|
+
* `EQL_V3_QUERY_UNSUPPORTED` until a v3 scalar query wire shape exists.
|
|
144
|
+
*/
|
|
145
|
+
eqlVersion?: 2 | 3;
|
|
52
146
|
};
|
|
53
147
|
type AtLeastOneCsTable<T> = [T, ...T[]];
|
|
148
|
+
/** Structural contract for a column builder the client can consume for STORAGE
|
|
149
|
+
* (`encrypt`). Satisfied by v2 `EncryptedColumn` / `EncryptedField` AND v3
|
|
150
|
+
* `EncryptedTextSearchColumn` — fields ARE encryptable, so this stays wide. */
|
|
151
|
+
interface BuildableColumn {
|
|
152
|
+
getName(): string;
|
|
153
|
+
build(): ColumnSchema;
|
|
154
|
+
}
|
|
155
|
+
/** Structural contract for a column the client can consume for QUERIES
|
|
156
|
+
* (`encryptQuery` / search terms). Narrower than `BuildableColumn`: it must
|
|
157
|
+
* EXCLUDE non-queryable `EncryptedField` (a field has no indexes). A v2
|
|
158
|
+
* `EncryptedColumn` qualifies via the nominal arm; a v3 queryable concrete
|
|
159
|
+
* type qualifies via the `getEqlType()` structural arm; `EncryptedField` (no
|
|
160
|
+
* `getEqlType`, not an `EncryptedColumn`) is rejected. */
|
|
161
|
+
interface BuildableV3QueryableColumn extends BuildableColumn {
|
|
162
|
+
getEqlType(): string;
|
|
163
|
+
getQueryCapabilities(): {
|
|
164
|
+
equality: boolean;
|
|
165
|
+
orderAndRange: boolean;
|
|
166
|
+
freeTextSearch: boolean;
|
|
167
|
+
};
|
|
168
|
+
isQueryable(): true;
|
|
169
|
+
}
|
|
170
|
+
type BuildableQueryColumn = EncryptedColumn | BuildableV3QueryableColumn;
|
|
171
|
+
/** Structural contract for a table builder the client can consume. Satisfied by
|
|
172
|
+
* v2 and v3 `EncryptedTable` alike. */
|
|
173
|
+
interface BuildableTable {
|
|
174
|
+
tableName: string;
|
|
175
|
+
build(): {
|
|
176
|
+
tableName: string;
|
|
177
|
+
columns: Record<string, ColumnSchema>;
|
|
178
|
+
};
|
|
179
|
+
/**
|
|
180
|
+
* Optional map from a model field's JS property name to its encrypt-config
|
|
181
|
+
* column name (the DB name). Present when the two can differ — v3 tables key
|
|
182
|
+
* their config by DB name (`column.getName()`) while models are written with
|
|
183
|
+
* JS property keys, so the model path must match by property but address the
|
|
184
|
+
* FFI/config by DB name.
|
|
185
|
+
*
|
|
186
|
+
* Absent on v2 tables, whose `build()` already keys columns by the JS property
|
|
187
|
+
* name; the model path then matches and addresses by that same key.
|
|
188
|
+
*/
|
|
189
|
+
buildColumnKeyMap?(): Record<string, string>;
|
|
190
|
+
}
|
|
54
191
|
type EncryptionClientConfig = {
|
|
55
|
-
schemas: AtLeastOneCsTable<
|
|
192
|
+
schemas: AtLeastOneCsTable<BuildableTable>;
|
|
56
193
|
config?: ClientConfig;
|
|
57
194
|
};
|
|
195
|
+
/**
|
|
196
|
+
* The literal column map of a buildable table, read from its type-level
|
|
197
|
+
* `_columnType` brand. Both v2 and v3 `EncryptedTable` carry this brand, so this
|
|
198
|
+
* recovers the literal column keys structurally.
|
|
199
|
+
*
|
|
200
|
+
* This deliberately uses the `_columnType` brand rather than `build().columns`:
|
|
201
|
+
* `BuildableTable.build()` is typed to return `Record<string, ColumnSchema>`,
|
|
202
|
+
* which erases the literal keys and would mark EVERY model field as encrypted.
|
|
203
|
+
*
|
|
204
|
+
* The fallbacks resolve to `Record<never, never>` (a no-key type), NOT `never`:
|
|
205
|
+
* a value typed as the bare structural `BuildableTable` carries no `_columnType`
|
|
206
|
+
* brand, and `keyof never` is `string | number | symbol` — which would wrongly
|
|
207
|
+
* mark EVERY model field as encrypted. `keyof Record<never, never>` is `never`,
|
|
208
|
+
* so `EncryptedFromBuildableTable` degrades gracefully to the model unchanged.
|
|
209
|
+
*/
|
|
210
|
+
type BuildableTableColumns<T extends BuildableTable> = T extends {
|
|
211
|
+
readonly _columnType: infer C;
|
|
212
|
+
} ? C extends Record<string, unknown> ? C : Record<never, never> : Record<never, never>;
|
|
213
|
+
/**
|
|
214
|
+
* Maps a plaintext model type to its encrypted form using a buildable table.
|
|
215
|
+
*
|
|
216
|
+
* Fields whose keys match a column defined in `Table` (via its `_columnType`
|
|
217
|
+
* brand) become `Encrypted` (`Encrypted | null` when the source field is
|
|
218
|
+
* nullable); all other fields retain their original types from `T`. Works for
|
|
219
|
+
* both v2 and v3 tables. See {@link EncryptedFromSchema} for the v2-specific
|
|
220
|
+
* variant retained for backward compatibility.
|
|
221
|
+
*/
|
|
222
|
+
type EncryptedFromBuildableTable<T, Table extends BuildableTable> = {
|
|
223
|
+
[K in keyof T]: [K] extends [keyof BuildableTableColumns<Table>] ? null extends T[K] ? Encrypted | null : Encrypted : T[K];
|
|
224
|
+
};
|
|
58
225
|
/**
|
|
59
226
|
* Options for single-value encrypt operations.
|
|
60
227
|
* Use a column from your table schema (from {@link encryptedColumn}) or a nested
|
|
@@ -62,21 +229,26 @@ type EncryptionClientConfig = {
|
|
|
62
229
|
*/
|
|
63
230
|
type EncryptOptions = {
|
|
64
231
|
/** The column or nested field to encrypt into. From {@link EncryptedColumn} or {@link EncryptedField}. */
|
|
65
|
-
column:
|
|
66
|
-
table:
|
|
232
|
+
column: BuildableColumn;
|
|
233
|
+
table: BuildableTable;
|
|
67
234
|
};
|
|
68
235
|
/** Format for encrypted query/search term return values */
|
|
69
236
|
type EncryptedReturnType = 'eql' | 'composite-literal' | 'escaped-composite-literal';
|
|
70
237
|
type SearchTerm = {
|
|
71
|
-
value:
|
|
72
|
-
column:
|
|
73
|
-
table:
|
|
238
|
+
value: Plaintext;
|
|
239
|
+
column: BuildableQueryColumn;
|
|
240
|
+
table: BuildableTable;
|
|
74
241
|
returnType?: EncryptedReturnType;
|
|
75
242
|
};
|
|
76
|
-
/** Encrypted search term result
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
243
|
+
/** Encrypted search term result. `eql` return type yields either a storage
|
|
244
|
+
* payload (`Encrypted`, for `ste_vec_term`) or a query-only term
|
|
245
|
+
* (`EncryptedQuery`, for scalar lookups and `ste_vec_selector`); the
|
|
246
|
+
* `composite-literal` return types yield a string. */
|
|
247
|
+
type EncryptedSearchTerm = Encrypted | EncryptedQuery | string;
|
|
248
|
+
/** Result of encryptQuery (single or batch). `eql` return type yields either a
|
|
249
|
+
* storage payload (`Encrypted`) or a query-only term (`EncryptedQuery`); the
|
|
250
|
+
* `composite-literal` return types yield a string. */
|
|
251
|
+
type EncryptedQueryResult = Encrypted | EncryptedQuery | string | null;
|
|
80
252
|
type EncryptedFields<T> = {
|
|
81
253
|
[K in keyof T as NonNullable<T[K]> extends Encrypted ? K : never]: T[K];
|
|
82
254
|
};
|
|
@@ -114,17 +286,17 @@ type EncryptedFromSchema<T, S extends EncryptedTableColumn> = {
|
|
|
114
286
|
};
|
|
115
287
|
type BulkEncryptPayload = Array<{
|
|
116
288
|
id?: string;
|
|
117
|
-
plaintext:
|
|
289
|
+
plaintext: Plaintext | null;
|
|
118
290
|
}>;
|
|
119
291
|
type BulkEncryptedData = Array<{
|
|
120
292
|
id?: string;
|
|
121
|
-
data: Encrypted;
|
|
293
|
+
data: Encrypted | null;
|
|
122
294
|
}>;
|
|
123
295
|
type BulkDecryptPayload = Array<{
|
|
124
296
|
id?: string;
|
|
125
|
-
data: Encrypted;
|
|
297
|
+
data: Encrypted | null;
|
|
126
298
|
}>;
|
|
127
|
-
type BulkDecryptedData = Array<DecryptionResult<JsPlaintext>>;
|
|
299
|
+
type BulkDecryptedData = Array<DecryptionResult<JsPlaintext | null>>;
|
|
128
300
|
type DecryptionSuccess<T> = {
|
|
129
301
|
error?: never;
|
|
130
302
|
data: T;
|
|
@@ -162,14 +334,14 @@ declare const queryTypes: {
|
|
|
162
334
|
};
|
|
163
335
|
/** @internal */
|
|
164
336
|
type QueryTermBase = {
|
|
165
|
-
column:
|
|
166
|
-
table:
|
|
337
|
+
column: BuildableQueryColumn;
|
|
338
|
+
table: BuildableTable;
|
|
167
339
|
queryType?: QueryTypeName;
|
|
168
340
|
returnType?: EncryptedReturnType;
|
|
169
341
|
};
|
|
170
342
|
type EncryptQueryOptions = QueryTermBase;
|
|
171
343
|
type ScalarQueryTerm = QueryTermBase & {
|
|
172
|
-
value:
|
|
344
|
+
value: Plaintext;
|
|
173
345
|
};
|
|
174
346
|
|
|
175
347
|
/**
|
|
@@ -179,6 +351,7 @@ type ScalarQueryTerm = QueryTermBase & {
|
|
|
179
351
|
* - `"bigint"`
|
|
180
352
|
* - `"boolean"`
|
|
181
353
|
* - `"date"`
|
|
354
|
+
* - `"timestamp"`
|
|
182
355
|
* - `"number"`
|
|
183
356
|
* - `"string"`
|
|
184
357
|
* - `"json"`
|
|
@@ -194,11 +367,11 @@ type ScalarQueryTerm = QueryTermBase & {
|
|
|
194
367
|
* EQL cast types — the PostgreSQL-aligned types that EQL actually accepts.
|
|
195
368
|
* These are stored in the `cast_as` field of the EncryptConfig.
|
|
196
369
|
*/
|
|
197
|
-
declare const eqlCastAsEnum: z.ZodDefault<z.ZodEnum<["text", "int", "small_int", "big_int", "real", "double", "boolean", "date", "jsonb"]>>;
|
|
370
|
+
declare const eqlCastAsEnum: z.ZodDefault<z.ZodEnum<["text", "int", "small_int", "big_int", "real", "double", "boolean", "date", "timestamp", "jsonb"]>>;
|
|
198
371
|
/**
|
|
199
372
|
* SDK-facing data types — developer-friendly aliases accepted by `dataType()`.
|
|
200
373
|
*/
|
|
201
|
-
declare const castAsEnum: z.ZodDefault<z.ZodEnum<["bigint", "boolean", "date", "number", "string", "json", "text"]>>;
|
|
374
|
+
declare const castAsEnum: z.ZodDefault<z.ZodEnum<["bigint", "boolean", "date", "timestamp", "number", "string", "json", "text"]>>;
|
|
202
375
|
/**
|
|
203
376
|
* Map SDK-facing data types to EQL `cast_as` values.
|
|
204
377
|
*
|
|
@@ -316,7 +489,7 @@ declare const steVecIndexOptsSchema: z.ZodObject<{
|
|
|
316
489
|
} | undefined;
|
|
317
490
|
}>;
|
|
318
491
|
declare const columnSchema: z.ZodDefault<z.ZodObject<{
|
|
319
|
-
cast_as: z.ZodDefault<z.ZodEnum<["bigint", "boolean", "date", "number", "string", "json", "text"]>>;
|
|
492
|
+
cast_as: z.ZodDefault<z.ZodEnum<["bigint", "boolean", "date", "timestamp", "number", "string", "json", "text"]>>;
|
|
320
493
|
indexes: z.ZodDefault<z.ZodObject<{
|
|
321
494
|
ore: z.ZodOptional<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>>;
|
|
322
495
|
unique: z.ZodOptional<z.ZodObject<{
|
|
@@ -480,7 +653,7 @@ declare const columnSchema: z.ZodDefault<z.ZodObject<{
|
|
|
480
653
|
} | undefined;
|
|
481
654
|
}>>;
|
|
482
655
|
}, "strip", z.ZodTypeAny, {
|
|
483
|
-
cast_as: "string" | "number" | "bigint" | "boolean" | "
|
|
656
|
+
cast_as: "string" | "number" | "bigint" | "boolean" | "date" | "timestamp" | "json" | "text";
|
|
484
657
|
indexes: {
|
|
485
658
|
match?: {
|
|
486
659
|
token_filters?: {
|
|
@@ -512,7 +685,7 @@ declare const columnSchema: z.ZodDefault<z.ZodObject<{
|
|
|
512
685
|
} | undefined;
|
|
513
686
|
};
|
|
514
687
|
}, {
|
|
515
|
-
cast_as?: "string" | "number" | "bigint" | "boolean" | "
|
|
688
|
+
cast_as?: "string" | "number" | "bigint" | "boolean" | "date" | "timestamp" | "json" | "text" | undefined;
|
|
516
689
|
indexes?: {
|
|
517
690
|
match?: {
|
|
518
691
|
token_filters?: {
|
|
@@ -548,7 +721,7 @@ declare const columnSchema: z.ZodDefault<z.ZodObject<{
|
|
|
548
721
|
declare const encryptConfigSchema: z.ZodObject<{
|
|
549
722
|
v: z.ZodNumber;
|
|
550
723
|
tables: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodDefault<z.ZodObject<{
|
|
551
|
-
cast_as: z.ZodDefault<z.ZodEnum<["bigint", "boolean", "date", "number", "string", "json", "text"]>>;
|
|
724
|
+
cast_as: z.ZodDefault<z.ZodEnum<["bigint", "boolean", "date", "timestamp", "number", "string", "json", "text"]>>;
|
|
552
725
|
indexes: z.ZodDefault<z.ZodObject<{
|
|
553
726
|
ore: z.ZodOptional<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>>;
|
|
554
727
|
unique: z.ZodOptional<z.ZodObject<{
|
|
@@ -712,7 +885,7 @@ declare const encryptConfigSchema: z.ZodObject<{
|
|
|
712
885
|
} | undefined;
|
|
713
886
|
}>>;
|
|
714
887
|
}, "strip", z.ZodTypeAny, {
|
|
715
|
-
cast_as: "string" | "number" | "bigint" | "boolean" | "
|
|
888
|
+
cast_as: "string" | "number" | "bigint" | "boolean" | "date" | "timestamp" | "json" | "text";
|
|
716
889
|
indexes: {
|
|
717
890
|
match?: {
|
|
718
891
|
token_filters?: {
|
|
@@ -744,7 +917,7 @@ declare const encryptConfigSchema: z.ZodObject<{
|
|
|
744
917
|
} | undefined;
|
|
745
918
|
};
|
|
746
919
|
}, {
|
|
747
|
-
cast_as?: "string" | "number" | "bigint" | "boolean" | "
|
|
920
|
+
cast_as?: "string" | "number" | "bigint" | "boolean" | "date" | "timestamp" | "json" | "text" | undefined;
|
|
748
921
|
indexes?: {
|
|
749
922
|
match?: {
|
|
750
923
|
token_filters?: {
|
|
@@ -779,7 +952,7 @@ declare const encryptConfigSchema: z.ZodObject<{
|
|
|
779
952
|
}, "strip", z.ZodTypeAny, {
|
|
780
953
|
v: number;
|
|
781
954
|
tables: Record<string, Record<string, {
|
|
782
|
-
cast_as: "string" | "number" | "bigint" | "boolean" | "
|
|
955
|
+
cast_as: "string" | "number" | "bigint" | "boolean" | "date" | "timestamp" | "json" | "text";
|
|
783
956
|
indexes: {
|
|
784
957
|
match?: {
|
|
785
958
|
token_filters?: {
|
|
@@ -814,7 +987,7 @@ declare const encryptConfigSchema: z.ZodObject<{
|
|
|
814
987
|
}, {
|
|
815
988
|
v: number;
|
|
816
989
|
tables?: Record<string, Record<string, {
|
|
817
|
-
cast_as?: "string" | "number" | "bigint" | "boolean" | "
|
|
990
|
+
cast_as?: "string" | "number" | "bigint" | "boolean" | "date" | "timestamp" | "json" | "text" | undefined;
|
|
818
991
|
indexes?: {
|
|
819
992
|
match?: {
|
|
820
993
|
token_filters?: {
|
|
@@ -903,7 +1076,7 @@ declare class EncryptedField {
|
|
|
903
1076
|
*/
|
|
904
1077
|
dataType(castAs: CastAs): this;
|
|
905
1078
|
build(): {
|
|
906
|
-
cast_as: "string" | "number" | "bigint" | "boolean" | "
|
|
1079
|
+
cast_as: "string" | "number" | "bigint" | "boolean" | "date" | "timestamp" | "json" | "text";
|
|
907
1080
|
indexes: {};
|
|
908
1081
|
};
|
|
909
1082
|
getName(): string;
|
|
@@ -1022,7 +1195,7 @@ declare class EncryptedColumn {
|
|
|
1022
1195
|
*/
|
|
1023
1196
|
searchableJson(): this;
|
|
1024
1197
|
build(): {
|
|
1025
|
-
cast_as: "string" | "number" | "bigint" | "boolean" | "
|
|
1198
|
+
cast_as: "string" | "number" | "bigint" | "boolean" | "date" | "timestamp" | "json" | "text";
|
|
1026
1199
|
indexes: {
|
|
1027
1200
|
ore?: OreIndexOpts;
|
|
1028
1201
|
unique?: UniqueIndexOpts;
|
|
@@ -1178,7 +1351,7 @@ declare function encryptedField(valueName: string): EncryptedField;
|
|
|
1178
1351
|
/**
|
|
1179
1352
|
* Build an encrypt config from a list of encrypted tables.
|
|
1180
1353
|
*
|
|
1181
|
-
* @param
|
|
1354
|
+
* @param protectTables - The list of encrypted tables to build the config from.
|
|
1182
1355
|
* @returns An encrypt config object.
|
|
1183
1356
|
*
|
|
1184
1357
|
* @example
|
|
@@ -1197,6 +1370,6 @@ declare function encryptedField(valueName: string): EncryptedField;
|
|
|
1197
1370
|
* console.log(config)
|
|
1198
1371
|
* ```
|
|
1199
1372
|
*/
|
|
1200
|
-
declare function buildEncryptConfig(...protectTables: Array<
|
|
1373
|
+
declare function buildEncryptConfig(...protectTables: Array<BuildableTable>): EncryptConfig;
|
|
1201
1374
|
|
|
1202
|
-
export {
|
|
1375
|
+
export { type OtherFields as $, type SteVecIndexOpts as A, type BulkEncryptPayload as B, type ClientConfig as C, type Decrypted as D, type EncryptedReturnType as E, buildEncryptConfig as F, castAsEnum as G, encryptConfigSchema as H, type InferEncrypted as I, eqlCastAsEnum as J, type KeysetIdentifier as K, toEqlCastAs as L, type MatchIndexOpts as M, type BuildableTableColumns as N, type OreIndexOpts as O, type Plaintext as P, type QueryTypeName as Q, type BuildableV3QueryableColumn as R, type ScalarQueryTerm as S, type TokenFilter as T, type UniqueIndexOpts as U, type DecryptedFields as V, type DecryptionResult as W, type EncryptedFields as X, type EncryptedFromSchema as Y, type EncryptedQuery as Z, type EncryptedSearchTerm as _, type Encrypted as a, type SearchTerm as a0, queryTypes as a1, type EncryptOptions as b, type BulkDecryptPayload as c, encryptedField as d, encryptedColumn as e, encryptedTable as f, EncryptedTable as g, type EncryptedTableColumn as h, type ColumnSchema as i, type EncryptConfig as j, EncryptedColumn as k, type CastAs as l, type EncryptedValue as m, type EncryptedQueryResult as n, type Client as o, type BulkDecryptedData as p, type BulkEncryptedData as q, type BuildableColumn as r, type BuildableTable as s, type EncryptQueryOptions as t, type BuildableQueryColumn as u, type EncryptedFromBuildableTable as v, type EncryptionClientConfig as w, EncryptedField as x, type InferPlaintext as y, type EqlCastAs as z };
|