@romaintaillandier1978/dotenv-never-lies 1.1.1 → 1.3.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.
Files changed (212) hide show
  1. package/README.md +103 -42
  2. package/dist/cli/commands/assert.d.ts +3 -4
  3. package/dist/cli/commands/assert.d.ts.map +1 -1
  4. package/dist/cli/commands/explain.d.ts +2 -3
  5. package/dist/cli/commands/explain.d.ts.map +1 -1
  6. package/dist/cli/commands/export.d.ts +4 -3
  7. package/dist/cli/commands/export.d.ts.map +1 -1
  8. package/dist/cli/commands/export.js +46 -0
  9. package/dist/cli/commands/generate.d.ts +2 -2
  10. package/dist/cli/commands/generate.d.ts.map +1 -1
  11. package/dist/cli/commands/infer.d.ts +15 -0
  12. package/dist/cli/commands/infer.d.ts.map +1 -0
  13. package/dist/cli/commands/infer.js +86 -0
  14. package/dist/cli/commands/init.d.ts +15 -0
  15. package/dist/cli/commands/init.d.ts.map +1 -0
  16. package/dist/cli/commands/init.js +30 -0
  17. package/dist/cli/commands/program.d.ts +4 -0
  18. package/dist/cli/commands/program.d.ts.map +1 -0
  19. package/dist/cli/commands/program.js +1 -0
  20. package/dist/cli/index.js +74 -30
  21. package/dist/cli/utils/infer-schema.d.ts +2 -2
  22. package/dist/cli/utils/infer-schema.d.ts.map +1 -1
  23. package/dist/cli/utils/infer-schema.js +20 -22
  24. package/dist/cli/utils/printer.d.ts +2 -0
  25. package/dist/cli/utils/printer.d.ts.map +1 -1
  26. package/dist/cli/utils/printer.js +104 -1
  27. package/dist/core.d.ts.map +1 -1
  28. package/dist/index.d.ts +1 -0
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js +1 -0
  31. package/dist/infer/__tests__/port-vs-version.test.d.ts +2 -0
  32. package/dist/infer/__tests__/port-vs-version.test.d.ts.map +1 -0
  33. package/dist/infer/__tests__/port-vs-version.test.js +32 -0
  34. package/dist/infer/__tests__/rules/basic.test.d.ts +2 -0
  35. package/dist/infer/__tests__/rules/basic.test.d.ts.map +1 -0
  36. package/dist/infer/__tests__/rules/basic.test.js +85 -0
  37. package/dist/infer/__tests__/rules/boolean.test.d.ts +2 -0
  38. package/dist/infer/__tests__/rules/boolean.test.d.ts.map +1 -0
  39. package/dist/infer/__tests__/rules/boolean.test.js +34 -0
  40. package/dist/infer/__tests__/rules/duration.test.d.ts +2 -0
  41. package/dist/infer/__tests__/rules/duration.test.d.ts.map +1 -0
  42. package/dist/infer/__tests__/rules/duration.test.js +24 -0
  43. package/dist/infer/__tests__/rules/ip.test.d.ts +2 -0
  44. package/dist/infer/__tests__/rules/ip.test.d.ts.map +1 -0
  45. package/dist/infer/__tests__/rules/ip.test.js +24 -0
  46. package/dist/infer/__tests__/rules/json.test.d.ts +2 -0
  47. package/dist/infer/__tests__/rules/json.test.d.ts.map +1 -0
  48. package/dist/infer/__tests__/rules/json.test.js +38 -0
  49. package/dist/infer/__tests__/rules/list.test.d.ts +2 -0
  50. package/dist/infer/__tests__/rules/list.test.d.ts.map +1 -0
  51. package/dist/infer/__tests__/rules/list.test.js +130 -0
  52. package/dist/infer/__tests__/rules/port.test.d.ts +2 -0
  53. package/dist/infer/__tests__/rules/port.test.d.ts.map +1 -0
  54. package/dist/infer/__tests__/rules/port.test.js +24 -0
  55. package/dist/infer/__tests__/rules/url.test.d.ts +2 -0
  56. package/dist/infer/__tests__/rules/url.test.d.ts.map +1 -0
  57. package/dist/infer/__tests__/rules/url.test.js +39 -0
  58. package/dist/infer/__tests__/rules/version.test.d.ts +2 -0
  59. package/dist/infer/__tests__/rules/version.test.d.ts.map +1 -0
  60. package/dist/infer/__tests__/rules/version.test.js +37 -0
  61. package/dist/infer/generated/basic.d.ts +8 -0
  62. package/dist/infer/generated/basic.d.ts.map +1 -0
  63. package/dist/infer/generated/basic.js +24 -0
  64. package/dist/infer/generated/boolean.d.ts +3 -0
  65. package/dist/infer/generated/boolean.d.ts.map +1 -0
  66. package/dist/infer/generated/boolean.js +9 -0
  67. package/dist/infer/generated/duration.d.ts +3 -0
  68. package/dist/infer/generated/duration.d.ts.map +1 -0
  69. package/dist/infer/generated/duration.js +9 -0
  70. package/dist/infer/generated/ip.d.ts +3 -0
  71. package/dist/infer/generated/ip.d.ts.map +1 -0
  72. package/dist/infer/generated/ip.js +9 -0
  73. package/dist/infer/generated/json.d.ts +4 -0
  74. package/dist/infer/generated/json.d.ts.map +1 -0
  75. package/dist/infer/generated/json.js +10 -0
  76. package/dist/infer/generated/list.d.ts +8 -0
  77. package/dist/infer/generated/list.d.ts.map +1 -0
  78. package/dist/infer/generated/list.js +49 -0
  79. package/dist/infer/generated/port.d.ts +4 -0
  80. package/dist/infer/generated/port.d.ts.map +1 -0
  81. package/dist/infer/generated/port.js +10 -0
  82. package/dist/infer/generated/url.d.ts +14 -0
  83. package/dist/infer/generated/url.d.ts.map +1 -0
  84. package/dist/infer/generated/url.js +30 -0
  85. package/dist/infer/generated/version.d.ts +4 -0
  86. package/dist/infer/generated/version.d.ts.map +1 -0
  87. package/dist/infer/generated/version.js +10 -0
  88. package/dist/infer/helpers.d.ts +11 -0
  89. package/dist/infer/helpers.d.ts.map +1 -0
  90. package/dist/infer/helpers.js +41 -0
  91. package/dist/infer/index.d.ts +4 -0
  92. package/dist/infer/index.d.ts.map +1 -0
  93. package/dist/infer/index.js +35 -0
  94. package/dist/infer/rules/basic.d.ts +11 -0
  95. package/dist/infer/rules/basic.d.ts.map +1 -0
  96. package/dist/infer/rules/basic.js +90 -0
  97. package/dist/infer/rules/boolean.d.ts +3 -0
  98. package/dist/infer/rules/boolean.d.ts.map +1 -0
  99. package/dist/infer/rules/boolean.js +25 -0
  100. package/dist/infer/rules/duration.d.ts +3 -0
  101. package/dist/infer/rules/duration.d.ts.map +1 -0
  102. package/dist/infer/rules/duration.js +25 -0
  103. package/dist/infer/rules/ip.d.ts +3 -0
  104. package/dist/infer/rules/ip.d.ts.map +1 -0
  105. package/dist/infer/rules/ip.js +25 -0
  106. package/dist/infer/rules/json.d.ts +3 -0
  107. package/dist/infer/rules/json.d.ts.map +1 -0
  108. package/dist/infer/rules/json.js +59 -0
  109. package/dist/infer/rules/list.d.ts +12 -0
  110. package/dist/infer/rules/list.d.ts.map +1 -0
  111. package/dist/infer/rules/list.js +221 -0
  112. package/dist/infer/rules/port.d.ts +3 -0
  113. package/dist/infer/rules/port.d.ts.map +1 -0
  114. package/dist/infer/rules/port.js +30 -0
  115. package/dist/infer/rules/url.d.ts +4 -0
  116. package/dist/infer/rules/url.d.ts.map +1 -0
  117. package/dist/infer/rules/url.js +143 -0
  118. package/dist/infer/rules/version.d.ts +3 -0
  119. package/dist/infer/rules/version.d.ts.map +1 -0
  120. package/dist/infer/rules/version.js +26 -0
  121. package/dist/infer/types.d.ts +87 -0
  122. package/dist/infer/types.d.ts.map +1 -0
  123. package/dist/infer/types.js +1 -0
  124. package/dist/infer-rules/basic.d.ts +5 -0
  125. package/dist/infer-rules/basic.d.ts.map +1 -0
  126. package/dist/infer-rules/basic.js +48 -0
  127. package/dist/infer-rules/boolean.d.ts +3 -0
  128. package/dist/infer-rules/boolean.d.ts.map +1 -0
  129. package/dist/infer-rules/boolean.js +25 -0
  130. package/dist/infer-rules/dotted.d.ts +4 -0
  131. package/dist/infer-rules/dotted.d.ts.map +1 -0
  132. package/dist/infer-rules/dotted.js +48 -0
  133. package/dist/infer-rules/duration.d.ts +3 -0
  134. package/dist/infer-rules/duration.d.ts.map +1 -0
  135. package/dist/infer-rules/duration.js +25 -0
  136. package/dist/infer-rules/index.d.ts +50 -0
  137. package/dist/infer-rules/index.d.ts.map +1 -0
  138. package/dist/infer-rules/index.js +42 -0
  139. package/dist/infer-rules/json.d.ts +3 -0
  140. package/dist/infer-rules/json.d.ts.map +1 -0
  141. package/dist/infer-rules/json.js +50 -0
  142. package/dist/infer-rules/list.d.ts +5 -0
  143. package/dist/infer-rules/list.d.ts.map +1 -0
  144. package/dist/infer-rules/list.js +200 -0
  145. package/dist/infer-rules/path.d.ts +5 -0
  146. package/dist/infer-rules/path.d.ts.map +1 -0
  147. package/dist/infer-rules/path.js +78 -0
  148. package/dist/infer-rules/port.d.ts +3 -0
  149. package/dist/infer-rules/port.d.ts.map +1 -0
  150. package/dist/infer-rules/port.js +26 -0
  151. package/dist/infer-rules/simple.d.ts +3 -0
  152. package/dist/infer-rules/simple.d.ts.map +1 -0
  153. package/dist/infer-rules/simple.js +37 -0
  154. package/dist/infer-rules/url.d.ts +4 -0
  155. package/dist/infer-rules/url.d.ts.map +1 -0
  156. package/dist/infer-rules/url.js +149 -0
  157. package/dist/llm-kit/context.json.d.ts +2 -0
  158. package/dist/llm-kit/context.json.d.ts.map +1 -0
  159. package/dist/llm-kit/context.json.js +22 -0
  160. package/dist/sample/DNLTest.d.ts +2 -0
  161. package/dist/sample/DNLTest.d.ts.map +1 -0
  162. package/dist/sample/DNLTest.js +4 -0
  163. package/dist/sample/debug.d.ts +2 -0
  164. package/dist/sample/debug.d.ts.map +1 -0
  165. package/dist/sample/debug.js +5 -0
  166. package/dist/sample/env.dnl.d.ts +426 -0
  167. package/dist/sample/env.dnl.d.ts.map +1 -0
  168. package/dist/sample/env.dnl.js +429 -0
  169. package/dist/schemas/bool.d.ts +9 -0
  170. package/dist/schemas/bool.d.ts.map +1 -0
  171. package/dist/schemas/bool.js +22 -0
  172. package/dist/schemas/boolean.d.ts +9 -0
  173. package/dist/schemas/boolean.d.ts.map +1 -0
  174. package/dist/schemas/boolean.js +23 -0
  175. package/dist/schemas/dotted.d.ts +21 -0
  176. package/dist/schemas/dotted.d.ts.map +1 -0
  177. package/dist/schemas/dotted.js +45 -0
  178. package/dist/schemas/duration.d.ts +11 -0
  179. package/dist/schemas/duration.d.ts.map +1 -0
  180. package/dist/schemas/duration.js +44 -0
  181. package/dist/schemas/index.d.ts +9 -0
  182. package/dist/schemas/index.d.ts.map +1 -0
  183. package/dist/schemas/index.js +8 -0
  184. package/dist/schemas/ip-and-version.d.ts +12 -0
  185. package/dist/schemas/ip-and-version.d.ts.map +1 -0
  186. package/dist/schemas/ip-and-version.js +35 -0
  187. package/dist/schemas/ip.d.ts +11 -0
  188. package/dist/schemas/ip.d.ts.map +1 -0
  189. package/dist/schemas/ip.js +33 -0
  190. package/dist/schemas/json.d.ts +15 -0
  191. package/dist/schemas/json.d.ts.map +1 -0
  192. package/dist/schemas/json.js +34 -0
  193. package/dist/schemas/list.d.ts +89 -0
  194. package/dist/schemas/list.d.ts.map +1 -0
  195. package/dist/schemas/list.js +139 -0
  196. package/dist/schemas/path.d.ts +23 -0
  197. package/dist/schemas/path.d.ts.map +1 -0
  198. package/dist/schemas/path.js +33 -0
  199. package/dist/schemas/port.d.ts +8 -0
  200. package/dist/schemas/port.d.ts.map +1 -0
  201. package/dist/schemas/port.js +9 -0
  202. package/dist/schemas/urls.d.ts +15 -0
  203. package/dist/schemas/urls.d.ts.map +1 -0
  204. package/dist/schemas/urls.js +54 -0
  205. package/package.json +11 -6
  206. package/dist/DnlTest.d.ts +0 -2
  207. package/dist/DnlTest.d.ts.map +0 -1
  208. package/dist/DnlTest.js +0 -12
  209. package/dist/cli/utils/exitCodes.d.ts +0 -8
  210. package/dist/cli/utils/exitCodes.d.ts.map +0 -1
  211. package/dist/cli/utils/exitCodes.js +0 -8
  212. package/dist/romaintaillandier1978-dotenv-never-lies-0.3.0.tgz +0 -0
