arkenv 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
  </a>
7
7
  <br />
8
8
  <a href="https://github.com/yamcodes/arkenv/actions/workflows/tests.yml?query=branch%3Amain"><img alt="Tests Status" src="https://github.com/yamcodes/arkenv/actions/workflows/tests.yml/badge.svg?event=push&branch=main"></a>
9
- <a href="https://www.npmjs.com/package/arkenv?activeTab=versions"><img alt="Total Downloads" src="https://img.shields.io/npm/dt/arkenv?logo=npm&color=blue&label=downloads"></a>
9
+ <a href="https://discord.com/channels/957797212103016458/1415373591394127894"><img alt="Chat on Discord" src="https://img.shields.io/discord/957797212103016458?label=Chat&color=5865f4&logo=discord&labelColor=121214"></a>
10
10
  <a href="https://www.typescriptlang.org/"><img alt="TypeScript" src="https://img.shields.io/badge/TypeScript-3178C6?style=flat&logo=typescript&logoColor=white"></a>
11
11
  <a href="https://arktype.io/"><img alt="Powered By ArkType" src="https://custom-icon-badges.demolab.com/badge/ArkType-0d1526?logo=arktype2&logoColor=e9eef9"></a>
12
12
  <a href="https://nodejs.org/en"><img alt="Node.js" src="https://img.shields.io/badge/Node.js-339933?style=flat&logo=node.js&logoColor=white"></a>
package/dist/index.cjs CHANGED
@@ -31,7 +31,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
31
31
  var index_exports = {};
32
32
  __export(index_exports, {
33
33
  createEnv: () => createEnv,
34
- default: () => createEnv
34
+ default: () => createEnv,
35
+ type: () => type4
35
36
  });
36
37
  module.exports = __toCommonJS(index_exports);
37
38
 
@@ -106,7 +107,11 @@ function createEnv(def, env = process.env) {
106
107
  }
107
108
  return validatedEnv;
108
109
  }
110
+
111
+ // src/type.ts
112
+ var type4 = $.type;
109
113
  // Annotate the CommonJS export names for ESM import in node:
110
114
  0 && (module.exports = {
111
- createEnv
115
+ createEnv,
116
+ type
112
117
  });
package/dist/index.d.cts CHANGED
@@ -1,7 +1,8 @@
1
1
  import * as arktype from 'arktype';
2
- import { type, distill } from 'arktype';
2
+ import { type as type$1, distill } from 'arktype';
3
3
  import * as arktype_internal_attributes_ts from 'arktype/internal/attributes.ts';
4
4
  import * as arktype_internal_keywords_string_ts from 'arktype/internal/keywords/string.ts';
5
+ import * as arktype_internal_type_ts from 'arktype/internal/type.ts';
5
6
 
6
7
  /**
7
8
  * The root scope for the ArkEnv library, containing extensions to the ArkType scopes with ArkEnv-specific types like `string.host` and `number.port`.
@@ -79,7 +80,7 @@ declare const $: arktype.Scope<{
79
80
  }>;
80
81
 
81
82
  type RuntimeEnvironment = Record<string, string | undefined>;
82
- type EnvSchema<def, $ = {}> = type.validate<def, $>;
83
+ type EnvSchema<def, $ = {}> = type$1.validate<def, $>;
83
84
  /**
84
85
  * Create an environment variables object from a schema and an environment
85
86
  * @param def - The environment variable schema
@@ -87,7 +88,79 @@ type EnvSchema<def, $ = {}> = type.validate<def, $>;
87
88
  * @returns The validated environment variable schema
88
89
  * @throws An error if the environment variables are invalid. See {@link ArkEnvError}
89
90
  */
90
- declare function createEnv<const T extends Record<string, string | undefined>>(def: EnvSchema<T, (typeof $)["t"]>, env?: RuntimeEnvironment): distill.Out<type.infer<T, (typeof $)["t"]>>;
91
- declare function createEnv<const T extends Record<string, string | undefined>>(def: EnvSchema<T>, env?: RuntimeEnvironment): distill.Out<type.infer<T>>;
91
+ declare function createEnv<const T extends Record<string, string | undefined>>(def: EnvSchema<T, (typeof $)["t"]>, env?: RuntimeEnvironment): distill.Out<type$1.infer<T, (typeof $)["t"]>>;
92
+ declare function createEnv<const T extends Record<string, string | undefined>>(def: EnvSchema<T>, env?: RuntimeEnvironment): distill.Out<type$1.infer<T>>;
92
93
 
