@arkenv/core 1.0.0-alpha.3 → 1.0.0-alpha.4

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["n","t","r","i","e","isDebugSecrets","shouldRedact","styleText","buildEnvIssue","$","coerceEnvironment","ArkEnvError","safeExecute","$"],"sources":["../../internal/scope/dist/index.js","../../internal/utils/dist/index.js","../src/arktype/index.ts","../src/arkenv.ts","../src/index.ts"],"sourcesContent":["import{scope as e,type as t}from\"arktype\";const n=t(`0 <= number.integer <= 65535`),r=t(`string.ip | 'localhost'`),i=e({string:t.module({...t.keywords.string,host:r}),number:t.module({...t.keywords.number,port:n})});export{i as $};\n//# sourceMappingURL=index.js.map","const e=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},t=e=>e===`true`?!0:e===`false`?!1:e,n=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}},r=e=>{if(e instanceof Date||typeof e!=`string`||!e.trim())return e;let t=new Date(e);return Number.isNaN(t.getTime())?e:t},i=e=>{let t={};for(let n in e){let r=e[n];r!==``&&(t[n]=r)}return t},a=`*`,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=(i,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=(i,a)=>{if(a===`array`&&typeof i==`string`)return c(i);if(a===`object`&&typeof i==`string`)return n(i);if(a===`date`&&typeof i==`string`)return r(i);if(a===`primitive`){if(Array.isArray(i))return i.map(n=>{if(typeof n!=`string`)return n;let r=e(n);return typeof r==`number`?r:t(n)});if(typeof i!=`string`)return i;let n=e(i);return typeof n==`number`?n:t(i)}return i};if(typeof i!=`object`||!i){let e=a.find(e=>e.path.length===0);return e?l(i,e.type):i}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=i;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 a=t?i(e):e,c={...a},l=[];if(r){let e=r();l.push(...e.missingKeys||[]),e.hasSchema&&(c=s(c,o(e.schema),{arrayFormat:n}))}return{processedEnv:a,coercedEnv:c,missingKeys:l}}const l=(e,t=2,{dontDetectNewlines:n=!1}={})=>n?`${` `.repeat(t)}${e}`:e.split(`\n`).map(e=>`${` `.repeat(t)}${e}`).join(`\n`),u={red:`\\x1B[31m`,yellow:`\\x1B[33m`,cyan:`\\x1B[36m`,reset:`\\x1B[0m`},d=()=>typeof process<`u`&&process.versions!=null&&process.versions.node!=null,f=()=>!!(!d()||process.env.NO_COLOR!==void 0||process.env.CI!==void 0||process.stdout&&!process.stdout.isTTY),p=(e,t)=>d()&&!f()?`${u[e]}${t}${u.reset}`:t;function m(e){return e.map(e=>`${p(`yellow`,e.path)} ${e.message.trimStart()}`).join(`\n`)}var h=class extends Error{constructor(e,t=`Errors found while validating environment variables`){let n=m(e);super(`${p(`red`,t)}\\n${l(n)}\\n`),this.name=`ArkEnvError`,this.issues=e}};Object.defineProperty(h,`name`,{value:`ArkEnvError`});function g(e,t){if(typeof t==`string`)throw new h([{path:e,message:`ArkType DSL strings are not supported in \"standard\" mode. Use a Standard Schema validator (e.g., Zod, Valibot) or import from \"arkenv\" for ArkType schemas.`,code:`INVALID_SCHEMA`}])}function _(e,t){let n=t&&typeof t==`object`&&`~standard`in t&&t[`~standard`];if(!n||typeof n!=`object`||!(`validate`in n)||typeof n.validate!=`function`)throw new h([{path:e,message:`Invalid validator: expected a Standard Schema 1.0 validator (must have \"~standard\" property). Import from \"arkenv\" to use ArkType schemas.`,code:`INVALID_SCHEMA`}])}function v(e){if(!e||typeof e!=`object`||Array.isArray(e))throw new h([{path:``,message:`Invalid schema: expected an object mapping in \"standard\" mode.`,code:`INVALID_SCHEMA`}])}const y=/secret|(_|^)key(_|$)|token|(_|^)password(_|$)|(_|^)pass(_|$)|(_|^)auth(_|$)|jwt|cert|credential|database_url|db_url/i;function b(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 x(e){return y.test(e)&&!/public/i.test(e)}function S(e,t,n){let r=b(n?.debugSecrets);if(e===void 0)return`missing`;if(e===null)return`null`;if(!r&&x(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=>S(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}: ${S(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 C={too_small:`VALUE_TOO_SMALL`,too_big:`VALUE_TOO_LARGE`,invalid_string:`INVALID_FORMAT`,invalid_date:`INVALID_FORMAT`,custom:`INVALID_FORMAT`};function w(e,t,n){let r=t.toLowerCase();return e===`invalid_type`&&(n===void 0||n===`undefined`)||r===`required`?`MISSING_VARIABLE`:e in C?C[e]:/regex|pattern|match/.test(r)?`PATTERN_MISMATCH`:`INVALID_TYPE`}function T(e){let t=e.minimum??e.min,n=e.maximum??e.max;return{...typeof t==`number`?{min:t}:{},...typeof n==`number`?{max:n}:{}}}function E(e){try{return{success:!0,data:e()}}catch(e){if(e instanceof h)return{success:!1,issues:e.issues};throw e}}function D(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 O(e,t,n,r,i,a){if(t===`MISSING_VARIABLE`)return n?`must be ${n} (was missing)`:`is required`;if(e.includes(`(was `))return e;let o=`(was ${p(`cyan`,!b(a?.debugSecrets)&&x(i)?`[REDACTED]`:S(r,i,a))})`;return n&&!e.includes(`Expected`)?`must be ${n} ${o}`:`${e} ${o}`}function k(e){let t={type:`object`,properties:{}},n=!1,r=[];for(let i in e){let a=e[i];if(!a){r.push(i);continue}let o=a[`~standard`];if(typeof o?.jsonSchema?.input==`function`)try{let e=o.jsonSchema.input({target:`draft-07`});if(e){t.properties[i]=e,n=!0;continue}}catch{}if(typeof a.jsonSchema?.input==`function`)try{let e=a.jsonSchema.input({target:`draft-07`});if(e){t.properties[i]=e,n=!0;continue}}catch{}if(typeof a.toJSONSchema==`function`)try{let e=a.toJSONSchema();if(e){t.properties[i]=e,n=!0;continue}}catch{}if(typeof a.toStandardJSONSchema?.v1==`function`)try{let e=a.toStandardJSONSchema.v1();if(e){t.properties[i]=e,n=!0;continue}}catch{}r.push(i)}return{jsonSchema:t,hasJsonSchema:n,missingKeys:r}}function A(e){return typeof e==`object`&&e&&`key`in e?String(e.key):String(e)}function j(e,t){return!t||t.length===0?e:[e,...t.map(A)].join(`.`)}function M(e,t){let n=e,r;try{let i=e,a=e.trim();if(a[0]===`{`||a[0]===`[`)try{i=JSON.parse(e)}catch(e){r=`[Unparseable JSON: ${e.message}]`}if(!r){for(let e of t)i=i?.[A(e)];n=i}}catch(e){r=`[Traversal error: ${e.message}]`}return{receivedVal:n,traversalError:r}}function N(e,t){let{env:n=process.env,onUndeclaredKey:r=`delete`,coerce:i=!0,arrayFormat:a=`comma`,emptyAsUndefined:o=!1}=t,s={},l=[],{processedEnv:u,coercedEnv:d,missingKeys:f}=c(n,o,a,i?()=>{let{jsonSchema:t,hasJsonSchema:n,missingKeys:r}=k(e);return{schema:t,hasSchema:n,missingKeys:r}}:void 0),p=new Set(Object.keys(u));for(let n in e){let r=e[n],a=d[n];if(!r||typeof r!=`object`||!(`~standard`in r))throw new h([D(n,`Invalid schema: expected a Standard Schema 1.0 validator (e.g. Zod, Valibot) in 'standard' mode.`,`INVALID_SCHEMA`)]);let o=r[`~standard`].validate(a);if(o instanceof Promise)throw new h([D(n,`Async validation is not supported. ArkEnv is synchronous.`,`INVALID_SCHEMA`)]);if(o.issues)for(let e of o.issues){let r=j(n,e.path),a,o;if(n in u){let t=u[n];if(typeof t==`string`&&e.path?.length){let n=M(t,e.path);a=n.receivedVal,o=n.traversalError}else a=t}else a=e.received;let s=w(e.code||`invalid_type`,e.message||``,a),c=e.expected||void 0,d={...T(e)},p=e;p.validation!==void 0&&(d.validation=p.validation),o!==void 0&&(d.traversalError=o);let m=O(e.message||``,s,c,a,r,t);i&&f.includes(n)&&(m+=` (Hint: coercion is enabled by default, but the validator for '${n}' lacks Standard JSON Schema support.)`),l.push(D(r,m,s,d,c,a))}else s[n]=o.value;p.delete(n)}if(r!==`delete`)for(let e of p)r===`reject`?l.push(D(e,`Undeclared key`,`UNDECLARED_KEY`)):r===`ignore`&&(s[e]=d[e]);if(l.length>0)throw new h(l);return s}function P(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)}export{a as ARRAY_ITEM_MARKER,h as ArkEnvError,s as applyCoercion,g as assertNotArkTypeDsl,_ as assertStandardSchema,v as assertStandardSchemaMap,D as buildEnvIssue,t as coerceBoolean,r as coerceDate,c as coerceEnvironment,n as coerceJson,e as coerceNumber,k as extractJsonSchema,o as findCoercionPaths,j as formatIssuePath,m as formatIssues,O as formatStandardIssueMessage,A as getProp,P as getSchemaKeys,T as getStandardMeta,l as indent,b as isDebugSecrets,w as mapStandardCode,N as parseStandard,E as safeExecute,S as safeStringify,x as shouldRedact,i as stripEmptyStrings,p as styleText,M as traverseReceivedValue};\n//# sourceMappingURL=index.js.map","import { $ } from \"@repo/scope\";\nimport type { SchemaShape } from \"@repo/types\";\nimport {\n\tArkEnvError,\n\tbuildEnvIssue,\n\tcoerceEnvironment,\n\ttype EnvIssue,\n\ttype EnvIssueCode,\n\ttype EnvIssueMeta,\n\tisDebugSecrets,\n\tshouldRedact,\n\tstyleText,\n} from \"@repo/utils\";\nimport type { ArkError, distill } from \"arktype\";\nimport { ArkErrors } from \"arktype\";\nimport type { ArkEnvConfig, EnvSchema } from \"@/arkenv\";\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 error code to an ArkEnv issue code.\n *\n * @param engineCode The ArkType engine error code\n * @returns The corresponding ArkEnv issue code\n */\nfunction 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 numeric bounds from an ArkType error object.\n *\n * @param error The ArkType error object\n * @returns An object containing optional min and max bounds\n */\nfunction 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 * Redact and colorize the value inside a \"(was ...)\" message fragment.\n *\n * @param message The validation error message\n * @param path The environment variable key path\n * @param debugSecrets Whether to display sensitive values in debug mode\n * @returns The modified error message with styled or redacted value\n */\nfunction 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\n/**\n * Re-export of ArkType's `distill` utilities.\n *\n * Exposed for internal use cases and type-level integrations.\n * ArkEnv does not add behavior or guarantees beyond what ArkType provides.\n *\n * @internal\n * @see https://github.com/arktypeio/arktype\n */\nexport type { distill };\n\n/**\n * Convert ArkType's `ArkErrors` (keyed by path) into a flat `EnvIssue[]`\n * suitable for `ArkEnvError`.\n *\n * @param errors The ArkType errors object to convert\n * @param config Optional ArkEnvConfig to read debugSecrets options\n * @returns An array of flattened validation issues\n *\n * @internal\n */\nfunction arkErrorsToIssues(\n\terrors: ArkErrors,\n\tconfig?: ArkEnvConfig,\n): EnvIssue[] {\n\treturn Object.entries(errors.byPath).map(([path, error]) => {\n\t\tlet message = error.message;\n\n\t\t// Strip leading path reference if ArkType included it in the message\n\t\tlet trimmed = message.trimStart();\n\t\tif (trimmed.length > 0 && \":.-\".includes(trimmed[0])) {\n\t\t\ttrimmed = trimmed.slice(1).trimStart();\n\t\t}\n\t\tif (trimmed.toLowerCase().startsWith(path.toLowerCase())) {\n\t\t\tlet rest = trimmed.slice(path.length).trimStart();\n\t\t\tif (rest.length > 0 && \":.-\".includes(rest[0])) {\n\t\t\t\trest = rest.slice(1);\n\t\t\t}\n\t\t\tmessage = rest.trimStart();\n\t\t}\n\n\t\t// Redact and style (was ...) inline values\n\t\tmessage = redactMessageWasValue(message, path, config?.debugSecrets);\n\n\t\t// Map code and metadata using centralized helpers\n\t\tconst code = mapArkTypeCode(error.code);\n\t\tconst bounds = getArkTypeMeta(error);\n\t\tconst meta: EnvIssueMeta = {\n\t\t\t...bounds,\n\t\t};\n\n\t\treturn buildEnvIssue(\n\t\t\tpath,\n\t\t\tmessage,\n\t\t\tcode,\n\t\t\tmeta,\n\t\t\terror.expected,\n\t\t\terror.code === \"required\" ? undefined : error.data,\n\t\t);\n\t});\n}\n\n/**\n * Parse and validate environment variables using ArkEnv's schema rules.\n *\n * This applies:\n * - schema validation\n * - optional coercion (strings → numbers, booleans, arrays)\n * - undeclared key handling\n *\n * On success, returns the validated environment object.\n * On failure, throws an {@link ArkEnvError}.\n *\n * This is a low-level utility used internally by ArkEnv.\n * Most users should prefer the default `arkenv()` export.\n *\n * @param def The ArkType schema definition to validate against\n * @param config The configuration object for parsing and coercion\n * @returns The parsed and validated environment variables\n * @throws {@link ArkEnvError} if validation fails\n *\n * @internal\n */\nexport function parse<const T extends SchemaShape>(\n\tdef: EnvSchema<T>,\n\tconfig: ArkEnvConfig,\n) {\n\tconst {\n\t\tenv = process.env,\n\t\tcoerce: shouldCoerce = true,\n\t\tonUndeclaredKey = \"delete\",\n\t\tarrayFormat = \"comma\",\n\t\temptyAsUndefined = false,\n\t} = config;\n\n\t// If def is a type definition (has assert method), use it directly\n\t// Otherwise, use raw() to convert the schema definition\n\tconst isCompiledType = typeof def === \"function\" && \"assert\" in def;\n\tconst schema = (isCompiledType ? def : $.type.raw(def)) as any;\n\n\t// Apply the `onUndeclaredKey` option\n\tconst schemaWithKeys = schema.onUndeclaredKey(onUndeclaredKey);\n\n\t// Optionally strip empty strings and apply coercion\n\tconst { coercedEnv } = coerceEnvironment(\n\t\tenv,\n\t\temptyAsUndefined,\n\t\tarrayFormat,\n\t\tshouldCoerce\n\t\t\t? () => {\n\t\t\t\t\tconst json = schemaWithKeys.in.toJsonSchema({\n\t\t\t\t\t\tfallback: (ctx: { base: unknown }) => ctx.base,\n\t\t\t\t\t});\n\t\t\t\t\treturn { schema: json, hasSchema: true };\n\t\t\t\t}\n\t\t\t: undefined,\n\t);\n\n\t// Validate the environment variables\n\tconst validatedEnv = schemaWithKeys(coercedEnv);\n\n\t// In ArkType 2.x, calling a type as a function returns the validated data or ArkErrors.\n\tif (validatedEnv instanceof ArkErrors) {\n\t\tthrow new ArkEnvError(arkErrorsToIssues(validatedEnv, config));\n\t}\n\n\treturn validatedEnv;\n}\n","import type { $ } from \"@repo/scope\";\nimport type {\n\tCompiledEnvSchema,\n\tDict,\n\tInferType,\n\tSchemaShape,\n\tStandardSchemaV1,\n} from \"@repo/types\";\nimport { ArkEnvError, type SafeArkEnvResult, safeExecute } from \"@repo/utils\";\nimport type { type as at, distill } from \"arktype\";\nimport { parse } from \"./arktype\";\n\n/**\n * Declarative environment schema definition accepted by ArkEnv.\n *\n * Represents a declarative schema object mapping environment\n * variable names to schema definitions (e.g. ArkType DSL strings\n * or Standard Schema validators).\n *\n * This type is used to validate that a schema object is compatible with\n * ArkEnv’s validator scope before being compiled or parsed.\n *\n * Most users will provide schemas in this form.\n *\n * @template def - The schema shape object\n */\nexport type EnvSchema<def> = at.validate<def, $>;\n\n/**\n * Infer the validated and coerced environment object type from a schema.\n * Supports declarative schema shapes, compiled ArkType schemas, and Standard Schema validators.\n *\n * @template T - The schema type\n */\nexport type Infer<T> =\n\tT extends StandardSchemaV1<infer _Input, infer Output>\n\t\t? Output\n\t\t: T extends { t: infer U }\n\t\t\t? U\n\t\t\t: T extends at.Any<infer U, infer _Scope>\n\t\t\t\t? U\n\t\t\t\t: T extends SchemaShape\n\t\t\t\t\t? distill.Out<at.infer<T, $>>\n\t\t\t\t\t: InferType<T>;\n\n/**\n * The environment variables passed to `arkenv`.\n * Uses `Dict<string>` to enforce\n * compile-time safety: all input environment variables must be strings\n * (or undefined), matching `process.env` semantics.\n */\ntype RuntimeEnvironment = Dict<string>;\n\n/**\n * Configuration options for `arkenv`\n */\nexport type ArkEnvConfig = {\n\t/**\n\t * The environment variables to parse. Defaults to `process.env`\n\t */\n\tenv?: RuntimeEnvironment;\n\t/**\n\t * Whether to coerce environment variables to their defined types. Defaults to `true`\n\t */\n\tcoerce?: boolean;\n\t/**\n\t * Control how ArkEnv handles environment variables that are not defined in your schema.\n\t *\n\t * Defaults to `'delete'` to ensure your output object only contains\n\t * keys you've explicitly declared. This differs from ArkType's standard behavior, which\n\t * mirrors TypeScript by defaulting to `'ignore'`.\n\t *\n\t * - `delete` (ArkEnv default): Undeclared keys are allowed on input but stripped from the output.\n\t * - `ignore` (ArkType default): Undeclared keys are allowed and preserved in the output.\n\t * - `reject`: Undeclared keys will cause validation to fail.\n\t *\n\t * @default \"delete\"\n\t * @see https://arktype.io/docs/configuration#onundeclaredkey\n\t */\n\tonUndeclaredKey?: \"ignore\" | \"delete\" | \"reject\";\n\n\t/**\n\t * The format to use for array parsing when coercion is enabled.\n\t *\n\t * - `comma` (default): Strings are split by comma and trimmed.\n\t * - `json`: Strings are parsed as JSON.\n\t *\n\t * @default \"comma\"\n\t */\n\tarrayFormat?: \"comma\" | \"json\";\n\n\t/**\n\t * Whether to bypass secret redaction and print raw sensitive values during debugging.\n\t * Defaults to checking `process.env.ARKENV_DEBUG_SECRETS === \"true\"` or `\"1\"`.\n\t */\n\tdebugSecrets?: boolean;\n\n\t/**\n\t * Whether to treat empty strings (`\"\"`) as `undefined` before validation.\n\t *\n\t * When enabled, an environment variable set to an empty value (e.g. `PORT=`)\n\t * will be treated as if it were missing, allowing defaults to apply and\n\t * preventing validation errors for numeric or boolean types.\n\t *\n\t * @default false\n\t */\n\temptyAsUndefined?: boolean;\n\n\t/**\n\t * Whether to return a safe result object instead of throwing an error on validation failure.\n\t *\n\t * When enabled, the function returns an object with `{ success: true, data }` or `{ success: false, issues }`.\n\t *\n\t * @default false\n\t */\n\tsafe?: boolean;\n};\n\nexport type { SafeArkEnvResult };\n\n/**\n * Helper type to represent the output of parsing either an EnvSchema or CompiledEnvSchema.\n */\nexport type ArkenvOutput<T extends SchemaShape, D> =\n\t| distill.Out<at.infer<T, $>>\n\t| InferType<D>;\n\n/**\n * Utility to parse environment variables using ArkType or Standard Schema\n *\n * Naming convention: the main function is lowercase (`arkenv`) following the\n * JavaScript convention for functions (e.g. `zod`, `joi`). Classes and types\n * use PascalCase with the full product name (`ArkEnvError`, `SafeArkEnvResult`).\n *\n * @param def The schema definition\n * @param config The evaluation configuration\n * @returns The parsed environment variables, or a SafeArkEnvResult if `{ safe: true }` is configured\n * @throws An {@link ArkEnvError | error} if the environment variables are invalid and `safe` is not enabled\n */\nexport function arkenv<const T extends SchemaShape>(\n\tdef: EnvSchema<T>,\n\tconfig?: ArkEnvConfig & { safe?: false },\n): distill.Out<at.infer<T, $>>;\nexport function arkenv<T extends CompiledEnvSchema>(\n\tdef: T,\n\tconfig?: ArkEnvConfig & { safe?: false },\n): InferType<T>;\nexport function arkenv<\n\tconst T extends SchemaShape,\n\tconst D extends EnvSchema<T> | CompiledEnvSchema,\n>(def: D, config?: ArkEnvConfig & { safe?: false }): ArkenvOutput<T, D>;\nexport function arkenv<const T extends SchemaShape>(\n\tdef: EnvSchema<T>,\n\tconfig: ArkEnvConfig & { safe: true },\n): SafeArkEnvResult<distill.Out<at.infer<T, $>>>;\nexport function arkenv<T extends CompiledEnvSchema>(\n\tdef: T,\n\tconfig: ArkEnvConfig & { safe: true },\n): SafeArkEnvResult<InferType<T>>;\nexport function arkenv<\n\tconst T extends SchemaShape,\n\tconst D extends EnvSchema<T> | CompiledEnvSchema,\n>(\n\tdef: D,\n\tconfig: ArkEnvConfig & { safe: true },\n): SafeArkEnvResult<ArkenvOutput<T, D>>;\nexport function arkenv<\n\tconst T extends SchemaShape,\n\tconst D extends EnvSchema<T> | CompiledEnvSchema,\n>(\n\tdef: D,\n\tconfig: ArkEnvConfig = {},\n): ArkenvOutput<T, D> | SafeArkEnvResult<ArkenvOutput<T, D>> {\n\tif (config.safe) {\n\t\treturn safeExecute(() => parse(def as any, config));\n\t}\n\t// biome-ignore lint/suspicious/noExplicitAny: parse handles both EnvSchema<T> and CompiledEnvSchema at runtime\n\treturn parse(def as any, config);\n}\n","import { $ } from \"@repo/scope\";\nimport {\n\tArkEnvError,\n\ttype EnvIssue,\n\tformatIssues,\n\tgetSchemaKeys,\n} from \"@repo/utils\";\nimport { arkenv } from \"./arkenv\";\n\nexport type { EnvIssue };\nexport { ArkEnvError, arkenv, formatIssues, getSchemaKeys };\n/**\n * Like ArkType's `type`, but with ArkEnv's extra keywords, such as:\n *\n * - `string.host` – a hostname (e.g. `\"localhost\"`, `\"127.0.0.1\"`)\n * - `number.port` – a port number (e.g. `8080`)\n *\n * See ArkType's docs for the full API:\n * https://arktype.io/docs/type-api\n */\nexport const type = $.type;\nexport type {\n\tArkEnvConfig,\n\tEnvSchema,\n\tInfer,\n\tSafeArkEnvResult,\n} from \"./arkenv\";\n\n/**\n * ArkEnv's main export, an alias for {@link arkenv}\n *\n * {@link https://arkenv.js.org | ArkEnv} is a typesafe environment variables validator from editor to runtime.\n */\nexport default arkenv;\n"],"mappings":";;;AAA0C,MAAMA,MAAEC,OAAE,+BAA+B,EAACC,MAAED,OAAE,0BAA0B,EAACE,MAAEC,MAAE;CAAC,QAAOH,OAAE,OAAO;EAAC,GAAGA,OAAE,SAAS;EAAO,MAAKC;EAAE,CAAC;CAAC,QAAOD,OAAE,OAAO;EAAC,GAAGA,OAAE,SAAS;EAAO,MAAKD;EAAE,CAAC;CAAC,CAAC;;;;ACAvN,MAAM,KAAE,MAAG;AAAC,KAAG,OAAO,KAAG,YAAU,OAAO,KAAG,YAAU,CA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ACA,SAAuB,EAAE,EACmC;AAC5D,KAAI,OAAO,KACV,QAAOC,QAAkB,MAAM,KAAY,OAAO,CAAC;AAGpD,QAAO,MAAM,KAAY,OAAO;;;;;;;;;;;;;;AC7JjC,MAAa,OAAOC,IAAE;;;;;;AAatB,kBAAe"}
1
+ {"version":3,"file":"index.mjs","names":["n","t","r","i","e","isDebugSecrets","shouldRedact","styleText","buildEnvIssue","$","coerceEnvironment","ArkEnvError","safeExecute","$"],"sources":["../../internal/scope/dist/index.js","../../internal/utils/dist/index.js","../src/arktype/index.ts","../src/arkenv.ts","../src/index.ts"],"sourcesContent":["import{scope as e,type as t}from\"arktype\";const n=t(`0 <= number.integer <= 65535`),r=t(`string.ip | 'localhost'`),i=e({string:t.module({...t.keywords.string,host:r}),number:t.module({...t.keywords.number,port:n})});export{i as $};\n//# sourceMappingURL=index.js.map","const e=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},t=e=>e===`true`?!0:e===`false`?!1:e,n=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}},r=e=>{if(e instanceof Date||typeof e!=`string`||!e.trim())return e;let t=new Date(e);return Number.isNaN(t.getTime())?e:t},i=e=>{let t={};for(let n in e){let r=e[n];r!==``&&(t[n]=r)}return t},a=`*`,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=(i,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=(i,a)=>{if(a===`array`&&typeof i==`string`)return c(i);if(a===`object`&&typeof i==`string`)return n(i);if(a===`date`&&typeof i==`string`)return r(i);if(a===`primitive`){if(Array.isArray(i))return i.map(n=>{if(typeof n!=`string`)return n;let r=e(n);return typeof r==`number`?r:t(n)});if(typeof i!=`string`)return i;let n=e(i);return typeof n==`number`?n:t(i)}return i};if(typeof i!=`object`||!i){let e=a.find(e=>e.path.length===0);return e?l(i,e.type):i}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=i;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 a=t?i(e):e,c={...a},l=[];if(r){let e=r();l.push(...e.missingKeys||[]),e.hasSchema&&(c=s(c,o(e.schema),{arrayFormat:n}))}return{processedEnv:a,coercedEnv:c,missingKeys:l}}const l=(e,t=2,{dontDetectNewlines:n=!1}={})=>n?`${` `.repeat(t)}${e}`:e.split(`\n`).map(e=>`${` `.repeat(t)}${e}`).join(`\n`),u={red:`\\x1B[31m`,yellow:`\\x1B[33m`,cyan:`\\x1B[36m`,reset:`\\x1B[0m`},d=()=>typeof process<`u`&&process.versions!=null&&process.versions.node!=null,f=()=>!!(!d()||process.env.NO_COLOR!==void 0||process.env.CI!==void 0||process.stdout&&!process.stdout.isTTY),p=(e,t)=>d()&&!f()?`${u[e]}${t}${u.reset}`:t;function m(e){return e.map(e=>`${p(`yellow`,e.path)} ${e.message.trimStart()}`).join(`\n`)}var h=class extends Error{constructor(e,t=`Errors found while validating environment variables`){let n=m(e);super(`${p(`red`,t)}\\n${l(n)}\\n`),this.name=`ArkEnvError`,this.issues=e}};Object.defineProperty(h,`name`,{value:`ArkEnvError`});function g(e,t){if(typeof t==`string`)throw new h([{path:e,message:`ArkType DSL strings are not supported in \"standard\" mode. Use a Standard Schema validator (e.g., Zod, Valibot) or import from \"arkenv\" for ArkType schemas.`,code:`INVALID_SCHEMA`}])}function _(e,t){let n=t&&typeof t==`object`&&`~standard`in t&&t[`~standard`];if(!n||typeof n!=`object`||!(`validate`in n)||typeof n.validate!=`function`)throw new h([{path:e,message:`Invalid validator: expected a Standard Schema 1.0 validator (must have \"~standard\" property). Import from \"arkenv\" to use ArkType schemas.`,code:`INVALID_SCHEMA`}])}function v(e){if(!e||typeof e!=`object`||Array.isArray(e))throw new h([{path:``,message:`Invalid schema: expected an object mapping in \"standard\" mode.`,code:`INVALID_SCHEMA`}])}const y=/secret|(_|^)key(_|$)|token|(_|^)password(_|$)|(_|^)pass(_|$)|(_|^)auth(_|$)|jwt|cert|credential|database_url|db_url/i;function b(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 x(e){return y.test(e)&&!/public/i.test(e)}function S(e,t,n){let r=b(n?.debugSecrets);if(e===void 0)return`missing`;if(e===null)return`null`;if(!r&&x(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=>S(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}: ${S(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 C={too_small:`VALUE_TOO_SMALL`,too_big:`VALUE_TOO_LARGE`,invalid_string:`INVALID_FORMAT`,invalid_date:`INVALID_FORMAT`,custom:`INVALID_FORMAT`};function w(e,t,n){let r=t.toLowerCase();return e===`invalid_type`&&(n===void 0||n===`undefined`)||r===`required`?`MISSING_VARIABLE`:e in C?C[e]:/regex|pattern|match/.test(r)?`PATTERN_MISMATCH`:`INVALID_TYPE`}function T(e){let t=e.minimum??e.min,n=e.maximum??e.max;return{...typeof t==`number`?{min:t}:{},...typeof n==`number`?{max:n}:{}}}function E(e){try{return{success:!0,data:e()}}catch(e){if(e instanceof h)return{success:!1,issues:e.issues};throw e}}function D(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 O(e,t,n,r,i,a){if(t===`MISSING_VARIABLE`)return n?`must be ${n} (was missing)`:`is required`;if(e.includes(`(was `))return e;let o=`(was ${p(`cyan`,!b(a?.debugSecrets)&&x(i)?`[REDACTED]`:S(r,i,a))})`;return n&&!e.includes(`Expected`)?`must be ${n} ${o}`:`${e} ${o}`}function k(e){let t={type:`object`,properties:{}},n=!1,r=[];for(let i in e){let a=e[i];if(!a){r.push(i);continue}let o=a[`~standard`];if(typeof o?.jsonSchema?.input==`function`)try{let e=o.jsonSchema.input({target:`draft-07`});if(e){t.properties[i]=e,n=!0;continue}}catch{}if(typeof a.jsonSchema?.input==`function`)try{let e=a.jsonSchema.input({target:`draft-07`});if(e){t.properties[i]=e,n=!0;continue}}catch{}if(typeof a.toJSONSchema==`function`)try{let e=a.toJSONSchema();if(e){t.properties[i]=e,n=!0;continue}}catch{}if(typeof a.toStandardJSONSchema?.v1==`function`)try{let e=a.toStandardJSONSchema.v1();if(e){t.properties[i]=e,n=!0;continue}}catch{}r.push(i)}return{jsonSchema:t,hasJsonSchema:n,missingKeys:r}}function A(e){return typeof e==`object`&&e&&`key`in e?String(e.key):String(e)}function j(e,t){return!t||t.length===0?e:[e,...t.map(A)].join(`.`)}function M(e,t){let n=e,r;try{let i=e,a=e.trim();if(a[0]===`{`||a[0]===`[`)try{i=JSON.parse(e)}catch(e){r=`[Unparseable JSON: ${e.message}]`}if(!r){for(let e of t)i=i?.[A(e)];n=i}}catch(e){r=`[Traversal error: ${e.message}]`}return{receivedVal:n,traversalError:r}}function N(e,t){let{env:n=process.env,onUndeclaredKey:r=`delete`,coerce:i=!0,arrayFormat:a=`comma`,emptyAsUndefined:o=!1}=t,s={},l=[],{processedEnv:u,coercedEnv:d,missingKeys:f}=c(n,o,a,i?()=>{let{jsonSchema:t,hasJsonSchema:n,missingKeys:r}=k(e);return{schema:t,hasSchema:n,missingKeys:r}}:void 0),p=new Set(Object.keys(u));for(let n in e){let r=e[n],a=d[n];if(!r||typeof r!=`object`||!(`~standard`in r))throw new h([D(n,`Invalid schema: expected a Standard Schema 1.0 validator (e.g. Zod, Valibot) in 'standard' mode.`,`INVALID_SCHEMA`)]);let o=r[`~standard`].validate(a);if(o instanceof Promise)throw new h([D(n,`Async validation is not supported. ArkEnv is synchronous.`,`INVALID_SCHEMA`)]);if(o.issues)for(let e of o.issues){let r=j(n,e.path),a,o;if(n in u){let t=u[n];if(typeof t==`string`&&e.path?.length){let n=M(t,e.path);a=n.receivedVal,o=n.traversalError}else a=t}else a=e.received;let s=w(e.code||`invalid_type`,e.message||``,a),c=e.expected||void 0,d={...T(e)},p=e;p.validation!==void 0&&(d.validation=p.validation),o!==void 0&&(d.traversalError=o);let m=O(e.message||``,s,c,a,r,t);i&&f.includes(n)&&(m+=` (Hint: coercion is enabled by default, but the validator for '${n}' lacks Standard JSON Schema support.)`),l.push(D(r,m,s,d,c,a))}else s[n]=o.value;p.delete(n)}if(r!==`delete`)for(let e of p)r===`reject`?l.push(D(e,`Undeclared key`,`UNDECLARED_KEY`)):r===`ignore`&&(s[e]=d[e]);if(l.length>0)throw new h(l);return s}function P(e){if(!e||typeof e!=`object`&&typeof e!=`function`)return[];if(e.json&&typeof e.json==`object`&&e.json.domain===`object`){let t=[];if(Array.isArray(e.json.required))for(let n of e.json.required)n&&typeof n==`object`&&`key`in n&&t.push(n.key);if(Array.isArray(e.json.optional))for(let n of e.json.optional)n&&typeof n==`object`&&`key`in n&&t.push(n.key);return t}let t=e[`~standard`],n=typeof t?.jsonSchema?.input==`function`&&t.jsonSchema.input||typeof e.jsonSchema?.input==`function`&&e.jsonSchema.input;if(n)try{let e=n({target:`draft-07`});if(e&&typeof e==`object`&&e.properties)return Object.keys(e.properties)}catch{}if(typeof e.toJSONSchema==`function`)try{let t=e.toJSONSchema();if(t&&typeof t==`object`&&t.properties)return Object.keys(t.properties)}catch{}if(typeof e.toStandardJSONSchema?.v1==`function`)try{let t=e.toStandardJSONSchema.v1();if(t&&typeof t==`object`&&t.properties)return Object.keys(t.properties)}catch{}return Object.keys(e)}const F=`[ArkEnv]`;function I(e){return`${F} ${e}`}export{a as ARRAY_ITEM_MARKER,h as ArkEnvError,F as BUILD_PREFIX,s as applyCoercion,g as assertNotArkTypeDsl,_ as assertStandardSchema,v as assertStandardSchemaMap,D as buildEnvIssue,t as coerceBoolean,r as coerceDate,c as coerceEnvironment,n as coerceJson,e as coerceNumber,k as extractJsonSchema,o as findCoercionPaths,I as formatBuildError,j as formatIssuePath,m as formatIssues,O as formatStandardIssueMessage,A as getProp,P as getSchemaKeys,T as getStandardMeta,l as indent,b as isDebugSecrets,w as mapStandardCode,N as parseStandard,E as safeExecute,S as safeStringify,x as shouldRedact,i as stripEmptyStrings,p as styleText,M as traverseReceivedValue};\n//# sourceMappingURL=index.js.map","import { $ } from \"@repo/scope\";\nimport type { SchemaShape } from \"@repo/types\";\nimport {\n\tArkEnvError,\n\tbuildEnvIssue,\n\tcoerceEnvironment,\n\ttype EnvIssue,\n\ttype EnvIssueCode,\n\ttype EnvIssueMeta,\n\tisDebugSecrets,\n\tshouldRedact,\n\tstyleText,\n} from \"@repo/utils\";\nimport type { ArkError, distill } from \"arktype\";\nimport { ArkErrors } from \"arktype\";\nimport type { ArkEnvConfig, EnvSchema } from \"@/arkenv\";\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 error code to an ArkEnv issue code.\n *\n * @param engineCode The ArkType engine error code\n * @returns The corresponding ArkEnv issue code\n */\nfunction 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 numeric bounds from an ArkType error object.\n *\n * @param error The ArkType error object\n * @returns An object containing optional min and max bounds\n */\nfunction 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 * Redact and colorize the value inside a \"(was ...)\" message fragment.\n *\n * @param message The validation error message\n * @param path The environment variable key path\n * @param debugSecrets Whether to display sensitive values in debug mode\n * @returns The modified error message with styled or redacted value\n */\nfunction 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\n/**\n * Re-export of ArkType's `distill` utilities.\n *\n * Exposed for internal use cases and type-level integrations.\n * ArkEnv does not add behavior or guarantees beyond what ArkType provides.\n *\n * @internal\n * @see https://github.com/arktypeio/arktype\n */\nexport type { distill };\n\n/**\n * Convert ArkType's `ArkErrors` (keyed by path) into a flat `EnvIssue[]`\n * suitable for `ArkEnvError`.\n *\n * @param errors The ArkType errors object to convert\n * @param config Optional ArkEnvConfig to read debugSecrets options\n * @returns An array of flattened validation issues\n *\n * @internal\n */\nfunction arkErrorsToIssues(\n\terrors: ArkErrors,\n\tconfig?: ArkEnvConfig,\n): EnvIssue[] {\n\treturn Object.entries(errors.byPath).map(([path, error]) => {\n\t\tlet message = error.message;\n\n\t\t// Strip leading path reference if ArkType included it in the message\n\t\tlet trimmed = message.trimStart();\n\t\tif (trimmed.length > 0 && \":.-\".includes(trimmed[0])) {\n\t\t\ttrimmed = trimmed.slice(1).trimStart();\n\t\t}\n\t\tif (trimmed.toLowerCase().startsWith(path.toLowerCase())) {\n\t\t\tlet rest = trimmed.slice(path.length).trimStart();\n\t\t\tif (rest.length > 0 && \":.-\".includes(rest[0])) {\n\t\t\t\trest = rest.slice(1);\n\t\t\t}\n\t\t\tmessage = rest.trimStart();\n\t\t}\n\n\t\t// Redact and style (was ...) inline values\n\t\tmessage = redactMessageWasValue(message, path, config?.debugSecrets);\n\n\t\t// Map code and metadata using centralized helpers\n\t\tconst code = mapArkTypeCode(error.code);\n\t\tconst bounds = getArkTypeMeta(error);\n\t\tconst meta: EnvIssueMeta = {\n\t\t\t...bounds,\n\t\t};\n\n\t\treturn buildEnvIssue(\n\t\t\tpath,\n\t\t\tmessage,\n\t\t\tcode,\n\t\t\tmeta,\n\t\t\terror.expected,\n\t\t\terror.code === \"required\" ? undefined : error.data,\n\t\t);\n\t});\n}\n\n/**\n * Parse and validate environment variables using ArkEnv's schema rules.\n *\n * This applies:\n * - schema validation\n * - optional coercion (strings → numbers, booleans, arrays)\n * - undeclared key handling\n *\n * On success, returns the validated environment object.\n * On failure, throws an {@link ArkEnvError}.\n *\n * This is a low-level utility used internally by ArkEnv.\n * Most users should prefer the default `arkenv()` export.\n *\n * @param def The ArkType schema definition to validate against\n * @param config The configuration object for parsing and coercion\n * @returns The parsed and validated environment variables\n * @throws {@link ArkEnvError} if validation fails\n *\n * @internal\n */\nexport function parse<const T extends SchemaShape>(\n\tdef: EnvSchema<T>,\n\tconfig: ArkEnvConfig,\n) {\n\tconst {\n\t\tenv = process.env,\n\t\tcoerce: shouldCoerce = true,\n\t\tonUndeclaredKey = \"delete\",\n\t\tarrayFormat = \"comma\",\n\t\temptyAsUndefined = false,\n\t} = config;\n\n\t// If def is a type definition (has assert method), use it directly\n\t// Otherwise, use raw() to convert the schema definition\n\tconst isCompiledType = typeof def === \"function\" && \"assert\" in def;\n\tconst schema = (isCompiledType ? def : $.type.raw(def)) as any;\n\n\t// Apply the `onUndeclaredKey` option\n\tconst schemaWithKeys = schema.onUndeclaredKey(onUndeclaredKey);\n\n\t// Optionally strip empty strings and apply coercion\n\tconst { coercedEnv } = coerceEnvironment(\n\t\tenv,\n\t\temptyAsUndefined,\n\t\tarrayFormat,\n\t\tshouldCoerce\n\t\t\t? () => {\n\t\t\t\t\tconst json = schemaWithKeys.in.toJsonSchema({\n\t\t\t\t\t\tfallback: (ctx: { base: unknown }) => ctx.base,\n\t\t\t\t\t});\n\t\t\t\t\treturn { schema: json, hasSchema: true };\n\t\t\t\t}\n\t\t\t: undefined,\n\t);\n\n\t// Validate the environment variables\n\tconst validatedEnv = schemaWithKeys(coercedEnv);\n\n\t// In ArkType 2.x, calling a type as a function returns the validated data or ArkErrors.\n\tif (validatedEnv instanceof ArkErrors) {\n\t\tthrow new ArkEnvError(arkErrorsToIssues(validatedEnv, config));\n\t}\n\n\treturn validatedEnv;\n}\n","import type { $ } from \"@repo/scope\";\nimport type {\n\tCompiledEnvSchema,\n\tInferType,\n\tSchemaShape,\n\tStandardSchemaV1,\n} from \"@repo/types\";\nimport { ArkEnvError, type SafeArkEnvResult, safeExecute } from \"@repo/utils\";\nimport type { type as at, distill } from \"arktype\";\nimport { parse } from \"./arktype\";\n\n/**\n * Declarative environment schema definition accepted by ArkEnv.\n *\n * Represents a declarative schema object mapping environment\n * variable names to schema definitions (e.g. ArkType DSL strings\n * or Standard Schema validators).\n *\n * This type is used to validate that a schema object is compatible with\n * ArkEnv’s validator scope before being compiled or parsed.\n *\n * Most users will provide schemas in this form.\n *\n * @template def - The schema shape object\n */\nexport type EnvSchema<def> = at.validate<def, $>;\n\n/**\n * Infer the validated and coerced environment object type from a schema.\n * Supports declarative schema shapes, compiled ArkType schemas, and Standard Schema validators.\n *\n * @template T - The schema type\n */\nexport type Infer<T> =\n\tT extends StandardSchemaV1<infer _Input, infer Output>\n\t\t? Output\n\t\t: T extends { t: infer U }\n\t\t\t? U\n\t\t\t: T extends at.Any<infer U, infer _Scope>\n\t\t\t\t? U\n\t\t\t\t: T extends SchemaShape\n\t\t\t\t\t? distill.Out<at.infer<T, $>>\n\t\t\t\t\t: InferType<T>;\n\n/**\n * Configuration options for `arkenv`\n */\nexport type ArkEnvConfig = {\n\t/**\n\t * The environment variables to parse. Defaults to `process.env`.\n\t *\n\t * All values must be strings (or `undefined`) to match `process.env` semantics.\n\t */\n\tenv?: Record<string, string | undefined>;\n\t/**\n\t * Whether to coerce environment variables to their defined types. Defaults to `true`\n\t */\n\tcoerce?: boolean;\n\t/**\n\t * Control how ArkEnv handles environment variables that are not defined in your schema.\n\t *\n\t * Defaults to `'delete'` to ensure your output object only contains\n\t * keys you've explicitly declared. This differs from ArkType's standard behavior, which\n\t * mirrors TypeScript by defaulting to `'ignore'`.\n\t *\n\t * - `delete` (ArkEnv default): Undeclared keys are allowed on input but stripped from the output.\n\t * - `ignore` (ArkType default): Undeclared keys are allowed and preserved in the output.\n\t * - `reject`: Undeclared keys will cause validation to fail.\n\t *\n\t * @default \"delete\"\n\t * @see https://arktype.io/docs/configuration#onundeclaredkey\n\t */\n\tonUndeclaredKey?: \"ignore\" | \"delete\" | \"reject\";\n\n\t/**\n\t * The format to use for array parsing when coercion is enabled.\n\t *\n\t * - `comma` (default): Strings are split by comma and trimmed.\n\t * - `json`: Strings are parsed as JSON.\n\t *\n\t * @default \"comma\"\n\t */\n\tarrayFormat?: \"comma\" | \"json\";\n\n\t/**\n\t * Whether to bypass secret redaction and print raw sensitive values during debugging.\n\t * Defaults to checking `process.env.ARKENV_DEBUG_SECRETS === \"true\"` or `\"1\"`.\n\t */\n\tdebugSecrets?: boolean;\n\n\t/**\n\t * Whether to treat empty strings (`\"\"`) as `undefined` before validation.\n\t *\n\t * When enabled, an environment variable set to an empty value (e.g. `PORT=`)\n\t * will be treated as if it were missing, allowing defaults to apply and\n\t * preventing validation errors for numeric or boolean types.\n\t *\n\t * @default false\n\t */\n\temptyAsUndefined?: boolean;\n\n\t/**\n\t * Whether to return a safe result object instead of throwing an error on validation failure.\n\t *\n\t * When enabled, the function returns an object with `{ success: true, data }` or `{ success: false, issues }`.\n\t *\n\t * @default false\n\t */\n\tsafe?: boolean;\n};\n\nexport type { SafeArkEnvResult };\n\n/**\n * Helper type to represent the output of parsing either an EnvSchema or CompiledEnvSchema.\n */\nexport type ArkenvOutput<T extends SchemaShape, D> =\n\t| distill.Out<at.infer<T, $>>\n\t| InferType<D>;\n\n/**\n * Utility to parse environment variables using ArkType or Standard Schema\n *\n * Naming convention: the main function is lowercase (`arkenv`) following the\n * JavaScript convention for functions (e.g. `zod`, `joi`). Classes and types\n * use PascalCase with the full product name (`ArkEnvError`, `SafeArkEnvResult`).\n *\n * @param def The schema definition\n * @param config The evaluation configuration\n * @returns The parsed environment variables, or a SafeArkEnvResult if `{ safe: true }` is configured\n * @throws An {@link ArkEnvError | error} if the environment variables are invalid and `safe` is not enabled\n */\nexport function arkenv<const T extends SchemaShape>(\n\tdef: EnvSchema<T>,\n\tconfig?: ArkEnvConfig & { safe?: false },\n): distill.Out<at.infer<T, $>>;\nexport function arkenv<T extends CompiledEnvSchema>(\n\tdef: T,\n\tconfig?: ArkEnvConfig & { safe?: false },\n): InferType<T>;\nexport function arkenv<\n\tconst T extends SchemaShape,\n\tconst D extends EnvSchema<T> | CompiledEnvSchema,\n>(def: D, config?: ArkEnvConfig & { safe?: false }): ArkenvOutput<T, D>;\nexport function arkenv<const T extends SchemaShape>(\n\tdef: EnvSchema<T>,\n\tconfig: ArkEnvConfig & { safe: true },\n): SafeArkEnvResult<distill.Out<at.infer<T, $>>>;\nexport function arkenv<T extends CompiledEnvSchema>(\n\tdef: T,\n\tconfig: ArkEnvConfig & { safe: true },\n): SafeArkEnvResult<InferType<T>>;\nexport function arkenv<\n\tconst T extends SchemaShape,\n\tconst D extends EnvSchema<T> | CompiledEnvSchema,\n>(\n\tdef: D,\n\tconfig: ArkEnvConfig & { safe: true },\n): SafeArkEnvResult<ArkenvOutput<T, D>>;\nexport function arkenv<\n\tconst T extends SchemaShape,\n\tconst D extends EnvSchema<T> | CompiledEnvSchema,\n>(\n\tdef: D,\n\tconfig: ArkEnvConfig = {},\n): ArkenvOutput<T, D> | SafeArkEnvResult<ArkenvOutput<T, D>> {\n\tif (config.safe) {\n\t\treturn safeExecute(() => parse(def as any, config));\n\t}\n\t// biome-ignore lint/suspicious/noExplicitAny: parse handles both EnvSchema<T> and CompiledEnvSchema at runtime\n\treturn parse(def as any, config);\n}\n","import { $ } from \"@repo/scope\";\nimport {\n\tArkEnvError,\n\ttype EnvIssue,\n\tformatIssues,\n\tgetSchemaKeys,\n} from \"@repo/utils\";\nimport { arkenv } from \"./arkenv\";\n\nexport type { EnvIssue };\nexport { ArkEnvError, arkenv, formatIssues, getSchemaKeys };\n/**\n * Like ArkType's `type`, but with ArkEnv's extra keywords, such as:\n *\n * - `string.host` – a hostname (e.g. `\"localhost\"`, `\"127.0.0.1\"`)\n * - `number.port` – a port number (e.g. `8080`)\n *\n * See ArkType's docs for the full API:\n * https://arktype.io/docs/type-api\n */\nexport const type = $.type;\nexport type {\n\tArkEnvConfig,\n\tEnvSchema,\n\tInfer,\n\tSafeArkEnvResult,\n} from \"./arkenv\";\n\n/**\n * ArkEnv's main export, an alias for {@link arkenv}\n *\n * {@link https://arkenv.js.org | ArkEnv} is a typesafe environment variables validator from editor to runtime.\n */\nexport default arkenv;\n"],"mappings":";;;AAA0C,MAAMA,MAAEC,OAAE,+BAA+B,EAACC,MAAED,OAAE,0BAA0B,EAACE,MAAEC,MAAE;CAAC,QAAOH,OAAE,OAAO;EAAC,GAAGA,OAAE,SAAS;EAAO,MAAKC;EAAE,CAAC;CAAC,QAAOD,OAAE,OAAO;EAAC,GAAGA,OAAE,SAAS;EAAO,MAAKD;EAAE,CAAC;CAAC,CAAC;;;;ACAvN,MAAM,KAAE,MAAG;AAAC,KAAG,OAAO,KAAG,YAAU,OAAO,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SAAgB,OAIf,KACA,SAAuB,EAAE,EACmC;AAC5D,KAAI,OAAO,KACV,QAAOC,QAAkB,MAAM,KAAY,OAAO,CAAC;AAGpD,QAAO,MAAM,KAAY,OAAO;;;;;;;;;;;;;;ACtJjC,MAAa,OAAOC,IAAE;;;;;;AAatB,kBAAe"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@arkenv/core",
3
3
  "type": "module",
4
- "version": "1.0.0-alpha.3",
4
+ "version": "1.0.0-alpha.4",
5
5
  "description": "Typesafe environment variables parsing and validation with ArkType",
6
6
  "main": "./dist/index.cjs",
7
7
  "module": "./dist/index.mjs",
@@ -20,12 +20,16 @@
20
20
  "dist"
21
21
  ],
22
22
  "keywords": [
23
- "pnpm",
24
- "arktype",
23
+ "env",
24
+ "environment-variables",
25
25
  "environment",
26
26
  "variables",
27
+ "dotenv",
28
+ "config",
29
+ "validation",
27
30
  "typesafe",
28
- "validation"
31
+ "standard-schema",
32
+ "arktype"
29
33
  ],
30
34
  "license": "MIT",
31
35
  "homepage": "https://arkenv.js.org",
@@ -50,9 +54,9 @@
50
54
  "typescript": "6.0.3",
51
55
  "vitest": "4.1.5",
52
56
  "zod": "4.4.1",
53
- "@repo/types": "0.1.0",
54
- "@arkenv/standard": "1.0.0-alpha.3",
57
+ "@arkenv/standard": "1.0.0-alpha.4",
55
58
  "@repo/scope": "0.1.3",
59
+ "@repo/types": "0.1.0",
56
60
  "@repo/utils": "0.1.3"
57
61
  },
58
62
  "peerDependencies": {