@cipherstash/stack 0.19.0 → 1.0.0-rc.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 (90) hide show
  1. package/CHANGELOG.md +531 -0
  2. package/README.md +95 -77
  3. package/dist/adapter-kit.cjs +923 -0
  4. package/dist/adapter-kit.cjs.map +1 -0
  5. package/dist/adapter-kit.d.cts +82 -0
  6. package/dist/adapter-kit.d.ts +82 -0
  7. package/dist/adapter-kit.js +47 -0
  8. package/dist/adapter-kit.js.map +1 -0
  9. package/dist/base-operation-AOAIvsSB.d.cts +32 -0
  10. package/dist/base-operation-FXEzUXIq.d.ts +32 -0
  11. package/dist/{chunk-4AVL4VZD.js → chunk-3B5ZX3IS.js} +3 -1
  12. package/dist/chunk-3B5ZX3IS.js.map +1 -0
  13. package/dist/chunk-7333ZC6L.js +48 -0
  14. package/dist/chunk-7333ZC6L.js.map +1 -0
  15. package/dist/{chunk-MP3SSDNN.js → chunk-CLM7E4I6.js} +15 -15
  16. package/dist/{chunk-MP3SSDNN.js.map → chunk-CLM7E4I6.js.map} +1 -1
  17. package/dist/{chunk-U66S7VIF.js → chunk-V2Q3NYIH.js} +166 -107
  18. package/dist/chunk-V2Q3NYIH.js.map +1 -0
  19. package/dist/chunk-X3JRXEIB.js +98 -0
  20. package/dist/chunk-X3JRXEIB.js.map +1 -0
  21. package/dist/{chunk-36AA7IBJ.js → chunk-ZTP5QJ27.js} +51 -18
  22. package/dist/chunk-ZTP5QJ27.js.map +1 -0
  23. package/dist/client.cjs +29 -12
  24. package/dist/client.cjs.map +1 -1
  25. package/dist/client.d.cts +3 -2
  26. package/dist/client.d.ts +3 -2
  27. package/dist/client.js +2 -2
  28. package/dist/{table-DihEAlxG.d.cts → columns-D2_YzrCX.d.cts} +155 -136
  29. package/dist/{table-CIH7jZ2h.d.ts → columns-rZc7fQHI.d.ts} +155 -136
  30. package/dist/dynamodb/index.d.cts +3 -2
  31. package/dist/dynamodb/index.d.ts +3 -2
  32. package/dist/encryption/index.cjs +54 -16
  33. package/dist/encryption/index.cjs.map +1 -1
  34. package/dist/encryption/index.d.cts +807 -6
  35. package/dist/encryption/index.d.ts +807 -6
  36. package/dist/encryption/index.js +4 -4
  37. package/dist/encryption/v3.cjs +1078 -973
  38. package/dist/encryption/v3.cjs.map +1 -1
  39. package/dist/encryption/v3.d.cts +15 -12
  40. package/dist/encryption/v3.d.ts +15 -12
  41. package/dist/encryption/v3.js +49 -21
  42. package/dist/encryption/v3.js.map +1 -1
  43. package/dist/eql/v3/index.cjs +130 -79
  44. package/dist/eql/v3/index.cjs.map +1 -1
  45. package/dist/eql/v3/index.d.cts +115 -13
  46. package/dist/eql/v3/index.d.ts +115 -13
  47. package/dist/eql/v3/index.js +16 -6
  48. package/dist/index-BquA71_Y.d.ts +24 -0
  49. package/dist/index-fhWTOV0K.d.cts +24 -0
  50. package/dist/index.cjs +79 -27
  51. package/dist/index.cjs.map +1 -1
  52. package/dist/index.d.cts +5 -17
  53. package/dist/index.d.ts +5 -17
  54. package/dist/index.js +4 -4
  55. package/dist/schema/index.cjs +29 -12
  56. package/dist/schema/index.cjs.map +1 -1
  57. package/dist/schema/index.d.cts +1 -1
  58. package/dist/schema/index.d.ts +1 -1
  59. package/dist/schema/index.js +2 -2
  60. package/dist/{types-public-CpS5KjwX.d.ts → types-public-QMjYNfQO.d.cts} +765 -726
  61. package/dist/{types-public-CpS5KjwX.d.cts → types-public-QMjYNfQO.d.ts} +765 -726
  62. package/dist/types-public.cjs.map +1 -1
  63. package/dist/types-public.d.cts +1 -1
  64. package/dist/types-public.d.ts +1 -1
  65. package/dist/types-public.js +1 -1
  66. package/dist/wasm-inline.d.ts +779 -405
  67. package/dist/wasm-inline.js +606 -299
  68. package/dist/wasm-inline.js.map +1 -1
  69. package/package.json +25 -53
  70. package/dist/chunk-36AA7IBJ.js.map +0 -1
  71. package/dist/chunk-4AVL4VZD.js.map +0 -1
  72. package/dist/chunk-IADZCZEA.js +0 -23
  73. package/dist/chunk-IADZCZEA.js.map +0 -1
  74. package/dist/chunk-IBSK6P33.js +0 -209
  75. package/dist/chunk-IBSK6P33.js.map +0 -1
  76. package/dist/chunk-U66S7VIF.js.map +0 -1
  77. package/dist/client-DSGHBN-g.d.cts +0 -834
  78. package/dist/client-DfCrlHXh.d.ts +0 -834
  79. package/dist/drizzle/index.cjs +0 -5617
  80. package/dist/drizzle/index.cjs.map +0 -1
  81. package/dist/drizzle/index.d.cts +0 -358
  82. package/dist/drizzle/index.d.ts +0 -358
  83. package/dist/drizzle/index.js +0 -1220
  84. package/dist/drizzle/index.js.map +0 -1
  85. package/dist/supabase/index.cjs +0 -5951
  86. package/dist/supabase/index.cjs.map +0 -1
  87. package/dist/supabase/index.d.cts +0 -223
  88. package/dist/supabase/index.d.ts +0 -223
  89. package/dist/supabase/index.js +0 -1217
  90. package/dist/supabase/index.js.map +0 -1
