arkenv 1.0.0-alpha.0 → 1.0.0-alpha.2

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.
Files changed (42) hide show
  1. package/README.md +1 -1
  2. package/dist/core-7-JO-N-w.d.cts +82 -0
  3. package/dist/core-7-JO-N-w.d.cts.map +1 -0
  4. package/dist/{core-B0IkKRzg.mjs → core-A65KioHX.mjs} +3 -3
  5. package/dist/core-A65KioHX.mjs.map +1 -0
  6. package/dist/core-BaGd9k2K.d.mts +76 -0
  7. package/dist/core-BaGd9k2K.d.mts.map +1 -0
  8. package/dist/{core-BftJnV8f.cjs → core-CA13n2Iu.cjs} +2 -2
  9. package/dist/core.cjs +1 -1
  10. package/dist/core.d.cts +3 -40
  11. package/dist/core.d.mts +2 -40
  12. package/dist/core.mjs +1 -1
  13. package/dist/errors-C_uh86xh.mjs +3 -0
  14. package/dist/errors-C_uh86xh.mjs.map +1 -0
  15. package/dist/errors-Dn6WQ2pP.cjs +8 -0
  16. package/dist/{index-CzNfOanV.d.cts → index-Do-2CL1V.d.cts} +2 -2
  17. package/dist/index-Do-2CL1V.d.cts.map +1 -0
  18. package/dist/{index-Br22fqkz.d.mts → index-NbQAnciD.d.mts} +2 -2
  19. package/dist/index-NbQAnciD.d.mts.map +1 -0
  20. package/dist/index.cjs +1 -1
  21. package/dist/index.d.cts +64 -20
  22. package/dist/index.d.cts.map +1 -1
  23. package/dist/index.d.mts +64 -20
  24. package/dist/index.d.mts.map +1 -1
  25. package/dist/index.mjs +1 -1
  26. package/dist/index.mjs.map +1 -1
  27. package/dist/standard.cjs +1 -1
  28. package/dist/standard.d.cts +26 -13
  29. package/dist/standard.d.cts.map +1 -1
  30. package/dist/standard.d.mts +26 -13
  31. package/dist/standard.d.mts.map +1 -1
  32. package/dist/standard.mjs +1 -1
  33. package/dist/standard.mjs.map +1 -1
  34. package/package.json +3 -3
  35. package/dist/core-B0IkKRzg.mjs.map +0 -1
  36. package/dist/core.d.cts.map +0 -1
  37. package/dist/core.d.mts.map +0 -1
  38. package/dist/index-Br22fqkz.d.mts.map +0 -1
  39. package/dist/index-CzNfOanV.d.cts.map +0 -1
  40. package/dist/shared-B7lIFzfk.mjs +0 -3
  41. package/dist/shared-B7lIFzfk.mjs.map +0 -1
  42. package/dist/shared-Bx3sbEJf.cjs +0 -8
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  <h1 align="center">ArkEnv</h1>
4
4
  <div align="center">
5
5
  <p align="center">
6
- Environment variable validation from editor to runtime<br/> for <a href="https://nextjs.org/">Next.js</a>, <a href="https://nodejs.org/">Node.js</a>, <a href="https://vite.dev/">Vite</a>, and <a href="https://bun.com/">Bun</a>
6
+ Environment variable validation from editor to runtime<br/> for <a href="https://nextjs.org/">Next.js</a>, <a href="https://nuxt.com/">Nuxt</a>, <a href="https://nodejs.org/">Node.js</a>, <a href="https://vite.dev/">Vite</a>, and <a href="https://bun.com/">Bun</a>
7
7
  </p>
8
8
  <a href="https://github.com/yamcodes/arkenv/actions/workflows/test.yml?query=branch%3Amain"><img alt="Test Status" src="https://github.com/yamcodes/arkenv/actions/workflows/tests-badge.yml/badge.svg?branch=main"></a>
9
9
  <a href="https://bundlephobia.com/package/arkenv"><img alt="npm bundle size" src="https://img.shields.io/bundlephobia/minzip/arkenv"></a>
