@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.
Files changed (102) hide show
  1. package/CHANGELOG.md +225 -0
  2. package/README.md +2 -2
  3. package/dist/{chunk-CY5B4LIF.js → chunk-36AA7IBJ.js} +303 -204
  4. package/dist/chunk-36AA7IBJ.js.map +1 -0
  5. package/dist/{chunk-MD6742R6.js → chunk-4AVL4VZD.js} +1 -1
  6. package/dist/chunk-4AVL4VZD.js.map +1 -0
  7. package/dist/{chunk-4RNBI3UH.js → chunk-BNO32ZMV.js} +1 -1
  8. package/dist/chunk-BNO32ZMV.js.map +1 -0
  9. package/dist/{chunk-6FD7OBGM.js → chunk-HQANMV7R.js} +3 -3
  10. package/dist/chunk-HQANMV7R.js.map +1 -0
  11. package/dist/chunk-IADZCZEA.js +23 -0
  12. package/dist/chunk-IADZCZEA.js.map +1 -0
  13. package/dist/chunk-IBSK6P33.js +209 -0
  14. package/dist/chunk-IBSK6P33.js.map +1 -0
  15. package/dist/chunk-JSG2AMDI.js +17 -0
  16. package/dist/chunk-JSG2AMDI.js.map +1 -0
  17. package/dist/chunk-MP3SSDNN.js +4439 -0
  18. package/dist/chunk-MP3SSDNN.js.map +1 -0
  19. package/dist/chunk-OFQ555AX.js +191 -0
  20. package/dist/chunk-OFQ555AX.js.map +1 -0
  21. package/dist/chunk-PZ5AY32C.js +10 -0
  22. package/dist/chunk-PZ5AY32C.js.map +1 -0
  23. package/dist/chunk-U66S7VIF.js +435 -0
  24. package/dist/chunk-U66S7VIF.js.map +1 -0
  25. package/dist/{client-C_7TF8EL.d.cts → client-DSGHBN-g.d.cts} +209 -72
  26. package/dist/{client-BLbA6aFD.d.ts → client-DfCrlHXh.d.ts} +209 -72
  27. package/dist/client.cjs +4103 -43
  28. package/dist/client.cjs.map +1 -1
  29. package/dist/client.d.cts +5 -5
  30. package/dist/client.d.ts +5 -5
  31. package/dist/client.js +3 -1
  32. package/dist/drizzle/index.cjs +4139 -77
  33. package/dist/drizzle/index.cjs.map +1 -1
  34. package/dist/drizzle/index.d.cts +33 -33
  35. package/dist/drizzle/index.d.ts +33 -33
  36. package/dist/drizzle/index.js +39 -33
  37. package/dist/drizzle/index.js.map +1 -1
  38. package/dist/dynamodb/index.cjs +31 -14
  39. package/dist/dynamodb/index.cjs.map +1 -1
  40. package/dist/dynamodb/index.d.cts +12 -12
  41. package/dist/dynamodb/index.d.ts +12 -12
  42. package/dist/dynamodb/index.js +16 -12
  43. package/dist/dynamodb/index.js.map +1 -1
  44. package/dist/encryption/index.cjs +4611 -257
  45. package/dist/encryption/index.cjs.map +1 -1
  46. package/dist/encryption/index.d.cts +3 -3
  47. package/dist/encryption/index.d.ts +3 -3
  48. package/dist/encryption/index.js +35 -7
  49. package/dist/encryption/v3.cjs +7791 -0
  50. package/dist/encryption/v3.cjs.map +1 -0
  51. package/dist/encryption/v3.d.cts +100 -0
  52. package/dist/encryption/v3.d.ts +100 -0
  53. package/dist/encryption/v3.js +161 -0
  54. package/dist/encryption/v3.js.map +1 -0
  55. package/dist/eql/v3/index.cjs +612 -0
  56. package/dist/eql/v3/index.cjs.map +1 -0
  57. package/dist/eql/v3/index.d.cts +71 -0
  58. package/dist/eql/v3/index.d.ts +71 -0
  59. package/dist/eql/v3/index.js +89 -0
  60. package/dist/eql/v3/index.js.map +1 -0
  61. package/dist/errors/index.js +1 -0
  62. package/dist/identity/index.cjs +55 -35
  63. package/dist/identity/index.cjs.map +1 -1
  64. package/dist/identity/index.d.cts +54 -30
  65. package/dist/identity/index.d.ts +54 -30
  66. package/dist/identity/index.js +9 -177
  67. package/dist/identity/index.js.map +1 -1
  68. package/dist/index.cjs +4625 -273
  69. package/dist/index.cjs.map +1 -1
  70. package/dist/index.d.cts +18 -7
  71. package/dist/index.d.ts +18 -7
  72. package/dist/index.js +20 -5
  73. package/dist/index.js.map +1 -1
  74. package/dist/schema/index.cjs +4108 -44
  75. package/dist/schema/index.cjs.map +1 -1
  76. package/dist/schema/index.d.cts +1 -1
  77. package/dist/schema/index.d.ts +1 -1
  78. package/dist/schema/index.js +3 -1
  79. package/dist/supabase/index.cjs +4500 -75
  80. package/dist/supabase/index.cjs.map +1 -1
  81. package/dist/supabase/index.d.cts +113 -34
  82. package/dist/supabase/index.d.ts +113 -34
  83. package/dist/supabase/index.js +350 -32
  84. package/dist/supabase/index.js.map +1 -1
  85. package/dist/table-CIH7jZ2h.d.ts +603 -0
  86. package/dist/table-DihEAlxG.d.cts +603 -0
  87. package/dist/{types-public-Dv-r6Ik0.d.ts → types-public-CpS5KjwX.d.cts} +209 -36
  88. package/dist/{types-public-Dv-r6Ik0.d.cts → types-public-CpS5KjwX.d.ts} +209 -36
  89. package/dist/types-public.cjs.map +1 -1
  90. package/dist/types-public.d.cts +2 -2
  91. package/dist/types-public.d.ts +2 -2
  92. package/dist/types-public.js +2 -1
  93. package/dist/wasm-inline.d.ts +1269 -0
  94. package/dist/wasm-inline.js +4594 -0
  95. package/dist/wasm-inline.js.map +1 -0
  96. package/package.json +63 -13
  97. package/dist/chunk-4RNBI3UH.js.map +0 -1
  98. package/dist/chunk-6FD7OBGM.js.map +0 -1
  99. package/dist/chunk-CY5B4LIF.js.map +0 -1
  100. package/dist/chunk-JDZ2QUUF.js +0 -381
  101. package/dist/chunk-JDZ2QUUF.js.map +0 -1
  102. package/dist/chunk-MD6742R6.js.map +0 -1
