@cipherstash/stack 0.4.0 → 0.6.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 (80) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +9 -36
  3. package/dist/bin/stash.js +220 -184
  4. package/dist/bin/stash.js.map +1 -1
  5. package/dist/{chunk-OAPLZLR5.js → chunk-GXGEW6T4.js} +2 -76
  6. package/dist/chunk-GXGEW6T4.js.map +1 -0
  7. package/dist/{chunk-KOU2MHXJ.js → chunk-HCL75LXQ.js} +1 -1
  8. package/dist/chunk-HCL75LXQ.js.map +1 -0
  9. package/dist/chunk-LBMC4D6D.js +19 -0
  10. package/dist/chunk-LBMC4D6D.js.map +1 -0
  11. package/dist/chunk-Q5FTQLYG.js +68 -0
  12. package/dist/chunk-Q5FTQLYG.js.map +1 -0
  13. package/dist/{chunk-WUZGKTMG.js → chunk-TGUELLJS.js} +16 -19
  14. package/dist/chunk-TGUELLJS.js.map +1 -0
  15. package/dist/chunk-YLISU7FD.js +357 -0
  16. package/dist/chunk-YLISU7FD.js.map +1 -0
  17. package/dist/{client-CrGQnSlk.d.ts → client-CJueivkw.d.cts} +36 -3
  18. package/dist/{client-CUGXheRq.d.cts → client-hHEpZIZH.d.ts} +36 -3
  19. package/dist/client.d.cts +4 -4
  20. package/dist/client.d.ts +4 -4
  21. package/dist/drizzle/index.cjs.map +1 -1
  22. package/dist/drizzle/index.d.cts +14 -6
  23. package/dist/drizzle/index.d.ts +14 -6
  24. package/dist/drizzle/index.js +3 -3
  25. package/dist/drizzle/index.js.map +1 -1
  26. package/dist/dynamodb/index.cjs +68 -0
  27. package/dist/dynamodb/index.cjs.map +1 -1
  28. package/dist/dynamodb/index.d.cts +4 -4
  29. package/dist/dynamodb/index.d.ts +4 -4
  30. package/dist/dynamodb/index.js +9 -0
  31. package/dist/dynamodb/index.js.map +1 -1
  32. package/dist/encryption/index.cjs +2572 -0
  33. package/dist/encryption/index.cjs.map +1 -0
  34. package/dist/encryption/index.d.cts +7 -0
  35. package/dist/encryption/index.d.ts +7 -0
  36. package/dist/encryption/index.js +17 -0
  37. package/dist/encryption/index.js.map +1 -0
  38. package/dist/errors/index.cjs +44 -0
  39. package/dist/errors/index.cjs.map +1 -0
  40. package/dist/errors/index.d.cts +94 -0
  41. package/dist/errors/index.d.ts +94 -0
  42. package/dist/errors/index.js +9 -0
  43. package/dist/errors/index.js.map +1 -0
  44. package/dist/identity/index.cjs +21 -13
  45. package/dist/identity/index.cjs.map +1 -1
  46. package/dist/identity/index.d.cts +78 -2
  47. package/dist/identity/index.d.ts +78 -2
  48. package/dist/identity/index.js +7 -3
  49. package/dist/identity/index.js.map +1 -1
  50. package/dist/index.cjs +379 -41
  51. package/dist/index.cjs.map +1 -1
  52. package/dist/index.d.cts +21 -19
  53. package/dist/index.d.ts +21 -19
  54. package/dist/index.js +14 -8
  55. package/dist/schema/index.d.cts +1 -2
  56. package/dist/schema/index.d.ts +1 -2
  57. package/dist/secrets/index.cjs +70 -39
  58. package/dist/secrets/index.cjs.map +1 -1
  59. package/dist/secrets/index.d.cts +4 -6
  60. package/dist/secrets/index.d.ts +4 -6
  61. package/dist/secrets/index.js +9 -318
  62. package/dist/secrets/index.js.map +1 -1
  63. package/dist/supabase/index.cjs +84 -1
  64. package/dist/supabase/index.cjs.map +1 -1
  65. package/dist/supabase/index.d.cts +4 -4
  66. package/dist/supabase/index.d.ts +4 -4
  67. package/dist/supabase/index.js +24 -1
  68. package/dist/supabase/index.js.map +1 -1
  69. package/dist/{types-public-Wj6tB_ux.d.ts → types-public-07ilcGY-.d.cts} +1 -9
  70. package/dist/{types-public-Wj6tB_ux.d.cts → types-public-07ilcGY-.d.ts} +1 -9
  71. package/dist/types-public.cjs.map +1 -1
  72. package/dist/types-public.d.cts +1 -2
  73. package/dist/types-public.d.ts +1 -2
  74. package/dist/types-public.js +1 -1
  75. package/package.json +29 -1
  76. package/dist/chunk-KOU2MHXJ.js.map +0 -1
  77. package/dist/chunk-OAPLZLR5.js.map +0 -1
  78. package/dist/chunk-WUZGKTMG.js.map +0 -1
  79. package/dist/index-9-Ya3fDK.d.cts +0 -169
  80. package/dist/index-9-Ya3fDK.d.ts +0 -169
