@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
|
@@ -0,0 +1,603 @@
|
|
|
1
|
+
import { i as ColumnSchema, M as MatchIndexOpts, a as Encrypted, j as EncryptConfig } from './types-public-CpS5KjwX.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The query capabilities a v3 concrete domain exposes. These are SDK-facing
|
|
5
|
+
* semantic flags describing what kinds of query terms a column can produce —
|
|
6
|
+
* NOT the raw EQL index keys. They are metadata only and never emitted by
|
|
7
|
+
* `build()`.
|
|
8
|
+
*
|
|
9
|
+
* - `equality`: exact-match lookups (EQL `hm`, or comparison via `ob`).
|
|
10
|
+
* - `orderAndRange`: comparison / range lookups (EQL `ob`).
|
|
11
|
+
* - `freeTextSearch`: tokenised substring match (EQL `bf`).
|
|
12
|
+
*/
|
|
13
|
+
type QueryCapabilities = Readonly<{
|
|
14
|
+
equality: boolean;
|
|
15
|
+
orderAndRange: boolean;
|
|
16
|
+
freeTextSearch: boolean;
|
|
17
|
+
}>;
|
|
18
|
+
/** The plaintext (TypeScript) kind a v3 domain decrypts to. A subset of the
|
|
19
|
+
* SDK `CastAs` enum, restricted to the scalar kinds v3 domains actually use. */
|
|
20
|
+
type PlaintextKind = 'string' | 'number' | 'boolean' | 'date' | 'timestamp';
|
|
21
|
+
/**
|
|
22
|
+
* The full, literal definition of a v3 domain. This is the LOAD-BEARING type:
|
|
23
|
+
* the base column class carries a private field of this type so that every
|
|
24
|
+
* concrete (otherwise-empty) subclass is discriminated by its literal
|
|
25
|
+
* `eqlType`/`castAs`/`capabilities` — TypeScript empty subclasses are NOT
|
|
26
|
+
* nominal, so without this a storage-only `boolean` column would be assignable to
|
|
27
|
+
* a storage-only `date` column and plaintext inference would collapse.
|
|
28
|
+
*/
|
|
29
|
+
type V3DomainDefinition = Readonly<{
|
|
30
|
+
eqlType: `eql_v3.${string}`;
|
|
31
|
+
castAs: PlaintextKind;
|
|
32
|
+
capabilities: QueryCapabilities;
|
|
33
|
+
}>;
|
|
34
|
+
/** Type-level mirror of {@link isQueryableCapabilities}: `false` for a
|
|
35
|
+
* storage-only domain (all capability flags `false`), `true` otherwise. */
|
|
36
|
+
type QueryableFlag<D extends V3DomainDefinition> = D['capabilities'] extends {
|
|
37
|
+
equality: false;
|
|
38
|
+
orderAndRange: false;
|
|
39
|
+
freeTextSearch: false;
|
|
40
|
+
} ? false : true;
|
|
41
|
+
/**
|
|
42
|
+
* The concrete EQL v3 domain name for a full-capability text column.
|
|
43
|
+
* Recorded as metadata for future DDL / query-dialect increments; it is
|
|
44
|
+
* intentionally absent from the emitted encrypt config.
|
|
45
|
+
*/
|
|
46
|
+
declare const TEXT_SEARCH_EQL_TYPE = "eql_v3.text_search";
|
|
47
|
+
declare const INTEGER: {
|
|
48
|
+
readonly eqlType: "eql_v3.integer";
|
|
49
|
+
readonly castAs: "number";
|
|
50
|
+
readonly capabilities: {
|
|
51
|
+
readonly equality: false;
|
|
52
|
+
readonly orderAndRange: false;
|
|
53
|
+
readonly freeTextSearch: false;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
declare const INTEGER_EQ: {
|
|
57
|
+
readonly eqlType: "eql_v3.integer_eq";
|
|
58
|
+
readonly castAs: "number";
|
|
59
|
+
readonly capabilities: {
|
|
60
|
+
readonly equality: true;
|
|
61
|
+
readonly orderAndRange: false;
|
|
62
|
+
readonly freeTextSearch: false;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
declare const INTEGER_ORD_ORE: {
|
|
66
|
+
readonly eqlType: "eql_v3.integer_ord_ore";
|
|
67
|
+
readonly castAs: "number";
|
|
68
|
+
readonly capabilities: {
|
|
69
|
+
readonly equality: true;
|
|
70
|
+
readonly orderAndRange: true;
|
|
71
|
+
readonly freeTextSearch: false;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
declare const INTEGER_ORD: {
|
|
75
|
+
readonly eqlType: "eql_v3.integer_ord";
|
|
76
|
+
readonly castAs: "number";
|
|
77
|
+
readonly capabilities: {
|
|
78
|
+
readonly equality: true;
|
|
79
|
+
readonly orderAndRange: true;
|
|
80
|
+
readonly freeTextSearch: false;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
declare const SMALLINT: {
|
|
84
|
+
readonly eqlType: "eql_v3.smallint";
|
|
85
|
+
readonly castAs: "number";
|
|
86
|
+
readonly capabilities: {
|
|
87
|
+
readonly equality: false;
|
|
88
|
+
readonly orderAndRange: false;
|
|
89
|
+
readonly freeTextSearch: false;
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
declare const SMALLINT_EQ: {
|
|
93
|
+
readonly eqlType: "eql_v3.smallint_eq";
|
|
94
|
+
readonly castAs: "number";
|
|
95
|
+
readonly capabilities: {
|
|
96
|
+
readonly equality: true;
|
|
97
|
+
readonly orderAndRange: false;
|
|
98
|
+
readonly freeTextSearch: false;
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
declare const SMALLINT_ORD_ORE: {
|
|
102
|
+
readonly eqlType: "eql_v3.smallint_ord_ore";
|
|
103
|
+
readonly castAs: "number";
|
|
104
|
+
readonly capabilities: {
|
|
105
|
+
readonly equality: true;
|
|
106
|
+
readonly orderAndRange: true;
|
|
107
|
+
readonly freeTextSearch: false;
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
declare const SMALLINT_ORD: {
|
|
111
|
+
readonly eqlType: "eql_v3.smallint_ord";
|
|
112
|
+
readonly castAs: "number";
|
|
113
|
+
readonly capabilities: {
|
|
114
|
+
readonly equality: true;
|
|
115
|
+
readonly orderAndRange: true;
|
|
116
|
+
readonly freeTextSearch: false;
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
declare const DATE: {
|
|
120
|
+
readonly eqlType: "eql_v3.date";
|
|
121
|
+
readonly castAs: "date";
|
|
122
|
+
readonly capabilities: {
|
|
123
|
+
readonly equality: false;
|
|
124
|
+
readonly orderAndRange: false;
|
|
125
|
+
readonly freeTextSearch: false;
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
declare const DATE_EQ: {
|
|
129
|
+
readonly eqlType: "eql_v3.date_eq";
|
|
130
|
+
readonly castAs: "date";
|
|
131
|
+
readonly capabilities: {
|
|
132
|
+
readonly equality: true;
|
|
133
|
+
readonly orderAndRange: false;
|
|
134
|
+
readonly freeTextSearch: false;
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
declare const DATE_ORD_ORE: {
|
|
138
|
+
readonly eqlType: "eql_v3.date_ord_ore";
|
|
139
|
+
readonly castAs: "date";
|
|
140
|
+
readonly capabilities: {
|
|
141
|
+
readonly equality: true;
|
|
142
|
+
readonly orderAndRange: true;
|
|
143
|
+
readonly freeTextSearch: false;
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
declare const DATE_ORD: {
|
|
147
|
+
readonly eqlType: "eql_v3.date_ord";
|
|
148
|
+
readonly castAs: "date";
|
|
149
|
+
readonly capabilities: {
|
|
150
|
+
readonly equality: true;
|
|
151
|
+
readonly orderAndRange: true;
|
|
152
|
+
readonly freeTextSearch: false;
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
declare const TIMESTAMP: {
|
|
156
|
+
readonly eqlType: "eql_v3.timestamp";
|
|
157
|
+
readonly castAs: "timestamp";
|
|
158
|
+
readonly capabilities: {
|
|
159
|
+
readonly equality: false;
|
|
160
|
+
readonly orderAndRange: false;
|
|
161
|
+
readonly freeTextSearch: false;
|
|
162
|
+
};
|
|
163
|
+
};
|
|
164
|
+
declare const TIMESTAMP_EQ: {
|
|
165
|
+
readonly eqlType: "eql_v3.timestamp_eq";
|
|
166
|
+
readonly castAs: "timestamp";
|
|
167
|
+
readonly capabilities: {
|
|
168
|
+
readonly equality: true;
|
|
169
|
+
readonly orderAndRange: false;
|
|
170
|
+
readonly freeTextSearch: false;
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
declare const TIMESTAMP_ORD_ORE: {
|
|
174
|
+
readonly eqlType: "eql_v3.timestamp_ord_ore";
|
|
175
|
+
readonly castAs: "timestamp";
|
|
176
|
+
readonly capabilities: {
|
|
177
|
+
readonly equality: true;
|
|
178
|
+
readonly orderAndRange: true;
|
|
179
|
+
readonly freeTextSearch: false;
|
|
180
|
+
};
|
|
181
|
+
};
|
|
182
|
+
declare const TIMESTAMP_ORD: {
|
|
183
|
+
readonly eqlType: "eql_v3.timestamp_ord";
|
|
184
|
+
readonly castAs: "timestamp";
|
|
185
|
+
readonly capabilities: {
|
|
186
|
+
readonly equality: true;
|
|
187
|
+
readonly orderAndRange: true;
|
|
188
|
+
readonly freeTextSearch: false;
|
|
189
|
+
};
|
|
190
|
+
};
|
|
191
|
+
declare const NUMERIC: {
|
|
192
|
+
readonly eqlType: "eql_v3.numeric";
|
|
193
|
+
readonly castAs: "number";
|
|
194
|
+
readonly capabilities: {
|
|
195
|
+
readonly equality: false;
|
|
196
|
+
readonly orderAndRange: false;
|
|
197
|
+
readonly freeTextSearch: false;
|
|
198
|
+
};
|
|
199
|
+
};
|
|
200
|
+
declare const NUMERIC_EQ: {
|
|
201
|
+
readonly eqlType: "eql_v3.numeric_eq";
|
|
202
|
+
readonly castAs: "number";
|
|
203
|
+
readonly capabilities: {
|
|
204
|
+
readonly equality: true;
|
|
205
|
+
readonly orderAndRange: false;
|
|
206
|
+
readonly freeTextSearch: false;
|
|
207
|
+
};
|
|
208
|
+
};
|
|
209
|
+
declare const NUMERIC_ORD_ORE: {
|
|
210
|
+
readonly eqlType: "eql_v3.numeric_ord_ore";
|
|
211
|
+
readonly castAs: "number";
|
|
212
|
+
readonly capabilities: {
|
|
213
|
+
readonly equality: true;
|
|
214
|
+
readonly orderAndRange: true;
|
|
215
|
+
readonly freeTextSearch: false;
|
|
216
|
+
};
|
|
217
|
+
};
|
|
218
|
+
declare const NUMERIC_ORD: {
|
|
219
|
+
readonly eqlType: "eql_v3.numeric_ord";
|
|
220
|
+
readonly castAs: "number";
|
|
221
|
+
readonly capabilities: {
|
|
222
|
+
readonly equality: true;
|
|
223
|
+
readonly orderAndRange: true;
|
|
224
|
+
readonly freeTextSearch: false;
|
|
225
|
+
};
|
|
226
|
+
};
|
|
227
|
+
declare const TEXT: {
|
|
228
|
+
readonly eqlType: "eql_v3.text";
|
|
229
|
+
readonly castAs: "string";
|
|
230
|
+
readonly capabilities: {
|
|
231
|
+
readonly equality: false;
|
|
232
|
+
readonly orderAndRange: false;
|
|
233
|
+
readonly freeTextSearch: false;
|
|
234
|
+
};
|
|
235
|
+
};
|
|
236
|
+
declare const TEXT_EQ: {
|
|
237
|
+
readonly eqlType: "eql_v3.text_eq";
|
|
238
|
+
readonly castAs: "string";
|
|
239
|
+
readonly capabilities: {
|
|
240
|
+
readonly equality: true;
|
|
241
|
+
readonly orderAndRange: false;
|
|
242
|
+
readonly freeTextSearch: false;
|
|
243
|
+
};
|
|
244
|
+
};
|
|
245
|
+
declare const TEXT_MATCH: {
|
|
246
|
+
readonly eqlType: "eql_v3.text_match";
|
|
247
|
+
readonly castAs: "string";
|
|
248
|
+
readonly capabilities: {
|
|
249
|
+
readonly equality: false;
|
|
250
|
+
readonly orderAndRange: false;
|
|
251
|
+
readonly freeTextSearch: true;
|
|
252
|
+
};
|
|
253
|
+
};
|
|
254
|
+
declare const TEXT_ORD_ORE: {
|
|
255
|
+
readonly eqlType: "eql_v3.text_ord_ore";
|
|
256
|
+
readonly castAs: "string";
|
|
257
|
+
readonly capabilities: {
|
|
258
|
+
readonly equality: true;
|
|
259
|
+
readonly orderAndRange: true;
|
|
260
|
+
readonly freeTextSearch: false;
|
|
261
|
+
};
|
|
262
|
+
};
|
|
263
|
+
declare const TEXT_ORD: {
|
|
264
|
+
readonly eqlType: "eql_v3.text_ord";
|
|
265
|
+
readonly castAs: "string";
|
|
266
|
+
readonly capabilities: {
|
|
267
|
+
readonly equality: true;
|
|
268
|
+
readonly orderAndRange: true;
|
|
269
|
+
readonly freeTextSearch: false;
|
|
270
|
+
};
|
|
271
|
+
};
|
|
272
|
+
declare const BOOLEAN: {
|
|
273
|
+
readonly eqlType: "eql_v3.boolean";
|
|
274
|
+
readonly castAs: "boolean";
|
|
275
|
+
readonly capabilities: {
|
|
276
|
+
readonly equality: false;
|
|
277
|
+
readonly orderAndRange: false;
|
|
278
|
+
readonly freeTextSearch: false;
|
|
279
|
+
};
|
|
280
|
+
};
|
|
281
|
+
declare const REAL: {
|
|
282
|
+
readonly eqlType: "eql_v3.real";
|
|
283
|
+
readonly castAs: "number";
|
|
284
|
+
readonly capabilities: {
|
|
285
|
+
readonly equality: false;
|
|
286
|
+
readonly orderAndRange: false;
|
|
287
|
+
readonly freeTextSearch: false;
|
|
288
|
+
};
|
|
289
|
+
};
|
|
290
|
+
declare const REAL_EQ: {
|
|
291
|
+
readonly eqlType: "eql_v3.real_eq";
|
|
292
|
+
readonly castAs: "number";
|
|
293
|
+
readonly capabilities: {
|
|
294
|
+
readonly equality: true;
|
|
295
|
+
readonly orderAndRange: false;
|
|
296
|
+
readonly freeTextSearch: false;
|
|
297
|
+
};
|
|
298
|
+
};
|
|
299
|
+
declare const REAL_ORD_ORE: {
|
|
300
|
+
readonly eqlType: "eql_v3.real_ord_ore";
|
|
301
|
+
readonly castAs: "number";
|
|
302
|
+
readonly capabilities: {
|
|
303
|
+
readonly equality: true;
|
|
304
|
+
readonly orderAndRange: true;
|
|
305
|
+
readonly freeTextSearch: false;
|
|
306
|
+
};
|
|
307
|
+
};
|
|
308
|
+
declare const REAL_ORD: {
|
|
309
|
+
readonly eqlType: "eql_v3.real_ord";
|
|
310
|
+
readonly castAs: "number";
|
|
311
|
+
readonly capabilities: {
|
|
312
|
+
readonly equality: true;
|
|
313
|
+
readonly orderAndRange: true;
|
|
314
|
+
readonly freeTextSearch: false;
|
|
315
|
+
};
|
|
316
|
+
};
|
|
317
|
+
declare const DOUBLE: {
|
|
318
|
+
readonly eqlType: "eql_v3.double";
|
|
319
|
+
readonly castAs: "number";
|
|
320
|
+
readonly capabilities: {
|
|
321
|
+
readonly equality: false;
|
|
322
|
+
readonly orderAndRange: false;
|
|
323
|
+
readonly freeTextSearch: false;
|
|
324
|
+
};
|
|
325
|
+
};
|
|
326
|
+
declare const DOUBLE_EQ: {
|
|
327
|
+
readonly eqlType: "eql_v3.double_eq";
|
|
328
|
+
readonly castAs: "number";
|
|
329
|
+
readonly capabilities: {
|
|
330
|
+
readonly equality: true;
|
|
331
|
+
readonly orderAndRange: false;
|
|
332
|
+
readonly freeTextSearch: false;
|
|
333
|
+
};
|
|
334
|
+
};
|
|
335
|
+
declare const DOUBLE_ORD_ORE: {
|
|
336
|
+
readonly eqlType: "eql_v3.double_ord_ore";
|
|
337
|
+
readonly castAs: "number";
|
|
338
|
+
readonly capabilities: {
|
|
339
|
+
readonly equality: true;
|
|
340
|
+
readonly orderAndRange: true;
|
|
341
|
+
readonly freeTextSearch: false;
|
|
342
|
+
};
|
|
343
|
+
};
|
|
344
|
+
declare const DOUBLE_ORD: {
|
|
345
|
+
readonly eqlType: "eql_v3.double_ord";
|
|
346
|
+
readonly castAs: "number";
|
|
347
|
+
readonly capabilities: {
|
|
348
|
+
readonly equality: true;
|
|
349
|
+
readonly orderAndRange: true;
|
|
350
|
+
readonly freeTextSearch: false;
|
|
351
|
+
};
|
|
352
|
+
};
|
|
353
|
+
/**
|
|
354
|
+
* Shared base for every v3 concrete domain column. Parameterised by the FULL
|
|
355
|
+
* literal {@link V3DomainDefinition} (not by capabilities alone): the private
|
|
356
|
+
* `definition` field carries the literal `eqlType`/`castAs`/`capabilities`, so
|
|
357
|
+
* two otherwise-empty subclasses (e.g. `EncryptedBooleanColumn` and
|
|
358
|
+
* `EncryptedDateColumn`, both storage-only) are NOT mutually assignable. This
|
|
359
|
+
* nominality is what keeps plaintext inference precise.
|
|
360
|
+
*/
|
|
361
|
+
declare class EncryptedV3Column<D extends V3DomainDefinition> {
|
|
362
|
+
private readonly columnName;
|
|
363
|
+
private readonly definition;
|
|
364
|
+
constructor(columnName: string, definition: D);
|
|
365
|
+
getName(): string;
|
|
366
|
+
/** The concrete EQL v3 domain name. Metadata only; not emitted by `build()`. */
|
|
367
|
+
getEqlType(): D['eqlType'];
|
|
368
|
+
/** The semantic query capabilities this domain exposes. Metadata only. */
|
|
369
|
+
getQueryCapabilities(): D['capabilities'];
|
|
370
|
+
/** `true` when this domain can produce at least one kind of query term. */
|
|
371
|
+
isQueryable(): QueryableFlag<D>;
|
|
372
|
+
/** Emit the encrypt-config column: `cast_as` plus capability-derived indexes. */
|
|
373
|
+
build(): ColumnSchema;
|
|
374
|
+
}
|
|
375
|
+
declare const TEXT_SEARCH_DOMAIN: {
|
|
376
|
+
readonly eqlType: "eql_v3.text_search";
|
|
377
|
+
readonly castAs: "string";
|
|
378
|
+
readonly capabilities: {
|
|
379
|
+
readonly equality: true;
|
|
380
|
+
readonly orderAndRange: true;
|
|
381
|
+
readonly freeTextSearch: true;
|
|
382
|
+
};
|
|
383
|
+
};
|
|
384
|
+
/**
|
|
385
|
+
* Builder for an `eql_v3.text_search` column.
|
|
386
|
+
*
|
|
387
|
+
* The concrete type inherently enables equality + order/range + free-text
|
|
388
|
+
* match — there are no capability-enabling methods. `.freeTextSearch(opts?)`
|
|
389
|
+
* tunes the match index only.
|
|
390
|
+
*
|
|
391
|
+
* NOTE — querying: a `text_search` column emits all three indexes (`unique`,
|
|
392
|
+
* `ore`, `match`), and the shared index-inference picks them by fixed priority
|
|
393
|
+
* `unique > match > ore`. So `encryptQuery(value, { column, table })` with NO
|
|
394
|
+
* explicit `queryType` builds an EQUALITY term (via `unique`), NOT a free-text
|
|
395
|
+
* match — a substring like `'joh'` then matches nothing. To run a free-text
|
|
396
|
+
* match query you MUST pass `queryType: 'freeTextSearch'`:
|
|
397
|
+
*
|
|
398
|
+
* ```typescript
|
|
399
|
+
* // equality (default): exact value only
|
|
400
|
+
* client.encryptQuery('john@example.com', { column: users.email, table: users })
|
|
401
|
+
* // free-text match: substring/token search
|
|
402
|
+
* client.encryptQuery('joh', { column: users.email, table: users, queryType: 'freeTextSearch' })
|
|
403
|
+
* ```
|
|
404
|
+
*/
|
|
405
|
+
declare class EncryptedTextSearchColumn extends EncryptedV3Column<typeof TEXT_SEARCH_DOMAIN> {
|
|
406
|
+
private matchOpts;
|
|
407
|
+
constructor(columnName: string);
|
|
408
|
+
/**
|
|
409
|
+
* Tune the match index. Each provided key replaces its default; omitted
|
|
410
|
+
* keys keep the default. This NEVER enables a capability — match is always
|
|
411
|
+
* on for this type. Merge semantics mirror v2's `opts?.x ?? default`.
|
|
412
|
+
*/
|
|
413
|
+
freeTextSearch(opts?: MatchIndexOpts): this;
|
|
414
|
+
/** Emit the encrypt-config column. Byte-identical to a v2 equality+order+match column. */
|
|
415
|
+
build(): ColumnSchema;
|
|
416
|
+
}
|
|
417
|
+
declare class EncryptedIntegerColumn extends EncryptedV3Column<typeof INTEGER> {
|
|
418
|
+
}
|
|
419
|
+
declare class EncryptedIntegerEqColumn extends EncryptedV3Column<typeof INTEGER_EQ> {
|
|
420
|
+
}
|
|
421
|
+
declare class EncryptedIntegerOrdOreColumn extends EncryptedV3Column<typeof INTEGER_ORD_ORE> {
|
|
422
|
+
}
|
|
423
|
+
declare class EncryptedIntegerOrdColumn extends EncryptedV3Column<typeof INTEGER_ORD> {
|
|
424
|
+
}
|
|
425
|
+
declare class EncryptedSmallintColumn extends EncryptedV3Column<typeof SMALLINT> {
|
|
426
|
+
}
|
|
427
|
+
declare class EncryptedSmallintEqColumn extends EncryptedV3Column<typeof SMALLINT_EQ> {
|
|
428
|
+
}
|
|
429
|
+
declare class EncryptedSmallintOrdOreColumn extends EncryptedV3Column<typeof SMALLINT_ORD_ORE> {
|
|
430
|
+
}
|
|
431
|
+
declare class EncryptedSmallintOrdColumn extends EncryptedV3Column<typeof SMALLINT_ORD> {
|
|
432
|
+
}
|
|
433
|
+
declare class EncryptedDateColumn extends EncryptedV3Column<typeof DATE> {
|
|
434
|
+
}
|
|
435
|
+
declare class EncryptedDateEqColumn extends EncryptedV3Column<typeof DATE_EQ> {
|
|
436
|
+
}
|
|
437
|
+
declare class EncryptedDateOrdOreColumn extends EncryptedV3Column<typeof DATE_ORD_ORE> {
|
|
438
|
+
}
|
|
439
|
+
declare class EncryptedDateOrdColumn extends EncryptedV3Column<typeof DATE_ORD> {
|
|
440
|
+
}
|
|
441
|
+
declare class EncryptedTimestampColumn extends EncryptedV3Column<typeof TIMESTAMP> {
|
|
442
|
+
}
|
|
443
|
+
declare class EncryptedTimestampEqColumn extends EncryptedV3Column<typeof TIMESTAMP_EQ> {
|
|
444
|
+
}
|
|
445
|
+
declare class EncryptedTimestampOrdOreColumn extends EncryptedV3Column<typeof TIMESTAMP_ORD_ORE> {
|
|
446
|
+
}
|
|
447
|
+
declare class EncryptedTimestampOrdColumn extends EncryptedV3Column<typeof TIMESTAMP_ORD> {
|
|
448
|
+
}
|
|
449
|
+
declare class EncryptedNumericColumn extends EncryptedV3Column<typeof NUMERIC> {
|
|
450
|
+
}
|
|
451
|
+
declare class EncryptedNumericEqColumn extends EncryptedV3Column<typeof NUMERIC_EQ> {
|
|
452
|
+
}
|
|
453
|
+
declare class EncryptedNumericOrdOreColumn extends EncryptedV3Column<typeof NUMERIC_ORD_ORE> {
|
|
454
|
+
}
|
|
455
|
+
declare class EncryptedNumericOrdColumn extends EncryptedV3Column<typeof NUMERIC_ORD> {
|
|
456
|
+
}
|
|
457
|
+
declare class EncryptedTextColumn extends EncryptedV3Column<typeof TEXT> {
|
|
458
|
+
}
|
|
459
|
+
declare class EncryptedTextEqColumn extends EncryptedV3Column<typeof TEXT_EQ> {
|
|
460
|
+
}
|
|
461
|
+
declare class EncryptedTextMatchColumn extends EncryptedV3Column<typeof TEXT_MATCH> {
|
|
462
|
+
}
|
|
463
|
+
declare class EncryptedTextOrdOreColumn extends EncryptedV3Column<typeof TEXT_ORD_ORE> {
|
|
464
|
+
}
|
|
465
|
+
declare class EncryptedTextOrdColumn extends EncryptedV3Column<typeof TEXT_ORD> {
|
|
466
|
+
}
|
|
467
|
+
declare class EncryptedBooleanColumn extends EncryptedV3Column<typeof BOOLEAN> {
|
|
468
|
+
}
|
|
469
|
+
declare class EncryptedRealColumn extends EncryptedV3Column<typeof REAL> {
|
|
470
|
+
}
|
|
471
|
+
declare class EncryptedRealEqColumn extends EncryptedV3Column<typeof REAL_EQ> {
|
|
472
|
+
}
|
|
473
|
+
declare class EncryptedRealOrdOreColumn extends EncryptedV3Column<typeof REAL_ORD_ORE> {
|
|
474
|
+
}
|
|
475
|
+
declare class EncryptedRealOrdColumn extends EncryptedV3Column<typeof REAL_ORD> {
|
|
476
|
+
}
|
|
477
|
+
declare class EncryptedDoubleColumn extends EncryptedV3Column<typeof DOUBLE> {
|
|
478
|
+
}
|
|
479
|
+
declare class EncryptedDoubleEqColumn extends EncryptedV3Column<typeof DOUBLE_EQ> {
|
|
480
|
+
}
|
|
481
|
+
declare class EncryptedDoubleOrdOreColumn extends EncryptedV3Column<typeof DOUBLE_ORD_ORE> {
|
|
482
|
+
}
|
|
483
|
+
declare class EncryptedDoubleOrdColumn extends EncryptedV3Column<typeof DOUBLE_ORD> {
|
|
484
|
+
}
|
|
485
|
+
/**
|
|
486
|
+
* Union of every v3 concrete column type. Used as the value type for v3 table
|
|
487
|
+
* columns so a table may mix any generated domains.
|
|
488
|
+
*/
|
|
489
|
+
type AnyEncryptedV3Column = EncryptedIntegerColumn | EncryptedIntegerEqColumn | EncryptedIntegerOrdOreColumn | EncryptedIntegerOrdColumn | EncryptedSmallintColumn | EncryptedSmallintEqColumn | EncryptedSmallintOrdOreColumn | EncryptedSmallintOrdColumn | EncryptedDateColumn | EncryptedDateEqColumn | EncryptedDateOrdOreColumn | EncryptedDateOrdColumn | EncryptedTimestampColumn | EncryptedTimestampEqColumn | EncryptedTimestampOrdOreColumn | EncryptedTimestampOrdColumn | EncryptedNumericColumn | EncryptedNumericEqColumn | EncryptedNumericOrdOreColumn | EncryptedNumericOrdColumn | EncryptedTextColumn | EncryptedTextEqColumn | EncryptedTextMatchColumn | EncryptedTextOrdOreColumn | EncryptedTextOrdColumn | EncryptedTextSearchColumn | EncryptedBooleanColumn | EncryptedRealColumn | EncryptedRealEqColumn | EncryptedRealOrdOreColumn | EncryptedRealOrdColumn | EncryptedDoubleColumn | EncryptedDoubleEqColumn | EncryptedDoubleOrdOreColumn | EncryptedDoubleOrdColumn;
|
|
490
|
+
/**
|
|
491
|
+
* Shape of v3 table columns: every value is a v3 concrete column builder.
|
|
492
|
+
* (Nested fields are deferred to later increments.)
|
|
493
|
+
*/
|
|
494
|
+
type EncryptedV3TableColumn = {
|
|
495
|
+
[key: string]: AnyEncryptedV3Column;
|
|
496
|
+
};
|
|
497
|
+
/** Map a domain's {@link PlaintextKind} to its TypeScript plaintext type. */
|
|
498
|
+
type PlaintextFromKind<K extends PlaintextKind> = K extends 'string' ? string : K extends 'number' ? number : K extends 'boolean' ? boolean : K extends 'date' | 'timestamp' ? Date : never;
|
|
499
|
+
/**
|
|
500
|
+
* The plaintext type for a single v3 column, read from the literal domain
|
|
501
|
+
* definition carried on the base class's private field. This is stable across
|
|
502
|
+
* empty subclasses that share the same base generic — a subclass-name
|
|
503
|
+
* conditional would collapse because those subclasses are structurally
|
|
504
|
+
* assignable to one another.
|
|
505
|
+
*/
|
|
506
|
+
type PlaintextForColumn<C> = C extends EncryptedV3Column<infer D> ? PlaintextFromKind<D['castAs']> : never;
|
|
507
|
+
/**
|
|
508
|
+
* The user-facing `queryType` names a v3 column supports, derived 1:1 from its
|
|
509
|
+
* capability flags. Resolves to `never` for a storage-only column (all flags
|
|
510
|
+
* `false`) and for any non-v3 value. The names mirror the {@link QueryCapabilities}
|
|
511
|
+
* keys and the first three {@link import('@/types').QueryTypeName} members.
|
|
512
|
+
*/
|
|
513
|
+
type QueryTypesForColumn<C> = C extends EncryptedV3Column<infer D> ? (D['capabilities']['equality'] extends true ? 'equality' : never) | (D['capabilities']['orderAndRange'] extends true ? 'orderAndRange' : never) | (D['capabilities']['freeTextSearch'] extends true ? 'freeTextSearch' : never) : never;
|
|
514
|
+
/**
|
|
515
|
+
* The concrete EQL v3 type string for a single column, read from the literal
|
|
516
|
+
* domain definition carried on the base class's private field (mirrors
|
|
517
|
+
* {@link PlaintextForColumn}). Distributes over a union of columns, so
|
|
518
|
+
* `EqlTypeForColumn<AnyEncryptedV3Column>` yields the union of every domain's
|
|
519
|
+
* `eqlType` — the canonical, source-of-truth key set for a type-driven test
|
|
520
|
+
* matrix keyed by domain.
|
|
521
|
+
*/
|
|
522
|
+
type EqlTypeForColumn<C> = C extends EncryptedV3Column<infer D> ? D['eqlType'] : never;
|
|
523
|
+
|
|
524
|
+
interface TableDefinition {
|
|
525
|
+
tableName: string;
|
|
526
|
+
columns: Record<string, ColumnSchema>;
|
|
527
|
+
}
|
|
528
|
+
/**
|
|
529
|
+
* A v3 encrypted table. Mirrors the v2 `EncryptedTable` but only accepts v3
|
|
530
|
+
* column builders. Emits the same `{ tableName, columns }` definition shape.
|
|
531
|
+
*/
|
|
532
|
+
declare class EncryptedTable<T extends EncryptedV3TableColumn> {
|
|
533
|
+
readonly tableName: string;
|
|
534
|
+
readonly columnBuilders: T;
|
|
535
|
+
/** @internal Type-level brand so TypeScript can infer `T` from `EncryptedTable<T>`. */
|
|
536
|
+
readonly _columnType: T;
|
|
537
|
+
constructor(tableName: string, columnBuilders: T);
|
|
538
|
+
build(): TableDefinition;
|
|
539
|
+
/**
|
|
540
|
+
* Map each column's JS property name to its DB column name (`getName()`).
|
|
541
|
+
* The model path matches user models by property name but must address the
|
|
542
|
+
* encrypt config and FFI by DB name — `build()` keys columns by DB name, so
|
|
543
|
+
* the two only agree when property == name. This recovers the mapping that
|
|
544
|
+
* `build()` discards.
|
|
545
|
+
*/
|
|
546
|
+
buildColumnKeyMap(): Record<string, string>;
|
|
547
|
+
}
|
|
548
|
+
/**
|
|
549
|
+
* Define a v3 encrypted table. Intentionally shadows the v2 `encryptedTable`
|
|
550
|
+
* name but lives on the `/eql/v3` subpath — the importer picks the model by
|
|
551
|
+
* import path. The returned object is also a column accessor (`users.email`).
|
|
552
|
+
*/
|
|
553
|
+
declare function encryptedTable<T extends EncryptedV3TableColumn>(tableName: string, columns: T): EncryptedTable<T> & T;
|
|
554
|
+
/**
|
|
555
|
+
* Build an `EncryptConfig` (`v: 1`) from one or more v3 tables. Emits the same
|
|
556
|
+
* shape as v2's `buildEncryptConfig`.
|
|
557
|
+
*/
|
|
558
|
+
declare function buildEncryptConfig(...tables: Array<EncryptedTable<EncryptedV3TableColumn>>): EncryptConfig;
|
|
559
|
+
/**
|
|
560
|
+
* Infer the plaintext (decrypted) shape from a v3 table schema. Each column maps
|
|
561
|
+
* to the TypeScript type of its domain's `castAs` kind.
|
|
562
|
+
*/
|
|
563
|
+
type InferPlaintext<T extends EncryptedTable<EncryptedV3TableColumn>> = T extends EncryptedTable<infer C> ? {
|
|
564
|
+
[K in keyof C]: PlaintextForColumn<C[K]>;
|
|
565
|
+
} : never;
|
|
566
|
+
/**
|
|
567
|
+
* Infer the encrypted shape from a v3 table schema. See {@link InferPlaintext}
|
|
568
|
+
* for why no key-remap filter is needed in the flat single-type model.
|
|
569
|
+
*/
|
|
570
|
+
type InferEncrypted<T extends EncryptedTable<EncryptedV3TableColumn>> = T extends EncryptedTable<infer C> ? {
|
|
571
|
+
[K in keyof C]: Encrypted;
|
|
572
|
+
} : never;
|
|
573
|
+
/** Any v3 table, regardless of its column map. */
|
|
574
|
+
type AnyV3Table = EncryptedTable<EncryptedV3TableColumn>;
|
|
575
|
+
/** Union of the concrete column builders declared on a v3 table. */
|
|
576
|
+
type ColumnsOf<T extends AnyV3Table> = T extends EncryptedTable<infer C> ? C[keyof C] : never;
|
|
577
|
+
/**
|
|
578
|
+
* Union of the *queryable* column builders on a v3 table. Storage-only columns
|
|
579
|
+
* (whose {@link QueryTypesForColumn} is `never`) are filtered out, so they can't
|
|
580
|
+
* be passed to a query method.
|
|
581
|
+
*/
|
|
582
|
+
type QueryableColumnsOf<T extends AnyV3Table> = T extends EncryptedTable<infer C> ? {
|
|
583
|
+
[K in keyof C]: [QueryTypesForColumn<C[K]>] extends [never] ? never : C[K];
|
|
584
|
+
}[keyof C] : never;
|
|
585
|
+
/**
|
|
586
|
+
* The accepted input model for {@link import('@/encryption/v3').TypedEncryptionClient.encryptModel}.
|
|
587
|
+
* `T` is inferred from the argument: keys that name a schema column are pinned to
|
|
588
|
+
* the column's plaintext type (nullable if the field is nullable), so a wrong-typed
|
|
589
|
+
* field fails assignability; all other keys pass through unchanged.
|
|
590
|
+
*/
|
|
591
|
+
type V3ModelInput<Table extends AnyV3Table, T> = {
|
|
592
|
+
[K in keyof T]: K extends keyof InferPlaintext<Table> ? null extends T[K] ? InferPlaintext<Table>[K] | null : InferPlaintext<Table>[K] : T[K];
|
|
593
|
+
};
|
|
594
|
+
/** The encrypted result model: schema columns become `Encrypted`, others pass through. */
|
|
595
|
+
type V3EncryptedModel<Table extends AnyV3Table, T> = {
|
|
596
|
+
[K in keyof T]: K extends keyof InferPlaintext<Table> ? null extends T[K] ? Encrypted | null : Encrypted : T[K];
|
|
597
|
+
};
|
|
598
|
+
/** The decrypted result model: schema columns become their plaintext type, others pass through. */
|
|
599
|
+
type V3DecryptedModel<Table extends AnyV3Table, T> = {
|
|
600
|
+
[K in keyof T]: K extends keyof InferPlaintext<Table> ? null extends T[K] ? InferPlaintext<Table>[K] | null : InferPlaintext<Table>[K] : T[K];
|
|
601
|
+
};
|
|
602
|
+
|
|
603
|
+
export { type AnyV3Table as A, EncryptedSmallintOrdColumn as B, type ColumnsOf as C, EncryptedSmallintOrdOreColumn as D, EncryptedBooleanColumn as E, EncryptedTable as F, EncryptedTextColumn as G, EncryptedTextEqColumn as H, EncryptedTextMatchColumn as I, EncryptedTextOrdColumn as J, EncryptedTextOrdOreColumn as K, EncryptedTextSearchColumn as L, EncryptedTimestampColumn as M, EncryptedTimestampEqColumn as N, EncryptedTimestampOrdColumn as O, type PlaintextForColumn as P, type QueryableColumnsOf as Q, EncryptedTimestampOrdOreColumn as R, type EncryptedV3TableColumn as S, type EqlTypeForColumn as T, type InferEncrypted as U, type V3ModelInput as V, type InferPlaintext as W, type QueryCapabilities as X, TEXT_SEARCH_EQL_TYPE as Y, buildEncryptConfig as Z, encryptedTable as _, type QueryTypesForColumn as a, type V3EncryptedModel as b, type V3DecryptedModel as c, type AnyEncryptedV3Column as d, EncryptedDateColumn as e, EncryptedDateEqColumn as f, EncryptedDateOrdColumn as g, EncryptedDateOrdOreColumn as h, EncryptedDoubleColumn as i, EncryptedDoubleEqColumn as j, EncryptedDoubleOrdColumn as k, EncryptedDoubleOrdOreColumn as l, EncryptedIntegerColumn as m, EncryptedIntegerEqColumn as n, EncryptedIntegerOrdColumn as o, EncryptedIntegerOrdOreColumn as p, EncryptedNumericColumn as q, EncryptedNumericEqColumn as r, EncryptedNumericOrdColumn as s, EncryptedNumericOrdOreColumn as t, EncryptedRealColumn as u, EncryptedRealEqColumn as v, EncryptedRealOrdColumn as w, EncryptedRealOrdOreColumn as x, EncryptedSmallintColumn as y, EncryptedSmallintEqColumn as z };
|