@grow-codes/aws-secrets-manager 0.0.0-stage → 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/LICENSE +202 -0
- package/NOTICE +115 -0
- package/README.md +33 -2
- package/lib/base-ClUDmFU5.d.cts +213 -0
- package/lib/base-ClUDmFU5.d.ts +213 -0
- package/lib/chunk-FGY6NSRU.js +822 -0
- package/lib/chunk-FGY6NSRU.js.map +1 -0
- package/lib/chunk-ZLYHN4AI.cjs +868 -0
- package/lib/chunk-ZLYHN4AI.cjs.map +1 -0
- package/lib/index.cjs +2964 -0
- package/lib/index.cjs.map +1 -0
- package/lib/index.d.cts +1424 -0
- package/lib/index.d.ts +1424 -0
- package/lib/index.js +2721 -0
- package/lib/index.js.map +1 -0
- package/lib/testing/index.cjs +678 -0
- package/lib/testing/index.cjs.map +1 -0
- package/lib/testing/index.d.cts +265 -0
- package/lib/testing/index.d.ts +265 -0
- package/lib/testing/index.js +655 -0
- package/lib/testing/index.js.map +1 -0
- package/package.json +100 -4
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,1424 @@
|
|
|
1
|
+
import { B as BaseSecretsProvider, S as SecretsProvider, G as GetOptions, a as SecretValue, b as SignalOptions, c as SecretMetadata, d as SetOptions, D as DeleteOptions, W as WatchCallback, e as WatchOptions, f as WatchHandle, g as SecretInput, H as HealthStatus } from './base-ClUDmFU5.js';
|
|
2
|
+
export { h as GET_MANY_CONCURRENCY, L as LoadEnvOptions, i as encodeSecretInput, j as healthStatus, k as isHealthyWord, p as probeHealth } from './base-ClUDmFU5.js';
|
|
3
|
+
import { Dispatcher } from 'undici';
|
|
4
|
+
import { SecretsManagerClient, Tag, APIErrorType, SecretListEntry, DescribeSecretResponse, ValidationErrorsEntry, SecretValueEntry, SecretVersionsListEntry } from '@aws-sdk/client-secrets-manager';
|
|
5
|
+
import { AwsCredentialIdentity, AwsCredentialIdentityProvider, HttpRequest, HttpHandlerOptions, HttpResponse } from '@smithy/types';
|
|
6
|
+
|
|
7
|
+
/** Throws {@link CancelledError} when the signal is already aborted. */
|
|
8
|
+
declare function throwIfAborted(signal: AbortSignal | undefined, operation: string): void;
|
|
9
|
+
/**
|
|
10
|
+
* Resolves after `ms` milliseconds; rejects with {@link CancelledError} when `signal` aborts
|
|
11
|
+
* first. The timer does not keep the process alive.
|
|
12
|
+
*/
|
|
13
|
+
declare function sleep(ms: number, signal?: AbortSignal, operation?: string): Promise<void>;
|
|
14
|
+
|
|
15
|
+
/** Replacement text for every redacted value. */
|
|
16
|
+
declare const REDACTED = "[REDACTED]";
|
|
17
|
+
declare const INSPECT$1: unique symbol;
|
|
18
|
+
/** Field and query parameter name substrings that make a value sensitive (case-insensitive). */
|
|
19
|
+
declare const SENSITIVE_FIELD_PARTS: readonly string[];
|
|
20
|
+
/** Minimum length of a known secret value that {@link redactText} replaces. */
|
|
21
|
+
declare const MIN_SECRET_LENGTH = 4;
|
|
22
|
+
/** True when a header with this name must be redacted (SPEC §2.6). */
|
|
23
|
+
declare function isSensitiveHeader(name: string): boolean;
|
|
24
|
+
/** True when a field or query parameter with this name must be redacted (SPEC §2.6). */
|
|
25
|
+
declare function isSensitiveField(name: string, extraKeys?: readonly string[]): boolean;
|
|
26
|
+
/** Header input accepted by {@link redactHeaders}. */
|
|
27
|
+
type HeadersInput = Readonly<Record<string, string | readonly string[] | undefined>> | Iterable<readonly [string, string]>;
|
|
28
|
+
/** Returns a copy of the headers with every sensitive value replaced by {@link REDACTED}. */
|
|
29
|
+
declare function redactHeaders(headers: HeadersInput): Record<string, string>;
|
|
30
|
+
/** Redacts credentials in the user-info part and the values of sensitive query parameters. */
|
|
31
|
+
declare function redactUrl(url: string | URL): string;
|
|
32
|
+
/**
|
|
33
|
+
* Returns a deep copy of `value` in which every map entry whose key is sensitive is replaced by
|
|
34
|
+
* {@link REDACTED}. Recurses into nested objects and arrays; other values are copied as is.
|
|
35
|
+
*/
|
|
36
|
+
declare function redactFields<T>(value: T, extraKeys?: readonly string[]): T;
|
|
37
|
+
/** A known secret: a plain string or a {@link Secret}. */
|
|
38
|
+
type KnownSecret = string | Secret | null | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* Replaces every occurrence of each known secret value (length >= 4) in `text` with
|
|
41
|
+
* {@link REDACTED}. Longer secrets are replaced first so overlapping values never leak a suffix.
|
|
42
|
+
*/
|
|
43
|
+
declare function redactText(text: string, knownSecrets?: Iterable<KnownSecret>): string;
|
|
44
|
+
/**
|
|
45
|
+
* Wraps a credential. `toString()`, `JSON.stringify` and `util.inspect` all print
|
|
46
|
+
* {@link REDACTED}; {@link Secret.reveal} returns the value.
|
|
47
|
+
*/
|
|
48
|
+
declare class Secret {
|
|
49
|
+
#private;
|
|
50
|
+
constructor(value: string);
|
|
51
|
+
/** Wraps a string (returns `undefined` for `undefined`/empty, keeps an existing Secret). */
|
|
52
|
+
static from(value: string | Secret | undefined | null): Secret | undefined;
|
|
53
|
+
/** The wrapped value. */
|
|
54
|
+
reveal(): string;
|
|
55
|
+
/** Constant-time-ish comparison with another value. */
|
|
56
|
+
equals(other: string | Secret): boolean;
|
|
57
|
+
toString(): string;
|
|
58
|
+
toJSON(): string;
|
|
59
|
+
[INSPECT$1](): string;
|
|
60
|
+
}
|
|
61
|
+
/** Redacts the message of an arbitrary error value, keeping its name and `code`. */
|
|
62
|
+
declare function redactError(err: unknown, knownSecrets?: Iterable<KnownSecret>): Error;
|
|
63
|
+
|
|
64
|
+
/** An environment map (defaults to `process.env`); injectable so tests never touch the real one. */
|
|
65
|
+
type EnvMap = Readonly<Record<string, string | undefined>>;
|
|
66
|
+
/**
|
|
67
|
+
* Parses a duration into milliseconds: integer milliseconds (`"1500"`) or Go-style units
|
|
68
|
+
* (`"500ms"`, `"10s"`, `"2m"`, `"1h"`, `"1m30s"`). Returns `undefined` when invalid.
|
|
69
|
+
*/
|
|
70
|
+
declare function parseDuration(raw: string): number | undefined;
|
|
71
|
+
/** Parses `true/false/1/0/yes/no/on/off` (case-insensitive). Returns `undefined` when invalid. */
|
|
72
|
+
declare function parseBool(raw: string): boolean | undefined;
|
|
73
|
+
/** Parses a base-10 integer (optional sign). Returns `undefined` when invalid. */
|
|
74
|
+
declare function parseInteger(raw: string): number | undefined;
|
|
75
|
+
/** A variable found by {@link EnvReader.lookup}. */
|
|
76
|
+
interface EnvHit {
|
|
77
|
+
/** Name of the variable that supplied the value. */
|
|
78
|
+
name: string;
|
|
79
|
+
/** Raw (non-empty) value. */
|
|
80
|
+
value: string;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Reads configuration from the environment with the SPEC §2.2 precedence
|
|
84
|
+
* `GROW_<KEY_UPPER>_<NAME>` > vendor variables (in order). Empty values count as unset.
|
|
85
|
+
* Every reader returns `undefined` when no variable is present; an invalid value throws
|
|
86
|
+
* {@link ConfigError} naming the variable but never its value.
|
|
87
|
+
*/
|
|
88
|
+
declare class EnvReader {
|
|
89
|
+
#private;
|
|
90
|
+
readonly prefix: string;
|
|
91
|
+
/**
|
|
92
|
+
* @param prefix e.g. `"GROW_AWS_SECRETS_MANAGER_"`.
|
|
93
|
+
* @param env environment map, defaults to `process.env`.
|
|
94
|
+
*/
|
|
95
|
+
constructor(prefix: string, env?: EnvMap);
|
|
96
|
+
/** Finds the first present variable: `<prefix><name>`, then each vendor name. */
|
|
97
|
+
lookup(name: string, vendorNames?: readonly string[]): EnvHit | undefined;
|
|
98
|
+
/** String value. */
|
|
99
|
+
string(name: string, vendorNames?: readonly string[]): string | undefined;
|
|
100
|
+
/** Credential value wrapped in a {@link Secret}. */
|
|
101
|
+
secret(name: string, vendorNames?: readonly string[]): Secret | undefined;
|
|
102
|
+
/** Duration in milliseconds (see {@link parseDuration}). */
|
|
103
|
+
duration(name: string, vendorNames?: readonly string[]): number | undefined;
|
|
104
|
+
/** Boolean (see {@link parseBool}). */
|
|
105
|
+
bool(name: string, vendorNames?: readonly string[]): boolean | undefined;
|
|
106
|
+
/** Integer. */
|
|
107
|
+
int(name: string, vendorNames?: readonly string[]): number | undefined;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** Canonical error codes shared by every Grow Codes SDK (SPEC §2.1). Values are the wire form. */
|
|
111
|
+
declare const ErrorCode: {
|
|
112
|
+
readonly Config: "CONFIG";
|
|
113
|
+
readonly Authentication: "AUTHENTICATION";
|
|
114
|
+
readonly PermissionDenied: "PERMISSION_DENIED";
|
|
115
|
+
readonly NotFound: "NOT_FOUND";
|
|
116
|
+
readonly Conflict: "CONFLICT";
|
|
117
|
+
readonly RateLimited: "RATE_LIMITED";
|
|
118
|
+
readonly Validation: "VALIDATION";
|
|
119
|
+
readonly Unavailable: "UNAVAILABLE";
|
|
120
|
+
readonly Timeout: "TIMEOUT";
|
|
121
|
+
readonly Unsupported: "UNSUPPORTED";
|
|
122
|
+
readonly Cancelled: "CANCELLED";
|
|
123
|
+
};
|
|
124
|
+
/** One of the {@link ErrorCode} wire values, e.g. `"NOT_FOUND"`. */
|
|
125
|
+
type ErrorCode = (typeof ErrorCode)[keyof typeof ErrorCode];
|
|
126
|
+
/** Optional details attached to an SDK error. */
|
|
127
|
+
interface ErrorDetails {
|
|
128
|
+
/** HTTP status when the error came from a response. */
|
|
129
|
+
httpStatus?: number;
|
|
130
|
+
/** Vendor request id header when present. */
|
|
131
|
+
requestId?: string;
|
|
132
|
+
/** Overrides the default retryability of the code. */
|
|
133
|
+
retryable?: boolean;
|
|
134
|
+
/** Server-requested wait (from `Retry-After`) in milliseconds. */
|
|
135
|
+
retryAfterMs?: number;
|
|
136
|
+
/** Underlying error (already redacted). */
|
|
137
|
+
cause?: unknown;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Base class of every error thrown by the AWS Secrets Manager SDK.
|
|
141
|
+
*
|
|
142
|
+
* The message never contains credentials, request bodies or unfiltered response bodies.
|
|
143
|
+
*/
|
|
144
|
+
declare class AwsSecretsManagerError extends Error {
|
|
145
|
+
/** Canonical error code. */
|
|
146
|
+
readonly code: ErrorCode;
|
|
147
|
+
/** HTTP status when the error came from a response. */
|
|
148
|
+
readonly httpStatus?: number;
|
|
149
|
+
/** Vendor request id when the response carried one. */
|
|
150
|
+
readonly requestId?: string;
|
|
151
|
+
/** Whether retrying the same call may succeed. */
|
|
152
|
+
readonly retryable: boolean;
|
|
153
|
+
/** Server-requested wait in milliseconds (rate limits, `Retry-After`). */
|
|
154
|
+
readonly retryAfterMs?: number;
|
|
155
|
+
constructor(code: ErrorCode, message: string, details?: ErrorDetails);
|
|
156
|
+
/** JSON form (no stack, no cause). */
|
|
157
|
+
toJSON(): Record<string, unknown>;
|
|
158
|
+
}
|
|
159
|
+
/** Invalid or missing configuration. */
|
|
160
|
+
declare class ConfigError extends AwsSecretsManagerError {
|
|
161
|
+
constructor(message: string, details?: ErrorDetails);
|
|
162
|
+
}
|
|
163
|
+
/** HTTP 401: missing or invalid credentials. */
|
|
164
|
+
declare class AuthenticationError extends AwsSecretsManagerError {
|
|
165
|
+
constructor(message: string, details?: ErrorDetails);
|
|
166
|
+
}
|
|
167
|
+
/** HTTP 403: the credentials do not allow the operation. */
|
|
168
|
+
declare class PermissionDeniedError extends AwsSecretsManagerError {
|
|
169
|
+
constructor(message: string, details?: ErrorDetails);
|
|
170
|
+
}
|
|
171
|
+
/** HTTP 404 or a missing record. */
|
|
172
|
+
declare class NotFoundError extends AwsSecretsManagerError {
|
|
173
|
+
constructor(message: string, details?: ErrorDetails);
|
|
174
|
+
}
|
|
175
|
+
/** HTTP 409/412 or a compare-and-set mismatch. */
|
|
176
|
+
declare class ConflictError extends AwsSecretsManagerError {
|
|
177
|
+
constructor(message: string, details?: ErrorDetails);
|
|
178
|
+
}
|
|
179
|
+
/** HTTP 429. `retryAfterMs` is set when the server sent `Retry-After`. */
|
|
180
|
+
declare class RateLimitError extends AwsSecretsManagerError {
|
|
181
|
+
constructor(message: string, details?: ErrorDetails);
|
|
182
|
+
}
|
|
183
|
+
/** HTTP 400/413/422/other 4xx, or bad input caught client side. */
|
|
184
|
+
declare class ValidationError extends AwsSecretsManagerError {
|
|
185
|
+
constructor(message: string, details?: ErrorDetails);
|
|
186
|
+
}
|
|
187
|
+
/** Network error or HTTP 500/502/503. */
|
|
188
|
+
declare class UnavailableError extends AwsSecretsManagerError {
|
|
189
|
+
constructor(message: string, details?: ErrorDetails);
|
|
190
|
+
}
|
|
191
|
+
/** A connect, request or total deadline was exceeded, or HTTP 408/504. */
|
|
192
|
+
declare class TimeoutError extends AwsSecretsManagerError {
|
|
193
|
+
constructor(message: string, details?: ErrorDetails);
|
|
194
|
+
}
|
|
195
|
+
/** The service or deployment does not offer the capability (HTTP 501, missing API). */
|
|
196
|
+
declare class UnsupportedError extends AwsSecretsManagerError {
|
|
197
|
+
constructor(message: string, details?: ErrorDetails);
|
|
198
|
+
}
|
|
199
|
+
/** The caller cancelled the operation (AbortSignal). */
|
|
200
|
+
declare class CancelledError extends AwsSecretsManagerError {
|
|
201
|
+
constructor(message: string, details?: ErrorDetails);
|
|
202
|
+
}
|
|
203
|
+
/** Creates the subclass that matches `code`. */
|
|
204
|
+
declare function errorForCode(code: ErrorCode, message: string, details?: ErrorDetails): AwsSecretsManagerError;
|
|
205
|
+
/** Default short reason for a code, used in messages such as `"op: not found (HTTP 404)"`. */
|
|
206
|
+
declare function reasonForCode(code: ErrorCode): string;
|
|
207
|
+
/** Maps an HTTP status (>= 400) to its canonical {@link ErrorCode} (SPEC §2.1). */
|
|
208
|
+
declare function codeForStatus(status: number): ErrorCode;
|
|
209
|
+
/** Builds the error for an HTTP error response: `"<operation>: <reason> (HTTP <status>)"`. */
|
|
210
|
+
declare function errorForStatus(operation: string, status: number, details?: Omit<ErrorDetails, "httpStatus"> & {
|
|
211
|
+
reason?: string;
|
|
212
|
+
}): AwsSecretsManagerError;
|
|
213
|
+
/** True when `err` is an SDK error (optionally with the given code). */
|
|
214
|
+
declare function isAwsSecretsManagerError(err: unknown, code?: ErrorCode): err is AwsSecretsManagerError;
|
|
215
|
+
|
|
216
|
+
/** Structured fields attached to a log line. */
|
|
217
|
+
type LogFields = Record<string, unknown>;
|
|
218
|
+
/**
|
|
219
|
+
* Minimal logger the client writes diagnostics to (SPEC §2.5). Compatible with `console`,
|
|
220
|
+
* pino and winston loggers. The default is silent.
|
|
221
|
+
*/
|
|
222
|
+
interface ClientLogger {
|
|
223
|
+
debug(message: string, fields?: LogFields): void;
|
|
224
|
+
info(message: string, fields?: LogFields): void;
|
|
225
|
+
warn(message: string, fields?: LogFields): void;
|
|
226
|
+
error(message: string, fields?: LogFields): void;
|
|
227
|
+
}
|
|
228
|
+
/** A logger that discards everything (the default). */
|
|
229
|
+
declare const silentLogger: ClientLogger;
|
|
230
|
+
/** Data passed to {@link Hooks.onRequest}. URL query values and headers are redacted. */
|
|
231
|
+
interface RequestInfo {
|
|
232
|
+
method: string;
|
|
233
|
+
url: string;
|
|
234
|
+
headers: Record<string, string>;
|
|
235
|
+
/** Attempt number, starting at 1. */
|
|
236
|
+
attempt: number;
|
|
237
|
+
}
|
|
238
|
+
/** Data passed to {@link Hooks.onResponse}. */
|
|
239
|
+
interface ResponseInfo {
|
|
240
|
+
method: string;
|
|
241
|
+
url: string;
|
|
242
|
+
status: number;
|
|
243
|
+
durationMs: number;
|
|
244
|
+
attempt: number;
|
|
245
|
+
requestId?: string;
|
|
246
|
+
}
|
|
247
|
+
/** Data passed to {@link Hooks.onError}. */
|
|
248
|
+
interface ErrorInfo {
|
|
249
|
+
method: string;
|
|
250
|
+
url: string;
|
|
251
|
+
error: Error;
|
|
252
|
+
attempt: number;
|
|
253
|
+
/** Whether the transport will retry after this error. */
|
|
254
|
+
willRetry: boolean;
|
|
255
|
+
}
|
|
256
|
+
/** Observability hooks called on every HTTP attempt. Exceptions thrown by hooks are ignored. */
|
|
257
|
+
interface Hooks {
|
|
258
|
+
onRequest?: (info: RequestInfo) => void;
|
|
259
|
+
onResponse?: (info: ResponseInfo) => void;
|
|
260
|
+
onError?: (info: ErrorInfo) => void;
|
|
261
|
+
}
|
|
262
|
+
/** Calls `fn` and swallows anything it throws (hooks and loggers must never break a call). */
|
|
263
|
+
declare function safeCall<A extends unknown[]>(fn: ((...args: A) => unknown) | undefined, ...args: A): void;
|
|
264
|
+
/** Wraps a logger so that no method ever throws. */
|
|
265
|
+
declare function safeLogger(logger: ClientLogger | undefined): ClientLogger;
|
|
266
|
+
|
|
267
|
+
/** Options of {@link RetryPolicy} (SPEC §2.3). */
|
|
268
|
+
interface RetryPolicyOptions {
|
|
269
|
+
/** Retries after the first attempt (default 3, so up to 4 attempts). */
|
|
270
|
+
maxRetries?: number;
|
|
271
|
+
/** Backoff cap for the first retry, in ms (default 100). */
|
|
272
|
+
initialBackoffMs?: number;
|
|
273
|
+
/** Upper bound of any backoff, in ms (default 10 000). */
|
|
274
|
+
maxBackoffMs?: number;
|
|
275
|
+
/** Exponential growth factor (default 2). */
|
|
276
|
+
multiplier?: number;
|
|
277
|
+
/** Longest `Retry-After` the client is willing to wait, in ms (default 60 000). */
|
|
278
|
+
maxRetryAfterMs?: number;
|
|
279
|
+
/** Random source in [0, 1) used for full jitter; injectable for tests. */
|
|
280
|
+
random?: () => number;
|
|
281
|
+
}
|
|
282
|
+
/** Retry policy with full-jitter exponential backoff. Immutable. */
|
|
283
|
+
declare class RetryPolicy {
|
|
284
|
+
static readonly DEFAULTS: Readonly<{
|
|
285
|
+
maxRetries: 3;
|
|
286
|
+
initialBackoffMs: 100;
|
|
287
|
+
maxBackoffMs: 10000;
|
|
288
|
+
multiplier: 2;
|
|
289
|
+
maxRetryAfterMs: 60000;
|
|
290
|
+
}>;
|
|
291
|
+
readonly maxRetries: number;
|
|
292
|
+
readonly initialBackoffMs: number;
|
|
293
|
+
readonly maxBackoffMs: number;
|
|
294
|
+
readonly multiplier: number;
|
|
295
|
+
readonly maxRetryAfterMs: number;
|
|
296
|
+
readonly random: () => number;
|
|
297
|
+
constructor(options?: RetryPolicyOptions);
|
|
298
|
+
/** Returns a policy from options, keeping an existing instance as is. */
|
|
299
|
+
static from(value: RetryPolicy | RetryPolicyOptions | undefined): RetryPolicy;
|
|
300
|
+
/** Upper bound of the backoff before retry `n` (0-based): `min(max, initial * multiplier^n)`. */
|
|
301
|
+
backoffCapMs(retry: number): number;
|
|
302
|
+
/** Full-jitter backoff before retry `n` (0-based): `random(0, backoffCapMs(n))`. */
|
|
303
|
+
backoffMs(retry: number): number;
|
|
304
|
+
/** Validation problems (empty when valid). */
|
|
305
|
+
problems(): string[];
|
|
306
|
+
toJSON(): Record<string, number>;
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Parses a `Retry-After` header (delta seconds or HTTP-date) into milliseconds from `now`.
|
|
310
|
+
* Returns `undefined` when absent or invalid; past dates give 0.
|
|
311
|
+
*/
|
|
312
|
+
declare function parseRetryAfter(value: string | null | undefined, now?: number): number | undefined;
|
|
313
|
+
/** `GET HEAD OPTIONS PUT DELETE` are idempotent. */
|
|
314
|
+
declare function isIdempotentMethod(method: string): boolean;
|
|
315
|
+
/**
|
|
316
|
+
* Whether a response with this status should be retried (SPEC §2.3): 429 always; 408, 502, 503,
|
|
317
|
+
* 504 for idempotent requests; 500 only for idempotent requests. Non-idempotent requests are
|
|
318
|
+
* retried only on 429.
|
|
319
|
+
*/
|
|
320
|
+
declare function isRetryableStatus(status: number, idempotent: boolean): boolean;
|
|
321
|
+
|
|
322
|
+
/** TLS settings (SPEC §2.2). */
|
|
323
|
+
interface TlsOptions {
|
|
324
|
+
/** Path to a PEM CA bundle. */
|
|
325
|
+
caCertPath?: string;
|
|
326
|
+
/** PEM CA bundle contents. */
|
|
327
|
+
caCertPem?: string;
|
|
328
|
+
/** Path to a PEM client certificate (requires {@link clientKeyPath}). */
|
|
329
|
+
clientCertPath?: string;
|
|
330
|
+
/** Path to the PEM client key (requires {@link clientCertPath}). */
|
|
331
|
+
clientKeyPath?: string;
|
|
332
|
+
/** Disables certificate verification. Tests only; logs a warning once. */
|
|
333
|
+
insecureSkipVerify?: boolean;
|
|
334
|
+
}
|
|
335
|
+
/** Common configuration input shared by every client config (all optional). */
|
|
336
|
+
interface CommonConfigOptions {
|
|
337
|
+
/** Endpoint base URL. */
|
|
338
|
+
url?: string;
|
|
339
|
+
/** Connection setup timeout in ms (default 10 000). */
|
|
340
|
+
connectTimeoutMs?: number;
|
|
341
|
+
/** Per-attempt timeout in ms, headers + body (default 30 000). */
|
|
342
|
+
requestTimeoutMs?: number;
|
|
343
|
+
/** Whole-call timeout in ms including retries and backoff (default 120 000). */
|
|
344
|
+
totalTimeoutMs?: number;
|
|
345
|
+
/** Retry policy or its options. */
|
|
346
|
+
retry?: RetryPolicy | RetryPolicyOptions;
|
|
347
|
+
/** TLS settings. */
|
|
348
|
+
tls?: TlsOptions;
|
|
349
|
+
/** Proxy URL. Environment proxies (`HTTPS_PROXY`, …) are ignored unless set here. */
|
|
350
|
+
proxy?: string;
|
|
351
|
+
/** Extra request headers. */
|
|
352
|
+
headers?: Record<string, string>;
|
|
353
|
+
/** Appended after the standard User-Agent. */
|
|
354
|
+
userAgentSuffix?: string;
|
|
355
|
+
/** Request/response hooks. */
|
|
356
|
+
hooks?: Hooks;
|
|
357
|
+
/** Diagnostic logger (silent by default). */
|
|
358
|
+
logger?: ClientLogger;
|
|
359
|
+
}
|
|
360
|
+
/** Resolved common configuration (defaults applied). */
|
|
361
|
+
interface CommonConfig {
|
|
362
|
+
readonly url: string;
|
|
363
|
+
readonly connectTimeoutMs: number;
|
|
364
|
+
readonly requestTimeoutMs: number;
|
|
365
|
+
readonly totalTimeoutMs: number;
|
|
366
|
+
readonly retry: RetryPolicy;
|
|
367
|
+
readonly tls: Readonly<TlsOptions>;
|
|
368
|
+
readonly proxy?: string;
|
|
369
|
+
readonly headers: Readonly<Record<string, string>>;
|
|
370
|
+
readonly userAgentSuffix?: string;
|
|
371
|
+
readonly hooks?: Hooks;
|
|
372
|
+
readonly logger?: ClientLogger;
|
|
373
|
+
}
|
|
374
|
+
/** Default timeouts (SPEC §2.2). */
|
|
375
|
+
declare const DEFAULT_TIMEOUTS: Readonly<{
|
|
376
|
+
connectTimeoutMs: 10000;
|
|
377
|
+
requestTimeoutMs: 30000;
|
|
378
|
+
totalTimeoutMs: 120000;
|
|
379
|
+
}>;
|
|
380
|
+
/** Applies defaults to common options. Does not validate (see {@link validateCommonConfig}). */
|
|
381
|
+
declare function resolveCommonConfig(options: CommonConfigOptions, defaultUrl: string): CommonConfig;
|
|
382
|
+
/** Throws {@link ConfigError} when the common settings are invalid (SPEC §2.2). */
|
|
383
|
+
declare function validateCommonConfig(config: CommonConfig): void;
|
|
384
|
+
/** Vendor variable names consulted after `GROW_<KEY_UPPER>_<NAME>` for the common settings. */
|
|
385
|
+
interface CommonVendorEnv {
|
|
386
|
+
url?: readonly string[];
|
|
387
|
+
caCert?: readonly string[];
|
|
388
|
+
clientCert?: readonly string[];
|
|
389
|
+
clientKey?: readonly string[];
|
|
390
|
+
insecureSkipVerify?: readonly string[];
|
|
391
|
+
proxy?: readonly string[];
|
|
392
|
+
}
|
|
393
|
+
/** Reads the common settings from the environment (only values that are present). */
|
|
394
|
+
declare function readCommonEnv(reader: EnvReader, vendor?: CommonVendorEnv): CommonConfigOptions;
|
|
395
|
+
/** Drops keys whose value is `undefined` so they do not shadow lower-precedence values. */
|
|
396
|
+
declare function definedOnly<T extends object>(value: T): Partial<T>;
|
|
397
|
+
/**
|
|
398
|
+
* Merges option layers, later layers winning; `retry`, `tls` and `headers` are merged
|
|
399
|
+
* key by key. `undefined` values never override.
|
|
400
|
+
*/
|
|
401
|
+
declare function mergeOptions<T extends CommonConfigOptions>(...layers: (Partial<T> | undefined)[]): T;
|
|
402
|
+
/** Debug description of the common settings with credentials redacted. */
|
|
403
|
+
declare function describeCommonConfig(config: CommonConfig): Record<string, unknown>;
|
|
404
|
+
/** Collects the revealed values of every {@link Secret} found in `values`. */
|
|
405
|
+
declare function secretValues(...values: unknown[]): string[];
|
|
406
|
+
|
|
407
|
+
/** Options of {@link pollUntil}. */
|
|
408
|
+
interface PollOptions {
|
|
409
|
+
/** Give up after this many ms (default 30 000). */
|
|
410
|
+
timeoutMs?: number;
|
|
411
|
+
/** Wait between attempts in ms (default 1 000). */
|
|
412
|
+
intervalMs?: number;
|
|
413
|
+
/** Caller cancellation. */
|
|
414
|
+
signal?: AbortSignal;
|
|
415
|
+
/** Name used in the timeout message (default `"poll"`). */
|
|
416
|
+
operation?: string;
|
|
417
|
+
/** Errors for which polling continues instead of failing (default: none). */
|
|
418
|
+
ignoreError?: (error: unknown) => boolean;
|
|
419
|
+
/** Test seam. */
|
|
420
|
+
sleep?: (ms: number, signal?: AbortSignal) => Promise<void>;
|
|
421
|
+
/** Test seam: clock in ms. */
|
|
422
|
+
now?: () => number;
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* Calls `fn` until `predicate(value)` is true and returns that value. Throws
|
|
426
|
+
* {@link TimeoutError} when the time budget runs out (the message includes the last value's
|
|
427
|
+
* failure reason when the predicate never matched) and `CancelledError` on abort.
|
|
428
|
+
*/
|
|
429
|
+
declare function pollUntil<T>(fn: (attempt: number) => Promise<T>, predicate: (value: T) => boolean, options?: PollOptions): Promise<T>;
|
|
430
|
+
|
|
431
|
+
/** Response headers that carry a vendor request id, checked in order. */
|
|
432
|
+
declare const DEFAULT_REQUEST_ID_HEADERS: readonly string[];
|
|
433
|
+
/** Longest vendor error text kept in an error message (SPEC §2.1). */
|
|
434
|
+
declare const MAX_VENDOR_TEXT = 300;
|
|
435
|
+
/** Query parameter values accepted by {@link RequestOptions.query}. */
|
|
436
|
+
type QueryValue = string | number | boolean | null | undefined | readonly (string | number | boolean)[];
|
|
437
|
+
/** How the response body is decoded. */
|
|
438
|
+
type ResponseType = "json" | "text" | "bytes" | "none";
|
|
439
|
+
/** One HTTP call made through {@link HttpTransport.request}. */
|
|
440
|
+
interface RequestOptions {
|
|
441
|
+
/** HTTP method (default `GET`). */
|
|
442
|
+
method?: string;
|
|
443
|
+
/** Path joined to the base URL (`/v1/x`), or an absolute URL. */
|
|
444
|
+
path: string;
|
|
445
|
+
/** Query parameters (`undefined`/`null` are skipped, arrays repeat the key). */
|
|
446
|
+
query?: Readonly<Record<string, QueryValue>>;
|
|
447
|
+
/** Extra headers for this call. */
|
|
448
|
+
headers?: Readonly<Record<string, string>>;
|
|
449
|
+
/** JSON body (sets `content-type: application/json`). */
|
|
450
|
+
json?: unknown;
|
|
451
|
+
/** Raw body. */
|
|
452
|
+
body?: string | Uint8Array;
|
|
453
|
+
/** Marks a non-idempotent method (e.g. `POST`) as safe to retry. */
|
|
454
|
+
idempotent?: boolean;
|
|
455
|
+
/** Caller cancellation. */
|
|
456
|
+
signal?: AbortSignal;
|
|
457
|
+
/** Operation name used in error messages (default `"<METHOD> <path>"`). */
|
|
458
|
+
operation?: string;
|
|
459
|
+
/** Per-attempt timeout override in ms. */
|
|
460
|
+
requestTimeoutMs?: number;
|
|
461
|
+
/** Whole-call timeout override in ms. */
|
|
462
|
+
totalTimeoutMs?: number;
|
|
463
|
+
/** Body decoding (default `json`; empty bodies decode to `undefined`). */
|
|
464
|
+
responseType?: ResponseType;
|
|
465
|
+
/**
|
|
466
|
+
* Error statuses returned to the caller instead of thrown (e.g. `[404]`). Their body is decoded
|
|
467
|
+
* like a success body (`data`; JSON that does not parse decodes to `undefined` instead of
|
|
468
|
+
* throwing) and the raw text is in {@link TransportResponse.text}.
|
|
469
|
+
*/
|
|
470
|
+
allowStatus?: readonly number[];
|
|
471
|
+
/**
|
|
472
|
+
* Maps an HTTP error response of this call to an SDK error; runs before
|
|
473
|
+
* {@link TransportOptions.classifyError}. Return `undefined` to keep the next mapping.
|
|
474
|
+
*/
|
|
475
|
+
classifyError?: ErrorClassifier;
|
|
476
|
+
}
|
|
477
|
+
/**
|
|
478
|
+
* An HTTP error response (status >= 400, not in `allowStatus`), passed to an
|
|
479
|
+
* {@link ErrorClassifier} before the transport decides about retries and calls `onError`.
|
|
480
|
+
*/
|
|
481
|
+
interface ErrorResponse {
|
|
482
|
+
/** Operation name used in error messages (e.g. `"GET /v1/x"`). */
|
|
483
|
+
readonly operation: string;
|
|
484
|
+
readonly method: string;
|
|
485
|
+
readonly status: number;
|
|
486
|
+
readonly headers: Headers;
|
|
487
|
+
/**
|
|
488
|
+
* Raw response body text. It is NOT redacted: parse it (vendor error codes, request ids), but do
|
|
489
|
+
* not copy it into an error message unfiltered — use {@link reason} or
|
|
490
|
+
* {@link HttpTransport.redact} instead.
|
|
491
|
+
*/
|
|
492
|
+
readonly body: string;
|
|
493
|
+
/** Vendor message extracted from the body: whitespace collapsed, redacted, truncated. */
|
|
494
|
+
readonly reason?: string;
|
|
495
|
+
readonly requestId?: string;
|
|
496
|
+
readonly retryAfterMs?: number;
|
|
497
|
+
/** 1-based attempt number. */
|
|
498
|
+
readonly attempt: number;
|
|
499
|
+
/** The error the transport throws when no classifier returns one (SPEC §2.1 mapping). */
|
|
500
|
+
readonly defaultError: AwsSecretsManagerError;
|
|
501
|
+
}
|
|
502
|
+
/**
|
|
503
|
+
* Service-specific error mapping: returns the error to raise for an HTTP error response, or
|
|
504
|
+
* `undefined` to keep the default. Retries still follow the HTTP status (SPEC §2.3); a returned
|
|
505
|
+
* error with `retryable: false` stops them. A classifier that throws an SDK error is treated as
|
|
506
|
+
* if it had returned it; any other exception is ignored.
|
|
507
|
+
*/
|
|
508
|
+
type ErrorClassifier = (response: ErrorResponse) => AwsSecretsManagerError | undefined;
|
|
509
|
+
/** Result of {@link HttpTransport.request}. */
|
|
510
|
+
interface TransportResponse<T = unknown> {
|
|
511
|
+
status: number;
|
|
512
|
+
headers: Headers;
|
|
513
|
+
data: T;
|
|
514
|
+
requestId?: string;
|
|
515
|
+
durationMs: number;
|
|
516
|
+
/** Attempts made, starting at 1. */
|
|
517
|
+
attempts: number;
|
|
518
|
+
/** Raw body text of an allowed error response (status >= 400 listed in `allowStatus`). */
|
|
519
|
+
text?: string;
|
|
520
|
+
}
|
|
521
|
+
/** Options of {@link HttpTransport}. */
|
|
522
|
+
interface TransportOptions {
|
|
523
|
+
/** Resolved common configuration (URL, timeouts, retry, TLS, proxy, headers, hooks, logger). */
|
|
524
|
+
config: CommonConfig;
|
|
525
|
+
/** Default headers added to every request (e.g. authorization), after `config.headers`. */
|
|
526
|
+
defaultHeaders?: () => Readonly<Record<string, string>>;
|
|
527
|
+
/** Known secret values redacted from every error message, hook payload and log line. */
|
|
528
|
+
knownSecrets?: () => Iterable<KnownSecret>;
|
|
529
|
+
/** Header names that carry a vendor request id. */
|
|
530
|
+
requestIdHeaders?: readonly string[];
|
|
531
|
+
/**
|
|
532
|
+
* Service-specific mapping of HTTP error responses to SDK errors (e.g. a vendor error code in
|
|
533
|
+
* the body that means `CONFLICT`). Runs after {@link RequestOptions.classifyError} and before
|
|
534
|
+
* retries and the `onError` hook, so hooks see the mapped error.
|
|
535
|
+
*/
|
|
536
|
+
classifyError?: ErrorClassifier;
|
|
537
|
+
/** Test seam: replaces the dispatcher built from TLS/proxy settings (e.g. undici `MockAgent`). */
|
|
538
|
+
dispatcher?: Dispatcher;
|
|
539
|
+
/** Test seam: replaces the backoff sleep. */
|
|
540
|
+
sleep?: (ms: number, signal?: AbortSignal) => Promise<void>;
|
|
541
|
+
/** Test seam: clock in ms. */
|
|
542
|
+
now?: () => number;
|
|
543
|
+
}
|
|
544
|
+
/** Builds the undici dispatcher for the TLS, proxy and connect-timeout settings. */
|
|
545
|
+
declare function createDispatcher(config: CommonConfig, logger?: ClientLogger): Dispatcher;
|
|
546
|
+
/**
|
|
547
|
+
* The HTTP transport shared by every client: base URL join, query and JSON encoding, default
|
|
548
|
+
* headers and User-Agent, retries with full-jitter backoff and `Retry-After`, per-attempt and
|
|
549
|
+
* total timeouts, cancellation, hooks, logging and status → error mapping (SPEC §2.3).
|
|
550
|
+
*/
|
|
551
|
+
declare class HttpTransport {
|
|
552
|
+
#private;
|
|
553
|
+
/** `grow-codes-<key>/<version> (typescript)[ <suffix>]`. */
|
|
554
|
+
readonly userAgent: string;
|
|
555
|
+
readonly retry: RetryPolicy;
|
|
556
|
+
constructor(options: TransportOptions);
|
|
557
|
+
/** Whether {@link close} was called. */
|
|
558
|
+
get closed(): boolean;
|
|
559
|
+
/**
|
|
560
|
+
* Throws `CancelledError` (`"<operation>: client is closed"`, not retryable) once {@link close}
|
|
561
|
+
* was called (SPEC §2.4). Requests check this themselves; service methods that send no request
|
|
562
|
+
* (cached reads, local helpers) call it first.
|
|
563
|
+
*/
|
|
564
|
+
ensureOpen(operation: string): void;
|
|
565
|
+
/** Builds the absolute URL for a path and query. */
|
|
566
|
+
buildUrl(path: string, query?: Readonly<Record<string, QueryValue>>): URL;
|
|
567
|
+
/** Redacts known secrets from a text (error messages, vendor text). */
|
|
568
|
+
redact(text: string): string;
|
|
569
|
+
/** `GET` shortcut. */
|
|
570
|
+
get<T = unknown>(path: string, options?: Omit<RequestOptions, "path" | "method">): Promise<TransportResponse<T>>;
|
|
571
|
+
/** `POST` shortcut. */
|
|
572
|
+
post<T = unknown>(path: string, options?: Omit<RequestOptions, "path" | "method">): Promise<TransportResponse<T>>;
|
|
573
|
+
/** `PUT` shortcut. */
|
|
574
|
+
put<T = unknown>(path: string, options?: Omit<RequestOptions, "path" | "method">): Promise<TransportResponse<T>>;
|
|
575
|
+
/** `DELETE` shortcut. */
|
|
576
|
+
delete<T = unknown>(path: string, options?: Omit<RequestOptions, "path" | "method">): Promise<TransportResponse<T>>;
|
|
577
|
+
/**
|
|
578
|
+
* Sends a request with retries; throws an SDK error on failure. Every error message passes
|
|
579
|
+
* through {@link redact} with the known secrets.
|
|
580
|
+
*/
|
|
581
|
+
request<T = unknown>(options: RequestOptions): Promise<TransportResponse<T>>;
|
|
582
|
+
/**
|
|
583
|
+
* Extracts the vendor error message from a response body (JSON `message`, `error`, … or plain
|
|
584
|
+
* text; HTML is ignored), collapses whitespace, trims, redacts secrets and truncates it to
|
|
585
|
+
* {@link MAX_VENDOR_TEXT} characters. Returns `undefined` when there is nothing useful.
|
|
586
|
+
*/
|
|
587
|
+
vendorText(text: string): string | undefined;
|
|
588
|
+
/** Releases connections. Idempotent. */
|
|
589
|
+
close(): Promise<void>;
|
|
590
|
+
}
|
|
591
|
+
/** Redacts `key=value`/`"key": "value"` pairs with sensitive keys and bearer tokens. */
|
|
592
|
+
declare function redactSecretsInText(text: string): string;
|
|
593
|
+
|
|
594
|
+
/** Package version (kept in sync by release-please). */
|
|
595
|
+
declare const SDK_VERSION = "0.1.1";
|
|
596
|
+
/** Catalog key of the service (`aws-secrets-manager`). */
|
|
597
|
+
declare const PACKAGE_KEY = "aws-secrets-manager";
|
|
598
|
+
/** Language tag used in the User-Agent. */
|
|
599
|
+
declare const LANGUAGE = "typescript";
|
|
600
|
+
/** sdk-kit version this package was generated from. */
|
|
601
|
+
declare const SDK_KIT_VERSION = "0.3.0";
|
|
602
|
+
|
|
603
|
+
declare const INSPECT: unique symbol;
|
|
604
|
+
/** Default recovery window of `deleteSecret` / `SecretsProvider.delete` in days (AWS default). */
|
|
605
|
+
declare const DEFAULT_RECOVERY_WINDOW_DAYS = 30;
|
|
606
|
+
/** Default STS role session name of the assume-role helper. */
|
|
607
|
+
declare const DEFAULT_ROLE_SESSION_NAME = "grow-sdk";
|
|
608
|
+
/** Options accepted by {@link AwsSecretsManagerConfig} (all optional). */
|
|
609
|
+
interface AwsSecretsManagerConfigOptions extends CommonConfigOptions {
|
|
610
|
+
/**
|
|
611
|
+
* Endpoint override (env `GROW_AWS_SECRETS_MANAGER_URL` > `AWS_ENDPOINT_URL_SECRETS_MANAGER` >
|
|
612
|
+
* `AWS_ENDPOINT_URL`). Unset: the AWS SDK resolves `https://secretsmanager.<region>.amazonaws.com`.
|
|
613
|
+
*/
|
|
614
|
+
url?: string;
|
|
615
|
+
/** AWS region (env `GROW_AWS_SECRETS_MANAGER_REGION` > `AWS_REGION` > `AWS_DEFAULT_REGION`). */
|
|
616
|
+
region?: string;
|
|
617
|
+
/** Access key id (env `GROW_AWS_SECRETS_MANAGER_ACCESS_KEY_ID` > `AWS_ACCESS_KEY_ID`). */
|
|
618
|
+
accessKeyId?: string;
|
|
619
|
+
/** Secret access key (env `GROW_AWS_SECRETS_MANAGER_SECRET_ACCESS_KEY` > `AWS_SECRET_ACCESS_KEY`). */
|
|
620
|
+
secretAccessKey?: string | Secret;
|
|
621
|
+
/** Session token (env `GROW_AWS_SECRETS_MANAGER_SESSION_TOKEN` > `AWS_SESSION_TOKEN`). */
|
|
622
|
+
sessionToken?: string | Secret;
|
|
623
|
+
/** Shared config/credentials profile (env `GROW_AWS_SECRETS_MANAGER_PROFILE` > `AWS_PROFILE`). */
|
|
624
|
+
profile?: string;
|
|
625
|
+
/** An AWS SDK credentials object or provider (instead of the key fields or the default chain). */
|
|
626
|
+
credentials?: AwsCredentialIdentity | AwsCredentialIdentityProvider;
|
|
627
|
+
/** Role to assume with STS on top of the base credentials (env `GROW_AWS_SECRETS_MANAGER_ROLE_ARN`). */
|
|
628
|
+
roleArn?: string;
|
|
629
|
+
/** STS session name (default `grow-sdk`, env `GROW_AWS_SECRETS_MANAGER_ROLE_SESSION_NAME`). */
|
|
630
|
+
roleSessionName?: string;
|
|
631
|
+
/** STS external id (env `GROW_AWS_SECRETS_MANAGER_EXTERNAL_ID`). */
|
|
632
|
+
externalId?: string;
|
|
633
|
+
/** Assumed-role session duration in ms (900 s – 43 200 s; default: the role's default). */
|
|
634
|
+
roleDurationMs?: number;
|
|
635
|
+
/** Recovery window of deletes in days, 7–30 (default 30, env `GROW_AWS_SECRETS_MANAGER_RECOVERY_WINDOW_DAYS`). */
|
|
636
|
+
recoveryWindowDays?: number;
|
|
637
|
+
/**
|
|
638
|
+
* An existing AWS SDK `SecretsManagerClient` to use instead of building one. Mutually exclusive
|
|
639
|
+
* with the credential, region and endpoint fields; `close()` never destroys it and the Grow
|
|
640
|
+
* hooks, TLS, proxy and User-Agent settings do not apply to it.
|
|
641
|
+
*/
|
|
642
|
+
sdkClient?: SecretsManagerClient;
|
|
643
|
+
}
|
|
644
|
+
/**
|
|
645
|
+
* Vendor environment variables read after `GROW_AWS_SECRETS_MANAGER_*`, in order (standard AWS
|
|
646
|
+
* variables). Unset credentials fall back to the AWS SDK default credential chain.
|
|
647
|
+
*/
|
|
648
|
+
declare const VENDOR_ENV: CommonVendorEnv & {
|
|
649
|
+
region: readonly string[];
|
|
650
|
+
accessKeyId: readonly string[];
|
|
651
|
+
secretAccessKey: readonly string[];
|
|
652
|
+
sessionToken: readonly string[];
|
|
653
|
+
profile: readonly string[];
|
|
654
|
+
};
|
|
655
|
+
/** Immutable configuration of {@link AwsSecretsManagerClient}. */
|
|
656
|
+
declare class AwsSecretsManagerConfig implements CommonConfig {
|
|
657
|
+
/** Prefix of every environment variable. */
|
|
658
|
+
static readonly ENV_PREFIX = "GROW_AWS_SECRETS_MANAGER_";
|
|
659
|
+
/**
|
|
660
|
+
* Effective endpoint: {@link endpoint} when set, otherwise the public AWS endpoint of
|
|
661
|
+
* {@link region} (`us-east-1` when the region is left to the SDK). Informational.
|
|
662
|
+
*/
|
|
663
|
+
readonly url: string;
|
|
664
|
+
/** Explicit endpoint override passed to the AWS SDK (`undefined` = SDK resolves it). */
|
|
665
|
+
readonly endpoint?: string;
|
|
666
|
+
readonly connectTimeoutMs: number;
|
|
667
|
+
readonly requestTimeoutMs: number;
|
|
668
|
+
readonly totalTimeoutMs: number;
|
|
669
|
+
readonly retry: RetryPolicy;
|
|
670
|
+
readonly tls: Readonly<TlsOptions>;
|
|
671
|
+
readonly proxy?: string;
|
|
672
|
+
readonly headers: Readonly<Record<string, string>>;
|
|
673
|
+
readonly userAgentSuffix?: string;
|
|
674
|
+
readonly hooks?: Hooks;
|
|
675
|
+
readonly logger?: ClientLogger;
|
|
676
|
+
/** AWS region (`undefined` = SDK chain: env, shared config). */
|
|
677
|
+
readonly region?: string;
|
|
678
|
+
/** Access key id. */
|
|
679
|
+
readonly accessKeyId?: string;
|
|
680
|
+
/** Secret access key. */
|
|
681
|
+
readonly secretAccessKey?: Secret;
|
|
682
|
+
/** Session token. */
|
|
683
|
+
readonly sessionToken?: Secret;
|
|
684
|
+
/** Shared config profile. */
|
|
685
|
+
readonly profile?: string;
|
|
686
|
+
/** Explicit SDK credentials. */
|
|
687
|
+
readonly credentials?: AwsCredentialIdentity | AwsCredentialIdentityProvider;
|
|
688
|
+
/** Role assumed with STS. */
|
|
689
|
+
readonly roleArn?: string;
|
|
690
|
+
/** STS session name. */
|
|
691
|
+
readonly roleSessionName: string;
|
|
692
|
+
/** STS external id. */
|
|
693
|
+
readonly externalId?: string;
|
|
694
|
+
/** Assumed-role session duration in ms. */
|
|
695
|
+
readonly roleDurationMs?: number;
|
|
696
|
+
/** Recovery window of deletes in days. */
|
|
697
|
+
readonly recoveryWindowDays: number;
|
|
698
|
+
/** Caller-supplied AWS SDK client. */
|
|
699
|
+
readonly sdkClient?: SecretsManagerClient;
|
|
700
|
+
/** Applies defaults, validates (throws {@link ConfigError}) and freezes. */
|
|
701
|
+
constructor(options?: AwsSecretsManagerConfigOptions);
|
|
702
|
+
/** Returns `options` when it already is a config, otherwise builds one. */
|
|
703
|
+
static from(options?: AwsSecretsManagerConfigOptions): AwsSecretsManagerConfig;
|
|
704
|
+
/**
|
|
705
|
+
* Builds a config from the environment. Precedence: explicit `overrides` >
|
|
706
|
+
* `GROW_AWS_SECRETS_MANAGER_<NAME>` > standard AWS variables ({@link VENDOR_ENV}) > defaults.
|
|
707
|
+
* Credentials left unset use the AWS SDK default chain.
|
|
708
|
+
*/
|
|
709
|
+
static fromEnv(overrides?: AwsSecretsManagerConfigOptions, env?: EnvMap): AwsSecretsManagerConfig;
|
|
710
|
+
/** Throws {@link ConfigError} when a setting is invalid. */
|
|
711
|
+
validate(): void;
|
|
712
|
+
/** Credential values to redact from error messages and logs. */
|
|
713
|
+
knownSecrets(): string[];
|
|
714
|
+
/** Debug form with every credential redacted. */
|
|
715
|
+
toJSON(): Record<string, unknown>;
|
|
716
|
+
toString(): string;
|
|
717
|
+
[INSPECT](): string;
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
/** Options of {@link SecretCache} (SPEC §3). */
|
|
721
|
+
interface SecretCacheOptions {
|
|
722
|
+
/** Entry lifetime in ms (default 60 000). Negative results are cached for the same time. */
|
|
723
|
+
ttlMs?: number;
|
|
724
|
+
/** LRU capacity (default 1 000). */
|
|
725
|
+
maxEntries?: number;
|
|
726
|
+
/** A hit after `ttl * refreshAheadFactor` triggers one background refresh (default 0.8). */
|
|
727
|
+
refreshAheadFactor?: number;
|
|
728
|
+
/** Within `ttl + staleWhileRevalidateMs` a stale value is returned while one refresh runs (default 0). */
|
|
729
|
+
staleWhileRevalidateMs?: number;
|
|
730
|
+
/** Clock in ms (default `Date.now`). */
|
|
731
|
+
clock?: () => number;
|
|
732
|
+
/** Called when a background refresh fails (the old entry is kept). */
|
|
733
|
+
onRefreshError?: (error: unknown) => void;
|
|
734
|
+
}
|
|
735
|
+
/** Counters reported by {@link SecretCache.stats}. */
|
|
736
|
+
interface SecretCacheStats {
|
|
737
|
+
hits: number;
|
|
738
|
+
misses: number;
|
|
739
|
+
evictions: number;
|
|
740
|
+
refreshes: number;
|
|
741
|
+
size: number;
|
|
742
|
+
}
|
|
743
|
+
/**
|
|
744
|
+
* Read-through LRU cache in front of a {@link SecretsProvider}. Reads (`get*`, `require`,
|
|
745
|
+
* `exists`, `getMany`) are cached, including negative results; writes pass through and
|
|
746
|
+
* invalidate the name; `list`, `getAll` and `metadata` always reach the provider.
|
|
747
|
+
*/
|
|
748
|
+
declare class SecretCache extends BaseSecretsProvider {
|
|
749
|
+
#private;
|
|
750
|
+
constructor(provider: SecretsProvider, options?: SecretCacheOptions);
|
|
751
|
+
/** The wrapped provider. */
|
|
752
|
+
get provider(): SecretsProvider;
|
|
753
|
+
protected fetchSecret(name: string, options: GetOptions): Promise<SecretValue | null>;
|
|
754
|
+
protected listSecrets(prefixOrPath: string | undefined, options: SignalOptions): Promise<SecretMetadata[]>;
|
|
755
|
+
protected putSecret(name: string, value: Uint8Array, options: SetOptions): Promise<string>;
|
|
756
|
+
protected removeSecret(name: string, options: DeleteOptions): Promise<void>;
|
|
757
|
+
protected fetchMetadata(name: string, options: GetOptions): Promise<SecretMetadata | null>;
|
|
758
|
+
/** Drops every cached entry of `name` (all versions and paths). */
|
|
759
|
+
invalidate(name: string): void;
|
|
760
|
+
/** Drops every cached entry. */
|
|
761
|
+
clear(): void;
|
|
762
|
+
/** Counters and current size. */
|
|
763
|
+
stats(): SecretCacheStats;
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
/** Variable name for a secret name: upper-cased, every non `[A-Z0-9_]` character → `_`. */
|
|
767
|
+
declare function envNameFor(secretName: string, prefix?: string): string;
|
|
768
|
+
/** The part of `name` after `path` (used for variable names in `loadEnv(path)`). */
|
|
769
|
+
declare function relativeName(name: string, path: string | undefined): string;
|
|
770
|
+
/**
|
|
771
|
+
* Writes `values` (`envName → [secretName, value]`) into `env`, keeping existing variables
|
|
772
|
+
* unless `override`. Returns `envName → secretName` for the variables that were set.
|
|
773
|
+
*/
|
|
774
|
+
declare function applyEnv(values: ReadonlyMap<string, readonly [string, string]>, env: Record<string, string | undefined>, override: boolean): Record<string, string>;
|
|
775
|
+
|
|
776
|
+
/** Change-detection fingerprint: the version when present, else the SHA-256 of the value. */
|
|
777
|
+
declare function secretFingerprint(value: SecretValue | null): string;
|
|
778
|
+
/**
|
|
779
|
+
* Polls `read` every `intervalMs` and calls `onChange(new, old)` when the fingerprint changes,
|
|
780
|
+
* including deletion (`new = null`). The first read only records the baseline. Read errors and
|
|
781
|
+
* callback failures go to `options.onError`; polling continues. Timers never keep the process
|
|
782
|
+
* alive.
|
|
783
|
+
*/
|
|
784
|
+
declare function watchSecret(read: () => Promise<SecretValue | null>, intervalMs: number, onChange: WatchCallback, options?: Pick<WatchOptions, "onError">): WatchHandle;
|
|
785
|
+
|
|
786
|
+
/** AWS Secrets Manager API version (the API contract date; AWS exposes no server version). */
|
|
787
|
+
declare const API_VERSION = "2017-10-17";
|
|
788
|
+
/** Default version stage. */
|
|
789
|
+
declare const AWSCURRENT = "AWSCURRENT";
|
|
790
|
+
/** Stage of the previous current version. */
|
|
791
|
+
declare const AWSPREVIOUS = "AWSPREVIOUS";
|
|
792
|
+
/** Stage of a version being rotated in. */
|
|
793
|
+
declare const AWSPENDING = "AWSPENDING";
|
|
794
|
+
/** Maximum ids per `BatchGetSecretValue` call; longer id lists are split. */
|
|
795
|
+
declare const BATCH_GET_MAX_IDS = 20;
|
|
796
|
+
/** Per-call options of every I/O method. */
|
|
797
|
+
interface CallOptions {
|
|
798
|
+
/** Cancels the call (`CancelledError`). */
|
|
799
|
+
signal?: AbortSignal;
|
|
800
|
+
}
|
|
801
|
+
/** Selects a version by id or by stage label (default `AWSCURRENT`). */
|
|
802
|
+
interface VersionSelector {
|
|
803
|
+
/** Version id (`VersionId`). */
|
|
804
|
+
versionId?: string;
|
|
805
|
+
/** Stage label, e.g. `AWSCURRENT`, `AWSPREVIOUS` or a custom label. */
|
|
806
|
+
versionStage?: string;
|
|
807
|
+
}
|
|
808
|
+
/** A secret value read from AWS (`GetSecretValue`, `BatchGetSecretValue`). */
|
|
809
|
+
interface AwsSecretValue {
|
|
810
|
+
/** Full ARN. */
|
|
811
|
+
arn: string;
|
|
812
|
+
/** Secret name. */
|
|
813
|
+
name: string;
|
|
814
|
+
/** Version id. */
|
|
815
|
+
versionId?: string;
|
|
816
|
+
/** Stage labels attached to this version. */
|
|
817
|
+
versionStages: string[];
|
|
818
|
+
/** Creation time of this version. */
|
|
819
|
+
createdDate?: Date;
|
|
820
|
+
/** True when the secret stores `SecretBinary`, false for `SecretString`. */
|
|
821
|
+
binary: boolean;
|
|
822
|
+
/** The value (redacting wrapper; `value.version` is the version id). */
|
|
823
|
+
value: SecretValue;
|
|
824
|
+
}
|
|
825
|
+
/** Rotation schedule. */
|
|
826
|
+
interface RotationRules {
|
|
827
|
+
/** Rotate every N days (1–1000). */
|
|
828
|
+
automaticallyAfterDays?: number;
|
|
829
|
+
/** Rotation window length, e.g. `"3h"`. */
|
|
830
|
+
duration?: string;
|
|
831
|
+
/** `rate(…)` or `cron(…)` expression. */
|
|
832
|
+
scheduleExpression?: string;
|
|
833
|
+
}
|
|
834
|
+
/** Replication status of one replica region. */
|
|
835
|
+
interface ReplicationStatus {
|
|
836
|
+
region?: string;
|
|
837
|
+
kmsKeyId?: string;
|
|
838
|
+
status?: string;
|
|
839
|
+
statusMessage?: string;
|
|
840
|
+
lastAccessedDate?: Date;
|
|
841
|
+
}
|
|
842
|
+
/** Secret metadata (`DescribeSecret`, `ListSecrets` entries). Never contains the value. */
|
|
843
|
+
interface SecretDescription {
|
|
844
|
+
arn: string;
|
|
845
|
+
name: string;
|
|
846
|
+
description?: string;
|
|
847
|
+
kmsKeyId?: string;
|
|
848
|
+
rotationEnabled: boolean;
|
|
849
|
+
rotationLambdaArn?: string;
|
|
850
|
+
rotationRules?: RotationRules;
|
|
851
|
+
lastRotatedDate?: Date;
|
|
852
|
+
lastChangedDate?: Date;
|
|
853
|
+
lastAccessedDate?: Date;
|
|
854
|
+
/** Set when the secret is scheduled for deletion. */
|
|
855
|
+
deletedDate?: Date;
|
|
856
|
+
nextRotationDate?: Date;
|
|
857
|
+
createdDate?: Date;
|
|
858
|
+
primaryRegion?: string;
|
|
859
|
+
owningService?: string;
|
|
860
|
+
/** Tags as a map. */
|
|
861
|
+
tags: Record<string, string>;
|
|
862
|
+
/** Version id → stage labels. */
|
|
863
|
+
versionIdsToStages: Record<string, string[]>;
|
|
864
|
+
replicationStatus: ReplicationStatus[];
|
|
865
|
+
}
|
|
866
|
+
/** One version of a secret (`ListSecretVersionIds`). */
|
|
867
|
+
interface SecretVersion {
|
|
868
|
+
versionId: string;
|
|
869
|
+
versionStages: string[];
|
|
870
|
+
createdDate?: Date;
|
|
871
|
+
lastAccessedDate?: Date;
|
|
872
|
+
kmsKeyIds: string[];
|
|
873
|
+
}
|
|
874
|
+
/** ARN and name of a secret. */
|
|
875
|
+
interface SecretRef {
|
|
876
|
+
arn: string;
|
|
877
|
+
name: string;
|
|
878
|
+
}
|
|
879
|
+
/** Result of writes that may create a version. */
|
|
880
|
+
interface SecretWriteResult extends SecretRef {
|
|
881
|
+
/** Id of the new version (absent when no version was created). */
|
|
882
|
+
versionId?: string;
|
|
883
|
+
}
|
|
884
|
+
/** Result of `putSecretValue`. */
|
|
885
|
+
interface PutSecretValueResult extends SecretRef {
|
|
886
|
+
versionId: string;
|
|
887
|
+
versionStages: string[];
|
|
888
|
+
}
|
|
889
|
+
/** Result of `deleteSecret`. */
|
|
890
|
+
interface DeleteSecretResult extends SecretRef {
|
|
891
|
+
/** When the secret will be (or was) deleted. */
|
|
892
|
+
deletionDate?: Date;
|
|
893
|
+
}
|
|
894
|
+
/** Result of `getResourcePolicy`. */
|
|
895
|
+
interface ResourcePolicyResult extends SecretRef {
|
|
896
|
+
/** The policy JSON text, absent when the secret has no policy. */
|
|
897
|
+
resourcePolicy?: string;
|
|
898
|
+
/** The parsed policy, absent when there is none or it is not valid JSON. */
|
|
899
|
+
policy?: Record<string, unknown>;
|
|
900
|
+
}
|
|
901
|
+
/** One problem found by `validateResourcePolicy`. */
|
|
902
|
+
interface PolicyValidationError {
|
|
903
|
+
checkName?: string;
|
|
904
|
+
errorMessage?: string;
|
|
905
|
+
}
|
|
906
|
+
/** Result of `validateResourcePolicy`. */
|
|
907
|
+
interface ValidateResourcePolicyResult {
|
|
908
|
+
policyValidationPassed: boolean;
|
|
909
|
+
validationErrors: PolicyValidationError[];
|
|
910
|
+
}
|
|
911
|
+
/** A per-secret failure of `batchGetSecretValue` (the call itself succeeded). */
|
|
912
|
+
interface BatchGetError {
|
|
913
|
+
secretId?: string;
|
|
914
|
+
/** AWS error code, e.g. `ResourceNotFoundException`. */
|
|
915
|
+
errorCode?: string;
|
|
916
|
+
message?: string;
|
|
917
|
+
}
|
|
918
|
+
/** Result of `batchGetSecretValue`. */
|
|
919
|
+
interface BatchGetResult {
|
|
920
|
+
/** Values, in request order for the id form. */
|
|
921
|
+
secretValues: AwsSecretValue[];
|
|
922
|
+
/** Ids that could not be read. */
|
|
923
|
+
errors: BatchGetError[];
|
|
924
|
+
}
|
|
925
|
+
/** `ListSecrets` / `BatchGetSecretValue` filter keys. */
|
|
926
|
+
type SecretFilterKey = "name" | "description" | "tag-key" | "tag-value" | "primary-region" | "owning-service" | "all";
|
|
927
|
+
/** A `ListSecrets` filter. A value prefixed with `!` negates it (AWS). */
|
|
928
|
+
interface SecretFilter {
|
|
929
|
+
key: SecretFilterKey;
|
|
930
|
+
values: string[];
|
|
931
|
+
}
|
|
932
|
+
/** A replica region for `createSecret`. */
|
|
933
|
+
interface ReplicaRegion {
|
|
934
|
+
region: string;
|
|
935
|
+
kmsKeyId?: string;
|
|
936
|
+
}
|
|
937
|
+
/** Converts tags to the AWS list form. */
|
|
938
|
+
declare function toAwsTags(tags: Readonly<Record<string, string>>): Tag[];
|
|
939
|
+
/** Converts the AWS tag list to a map. */
|
|
940
|
+
declare function fromAwsTags(tags: readonly Tag[] | undefined | null): Record<string, string>;
|
|
941
|
+
/**
|
|
942
|
+
* Encodes a value for `SecretString`/`SecretBinary`: strings as `SecretString`, bytes as
|
|
943
|
+
* `SecretBinary`, objects as JSON `SecretString`.
|
|
944
|
+
*/
|
|
945
|
+
declare function encodeValue(value: SecretInput): {
|
|
946
|
+
SecretString: string;
|
|
947
|
+
} | {
|
|
948
|
+
SecretBinary: Uint8Array;
|
|
949
|
+
};
|
|
950
|
+
/** Encodes raw bytes: valid UTF-8 → `SecretString`, anything else → `SecretBinary`. */
|
|
951
|
+
declare function encodeBytes(bytes: Uint8Array): {
|
|
952
|
+
SecretString: string;
|
|
953
|
+
} | {
|
|
954
|
+
SecretBinary: Uint8Array;
|
|
955
|
+
};
|
|
956
|
+
/** The fields of a `GetSecretValue` output that {@link toSecretValue} reads. */
|
|
957
|
+
interface ValueShape {
|
|
958
|
+
ARN?: string | undefined;
|
|
959
|
+
Name?: string | undefined;
|
|
960
|
+
VersionId?: string | undefined;
|
|
961
|
+
VersionStages?: string[] | undefined;
|
|
962
|
+
CreatedDate?: Date | undefined;
|
|
963
|
+
SecretString?: string | undefined;
|
|
964
|
+
SecretBinary?: Uint8Array | undefined;
|
|
965
|
+
}
|
|
966
|
+
/** Converts a `GetSecretValue` output / `SecretValueEntry`. */
|
|
967
|
+
declare function toSecretValue(out: ValueShape | SecretValueEntry): AwsSecretValue;
|
|
968
|
+
/** Converts a `DescribeSecret` output or a `SecretListEntry`. */
|
|
969
|
+
declare function toDescription(out: Omit<SecretListEntry, "Tags"> & Omit<DescribeSecretResponse, "Tags"> & {
|
|
970
|
+
Tags?: Tag[] | undefined;
|
|
971
|
+
}): SecretDescription;
|
|
972
|
+
/** Converts a `ListSecretVersionIds` entry. */
|
|
973
|
+
declare function toVersion(v: SecretVersionsListEntry): SecretVersion;
|
|
974
|
+
/** Converts a `BatchGetSecretValue` error entry. */
|
|
975
|
+
declare function toBatchError(e: APIErrorType): BatchGetError;
|
|
976
|
+
/** Converts a `ValidateResourcePolicy` error entry. */
|
|
977
|
+
declare function toPolicyError(e: ValidationErrorsEntry): PolicyValidationError;
|
|
978
|
+
/** Parses a policy JSON text into an object (`undefined` when absent or not a JSON object). */
|
|
979
|
+
declare function parsePolicy(text: string | undefined): Record<string, unknown> | undefined;
|
|
980
|
+
/** Converts filters to the AWS form. */
|
|
981
|
+
declare function toAwsFilters(filters: readonly SecretFilter[]): {
|
|
982
|
+
Key: SecretFilterKey;
|
|
983
|
+
Values: string[];
|
|
984
|
+
}[];
|
|
985
|
+
/** Whether an AWS `NextToken` means "more pages" (`null`, absent and `""` end the list). */
|
|
986
|
+
declare function hasMore(token: string | undefined | null): token is string;
|
|
987
|
+
|
|
988
|
+
/** Fetches one page: returns the items and the next token (`undefined` = last page). */
|
|
989
|
+
type PageFetcher<T> = (nextToken: string | undefined) => Promise<{
|
|
990
|
+
items: T[];
|
|
991
|
+
nextToken: string | undefined;
|
|
992
|
+
}>;
|
|
993
|
+
/**
|
|
994
|
+
* Lazily walks every page of an AWS list operation. Iterate with `for await`, or collect
|
|
995
|
+
* everything with {@link toArray}. Each iteration starts again from the first page.
|
|
996
|
+
*/
|
|
997
|
+
declare class Paginator<T> implements AsyncIterable<T> {
|
|
998
|
+
#private;
|
|
999
|
+
constructor(fetch: PageFetcher<T>);
|
|
1000
|
+
/** Yields one array per page. */
|
|
1001
|
+
pages(): AsyncGenerator<T[], void, undefined>;
|
|
1002
|
+
[Symbol.asyncIterator](): AsyncGenerator<T, void, undefined>;
|
|
1003
|
+
/** Collects every item of every page. */
|
|
1004
|
+
toArray(): Promise<T[]>;
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
/** The AWS caching-client defaults: TTL 1 h, 1 024 entries. Also usable with `SecretCache`. */
|
|
1008
|
+
declare const AWS_SECRET_CACHE_DEFAULTS: Readonly<Required<Pick<SecretCacheOptions, "ttlMs" | "maxEntries">>>;
|
|
1009
|
+
/** The client operations the cache needs. */
|
|
1010
|
+
interface SecretCacheSource {
|
|
1011
|
+
getSecretValue(secretId: string, options?: CallOptions & {
|
|
1012
|
+
versionStage?: string;
|
|
1013
|
+
}): Promise<AwsSecretValue>;
|
|
1014
|
+
describeSecret(secretId: string, options?: CallOptions): Promise<{
|
|
1015
|
+
versionIdsToStages: Record<string, string[]>;
|
|
1016
|
+
}>;
|
|
1017
|
+
}
|
|
1018
|
+
/** Options of {@link AwsSecretCache}. */
|
|
1019
|
+
interface AwsSecretCacheOptions {
|
|
1020
|
+
/** Refresh interval in ms (default 3 600 000 = 1 h). */
|
|
1021
|
+
ttlMs?: number;
|
|
1022
|
+
/** LRU capacity (default 1 024). */
|
|
1023
|
+
maxEntries?: number;
|
|
1024
|
+
/** Default stage label (default `AWSCURRENT`). */
|
|
1025
|
+
versionStage?: string;
|
|
1026
|
+
/** Clock in ms (default `Date.now`). */
|
|
1027
|
+
clock?: () => number;
|
|
1028
|
+
/** Called when a refresh fails and the cached value is served instead. */
|
|
1029
|
+
onRefreshError?: (error: unknown) => void;
|
|
1030
|
+
}
|
|
1031
|
+
/** Options of the cache reads. */
|
|
1032
|
+
interface CacheGetOptions extends CallOptions {
|
|
1033
|
+
/** Stage label (default: the cache's `versionStage`). */
|
|
1034
|
+
versionStage?: string;
|
|
1035
|
+
}
|
|
1036
|
+
/** Counters reported by {@link AwsSecretCache.stats}. */
|
|
1037
|
+
interface AwsSecretCacheStats {
|
|
1038
|
+
hits: number;
|
|
1039
|
+
misses: number;
|
|
1040
|
+
/** Expired entries checked with `DescribeSecret`. */
|
|
1041
|
+
refreshes: number;
|
|
1042
|
+
/** Refreshes that fetched a new version. */
|
|
1043
|
+
versionChanges: number;
|
|
1044
|
+
evictions: number;
|
|
1045
|
+
size: number;
|
|
1046
|
+
}
|
|
1047
|
+
/**
|
|
1048
|
+
* Version-stage aware cache in front of an {@link AwsSecretsManagerClient}
|
|
1049
|
+
* (`client.secretCache()`). Reads are coalesced per (secretId, stage). A refresh that fails
|
|
1050
|
+
* keeps serving the cached value and retries with exponential backoff (AWS caching-client
|
|
1051
|
+
* behaviour); a first read that fails throws.
|
|
1052
|
+
*/
|
|
1053
|
+
declare class AwsSecretCache {
|
|
1054
|
+
#private;
|
|
1055
|
+
/** The AWS caching-client defaults (TTL 1 h, 1 024 entries). */
|
|
1056
|
+
static awsDefaults(): {
|
|
1057
|
+
ttlMs: number;
|
|
1058
|
+
maxEntries: number;
|
|
1059
|
+
};
|
|
1060
|
+
constructor(source: SecretCacheSource, options?: AwsSecretCacheOptions);
|
|
1061
|
+
/** The cached value of `secretId` at the stage (default `AWSCURRENT`). */
|
|
1062
|
+
getSecretValue(secretId: string, options?: CacheGetOptions): Promise<AwsSecretValue>;
|
|
1063
|
+
/** The value as text (`SecretString`, or UTF-8 of the binary). */
|
|
1064
|
+
getSecretString(secretId: string, options?: CacheGetOptions): Promise<string>;
|
|
1065
|
+
/** The value as bytes. */
|
|
1066
|
+
getSecretBinary(secretId: string, options?: CacheGetOptions): Promise<Uint8Array>;
|
|
1067
|
+
/** Forces a refresh check now (and a fetch when the stage moved); returns the value. */
|
|
1068
|
+
refreshNow(secretId: string, options?: CacheGetOptions): Promise<AwsSecretValue>;
|
|
1069
|
+
/** Drops every cached stage of `secretId`. */
|
|
1070
|
+
invalidate(secretId: string): void;
|
|
1071
|
+
/** Drops every entry. */
|
|
1072
|
+
clear(): void;
|
|
1073
|
+
/** Counters and current size. */
|
|
1074
|
+
stats(): AwsSecretCacheStats;
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
/** Options of {@link AwsSecretsManagerSecretsProvider} (`client.secrets(options)`). */
|
|
1078
|
+
interface AwsSecretsManagerSecretsOptions {
|
|
1079
|
+
/** Recovery window of `delete()` in days (default `config.recoveryWindowDays`, i.e. 30). */
|
|
1080
|
+
recoveryWindowDays?: number;
|
|
1081
|
+
}
|
|
1082
|
+
/** `path/name` when a path is given, otherwise `name`. */
|
|
1083
|
+
declare function fullName(name: string, path: string | undefined): string;
|
|
1084
|
+
/** Converts a description into SPEC metadata. */
|
|
1085
|
+
declare function toMetadata(d: SecretDescription): SecretMetadata;
|
|
1086
|
+
/**
|
|
1087
|
+
* {@link SecretsProvider} over AWS Secrets Manager. Capabilities: `write`, `versions`, `delete`.
|
|
1088
|
+
*
|
|
1089
|
+
* - `get(name, {version})` reads `VersionId = version` (stage labels: use
|
|
1090
|
+
* `client.getSecretValue`).
|
|
1091
|
+
* - `set` stores text as `SecretString` and other bytes as `SecretBinary`; it creates the secret
|
|
1092
|
+
* when missing (with `description`/`tags`) and returns the new VersionId. `cas` is not
|
|
1093
|
+
* supported (`ValidationError`).
|
|
1094
|
+
* - `delete` schedules deletion with the recovery window (default 30 days); `permanent: true`
|
|
1095
|
+
* deletes immediately. A name scheduled for deletion cannot be written again until it is
|
|
1096
|
+
* restored or purged (`ConflictError`).
|
|
1097
|
+
* - `list(prefix)` matches names by string prefix (recursive); `getAll(path)` returns the
|
|
1098
|
+
* secrets directly under `path` (non-recursive).
|
|
1099
|
+
*/
|
|
1100
|
+
declare class AwsSecretsManagerSecretsProvider extends BaseSecretsProvider {
|
|
1101
|
+
#private;
|
|
1102
|
+
/** Capabilities declared to the conformance runner. */
|
|
1103
|
+
static readonly capabilities: readonly ["write", "versions", "delete"];
|
|
1104
|
+
constructor(client: AwsSecretsManagerClient, options?: AwsSecretsManagerSecretsOptions, onClose?: () => void);
|
|
1105
|
+
/** The client this provider uses. */
|
|
1106
|
+
get client(): AwsSecretsManagerClient;
|
|
1107
|
+
protected fetchSecret(name: string, options: GetOptions): Promise<SecretValue | null>;
|
|
1108
|
+
protected listSecrets(prefixOrPath: string | undefined, options: SignalOptions): Promise<SecretMetadata[]>;
|
|
1109
|
+
/** Every secret directly under `path` (non-recursive), keyed by full name. */
|
|
1110
|
+
getAll(path?: string, options?: SignalOptions): Promise<Map<string, SecretValue>>;
|
|
1111
|
+
/**
|
|
1112
|
+
* Present secrets in request order (`BatchGetSecretValue` in chunks of 20; per-name reads when
|
|
1113
|
+
* a `version` is requested).
|
|
1114
|
+
*/
|
|
1115
|
+
getMany(names: readonly string[], options?: GetOptions): Promise<Map<string, SecretValue>>;
|
|
1116
|
+
protected putSecret(name: string, value: Uint8Array, options: SetOptions): Promise<string>;
|
|
1117
|
+
protected removeSecret(name: string, options: DeleteOptions): Promise<void>;
|
|
1118
|
+
protected fetchMetadata(name: string, options: GetOptions): Promise<SecretMetadata | null>;
|
|
1119
|
+
/** Stops the watchers of this provider. Idempotent. */
|
|
1120
|
+
close(): Promise<void>;
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
/** Test seams. Not part of the stable API. */
|
|
1124
|
+
interface ClientInternals {
|
|
1125
|
+
/** Replaces the undici dispatcher built from the TLS/proxy settings (e.g. `MockAgent`). */
|
|
1126
|
+
dispatcher?: Dispatcher;
|
|
1127
|
+
}
|
|
1128
|
+
/** Options of {@link AwsSecretsManagerClient.getSecretValue} and {@link AwsSecretsManagerClient.getJsonField}. */
|
|
1129
|
+
interface GetSecretValueOptions extends CallOptions, VersionSelector {
|
|
1130
|
+
}
|
|
1131
|
+
/** Options of {@link AwsSecretsManagerClient.batchGetSecretValue}. */
|
|
1132
|
+
interface BatchGetOptions extends CallOptions {
|
|
1133
|
+
/** Page size for the filter form (1–20). */
|
|
1134
|
+
maxResults?: number;
|
|
1135
|
+
}
|
|
1136
|
+
/** Options of {@link AwsSecretsManagerClient.listSecrets}. */
|
|
1137
|
+
interface ListSecretsOptions extends CallOptions {
|
|
1138
|
+
filters?: readonly SecretFilter[];
|
|
1139
|
+
/** Include secrets scheduled for deletion (default false). */
|
|
1140
|
+
includePlannedDeletion?: boolean;
|
|
1141
|
+
/** Sort by creation date. */
|
|
1142
|
+
sortOrder?: "asc" | "desc";
|
|
1143
|
+
/** Page size (1–100). */
|
|
1144
|
+
maxResults?: number;
|
|
1145
|
+
}
|
|
1146
|
+
/** Options of {@link AwsSecretsManagerClient.listSecretVersionIds}. */
|
|
1147
|
+
interface ListSecretVersionIdsOptions extends CallOptions {
|
|
1148
|
+
/** Include versions without a stage label (deprecated versions). */
|
|
1149
|
+
includeDeprecated?: boolean;
|
|
1150
|
+
/** Page size (1–100). */
|
|
1151
|
+
maxResults?: number;
|
|
1152
|
+
}
|
|
1153
|
+
/** Options of {@link AwsSecretsManagerClient.createSecret}. */
|
|
1154
|
+
interface CreateSecretOptions extends CallOptions {
|
|
1155
|
+
description?: string;
|
|
1156
|
+
/** KMS key id/ARN/alias (default `aws/secretsmanager`). */
|
|
1157
|
+
kmsKeyId?: string;
|
|
1158
|
+
tags?: Readonly<Record<string, string>>;
|
|
1159
|
+
/** Idempotency token (32–64 chars, becomes the version id). The SDK fills one when unset. */
|
|
1160
|
+
clientRequestToken?: string;
|
|
1161
|
+
addReplicaRegions?: readonly ReplicaRegion[];
|
|
1162
|
+
forceOverwriteReplicaSecret?: boolean;
|
|
1163
|
+
}
|
|
1164
|
+
/** Options of {@link AwsSecretsManagerClient.putSecretValue}. */
|
|
1165
|
+
interface PutSecretValueOptions extends CallOptions {
|
|
1166
|
+
/** Stage labels for the new version (default `["AWSCURRENT"]`). */
|
|
1167
|
+
versionStages?: readonly string[];
|
|
1168
|
+
clientRequestToken?: string;
|
|
1169
|
+
}
|
|
1170
|
+
/** Options of {@link AwsSecretsManagerClient.updateSecret}. */
|
|
1171
|
+
interface UpdateSecretOptions extends CallOptions {
|
|
1172
|
+
/** New value (creates a new `AWSCURRENT` version). */
|
|
1173
|
+
value?: SecretInput;
|
|
1174
|
+
description?: string;
|
|
1175
|
+
kmsKeyId?: string;
|
|
1176
|
+
clientRequestToken?: string;
|
|
1177
|
+
}
|
|
1178
|
+
/** Options of {@link AwsSecretsManagerClient.updateSecretVersionStage}. */
|
|
1179
|
+
interface UpdateSecretVersionStageOptions extends CallOptions {
|
|
1180
|
+
/** Version that receives the label. */
|
|
1181
|
+
moveToVersionId?: string;
|
|
1182
|
+
/** Version that loses the label (required when moving `AWSCURRENT`). */
|
|
1183
|
+
removeFromVersionId?: string;
|
|
1184
|
+
}
|
|
1185
|
+
/** Options of {@link AwsSecretsManagerClient.deleteSecret}. */
|
|
1186
|
+
interface DeleteSecretOptions extends CallOptions {
|
|
1187
|
+
/** Days before the secret is purged (7–30; AWS default 30). */
|
|
1188
|
+
recoveryWindowDays?: number;
|
|
1189
|
+
/** Delete immediately without recovery. Mutually exclusive with `recoveryWindowDays`. */
|
|
1190
|
+
forceDeleteWithoutRecovery?: boolean;
|
|
1191
|
+
}
|
|
1192
|
+
/** Options of {@link AwsSecretsManagerClient.putResourcePolicy}. */
|
|
1193
|
+
interface PutResourcePolicyOptions extends CallOptions {
|
|
1194
|
+
/** Reject policies that grant public access (AWS default true). */
|
|
1195
|
+
blockPublicPolicy?: boolean;
|
|
1196
|
+
}
|
|
1197
|
+
/** Options of {@link AwsSecretsManagerClient.validateResourcePolicy}. */
|
|
1198
|
+
interface ValidateResourcePolicyOptions extends CallOptions {
|
|
1199
|
+
/** Secret the policy would be attached to. */
|
|
1200
|
+
secretId?: string;
|
|
1201
|
+
}
|
|
1202
|
+
/** Options of {@link AwsSecretsManagerClient.rotateSecret}. */
|
|
1203
|
+
interface RotateSecretOptions extends CallOptions {
|
|
1204
|
+
/** Rotation Lambda ARN (omit for managed rotation or to keep the current function). */
|
|
1205
|
+
lambdaArn?: string;
|
|
1206
|
+
rules?: RotationRules;
|
|
1207
|
+
/** Rotate now (AWS default true). */
|
|
1208
|
+
rotateImmediately?: boolean;
|
|
1209
|
+
clientRequestToken?: string;
|
|
1210
|
+
}
|
|
1211
|
+
/** Options of {@link AwsSecretsManagerClient.getRandomPassword}. */
|
|
1212
|
+
interface RandomPasswordOptions extends CallOptions {
|
|
1213
|
+
/** Length 1–4096 (default 32). */
|
|
1214
|
+
length?: number;
|
|
1215
|
+
/** Characters that must not appear. */
|
|
1216
|
+
excludeCharacters?: string;
|
|
1217
|
+
excludeNumbers?: boolean;
|
|
1218
|
+
excludePunctuation?: boolean;
|
|
1219
|
+
excludeUppercase?: boolean;
|
|
1220
|
+
excludeLowercase?: boolean;
|
|
1221
|
+
includeSpace?: boolean;
|
|
1222
|
+
/** Include at least one character of every included type (AWS default true). */
|
|
1223
|
+
requireEachIncludedType?: boolean;
|
|
1224
|
+
}
|
|
1225
|
+
/**
|
|
1226
|
+
* Client for AWS Secrets Manager on the official AWS SDK v3. Builds a `SecretsManagerClient` from
|
|
1227
|
+
* the Grow config (region, credentials, endpoint, timeouts, retries, TLS, proxy, User-Agent,
|
|
1228
|
+
* hooks) or wraps one the caller passes (`sdkClient`).
|
|
1229
|
+
*/
|
|
1230
|
+
declare class AwsSecretsManagerClient {
|
|
1231
|
+
#private;
|
|
1232
|
+
/** The immutable configuration. */
|
|
1233
|
+
readonly config: AwsSecretsManagerConfig;
|
|
1234
|
+
/** Accepts a {@link AwsSecretsManagerConfig} or plain options. */
|
|
1235
|
+
constructor(config?: AwsSecretsManagerConfigOptions, internals?: ClientInternals);
|
|
1236
|
+
/** Builds a client from `GROW_AWS_SECRETS_MANAGER_*` and the standard AWS environment variables. */
|
|
1237
|
+
static fromEnv(overrides?: AwsSecretsManagerConfigOptions): AwsSecretsManagerClient;
|
|
1238
|
+
/** Wraps an existing AWS SDK client; `close()` leaves it open. */
|
|
1239
|
+
static withSdkClient(sdkClient: SecretsManagerClient, options?: Omit<AwsSecretsManagerConfigOptions, "sdkClient">): AwsSecretsManagerClient;
|
|
1240
|
+
/** The underlying AWS SDK client (escape hatch for operations not wrapped here). */
|
|
1241
|
+
get sdk(): SecretsManagerClient;
|
|
1242
|
+
/** Whether {@link close} was called. */
|
|
1243
|
+
get closed(): boolean;
|
|
1244
|
+
/**
|
|
1245
|
+
* Liveness: a signed `ListSecrets {MaxResults: 1}` with a short timeout and no retries.
|
|
1246
|
+
* `ok` when AWS answers (also when the credentials are rejected: `details.auth = "failed"`),
|
|
1247
|
+
* `degraded` when throttled, `unhealthy` on HTTP 5xx, `unreachable` on network errors.
|
|
1248
|
+
* Throws only `CancelledError` (also on a closed client) and `ConfigError`.
|
|
1249
|
+
*/
|
|
1250
|
+
health(options?: CallOptions): Promise<HealthStatus>;
|
|
1251
|
+
/**
|
|
1252
|
+
* Authenticated round trip (`ListSecrets {MaxResults: 1}`); returns the latency in ms.
|
|
1253
|
+
* `AuthenticationError` for unknown keys or bad signatures, `PermissionDeniedError` when the
|
|
1254
|
+
* principal may not call `secretsmanager:ListSecrets`.
|
|
1255
|
+
*/
|
|
1256
|
+
ping(options?: CallOptions): Promise<number>;
|
|
1257
|
+
/**
|
|
1258
|
+
* Always throws {@link UnsupportedError}: AWS Secrets Manager exposes no server version (the API
|
|
1259
|
+
* contract date is the constant `API_VERSION`).
|
|
1260
|
+
*/
|
|
1261
|
+
serverVersion(options?: CallOptions): Promise<string>;
|
|
1262
|
+
/**
|
|
1263
|
+
* Stops every watcher of the providers created by {@link secrets} and destroys the SDK client
|
|
1264
|
+
* this instance built (never a caller-supplied one). Idempotent.
|
|
1265
|
+
*/
|
|
1266
|
+
close(): Promise<void>;
|
|
1267
|
+
/**
|
|
1268
|
+
* The {@link SecretsProvider} view (SPEC §3) of this client. `close()` of the client stops its
|
|
1269
|
+
* watchers.
|
|
1270
|
+
*/
|
|
1271
|
+
secrets(options?: AwsSecretsManagerSecretsOptions): AwsSecretsManagerSecretsProvider;
|
|
1272
|
+
/** A version-stage aware cache with the AWS caching-client semantics (TTL 1 h, 1 024 entries). */
|
|
1273
|
+
secretCache(options?: AwsSecretCacheOptions): AwsSecretCache;
|
|
1274
|
+
/**
|
|
1275
|
+
* Reads a secret value (`GetSecretValue`), by default the `AWSCURRENT` version. `secretId` is a
|
|
1276
|
+
* name or ARN. `NotFoundError` when the secret, version or stage does not exist; `ConflictError`
|
|
1277
|
+
* when the secret is scheduled for deletion.
|
|
1278
|
+
*/
|
|
1279
|
+
getSecretValue(secretId: string, options?: GetSecretValueOptions): Promise<AwsSecretValue>;
|
|
1280
|
+
/**
|
|
1281
|
+
* Reads many secrets at once (`BatchGetSecretValue`). With a list of ids, lists longer than 20
|
|
1282
|
+
* are split and the values come back in request order; with `{ filters }` every page is read.
|
|
1283
|
+
* Per-secret failures are returned in `errors` (the call itself succeeds).
|
|
1284
|
+
*/
|
|
1285
|
+
batchGetSecretValue(selector: readonly string[] | {
|
|
1286
|
+
filters: readonly SecretFilter[];
|
|
1287
|
+
}, options?: BatchGetOptions): Promise<BatchGetResult>;
|
|
1288
|
+
/** Metadata of a secret (`DescribeSecret`), never the value. */
|
|
1289
|
+
describeSecret(secretId: string, options?: CallOptions): Promise<SecretDescription>;
|
|
1290
|
+
/**
|
|
1291
|
+
* Lists secrets (`ListSecrets`) lazily across all pages: `for await (const s of
|
|
1292
|
+
* client.listSecrets())` or `await client.listSecrets().toArray()`.
|
|
1293
|
+
*/
|
|
1294
|
+
listSecrets(options?: ListSecretsOptions): Paginator<SecretDescription>;
|
|
1295
|
+
/** Lists the versions of a secret (`ListSecretVersionIds`) lazily across all pages. */
|
|
1296
|
+
listSecretVersionIds(secretId: string, options?: ListSecretVersionIdsOptions): Paginator<SecretVersion>;
|
|
1297
|
+
/**
|
|
1298
|
+
* Creates a secret (`CreateSecret`). `value`: string → `SecretString`, bytes → `SecretBinary`,
|
|
1299
|
+
* object → JSON `SecretString`, `undefined`/`null` → a secret without a version.
|
|
1300
|
+
* `ConflictError` when the name exists (or is scheduled for deletion).
|
|
1301
|
+
*/
|
|
1302
|
+
createSecret(name: string, value: SecretInput | null | undefined, options?: CreateSecretOptions): Promise<SecretWriteResult>;
|
|
1303
|
+
/**
|
|
1304
|
+
* Stores a new version (`PutSecretValue`). By default it becomes `AWSCURRENT` (the old one
|
|
1305
|
+
* becomes `AWSPREVIOUS`); with custom `versionStages` only those labels are attached.
|
|
1306
|
+
*/
|
|
1307
|
+
putSecretValue(secretId: string, value: SecretInput, options?: PutSecretValueOptions): Promise<PutSecretValueResult>;
|
|
1308
|
+
/**
|
|
1309
|
+
* Updates description, KMS key and/or value (`UpdateSecret`). A new version is created only
|
|
1310
|
+
* when `value` is given.
|
|
1311
|
+
*/
|
|
1312
|
+
updateSecret(secretId: string, options?: UpdateSecretOptions): Promise<SecretWriteResult>;
|
|
1313
|
+
/**
|
|
1314
|
+
* Moves a stage label between versions (`UpdateSecretVersionStage`). Moving `AWSCURRENT` needs
|
|
1315
|
+
* `removeFromVersionId` = the current version; the old current version gets `AWSPREVIOUS`.
|
|
1316
|
+
*/
|
|
1317
|
+
updateSecretVersionStage(secretId: string, versionStage: string, options?: UpdateSecretVersionStageOptions): Promise<SecretRef>;
|
|
1318
|
+
/**
|
|
1319
|
+
* Schedules deletion (`DeleteSecret`) after `recoveryWindowDays` (AWS default 30) or deletes
|
|
1320
|
+
* immediately with `forceDeleteWithoutRecovery`. Note: AWS answers success for a forced delete
|
|
1321
|
+
* of a secret that does not exist.
|
|
1322
|
+
*/
|
|
1323
|
+
deleteSecret(secretId: string, options?: DeleteSecretOptions): Promise<DeleteSecretResult>;
|
|
1324
|
+
/** Cancels a scheduled deletion (`RestoreSecret`). A no-op for a live secret. */
|
|
1325
|
+
restoreSecret(secretId: string, options?: CallOptions): Promise<SecretRef>;
|
|
1326
|
+
/** Adds or replaces tags (`TagResource`). */
|
|
1327
|
+
tagResource(secretId: string, tags: Readonly<Record<string, string>>, options?: CallOptions): Promise<void>;
|
|
1328
|
+
/** Removes tags by key (`UntagResource`). */
|
|
1329
|
+
untagResource(secretId: string, tagKeys: readonly string[], options?: CallOptions): Promise<void>;
|
|
1330
|
+
/** Attaches a resource policy (`PutResourcePolicy`); objects are JSON-encoded. */
|
|
1331
|
+
putResourcePolicy(secretId: string, policy: string | object, options?: PutResourcePolicyOptions): Promise<SecretRef>;
|
|
1332
|
+
/** Reads the resource policy (`GetResourcePolicy`); `resourcePolicy` is absent when there is none. */
|
|
1333
|
+
getResourcePolicy(secretId: string, options?: CallOptions): Promise<ResourcePolicyResult>;
|
|
1334
|
+
/** Removes the resource policy (`DeleteResourcePolicy`). */
|
|
1335
|
+
deleteResourcePolicy(secretId: string, options?: CallOptions): Promise<SecretRef>;
|
|
1336
|
+
/**
|
|
1337
|
+
* Checks a policy with IAM Access Analyzer (`ValidateResourcePolicy`). Emulators that lack the
|
|
1338
|
+
* operation (Moto 5.2.4) raise `UnsupportedError`.
|
|
1339
|
+
*/
|
|
1340
|
+
validateResourcePolicy(policy: string | object, options?: ValidateResourcePolicyOptions): Promise<ValidateResourcePolicyResult>;
|
|
1341
|
+
/**
|
|
1342
|
+
* Configures and/or starts rotation (`RotateSecret`). Without `lambdaArn` the secret's managed
|
|
1343
|
+
* or existing rotation function is used.
|
|
1344
|
+
*/
|
|
1345
|
+
rotateSecret(secretId: string, options?: RotateSecretOptions): Promise<SecretWriteResult>;
|
|
1346
|
+
/** Turns rotation off and cancels a rotation in progress (`CancelRotateSecret`). */
|
|
1347
|
+
cancelRotateSecret(secretId: string, options?: CallOptions): Promise<SecretWriteResult>;
|
|
1348
|
+
/** Generates a random password (`GetRandomPassword`), returned as a redacting {@link Secret}. */
|
|
1349
|
+
getRandomPassword(options?: RandomPasswordOptions): Promise<Secret>;
|
|
1350
|
+
/**
|
|
1351
|
+
* Reads one field of a JSON secret: `GetSecretValue`, parse `SecretString` as a JSON object,
|
|
1352
|
+
* return `field` (an exact key first, otherwise a dot path such as `"db.host"`). `null` when
|
|
1353
|
+
* the field is absent; `ValidationError` when the value is binary or not a JSON object;
|
|
1354
|
+
* `NotFoundError` when the secret is missing.
|
|
1355
|
+
*/
|
|
1356
|
+
getJsonField(secretId: string, field: string, options?: GetSecretValueOptions): Promise<unknown>;
|
|
1357
|
+
/** Known credential values for redaction. @internal */
|
|
1358
|
+
knownSecrets(): string[];
|
|
1359
|
+
}
|
|
1360
|
+
/** Exact key first, then a dot path. */
|
|
1361
|
+
declare function jsonField(obj: Record<string, unknown>, field: string): unknown;
|
|
1362
|
+
|
|
1363
|
+
/** AWS error code → Grow {@link ErrorCode} (API.md §1.1). */
|
|
1364
|
+
declare const AWS_ERROR_CODES: Readonly<Record<string, ErrorCode>>;
|
|
1365
|
+
/** Options of {@link mapAwsError}. */
|
|
1366
|
+
interface MapErrorOptions {
|
|
1367
|
+
/** Credential values redacted from the message. */
|
|
1368
|
+
knownSecrets?: Iterable<KnownSecret>;
|
|
1369
|
+
/**
|
|
1370
|
+
* The operation is known to be missing from some emulators: a non-JSON HTTP 500 answer then
|
|
1371
|
+
* maps to `UNSUPPORTED` instead of `UNAVAILABLE` (Moto 5.2.4 `ValidateResourcePolicy`).
|
|
1372
|
+
*/
|
|
1373
|
+
unsupportedOnHtml500?: boolean;
|
|
1374
|
+
}
|
|
1375
|
+
/** Extracts an error code from an XML (`<Code>`) or JSON (`__type`) error body. */
|
|
1376
|
+
declare function errorCodeFromBody(text: string): string | undefined;
|
|
1377
|
+
/**
|
|
1378
|
+
* Converts anything the AWS SDK throws into an SDK error (`AwsSecretsManagerError` subclass) with
|
|
1379
|
+
* the message `"<operation>: <AwsCode>: <redacted vendor text> (HTTP <status>)"`.
|
|
1380
|
+
*/
|
|
1381
|
+
declare function mapAwsError(err: unknown, operation: string, options?: MapErrorOptions): AwsSecretsManagerError;
|
|
1382
|
+
|
|
1383
|
+
/** Grow User-Agent product token: `grow-codes-aws-secrets-manager/<version> (typescript)`. */
|
|
1384
|
+
declare const GROW_USER_AGENT = "grow-codes-aws-secrets-manager/0.1.1 (typescript)";
|
|
1385
|
+
/** Options of {@link GrowHttpHandler}. */
|
|
1386
|
+
interface GrowHttpHandlerOptions {
|
|
1387
|
+
/** Resolved common configuration (timeouts, TLS, proxy, headers, hooks, logger). */
|
|
1388
|
+
config: CommonConfig;
|
|
1389
|
+
/** Test seam: replaces the dispatcher built from the TLS/proxy settings. */
|
|
1390
|
+
dispatcher?: Dispatcher;
|
|
1391
|
+
}
|
|
1392
|
+
/** Error raised when one attempt exceeds `requestTimeoutMs` (the SDK retries it). */
|
|
1393
|
+
declare class AttemptTimeoutError extends Error {
|
|
1394
|
+
/** Node-style code, recognised by the SDK retry strategy as a transient error. */
|
|
1395
|
+
readonly code = "ETIMEDOUT";
|
|
1396
|
+
constructor(ms: number);
|
|
1397
|
+
}
|
|
1398
|
+
/**
|
|
1399
|
+
* One-attempt HTTP handler for the AWS SDK v3 client, on undici. Not used when the caller
|
|
1400
|
+
* passes its own SDK client (`sdkClient`).
|
|
1401
|
+
*/
|
|
1402
|
+
declare class GrowHttpHandler {
|
|
1403
|
+
#private;
|
|
1404
|
+
constructor(options: GrowHttpHandlerOptions);
|
|
1405
|
+
/** The User-Agent token appended to the SDK's own User-Agent. */
|
|
1406
|
+
get userAgent(): string;
|
|
1407
|
+
/** Smithy handler metadata. */
|
|
1408
|
+
readonly metadata: {
|
|
1409
|
+
handlerProtocol: string;
|
|
1410
|
+
};
|
|
1411
|
+
/** Sends one attempt. Called by the SDK (after signing) for every attempt. */
|
|
1412
|
+
handle(request: HttpRequest, options?: HttpHandlerOptions): Promise<{
|
|
1413
|
+
response: HttpResponse;
|
|
1414
|
+
}>;
|
|
1415
|
+
/** Smithy handler API (no runtime-updatable settings). */
|
|
1416
|
+
updateHttpClientConfig(): void;
|
|
1417
|
+
/** Smithy handler API. */
|
|
1418
|
+
httpHandlerConfigs(): Record<string, never>;
|
|
1419
|
+
/** Closes the dispatcher (only when this handler created it). Idempotent. */
|
|
1420
|
+
destroy(): void;
|
|
1421
|
+
}
|
|
1422
|
+
|
|
1423
|
+
export { API_VERSION, AWSCURRENT, AWSPENDING, AWSPREVIOUS, AWS_ERROR_CODES, AWS_SECRET_CACHE_DEFAULTS, AttemptTimeoutError, AuthenticationError, AwsSecretCache, AwsSecretsManagerClient, AwsSecretsManagerConfig, AwsSecretsManagerError, AwsSecretsManagerSecretsProvider, BATCH_GET_MAX_IDS, BaseSecretsProvider, CancelledError, ConfigError, ConflictError, DEFAULT_RECOVERY_WINDOW_DAYS, DEFAULT_REQUEST_ID_HEADERS, DEFAULT_ROLE_SESSION_NAME, DEFAULT_TIMEOUTS, DeleteOptions, EnvReader, ErrorCode, GROW_USER_AGENT, GetOptions, GrowHttpHandler, HealthStatus, HttpTransport, LANGUAGE, MAX_VENDOR_TEXT, MIN_SECRET_LENGTH, NotFoundError, PACKAGE_KEY, Paginator, PermissionDeniedError, REDACTED, RateLimitError, RetryPolicy, SDK_KIT_VERSION, SDK_VERSION, SENSITIVE_FIELD_PARTS, Secret, SecretCache, SecretInput, SecretMetadata, SecretValue, SecretsProvider, SetOptions, SignalOptions, TimeoutError, UnavailableError, UnsupportedError, VENDOR_ENV, ValidationError, WatchCallback, WatchHandle, WatchOptions, applyEnv, codeForStatus, createDispatcher, definedOnly, describeCommonConfig, encodeBytes, encodeValue, envNameFor, errorCodeFromBody, errorForCode, errorForStatus, fromAwsTags, fullName, hasMore, isAwsSecretsManagerError, isIdempotentMethod, isRetryableStatus, isSensitiveField, isSensitiveHeader, jsonField, mapAwsError, mergeOptions, parseBool, parseDuration, parseInteger, parsePolicy, parseRetryAfter, pollUntil, readCommonEnv, reasonForCode, redactError, redactFields, redactHeaders, redactSecretsInText, redactText, redactUrl, relativeName, resolveCommonConfig, safeCall, safeLogger, secretFingerprint, secretValues, silentLogger, sleep, throwIfAborted, toAwsFilters, toAwsTags, toBatchError, toDescription, toMetadata, toPolicyError, toSecretValue, toVersion, validateCommonConfig, watchSecret };
|
|
1424
|
+
export type { AwsSecretCacheOptions, AwsSecretCacheStats, AwsSecretValue, AwsSecretsManagerConfigOptions, AwsSecretsManagerSecretsOptions, BatchGetError, BatchGetOptions, BatchGetResult, CacheGetOptions, CallOptions, ClientInternals, ClientLogger, CommonConfig, CommonConfigOptions, CommonVendorEnv, CreateSecretOptions, DeleteSecretOptions, DeleteSecretResult, EnvHit, EnvMap, ErrorClassifier, ErrorDetails, ErrorInfo, ErrorResponse, GetSecretValueOptions, GrowHttpHandlerOptions, HeadersInput, Hooks, KnownSecret, ListSecretVersionIdsOptions, ListSecretsOptions, LogFields, MapErrorOptions, PageFetcher, PolicyValidationError, PollOptions, PutResourcePolicyOptions, PutSecretValueOptions, PutSecretValueResult, QueryValue, RandomPasswordOptions, ReplicaRegion, ReplicationStatus, RequestInfo, RequestOptions, ResourcePolicyResult, ResponseInfo, ResponseType, RetryPolicyOptions, RotateSecretOptions, RotationRules, SecretCacheOptions, SecretCacheSource, SecretCacheStats, SecretDescription, SecretFilter, SecretFilterKey, SecretRef, SecretVersion, SecretWriteResult, TlsOptions, TransportOptions, TransportResponse, UpdateSecretOptions, UpdateSecretVersionStageOptions, ValidateResourcePolicyOptions, ValidateResourcePolicyResult, ValueShape, VersionSelector };
|