package/dist/index.d.cts CHANGED
@@ -1,22 +1,24 @@
1
- import { E as EncryptionClient } from './client-CUGXheRq.cjs';
2
- import { E as EncryptionClientConfig } from './types-public-Wj6tB_ux.cjs';
3
- export { d as EncryptedColumn, h as EncryptedField, i as EncryptedFromSchema, f as EncryptedTable, g as EncryptedTableColumn, c as InferEncrypted, I as InferPlaintext, a as encryptedColumn, b as encryptedField, e as encryptedTable } from './types-public-Wj6tB_ux.cjs';
4
- export { C as ClientInitError, c as CtsTokenError, D as DecryptionOperationError, a as EncryptionError, E as EncryptionErrorTypes, b as EncryptionOperationError, L as LockContextError, S as StackError, g as getErrorMessage } from './index-9-Ya3fDK.cjs';
5
- import '@byteslice/result';
6
- import '@cipherstash/protect-ffi';
1
+ import { E as Encrypted } from './types-public-07ilcGY-.cjs';
2
+ export { e as encryptedColumn, a as encryptedField, b as encryptedTable } from './types-public-07ilcGY-.cjs';
3
+ export { E as Encryption } from './client-CJueivkw.cjs';
4
+ export { Secrets } from './secrets/index.cjs';
7
5
  import 'zod';
8
- import 'evlog';
9
-
10
- /** Initialize an Encryption client with the provided configuration.
11
-
12
- @param config - The configuration object for initializing the Encryption client.
13
-
14
- @see {@link EncryptionClientConfig} for details on the configuration options.
15
-
16
- @returns A Promise that resolves to an instance of EncryptionClient.
6
+ import '@cipherstash/protect-ffi';
7
+ import './errors/index.cjs';
8
+ import '@byteslice/result';
9
+ import './identity/index.cjs';
17
10
 
18
- @throws Will throw an error if no schemas are provided or if the keyset ID is not a valid UUID.
19
- */
20
- declare const Encryption: (config: EncryptionClientConfig) => Promise<EncryptionClient>;
11
+ type EncryptedPgComposite = {
12
+ data: Encrypted;
13
+ };
14
+ /**
15
+ * Helper function to transform an encrypted payload into a PostgreSQL composite type.
16
+ * Use this when inserting data via Supabase or similar clients.
17
+ */
18
+ declare function encryptedToPgComposite(obj: Encrypted): EncryptedPgComposite;
19
+ /**
20
+ * Helper function to check if a value is an encrypted payload
21
+ */
22
+ declare function isEncryptedPayload(value: unknown): value is Encrypted;
21
23
 