@@ -0,0 +1,35 @@
1
+ import { z } from "zod";
2
+ const ipV4Regex = /^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/;
3
+ const ipV6Regex = /^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$/;
4
+ export const looksLikeValidIp = (value) => {
5
+ return ipV4Regex.test(value) || ipV6Regex.test(value);
6
+ };
7
+ /**
8
+ * Creates a Zod schema for a IP address. (simple V4 address: 0.0.0.0 or V6 address: 0000:0000:0000:0000:0000:0000:0000:0000).
9
+ * compressed ip addresses like ::ffff:192.0.2.1 are not supported.
10
+ * @param name - The name of the environment variable.
11
+ * @returns A Zod schema for a IP address.
12
+ */
13
+ export const ipSchema = (name) => {
14
+ return z.string().transform((v, ctx) => {
15
+ if (!looksLikeValidIp(v)) {
16
+ ctx.addIssue({ code: "custom", message: `${name} has invalid value: "${v}"` });
17
+ return z.NEVER;
18
+ }
19
+ return v;
20
+ });
21
+ };
22
+ /** semver 1.2.3 let it be simple ! no suffixes like -beta, -rc, etc.*/
23
+ const VERSION_REGEX = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/;
24
+ export const looksLikeValidVersion = (value) => {
25
+ return VERSION_REGEX.test(value);
26
+ };
27
+ export const versionSchema = (name) => {
28
+ return z.string().transform((v, ctx) => {
29
+ if (!VERSION_REGEX.test(v)) {
30
+ ctx.addIssue({ code: "custom", message: `${name} has invalid value: "${v}"` });
31
+ return z.NEVER;
32
+ }
33
+ return v;
34
+ });
35
+ };
@@ -0,0 +1,11 @@
1
+ import { z } from "zod";
2
+ export declare const looksLikeValidIp: (value: string) => boolean;
3
+ /**
4
+ * Creates a Zod schema for a boolean value.
5
+ * @param name - The name of the boolean value.
6
+ * @returns A Zod schema for a boolean value.
7
+ */
8
+ export declare const ipSchema: (name: string) => z.ZodType<string>;
9
+ export declare const looksLikeValidVersion: (value: string) => boolean;
10
+ export declare const versionSchema: (name: string) => z.ZodType<string>;
11
+ //# sourceMappingURL=ip.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ip.d.ts","sourceRoot":"","sources":["../../src/schemas/ip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,gBAAgB,GAAI,OAAO,MAAM,YAE7C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,QAAQ,GAAI,MAAM,MAAM,KAAG,CAAC,CAAC,OAAO,CAAC,MAAM,CAQvD,CAAC;AAGF,eAAO,MAAM,qBAAqB,GAAI,OAAO,MAAM,YAElD,CAAC;AACF,eAAO,MAAM,aAAa,GAAI,MAAM,MAAM,KAAG,CAAC,CAAC,OAAO,CAAC,MAAM,CAQ5D,CAAC"}
@@ -0,0 +1,33 @@
1
+ import { z } from "zod";
2
+ const ipV4Regex = /^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/;
3
+ const ipV6Regex = /^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$/;
4
+ export const looksLikeValidIp = (value) => {
5
+ return ipV4Regex.test(value) || ipV6Regex.test(value);
6
+ };
7
+ /**
8
+ * Creates a Zod schema for a boolean value.
9
+ * @param name - The name of the boolean value.
10
+ * @returns A Zod schema for a boolean value.
11
+ */
12
+ export const ipSchema = (name) => {
13
+ return z.string().transform((v, ctx) => {
14
+ if (!looksLikeValidIp(v)) {
15
+ ctx.addIssue({ code: "custom", message: `${name} has invalid value: "${v}"` });
16
+ return z.NEVER;
17
+ }
18
+ return v;
19
+ });
20
+ };
21
+ const VERSION_REGEX = /^(\d+\.\d+\.\d+)$/;
22
+ export const looksLikeValidVersion = (value) => {
23
+ return VERSION_REGEX.test(value);
24
+ };
25
+ export const versionSchema = (name) => {
26
+ return z.string().transform((v, ctx) => {
27
+ if (!VERSION_REGEX.test(v)) {
28
+ ctx.addIssue({ code: "custom", message: `${name} has invalid value: "${v}"` });
29
+ return z.NEVER;
30
+ }
31
+ return v;
32
+ });
33
+ };
@@ -0,0 +1,15 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Creates a Zod schema for a JSON value.
4
+ * @param name - The name of the JSON value.
5
+ * @returns A Zod schema for a JSON value.
6
+ */
7
+ export declare function jsonSchema(name: string): z.ZodType<unknown>;
8
+ /**
9
+ * Creates a Zod schema for a JSON value with a specific schema.
10
+ * @param name - The name of the JSON value.
11
+ * @param of - The schema used to validate the JSON value.
12
+ * @returns A Zod schema for a JSON value.
13
+ */
14
+ export declare function jsonSchema<T>(name: string, of: z.ZodSchema<T>): z.ZodType<T>;
15
+ //# sourceMappingURL=json.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../src/schemas/json.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;AAE7D;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,34 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Creates a Zod schema for a JSON value with a specific schema.
4
+ * @param name - The name of the JSON value.
5
+ * @param of - The schema used to validate the JSON value.
6
+ * @returns A Zod schema for a JSON value.
7
+ */
8
+ export function jsonSchema(name, of) {
9
+ return z.string().transform((v, ctx) => {
10
+ let parsed;
11
+ try {
12
+ parsed = JSON.parse(v);
13
+ }
14
+ catch {
15
+ ctx.addIssue({
16
+ code: "custom",
17
+ message: `${name} is not a valid JSON`,
18
+ });
19
+ return z.NEVER;
20
+ }
21
+ if (!of) {
22
+ return parsed;
23
+ }
24
+ const result = of.safeParse(parsed);
25
+ if (!result.success) {
26
+ ctx.addIssue({
27
+ code: "custom",
28
+ message: `${name} does not match expected JSON schema`,
29
+ });
30
+ return z.NEVER;
31
+ }
32
+ return result.data;
33
+ });
34
+ }
@@ -0,0 +1,89 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Options for the listSchema function. (exemple : "a;b;c")
4
+ * @template T - The type of the elements in the list.
5
+ */
6
+ export type SplitterSchemaOptions<T = string> = {
7
+ /**
8
+ * The separator used to split the string into a list.
9
+ */
10
+ splitter?: string;
11
+ /**
12
+ * The schema used to validate the elements in the list.
13
+ */
14
+ of?: z.ZodSchema<T>;
15
+ };
16
+ /**
17
+ * Options for key=value listSchema function. (exemple : "a=b&c=d")
18
+ * @template T - The type of the elements in the list.
19
+ */
20
+ export type DoubleSplitterSchemaOptions<T = string> = {
21
+ /**
22
+ * first level separator used to split the string into a list.
23
+ */
24
+ splitter?: string;
25
+ /**
26
+ * The schema used to validate the elements in the list.
27
+ */
28
+ of?: {
29
+ /**
30
+ * second level separator used to split key-pair.
31
+ */
32
+ splitter?: string;
33
+ /**
34
+ * The schema used to validate the elements in the list.
35
+ */
36
+ of?: z.ZodSchema<T>;
37
+ };
38
+ };
39
+ /**
40
+ * Creates a Zod schema for a list of elements.
41
+ * @param name - The name of the list.
42
+ * @param options - The options for the list schema.
43
+ * @param options.splitter - The separator used to split the string into a list. (default: ";")
44
+ * @param options.of - The schema used to validate the elements in the list. (default: z.string())
45
+ * @returns A Zod schema for a list of elements.
46
+ */
47
+ export declare const listSchema: <T = string>(name: string, options?: SplitterSchemaOptions<T>) => z.ZodType<T[]>;
48
+ /**
49
+ * Creates a Zod schema for a list of URLs.
50
+ * @param name - The name of the list.
51
+ * @param options - The options for the list schema.
52
+ * @returns A Zod schema for a list of URLs.
53
+ */
54
+ export declare const urlListSchema: (name: string, options?: Omit<SplitterSchemaOptions<string>, "of">) => z.ZodType<string[], unknown, z.core.$ZodTypeInternals<string[], unknown>>;
55
+ /**
56
+ * Creates a Zod schema for a list of emails.
57
+ * @param name - The name of the list.
58
+ * @param options - The options for the list schema.
59
+ * @returns A Zod schema for a list of emails.
60
+ */
61
+ export declare const emailListSchema: (name: string, options?: Omit<SplitterSchemaOptions<string>, "of">) => z.ZodType<string[], unknown, z.core.$ZodTypeInternals<string[], unknown>>;
62
+ /**
63
+ * Creates a Zod schema for a key-value pair.
64
+ * @param name - The name of the key-value pair.
65
+ * @param options - The options for the key-value pair schema.
66
+ * @returns an object with a single key
67
+ */
68
+ export declare const keyValueSchema: <T = string>(name: string, options?: SplitterSchemaOptions<T>) => z.ZodType<Record<string, T>>;
69
+ /**
70
+ * Creates a Zod schema for a list of key-value pairs using two separators.
71
+ * @Example firstname=Romain&lastname=Taillandier
72
+ * => will be parsed as an array of objects with a single key: [{ firstname: "Romain" }, { lastname: "Taillandier" }]
73
+ * @param name - The name of the list.
74
+ * @param options - The options for the list schema.
75
+ * @param options.splitter - The separator used to split the string into a list of key-value pairs. (default: "&")
76
+ * @param options.of - The schema used to validate the key-value pairs. (default: "=")
77
+ * @returns an array of objects with a single key
78
+ */
79
+ export declare const keyValueListSchema: <T = string>(name: string, options?: DoubleSplitterSchemaOptions<T>) => z.ZodType<Record<string, T>[]>;
80
+ /**
81
+ * Creates a Zod schema for a map of key-value pairs using two separators. Duplicate keys are rejected.
82
+ * @Example firstname=Romain&lastname=Taillandier
83
+ * => will be parsed as { firstname: "Romain", lastname: "Taillandier" }
84
+ * @param name - The name of the map.
85
+ * @param options - The options for the map schema.
86
+ * @returns a map of key-value pairs
87
+ */
88
+ export declare const keyValueMapSchema: <T = string>(name: string, options?: DoubleSplitterSchemaOptions<T>) => z.ZodType<Record<string, T>>;
89
+ //# sourceMappingURL=list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../src/schemas/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,MAAM,MAAM,qBAAqB,CAAC,CAAC,GAAG,MAAM,IAAI;IAC5C;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,EAAE,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;CACvB,CAAC;AACF;;;GAGG;AACH,MAAM,MAAM,2BAA2B,CAAC,CAAC,GAAG,MAAM,IAAI;IAClD;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,EAAE,CAAC,EAAE;QACD;;WAEG;QACH,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB;;WAEG;QACH,EAAE,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;KACvB,CAAC;CACL,CAAC;AAmBF;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU,GAAI,CAAC,GAAG,MAAM,EAAE,MAAM,MAAM,EAAE,UAAS,qBAAqB,CAAC,CAAC,CAAM,KAAG,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,CAkB1G,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GAAI,MAAM,MAAM,EAAE,UAAU,IAAI,CAAC,qBAAqB,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,8EAIzF,CAAC;AAEP;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAAI,MAAM,MAAM,EAAE,UAAU,IAAI,CAAC,qBAAqB,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,8EAI3F,CAAC;AAEP;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GAAI,CAAC,GAAG,MAAM,EAAE,MAAM,MAAM,EAAE,UAAS,qBAAqB,CAAC,CAAC,CAAM,KAAG,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CA4B5H,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,GAAI,CAAC,GAAG,MAAM,EAAE,MAAM,MAAM,EAAE,UAAS,2BAA2B,CAAC,CAAC,CAAM,KAAG,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,CAUxI,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,GAAI,CAAC,GAAG,MAAM,EAAE,MAAM,MAAM,EAAE,UAAS,2BAA2B,CAAC,CAAC,CAAM,KAAG,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAkBrI,CAAC"}
@@ -0,0 +1,139 @@
1
+ import { z } from "zod";
2
+ const defaultListOptions = {
3
+ splitter: ";",
4
+ of: z.string(),
5
+ };
6
+ const defaultKeyValueOptions = {
7
+ splitter: "=",
8
+ of: z.string(),
9
+ };
10
+ const defaultKeyValueListOptions = {
11
+ splitter: "&",
12
+ of: {
13
+ splitter: "=",
14
+ of: z.string(),
15
+ },
16
+ };
17
+ /**
18
+ * Creates a Zod schema for a list of elements.
19
+ * @param name - The name of the list.
20
+ * @param options - The options for the list schema.
21
+ * @param options.splitter - The separator used to split the string into a list. (default: ";")
22
+ * @param options.of - The schema used to validate the elements in the list. (default: z.string())
23
+ * @returns A Zod schema for a list of elements.
24
+ */
25
+ export const listSchema = (name, options = {}) => {
26
+ const opts = { ...defaultListOptions, ...options };
27
+ return z.string().transform((v, ctx) => {
28
+ const values = v
29
+ .split(opts.splitter)
30
+ .map((s) => s.trim())
31
+ .filter(Boolean);
32
+ return values.map((entry) => {
33
+ const res = opts.of.safeParse(entry);
34
+ if (!res.success) {
35
+ ctx.addIssue({ code: "custom", message: `${name} contains an invalid entry: "${entry}"` });
36
+ return z.NEVER;
37
+ }
38
+ return res.data;
39
+ });
40
+ });
41
+ };
42
+ /**
43
+ * Creates a Zod schema for a list of URLs.
44
+ * @param name - The name of the list.
45
+ * @param options - The options for the list schema.
46
+ * @returns A Zod schema for a list of URLs.
47
+ */
48
+ export const urlListSchema = (name, options) => listSchema(name, {
49
+ ...options,
50
+ of: z.url(),
51
+ });
52
+ /**
53
+ * Creates a Zod schema for a list of emails.
54
+ * @param name - The name of the list.
55
+ * @param options - The options for the list schema.
56
+ * @returns A Zod schema for a list of emails.
57
+ */
58
+ export const emailListSchema = (name, options) => listSchema(name, {
59
+ ...options,
60
+ of: z.email(),
61
+ });
62
+ /**
63
+ * Creates a Zod schema for a key-value pair.
64
+ * @param name - The name of the key-value pair.
65
+ * @param options - The options for the key-value pair schema.
66
+ * @returns an object with a single key
67
+ */
68
+ export const keyValueSchema = (name, options = {}) => {
69
+ const opts = { ...defaultKeyValueOptions, ...options };
70
+ return z.string().transform((v, ctx) => {
71
+ // if target value is "abc=def=ghi" => awaited result : { abc: "def=ghi" }
72
+ // So don't do that :
73
+ // const parts = v.split(opts.splitter);
74
+ const index = v.indexOf(opts.splitter);
75
+ if (index === -1) {
76
+ ctx.addIssue({ code: "custom", message: `${name} contains an invalid entry: "${v}"` });
77
+ return z.NEVER;
78
+ }
79
+ const keyPart = v.slice(0, index);
80
+ const valuePart = v.slice(index + opts.splitter.length);
81
+ const key = z.string().safeParse(keyPart);
82
+ if (!key.success) {
83
+ ctx.addIssue({ code: "custom", message: `${name} contains an invalid key: "${keyPart}"` });
84
+ return z.NEVER;
85
+ }
86
+ const value = opts.of.safeParse(valuePart);
87
+ if (!value.success) {
88
+ ctx.addIssue({ code: "custom", message: `${name} contains an invalid value: "${valuePart}"` });
89
+ return z.NEVER;
90
+ }
91
+ return { [key.data]: value.data };
92
+ });
93
+ };
94
+ /**
95
+ * Creates a Zod schema for a list of key-value pairs using two separators.
96
+ * @Example firstname=Romain&lastname=Taillandier
97
+ * => will be parsed as an array of objects with a single key: [{ firstname: "Romain" }, { lastname: "Taillandier" }]
98
+ * @param name - The name of the list.
99
+ * @param options - The options for the list schema.
100
+ * @param options.splitter - The separator used to split the string into a list of key-value pairs. (default: "&")
101
+ * @param options.of - The schema used to validate the key-value pairs. (default: "=")
102
+ * @returns an array of objects with a single key
103
+ */
104
+ export const keyValueListSchema = (name, options = {}) => {
105
+ const outerSplitter = options.splitter ?? defaultKeyValueListOptions.splitter;
106
+ const innerOptions = {
107
+ splitter: options.of?.splitter ?? defaultKeyValueListOptions.of.splitter,
108
+ of: (options.of?.of ?? z.string()),
109
+ };
110
+ return listSchema(name, {
111
+ splitter: outerSplitter,
112
+ of: keyValueSchema(name, innerOptions),
113
+ });
114
+ };
115
+ /**
116
+ * Creates a Zod schema for a map of key-value pairs using two separators. Duplicate keys are rejected.
117
+ * @Example firstname=Romain&lastname=Taillandier
118
+ * => will be parsed as { firstname: "Romain", lastname: "Taillandier" }
119
+ * @param name - The name of the map.
120
+ * @param options - The options for the map schema.
121
+ * @returns a map of key-value pairs
122
+ */
123
+ export const keyValueMapSchema = (name, options = {}) => {
124
+ return keyValueListSchema(name, options).transform((list, ctx) => {
125
+ const result = {};
126
+ for (const entry of list) {
127
+ const [key, value] = Object.entries(entry)[0];
128
+ if (key in result) {
129
+ ctx.addIssue({
130
+ code: "custom",
131
+ message: `${name} contains duplicate key: "${key}"`,
132
+ });
133
+ return z.NEVER;
134
+ }
135
+ result[key] = value;
136
+ }
137
+ return result;
138
+ });
139
+ };
@@ -0,0 +1,23 @@
1
+ import { z } from "zod";
2
+ export declare const looksLikePath: (value: string) => boolean;
3
+ export declare const looksLikeFilename: (value: string) => boolean;
4
+ export declare const looksLikeFilePath: (value: string) => boolean | undefined;
5
+ /**
6
+ * Creates a Zod schema for a path.
7
+ * @param name - The name of the path.
8
+ * @returns A Zod schema for a path.
9
+ */
10
+ export declare const pathSchema: (name: string) => z.ZodType<string>;
11
+ /**
12
+ * Creates a Zod schema for a file path.
13
+ * @param name - The name of the file path.
14
+ * @returns A Zod schema for a file path.
15
+ */
16
+ export declare const filePathSchema: (name: string) => z.ZodType<string>;
17
+ /**
18
+ * Creates a Zod schema for a filename.
19
+ * @param name - The name of the filename.
20
+ * @returns A Zod schema for a filename.
21
+ */
22
+ export declare const filenameSchema: (name: string) => z.ZodString;
23
+ //# sourceMappingURL=path.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../src/schemas/path.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB,eAAO,MAAM,aAAa,GAAI,OAAO,MAAM,YAAgD,CAAC;AAE5F,eAAO,MAAM,iBAAiB,GAAI,OAAO,MAAM,YAAyE,CAAC;AAEzH,eAAO,MAAM,iBAAiB,GAAI,OAAO,MAAM,wBAA+F,CAAC;AAK/I;;;;GAIG;AACH,eAAO,MAAM,UAAU,GAAI,MAAM,MAAM,KAAG,CAAC,CAAC,OAAO,CAAC,MAAM,CAAsB,CAAC;AAEjF;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,KAAG,CAAC,CAAC,OAAO,CAAC,MAAM,CAAsB,CAAC;AAErF;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,gBAI4D,CAAC"}
@@ -0,0 +1,33 @@
1
+ import { z } from "zod";
2
+ // Note to myself :
3
+ // On est volontairement permissifs.
4
+ //
5
+ // On fait au plus simple : un path contient au moins un / ou un \
6
+ // sinon on sait pas.
7
+ // si oui, c'est presque certain que c'est un path, dans un .env
8
+ export const looksLikePath = (value) => value.includes("/") || value.includes("\\");
9
+ export const looksLikeFilename = (value) => !value.includes("/") && !value.includes("\\") && value.includes(".");
10
+ export const looksLikeFilePath = (value) => (value.includes("/") || value.includes("\\")) && value.split(/[\\/]/).pop()?.includes(".");
11
+ //
12
+ // Les schéma vont refléter ca
13
+ /**
14
+ * Creates a Zod schema for a path.
15
+ * @param name - The name of the path.
16
+ * @returns A Zod schema for a path.
17
+ */
18
+ export const pathSchema = (name) => z.string().min(1);
19
+ /**
20
+ * Creates a Zod schema for a file path.
21
+ * @param name - The name of the file path.
22
+ * @returns A Zod schema for a file path.
23
+ */
24
+ export const filePathSchema = (name) => z.string().min(1);
25
+ /**
26
+ * Creates a Zod schema for a filename.
27
+ * @param name - The name of the filename.
28
+ * @returns A Zod schema for a filename.
29
+ */
30
+ export const filenameSchema = (name) => z
31
+ .string()
32
+ .min(1)
33
+ .refine((v) => !v.includes("/") && !v.includes("\\"), `${name} must be a filename, not a path`);
@@ -0,0 +1,8 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Creates a Zod schema for a port.
4
+ * @param name - The name of the port.
5
+ * @returns A Zod schema for a port.
6
+ */
7
+ export declare const portSchema: (name: string) => z.ZodType<number>;
8
+ //# sourceMappingURL=port.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"port.d.ts","sourceRoot":"","sources":["../../src/schemas/port.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;GAIG;AACH,eAAO,MAAM,UAAU,GAAI,MAAM,MAAM,KAAG,CAAC,CAAC,OAAO,CAAC,MAAM,CAEzD,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Creates a Zod schema for a port.
4
+ * @param name - The name of the port.
5
+ * @returns A Zod schema for a port.
6
+ */
7
+ export const portSchema = (name) => {
8
+ return z.coerce.number(`${name} must be a number`).int(`${name} must be an integer`).min(1, `${name} must be >= 1`).max(65535, `${name} must be <= 65535`);
9
+ };
@@ -0,0 +1,15 @@
1
+ import { z } from "zod";
2
+ export declare const looksLikeUrl: (value: string) => boolean;
3
+ export declare const looksLikeHttpUrl: (value: string) => boolean;
4
+ export declare const looksLikeDbUrl: (value: string) => boolean;
5
+ export declare const looksLikeQueueUrl: (value: string) => boolean;
6
+ export declare const looksLikeWsUrl: (value: string) => boolean;
7
+ export declare const looksLikeStorageUrl: (value: string) => boolean;
8
+ export declare const looksLikeOtherUrl: (value: string) => boolean;
9
+ export declare const httpUrlSchema: (name: string) => z.ZodURL;
10
+ export declare const databaseUrlSchema: (name: string) => z.ZodURL;
11
+ export declare const queueUrlSchema: (name: string) => z.ZodURL;
12
+ export declare const wsUrlSchema: (name: string) => z.ZodURL;
13
+ export declare const storageUrlSchema: (name: string) => z.ZodURL;
14
+ export declare const otherUrlSchema: (name: string) => z.ZodURL;
15
+ //# sourceMappingURL=urls.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"urls.d.ts","sourceRoot":"","sources":["../../src/schemas/urls.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,YAAY,GAAI,OAAO,MAAM,KAAG,OAO5C,CAAC;AAwCF,eAAO,MAAM,gBAAgB,UAhB4B,MAAM,KAAK,OAgBJ,CAAC;AACjE,eAAO,MAAM,cAAc,UAjB8B,MAAM,KAAK,OAiBR,CAAC;AAC7D,eAAO,MAAM,iBAAiB,UAlB2B,MAAM,KAAK,OAkBF,CAAC;AACnE,eAAO,MAAM,cAAc,UAnB8B,MAAM,KAAK,OAmBR,CAAC;AAC7D,eAAO,MAAM,mBAAmB,UApByB,MAAM,KAAK,OAoBE,CAAC;AACvE,eAAO,MAAM,iBAAiB,UArB2B,MAAM,KAAK,OAqBF,CAAC;AAEnE,eAAO,MAAM,aAAa,SAbf,MAAM,KAAG,CAAC,CAAC,MAa8C,CAAC;AACrE,eAAO,MAAM,iBAAiB,SAdnB,MAAM,KAAG,CAAC,CAAC,MAcoD,CAAC;AAC3E,eAAO,MAAM,cAAc,SAfhB,MAAM,KAAG,CAAC,CAAC,MAeiD,CAAC;AACxE,eAAO,MAAM,WAAW,SAhBb,MAAM,KAAG,CAAC,CAAC,MAgB+C,CAAC;AACtE,eAAO,MAAM,gBAAgB,SAjBlB,MAAM,KAAG,CAAC,CAAC,MAiBuD,CAAC;AAC9E,eAAO,MAAM,cAAc,SAlBhB,MAAM,KAAG,CAAC,CAAC,MAkBiD,CAAC"}
@@ -0,0 +1,54 @@
1
+ import { z } from "zod";
2
+ export const looksLikeUrl = (value) => {
3
+ try {
4
+ new URL(value);
5
+ return true;
6
+ }
7
+ catch {
8
+ return false;
9
+ }
10
+ };
11
+ const HTTP_PROTOCOLS = ["http:", "https:"];
12
+ const DB_PROTOCOLS = [
13
+ "postgres:",
14
+ "postgresql:",
15
+ "mysql:",
16
+ "mariadb:",
17
+ "mongodb:",
18
+ "mongodb+srv:",
19
+ "redis:",
20
+ "rediss:",
21
+ "cassandra:",
22
+ "mssql:",
23
+ "sqlserver:",
24
+ "oracle:",
25
+ "cockroachdb:",
26
+ "sqlite:",
27
+ ];
28
+ const QUEUE_PROTOCOLS = ["amqp:", "amqps:", "mqtt:", "mqtt+ws:", "mqtt+wss:", "stomp:", "stomp+ssl:", "stomp+ws:", "stomp+wss:"];
29
+ const WS_PROTOCOLS = ["ws:", "wss:"];
30
+ const STORAGE_PROTOCOLS = ["s3:", "gs:", "azure:", "azblob:", "file:", "ftp:", "ftps:", "sftp:"];
31
+ const OTHER_PROTOCOLS = ["ldap:", "ldaps:", "smtp:", "smtps:", "imap:", "imaps:", "pop3:", "pop3s:", "git:", "ssh:", "tcp:", "udp:"];
32
+ const makeUrlLooksLike = (protocols) => {
33
+ return (value) => protocols.some((protocol) => new URL(value).protocol === protocol);
34
+ };
35
+ // Remark.
36
+ // here each schema do a double url verification :
37
+ // once in z.url(), once in looksLikeXUrl() with new URL().
38
+ const makeUrlSchema = (message, looksLike) => (name) => {
39
+ return z.url().refine((v) => looksLike(v.toString()), {
40
+ message: `${name} has invalid ${message} URL`,
41
+ });
42
+ };
43
+ export const looksLikeHttpUrl = makeUrlLooksLike(HTTP_PROTOCOLS);
44
+ export const looksLikeDbUrl = makeUrlLooksLike(DB_PROTOCOLS);
45
+ export const looksLikeQueueUrl = makeUrlLooksLike(QUEUE_PROTOCOLS);
46
+ export const looksLikeWsUrl = makeUrlLooksLike(WS_PROTOCOLS);
47
+ export const looksLikeStorageUrl = makeUrlLooksLike(STORAGE_PROTOCOLS);
48
+ export const looksLikeOtherUrl = makeUrlLooksLike(OTHER_PROTOCOLS);
49
+ export const httpUrlSchema = makeUrlSchema("HTTP", looksLikeHttpUrl);
50
+ export const databaseUrlSchema = makeUrlSchema("database", looksLikeDbUrl);
51
+ export const queueUrlSchema = makeUrlSchema("queue", looksLikeQueueUrl);
52
+ export const wsUrlSchema = makeUrlSchema("WebSocket", looksLikeWsUrl);
53
+ export const storageUrlSchema = makeUrlSchema("storage", looksLikeStorageUrl);
54
+ export const otherUrlSchema = makeUrlSchema("other", looksLikeOtherUrl);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@romaintaillandier1978/dotenv-never-lies",
3
- "version": "1.1.1",
3
+ "version": "1.3.0",
4
4
  "description": "Typed, validated, and explicit environment variables — powered by Zod.",