package/dist/index.d.cts CHANGED
@@ -1,27 +1,15 @@
1
- export { f as Encryption } from './client-DSGHBN-g.cjs';
2
- import { a as Encrypted } from './types-public-CpS5KjwX.cjs';
3
- export { e as encryptedColumn, d as encryptedField, f as encryptedTable } from './types-public-CpS5KjwX.cjs';
1
+ export { Encryption } from './encryption/index.cjs';
2
+ export { e as encryptedToPgComposite, i as isEncryptedPayload } from './index-fhWTOV0K.cjs';
3
+ export { p as Encrypted, Z as encryptedColumn, _ as encryptedField, $ as encryptedTable } from './types-public-QMjYNfQO.cjs';
4
4
  import auth from '@cipherstash/auth';
5
5
  export { AuthErrorCode, AuthFailure, TokenResult } from '@cipherstash/auth';
6
6
  import '@byteslice/result';
7
7
  import './errors/index.cjs';
8
8
  import '@cipherstash/protect-ffi';
9
9
  import './identity/index.cjs';
10
+ import './base-operation-AOAIvsSB.cjs';
10
11
  import 'zod';
11
12
 
12
- type EncryptedPgComposite = {
13
- data: Encrypted;
14
- };
15
- /**
16
- * Helper function to transform an encrypted payload into a PostgreSQL composite type.
17
- * Use this when inserting data via Supabase or similar clients.
18
- */
19
- declare function encryptedToPgComposite(obj: Encrypted): EncryptedPgComposite;
20
- /**
21
- * Helper function to check if a value is an encrypted payload
22
- */
23
- declare function isEncryptedPayload(value: unknown): value is Encrypted;
24
-
25
13
  declare const AccessKeyStrategy: typeof auth.AccessKeyStrategy;
26
14
  type AccessKeyStrategy = InstanceType<typeof auth.AccessKeyStrategy>;
27
15
  declare const AutoStrategy: typeof auth.AutoStrategy;
@@ -31,4 +19,4 @@ type DeviceSessionStrategy = InstanceType<typeof auth.DeviceSessionStrategy>;
31
19
  declare const OidcFederationStrategy: typeof auth.OidcFederationStrategy;
32
20
  type OidcFederationStrategy = InstanceType<typeof auth.OidcFederationStrategy>;
33
21
 