22
- export { Encryption };
24
+ export { Encrypted, encryptedToPgComposite, isEncryptedPayload };
package/dist/index.d.ts CHANGED
@@ -1,22 +1,24 @@
1
- import { E as EncryptionClient } from './client-CrGQnSlk.js';
2
- import { E as EncryptionClientConfig } from './types-public-Wj6tB_ux.js';
3
- export { d as EncryptedColumn, h as EncryptedField, i as EncryptedFromSchema, f as EncryptedTable, g as EncryptedTableColumn, c as InferEncrypted, I as InferPlaintext, a as encryptedColumn, b as encryptedField, e as encryptedTable } from './types-public-Wj6tB_ux.js';
4
- export { C as ClientInitError, c as CtsTokenError, D as DecryptionOperationError, a as EncryptionError, E as EncryptionErrorTypes, b as EncryptionOperationError, L as LockContextError, S as StackError, g as getErrorMessage } from './index-9-Ya3fDK.js';
5
- import '@byteslice/result';
6
- import '@cipherstash/protect-ffi';
1
+ import { E as Encrypted } from './types-public-07ilcGY-.js';
2
+ export { e as encryptedColumn, a as encryptedField, b as encryptedTable } from './types-public-07ilcGY-.js';
3
+ export { E as Encryption } from './client-hHEpZIZH.js';
4
+ export { Secrets } from './secrets/index.js';
7
5
  import 'zod';
8
- import 'evlog';
9
-
10
- /** Initialize an Encryption client with the provided configuration.
11
-
12
- @param config - The configuration object for initializing the Encryption client.
13
-
14
- @see {@link EncryptionClientConfig} for details on the configuration options.
15
-
16
- @returns A Promise that resolves to an instance of EncryptionClient.
6
+ import '@cipherstash/protect-ffi';
7
+ import './errors/index.js';
8
+ import '@byteslice/result';
9
+ import './identity/index.js';
17
10
 
18
- @throws Will throw an error if no schemas are provided or if the keyset ID is not a valid UUID.
19
- */
20
- declare const Encryption: (config: EncryptionClientConfig) => Promise<EncryptionClient>;
11
+ type EncryptedPgComposite = {
12
+ data: Encrypted;
13
+ };
14
+ /**
15
+ * Helper function to transform an encrypted payload into a PostgreSQL composite type.
16
+ * Use this when inserting data via Supabase or similar clients.
17
+ */
18
+ declare function encryptedToPgComposite(obj: Encrypted): EncryptedPgComposite;
19
+ /**
20
+ * Helper function to check if a value is an encrypted payload
21
+ */
22
+ declare function isEncryptedPayload(value: unknown): value is Encrypted;
21
23
 
22
- export { Encryption };
24
+ export { Encrypted, encryptedToPgComposite, isEncryptedPayload };
package/dist/index.js CHANGED
@@ -1,23 +1,29 @@
1
+ import {
2
+ Secrets
3
+ } from "./chunk-YLISU7FD.js";
1
4
  import {
2
5
  Encryption
3
- } from "./chunk-WUZGKTMG.js";
4
- import "./chunk-4RNBI3UH.js";
5
- import "./chunk-KOU2MHXJ.js";
6
+ } from "./chunk-TGUELLJS.js";
6
7
  import {
7
- EncryptionErrorTypes,
8
- getErrorMessage
9
- } from "./chunk-OAPLZLR5.js";
8
+ encryptedToPgComposite,
9
+ isEncryptedPayload
10
+ } from "./chunk-4RNBI3UH.js";
10
11
  import {
11
12
  encryptedColumn,
12
13
  encryptedField,
13
14
  encryptedTable
14
15
  } from "./chunk-Y35W4WFN.js";
