quiet-env-resolver 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/.editorconfig ADDED
@@ -0,0 +1,12 @@
1
+ # ~~ Generated by projen. To modify, edit .projenrc.ts and run "npx projen".
2
+
3
+ root=true
4
+
5
+ [*]
6
+ end_of_line=lf
7
+ charset=utf-8
8
+
9
+ [*\.{js,ts}]
10
+ indent_style=space
11
+ indent_size=2
12
+ max_line_length=160
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 [yyyy] [name of copyright owner]
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/README.md CHANGED
@@ -1,3 +1,123 @@
1
- # Temporary Holding Version
1
+ # Quiet Env Resolver
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
+ [![npm version](https://img.shields.io/npm/v/quiet-env-resolver?style=flat-square)](https://www.npmjs.com/package/quiet-env-resolver)
4
+ [![license](https://img.shields.io/npm/l/quiet-env-resolver?style=flat-square)](https://www.npmjs.com/package/quiet-env-resolver)
5
+ [![Node.js](https://img.shields.io/node/v/quiet-env-resolver?style=flat-square)](https://www.npmjs.com/package/quiet-env-resolver)
6
+ [![build](https://img.shields.io/github/actions/workflow/status/gammarers-labs/quiet-env-resolver/build.yml?label=build&style=flat-square)](https://github.com/gammarers-labs/quiet-env-resolver/actions/workflows/build.yml)
7
+
8
+ Resolves environment variables without throwing. Wraps `strict-env-resolver` and reports failures through an `onError` callback.
9
+
10
+ ## Features
11
+
12
+ - Reads `string`, `number`, `boolean`, and `enum` environment variables with the same specs as `strict-env-resolver`
13
+ - Reports a failure through an optional `onError` instead of throwing
14
+ - Passes shape mismatches as `QuietEnvResolverValidateError` and leaves any other thrown value unchanged
15
+ - Resolves one variable with `resolve`, or every key in a schema with `resolves`
16
+
17
+ ## How it works
18
+
19
+ `resolve` and `resolves` call `strict-env-resolver`. That library throws when a variable is missing or invalid. This package catches the throw. A validation failure is passed to `onError` as `QuietEnvResolverValidateError`, without the rejected value. Any other thrown value is passed through unchanged. `onError` is optional: a callback, or `{ onError }` as the last argument. After a failure the call returns `undefined`. `default` is still the strict fallback for a missing value, and a missing value that uses `default` does not call `onError`.
20
+
21
+ ## Installation
22
+
23
+ ### npm
24
+
25
+ ```bash
26
+ npm install quiet-env-resolver
27
+ ```
28
+
29
+ ### yarn
30
+
31
+ ```bash
32
+ yarn add quiet-env-resolver
33
+ ```
34
+
35
+ ### pnpm
36
+
37
+ ```bash
38
+ pnpm add quiet-env-resolver
39
+ ```
40
+
41
+ ## Usage
42
+
43
+ ```ts
44
+ import { QuietEnvResolver, StrictEnvType } from 'quiet-env-resolver';
45
+
46
+ const port = QuietEnvResolver.resolve('PORT', StrictEnvType.Number.Port, { default: 3000 });
47
+ ```
48
+
49
+ `port` is `3000` when `PORT` is unset, the parsed number when `PORT` is valid, and `undefined` when parsing fails. No error is thrown.
50
+
51
+ Pass `onError` as the last argument. A function and `{ onError }` are both accepted:
52
+
53
+ ```ts
54
+ import { QuietEnvResolver, QuietEnvResolverValidateError, StrictEnvType } from 'quiet-env-resolver';
55
+
56
+ const fromInvalid = QuietEnvResolver.resolve('PORT', StrictEnvType.Number.Port, (error) => {
57
+ console.error('failed to parse config', error);
58
+ });
59
+
60
+ const checked = QuietEnvResolver.resolve('PORT', StrictEnvType.Number.Port, { default: 3000 }, {
61
+ onError: (error) => {
62
+ if (error instanceof QuietEnvResolverValidateError) {
63
+ console.error('config shape mismatch');
64
+ return;
65
+ }
66
+ console.error('failed to parse config', error);
67
+ },
68
+ });
69
+ ```
70
+
71
+ Check `QuietEnvResolverValidateError` before `QuietEnvResolverError`. The validation error does not include the rejected value.
72
+
73
+ Several variables in one call:
74
+
75
+ ```ts
76
+ const envs = QuietEnvResolver.resolves({
77
+ PORT: [StrictEnvType.Number.Port, { default: 3000 }],
78
+ DEBUG: [StrictEnvType.Boolean, { default: false }],
79
+ MODE: StrictEnvType.Enum(['read', 'write'] as const),
80
+ }, {
81
+ onError: (error) => {
82
+ if (error instanceof QuietEnvResolverValidateError) {
83
+ console.error('config shape mismatch');
84
+ return;
85
+ }
86
+ console.error('failed to parse config', error);
87
+ },
88
+ });
89
+ ```
90
+
91
+ ## Options
92
+
93
+ ### `QuietEnvResolver.resolve(key, spec?, options?, onError?)`
94
+
95
+ | Argument | Required | Description |
96
+ |----------|----------|-------------|
97
+ | **key** | Yes | Environment variable name (for example `"PORT"`). |
98
+ | **spec** | No | Type spec. Defaults to `StrictEnvType.String`. Use `StrictEnvType.String`, `StrictEnvType.Number` (or a preset such as `Number.Port`), `StrictEnvType.Boolean`, or `StrictEnvType.Enum(choices)`. |
99
+ | **options** | No | `{ default, trim }` forwarded to `strict-env-resolver`. `onError` may sit on this object. |
100
+ | **onError** | No | Last argument. A callback `(error: unknown) => void`, or `{ onError }`. |
101
+
102
+ ### `QuietEnvResolver.resolves(schema, onError?)`
103
+
104
+ | Argument | Required | Description |
105
+ |----------|----------|-------------|
106
+ | **schema** | Yes | Object whose keys are env names. Each value is a spec, or a `[spec, options]` tuple. |
107
+ | **onError** | No | Last argument. A callback, or `{ onError }`. One failure is reported for the whole schema. |
108
+
109
+ ### `onError`
110
+
111
+ | Field | Type | Description |
112
+ |-------|------|-------------|
113
+ | **onError** | `(error: unknown) => void` | Optional. Validation failures are `QuietEnvResolverValidateError`. Other thrown values are unchanged. Not called when `default` covers a missing value. |
114
+
115
+ A successful call returns the parsed value and does not call `onError`. A failed call calls `onError` when it was passed, then returns `undefined`. An exception thrown by `onError` propagates to the caller. Omitting `onError` still returns `undefined` and does not throw.
116
+
117
+ ## Requirements
118
+
119
+ - **Node.js** >= 20.0.0
120
+
121
+ ## License
122
+
123
+ This project is licensed under the Apache-2.0 License.
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Base error for quiet-env-resolver.
3
+ *
4
+ * Resolution failures are not thrown. Callers receive them through `onError`.
5
+ * Check {@link QuietEnvResolverValidateError} before this base class.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * if (error instanceof QuietEnvResolverValidateError) {
10
+ * return;
11
+ * }
12
+ * if (error instanceof QuietEnvResolverError) {
13
+ * // Other errors raised by this package.
14
+ * }
15
+ * ```
16
+ */
17
+ export declare abstract class QuietEnvResolverError extends Error {
18
+ readonly name: string;
19
+ /**
20
+ * @param message - Error message.
21
+ */
22
+ protected constructor(message: string);
23
+ }
24
+ /**
25
+ * Passed to `onError` when `strict-env-resolver` rejects a value.
26
+ *
27
+ * The rejected value is omitted so logs do not include raw environment data.
28
+ */
29
+ export declare class QuietEnvResolverValidateError extends QuietEnvResolverError {
30
+ readonly name: string;
31
+ /**
32
+ * @param message - Override for the default shape-mismatch message.
33
+ */
34
+ constructor(message?: string);
35
+ }
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.QuietEnvResolverValidateError = exports.QuietEnvResolverError = void 0;
4
+ /**
5
+ * Base error for quiet-env-resolver.
6
+ *
7
+ * Resolution failures are not thrown. Callers receive them through `onError`.
8
+ * Check {@link QuietEnvResolverValidateError} before this base class.
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * if (error instanceof QuietEnvResolverValidateError) {
13
+ * return;
14
+ * }
15
+ * if (error instanceof QuietEnvResolverError) {
16
+ * // Other errors raised by this package.
17
+ * }
18
+ * ```
19
+ */
20
+ class QuietEnvResolverError extends Error {
21
+ /**
22
+ * @param message - Error message.
23
+ */
24
+ constructor(message) {
25
+ super(message);
26
+ this.name = 'QuietEnvResolverError';
27
+ Object.setPrototypeOf(this, QuietEnvResolverError.prototype);
28
+ }
29
+ }
30
+ exports.QuietEnvResolverError = QuietEnvResolverError;
31
+ const VALIDATE_MISMATCH_MESSAGE = 'Environment variable did not match the expected shape';
32
+ /**
33
+ * Passed to `onError` when `strict-env-resolver` rejects a value.
34
+ *
35
+ * The rejected value is omitted so logs do not include raw environment data.
36
+ */
37
+ class QuietEnvResolverValidateError extends QuietEnvResolverError {
38
+ /**
39
+ * @param message - Override for the default shape-mismatch message.
40
+ */
41
+ constructor(message = VALIDATE_MISMATCH_MESSAGE) {
42
+ super(message);
43
+ this.name = 'QuietEnvResolverValidateError';
44
+ Object.setPrototypeOf(this, QuietEnvResolverValidateError.prototype);
45
+ }
46
+ }
47
+ exports.QuietEnvResolverValidateError = QuietEnvResolverValidateError;
48
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXJyb3JzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NvcmUvZXJyb3JzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBOzs7Ozs7Ozs7Ozs7Ozs7R0FlRztBQUNILE1BQXNCLHFCQUFzQixTQUFRLEtBQUs7SUFHdkQ7O09BRUc7SUFDSCxZQUFzQixPQUFlO1FBQ25DLEtBQUssQ0FBQyxPQUFPLENBQUMsQ0FBQztRQU5DLFNBQUksR0FBVyx1QkFBdUIsQ0FBQztRQU92RCxNQUFNLENBQUMsY0FBYyxDQUFDLElBQUksRUFBRSxxQkFBcUIsQ0FBQyxTQUFTLENBQUMsQ0FBQztJQUMvRCxDQUFDO0NBQ0Y7QUFWRCxzREFVQztBQUVELE1BQU0seUJBQXlCLEdBQUcsdURBQXVELENBQUM7QUFFMUY7Ozs7R0FJRztBQUNILE1BQWEsNkJBQThCLFNBQVEscUJBQXFCO0lBR3RFOztPQUVHO0lBQ0gsWUFBWSxVQUFrQix5QkFBeUI7UUFDckQsS0FBSyxDQUFDLE9BQU8sQ0FBQyxDQUFDO1FBTkMsU0FBSSxHQUFXLCtCQUErQixDQUFDO1FBTy9ELE1BQU0sQ0FBQyxjQUFjLENBQUMsSUFBSSxFQUFFLDZCQUE2QixDQUFDLFNBQVMsQ0FBQyxDQUFDO0lBQ3ZFLENBQUM7Q0FDRjtBQVZELHNFQVVDIiwic291cmNlc0Nv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Qgbm90IG1hdGNoIHRoZSBleHBlY3RlZCBzaGFwZSc7XG5cbi8qKlxuICogUGFzc2VkIHRvIGBvbkVycm9yYCB3aGVuIGBzdHJpY3QtZW52LXJlc29sdmVyYCByZWplY3RzIGEgdmFsdWUuXG4gKlxuICogVGhlIHJlamVjdGVkIHZhbHVlIGlzIG9taXR0ZWQgc28gbG9ncyBkbyBub3QgaW5jbHVkZSByYXcgZW52aXJvbm1lbnQgZGF0YS5cbiAqL1xuZXhwb3J0IGNsYXNzIFF1aWV0RW52UmVzb2x2ZXJWYWxpZGF0ZUVycm9yIGV4dGVuZHMgUXVpZXRFbnZSZXNvbHZlckVycm9yIHtcbiAgb3ZlcnJpZGUgcmVhZG9ubHkgbmFtZTogc3RyaW5nID0gJ1F1aWV0RW52UmVzb2x2ZXJWYWxpZGF0ZUVycm9yJztcblxuICAvKipcbiAgICogQHBhcmFtIG1lc3NhZ2UgLSBPdmVycmlkZSBmb3IgdGhlIGRlZmF1bHQgc2hhcGUtbWlzbWF0Y2ggbWVzc2FnZS5cbiAgICovXG4gIGNvbnN0cnVjdG9yKG1lc3NhZ2U6IHN0cmluZyA9IFZBTElEQVRFX01JU01BVENIX01FU1NBR0UpIHtcbiAgICBzdXBlcihtZXNzYWdlKTtcbiAgICBPYmplY3Quc2V0UHJvdG90eXBlT2YodGhpcywgUXVpZXRFbnZSZXNvbHZlclZhbGlkYXRlRXJyb3IucHJvdG90eXBlKTtcbiAgfVxufVxuIl19
package/lib/index.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Public entry for quiet-env-resolver.
3
+ * Re-exports the quiet resolver, package errors, and the spec types callers need.
4
+ * Implementation lives in the resolver module and in core.
5
+ */
6
+ export { QuietEnvResolver } from './resolver';
7
+ export type { QuietEnvHandler, QuietEnvOnError, QuietEnvOptions } from './resolver';
8
+ export { QuietEnvResolverError, QuietEnvResolverValidateError } from './core/errors';
9
+ export { StrictEnvType } from 'strict-env-resolver';
10
+ export type { StrictEnvNumberConstraints, StrictEnvOptions, StrictEnvSchema, StrictEnvSchemaEntry, StrictEnvSchemaToType, StrictEnvSpec, StrictEnvSpecToType, StrictEnvTypeBoolean, StrictEnvTypeEnum, StrictEnvTypeNumber, StrictEnvTypeString, } from 'strict-env-resolver';
package/lib/index.js ADDED
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StrictEnvType = exports.QuietEnvResolverValidateError = exports.QuietEnvResolverError = exports.QuietEnvResolver = void 0;
4
+ /**
5
+ * Public entry for quiet-env-resolver.
6
+ * Re-exports the quiet resolver, package errors, and the spec types callers need.
7
+ * Implementation lives in the resolver module and in core.
8
+ */
9
+ var resolver_1 = require("./resolver");
10
+ Object.defineProperty(exports, "QuietEnvResolver", { enumerable: true, get: function () { return resolver_1.QuietEnvResolver; } });
11
+ var errors_1 = require("./core/errors");
12
+ Object.defineProperty(exports, "QuietEnvResolverError", { enumerable: true, get: function () { return errors_1.QuietEnvResolverError; } });
13
+ Object.defineProperty(exports, "QuietEnvResolverValidateError", { enumerable: true, get: function () { return errors_1.QuietEnvResolverValidateError; } });
14
+ var strict_env_resolver_1 = require("strict-env-resolver");
15
+ Object.defineProperty(exports, "StrictEnvType", { enumerable: true, get: function () { return strict_env_resolver_1.StrictEnvType; } });
16
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUE7Ozs7R0FJRztBQUNILHVDQUE4QztBQUFyQyw0R0FBQSxnQkFBZ0IsT0FBQTtBQUl6Qix3Q0FBcUY7QUFBNUUsK0dBQUEscUJBQXFCLE9BQUE7QUFBRSx1SEFBQSw2QkFBNkIsT0FBQTtBQUU3RCwyREFBb0Q7QUFBM0Msb0hBQUEsYUFBYSxPQUFBIiw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,0 +1,52 @@
1
+ import { type StrictEnvOptions, type StrictEnvSchema, type StrictEnvSchemaToType, type StrictEnvSpec, type StrictEnvSpecToType } from 'strict-env-resolver';
2
+ /**
3
+ * Called when resolution fails.
4
+ *
5
+ * A shape mismatch is a {@link QuietEnvResolverValidateError}. Any other thrown
6
+ * value is passed through. Omitted callbacks are not invoked.
7
+ */
8
+ export type QuietEnvOnError = (error: unknown) => void;
9
+ /**
10
+ * Last-argument object form, matching `onError` inside quiet-json-parser options.
11
+ */
12
+ export type QuietEnvHandler = {
13
+ /** Receives the failure. The resolver does not throw. */
14
+ readonly onError: QuietEnvOnError;
15
+ };
16
+ /**
17
+ * `strict-env-resolver` options, plus an optional `onError` on the same object.
18
+ *
19
+ * @typeParam S - Environment variable spec.
20
+ */
21
+ export type QuietEnvOptions<S extends StrictEnvSpec = StrictEnvSpec> = StrictEnvOptions<S> & {
22
+ /** Called when this read fails. Same callback as the trailing `onError` argument. */
23
+ readonly onError?: QuietEnvOnError;
24
+ };
25
+ type QuietResolve = {
26
+ <K extends string>(key: K, onError?: QuietEnvOnError | QuietEnvHandler): string | undefined;
27
+ <K extends string, S extends StrictEnvSpec>(key: K, spec: S, onError?: QuietEnvOnError | QuietEnvHandler): StrictEnvSpecToType<S> | undefined;
28
+ <K extends string, S extends StrictEnvSpec>(key: K, spec: S, options: QuietEnvOptions<S>, onError?: QuietEnvOnError | QuietEnvHandler): StrictEnvSpecToType<S> | undefined;
29
+ };
30
+ /**
31
+ * Quiet wrapper around `strict-env-resolver`.
32
+ *
33
+ * @example
34
+ * ```ts
35
+ * const port = QuietEnvResolver.resolve('PORT', StrictEnvType.Number.Port, { default: 3000 }, {
36
+ * onError: (error) => {
37
+ * if (error instanceof QuietEnvResolverValidateError) {
38
+ * console.error('config shape mismatch');
39
+ * return;
40
+ * }
41
+ * console.error('failed to parse config', error);
42
+ * },
43
+ * });
44
+ * ```
45
+ */
46
+ export declare const QuietEnvResolver: {
47
+ /** Reads and parses a single environment variable. See {@link resolve}. */
48
+ resolve: QuietResolve;
49
+ /** Reads and parses every variable in a schema. See {@link resolves}. */
50
+ resolves: <TSchema extends StrictEnvSchema>(schema: TSchema, onErrorOrHandler?: QuietEnvOnError | QuietEnvHandler) => StrictEnvSchemaToType<TSchema> | undefined;
51
+ };
52
+ export {};
@@ -0,0 +1,177 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.QuietEnvResolver = void 0;
4
+ const strict_env_resolver_1 = require("strict-env-resolver");
5
+ const errors_1 = require("./core/errors");
6
+ /**
7
+ * True for a trailing callback.
8
+ * `StrictEnvType.Number` is callable and also has `type`, so it stays a spec.
9
+ *
10
+ * @param value - Candidate argument.
11
+ * @returns Whether `value` is an `onError` callback.
12
+ */
13
+ const isOnError = (value) => {
14
+ if (typeof value !== 'function') {
15
+ return false;
16
+ }
17
+ if ('type' in value) {
18
+ return false;
19
+ }
20
+ return true;
21
+ };
22
+ /**
23
+ * True for `{ onError }` when that object is not a spec or a `{ default, trim }` bag.
24
+ *
25
+ * @param value - Candidate argument.
26
+ * @returns Whether `value` is a handler object.
27
+ */
28
+ const isOnErrorHandler = (value) => {
29
+ if (typeof value !== 'object' || value === null) {
30
+ return false;
31
+ }
32
+ if (!('onError' in value) || typeof value.onError !== 'function') {
33
+ return false;
34
+ }
35
+ if ('type' in value || 'default' in value || 'trim' in value) {
36
+ return false;
37
+ }
38
+ return true;
39
+ };
40
+ /**
41
+ * Reads `onError` from a callback, a handler object, or options that include it.
42
+ *
43
+ * @param value - Trailing argument or options bag.
44
+ * @returns The callback, or `undefined` when the caller did not pass one.
45
+ */
46
+ const onErrorFrom = (value) => {
47
+ if (isOnError(value)) {
48
+ return value;
49
+ }
50
+ if (typeof value !== 'object' || value === null) {
51
+ return undefined;
52
+ }
53
+ if (!('onError' in value)) {
54
+ return undefined;
55
+ }
56
+ // `in` does not narrow the property to a callback.
57
+ const callback = value.onError;
58
+ if (!isOnError(callback)) {
59
+ return undefined;
60
+ }
61
+ return callback;
62
+ };
63
+ /**
64
+ * Maps a thrown validation error onto this package's error.
65
+ * Other thrown values stay as they are.
66
+ *
67
+ * @param error - Caught exception.
68
+ * @returns Value passed to `onError`.
69
+ */
70
+ const toQuietError = (error) => {
71
+ if (!(error instanceof strict_env_resolver_1.StrictEnvValidationError)) {
72
+ return error;
73
+ }
74
+ return new errors_1.QuietEnvResolverValidateError();
75
+ };
76
+ /**
77
+ * Runs a strict read. Failures go to `onError` and become `undefined`.
78
+ * `onError` is outside the assignment so a handler failure is not caught again.
79
+ *
80
+ * @param read - Strict resolver call.
81
+ * @param onError - Optional failure callback.
82
+ * @returns Parsed value, or `undefined` after a failure.
83
+ */
84
+ const reportQuietly = (read, onError) => {
85
+ let value;
86
+ try {
87
+ value = read();
88
+ }
89
+ catch (error) {
90
+ onError?.(toQuietError(error));
91
+ return undefined;
92
+ }
93
+ return value;
94
+ };
95
+ /**
96
+ * `strict-env-resolver` reads `default` and `trim` only. A sibling `onError` is ignored there.
97
+ *
98
+ * @param value - Caller options, which may also carry `onError`.
99
+ * @returns Options safe to forward.
100
+ */
101
+ const asStrictOptions = (value) => value;
102
+ const readOne = (key, spec, options, onError) => {
103
+ if (spec === undefined) {
104
+ return reportQuietly(() => strict_env_resolver_1.StrictEnvResolver.resolve(key), onError);
105
+ }
106
+ if (options === undefined) {
107
+ return reportQuietly(() => strict_env_resolver_1.StrictEnvResolver.resolve(key, spec), onError);
108
+ }
109
+ return reportQuietly(() => strict_env_resolver_1.StrictEnvResolver.resolve(key, spec, asStrictOptions(options)), onError);
110
+ };
111
+ /**
112
+ * Reads one environment variable.
113
+ *
114
+ * The last argument is optional. It may be an `onError` callback or `{ onError }`.
115
+ * `onError` may also sit on the options object next to `default` and `trim`.
116
+ * Validation failures become {@link QuietEnvResolverValidateError}. Other thrown
117
+ * values are passed through. Nothing is thrown when `onError` is omitted.
118
+ *
119
+ * Overload signatures are what callers see. The implementation narrows each
120
+ * argument shape at runtime because an arrow function cannot declare overloads.
121
+ *
122
+ * @param key - Environment variable name.
123
+ * @param spec - Type spec. Defaults to string when omitted.
124
+ * @param options - Optional `{ default, trim, onError }`.
125
+ * @param onError - Callback or `{ onError }`, used when it is not already on `options`.
126
+ * @returns Parsed value, or `undefined` when resolution fails.
127
+ */
128
+ const resolve = ((key, second, third, fourth) => {
129
+ if (second === undefined) {
130
+ return readOne(key, undefined, undefined, undefined);
131
+ }
132
+ if (isOnError(second) || isOnErrorHandler(second)) {
133
+ return readOne(key, undefined, undefined, onErrorFrom(second));
134
+ }
135
+ if (third === undefined) {
136
+ return readOne(key, second, undefined, undefined);
137
+ }
138
+ if (isOnError(third) || isOnErrorHandler(third)) {
139
+ return readOne(key, second, undefined, onErrorFrom(third));
140
+ }
141
+ // Fourth argument wins when both the options bag and the last argument set onError.
142
+ return readOne(key, second, third, onErrorFrom(fourth) ?? onErrorFrom(third));
143
+ });
144
+ /**
145
+ * Reads every variable in `schema`.
146
+ *
147
+ * One validation failure is reported once. `onError` is optional and may be a
148
+ * callback or `{ onError }`.
149
+ *
150
+ * @param schema - Map of env names to specs or `[spec, options]` tuples.
151
+ * @param onErrorOrHandler - Optional callback or `{ onError }`.
152
+ * @returns Parsed object, or `undefined` when resolution fails.
153
+ */
154
+ const resolves = (schema, onErrorOrHandler) => reportQuietly(() => strict_env_resolver_1.StrictEnvResolver.resolves(schema), onErrorFrom(onErrorOrHandler));
155
+ /**
156
+ * Quiet wrapper around `strict-env-resolver`.
157
+ *
158
+ * @example
159
+ * ```ts
160
+ * const port = QuietEnvResolver.resolve('PORT', StrictEnvType.Number.Port, { default: 3000 }, {
161
+ * onError: (error) => {
162
+ * if (error instanceof QuietEnvResolverValidateError) {
163
+ * console.error('config shape mismatch');
164
+ * return;
165
+ * }
166
+ * console.error('failed to parse config', error);
167
+ * },
168
+ * });
169
+ * ```
170
+ */
171
+ exports.QuietEnvResolver = {
172
+ /** Reads and parses a single environment variable. See {@link resolve}. */
173
+ resolve,
174
+ /** Reads and parses every variable in a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xlLmVycm9yKCdjb25maWcgc2hhcGUgbWlzbWF0Y2gnKTtcbiAqICAgICAgIHJldHVybjtcbiAqICAgICB9XG4gKiAgICAgY29uc29sZS5lcnJvcignZmFpbGVkIHRvIHBhcnNlIGNvbmZpZycsIGVycm9yKTtcbiAqICAgfSxcbiAqIH0pO1xuICogYGBgXG4gKi9cbmV4cG9ydCBjb25zdCBRdWlldEVudlJlc29sdmVyID0ge1xuICAvKiogUmVhZHMgYW5kIHBhcnNlcyBhIHNpbmdsZSBlbnZpcm9ubWVudCB2YXJpYWJsZS4gU2VlIHtAbGluayByZXNvbHZlfS4gKi9cbiAgcmVzb2x2ZSxcbiAgLyoqIFJlYWRzIGFuZCBwYXJzZXMgZXZlcnkgdmFyaWFibGUgaW4gYSBzY2hlbWEuIFNlZSB7QGxpbmsgcmVzb2x2ZXN9LiAqL1xuICByZXNvbHZlcyxcbn07XG4iXX0=
package/package.json CHANGED
@@ -1,6 +1,123 @@
1
1
  {
2
2
  "name": "quiet-env-resolver",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "description": "A library for resolving environment variables in a quiet way.",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "https://github.com/gammarers-labs/quiet-env-resolver.git"
7
+ },
8
+ "scripts": {
9
+ "build": "projen build",
10
+ "bump": "projen bump",
11
+ "bump:releasable-commits": "projen bump:releasable-commits",
12
+ "clobber": "projen clobber",
13
+ "compile": "projen compile",
14
+ "default": "projen default",
15
+ "eject": "projen eject",
16
+ "eslint": "projen eslint",
17
+ "package": "projen package",
18
+ "post-compile": "projen post-compile",
19
+ "post-upgrade": "projen post-upgrade",
20
+ "pre-compile": "projen pre-compile",
21
+ "release": "projen release",
22
+ "test": "projen test",
23
+ "test:watch": "projen test:watch",
24
+ "unbump": "projen unbump",
25
+ "upgrade": "projen upgrade",
26
+ "watch": "projen watch",
27
+ "projen": "projen"
28
+ },
29
+ "author": {
30
+ "name": "yicr",
31
+ "email": "yicr@users.noreply.github.com",
32
+ "organization": false
33
+ },
34
+ "devDependencies": {
35
+ "@gammarers/projen-projects": "^0.5.8",
36
+ "@stylistic/eslint-plugin": "^2",
37
+ "@types/jest": "^30.0.0",
38
+ "@types/node": "^20",
39
+ "@typescript-eslint/eslint-plugin": "^8",
40
+ "@typescript-eslint/parser": "^8",
41
+ "commit-and-tag-version": "^13",
42
+ "constructs": "^10.0.0",
43
+ "eslint": "^9",
44
+ "eslint-import-resolver-typescript": "^4.4.5",
45
+ "eslint-plugin-import": "^2.32.0",
46
+ "jest": "^30.5.2",
47
+ "jest-junit": "^17",
48
+ "projen": "^0.104.5",
49
+ "ts-jest": "^29.4.14",
50
+ "ts-node": "^10.9.2",
51
+ "typescript": "6.0.x"
52
+ },
53
+ "dependencies": {
54
+ "strict-env-resolver": "^0.8.0"
55
+ },
56
+ "keywords": [
57
+ "environment",
58
+ "resolver",
59
+ "variables"
60
+ ],
61
+ "engines": {
62
+ "node": ">= 20.0.0"
63
+ },
64
+ "devEngines": {
65
+ "packageManager": {
66
+ "name": "npm",
67
+ "onFail": "ignore"
68
+ }
69
+ },
70
+ "main": "lib/index.js",
71
+ "license": "Apache-2.0",
72
+ "publishConfig": {
73
+ "access": "public"
74
+ },
75
+ "version": "0.1.1",
76
+ "jest": {
77
+ "coverageProvider": "v8",
78
+ "testMatch": [
79
+ "<rootDir>/@(src|test)/**/*(*.)@(spec|test).ts?(x)",
80
+ "<rootDir>/@(src|test)/**/__tests__/**/*.ts?(x)",
81
+ "<rootDir>/@(projenrc)/**/*(*.)@(spec|test).ts?(x)",
82
+ "<rootDir>/@(projenrc)/**/__tests__/**/*.ts?(x)"
83
+ ],
84
+ "clearMocks": true,
85
+ "collectCoverage": true,
86
+ "coverageReporters": [
87
+ "json",
88
+ "lcov",
89
+ "clover",
90
+ "cobertura",
91
+ "text"
92
+ ],
93
+ "coverageDirectory": "coverage",
94
+ "coveragePathIgnorePatterns": [
95
+ "/node_modules/"
96
+ ],
97
+ "testPathIgnorePatterns": [
98
+ "/node_modules/"
99
+ ],
100
+ "watchPathIgnorePatterns": [
101
+ "/node_modules/"
102
+ ],
103
+ "reporters": [
104
+ "default",
105
+ [
106
+ "jest-junit",
107
+ {
108
+ "outputDirectory": "test-reports"
109
+ }
110
+ ]
111
+ ],
112
+ "transform": {
113
+ "^.+\\.[t]sx?$": [
114
+ "ts-jest",
115
+ {
116
+ "tsconfig": "test/tsconfig.json"
117
+ }
118
+ ]
119
+ }
120
+ },
121
+ "types": "lib/index.d.ts",
122
+ "//": "~~ Generated by projen. To modify, edit .projenrc.ts and run \"npx projen\"."
123
+ }