@@ -1,43 +1,14 @@
1
1
  import * as drizzle_orm_pg_core from 'drizzle-orm/pg-core';
2
2
  import { PgTable, PgCustomColumn } from 'drizzle-orm/pg-core';
3
- import { c as EncryptedTable, f as EncryptedColumn, C as CastAs, M as MatchIndexOpts, T as TokenFilter } from '../types-public-Dv-r6Ik0.cjs';
4
- import { a as EncryptionClient } from '../client-C_7TF8EL.cjs';
3
+ import { g as EncryptedTable, k as EncryptedColumn, l as CastAs, M as MatchIndexOpts, T as TokenFilter } from '../types-public-CpS5KjwX.cjs';
5
4
  import { SQLWrapper, SQL, exists, notExists, isNull, isNotNull, not, arrayContains, arrayContained, arrayOverlaps } from 'drizzle-orm';
6
- import 'zod';
5
+ import { e as EncryptionClient } from '../client-DSGHBN-g.cjs';
7
6
  import '@cipherstash/protect-ffi';
8
- import '../errors/index.cjs';
7
+ import 'zod';
9
8
  import '@byteslice/result';
9
+ import '../errors/index.cjs';
10
10
  import '../identity/index.cjs';
11
11
 
12
- /**
13
- * Extracts the encrypted column keys from a Drizzle table type.
14
- * Columns created with `encryptedType` are `PgCustomColumn` instances;
15
- * this picks only those keys and maps them to `EncryptedColumn`.
16
- */
17
- type DrizzleEncryptedSchema<T> = {
18
- [K in keyof T as T[K] extends PgCustomColumn<any> ? K : never]: EncryptedColumn;
19
- };
20
- /**
21
- * Extracts an encryption schema from a Drizzle table definition.
22
- * This function identifies columns created with `encryptedType` and
23
- * builds a corresponding `EncryptedTable` with `encryptedColumn` definitions.
24
- *
25
- * @param table - The Drizzle table definition
26
- * @returns A EncryptedTable that can be used with encryption client initialization
27
- *
28
- * @example
29
- * ```ts
30
- * const drizzleUsersTable = pgTable('users', {
31
- * email: encryptedType('email', { freeTextSearch: true, equality: true }),
32
- * age: encryptedType('age', { dataType: 'number', orderAndRange: true }),
33
- * })
34
- *
35
- * const encryptionSchema = extractEncryptionSchema(drizzleUsersTable)
36
- * const client = await createEncryptionClient({ schemas: [encryptionSchema.build()] })
37
- * ```
38
- */
39
- declare function extractEncryptionSchema<T extends PgTable<any>>(table: T): EncryptedTable<DrizzleEncryptedSchema<T>> & DrizzleEncryptedSchema<T>;
40
-
41
12
  /**
42
13
  * Custom error types for better debugging
43
14
  */
