@grow-codes/aws-secrets-manager 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2026 Grow Codes
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,115 @@
1
+ Grow Codes SDK for AWS Secrets Manager (aws-secrets-manager)
2
+ Copyright 2026 Grow Codes <opensource@grow.codes>
3
+
4
+ This product is licensed under the Apache License, Version 2.0 (see LICENSE).
5
+ Source: https://github.com/grow-codes-packages/aws-secrets-manager
6
+ Documentation: https://grow-codes-packages.github.io/aws-secrets-manager/
7
+
8
+ -------------------------------------------------------------------------------
9
+ No responsibility / disclaimer
10
+ -------------------------------------------------------------------------------
11
+
12
+ This software is provided "AS IS", WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13
+ either express or implied, including, without limitation, any warranties or
14
+ conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
15
+ PARTICULAR PURPOSE. You are solely responsible for determining whether it is
16
+ appropriate to use this software and you assume all risks of doing so.
17
+
18
+ To the maximum extent permitted by applicable law, Grow Codes is not
19
+ responsible for any damage, data loss, security incident, outage or cost
20
+ (including service, cloud, licence or usage charges) that results from using,
21
+ misusing or being unable to use this software, the services it connects to, or
22
+ any configuration, credential or data handled through it, whether in contract,
23
+ tort or otherwise, even if Grow Codes has been advised of the possibility of
24
+ such damage. See sections 7 and 8 of the Apache License, Version 2.0.
25
+
26
+ -------------------------------------------------------------------------------
27
+ Trademarks
28
+ -------------------------------------------------------------------------------
29
+
30
+ This project is an independent, community-maintained client library. It is not
31
+ affiliated with, endorsed or sponsored by Amazon.com, Inc. or its affiliates.
32
+ Amazon Web Services, AWS and AWS Secrets Manager are trademarks of Amazon.com,
33
+ Inc. or its affiliates. This project is not affiliated with or endorsed by AWS.
34
+ All other product names, logos and brands are the property of their respective
35
+ owners and are used for identification purposes only.
36
+
37
+ AWS Secrets Manager is a proprietary managed service of Amazon Web Services.
38
+ This SDK contains no AWS service code; it calls the service's public API only
39
+ through the official AWS SDKs listed below (Apache-2.0).
40
+
41
+ -------------------------------------------------------------------------------
42
+ Third-party attributions
43
+ -------------------------------------------------------------------------------
44
+
45
+ The packages in this repository depend on third-party open-source libraries,
46
+ each under its own licence (all on the allowlist in AGENTS.md: Apache-2.0, MIT,
47
+ BSD-2-Clause, BSD-3-Clause, ISC, Zlib, Unicode-3.0, Unicode-DFS-2016, 0BSD,
48
+ CC0-1.0, MPL-2.0). The full dependency lists and their licences are produced by
49
+ "make license" in each language folder:
50
+
51
+ typescript/ npm dependencies (license-checker-rseidelsohn)
52
+ rust/ crates.io dependencies (cargo-deny, rust/deny.toml)
53
+ go/ Go modules (go-licenses)
54
+ python/ PyPI dependencies (pip-licenses)
55
+ java/ Maven dependencies (license-maven-plugin)
56
+
57
+ The Java package additionally depends on org.reactivestreams:reactive-streams
58
+ (MIT-0, MIT No Attribution), a dependency of the AWS SDK for Java v2 core; MIT-0
59
+ is on the allowlist of the Java licence check for this reason.
60
+
61
+ AWS SDKs used at runtime (Apache License, Version 2.0; not modified, used as
62
+ dependencies):
63
+
64
+ AWS SDK for JavaScript v3 (@aws-sdk/client-secrets-manager,
65
+ @aws-sdk/credential-providers and their @aws-sdk/* and @smithy/* packages)
66
+ -- TypeScript package
67
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
68
+ https://github.com/aws/aws-sdk-js-v3
69
+
70
+ AWS SDK for Rust (aws-sdk-secretsmanager, aws-config, aws-credential-types,
71
+ aws-smithy-* and related crates) -- Rust package
72
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
73
+ https://github.com/awslabs/aws-sdk-rust
74
+
75
+ AWS SDK for Go v2 (github.com/aws/aws-sdk-go-v2 incl. service/secretsmanager,
76
+ config, credentials; github.com/aws/smithy-go) -- Go package
77
+ AWS SDK for Go
78
+ Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
79
+ Copyright 2014-2015 Stripe, Inc.
80
+ https://github.com/aws/aws-sdk-go-v2
81
+
82
+ boto3 and botocore -- Python package
83
+ boto3
84
+ Copyright 2013-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
85
+ Botocore
86
+ Copyright 2012-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
87
+ (Botocore includes vendorized parts of requests, Copyright 2013 Kenneth
88
+ Reitz, Apache-2.0, and urllib3, MIT.)
89
+ https://github.com/boto/boto3 https://github.com/boto/botocore
90
+
91
+ aioboto3 and aiobotocore -- Python package, optional extra [async]
92
+ aioboto3: Terri Cain and contributors, https://github.com/terricain/aioboto3
93
+ aiobotocore: Nikolay Novik and contributors, https://github.com/aio-libs/aiobotocore
94
+
95
+ AWS SDK for Java 2.0 (software.amazon.awssdk: secretsmanager, sts and the SDK
96
+ core modules) -- Java package
97
+ AWS SDK for Java 2.0
98
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
99
+ This product includes software developed by
100
+ Amazon Technologies, Inc (http://www.amazon.com/).
101
+ https://github.com/aws/aws-sdk-java-v2
102
+
103
+ Test-only tools (not distributed with any package):
104
+
105
+ Moto (motoserver/moto Docker image), the AWS service emulator used by the
106
+ Docker integration tests -- Apache License, Version 2.0,
107
+ author Steve Pulec and the Moto contributors (AUTHORS.md),
108
+ https://github.com/getmoto/moto. Moto is pulled as an image at test time; no
109
+ Moto code is copied into this repository.
110
+
111
+ Code copied or adapted from other projects is listed below with its source,
112
+ copyright and licence.
113
+
114
+ CODE_OF_CONDUCT.md is adapted from the Contributor Covenant, version 2.1,
115
+ https://www.contributor-covenant.org, licensed under CC BY 4.0.
package/README.md CHANGED
@@ -1,3 +1,34 @@
1
- # Temporary Holding Version
1
+ # @grow-codes/aws-secrets-manager
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ TypeScript SDK for [AWS Secrets Manager](https://grow-codes-packages.github.io/aws-secrets-manager/) by Grow Codes.
4
+ Node.js 22.12 or newer, ESM and CommonJS, full type definitions.
5
+
6
+ ```sh
7
+ npm install @grow-codes/aws-secrets-manager
8
+ ```
9
+
10
+ ```ts
11
+ import { AwsSecretsManagerClient } from "@grow-codes/aws-secrets-manager";
12
+
13
+ // Reads GROW_AWS_SECRETS_MANAGER_* first, then AWS_REGION, AWS_PROFILE, AWS_ACCESS_KEY_ID … and the
14
+ // AWS SDK default credential chain. Built on @aws-sdk/client-secrets-manager v3.
15
+ const client = AwsSecretsManagerClient.fromEnv();
16
+ try {
17
+ console.log(await client.health()); // { healthy: true, status: "ok", details: {} }
18
+ console.log(`ping: ${(await client.ping()).toFixed(1)} ms`);
19
+ const secret = await client.getSecretValue("prod/app/db"); // value prints as [REDACTED]
20
+ console.log(secret.versionId, await client.getJsonField("prod/app/db", "host"));
21
+ } finally {
22
+ await client.close();
23
+ }
24
+ ```
25
+
26
+ Every error is a `AwsSecretsManagerError` subclass with a canonical `code` (`NOT_FOUND`,
27
+ `AUTHENTICATION`, `RATE_LIMITED`, …), `httpStatus`, `requestId` and `retryable`. Credentials
28
+ never appear in messages, logs, hook data or `toString()` output.
29
+
30
+ Test helpers (in-memory fakes and the conformance runner) live in
31
+ `@grow-codes/aws-secrets-manager/testing`.
32
+
33
+ Documentation: https://grow-codes-packages.github.io/aws-secrets-manager/ · Licence: Apache-2.0.
34
+ AWS Secrets Manager is a trademark of Amazon.com, Inc. or its affiliates; this package is not affiliated with or endorsed by it.
@@ -0,0 +1,202 @@
1
+ /** Result of `client.health()` (SPEC §2.4). */
2
+ interface HealthStatus {
3
+ /** Whether the service answered and reports itself usable. */
4
+ healthy: boolean;
5
+ /** `"ok" | "degraded" | "unhealthy" | "unreachable"` or the vendor's word. */
6
+ status: string;
7
+ /** Extra vendor details (string values). */
8
+ details: Record<string, string>;
9
+ }
10
+ /** True when a vendor status word means healthy. */
11
+ declare function isHealthyWord(status: string): boolean;
12
+ /** Builds a {@link HealthStatus}; `healthy` defaults to {@link isHealthyWord}(status). */
13
+ declare function healthStatus(status: string, details?: Record<string, unknown>, healthy?: boolean): HealthStatus;
14
+ /**
15
+ * Runs a health probe and converts failures into a {@link HealthStatus} (SPEC §2.4): network
16
+ * errors and timeouts → `unreachable`; HTTP errors → `unhealthy` (with the status code in
17
+ * `details.httpStatus`). Only `CANCELLED` and `CONFIG` errors are rethrown.
18
+ */
19
+ declare function probeHealth(probe: () => Promise<HealthStatus>): Promise<HealthStatus>;
20
+
21
+ declare const INSPECT: unique symbol;
22
+ /**
23
+ * A secret value. Every string form (`toString`, `JSON.stringify`, `util.inspect`) prints
24
+ * `SecretValue([REDACTED])`; use {@link reveal}, {@link revealBytes} or {@link json} to read it.
25
+ */
26
+ declare class SecretValue {
27
+ #private;
28
+ /** Opaque version string (KV `"3"`, AWS VersionId, …) when the service has versions. */
29
+ readonly version?: string;
30
+ constructor(value: string | Uint8Array, version?: string);
31
+ /** Encodes a string, bytes or a JSON-serialisable object (objects are JSON-encoded). */
32
+ static from(value: string | Uint8Array | object, version?: string): SecretValue;
33
+ /** UTF-8 text. Throws {@link ValidationError} when the value is not valid UTF-8. */
34
+ reveal(): string;
35
+ /** A copy of the raw bytes. */
36
+ revealBytes(): Uint8Array;
37
+ /** Parses the value as JSON. Throws {@link ValidationError} when it is not JSON. */
38
+ json<T = unknown>(): T;
39
+ /** Hex SHA-256 of the bytes (used to detect changes when there is no version). */
40
+ sha256(): string;
41
+ /** Byte length. */
42
+ get byteLength(): number;
43
+ toString(): string;
44
+ toJSON(): string;
45
+ [INSPECT](): string;
46
+ }
47
+ /** Encodes a `set()` input: strings as UTF-8, bytes as is, objects as JSON. */
48
+ declare function encodeSecretInput(value: string | Uint8Array | object): Uint8Array;
49
+
50
+ /** Metadata of one secret (SPEC §3). */
51
+ interface SecretMetadata {
52
+ /** Full name, usable with `get()`. */
53
+ name: string;
54
+ /** Containing path when the service has paths. */
55
+ path?: string;
56
+ /** Current version. */
57
+ version?: string;
58
+ createdAt?: Date;
59
+ updatedAt?: Date;
60
+ tags: Record<string, string>;
61
+ /** Number of stored versions. */
62
+ versions?: number;
63
+ /** Vendor-specific extra fields. */
64
+ extra: Record<string, string>;
65
+ }
66
+ /** Cancellation option accepted by every I/O method. */
67
+ interface SignalOptions {
68
+ signal?: AbortSignal;
69
+ }
70
+ /** Options of `get` and the other reads. */
71
+ interface GetOptions extends SignalOptions {
72
+ /** Read this version instead of the current one. */
73
+ version?: string;
74
+ /** Mount/folder/path the name is relative to. */
75
+ path?: string;
76
+ }
77
+ /** Options of `set`. */
78
+ interface SetOptions extends SignalOptions {
79
+ path?: string;
80
+ /** Compare-and-set: the current version must equal this (0 = must not exist). */
81
+ cas?: number;
82
+ tags?: Record<string, string>;
83
+ description?: string;
84
+ }
85
+ /** Options of `delete`. */
86
+ interface DeleteOptions extends SignalOptions {
87
+ path?: string;
88
+ /** Delete only these versions. */
89
+ versions?: string[];
90
+ /** Destroy permanently instead of soft-deleting where the service distinguishes. */
91
+ permanent?: boolean;
92
+ }
93
+ /** Options of `loadEnv`. */
94
+ interface LoadEnvOptions extends SignalOptions {
95
+ /** Replace variables that already exist (default false). */
96
+ override?: boolean;
97
+ /** Prefix added to every variable name (path form only, default `""`). */
98
+ prefix?: string;
99
+ /** Target environment (default `process.env`). */
100
+ env?: Record<string, string | undefined>;
101
+ }
102
+ /** Options of `watch`. */
103
+ interface WatchOptions {
104
+ /** Called for read errors and `onChange` failures; polling continues. */
105
+ onError?: (error: unknown) => void;
106
+ /** Options passed to every read. */
107
+ get?: GetOptions;
108
+ }
109
+ /** Handle returned by `watch`. */
110
+ interface WatchHandle {
111
+ /** Stops polling. Idempotent. */
112
+ stop(): void;
113
+ /** Whether {@link stop} was called. */
114
+ readonly stopped: boolean;
115
+ /** Resolves once the initial value has been read (or the first read failed). */
116
+ readonly ready: Promise<void>;
117
+ }
118
+ /** Called when a watched secret changes; `newValue` is `null` after deletion. */
119
+ type WatchCallback = (newValue: SecretValue | null, oldValue: SecretValue | null) => void | Promise<void>;
120
+ /** Input accepted by `set`: text, bytes or a JSON-serialisable object. */
121
+ type SecretInput = string | Uint8Array | object;
122
+ /** The secrets interface every secrets service implements (SPEC §3). */
123
+ interface SecretsProvider {
124
+ /** The secret, or `null` when missing. */
125
+ get(name: string, options?: GetOptions): Promise<SecretValue | null>;
126
+ /** UTF-8 text, or `null` when missing. */
127
+ getString(name: string, options?: GetOptions): Promise<string | null>;
128
+ /** Parsed JSON, or `null` when missing (`ValidationError` when not JSON). */
129
+ getJson<T = unknown>(name: string, options?: GetOptions): Promise<T | null>;
130
+ /** Number, or `null` when missing (`ValidationError` when not a number). */
131
+ getNumber(name: string, options?: GetOptions): Promise<number | null>;
132
+ /** Boolean (`true/false/1/0/yes/no/on/off`), or `null` when missing. */
133
+ getBool(name: string, options?: GetOptions): Promise<boolean | null>;
134
+ /** The secret; `NotFoundError` when missing. */
135
+ require(name: string, options?: GetOptions): Promise<SecretValue>;
136
+ /** Whether the secret exists. */
137
+ exists(name: string, options?: GetOptions): Promise<boolean>;
138
+ /** Present secrets in request order (missing names omitted). */
139
+ getMany(names: readonly string[], options?: GetOptions): Promise<Map<string, SecretValue>>;
140
+ /** Every secret directly under `path` (non-recursive), keyed by full name. */
141
+ getAll(path?: string, options?: SignalOptions): Promise<Map<string, SecretValue>>;
142
+ /** Metadata of the secrets directly under a prefix or path, sorted by name. */
143
+ list(prefixOrPath?: string, options?: SignalOptions): Promise<SecretMetadata[]>;
144
+ /** Writes a secret; returns the new version (`""` when the service has no versions). */
145
+ set(name: string, value: SecretInput, options?: SetOptions): Promise<string>;
146
+ /** Deletes a secret; `NotFoundError` when missing. */
147
+ delete(name: string, options?: DeleteOptions): Promise<void>;
148
+ /** Metadata, or `null` when missing. */
149
+ metadata(name: string, options?: GetOptions): Promise<SecretMetadata | null>;
150
+ /**
151
+ * Sets environment variables from secrets: a path (one variable per secret directly under it)
152
+ * or a mapping `{ ENV_NAME: "secret/name" }`. Returns `{ envName: secretName }` for the
153
+ * variables that were set (never values).
154
+ */
155
+ loadEnv(source: string | Readonly<Record<string, string>>, options?: LoadEnvOptions): Promise<Record<string, string>>;
156
+ /** Polls a secret and calls `onChange` when its version (or SHA-256) changes. */
157
+ watch(name: string, intervalMs: number, onChange: WatchCallback, options?: WatchOptions): WatchHandle;
158
+ }
159
+
160
+ /** Concurrency used by {@link BaseSecretsProvider.getMany}. */
161
+ declare const GET_MANY_CONCURRENCY = 8;
162
+ /**
163
+ * Implements the whole {@link SecretsProvider} interface from five primitives a service
164
+ * implements on top of its API (SPEC §3).
165
+ */
166
+ declare abstract class BaseSecretsProvider implements SecretsProvider {
167
+ #private;
168
+ /** Reads a secret; `null` when missing. */
169
+ protected abstract fetchSecret(name: string, options: GetOptions): Promise<SecretValue | null>;
170
+ /** Lists the secrets directly under a prefix or path (any order). */
171
+ protected abstract listSecrets(prefixOrPath: string | undefined, options: SignalOptions): Promise<SecretMetadata[]>;
172
+ /** Writes a secret; returns the new version or `""`. */
173
+ protected abstract putSecret(name: string, value: Uint8Array, options: SetOptions): Promise<string>;
174
+ /** Deletes a secret; must throw {@link NotFoundError} when missing. */
175
+ protected abstract removeSecret(name: string, options: DeleteOptions): Promise<void>;
176
+ /** Reads metadata; `null` when missing. */
177
+ protected abstract fetchMetadata(name: string, options: GetOptions): Promise<SecretMetadata | null>;
178
+ get(name: string, options?: GetOptions): Promise<SecretValue | null>;
179
+ getString(name: string, options?: GetOptions): Promise<string | null>;
180
+ getJson<T = unknown>(name: string, options?: GetOptions): Promise<T | null>;
181
+ getNumber(name: string, options?: GetOptions): Promise<number | null>;
182
+ getBool(name: string, options?: GetOptions): Promise<boolean | null>;
183
+ require(name: string, options?: GetOptions): Promise<SecretValue>;
184
+ exists(name: string, options?: GetOptions): Promise<boolean>;
185
+ getMany(names: readonly string[], options?: GetOptions): Promise<Map<string, SecretValue>>;
186
+ getAll(path?: string, options?: SignalOptions): Promise<Map<string, SecretValue>>;
187
+ list(prefixOrPath?: string, options?: SignalOptions): Promise<SecretMetadata[]>;
188
+ set(name: string, value: SecretInput, options?: SetOptions): Promise<string>;
189
+ delete(name: string, options?: DeleteOptions): Promise<void>;
190
+ metadata(name: string, options?: GetOptions): Promise<SecretMetadata | null>;
191
+ loadEnv(source: string | Readonly<Record<string, string>>, options?: LoadEnvOptions): Promise<Record<string, string>>;
192
+ watch(name: string, intervalMs: number, onChange: WatchCallback, options?: WatchOptions): WatchHandle;
193
+ /** Number of active watchers. */
194
+ get activeWatchers(): number;
195
+ /** Stops every watcher started by this provider. Idempotent. */
196
+ stopWatchers(): void;
197
+ /** Stops all watchers (the owning client calls this from `close()`). Idempotent. */
198
+ close(): Promise<void>;
199
+ }
200
+
201
+ export { BaseSecretsProvider as B, SecretValue as a, GET_MANY_CONCURRENCY as h, encodeSecretInput as i, healthStatus as j, isHealthyWord as k, probeHealth as p };
202
+ export type { DeleteOptions as D, GetOptions as G, HealthStatus as H, LoadEnvOptions as L, SecretsProvider as S, WatchCallback as W, SignalOptions as b, SecretMetadata as c, SetOptions as d, WatchOptions as e, WatchHandle as f, SecretInput as g };