@@ -0,0 +1,82 @@
1
+ //#region src/core.d.ts
2
+ /**
3
+ * Machine-readable classification codes for environment validation issues.
4
+ * Serves as the Source of Truth (SoT) for error categorization in ArkEnv.
5
+ */
6
+ type EnvIssueCode = /** The environment variable is required but was not provided, and has no default value. */"MISSING_VARIABLE" /** The variable value failed a type assertion (e.g., expected a number or boolean but received a string). */ | "INVALID_TYPE" /** The variable value falls below the minimum allowed numeric limit or string/array length constraint. */ | "VALUE_TOO_SMALL" /** The variable value exceeds the maximum allowed numeric limit or string/array length constraint. */ | "VALUE_TOO_LARGE" /** The variable value did not match the specified regular expression (regex) pattern constraint. */ | "PATTERN_MISMATCH" /** The variable value is not in a valid format (e.g., failed email or UUID format validation). */ | "INVALID_FORMAT" /** An undeclared key was found in the environment, and the schema config is set to reject undeclared keys. */ | "UNDECLARED_KEY" /** The provided validation schema definition itself is malformed or invalid. */ | "INVALID_SCHEMA" /** A validation error was triggered by a custom validator function or inline pipe logic. */ | "CUSTOM";
7
+ /**
8
+ * Metadata associated with an environment validation issue.
9
+ */
10
+ type EnvIssueMeta = {
11
+ /** The minimum expected boundary for numeric/string length constraints */min?: number; /** The maximum expected boundary for numeric/string length constraints */
12
+ max?: number; /** Additional validation pattern/specifier details */
13
+ validation?: string; /** Any custom constraint descriptions */
14
+ constraint?: string; /** Traversal error occurred during JSON-parsing of the environment variable */
15
+ traversalError?: string;
16
+ };
17
+ /**
18
+ * Normalized validation issue representing a failure on a specific environment variable.
19
+ */
20
+ type EnvIssue = {
21
+ /** The dot-separated property path/name of the environment variable */path: string; /** The descriptive, user-friendly error message */
22
+ message: string; /** The normalized classification code for the issue */
23
+ code: EnvIssueCode; /** The expected type or value shape description */
24
+ expected?: string; /** The raw value received (redacted in string formatting if sensitive) */
25
+ received?: unknown; /** Additional validation metadata */
26
+ meta?: EnvIssueMeta;
27
+ };
28
+ /**
29
+ * Format a list of normalized environment issues into a single styled string.
30
+ *
31
+ * @param issues - The array of normalized issues to format
32
+ * @returns The formatted and styled error report string
33
+ */
34
+ declare function formatIssues(issues: EnvIssue[]): string;
35
+ /**
36
+ * Error thrown when environment variable validation fails.
37
+ *
38
+ * This error extends the native `Error` class and provides formatted error messages
39
+ * that clearly indicate which environment variables are invalid and why.
40
+ *
41
+ * @example
42
+ * ```ts
43
+ * import arkenv from 'arkenv';
44
+ * import { ArkEnvError } from 'arkenv/core';
45
+ *
46
+ * try {
47
+ * const env = arkenv({
48
+ * PORT: 'number.port',
49
+ * HOST: 'string.host',
50
+ * });
51
+ * } catch (error) {
52
+ * if (error instanceof ArkEnvError) {
53
+ * console.error('Environment validation failed:', error.message);
54
+ * }
55
+ * }
56
+ * ```
57
+ */
58
+ declare class ArkEnvError extends Error {
59
+ /** The list of normalized issues that caused the validation failure */
60
+ readonly issues: EnvIssue[];
61
+ constructor(issues: EnvIssue[], message?: string);
62
+ }
63
+ /**
64
+ * Result of a non-throwing arkenv parse operation.
65
+ */
66
+ type SafeArkEnvResult<T> = {
67
+ success: true;
68
+ data: T;
69
+ } | {
70
+ success: false;
71
+ issues: readonly EnvIssue[];
72
+ };
73
+ //#endregion
74
+ export { SafeArkEnvResult as a, EnvIssueMeta as i, EnvIssue as n, formatIssues as o, EnvIssueCode as r, ArkEnvError as t };
75
+
76
+ // CJS Interop Shim
77
+ if (module.exports && module.exports.default) {
78
+ Object.assign(module.exports.default, module.exports);
79
+ module.exports = module.exports.default;
80
+ }
81
+
82
+ //# sourceMappingURL=core-7-JO-N-w.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core-7-JO-N-w.d.cts","names":[],"sources":["../src/core.ts"],"mappings":";;AAOA;;;KAAY,YAAA,0tBAuCZ;;;;KAhBY,YAAA;EA4BX,0EA1BA,GAAA,WA0BmB;EAxBnB,GAAA,WAiCe;EA/Bf,UAAA;EAEA,UAAA,WA6B8C;EA3B9C,cAAA;AAAA;;;;KAMW,QAAA;EAsD0B,uEApDrC,IAAA,UAoDgC;EAlDhC,OAAA,UAoDiB;EAlDjB,IAAA,EAAM,YAAA,EAqDG;EAnDT,QAAA,WAoDC;EAlDD,QAAA,YAkDgE;EAhDhE,IAAA,GAAO,YAAA;AAAA;;;;;;;iBASQ,YAAA,CAAa,MAAA,EAAQ,QAAA;;;;;;;;;;;;;;;;;;;;;;;;cAiCxB,WAAA,SAAoB,KAAA;;WAEvB,MAAA,EAAQ,QAAA;cAGhB,MAAA,EAAQ,QAAA,IACR,OAAA;AAAA;;;;KAcU,gBAAA;EACP,OAAA;EAAe,IAAA,EAAM,CAAA;AAAA;EACrB,OAAA;EAAgB,MAAA,WAAiB,QAAA;AAAA"}
@@ -1,6 +1,6 @@
1
1
  const e=(e,t=2,{dontDetectNewlines:n=!1}={})=>n?`${` `.repeat(t)}${e}`:e.split(`
2
2
  `).map(e=>`${` `.repeat(t)}${e}`).join(`
3
- `),t={red:`\x1B[31m`,yellow:`\x1B[33m`,cyan:`\x1B[36m`,reset:`\x1B[0m`},n=()=>typeof process<`u`&&process.versions!=null&&process.versions.node!=null,r=()=>!!(!n()||process.env.NO_COLOR!==void 0||process.env.CI!==void 0||process.stdout&&!process.stdout.isTTY),i=(e,i)=>n()&&!r()?`${t[e]}${i}${t.reset}`:i,a=e=>e.map(e=>`${i(`yellow`,e.path)} ${e.message.trimStart()}`).join(`
4
- `);var o=class extends Error{constructor(t,n=`Errors found while validating environment variables`){let r=a(t);super(`${i(`red`,n)}\n${e(r)}\n`),this.name=`ArkEnvError`}};Object.defineProperty(o,`name`,{value:`ArkEnvError`});export{a as n,i as r,o as t};
3
+ `),t={red:`\x1B[31m`,yellow:`\x1B[33m`,cyan:`\x1B[36m`,reset:`\x1B[0m`},n=()=>typeof process<`u`&&process.versions!=null&&process.versions.node!=null,r=()=>!!(!n()||process.env.NO_COLOR!==void 0||process.env.CI!==void 0||process.stdout&&!process.stdout.isTTY),i=(e,i)=>n()&&!r()?`${t[e]}${i}${t.reset}`:i;function a(e){return e.map(e=>`${i(`yellow`,e.path)} ${e.message.trimStart()}`).join(`
4
+ `)}var o=class extends Error{constructor(t,n=`Errors found while validating environment variables`){let r=a(t);super(`${i(`red`,n)}\n${e(r)}\n`),this.name=`ArkEnvError`,this.issues=t}};Object.defineProperty(o,`name`,{value:`ArkEnvError`});export{a as n,i as r,o as t};
5
5
 
6
- //# sourceMappingURL=core-B0IkKRzg.mjs.map
6
+ //# sourceMappingURL=core-A65KioHX.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core-A65KioHX.mjs","names":[],"sources":["../src/utils/indent.ts","../src/utils/style-text.ts","../src/core.ts"],"sourcesContent":["/**\n * Options for the `indent` function\n */\ntype IndentOptions = {\n\t/**\n\t * Whether to detect newlines and indent each line individually, defaults to false (indenting the whole string)\n\t */\n\tdontDetectNewlines?: boolean;\n};\n\n/**\n * Indent a string by a given amount\n * @param str - The string to indent\n * @param amt - The amount to indent by, defaults to 2\n * @param options - {@link IndentOptions}\n * @returns The indented string\n */\nexport const indent = (\n\tstr: string,\n\tamt = 2,\n\t{ dontDetectNewlines = false }: IndentOptions = {},\n) => {\n\tconst detectNewlines = !dontDetectNewlines;\n\tif (detectNewlines) {\n\t\treturn str\n\t\t\t.split(\"\\n\")\n\t\t\t.map((line) => `${\" \".repeat(amt)}${line}`)\n\t\t\t.join(\"\\n\");\n\t}\n\n\treturn `${\" \".repeat(amt)}${str}`;\n};\n","/**\n * Cross-platform text styling utility\n * Uses ANSI colors in Node environments, plain text in browsers\n * Respects NO_COLOR, CI environment variables, and TTY detection\n */\n\n// ANSI color codes for Node environments\nconst colors = {\n\tred: \"\\x1b[31m\",\n\tyellow: \"\\x1b[33m\",\n\tcyan: \"\\x1b[36m\",\n\treset: \"\\x1b[0m\",\n} as const;\n\n/**\n * Check if we're in a Node environment (not browser)\n * Checked dynamically to allow for testing with mocked globals\n */\nconst isNode = (): boolean =>\n\ttypeof process !== \"undefined\" &&\n\tprocess.versions != null &&\n\tprocess.versions.node != null;\n\n/**\n * Check if colors should be disabled based on environment\n * Respects NO_COLOR, CI environment variables, and TTY detection\n */\nconst shouldDisableColors = (): boolean => {\n\tif (!isNode()) return true;\n\n\t// Respect NO_COLOR environment variable (https://no-color.org/)\n\tif (process.env.NO_COLOR !== undefined) return true;\n\n\t// Disable colors in CI environments by default\n\tif (process.env.CI !== undefined) return true;\n\n\t// Disable colors if not writing to a TTY\n\tif (process.stdout && !process.stdout.isTTY) return true;\n\n\treturn false;\n};\n\n/**\n * Style text with color. Uses ANSI codes in Node, plain text in browsers.\n * @param color - The color to apply\n * @param text - The text to style\n * @returns Styled text in Node (if colors enabled), plain text otherwise\n */\nexport const styleText = (\n\tcolor: \"red\" | \"yellow\" | \"cyan\",\n\ttext: string,\n): string => {\n\t// Use ANSI colors only in Node environments with colors enabled\n\tif (isNode() && !shouldDisableColors()) {\n\t\treturn `${colors[color]}${text}${colors.reset}`;\n\t}\n\t// Fall back to plain text in browsers or when colors are disabled\n\treturn text;\n};\n","import { indent } from \"@/utils/indent\";\nimport { styleText } from \"@/utils/style-text\";\n\n/**\n * Machine-readable classification codes for environment validation issues.\n * Serves as the Source of Truth (SoT) for error categorization in ArkEnv.\n */\nexport type EnvIssueCode =\n\t/** The environment variable is required but was not provided, and has no default value. */\n\t| \"MISSING_VARIABLE\"\n\t/** The variable value failed a type assertion (e.g., expected a number or boolean but received a string). */\n\t| \"INVALID_TYPE\"\n\t/** The variable value falls below the minimum allowed numeric limit or string/array length constraint. */\n\t| \"VALUE_TOO_SMALL\"\n\t/** The variable value exceeds the maximum allowed numeric limit or string/array length constraint. */\n\t| \"VALUE_TOO_LARGE\"\n\t/** The variable value did not match the specified regular expression (regex) pattern constraint. */\n\t| \"PATTERN_MISMATCH\"\n\t/** The variable value is not in a valid format (e.g., failed email or UUID format validation). */\n\t| \"INVALID_FORMAT\"\n\t/** An undeclared key was found in the environment, and the schema config is set to reject undeclared keys. */\n\t| \"UNDECLARED_KEY\"\n\t/** The provided validation schema definition itself is malformed or invalid. */\n\t| \"INVALID_SCHEMA\"\n\t/** A validation error was triggered by a custom validator function or inline pipe logic. */\n\t| \"CUSTOM\";\n\n/**\n * Metadata associated with an environment validation issue.\n */\nexport type EnvIssueMeta = {\n\t/** The minimum expected boundary for numeric/string length constraints */\n\tmin?: number;\n\t/** The maximum expected boundary for numeric/string length constraints */\n\tmax?: number;\n\t/** Additional validation pattern/specifier details */\n\tvalidation?: string;\n\t/** Any custom constraint descriptions */\n\tconstraint?: string;\n\t/** Traversal error occurred during JSON-parsing of the environment variable */\n\ttraversalError?: string;\n};\n\n/**\n * Normalized validation issue representing a failure on a specific environment variable.\n */\nexport type EnvIssue = {\n\t/** The dot-separated property path/name of the environment variable */\n\tpath: string;\n\t/** The descriptive, user-friendly error message */\n\tmessage: string;\n\t/** The normalized classification code for the issue */\n\tcode: EnvIssueCode;\n\t/** The expected type or value shape description */\n\texpected?: string;\n\t/** The raw value received (redacted in string formatting if sensitive) */\n\treceived?: unknown;\n\t/** Additional validation metadata */\n\tmeta?: EnvIssueMeta;\n};\n\n/**\n * Format a list of normalized environment issues into a single styled string.\n *\n * @param issues - The array of normalized issues to format\n * @returns The formatted and styled error report string\n */\nexport function formatIssues(issues: EnvIssue[]): string {\n\treturn issues\n\t\t.map((issue) => {\n\t\t\tconst pathStr = styleText(\"yellow\", issue.path);\n\t\t\tconst messageStr = issue.message.trimStart();\n\t\t\treturn `${pathStr} ${messageStr}`;\n\t\t})\n\t\t.join(\"\\n\");\n}\n\n/**\n * Error thrown when environment variable validation fails.\n *\n * This error extends the native `Error` class and provides formatted error messages\n * that clearly indicate which environment variables are invalid and why.\n *\n * @example\n * ```ts\n * import arkenv from 'arkenv';\n * import { ArkEnvError } from 'arkenv/core';\n *\n * try {\n * const env = arkenv({\n * PORT: 'number.port',\n * HOST: 'string.host',\n * });\n * } catch (error) {\n * if (error instanceof ArkEnvError) {\n * console.error('Environment validation failed:', error.message);\n * }\n * }\n * ```\n */\nexport class ArkEnvError extends Error {\n\t/** The list of normalized issues that caused the validation failure */\n\treadonly issues: EnvIssue[];\n\n\tconstructor(\n\t\tissues: EnvIssue[],\n\t\tmessage = \"Errors found while validating environment variables\",\n\t) {\n\t\tconst formattedIssues = formatIssues(issues);\n\t\tsuper(`${styleText(\"red\", message)}\\n${indent(formattedIssues)}\\n`);\n\t\tthis.name = \"ArkEnvError\";\n\t\tthis.issues = issues;\n\t}\n}\n\nObject.defineProperty(ArkEnvError, \"name\", { value: \"ArkEnvError\" });\n\n/**\n * Result of a non-throwing arkenv parse operation.\n */\nexport type SafeArkEnvResult<T> =\n\t| { success: true; data: T }\n\t| { success: false; issues: readonly EnvIssue[] };\n"],"mappings":"AAiBA,MAAa,GACZ,EACA,EAAM,EACN,CAAE,qBAAqB,IAAyB,EAAE,GAE1B,EAQjB,GAAG,IAAI,OAAO,EAAI,GAAG,IANpB,EACL,MAAM;EAAK,CACX,IAAK,GAAS,GAAG,IAAI,OAAO,EAAI,GAAG,IAAO,CAC1C,KAAK;EAAK,CCpBR,EAAS,CACd,IAAK,WACL,OAAQ,WACR,KAAM,WACN,MAAO,UACP,CAMK,MACL,OAAO,QAAY,KACnB,QAAQ,UAAY,MACpB,QAAQ,SAAS,MAAQ,KAMpB,MAUL,GATI,CAAC,GAAQ,EAGT,QAAQ,IAAI,WAAa,IAAA,IAGzB,QAAQ,IAAI,KAAO,IAAA,IAGnB,QAAQ,QAAU,CAAC,QAAQ,OAAO,OAW1B,GACZ,EACA,IAGI,GAAQ,EAAI,CAAC,GAAqB,CAC9B,GAAG,EAAO,KAAS,IAAO,EAAO,QAGlC,ECUR,SAAgB,EAAa,EAA4B,CACxD,OAAO,EACL,IAAK,GAGE,GAFS,EAAU,SAAU,EAAM,KAEzB,CAAC,GADC,EAAM,QAAQ,WACF,GAC9B,CACD,KAAK;EAAK,CA0Bb,IAAa,EAAb,cAAiC,KAAM,CAItC,YACC,EACA,EAAU,sDACT,CACD,IAAM,EAAkB,EAAa,EAAO,CAC5C,MAAM,GAAG,EAAU,MAAO,EAAQ,CAAC,IAAI,EAAO,EAAgB,CAAC,IAAI,CACnE,KAAK,KAAO,cACZ,KAAK,OAAS,IAIhB,OAAO,eAAe,EAAa,OAAQ,CAAE,MAAO,cAAe,CAAC"}
@@ -0,0 +1,76 @@
1
+ //#region src/core.d.ts
2
+ /**
3
+ * Machine-readable classification codes for environment validation issues.
4
+ * Serves as the Source of Truth (SoT) for error categorization in ArkEnv.
5
+ */
6
+ type EnvIssueCode = /** The environment variable is required but was not provided, and has no default value. */"MISSING_VARIABLE" /** The variable value failed a type assertion (e.g., expected a number or boolean but received a string). */ | "INVALID_TYPE" /** The variable value falls below the minimum allowed numeric limit or string/array length constraint. */ | "VALUE_TOO_SMALL" /** The variable value exceeds the maximum allowed numeric limit or string/array length constraint. */ | "VALUE_TOO_LARGE" /** The variable value did not match the specified regular expression (regex) pattern constraint. */ | "PATTERN_MISMATCH" /** The variable value is not in a valid format (e.g., failed email or UUID format validation). */ | "INVALID_FORMAT" /** An undeclared key was found in the environment, and the schema config is set to reject undeclared keys. */ | "UNDECLARED_KEY" /** The provided validation schema definition itself is malformed or invalid. */ | "INVALID_SCHEMA" /** A validation error was triggered by a custom validator function or inline pipe logic. */ | "CUSTOM";
7
+ /**
8
+ * Metadata associated with an environment validation issue.
9
+ */
10
+ type EnvIssueMeta = {
11
+ /** The minimum expected boundary for numeric/string length constraints */min?: number; /** The maximum expected boundary for numeric/string length constraints */
12
+ max?: number; /** Additional validation pattern/specifier details */
13
+ validation?: string; /** Any custom constraint descriptions */
14
+ constraint?: string; /** Traversal error occurred during JSON-parsing of the environment variable */
15
+ traversalError?: string;
16
+ };
17
+ /**
18
+ * Normalized validation issue representing a failure on a specific environment variable.
19
+ */
20
+ type EnvIssue = {
21
+ /** The dot-separated property path/name of the environment variable */path: string; /** The descriptive, user-friendly error message */
22
+ message: string; /** The normalized classification code for the issue */
23
+ code: EnvIssueCode; /** The expected type or value shape description */
24
+ expected?: string; /** The raw value received (redacted in string formatting if sensitive) */
25
+ received?: unknown; /** Additional validation metadata */
26
+ meta?: EnvIssueMeta;
27
+ };
28
+ /**
29
+ * Format a list of normalized environment issues into a single styled string.
30
+ *
31
+ * @param issues - The array of normalized issues to format
32
+ * @returns The formatted and styled error report string
33
+ */
34
+ declare function formatIssues(issues: EnvIssue[]): string;
35
+ /**
36
+ * Error thrown when environment variable validation fails.
37
+ *
38
+ * This error extends the native `Error` class and provides formatted error messages
39
+ * that clearly indicate which environment variables are invalid and why.
40
+ *
41
+ * @example
42
+ * ```ts
43
+ * import arkenv from 'arkenv';
44
+ * import { ArkEnvError } from 'arkenv/core';
45
+ *
46
+ * try {
47
+ * const env = arkenv({
48
+ * PORT: 'number.port',
49
+ * HOST: 'string.host',
50
+ * });
51
+ * } catch (error) {
52
+ * if (error instanceof ArkEnvError) {
53
+ * console.error('Environment validation failed:', error.message);
54
+ * }
55
+ * }
56
+ * ```
57
+ */
58
+ declare class ArkEnvError extends Error {
59
+ /** The list of normalized issues that caused the validation failure */
60
+ readonly issues: EnvIssue[];
61
+ constructor(issues: EnvIssue[], message?: string);
62
+ }
63
+ /**
64
+ * Result of a non-throwing arkenv parse operation.
65
+ */
66
+ type SafeArkEnvResult<T> = {
67
+ success: true;
68
+ data: T;
69
+ } | {
70
+ success: false;
71
+ issues: readonly EnvIssue[];
72
+ };
73
+ //#endregion
74
+ export { SafeArkEnvResult as a, EnvIssueMeta as i, EnvIssue as n, formatIssues as o, EnvIssueCode as r, ArkEnvError as t };
75
+
76
+ //# sourceMappingURL=core-BaGd9k2K.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core-BaGd9k2K.d.mts","names":[],"sources":["../src/core.ts"],"mappings":";;AAOA;;;KAAY,YAAA,0tBAuCZ;;;;KAhBY,YAAA;EA4BX,0EA1BA,GAAA,WA0BmB;EAxBnB,GAAA,WAiCe;EA/Bf,UAAA;EAEA,UAAA,WA6B8C;EA3B9C,cAAA;AAAA;;;;KAMW,QAAA;EAsD0B,uEApDrC,IAAA,UAoDgC;EAlDhC,OAAA,UAoDiB;EAlDjB,IAAA,EAAM,YAAA,EAqDG;EAnDT,QAAA,WAoDC;EAlDD,QAAA,YAkDgE;EAhDhE,IAAA,GAAO,YAAA;AAAA;;;;;;;iBASQ,YAAA,CAAa,MAAA,EAAQ,QAAA;;;;;;;;;;;;;;;;;;;;;;;;cAiCxB,WAAA,SAAoB,KAAA;;WAEvB,MAAA,EAAQ,QAAA;cAGhB,MAAA,EAAQ,QAAA,IACR,OAAA;AAAA;;;;KAcU,gBAAA;EACP,OAAA;EAAe,IAAA,EAAM,CAAA;AAAA;EACrB,OAAA;EAAgB,MAAA,WAAiB,QAAA;AAAA"}
@@ -1,7 +1,7 @@
1
1
  const e=(e,t=2,{dontDetectNewlines:n=!1}={})=>n?`${` `.repeat(t)}${e}`:e.split(`
2
2
  `).map(e=>`${` `.repeat(t)}${e}`).join(`
3
- `),t={red:`\x1B[31m`,yellow:`\x1B[33m`,cyan:`\x1B[36m`,reset:`\x1B[0m`},n=()=>typeof process<`u`&&process.versions!=null&&process.versions.node!=null,r=()=>!!(!n()||process.env.NO_COLOR!==void 0||process.env.CI!==void 0||process.stdout&&!process.stdout.isTTY),i=(e,i)=>n()&&!r()?`${t[e]}${i}${t.reset}`:i,a=e=>e.map(e=>`${i(`yellow`,e.path)} ${e.message.trimStart()}`).join(`
4
- `);var o=class extends Error{constructor(t,n=`Errors found while validating environment variables`){let r=a(t);super(`${i(`red`,n)}\n${e(r)}\n`),this.name=`ArkEnvError`}};Object.defineProperty(o,`name`,{value:`ArkEnvError`}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return o}});
3
+ `),t={red:`\x1B[31m`,yellow:`\x1B[33m`,cyan:`\x1B[36m`,reset:`\x1B[0m`},n=()=>typeof process<`u`&&process.versions!=null&&process.versions.node!=null,r=()=>!!(!n()||process.env.NO_COLOR!==void 0||process.env.CI!==void 0||process.stdout&&!process.stdout.isTTY),i=(e,i)=>n()&&!r()?`${t[e]}${i}${t.reset}`:i;function a(e){return e.map(e=>`${i(`yellow`,e.path)} ${e.message.trimStart()}`).join(`
4
+ `)}var o=class extends Error{constructor(t,n=`Errors found while validating environment variables`){let r=a(t);super(`${i(`red`,n)}\n${e(r)}\n`),this.name=`ArkEnvError`,this.issues=t}};Object.defineProperty(o,`name`,{value:`ArkEnvError`}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return o}});
5
5
 
6
6
  // CJS Interop Shim
7
7
  if (module.exports && module.exports.default) {
package/dist/core.cjs CHANGED
@@ -1,4 +1,4 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./core-BftJnV8f.cjs`);exports.ArkEnvError=e.t,exports.formatInternalErrors=e.n;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./core-CA13n2Iu.cjs`);exports.ArkEnvError=e.t,exports.formatIssues=e.n;
2
2
 
3
3
  // CJS Interop Shim
4
4
  if (module.exports && module.exports.default) {
package/dist/core.d.cts CHANGED
@@ -1,46 +1,9 @@
1
- //#region src/core.d.ts
2
- /**
3
- * A single validation issue produced during environment variable parsing.
4
- * Used by {@link ArkEnvError} to report which key failed and why.
5
- */
6
- type ValidationIssue = {
7
- path: string;
8
- message: string;
9
- };
10
- declare const formatInternalErrors: (errors: ValidationIssue[]) => string;
11
- /**
12
- * Error thrown when environment variable validation fails.
13
- *
14
- * This error extends the native `Error` class and provides formatted error messages
15
- * that clearly indicate which environment variables are invalid and why.
16
- *
17
- * @example
18
- * ```ts
19
- * import arkenv from 'arkenv';
20
- * import { ArkEnvError } from 'arkenv/core';
21
- *
22
- * try {
23
- * const env = arkenv({
24
- * PORT: 'number.port',
25
- * HOST: 'string.host',
26
- * });
27
- * } catch (error) {
28
- * if (error instanceof ArkEnvError) {
29
- * console.error('Environment validation failed:', error.message);
30
- * }
31
- * }
32
- * ```
33
- */
34
- declare class ArkEnvError extends Error {
35
- constructor(errors: ValidationIssue[], message?: string);
36
- }
37
- //#endregion
38
- export { ArkEnvError, ValidationIssue, formatInternalErrors };
1
+ import { a as SafeArkEnvResult, i as EnvIssueMeta, n as EnvIssue, o as formatIssues, r as EnvIssueCode, t as ArkEnvError } from "./core-7-JO-N-w.cjs";
2
+ export { ArkEnvError, EnvIssue, EnvIssueCode, EnvIssueMeta, SafeArkEnvResult, formatIssues };
39
3
 
40
4
  // CJS Interop Shim
41
5
  if (module.exports && module.exports.default) {
42
6
  Object.assign(module.exports.default, module.exports);
43
7
  module.exports = module.exports.default;
44
8
  }
45
-
46
- //# sourceMappingURL=core.d.cts.map
9
+
package/dist/core.d.mts CHANGED
@@ -1,40 +1,2 @@
1
- //#region src/core.d.ts
2
- /**
3
- * A single validation issue produced during environment variable parsing.
4
- * Used by {@link ArkEnvError} to report which key failed and why.
5
- */
6
- type ValidationIssue = {
7
- path: string;
8
- message: string;
9
- };
10
- declare const formatInternalErrors: (errors: ValidationIssue[]) => string;
11
- /**
12
- * Error thrown when environment variable validation fails.
13
- *
14
- * This error extends the native `Error` class and provides formatted error messages
15
- * that clearly indicate which environment variables are invalid and why.
16
- *
17
- * @example
18
- * ```ts
19
- * import arkenv from 'arkenv';
20
- * import { ArkEnvError } from 'arkenv/core';
21
- *
22
- * try {
23
- * const env = arkenv({
24
- * PORT: 'number.port',
25
- * HOST: 'string.host',
26
- * });
27
- * } catch (error) {
28
- * if (error instanceof ArkEnvError) {
29
- * console.error('Environment validation failed:', error.message);
30
- * }
31
- * }
32
- * ```
33
- */
34
- declare class ArkEnvError extends Error {
35
- constructor(errors: ValidationIssue[], message?: string);
36
- }
37
- //#endregion
38
- export { ArkEnvError, ValidationIssue, formatInternalErrors };
39
-
40
- //# sourceMappingURL=core.d.mts.map
1
+ import { a as SafeArkEnvResult, i as EnvIssueMeta, n as EnvIssue, o as formatIssues, r as EnvIssueCode, t as ArkEnvError } from "./core-BaGd9k2K.mjs";
2
+ export { ArkEnvError, EnvIssue, EnvIssueCode, EnvIssueMeta, SafeArkEnvResult, formatIssues };
package/dist/core.mjs CHANGED
@@ -1 +1 @@
1
- import{n as e,t}from"./core-B0IkKRzg.mjs";export{t as ArkEnvError,e as formatInternalErrors};
1
+ import{n as e,t}from"./core-A65KioHX.mjs";export{t as ArkEnvError,e as formatIssues};
@@ -0,0 +1,3 @@
1
+ import{r as e,t}from"./core-A65KioHX.mjs";const n=e=>{if(typeof e==`number`||typeof e!=`string`||!e.trim())return e;if(e.trim()===`NaN`)return NaN;let t=Number(e);return Number.isNaN(t)?e:t},r=e=>e===`true`?!0:e===`false`?!1:e,i=e=>{if(typeof e!=`string`)return e;let t=e.trim();if(t[0]!==`{`&&t[0]!==`[`)return e;try{return JSON.parse(t)}catch{return e}},a=e=>{if(e instanceof Date||typeof e!=`string`||!e.trim())return e;let t=new Date(e);return Number.isNaN(t.getTime())?e:t},o=e=>{let t={};for(let n in e){let r=e[n];r!==``&&(t[n]=r)}return t},s=(e,t=[])=>{let n=[];if(!e||typeof e!=`object`||Array.isArray(e))return n;let r=e;if(`const`in r){let e=typeof r.const;(e===`number`||e===`boolean`)&&n.push({path:[...t],type:`primitive`})}`enum`in r&&Array.isArray(r.enum)&&r.enum.some(e=>typeof e==`number`||typeof e==`boolean`)&&n.push({path:[...t],type:`primitive`});let i=r.type;if(i===`number`||i===`integer`||i===`boolean`)n.push({path:[...t],type:`primitive`});else if(i===`string`&&`format`in r&&(r.format===`date-time`||r.format===`date`))n.push({path:[...t],type:`date`});else if(i===`object`){if(r.properties&&Object.keys(r.properties).length>0){n.push({path:[...t],type:`object`});for(let e in r.properties)n.push(...s(r.properties[e],[...t,e]))}}else i===`array`&&(n.push({path:[...t],type:`array`}),r.items&&(Array.isArray(r.items)?r.items.forEach((e,r)=>{n.push(...s(e,[...t,String(r)]))}):n.push(...s(r.items,[...t,`*`]))));for(let e of[`anyOf`,`allOf`,`oneOf`])if(r[e]&&Array.isArray(r[e]))for(let i of r[e])n.push(...s(i,t));let a=new Set;return n.filter(e=>{let t=e.path.join(`/`)+`:`+e.type;return a.has(t)?!1:a.add(t)})},c=(e,t,o={})=>{let{arrayFormat:s=`comma`}=o,c=e=>{if(s===`json`)try{return JSON.parse(e)}catch{return e}return e.trim()?e.split(`,`).map(e=>e.trim()):[]},l=(e,t)=>{if(t===`array`&&typeof e==`string`)return c(e);if(t===`object`&&typeof e==`string`)return i(e);if(t===`date`&&typeof e==`string`)return a(e);if(t===`primitive`){if(Array.isArray(e))return e.map(e=>{if(typeof e!=`string`)return e;let t=n(e);return typeof t==`number`?t:r(e)});if(typeof e!=`string`)return e;let t=n(e);return typeof t==`number`?t:r(e)}return e};if(typeof e!=`object`||!e){let n=t.find(e=>e.path.length===0);return n?l(e,n.type):e}let u=[...t].sort((e,t)=>e.path.length-t.path.length),d=(e,t,n)=>{if(t.length===0)return n(e);let[r,...i]=t;if(r===`*`){if(Array.isArray(e)){let t=!1,r=e.map(e=>{let r=d(e,i,n);return r!==e&&(t=!0),r});return t?r:e}return e}if(!e||typeof e!=`object`)return e;if(Array.isArray(e)){let t=Number(r);if(!Number.isNaN(t)&&t>=0&&t<e.length){let r=d(e[t],i,n);if(r!==e[t]){let n=[...e];return n[t]=r,n}}return e}if(Object.hasOwn(e,r)){let t=d(e[r],i,n);if(t!==e[r])return{...e,[r]:t}}return e},f=e;for(let e of u)e.path.length>0&&(f=d(f,e.path,t=>l(t,e.type)));return f};function l(e,t,n,r){let i=t?o(e):e,a={...i},l=[];if(r){let e=r();l.push(...e.missingKeys||[]),e.hasSchema&&(a=c(a,s(e.schema),{arrayFormat:n}))}return{processedEnv:i,coercedEnv:a,missingKeys:l}}const u=/secret|(_|^)key(_|$)|token|(_|^)password(_|$)|(_|^)pass(_|$)|(_|^)auth(_|$)|jwt|cert|credential|database_url|db_url/i;function d(e){if(e!==void 0)return e;if(typeof process>`u`)return!1;let t=process.env.ARKENV_DEBUG_SECRETS;return t===`true`||t===`1`}function f(e){return u.test(e)&&!/public/i.test(e)}function p(e,t,n){let r=d(n?.debugSecrets);if(e===void 0)return`missing`;if(e===null)return`null`;if(!r&&f(t))return`[REDACTED]`;if(typeof e==`string`)return JSON.stringify(e);if(typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`)return String(e);if(typeof e==`symbol`)return e.toString();if(typeof e==`function`)return`[Function]`;if(e&&typeof e==`object`)try{if(Array.isArray(e)){let r=e.slice(0,3).map(e=>p(e,t,n));return e.length>3&&r.push(`...(+${e.length-3} more)`),`[${r.join(`, `)}]`}let r=Object.keys(e),i=r.slice(0,3).map(r=>`${r}: ${p(e[r],t,n)}`);return r.length>3&&i.push(`...(+${r.length-3} more)`),`{ ${i.join(`, `)} }`}catch{return Object.prototype.toString.call(e)}return String(e)}const m={required:`MISSING_VARIABLE`,pattern:`PATTERN_MISMATCH`,min:`VALUE_TOO_SMALL`,minLength:`VALUE_TOO_SMALL`,max:`VALUE_TOO_LARGE`,maxLength:`VALUE_TOO_LARGE`,divisor:`INVALID_TYPE`,intersection:`INVALID_TYPE`,union:`INVALID_TYPE`,unit:`INVALID_TYPE`,proto:`INVALID_TYPE`,domain:`INVALID_TYPE`,exactLength:`INVALID_FORMAT`,before:`INVALID_FORMAT`,after:`INVALID_FORMAT`,predicate:`CUSTOM`};function h(e){return e in m?m[e]:`INVALID_FORMAT`}function g(e){let t=e.min??e.rule,n=e.max;return{...typeof t==`number`?{min:t}:{},...typeof n==`number`?{max:n}:{}}}const _={too_small:`VALUE_TOO_SMALL`,too_big:`VALUE_TOO_LARGE`,invalid_string:`INVALID_FORMAT`,invalid_date:`INVALID_FORMAT`,custom:`INVALID_FORMAT`};function v(e,t,n){let r=t.toLowerCase();return e===`invalid_type`&&(n===void 0||n===`undefined`)||r===`required`?`MISSING_VARIABLE`:e in _?_[e]:/regex|pattern|match/.test(r)?`PATTERN_MISMATCH`:`INVALID_TYPE`}function y(e){let t=e.minimum??e.min,n=e.maximum??e.max;return{...typeof t==`number`?{min:t}:{},...typeof n==`number`?{max:n}:{}}}function b(e){try{return{success:!0,data:e()}}catch(e){if(e instanceof t)return{success:!1,issues:e.issues};throw e}}function x(e,t,n,r,i,a){let o={path:e,message:t,code:n,meta:r??{}};return i&&(o.expected=i),a!==void 0&&(o.received=a),o}function S(t,n,r,i,a,o){if(n===`MISSING_VARIABLE`)return r?`must be ${r} (was missing)`:`is required`;if(t.includes(`(was `))return t;let s=`(was ${e(`cyan`,!d(o?.debugSecrets)&&f(a)?`[REDACTED]`:p(i,a,o))})`;return r&&!t.includes(`Expected`)?`must be ${r} ${s}`:`${t} ${s}`}function C(t,n,r){let i=t.match(/\(was (.*)\)/);if(!i?.[1])return t;let a=i[1],o=!d(r)&&f(n)?`[REDACTED]`:a;return o.includes(`\x1B[`)?t:t.replace(`(was ${a})`,`(was ${e(`cyan`,o)})`)}export{h as a,b as c,y as i,l,S as n,v as o,g as r,C as s,x as t};
2
+
3
+ //# sourceMappingURL=errors-C_uh86xh.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors-C_uh86xh.mjs","names":[],"sources":["../src/coercion/morphs.ts","../src/coercion/shared.ts","../src/coercion/environment.ts","../src/utils/redact.ts","../src/utils/errors.ts"],"sourcesContent":["/**\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\" || !s.trim()) return s;\n\tif (s.trim() === \"NaN\") return Number.NaN;\n\tconst n = Number(s);\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[0] !== \"{\" && trimmed[0] !== \"[\") return s;\n\ttry {\n\t\treturn JSON.parse(trimmed);\n\t} catch {\n\t\treturn s;\n\t}\n};\n\n/**\n * Attempt to coerce a value to a Date.\n *\n * If the input is already a Date, returns it unchanged.\n * If the input is a valid date string, returns a Date object.\n * Otherwise, returns the original value unchanged.\n *\n * @internal\n * @param s - The value to coerce\n * @returns The coerced Date or the original value\n */\nexport const coerceDate = (s: unknown) => {\n\tif (s instanceof Date) return s;\n\tif (typeof s !== \"string\" || !s.trim()) return s;\n\tconst d = new Date(s);\n\treturn Number.isNaN(d.getTime()) ? s : d;\n};\n","import type { Dict } from \"@repo/types\";\nimport { coerceBoolean, coerceDate, coerceJson, coerceNumber } from \"./morphs\";\n\n/**\n * Remove keys with empty string values from an environment record.\n *\n * When a key is set to `\"\"` (e.g. `PORT=` in a `.env` file), deleting it\n * allows the validator to treat it as missing so that defaults apply.\n *\n * @param env The environment variables record\n * @returns A new record with empty string keys removed\n */\nexport const stripEmptyStrings = (env: Dict<string>): Dict<string> => {\n\tconst result: Dict<string> = {};\n\tfor (const key in env) {\n\t\tconst value = env[key];\n\t\tif (value !== \"\") {\n\t\t\tresult[key] = value;\n\t\t}\n\t}\n\treturn result;\n};\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 */\nexport const ARRAY_ITEM_MARKER = \"*\";\n\n/**\n * @internal\n * Information about a path in the schema that requires coercion.\n */\nexport type CoercionTarget = {\n\tpath: string[];\n\ttype: \"primitive\" | \"array\" | \"object\" | \"date\";\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 * Internal representation of a JSON Schema node for coercion traversal.\n */\ntype JsonSchemaNode = {\n\ttype?: string | string[];\n\tconst?: unknown;\n\tenum?: unknown[];\n\tformat?: string;\n\tproperties?: Record<string, unknown>;\n\titems?: unknown | unknown[];\n\tanyOf?: unknown[];\n\tallOf?: unknown[];\n\toneOf?: unknown[];\n};\n\n/**\n * Find all paths in a JSON Schema that require coercion.\n *\n * Prioritize \"number\", \"integer\", \"boolean\", \"array\", \"object\", and \"date\" types.\n *\n * @param node The JSON Schema node to traverse\n * @param path The current path segments in the schema tree\n * @returns An array of coercion targets containing their path and type\n */\nexport const findCoercionPaths = (\n\tnode: unknown,\n\tpath: string[] = [],\n): CoercionTarget[] => {\n\tconst results: CoercionTarget[] = [];\n\tif (!node || typeof node !== \"object\" || Array.isArray(node)) return results;\n\n\tconst n = node as JsonSchemaNode;\n\n\tif (\"const\" in n) {\n\t\tconst t = typeof n.const;\n\t\tif (t === \"number\" || t === \"boolean\") {\n\t\t\tresults.push({ path: [...path], type: \"primitive\" });\n\t\t}\n\t}\n\n\tif (\"enum\" in n && Array.isArray(n.enum)) {\n\t\tif (n.enum.some((v) => typeof v === \"number\" || typeof v === \"boolean\")) {\n\t\t\tresults.push({ path: [...path], type: \"primitive\" });\n\t\t}\n\t}\n\n\tconst type = n.type;\n\tif (type === \"number\" || type === \"integer\" || type === \"boolean\") {\n\t\tresults.push({ path: [...path], type: \"primitive\" });\n\t} else if (\n\t\ttype === \"string\" &&\n\t\t\"format\" in n &&\n\t\t(n.format === \"date-time\" || n.format === \"date\")\n\t) {\n\t\tresults.push({ path: [...path], type: \"date\" });\n\t} else if (type === \"object\") {\n\t\tif (n.properties && Object.keys(n.properties).length > 0) {\n\t\t\tresults.push({ path: [...path], type: \"object\" });\n\t\t\tfor (const key in n.properties) {\n\t\t\t\tresults.push(...findCoercionPaths(n.properties[key], [...path, key]));\n\t\t\t}\n\t\t}\n\t} else if (type === \"array\") {\n\t\tresults.push({ path: [...path], type: \"array\" });\n\t\tif (n.items) {\n\t\t\tif (Array.isArray(n.items)) {\n\t\t\t\tn.items.forEach((item, index) => {\n\t\t\t\t\tresults.push(...findCoercionPaths(item, [...path, String(index)]));\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tresults.push(\n\t\t\t\t\t...findCoercionPaths(n.items, [...path, ARRAY_ITEM_MARKER]),\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (const comb of [\"anyOf\", \"allOf\", \"oneOf\"] as const) {\n\t\tif (n[comb] && Array.isArray(n[comb])) {\n\t\t\tfor (const branch of n[comb]) {\n\t\t\t\tresults.push(...findCoercionPaths(branch, path));\n\t\t\t}\n\t\t}\n\t}\n\n\tconst seen = new Set<string>();\n\treturn results.filter((t) => {\n\t\tconst key = t.path.join(\"/\") + \":\" + t.type;\n\t\treturn seen.has(key) ? false : seen.add(key);\n\t});\n};\n\n/**\n * Apply coercion to a data object based on identified paths.\n *\n * @param data The input environment data object to coerce\n * @param targets The coercion targets mapping paths to types\n * @param options The coercion options, including array parsing format\n * @returns The coerced data object\n */\nexport const applyCoercion = <T = unknown>(\n\tdata: T,\n\ttargets: CoercionTarget[],\n\toptions: CoerceOptions = {},\n): T => {\n\tconst { arrayFormat = \"comma\" } = options;\n\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\t\treturn val.trim() ? val.split(\",\").map((s) => s.trim()) : [];\n\t};\n\n\tconst coerceValue = (val: unknown, type: CoercionTarget[\"type\"]): unknown => {\n\t\tif (type === \"array\" && typeof val === \"string\") {\n\t\t\treturn splitString(val);\n\t\t}\n\t\tif (type === \"object\" && typeof val === \"string\") {\n\t\t\treturn coerceJson(val);\n\t\t}\n\t\tif (type === \"date\" && typeof val === \"string\") {\n\t\t\treturn coerceDate(val);\n\t\t}\n\t\tif (type === \"primitive\") {\n\t\t\tif (Array.isArray(val)) {\n\t\t\t\treturn val.map((item) => {\n\t\t\t\t\tif (typeof item !== \"string\") return item;\n\t\t\t\t\tconst n = coerceNumber(item);\n\t\t\t\t\treturn typeof n === \"number\" ? n : coerceBoolean(item);\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (typeof val !== \"string\") return val;\n\t\t\tconst n = coerceNumber(val);\n\t\t\treturn typeof n === \"number\" ? n : coerceBoolean(val);\n\t\t}\n\t\treturn val;\n\t};\n\n\tif (typeof data !== \"object\" || data === null) {\n\t\tconst root = targets.find((t) => t.path.length === 0);\n\t\tif (root) {\n\t\t\treturn coerceValue(data, root.type) as T;\n\t\t}\n\t\treturn data;\n\t}\n\n\tconst sorted = [...targets].sort((a, b) => a.path.length - b.path.length);\n\n\tconst updateAtPath = (\n\t\tcurrent: any,\n\t\tpath: string[],\n\t\tfn: (val: any) => any,\n\t): any => {\n\t\tif (path.length === 0) {\n\t\t\treturn fn(current);\n\t\t}\n\n\t\tconst [key, ...rest] = path;\n\n\t\tif (key === ARRAY_ITEM_MARKER) {\n\t\t\tif (Array.isArray(current)) {\n\t\t\t\tlet changed = false;\n\t\t\t\tconst nextArr = current.map((item) => {\n\t\t\t\t\tconst nextVal = updateAtPath(item, rest, fn);\n\t\t\t\t\tif (nextVal !== item) {\n\t\t\t\t\t\tchanged = true;\n\t\t\t\t\t}\n\t\t\t\t\treturn nextVal;\n\t\t\t\t});\n\t\t\t\treturn changed ? nextArr : current;\n\t\t\t}\n\t\t\treturn current;\n\t\t}\n\n\t\tif (!current || typeof current !== \"object\") {\n\t\t\treturn current;\n\t\t}\n\n\t\tif (Array.isArray(current)) {\n\t\t\tconst index = Number(key);\n\t\t\tif (!Number.isNaN(index) && index >= 0 && index < current.length) {\n\t\t\t\tconst nextVal = updateAtPath(current[index], rest, fn);\n\t\t\t\tif (nextVal !== current[index]) {\n\t\t\t\t\tconst copy = [...current];\n\t\t\t\t\tcopy[index] = nextVal;\n\t\t\t\t\treturn copy;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn current;\n\t\t}\n\n\t\tif (Object.hasOwn(current, key)) {\n\t\t\tconst nextVal = updateAtPath(current[key], rest, fn);\n\t\t\tif (nextVal !== current[key]) {\n\t\t\t\treturn {\n\t\t\t\t\t...current,\n\t\t\t\t\t[key]: nextVal,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\treturn current;\n\t};\n\n\tlet result = data;\n\tfor (const t of sorted) {\n\t\tif (t.path.length > 0) {\n\t\t\tresult = updateAtPath(result, t.path, (val) => coerceValue(val, t.type));\n\t\t}\n\t}\n\treturn result;\n};\n","import type { Dict } from \"@repo/types\";\nimport { applyCoercion, findCoercionPaths, stripEmptyStrings } from \"./shared\";\n\n/**\n * Prepare an environment record by optionally stripping empty strings and applying coercion.\n *\n * @param env The raw environment variables\n * @param emptyAsUndefined Whether to strip empty string values before processing\n * @param arrayFormat The format to use for array coercion\n * @param getSchema Optional callback that returns a JSON Schema and whether it exists,\n * used to determine coercion targets. When omitted, no coercion is performed.\n * @returns The processed environment, the coerced environment, and any missing schema keys\n */\nexport function coerceEnvironment(\n\tenv: Dict<string>,\n\temptyAsUndefined: boolean,\n\tarrayFormat: \"comma\" | \"json\",\n\tgetSchema?: () => {\n\t\tschema: unknown;\n\t\thasSchema: boolean;\n\t\tmissingKeys?: string[];\n\t},\n): {\n\tprocessedEnv: Dict<string>;\n\tcoercedEnv: Record<string, unknown>;\n\tmissingKeys: string[];\n} {\n\tconst processedEnv = emptyAsUndefined ? stripEmptyStrings(env) : env;\n\tlet coercedEnv: Record<string, unknown> = { ...processedEnv };\n\tconst missingKeys: string[] = [];\n\n\tif (getSchema) {\n\t\tconst result = getSchema();\n\t\tmissingKeys.push(...(result.missingKeys || []));\n\t\tif (result.hasSchema) {\n\t\t\tcoercedEnv = applyCoercion(coercedEnv, findCoercionPaths(result.schema), {\n\t\t\t\tarrayFormat,\n\t\t\t}) as Record<string, unknown>;\n\t\t}\n\t}\n\n\treturn { processedEnv, coercedEnv, missingKeys };\n}\n","/**\n * Regex pattern matching sensitive environment variable names.\n *\n * Matches keywords commonly associated with secrets (e.g. secret, key, token,\n * password, pass, auth, jwt, cert, credential, db_url). Excludes public keys\n * via the `shouldRedact` helper.\n *\n * @see {@link shouldRedact}\n */\nconst SENSITIVE_PATTERN =\n\t/secret|(_|^)key(_|$)|token|(_|^)password(_|$)|(_|^)pass(_|$)|(_|^)auth(_|$)|jwt|cert|credential|database_url|db_url/i;\n\n/**\n * Check if debug secrets mode is enabled.\n *\n * Debug secrets mode can be enabled programmatically via the `debugSecrets` config option,\n * or globally by setting the `ARKENV_DEBUG_SECRETS` environment variable to `\"true\"` or `\"1\"`.\n *\n * @param configSecrets Programmatic override option for debugging secrets\n * @returns A boolean indicating if debug secrets mode is active\n */\nexport function isDebugSecrets(configSecrets?: boolean): boolean {\n\tif (configSecrets !== undefined) return configSecrets;\n\tif (typeof process === \"undefined\") return false;\n\tconst val = process.env.ARKENV_DEBUG_SECRETS;\n\treturn val === \"true\" || val === \"1\";\n}\n\n/**\n * Determine if an environment variable path matches sensitive keyword patterns.\n *\n * By default, environment variables that contain sensitive keywords (e.g. 'secret', 'key',\n * 'token', 'password', 'auth', 'jwt', 'cert', 'credential', 'db_url') are flagged for redaction,\n * unless they are explicitly marked as public (e.g., matching 'public').\n *\n * Redaction prevents sensitive values from being logged or printed to the terminal\n * when environment validation fails.\n *\n * @param path The environment variable name/path under validation\n * @returns A boolean indicating if the path is sensitive and should be redacted\n */\nexport function shouldRedact(path: string): boolean {\n\treturn SENSITIVE_PATTERN.test(path) && !/public/i.test(path);\n}\n\n/**\n * Safely format and serialize an environment value for error reporting.\n *\n * Serializes primitive values and objects while redacting sensitive values if debugSecrets is disabled.\n * Limits object and array serialization to the first 3 keys/elements to prevent excessively large log outputs.\n *\n * @param val The raw received environment variable value\n * @param path The variable name/path under validation\n * @param options Configuration options, including debugSecrets override\n * @returns The formatted string representation of the value\n */\nexport function safeStringify(\n\tval: unknown,\n\tpath: string,\n\toptions?: { debugSecrets?: boolean },\n): string {\n\tconst debug = isDebugSecrets(options?.debugSecrets);\n\n\tif (val === undefined) return \"missing\";\n\tif (val === null) return \"null\";\n\n\tif (!debug && shouldRedact(path)) {\n\t\treturn \"[REDACTED]\";\n\t}\n\n\tif (typeof val === \"string\") return JSON.stringify(val);\n\tif (\n\t\ttypeof val === \"number\" ||\n\t\ttypeof val === \"boolean\" ||\n\t\ttypeof val === \"bigint\"\n\t) {\n\t\treturn String(val);\n\t}\n\tif (typeof val === \"symbol\") return val.toString();\n\tif (typeof val === \"function\") return \"[Function]\";\n\n\tif (val && typeof val === \"object\") {\n\t\ttry {\n\t\t\tif (Array.isArray(val)) {\n\t\t\t\tconst res = val.slice(0, 3).map((x) => safeStringify(x, path, options));\n\t\t\t\tif (val.length > 3) res.push(`...(+${val.length - 3} more)`);\n\t\t\t\treturn `[${res.join(\", \")}]`;\n\t\t\t}\n\t\t\tconst keys = Object.keys(val);\n\t\t\tconst res = keys\n\t\t\t\t.slice(0, 3)\n\t\t\t\t.map((k) => `${k}: ${safeStringify((val as any)[k], path, options)}`);\n\t\t\tif (keys.length > 3) res.push(`...(+${keys.length - 3} more)`);\n\t\t\treturn `{ ${res.join(\", \")} }`;\n\t\t} catch {\n\t\t\treturn Object.prototype.toString.call(val);\n\t\t}\n\t}\n\n\treturn String(val);\n}\n","import type { ArkError } from \"arktype\";\nimport {\n\tArkEnvError,\n\ttype EnvIssue,\n\ttype EnvIssueCode,\n\ttype EnvIssueMeta,\n\ttype SafeArkEnvResult,\n} from \"@/core\";\nimport { isDebugSecrets, safeStringify, shouldRedact } from \"./redact\";\nimport { styleText } from \"./style-text\";\n\n/**\n * Mapping of ArkType validation error codes to normalized EnvIssueCode classification codes.\n *\n * These codes are runtime strings produced by the ArkType validator and are not\n * exported as a public type or constant by the ArkType library. The mapping is\n * maintained manually based on ArkType's internal error reporting behavior.\n *\n * @see https://arktype.io/docs/intro\n * @internal\n */\nconst ARKTYPE_CODE_MAP = {\n\trequired: \"MISSING_VARIABLE\",\n\tpattern: \"PATTERN_MISMATCH\",\n\tmin: \"VALUE_TOO_SMALL\",\n\tminLength: \"VALUE_TOO_SMALL\",\n\tmax: \"VALUE_TOO_LARGE\",\n\tmaxLength: \"VALUE_TOO_LARGE\",\n\tdivisor: \"INVALID_TYPE\",\n\tintersection: \"INVALID_TYPE\",\n\tunion: \"INVALID_TYPE\",\n\tunit: \"INVALID_TYPE\",\n\tproto: \"INVALID_TYPE\",\n\tdomain: \"INVALID_TYPE\",\n\texactLength: \"INVALID_FORMAT\",\n\tbefore: \"INVALID_FORMAT\",\n\tafter: \"INVALID_FORMAT\",\n\tpredicate: \"CUSTOM\",\n} satisfies Record<ArkError[\"code\"], EnvIssueCode>;\n\n/**\n * Map an ArkType validation error code to a normalized EnvIssueCode.\n *\n * @param engineCode The raw code returned by the ArkType engine\n * @returns The normalized EnvIssueCode classification\n * @internal\n */\nexport function mapArkTypeCode(engineCode: string): EnvIssueCode {\n\treturn engineCode in ARKTYPE_CODE_MAP\n\t\t? ARKTYPE_CODE_MAP[engineCode as keyof typeof ARKTYPE_CODE_MAP]\n\t\t: \"INVALID_FORMAT\";\n}\n\n/**\n * Extract validation boundary metadata from an ArkType error object.\n *\n * @param error The raw error object from ArkType\n * @returns An object containing normalized min and/or max values if present\n * @internal\n */\nexport function getArkTypeMeta(error: any): { min?: number; max?: number } {\n\tconst min = error.min ?? error.rule;\n\tconst max = error.max;\n\treturn {\n\t\t...(typeof min === \"number\" ? { min } : {}),\n\t\t...(typeof max === \"number\" ? { max } : {}),\n\t};\n}\n\n/**\n * Mapping of Standard Schema validation issue codes to normalized EnvIssueCode classification codes.\n *\n * This serves as an internal translation map specifically for Standard Schema validators\n * (such as Zod or Valibot) to map their engine-specific error keys to our unified union type.\n * It is not a duplicate Source of Truth for the allowed issue codes themselves, which are\n * defined solely by the `EnvIssueCode` type in `core.ts`.\n *\n * @internal\n */\nconst STANDARD_CODE_MAP = {\n\ttoo_small: \"VALUE_TOO_SMALL\",\n\ttoo_big: \"VALUE_TOO_LARGE\",\n\tinvalid_string: \"INVALID_FORMAT\",\n\tinvalid_date: \"INVALID_FORMAT\",\n\tcustom: \"INVALID_FORMAT\",\n} satisfies Record<string, EnvIssueCode>;\n\n/**\n * Map a Standard Schema validation issue to a normalized EnvIssueCode.\n *\n * @param engineCode The raw issue code from the Standard Schema engine\n * @param message The error message associated with the issue\n * @param receivedVal The raw value received by the validator\n * @returns The normalized EnvIssueCode classification\n * @internal\n */\nexport function mapStandardCode(\n\tengineCode: string,\n\tmessage: string,\n\treceivedVal: unknown,\n): EnvIssueCode {\n\tconst msg = message.toLowerCase();\n\tif (\n\t\t(engineCode === \"invalid_type\" &&\n\t\t\t(receivedVal === undefined || receivedVal === \"undefined\")) ||\n\t\tmsg === \"required\"\n\t) {\n\t\treturn \"MISSING_VARIABLE\";\n\t}\n\tif (engineCode in STANDARD_CODE_MAP) {\n\t\treturn STANDARD_CODE_MAP[engineCode as keyof typeof STANDARD_CODE_MAP];\n\t}\n\tif (/regex|pattern|match/.test(msg)) {\n\t\treturn \"PATTERN_MISMATCH\";\n\t}\n\treturn \"INVALID_TYPE\";\n}\n\n/**\n * Extract validation boundary metadata from a Standard Schema issue.\n *\n * @param issue The raw issue from Standard Schema\n * @returns An object containing normalized min and/or max values if present\n * @internal\n */\nexport function getStandardMeta(issue: any): { min?: number; max?: number } {\n\tconst min = issue.minimum ?? issue.min;\n\tconst max = issue.maximum ?? issue.max;\n\treturn {\n\t\t...(typeof min === \"number\" ? { min } : {}),\n\t\t...(typeof max === \"number\" ? { max } : {}),\n\t};\n}\n\n/**\n * Execute a parser function and return a SafeArkEnvResult.\n *\n * @param parseFn The function that parses the environment variables and might throw an ArkEnvError\n * @returns A SafeArkEnvResult containing either the parsed data or the caught ArkEnvError\n * @internal\n */\nexport function safeExecute<T>(parseFn: () => T): SafeArkEnvResult<T> {\n\ttry {\n\t\treturn { success: true, data: parseFn() };\n\t} catch (error) {\n\t\tif (error instanceof ArkEnvError) {\n\t\t\treturn { success: false, issues: error.issues };\n\t\t}\n\t\tthrow error;\n\t}\n}\n\n/**\n * Build a normalized {@link EnvIssue}.\n *\n * @param path The dot-separated property path/name of the environment variable\n * @param message The descriptive, user-friendly error message\n * @param code The normalized classification code for the issue\n * @param meta Additional validation metadata and engine codes\n * @param expected The expected type or value shape description\n * @param received The raw value received (redacted in string formatting if sensitive)\n * @returns A fully populated EnvIssue\n * @internal\n */\nexport function buildEnvIssue(\n\tpath: string,\n\tmessage: string,\n\tcode: EnvIssueCode,\n\tmeta?: EnvIssueMeta,\n\texpected?: string,\n\treceived?: unknown,\n): EnvIssue {\n\tconst issue: EnvIssue = { path, message, code, meta: meta ?? {} };\n\tif (expected) issue.expected = expected;\n\tif (received !== undefined) issue.received = received;\n\treturn issue;\n}\n\n/**\n * Format a Standard Schema validation issue message, appending a `(was …)` suffix\n * and redacting sensitive values when appropriate.\n *\n * @param baseMessage The raw message from the Standard Schema validator\n * @param code The normalized issue code\n * @param expected The expected type description, if any\n * @param receivedVal The raw value received by the validator\n * @param path The environment variable name/path under validation\n * @param config Optional config containing the debugSecrets override\n * @returns The formatted message string\n * @internal\n */\nexport function formatStandardIssueMessage(\n\tbaseMessage: string,\n\tcode: EnvIssueCode,\n\texpected: string | undefined,\n\treceivedVal: unknown,\n\tpath: string,\n\tconfig?: { debugSecrets?: boolean },\n): string {\n\tif (code === \"MISSING_VARIABLE\") {\n\t\treturn expected ? `must be ${expected} (was missing)` : \"is required\";\n\t}\n\n\tif (baseMessage.includes(\"(was \")) return baseMessage;\n\n\tconst debug = isDebugSecrets(config?.debugSecrets);\n\tconst displayVal =\n\t\t!debug && shouldRedact(path)\n\t\t\t? \"[REDACTED]\"\n\t\t\t: safeStringify(receivedVal, path, config);\n\tconst suffix = `(was ${styleText(\"cyan\", displayVal)})`;\n\n\treturn expected && !baseMessage.includes(\"Expected\")\n\t\t? `must be ${expected} ${suffix}`\n\t\t: `${baseMessage} ${suffix}`;\n}\n\n/**\n * Redact the value inside an existing `(was <value>)` substring within a message.\n *\n * ArkType already embeds `(was …)` in its error messages; this helper swaps the\n * raw value for `[REDACTED]` when the path is sensitive and debug mode is off,\n * and styles the result in cyan.\n *\n * @param message The message containing `(was <value>)`\n * @param path The environment variable name/path under validation\n * @param debugSecrets Optional override for debug secrets mode\n * @returns The message with redacted/styled `(was …)` value\n * @internal\n */\nexport function redactMessageWasValue(\n\tmessage: string,\n\tpath: string,\n\tdebugSecrets?: boolean,\n): string {\n\tconst valueMatch = message.match(/\\(was (.*)\\)/);\n\tif (!valueMatch?.[1]) return message;\n\n\tconst value = valueMatch[1];\n\tconst debug = isDebugSecrets(debugSecrets);\n\tconst displayedValue = !debug && shouldRedact(path) ? \"[REDACTED]\" : value;\n\n\tif (displayedValue.includes(\"\\x1b[\")) return message;\n\n\treturn message.replace(\n\t\t`(was ${value})`,\n\t\t`(was ${styleText(\"cyan\", displayedValue)})`,\n\t);\n}\n"],"mappings":"0CAWA,MAAa,EAAgB,GAAe,CAE3C,GADI,OAAO,GAAM,UACb,OAAO,GAAM,UAAY,CAAC,EAAE,MAAM,CAAE,OAAO,EAC/C,GAAI,EAAE,MAAM,GAAK,MAAO,MAAO,KAC/B,IAAM,EAAI,OAAO,EAAE,CACnB,OAAO,OAAO,MAAM,EAAE,CAAG,EAAI,GAajB,EAAiB,GACzB,IAAM,OAAe,GACrB,IAAM,QAAgB,GACnB,EAaK,EAAc,GAAe,CACzC,GAAI,OAAO,GAAM,SAAU,OAAO,EAClC,IAAM,EAAU,EAAE,MAAM,CACxB,GAAI,EAAQ,KAAO,KAAO,EAAQ,KAAO,IAAK,OAAO,EACrD,GAAI,CACH,OAAO,KAAK,MAAM,EAAQ,MACnB,CACP,OAAO,IAeI,EAAc,GAAe,CAEzC,GADI,aAAa,MACb,OAAO,GAAM,UAAY,CAAC,EAAE,MAAM,CAAE,OAAO,EAC/C,IAAM,EAAI,IAAI,KAAK,EAAE,CACrB,OAAO,OAAO,MAAM,EAAE,SAAS,CAAC,CAAG,EAAI,GC3D3B,EAAqB,GAAoC,CACrE,IAAM,EAAuB,EAAE,CAC/B,IAAK,IAAM,KAAO,EAAK,CACtB,IAAM,EAAQ,EAAI,GACd,IAAU,KACb,EAAO,GAAO,GAGhB,OAAO,GAqDK,GACZ,EACA,EAAiB,EAAE,GACG,CACtB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CAAS,EAEtC,EAAQ,QACd,QAAQ,EAAM,GACd,QAAQ,EAAU,OAAQ,EAAe,CAAC,GAC1C"}
@@ -0,0 +1,8 @@
1
+ const e=require(`./core-CA13n2Iu.cjs`),t=e=>{if(typeof e==`number`||typeof e!=`string`||!e.trim())return e;if(e.trim()===`NaN`)return NaN;let t=Number(e);return Number.isNaN(t)?e:t},n=e=>e===`true`?!0:e===`false`?!1:e,r=e=>{if(typeof e!=`string`)return e;let t=e.trim();if(t[0]!==`{`&&t[0]!==`[`)return e;try{return JSON.parse(t)}catch{return e}},i=e=>{if(e instanceof Date||typeof e!=`string`||!e.trim())return e;let t=new Date(e);return Number.isNaN(t.getTime())?e:t},a=e=>{let t={};for(let n in e){let r=e[n];r!==``&&(t[n]=r)}return t},o=(e,t=[])=>{let n=[];if(!e||typeof e!=`object`||Array.isArray(e))return n;let r=e;if(`const`in r){let e=typeof r.const;(e===`number`||e===`boolean`)&&n.push({path:[...t],type:`primitive`})}`enum`in r&&Array.isArray(r.enum)&&r.enum.some(e=>typeof e==`number`||typeof e==`boolean`)&&n.push({path:[...t],type:`primitive`});let i=r.type;if(i===`number`||i===`integer`||i===`boolean`)n.push({path:[...t],type:`primitive`});else if(i===`string`&&`format`in r&&(r.format===`date-time`||r.format===`date`))n.push({path:[...t],type:`date`});else if(i===`object`){if(r.properties&&Object.keys(r.properties).length>0){n.push({path:[...t],type:`object`});for(let e in r.properties)n.push(...o(r.properties[e],[...t,e]))}}else i===`array`&&(n.push({path:[...t],type:`array`}),r.items&&(Array.isArray(r.items)?r.items.forEach((e,r)=>{n.push(...o(e,[...t,String(r)]))}):n.push(...o(r.items,[...t,`*`]))));for(let e of[`anyOf`,`allOf`,`oneOf`])if(r[e]&&Array.isArray(r[e]))for(let i of r[e])n.push(...o(i,t));let a=new Set;return n.filter(e=>{let t=e.path.join(`/`)+`:`+e.type;return a.has(t)?!1:a.add(t)})},s=(e,a,o={})=>{let{arrayFormat:s=`comma`}=o,c=e=>{if(s===`json`)try{return JSON.parse(e)}catch{return e}return e.trim()?e.split(`,`).map(e=>e.trim()):[]},l=(e,a)=>{if(a===`array`&&typeof e==`string`)return c(e);if(a===`object`&&typeof e==`string`)return r(e);if(a===`date`&&typeof e==`string`)return i(e);if(a===`primitive`){if(Array.isArray(e))return e.map(e=>{if(typeof e!=`string`)return e;let r=t(e);return typeof r==`number`?r:n(e)});if(typeof e!=`string`)return e;let r=t(e);return typeof r==`number`?r:n(e)}return e};if(typeof e!=`object`||!e){let t=a.find(e=>e.path.length===0);return t?l(e,t.type):e}let u=[...a].sort((e,t)=>e.path.length-t.path.length),d=(e,t,n)=>{if(t.length===0)return n(e);let[r,...i]=t;if(r===`*`){if(Array.isArray(e)){let t=!1,r=e.map(e=>{let r=d(e,i,n);return r!==e&&(t=!0),r});return t?r:e}return e}if(!e||typeof e!=`object`)return e;if(Array.isArray(e)){let t=Number(r);if(!Number.isNaN(t)&&t>=0&&t<e.length){let r=d(e[t],i,n);if(r!==e[t]){let n=[...e];return n[t]=r,n}}return e}if(Object.hasOwn(e,r)){let t=d(e[r],i,n);if(t!==e[r])return{...e,[r]:t}}return e},f=e;for(let e of u)e.path.length>0&&(f=d(f,e.path,t=>l(t,e.type)));return f};function c(e,t,n,r){let i=t?a(e):e,c={...i},l=[];if(r){let e=r();l.push(...e.missingKeys||[]),e.hasSchema&&(c=s(c,o(e.schema),{arrayFormat:n}))}return{processedEnv:i,coercedEnv:c,missingKeys:l}}const l=/secret|(_|^)key(_|$)|token|(_|^)password(_|$)|(_|^)pass(_|$)|(_|^)auth(_|$)|jwt|cert|credential|database_url|db_url/i;function u(e){if(e!==void 0)return e;if(typeof process>`u`)return!1;let t=process.env.ARKENV_DEBUG_SECRETS;return t===`true`||t===`1`}function d(e){return l.test(e)&&!/public/i.test(e)}function f(e,t,n){let r=u(n?.debugSecrets);if(e===void 0)return`missing`;if(e===null)return`null`;if(!r&&d(t))return`[REDACTED]`;if(typeof e==`string`)return JSON.stringify(e);if(typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`)return String(e);if(typeof e==`symbol`)return e.toString();if(typeof e==`function`)return`[Function]`;if(e&&typeof e==`object`)try{if(Array.isArray(e)){let r=e.slice(0,3).map(e=>f(e,t,n));return e.length>3&&r.push(`...(+${e.length-3} more)`),`[${r.join(`, `)}]`}let r=Object.keys(e),i=r.slice(0,3).map(r=>`${r}: ${f(e[r],t,n)}`);return r.length>3&&i.push(`...(+${r.length-3} more)`),`{ ${i.join(`, `)} }`}catch{return Object.prototype.toString.call(e)}return String(e)}const p={required:`MISSING_VARIABLE`,pattern:`PATTERN_MISMATCH`,min:`VALUE_TOO_SMALL`,minLength:`VALUE_TOO_SMALL`,max:`VALUE_TOO_LARGE`,maxLength:`VALUE_TOO_LARGE`,divisor:`INVALID_TYPE`,intersection:`INVALID_TYPE`,union:`INVALID_TYPE`,unit:`INVALID_TYPE`,proto:`INVALID_TYPE`,domain:`INVALID_TYPE`,exactLength:`INVALID_FORMAT`,before:`INVALID_FORMAT`,after:`INVALID_FORMAT`,predicate:`CUSTOM`};function m(e){return e in p?p[e]:`INVALID_FORMAT`}function h(e){let t=e.min??e.rule,n=e.max;return{...typeof t==`number`?{min:t}:{},...typeof n==`number`?{max:n}:{}}}const g={too_small:`VALUE_TOO_SMALL`,too_big:`VALUE_TOO_LARGE`,invalid_string:`INVALID_FORMAT`,invalid_date:`INVALID_FORMAT`,custom:`INVALID_FORMAT`};function _(e,t,n){let r=t.toLowerCase();return e===`invalid_type`&&(n===void 0||n===`undefined`)||r===`required`?`MISSING_VARIABLE`:e in g?g[e]:/regex|pattern|match/.test(r)?`PATTERN_MISMATCH`:`INVALID_TYPE`}function v(e){let t=e.minimum??e.min,n=e.maximum??e.max;return{...typeof t==`number`?{min:t}:{},...typeof n==`number`?{max:n}:{}}}function y(t){try{return{success:!0,data:t()}}catch(t){if(t instanceof e.t)return{success:!1,issues:t.issues};throw t}}function b(e,t,n,r,i,a){let o={path:e,message:t,code:n,meta:r??{}};return i&&(o.expected=i),a!==void 0&&(o.received=a),o}function x(t,n,r,i,a,o){if(n===`MISSING_VARIABLE`)return r?`must be ${r} (was missing)`:`is required`;if(t.includes(`(was `))return t;let s=`(was ${e.r(`cyan`,!u(o?.debugSecrets)&&d(a)?`[REDACTED]`:f(i,a,o))})`;return r&&!t.includes(`Expected`)?`must be ${r} ${s}`:`${t} ${s}`}function S(t,n,r){let i=t.match(/\(was (.*)\)/);if(!i?.[1])return t;let a=i[1],o=!u(r)&&d(n)?`[REDACTED]`:a;return o.includes(`\x1B[`)?t:t.replace(`(was ${a})`,`(was ${e.r(`cyan`,o)})`)}Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return b}});
2
+
3
+ // CJS Interop Shim
4
+ if (module.exports && module.exports.default) {
5
+ Object.assign(module.exports.default, module.exports);
6
+ module.exports = module.exports.default;
7
+ }
8
+
@@ -179,7 +179,7 @@ declare namespace StandardSchemaV1 {
179
179
  *
180
180
  * @template T - The schema definition to infer from
181
181
  */
182
- 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 {
182
+ type InferType<T> = T extends StandardSchemaV1<infer _Input, infer Output> ? Output : T extends ((value: Dict<string>) => infer R) ? R extends type.errors ? never : R : T extends {
183
183
  t: infer U;
184
184
  } ? U : T extends type.Any<infer U, infer _Scope> ? U : never;
185
185
  //#endregion
@@ -207,4 +207,4 @@ if (module.exports && module.exports.default) {
207
207
  module.exports = module.exports.default;
208
208
  }
209
209
 
210
- //# sourceMappingURL=index-CzNfOanV.d.cts.map
210
+ //# sourceMappingURL=index-Do-2CL1V.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-Do-2CL1V.d.cts","names":["_$arktype","_$arktype_internal_keywords_string_ts0","_$arktype_internal_attributes_ts0","$","trim","To","Submodule","normalize","capitalize","stringDate","stringInteger","ip","stringJson","lower","stringNumeric","url","uuid","Scope","string","In","root","alpha","alphanumeric","hex","base64","creditCard","date","digits","email","integer","json","numeric","regex","semver","upper","preformatted","host","number","NaN","Infinity","epoch","safe","NegativeInfinity","port","Dict","T","Record","StandardTypedV1","Input","Output","Props","Schema","Types","NonNullable","version","vendor","types","input","output","InferInput","InferOutput","StandardSchemaV1","Options","Result","Promise","SuccessResult","FailureResult","Record","Issue","ReadonlyArray","PropertyKey","PathSegment","validate","value","options","issues","libraryOptions","message","path","key","StandardJSONSchemaV1","Converter","Target","jsonSchema","target","type","Dict","StandardSchemaV1","InferType","T","errors","Any","_Input","Output","value","R","t","U","_Scope","$","Type","SchemaShape","Record","CompiledEnvSchema"],"sources":["../../internal/scope/dist/index.d.ts","../../internal/types/dist/helpers.d.ts","../../internal/types/dist/standard-schema.d.ts","../../internal/types/dist/infer-type.d.ts","../../internal/types/dist/schema.d.ts"],"mappings":";;;;;;;;AAEoF;;;;cAQtEG,CAAAA,EAAGH,SAAAA,CAAUiB,KAAAA;EACzBC,MAAAA,EAAQlB,SAAAA,CAAUM,SAAAA;IAChBF,IAAAA,EAAMJ,SAAAA,CAAUM,SAAAA,CAAUL,sCAAAA,CAAuCG,IAAAA,CAAKD,CAAAA;MACpE,cAAA,GAAiBgB,EAAAA,aAAejB,iCAAAA,CAAkCG,EAAAA;IAAAA;IAEpEE,SAAAA,EAAWP,SAAAA,CAAUM,SAAAA,CAAUL,sCAAAA,CAAuCM,SAAAA,CAAUJ,CAAAA;MAC9E,cAAA,GAAi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CAAMJ,KAAAA,EAAOC,MAAAA;EFnDpFlC;EAAAA,KEsDG4C,UAAAA,gBAA0BZ,eAAAA,IAAmBA,eAAAA,CAAgBY,UAAAA,CAAWR,MAAAA;EFlD7E3C;EAAAA,KEoDKoD,WAAAA,gBAA2Bb,eAAAA,IAAmBA,eAAAA,CAAgBa,WAAAA,CAAYT,MAAAA;AAAAA;;;;;;AF9EC;;;;;;KGUxEqC,SAAAA,MAAeC,CAAAA,SAAUF,gBAAAA,+BAA+CM,MAAAA,GAASJ,CAAAA,WAAWK,KAAAA,EAAOR,IAAAA,wBAA2BS,CAAAA,SAAUV,IAAAA,CAAKK,MAAAA,WAAiBK,CAAAA,GAAIN,CAAAA;EAC1KO,CAAAA;AAAAA,IACAC,CAAAA,GAAIR,CAAAA,SAAUJ,IAAAA,CAAKM,GAAAA,0BAA6BM,CAAAA;;;KCZxCI,WAAAA,GAAcC,MAAAA;;;;AJA0D;;;;;;;;;KIaxEC,iBAAAA,GAAoBH,IAAAA,CAAKC,WAAAA,EAAaF,CAAAA"}
@@ -179,7 +179,7 @@ declare namespace StandardSchemaV1 {
179
179
  *
180
180
  * @template T - The schema definition to infer from
181
181
  */
182
- 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 {
182
+ type InferType<T> = T extends StandardSchemaV1<infer _Input, infer Output> ? Output : T extends ((value: Dict<string>) => infer R) ? R extends type.errors ? never : R : T extends {
183
183
  t: infer U;
184
184
  } ? U : T extends type.Any<infer U, infer _Scope> ? U : never;
185
185
  //#endregion
@@ -201,4 +201,4 @@ type CompiledEnvSchema = Type<SchemaShape, $>;
201
201
  //#endregion
202
202
  export { Dict as a, StandardSchemaV1 as i, SchemaShape as n, $ as o, InferType as r, CompiledEnvSchema as t };
203
203
 
204
- //# sourceMappingURL=index-Br22fqkz.d.mts.map
204
+ //# sourceMappingURL=index-NbQAnciD.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-NbQAnciD.d.mts","names":["_$arktype","_$arktype_internal_keywords_string_ts0","_$arktype_internal_attributes_ts0","$","trim","To","Submodule","normalize","capitalize","stringDate","stringInteger","ip","stringJson","lower","stringNumeric","url","uuid","Scope","string","In","root","alpha","alphanumeric","hex","base64","creditCard","date","digits","email","integer","json","numeric","regex","semver","upper","preformatted","host","number","NaN","Infinity","epoch","safe","NegativeInfinity","port","Dict","T","Record","StandardTypedV1","Input","Output","Props","Schema","Types","NonNullable","version","vendor","types","input","output","InferInput","InferOutput","StandardSchemaV1","Options","Result","Promise","SuccessResult","FailureResult","Record","Issue","ReadonlyArray","PropertyKey","PathSegment","validate","value","options","issues","libraryOptions","message","path","key","StandardJSONSchemaV1","Converter","Target","jsonSchema","target","type","Dict","StandardSchemaV1","InferType","T","errors","Any","_Input","Output","value","R","t","U","_Scope","$","Type","SchemaShape","Record","CompiledEnvSchema"],"sources":["../../internal/scope/dist/index.d.ts","../../internal/types/dist/helpers.d.ts","../../internal/types/dist/standard-schema.d.ts","../../internal/types/dist/infer-type.d.ts","../../internal/types/dist/schema.d.ts"],"mappings":";;;;;;;;AAEoF;;;;cAQtEG,CAAAA,EAAGH,SAAAA,CAAUiB,KAAAA;EACzBC,MAAAA,EAAQlB,SAAAA,CAAUM,SAAAA;IAChBF,IAAAA,EAAMJ,SAAAA,CAAUM,SAAAA,CAAUL,sCAAAA,CAAuCG,IAAAA,CAAKD,CAAAA;MACpE,cAAA,GAAiBgB,EAAAA,aAAejB,iCAAAA,CAAkCG,EAAAA;IAAAA;IAEpEE,SAAAA,EAAWP,SAAAA,CAAUM,SAAAA,CAAUL,sCAAAA,CAAuCM,SAAAA,CAAUJ,CAAAA;MAC9E,cAAA,GAAiBgB,EAAAA,aAAejB,iCAAAA,CAAkCG,EAAAA;IAAAA;IAEpEe,IAAAA;IACAC,KAAAA;IACAC,YAAAA;IACAC,GAAAA;IACAC,MAAAA,EAAQxB,SAAAA,CAAUM,SAAAA;M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DKoD,WAAAA,gBAA2Bb,eAAAA,IAAmBA,eAAAA,CAAgBa,WAAAA,CAAYT,MAAAA;AAAAA;;;;;;AF9EC;;;;;;KGUxEqC,SAAAA,MAAeC,CAAAA,SAAUF,gBAAAA,+BAA+CM,MAAAA,GAASJ,CAAAA,WAAWK,KAAAA,EAAOR,IAAAA,wBAA2BS,CAAAA,SAAUV,IAAAA,CAAKK,MAAAA,WAAiBK,CAAAA,GAAIN,CAAAA;EAC1KO,CAAAA;AAAAA,IACAC,CAAAA,GAAIR,CAAAA,SAAUJ,IAAAA,CAAKM,GAAAA,0BAA6BM,CAAAA;;;KCZxCI,WAAAA,GAAcC,MAAAA;;;;AJA0D;;;;;;;;;KIaxEC,iBAAAA,GAAoBH,IAAAA,CAAKC,WAAAA,EAAaF,CAAAA"}
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require(`./shared-Bx3sbEJf.cjs`),t=require(`./core-BftJnV8f.cjs`);let n=require(`arktype`);const r=(0,n.type)(`0 <= number.integer <= 65535`),i=(0,n.type)(`string.ip | 'localhost'`),a=(0,n.scope)({string:n.type.module({...n.type.keywords.string,host:i}),number:n.type.module({...n.type.keywords.number,port:r})});function o(e){return Object.entries(e.byPath).map(([e,n])=>{let r=n.message,i=r.trimStart();if(i.length>0&&`:.-`.includes(i[0])&&(i=i.slice(1).trimStart()),i.toLowerCase().startsWith(e.toLowerCase())){let t=i.slice(e.length).trimStart();t.length>0&&`:.-`.includes(t[0])&&(t=t.slice(1)),r=t.trimStart()}let a=r.match(/\(was (.*)\)/);if(a?.[1]){let e=a[1];e.includes(`\x1B[`)||(r=r.replace(`(was ${e})`,`(was ${t.r(`cyan`,e)})`))}return{path:e,message:r}})}function s(r,i){let{env:s=process.env,coerce:c=!0,onUndeclaredKey:l=`delete`,arrayFormat:u=`comma`,emptyAsUndefined:d=!1}=i,f=(typeof r==`function`&&`assert`in r?r:a.type.raw(r)).onUndeclaredKey(l),p={...d?e.r(s):s};if(c){let t=e.n(f.in.toJsonSchema({fallback:e=>e.base}));t.length>0&&(p=e.t(p,t,{arrayFormat:u}))}let m=f(p);if(m instanceof n.ArkErrors)throw new t.t(o(m));return m}function c(e,t={}){return s(e,t)}const l=a.type,u=c;exports.createEnv=c,exports.default=u,exports.type=l;
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require(`./errors-Dn6WQ2pP.cjs`),t=require(`./core-CA13n2Iu.cjs`);let n=require(`arktype`);const r=(0,n.type)(`0 <= number.integer <= 65535`),i=(0,n.type)(`string.ip | 'localhost'`),a=(0,n.scope)({string:n.type.module({...n.type.keywords.string,host:i}),number:n.type.module({...n.type.keywords.number,port:r})});function o(t,n){return Object.entries(t.byPath).map(([t,r])=>{let i=r.message,a=i.trimStart();if(a.length>0&&`:.-`.includes(a[0])&&(a=a.slice(1).trimStart()),a.toLowerCase().startsWith(t.toLowerCase())){let e=a.slice(t.length).trimStart();e.length>0&&`:.-`.includes(e[0])&&(e=e.slice(1)),i=e.trimStart()}i=e.s(i,t,n?.debugSecrets);let o=e.a(r.code),s={...e.r(r)};return e.t(t,i,o,s,r.expected,r.code===`required`?void 0:r.data)})}function s(r,i){let{env:s=process.env,coerce:c=!0,onUndeclaredKey:l=`delete`,arrayFormat:u=`comma`,emptyAsUndefined:d=!1}=i,f=(typeof r==`function`&&`assert`in r?r:a.type.raw(r)).onUndeclaredKey(l),{coercedEnv:p}=e.l(s,d,u,c?()=>({schema:f.in.toJsonSchema({fallback:e=>e.base}),hasSchema:!0}):void 0),m=f(p);if(m instanceof n.ArkErrors)throw new t.t(o(m,i));return m}function c(t,n={}){return n.safe?e.c(()=>s(t,n)):s(t,n)}function l(e){if(!e||typeof e!=`object`&&typeof e!=`function`)return[];if(e.json&&typeof e.json==`object`&&e.json.domain===`object`){let t=[];if(Array.isArray(e.json.required))for(let n of e.json.required)n&&typeof n==`object`&&`key`in n&&t.push(n.key);if(Array.isArray(e.json.optional))for(let n of e.json.optional)n&&typeof n==`object`&&`key`in n&&t.push(n.key);return t}let t=e[`~standard`],n=typeof t?.jsonSchema?.input==`function`&&t.jsonSchema.input||typeof e.jsonSchema?.input==`function`&&e.jsonSchema.input;if(n)try{let e=n({target:`draft-07`});if(e&&typeof e==`object`&&e.properties)return Object.keys(e.properties)}catch{}if(typeof e.toJSONSchema==`function`)try{let t=e.toJSONSchema();if(t&&typeof t==`object`&&t.properties)return Object.keys(t.properties)}catch{}if(typeof e.toStandardJSONSchema?.v1==`function`)try{let t=e.toStandardJSONSchema.v1();if(t&&typeof t==`object`&&t.properties)return Object.keys(t.properties)}catch{}return Object.keys(e)}const u=a.type;var d=c;exports.arkenv=c,exports.default=d,exports.getSchemaKeys=l,exports.type=u;
2
2
 
3
3
  // CJS Interop Shim
4
4
  if (module.exports && module.exports.default) {