93
- export { type EnvSchema, createEnv, createEnv as default };
94
+ declare const type: arktype_internal_type_ts.TypeParser<{
95
+ string: arktype.Submodule<{
96
+ root: string;
97
+ " arkInferred": string;
98
+ trim: arktype.Submodule<arktype_internal_keywords_string_ts.trim.$ & {
99
+ " arkInferred": (In: string) => arktype_internal_attributes_ts.To<string>;
100
+ }>;
101
+ normalize: arktype.Submodule<arktype_internal_keywords_string_ts.normalize.$ & {
102
+ " arkInferred": (In: string) => arktype_internal_attributes_ts.To<string>;
103
+ }>;
104
+ alpha: string;
105
+ alphanumeric: string;
106
+ hex: string;
107
+ base64: arktype.Submodule<{
108
+ root: string;
109
+ url: string;
110
+ } & {
111
+ " arkInferred": string;
112
+ }>;
113
+ capitalize: arktype.Submodule<arktype_internal_keywords_string_ts.capitalize.$ & {
114
+ " arkInferred": (In: string) => arktype_internal_attributes_ts.To<string>;
115
+ }>;
116
+ creditCard: string;
117
+ date: arktype.Submodule<arktype_internal_keywords_string_ts.stringDate.$ & {
118
+ " arkInferred": string;
119
+ }>;
120
+ digits: string;
121
+ email: string;
122
+ integer: arktype.Submodule<arktype_internal_keywords_string_ts.stringInteger.$ & {
123
+ " arkInferred": string;
124
+ }>;
125
+ ip: arktype.Submodule<arktype_internal_keywords_string_ts.ip.$ & {
126
+ " arkInferred": string;
127
+ }>;
128
+ json: arktype.Submodule<arktype_internal_keywords_string_ts.stringJson.$ & {
129
+ " arkInferred": string;
130
+ }>;
131
+ lower: arktype.Submodule<arktype_internal_keywords_string_ts.lower.$ & {
132
+ " arkInferred": (In: string) => arktype_internal_attributes_ts.To<string>;
133
+ }>;
134
+ numeric: arktype.Submodule<arktype_internal_keywords_string_ts.stringNumeric.$ & {
135
+ " arkInferred": string;
136
+ }>;
137
+ regex: string;
138
+ semver: string;
139
+ upper: arktype.Submodule<{
140
+ root: (In: string) => arktype_internal_attributes_ts.To<string>;
141
+ preformatted: string;
142
+ } & {
143
+ " arkInferred": (In: string) => arktype_internal_attributes_ts.To<string>;
144
+ }>;
145
+ url: arktype.Submodule<arktype_internal_keywords_string_ts.url.$ & {
146
+ " arkInferred": string;
147
+ }>;
148
+ uuid: arktype.Submodule<arktype_internal_keywords_string_ts.uuid.$ & {
149
+ " arkInferred": string;
150
+ }>;
151
+ host: string;
152
+ }>;
153
+ number: arktype.Submodule<{
154
+ NaN: number;
155
+ Infinity: number;
156
+ root: number;
157
+ " arkInferred": number;
158
+ integer: number;
159
+ epoch: number;
160
+ safe: number;
161
+ NegativeInfinity: number;
162
+ port: (In: string) => arktype.Out<number>;
163
+ }>;
164
+ }>;
165
+
166
+ export { type EnvSchema, createEnv, createEnv as default, type };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import * as arktype from 'arktype';
2
- import { type, distill } from 'arktype';
2
+ import { type as type$1, distill } from 'arktype';
3
3
  import * as arktype_internal_attributes_ts from 'arktype/internal/attributes.ts';
4
4
  import * as arktype_internal_keywords_string_ts from 'arktype/internal/keywords/string.ts';
5
+ import * as arktype_internal_type_ts from 'arktype/internal/type.ts';
5
6
 
6
7
  /**
7
8
  * The root scope for the ArkEnv library, containing extensions to the ArkType scopes with ArkEnv-specific types like `string.host` and `number.port`.
@@ -79,7 +80,7 @@ declare const $: arktype.Scope<{
79
80
  }>;
80
81
 
81
82
  type RuntimeEnvironment = Record<string, string | undefined>;
82
- type EnvSchema<def, $ = {}> = type.validate<def, $>;
83
+ type EnvSchema<def, $ = {}> = type$1.validate<def, $>;
83
84
  /**
84
85
  * Create an environment variables object from a schema and an environment
85
86
  * @param def - The environment variable schema
@@ -87,7 +88,79 @@ type EnvSchema<def, $ = {}> = type.validate<def, $>;
87
88
  * @returns The validated environment variable schema
88
89
  * @throws An error if the environment variables are invalid. See {@link ArkEnvError}
89
90
  */