5
5
  "license": "MIT",
6
6
  "author": "Romain TAILLANDIER",
@@ -15,7 +15,11 @@
15
15
  "pack:check": "npm pack --dry-run",
16
16
  "release:patch": "npm version patch",
17
17
  "release:minor": "npm version minor",
18
- "release:major": "npm version major"
18
+ "release:major": "npm version major",
19
+ "test": "vitest",
20
+ "test:run": "vitest run",
21
+ "test:watch": "vitest",
22
+ "start:infer": "yarn build && dnl infer --source .env --out src/sample/env.dnl.ts -f "
19
23
  },
20
24
  "keywords": [
21
25
  "env",
@@ -39,13 +43,13 @@
39
43
  "types": "./dist/index.d.ts",
40
44
  "exports": {
41
45
  ".": {
42
- "require": "./dist/index.js",
46
+ "types": "./dist/index.d.ts",
43
47
  "import": "./dist/index.js",
44
- "types": "./dist/index.d.ts"
48
+ "require": "./dist/index.js"
45
49
  },
46
50
  "./cli": {
47
- "require": "./dist/cli/index.js",
48
- "import": "./dist/cli/index.js"
51
+ "import": "./dist/cli/index.js",
52
+ "require": "./dist/cli/index.js"
49
53
  }
50
54
  },
51
55
  "bin": {
@@ -68,6 +72,7 @@
68
72
  "eslint": "^9.39.2",
69
73
  "prettier": "^3.7.4",
70
74
  "typescript": "^5.9.3",
75
+ "vitest": "^4.0.17",
71
76
  "zod": "^4.2.1"
72
77
  }
73
78
  }