@@ -265,6 +236,35 @@ declare function createEncryptionOperators(encryptionClient: EncryptionClient):
265
236
  arrayOverlaps: typeof arrayOverlaps;
266
237
  };
267
238
 
239
+ /**
240
+ * Extracts the encrypted column keys from a Drizzle table type.
241
+ * Columns created with `encryptedType` are `PgCustomColumn` instances;
242
+ * this picks only those keys and maps them to `EncryptedColumn`.
243
+ */
244
+ type DrizzleEncryptedSchema<T> = {
245
+ [K in keyof T as T[K] extends PgCustomColumn<any> ? K : never]: EncryptedColumn;
246
+ };
247
+ /**
248
+ * Extracts an encryption schema from a Drizzle table definition.
249
+ * This function identifies columns created with `encryptedType` and
250
+ * builds a corresponding `EncryptedTable` with `encryptedColumn` definitions.
251
+ *
252
+ * @param table - The Drizzle table definition
253
+ * @returns A EncryptedTable that can be used with encryption client initialization
254
+ *
255
+ * @example
256
+ * ```ts
257
+ * const drizzleUsersTable = pgTable('users', {
258
+ * email: encryptedType('email', { freeTextSearch: true, equality: true }),
259
+ * age: encryptedType('age', { dataType: 'number', orderAndRange: true }),
260
+ * })
261
+ *
262
+ * const encryptionSchema = extractEncryptionSchema(drizzleUsersTable)
263
+ * const client = await createEncryptionClient({ schemas: [encryptionSchema.build()] })
264
+ * ```
265
+ */
266
+ declare function extractEncryptionSchema<T extends PgTable<any>>(table: T): EncryptedTable<DrizzleEncryptedSchema<T>> & DrizzleEncryptedSchema<T>;
267
+
268
268
  /**
269
269
  * Configuration for encrypted column indexes and data types
270
270
  */
@@ -1,43 +1,14 @@
1
1
  import * as drizzle_orm_pg_core from 'drizzle-orm/pg-core';
2
2
  import { PgTable, PgCustomColumn } from 'drizzle-orm/pg-core';
3
- import { c as EncryptedTable, f as EncryptedColumn, C as CastAs, M as MatchIndexOpts, T as TokenFilter } from '../types-public-Dv-r6Ik0.js';
4
- import { a as EncryptionClient } from '../client-BLbA6aFD.js';
3
+ import { g as EncryptedTable, k as EncryptedColumn, l as CastAs, M as MatchIndexOpts, T as TokenFilter } from '../types-public-CpS5KjwX.js';
5
4
  import { SQLWrapper, SQL, exists, notExists, isNull, isNotNull, not, arrayContains, arrayContained, arrayOverlaps } from 'drizzle-orm';
