@t3-oss/env-core
Advanced tools
Comparing version 0.6.0 to 0.6.1
@@ -42,4 +42,4 @@ import { ZodType, ZodError, z, ZodObject } from 'zod'; | ||
type EnvOptions<TPrefix extends string, TServer extends Record<string, ZodType>, TClient extends Record<string, ZodType>, TShared extends Record<string, ZodType>> = (LooseOptions<TShared> & ServerClientOptions<TPrefix, TServer, TClient>) | (StrictOptions<TPrefix, TServer, TClient, TShared> & ServerClientOptions<TPrefix, TServer, TClient>); | ||
declare function createEnv<TPrefix extends string = "", TServer extends Record<string, ZodType> = NonNullable<unknown>, TClient extends Record<string, ZodType> = NonNullable<unknown>, TShared extends Record<string, ZodType> = NonNullable<unknown>>(opts: EnvOptions<TPrefix, TServer, TClient, TShared>): Simplify<z.infer<ZodObject<TServer>> & z.infer<ZodObject<TClient>> & z.infer<ZodObject<TShared>>>; | ||
declare function createEnv<TPrefix extends string = "", TServer extends Record<string, ZodType> = NonNullable<unknown>, TClient extends Record<string, ZodType> = NonNullable<unknown>, TShared extends Record<string, ZodType> = NonNullable<unknown>>(opts: EnvOptions<TPrefix, TServer, TClient, TShared>): Readonly<Simplify<z.infer<ZodObject<TServer>> & z.infer<ZodObject<TClient>> & z.infer<ZodObject<TShared>>>>; | ||
export { BaseOptions, ClientOptions, EnvOptions, ErrorMessage, LooseOptions, ServerClientOptions, ServerOptions, Simplify, StrictOptions, createEnv }; |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }var _zod = require('zod');function h(e){let t=_nullishCoalesce(_nullishCoalesce(e.runtimeEnvStrict, () => (e.runtimeEnv)), () => (process.env));if(!!e.skipValidation)return t;let a=typeof e.client=="object"?e.client:{},l=typeof e.server=="object"?e.server:{},c=typeof e.shared=="object"?e.shared:{},d=_zod.z.object(a),v=_zod.z.object(l),i=_zod.z.object(c),T=_nullishCoalesce(e.isServer, () => (typeof window>"u")),f=d.merge(i),x=v.merge(i).merge(d),s=T?x.safeParse(t):f.safeParse(t),y=_nullishCoalesce(e.onValidationError, () => ((n=>{throw console.error("\u274C Invalid environment variables:",n.flatten().fieldErrors),new Error("Invalid environment variables")}))),p=_nullishCoalesce(e.onInvalidAccess, () => ((n=>{throw new Error("\u274C Attempted to access a server-side environment variable on the client")})));return s.success===!1?y(s.error):new Proxy(s.data,{get(n,r){if(typeof r=="string")return!T&&e.clientPrefix&&!r.startsWith(e.clientPrefix)&&i.shape[r]===void 0?p(r):n[r]}})}exports.createEnv = h; | ||
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }var _zod = require('zod');function h(e){let t=_nullishCoalesce(_nullishCoalesce(e.runtimeEnvStrict, () => (e.runtimeEnv)), () => (process.env));if(!!e.skipValidation)return t;let a=typeof e.client=="object"?e.client:{},l=typeof e.server=="object"?e.server:{},c=typeof e.shared=="object"?e.shared:{},d=_zod.z.object(a),v=_zod.z.object(l),i=_zod.z.object(c),T=_nullishCoalesce(e.isServer, () => (typeof window>"u")),f=d.merge(i),x=v.merge(i).merge(d),o=T?x.safeParse(t):f.safeParse(t),y=_nullishCoalesce(e.onValidationError, () => ((n=>{throw console.error("\u274C Invalid environment variables:",n.flatten().fieldErrors),new Error("Invalid environment variables")}))),p=_nullishCoalesce(e.onInvalidAccess, () => ((n=>{throw new Error("\u274C Attempted to access a server-side environment variable on the client")})));return o.success===!1?y(o.error):new Proxy(o.data,{get(n,r){if(typeof r=="string")return!T&&e.clientPrefix&&!r.startsWith(e.clientPrefix)&&i.shape[r]===void 0?p(r):n[r]}})}exports.createEnv = h; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@t3-oss/env-core", | ||
"version": "0.6.0", | ||
"version": "0.6.1", | ||
"keywords": [ | ||
@@ -5,0 +5,0 @@ "create-t3-app", |
Sorry, the diff of this file is not supported yet
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
25822