16
+ import "./chunk-HCL75LXQ.js";
17
+ import "./chunk-GXGEW6T4.js";
18
+ import "./chunk-Q5FTQLYG.js";
19
+ import "./chunk-LBMC4D6D.js";
15
20
  export {
16
21
  Encryption,
17
- EncryptionErrorTypes,
22
+ Secrets,
18
23
  encryptedColumn,
19
24
  encryptedField,
20
25
  encryptedTable,
21
- getErrorMessage
26
+ encryptedToPgComposite,
27
+ isEncryptedPayload
22
28
  };
23
29
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,3 @@
1
- export { C as CastAs, x as ColumnSchema, t as EncryptConfig, d as EncryptedColumn, h as EncryptedField, f as EncryptedTable, g as EncryptedTableColumn, c as InferEncrypted, I as InferPlaintext, M as MatchIndexOpts, O as OreIndexOpts, w as SteVecIndexOpts, T as TokenFilter, U as UniqueIndexOpts, y as buildEncryptConfig, u as castAsEnum, v as encryptConfigSchema, a as encryptedColumn, b as encryptedField, e as encryptedTable } from '../types-public-Wj6tB_ux.cjs';
1
+ export { C as CastAs, u as ColumnSchema, q as EncryptConfig, f as EncryptedColumn, n as EncryptedField, c as EncryptedTable, d as EncryptedTableColumn, I as InferEncrypted, t as InferPlaintext, M as MatchIndexOpts, O as OreIndexOpts, v as SteVecIndexOpts, T as TokenFilter, U as UniqueIndexOpts, w as buildEncryptConfig, x as castAsEnum, y as encryptConfigSchema, e as encryptedColumn, a as encryptedField, b as encryptedTable } from '../types-public-07ilcGY-.cjs';
2
2
  import 'zod';
3
- import 'evlog';
4
3
  import '@cipherstash/protect-ffi';
@@ -1,4 +1,3 @@
1
- export { C as CastAs, x as ColumnSchema, t as EncryptConfig, d as EncryptedColumn, h as EncryptedField, f as EncryptedTable, g as EncryptedTableColumn, c as InferEncrypted, I as InferPlaintext, M as MatchIndexOpts, O as OreIndexOpts, w as SteVecIndexOpts, T as TokenFilter, U as UniqueIndexOpts, y as buildEncryptConfig, u as castAsEnum, v as encryptConfigSchema, a as encryptedColumn, b as encryptedField, e as encryptedTable } from '../types-public-Wj6tB_ux.js';
1
+ export { C as CastAs, u as ColumnSchema, q as EncryptConfig, f as EncryptedColumn, n as EncryptedField, c as EncryptedTable, d as EncryptedTableColumn, I as InferEncrypted, t as InferPlaintext, M as MatchIndexOpts, O as OreIndexOpts, v as SteVecIndexOpts, T as TokenFilter, U as UniqueIndexOpts, w as buildEncryptConfig, x as castAsEnum, y as encryptConfigSchema, e as encryptedColumn, a as encryptedField, b as encryptedTable } from '../types-public-07ilcGY-.js';
2
2
  import 'zod';
3
- import 'evlog';
4
3
  import '@cipherstash/protect-ffi';
@@ -72,15 +72,6 @@ function isEncryptedPayload(value) {
72
72
  return true;
73
73
  }
74
74
 
75
- // src/errors/index.ts
76
- var EncryptionErrorTypes = {
77
- ClientInitError: "ClientInitError",
78
- EncryptionError: "EncryptionError",
79
- DecryptionError: "DecryptionError",
80
- LockContextError: "LockContextError",
81
- CtsTokenError: "CtsTokenError"
82
- };
83
-
84
75
  // src/schema/index.ts
85
76
  var import_zod = require("zod");
86
77
  var castAsEnum = import_zod.z.enum(["bigint", "boolean", "date", "number", "string", "json", "text"]).default("text");
@@ -405,6 +396,15 @@ function buildEncryptConfig(...protectTables) {
405
396
  return config;
406
397
  }
