arkenv 0.8.2 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/arktype/index.cjs +1 -0
- package/dist/arktype/index.d.cts +86 -0
- package/dist/arktype/index.d.cts.map +1 -0
- package/dist/arktype/index.d.ts +86 -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-Dk1I0Ftq.d.ts +171 -0
- package/dist/create-env-Dk1I0Ftq.d.ts.map +1 -0
- package/dist/create-env-gH1q_Fv8.d.cts +171 -0
- package/dist/create-env-gH1q_Fv8.d.cts.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 +8 -247
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +8 -247
- 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
|
|
|
@@ -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,86 @@
|
|
|
1
|
+
import { i as SchemaShape, n as EnvSchema, t as ArkEnvConfig } from "../create-env-gH1q_Fv8.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
|
+
* Re-export the ArkType `type` function from the scoped root.
|
|
11
|
+
*/
|
|
12
|
+
declare const type: arktype_internal_type_ts0.TypeParser<{
|
|
13
|
+
string: arktype0.Submodule<{
|
|
14
|
+
trim: arktype0.Submodule<arktype_internal_keywords_string_ts0.trim.$ & {
|
|
15
|
+
" arkInferred": (In: string) => arktype_internal_attributes_ts0.To<string>;
|
|
16
|
+
}>;
|
|
17
|
+
normalize: arktype0.Submodule<arktype_internal_keywords_string_ts0.normalize.$ & {
|
|
18
|
+
" arkInferred": (In: string) => arktype_internal_attributes_ts0.To<string>;
|
|
19
|
+
}>;
|
|
20
|
+
root: string;
|
|
21
|
+
alpha: string;
|
|
22
|
+
alphanumeric: string;
|
|
23
|
+
hex: string;
|
|
24
|
+
base64: arktype0.Submodule<{
|
|
25
|
+
root: string;
|
|
26
|
+
url: string;
|
|
27
|
+
} & {
|
|
28
|
+
" arkInferred": string;
|
|
29
|
+
}>;
|
|
30
|
+
capitalize: arktype0.Submodule<arktype_internal_keywords_string_ts0.capitalize.$ & {
|
|
31
|
+
" arkInferred": (In: string) => arktype_internal_attributes_ts0.To<string>;
|
|
32
|
+
}>;
|
|
33
|
+
creditCard: string;
|
|
34
|
+
date: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringDate.$ & {
|
|
35
|
+
" arkInferred": string;
|
|
36
|
+
}>;
|
|
37
|
+
digits: string;
|
|
38
|
+
email: string;
|
|
39
|
+
integer: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringInteger.$ & {
|
|
40
|
+
" arkInferred": string;
|
|
41
|
+
}>;
|
|
42
|
+
ip: arktype0.Submodule<arktype_internal_keywords_string_ts0.ip.$ & {
|
|
43
|
+
" arkInferred": string;
|
|
44
|
+
}>;
|
|
45
|
+
json: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringJson.$ & {
|
|
46
|
+
" arkInferred": string;
|
|
47
|
+
}>;
|
|
48
|
+
lower: arktype0.Submodule<arktype_internal_keywords_string_ts0.lower.$ & {
|
|
49
|
+
" arkInferred": (In: string) => arktype_internal_attributes_ts0.To<string>;
|
|
50
|
+
}>;
|
|
51
|
+
numeric: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringNumeric.$ & {
|
|
52
|
+
" arkInferred": string;
|
|
53
|
+
}>;
|
|
54
|
+
regex: string;
|
|
55
|
+
semver: string;
|
|
56
|
+
upper: arktype0.Submodule<{
|
|
57
|
+
root: (In: string) => arktype_internal_attributes_ts0.To<string>;
|
|
58
|
+
preformatted: string;
|
|
59
|
+
} & {
|
|
60
|
+
" arkInferred": (In: string) => arktype_internal_attributes_ts0.To<string>;
|
|
61
|
+
}>;
|
|
62
|
+
url: arktype0.Submodule<arktype_internal_keywords_string_ts0.url.$ & {
|
|
63
|
+
" arkInferred": string;
|
|
64
|
+
}>;
|
|
65
|
+
uuid: arktype0.Submodule<arktype_internal_keywords_string_ts0.uuid.$ & {
|
|
66
|
+
" arkInferred": string;
|
|
67
|
+
}>;
|
|
68
|
+
" arkInferred": string;
|
|
69
|
+
host: string;
|
|
70
|
+
}>;
|
|
71
|
+
number: arktype0.Submodule<{
|
|
72
|
+
NaN: number;
|
|
73
|
+
Infinity: number;
|
|
74
|
+
root: number;
|
|
75
|
+
integer: number;
|
|
76
|
+
" arkInferred": number;
|
|
77
|
+
epoch: number;
|
|
78
|
+
safe: number;
|
|
79
|
+
NegativeInfinity: number;
|
|
80
|
+
port: number;
|
|
81
|
+
}>;
|
|
82
|
+
}>;
|
|
83
|
+
declare function parse<const T extends SchemaShape>(def: EnvSchema<T>, config: ArkEnvConfig): any;
|
|
84
|
+
//#endregion
|
|
85
|
+
export { type distill, parse, type };
|
|
86
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/arktype/index.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;cAaa,gCAAI;EAAJ,MAAA,oBAAa,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAAT,MAAA;IAAA,CAAA,CAAA;IAED,KAAK,oBAAA,gDAAA;MAAiB,cAAA,EAAA,CAAA,EAAA,EAAA,MAAA,EAAA,qCAAA,CAAA,MAAA,CAAA;IACtB,CAAA,CAAA;IAAV,OAAA,oBAAA,wDAAA;MACG,cAAA,EAAA,MAAA;IAAY,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAFL,sBAAsB,kBAChC,UAAU,YACP"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { i as SchemaShape, n as EnvSchema, t as ArkEnvConfig } from "../create-env-Dk1I0Ftq.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
|
+
* Re-export the ArkType `type` function from the scoped root.
|
|
11
|
+
*/
|
|
12
|
+
declare const type: arktype_internal_type_ts0.TypeParser<{
|
|
13
|
+
string: arktype0.Submodule<{
|
|
14
|
+
trim: arktype0.Submodule<arktype_internal_keywords_string_ts0.trim.$ & {
|
|
15
|
+
" arkInferred": (In: string) => arktype_internal_attributes_ts0.To<string>;
|
|
16
|
+
}>;
|
|
17
|
+
normalize: arktype0.Submodule<arktype_internal_keywords_string_ts0.normalize.$ & {
|
|
18
|
+
" arkInferred": (In: string) => arktype_internal_attributes_ts0.To<string>;
|
|
19
|
+
}>;
|
|
20
|
+
root: string;
|
|
21
|
+
alpha: string;
|
|
22
|
+
alphanumeric: string;
|
|
23
|
+
hex: string;
|
|
24
|
+
base64: arktype0.Submodule<{
|
|
25
|
+
root: string;
|
|
26
|
+
url: string;
|
|
27
|
+
} & {
|
|
28
|
+
" arkInferred": string;
|
|
29
|
+
}>;
|
|
30
|
+
capitalize: arktype0.Submodule<arktype_internal_keywords_string_ts0.capitalize.$ & {
|
|
31
|
+
" arkInferred": (In: string) => arktype_internal_attributes_ts0.To<string>;
|
|
32
|
+
}>;
|
|
33
|
+
creditCard: string;
|
|
34
|
+
date: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringDate.$ & {
|
|
35
|
+
" arkInferred": string;
|
|
36
|
+
}>;
|
|
37
|
+
digits: string;
|
|
38
|
+
email: string;
|
|
39
|
+
integer: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringInteger.$ & {
|
|
40
|
+
" arkInferred": string;
|
|
41
|
+
}>;
|
|
42
|
+
ip: arktype0.Submodule<arktype_internal_keywords_string_ts0.ip.$ & {
|
|
43
|
+
" arkInferred": string;
|
|
44
|
+
}>;
|
|
45
|
+
json: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringJson.$ & {
|
|
46
|
+
" arkInferred": string;
|
|
47
|
+
}>;
|
|
48
|
+
lower: arktype0.Submodule<arktype_internal_keywords_string_ts0.lower.$ & {
|
|
49
|
+
" arkInferred": (In: string) => arktype_internal_attributes_ts0.To<string>;
|
|
50
|
+
}>;
|
|
51
|
+
numeric: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringNumeric.$ & {
|
|
52
|
+
" arkInferred": string;
|
|
53
|
+
}>;
|
|
54
|
+
regex: string;
|
|
55
|
+
semver: string;
|
|
56
|
+
upper: arktype0.Submodule<{
|
|
57
|
+
root: (In: string) => arktype_internal_attributes_ts0.To<string>;
|
|
58
|
+
preformatted: string;
|
|
59
|
+
} & {
|
|
60
|
+
" arkInferred": (In: string) => arktype_internal_attributes_ts0.To<string>;
|
|
61
|
+
}>;
|
|
62
|
+
url: arktype0.Submodule<arktype_internal_keywords_string_ts0.url.$ & {
|
|
63
|
+
" arkInferred": string;
|
|
64
|
+
}>;
|
|
65
|
+
uuid: arktype0.Submodule<arktype_internal_keywords_string_ts0.uuid.$ & {
|
|
66
|
+
" arkInferred": string;
|
|
67
|
+
}>;
|
|
68
|
+
" arkInferred": string;
|
|
69
|
+
host: string;
|
|
70
|
+
}>;
|
|
71
|
+
number: arktype0.Submodule<{
|
|
72
|
+
NaN: number;
|
|
73
|
+
Infinity: number;
|
|
74
|
+
root: number;
|
|
75
|
+
integer: number;
|
|
76
|
+
" arkInferred": number;
|
|
77
|
+
epoch: number;
|
|
78
|
+
safe: number;
|
|
79
|
+
NegativeInfinity: number;
|
|
80
|
+
port: number;
|
|
81
|
+
}>;
|
|
82
|
+
}>;
|
|
83
|
+
declare function parse<const T extends SchemaShape>(def: EnvSchema<T>, config: ArkEnvConfig): any;
|
|
84
|
+
//#endregion
|
|
85
|
+
export { type distill, parse, type };
|
|
86
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/arktype/index.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;cAaa,gCAAI;EAAJ,MAAA,oBAAa,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAAT,MAAA;IAAA,CAAA,CAAA;IAED,KAAK,oBAAA,gDAAA;MAAiB,cAAA,EAAA,CAAA,EAAA,EAAA,MAAA,EAAA,qCAAA,CAAA,MAAA,CAAA;IACtB,CAAA,CAAA;IAAV,OAAA,oBAAA,wDAAA;MACG,cAAA,EAAA,MAAA;IAAY,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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\nexport type { distill };\n\n/**\n * Re-export the ArkType `type` function from the scoped root.\n */\nexport const type = $.type;\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,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M,CACL,MAAM,QAAQ,IACd,OAAQ,EAAe,GACvB,kBAAkB,SAClB,cAAc,SACX,EAQE,GAJiB,OAAO,GAAQ,YAAc,WAAY,EAC/B,EAAMA,EAAE,KAAK,IAAI,EAAI,EAGxB,gBAAgB,EAAgB,CAG1D,EAAc,EACd,IACH,EAAc,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,171 @@
|
|
|
1
|
+
import * as arktype0 from "arktype";
|
|
2
|
+
import { Type, distill, type } from "arktype";
|
|
3
|
+
import * as arktype_internal_keywords_string_ts0 from "arktype/internal/keywords/string.ts";
|
|
4
|
+
import * as arktype_internal_attributes_ts0 from "arktype/internal/attributes.ts";
|
|
5
|
+
|
|
6
|
+
//#region ../internal/types/dist/helpers.d.ts
|
|
7
|
+
type Dict<T> = Record<string, T | undefined>;
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region ../internal/types/dist/infer-type.d.ts
|
|
10
|
+
/**
|
|
11
|
+
* Extract the inferred type from an ArkType type definition by checking its call signature.
|
|
12
|
+
* When a type definition is called, it returns either the validated value or type.errors.
|
|
13
|
+
*
|
|
14
|
+
* @template T - The ArkType type definition to infer from
|
|
15
|
+
*/
|
|
16
|
+
type InferType<T> = T extends ((value: Record<string, string | undefined>) => infer R) ? R extends type.errors ? never : R : T extends {
|
|
17
|
+
t: infer U;
|
|
18
|
+
} ? U : T extends type.Any<infer U, infer _Scope> ? U : never;
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region ../internal/scope/dist/index.d.ts
|
|
21
|
+
//#region src/root.d.ts
|
|
22
|
+
/**
|
|
23
|
+
* The root scope for the ArkEnv library,
|
|
24
|
+
* containing extensions to the ArkType scopes with ArkEnv-specific types
|
|
25
|
+
* like `string.host` and `number.port`.
|
|
26
|
+
*/
|
|
27
|
+
declare const $: arktype0.Scope<{
|
|
28
|
+
string: arktype0.Submodule<{
|
|
29
|
+
trim: arktype0.Submodule<arktype_internal_keywords_string_ts0.trim.$ & {
|
|
30
|
+
" arkInferred": (In: string) => arktype_internal_attributes_ts0.To<string>;
|
|
31
|
+
}>;
|
|
32
|
+
normalize: arktype0.Submodule<arktype_internal_keywords_string_ts0.normalize.$ & {
|
|
33
|
+
" arkInferred": (In: string) => arktype_internal_attributes_ts0.To<string>;
|
|
34
|
+
}>;
|
|
35
|
+
root: string;
|
|
36
|
+
alpha: string;
|
|
37
|
+
alphanumeric: string;
|
|
38
|
+
hex: string;
|
|
39
|
+
base64: arktype0.Submodule<{
|
|
40
|
+
root: string;
|
|
41
|
+
url: string;
|
|
42
|
+
} & {
|
|
43
|
+
" arkInferred": string;
|
|
44
|
+
}>;
|
|
45
|
+
capitalize: arktype0.Submodule<arktype_internal_keywords_string_ts0.capitalize.$ & {
|
|
46
|
+
" arkInferred": (In: string) => arktype_internal_attributes_ts0.To<string>;
|
|
47
|
+
}>;
|
|
48
|
+
creditCard: string;
|
|
49
|
+
date: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringDate.$ & {
|
|
50
|
+
" arkInferred": string;
|
|
51
|
+
}>;
|
|
52
|
+
digits: string;
|
|
53
|
+
email: string;
|
|
54
|
+
integer: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringInteger.$ & {
|
|
55
|
+
" arkInferred": string;
|
|
56
|
+
}>;
|
|
57
|
+
ip: arktype0.Submodule<arktype_internal_keywords_string_ts0.ip.$ & {
|
|
58
|
+
" arkInferred": string;
|
|
59
|
+
}>;
|
|
60
|
+
json: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringJson.$ & {
|
|
61
|
+
" arkInferred": string;
|
|
62
|
+
}>;
|
|
63
|
+
lower: arktype0.Submodule<arktype_internal_keywords_string_ts0.lower.$ & {
|
|
64
|
+
" arkInferred": (In: string) => arktype_internal_attributes_ts0.To<string>;
|
|
65
|
+
}>;
|
|
66
|
+
numeric: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringNumeric.$ & {
|
|
67
|
+
" arkInferred": string;
|
|
68
|
+
}>;
|
|
69
|
+
regex: string;
|
|
70
|
+
semver: string;
|
|
71
|
+
upper: arktype0.Submodule<{
|
|
72
|
+
root: (In: string) => arktype_internal_attributes_ts0.To<string>;
|
|
73
|
+
preformatted: string;
|
|
74
|
+
} & {
|
|
75
|
+
" arkInferred": (In: string) => arktype_internal_attributes_ts0.To<string>;
|
|
76
|
+
}>;
|
|
77
|
+
url: arktype0.Submodule<arktype_internal_keywords_string_ts0.url.$ & {
|
|
78
|
+
" arkInferred": string;
|
|
79
|
+
}>;
|
|
80
|
+
uuid: arktype0.Submodule<arktype_internal_keywords_string_ts0.uuid.$ & {
|
|
81
|
+
" arkInferred": string;
|
|
82
|
+
}>;
|
|
83
|
+
" arkInferred": string;
|
|
84
|
+
host: string;
|
|
85
|
+
}>;
|
|
86
|
+
number: arktype0.Submodule<{
|
|
87
|
+
NaN: number;
|
|
88
|
+
Infinity: number;
|
|
89
|
+
root: number;
|
|
90
|
+
integer: number;
|
|
91
|
+
" arkInferred": number;
|
|
92
|
+
epoch: number;
|
|
93
|
+
safe: number;
|
|
94
|
+
NegativeInfinity: number;
|
|
95
|
+
port: number;
|
|
96
|
+
}>;
|
|
97
|
+
}>;
|
|
98
|
+
type $ = (typeof $)["t"];
|
|
99
|
+
//#endregion
|
|
100
|
+
//#endregion
|
|
101
|
+
//#region ../internal/types/dist/schema.d.ts
|
|
102
|
+
type SchemaShape = Record<string, unknown>;
|
|
103
|
+
type EnvSchemaWithType = Type<SchemaShape, $>;
|
|
104
|
+
//#endregion
|
|
105
|
+
//#region src/create-env.d.ts
|
|
106
|
+
type EnvSchema<def$1> = type.validate<def$1, $>;
|
|
107
|
+
type RuntimeEnvironment = Dict<string>;
|
|
108
|
+
/**
|
|
109
|
+
* Configuration options for `createEnv`
|
|
110
|
+
*/
|
|
111
|
+
type ArkEnvConfig = {
|
|
112
|
+
/**
|
|
113
|
+
* The environment variables to parse. Defaults to `process.env`
|
|
114
|
+
*/
|
|
115
|
+
env?: RuntimeEnvironment;
|
|
116
|
+
/**
|
|
117
|
+
* Whether to coerce environment variables to their defined types. Defaults to `true`
|
|
118
|
+
*/
|
|
119
|
+
coerce?: boolean;
|
|
120
|
+
/**
|
|
121
|
+
* Control how ArkEnv handles environment variables that are not defined in your schema.
|
|
122
|
+
*
|
|
123
|
+
* Defaults to `'delete'` to ensure your output object only contains
|
|
124
|
+
* keys you've explicitly declared. This differs from ArkType's standard behavior, which
|
|
125
|
+
* mirrors TypeScript by defaulting to `'ignore'`.
|
|
126
|
+
*
|
|
127
|
+
* - `delete` (ArkEnv default): Undeclared keys are allowed on input but stripped from the output.
|
|
128
|
+
* - `ignore` (ArkType default): Undeclared keys are allowed and preserved in the output.
|
|
129
|
+
* - `reject`: Undeclared keys will cause validation to fail.
|
|
130
|
+
*
|
|
131
|
+
* @default "delete"
|
|
132
|
+
* @see https://arktype.io/docs/configuration#onundeclaredkey
|
|
133
|
+
*/
|
|
134
|
+
onUndeclaredKey?: "ignore" | "delete" | "reject";
|
|
135
|
+
/**
|
|
136
|
+
* The format to use for array parsing when coercion is enabled.
|
|
137
|
+
*
|
|
138
|
+
* - `comma` (default): Strings are split by comma and trimmed.
|
|
139
|
+
* - `json`: Strings are parsed as JSON.
|
|
140
|
+
*
|
|
141
|
+
* @default "comma"
|
|
142
|
+
*/
|
|
143
|
+
arrayFormat?: "comma" | "json";
|
|
144
|
+
/**
|
|
145
|
+
* Choose the validator engine to use.
|
|
146
|
+
*
|
|
147
|
+
* - `arktype` (default): Uses ArkType for all validation and coercion.
|
|
148
|
+
* - `standard`: Uses Standard Schema 1.0 directly for validation. Coercion is not supported in this mode.
|
|
149
|
+
*
|
|
150
|
+
* @default "arktype"
|
|
151
|
+
*/
|
|
152
|
+
validator?: "arktype" | "standard";
|
|
153
|
+
};
|
|
154
|
+
/**
|
|
155
|
+
* TODO: `SchemaShape` is basically `Record<string, unknown>`.
|
|
156
|
+
* If possible, find a better type than "const T extends Record<string, unknown>",
|
|
157
|
+
* and be as close as possible to the type accepted by ArkType's `type`.
|
|
158
|
+
*/
|
|
159
|
+
/**
|
|
160
|
+
* Utility to parse environment variables using ArkType or Standard Schema
|
|
161
|
+
* @param def - The schema definition
|
|
162
|
+
* @param config - The evaluation configuration
|
|
163
|
+
* @returns The parsed environment variables
|
|
164
|
+
* @throws An {@link ArkEnvError | error} if the environment variables are invalid.
|
|
165
|
+
*/
|
|
166
|
+
declare function createEnv<const T extends SchemaShape>(def: EnvSchema<T>, config?: ArkEnvConfig): distill.Out<type.infer<T, $>>;
|
|
167
|
+
declare function createEnv<T extends EnvSchemaWithType>(def: T, config?: ArkEnvConfig): InferType<T>;
|
|
168
|
+
declare function createEnv<const T extends SchemaShape>(def: EnvSchema<T> | EnvSchemaWithType, config?: ArkEnvConfig): distill.Out<type.infer<T, $>> | InferType<typeof def>;
|
|
169
|
+
//#endregion
|
|
170
|
+
export { SchemaShape as i, EnvSchema as n, createEnv as r, ArkEnvConfig as t };
|
|
171
|
+
//# sourceMappingURL=create-env-Dk1I0Ftq.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-env-Dk1I0Ftq.d.ts","names":["Dict","T","Record","type","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","EnvSchemaWithType"],"sources":["../../internal/types/dist/helpers.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","import type { type } from \"arktype\";\n/**\n * Extract the inferred type from an ArkType type definition by checking its call signature.\n * When a type definition is called, it returns either the validated value or type.errors.\n *\n * @template T - The ArkType type definition to infer from\n */\nexport type InferType<T> = 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>;\nexport type EnvSchemaWithType = Type<SchemaShape, $>;\n//# sourceMappingURL=schema.d.ts.map"],"mappings":";;;;;;KAAYA,UAAUE,eAAeD;;;;;;;;AAArC;KCOYG,eAAeC,mBAAkBC,4DAA2DH,IAAAA,CAAKI,qBAAqBF;;QAE1HA,UAAUF,IAAAA,CAAKK;;;;;ADTvB;;;;ACOA,cCGcI,CDHFR,ECGKK,QAAAA,CAASiB,KDHL,CAAA;EAAMrB,MAAAA,ECIjBI,QAAAA,CAASM,SDJQV,CAAAA;IAAkBC,IAAAA,ECKnCG,QAAAA,CAASM,SDL0BT,CCKhBI,oCAAAA,CAAqCG,IAAAA,CAAKD,CDL1BN,GAAAA;MAAgEC,cAAAA,EAAAA,CAAAA,EAAAA,EAAAA,MAAAA,EAAAA,GCMvEI,+BAAAA,CAAgCG,EDNuCP,CAAAA,MAAAA,CAAAA;IAAqBF,CAAAA,CAAAA;IAE1HA,SAAAA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,SDlF8B,CCkFpB,CDlFoB,CAAA,GCkFf,iBDlFe,EAAA,MAAA,CAAA,ECmF1B,YDnF0B,CAAA,ECoFjC,OAAA,CAAQ,GDpFyB,CCoFrB,IAAA,CAAG,KDpFkB,CCoFZ,CDpFY,ECoFT,CDpFS,CAAA,CAAA,GCoFH,SDpFG,CAAA,OCoFc,GDpFd,CAAA"}
|
|
@@ -0,0 +1,171 @@
|
|
|
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/infer-type.d.ts
|
|
10
|
+
/**
|
|
11
|
+
* Extract the inferred type from an ArkType type definition by checking its call signature.
|
|
12
|
+
* When a type definition is called, it returns either the validated value or type.errors.
|
|
13
|
+
*
|
|
14
|
+
* @template T - The ArkType type definition to infer from
|
|
15
|
+
*/
|
|
16
|
+
type InferType<T> = T extends ((value: Record<string, string | undefined>) => infer R) ? R extends type.errors ? never : R : T extends {
|
|
17
|
+
t: infer U;
|
|
18
|
+
} ? U : T extends type.Any<infer U, infer _Scope> ? U : never;
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region ../internal/scope/dist/index.d.ts
|
|
21
|
+
//#region src/root.d.ts
|
|
22
|
+
/**
|
|
23
|
+
* The root scope for the ArkEnv library,
|
|
24
|
+
* containing extensions to the ArkType scopes with ArkEnv-specific types
|
|
25
|
+
* like `string.host` and `number.port`.
|
|
26
|
+
*/
|
|
27
|
+
declare const $: arktype0.Scope<{
|
|
28
|
+
string: arktype0.Submodule<{
|
|
29
|
+
trim: arktype0.Submodule<arktype_internal_keywords_string_ts0.trim.$ & {
|
|
30
|
+
" arkInferred": (In: string) => arktype_internal_attributes_ts0.To<string>;
|
|
31
|
+
}>;
|
|
32
|
+
normalize: arktype0.Submodule<arktype_internal_keywords_string_ts0.normalize.$ & {
|
|
33
|
+
" arkInferred": (In: string) => arktype_internal_attributes_ts0.To<string>;
|
|
34
|
+
}>;
|
|
35
|
+
root: string;
|
|
36
|
+
alpha: string;
|
|
37
|
+
alphanumeric: string;
|
|
38
|
+
hex: string;
|
|
39
|
+
base64: arktype0.Submodule<{
|
|
40
|
+
root: string;
|
|
41
|
+
url: string;
|
|
42
|
+
} & {
|
|
43
|
+
" arkInferred": string;
|
|
44
|
+
}>;
|
|
45
|
+
capitalize: arktype0.Submodule<arktype_internal_keywords_string_ts0.capitalize.$ & {
|
|
46
|
+
" arkInferred": (In: string) => arktype_internal_attributes_ts0.To<string>;
|
|
47
|
+
}>;
|
|
48
|
+
creditCard: string;
|
|
49
|
+
date: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringDate.$ & {
|
|
50
|
+
" arkInferred": string;
|
|
51
|
+
}>;
|
|
52
|
+
digits: string;
|
|
53
|
+
email: string;
|
|
54
|
+
integer: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringInteger.$ & {
|
|
55
|
+
" arkInferred": string;
|
|
56
|
+
}>;
|
|
57
|
+
ip: arktype0.Submodule<arktype_internal_keywords_string_ts0.ip.$ & {
|
|
58
|
+
" arkInferred": string;
|
|
59
|
+
}>;
|
|
60
|
+
json: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringJson.$ & {
|
|
61
|
+
" arkInferred": string;
|
|
62
|
+
}>;
|
|
63
|
+
lower: arktype0.Submodule<arktype_internal_keywords_string_ts0.lower.$ & {
|
|
64
|
+
" arkInferred": (In: string) => arktype_internal_attributes_ts0.To<string>;
|
|
65
|
+
}>;
|
|
66
|
+
numeric: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringNumeric.$ & {
|
|
67
|
+
" arkInferred": string;
|
|
68
|
+
}>;
|
|
69
|
+
regex: string;
|
|
70
|
+
semver: string;
|
|
71
|
+
upper: arktype0.Submodule<{
|
|
72
|
+
root: (In: string) => arktype_internal_attributes_ts0.To<string>;
|
|
73
|
+
preformatted: string;
|
|
74
|
+
} & {
|
|
75
|
+
" arkInferred": (In: string) => arktype_internal_attributes_ts0.To<string>;
|
|
76
|
+
}>;
|
|
77
|
+
url: arktype0.Submodule<arktype_internal_keywords_string_ts0.url.$ & {
|
|
78
|
+
" arkInferred": string;
|
|
79
|
+
}>;
|
|
80
|
+
uuid: arktype0.Submodule<arktype_internal_keywords_string_ts0.uuid.$ & {
|
|
81
|
+
" arkInferred": string;
|
|
82
|
+
}>;
|
|
83
|
+
" arkInferred": string;
|
|
84
|
+
host: string;
|
|
85
|
+
}>;
|
|
86
|
+
number: arktype0.Submodule<{
|
|
87
|
+
NaN: number;
|
|
88
|
+
Infinity: number;
|
|
89
|
+
root: number;
|
|
90
|
+
integer: number;
|
|
91
|
+
" arkInferred": number;
|
|
92
|
+
epoch: number;
|
|
93
|
+
safe: number;
|
|
94
|
+
NegativeInfinity: number;
|
|
95
|
+
port: number;
|
|
96
|
+
}>;
|
|
97
|
+
}>;
|
|
98
|
+
type $ = (typeof $)["t"];
|
|
99
|
+
//#endregion
|
|
100
|
+
//#endregion
|
|
101
|
+
//#region ../internal/types/dist/schema.d.ts
|
|
102
|
+
type SchemaShape = Record<string, unknown>;
|
|
103
|
+
type EnvSchemaWithType = Type<SchemaShape, $>;
|
|
104
|
+
//#endregion
|
|
105
|
+
//#region src/create-env.d.ts
|
|
106
|
+
type EnvSchema<def$1> = type.validate<def$1, $>;
|
|
107
|
+
type RuntimeEnvironment = Dict<string>;
|
|
108
|
+
/**
|
|
109
|
+
* Configuration options for `createEnv`
|
|
110
|
+
*/
|
|
111
|
+
type ArkEnvConfig = {
|
|
112
|
+
/**
|
|
113
|
+
* The environment variables to parse. Defaults to `process.env`
|
|
114
|
+
*/
|
|
115
|
+
env?: RuntimeEnvironment;
|
|
116
|
+
/**
|
|
117
|
+
* Whether to coerce environment variables to their defined types. Defaults to `true`
|
|
118
|
+
*/
|
|
119
|
+
coerce?: boolean;
|
|
120
|
+
/**
|
|
121
|
+
* Control how ArkEnv handles environment variables that are not defined in your schema.
|
|
122
|
+
*
|
|
123
|
+
* Defaults to `'delete'` to ensure your output object only contains
|
|
124
|
+
* keys you've explicitly declared. This differs from ArkType's standard behavior, which
|
|
125
|
+
* mirrors TypeScript by defaulting to `'ignore'`.
|
|
126
|
+
*
|
|
127
|
+
* - `delete` (ArkEnv default): Undeclared keys are allowed on input but stripped from the output.
|
|
128
|
+
* - `ignore` (ArkType default): Undeclared keys are allowed and preserved in the output.
|
|
129
|
+
* - `reject`: Undeclared keys will cause validation to fail.
|
|
130
|
+
*
|
|
131
|
+
* @default "delete"
|
|
132
|
+
* @see https://arktype.io/docs/configuration#onundeclaredkey
|
|
133
|
+
*/
|
|
134
|
+
onUndeclaredKey?: "ignore" | "delete" | "reject";
|
|
135
|
+
/**
|
|
136
|
+
* The format to use for array parsing when coercion is enabled.
|
|
137
|
+
*
|
|
138
|
+
* - `comma` (default): Strings are split by comma and trimmed.
|
|
139
|
+
* - `json`: Strings are parsed as JSON.
|
|
140
|
+
*
|
|
141
|
+
* @default "comma"
|
|
142
|
+
*/
|
|
143
|
+
arrayFormat?: "comma" | "json";
|
|
144
|
+
/**
|
|
145
|
+
* Choose the validator engine to use.
|
|
146
|
+
*
|
|
147
|
+
* - `arktype` (default): Uses ArkType for all validation and coercion.
|
|
148
|
+
* - `standard`: Uses Standard Schema 1.0 directly for validation. Coercion is not supported in this mode.
|
|
149
|
+
*
|
|
150
|
+
* @default "arktype"
|
|
151
|
+
*/
|
|
152
|
+
validator?: "arktype" | "standard";
|
|
153
|
+
};
|
|
154
|
+
/**
|
|
155
|
+
* TODO: `SchemaShape` is basically `Record<string, unknown>`.
|
|
156
|
+
* If possible, find a better type than "const T extends Record<string, unknown>",
|
|
157
|
+
* and be as close as possible to the type accepted by ArkType's `type`.
|
|
158
|
+
*/
|
|
159
|
+
/**
|
|
160
|
+
* Utility to parse environment variables using ArkType or Standard Schema
|
|
161
|
+
* @param def - The schema definition
|
|
162
|
+
* @param config - The evaluation configuration
|
|
163
|
+
* @returns The parsed environment variables
|
|
164
|
+
* @throws An {@link ArkEnvError | error} if the environment variables are invalid.
|
|
165
|
+
*/
|
|
166
|
+
declare function createEnv<const T extends SchemaShape>(def: EnvSchema<T>, config?: ArkEnvConfig): distill.Out<type.infer<T, $>>;
|
|
167
|
+
declare function createEnv<T extends EnvSchemaWithType>(def: T, config?: ArkEnvConfig): InferType<T>;
|
|
168
|
+
declare function createEnv<const T extends SchemaShape>(def: EnvSchema<T> | EnvSchemaWithType, config?: ArkEnvConfig): distill.Out<type.infer<T, $>> | InferType<typeof def>;
|
|
169
|
+
//#endregion
|
|
170
|
+
export { SchemaShape as i, EnvSchema as n, createEnv as r, ArkEnvConfig as t };
|
|
171
|
+
//# sourceMappingURL=create-env-gH1q_Fv8.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-env-gH1q_Fv8.d.cts","names":["Dict","T","Record","type","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","EnvSchemaWithType"],"sources":["../../internal/types/dist/helpers.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","import type { type } from \"arktype\";\n/**\n * Extract the inferred type from an ArkType type definition by checking its call signature.\n * When a type definition is called, it returns either the validated value or type.errors.\n *\n * @template T - The ArkType type definition to infer from\n */\nexport type InferType<T> = 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>;\nexport type EnvSchemaWithType = Type<SchemaShape, $>;\n//# sourceMappingURL=schema.d.ts.map"],"mappings":";;;;;;KAAYA,UAAUE,eAAeD;;;;;;;;AAArC;KCOYG,eAAeC,mBAAkBC,4DAA2DH,IAAAA,CAAKI,qBAAqBF;;QAE1HA,UAAUF,IAAAA,CAAKK;;;;;ADTvB;;;;ACOA,cCGcI,CDHFR,ECGKK,QAAAA,CAASiB,KDHL,CAAA;EAAMrB,MAAAA,ECIjBI,QAAAA,CAASM,SDJQV,CAAAA;IAAkBC,IAAAA,ECKnCG,QAAAA,CAASM,SDL0BT,CCKhBI,oCAAAA,CAAqCG,IAAAA,CAAKD,CDL1BN,GAAAA;MAAgEC,cAAAA,EAAAA,CAAAA,EAAAA,EAAAA,MAAAA,EAAAA,GCMvEI,+BAAAA,CAAgCG,EDNuCP,CAAAA,MAAAA,CAAAA;IAAqBF,CAAAA,CAAAA;IAE1HA,SAAAA,ECMOI,QAAAA,CAASM,SDNhBV,CCM0BK,oCAAAA,CAAqCM,SAAAA,CAAUJ,CDNzEP,GAAAA;MAAeG,cAAAA,EAAAA,CA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