90
- declare function createEnv<const T extends Record<string, string | undefined>>(def: EnvSchema<T, (typeof $)["t"]>, env?: RuntimeEnvironment): distill.Out<type.infer<T, (typeof $)["t"]>>;
91
- declare function createEnv<const T extends Record<string, string | undefined>>(def: EnvSchema<T>, env?: RuntimeEnvironment): distill.Out<type.infer<T>>;
91
+ declare function createEnv<const T extends Record<string, string | undefined>>(def: EnvSchema<T, (typeof $)["t"]>, env?: RuntimeEnvironment): distill.Out<type$1.infer<T, (typeof $)["t"]>>;
92
+ declare function createEnv<const T extends Record<string, string | undefined>>(def: EnvSchema<T>, env?: RuntimeEnvironment): distill.Out<type$1.infer<T>>;
92
93
 
93
- export { type EnvSchema, createEnv, createEnv as default };
94
+ declare const type: arktype_internal_type_ts.TypeParser<{
95
+ string: arktype.Submodule<{
96
+ root: string;
97
+ " arkInferred": string;
98
+ trim: arktype.Submodule<arktype_internal_keywords_string_ts.trim.$ & {
99
+ " arkInferred": (In: string) => arktype_internal_attributes_ts.To<string>;
100
+ }>;
101
+ normalize: arktype.Submodule<arktype_internal_keywords_string_ts.normalize.$ & {
102
+ " arkInferred": (In: string) => arktype_internal_attributes_ts.To<string>;
103
+ }>;
104
+ alpha: string;
105
+ alphanumeric: string;
106
+ hex: string;
107
+ base64: arktype.Submodule<{
108
+ root: string;
109
+ url: string;
110
+ } & {
111
+ " arkInferred": string;
112
+ }>;
113
+ capitalize: arktype.Submodule<arktype_internal_keywords_string_ts.capitalize.$ & {
114
+ " arkInferred": (In: string) => arktype_internal_attributes_ts.To<string>;
115
+ }>;
116
+ creditCard: string;
117
+ date: arktype.Submodule<arktype_internal_keywords_string_ts.stringDate.$ & {
118
+ " arkInferred": string;
119
+ }>;
120
+ digits: string;
121
+ email: string;
122
+ integer: arktype.Submodule<arktype_internal_keywords_string_ts.stringInteger.$ & {
123
+ " arkInferred": string;
124
+ }>;
125
+ ip: arktype.Submodule<arktype_internal_keywords_string_ts.ip.$ & {
126
+ " arkInferred": string;
127
+ }>;
128
+ json: arktype.Submodule<arktype_internal_keywords_string_ts.stringJson.$ & {
129
+ " arkInferred": string;
130
+ }>;
131
+ lower: arktype.Submodule<arktype_internal_keywords_string_ts.lower.$ & {
132
+ " arkInferred": (In: string) => arktype_internal_attributes_ts.To<string>;
133
+ }>;
134
+ numeric: arktype.Submodule<arktype_internal_keywords_string_ts.stringNumeric.$ & {
135
+ " arkInferred": string;
136
+ }>;
137
+ regex: string;
138
+ semver: string;
139
+ upper: arktype.Submodule<{
140
+ root: (In: string) => arktype_internal_attributes_ts.To<string>;
141
+ preformatted: string;
142
+ } & {
143
+ " arkInferred": (In: string) => arktype_internal_attributes_ts.To<string>;
144
+ }>;
145
+ url: arktype.Submodule<arktype_internal_keywords_string_ts.url.$ & {
146
+ " arkInferred": string;
147
+ }>;
148
+ uuid: arktype.Submodule<arktype_internal_keywords_string_ts.uuid.$ & {
149
+ " arkInferred": string;
150
+ }>;
151
+ host: string;
152
+ }>;
153
+ number: arktype.Submodule<{
154
+ NaN: number;
155
+ Infinity: number;
156
+ root: number;
157
+ " arkInferred": number;
158
+ integer: number;
159
+ epoch: number;
160
+ safe: number;
161
+ NegativeInfinity: number;
162
+ port: (In: string) => arktype.Out<number>;
163
+ }>;
164
+ }>;
165
+
166
+ export { type EnvSchema, createEnv, createEnv as default, type };
package/dist/index.js CHANGED
@@ -69,7 +69,11 @@ function createEnv(def, env = process.env) {
69
69
  }
70
70
  return validatedEnv;
71
71
  }
72
+
73
+ // src/type.ts
74
+ var type4 = $.type;
72
75
  export {
73
76
  createEnv,
74
- createEnv as default
77
+ createEnv as default,
78
+ type4 as type
75
79
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "arkenv",
3
3
  "type": "module",
4
- "version": "0.5.0",
4
+ "version": "0.6.0",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",