arkenv 0.8.3 → 0.9.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/README.md +3 -3
- package/dist/arktype/index.cjs +1 -0
- package/dist/arktype/index.d.cts +109 -0
- package/dist/arktype/index.d.cts.map +1 -0
- package/dist/arktype/index.d.ts +109 -0
- package/dist/arktype/index.d.ts.map +1 -0
- package/dist/arktype/index.js +2 -0
- package/dist/arktype/index.js.map +1 -0
- package/dist/create-env-BPsNJfxy.d.cts +285 -0
- package/dist/create-env-BPsNJfxy.d.cts.map +1 -0
- package/dist/create-env-CFw1N3G1.d.ts +285 -0
- package/dist/create-env-CFw1N3G1.d.ts.map +1 -0
- package/dist/errors-DM9X9ICI.cjs +5 -0
- package/dist/errors-D_Q1KGgZ.js +6 -0
- package/dist/errors-D_Q1KGgZ.js.map +1 -0
- package/dist/index.cjs +1 -4
- package/dist/index.d.cts +29 -246
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +29 -246
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -4
- package/dist/index.js.map +1 -1
- package/package.json +24 -12
package/README.md
CHANGED
|
@@ -59,13 +59,13 @@ ArkEnvError: Errors found while validating environment variables
|
|
|
59
59
|
|
|
60
60
|
* Zero external dependencies
|
|
61
61
|
* Works in Node.js, Bun, and Vite
|
|
62
|
-
* Tiny: <
|
|
62
|
+
* Tiny: <3kB gzipped
|
|
63
63
|
* Build-time / runtime validation with editor autocomplete & type hints
|
|
64
64
|
* Single import, zero config for most projects
|
|
65
65
|
* Optional variables and default values
|
|
66
66
|
* Intuitive automatic coercion
|
|
67
67
|
* Compatible with any Standard Schema validator (Zod, Valibot, etc.)
|
|
68
|
-
* Native support for ArkType, TypeScript
|
|
68
|
+
* Native support for ArkType, TypeScript's 1\:1 validator
|
|
69
69
|
|
|
70
70
|
> See how ArkEnv compares to alternatives like T3 Env, znv, and envalid in the [comparison cheatsheet](https://arkenv.js.org/docs/arkenv/comparison#comparison-cheatsheet).
|
|
71
71
|
|
|
@@ -109,7 +109,7 @@ bun add arkenv arktype
|
|
|
109
109
|
|
|
110
110
|
:rocket: **Let's get started!** Read the [2-minute setup guide](https://arkenv.js.org/docs/quickstart) or [start with an example](https://arkenv.js.org/docs/examples).
|
|
111
111
|
|
|
112
|
-
> Improve your DX with _syntax highlighting_ in [VS Code](https://arkenv.js.org/docs/integrations/vscode), [Cursor, Antigravity](https://arkenv.js.org/docs/integrations/open-vsx), and [JetBrains IDEs](https://arkenv.js.org/docs/integrations/jetbrains).
|
|
112
|
+
> Improve your DX with _syntax highlighting_ in [VS Code](https://arkenv.js.org/docs/arkenv/integrations/api/vscode), [Cursor, Antigravity](https://arkenv.js.org/docs/arkenv/integrations/api/open-vsx), and [JetBrains IDEs](https://arkenv.js.org/docs/arkenv/integrations/api/jetbrains).
|
|
113
113
|
|
|
114
114
|
## Requirements
|
|
115
115
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`../errors-DM9X9ICI.cjs`);let t=require(`arktype`);const n=(0,t.type)(`0 <= number.integer <= 65535`),r=(0,t.type)(`string.ip | 'localhost'`),i=(0,t.scope)({string:t.type.module({...t.type.keywords.string,host:r}),number:t.type.module({...t.type.keywords.number,port:n})}),a=e=>{if(typeof e==`number`||typeof e!=`string`)return e;let t=e.trim();if(t===``)return e;if(t===`NaN`)return NaN;let n=Number(t);return Number.isNaN(n)?e:n},o=e=>e===`true`?!0:e===`false`?!1:e,s=e=>{if(typeof e!=`string`)return e;let t=e.trim();if(!t.startsWith(`{`)&&!t.startsWith(`[`))return e;try{return JSON.parse(t)}catch{return e}},c=`*`,l=(e,t=[])=>{let n=[];if(typeof e==`boolean`)return n;if(`const`in e&&(typeof e.const==`number`||typeof e.const==`boolean`)&&n.push({path:[...t],type:`primitive`}),`enum`in e&&e.enum&&e.enum.some(e=>typeof e==`number`||typeof e==`boolean`)&&n.push({path:[...t],type:`primitive`}),`type`in e)if(e.type===`number`||e.type===`integer`)n.push({path:[...t],type:`primitive`});else if(e.type===`boolean`)n.push({path:[...t],type:`primitive`});else if(e.type===`object`){if(`properties`in e&&e.properties&&Object.keys(e.properties).length>0&&n.push({path:[...t],type:`object`}),`properties`in e&&e.properties)for(let[r,i]of Object.entries(e.properties))n.push(...l(i,[...t,r]))}else e.type===`array`&&(n.push({path:[...t],type:`array`}),`items`in e&&e.items&&(Array.isArray(e.items)?e.items.forEach((e,r)=>{n.push(...l(e,[...t,`${r}`]))}):n.push(...l(e.items,[...t,`*`]))));if(`anyOf`in e&&e.anyOf)for(let r of e.anyOf)n.push(...l(r,t));if(`allOf`in e&&e.allOf)for(let r of e.allOf)n.push(...l(r,t));if(`oneOf`in e&&e.oneOf)for(let r of e.oneOf)n.push(...l(r,t));let r=new Set;return n.filter(e=>{let t=JSON.stringify(e.path)+e.type;return r.has(t)?!1:(r.add(t),!0)})},u=(e,t,n={})=>{let{arrayFormat:r=`comma`}=n,i=e=>{if(r===`json`)try{return JSON.parse(e)}catch{return e}return e.trim()?e.split(`,`).map(e=>e.trim()):[]};if(typeof e!=`object`||!e){if(t.some(e=>e.path.length===0)){let n=t.find(e=>e.path.length===0);if(n?.type===`object`&&typeof e==`string`)return s(e);if(n?.type===`array`&&typeof e==`string`)return i(e);let r=a(e);return typeof r==`number`?r:o(e)}return e}let c=[...t].sort((e,t)=>e.path.length-t.path.length),l=(e,t,n)=>{if(!e||typeof e!=`object`||t.length===0)return;if(t.length===1){let r=t[0];if(r===`*`){if(Array.isArray(e))for(let t=0;t<e.length;t++){let r=e[t];if(n===`primitive`){let n=a(r);typeof n==`number`?e[t]=n:e[t]=o(r)}else n===`object`&&(e[t]=s(r))}return}let c=e;if(Object.prototype.hasOwnProperty.call(c,r)){let e=c[r];if(n===`array`&&typeof e==`string`){c[r]=i(e);return}if(n===`object`&&typeof e==`string`){c[r]=s(e);return}if(Array.isArray(e)){if(n===`primitive`)for(let t=0;t<e.length;t++){let n=e[t],r=a(n);typeof r==`number`?e[t]=r:e[t]=o(n)}}else if(n===`primitive`){let t=a(e);typeof t==`number`?c[r]=t:c[r]=o(e)}}return}let[r,...c]=t;if(r===`*`){if(Array.isArray(e))for(let t of e)l(t,c,n);return}l(e[r],c,n)};for(let t of c)l(e,t.path,t.type);return e};function d(e,t,n){let r=l(t.in.toJsonSchema({fallback:e=>e.base}));return r.length===0?t:e(`unknown`).pipe(e=>u(e,r,n)).pipe(t)}const f=i.type;function p(n,r){let{env:a=process.env,coerce:o=!0,onUndeclaredKey:s=`delete`,arrayFormat:c=`comma`}=r,l=(typeof n==`function`&&`assert`in n?n:i.type.raw(n)).onUndeclaredKey(s),u=l;o&&(u=d(i.type,l,{arrayFormat:c}));let f=u(a);if(f instanceof t.ArkErrors)throw new e.t(f);return f}exports.parse=p,exports.type=f;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { i as SchemaShape, n as EnvSchema, t as ArkEnvConfig } from "../create-env-BPsNJfxy.cjs";
|
|
2
|
+
import * as arktype_internal_keywords_string_ts0 from "arktype/internal/keywords/string.ts";
|
|
3
|
+
import * as arktype_internal_attributes_ts0 from "arktype/internal/attributes.ts";
|
|
4
|
+
import * as arktype0 from "arktype";
|
|
5
|
+
import { distill } from "arktype";
|
|
6
|
+
import * as arktype_internal_type_ts0 from "arktype/internal/type.ts";
|
|
7
|
+
|
|
8
|
+
//#region src/arktype/index.d.ts
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Like ArkType’s `type`, but with ArkEnv’s extra keywords, such as:
|
|
12
|
+
*
|
|
13
|
+
* - `string.host` – a hostname (e.g. `"localhost"`, `"127.0.0.1"`)
|
|
14
|
+
* - `number.port` – a port number (e.g. `8080`)
|
|
15
|
+
*
|
|
16
|
+
* See ArkType’s docs for the full API:
|
|
17
|
+
* https://arktype.io/docs/type-api
|
|
18
|
+
*/
|
|
19
|
+
declare const type: arktype_internal_type_ts0.TypeParser<{
|
|
20
|
+
string: arktype0.Submodule<{
|
|
21
|
+
trim: arktype0.Submodule<arktype_internal_keywords_string_ts0.trim.$ & {
|
|
22
|
+
" arkInferred": (In: string) => arktype_internal_attributes_ts0.To<string>;
|
|
23
|
+
}>;
|
|
24
|
+
normalize: arktype0.Submodule<arktype_internal_keywords_string_ts0.normalize.$ & {
|
|
25
|
+
" arkInferred": (In: string) => arktype_internal_attributes_ts0.To<string>;
|
|
26
|
+
}>;
|
|
27
|
+
root: string;
|
|
28
|
+
alpha: string;
|
|
29
|
+
alphanumeric: string;
|
|
30
|
+
hex: string;
|
|
31
|
+
base64: arktype0.Submodule<{
|
|
32
|
+
root: string;
|
|
33
|
+
url: string;
|
|
34
|
+
} & {
|
|
35
|
+
" arkInferred": string;
|
|
36
|
+
}>;
|
|
37
|
+
capitalize: arktype0.Submodule<arktype_internal_keywords_string_ts0.capitalize.$ & {
|
|
38
|
+
" arkInferred": (In: string) => arktype_internal_attributes_ts0.To<string>;
|
|
39
|
+
}>;
|
|
40
|
+
creditCard: string;
|
|
41
|
+
date: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringDate.$ & {
|
|
42
|
+
" arkInferred": string;
|
|
43
|
+
}>;
|
|
44
|
+
digits: string;
|
|
45
|
+
email: string;
|
|
46
|
+
integer: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringInteger.$ & {
|
|
47
|
+
" arkInferred": string;
|
|
48
|
+
}>;
|
|
49
|
+
ip: arktype0.Submodule<arktype_internal_keywords_string_ts0.ip.$ & {
|
|
50
|
+
" arkInferred": string;
|
|
51
|
+
}>;
|
|
52
|
+
json: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringJson.$ & {
|
|
53
|
+
" arkInferred": string;
|
|
54
|
+
}>;
|
|
55
|
+
lower: arktype0.Submodule<arktype_internal_keywords_string_ts0.lower.$ & {
|
|
56
|
+
" arkInferred": (In: string) => arktype_internal_attributes_ts0.To<string>;
|
|
57
|
+
}>;
|
|
58
|
+
numeric: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringNumeric.$ & {
|
|
59
|
+
" arkInferred": string;
|
|
60
|
+
}>;
|
|
61
|
+
regex: string;
|
|
62
|
+
semver: string;
|
|
63
|
+
upper: arktype0.Submodule<{
|
|
64
|
+
root: (In: string) => arktype_internal_attributes_ts0.To<string>;
|
|
65
|
+
preformatted: string;
|
|
66
|
+
} & {
|
|
67
|
+
" arkInferred": (In: string) => arktype_internal_attributes_ts0.To<string>;
|
|
68
|
+
}>;
|
|
69
|
+
url: arktype0.Submodule<arktype_internal_keywords_string_ts0.url.$ & {
|
|
70
|
+
" arkInferred": string;
|
|
71
|
+
}>;
|
|
72
|
+
uuid: arktype0.Submodule<arktype_internal_keywords_string_ts0.uuid.$ & {
|
|
73
|
+
" arkInferred": string;
|
|
74
|
+
}>;
|
|
75
|
+
" arkInferred": string;
|
|
76
|
+
host: string;
|
|
77
|
+
}>;
|
|
78
|
+
number: arktype0.Submodule<{
|
|
79
|
+
NaN: number;
|
|
80
|
+
Infinity: number;
|
|
81
|
+
root: number;
|
|
82
|
+
integer: number;
|
|
83
|
+
" arkInferred": number;
|
|
84
|
+
epoch: number;
|
|
85
|
+
safe: number;
|
|
86
|
+
NegativeInfinity: number;
|
|
87
|
+
port: number;
|
|
88
|
+
}>;
|
|
89
|
+
}>;
|
|
90
|
+
/**
|
|
91
|
+
* Parse and validate environment variables using ArkEnv’s schema rules.
|
|
92
|
+
*
|
|
93
|
+
* This applies:
|
|
94
|
+
* - schema validation
|
|
95
|
+
* - optional coercion (strings → numbers, booleans, arrays)
|
|
96
|
+
* - undeclared key handling
|
|
97
|
+
*
|
|
98
|
+
* On success, returns the validated environment object.
|
|
99
|
+
* On failure, throws an {@link ArkEnvError}.
|
|
100
|
+
*
|
|
101
|
+
* This is a low-level utility used internally by ArkEnv.
|
|
102
|
+
* Most users should prefer the default `arkenv()` export.
|
|
103
|
+
*
|
|
104
|
+
* @internal
|
|
105
|
+
*/
|
|
106
|
+
declare function parse<const T extends SchemaShape>(def: EnvSchema<T>, config: ArkEnvConfig): any;
|
|
107
|
+
//#endregion
|
|
108
|
+
export { type distill, parse, type };
|
|
109
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/arktype/index.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;;;;cA4Ba,gCAAI;;;;;;;;;;;;;;;;;;;sBAAA,CAAA,EAAA,EAAA,MAAA,EAAA,qCAAA,CAAA,MAAA,CAAA;IAAA,CAAA,CAAA;IAkBD,UAAK,EAAA,MAAA;IAAiB,IAAA,oBAAA,qDAAA;MACtB,cAAA,EAAA,MAAA;IAAV,CAAA,CAAA;IACG,MAAA,EAAA,MAAA;IAAY,KAAA,EAAA,MAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAFL,sBAAsB,kBAChC,UAAU,YACP"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { i as SchemaShape, n as EnvSchema, t as ArkEnvConfig } from "../create-env-CFw1N3G1.js";
|
|
2
|
+
import * as arktype0 from "arktype";
|
|
3
|
+
import { distill } from "arktype";
|
|
4
|
+
import * as arktype_internal_keywords_string_ts0 from "arktype/internal/keywords/string.ts";
|
|
5
|
+
import * as arktype_internal_attributes_ts0 from "arktype/internal/attributes.ts";
|
|
6
|
+
import * as arktype_internal_type_ts0 from "arktype/internal/type.ts";
|
|
7
|
+
|
|
8
|
+
//#region src/arktype/index.d.ts
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Like ArkType’s `type`, but with ArkEnv’s extra keywords, such as:
|
|
12
|
+
*
|
|
13
|
+
* - `string.host` – a hostname (e.g. `"localhost"`, `"127.0.0.1"`)
|
|
14
|
+
* - `number.port` – a port number (e.g. `8080`)
|
|
15
|
+
*
|
|
16
|
+
* See ArkType’s docs for the full API:
|
|
17
|
+
* https://arktype.io/docs/type-api
|
|
18
|
+
*/
|
|
19
|
+
declare const type: arktype_internal_type_ts0.TypeParser<{
|
|
20
|
+
string: arktype0.Submodule<{
|
|
21
|
+
trim: arktype0.Submodule<arktype_internal_keywords_string_ts0.trim.$ & {
|
|
22
|
+
" arkInferred": (In: string) => arktype_internal_attributes_ts0.To<string>;
|
|
23
|
+
}>;
|
|
24
|
+
normalize: arktype0.Submodule<arktype_internal_keywords_string_ts0.normalize.$ & {
|
|
25
|
+
" arkInferred": (In: string) => arktype_internal_attributes_ts0.To<string>;
|
|
26
|
+
}>;
|
|
27
|
+
root: string;
|
|
28
|
+
alpha: string;
|
|
29
|
+
alphanumeric: string;
|
|
30
|
+
hex: string;
|
|
31
|
+
base64: arktype0.Submodule<{
|
|
32
|
+
root: string;
|
|
33
|
+
url: string;
|
|
34
|
+
} & {
|
|
35
|
+
" arkInferred": string;
|
|
36
|
+
}>;
|
|
37
|
+
capitalize: arktype0.Submodule<arktype_internal_keywords_string_ts0.capitalize.$ & {
|
|
38
|
+
" arkInferred": (In: string) => arktype_internal_attributes_ts0.To<string>;
|
|
39
|
+
}>;
|
|
40
|
+
creditCard: string;
|
|
41
|
+
date: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringDate.$ & {
|
|
42
|
+
" arkInferred": string;
|
|
43
|
+
}>;
|
|
44
|
+
digits: string;
|
|
45
|
+
email: string;
|
|
46
|
+
integer: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringInteger.$ & {
|
|
47
|
+
" arkInferred": string;
|
|
48
|
+
}>;
|
|
49
|
+
ip: arktype0.Submodule<arktype_internal_keywords_string_ts0.ip.$ & {
|
|
50
|
+
" arkInferred": string;
|
|
51
|
+
}>;
|
|
52
|
+
json: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringJson.$ & {
|
|
53
|
+
" arkInferred": string;
|
|
54
|
+
}>;
|
|
55
|
+
lower: arktype0.Submodule<arktype_internal_keywords_string_ts0.lower.$ & {
|
|
56
|
+
" arkInferred": (In: string) => arktype_internal_attributes_ts0.To<string>;
|
|
57
|
+
}>;
|
|
58
|
+
numeric: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringNumeric.$ & {
|
|
59
|
+
" arkInferred": string;
|
|
60
|
+
}>;
|
|
61
|
+
regex: string;
|
|
62
|
+
semver: string;
|
|
63
|
+
upper: arktype0.Submodule<{
|
|
64
|
+
root: (In: string) => arktype_internal_attributes_ts0.To<string>;
|
|
65
|
+
preformatted: string;
|
|
66
|
+
} & {
|
|
67
|
+
" arkInferred": (In: string) => arktype_internal_attributes_ts0.To<string>;
|
|
68
|
+
}>;
|
|
69
|
+
url: arktype0.Submodule<arktype_internal_keywords_string_ts0.url.$ & {
|
|
70
|
+
" arkInferred": string;
|
|
71
|
+
}>;
|
|
72
|
+
uuid: arktype0.Submodule<arktype_internal_keywords_string_ts0.uuid.$ & {
|
|
73
|
+
" arkInferred": string;
|
|
74
|
+
}>;
|
|
75
|
+
" arkInferred": string;
|
|
76
|
+
host: string;
|
|
77
|
+
}>;
|
|
78
|
+
number: arktype0.Submodule<{
|
|
79
|
+
NaN: number;
|
|
80
|
+
Infinity: number;
|
|
81
|
+
root: number;
|
|
82
|
+
integer: number;
|
|
83
|
+
" arkInferred": number;
|
|
84
|
+
epoch: number;
|
|
85
|
+
safe: number;
|
|
86
|
+
NegativeInfinity: number;
|
|
87
|
+
port: number;
|
|
88
|
+
}>;
|
|
89
|
+
}>;
|
|
90
|
+
/**
|
|
91
|
+
* Parse and validate environment variables using ArkEnv’s schema rules.
|
|
92
|
+
*
|
|
93
|
+
* This applies:
|
|
94
|
+
* - schema validation
|
|
95
|
+
* - optional coercion (strings → numbers, booleans, arrays)
|
|
96
|
+
* - undeclared key handling
|
|
97
|
+
*
|
|
98
|
+
* On success, returns the validated environment object.
|
|
99
|
+
* On failure, throws an {@link ArkEnvError}.
|
|
100
|
+
*
|
|
101
|
+
* This is a low-level utility used internally by ArkEnv.
|
|
102
|
+
* Most users should prefer the default `arkenv()` export.
|
|
103
|
+
*
|
|
104
|
+
* @internal
|
|
105
|
+
*/
|
|
106
|
+
declare function parse<const T extends SchemaShape>(def: EnvSchema<T>, config: ArkEnvConfig): any;
|
|
107
|
+
//#endregion
|
|
108
|
+
export { type distill, parse, type };
|
|
109
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/arktype/index.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;;;;cA4Ba,gCAAI;;;;;;;;;;;;;;;;;;;sBAAA,CAAA,EAAA,EAAA,MAAA,EAAA,qCAAA,CAAA,MAAA,CAAA;IAAA,CAAA,CAAA;IAkBD,UAAK,EAAA,MAAA;IAAiB,IAAA,oBAAA,qDAAA;MACtB,cAAA,EAAA,MAAA;IAAV,CAAA,CAAA;IACG,MAAA,EAAA,MAAA;IAAY,KAAA,EAAA,MAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAFL,sBAAsB,kBAChC,UAAU,YACP"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{t as e}from"../errors-D_Q1KGgZ.js";import{ArkErrors as t,scope as n,type as r}from"arktype";const i=r(`0 <= number.integer <= 65535`),a=r(`string.ip | 'localhost'`),o=n({string:r.module({...r.keywords.string,host:a}),number:r.module({...r.keywords.number,port:i})}),s=e=>{if(typeof e==`number`||typeof e!=`string`)return e;let t=e.trim();if(t===``)return e;if(t===`NaN`)return NaN;let n=Number(t);return Number.isNaN(n)?e:n},c=e=>e===`true`?!0:e===`false`?!1:e,l=e=>{if(typeof e!=`string`)return e;let t=e.trim();if(!t.startsWith(`{`)&&!t.startsWith(`[`))return e;try{return JSON.parse(t)}catch{return e}},u=(e,t=[])=>{let n=[];if(typeof e==`boolean`)return n;if(`const`in e&&(typeof e.const==`number`||typeof e.const==`boolean`)&&n.push({path:[...t],type:`primitive`}),`enum`in e&&e.enum&&e.enum.some(e=>typeof e==`number`||typeof e==`boolean`)&&n.push({path:[...t],type:`primitive`}),`type`in e)if(e.type===`number`||e.type===`integer`)n.push({path:[...t],type:`primitive`});else if(e.type===`boolean`)n.push({path:[...t],type:`primitive`});else if(e.type===`object`){if(`properties`in e&&e.properties&&Object.keys(e.properties).length>0&&n.push({path:[...t],type:`object`}),`properties`in e&&e.properties)for(let[r,i]of Object.entries(e.properties))n.push(...u(i,[...t,r]))}else e.type===`array`&&(n.push({path:[...t],type:`array`}),`items`in e&&e.items&&(Array.isArray(e.items)?e.items.forEach((e,r)=>{n.push(...u(e,[...t,`${r}`]))}):n.push(...u(e.items,[...t,`*`]))));if(`anyOf`in e&&e.anyOf)for(let r of e.anyOf)n.push(...u(r,t));if(`allOf`in e&&e.allOf)for(let r of e.allOf)n.push(...u(r,t));if(`oneOf`in e&&e.oneOf)for(let r of e.oneOf)n.push(...u(r,t));let r=new Set;return n.filter(e=>{let t=JSON.stringify(e.path)+e.type;return r.has(t)?!1:(r.add(t),!0)})},d=(e,t,n={})=>{let{arrayFormat:r=`comma`}=n,i=e=>{if(r===`json`)try{return JSON.parse(e)}catch{return e}return e.trim()?e.split(`,`).map(e=>e.trim()):[]};if(typeof e!=`object`||!e){if(t.some(e=>e.path.length===0)){let n=t.find(e=>e.path.length===0);if(n?.type===`object`&&typeof e==`string`)return l(e);if(n?.type===`array`&&typeof e==`string`)return i(e);let r=s(e);return typeof r==`number`?r:c(e)}return e}let a=[...t].sort((e,t)=>e.path.length-t.path.length),o=(e,t,n)=>{if(!e||typeof e!=`object`||t.length===0)return;if(t.length===1){let r=t[0];if(r===`*`){if(Array.isArray(e))for(let t=0;t<e.length;t++){let r=e[t];if(n===`primitive`){let n=s(r);typeof n==`number`?e[t]=n:e[t]=c(r)}else n===`object`&&(e[t]=l(r))}return}let a=e;if(Object.prototype.hasOwnProperty.call(a,r)){let e=a[r];if(n===`array`&&typeof e==`string`){a[r]=i(e);return}if(n===`object`&&typeof e==`string`){a[r]=l(e);return}if(Array.isArray(e)){if(n===`primitive`)for(let t=0;t<e.length;t++){let n=e[t],r=s(n);typeof r==`number`?e[t]=r:e[t]=c(n)}}else if(n===`primitive`){let t=s(e);typeof t==`number`?a[r]=t:a[r]=c(e)}}return}let[r,...a]=t;if(r===`*`){if(Array.isArray(e))for(let t of e)o(t,a,n);return}o(e[r],a,n)};for(let t of a)o(e,t.path,t.type);return e};function f(e,t,n){let r=u(t.in.toJsonSchema({fallback:e=>e.base}));return r.length===0?t:e(`unknown`).pipe(e=>d(e,r,n)).pipe(t)}const p=o.type;function m(n,r){let{env:i=process.env,coerce:a=!0,onUndeclaredKey:s=`delete`,arrayFormat:c=`comma`}=r,l=(typeof n==`function`&&`assert`in n?n:o.type.raw(n)).onUndeclaredKey(s),u=l;a&&(u=f(o.type,l,{arrayFormat:c}));let d=u(i);if(d instanceof t)throw new e(d);return d}export{m as parse,p as type};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["t","e","n","results: CoercionTarget[]","i","type","$"],"sources":["../../../internal/scope/dist/index.js","../../src/arktype/coercion/morphs.ts","../../src/arktype/coercion/coerce.ts","../../src/arktype/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","/**\n * Attempt to coerce a value to a number.\n *\n * If the input is already a number, returns it unchanged.\n * If the input is a string that can be parsed as a number, returns the parsed number.\n * Otherwise, returns the original value unchanged.\n *\n * @internal\n * @param s - The value to coerce\n * @returns The coerced number or the original value\n */\nexport const coerceNumber = (s: unknown) => {\n\tif (typeof s === \"number\") return s;\n\tif (typeof s !== \"string\") return s;\n\tconst trimmed = s.trim();\n\tif (trimmed === \"\") return s;\n\tif (trimmed === \"NaN\") return Number.NaN;\n\tconst n = Number(trimmed);\n\treturn Number.isNaN(n) ? s : n;\n};\n\n/**\n * Attempt to coerce a value to a boolean.\n *\n * Convert the strings \"true\" and \"false\" to their boolean equivalents.\n * All other values are returned unchanged.\n *\n * @internal\n * @param s - The value to coerce\n * @returns The coerced boolean or the original value\n */\nexport const coerceBoolean = (s: unknown) => {\n\tif (s === \"true\") return true;\n\tif (s === \"false\") return false;\n\treturn s;\n};\n\n/**\n * Attempt to parse a value as JSON.\n *\n * If the input is a string that starts with `{` or `[` and can be parsed as JSON,\n * returns the parsed object or array. Otherwise, returns the original value unchanged.\n *\n * @internal\n * @param s - The value to parse\n * @returns The parsed JSON or the original value\n */\nexport const coerceJson = (s: unknown) => {\n\tif (typeof s !== \"string\") return s;\n\tconst trimmed = s.trim();\n\tif (!trimmed.startsWith(\"{\") && !trimmed.startsWith(\"[\")) return s;\n\ttry {\n\t\treturn JSON.parse(trimmed);\n\t} catch {\n\t\treturn s;\n\t}\n};\n","import type { BaseType, JsonSchema } from \"arktype\";\nimport { ArkEnvError } from \"../../errors.ts\";\nimport { coerceBoolean, coerceJson, coerceNumber } from \"./morphs.ts\";\n\n/**\n * A marker used in the coercion path to indicate that the target\n * is the *elements* of an array, rather than the array property itself.\n */\nconst ARRAY_ITEM_MARKER = \"*\";\n\n/**\n * @internal\n * Information about a path in the schema that requires coercion.\n */\ntype CoercionTarget = {\n\tpath: string[];\n\ttype: \"primitive\" | \"array\" | \"object\";\n};\n\n/**\n * Options for coercion behavior.\n */\nexport type CoerceOptions = {\n\t/**\n\t * format to use for array parsing\n\t * @default \"comma\"\n\t */\n\tarrayFormat?: \"comma\" | \"json\";\n};\n\n/**\n * Recursively find all paths in a JSON Schema that require coercion.\n * We prioritize \"number\", \"integer\", \"boolean\", \"array\", and \"object\" types.\n */\nconst findCoercionPaths = (\n\tnode: JsonSchema,\n\tpath: string[] = [],\n): CoercionTarget[] => {\n\tconst results: CoercionTarget[] = [];\n\n\tif (typeof node === \"boolean\") {\n\t\treturn results;\n\t}\n\n\tif (\"const\" in node) {\n\t\tif (typeof node.const === \"number\" || typeof node.const === \"boolean\") {\n\t\t\tresults.push({ path: [...path], type: \"primitive\" });\n\t\t}\n\t}\n\n\tif (\"enum\" in node && node.enum) {\n\t\tif (\n\t\t\tnode.enum.some((v) => typeof v === \"number\" || typeof v === \"boolean\")\n\t\t) {\n\t\t\tresults.push({ path: [...path], type: \"primitive\" });\n\t\t}\n\t}\n\n\tif (\"type\" in node) {\n\t\tif (node.type === \"number\" || node.type === \"integer\") {\n\t\t\tresults.push({ path: [...path], type: \"primitive\" });\n\t\t} else if (node.type === \"boolean\") {\n\t\t\tresults.push({ path: [...path], type: \"primitive\" });\n\t\t} else if (node.type === \"object\") {\n\t\t\t// Check if this object has properties defined\n\t\t\t// If it does, we want to coerce the whole object from a JSON string\n\t\t\t// But we also want to recursively check nested properties\n\t\t\tconst hasProperties =\n\t\t\t\t\"properties\" in node &&\n\t\t\t\tnode.properties &&\n\t\t\t\tObject.keys(node.properties).length > 0;\n\n\t\t\tif (hasProperties) {\n\t\t\t\t// Mark this path as needing object coercion (JSON parsing)\n\t\t\t\tresults.push({ path: [...path], type: \"object\" });\n\t\t\t}\n\n\t\t\t// Also recursively check nested properties for their own coercions\n\t\t\tif (\"properties\" in node && node.properties) {\n\t\t\t\tfor (const [key, prop] of Object.entries(node.properties)) {\n\t\t\t\t\tresults.push(\n\t\t\t\t\t\t...findCoercionPaths(prop as JsonSchema, [...path, key]),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (node.type === \"array\") {\n\t\t\t// Mark the array itself as a target for splitting strings\n\t\t\tresults.push({ path: [...path], type: \"array\" });\n\n\t\t\tif (\"items\" in node && node.items) {\n\t\t\t\tif (Array.isArray(node.items)) {\n\t\t\t\t\t// Tuple traversal\n\t\t\t\t\tnode.items.forEach((item, index) => {\n\t\t\t\t\t\tresults.push(\n\t\t\t\t\t\t\t...findCoercionPaths(item as JsonSchema, [...path, `${index}`]),\n\t\t\t\t\t\t);\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\t// List traversal\n\t\t\t\t\tresults.push(\n\t\t\t\t\t\t...findCoercionPaths(node.items as JsonSchema, [\n\t\t\t\t\t\t\t...path,\n\t\t\t\t\t\t\tARRAY_ITEM_MARKER,\n\t\t\t\t\t\t]),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif (\"anyOf\" in node && node.anyOf) {\n\t\tfor (const branch of node.anyOf) {\n\t\t\tresults.push(...findCoercionPaths(branch as JsonSchema, path));\n\t\t}\n\t}\n\n\tif (\"allOf\" in node && node.allOf) {\n\t\tfor (const branch of node.allOf) {\n\t\t\tresults.push(...findCoercionPaths(branch as JsonSchema, path));\n\t\t}\n\t}\n\n\tif (\"oneOf\" in node && node.oneOf) {\n\t\tfor (const branch of node.oneOf) {\n\t\t\tresults.push(...findCoercionPaths(branch as JsonSchema, path));\n\t\t}\n\t}\n\n\t// Deduplicate by path and type combination\n\tconst seen = new Set<string>();\n\treturn results.filter((t) => {\n\t\tconst key = JSON.stringify(t.path) + t.type;\n\t\tif (seen.has(key)) return false;\n\t\tseen.add(key);\n\t\treturn true;\n\t});\n};\n\n/**\n * Apply coercion to a data object based on identified paths.\n */\nconst applyCoercion = (\n\tdata: unknown,\n\ttargets: CoercionTarget[],\n\toptions: CoerceOptions = {},\n) => {\n\tconst { arrayFormat = \"comma\" } = options;\n\n\t// Helper to split string to array\n\tconst splitString = (val: string) => {\n\t\tif (arrayFormat === \"json\") {\n\t\t\ttry {\n\t\t\t\treturn JSON.parse(val);\n\t\t\t} catch {\n\t\t\t\treturn val;\n\t\t\t}\n\t\t}\n\n\t\tif (!val.trim()) return [];\n\t\treturn val.split(\",\").map((s) => s.trim());\n\t};\n\n\tif (typeof data !== \"object\" || data === null) {\n\t\t// If root data needs coercion\n\t\tif (targets.some((t) => t.path.length === 0)) {\n\t\t\tconst rootTarget = targets.find((t) => t.path.length === 0);\n\n\t\t\tif (rootTarget?.type === \"object\" && typeof data === \"string\") {\n\t\t\t\treturn coerceJson(data);\n\t\t\t}\n\n\t\t\tif (rootTarget?.type === \"array\" && typeof data === \"string\") {\n\t\t\t\treturn splitString(data);\n\t\t\t}\n\n\t\t\tconst asNumber = coerceNumber(data);\n\t\t\tif (typeof asNumber === \"number\") {\n\t\t\t\treturn asNumber;\n\t\t\t}\n\t\t\treturn coerceBoolean(data);\n\t\t}\n\t\treturn data;\n\t}\n\n\t// Sort targets by path length to ensure parent objects/arrays are coerced before their children\n\tconst sortedTargets = [...targets].sort(\n\t\t(a, b) => a.path.length - b.path.length,\n\t);\n\n\tconst walk = (\n\t\tcurrent: unknown,\n\t\ttargetPath: string[],\n\t\ttype: \"primitive\" | \"array\" | \"object\",\n\t) => {\n\t\tif (!current || typeof current !== \"object\") return;\n\n\t\tif (targetPath.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\t// If we've reached the last key, apply coercion\n\t\tif (targetPath.length === 1) {\n\t\t\tconst lastKey = targetPath[0];\n\n\t\t\tif (lastKey === ARRAY_ITEM_MARKER) {\n\t\t\t\tif (Array.isArray(current)) {\n\t\t\t\t\tfor (let i = 0; i < current.length; i++) {\n\t\t\t\t\t\tconst original = current[i];\n\t\t\t\t\t\tif (type === \"primitive\") {\n\t\t\t\t\t\t\tconst asNumber = coerceNumber(original);\n\t\t\t\t\t\t\tif (typeof asNumber === \"number\") {\n\t\t\t\t\t\t\t\tcurrent[i] = asNumber;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tcurrent[i] = coerceBoolean(original);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else if (type === \"object\") {\n\t\t\t\t\t\t\tcurrent[i] = coerceJson(original);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst record = current as Record<string, unknown>;\n\t\t\t// biome-ignore lint/suspicious/noPrototypeBuiltins: ES2020 compatibility\n\t\t\tif (Object.prototype.hasOwnProperty.call(record, lastKey)) {\n\t\t\t\tconst original = record[lastKey];\n\n\t\t\t\tif (type === \"array\" && typeof original === \"string\") {\n\t\t\t\t\trecord[lastKey] = splitString(original);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (type === \"object\" && typeof original === \"string\") {\n\t\t\t\t\trecord[lastKey] = coerceJson(original);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (Array.isArray(original)) {\n\t\t\t\t\tif (type === \"primitive\") {\n\t\t\t\t\t\tfor (let i = 0; i < original.length; i++) {\n\t\t\t\t\t\t\tconst item = original[i];\n\t\t\t\t\t\t\tconst asNumber = coerceNumber(item);\n\t\t\t\t\t\t\tif (typeof asNumber === \"number\") {\n\t\t\t\t\t\t\t\toriginal[i] = asNumber;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\toriginal[i] = coerceBoolean(item);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (type === \"primitive\") {\n\t\t\t\t\t\tconst asNumber = coerceNumber(original);\n\t\t\t\t\t\t// If numeric parsing didn't produce a number, try boolean coercion\n\t\t\t\t\t\tif (typeof asNumber === \"number\") {\n\t\t\t\t\t\t\trecord[lastKey] = asNumber;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\trecord[lastKey] = coerceBoolean(original);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t// Recurse down\n\t\tconst [nextKey, ...rest] = targetPath;\n\n\t\tif (nextKey === ARRAY_ITEM_MARKER) {\n\t\t\tif (Array.isArray(current)) {\n\t\t\t\tfor (const item of current) {\n\t\t\t\t\twalk(item, rest, type);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tconst record = current as Record<string, unknown>;\n\t\twalk(record[nextKey], rest, type);\n\t};\n\n\tfor (const target of sortedTargets) {\n\t\twalk(data, target.path, target.type);\n\t}\n\n\treturn data;\n};\n\n/**\n * Create a coercing wrapper around an ArkType schema using JSON Schema introspection.\n * Pre-process input data to coerce string values to numbers/booleans at identified paths\n * before validation.\n */\nexport function coerce<t, $ = {}>(\n\tat: any,\n\tschema: BaseType<t, $>,\n\toptions?: CoerceOptions,\n): BaseType<t, $> {\n\t// Use a fallback to handle unjsonifiable parts of the schema (like predicates)\n\t// by preserving the base schema. This ensures that even if part of the schema\n\t// cannot be fully represented in JSON Schema, we can still perform coercion\n\t// for the parts that can.\n\tconst json = schema.in.toJsonSchema({\n\t\tfallback: (ctx) => (ctx as any).base,\n\t});\n\tconst targets = findCoercionPaths(json as any);\n\n\tif (targets.length === 0) {\n\t\treturn schema;\n\t}\n\n\t/*\n\t * We use `type(\"unknown\")` to start the pipeline, which initializes a default scope.\n\t * Integrating the original `schema` with its custom scope `$` into this pipeline\n\t * creates a scope mismatch in TypeScript ({} vs $).\n\t * We cast to `BaseType<t, $>` to assert the final contract is maintained.\n\t */\n\treturn at(\"unknown\")\n\t\t.pipe((data: unknown) => applyCoercion(data, targets, options))\n\t\t.pipe(schema) as BaseType<t, $>;\n}\n","import { $ } from \"@repo/scope\";\nimport type { SchemaShape } from \"@repo/types\";\nimport type { distill } from \"arktype\";\nimport { ArkErrors } from \"arktype\";\nimport type { ArkEnvConfig, EnvSchema } from \"../create-env.ts\";\nimport { ArkEnvError } from \"../errors.ts\";\nimport { coerce } from \"./coercion/coerce.ts\";\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 * 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;\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 * @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} = 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// Apply coercion transformation to allow strings to be parsed as numbers/booleans\n\tlet finalSchema = schemaWithKeys;\n\tif (shouldCoerce) {\n\t\tfinalSchema = coerce($.type, schemaWithKeys, { arrayFormat });\n\t}\n\n\t// Validate the environment variables\n\tconst validatedEnv = finalSchema(env);\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(validatedEnv);\n\t}\n\n\treturn validatedEnv;\n}\n"],"mappings":"mGAA0C,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,CCW1M,EAA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,EAAOA,EAAE,KAAM,EAAgB,CAAE,cAAa,CAAC,EAI9D,IAAM,EAAe,EAAY,EAAI,CAGrC,GAAI,aAAwB,EAC3B,MAAM,IAAI,EAAY,EAAa,CAGpC,OAAO"}
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import * as arktype_internal_keywords_string_ts0 from "arktype/internal/keywords/string.ts";
|
|
2
|
+
import * as arktype_internal_attributes_ts0 from "arktype/internal/attributes.ts";
|
|
3
|
+
import * as arktype0 from "arktype";
|
|
4
|
+
import { Type, distill, type } from "arktype";
|
|
5
|
+
|
|
6
|
+
//#region ../internal/types/dist/helpers.d.ts
|
|
7
|
+
type Dict<T> = Record<string, T | undefined>;
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region ../internal/types/dist/standard-schema.d.ts
|
|
10
|
+
/**
|
|
11
|
+
* @see https://github.com/standard-schema/standard-schema/tree/3130ce43fdd848d9ab49dbb0458d04f18459961c/packages/spec
|
|
12
|
+
*
|
|
13
|
+
* Copied from standard-schema (MIT License)
|
|
14
|
+
* Copyright (c) 2024 Colin McDannell
|
|
15
|
+
*/
|
|
16
|
+
/** The Standard Typed interface. This is a base type extended by other specs. */
|
|
17
|
+
interface StandardTypedV1<Input = unknown, Output = Input> {
|
|
18
|
+
/** The Standard properties. */
|
|
19
|
+
readonly "~standard": StandardTypedV1.Props<Input, Output>;
|
|
20
|
+
}
|
|
21
|
+
declare namespace StandardTypedV1 {
|
|
22
|
+
/** The Standard Typed properties interface. */
|
|
23
|
+
interface Props<Input = unknown, Output = Input> {
|
|
24
|
+
/** The version number of the standard. */
|
|
25
|
+
readonly version: 1;
|
|
26
|
+
/** The vendor name of the schema library. */
|
|
27
|
+
readonly vendor: string;
|
|
28
|
+
/** Inferred types associated with the schema. */
|
|
29
|
+
readonly types?: Types<Input, Output> | undefined;
|
|
30
|
+
}
|
|
31
|
+
/** The Standard Typed types interface. */
|
|
32
|
+
interface Types<Input = unknown, Output = Input> {
|
|
33
|
+
/** The input type of the schema. */
|
|
34
|
+
readonly input: Input;
|
|
35
|
+
/** The output type of the schema. */
|
|
36
|
+
readonly output: Output;
|
|
37
|
+
}
|
|
38
|
+
/** Infers the input type of a Standard Typed. */
|
|
39
|
+
type InferInput<Schema extends StandardTypedV1> = NonNullable<Schema["~standard"]["types"]>["input"];
|
|
40
|
+
/** Infers the output type of a Standard Typed. */
|
|
41
|
+
type InferOutput<Schema extends StandardTypedV1> = NonNullable<Schema["~standard"]["types"]>["output"];
|
|
42
|
+
}
|
|
43
|
+
/** The Standard Schema interface. */
|
|
44
|
+
interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
45
|
+
/** The Standard Schema properties. */
|
|
46
|
+
readonly "~standard": StandardSchemaV1.Props<Input, Output>;
|
|
47
|
+
}
|
|
48
|
+
declare namespace StandardSchemaV1 {
|
|
49
|
+
/** The Standard Schema properties interface. */
|
|
50
|
+
interface Props<Input = unknown, Output = Input> extends StandardTypedV1.Props<Input, Output> {
|
|
51
|
+
/** Validates unknown input values. */
|
|
52
|
+
readonly validate: (value: unknown, options?: StandardSchemaV1.Options | undefined) => Result<Output> | Promise<Result<Output>>;
|
|
53
|
+
}
|
|
54
|
+
/** The result interface of the validate function. */
|
|
55
|
+
type Result<Output> = SuccessResult<Output> | FailureResult;
|
|
56
|
+
/** The result interface if validation succeeds. */
|
|
57
|
+
interface SuccessResult<Output> {
|
|
58
|
+
/** The typed output value. */
|
|
59
|
+
readonly value: Output;
|
|
60
|
+
/** A falsy value for `issues` indicates success. */
|
|
61
|
+
readonly issues?: undefined;
|
|
62
|
+
}
|
|
63
|
+
interface Options {
|
|
64
|
+
/** Explicit support for additional vendor-specific parameters, if needed. */
|
|
65
|
+
readonly libraryOptions?: Record<string, unknown> | undefined;
|
|
66
|
+
}
|
|
67
|
+
/** The result interface if validation fails. */
|
|
68
|
+
interface FailureResult {
|
|
69
|
+
/** The issues of failed validation. */
|
|
70
|
+
readonly issues: ReadonlyArray<Issue>;
|
|
71
|
+
}
|
|
72
|
+
/** The issue interface of the failure output. */
|
|
73
|
+
interface Issue {
|
|
74
|
+
/** The error message of the issue. */
|
|
75
|
+
readonly message: string;
|
|
76
|
+
/** The path of the issue, if any. */
|
|
77
|
+
readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
|
|
78
|
+
}
|
|
79
|
+
/** The path segment interface of the issue. */
|
|
80
|
+
interface PathSegment {
|
|
81
|
+
/** The key representing a path segment. */
|
|
82
|
+
readonly key: PropertyKey;
|
|
83
|
+
}
|
|
84
|
+
/** The Standard types interface. */
|
|
85
|
+
interface Types<Input = unknown, Output = Input> extends StandardTypedV1.Types<Input, Output> {}
|
|
86
|
+
/** Infers the input type of a Standard. */
|
|
87
|
+
type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>;
|
|
88
|
+
/** Infers the output type of a Standard. */
|
|
89
|
+
type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
|
|
90
|
+
}
|
|
91
|
+
//#endregion
|
|
92
|
+
//#region ../internal/types/dist/infer-type.d.ts
|
|
93
|
+
/**
|
|
94
|
+
* Extract the inferred type from a schema definition.
|
|
95
|
+
* Supports both ArkType type definitions and Standard Schema 1.0 validators.
|
|
96
|
+
*
|
|
97
|
+
* For Standard Schema validators (e.g., Zod, Valibot), extracts the output type.
|
|
98
|
+
* For ArkType definitions, checks the call signature or type properties.
|
|
99
|
+
*
|
|
100
|
+
* @template T - The schema definition to infer from
|
|
101
|
+
*/
|
|
102
|
+
type InferType<T> = T extends StandardSchemaV1<infer _Input, infer Output> ? Output : T extends ((value: Record<string, string | undefined>) => infer R) ? R extends type.errors ? never : R : T extends {
|
|
103
|
+
t: infer U;
|
|
104
|
+
} ? U : T extends type.Any<infer U, infer _Scope> ? U : never;
|
|
105
|
+
//#endregion
|
|
106
|
+
//#region ../internal/scope/dist/index.d.ts
|
|
107
|
+
//#region src/root.d.ts
|
|
108
|
+
/**
|
|
109
|
+
* The root scope for the ArkEnv library,
|
|
110
|
+
* containing extensions to the ArkType scopes with ArkEnv-specific types
|
|
111
|
+
* like `string.host` and `number.port`.
|
|
112
|
+
*/
|
|
113
|
+
declare const $: arktype0.Scope<{
|
|
114
|
+
string: arktype0.Submodule<{
|
|
115
|
+
trim: arktype0.Submodule<arktype_internal_keywords_string_ts0.trim.$ & {
|
|
116
|
+
" arkInferred": (In: string) => arktype_internal_attributes_ts0.To<string>;
|
|
117
|
+
}>;
|
|
118
|
+
normalize: arktype0.Submodule<arktype_internal_keywords_string_ts0.normalize.$ & {
|
|
119
|
+
" arkInferred": (In: string) => arktype_internal_attributes_ts0.To<string>;
|
|
120
|
+
}>;
|
|
121
|
+
root: string;
|
|
122
|
+
alpha: string;
|
|
123
|
+
alphanumeric: string;
|
|
124
|
+
hex: string;
|
|
125
|
+
base64: arktype0.Submodule<{
|
|
126
|
+
root: string;
|
|
127
|
+
url: string;
|
|
128
|
+
} & {
|
|
129
|
+
" arkInferred": string;
|
|
130
|
+
}>;
|
|
131
|
+
capitalize: arktype0.Submodule<arktype_internal_keywords_string_ts0.capitalize.$ & {
|
|
132
|
+
" arkInferred": (In: string) => arktype_internal_attributes_ts0.To<string>;
|
|
133
|
+
}>;
|
|
134
|
+
creditCard: string;
|
|
135
|
+
date: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringDate.$ & {
|
|
136
|
+
" arkInferred": string;
|
|
137
|
+
}>;
|
|
138
|
+
digits: string;
|
|
139
|
+
email: string;
|
|
140
|
+
integer: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringInteger.$ & {
|
|
141
|
+
" arkInferred": string;
|
|
142
|
+
}>;
|
|
143
|
+
ip: arktype0.Submodule<arktype_internal_keywords_string_ts0.ip.$ & {
|
|
144
|
+
" arkInferred": string;
|
|
145
|
+
}>;
|
|
146
|
+
json: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringJson.$ & {
|
|
147
|
+
" arkInferred": string;
|
|
148
|
+
}>;
|
|
149
|
+
lower: arktype0.Submodule<arktype_internal_keywords_string_ts0.lower.$ & {
|
|
150
|
+
" arkInferred": (In: string) => arktype_internal_attributes_ts0.To<string>;
|
|
151
|
+
}>;
|
|
152
|
+
numeric: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringNumeric.$ & {
|
|
153
|
+
" arkInferred": string;
|
|
154
|
+
}>;
|
|
155
|
+
regex: string;
|
|
156
|
+
semver: string;
|
|
157
|
+
upper: arktype0.Submodule<{
|
|
158
|
+
root: (In: string) => arktype_internal_attributes_ts0.To<string>;
|
|
159
|
+
preformatted: string;
|
|
160
|
+
} & {
|
|
161
|
+
" arkInferred": (In: string) => arktype_internal_attributes_ts0.To<string>;
|
|
162
|
+
}>;
|
|
163
|
+
url: arktype0.Submodule<arktype_internal_keywords_string_ts0.url.$ & {
|
|
164
|
+
" arkInferred": string;
|
|
165
|
+
}>;
|
|
166
|
+
uuid: arktype0.Submodule<arktype_internal_keywords_string_ts0.uuid.$ & {
|
|
167
|
+
" arkInferred": string;
|
|
168
|
+
}>;
|
|
169
|
+
" arkInferred": string;
|
|
170
|
+
host: string;
|
|
171
|
+
}>;
|
|
172
|
+
number: arktype0.Submodule<{
|
|
173
|
+
NaN: number;
|
|
174
|
+
Infinity: number;
|
|
175
|
+
root: number;
|
|
176
|
+
integer: number;
|
|
177
|
+
" arkInferred": number;
|
|
178
|
+
epoch: number;
|
|
179
|
+
safe: number;
|
|
180
|
+
NegativeInfinity: number;
|
|
181
|
+
port: number;
|
|
182
|
+
}>;
|
|
183
|
+
}>;
|
|
184
|
+
type $ = (typeof $)["t"];
|
|
185
|
+
//#endregion
|
|
186
|
+
//#endregion
|
|
187
|
+
//#region ../internal/types/dist/schema.d.ts
|
|
188
|
+
type SchemaShape = Record<string, unknown>;
|
|
189
|
+
/**
|
|
190
|
+
* @internal
|
|
191
|
+
*
|
|
192
|
+
* Compiled ArkType schema accepted by ArkEnv.
|
|
193
|
+
* Produced by `arktype.type(...)` or `scope(...)`.
|
|
194
|
+
*
|
|
195
|
+
* Represents an already-constructed ArkType `Type` instance that
|
|
196
|
+
* defines the full environment schema.
|
|
197
|
+
*
|
|
198
|
+
* This form bypasses schema validation and is intended for advanced
|
|
199
|
+
* or programmatic use cases where schemas are constructed dynamically.
|
|
200
|
+
*/
|
|
201
|
+
type CompiledEnvSchema = Type<SchemaShape, $>;
|
|
202
|
+
//#endregion
|
|
203
|
+
//#region src/create-env.d.ts
|
|
204
|
+
/**
|
|
205
|
+
* Declarative environment schema definition accepted by ArkEnv.
|
|
206
|
+
*
|
|
207
|
+
* Represents a declarative schema object mapping environment
|
|
208
|
+
* variable names to schema definitions (e.g. ArkType DSL strings
|
|
209
|
+
* or Standard Schema validators).
|
|
210
|
+
*
|
|
211
|
+
* This type is used to validate that a schema object is compatible with
|
|
212
|
+
* ArkEnv’s validator scope before being compiled or parsed.
|
|
213
|
+
*
|
|
214
|
+
* Most users will provide schemas in this form.
|
|
215
|
+
*
|
|
216
|
+
* @template def - The schema shape object
|
|
217
|
+
*/
|
|
218
|
+
type EnvSchema<def> = type.validate<def, $>;
|
|
219
|
+
type RuntimeEnvironment = Dict<string>;
|
|
220
|
+
/**
|
|
221
|
+
* Configuration options for `createEnv`
|
|
222
|
+
*/
|
|
223
|
+
type ArkEnvConfig = {
|
|
224
|
+
/**
|
|
225
|
+
* The environment variables to parse. Defaults to `process.env`
|
|
226
|
+
*/
|
|
227
|
+
env?: RuntimeEnvironment;
|
|
228
|
+
/**
|
|
229
|
+
* Whether to coerce environment variables to their defined types. Defaults to `true`
|
|
230
|
+
*/
|
|
231
|
+
coerce?: boolean;
|
|
232
|
+
/**
|
|
233
|
+
* Control how ArkEnv handles environment variables that are not defined in your schema.
|
|
234
|
+
*
|
|
235
|
+
* Defaults to `'delete'` to ensure your output object only contains
|
|
236
|
+
* keys you've explicitly declared. This differs from ArkType's standard behavior, which
|
|
237
|
+
* mirrors TypeScript by defaulting to `'ignore'`.
|
|
238
|
+
*
|
|
239
|
+
* - `delete` (ArkEnv default): Undeclared keys are allowed on input but stripped from the output.
|
|
240
|
+
* - `ignore` (ArkType default): Undeclared keys are allowed and preserved in the output.
|
|
241
|
+
* - `reject`: Undeclared keys will cause validation to fail.
|
|
242
|
+
*
|
|
243
|
+
* @default "delete"
|
|
244
|
+
* @see https://arktype.io/docs/configuration#onundeclaredkey
|
|
245
|
+
*/
|
|
246
|
+
onUndeclaredKey?: "ignore" | "delete" | "reject";
|
|
247
|
+
/**
|
|
248
|
+
* The format to use for array parsing when coercion is enabled.
|
|
249
|
+
*
|
|
250
|
+
* - `comma` (default): Strings are split by comma and trimmed.
|
|
251
|
+
* - `json`: Strings are parsed as JSON.
|
|
252
|
+
*
|
|
253
|
+
* @default "comma"
|
|
254
|
+
*/
|
|
255
|
+
arrayFormat?: "comma" | "json";
|
|
256
|
+
/**
|
|
257
|
+
* Choose the validator engine to use.
|
|
258
|
+
*
|
|
259
|
+
* - `arktype` (default): Uses ArkType for all validation and coercion.
|
|
260
|
+
* - `standard`: Uses Standard Schema 1.0 directly for validation. Coercion is not supported in this mode.
|
|
261
|
+
*
|
|
262
|
+
* @default "arktype"
|
|
263
|
+
*/
|
|
264
|
+
validator?: "arktype" | "standard";
|
|
265
|
+
};
|
|
266
|
+
/**
|
|
267
|
+
* TODO: `SchemaShape` is basically `Record<string, unknown>`.
|
|
268
|
+
* If possible, find a better type than "const T extends Record<string, unknown>",
|
|
269
|
+
* and be as close as possible to the type accepted by ArkType's `type`.
|
|
270
|
+
*/
|
|
271
|
+
/**
|
|
272
|
+
* Utility to parse environment variables using ArkType or Standard Schema
|
|
273
|
+
* @param def - The schema definition
|
|
274
|
+
* @param config - The evaluation configuration
|
|
275
|
+
* @returns The parsed environment variables
|
|
276
|
+
* @throws An {@link ArkEnvError | error} if the environment variables are invalid.
|
|
277
|
+
*/
|
|
278
|
+
declare function createEnv<const T extends Record<string, StandardSchemaV1>>(def: T, config: ArkEnvConfig & {
|
|
279
|
+
validator: "standard";
|
|
280
|
+
}): { [K in keyof T]: StandardSchemaV1.InferOutput<T[K]> };
|
|
281
|
+
declare function createEnv<const T extends SchemaShape>(def: EnvSchema<T>, config?: ArkEnvConfig): distill.Out<type.infer<T, $>>;
|
|
282
|
+
declare function createEnv<T extends CompiledEnvSchema>(def: T, config?: ArkEnvConfig): InferType<T>;
|
|
283
|
+
//#endregion
|
|
284
|
+
export { SchemaShape as i, EnvSchema as n, createEnv as r, ArkEnvConfig as t };
|
|
285
|
+
//# sourceMappingURL=create-env-BPsNJfxy.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-env-BPsNJfxy.d.cts","names":["Dict","T","Record","StandardTypedV1","Input","Output","Props","Schema","Types","NonNullable","StandardSchemaV1","Options","Result","Promise","SuccessResult","FailureResult","Record","Issue","ReadonlyArray","PropertyKey","PathSegment","InferInput","InferOutput","StandardJSONSchemaV1","Converter","Target","type","StandardSchemaV1","InferType","T","Record","errors","Any","arktype0","arktype_internal_keywords_string_ts0","arktype_internal_attributes_ts0","$","trim","To","Submodule","normalize","capitalize","stringDate","stringInteger","ip","stringJson","lower","stringNumeric","url","uuid","Scope","$","Type","SchemaShape","Record","CompiledEnvSchema"],"sources":["../../internal/types/dist/helpers.d.ts","../../internal/types/dist/standard-schema.d.ts","../../internal/types/dist/infer-type.d.ts","../../internal/scope/dist/index.d.ts","../../internal/types/dist/schema.d.ts","../src/create-env.ts"],"sourcesContent":["export type Dict<T> = Record<string, T | undefined>;\n//# sourceMappingURL=helpers.d.ts.map","/**\n * @see https://github.com/standard-schema/standard-schema/tree/3130ce43fdd848d9ab49dbb0458d04f18459961c/packages/spec\n *\n * Copied from standard-schema (MIT License)\n * Copyright (c) 2024 Colin McDannell\n */\n/** The Standard Typed interface. This is a base type extended by other specs. */\nexport interface StandardTypedV1<Input = unknown, Output = Input> {\n /** The Standard properties. */\n readonly \"~standard\": StandardTypedV1.Props<Input, Output>;\n}\nexport declare namespace StandardTypedV1 {\n /** The Standard Typed properties interface. */\n interface Props<Input = unknown, Output = Input> {\n /** The version number of the standard. */\n readonly version: 1;\n /** The vendor name of the schema library. */\n readonly vendor: string;\n /** Inferred types associated with the schema. */\n readonly types?: Types<Input, Output> | undefined;\n }\n /** The Standard Typed types interface. */\n interface Types<Input = unknown, Output = Input> {\n /** The input type of the schema. */\n readonly input: Input;\n /** The output type of the schema. */\n readonly output: Output;\n }\n /** Infers the input type of a Standard Typed. */\n type InferInput<Schema extends StandardTypedV1> = NonNullable<Schema[\"~standard\"][\"types\"]>[\"input\"];\n /** Infers the output type of a Standard Typed. */\n type InferOutput<Schema extends StandardTypedV1> = NonNullable<Schema[\"~standard\"][\"types\"]>[\"output\"];\n}\n/** The Standard Schema interface. */\nexport interface StandardSchemaV1<Input = unknown, Output = Input> {\n /** The Standard Schema properties. */\n readonly \"~standard\": StandardSchemaV1.Props<Input, Output>;\n}\nexport declare namespace StandardSchemaV1 {\n /** The Standard Schema properties interface. */\n interface Props<Input = unknown, Output = Input> extends StandardTypedV1.Props<Input, Output> {\n /** Validates unknown input values. */\n readonly validate: (value: unknown, options?: StandardSchemaV1.Options | undefined) => Result<Output> | Promise<Result<Output>>;\n }\n /** The result interface of the validate function. */\n type Result<Output> = SuccessResult<Output> | FailureResult;\n /** The result interface if validation succeeds. */\n interface SuccessResult<Output> {\n /** The typed output value. */\n readonly value: Output;\n /** A falsy value for `issues` indicates success. */\n readonly issues?: undefined;\n }\n interface Options {\n /** Explicit support for additional vendor-specific parameters, if needed. */\n readonly libraryOptions?: Record<string, unknown> | undefined;\n }\n /** The result interface if validation fails. */\n interface FailureResult {\n /** The issues of failed validation. */\n readonly issues: ReadonlyArray<Issue>;\n }\n /** The issue interface of the failure output. */\n interface Issue {\n /** The error message of the issue. */\n readonly message: string;\n /** The path of the issue, if any. */\n readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;\n }\n /** The path segment interface of the issue. */\n interface PathSegment {\n /** The key representing a path segment. */\n readonly key: PropertyKey;\n }\n /** The Standard types interface. */\n interface Types<Input = unknown, Output = Input> extends StandardTypedV1.Types<Input, Output> {\n }\n /** Infers the input type of a Standard. */\n type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>;\n /** Infers the output type of a Standard. */\n type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;\n}\n/** The Standard JSON Schema interface. */\nexport interface StandardJSONSchemaV1<Input = unknown, Output = Input> {\n /** The Standard JSON Schema properties. */\n readonly \"~standard\": StandardJSONSchemaV1.Props<Input, Output>;\n}\nexport declare namespace StandardJSONSchemaV1 {\n /** The Standard JSON Schema properties interface. */\n interface Props<Input = unknown, Output = Input> extends StandardTypedV1.Props<Input, Output> {\n /** Methods for generating the input/output JSON Schema. */\n readonly jsonSchema: StandardJSONSchemaV1.Converter;\n }\n /** The Standard JSON Schema converter interface. */\n interface Converter {\n /** Converts the input type to JSON Schema. May throw if conversion is not supported. */\n readonly input: (options: StandardJSONSchemaV1.Options) => Record<string, unknown>;\n /** Converts the output type to JSON Schema. May throw if conversion is not supported. */\n readonly output: (options: StandardJSONSchemaV1.Options) => Record<string, unknown>;\n }\n /**\n * The target version of the generated JSON Schema.\n *\n * It is *strongly recommended* that implementers support `\"draft-2020-12\"` and `\"draft-07\"`, as they are both in wide use. All other targets can be implemented on a best-effort basis. Libraries should throw if they don't support a specified target.\n *\n * The `\"openapi-3.0\"` target is intended as a standardized specifier for OpenAPI 3.0 which is a superset of JSON Schema `\"draft-04\"`.\n */\n type Target = \"draft-2020-12\" | \"draft-07\" | \"openapi-3.0\" | ({} & string);\n /** The options for the input/output methods. */\n interface Options {\n /** Specifies the target version of the generated JSON Schema. Support for all versions is on a best-effort basis. If a given version is not supported, the library should throw. */\n readonly target: Target;\n /** Explicit support for additional vendor-specific parameters, if needed. */\n readonly libraryOptions?: Record<string, unknown> | undefined;\n }\n /** The Standard types interface. */\n interface Types<Input = unknown, Output = Input> extends StandardTypedV1.Types<Input, Output> {\n }\n /** Infers the input type of a Standard. */\n type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>;\n /** Infers the output type of a Standard. */\n type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;\n}\n//# sourceMappingURL=standard-schema.d.ts.map","import type { type } from \"arktype\";\nimport type { StandardSchemaV1 } from \"./standard-schema\";\n/**\n * Extract the inferred type from a schema definition.\n * Supports both ArkType type definitions and Standard Schema 1.0 validators.\n *\n * For Standard Schema validators (e.g., Zod, Valibot), extracts the output type.\n * For ArkType definitions, checks the call signature or type properties.\n *\n * @template T - The schema definition to infer from\n */\nexport type InferType<T> = T extends StandardSchemaV1<infer _Input, infer Output> ? Output : T extends (value: Record<string, string | undefined>) => infer R ? R extends type.errors ? never : R : T extends {\n t: infer U;\n} ? U : T extends type.Any<infer U, infer _Scope> ? U : never;\n//# sourceMappingURL=infer-type.d.ts.map","import * as arktype0 from \"arktype\";\nimport * as arktype_internal_keywords_string_ts0 from \"arktype/internal/keywords/string.ts\";\nimport * as arktype_internal_attributes_ts0 from \"arktype/internal/attributes.ts\";\n\n//#region src/root.d.ts\n/**\n * The root scope for the ArkEnv library,\n * containing extensions to the ArkType scopes with ArkEnv-specific types\n * like `string.host` and `number.port`.\n */\ndeclare const $: arktype0.Scope<{\n string: arktype0.Submodule<{\n trim: arktype0.Submodule<arktype_internal_keywords_string_ts0.trim.$ & {\n \" arkInferred\": (In: string) => arktype_internal_attributes_ts0.To<string>;\n }>;\n normalize: arktype0.Submodule<arktype_internal_keywords_string_ts0.normalize.$ & {\n \" arkInferred\": (In: string) => arktype_internal_attributes_ts0.To<string>;\n }>;\n root: string;\n alpha: string;\n alphanumeric: string;\n hex: string;\n base64: arktype0.Submodule<{\n root: string;\n url: string;\n } & {\n \" arkInferred\": string;\n }>;\n capitalize: arktype0.Submodule<arktype_internal_keywords_string_ts0.capitalize.$ & {\n \" arkInferred\": (In: string) => arktype_internal_attributes_ts0.To<string>;\n }>;\n creditCard: string;\n date: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringDate.$ & {\n \" arkInferred\": string;\n }>;\n digits: string;\n email: string;\n integer: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringInteger.$ & {\n \" arkInferred\": string;\n }>;\n ip: arktype0.Submodule<arktype_internal_keywords_string_ts0.ip.$ & {\n \" arkInferred\": string;\n }>;\n json: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringJson.$ & {\n \" arkInferred\": string;\n }>;\n lower: arktype0.Submodule<arktype_internal_keywords_string_ts0.lower.$ & {\n \" arkInferred\": (In: string) => arktype_internal_attributes_ts0.To<string>;\n }>;\n numeric: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringNumeric.$ & {\n \" arkInferred\": string;\n }>;\n regex: string;\n semver: string;\n upper: arktype0.Submodule<{\n root: (In: string) => arktype_internal_attributes_ts0.To<string>;\n preformatted: string;\n } & {\n \" arkInferred\": (In: string) => arktype_internal_attributes_ts0.To<string>;\n }>;\n url: arktype0.Submodule<arktype_internal_keywords_string_ts0.url.$ & {\n \" arkInferred\": string;\n }>;\n uuid: arktype0.Submodule<arktype_internal_keywords_string_ts0.uuid.$ & {\n \" arkInferred\": string;\n }>;\n \" arkInferred\": string;\n host: string;\n }>;\n number: arktype0.Submodule<{\n NaN: number;\n Infinity: number;\n root: number;\n integer: number;\n \" arkInferred\": number;\n epoch: number;\n safe: number;\n NegativeInfinity: number;\n port: number;\n }>;\n}>;\ntype $ = (typeof $)[\"t\"];\n//#endregion\nexport { $ };\n//# sourceMappingURL=index.d.ts.map","import type { $ } from \"@repo/scope\";\nimport type { Type } from \"arktype\";\nexport type SchemaShape = Record<string, unknown>;\n/**\n * @internal\n *\n * Compiled ArkType schema accepted by ArkEnv.\n * Produced by `arktype.type(...)` or `scope(...)`.\n *\n * Represents an already-constructed ArkType `Type` instance that\n * defines the full environment schema.\n *\n * This form bypasses schema validation and is intended for advanced\n * or programmatic use cases where schemas are constructed dynamically.\n */\nexport type CompiledEnvSchema = Type<SchemaShape, $>;\n//# sourceMappingURL=schema.d.ts.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