@grow-codes/aws-secrets-manager 0.1.0 → 0.1.1

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/lib/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunk5AEPFQD7_cjs = require('./chunk-5AEPFQD7.cjs');
3
+ var chunkZLYHN4AI_cjs = require('./chunk-ZLYHN4AI.cjs');
4
4
  var fs = require('fs');
5
5
  var undici = require('undici');
6
6
  var clientSecretsManager = require('@aws-sdk/client-secrets-manager');
@@ -37,14 +37,14 @@ async function probeHealth(probe) {
37
37
  try {
38
38
  return await probe();
39
39
  } catch (err) {
40
- if (err instanceof chunk5AEPFQD7_cjs.AwsSecretsManagerError) {
41
- if (err.code === chunk5AEPFQD7_cjs.ErrorCode.Cancelled || err.code === chunk5AEPFQD7_cjs.ErrorCode.Config) throw err;
40
+ if (err instanceof chunkZLYHN4AI_cjs.AwsSecretsManagerError) {
41
+ if (err.code === chunkZLYHN4AI_cjs.ErrorCode.Cancelled || err.code === chunkZLYHN4AI_cjs.ErrorCode.Config) throw err;
42
42
  if (err.httpStatus !== void 0) {
43
43
  return healthStatus("unhealthy", { httpStatus: err.httpStatus, error: err.code }, false);
44
44
  }
45
45
  return healthStatus("unreachable", { error: err.code }, false);
46
46
  }
47
- return healthStatus("unreachable", { error: chunk5AEPFQD7_cjs.ErrorCode.Unavailable }, false);
47
+ return healthStatus("unreachable", { error: chunkZLYHN4AI_cjs.ErrorCode.Unavailable }, false);
48
48
  }
49
49
  }
50
50
 
@@ -234,7 +234,7 @@ function validateCommonConfig(config) {
234
234
  if (config.proxy !== void 0 && !isHttpUrl(config.proxy)) {
235
235
  problems.push("proxy must be an http or https URL");
236
236
  }
237
- if (problems.length > 0) throw new chunk5AEPFQD7_cjs.ConfigError(`invalid configuration: ${problems.join("; ")}`);
237
+ if (problems.length > 0) throw new chunkZLYHN4AI_cjs.ConfigError(`invalid configuration: ${problems.join("; ")}`);
238
238
  }
239
239
  function readCommonEnv(reader, vendor = {}) {
240
240
  const out = {};
@@ -287,32 +287,32 @@ function mergeOptions(...layers) {
287
287
  }
288
288
  function describeCommonConfig(config) {
289
289
  const headers = {};
290
- for (const k of Object.keys(config.headers)) headers[k] = chunk5AEPFQD7_cjs.REDACTED;
290
+ for (const k of Object.keys(config.headers)) headers[k] = chunkZLYHN4AI_cjs.REDACTED;
291
291
  const out = {
292
- url: chunk5AEPFQD7_cjs.redactUrl(config.url),
292
+ url: chunkZLYHN4AI_cjs.redactUrl(config.url),
293
293
  connectTimeoutMs: config.connectTimeoutMs,
294
294
  requestTimeoutMs: config.requestTimeoutMs,
295
295
  totalTimeoutMs: config.totalTimeoutMs,
296
296
  retry: config.retry.toJSON(),
297
297
  tls: {
298
298
  ...config.tls,
299
- ...config.tls.caCertPem === void 0 ? {} : { caCertPem: chunk5AEPFQD7_cjs.REDACTED }
299
+ ...config.tls.caCertPem === void 0 ? {} : { caCertPem: chunkZLYHN4AI_cjs.REDACTED }
300
300
  },
301
301
  headers
302
302
  };
303
- if (config.proxy !== void 0) out.proxy = chunk5AEPFQD7_cjs.redactUrl(config.proxy);
303
+ if (config.proxy !== void 0) out.proxy = chunkZLYHN4AI_cjs.redactUrl(config.proxy);
304
304
  if (config.userAgentSuffix !== void 0) out.userAgentSuffix = config.userAgentSuffix;
305
305
  return out;
306
306
  }
307
307
  function secretValues(...values) {
308
- return values.filter((v) => v instanceof chunk5AEPFQD7_cjs.Secret).map((s) => s.reveal());
308
+ return values.filter((v) => v instanceof chunkZLYHN4AI_cjs.Secret).map((s) => s.reveal());
309
309
  }
310
310
 
311
311
  // src/core/version.ts
312
- var SDK_VERSION = "0.1.0";
312
+ var SDK_VERSION = "0.1.1";
313
313
  var PACKAGE_KEY = "aws-secrets-manager";
314
314
  var LANGUAGE = "typescript";
315
- var SDK_KIT_VERSION = "0.2.0";
315
+ var SDK_KIT_VERSION = "0.3.0";
316
316
 
317
317
  // src/core/transport.ts
318
318
  var DEFAULT_REQUEST_ID_HEADERS = [
@@ -402,7 +402,7 @@ var HttpTransport = class {
402
402
  this.#logger = safeLogger(options.config.logger);
403
403
  this.#hooks = options.config.hooks ?? {};
404
404
  this.#fetch = undici.fetch;
405
- this.#sleep = options.sleep ?? chunk5AEPFQD7_cjs.sleep;
405
+ this.#sleep = options.sleep ?? chunkZLYHN4AI_cjs.sleep;
406
406
  this.#now = options.now ?? Date.now;
407
407
  this.#requestIdHeaders = options.requestIdHeaders ?? DEFAULT_REQUEST_ID_HEADERS;
408
408
  this.#dispatcher = options.dispatcher;
@@ -413,6 +413,14 @@ var HttpTransport = class {
413
413
  get closed() {
414
414
  return this.#closed;
415
415
  }
416
+ /**
417
+ * Throws `CancelledError` (`"<operation>: client is closed"`, not retryable) once {@link close}
418
+ * was called (SPEC §2.4). Requests check this themselves; service methods that send no request
419
+ * (cached reads, local helpers) call it first.
420
+ */
421
+ ensureOpen(operation) {
422
+ if (this.#closed) throw new chunkZLYHN4AI_cjs.CancelledError(`${operation}: client is closed`);
423
+ }
416
424
  /** Builds the absolute URL for a path and query. */
417
425
  buildUrl(path, query) {
418
426
  let url;
@@ -435,7 +443,7 @@ var HttpTransport = class {
435
443
  }
436
444
  /** Redacts known secrets from a text (error messages, vendor text). */
437
445
  redact(text) {
438
- return chunk5AEPFQD7_cjs.redactText(text, this.#knownSecrets());
446
+ return chunkZLYHN4AI_cjs.redactText(text, this.#knownSecrets());
439
447
  }
440
448
  #knownSecrets() {
441
449
  return [...this.#options.knownSecrets?.() ?? []];
@@ -468,18 +476,18 @@ var HttpTransport = class {
468
476
  try {
469
477
  return await this.#request(options);
470
478
  } catch (err) {
471
- if (err instanceof chunk5AEPFQD7_cjs.AwsSecretsManagerError) err.message = this.redact(err.message);
479
+ if (err instanceof chunkZLYHN4AI_cjs.AwsSecretsManagerError) err.message = this.redact(err.message);
472
480
  throw err;
473
481
  }
474
482
  }
475
483
  async #request(options) {
476
484
  const method = (options.method ?? "GET").toUpperCase();
477
485
  const operation = options.operation ?? `${method} ${options.path.split("?")[0] ?? ""}`;
478
- if (this.#closed) throw new chunk5AEPFQD7_cjs.CancelledError(`${operation}: client is closed`);
486
+ this.ensureOpen(operation);
479
487
  const signal = options.signal;
480
- if (signal?.aborted === true) throw new chunk5AEPFQD7_cjs.CancelledError(`${operation}: cancelled`);
488
+ if (signal?.aborted === true) throw new chunkZLYHN4AI_cjs.CancelledError(`${operation}: cancelled`);
481
489
  const url = this.buildUrl(options.path, options.query);
482
- const safeUrl = chunk5AEPFQD7_cjs.redactUrl(url);
490
+ const safeUrl = chunkZLYHN4AI_cjs.redactUrl(url);
483
491
  const headers = this.#buildHeaders(options);
484
492
  const body = options.json !== void 0 ? JSON.stringify(options.json) : options.body;
485
493
  const idempotent = options.idempotent ?? isIdempotentMethod(method);
@@ -491,14 +499,14 @@ var HttpTransport = class {
491
499
  for (let attempt = 1; ; attempt++) {
492
500
  const remaining = deadline - this.#now();
493
501
  if (remaining <= 0) {
494
- throw new chunk5AEPFQD7_cjs.TimeoutError(`${operation}: total timeout of ${totalTimeout} ms exceeded`);
502
+ throw new chunkZLYHN4AI_cjs.TimeoutError(`${operation}: total timeout of ${totalTimeout} ms exceeded`);
495
503
  }
496
504
  const attemptTimeout = Math.min(requestTimeout, remaining);
497
505
  const isTotal = attemptTimeout < requestTimeout;
498
506
  safeCall(this.#hooks.onRequest, {
499
507
  method,
500
508
  url: safeUrl,
501
- headers: chunk5AEPFQD7_cjs.redactHeaders(headers),
509
+ headers: chunkZLYHN4AI_cjs.redactHeaders(headers),
502
510
  attempt
503
511
  });
504
512
  this.#logger.debug("http request", { method, url: safeUrl, attempt });
@@ -547,7 +555,7 @@ var HttpTransport = class {
547
555
  }
548
556
  const retryAfter = res.status === 429 || res.status === 503 ? parseRetryAfter(res.headers.get("retry-after"), this.#now()) : void 0;
549
557
  const reason = this.vendorText(res.text);
550
- const defaultError = chunk5AEPFQD7_cjs.errorForStatus(operation, res.status, {
558
+ const defaultError = chunkZLYHN4AI_cjs.errorForStatus(operation, res.status, {
551
559
  ...reason === void 0 ? {} : { reason },
552
560
  ...requestId === void 0 ? {} : { requestId },
553
561
  ...retryAfter === void 0 ? {} : { retryAfterMs: retryAfter }
@@ -593,7 +601,7 @@ var HttpTransport = class {
593
601
  attempt,
594
602
  willRetry: false
595
603
  });
596
- throw new chunk5AEPFQD7_cjs.TimeoutError(
604
+ throw new chunkZLYHN4AI_cjs.TimeoutError(
597
605
  `${operation}: total timeout of ${totalTimeout} ms exceeded after ${attempt} attempts`,
598
606
  {
599
607
  cause: failure,
@@ -620,7 +628,7 @@ var HttpTransport = class {
620
628
  waitMs: Math.round(waitMs)
621
629
  });
622
630
  await this.#sleep(waitMs, signal).catch((err) => {
623
- throw err instanceof chunk5AEPFQD7_cjs.AwsSecretsManagerError ? err : new chunk5AEPFQD7_cjs.CancelledError(`${operation}: cancelled`);
631
+ throw err instanceof chunkZLYHN4AI_cjs.AwsSecretsManagerError ? err : new chunkZLYHN4AI_cjs.CancelledError(`${operation}: cancelled`);
624
632
  });
625
633
  }
626
634
  }
@@ -695,30 +703,30 @@ var HttpTransport = class {
695
703
  try {
696
704
  return JSON.parse(text);
697
705
  } catch {
698
- throw new chunk5AEPFQD7_cjs.UnavailableError(`invalid JSON in response (HTTP ${status})`, {
706
+ throw new chunkZLYHN4AI_cjs.UnavailableError(`invalid JSON in response (HTTP ${status})`, {
699
707
  retryable: false,
700
708
  httpStatus: status
701
709
  });
702
710
  }
703
711
  }
704
712
  #classify(err, operation, timeoutMs, isTotal, totalTimeout) {
705
- if (err instanceof chunk5AEPFQD7_cjs.AwsSecretsManagerError) return err;
713
+ if (err instanceof chunkZLYHN4AI_cjs.AwsSecretsManagerError) return err;
706
714
  if (err instanceof AbortedAttempt) {
707
- if (err.kind === CANCEL) return new chunk5AEPFQD7_cjs.CancelledError(`${operation}: cancelled`);
708
- return isTotal ? new chunk5AEPFQD7_cjs.TimeoutError(`${operation}: total timeout of ${totalTimeout} ms exceeded`) : new chunk5AEPFQD7_cjs.TimeoutError(`${operation}: request timed out after ${timeoutMs} ms`);
715
+ if (err.kind === CANCEL) return new chunkZLYHN4AI_cjs.CancelledError(`${operation}: cancelled`);
716
+ return isTotal ? new chunkZLYHN4AI_cjs.TimeoutError(`${operation}: total timeout of ${totalTimeout} ms exceeded`) : new chunkZLYHN4AI_cjs.TimeoutError(`${operation}: request timed out after ${timeoutMs} ms`);
709
717
  }
710
- const cause = chunk5AEPFQD7_cjs.redactError(err, this.#knownSecrets());
718
+ const cause = chunkZLYHN4AI_cjs.redactError(err, this.#knownSecrets());
711
719
  const code = errorCode(err);
712
720
  if (code === "UND_ERR_CONNECT_TIMEOUT") {
713
- return new chunk5AEPFQD7_cjs.TimeoutError(
721
+ return new chunkZLYHN4AI_cjs.TimeoutError(
714
722
  `${operation}: connect timeout after ${this.#config.connectTimeoutMs} ms`,
715
723
  { cause }
716
724
  );
717
725
  }
718
726
  if (code !== void 0 && TLS_CODE.test(code)) {
719
- return new chunk5AEPFQD7_cjs.UnavailableError(`${operation}: TLS error (${code})`, { cause, retryable: false });
727
+ return new chunkZLYHN4AI_cjs.UnavailableError(`${operation}: TLS error (${code})`, { cause, retryable: false });
720
728
  }
721
- return new chunk5AEPFQD7_cjs.UnavailableError(
729
+ return new chunkZLYHN4AI_cjs.UnavailableError(
722
730
  `${operation}: network error${code === void 0 ? "" : ` (${code})`}`,
723
731
  { cause }
724
732
  );
@@ -730,9 +738,9 @@ var HttpTransport = class {
730
738
  try {
731
739
  mapped = classify(response);
732
740
  } catch (err) {
733
- mapped = err instanceof chunk5AEPFQD7_cjs.AwsSecretsManagerError ? err : void 0;
741
+ mapped = err instanceof chunkZLYHN4AI_cjs.AwsSecretsManagerError ? err : void 0;
734
742
  }
735
- if (mapped instanceof chunk5AEPFQD7_cjs.AwsSecretsManagerError) return mapped;
743
+ if (mapped instanceof chunkZLYHN4AI_cjs.AwsSecretsManagerError) return mapped;
736
744
  }
737
745
  return void 0;
738
746
  }
@@ -887,9 +895,9 @@ var AwsSecretsManagerConfig = class _AwsSecretsManagerConfig {
887
895
  if (region !== void 0) this.region = region;
888
896
  const accessKeyId = blankToUndefined(options.accessKeyId);
889
897
  if (accessKeyId !== void 0) this.accessKeyId = accessKeyId;
890
- const secretAccessKey = chunk5AEPFQD7_cjs.Secret.from(options.secretAccessKey);
898
+ const secretAccessKey = chunkZLYHN4AI_cjs.Secret.from(options.secretAccessKey);
891
899
  if (secretAccessKey !== void 0) this.secretAccessKey = secretAccessKey;
892
- const sessionToken = chunk5AEPFQD7_cjs.Secret.from(options.sessionToken);
900
+ const sessionToken = chunkZLYHN4AI_cjs.Secret.from(options.sessionToken);
893
901
  if (sessionToken !== void 0) this.sessionToken = sessionToken;
894
902
  const profile = blankToUndefined(options.profile);
895
903
  if (profile !== void 0) this.profile = profile;
@@ -916,7 +924,7 @@ var AwsSecretsManagerConfig = class _AwsSecretsManagerConfig {
916
924
  * Credentials left unset use the AWS SDK default chain.
917
925
  */
918
926
  static fromEnv(overrides = {}, env = process.env) {
919
- const reader = new chunk5AEPFQD7_cjs.EnvReader(_AwsSecretsManagerConfig.ENV_PREFIX, env);
927
+ const reader = new chunkZLYHN4AI_cjs.EnvReader(_AwsSecretsManagerConfig.ENV_PREFIX, env);
920
928
  const fromEnv = readCommonEnv(reader, VENDOR_ENV);
921
929
  const set = (key, value) => {
922
930
  if (value !== void 0) fromEnv[key] = value;
@@ -929,8 +937,8 @@ var AwsSecretsManagerConfig = class _AwsSecretsManagerConfig {
929
937
  set("sessionToken", reader.secret("SESSION_TOKEN"));
930
938
  } else {
931
939
  set("accessKeyId", firstEnv(env, VENDOR_ENV.accessKeyId));
932
- set("secretAccessKey", chunk5AEPFQD7_cjs.Secret.from(firstEnv(env, VENDOR_ENV.secretAccessKey)));
933
- set("sessionToken", chunk5AEPFQD7_cjs.Secret.from(firstEnv(env, VENDOR_ENV.sessionToken)));
940
+ set("secretAccessKey", chunkZLYHN4AI_cjs.Secret.from(firstEnv(env, VENDOR_ENV.secretAccessKey)));
941
+ set("sessionToken", chunkZLYHN4AI_cjs.Secret.from(firstEnv(env, VENDOR_ENV.sessionToken)));
934
942
  }
935
943
  set("profile", reader.string("PROFILE", VENDOR_ENV.profile));
936
944
  set("roleArn", reader.string("ROLE_ARN"));
@@ -996,7 +1004,7 @@ var AwsSecretsManagerConfig = class _AwsSecretsManagerConfig {
996
1004
  problems.push("recoveryWindowDays must be an integer from 7 to 30");
997
1005
  }
998
1006
  if (problems.length > 0) {
999
- throw new chunk5AEPFQD7_cjs.ConfigError(`invalid configuration: ${problems.join("; ")}`);
1007
+ throw new chunkZLYHN4AI_cjs.ConfigError(`invalid configuration: ${problems.join("; ")}`);
1000
1008
  }
1001
1009
  }
1002
1010
  /** Credential values to redact from error messages and logs. */
@@ -1010,13 +1018,13 @@ var AwsSecretsManagerConfig = class _AwsSecretsManagerConfig {
1010
1018
  endpoint: this.endpoint ?? null,
1011
1019
  region: this.region ?? null,
1012
1020
  accessKeyId: this.accessKeyId ?? null,
1013
- secretAccessKey: this.secretAccessKey === void 0 ? null : chunk5AEPFQD7_cjs.REDACTED,
1014
- sessionToken: this.sessionToken === void 0 ? null : chunk5AEPFQD7_cjs.REDACTED,
1021
+ secretAccessKey: this.secretAccessKey === void 0 ? null : chunkZLYHN4AI_cjs.REDACTED,
1022
+ sessionToken: this.sessionToken === void 0 ? null : chunkZLYHN4AI_cjs.REDACTED,
1015
1023
  profile: this.profile ?? null,
1016
- credentials: this.credentials === void 0 ? null : chunk5AEPFQD7_cjs.REDACTED,
1024
+ credentials: this.credentials === void 0 ? null : chunkZLYHN4AI_cjs.REDACTED,
1017
1025
  roleArn: this.roleArn ?? null,
1018
1026
  roleSessionName: this.roleSessionName,
1019
- externalId: this.externalId === void 0 ? null : chunk5AEPFQD7_cjs.REDACTED,
1027
+ externalId: this.externalId === void 0 ? null : chunkZLYHN4AI_cjs.REDACTED,
1020
1028
  recoveryWindowDays: this.recoveryWindowDays,
1021
1029
  sdkClient: this.sdkClient === void 0 ? null : "SecretsManagerClient"
1022
1030
  };
@@ -1043,46 +1051,46 @@ function blankToUndefined(value) {
1043
1051
 
1044
1052
  // src/errors-map.ts
1045
1053
  var AWS_ERROR_CODES = Object.freeze({
1046
- ResourceNotFoundException: chunk5AEPFQD7_cjs.ErrorCode.NotFound,
1047
- ResourceExistsException: chunk5AEPFQD7_cjs.ErrorCode.Conflict,
1048
- PreconditionNotMetException: chunk5AEPFQD7_cjs.ErrorCode.Conflict,
1049
- InvalidRequestException: chunk5AEPFQD7_cjs.ErrorCode.Conflict,
1050
- InvalidParameterException: chunk5AEPFQD7_cjs.ErrorCode.Validation,
1051
- InvalidParameterValue: chunk5AEPFQD7_cjs.ErrorCode.Validation,
1052
- ValidationException: chunk5AEPFQD7_cjs.ErrorCode.Validation,
1053
- InvalidNextTokenException: chunk5AEPFQD7_cjs.ErrorCode.Validation,
1054
- MalformedPolicyDocumentException: chunk5AEPFQD7_cjs.ErrorCode.Validation,
1055
- PublicPolicyException: chunk5AEPFQD7_cjs.ErrorCode.Validation,
1056
- LimitExceededException: chunk5AEPFQD7_cjs.ErrorCode.Validation,
1057
- EncryptionFailure: chunk5AEPFQD7_cjs.ErrorCode.Validation,
1058
- DecryptionFailure: chunk5AEPFQD7_cjs.ErrorCode.Validation,
1059
- SerializationException: chunk5AEPFQD7_cjs.ErrorCode.Validation,
1060
- AccessDeniedException: chunk5AEPFQD7_cjs.ErrorCode.PermissionDenied,
1061
- AccessDenied: chunk5AEPFQD7_cjs.ErrorCode.PermissionDenied,
1062
- UnrecognizedClientException: chunk5AEPFQD7_cjs.ErrorCode.Authentication,
1063
- InvalidClientTokenId: chunk5AEPFQD7_cjs.ErrorCode.Authentication,
1064
- InvalidSignatureException: chunk5AEPFQD7_cjs.ErrorCode.Authentication,
1065
- SignatureDoesNotMatch: chunk5AEPFQD7_cjs.ErrorCode.Authentication,
1066
- IncompleteSignature: chunk5AEPFQD7_cjs.ErrorCode.Authentication,
1067
- IncompleteSignatureException: chunk5AEPFQD7_cjs.ErrorCode.Authentication,
1068
- MissingAuthenticationToken: chunk5AEPFQD7_cjs.ErrorCode.Authentication,
1069
- MissingAuthenticationTokenException: chunk5AEPFQD7_cjs.ErrorCode.Authentication,
1070
- ExpiredToken: chunk5AEPFQD7_cjs.ErrorCode.Authentication,
1071
- ExpiredTokenException: chunk5AEPFQD7_cjs.ErrorCode.Authentication,
1072
- InvalidAccessKeyId: chunk5AEPFQD7_cjs.ErrorCode.Authentication,
1073
- CredentialsProviderError: chunk5AEPFQD7_cjs.ErrorCode.Authentication,
1074
- ThrottlingException: chunk5AEPFQD7_cjs.ErrorCode.RateLimited,
1075
- Throttling: chunk5AEPFQD7_cjs.ErrorCode.RateLimited,
1076
- TooManyRequestsException: chunk5AEPFQD7_cjs.ErrorCode.RateLimited,
1077
- RequestLimitExceeded: chunk5AEPFQD7_cjs.ErrorCode.RateLimited,
1078
- InternalServiceError: chunk5AEPFQD7_cjs.ErrorCode.Unavailable,
1079
- InternalServiceErrorException: chunk5AEPFQD7_cjs.ErrorCode.Unavailable,
1080
- InternalFailure: chunk5AEPFQD7_cjs.ErrorCode.Unavailable,
1081
- ServiceUnavailable: chunk5AEPFQD7_cjs.ErrorCode.Unavailable,
1082
- ServiceUnavailableException: chunk5AEPFQD7_cjs.ErrorCode.Unavailable,
1083
- RequestTimeout: chunk5AEPFQD7_cjs.ErrorCode.Timeout,
1084
- RequestTimeoutException: chunk5AEPFQD7_cjs.ErrorCode.Timeout,
1085
- TimeoutError: chunk5AEPFQD7_cjs.ErrorCode.Timeout
1054
+ ResourceNotFoundException: chunkZLYHN4AI_cjs.ErrorCode.NotFound,
1055
+ ResourceExistsException: chunkZLYHN4AI_cjs.ErrorCode.Conflict,
1056
+ PreconditionNotMetException: chunkZLYHN4AI_cjs.ErrorCode.Conflict,
1057
+ InvalidRequestException: chunkZLYHN4AI_cjs.ErrorCode.Conflict,
1058
+ InvalidParameterException: chunkZLYHN4AI_cjs.ErrorCode.Validation,
1059
+ InvalidParameterValue: chunkZLYHN4AI_cjs.ErrorCode.Validation,
1060
+ ValidationException: chunkZLYHN4AI_cjs.ErrorCode.Validation,
1061
+ InvalidNextTokenException: chunkZLYHN4AI_cjs.ErrorCode.Validation,
1062
+ MalformedPolicyDocumentException: chunkZLYHN4AI_cjs.ErrorCode.Validation,
1063
+ PublicPolicyException: chunkZLYHN4AI_cjs.ErrorCode.Validation,
1064
+ LimitExceededException: chunkZLYHN4AI_cjs.ErrorCode.Validation,
1065
+ EncryptionFailure: chunkZLYHN4AI_cjs.ErrorCode.Validation,
1066
+ DecryptionFailure: chunkZLYHN4AI_cjs.ErrorCode.Validation,
1067
+ SerializationException: chunkZLYHN4AI_cjs.ErrorCode.Validation,
1068
+ AccessDeniedException: chunkZLYHN4AI_cjs.ErrorCode.PermissionDenied,
1069
+ AccessDenied: chunkZLYHN4AI_cjs.ErrorCode.PermissionDenied,
1070
+ UnrecognizedClientException: chunkZLYHN4AI_cjs.ErrorCode.Authentication,
1071
+ InvalidClientTokenId: chunkZLYHN4AI_cjs.ErrorCode.Authentication,
1072
+ InvalidSignatureException: chunkZLYHN4AI_cjs.ErrorCode.Authentication,
1073
+ SignatureDoesNotMatch: chunkZLYHN4AI_cjs.ErrorCode.Authentication,
1074
+ IncompleteSignature: chunkZLYHN4AI_cjs.ErrorCode.Authentication,
1075
+ IncompleteSignatureException: chunkZLYHN4AI_cjs.ErrorCode.Authentication,
1076
+ MissingAuthenticationToken: chunkZLYHN4AI_cjs.ErrorCode.Authentication,
1077
+ MissingAuthenticationTokenException: chunkZLYHN4AI_cjs.ErrorCode.Authentication,
1078
+ ExpiredToken: chunkZLYHN4AI_cjs.ErrorCode.Authentication,
1079
+ ExpiredTokenException: chunkZLYHN4AI_cjs.ErrorCode.Authentication,
1080
+ InvalidAccessKeyId: chunkZLYHN4AI_cjs.ErrorCode.Authentication,
1081
+ CredentialsProviderError: chunkZLYHN4AI_cjs.ErrorCode.Authentication,
1082
+ ThrottlingException: chunkZLYHN4AI_cjs.ErrorCode.RateLimited,
1083
+ Throttling: chunkZLYHN4AI_cjs.ErrorCode.RateLimited,
1084
+ TooManyRequestsException: chunkZLYHN4AI_cjs.ErrorCode.RateLimited,
1085
+ RequestLimitExceeded: chunkZLYHN4AI_cjs.ErrorCode.RateLimited,
1086
+ InternalServiceError: chunkZLYHN4AI_cjs.ErrorCode.Unavailable,
1087
+ InternalServiceErrorException: chunkZLYHN4AI_cjs.ErrorCode.Unavailable,
1088
+ InternalFailure: chunkZLYHN4AI_cjs.ErrorCode.Unavailable,
1089
+ ServiceUnavailable: chunkZLYHN4AI_cjs.ErrorCode.Unavailable,
1090
+ ServiceUnavailableException: chunkZLYHN4AI_cjs.ErrorCode.Unavailable,
1091
+ RequestTimeout: chunkZLYHN4AI_cjs.ErrorCode.Timeout,
1092
+ RequestTimeoutException: chunkZLYHN4AI_cjs.ErrorCode.Timeout,
1093
+ TimeoutError: chunkZLYHN4AI_cjs.ErrorCode.Timeout
1086
1094
  });
1087
1095
  var NETWORK_TIMEOUT_CODES = /* @__PURE__ */ new Set([
1088
1096
  "ETIMEDOUT",
@@ -1108,7 +1116,7 @@ function errorCodeFromBody(text) {
1108
1116
  }
1109
1117
  function cleanVendorText(text, knownSecrets) {
1110
1118
  const collapsed = text.replace(/\s+/g, " ").trim();
1111
- const redacted = redactSecretsInText(chunk5AEPFQD7_cjs.redactText(collapsed, knownSecrets));
1119
+ const redacted = redactSecretsInText(chunkZLYHN4AI_cjs.redactText(collapsed, knownSecrets));
1112
1120
  return redacted.length > MAX_VENDOR_TEXT ? `${redacted.slice(0, MAX_VENDOR_TEXT)}\u2026` : redacted;
1113
1121
  }
1114
1122
  function nodeCode(err) {
@@ -1121,7 +1129,7 @@ function nodeCode(err) {
1121
1129
  return void 0;
1122
1130
  }
1123
1131
  function mapAwsError(err, operation, options = {}) {
1124
- if (chunk5AEPFQD7_cjs.isAwsSecretsManagerError(err)) return err;
1132
+ if (chunkZLYHN4AI_cjs.isAwsSecretsManagerError(err)) return err;
1125
1133
  const known = [...options.knownSecrets ?? []];
1126
1134
  const e = typeof err === "object" && err !== null ? err : {};
1127
1135
  const name = typeof e.name === "string" ? e.name : "";
@@ -1135,11 +1143,11 @@ function mapAwsError(err, operation, options = {}) {
1135
1143
  };
1136
1144
  const suffix = status === void 0 ? "" : ` (HTTP ${String(status)})`;
1137
1145
  if (name === "AbortError") {
1138
- return chunk5AEPFQD7_cjs.errorForCode(chunk5AEPFQD7_cjs.ErrorCode.Cancelled, `${operation}: cancelled`, { cause: err });
1146
+ return chunkZLYHN4AI_cjs.errorForCode(chunkZLYHN4AI_cjs.ErrorCode.Cancelled, `${operation}: cancelled`, { cause: err });
1139
1147
  }
1140
1148
  if (/Region is missing|Region not accepted/i.test(message)) {
1141
- return chunk5AEPFQD7_cjs.errorForCode(
1142
- chunk5AEPFQD7_cjs.ErrorCode.Config,
1149
+ return chunkZLYHN4AI_cjs.errorForCode(
1150
+ chunkZLYHN4AI_cjs.ErrorCode.Config,
1143
1151
  `${operation}: no AWS region configured (set region or AWS_REGION)`,
1144
1152
  { cause: err }
1145
1153
  );
@@ -1151,18 +1159,18 @@ function mapAwsError(err, operation, options = {}) {
1151
1159
  let code = awsCode === void 0 ? void 0 : AWS_ERROR_CODES[awsCode];
1152
1160
  if (code === void 0) {
1153
1161
  if (status === 403) {
1154
- code = /InvalidClientTokenId|SignatureDoesNotMatch|security token/i.test(raw) ? chunk5AEPFQD7_cjs.ErrorCode.Authentication : chunk5AEPFQD7_cjs.ErrorCode.PermissionDenied;
1162
+ code = /InvalidClientTokenId|SignatureDoesNotMatch|security token/i.test(raw) ? chunkZLYHN4AI_cjs.ErrorCode.Authentication : chunkZLYHN4AI_cjs.ErrorCode.PermissionDenied;
1155
1163
  } else if (status === 500 && options.unsupportedOnHtml500 === true && /<html/i.test(raw)) {
1156
- code = chunk5AEPFQD7_cjs.ErrorCode.Unsupported;
1164
+ code = chunkZLYHN4AI_cjs.ErrorCode.Unsupported;
1157
1165
  } else {
1158
- code = chunk5AEPFQD7_cjs.codeForStatus(status);
1166
+ code = chunkZLYHN4AI_cjs.codeForStatus(status);
1159
1167
  }
1160
1168
  }
1161
1169
  const vendor = parsed !== void 0 ? cleanVendorText(message, known) : "";
1162
- const reason = awsCode === void 0 ? chunk5AEPFQD7_cjs.reasonForCode(code) : vendor === "" ? awsCode : `${awsCode}: ${vendor}`;
1170
+ const reason = awsCode === void 0 ? chunkZLYHN4AI_cjs.reasonForCode(code) : vendor === "" ? awsCode : `${awsCode}: ${vendor}`;
1163
1171
  const retryAfterRaw = e.$response?.headers?.["retry-after"];
1164
- const retryAfterMs = code === chunk5AEPFQD7_cjs.ErrorCode.RateLimited && retryAfterRaw !== void 0 ? parseRetryAfter(retryAfterRaw) : void 0;
1165
- return chunk5AEPFQD7_cjs.errorForCode(code, `${operation}: ${reason}${suffix}`, {
1172
+ const retryAfterMs = code === chunkZLYHN4AI_cjs.ErrorCode.RateLimited && retryAfterRaw !== void 0 ? parseRetryAfter(retryAfterRaw) : void 0;
1173
+ return chunkZLYHN4AI_cjs.errorForCode(code, `${operation}: ${reason}${suffix}`, {
1166
1174
  ...details,
1167
1175
  ...retryAfterMs === void 0 ? {} : { retryAfterMs }
1168
1176
  });
@@ -1170,19 +1178,19 @@ function mapAwsError(err, operation, options = {}) {
1170
1178
  const mappedByName = AWS_ERROR_CODES[name];
1171
1179
  if (mappedByName !== void 0) {
1172
1180
  const text2 = cleanVendorText(message, known);
1173
- return chunk5AEPFQD7_cjs.errorForCode(
1181
+ return chunkZLYHN4AI_cjs.errorForCode(
1174
1182
  mappedByName,
1175
- `${operation}: ${chunk5AEPFQD7_cjs.reasonForCode(mappedByName)}: ${text2}`,
1183
+ `${operation}: ${chunkZLYHN4AI_cjs.reasonForCode(mappedByName)}: ${text2}`,
1176
1184
  details
1177
1185
  );
1178
1186
  }
1179
1187
  const net = nodeCode(err);
1180
1188
  if (net !== void 0 && NETWORK_TIMEOUT_CODES.has(net)) {
1181
- return chunk5AEPFQD7_cjs.errorForCode(chunk5AEPFQD7_cjs.ErrorCode.Timeout, `${operation}: timed out (${net})`, details);
1189
+ return chunkZLYHN4AI_cjs.errorForCode(chunkZLYHN4AI_cjs.ErrorCode.Timeout, `${operation}: timed out (${net})`, details);
1182
1190
  }
1183
1191
  const text = cleanVendorText(message, known);
1184
- return chunk5AEPFQD7_cjs.errorForCode(
1185
- chunk5AEPFQD7_cjs.ErrorCode.Unavailable,
1192
+ return chunkZLYHN4AI_cjs.errorForCode(
1193
+ chunkZLYHN4AI_cjs.ErrorCode.Unavailable,
1186
1194
  `${operation}: service unavailable: ${net === void 0 ? text : `${net}: ${text}`}`,
1187
1195
  details
1188
1196
  );
@@ -1245,7 +1253,7 @@ var GrowHttpHandler = class {
1245
1253
  /** Sends one attempt. Called by the SDK (after signing) for every attempt. */
1246
1254
  async handle(request, options = {}) {
1247
1255
  const url = buildUrl(request);
1248
- const safeUrl = chunk5AEPFQD7_cjs.redactUrl(url);
1256
+ const safeUrl = chunkZLYHN4AI_cjs.redactUrl(url);
1249
1257
  const headers = {};
1250
1258
  for (const [k, v] of Object.entries(this.#config.headers)) headers[k.toLowerCase()] = v;
1251
1259
  for (const [k, v] of Object.entries(request.headers)) headers[k.toLowerCase()] = v;
@@ -1255,7 +1263,7 @@ var GrowHttpHandler = class {
1255
1263
  safeCall(this.#hooks.onRequest, {
1256
1264
  method,
1257
1265
  url: safeUrl,
1258
- headers: chunk5AEPFQD7_cjs.redactHeaders(headers),
1266
+ headers: chunkZLYHN4AI_cjs.redactHeaders(headers),
1259
1267
  attempt
1260
1268
  });
1261
1269
  this.#logger.debug("aws-secrets-manager request", { method, url: safeUrl, attempt });
@@ -1359,7 +1367,7 @@ function toError(err) {
1359
1367
  }
1360
1368
 
1361
1369
  // src/secrets/cache.ts
1362
- var SecretCache = class extends chunk5AEPFQD7_cjs.BaseSecretsProvider {
1370
+ var SecretCache = class extends chunkZLYHN4AI_cjs.BaseSecretsProvider {
1363
1371
  #provider;
1364
1372
  #ttl;
1365
1373
  #max;
@@ -1383,12 +1391,12 @@ var SecretCache = class extends chunk5AEPFQD7_cjs.BaseSecretsProvider {
1383
1391
  this.#swr = options.staleWhileRevalidateMs ?? 0;
1384
1392
  this.#clock = options.clock ?? Date.now;
1385
1393
  this.#onRefreshError = options.onRefreshError;
1386
- if (!(this.#ttl > 0)) throw new chunk5AEPFQD7_cjs.ValidationError("SecretCache: ttlMs must be > 0");
1394
+ if (!(this.#ttl > 0)) throw new chunkZLYHN4AI_cjs.ValidationError("SecretCache: ttlMs must be > 0");
1387
1395
  if (!Number.isInteger(this.#max) || this.#max < 1)
1388
- throw new chunk5AEPFQD7_cjs.ValidationError("SecretCache: maxEntries must be >= 1");
1389
- if (!(factor > 0)) throw new chunk5AEPFQD7_cjs.ValidationError("SecretCache: refreshAheadFactor must be > 0");
1396
+ throw new chunkZLYHN4AI_cjs.ValidationError("SecretCache: maxEntries must be >= 1");
1397
+ if (!(factor > 0)) throw new chunkZLYHN4AI_cjs.ValidationError("SecretCache: refreshAheadFactor must be > 0");
1390
1398
  if (!(this.#swr >= 0))
1391
- throw new chunk5AEPFQD7_cjs.ValidationError("SecretCache: staleWhileRevalidateMs must be >= 0");
1399
+ throw new chunkZLYHN4AI_cjs.ValidationError("SecretCache: staleWhileRevalidateMs must be >= 0");
1392
1400
  this.#refreshAt = this.#ttl * factor;
1393
1401
  }
1394
1402
  /** The wrapped provider. */
@@ -1532,7 +1540,7 @@ function encodeValue(value) {
1532
1540
  } catch {
1533
1541
  json = void 0;
1534
1542
  }
1535
- if (json === void 0) throw new chunk5AEPFQD7_cjs.ValidationError("secret value must be JSON-serialisable");
1543
+ if (json === void 0) throw new chunkZLYHN4AI_cjs.ValidationError("secret value must be JSON-serialisable");
1536
1544
  return { SecretString: json };
1537
1545
  }
1538
1546
  function encodeBytes(bytes) {
@@ -1555,7 +1563,7 @@ function toSecretValue(out) {
1555
1563
  versionStages: [...out.VersionStages ?? []],
1556
1564
  ...opt("createdDate", out.CreatedDate),
1557
1565
  binary,
1558
- value: new chunk5AEPFQD7_cjs.SecretValue(raw, out.VersionId ?? void 0)
1566
+ value: new chunkZLYHN4AI_cjs.SecretValue(raw, out.VersionId ?? void 0)
1559
1567
  };
1560
1568
  }
1561
1569
  function toRotationRules(r) {
@@ -1694,12 +1702,12 @@ var AwsSecretCache = class {
1694
1702
  this.#stage = options.versionStage ?? AWSCURRENT;
1695
1703
  this.#clock = options.clock ?? Date.now;
1696
1704
  this.#onRefreshError = options.onRefreshError;
1697
- if (!(this.#ttl > 0)) throw new chunk5AEPFQD7_cjs.ValidationError("AwsSecretCache: ttlMs must be > 0");
1705
+ if (!(this.#ttl > 0)) throw new chunkZLYHN4AI_cjs.ValidationError("AwsSecretCache: ttlMs must be > 0");
1698
1706
  if (!Number.isInteger(this.#max) || this.#max < 1) {
1699
- throw new chunk5AEPFQD7_cjs.ValidationError("AwsSecretCache: maxEntries must be >= 1");
1707
+ throw new chunkZLYHN4AI_cjs.ValidationError("AwsSecretCache: maxEntries must be >= 1");
1700
1708
  }
1701
1709
  if (this.#stage.trim() === "") {
1702
- throw new chunk5AEPFQD7_cjs.ValidationError("AwsSecretCache: versionStage must not be empty");
1710
+ throw new chunkZLYHN4AI_cjs.ValidationError("AwsSecretCache: versionStage must not be empty");
1703
1711
  }
1704
1712
  }
1705
1713
  /** The cached value of `secretId` at the stage (default `AWSCURRENT`). */
@@ -1833,8 +1841,8 @@ function signalOnly2(options) {
1833
1841
  return options.signal === void 0 ? {} : { signal: options.signal };
1834
1842
  }
1835
1843
  function isMissing(err) {
1836
- return chunk5AEPFQD7_cjs.isAwsSecretsManagerError(err, chunk5AEPFQD7_cjs.ErrorCode.NotFound) || // InvalidRequestException: the secret is scheduled for deletion.
1837
- chunk5AEPFQD7_cjs.isAwsSecretsManagerError(err, chunk5AEPFQD7_cjs.ErrorCode.Conflict) && err.message.includes("InvalidRequestException");
1844
+ return chunkZLYHN4AI_cjs.isAwsSecretsManagerError(err, chunkZLYHN4AI_cjs.ErrorCode.NotFound) || // InvalidRequestException: the secret is scheduled for deletion.
1845
+ chunkZLYHN4AI_cjs.isAwsSecretsManagerError(err, chunkZLYHN4AI_cjs.ErrorCode.Conflict) && err.message.includes("InvalidRequestException");
1838
1846
  }
1839
1847
  function toMetadata(d) {
1840
1848
  const current = Object.entries(d.versionIdsToStages).find(
@@ -1858,7 +1866,7 @@ function toMetadata(d) {
1858
1866
  extra
1859
1867
  };
1860
1868
  }
1861
- var AwsSecretsManagerSecretsProvider = class extends chunk5AEPFQD7_cjs.BaseSecretsProvider {
1869
+ var AwsSecretsManagerSecretsProvider = class extends chunkZLYHN4AI_cjs.BaseSecretsProvider {
1862
1870
  /** Capabilities declared to the conformance runner. */
1863
1871
  static capabilities = ["write", "versions", "delete"];
1864
1872
  #client;
@@ -1869,7 +1877,7 @@ var AwsSecretsManagerSecretsProvider = class extends chunk5AEPFQD7_cjs.BaseSecre
1869
1877
  this.#client = client;
1870
1878
  const days = options.recoveryWindowDays ?? client.config.recoveryWindowDays;
1871
1879
  if (!Number.isInteger(days) || days < 7 || days > 30) {
1872
- throw new chunk5AEPFQD7_cjs.ValidationError("secrets: recoveryWindowDays must be an integer from 7 to 30");
1880
+ throw new chunkZLYHN4AI_cjs.ValidationError("secrets: recoveryWindowDays must be an integer from 7 to 30");
1873
1881
  }
1874
1882
  this.#recoveryWindowDays = days;
1875
1883
  this.#onClose = onClose;
@@ -1903,7 +1911,7 @@ var AwsSecretsManagerSecretsProvider = class extends chunk5AEPFQD7_cjs.BaseSecre
1903
1911
  }
1904
1912
  /** Every secret directly under `path` (non-recursive), keyed by full name. */
1905
1913
  async getAll(path, options = {}) {
1906
- chunk5AEPFQD7_cjs.throwIfAborted(options.signal, "secrets.getAll");
1914
+ chunkZLYHN4AI_cjs.throwIfAborted(options.signal, "secrets.getAll");
1907
1915
  const base = path === void 0 ? "" : trimSlashes(path);
1908
1916
  const prefix = base === "" ? "" : `${base}/`;
1909
1917
  const names = (await this.#listDescriptions(prefix, options)).map((d) => d.name).filter((n) => !n.slice(prefix.length).includes("/")).sort();
@@ -1915,7 +1923,7 @@ var AwsSecretsManagerSecretsProvider = class extends chunk5AEPFQD7_cjs.BaseSecre
1915
1923
  */
1916
1924
  async getMany(names, options = {}) {
1917
1925
  if (options.version !== void 0) return super.getMany(names, options);
1918
- chunk5AEPFQD7_cjs.throwIfAborted(options.signal, "secrets.getMany");
1926
+ chunkZLYHN4AI_cjs.throwIfAborted(options.signal, "secrets.getMany");
1919
1927
  const unique = [...new Set(names)];
1920
1928
  const byFull = /* @__PURE__ */ new Map();
1921
1929
  for (const n of unique) byFull.set(fullName(n, options.path), n);
@@ -1926,8 +1934,8 @@ var AwsSecretsManagerSecretsProvider = class extends chunk5AEPFQD7_cjs.BaseSecre
1926
1934
  const result = await this.#client.batchGetSecretValue(chunk, signalOnly2(options));
1927
1935
  for (const e of result.errors) {
1928
1936
  if (e.errorCode !== void 0 && MISSING_BATCH_CODES.has(e.errorCode)) continue;
1929
- const code = (e.errorCode === void 0 ? void 0 : AWS_ERROR_CODES[e.errorCode]) ?? chunk5AEPFQD7_cjs.ErrorCode.Unavailable;
1930
- throw chunk5AEPFQD7_cjs.errorForCode(code, `secrets.getMany ${e.secretId ?? ""}: ${e.errorCode ?? "error"}`);
1937
+ const code = (e.errorCode === void 0 ? void 0 : AWS_ERROR_CODES[e.errorCode]) ?? chunkZLYHN4AI_cjs.ErrorCode.Unavailable;
1938
+ throw chunkZLYHN4AI_cjs.errorForCode(code, `secrets.getMany ${e.secretId ?? ""}: ${e.errorCode ?? "error"}`);
1931
1939
  }
1932
1940
  for (const v of result.secretValues) {
1933
1941
  const requested = byFull.get(v.name) ?? byFull.get(v.arn);
@@ -1943,7 +1951,7 @@ var AwsSecretsManagerSecretsProvider = class extends chunk5AEPFQD7_cjs.BaseSecre
1943
1951
  }
1944
1952
  async putSecret(name, value, options) {
1945
1953
  if (options.cas !== void 0) {
1946
- throw new chunk5AEPFQD7_cjs.ValidationError(
1954
+ throw new chunkZLYHN4AI_cjs.ValidationError(
1947
1955
  `secrets.set ${name}: AWS Secrets Manager has no compare-and-set (cas)`
1948
1956
  );
1949
1957
  }
@@ -1964,7 +1972,7 @@ var AwsSecretsManagerSecretsProvider = class extends chunk5AEPFQD7_cjs.BaseSecre
1964
1972
  try {
1965
1973
  return await putExisting();
1966
1974
  } catch (err) {
1967
- if (!chunk5AEPFQD7_cjs.isAwsSecretsManagerError(err, chunk5AEPFQD7_cjs.ErrorCode.NotFound)) throw err;
1975
+ if (!chunkZLYHN4AI_cjs.isAwsSecretsManagerError(err, chunkZLYHN4AI_cjs.ErrorCode.NotFound)) throw err;
1968
1976
  }
1969
1977
  try {
1970
1978
  const created = await this.#client.createSecret(id, input, {
@@ -1974,7 +1982,7 @@ var AwsSecretsManagerSecretsProvider = class extends chunk5AEPFQD7_cjs.BaseSecre
1974
1982
  });
1975
1983
  return created.versionId ?? "";
1976
1984
  } catch (err) {
1977
- if (chunk5AEPFQD7_cjs.isAwsSecretsManagerError(err, chunk5AEPFQD7_cjs.ErrorCode.Conflict) && err.message.includes("ResourceExistsException")) {
1985
+ if (chunkZLYHN4AI_cjs.isAwsSecretsManagerError(err, chunkZLYHN4AI_cjs.ErrorCode.Conflict) && err.message.includes("ResourceExistsException")) {
1978
1986
  return await putExisting();
1979
1987
  }
1980
1988
  throw err;
@@ -1982,14 +1990,14 @@ var AwsSecretsManagerSecretsProvider = class extends chunk5AEPFQD7_cjs.BaseSecre
1982
1990
  }
1983
1991
  async removeSecret(name, options) {
1984
1992
  if (options.versions !== void 0) {
1985
- throw new chunk5AEPFQD7_cjs.ValidationError(
1993
+ throw new chunkZLYHN4AI_cjs.ValidationError(
1986
1994
  `secrets.delete ${name}: AWS Secrets Manager cannot delete single versions; use updateSecretVersionStage`
1987
1995
  );
1988
1996
  }
1989
1997
  const id = fullName(name, options.path);
1990
1998
  const call = signalOnly2(options);
1991
1999
  const meta = await this.#describe(id, call);
1992
- if (meta === null) throw new chunk5AEPFQD7_cjs.NotFoundError(`secrets.delete ${id}: not found`);
2000
+ if (meta === null) throw new chunkZLYHN4AI_cjs.NotFoundError(`secrets.delete ${id}: not found`);
1993
2001
  await this.#client.deleteSecret(
1994
2002
  id,
1995
2003
  options.permanent === true ? { ...call, forceDeleteWithoutRecovery: true } : { ...call, recoveryWindowDays: this.#recoveryWindowDays }
@@ -2091,13 +2099,13 @@ var AwsSecretsManagerClient = class _AwsSecretsManagerClient {
2091
2099
  } catch (err) {
2092
2100
  const e = err;
2093
2101
  switch (e.code) {
2094
- case chunk5AEPFQD7_cjs.ErrorCode.Cancelled:
2095
- case chunk5AEPFQD7_cjs.ErrorCode.Config:
2102
+ case chunkZLYHN4AI_cjs.ErrorCode.Cancelled:
2103
+ case chunkZLYHN4AI_cjs.ErrorCode.Config:
2096
2104
  throw e;
2097
- case chunk5AEPFQD7_cjs.ErrorCode.RateLimited:
2105
+ case chunkZLYHN4AI_cjs.ErrorCode.RateLimited:
2098
2106
  return healthStatus("degraded", { code: e.code }, true);
2099
- case chunk5AEPFQD7_cjs.ErrorCode.Authentication:
2100
- case chunk5AEPFQD7_cjs.ErrorCode.PermissionDenied:
2107
+ case chunkZLYHN4AI_cjs.ErrorCode.Authentication:
2108
+ case chunkZLYHN4AI_cjs.ErrorCode.PermissionDenied:
2101
2109
  return healthStatus("ok", { auth: "failed", code: e.code }, true);
2102
2110
  default:
2103
2111
  if (e.httpStatus === void 0) {
@@ -2126,8 +2134,8 @@ var AwsSecretsManagerClient = class _AwsSecretsManagerClient {
2126
2134
  */
2127
2135
  // eslint-disable-next-line @typescript-eslint/require-await
2128
2136
  async serverVersion(options = {}) {
2129
- chunk5AEPFQD7_cjs.throwIfAborted(options.signal, "serverVersion");
2130
- throw new chunk5AEPFQD7_cjs.UnsupportedError(
2137
+ chunkZLYHN4AI_cjs.throwIfAborted(options.signal, "serverVersion");
2138
+ throw new chunkZLYHN4AI_cjs.UnsupportedError(
2131
2139
  "serverVersion: AWS Secrets Manager does not expose a server version"
2132
2140
  );
2133
2141
  }
@@ -2218,7 +2226,7 @@ var AwsSecretsManagerClient = class _AwsSecretsManagerClient {
2218
2226
  }
2219
2227
  const filters = selector.filters;
2220
2228
  if (filters === void 0 || filters.length === 0) {
2221
- throw new chunk5AEPFQD7_cjs.ValidationError("batchGetSecretValue: give secret ids or at least one filter");
2229
+ throw new chunkZLYHN4AI_cjs.ValidationError("batchGetSecretValue: give secret ids or at least one filter");
2222
2230
  }
2223
2231
  let token;
2224
2232
  do {
@@ -2368,7 +2376,7 @@ var AwsSecretsManagerClient = class _AwsSecretsManagerClient {
2368
2376
  async updateSecretVersionStage(secretId, versionStage, options = {}) {
2369
2377
  requireId("updateSecretVersionStage", secretId);
2370
2378
  if (options.moveToVersionId === void 0 && options.removeFromVersionId === void 0) {
2371
- throw new chunk5AEPFQD7_cjs.ValidationError(
2379
+ throw new chunkZLYHN4AI_cjs.ValidationError(
2372
2380
  "updateSecretVersionStage: give moveToVersionId and/or removeFromVersionId"
2373
2381
  );
2374
2382
  }
@@ -2393,12 +2401,12 @@ var AwsSecretsManagerClient = class _AwsSecretsManagerClient {
2393
2401
  requireId("deleteSecret", secretId);
2394
2402
  const { recoveryWindowDays: days, forceDeleteWithoutRecovery: force } = options;
2395
2403
  if (days !== void 0 && force === true) {
2396
- throw new chunk5AEPFQD7_cjs.ValidationError(
2404
+ throw new chunkZLYHN4AI_cjs.ValidationError(
2397
2405
  "deleteSecret: recoveryWindowDays and forceDeleteWithoutRecovery are mutually exclusive"
2398
2406
  );
2399
2407
  }
2400
2408
  if (days !== void 0 && !(Number.isInteger(days) && days >= 7 && days <= 30)) {
2401
- throw new chunk5AEPFQD7_cjs.ValidationError("deleteSecret: recoveryWindowDays must be an integer from 7 to 30");
2409
+ throw new chunkZLYHN4AI_cjs.ValidationError("deleteSecret: recoveryWindowDays must be an integer from 7 to 30");
2402
2410
  }
2403
2411
  const input = {
2404
2412
  SecretId: secretId,
@@ -2559,7 +2567,7 @@ var AwsSecretsManagerClient = class _AwsSecretsManagerClient {
2559
2567
  ...options.requireEachIncludedType === void 0 ? {} : { RequireEachIncludedType: options.requireEachIncludedType }
2560
2568
  };
2561
2569
  const out = await this.#send("getRandomPassword", new clientSecretsManager.GetRandomPasswordCommand(input), options);
2562
- return new chunk5AEPFQD7_cjs.Secret(out.RandomPassword ?? "");
2570
+ return new chunkZLYHN4AI_cjs.Secret(out.RandomPassword ?? "");
2563
2571
  }
2564
2572
  /**
2565
2573
  * Reads one field of a JSON secret: `GetSecretValue`, parse `SecretString` as a JSON object,
@@ -2570,16 +2578,16 @@ var AwsSecretsManagerClient = class _AwsSecretsManagerClient {
2570
2578
  async getJsonField(secretId, field, options = {}) {
2571
2579
  const secret = await this.getSecretValue(secretId, options);
2572
2580
  if (secret.binary) {
2573
- throw new chunk5AEPFQD7_cjs.ValidationError(`getJsonField ${secretId}: the secret is binary, not JSON`);
2581
+ throw new chunkZLYHN4AI_cjs.ValidationError(`getJsonField ${secretId}: the secret is binary, not JSON`);
2574
2582
  }
2575
2583
  let parsed;
2576
2584
  try {
2577
2585
  parsed = secret.value.json();
2578
2586
  } catch {
2579
- throw new chunk5AEPFQD7_cjs.ValidationError(`getJsonField ${secretId}: the value is not valid JSON`);
2587
+ throw new chunkZLYHN4AI_cjs.ValidationError(`getJsonField ${secretId}: the value is not valid JSON`);
2580
2588
  }
2581
2589
  if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
2582
- throw new chunk5AEPFQD7_cjs.ValidationError(`getJsonField ${secretId}: the value is not a JSON object`);
2590
+ throw new chunkZLYHN4AI_cjs.ValidationError(`getJsonField ${secretId}: the value is not a JSON object`);
2583
2591
  }
2584
2592
  return jsonField(parsed, field);
2585
2593
  }
@@ -2596,9 +2604,9 @@ var AwsSecretsManagerClient = class _AwsSecretsManagerClient {
2596
2604
  }
2597
2605
  /** Sends a command with cancellation, the total timeout and error mapping. */
2598
2606
  async #send(operation, command, options = {}) {
2599
- if (this.#closed) throw new chunk5AEPFQD7_cjs.CancelledError(`${operation}: client is closed`);
2607
+ if (this.#closed) throw new chunkZLYHN4AI_cjs.CancelledError(`${operation}: client is closed`);
2600
2608
  const signal = options.signal;
2601
- if (signal?.aborted === true) throw new chunk5AEPFQD7_cjs.CancelledError(`${operation}: cancelled`);
2609
+ if (signal?.aborted === true) throw new chunkZLYHN4AI_cjs.CancelledError(`${operation}: cancelled`);
2602
2610
  const total = new AbortController();
2603
2611
  const timer = setTimeout(() => {
2604
2612
  total.abort();
@@ -2615,9 +2623,9 @@ var AwsSecretsManagerClient = class _AwsSecretsManagerClient {
2615
2623
  } catch (err) {
2616
2624
  let mapped;
2617
2625
  if (isAborted(signal)) {
2618
- mapped = new chunk5AEPFQD7_cjs.CancelledError(`${operation}: cancelled`, { cause: err });
2626
+ mapped = new chunkZLYHN4AI_cjs.CancelledError(`${operation}: cancelled`, { cause: err });
2619
2627
  } else if (total.signal.aborted) {
2620
- mapped = new chunk5AEPFQD7_cjs.TimeoutError(
2628
+ mapped = new chunkZLYHN4AI_cjs.TimeoutError(
2621
2629
  `${operation}: total timeout of ${String(this.config.totalTimeoutMs)} ms exceeded`,
2622
2630
  { cause: err }
2623
2631
  );
@@ -2651,7 +2659,7 @@ function attemptsOf(err) {
2651
2659
  }
2652
2660
  function requireId(operation, id) {
2653
2661
  if (typeof id !== "string" || id.trim() === "") {
2654
- throw new chunk5AEPFQD7_cjs.ValidationError(`${operation}: secret id must not be empty`);
2662
+ throw new chunkZLYHN4AI_cjs.ValidationError(`${operation}: secret id must not be empty`);
2655
2663
  }
2656
2664
  }
2657
2665
  function writeResult(out) {
@@ -2711,183 +2719,183 @@ function buildCredentials(cfg, handler) {
2711
2719
 
2712
2720
  Object.defineProperty(exports, "AuthenticationError", {
2713
2721
  enumerable: true,
2714
- get: function () { return chunk5AEPFQD7_cjs.AuthenticationError; }
2722
+ get: function () { return chunkZLYHN4AI_cjs.AuthenticationError; }
2715
2723
  });
2716
2724
  Object.defineProperty(exports, "AwsSecretsManagerError", {
2717
2725
  enumerable: true,
2718
- get: function () { return chunk5AEPFQD7_cjs.AwsSecretsManagerError; }
2726
+ get: function () { return chunkZLYHN4AI_cjs.AwsSecretsManagerError; }
2719
2727
  });
2720
2728
  Object.defineProperty(exports, "BaseSecretsProvider", {
2721
2729
  enumerable: true,
2722
- get: function () { return chunk5AEPFQD7_cjs.BaseSecretsProvider; }
2730
+ get: function () { return chunkZLYHN4AI_cjs.BaseSecretsProvider; }
2723
2731
  });
2724
2732
  Object.defineProperty(exports, "CancelledError", {
2725
2733
  enumerable: true,
2726
- get: function () { return chunk5AEPFQD7_cjs.CancelledError; }
2734
+ get: function () { return chunkZLYHN4AI_cjs.CancelledError; }
2727
2735
  });
2728
2736
  Object.defineProperty(exports, "ConfigError", {
2729
2737
  enumerable: true,
2730
- get: function () { return chunk5AEPFQD7_cjs.ConfigError; }
2738
+ get: function () { return chunkZLYHN4AI_cjs.ConfigError; }
2731
2739
  });
2732
2740
  Object.defineProperty(exports, "ConflictError", {
2733
2741
  enumerable: true,
2734
- get: function () { return chunk5AEPFQD7_cjs.ConflictError; }
2742
+ get: function () { return chunkZLYHN4AI_cjs.ConflictError; }
2735
2743
  });
2736
2744
  Object.defineProperty(exports, "EnvReader", {
2737
2745
  enumerable: true,
2738
- get: function () { return chunk5AEPFQD7_cjs.EnvReader; }
2746
+ get: function () { return chunkZLYHN4AI_cjs.EnvReader; }
2739
2747
  });
2740
2748
  Object.defineProperty(exports, "ErrorCode", {
2741
2749
  enumerable: true,
2742
- get: function () { return chunk5AEPFQD7_cjs.ErrorCode; }
2750
+ get: function () { return chunkZLYHN4AI_cjs.ErrorCode; }
2743
2751
  });
2744
2752
  Object.defineProperty(exports, "GET_MANY_CONCURRENCY", {
2745
2753
  enumerable: true,
2746
- get: function () { return chunk5AEPFQD7_cjs.GET_MANY_CONCURRENCY; }
2754
+ get: function () { return chunkZLYHN4AI_cjs.GET_MANY_CONCURRENCY; }
2747
2755
  });
2748
2756
  Object.defineProperty(exports, "MIN_SECRET_LENGTH", {
2749
2757
  enumerable: true,
2750
- get: function () { return chunk5AEPFQD7_cjs.MIN_SECRET_LENGTH; }
2758
+ get: function () { return chunkZLYHN4AI_cjs.MIN_SECRET_LENGTH; }
2751
2759
  });
2752
2760
  Object.defineProperty(exports, "NotFoundError", {
2753
2761
  enumerable: true,
2754
- get: function () { return chunk5AEPFQD7_cjs.NotFoundError; }
2762
+ get: function () { return chunkZLYHN4AI_cjs.NotFoundError; }
2755
2763
  });
2756
2764
  Object.defineProperty(exports, "PermissionDeniedError", {
2757
2765
  enumerable: true,
2758
- get: function () { return chunk5AEPFQD7_cjs.PermissionDeniedError; }
2766
+ get: function () { return chunkZLYHN4AI_cjs.PermissionDeniedError; }
2759
2767
  });
2760
2768
  Object.defineProperty(exports, "REDACTED", {
2761
2769
  enumerable: true,
2762
- get: function () { return chunk5AEPFQD7_cjs.REDACTED; }
2770
+ get: function () { return chunkZLYHN4AI_cjs.REDACTED; }
2763
2771
  });
2764
2772
  Object.defineProperty(exports, "RateLimitError", {
2765
2773
  enumerable: true,
2766
- get: function () { return chunk5AEPFQD7_cjs.RateLimitError; }
2774
+ get: function () { return chunkZLYHN4AI_cjs.RateLimitError; }
2767
2775
  });
2768
2776
  Object.defineProperty(exports, "SENSITIVE_FIELD_PARTS", {
2769
2777
  enumerable: true,
2770
- get: function () { return chunk5AEPFQD7_cjs.SENSITIVE_FIELD_PARTS; }
2778
+ get: function () { return chunkZLYHN4AI_cjs.SENSITIVE_FIELD_PARTS; }
2771
2779
  });
2772
2780
  Object.defineProperty(exports, "Secret", {
2773
2781
  enumerable: true,
2774
- get: function () { return chunk5AEPFQD7_cjs.Secret; }
2782
+ get: function () { return chunkZLYHN4AI_cjs.Secret; }
2775
2783
  });
2776
2784
  Object.defineProperty(exports, "SecretValue", {
2777
2785
  enumerable: true,
2778
- get: function () { return chunk5AEPFQD7_cjs.SecretValue; }
2786
+ get: function () { return chunkZLYHN4AI_cjs.SecretValue; }
2779
2787
  });
2780
2788
  Object.defineProperty(exports, "TimeoutError", {
2781
2789
  enumerable: true,
2782
- get: function () { return chunk5AEPFQD7_cjs.TimeoutError; }
2790
+ get: function () { return chunkZLYHN4AI_cjs.TimeoutError; }
2783
2791
  });
2784
2792
  Object.defineProperty(exports, "UnavailableError", {
2785
2793
  enumerable: true,
2786
- get: function () { return chunk5AEPFQD7_cjs.UnavailableError; }
2794
+ get: function () { return chunkZLYHN4AI_cjs.UnavailableError; }
2787
2795
  });
2788
2796
  Object.defineProperty(exports, "UnsupportedError", {
2789
2797
  enumerable: true,
2790
- get: function () { return chunk5AEPFQD7_cjs.UnsupportedError; }
2798
+ get: function () { return chunkZLYHN4AI_cjs.UnsupportedError; }
2791
2799
  });
2792
2800
  Object.defineProperty(exports, "ValidationError", {
2793
2801
  enumerable: true,
2794
- get: function () { return chunk5AEPFQD7_cjs.ValidationError; }
2802
+ get: function () { return chunkZLYHN4AI_cjs.ValidationError; }
2795
2803
  });
2796
2804
  Object.defineProperty(exports, "applyEnv", {
2797
2805
  enumerable: true,
2798
- get: function () { return chunk5AEPFQD7_cjs.applyEnv; }
2806
+ get: function () { return chunkZLYHN4AI_cjs.applyEnv; }
2799
2807
  });
2800
2808
  Object.defineProperty(exports, "codeForStatus", {
2801
2809
  enumerable: true,
2802
- get: function () { return chunk5AEPFQD7_cjs.codeForStatus; }
2810
+ get: function () { return chunkZLYHN4AI_cjs.codeForStatus; }
2803
2811
  });
2804
2812
  Object.defineProperty(exports, "encodeSecretInput", {
2805
2813
  enumerable: true,
2806
- get: function () { return chunk5AEPFQD7_cjs.encodeSecretInput; }
2814
+ get: function () { return chunkZLYHN4AI_cjs.encodeSecretInput; }
2807
2815
  });
2808
2816
  Object.defineProperty(exports, "envNameFor", {
2809
2817
  enumerable: true,
2810
- get: function () { return chunk5AEPFQD7_cjs.envNameFor; }
2818
+ get: function () { return chunkZLYHN4AI_cjs.envNameFor; }
2811
2819
  });
2812
2820
  Object.defineProperty(exports, "errorForCode", {
2813
2821
  enumerable: true,
2814
- get: function () { return chunk5AEPFQD7_cjs.errorForCode; }
2822
+ get: function () { return chunkZLYHN4AI_cjs.errorForCode; }
2815
2823
  });
2816
2824
  Object.defineProperty(exports, "errorForStatus", {
2817
2825
  enumerable: true,
2818
- get: function () { return chunk5AEPFQD7_cjs.errorForStatus; }
2826
+ get: function () { return chunkZLYHN4AI_cjs.errorForStatus; }
2819
2827
  });
2820
2828
  Object.defineProperty(exports, "isAwsSecretsManagerError", {
2821
2829
  enumerable: true,
2822
- get: function () { return chunk5AEPFQD7_cjs.isAwsSecretsManagerError; }
2830
+ get: function () { return chunkZLYHN4AI_cjs.isAwsSecretsManagerError; }
2823
2831
  });
2824
2832
  Object.defineProperty(exports, "isSensitiveField", {
2825
2833
  enumerable: true,
2826
- get: function () { return chunk5AEPFQD7_cjs.isSensitiveField; }
2834
+ get: function () { return chunkZLYHN4AI_cjs.isSensitiveField; }
2827
2835
  });
2828
2836
  Object.defineProperty(exports, "isSensitiveHeader", {
2829
2837
  enumerable: true,
2830
- get: function () { return chunk5AEPFQD7_cjs.isSensitiveHeader; }
2838
+ get: function () { return chunkZLYHN4AI_cjs.isSensitiveHeader; }
2831
2839
  });
2832
2840
  Object.defineProperty(exports, "parseBool", {
2833
2841
  enumerable: true,
2834
- get: function () { return chunk5AEPFQD7_cjs.parseBool; }
2842
+ get: function () { return chunkZLYHN4AI_cjs.parseBool; }
2835
2843
  });
2836
2844
  Object.defineProperty(exports, "parseDuration", {
2837
2845
  enumerable: true,
2838
- get: function () { return chunk5AEPFQD7_cjs.parseDuration; }
2846
+ get: function () { return chunkZLYHN4AI_cjs.parseDuration; }
2839
2847
  });
2840
2848
  Object.defineProperty(exports, "parseInteger", {
2841
2849
  enumerable: true,
2842
- get: function () { return chunk5AEPFQD7_cjs.parseInteger; }
2850
+ get: function () { return chunkZLYHN4AI_cjs.parseInteger; }
2843
2851
  });
2844
2852
  Object.defineProperty(exports, "pollUntil", {
2845
2853
  enumerable: true,
2846
- get: function () { return chunk5AEPFQD7_cjs.pollUntil; }
2854
+ get: function () { return chunkZLYHN4AI_cjs.pollUntil; }
2847
2855
  });
2848
2856
  Object.defineProperty(exports, "reasonForCode", {
2849
2857
  enumerable: true,
2850
- get: function () { return chunk5AEPFQD7_cjs.reasonForCode; }
2858
+ get: function () { return chunkZLYHN4AI_cjs.reasonForCode; }
2851
2859
  });
2852
2860
  Object.defineProperty(exports, "redactError", {
2853
2861
  enumerable: true,
2854
- get: function () { return chunk5AEPFQD7_cjs.redactError; }
2862
+ get: function () { return chunkZLYHN4AI_cjs.redactError; }
2855
2863
  });
2856
2864
  Object.defineProperty(exports, "redactFields", {
2857
2865
  enumerable: true,
2858
- get: function () { return chunk5AEPFQD7_cjs.redactFields; }
2866
+ get: function () { return chunkZLYHN4AI_cjs.redactFields; }
2859
2867
  });
2860
2868
  Object.defineProperty(exports, "redactHeaders", {
2861
2869
  enumerable: true,
2862
- get: function () { return chunk5AEPFQD7_cjs.redactHeaders; }
2870
+ get: function () { return chunkZLYHN4AI_cjs.redactHeaders; }
2863
2871
  });
2864
2872
  Object.defineProperty(exports, "redactText", {
2865
2873
  enumerable: true,
2866
- get: function () { return chunk5AEPFQD7_cjs.redactText; }
2874
+ get: function () { return chunkZLYHN4AI_cjs.redactText; }
2867
2875
  });
2868
2876
  Object.defineProperty(exports, "redactUrl", {
2869
2877
  enumerable: true,
2870
- get: function () { return chunk5AEPFQD7_cjs.redactUrl; }
2878
+ get: function () { return chunkZLYHN4AI_cjs.redactUrl; }
2871
2879
  });
2872
2880
  Object.defineProperty(exports, "relativeName", {
2873
2881
  enumerable: true,
2874
- get: function () { return chunk5AEPFQD7_cjs.relativeName; }
2882
+ get: function () { return chunkZLYHN4AI_cjs.relativeName; }
2875
2883
  });
2876
2884
  Object.defineProperty(exports, "secretFingerprint", {
2877
2885
  enumerable: true,
2878
- get: function () { return chunk5AEPFQD7_cjs.secretFingerprint; }
2886
+ get: function () { return chunkZLYHN4AI_cjs.secretFingerprint; }
2879
2887
  });
2880
2888
  Object.defineProperty(exports, "sleep", {
2881
2889
  enumerable: true,
2882
- get: function () { return chunk5AEPFQD7_cjs.sleep; }
2890
+ get: function () { return chunkZLYHN4AI_cjs.sleep; }
2883
2891
  });
2884
2892
  Object.defineProperty(exports, "throwIfAborted", {
2885
2893
  enumerable: true,
2886
- get: function () { return chunk5AEPFQD7_cjs.throwIfAborted; }
2894
+ get: function () { return chunkZLYHN4AI_cjs.throwIfAborted; }
2887
2895
  });
2888
2896
  Object.defineProperty(exports, "watchSecret", {
2889
2897
  enumerable: true,
2890
- get: function () { return chunk5AEPFQD7_cjs.watchSecret; }
2898
+ get: function () { return chunkZLYHN4AI_cjs.watchSecret; }
2891
2899
  });
2892
2900
  exports.API_VERSION = API_VERSION;
2893
2901
  exports.AWSCURRENT = AWSCURRENT;