@arundo/typed-env
Advanced tools
Comparing version 0.1.0 to 0.2.0
@@ -1,2 +0,2 @@ | ||
import { ZodError, ZodTypeAny } from 'zod'; | ||
import { ZodIssue, ZodTypeAny } from 'zod'; | ||
import { ConstantKeys, CamelKeys, PascalKeys, KebabKeys, Replace } from 'string-ts'; | ||
@@ -7,3 +7,3 @@ | ||
transform?: TTransform; | ||
formatErrorFn?: (error: ZodError) => string; | ||
constructErrorFn?: (issues: ZodIssue[]) => Error; | ||
excludePrefix?: TPrefixRemoval; | ||
@@ -10,0 +10,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
"use strict";var i=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var y=(n,e)=>{for(var o in e)i(n,o,{get:e[o],enumerable:!0})},x=(n,e,o,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of v(e))!l.call(n,t)&&t!==o&&i(n,t,{get:()=>e[t],enumerable:!(a=u(e,t))||a.enumerable});return n};var g=n=>x(i({},"__esModule",{value:!0}),n);var w={};y(w,{removePrefix:()=>f,typeEnvironment:()=>h});module.exports=g(w);var d=require("zod"),r=require("string-ts"),m={},c=n=>`Environment variable validation failed:${n.issues.map(e=>` | ||
'${e.path.join(",")}': ${e.message}`).join(",")}`,E=()=>{if(m?.env!==void 0)return m.env;if(process.env!==void 0)return process.env;throw new Error("Failed to get environment object")};function f(n,e){if(!e)return n;let o={};for(let a in n){let t=e?e.endsWith("_")?(0,r.replace)(a,e,""):(0,r.replace)(a,`${e}_`,""):a;o[t]=n[a]}return o}var R=(n,e)=>{switch(n){case"camelcase":return(0,r.camelKeys)(e);case"pascalcase":return(0,r.pascalKeys)(e);case"kebabcase":return(0,r.kebabKeys)(e);case"constantcase":default:return(0,r.constantKeys)(e)}},h=(n,e={},o=E())=>{let{transform:a="default",formatErrorFn:t=c,excludePrefix:T=""}=e;try{let s=n.parse(o),p=f(s,T);return R(a,p)}catch(s){throw s instanceof d.ZodError?new Error(t?t(s):c(s)):new Error("Environment variable validation failed")}};0&&(module.exports={removePrefix,typeEnvironment}); | ||
"use strict";var c=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var v=Object.prototype.hasOwnProperty;var l=(n,e)=>{for(var t in e)c(n,t,{get:e[t],enumerable:!0})},y=(n,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of p(e))!v.call(n,o)&&o!==t&&c(n,o,{get:()=>e[o],enumerable:!(s=T(e,o))||s.enumerable});return n};var x=n=>y(c({},"__esModule",{value:!0}),n);var R={};l(R,{removePrefix:()=>f,typeEnvironment:()=>h});module.exports=x(R);var r=require("string-ts"),m={},d=n=>new Error(`Environment variable validation failed:${n.map(e=>` | ||
'${e.path.join(",")}': ${e.message}`).join(",")}`),g=()=>{if(m?.env!==void 0)return m.env;if(process.env!==void 0)return process.env;throw new Error("Failed to get environment object")};function f(n,e){if(!e)return n;let t={};for(let s in n){let o=e?e.endsWith("_")?(0,r.replace)(s,e,""):(0,r.replace)(s,`${e}_`,""):s;t[o]=n[s]}return t}var E=(n,e)=>{switch(n){case"camelcase":return(0,r.camelKeys)(e);case"pascalcase":return(0,r.pascalKeys)(e);case"kebabcase":return(0,r.kebabKeys)(e);case"constantcase":default:return(0,r.constantKeys)(e)}},h=(n,e={},t=g())=>{let{transform:s="default",constructErrorFn:o=d,excludePrefix:u=""}=e;try{let i=n.parse(t),a=f(i,u);return E(s,a)}catch(i){let a=i?.issues||i?.errors||[];throw a.length>0?o?o(a):d(a):new Error("Environment variable validation failed")}};0&&(module.exports={removePrefix,typeEnvironment}); |
{ | ||
"name": "@arundo/typed-env", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "Typed environment variables made easy 🚀", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9369