package/dist/DnlTest.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=DnlTest.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DnlTest.d.ts","sourceRoot":"","sources":["../src/DnlTest.ts"],"names":[],"mappings":""}
package/dist/DnlTest.js DELETED
@@ -1,12 +0,0 @@
1
- export {};
2
- //envDefinition.explain({ key: "NODE_CORS_ORIGIN" });
3
- // const source: EnvSource = dnl.readEnvFile(".env");
4
- // let ok = envDefinition.check();
5
- // ok = envDefinition.check({ source: process.env });
6
- // const ENV = envDefinition.load({ source });
7
- // ok = envDefinition.check();
8
- // ok = envDefinition.check({ source: process.env });
9
- // // intellisens OK
10
- // ENV.NODE_ENV; //(property) NODE_ENV: "test" | "development" | "staging" | "production"
11
- // ENV.NODE_PORT; //(property) NODE_PORT: number
12
- // envDefinition.explain();
@@ -1,8 +0,0 @@
1
- export declare enum ExitCodes {
2
- success = 0,
3
- usageError = 1,
4
- schemaNotFound = 2,
5
- validationError = 3,
6
- exportError = 4
7
- }
8
- //# sourceMappingURL=exitCodes.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"exitCodes.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/exitCodes.ts"],"names":[],"mappings":"AAAA,oBAAY,SAAS;IACjB,OAAO,IAAI;IACX,UAAU,IAAI;IACd,cAAc,IAAI;IAClB,eAAe,IAAI;IACnB,WAAW,IAAI;CAClB"}
@@ -1,8 +0,0 @@
1
- export var ExitCodes;
2
- (function (ExitCodes) {
3
- ExitCodes[ExitCodes["success"] = 0] = "success";
4
- ExitCodes[ExitCodes["usageError"] = 1] = "usageError";
5
- ExitCodes[ExitCodes["schemaNotFound"] = 2] = "schemaNotFound";
6
- ExitCodes[ExitCodes["validationError"] = 3] = "validationError";
7
- ExitCodes[ExitCodes["exportError"] = 4] = "exportError";
8
- })(ExitCodes || (ExitCodes = {}));