arkenv 1.0.0-alpha.2 → 1.0.0-alpha.3
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/README.md +20 -80
- package/dist/chunk-i8uDWG73.cjs +1 -0
- package/dist/index.cjs +375 -8
- package/dist/index.d.cts +1 -235
- package/package.json +27 -81
- package/dist/core-7-JO-N-w.d.cts +0 -82
- package/dist/core-7-JO-N-w.d.cts.map +0 -1
- package/dist/core-A65KioHX.mjs +0 -6
- package/dist/core-A65KioHX.mjs.map +0 -1
- package/dist/core-BaGd9k2K.d.mts +0 -76
- package/dist/core-BaGd9k2K.d.mts.map +0 -1
- package/dist/core-CA13n2Iu.cjs +0 -11
- package/dist/core.cjs +0 -8
- package/dist/core.d.cts +0 -9
- package/dist/core.d.mts +0 -2
- package/dist/core.mjs +0 -1
- package/dist/errors-C_uh86xh.mjs +0 -3
- package/dist/errors-C_uh86xh.mjs.map +0 -1
- package/dist/errors-Dn6WQ2pP.cjs +0 -8
- package/dist/index-Do-2CL1V.d.cts +0 -210
- package/dist/index-Do-2CL1V.d.cts.map +0 -1
- package/dist/index-NbQAnciD.d.mts +0 -204
- package/dist/index-NbQAnciD.d.mts.map +0 -1
- package/dist/index.d.cts.map +0 -1
- package/dist/index.d.mts +0 -229
- package/dist/index.d.mts.map +0 -1
- package/dist/index.mjs +0 -3
- package/dist/index.mjs.map +0 -1
- package/dist/standard.cjs +0 -8
- package/dist/standard.d.cts +0 -111
- package/dist/standard.d.cts.map +0 -1
- package/dist/standard.d.mts +0 -105
- package/dist/standard.d.mts.map +0 -1
- package/dist/standard.mjs +0 -3
- package/dist/standard.mjs.map +0 -1
package/dist/index.d.mts
DELETED
|
@@ -1,229 +0,0 @@
|
|
|
1
|
-
import { a as SafeArkEnvResult } from "./core-BaGd9k2K.mjs";
|
|
2
|
-
import { a as Dict, n as SchemaShape, o as $, r as InferType, t as CompiledEnvSchema } from "./index-NbQAnciD.mjs";
|
|
3
|
-
import * as _$arktype from "arktype";
|
|
4
|
-
import { distill, type as type$1 } from "arktype";
|
|
5
|
-
import * as _$arktype_internal_keywords_string_ts0 from "arktype/internal/keywords/string.ts";
|
|
6
|
-
import * as _$arktype_internal_attributes_ts0 from "arktype/internal/attributes.ts";
|
|
7
|
-
import * as _$arktype_internal_type_ts0 from "arktype/internal/type.ts";
|
|
8
|
-
|
|
9
|
-
//#region src/arkenv.d.ts
|
|
10
|
-
/**
|
|
11
|
-
* Declarative environment schema definition accepted by ArkEnv.
|
|
12
|
-
*
|
|
13
|
-
* Represents a declarative schema object mapping environment
|
|
14
|
-
* variable names to schema definitions (e.g. ArkType DSL strings
|
|
15
|
-
* or Standard Schema validators).
|
|
16
|
-
*
|
|
17
|
-
* This type is used to validate that a schema object is compatible with
|
|
18
|
-
* ArkEnv’s validator scope before being compiled or parsed.
|
|
19
|
-
*
|
|
20
|
-
* Most users will provide schemas in this form.
|
|
21
|
-
*
|
|
22
|
-
* @template def - The schema shape object
|
|
23
|
-
*/
|
|
24
|
-
type EnvSchema<def> = type$1.validate<def, $>;
|
|
25
|
-
/**
|
|
26
|
-
* Infer the validated and coerced environment object type from a schema.
|
|
27
|
-
* Supports declarative schema shapes, compiled ArkType schemas, and Standard Schema validators.
|
|
28
|
-
*
|
|
29
|
-
* @template T - The schema type
|
|
30
|
-
*/
|
|
31
|
-
type Infer<T> = T extends SchemaShape ? distill.Out<type$1.infer<T, $>> : InferType<T>;
|
|
32
|
-
/**
|
|
33
|
-
* The environment variables passed to `arkenv`.
|
|
34
|
-
* Uses `Dict<string>` to enforce
|
|
35
|
-
* compile-time safety: all input environment variables must be strings
|
|
36
|
-
* (or undefined), matching `process.env` semantics.
|
|
37
|
-
*/
|
|
38
|
-
type RuntimeEnvironment = Dict<string>;
|
|
39
|
-
/**
|
|
40
|
-
* Configuration options for `arkenv`
|
|
41
|
-
*/
|
|
42
|
-
type ArkEnvConfig = {
|
|
43
|
-
/**
|
|
44
|
-
* The environment variables to parse. Defaults to `process.env`
|
|
45
|
-
*/
|
|
46
|
-
env?: RuntimeEnvironment;
|
|
47
|
-
/**
|
|
48
|
-
* Whether to coerce environment variables to their defined types. Defaults to `true`
|
|
49
|
-
*/
|
|
50
|
-
coerce?: boolean;
|
|
51
|
-
/**
|
|
52
|
-
* Control how ArkEnv handles environment variables that are not defined in your schema.
|
|
53
|
-
*
|
|
54
|
-
* Defaults to `'delete'` to ensure your output object only contains
|
|
55
|
-
* keys you've explicitly declared. This differs from ArkType's standard behavior, which
|
|
56
|
-
* mirrors TypeScript by defaulting to `'ignore'`.
|
|
57
|
-
*
|
|
58
|
-
* - `delete` (ArkEnv default): Undeclared keys are allowed on input but stripped from the output.
|
|
59
|
-
* - `ignore` (ArkType default): Undeclared keys are allowed and preserved in the output.
|
|
60
|
-
* - `reject`: Undeclared keys will cause validation to fail.
|
|
61
|
-
*
|
|
62
|
-
* @default "delete"
|
|
63
|
-
* @see https://arktype.io/docs/configuration#onundeclaredkey
|
|
64
|
-
*/
|
|
65
|
-
onUndeclaredKey?: "ignore" | "delete" | "reject";
|
|
66
|
-
/**
|
|
67
|
-
* The format to use for array parsing when coercion is enabled.
|
|
68
|
-
*
|
|
69
|
-
* - `comma` (default): Strings are split by comma and trimmed.
|
|
70
|
-
* - `json`: Strings are parsed as JSON.
|
|
71
|
-
*
|
|
72
|
-
* @default "comma"
|
|
73
|
-
*/
|
|
74
|
-
arrayFormat?: "comma" | "json";
|
|
75
|
-
/**
|
|
76
|
-
* Whether to bypass secret redaction and print raw sensitive values during debugging.
|
|
77
|
-
* Defaults to checking `process.env.ARKENV_DEBUG_SECRETS === "true"` or `"1"`.
|
|
78
|
-
*/
|
|
79
|
-
debugSecrets?: boolean;
|
|
80
|
-
/**
|
|
81
|
-
* Whether to treat empty strings (`""`) as `undefined` before validation.
|
|
82
|
-
*
|
|
83
|
-
* When enabled, an environment variable set to an empty value (e.g. `PORT=`)
|
|
84
|
-
* will be treated as if it were missing, allowing defaults to apply and
|
|
85
|
-
* preventing validation errors for numeric or boolean types.
|
|
86
|
-
*
|
|
87
|
-
* @default false
|
|
88
|
-
*/
|
|
89
|
-
emptyAsUndefined?: boolean;
|
|
90
|
-
/**
|
|
91
|
-
* Whether to return a safe result object instead of throwing an error on validation failure.
|
|
92
|
-
*
|
|
93
|
-
* When enabled, the function returns an object with `{ success: true, data }` or `{ success: false, issues }`.
|
|
94
|
-
*
|
|
95
|
-
* @default false
|
|
96
|
-
*/
|
|
97
|
-
safe?: boolean;
|
|
98
|
-
};
|
|
99
|
-
/**
|
|
100
|
-
* Helper type to represent the output of parsing either an EnvSchema or CompiledEnvSchema.
|
|
101
|
-
*/
|
|
102
|
-
type ArkenvOutput<T extends SchemaShape, D> = distill.Out<type$1.infer<T, $>> | InferType<D>;
|
|
103
|
-
/**
|
|
104
|
-
* Utility to parse environment variables using ArkType or Standard Schema
|
|
105
|
-
*
|
|
106
|
-
* Naming convention: the main function is lowercase (`arkenv`) following the
|
|
107
|
-
* JavaScript convention for functions (e.g. `zod`, `joi`). Classes and types
|
|
108
|
-
* use PascalCase with the full product name (`ArkEnvError`, `SafeArkEnvResult`).
|
|
109
|
-
*
|
|
110
|
-
* @param def The schema definition
|
|
111
|
-
* @param config The evaluation configuration
|
|
112
|
-
* @returns The parsed environment variables, or a SafeArkEnvResult if `{ safe: true }` is configured
|
|
113
|
-
* @throws An {@link ArkEnvError | error} if the environment variables are invalid and `safe` is not enabled
|
|
114
|
-
*/
|
|
115
|
-
declare function arkenv<const T extends SchemaShape>(def: EnvSchema<T>, config?: ArkEnvConfig & {
|
|
116
|
-
safe?: false;
|
|
117
|
-
}): distill.Out<type$1.infer<T, $>>;
|
|
118
|
-
declare function arkenv<T extends CompiledEnvSchema>(def: T, config?: ArkEnvConfig & {
|
|
119
|
-
safe?: false;
|
|
120
|
-
}): InferType<T>;
|
|
121
|
-
declare function arkenv<const T extends SchemaShape, const D extends EnvSchema<T> | CompiledEnvSchema>(def: D, config?: ArkEnvConfig & {
|
|
122
|
-
safe?: false;
|
|
123
|
-
}): ArkenvOutput<T, D>;
|
|
124
|
-
declare function arkenv<const T extends SchemaShape>(def: EnvSchema<T>, config: ArkEnvConfig & {
|
|
125
|
-
safe: true;
|
|
126
|
-
}): SafeArkEnvResult<distill.Out<type$1.infer<T, $>>>;
|
|
127
|
-
declare function arkenv<T extends CompiledEnvSchema>(def: T, config: ArkEnvConfig & {
|
|
128
|
-
safe: true;
|
|
129
|
-
}): SafeArkEnvResult<InferType<T>>;
|
|
130
|
-
declare function arkenv<const T extends SchemaShape, const D extends EnvSchema<T> | CompiledEnvSchema>(def: D, config: ArkEnvConfig & {
|
|
131
|
-
safe: true;
|
|
132
|
-
}): SafeArkEnvResult<ArkenvOutput<T, D>>;
|
|
133
|
-
//#endregion
|
|
134
|
-
//#region src/schema.d.ts
|
|
135
|
-
/**
|
|
136
|
-
* Extract the keys from a schema definition dynamically.
|
|
137
|
-
* Supports plain objects, ArkType schemas, and Standard Schema validators.
|
|
138
|
-
*
|
|
139
|
-
* @param schema The schema definition to extract keys from
|
|
140
|
-
* @returns An array of extracted key names
|
|
141
|
-
* @internal
|
|
142
|
-
*/
|
|
143
|
-
declare function getSchemaKeys(schema: any): string[];
|
|
144
|
-
//#endregion
|
|
145
|
-
//#region src/index.d.ts
|
|
146
|
-
/**
|
|
147
|
-
* Like ArkType's `type`, but with ArkEnv's extra keywords, such as:
|
|
148
|
-
*
|
|
149
|
-
* - `string.host` – a hostname (e.g. `"localhost"`, `"127.0.0.1"`)
|
|
150
|
-
* - `number.port` – a port number (e.g. `8080`)
|
|
151
|
-
*
|
|
152
|
-
* See ArkType's docs for the full API:
|
|
153
|
-
* https://arktype.io/docs/type-api
|
|
154
|
-
*/
|
|
155
|
-
declare const type: _$arktype_internal_type_ts0.TypeParser<{
|
|
156
|
-
string: _$arktype.Submodule<{
|
|
157
|
-
trim: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.trim.$ & {
|
|
158
|
-
" arkInferred": (In: string) => _$arktype_internal_attributes_ts0.To<string>;
|
|
159
|
-
}>;
|
|
160
|
-
normalize: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.normalize.$ & {
|
|
161
|
-
" arkInferred": (In: string) => _$arktype_internal_attributes_ts0.To<string>;
|
|
162
|
-
}>;
|
|
163
|
-
root: string;
|
|
164
|
-
alpha: string;
|
|
165
|
-
alphanumeric: string;
|
|
166
|
-
hex: string;
|
|
167
|
-
base64: _$arktype.Submodule<{
|
|
168
|
-
root: string;
|
|
169
|
-
url: string;
|
|
170
|
-
} & {
|
|
171
|
-
" arkInferred": string;
|
|
172
|
-
}>;
|
|
173
|
-
capitalize: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.capitalize.$ & {
|
|
174
|
-
" arkInferred": (In: string) => _$arktype_internal_attributes_ts0.To<string>;
|
|
175
|
-
}>;
|
|
176
|
-
creditCard: string;
|
|
177
|
-
date: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.stringDate.$ & {
|
|
178
|
-
" arkInferred": string;
|
|
179
|
-
}>;
|
|
180
|
-
digits: string;
|
|
181
|
-
email: string;
|
|
182
|
-
integer: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.stringInteger.$ & {
|
|
183
|
-
" arkInferred": string;
|
|
184
|
-
}>;
|
|
185
|
-
ip: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.ip.$ & {
|
|
186
|
-
" arkInferred": string;
|
|
187
|
-
}>;
|
|
188
|
-
json: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.stringJson.$ & {
|
|
189
|
-
" arkInferred": string;
|
|
190
|
-
}>;
|
|
191
|
-
lower: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.lower.$ & {
|
|
192
|
-
" arkInferred": (In: string) => _$arktype_internal_attributes_ts0.To<string>;
|
|
193
|
-
}>;
|
|
194
|
-
numeric: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.stringNumeric.$ & {
|
|
195
|
-
" arkInferred": string;
|
|
196
|
-
}>;
|
|
197
|
-
regex: string;
|
|
198
|
-
semver: string;
|
|
199
|
-
upper: _$arktype.Submodule<{
|
|
200
|
-
root: (In: string) => _$arktype_internal_attributes_ts0.To<string>;
|
|
201
|
-
preformatted: string;
|
|
202
|
-
} & {
|
|
203
|
-
" arkInferred": (In: string) => _$arktype_internal_attributes_ts0.To<string>;
|
|
204
|
-
}>;
|
|
205
|
-
url: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.url.$ & {
|
|
206
|
-
" arkInferred": string;
|
|
207
|
-
}>;
|
|
208
|
-
uuid: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.uuid.$ & {
|
|
209
|
-
" arkInferred": string;
|
|
210
|
-
}>;
|
|
211
|
-
" arkInferred": string;
|
|
212
|
-
host: string;
|
|
213
|
-
}>;
|
|
214
|
-
number: _$arktype.Submodule<{
|
|
215
|
-
NaN: number;
|
|
216
|
-
Infinity: number;
|
|
217
|
-
root: number;
|
|
218
|
-
integer: number;
|
|
219
|
-
" arkInferred": number;
|
|
220
|
-
epoch: number;
|
|
221
|
-
safe: number;
|
|
222
|
-
NegativeInfinity: number;
|
|
223
|
-
port: number;
|
|
224
|
-
}>;
|
|
225
|
-
}>;
|
|
226
|
-
//#endregion
|
|
227
|
-
export { type ArkEnvConfig, type EnvSchema, type Infer, type SafeArkEnvResult, arkenv, arkenv as default, getSchemaKeys, type };
|
|
228
|
-
|
|
229
|
-
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/arkenv.ts","../src/schema.ts","../src/index.ts"],"mappings":";;;;;;;;;;;;;;AA0BA;;;;;;;;;KAAY,SAAA,QAAiB,MAAA,CAAG,QAAA,CAAS,GAAA,EAAK,CAAA;;;;;;AAQ9C;KAAY,KAAA,MAAW,CAAA,SAAU,WAAA,GAC9B,OAAA,CAAQ,GAAA,CAAI,MAAA,CAAG,KAAA,CAAM,C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EACL,MAAA,EAAQ,YAAA;EAAiB,IAAA;AAAA,IACvB,gBAAA,CAAiB,SAAA,CAAU,CAAA;AAAA,iBACd,MAAA,iBACC,WAAA,kBACA,SAAA,CAAU,CAAA,IAAK,iBAAA,CAAA,CAE/B,GAAA,EAAK,CAAA,EACL,MAAA,EAAQ,YAAA;EAAiB,IAAA;AAAA,IACvB,gBAAA,CAAiB,YAAA,CAAa,CAAA,EAAG,CAAA;;;;;;;;;;;iBCrJpB,aAAA,CAAc,MAAA;;;;;;;;;ADiB9B;;;cEZa,IAAA,8BAAI,UAAA"}
|
package/dist/index.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{a as e,c as t,l as n,r,s as i,t as a}from"./errors-C_uh86xh.mjs";import{t as o}from"./core-A65KioHX.mjs";import{ArkErrors as s,scope as c,type as l}from"arktype";const u=l(`0 <= number.integer <= 65535`),d=l(`string.ip | 'localhost'`),f=c({string:l.module({...l.keywords.string,host:d}),number:l.module({...l.keywords.number,port:u})});function p(t,n){return Object.entries(t.byPath).map(([t,o])=>{let s=o.message,c=s.trimStart();if(c.length>0&&`:.-`.includes(c[0])&&(c=c.slice(1).trimStart()),c.toLowerCase().startsWith(t.toLowerCase())){let e=c.slice(t.length).trimStart();e.length>0&&`:.-`.includes(e[0])&&(e=e.slice(1)),s=e.trimStart()}s=i(s,t,n?.debugSecrets);let l=e(o.code),u={...r(o)};return a(t,s,l,u,o.expected,o.code===`required`?void 0:o.data)})}function m(e,t){let{env:r=process.env,coerce:i=!0,onUndeclaredKey:a=`delete`,arrayFormat:c=`comma`,emptyAsUndefined:l=!1}=t,u=(typeof e==`function`&&`assert`in e?e:f.type.raw(e)).onUndeclaredKey(a),{coercedEnv:d}=n(r,l,c,i?()=>({schema:u.in.toJsonSchema({fallback:e=>e.base}),hasSchema:!0}):void 0),m=u(d);if(m instanceof s)throw new o(p(m,t));return m}function h(e,n={}){return n.safe?t(()=>m(e,n)):m(e,n)}function g(e){if(!e||typeof e!=`object`&&typeof e!=`function`)return[];if(e.json&&typeof e.json==`object`&&e.json.domain===`object`){let t=[];if(Array.isArray(e.json.required))for(let n of e.json.required)n&&typeof n==`object`&&`key`in n&&t.push(n.key);if(Array.isArray(e.json.optional))for(let n of e.json.optional)n&&typeof n==`object`&&`key`in n&&t.push(n.key);return t}let t=e[`~standard`],n=typeof t?.jsonSchema?.input==`function`&&t.jsonSchema.input||typeof e.jsonSchema?.input==`function`&&e.jsonSchema.input;if(n)try{let e=n({target:`draft-07`});if(e&&typeof e==`object`&&e.properties)return Object.keys(e.properties)}catch{}if(typeof e.toJSONSchema==`function`)try{let t=e.toJSONSchema();if(t&&typeof t==`object`&&t.properties)return Object.keys(t.properties)}catch{}if(typeof e.toStandardJSONSchema?.v1==`function`)try{let t=e.toStandardJSONSchema.v1();if(t&&typeof t==`object`&&t.properties)return Object.keys(t.properties)}catch{}return Object.keys(e)}const _=f.type;var v=h;export{h as arkenv,v as default,g as getSchemaKeys,_ as type};
|
|
2
|
-
|
|
3
|
-
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["t","e","$","$"],"sources":["../../internal/scope/dist/index.js","../src/arktype/index.ts","../src/arkenv.ts","../src/schema.ts","../src/index.ts"],"sourcesContent":["import{scope as e,type as t}from\"arktype\";const n=t(`0 <= number.integer <= 65535`),r=t(`string.ip | 'localhost'`),i=e({string:t.module({...t.keywords.string,host:r}),number:t.module({...t.keywords.number,port:n})});export{i as $};\n//# sourceMappingURL=index.js.map","import { $ } from \"@repo/scope\";\nimport type { SchemaShape } from \"@repo/types\";\nimport type { distill } from \"arktype\";\nimport { ArkErrors } from \"arktype\";\nimport type { ArkEnvConfig, EnvSchema } from \"@/arkenv\";\nimport { coerceEnvironment } from \"@/coercion\";\nimport { ArkEnvError, type EnvIssue, type EnvIssueMeta } from \"@/core\";\nimport {\n\tbuildEnvIssue,\n\tgetArkTypeMeta,\n\tmapArkTypeCode,\n\tredactMessageWasValue,\n} from \"@/utils/errors\";\n\n/**\n * Re-export of ArkType's `distill` utilities.\n *\n * Exposed for internal use cases and type-level integrations.\n * ArkEnv does not add behavior or guarantees beyond what ArkType provides.\n *\n * @internal\n * @see https://github.com/arktypeio/arktype\n */\nexport type { distill };\n\n/**\n * Convert ArkType's `ArkErrors` (keyed by path) into a flat `EnvIssue[]`\n * suitable for `ArkEnvError`.\n *\n * @param errors The ArkType errors object to convert\n * @param config Optional ArkEnvConfig to read debugSecrets options\n * @returns An array of flattened validation issues\n *\n * @internal\n */\nfunction arkErrorsToIssues(\n\terrors: ArkErrors,\n\tconfig?: ArkEnvConfig,\n): EnvIssue[] {\n\treturn Object.entries(errors.byPath).map(([path, error]) => {\n\t\tlet message = error.message;\n\n\t\t// Strip leading path reference if ArkType included it in the message\n\t\tlet trimmed = message.trimStart();\n\t\tif (trimmed.length > 0 && \":.-\".includes(trimmed[0])) {\n\t\t\ttrimmed = trimmed.slice(1).trimStart();\n\t\t}\n\t\tif (trimmed.toLowerCase().startsWith(path.toLowerCase())) {\n\t\t\tlet rest = trimmed.slice(path.length).trimStart();\n\t\t\tif (rest.length > 0 && \":.-\".includes(rest[0])) {\n\t\t\t\trest = rest.slice(1);\n\t\t\t}\n\t\t\tmessage = rest.trimStart();\n\t\t}\n\n\t\t// Redact and style (was ...) inline values\n\t\tmessage = redactMessageWasValue(message, path, config?.debugSecrets);\n\n\t\t// Map code and metadata using centralized helpers\n\t\tconst code = mapArkTypeCode(error.code);\n\t\tconst bounds = getArkTypeMeta(error);\n\t\tconst meta: EnvIssueMeta = {\n\t\t\t...bounds,\n\t\t};\n\n\t\treturn buildEnvIssue(\n\t\t\tpath,\n\t\t\tmessage,\n\t\t\tcode,\n\t\t\tmeta,\n\t\t\terror.expected,\n\t\t\terror.code === \"required\" ? undefined : error.data,\n\t\t);\n\t});\n}\n\n/**\n * Parse and validate environment variables using ArkEnv's schema rules.\n *\n * This applies:\n * - schema validation\n * - optional coercion (strings → numbers, booleans, arrays)\n * - undeclared key handling\n *\n * On success, returns the validated environment object.\n * On failure, throws an {@link ArkEnvError}.\n *\n * This is a low-level utility used internally by ArkEnv.\n * Most users should prefer the default `arkenv()` export.\n *\n * @param def The ArkType schema definition to validate against\n * @param config The configuration object for parsing and coercion\n * @returns The parsed and validated environment variables\n * @throws {@link ArkEnvError} if validation fails\n *\n * @internal\n */\nexport function parse<const T extends SchemaShape>(\n\tdef: EnvSchema<T>,\n\tconfig: ArkEnvConfig,\n) {\n\tconst {\n\t\tenv = process.env,\n\t\tcoerce: shouldCoerce = true,\n\t\tonUndeclaredKey = \"delete\",\n\t\tarrayFormat = \"comma\",\n\t\temptyAsUndefined = false,\n\t} = config;\n\n\t// If def is a type definition (has assert method), use it directly\n\t// Otherwise, use raw() to convert the schema definition\n\tconst isCompiledType = typeof def === \"function\" && \"assert\" in def;\n\tconst schema = (isCompiledType ? def : $.type.raw(def)) as any;\n\n\t// Apply the `onUndeclaredKey` option\n\tconst schemaWithKeys = schema.onUndeclaredKey(onUndeclaredKey);\n\n\t// Optionally strip empty strings and apply coercion\n\tconst { coercedEnv } = coerceEnvironment(\n\t\tenv,\n\t\temptyAsUndefined,\n\t\tarrayFormat,\n\t\tshouldCoerce\n\t\t\t? () => {\n\t\t\t\t\tconst json = schemaWithKeys.in.toJsonSchema({\n\t\t\t\t\t\tfallback: (ctx: { base: unknown }) => ctx.base,\n\t\t\t\t\t});\n\t\t\t\t\treturn { schema: json, hasSchema: true };\n\t\t\t\t}\n\t\t\t: undefined,\n\t);\n\n\t// Validate the environment variables\n\tconst validatedEnv = schemaWithKeys(coercedEnv);\n\n\t// In ArkType 2.x, calling a type as a function returns the validated data or ArkErrors\n\tif (validatedEnv instanceof ArkErrors) {\n\t\tthrow new ArkEnvError(arkErrorsToIssues(validatedEnv, config));\n\t}\n\n\treturn validatedEnv;\n}\n","import type { $ } from \"@repo/scope\";\nimport type {\n\tCompiledEnvSchema,\n\tDict,\n\tInferType,\n\tSchemaShape,\n} from \"@repo/types\";\nimport type { type as at, distill } from \"arktype\";\nimport { parse } from \"./arktype\";\nimport { ArkEnvError, type SafeArkEnvResult } from \"./core\";\nimport { safeExecute } from \"./utils/errors\";\n\n/**\n * Declarative environment schema definition accepted by ArkEnv.\n *\n * Represents a declarative schema object mapping environment\n * variable names to schema definitions (e.g. ArkType DSL strings\n * or Standard Schema validators).\n *\n * This type is used to validate that a schema object is compatible with\n * ArkEnv’s validator scope before being compiled or parsed.\n *\n * Most users will provide schemas in this form.\n *\n * @template def - The schema shape object\n */\nexport type EnvSchema<def> = at.validate<def, $>;\n\n/**\n * Infer the validated and coerced environment object type from a schema.\n * Supports declarative schema shapes, compiled ArkType schemas, and Standard Schema validators.\n *\n * @template T - The schema type\n */\nexport type Infer<T> = T extends SchemaShape\n\t? distill.Out<at.infer<T, $>>\n\t: InferType<T>;\n\n/**\n * The environment variables passed to `arkenv`.\n * Uses `Dict<string>` to enforce\n * compile-time safety: all input environment variables must be strings\n * (or undefined), matching `process.env` semantics.\n */\ntype RuntimeEnvironment = Dict<string>;\n\n/**\n * Configuration options for `arkenv`\n */\nexport type ArkEnvConfig = {\n\t/**\n\t * The environment variables to parse. Defaults to `process.env`\n\t */\n\tenv?: RuntimeEnvironment;\n\t/**\n\t * Whether to coerce environment variables to their defined types. Defaults to `true`\n\t */\n\tcoerce?: boolean;\n\t/**\n\t * Control how ArkEnv handles environment variables that are not defined in your schema.\n\t *\n\t * Defaults to `'delete'` to ensure your output object only contains\n\t * keys you've explicitly declared. This differs from ArkType's standard behavior, which\n\t * mirrors TypeScript by defaulting to `'ignore'`.\n\t *\n\t * - `delete` (ArkEnv default): Undeclared keys are allowed on input but stripped from the output.\n\t * - `ignore` (ArkType default): Undeclared keys are allowed and preserved in the output.\n\t * - `reject`: Undeclared keys will cause validation to fail.\n\t *\n\t * @default \"delete\"\n\t * @see https://arktype.io/docs/configuration#onundeclaredkey\n\t */\n\tonUndeclaredKey?: \"ignore\" | \"delete\" | \"reject\";\n\n\t/**\n\t * The format to use for array parsing when coercion is enabled.\n\t *\n\t * - `comma` (default): Strings are split by comma and trimmed.\n\t * - `json`: Strings are parsed as JSON.\n\t *\n\t * @default \"comma\"\n\t */\n\tarrayFormat?: \"comma\" | \"json\";\n\n\t/**\n\t * Whether to bypass secret redaction and print raw sensitive values during debugging.\n\t * Defaults to checking `process.env.ARKENV_DEBUG_SECRETS === \"true\"` or `\"1\"`.\n\t */\n\tdebugSecrets?: boolean;\n\n\t/**\n\t * Whether to treat empty strings (`\"\"`) as `undefined` before validation.\n\t *\n\t * When enabled, an environment variable set to an empty value (e.g. `PORT=`)\n\t * will be treated as if it were missing, allowing defaults to apply and\n\t * preventing validation errors for numeric or boolean types.\n\t *\n\t * @default false\n\t */\n\temptyAsUndefined?: boolean;\n\n\t/**\n\t * Whether to return a safe result object instead of throwing an error on validation failure.\n\t *\n\t * When enabled, the function returns an object with `{ success: true, data }` or `{ success: false, issues }`.\n\t *\n\t * @default false\n\t */\n\tsafe?: boolean;\n};\n\nexport type { SafeArkEnvResult };\n\n/**\n * Helper type to represent the output of parsing either an EnvSchema or CompiledEnvSchema.\n */\nexport type ArkenvOutput<T extends SchemaShape, D> =\n\t| distill.Out<at.infer<T, $>>\n\t| InferType<D>;\n\n/**\n * Utility to parse environment variables using ArkType or Standard Schema\n *\n * Naming convention: the main function is lowercase (`arkenv`) following the\n * JavaScript convention for functions (e.g. `zod`, `joi`). Classes and types\n * use PascalCase with the full product name (`ArkEnvError`, `SafeArkEnvResult`).\n *\n * @param def The schema definition\n * @param config The evaluation configuration\n * @returns The parsed environment variables, or a SafeArkEnvResult if `{ safe: true }` is configured\n * @throws An {@link ArkEnvError | error} if the environment variables are invalid and `safe` is not enabled\n */\nexport function arkenv<const T extends SchemaShape>(\n\tdef: EnvSchema<T>,\n\tconfig?: ArkEnvConfig & { safe?: false },\n): distill.Out<at.infer<T, $>>;\nexport function arkenv<T extends CompiledEnvSchema>(\n\tdef: T,\n\tconfig?: ArkEnvConfig & { safe?: false },\n): InferType<T>;\nexport function arkenv<\n\tconst T extends SchemaShape,\n\tconst D extends EnvSchema<T> | CompiledEnvSchema,\n>(def: D, config?: ArkEnvConfig & { safe?: false }): ArkenvOutput<T, D>;\nexport function arkenv<const T extends SchemaShape>(\n\tdef: EnvSchema<T>,\n\tconfig: ArkEnvConfig & { safe: true },\n): SafeArkEnvResult<distill.Out<at.infer<T, $>>>;\nexport function arkenv<T extends CompiledEnvSchema>(\n\tdef: T,\n\tconfig: ArkEnvConfig & { safe: true },\n): SafeArkEnvResult<InferType<T>>;\nexport function arkenv<\n\tconst T extends SchemaShape,\n\tconst D extends EnvSchema<T> | CompiledEnvSchema,\n>(\n\tdef: D,\n\tconfig: ArkEnvConfig & { safe: true },\n): SafeArkEnvResult<ArkenvOutput<T, D>>;\nexport function arkenv<\n\tconst T extends SchemaShape,\n\tconst D extends EnvSchema<T> | CompiledEnvSchema,\n>(\n\tdef: D,\n\tconfig: ArkEnvConfig = {},\n): ArkenvOutput<T, D> | SafeArkEnvResult<ArkenvOutput<T, D>> {\n\tif (config.safe) {\n\t\treturn safeExecute(() => parse(def as any, config));\n\t}\n\t// biome-ignore lint/suspicious/noExplicitAny: parse handles both EnvSchema<T> and CompiledEnvSchema at runtime\n\treturn parse(def as any, config);\n}\n","/**\n * Extract the keys from a schema definition dynamically.\n * Supports plain objects, ArkType schemas, and Standard Schema validators.\n *\n * @param schema The schema definition to extract keys from\n * @returns An array of extracted key names\n * @internal\n */\n// biome-ignore lint/suspicious/noExplicitAny: Need to handle various schema formats\nexport function getSchemaKeys(schema: any): string[] {\n\tif (!schema || (typeof schema !== \"object\" && typeof schema !== \"function\")) {\n\t\treturn [];\n\t}\n\n\t// ArkType Type\n\tif (\n\t\tschema.json &&\n\t\ttypeof schema.json === \"object\" &&\n\t\tschema.json.domain === \"object\"\n\t) {\n\t\tconst keys: string[] = [];\n\t\tif (Array.isArray(schema.json.required)) {\n\t\t\tfor (const r of schema.json.required) {\n\t\t\t\tif (r && typeof r === \"object\" && \"key\" in r) {\n\t\t\t\t\tkeys.push(r.key);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (Array.isArray(schema.json.optional)) {\n\t\t\tfor (const o of schema.json.optional) {\n\t\t\t\tif (o && typeof o === \"object\" && \"key\" in o) {\n\t\t\t\t\tkeys.push(o.key);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn keys;\n\t}\n\n\t// Standard Schema / JSON Schema fallback\n\tconst std = schema[\"~standard\"];\n\tconst jsonSchemaInput =\n\t\t(typeof std?.jsonSchema?.input === \"function\" && std.jsonSchema.input) ||\n\t\t(typeof schema.jsonSchema?.input === \"function\" && schema.jsonSchema.input);\n\n\tif (jsonSchemaInput) {\n\t\ttry {\n\t\t\tconst json = jsonSchemaInput({ target: \"draft-07\" });\n\t\t\tif (json && typeof json === \"object\" && json.properties) {\n\t\t\t\treturn Object.keys(json.properties);\n\t\t\t}\n\t\t} catch {}\n\t}\n\n\tif (typeof schema.toJSONSchema === \"function\") {\n\t\ttry {\n\t\t\tconst json = schema.toJSONSchema();\n\t\t\tif (json && typeof json === \"object\" && json.properties) {\n\t\t\t\treturn Object.keys(json.properties);\n\t\t\t}\n\t\t} catch {}\n\t}\n\n\tif (typeof schema.toStandardJSONSchema?.v1 === \"function\") {\n\t\ttry {\n\t\t\tconst json = schema.toStandardJSONSchema.v1();\n\t\t\tif (json && typeof json === \"object\" && json.properties) {\n\t\t\t\treturn Object.keys(json.properties);\n\t\t\t}\n\t\t} catch {}\n\t}\n\n\t// Plain object schema\n\treturn Object.keys(schema);\n}\n","import { $ } from \"@repo/scope\";\nimport { arkenv } from \"./arkenv\";\nimport { getSchemaKeys } from \"./schema\";\n\nexport { arkenv, getSchemaKeys };\n/**\n * Like ArkType's `type`, but with ArkEnv's extra keywords, such as:\n *\n * - `string.host` – a hostname (e.g. `\"localhost\"`, `\"127.0.0.1\"`)\n * - `number.port` – a port number (e.g. `8080`)\n *\n * See ArkType's docs for the full API:\n * https://arktype.io/docs/type-api\n */\nexport const type = $.type;\nexport type {\n\tArkEnvConfig,\n\tEnvSchema,\n\tInfer,\n\tSafeArkEnvResult,\n} from \"./arkenv\";\n\n/**\n * ArkEnv's main export, an alias for {@link arkenv}\n *\n * {@link https://arkenv.js.org | ArkEnv} is a typesafe environment variables validator from editor to runtime.\n */\nexport default arkenv;\n"],"mappings":"yKAA0C,MAAM,EAAEA,EAAE,+BAA+B,CAAC,EAAEA,EAAE,0BAA0B,CAAC,EAAEC,EAAE,CAAC,OAAOD,EAAE,OAAO,CAAC,GAAGA,EAAE,SAAS,OAAO,KAAK,EAAE,CAAC,CAAC,OAAOA,EAAE,OAAO,CAAC,GAAGA,EAAE,SAAS,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,CCmCvN,SAAS,EACR,EACA,EACa,CACb,OAAO,OAAO,QAAQ,EAAO,OAAO,CAAC,KAAK,CAAC,EAAM,KAAW,CAC3D,IAAI,EAAU,EAAM,QAGhB,EAAU,EAAQ,WAAW,CAIjC,GAHI,EAAQ,OAAS,GAAK,MAAM,SAAS,EAAQ,GAAG,GACnD,EAAU,EAAQ,MAAM,EAAE,CAAC,WAAW,EAEnC,EAAQ,aAAa,CAAC,WAAW,EAAK,aAAa,CAAC,CAAE,CACzD,IAAI,EAAO,EAAQ,MAAM,EAAK,OAAO,CAAC,WAAW,CAC7C,EAAK,OAAS,GAAK,MAAM,SAAS,EAAK,GAAG,GAC7C,EAAO,EAAK,MAAM,EAAE,EAErB,EAAU,EAAK,WAAW,CAI3B,EAAU,EAAsB,EAAS,EAAM,GAAQ,aAAa,CAGpE,IAAM,EAAO,EAAe,EAAM,KAAK,CAEjC,EAAqB,CAC1B,GAFc,EAAe,EAEpB,CACT,CAED,OAAO,EACN,EACA,EACA,EACA,EACA,EAAM,SACN,EAAM,OAAS,WAAa,IAAA,GAAY,EAAM,KAC9C,EACA,CAwBH,SAAgB,EACf,EACA,EACC,CACD,GAAM,C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,OAAQ,WAAY,CAAC,CACpD,GAAI,GAAQ,OAAO,GAAS,UAAY,EAAK,WAC5C,OAAO,OAAO,KAAK,EAAK,WAAW,MAE7B,EAGT,GAAI,OAAO,EAAO,cAAiB,WAClC,GAAI,CACH,IAAM,EAAO,EAAO,cAAc,CAClC,GAAI,GAAQ,OAAO,GAAS,UAAY,EAAK,WAC5C,OAAO,OAAO,KAAK,EAAK,WAAW,MAE7B,EAGT,GAAI,OAAO,EAAO,sBAAsB,IAAO,WAC9C,GAAI,CACH,IAAM,EAAO,EAAO,qBAAqB,IAAI,CAC7C,GAAI,GAAQ,OAAO,GAAS,UAAY,EAAK,WAC5C,OAAO,OAAO,KAAK,EAAK,WAAW,MAE7B,EAIT,OAAO,OAAO,KAAK,EAAO,CC1D3B,MAAa,EAAOC,EAAE,KAatB,IAAA,EAAe"}
|
package/dist/standard.cjs
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require(`./errors-Dn6WQ2pP.cjs`),t=require(`./core-CA13n2Iu.cjs`);function n(e,n){if(typeof n==`string`)throw new t.t([{path:e,message:`ArkType DSL strings are not supported in "standard" mode. Use a Standard Schema validator (e.g., Zod, Valibot) or import from "arkenv" for ArkType schemas.`,code:`INVALID_SCHEMA`}])}function r(e,n){let r=n&&typeof n==`object`&&`~standard`in n&&n[`~standard`];if(!r||typeof r!=`object`||!(`validate`in r)||typeof r.validate!=`function`)throw new t.t([{path:e,message:`Invalid validator: expected a Standard Schema 1.0 validator (must have "~standard" property). Import from "arkenv" to use ArkType schemas.`,code:`INVALID_SCHEMA`}])}function i(e){if(!e||typeof e!=`object`||Array.isArray(e))throw new t.t([{path:``,message:`Invalid schema: expected an object mapping in "standard" mode.`,code:`INVALID_SCHEMA`}])}function a(e){let t={type:`object`,properties:{}},n=!1,r=[];for(let i in e){let a=e[i];if(!a){r.push(i);continue}let o=a[`~standard`];if(typeof o?.jsonSchema?.input==`function`)try{let e=o.jsonSchema.input({target:`draft-07`});if(e){t.properties[i]=e,n=!0;continue}}catch{}if(typeof a.jsonSchema?.input==`function`)try{let e=a.jsonSchema.input({target:`draft-07`});if(e){t.properties[i]=e,n=!0;continue}}catch{}if(typeof a.toJSONSchema==`function`)try{let e=a.toJSONSchema();if(e){t.properties[i]=e,n=!0;continue}}catch{}if(typeof a.toStandardJSONSchema?.v1==`function`)try{let e=a.toStandardJSONSchema.v1();if(e){t.properties[i]=e,n=!0;continue}}catch{}r.push(i)}return{jsonSchema:t,hasJsonSchema:n,missingKeys:r}}function o(e){return typeof e==`object`&&e&&`key`in e?String(e.key):String(e)}function s(e,t){return!t||t.length===0?e:[e,...t.map(o)].join(`.`)}function c(e,t){let n=e,r;try{let i=e,a=e.trim();if(a[0]===`{`||a[0]===`[`)try{i=JSON.parse(e)}catch(e){r=`[Unparseable JSON: ${e.message}]`}if(!r){for(let e of t)i=i?.[o(e)];n=i}}catch(e){r=`[Traversal error: ${e.message}]`}return{receivedVal:n,traversalError:r}}function l(n,r){let{env:i=process.env,onUndeclaredKey:o=`delete`,coerce:l=!0,arrayFormat:u=`comma`,emptyAsUndefined:d=!1}=r,f={},p=[],{processedEnv:m,coercedEnv:h,missingKeys:g}=e.l(i,d,u,l?()=>{let{jsonSchema:e,hasJsonSchema:t,missingKeys:r}=a(n);return{schema:e,hasSchema:t,missingKeys:r}}:void 0),_=new Set(Object.keys(m));for(let i in n){let a=n[i],o=h[i];if(!a||typeof a!=`object`||!(`~standard`in a))throw new t.t([e.t(i,`Invalid schema: expected a Standard Schema 1.0 validator (e.g. Zod, Valibot) in 'standard' mode.`,`INVALID_SCHEMA`)]);let u=a[`~standard`].validate(o);if(u instanceof Promise)throw new t.t([e.t(i,`Async validation is not supported. ArkEnv is synchronous.`,`INVALID_SCHEMA`)]);if(u.issues)for(let t of u.issues){let n=s(i,t.path),a,o;if(i in m){let e=m[i];if(typeof e==`string`&&t.path?.length){let n=c(e,t.path);a=n.receivedVal,o=n.traversalError}else a=e}else a=t.received;let u=e.o(t.code||`invalid_type`,t.message||``,a),d=t.expected||void 0,f={...e.i(t)},h=t;h.validation!==void 0&&(f.validation=h.validation),o!==void 0&&(f.traversalError=o);let _=e.n(t.message||``,u,d,a,n,r);l&&g.includes(i)&&(_+=` (Hint: coercion is enabled by default, but the validator for '${i}' lacks Standard JSON Schema support.)`),p.push(e.t(n,_,u,f,d,a))}else f[i]=u.value;_.delete(i)}if(o!==`delete`)for(let t of _)o===`reject`?p.push(e.t(t,`Undeclared key`,`UNDECLARED_KEY`)):o===`ignore`&&(f[t]=h[t]);if(p.length>0)throw new t.t(p);return f}function u(t,a={}){i(t);for(let e in t){let i=t[e];n(e,i),r(e,i)}return a.safe?e.c(()=>l(t,a)):l(t,a)}exports.arkenv=u,exports.default=u;
|
|
2
|
-
|
|
3
|
-
// CJS Interop Shim
|
|
4
|
-
if (module.exports && module.exports.default) {
|
|
5
|
-
Object.assign(module.exports.default, module.exports);
|
|
6
|
-
module.exports = module.exports.default;
|
|
7
|
-
}
|
|
8
|
-
|
package/dist/standard.d.cts
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import { a as SafeArkEnvResult } from "./core-7-JO-N-w.cjs";
|
|
2
|
-
import { a as Dict, i as StandardSchemaV1 } from "./index-Do-2CL1V.cjs";
|
|
3
|
-
|
|
4
|
-
//#region src/parse-standard.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* Configuration options for {@link parseStandard}.
|
|
7
|
-
*/
|
|
8
|
-
type ParseStandardConfig = {
|
|
9
|
-
/**
|
|
10
|
-
* The environment variables to parse. Defaults to `process.env`
|
|
11
|
-
*/
|
|
12
|
-
env?: Dict<string>;
|
|
13
|
-
/**
|
|
14
|
-
* Control how ArkEnv handles environment variables that are not defined in your schema.
|
|
15
|
-
*
|
|
16
|
-
* Defaults to `'delete'` to ensure your output object only contains
|
|
17
|
-
* keys you've explicitly declared.
|
|
18
|
-
*
|
|
19
|
-
* - `delete` (ArkEnv default): Undeclared keys are allowed on input but stripped from the output.
|
|
20
|
-
* - `ignore`: Undeclared keys are allowed and preserved in the output.
|
|
21
|
-
* - `reject`: Undeclared keys will cause validation to fail.
|
|
22
|
-
*
|
|
23
|
-
* @default "delete"
|
|
24
|
-
*/
|
|
25
|
-
onUndeclaredKey?: "ignore" | "delete" | "reject";
|
|
26
|
-
/**
|
|
27
|
-
* Whether to bypass secret redaction and print raw sensitive values during debugging.
|
|
28
|
-
* Defaults to checking `process.env.ARKENV_DEBUG_SECRETS === "true"` or `"1"`.
|
|
29
|
-
*/
|
|
30
|
-
debugSecrets?: boolean;
|
|
31
|
-
/**
|
|
32
|
-
* Whether to perform best-effort coercion on the environment variables.
|
|
33
|
-
* Coercion requires validators that implement the StandardJSONSchemaV1 spec
|
|
34
|
-
* (e.g. Zod, Valibot).
|
|
35
|
-
*
|
|
36
|
-
* @see https://standard-schema.dev
|
|
37
|
-
* @default true
|
|
38
|
-
*/
|
|
39
|
-
coerce?: boolean;
|
|
40
|
-
/**
|
|
41
|
-
* The format to use for array parsing when coercion is enabled.
|
|
42
|
-
*
|
|
43
|
-
* - `comma` (default): Strings are split by comma and trimmed.
|
|
44
|
-
* - `json`: Strings are parsed as JSON.
|
|
45
|
-
*
|
|
46
|
-
* @default "comma"
|
|
47
|
-
*/
|
|
48
|
-
arrayFormat?: "comma" | "json";
|
|
49
|
-
/**
|
|
50
|
-
* Whether to treat empty strings (`""`) as `undefined` before validation.
|
|
51
|
-
*
|
|
52
|
-
* When enabled, an environment variable set to an empty value (e.g. `PORT=`)
|
|
53
|
-
* will be treated as if it were missing, allowing defaults to apply and
|
|
54
|
-
* preventing validation errors for numeric or boolean types.
|
|
55
|
-
*
|
|
56
|
-
* @default false
|
|
57
|
-
*/
|
|
58
|
-
emptyAsUndefined?: boolean;
|
|
59
|
-
/**
|
|
60
|
-
* Whether to return a safe result object instead of throwing an error on validation failure.
|
|
61
|
-
*
|
|
62
|
-
* When enabled, the function returns an object with `{ success: true, data }` or `{ success: false, issues }`.
|
|
63
|
-
*
|
|
64
|
-
* @default false
|
|
65
|
-
*/
|
|
66
|
-
safe?: boolean;
|
|
67
|
-
};
|
|
68
|
-
//#endregion
|
|
69
|
-
//#region src/standard.d.ts
|
|
70
|
-
/**
|
|
71
|
-
* Configuration options for the `arkenv/standard` entry's `arkenv`.
|
|
72
|
-
*/
|
|
73
|
-
type StandardEnvConfig = ParseStandardConfig;
|
|
74
|
-
/**
|
|
75
|
-
* Parse and validate environment variables using Standard Schema 1.0 validators (e.g. Zod, Valibot).
|
|
76
|
-
*
|
|
77
|
-
* This entry is ArkType-free - ArkType is never imported, even transitively.
|
|
78
|
-
* Use this when your project must not depend on ArkType.
|
|
79
|
-
*
|
|
80
|
-
* @param def An object mapping variable names to Standard Schema validators
|
|
81
|
-
* @param config Optional configuration
|
|
82
|
-
* @returns The validated environment variables, or a SafeArkEnvResult if `{ safe: true }` is configured
|
|
83
|
-
* @throws An {@link ArkEnvError} if validation fails and `safe` is not enabled
|
|
84
|
-
*
|
|
85
|
-
* @example
|
|
86
|
-
* ```ts
|
|
87
|
-
* import arkenv from "arkenv/standard";
|
|
88
|
-
* import { z } from "zod";
|
|
89
|
-
*
|
|
90
|
-
* const env = arkenv({
|
|
91
|
-
* PORT: z.coerce.number(),
|
|
92
|
-
* HOST: z.string(),
|
|
93
|
-
* });
|
|
94
|
-
* ```
|
|
95
|
-
*/
|
|
96
|
-
declare function arkenv<const T extends Record<string, StandardSchemaV1>>(def: T, config?: StandardEnvConfig & {
|
|
97
|
-
safe?: false;
|
|
98
|
-
}): { [K in keyof T]: StandardSchemaV1.InferOutput<T[K]> };
|
|
99
|
-
declare function arkenv<const T extends Record<string, StandardSchemaV1>>(def: T, config: StandardEnvConfig & {
|
|
100
|
-
safe: true;
|
|
101
|
-
}): SafeArkEnvResult<{ [K in keyof T]: StandardSchemaV1.InferOutput<T[K]> }>;
|
|
102
|
-
//#endregion
|
|
103
|
-
export { StandardEnvConfig, arkenv, arkenv as default };
|
|
104
|
-
|
|
105
|
-
// CJS Interop Shim
|
|
106
|
-
if (module.exports && module.exports.default) {
|
|
107
|
-
Object.assign(module.exports.default, module.exports);
|
|
108
|
-
module.exports = module.exports.default;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
//# sourceMappingURL=standard.d.cts.map
|
package/dist/standard.d.cts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"standard.d.cts","names":[],"sources":["../src/parse-standard.ts","../src/standard.ts"],"mappings":";;;;;;;KAqCY,mBAAA;EAAmB;;;EAI9B,GAAA,GAAM,IAAA;EAAA;;;;;;;;;;;;EAaN,eAAA;ECzC4B;;;;ED8C5B,YAAA;ECtBqB;;;;;;;;EDgCrB,MAAA;EC7BoB;;;;;;;;EDuCpB,WAAA;ECxC+B;;;;;;;;;EDmD/B,gBAAA;ECjDe;;;;;;;ED0Df,IAAA;AAAA;;;;AA9DD;;KCxBY,iBAAA,GAAoB,mBAAA;;;;;;;;;;;;;;;AAAhC;;;;;AAwBA;;;iBAAgB,MAAA,iBAAuB,MAAA,SAAe,gBAAA,EAAA,CACrD,GAAA,EAAK,CAAA,EACL,MAAA,GAAS,iBAAA;EAAsB,IAAA;AAAA,kBACf,CAAA,GAAI,gBAAA,CAAiB,WAAA,CAAY,CAAA,CAAE,CAAA;AAAA,iBACpC,MAAA,iBAAuB,MAAA,SAAe,gBAAA,EAAA,CACrD,GAAA,EAAK,CAAA,EACL,MAAA,EAAQ,iBAAA;EAAsB,IAAA;AAAA,IAC5B,gBAAA,eAA+B,CAAA,GAAI,gBAAA,CAAiB,WAAA,CAAY,CAAA,CAAE,CAAA"}
|
package/dist/standard.d.mts
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { a as SafeArkEnvResult } from "./core-BaGd9k2K.mjs";
|
|
2
|
-
import { a as Dict, i as StandardSchemaV1 } from "./index-NbQAnciD.mjs";
|
|
3
|
-
|
|
4
|
-
//#region src/parse-standard.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* Configuration options for {@link parseStandard}.
|
|
7
|
-
*/
|
|
8
|
-
type ParseStandardConfig = {
|
|
9
|
-
/**
|
|
10
|
-
* The environment variables to parse. Defaults to `process.env`
|
|
11
|
-
*/
|
|
12
|
-
env?: Dict<string>;
|
|
13
|
-
/**
|
|
14
|
-
* Control how ArkEnv handles environment variables that are not defined in your schema.
|
|
15
|
-
*
|
|
16
|
-
* Defaults to `'delete'` to ensure your output object only contains
|
|
17
|
-
* keys you've explicitly declared.
|
|
18
|
-
*
|
|
19
|
-
* - `delete` (ArkEnv default): Undeclared keys are allowed on input but stripped from the output.
|
|
20
|
-
* - `ignore`: Undeclared keys are allowed and preserved in the output.
|
|
21
|
-
* - `reject`: Undeclared keys will cause validation to fail.
|
|
22
|
-
*
|
|
23
|
-
* @default "delete"
|
|
24
|
-
*/
|
|
25
|
-
onUndeclaredKey?: "ignore" | "delete" | "reject";
|
|
26
|
-
/**
|
|
27
|
-
* Whether to bypass secret redaction and print raw sensitive values during debugging.
|
|
28
|
-
* Defaults to checking `process.env.ARKENV_DEBUG_SECRETS === "true"` or `"1"`.
|
|
29
|
-
*/
|
|
30
|
-
debugSecrets?: boolean;
|
|
31
|
-
/**
|
|
32
|
-
* Whether to perform best-effort coercion on the environment variables.
|
|
33
|
-
* Coercion requires validators that implement the StandardJSONSchemaV1 spec
|
|
34
|
-
* (e.g. Zod, Valibot).
|
|
35
|
-
*
|
|
36
|
-
* @see https://standard-schema.dev
|
|
37
|
-
* @default true
|
|
38
|
-
*/
|
|
39
|
-
coerce?: boolean;
|
|
40
|
-
/**
|
|
41
|
-
* The format to use for array parsing when coercion is enabled.
|
|
42
|
-
*
|
|
43
|
-
* - `comma` (default): Strings are split by comma and trimmed.
|
|
44
|
-
* - `json`: Strings are parsed as JSON.
|
|
45
|
-
*
|
|
46
|
-
* @default "comma"
|
|
47
|
-
*/
|
|
48
|
-
arrayFormat?: "comma" | "json";
|
|
49
|
-
/**
|
|
50
|
-
* Whether to treat empty strings (`""`) as `undefined` before validation.
|
|
51
|
-
*
|
|
52
|
-
* When enabled, an environment variable set to an empty value (e.g. `PORT=`)
|
|
53
|
-
* will be treated as if it were missing, allowing defaults to apply and
|
|
54
|
-
* preventing validation errors for numeric or boolean types.
|
|
55
|
-
*
|
|
56
|
-
* @default false
|
|
57
|
-
*/
|
|
58
|
-
emptyAsUndefined?: boolean;
|
|
59
|
-
/**
|
|
60
|
-
* Whether to return a safe result object instead of throwing an error on validation failure.
|
|
61
|
-
*
|
|
62
|
-
* When enabled, the function returns an object with `{ success: true, data }` or `{ success: false, issues }`.
|
|
63
|
-
*
|
|
64
|
-
* @default false
|
|
65
|
-
*/
|
|
66
|
-
safe?: boolean;
|
|
67
|
-
};
|
|
68
|
-
//#endregion
|
|
69
|
-
//#region src/standard.d.ts
|
|
70
|
-
/**
|
|
71
|
-
* Configuration options for the `arkenv/standard` entry's `arkenv`.
|
|
72
|
-
*/
|
|
73
|
-
type StandardEnvConfig = ParseStandardConfig;
|
|
74
|
-
/**
|
|
75
|
-
* Parse and validate environment variables using Standard Schema 1.0 validators (e.g. Zod, Valibot).
|
|
76
|
-
*
|
|
77
|
-
* This entry is ArkType-free - ArkType is never imported, even transitively.
|
|
78
|
-
* Use this when your project must not depend on ArkType.
|
|
79
|
-
*
|
|
80
|
-
* @param def An object mapping variable names to Standard Schema validators
|
|
81
|
-
* @param config Optional configuration
|
|
82
|
-
* @returns The validated environment variables, or a SafeArkEnvResult if `{ safe: true }` is configured
|
|
83
|
-
* @throws An {@link ArkEnvError} if validation fails and `safe` is not enabled
|
|
84
|
-
*
|
|
85
|
-
* @example
|
|
86
|
-
* ```ts
|
|
87
|
-
* import arkenv from "arkenv/standard";
|
|
88
|
-
* import { z } from "zod";
|
|
89
|
-
*
|
|
90
|
-
* const env = arkenv({
|
|
91
|
-
* PORT: z.coerce.number(),
|
|
92
|
-
* HOST: z.string(),
|
|
93
|
-
* });
|
|
94
|
-
* ```
|
|
95
|
-
*/
|
|
96
|
-
declare function arkenv<const T extends Record<string, StandardSchemaV1>>(def: T, config?: StandardEnvConfig & {
|
|
97
|
-
safe?: false;
|
|
98
|
-
}): { [K in keyof T]: StandardSchemaV1.InferOutput<T[K]> };
|
|
99
|
-
declare function arkenv<const T extends Record<string, StandardSchemaV1>>(def: T, config: StandardEnvConfig & {
|
|
100
|
-
safe: true;
|
|
101
|
-
}): SafeArkEnvResult<{ [K in keyof T]: StandardSchemaV1.InferOutput<T[K]> }>;
|
|
102
|
-
//#endregion
|
|
103
|
-
export { StandardEnvConfig, arkenv, arkenv as default };
|
|
104
|
-
|
|
105
|
-
//# sourceMappingURL=standard.d.mts.map
|
package/dist/standard.d.mts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"standard.d.mts","names":[],"sources":["../src/parse-standard.ts","../src/standard.ts"],"mappings":";;;;;;;KAqCY,mBAAA;EAAmB;;;EAI9B,GAAA,GAAM,IAAA;EAAA;;;;;;;;;;;;EAaN,eAAA;ECzC4B;;;;ED8C5B,YAAA;ECtBqB;;;;;;;;EDgCrB,MAAA;EC7BoB;;;;;;;;EDuCpB,WAAA;ECxC+B;;;;;;;;;EDmD/B,gBAAA;ECjDe;;;;;;;ED0Df,IAAA;AAAA;;;;AA9DD;;KCxBY,iBAAA,GAAoB,mBAAA;;;;;;;;;;;;;;;AAAhC;;;;;AAwBA;;;iBAAgB,MAAA,iBAAuB,MAAA,SAAe,gBAAA,EAAA,CACrD,GAAA,EAAK,CAAA,EACL,MAAA,GAAS,iBAAA;EAAsB,IAAA;AAAA,kBACf,CAAA,GAAI,gBAAA,CAAiB,WAAA,CAAY,CAAA,CAAE,CAAA;AAAA,iBACpC,MAAA,iBAAuB,MAAA,SAAe,gBAAA,EAAA,CACrD,GAAA,EAAK,CAAA,EACL,MAAA,EAAQ,iBAAA;EAAsB,IAAA;AAAA,IAC5B,gBAAA,eAA+B,CAAA,GAAI,gBAAA,CAAiB,WAAA,CAAY,CAAA,CAAE,CAAA"}
|
package/dist/standard.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{c as e,i as t,l as n,n as r,o as i,t as a}from"./errors-C_uh86xh.mjs";import{t as o}from"./core-A65KioHX.mjs";function s(e,t){if(typeof t==`string`)throw new o([{path:e,message:`ArkType DSL strings are not supported in "standard" mode. Use a Standard Schema validator (e.g., Zod, Valibot) or import from "arkenv" for ArkType schemas.`,code:`INVALID_SCHEMA`}])}function c(e,t){let n=t&&typeof t==`object`&&`~standard`in t&&t[`~standard`];if(!n||typeof n!=`object`||!(`validate`in n)||typeof n.validate!=`function`)throw new o([{path:e,message:`Invalid validator: expected a Standard Schema 1.0 validator (must have "~standard" property). Import from "arkenv" to use ArkType schemas.`,code:`INVALID_SCHEMA`}])}function l(e){if(!e||typeof e!=`object`||Array.isArray(e))throw new o([{path:``,message:`Invalid schema: expected an object mapping in "standard" mode.`,code:`INVALID_SCHEMA`}])}function u(e){let t={type:`object`,properties:{}},n=!1,r=[];for(let i in e){let a=e[i];if(!a){r.push(i);continue}let o=a[`~standard`];if(typeof o?.jsonSchema?.input==`function`)try{let e=o.jsonSchema.input({target:`draft-07`});if(e){t.properties[i]=e,n=!0;continue}}catch{}if(typeof a.jsonSchema?.input==`function`)try{let e=a.jsonSchema.input({target:`draft-07`});if(e){t.properties[i]=e,n=!0;continue}}catch{}if(typeof a.toJSONSchema==`function`)try{let e=a.toJSONSchema();if(e){t.properties[i]=e,n=!0;continue}}catch{}if(typeof a.toStandardJSONSchema?.v1==`function`)try{let e=a.toStandardJSONSchema.v1();if(e){t.properties[i]=e,n=!0;continue}}catch{}r.push(i)}return{jsonSchema:t,hasJsonSchema:n,missingKeys:r}}function d(e){return typeof e==`object`&&e&&`key`in e?String(e.key):String(e)}function f(e,t){return!t||t.length===0?e:[e,...t.map(d)].join(`.`)}function p(e,t){let n=e,r;try{let i=e,a=e.trim();if(a[0]===`{`||a[0]===`[`)try{i=JSON.parse(e)}catch(e){r=`[Unparseable JSON: ${e.message}]`}if(!r){for(let e of t)i=i?.[d(e)];n=i}}catch(e){r=`[Traversal error: ${e.message}]`}return{receivedVal:n,traversalError:r}}function m(e,s){let{env:c=process.env,onUndeclaredKey:l=`delete`,coerce:d=!0,arrayFormat:m=`comma`,emptyAsUndefined:h=!1}=s,g={},_=[],{processedEnv:v,coercedEnv:y,missingKeys:b}=n(c,h,m,d?()=>{let{jsonSchema:t,hasJsonSchema:n,missingKeys:r}=u(e);return{schema:t,hasSchema:n,missingKeys:r}}:void 0),x=new Set(Object.keys(v));for(let n in e){let c=e[n],l=y[n];if(!c||typeof c!=`object`||!(`~standard`in c))throw new o([a(n,`Invalid schema: expected a Standard Schema 1.0 validator (e.g. Zod, Valibot) in 'standard' mode.`,`INVALID_SCHEMA`)]);let u=c[`~standard`].validate(l);if(u instanceof Promise)throw new o([a(n,`Async validation is not supported. ArkEnv is synchronous.`,`INVALID_SCHEMA`)]);if(u.issues)for(let e of u.issues){let o=f(n,e.path),c,l;if(n in v){let t=v[n];if(typeof t==`string`&&e.path?.length){let n=p(t,e.path);c=n.receivedVal,l=n.traversalError}else c=t}else c=e.received;let u=i(e.code||`invalid_type`,e.message||``,c),m=e.expected||void 0,h={...t(e)},g=e;g.validation!==void 0&&(h.validation=g.validation),l!==void 0&&(h.traversalError=l);let y=r(e.message||``,u,m,c,o,s);d&&b.includes(n)&&(y+=` (Hint: coercion is enabled by default, but the validator for '${n}' lacks Standard JSON Schema support.)`),_.push(a(o,y,u,h,m,c))}else g[n]=u.value;x.delete(n)}if(l!==`delete`)for(let e of x)l===`reject`?_.push(a(e,`Undeclared key`,`UNDECLARED_KEY`)):l===`ignore`&&(g[e]=y[e]);if(_.length>0)throw new o(_);return g}function h(t,n={}){l(t);for(let e in t){let n=t[e];s(e,n),c(e,n)}return n.safe?e(()=>m(t,n)):m(t,n)}export{h as arkenv,h as default};
|
|
2
|
-
|
|
3
|
-
//# sourceMappingURL=standard.mjs.map
|
package/dist/standard.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"standard.mjs","names":[],"sources":["../src/guards.ts","../src/utils/standard-helpers.ts","../src/parse-standard.ts","../src/standard.ts"],"sourcesContent":["import { ArkEnvError } from \"./core\";\n\n/**\n * Throws if the given value is a string (ArkType DSL) in standard mode.\n * @internal\n */\nexport function assertNotArkTypeDsl(key: string, value: unknown): void {\n\tif (typeof value === \"string\") {\n\t\tthrow new ArkEnvError([\n\t\t\t{\n\t\t\t\tpath: key,\n\t\t\t\tmessage:\n\t\t\t\t\t'ArkType DSL strings are not supported in \"standard\" mode. Use a Standard Schema validator (e.g., Zod, Valibot) or import from \"arkenv\" for ArkType schemas.',\n\t\t\t\tcode: \"INVALID_SCHEMA\",\n\t\t\t},\n\t\t]);\n\t}\n}\n\n/**\n * Throws if the given value is not a well-formed Standard Schema validator\n * (must have a `~standard` property whose `validate` field is a function).\n * @internal\n */\nexport function assertStandardSchema(key: string, value: unknown): void {\n\tconst std =\n\t\tvalue &&\n\t\ttypeof value === \"object\" &&\n\t\t\"~standard\" in value &&\n\t\t(value as Record<string, unknown>)[\"~standard\"];\n\n\tif (\n\t\t!std ||\n\t\ttypeof std !== \"object\" ||\n\t\t!(\"validate\" in std) ||\n\t\ttypeof (std as Record<string, unknown>).validate !== \"function\"\n\t) {\n\t\tthrow new ArkEnvError([\n\t\t\t{\n\t\t\t\tpath: key,\n\t\t\t\tmessage:\n\t\t\t\t\t'Invalid validator: expected a Standard Schema 1.0 validator (must have \"~standard\" property). Import from \"arkenv\" to use ArkType schemas.',\n\t\t\t\tcode: \"INVALID_SCHEMA\",\n\t\t\t},\n\t\t]);\n\t}\n}\n\n/**\n * Throws if `def` is not a plain object (i.e. not a valid schema map).\n * @internal\n */\nexport function assertStandardSchemaMap(\n\tdef: unknown,\n): asserts def is Record<string, unknown> {\n\tif (!def || typeof def !== \"object\" || Array.isArray(def)) {\n\t\tthrow new ArkEnvError([\n\t\t\t{\n\t\t\t\tpath: \"\",\n\t\t\t\tmessage:\n\t\t\t\t\t'Invalid schema: expected an object mapping in \"standard\" mode.',\n\t\t\t\tcode: \"INVALID_SCHEMA\",\n\t\t\t},\n\t\t]);\n\t}\n}\n","/**\n * Extract JSON Schema definitions from standard schema validators.\n *\n * @param def The schema dictionary mapping keys to validators\n * @returns The generated JSON Schema, a flag indicating if any JSON Schema was found,\n * and a list of keys that do not support JSON Schema\n */\nexport function extractJsonSchema(def: Record<string, unknown>): {\n\tjsonSchema: Record<string, any>;\n\thasJsonSchema: boolean;\n\tmissingKeys: string[];\n} {\n\tconst jsonSchema: Record<string, any> = { type: \"object\", properties: {} };\n\tlet hasJsonSchema = false;\n\tconst missingKeys: string[] = [];\n\n\tfor (const key in def) {\n\t\tconst validator = def[key] as any;\n\t\tif (!validator) {\n\t\t\tmissingKeys.push(key);\n\t\t\tcontinue;\n\t\t}\n\n\t\t// 1. Standard way via ~standard property\n\t\tconst std = validator[\"~standard\"];\n\t\tif (typeof std?.jsonSchema?.input === \"function\") {\n\t\t\ttry {\n\t\t\t\tconst schema = std.jsonSchema.input({ target: \"draft-07\" });\n\t\t\t\tif (schema) {\n\t\t\t\t\tjsonSchema.properties[key] = schema;\n\t\t\t\t\thasJsonSchema = true;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t} catch {}\n\t\t}\n\n\t\t// 2. Direct jsonSchema.input on validator\n\t\tif (typeof validator.jsonSchema?.input === \"function\") {\n\t\t\ttry {\n\t\t\t\tconst schema = validator.jsonSchema.input({ target: \"draft-07\" });\n\t\t\t\tif (schema) {\n\t\t\t\t\tjsonSchema.properties[key] = schema;\n\t\t\t\t\thasJsonSchema = true;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t} catch {}\n\t\t}\n\n\t\t// 3. toJSONSchema method (e.g. zod mini, zod-to-json-schema)\n\t\tif (typeof validator.toJSONSchema === \"function\") {\n\t\t\ttry {\n\t\t\t\tconst schema = validator.toJSONSchema();\n\t\t\t\tif (schema) {\n\t\t\t\t\tjsonSchema.properties[key] = schema;\n\t\t\t\t\thasJsonSchema = true;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t} catch {}\n\t\t}\n\n\t\t// 4. toStandardJSONSchema.v1 method (e.g. stnl)\n\t\tif (typeof validator.toStandardJSONSchema?.v1 === \"function\") {\n\t\t\ttry {\n\t\t\t\tconst schema = validator.toStandardJSONSchema.v1();\n\t\t\t\tif (schema) {\n\t\t\t\t\tjsonSchema.properties[key] = schema;\n\t\t\t\t\thasJsonSchema = true;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t} catch {}\n\t\t}\n\n\t\tmissingKeys.push(key);\n\t}\n\n\treturn { jsonSchema, hasJsonSchema, missingKeys };\n}\n\n/**\n * Get the property key from a path segment.\n *\n * @param s The path segment which can be a key or a segment object\n * @returns The string representation of the property key\n */\nexport function getProp(\n\ts: string | number | symbol | { readonly key: string | number | symbol },\n): string {\n\treturn typeof s === \"object\" && s !== null && \"key\" in s\n\t\t? String(s.key)\n\t\t: String(s);\n}\n\n/**\n * Format standard schema validation issue path.\n *\n * @param key The base key of the environment variable\n * @param path The relative path segments of the issue\n * @returns The formatted dot-separated path string\n */\nexport function formatIssuePath(\n\tkey: string,\n\tpath:\n\t\t| readonly (\n\t\t\t\t| string\n\t\t\t\t| number\n\t\t\t\t| symbol\n\t\t\t\t| { readonly key: string | number | symbol }\n\t\t )[]\n\t\t| undefined,\n): string {\n\tif (!path || path.length === 0) return key;\n\treturn [key, ...path.map(getProp)].join(\".\");\n}\n\n/**\n * Traverse the raw string value (attempting to parse as JSON if it represents an object/array)\n * to extract the nested value targeted by the issue path.\n *\n * @param rawVal The raw string value of the environment variable\n * @param path The path segments of the validation issue\n * @returns An object containing the resolved nested value and an optional traversal error string\n */\nexport function traverseReceivedValue(\n\trawVal: string,\n\tpath: readonly (\n\t\t| string\n\t\t| number\n\t\t| symbol\n\t\t| { readonly key: string | number | symbol }\n\t)[],\n): { receivedVal: unknown; traversalError?: string | undefined } {\n\tlet receivedVal: unknown = rawVal;\n\tlet traversalError: string | undefined;\n\n\ttry {\n\t\tlet current: any = rawVal;\n\t\tconst trimmed = rawVal.trim();\n\t\tif (trimmed[0] === \"{\" || trimmed[0] === \"[\") {\n\t\t\ttry {\n\t\t\t\tcurrent = JSON.parse(rawVal);\n\t\t\t} catch (e: any) {\n\t\t\t\ttraversalError = `[Unparseable JSON: ${e.message}]`;\n\t\t\t}\n\t\t}\n\t\tif (!traversalError) {\n\t\t\tfor (const seg of path) {\n\t\t\t\tcurrent = current?.[getProp(seg)];\n\t\t\t}\n\t\t\treceivedVal = current;\n\t\t}\n\t} catch (e: any) {\n\t\ttraversalError = `[Traversal error: ${e.message}]`;\n\t}\n\n\treturn { receivedVal, traversalError };\n}\n","import type { Dict, StandardSchemaV1 } from \"@repo/types\";\nimport { coerceEnvironment } from \"@/coercion\";\nimport { ArkEnvError, type EnvIssue, type EnvIssueMeta } from \"./core\";\nimport {\n\tbuildEnvIssue,\n\tformatStandardIssueMessage,\n\tgetStandardMeta,\n\tmapStandardCode,\n} from \"./utils/errors\";\nimport {\n\textractJsonSchema,\n\tformatIssuePath,\n\ttraverseReceivedValue,\n} from \"./utils/standard-helpers\";\n\n/*\n * ⚠️ ARCHITECTURAL WARNING: DO NOT DRY THIS FILE ⚠️\n *\n * This file contains parsing logic that looks very similar to the code in\n * `src/arktype/index.ts`. **This duplication is 100% intentional.**\n *\n * `parse-standard.ts` powers the `arkenv/standard` module export. The entire\n * purpose of the `arkenv/standard` entrypoint is to guarantee a zero-dependency\n * environment for users utilizing Zod or Valibot, ensuring the `arktype` library\n * is NEVER included in their bundle.\n *\n * If you attempt to DRY up this code by merging it with the ArkType parser or\n * importing utilities from `src/arktype/*`, bundlers will statically trace those\n * imports and silently drag the entire ArkType library into the `arkenv/standard`\n * bundle.\n *\n * Prioritize strict module boundaries and tree-shaking over DRYness.\n */\n\n/**\n * Configuration options for {@link parseStandard}.\n */\nexport type ParseStandardConfig = {\n\t/**\n\t * The environment variables to parse. Defaults to `process.env`\n\t */\n\tenv?: Dict<string>;\n\t/**\n\t * Control how ArkEnv handles environment variables that are not defined in your schema.\n\t *\n\t * Defaults to `'delete'` to ensure your output object only contains\n\t * keys you've explicitly declared.\n\t *\n\t * - `delete` (ArkEnv default): Undeclared keys are allowed on input but stripped from the output.\n\t * - `ignore`: Undeclared keys are allowed and preserved in the output.\n\t * - `reject`: Undeclared keys will cause validation to fail.\n\t *\n\t * @default \"delete\"\n\t */\n\tonUndeclaredKey?: \"ignore\" | \"delete\" | \"reject\";\n\t/**\n\t * Whether to bypass secret redaction and print raw sensitive values during debugging.\n\t * Defaults to checking `process.env.ARKENV_DEBUG_SECRETS === \"true\"` or `\"1\"`.\n\t */\n\tdebugSecrets?: boolean;\n\n\t/**\n\t * Whether to perform best-effort coercion on the environment variables.\n\t * Coercion requires validators that implement the StandardJSONSchemaV1 spec\n\t * (e.g. Zod, Valibot).\n\t *\n\t * @see https://standard-schema.dev\n\t * @default true\n\t */\n\tcoerce?: boolean;\n\n\t/**\n\t * The format to use for array parsing when coercion is enabled.\n\t *\n\t * - `comma` (default): Strings are split by comma and trimmed.\n\t * - `json`: Strings are parsed as JSON.\n\t *\n\t * @default \"comma\"\n\t */\n\tarrayFormat?: \"comma\" | \"json\";\n\n\t/**\n\t * Whether to treat empty strings (`\"\"`) as `undefined` before validation.\n\t *\n\t * When enabled, an environment variable set to an empty value (e.g. `PORT=`)\n\t * will be treated as if it were missing, allowing defaults to apply and\n\t * preventing validation errors for numeric or boolean types.\n\t *\n\t * @default false\n\t */\n\temptyAsUndefined?: boolean;\n\n\t/**\n\t * Whether to return a safe result object instead of throwing an error on validation failure.\n\t *\n\t * When enabled, the function returns an object with `{ success: true, data }` or `{ success: false, issues }`.\n\t *\n\t * @default false\n\t */\n\tsafe?: boolean;\n};\n\n/**\n * Parse and validate environment variables using Standard Schema 1.0 validators.\n *\n * @param def An object mapping environment variable keys to Standard Schema 1.0 validators\n * @param config Parsing options, including environment source, undeclared key handling, and coercion config\n * @returns The parsed and validated environment variables\n * @throws An ArkEnvError if validation fails\n */\nexport function parseStandard(\n\tdef: Record<string, unknown>,\n\tconfig: ParseStandardConfig,\n): Record<string, unknown> {\n\tconst {\n\t\tenv = process.env,\n\t\tonUndeclaredKey = \"delete\",\n\t\tcoerce = true,\n\t\tarrayFormat = \"comma\",\n\t\temptyAsUndefined = false,\n\t} = config;\n\tconst output: Record<string, unknown> = {};\n\tconst errors: EnvIssue[] = [];\n\n\tconst {\n\t\tprocessedEnv,\n\t\tcoercedEnv,\n\t\tmissingKeys: missingJsonSchemaKeys,\n\t} = coerceEnvironment(\n\t\tenv as Dict<string>,\n\t\temptyAsUndefined,\n\t\tarrayFormat,\n\t\tcoerce\n\t\t\t? () => {\n\t\t\t\t\tconst { jsonSchema, hasJsonSchema, missingKeys } =\n\t\t\t\t\t\textractJsonSchema(def);\n\t\t\t\t\treturn {\n\t\t\t\t\t\tschema: jsonSchema,\n\t\t\t\t\t\thasSchema: hasJsonSchema,\n\t\t\t\t\t\tmissingKeys,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t: undefined,\n\t);\n\tconst envKeys = new Set(Object.keys(processedEnv));\n\n\t// 1. Validate declared keys\n\tfor (const key in def) {\n\t\tconst validator = def[key];\n\t\tconst value = coercedEnv[key];\n\n\t\t// Check if it's a Standard Schema validator\n\t\tif (\n\t\t\t!validator ||\n\t\t\ttypeof validator !== \"object\" ||\n\t\t\t!(\"~standard\" in validator)\n\t\t) {\n\t\t\tthrow new ArkEnvError([\n\t\t\t\tbuildEnvIssue(\n\t\t\t\t\tkey,\n\t\t\t\t\t`Invalid schema: expected a Standard Schema 1.0 validator (e.g. Zod, Valibot) in 'standard' mode.`,\n\t\t\t\t\t\"INVALID_SCHEMA\",\n\t\t\t\t),\n\t\t\t]);\n\t\t}\n\n\t\tconst result = (validator as StandardSchemaV1)[\"~standard\"].validate(value);\n\n\t\tif (result instanceof Promise) {\n\t\t\tthrow new ArkEnvError([\n\t\t\t\tbuildEnvIssue(\n\t\t\t\t\tkey,\n\t\t\t\t\t\"Async validation is not supported. ArkEnv is synchronous.\",\n\t\t\t\t\t\"INVALID_SCHEMA\",\n\t\t\t\t),\n\t\t\t]);\n\t\t}\n\n\t\tif (result.issues) {\n\t\t\tfor (const issue of result.issues) {\n\t\t\t\tconst issuePath = formatIssuePath(key, issue.path);\n\n\t\t\t\tlet receivedVal: unknown;\n\t\t\t\tlet traversalError: string | undefined;\n\n\t\t\t\tif (key in processedEnv) {\n\t\t\t\t\tconst rawVal = processedEnv[key];\n\t\t\t\t\tif (typeof rawVal === \"string\" && issue.path?.length) {\n\t\t\t\t\t\tconst traversed = traverseReceivedValue(rawVal, issue.path);\n\t\t\t\t\t\treceivedVal = traversed.receivedVal;\n\t\t\t\t\t\ttraversalError = traversed.traversalError;\n\t\t\t\t\t} else {\n\t\t\t\t\t\treceivedVal = rawVal;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\treceivedVal = (issue as any).received;\n\t\t\t\t}\n\n\t\t\t\tconst issueCode = (issue as any).code || \"invalid_type\";\n\t\t\t\tconst msg = issue.message || \"\";\n\t\t\t\tconst code = mapStandardCode(issueCode, msg, receivedVal);\n\n\t\t\t\tconst expected = (issue as any).expected || undefined;\n\t\t\t\tconst bounds = getStandardMeta(issue);\n\n\t\t\t\tconst meta: EnvIssueMeta = {\n\t\t\t\t\t...bounds,\n\t\t\t\t};\n\t\t\t\tconst iss = issue as any;\n\t\t\t\tif (iss.validation !== undefined) meta.validation = iss.validation;\n\t\t\t\tif (traversalError !== undefined) meta.traversalError = traversalError;\n\n\t\t\t\tlet message = formatStandardIssueMessage(\n\t\t\t\t\tissue.message || \"\",\n\t\t\t\t\tcode,\n\t\t\t\t\texpected,\n\t\t\t\t\treceivedVal,\n\t\t\t\t\tissuePath,\n\t\t\t\t\tconfig,\n\t\t\t\t);\n\n\t\t\t\tif (coerce && missingJsonSchemaKeys.includes(key)) {\n\t\t\t\t\tmessage += ` (Hint: coercion is enabled by default, but the validator for '${key}' lacks Standard JSON Schema support.)`;\n\t\t\t\t}\n\n\t\t\t\terrors.push(\n\t\t\t\t\tbuildEnvIssue(issuePath, message, code, meta, expected, receivedVal),\n\t\t\t\t);\n\t\t\t}\n\t\t} else {\n\t\t\toutput[key] = result.value;\n\t\t}\n\n\t\tenvKeys.delete(key);\n\t}\n\n\t// 2. Handle undeclared keys\n\tif (onUndeclaredKey !== \"delete\") {\n\t\tfor (const key of envKeys) {\n\t\t\tif (onUndeclaredKey === \"reject\") {\n\t\t\t\terrors.push(buildEnvIssue(key, \"Undeclared key\", \"UNDECLARED_KEY\"));\n\t\t\t} else if (onUndeclaredKey === \"ignore\") {\n\t\t\t\toutput[key] = coercedEnv[key];\n\t\t\t}\n\t\t}\n\t}\n\n\tif (errors.length > 0) {\n\t\tthrow new ArkEnvError(errors);\n\t}\n\n\treturn output;\n}\n","import type { StandardSchemaV1 } from \"@repo/types\";\nimport { ArkEnvError, type SafeArkEnvResult } from \"./core\";\nimport {\n\tassertNotArkTypeDsl,\n\tassertStandardSchema,\n\tassertStandardSchemaMap,\n} from \"./guards\";\nimport { type ParseStandardConfig, parseStandard } from \"./parse-standard\";\nimport { safeExecute } from \"./utils/errors\";\n\n/**\n * Configuration options for the `arkenv/standard` entry's `arkenv`.\n */\nexport type StandardEnvConfig = ParseStandardConfig;\n\n/**\n * Parse and validate environment variables using Standard Schema 1.0 validators (e.g. Zod, Valibot).\n *\n * This entry is ArkType-free - ArkType is never imported, even transitively.\n * Use this when your project must not depend on ArkType.\n *\n * @param def An object mapping variable names to Standard Schema validators\n * @param config Optional configuration\n * @returns The validated environment variables, or a SafeArkEnvResult if `{ safe: true }` is configured\n * @throws An {@link ArkEnvError} if validation fails and `safe` is not enabled\n *\n * @example\n * ```ts\n * import arkenv from \"arkenv/standard\";\n * import { z } from \"zod\";\n *\n * const env = arkenv({\n * PORT: z.coerce.number(),\n * HOST: z.string(),\n * });\n * ```\n */\nexport function arkenv<const T extends Record<string, StandardSchemaV1>>(\n\tdef: T,\n\tconfig?: StandardEnvConfig & { safe?: false },\n): { [K in keyof T]: StandardSchemaV1.InferOutput<T[K]> };\nexport function arkenv<const T extends Record<string, StandardSchemaV1>>(\n\tdef: T,\n\tconfig: StandardEnvConfig & { safe: true },\n): SafeArkEnvResult<{ [K in keyof T]: StandardSchemaV1.InferOutput<T[K]> }>;\nexport function arkenv<const T extends Record<string, StandardSchemaV1>>(\n\tdef: T,\n\tconfig: StandardEnvConfig = {},\n):\n\t| { [K in keyof T]: StandardSchemaV1.InferOutput<T[K]> }\n\t| SafeArkEnvResult<{ [K in keyof T]: StandardSchemaV1.InferOutput<T[K]> }> {\n\tassertStandardSchemaMap(def);\n\n\tfor (const key in def) {\n\t\tconst validator = (def as Record<string, unknown>)[key];\n\t\tassertNotArkTypeDsl(key, validator);\n\t\tassertStandardSchema(key, validator);\n\t}\n\n\tif (config.safe) {\n\t\treturn safeExecute(\n\t\t\t() =>\n\t\t\t\tparseStandard(def as Record<string, unknown>, config) as {\n\t\t\t\t\t[K in keyof T]: StandardSchemaV1.InferOutput<T[K]>;\n\t\t\t\t},\n\t\t);\n\t}\n\n\treturn parseStandard(def as Record<string, unknown>, config) as {\n\t\t[K in keyof T]: StandardSchemaV1.InferOutput<T[K]>;\n\t};\n}\n\n/**\n * ArkEnv's Standard Schema export\n *\n * {@link https://arkenv.js.org | ArkEnv} is a typesafe environment variables validator from editor to runtime.\n */\nexport default arkenv;\n"],"mappings":"qHAMA,SAAgB,EAAoB,EAAa,EAAsB,CACtE,GAAI,OAAO,GAAU,SACpB,MAAM,IAAI,EAAY,CACrB,CACC,KAAM,EACN,QACC,8JACD,KAAM,iBACN,CACD,CAAC,CASJ,SAAgB,EAAqB,EAAa,EAAsB,CACvE,IAAM,EACL,GACA,OAAO,GAAU,UACjB,cAAe,GACd,EAAkC,aAEpC,GACC,CAAC,GACD,OAAO,GAAQ,UACf,EAAE,aA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