34
- export { AccessKeyStrategy, AutoStrategy, DeviceSessionStrategy, Encrypted, OidcFederationStrategy, encryptedToPgComposite, isEncryptedPayload };
22
+ export { AccessKeyStrategy, AutoStrategy, DeviceSessionStrategy, OidcFederationStrategy };
package/dist/index.d.ts CHANGED
@@ -1,27 +1,15 @@
1
- export { f as Encryption } from './client-DfCrlHXh.js';
2
- import { a as Encrypted } from './types-public-CpS5KjwX.js';
3
- export { e as encryptedColumn, d as encryptedField, f as encryptedTable } from './types-public-CpS5KjwX.js';
1
+ export { Encryption } from './encryption/index.js';
2
+ export { e as encryptedToPgComposite, i as isEncryptedPayload } from './index-BquA71_Y.js';
3
+ export { p as Encrypted, Z as encryptedColumn, _ as encryptedField, $ as encryptedTable } from './types-public-QMjYNfQO.js';
4
4
  import auth from '@cipherstash/auth';
5
5
  export { AuthErrorCode, AuthFailure, TokenResult } from '@cipherstash/auth';
6
6
  import '@byteslice/result';
7
7
  import './errors/index.js';
8
8
  import '@cipherstash/protect-ffi';
9
9
  import './identity/index.js';
10
+ import './base-operation-FXEzUXIq.js';
10
11
  import 'zod';
11
12
 
12
- type EncryptedPgComposite = {
13
- data: Encrypted;
14
- };
15
- /**
16
- * Helper function to transform an encrypted payload into a PostgreSQL composite type.
17
- * Use this when inserting data via Supabase or similar clients.
18
- */
19
- declare function encryptedToPgComposite(obj: Encrypted): EncryptedPgComposite;
20
- /**
21
- * Helper function to check if a value is an encrypted payload
22
- */
23
- declare function isEncryptedPayload(value: unknown): value is Encrypted;
24
-
25
13
  declare const AccessKeyStrategy: typeof auth.AccessKeyStrategy;
26
14
  type AccessKeyStrategy = InstanceType<typeof auth.AccessKeyStrategy>;
27
15
  declare const AutoStrategy: typeof auth.AutoStrategy;
@@ -31,4 +19,4 @@ type DeviceSessionStrategy = InstanceType<typeof auth.DeviceSessionStrategy>;
31
19
  declare const OidcFederationStrategy: typeof auth.OidcFederationStrategy;
32
20
  type OidcFederationStrategy = InstanceType<typeof auth.OidcFederationStrategy>;
33
21
 
34
- export { AccessKeyStrategy, AutoStrategy, DeviceSessionStrategy, Encrypted, OidcFederationStrategy, encryptedToPgComposite, isEncryptedPayload };
22
+ export { AccessKeyStrategy, AutoStrategy, DeviceSessionStrategy, OidcFederationStrategy };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Encryption
3
- } from "./chunk-36AA7IBJ.js";
3
+ } from "./chunk-ZTP5QJ27.js";
4
4
  import "./chunk-OFQ555AX.js";
5
5
  import {
6
6
  encryptedToPgComposite,
@@ -10,9 +10,9 @@ import {
10
10
  encryptedColumn,
11
11
  encryptedField,
12
12
  encryptedTable
13
- } from "./chunk-MP3SSDNN.js";
14
- import "./chunk-IADZCZEA.js";
15
- import "./chunk-4AVL4VZD.js";
13
+ } from "./chunk-CLM7E4I6.js";
14
+ import "./chunk-7333ZC6L.js";
15
+ import "./chunk-3B5ZX3IS.js";
16
16
  import "./chunk-JSG2AMDI.js";
17
17
  import "./chunk-HQANMV7R.js";
18
18
  import "./chunk-LBMC4D6D.js";
@@ -4085,6 +4085,23 @@ function defaultMatchOpts() {
4085
4085
  include_original: true
4086
4086
  };
4087
4087
  }
4088
+ function cloneMatchOpts(opts) {
4089
+ return {
4090
+ ...opts,
4091
+ tokenizer: { ...opts.tokenizer },
4092
+ token_filters: opts.token_filters.map((f) => ({ ...f }))
4093
+ };
4094
+ }
4095
+ function resolveMatchOpts(opts) {
4096
+ const defaults = defaultMatchOpts();
4097
+ return cloneMatchOpts({
4098
+ tokenizer: opts?.tokenizer ?? defaults.tokenizer,
4099
+ token_filters: opts?.token_filters ?? defaults.token_filters,
4100
+ k: opts?.k ?? defaults.k,
4101
+ m: opts?.m ?? defaults.m,
4102
+ include_original: opts?.include_original ?? defaults.include_original
4103
+ });
4104
+ }
4088
4105
 