6
- import 'zod';
5
+ import { e as EncryptionClient } from '../client-DfCrlHXh.js';
7
6
  import '@cipherstash/protect-ffi';
8
- import '../errors/index.js';
7
+ import 'zod';
9
8
  import '@byteslice/result';
9
+ import '../errors/index.js';
10
10
  import '../identity/index.js';
11
11
 
12
- /**
13
- * Extracts the encrypted column keys from a Drizzle table type.
14
- * Columns created with `encryptedType` are `PgCustomColumn` instances;
15
- * this picks only those keys and maps them to `EncryptedColumn`.
16
- */
17
- type DrizzleEncryptedSchema<T> = {
18
- [K in keyof T as T[K] extends PgCustomColumn<any> ? K : never]: EncryptedColumn;
19
- };
20
- /**
21
- * Extracts an encryption schema from a Drizzle table definition.
22
- * This function identifies columns created with `encryptedType` and
23
- * builds a corresponding `EncryptedTable` with `encryptedColumn` definitions.
24
- *
25
- * @param table - The Drizzle table definition
26
- * @returns A EncryptedTable that can be used with encryption client initialization
27
- *
28
- * @example
29
- * ```ts
30
- * const drizzleUsersTable = pgTable('users', {
31
- * email: encryptedType('email', { freeTextSearch: true, equality: true }),
32
- * age: encryptedType('age', { dataType: 'number', orderAndRange: true }),
33
- * })
34
- *
35
- * const encryptionSchema = extractEncryptionSchema(drizzleUsersTable)
36
- * const client = await createEncryptionClient({ schemas: [encryptionSchema.build()] })
37
- * ```
38
- */
39
- declare function extractEncryptionSchema<T extends PgTable<any>>(table: T): EncryptedTable<DrizzleEncryptedSchema<T>> & DrizzleEncryptedSchema<T>;
40
-
41
12
  /**
42
13
  * Custom error types for better debugging
43
14
  */
@@ -265,6 +236,35 @@ declare function createEncryptionOperators(encryptionClient: EncryptionClient):
265
236
  arrayOverlaps: typeof arrayOverlaps;
266
237
  };
267
238
 
239
+ /**
240
+ * Extracts the encrypted column keys from a Drizzle table type.
241
+ * Columns created with `encryptedType` are `PgCustomColumn` instances;
242
+ * this picks only those keys and maps them to `EncryptedColumn`.
243
+ */
244
+ type DrizzleEncryptedSchema<T> = {
245
+ [K in keyof T as T[K] extends PgCustomColumn<any> ? K : never]: EncryptedColumn;
246
+ };
247
+ /**
248
+ * Extracts an encryption schema from a Drizzle table definition.
249
+ * This function identifies columns created with `encryptedType` and
250
+ * builds a corresponding `EncryptedTable` with `encryptedColumn` definitions.
251
+ *
252
+ * @param table - The Drizzle table definition
253
+ * @returns A EncryptedTable that can be used with encryption client initialization
254
+ *
255
+ * @example
256
+ * ```ts
257
+ * const drizzleUsersTable = pgTable('users', {
258
+ * email: encryptedType('email', { freeTextSearch: true, equality: true }),
259
+ * age: encryptedType('age', { dataType: 'number', orderAndRange: true }),
260
+ * })
261
+ *
262
+ * const encryptionSchema = extractEncryptionSchema(drizzleUsersTable)
263
+ * const client = await createEncryptionClient({ schemas: [encryptionSchema.build()] })
264
+ * ```
265
+ */
266
+ declare function extractEncryptionSchema<T extends PgTable<any>>(table: T): EncryptedTable<DrizzleEncryptedSchema<T>> & DrizzleEncryptedSchema<T>;
267
+
268
268
  /**
269
269
  * Configuration for encrypted column indexes and data types
270
270
  */