407
398
 
399
+ // src/errors/index.ts
400
+ var EncryptionErrorTypes = {
401
+ ClientInitError: "ClientInitError",
402
+ EncryptionError: "EncryptionError",
403
+ DecryptionError: "DecryptionError",
404
+ LockContextError: "LockContextError",
405
+ CtsTokenError: "CtsTokenError"
406
+ };
407
+
408
408
  // src/utils/config/index.ts
409
409
  var import_node_fs = __toESM(require("fs"), 1);
410
410
  var import_node_path = __toESM(require("path"), 1);
@@ -470,25 +470,33 @@ function loadWorkSpaceId(suppliedCrn) {
470
470
 
471
471
  // src/utils/logger/index.ts
472
472
  var import_evlog = require("evlog");
473
- function samplingFromEnv() {
474
- const env = process.env.STASH_LOG_LEVEL;
475
- if (!env) return void 0;
476
- const levels = ["debug", "info", "warn", "error"];
477
- const idx = levels.indexOf(env);
478
- if (idx === -1) return void 0;
479
- return Object.fromEntries(levels.map((l, i) => [l, i >= idx ? 100 : 0]));
473
+ var validLevels = ["debug", "info", "error"];
474
+ function levelFromEnv() {
475
+ const env = process.env.STASH_STACK_LOG;
476
+ if (env && validLevels.includes(env)) return env;
477
+ return "error";
478
+ }
479
+ function samplingRatesForLevel(level) {
480
+ switch (level) {
481
+ case "debug":
482
+ return { debug: 100, info: 100, warn: 100, error: 100 };
483
+ case "info":
484
+ return { debug: 0, info: 100, warn: 100, error: 100 };
485
+ case "error":
486
+ default:
487
+ return { debug: 0, info: 0, warn: 0, error: 100 };
488
+ }
480
489
  }
481
490
  var initialized = false;
482
- function initStackLogger(config) {
491
+ function initStackLogger() {
483
492
  if (initialized) return;
484
493
  initialized = true;
485
- const rates = samplingFromEnv();
494
+ const level = levelFromEnv();
495
+ const rates = samplingRatesForLevel(level);
486
496
  (0, import_evlog.initLogger)({
487
497
  env: { service: "@cipherstash/stack" },
488
- enabled: config?.enabled ?? !!rates,
489
- pretty: config?.pretty,
490
- ...rates && { sampling: { rates } },
491
- ...config?.drain && { drain: config.drain }
498
+ enabled: true,
499
+ sampling: { rates }
492
500
  });
493
501
  }
494
502
  initStackLogger();
@@ -526,6 +534,7 @@ var logger = {
526
534
  // src/encryption/index.ts
527
535
  var import_result11 = require("@byteslice/result");
528
536
  var import_protect_ffi9 = require("@cipherstash/protect-ffi");
537
+ var import_uuid = require("uuid");
529
538
 
530
539
  // src/encryption/helpers/type-guards.ts
531
540
  function isScalarQueryTermArray(value) {
@@ -2801,23 +2810,14 @@ var EncryptionClient = class {
2801
2810
  };
2802
2811
  }
2803
2812
  };
2804
-
2805
- // src/index.ts
2806
- function isValidUuid(uuid) {
2807
- const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
2808
- return uuidRegex.test(uuid);
2809
- }
2810
2813
  var Encryption = async (config) => {
2811
- if (config.logging) {
2812
- initStackLogger(config.logging);
2813
- }
2814
2814
  const { schemas, config: clientConfig } = config;
2815
2815
  if (!schemas.length) {
2816
2816
  throw new Error(
2817
2817
  "[encryption]: At least one encryptedTable must be provided to initialize the encryption client"
2818
2818
  );
2819
2819
  }
2820
- if (clientConfig?.keyset && "id" in clientConfig.keyset && !isValidUuid(clientConfig.keyset.id)) {
2820
+ if (clientConfig?.keyset && "id" in clientConfig.keyset && !(0, import_uuid.validate)(clientConfig.keyset.id)) {
2821
2821
  throw new Error(
2822
2822
  "[encryption]: Invalid UUID provided for keyset id. Must be a valid UUID."
2823
2823
  );
@@ -2843,7 +2843,22 @@ var Secrets = class {
2843
2843
  value: encryptedColumn("value")
2844
2844
  });
2845
2845
  constructor(config) {
2846
- this.config = config;
2846
+ const workspaceCRN = config.workspaceCRN ?? process.env.CS_WORKSPACE_CRN;
2847
+ const clientId = config.clientId ?? process.env.CS_CLIENT_ID;
2848
+ const clientKey = config.clientKey ?? process.env.CS_CLIENT_KEY;
2849
+ const accessKey = config.accessKey ?? process.env.CS_CLIENT_ACCESS_KEY;
2850
+ if (!workspaceCRN || !clientId || !clientKey || !accessKey) {
2851
+ throw new Error(
2852
+ "Missing required configuration or environment variables."
2853
+ );
2854
+ }
2855
+ this.config = {
2856
+ environment: config.environment,
2857
+ workspaceCRN,
2858
+ clientId,
2859
+ clientKey,
2860
+ accessKey
2861
+ };
2847
2862
  }
2848
2863
  initPromise = null;
2849
2864
  /**
@@ -2856,24 +2871,24 @@ var Secrets = class {
2856
2871
  return this.initPromise;
2857
2872
  }
2858
2873
  async _doInit() {
2874
+ logger.debug("Initializing the Secrets client.");
2859
2875
  this.encryptionClient = await Encryption({
2860
2876
  schemas: [this.secretsSchema],
2861
2877
  config: {
2862
2878
  workspaceCrn: this.config.workspaceCRN,
2863
2879
  clientId: this.config.clientId,
2864
2880
  clientKey: this.config.clientKey,
2865
- accessKey: this.config.apiKey,
2866
- keyset: {
2867
- name: this.config.environment
2868
- }
2881
+ accessKey: this.config.accessKey,
2882
+ keyset: { name: this.config.environment }
2869
2883
  }
2870
2884
  });
2885
+ logger.debug("Successfully initialized the Secrets client.");
2871
2886
  }
2872
2887
  /**
2873
2888
  * Get the authorization header for API requests
2874
2889
  */
2875
2890
  getAuthHeader() {
2876
- return `Bearer ${this.config.apiKey}`;
2891
+ return `Bearer ${this.config.accessKey}`;
2877
2892
  }
2878
2893
  /**
2879
2894
  * Make an API request with error handling.
@@ -2888,6 +2903,7 @@ var Secrets = class {
2888
2903
  const searchParams = new URLSearchParams(options.params);
2889
2904
  url = `${url}?${searchParams.toString()}`;
2890
2905
  }
2906
+ logger.debug(`Secrets API request: ${method} ${path2}`);
2891
2907
  const headers = {
2892
2908
  "Content-Type": "application/json",
2893
2909
  Authorization: this.getAuthHeader()
@@ -2906,6 +2922,7 @@ var Secrets = class {
2906
2922
  } catch {
2907
2923
  errorMessage = errorText || errorMessage;
2908
2924
  }
2925
+ logger.error(`Secrets API error on ${method} ${path2}: ${errorMessage}`);
2909
2926
  return {
2910
2927
  failure: {
2911
2928
  type: "ApiError",
@@ -2913,13 +2930,16 @@ var Secrets = class {
2913
2930
  }
2914
2931
  };
2915
2932
  }
2933
+ logger.debug(`Secrets API request successful: ${method} ${path2}`);
2916
2934
  const data = await response.json();
2917
2935
  return { data };
2918
2936
  } catch (error) {
2937
+ const message = error instanceof Error ? error.message : "Unknown network error occurred";
2938
+ logger.error(`Secrets network error on ${method} ${path2}: ${message}`);
2919
2939
  return {
2920
2940
  failure: {
2921
2941
  type: "NetworkError",
2922
- message: error instanceof Error ? error.message : "Unknown network error occurred"
2942
+ message
2923
2943
  }
2924
2944
  };
2925
2945
  }
@@ -2935,6 +2955,7 @@ var Secrets = class {
2935
2955
  * @returns A Result containing the API response or an error
2936
2956
  */
2937
2957
  async set(name, value) {
2958
+ logger.debug("Setting secret");
2938
2959
  await this.ensureInitialized();
2939
2960
  if (!this.encryptionClient) {
2940
2961
  return {
@@ -2949,6 +2970,7 @@ var Secrets = class {
2949
2970
  table: this.secretsSchema
2950
2971
  });
2951
2972
  if (encryptResult.failure) {
2973
+ logger.error("Failed to encrypt secret");
2952
2974
  return {
2953
2975
  failure: {
2954
2976
  type: "EncryptionError",
@@ -2976,6 +2998,7 @@ var Secrets = class {
2976
2998
  * @returns A Result containing the decrypted value or an error
2977
2999
  */
2978
3000
  async get(name) {
3001
+ logger.debug("Getting secret");
2979
3002
  await this.ensureInitialized();
2980
3003
  if (!this.encryptionClient) {
2981
3004
  return {
@@ -3000,6 +3023,7 @@ var Secrets = class {
3000
3023
  apiResult.data.encryptedValue.data
3001
3024
  );
3002
3025
  if (decryptResult.failure) {
3026
+ logger.error("Failed to decrypt secret");
3003
3027
  return {
3004
3028
  failure: {
3005
3029
  type: "DecryptionError",
@@ -3008,6 +3032,7 @@ var Secrets = class {
3008
3032
  };
3009
3033
  }
3010
3034
  if (typeof decryptResult.data !== "string") {
3035
+ logger.error("Decrypted secret value is not a string");
3011
3036
  return {
3012
3037
  failure: {
3013
3038
  type: "DecryptionError",
@@ -3032,6 +3057,7 @@ var Secrets = class {
3032
3057
  * @returns A Result containing an object mapping secret names to their decrypted values
3033
3058
  */
3034
3059
  async getMany(names) {
3060
+ logger.debug(`Getting ${names.length} secrets.`);
3035
3061
  await this.ensureInitialized();
3036
3062
  if (!this.encryptionClient) {
3037
3063
  return {
@@ -3078,6 +3104,9 @@ var Secrets = class {
3078
3104
  }));
3079
3105
  const decryptResult = await this.encryptionClient.bulkDecryptModels(dataToDecrypt);
3080
3106
  if (decryptResult.failure) {
3107
+ logger.error(
3108
+ `Failed to decrypt secrets: ${decryptResult.failure.message}`
3109
+ );
3081
3110
  return {
3082
3111
  failure: {
3083
3112
  type: "DecryptionError",
@@ -3103,6 +3132,7 @@ var Secrets = class {
3103
3132
  * @returns A Result containing the list of secrets or an error
3104
3133
  */
3105
3134
  async list() {
3135
+ logger.debug("Listing secrets.");
3106
3136
  const workspaceId = extractWorkspaceIdFromCrn(this.config.workspaceCRN);
3107
3137
  const apiResult = await this.apiRequest(
3108
3138
  "GET",
@@ -3128,6 +3158,7 @@ var Secrets = class {
3128
3158
  * @returns A Result containing the API response or an error
3129
3159
  */
3130
3160
  async delete(name) {
3161
+ logger.debug("Deleting secret");
3131
3162
  const workspaceId = extractWorkspaceIdFromCrn(this.config.workspaceCRN);
3132
3163
  return await this.apiRequest("POST", "/delete", {
3133
3164
  body: {