4089
4106
  // src/schema/index.ts
4090
4107
  var eqlCastAsEnum = external_exports.enum([
@@ -4142,6 +4159,7 @@ var tokenizerSchema = external_exports.union([
4142
4159
  })
4143
4160
  ]).default({ kind: "ngram", token_length: 3 }).optional();
4144
4161
  var oreIndexOptsSchema = external_exports.object({});
4162
+ var opeIndexOptsSchema = external_exports.object({});
4145
4163
  var uniqueIndexOptsSchema = external_exports.object({
4146
4164
  token_filters: external_exports.array(tokenFilterSchema).default([]).optional()
4147
4165
  });
@@ -4163,10 +4181,12 @@ var arrayIndexModeSchema = external_exports.union([
4163
4181
  ]);
4164
4182
  var steVecIndexOptsSchema = external_exports.object({
4165
4183
  prefix: external_exports.string(),
4166
- array_index_mode: arrayIndexModeSchema.optional()
4184
+ array_index_mode: arrayIndexModeSchema.optional(),
4185
+ mode: external_exports.enum(["compat", "standard"]).optional()
4167
4186
  });
4168
4187
  var indexesSchema = external_exports.object({
4169
4188
  ore: oreIndexOptsSchema.optional(),
4189
+ ope: opeIndexOptsSchema.optional(),
4170
4190
  unique: uniqueIndexOptsSchema.optional(),
4171
4191
  match: matchIndexOptsSchema.optional(),
4172
4192
  ste_vec: steVecIndexOptsSchema.optional()
@@ -4195,7 +4215,7 @@ var EncryptedField = class {
4195
4215
  * a different type so the encryption layer knows how to encode the plaintext
4196
4216
  * before encrypting.
4197
4217
  *
4198
- * @param castAs - The plaintext data type: `'string'`, `'number'`, `'boolean'`, `'date'`, `'text'`, `'bigint'`, or `'json'`.
4218
+ * @param castAs - The plaintext data type: `'string'`, `'number'`, `'boolean'`, `'date'`, `'timestamp'`, `'text'`, `'bigint'`, or `'json'`. Use `'timestamp'` (not `'date'`) to preserve time-of-day — `'date'` truncates to midnight.
4199
4219
  * @returns This `EncryptedField` instance for method chaining.
4200
4220
  *
4201
4221
  * @example
@@ -4234,7 +4254,7 @@ var EncryptedColumn = class {
4234
4254
  * a different type so the encryption layer knows how to encode the plaintext
4235
4255
  * before encrypting.
4236
4256
  *
4237
- * @param castAs - The plaintext data type: `'string'`, `'number'`, `'boolean'`, `'date'`, `'bigint'`, or `'json'`.
4257
+ * @param castAs - The plaintext data type: `'string'`, `'number'`, `'boolean'`, `'date'`, `'timestamp'`, `'text'`, `'bigint'`, or `'json'`. Use `'timestamp'` (not `'date'`) to preserve time-of-day — `'date'` truncates to midnight.
4238
4258
  * @returns This `EncryptedColumn` instance for method chaining.
4239
4259
  *
4240
4260
  * @example
@@ -4323,14 +4343,7 @@ var EncryptedColumn = class {
4323
4343
  * ```
4324
4344
  */
4325
4345
  freeTextSearch(opts) {
4326
- const defaults = defaultMatchOpts();
4327
- this.indexesValue.match = {
4328
- tokenizer: opts?.tokenizer ?? defaults.tokenizer,
4329
- token_filters: opts?.token_filters ?? defaults.token_filters,
4330
- k: opts?.k ?? defaults.k,
4331
- m: opts?.m ?? defaults.m,
4332
- include_original: opts?.include_original ?? defaults.include_original
4333
- };
4346
+ this.indexesValue.match = resolveMatchOpts(opts);
4334
4347
  return this;
4335
4348
  }
4336
4349
  /**
@@ -4357,7 +4370,11 @@ var EncryptedColumn = class {
4357
4370
  */
4358
4371
  searchableJson() {
4359
4372
  this.castAsValue = "json";
4360
- this.indexesValue.ste_vec = { prefix: "enabled", array_index_mode: "all" };
4373
+ this.indexesValue.ste_vec = {
4374
+ prefix: "enabled",
4375
+ array_index_mode: "all",
4376
+ mode: "standard"
4377
+ };
4361
4378
  return this;
4362
4379
  }
4363
4380
  build() {