@@ -1,17 +1,50 @@
1
1
  import {
2
2
  encryptedColumn,
3
3
  encryptedTable
4
- } from "../chunk-JDZ2QUUF.js";
4
+ } from "../chunk-MP3SSDNN.js";
5
+ import "../chunk-IADZCZEA.js";
5
6
  import {
6
7
  queryTypes
7
- } from "../chunk-MD6742R6.js";
8
+ } from "../chunk-4AVL4VZD.js";
9
+ import "../chunk-PZ5AY32C.js";
8
10
 
9
11
  // src/drizzle/index.ts
10
12
  import { customType } from "drizzle-orm/pg-core";
11
13
 
14
+ // src/drizzle/operators.ts
15
+ import {
16
+ and,
17
+ arrayContained,
18
+ arrayContains,
19
+ arrayOverlaps,
20
+ asc,
21
+ between,
22
+ bindIfParam,
23
+ desc,
24
+ eq,
25
+ exists,
26
+ gt,
27
+ gte,
28
+ ilike,
29
+ inArray,
30
+ isNotNull,
31
+ isNull,
32
+ like,
33
+ lt,
34
+ lte,
35
+ ne,
36
+ not,
37
+ notBetween,
38
+ notExists,
39
+ notIlike,
40
+ notInArray,
41
+ or,
42
+ sql
43
+ } from "drizzle-orm";
44
+
12
45
  // src/drizzle/schema-extraction.ts
13
46
  function extractEncryptionSchema(table) {
14
- const tableName = table[Symbol.for("drizzle:Name")];
47
+ const tableName = table[/* @__PURE__ */ Symbol.for("drizzle:Name")];
15
48
  if (!tableName) {
16
49
  throw new Error(
17
50
  "Unable to extract table name from Drizzle table. Ensure you are using a table created with pgTable()."
@@ -66,39 +99,11 @@ function extractEncryptionSchema(table) {
66
99
  }
67
100
 
68
101
  // src/drizzle/operators.ts
69
- import {
70
- and,
71
- arrayContained,
72
- arrayContains,
73
- arrayOverlaps,
74
- asc,
75
- between,
76
- desc,
77
- eq,
78
- exists,
79
- gt,
80
- gte,
81
- ilike,
82
- inArray,
83
- isNotNull,
84
- isNull,
85
- like,
86
- lt,
87
- lte,
88
- ne,
89
- not,
90
- notBetween,
91
- notExists,
92
- notIlike,
93
- notInArray,
94
- or
95
- } from "drizzle-orm";
96
- import { bindIfParam, sql } from "drizzle-orm";
97
102
  function isSQLWrapper(value) {
98
103
  return typeof value === "object" && value !== null && "sql" in value && typeof value.sql !== "undefined";
99
104
  }
100
105
  function isPgTable(value) {
101
- return typeof value === "object" && value !== null && Symbol.for("drizzle:Name") in value;
106
+ return typeof value === "object" && value !== null && /* @__PURE__ */ Symbol.for("drizzle:Name") in value;
102
107
  }
103
108
  var EncryptionOperatorError = class extends Error {
104
109
  constructor(message, context) {
@@ -106,6 +111,7 @@ var EncryptionOperatorError = class extends Error {
106
111
  this.context = context;
107
112
  this.name = "EncryptionOperatorError";
108
113
  }
114
+ context;
109
115
  };
110
116
  var EncryptionConfigError = class extends EncryptionOperatorError {
111
117
  constructor(message, context) {
@@ -118,7 +124,7 @@ function getDrizzleTableName(drizzleTable) {
118
124
  return void 0;
119
125
  }
120
126
  const tableWithSymbol = drizzleTable;
121
- return tableWithSymbol[Symbol.for("drizzle:Name")];
127
+ return tableWithSymbol[/* @__PURE__ */ Symbol.for("drizzle:Name")];
122
128
  }
123
129
  function getDrizzleTableFromColumn(drizzleColumn) {
124
130
  const column = drizzleColumn;