@e-n-v/env 0.0.5 → 0.0.8
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/dist/{BooleanMap-DmFnCA-O.d.ts → BooleanMap-BPQuO3Ae.d.ts} +1 -3
- package/dist/{BooleanMap-B2eIP3tZ.d.cts → BooleanMap-CX_YrPCf.d.cts} +1 -3
- package/dist/EnvChannelOptions-BbKeuO-o.d.cts +366 -0
- package/dist/EnvChannelOptions-BbKeuO-o.d.ts +366 -0
- package/dist/{EnvSource-DA3ZGlES.js → EnvSource-WAGWqRVM.js} +6 -10
- package/dist/{EnvSource-BVnmdHku.cjs → EnvSource-s8F_M_6O.cjs} +21 -28
- package/dist/EnvVarSchema-CDZGmnex.cjs +15 -0
- package/dist/EnvVarSchema-Dr6q7jf6.js +10 -0
- package/dist/{ProcessEnvChannel-Do4-yiLI.d.ts → ProcessEnvChannel-CwhV7_EB.d.ts} +2 -4
- package/dist/{ProcessEnvChannel-D465c-dp.d.cts → ProcessEnvChannel-DWHPZePe.d.cts} +2 -4
- package/dist/{StringEnvVarSchema-B8MT7htU.d.ts → StringEnvVarSchema-D9Jr1Aws.d.cts} +5 -3
- package/dist/{StringEnvVarSchema-BF6C0nyT.d.cts → StringEnvVarSchema-D9Jr1Aws.d.ts} +5 -3
- package/dist/channels.cjs +3 -4
- package/dist/channels.d.cts +3 -4
- package/dist/channels.d.ts +3 -4
- package/dist/channels.js +2 -4
- package/dist/cli.cjs +10 -23
- package/dist/cli.d.cts +1 -1
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +7 -13
- package/dist/core.cjs +13 -14
- package/dist/core.d.cts +147 -6
- package/dist/core.d.ts +147 -6
- package/dist/core.js +9 -11
- package/dist/{custom-Bt_wnxIu.js → custom-Bd-jLg80.js} +3 -12
- package/dist/{custom-D_Rqjm09.cjs → custom-Dyb9TnER.cjs} +48 -58
- package/dist/files.cjs +6 -6
- package/dist/files.d.cts +2 -2
- package/dist/files.d.ts +2 -2
- package/dist/files.js +2 -5
- package/dist/{parse-DwtLpVhC.d.ts → index-B2eNij2x.d.cts} +1 -2
- package/dist/{parse-BT1QSa5e.d.cts → index-BHTM8nxS.d.ts} +1 -2
- package/dist/{prompt-yKdccbtZ.d.ts → index-BKBW9Dxs.d.cts} +3 -4
- package/dist/{prompt-C5WudV9x.d.cts → index-CEyOIRdj.d.ts} +3 -4
- package/dist/{EnvModel-CrGclUpJ.d.cts → index-Cb0abjLf.d.ts} +59 -7
- package/dist/{EnvModel-D8rt0EJ6.d.ts → index-Cz3frUwZ.d.cts} +58 -6
- package/dist/index.cjs +33 -0
- package/dist/index.d.cts +19 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +15 -0
- package/dist/model.cjs +10 -11
- package/dist/model.d.cts +2 -35
- package/dist/model.d.ts +2 -35
- package/dist/model.js +2 -6
- package/dist/parse.cjs +14 -14
- package/dist/parse.d.cts +5 -8
- package/dist/parse.d.ts +5 -8
- package/dist/parse.js +4 -7
- package/dist/preprocessors-BKuIcZa1.d.ts +83 -0
- package/dist/preprocessors-DFVyF0c7.d.cts +83 -0
- package/dist/prompt.cjs +12 -15
- package/dist/prompt.d.cts +5 -10
- package/dist/prompt.d.ts +5 -10
- package/dist/prompt.js +3 -9
- package/dist/{redis-EcC7TX3K.cjs → redis-CyTF0SYT.cjs} +321 -253
- package/dist/{redis-CJOpRPjc.js → redis-D18f4ztf.js} +76 -37
- package/dist/{index-Dq_0aeAL.d.ts → redis-DsW-Vkwq.d.cts} +26 -6
- package/dist/{index-D8pslhp4.d.cts → redis-tRD4nAy_.d.ts} +26 -6
- package/dist/{resolveChannel-v9BDsw-M.js → resolveChannel-D1Fzl4TL.js} +59 -63
- package/dist/{resolveChannel-CjAuxy3p.cjs → resolveChannel-DxZNYdDe.cjs} +84 -92
- package/dist/{chunk-pbleEpgJ.cjs → rolldown-runtime-C0BPl7ul.cjs} +15 -16
- package/dist/{chunk-Bp6m_JJh.js → rolldown-runtime-D7D4PA-g.js} +4 -4
- package/dist/{schema-jN4EtvEP.d.ts → schema-B-JLVS42.d.ts} +1 -3
- package/dist/{schema-DH4GiW9A.d.cts → schema-B1i83alz.d.cts} +1 -3
- package/dist/schema-CtP5lpU1.js +11 -0
- package/dist/schema-D9nJKipf.cjs +22 -0
- package/dist/schemas/zod.cjs +112 -359
- package/dist/schemas/zod.d.cts +117 -87
- package/dist/schemas/zod.d.ts +117 -87
- package/dist/schemas/zod.js +116 -377
- package/dist/schemas.cjs +152 -133
- package/dist/schemas.d.cts +2 -3
- package/dist/schemas.d.ts +2 -3
- package/dist/schemas.js +2 -6
- package/dist/{src-Cjo2XA4n.cjs → src-5GYFbR9n.cjs} +21 -25
- package/dist/{src-BBwjK5SK.js → src-8rEOvFG5.js} +11 -15
- package/dist/{src-Dtv7TlJx.js → src-CdzAzdq-.js} +100 -114
- package/dist/{src-CLTURaoo.js → src-Cg49gGJb.js} +18 -44
- package/dist/{src-DWYoqPX1.cjs → src-CttkcdpE.cjs} +114 -133
- package/dist/{src-XjL5cyPG.cjs → src-D5KzIEH_.cjs} +130 -107
- package/dist/src-DB0Har0j.cjs +1632 -0
- package/dist/{src-CVdUqK3q.js → src-DWc-WWjX.js} +107 -86
- package/dist/{src-B7FG1rak.js → src-DvUBRBe3.js} +205 -116
- package/dist/{src-meUnCASg.cjs → src-TZx_e95f.cjs} +87 -132
- package/dist/{vars-BNVI6k89.d.ts → vars-DtzGL5Nc.d.cts} +1 -4
- package/dist/{vars-CptZRPX5.d.cts → vars-obKYxaSu.d.ts} +1 -4
- package/dist/vars.cjs +175 -138
- package/dist/vars.d.cts +3 -7
- package/dist/vars.d.ts +3 -7
- package/dist/vars.js +21 -9
- package/package.json +9 -8
- package/dist/EnvChannelOptions-BPkWDrmr.d.cts +0 -108
- package/dist/EnvChannelOptions-CRwDLWjd.d.ts +0 -108
- package/dist/coerce-DNIuYAx4.js +0 -11028
- package/dist/coerce-b7UVodS9.cjs +0 -12365
- package/dist/model-Dic8IJsf.d.ts +0 -29
- package/dist/model-ft0WhSSS.d.cts +0 -29
- package/dist/root.cjs +0 -36
- package/dist/root.d.cts +0 -21
- package/dist/root.d.ts +0 -21
- package/dist/root.js +0 -21
- package/dist/src-DZmpNGrQ.cjs +0 -1411
- package/dist/validate-BxA3a-ns.d.cts +0 -203
- package/dist/validate-CyxrRacF.d.ts +0 -203
- package/dist/vars-CYOaskkK.cjs +0 -27
- package/dist/vars-DOW0LiiN.js +0 -22
- /package/dist/{EnvChannel-LMIRYvT1.d.cts → EnvChannel-CfSwa_25.d.cts} +0 -0
- /package/dist/{EnvChannel-w27PEm7x.d.ts → EnvChannel-CfSwa_25.d.ts} +0 -0
package/dist/cli.cjs
CHANGED
|
@@ -1,24 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const
|
|
3
|
-
require(
|
|
4
|
-
require('./resolveChannel-CjAuxy3p.cjs');
|
|
5
|
-
const require_src = require('./src-DWYoqPX1.cjs');
|
|
6
|
-
require('./src-meUnCASg.cjs');
|
|
7
|
-
require('./coerce-b7UVodS9.cjs');
|
|
8
|
-
const require_src$2 = require('./src-XjL5cyPG.cjs');
|
|
2
|
+
const require_src = require("./src-D5KzIEH_.cjs");
|
|
3
|
+
const require_src$1 = require("./src-CttkcdpE.cjs");
|
|
9
4
|
let node_path = require("node:path");
|
|
10
|
-
node_path = require_chunk.__toESM(node_path);
|
|
11
5
|
let node_fs_promises = require("node:fs/promises");
|
|
12
|
-
node_fs_promises = require_chunk.__toESM(node_fs_promises);
|
|
13
|
-
let commander = require("commander");
|
|
14
|
-
commander = require_chunk.__toESM(commander);
|
|
15
6
|
let node_url = require("node:url");
|
|
16
|
-
node_url = require_chunk.__toESM(node_url);
|
|
17
7
|
let node_os = require("node:os");
|
|
18
|
-
|
|
8
|
+
let commander = require("commander");
|
|
19
9
|
let tsx_esm_api = require("tsx/esm/api");
|
|
20
|
-
tsx_esm_api = require_chunk.__toESM(tsx_esm_api);
|
|
21
|
-
|
|
22
10
|
//#region ../cli/src/index.ts
|
|
23
11
|
let tsxRegistered = false;
|
|
24
12
|
const DEFAULT_MODEL_BASENAME = "env.model";
|
|
@@ -31,7 +19,7 @@ const MODEL_EXTENSIONS = [
|
|
|
31
19
|
".mjs",
|
|
32
20
|
".cjs"
|
|
33
21
|
];
|
|
34
|
-
const IGNORED_DIRECTORIES = new Set([
|
|
22
|
+
const IGNORED_DIRECTORIES = /* @__PURE__ */ new Set([
|
|
35
23
|
"node_modules",
|
|
36
24
|
".git",
|
|
37
25
|
"dist",
|
|
@@ -90,7 +78,7 @@ function resolveModel(moduleExports, origin) {
|
|
|
90
78
|
moduleExports.model,
|
|
91
79
|
moduleExports.EnvModel
|
|
92
80
|
].concat(Object.values(moduleExports));
|
|
93
|
-
for (const candidate of candidates) if (candidate instanceof require_src
|
|
81
|
+
for (const candidate of candidates) if (candidate instanceof require_src.EnvModel) return candidate;
|
|
94
82
|
throw new Error(`Unable to locate an EnvModel export in ${origin}`);
|
|
95
83
|
}
|
|
96
84
|
function resolvePromptOptions(moduleExports, origin) {
|
|
@@ -101,7 +89,7 @@ function resolvePromptOptions(moduleExports, origin) {
|
|
|
101
89
|
];
|
|
102
90
|
for (const candidate of candidates) if (candidate && typeof candidate === "object") return candidate;
|
|
103
91
|
for (const value of Object.values(moduleExports)) {
|
|
104
|
-
if (value instanceof require_src
|
|
92
|
+
if (value instanceof require_src.EnvModel) continue;
|
|
105
93
|
if (value && typeof value === "object") return value;
|
|
106
94
|
}
|
|
107
95
|
throw new Error(`Unable to locate prompt configuration exports in ${origin}`);
|
|
@@ -111,11 +99,12 @@ async function handleSetupCommand(modelPathInput, configPathInput) {
|
|
|
111
99
|
if (!modelPath) throw new Error("Unable to locate an EnvModel file. Provide a path or create a file named \"env.model.*\".");
|
|
112
100
|
const model = resolveModel(await importUserModule(modelPath), modelPath);
|
|
113
101
|
if (!configPathInput) {
|
|
114
|
-
await require_src.prompt(model);
|
|
102
|
+
await require_src$1.prompt(model);
|
|
115
103
|
return;
|
|
116
104
|
}
|
|
117
105
|
const configPath = toAbsolutePath(configPathInput);
|
|
118
|
-
|
|
106
|
+
const options = resolvePromptOptions(await importUserModule(configPath), configPath);
|
|
107
|
+
await require_src$1.prompt(model, options);
|
|
119
108
|
}
|
|
120
109
|
async function run(argv = process.argv) {
|
|
121
110
|
const program = new commander.Command();
|
|
@@ -135,7 +124,6 @@ async function run(argv = process.argv) {
|
|
|
135
124
|
program.showSuggestionAfterError();
|
|
136
125
|
await program.parseAsync(argv);
|
|
137
126
|
}
|
|
138
|
-
|
|
139
127
|
//#endregion
|
|
140
128
|
//#region src/cli.ts
|
|
141
129
|
run(process.argv).catch((error) => {
|
|
@@ -143,5 +131,4 @@ run(process.argv).catch((error) => {
|
|
|
143
131
|
else console.error(error);
|
|
144
132
|
process.exit(1);
|
|
145
133
|
});
|
|
146
|
-
|
|
147
|
-
//#endregion
|
|
134
|
+
//#endregion
|
package/dist/cli.d.cts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {}
|
package/dist/cli.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {}
|
package/dist/cli.js
CHANGED
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import "./
|
|
3
|
-
import "./
|
|
4
|
-
import { t as prompt } from "./src-Dtv7TlJx.js";
|
|
5
|
-
import "./src-CLTURaoo.js";
|
|
6
|
-
import "./coerce-DNIuYAx4.js";
|
|
7
|
-
import { n as EnvModel } from "./src-CVdUqK3q.js";
|
|
2
|
+
import { n as EnvModel } from "./src-DWc-WWjX.js";
|
|
3
|
+
import { t as prompt } from "./src-CdzAzdq-.js";
|
|
8
4
|
import { isAbsolute, join, resolve } from "node:path";
|
|
9
5
|
import { readdir } from "node:fs/promises";
|
|
10
|
-
import { Command } from "commander";
|
|
11
6
|
import { pathToFileURL } from "node:url";
|
|
12
7
|
import { homedir } from "node:os";
|
|
8
|
+
import { Command } from "commander";
|
|
13
9
|
import { register } from "tsx/esm/api";
|
|
14
|
-
|
|
15
10
|
//#region ../cli/src/index.ts
|
|
16
11
|
let tsxRegistered = false;
|
|
17
12
|
const DEFAULT_MODEL_BASENAME = "env.model";
|
|
@@ -24,7 +19,7 @@ const MODEL_EXTENSIONS = [
|
|
|
24
19
|
".mjs",
|
|
25
20
|
".cjs"
|
|
26
21
|
];
|
|
27
|
-
const IGNORED_DIRECTORIES = new Set([
|
|
22
|
+
const IGNORED_DIRECTORIES = /* @__PURE__ */ new Set([
|
|
28
23
|
"node_modules",
|
|
29
24
|
".git",
|
|
30
25
|
"dist",
|
|
@@ -108,7 +103,8 @@ async function handleSetupCommand(modelPathInput, configPathInput) {
|
|
|
108
103
|
return;
|
|
109
104
|
}
|
|
110
105
|
const configPath = toAbsolutePath(configPathInput);
|
|
111
|
-
|
|
106
|
+
const options = resolvePromptOptions(await importUserModule(configPath), configPath);
|
|
107
|
+
await prompt(model, options);
|
|
112
108
|
}
|
|
113
109
|
async function run(argv = process.argv) {
|
|
114
110
|
const program = new Command();
|
|
@@ -128,7 +124,6 @@ async function run(argv = process.argv) {
|
|
|
128
124
|
program.showSuggestionAfterError();
|
|
129
125
|
await program.parseAsync(argv);
|
|
130
126
|
}
|
|
131
|
-
|
|
132
127
|
//#endregion
|
|
133
128
|
//#region src/cli.ts
|
|
134
129
|
run(process.argv).catch((error) => {
|
|
@@ -136,6 +131,5 @@ run(process.argv).catch((error) => {
|
|
|
136
131
|
else console.error(error);
|
|
137
132
|
process.exit(1);
|
|
138
133
|
});
|
|
139
|
-
|
|
140
134
|
//#endregion
|
|
141
|
-
export {
|
|
135
|
+
export {};
|
package/dist/core.cjs
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
3
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_src = require("./src-TZx_e95f.cjs");
|
|
3
|
+
const require_EnvVarSchema = require("./EnvVarSchema-CDZGmnex.cjs");
|
|
4
|
+
const require_custom = require("./custom-Dyb9TnER.cjs");
|
|
5
|
+
const require_schema = require("./schema-D9nJKipf.cjs");
|
|
4
6
|
//#region ../core/src/processing/checks/maxLength.ts
|
|
5
7
|
/**
|
|
6
8
|
* String check: maximum length.
|
|
7
9
|
*/
|
|
8
|
-
function maxLength(max
|
|
10
|
+
function maxLength(max, trait) {
|
|
9
11
|
return (value) => {
|
|
10
|
-
if (value.length > max
|
|
12
|
+
if (value.length > max) return trait ? [trait] : [`at most ${max} characters`];
|
|
11
13
|
return [];
|
|
12
14
|
};
|
|
13
15
|
}
|
|
14
|
-
|
|
15
16
|
//#endregion
|
|
16
17
|
//#region ../core/src/processing/checks/min.ts
|
|
17
18
|
/**
|
|
@@ -19,11 +20,10 @@ function maxLength(max$1, trait) {
|
|
|
19
20
|
*/
|
|
20
21
|
function min(minimum, trait) {
|
|
21
22
|
return (value) => {
|
|
22
|
-
if (value < minimum) return trait ? [trait] : [`at least ${minimum}`];
|
|
23
|
+
if (Number.isNaN(value) || value < minimum) return trait ? [trait] : [`at least ${minimum}`];
|
|
23
24
|
return [];
|
|
24
25
|
};
|
|
25
26
|
}
|
|
26
|
-
|
|
27
27
|
//#endregion
|
|
28
28
|
//#region ../core/src/processing/checks/max.ts
|
|
29
29
|
/**
|
|
@@ -31,11 +31,10 @@ function min(minimum, trait) {
|
|
|
31
31
|
*/
|
|
32
32
|
function max(maximum, trait) {
|
|
33
33
|
return (value) => {
|
|
34
|
-
if (value > maximum) return trait ? [trait] : [`at most ${maximum}`];
|
|
34
|
+
if (Number.isNaN(value) || value > maximum) return trait ? [trait] : [`at most ${maximum}`];
|
|
35
35
|
return [];
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
|
-
|
|
39
38
|
//#endregion
|
|
40
39
|
exports.BooleanEnvVarSchema = require_src.BooleanEnvVarSchema;
|
|
41
40
|
exports.EnumEnvVarSchema = require_src.EnumEnvVarSchema;
|
|
@@ -48,7 +47,7 @@ exports.custom = require_custom.custom;
|
|
|
48
47
|
exports.enumeration = require_src.enumeration;
|
|
49
48
|
exports.exactLength = require_custom.exactLength;
|
|
50
49
|
exports.integer = require_custom.integer;
|
|
51
|
-
exports.isEnvVarSchema =
|
|
50
|
+
exports.isEnvVarSchema = require_EnvVarSchema.isEnvVarSchema;
|
|
52
51
|
exports.lengthBetween = require_custom.lengthBetween;
|
|
53
52
|
exports.max = max;
|
|
54
53
|
exports.maxLength = maxLength;
|
|
@@ -60,9 +59,9 @@ exports.pattern = require_custom.pattern;
|
|
|
60
59
|
exports.preprocessors = require_src.preprocessors;
|
|
61
60
|
exports.processors = require_src.processors;
|
|
62
61
|
exports.resolvePreprocessor = require_src.resolvePreprocessor;
|
|
63
|
-
exports.s =
|
|
64
|
-
exports.schema =
|
|
62
|
+
exports.s = require_schema.s;
|
|
63
|
+
exports.schema = require_schema.schema;
|
|
65
64
|
exports.string = require_src.string;
|
|
66
65
|
exports.toList = require_src.toList;
|
|
67
66
|
exports.url = require_custom.url;
|
|
68
|
-
exports.validate = require_src.validate;
|
|
67
|
+
exports.validate = require_src.validate;
|
package/dist/core.d.cts
CHANGED
|
@@ -1,6 +1,147 @@
|
|
|
1
|
-
import { a as EnumEnvVarSchema, c as BooleanEnvVarSchemaInput, d as EnvVarType, f as Processor, i as NumberEnvVarSchemaInput, l as EnvVarSchemaBase, n as StringEnvVarSchemaInput, o as EnumEnvVarSchemaInput, r as NumberEnvVarSchema, s as BooleanEnvVarSchema, t as StringEnvVarSchema, u as EnvVarSchemaInput } from "./StringEnvVarSchema-
|
|
2
|
-
import {
|
|
3
|
-
import { a as
|
|
4
|
-
import { t as EnvChannel } from "./EnvChannel-
|
|
5
|
-
import { n as schema, t as s } from "./schema-
|
|
6
|
-
|
|
1
|
+
import { a as EnumEnvVarSchema, c as BooleanEnvVarSchemaInput, d as EnvVarType, f as Processor, i as NumberEnvVarSchemaInput, l as EnvVarSchemaBase, n as StringEnvVarSchemaInput, o as EnumEnvVarSchemaInput, r as NumberEnvVarSchema, s as BooleanEnvVarSchema, t as StringEnvVarSchema, u as EnvVarSchemaInput } from "./StringEnvVarSchema-D9Jr1Aws.cjs";
|
|
2
|
+
import { a as isEnvVarSchema, i as EnvVarSchema, n as Preprocessor, r as PreprocessorToggle, t as BooleanMap } from "./BooleanMap-CX_YrPCf.cjs";
|
|
3
|
+
import { a as number, i as boolean, n as processors, o as string, r as enumeration, s as Check, t as preprocessors } from "./preprocessors-DFVyF0c7.cjs";
|
|
4
|
+
import { t as EnvChannel } from "./EnvChannel-CfSwa_25.cjs";
|
|
5
|
+
import { n as schema, t as s } from "./schema-B1i83alz.cjs";
|
|
6
|
+
//#region ../core/src/schemas/EnvVarSchemaDetails.d.ts
|
|
7
|
+
interface EnvVarSchemaDetails<T> {
|
|
8
|
+
type: EnvVarType;
|
|
9
|
+
required: boolean;
|
|
10
|
+
default?: T;
|
|
11
|
+
description?: string;
|
|
12
|
+
link?: string;
|
|
13
|
+
process?: Processor<T>;
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region ../core/src/processing/options/PreprocessorOptions.d.ts
|
|
17
|
+
type PreprocessorOptions = Partial<{
|
|
18
|
+
/**
|
|
19
|
+
* Custom string preprocessing function
|
|
20
|
+
* Receives the string value and should return a string value
|
|
21
|
+
* @param value - The raw string value from the environment variable
|
|
22
|
+
* @returns Preprocessed string value
|
|
23
|
+
*/
|
|
24
|
+
string?: Preprocessor<string> | boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Custom number preprocessing function
|
|
27
|
+
* Receives the string value and should return a string or the target number type
|
|
28
|
+
* @param value - The raw string value from the environment variable
|
|
29
|
+
* @returns Preprocessed string or number value
|
|
30
|
+
*/
|
|
31
|
+
number?: Preprocessor<number> | boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Custom boolean preprocessing function
|
|
34
|
+
* Receives the string value and should return a string or the target boolean type
|
|
35
|
+
* @param value - The raw string value from the environment variable
|
|
36
|
+
* @returns Preprocessed string or boolean value
|
|
37
|
+
*/
|
|
38
|
+
boolean?: boolean | Preprocessor<boolean> | BooleanMap;
|
|
39
|
+
/**
|
|
40
|
+
* Custom enum preprocessing function
|
|
41
|
+
* Receives the string value and should return a string value
|
|
42
|
+
* @param value - The raw string value from the environment variable
|
|
43
|
+
* @returns Preprocessed string value
|
|
44
|
+
*/
|
|
45
|
+
enum?: Preprocessor<string> | boolean;
|
|
46
|
+
}>;
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region ../core/src/processing/preprocessors/resolvePreprocessor.d.ts
|
|
49
|
+
type DefaultPreprocessor<T extends EnvVarType> = T extends "number" ? Preprocessor<number> : T extends "boolean" ? Preprocessor<boolean> : Preprocessor<string>;
|
|
50
|
+
/**
|
|
51
|
+
* Resolve the effective preprocessor for a given environment variable type.
|
|
52
|
+
* Respects custom overrides and falls back to built-in defaults (number, boolean).
|
|
53
|
+
*/
|
|
54
|
+
declare function resolvePreprocessor<T extends EnvVarType>(envVarType: T, preprocessorOptions?: PreprocessorOptions): DefaultPreprocessor<T> | undefined;
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region ../core/src/processing/checks/minLength.d.ts
|
|
57
|
+
/**
|
|
58
|
+
* String check: minimum length.
|
|
59
|
+
*/
|
|
60
|
+
declare function minLength(min: number, trait?: string): Check<string>;
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region ../core/src/processing/checks/maxLength.d.ts
|
|
63
|
+
/**
|
|
64
|
+
* String check: maximum length.
|
|
65
|
+
*/
|
|
66
|
+
declare function maxLength(max: number, trait?: string): Check<string>;
|
|
67
|
+
//#endregion
|
|
68
|
+
//#region ../core/src/processing/checks/lengthBetween.d.ts
|
|
69
|
+
/**
|
|
70
|
+
* String check: length within a range.
|
|
71
|
+
*/
|
|
72
|
+
declare function lengthBetween(min: number, max: number, trait?: string): Check<string>;
|
|
73
|
+
//#endregion
|
|
74
|
+
//#region ../core/src/processing/checks/exactLength.d.ts
|
|
75
|
+
/**
|
|
76
|
+
* String check: exact length.
|
|
77
|
+
*/
|
|
78
|
+
declare function exactLength(length: number, trait?: string): Check<string>;
|
|
79
|
+
//#endregion
|
|
80
|
+
//#region ../core/src/processing/checks/pattern.d.ts
|
|
81
|
+
/**
|
|
82
|
+
* String check: regex pattern match.
|
|
83
|
+
*/
|
|
84
|
+
declare function pattern(regex: RegExp, trait: string | readonly string[]): Check<string>;
|
|
85
|
+
//#endregion
|
|
86
|
+
//#region ../core/src/processing/checks/url.d.ts
|
|
87
|
+
/**
|
|
88
|
+
* String check: valid URL.
|
|
89
|
+
*/
|
|
90
|
+
declare function url(trait?: string): Check<string>;
|
|
91
|
+
//#endregion
|
|
92
|
+
//#region ../core/src/processing/checks/oneOf.d.ts
|
|
93
|
+
/**
|
|
94
|
+
* String check: value must be one of the provided values.
|
|
95
|
+
*/
|
|
96
|
+
declare function oneOf<T extends string>(values: readonly T[], trait?: string): Check<string>;
|
|
97
|
+
//#endregion
|
|
98
|
+
//#region ../core/src/processing/checks/integer.d.ts
|
|
99
|
+
/**
|
|
100
|
+
* Number check: must be an integer.
|
|
101
|
+
*/
|
|
102
|
+
declare function integer(trait?: string): Check<number>;
|
|
103
|
+
//#endregion
|
|
104
|
+
//#region ../core/src/processing/checks/min.d.ts
|
|
105
|
+
/**
|
|
106
|
+
* Number check: minimum value.
|
|
107
|
+
*/
|
|
108
|
+
declare function min(minimum: number, trait?: string): Check<number>;
|
|
109
|
+
//#endregion
|
|
110
|
+
//#region ../core/src/processing/checks/max.d.ts
|
|
111
|
+
/**
|
|
112
|
+
* Number check: maximum value.
|
|
113
|
+
*/
|
|
114
|
+
declare function max(maximum: number, trait?: string): Check<number>;
|
|
115
|
+
//#endregion
|
|
116
|
+
//#region ../core/src/processing/checks/between.d.ts
|
|
117
|
+
/**
|
|
118
|
+
* Number check: value within a range.
|
|
119
|
+
*/
|
|
120
|
+
declare function between(minimum: number, maximum: number, trait?: string): Check<number>;
|
|
121
|
+
//#endregion
|
|
122
|
+
//#region ../core/src/processing/checks/custom.d.ts
|
|
123
|
+
/**
|
|
124
|
+
* Custom check with user-defined validation function.
|
|
125
|
+
* Can return multiple traits.
|
|
126
|
+
*/
|
|
127
|
+
declare function custom<T>(fn: (value: T) => boolean, ...traits: string[]): Check<T>;
|
|
128
|
+
//#endregion
|
|
129
|
+
//#region ../core/src/processing/helpers/toList.d.ts
|
|
130
|
+
/**
|
|
131
|
+
* Convert array of items to natural language list.
|
|
132
|
+
* Examples:
|
|
133
|
+
* - [] => ""
|
|
134
|
+
* - ["one"] => "one"
|
|
135
|
+
* - ["one", "two"] => "one and two"
|
|
136
|
+
* - ["one", "two", "three"] => "one, two, and three"
|
|
137
|
+
*/
|
|
138
|
+
declare function toList(items: string[]): string;
|
|
139
|
+
//#endregion
|
|
140
|
+
//#region ../core/src/processing/helpers/validate.d.ts
|
|
141
|
+
/**
|
|
142
|
+
* Run checks and aggregate errors.
|
|
143
|
+
* Throws an error with all validation requirements if any check fails.
|
|
144
|
+
*/
|
|
145
|
+
declare function validate<T>(value: T, checks: Array<Check<T>>): T;
|
|
146
|
+
//#endregion
|
|
147
|
+
export { BooleanEnvVarSchema, BooleanEnvVarSchemaInput, BooleanMap, type BooleanMap as BooleanPreprocessorOptions, type Check, EnumEnvVarSchema, EnumEnvVarSchemaInput, EnvChannel, type EnvVarSchema, EnvVarSchemaBase, EnvVarSchemaDetails, EnvVarSchemaInput, EnvVarType, NumberEnvVarSchema, NumberEnvVarSchemaInput, Preprocessor, PreprocessorToggle, type PreprocessorOptions as Preprocessors, Processor, StringEnvVarSchema, StringEnvVarSchemaInput, between, boolean, custom, enumeration, exactLength, integer, isEnvVarSchema, lengthBetween, max, maxLength, min, minLength, number, oneOf, pattern, preprocessors, processors, resolvePreprocessor, s, schema, string, toList, url, validate };
|
package/dist/core.d.ts
CHANGED
|
@@ -1,6 +1,147 @@
|
|
|
1
|
-
import { a as EnumEnvVarSchema, c as BooleanEnvVarSchemaInput, d as EnvVarType, f as Processor, i as NumberEnvVarSchemaInput, l as EnvVarSchemaBase, n as StringEnvVarSchemaInput, o as EnumEnvVarSchemaInput, r as NumberEnvVarSchema, s as BooleanEnvVarSchema, t as StringEnvVarSchema, u as EnvVarSchemaInput } from "./StringEnvVarSchema-
|
|
2
|
-
import {
|
|
3
|
-
import { a as
|
|
4
|
-
import { t as EnvChannel } from "./EnvChannel-
|
|
5
|
-
import { n as schema, t as s } from "./schema-
|
|
6
|
-
|
|
1
|
+
import { a as EnumEnvVarSchema, c as BooleanEnvVarSchemaInput, d as EnvVarType, f as Processor, i as NumberEnvVarSchemaInput, l as EnvVarSchemaBase, n as StringEnvVarSchemaInput, o as EnumEnvVarSchemaInput, r as NumberEnvVarSchema, s as BooleanEnvVarSchema, t as StringEnvVarSchema, u as EnvVarSchemaInput } from "./StringEnvVarSchema-D9Jr1Aws.js";
|
|
2
|
+
import { a as isEnvVarSchema, i as EnvVarSchema, n as Preprocessor, r as PreprocessorToggle, t as BooleanMap } from "./BooleanMap-BPQuO3Ae.js";
|
|
3
|
+
import { a as number, i as boolean, n as processors, o as string, r as enumeration, s as Check, t as preprocessors } from "./preprocessors-BKuIcZa1.js";
|
|
4
|
+
import { t as EnvChannel } from "./EnvChannel-CfSwa_25.js";
|
|
5
|
+
import { n as schema, t as s } from "./schema-B-JLVS42.js";
|
|
6
|
+
//#region ../core/src/schemas/EnvVarSchemaDetails.d.ts
|
|
7
|
+
interface EnvVarSchemaDetails<T> {
|
|
8
|
+
type: EnvVarType;
|
|
9
|
+
required: boolean;
|
|
10
|
+
default?: T;
|
|
11
|
+
description?: string;
|
|
12
|
+
link?: string;
|
|
13
|
+
process?: Processor<T>;
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region ../core/src/processing/options/PreprocessorOptions.d.ts
|
|
17
|
+
type PreprocessorOptions = Partial<{
|
|
18
|
+
/**
|
|
19
|
+
* Custom string preprocessing function
|
|
20
|
+
* Receives the string value and should return a string value
|
|
21
|
+
* @param value - The raw string value from the environment variable
|
|
22
|
+
* @returns Preprocessed string value
|
|
23
|
+
*/
|
|
24
|
+
string?: Preprocessor<string> | boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Custom number preprocessing function
|
|
27
|
+
* Receives the string value and should return a string or the target number type
|
|
28
|
+
* @param value - The raw string value from the environment variable
|
|
29
|
+
* @returns Preprocessed string or number value
|
|
30
|
+
*/
|
|
31
|
+
number?: Preprocessor<number> | boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Custom boolean preprocessing function
|
|
34
|
+
* Receives the string value and should return a string or the target boolean type
|
|
35
|
+
* @param value - The raw string value from the environment variable
|
|
36
|
+
* @returns Preprocessed string or boolean value
|
|
37
|
+
*/
|
|
38
|
+
boolean?: boolean | Preprocessor<boolean> | BooleanMap;
|
|
39
|
+
/**
|
|
40
|
+
* Custom enum preprocessing function
|
|
41
|
+
* Receives the string value and should return a string value
|
|
42
|
+
* @param value - The raw string value from the environment variable
|
|
43
|
+
* @returns Preprocessed string value
|
|
44
|
+
*/
|
|
45
|
+
enum?: Preprocessor<string> | boolean;
|
|
46
|
+
}>;
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region ../core/src/processing/preprocessors/resolvePreprocessor.d.ts
|
|
49
|
+
type DefaultPreprocessor<T extends EnvVarType> = T extends "number" ? Preprocessor<number> : T extends "boolean" ? Preprocessor<boolean> : Preprocessor<string>;
|
|
50
|
+
/**
|
|
51
|
+
* Resolve the effective preprocessor for a given environment variable type.
|
|
52
|
+
* Respects custom overrides and falls back to built-in defaults (number, boolean).
|
|
53
|
+
*/
|
|
54
|
+
declare function resolvePreprocessor<T extends EnvVarType>(envVarType: T, preprocessorOptions?: PreprocessorOptions): DefaultPreprocessor<T> | undefined;
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region ../core/src/processing/checks/minLength.d.ts
|
|
57
|
+
/**
|
|
58
|
+
* String check: minimum length.
|
|
59
|
+
*/
|
|
60
|
+
declare function minLength(min: number, trait?: string): Check<string>;
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region ../core/src/processing/checks/maxLength.d.ts
|
|
63
|
+
/**
|
|
64
|
+
* String check: maximum length.
|
|
65
|
+
*/
|
|
66
|
+
declare function maxLength(max: number, trait?: string): Check<string>;
|
|
67
|
+
//#endregion
|
|
68
|
+
//#region ../core/src/processing/checks/lengthBetween.d.ts
|
|
69
|
+
/**
|
|
70
|
+
* String check: length within a range.
|
|
71
|
+
*/
|
|
72
|
+
declare function lengthBetween(min: number, max: number, trait?: string): Check<string>;
|
|
73
|
+
//#endregion
|
|
74
|
+
//#region ../core/src/processing/checks/exactLength.d.ts
|
|
75
|
+
/**
|
|
76
|
+
* String check: exact length.
|
|
77
|
+
*/
|
|
78
|
+
declare function exactLength(length: number, trait?: string): Check<string>;
|
|
79
|
+
//#endregion
|
|
80
|
+
//#region ../core/src/processing/checks/pattern.d.ts
|
|
81
|
+
/**
|
|
82
|
+
* String check: regex pattern match.
|
|
83
|
+
*/
|
|
84
|
+
declare function pattern(regex: RegExp, trait: string | readonly string[]): Check<string>;
|
|
85
|
+
//#endregion
|
|
86
|
+
//#region ../core/src/processing/checks/url.d.ts
|
|
87
|
+
/**
|
|
88
|
+
* String check: valid URL.
|
|
89
|
+
*/
|
|
90
|
+
declare function url(trait?: string): Check<string>;
|
|
91
|
+
//#endregion
|
|
92
|
+
//#region ../core/src/processing/checks/oneOf.d.ts
|
|
93
|
+
/**
|
|
94
|
+
* String check: value must be one of the provided values.
|
|
95
|
+
*/
|
|
96
|
+
declare function oneOf<T extends string>(values: readonly T[], trait?: string): Check<string>;
|
|
97
|
+
//#endregion
|
|
98
|
+
//#region ../core/src/processing/checks/integer.d.ts
|
|
99
|
+
/**
|
|
100
|
+
* Number check: must be an integer.
|
|
101
|
+
*/
|
|
102
|
+
declare function integer(trait?: string): Check<number>;
|
|
103
|
+
//#endregion
|
|
104
|
+
//#region ../core/src/processing/checks/min.d.ts
|
|
105
|
+
/**
|
|
106
|
+
* Number check: minimum value.
|
|
107
|
+
*/
|
|
108
|
+
declare function min(minimum: number, trait?: string): Check<number>;
|
|
109
|
+
//#endregion
|
|
110
|
+
//#region ../core/src/processing/checks/max.d.ts
|
|
111
|
+
/**
|
|
112
|
+
* Number check: maximum value.
|
|
113
|
+
*/
|
|
114
|
+
declare function max(maximum: number, trait?: string): Check<number>;
|
|
115
|
+
//#endregion
|
|
116
|
+
//#region ../core/src/processing/checks/between.d.ts
|
|
117
|
+
/**
|
|
118
|
+
* Number check: value within a range.
|
|
119
|
+
*/
|
|
120
|
+
declare function between(minimum: number, maximum: number, trait?: string): Check<number>;
|
|
121
|
+
//#endregion
|
|
122
|
+
//#region ../core/src/processing/checks/custom.d.ts
|
|
123
|
+
/**
|
|
124
|
+
* Custom check with user-defined validation function.
|
|
125
|
+
* Can return multiple traits.
|
|
126
|
+
*/
|
|
127
|
+
declare function custom<T>(fn: (value: T) => boolean, ...traits: string[]): Check<T>;
|
|
128
|
+
//#endregion
|
|
129
|
+
//#region ../core/src/processing/helpers/toList.d.ts
|
|
130
|
+
/**
|
|
131
|
+
* Convert array of items to natural language list.
|
|
132
|
+
* Examples:
|
|
133
|
+
* - [] => ""
|
|
134
|
+
* - ["one"] => "one"
|
|
135
|
+
* - ["one", "two"] => "one and two"
|
|
136
|
+
* - ["one", "two", "three"] => "one, two, and three"
|
|
137
|
+
*/
|
|
138
|
+
declare function toList(items: string[]): string;
|
|
139
|
+
//#endregion
|
|
140
|
+
//#region ../core/src/processing/helpers/validate.d.ts
|
|
141
|
+
/**
|
|
142
|
+
* Run checks and aggregate errors.
|
|
143
|
+
* Throws an error with all validation requirements if any check fails.
|
|
144
|
+
*/
|
|
145
|
+
declare function validate<T>(value: T, checks: Array<Check<T>>): T;
|
|
146
|
+
//#endregion
|
|
147
|
+
export { BooleanEnvVarSchema, BooleanEnvVarSchemaInput, BooleanMap, type BooleanMap as BooleanPreprocessorOptions, type Check, EnumEnvVarSchema, EnumEnvVarSchemaInput, EnvChannel, type EnvVarSchema, EnvVarSchemaBase, EnvVarSchemaDetails, EnvVarSchemaInput, EnvVarType, NumberEnvVarSchema, NumberEnvVarSchemaInput, Preprocessor, PreprocessorToggle, type PreprocessorOptions as Preprocessors, Processor, StringEnvVarSchema, StringEnvVarSchemaInput, between, boolean, custom, enumeration, exactLength, integer, isEnvVarSchema, lengthBetween, max, maxLength, min, minLength, number, oneOf, pattern, preprocessors, processors, resolvePreprocessor, s, schema, string, toList, url, validate };
|
package/dist/core.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { a as EnumEnvVarSchema, c as enumeration, d as string, f as validate, i as NumberEnvVarSchema, l as boolean, m as EnvVarSchemaBase, n as preprocessors, o as BooleanEnvVarSchema, p as toList, r as StringEnvVarSchema, s as processors, t as resolvePreprocessor, u as number } from "./src-Cg49gGJb.js";
|
|
2
|
+
import { t as isEnvVarSchema } from "./EnvVarSchema-Dr6q7jf6.js";
|
|
3
|
+
import { a as url, c as lengthBetween, i as oneOf, l as minLength, n as between, o as pattern, r as integer, s as exactLength, t as custom } from "./custom-Bd-jLg80.js";
|
|
4
|
+
import { n as schema, t as s } from "./schema-CtP5lpU1.js";
|
|
4
5
|
//#region ../core/src/processing/checks/maxLength.ts
|
|
5
6
|
/**
|
|
6
7
|
* String check: maximum length.
|
|
7
8
|
*/
|
|
8
|
-
function maxLength(max
|
|
9
|
+
function maxLength(max, trait) {
|
|
9
10
|
return (value) => {
|
|
10
|
-
if (value.length > max
|
|
11
|
+
if (value.length > max) return trait ? [trait] : [`at most ${max} characters`];
|
|
11
12
|
return [];
|
|
12
13
|
};
|
|
13
14
|
}
|
|
14
|
-
|
|
15
15
|
//#endregion
|
|
16
16
|
//#region ../core/src/processing/checks/min.ts
|
|
17
17
|
/**
|
|
@@ -19,11 +19,10 @@ function maxLength(max$1, trait) {
|
|
|
19
19
|
*/
|
|
20
20
|
function min(minimum, trait) {
|
|
21
21
|
return (value) => {
|
|
22
|
-
if (value < minimum) return trait ? [trait] : [`at least ${minimum}`];
|
|
22
|
+
if (Number.isNaN(value) || value < minimum) return trait ? [trait] : [`at least ${minimum}`];
|
|
23
23
|
return [];
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
-
|
|
27
26
|
//#endregion
|
|
28
27
|
//#region ../core/src/processing/checks/max.ts
|
|
29
28
|
/**
|
|
@@ -31,10 +30,9 @@ function min(minimum, trait) {
|
|
|
31
30
|
*/
|
|
32
31
|
function max(maximum, trait) {
|
|
33
32
|
return (value) => {
|
|
34
|
-
if (value > maximum) return trait ? [trait] : [`at most ${maximum}`];
|
|
33
|
+
if (Number.isNaN(value) || value > maximum) return trait ? [trait] : [`at most ${maximum}`];
|
|
35
34
|
return [];
|
|
36
35
|
};
|
|
37
36
|
}
|
|
38
|
-
|
|
39
37
|
//#endregion
|
|
40
|
-
export { BooleanEnvVarSchema, EnumEnvVarSchema, EnvVarSchemaBase, NumberEnvVarSchema, StringEnvVarSchema, between, boolean, custom, enumeration, exactLength, integer, isEnvVarSchema, lengthBetween, max, maxLength, min, minLength, number, oneOf, pattern, preprocessors, processors, resolvePreprocessor, s, schema, string, toList, url, validate };
|
|
38
|
+
export { BooleanEnvVarSchema, EnumEnvVarSchema, EnvVarSchemaBase, NumberEnvVarSchema, StringEnvVarSchema, between, boolean, custom, enumeration, exactLength, integer, isEnvVarSchema, lengthBetween, max, maxLength, min, minLength, number, oneOf, pattern, preprocessors, processors, resolvePreprocessor, s, schema, string, toList, url, validate };
|
|
@@ -8,7 +8,6 @@ function minLength(min, trait) {
|
|
|
8
8
|
return [];
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
|
-
|
|
12
11
|
//#endregion
|
|
13
12
|
//#region ../core/src/processing/checks/lengthBetween.ts
|
|
14
13
|
/**
|
|
@@ -20,7 +19,6 @@ function lengthBetween(min, max, trait) {
|
|
|
20
19
|
return [];
|
|
21
20
|
};
|
|
22
21
|
}
|
|
23
|
-
|
|
24
22
|
//#endregion
|
|
25
23
|
//#region ../core/src/processing/checks/exactLength.ts
|
|
26
24
|
/**
|
|
@@ -32,7 +30,6 @@ function exactLength(length, trait) {
|
|
|
32
30
|
return [];
|
|
33
31
|
};
|
|
34
32
|
}
|
|
35
|
-
|
|
36
33
|
//#endregion
|
|
37
34
|
//#region ../core/src/processing/checks/pattern.ts
|
|
38
35
|
/**
|
|
@@ -44,7 +41,6 @@ function pattern(regex, trait) {
|
|
|
44
41
|
return [];
|
|
45
42
|
};
|
|
46
43
|
}
|
|
47
|
-
|
|
48
44
|
//#endregion
|
|
49
45
|
//#region ../core/src/processing/checks/url.ts
|
|
50
46
|
/**
|
|
@@ -60,7 +56,6 @@ function url(trait) {
|
|
|
60
56
|
}
|
|
61
57
|
};
|
|
62
58
|
}
|
|
63
|
-
|
|
64
59
|
//#endregion
|
|
65
60
|
//#region ../core/src/processing/checks/oneOf.ts
|
|
66
61
|
/**
|
|
@@ -72,7 +67,6 @@ function oneOf(values, trait) {
|
|
|
72
67
|
return [];
|
|
73
68
|
};
|
|
74
69
|
}
|
|
75
|
-
|
|
76
70
|
//#endregion
|
|
77
71
|
//#region ../core/src/processing/checks/integer.ts
|
|
78
72
|
/**
|
|
@@ -84,7 +78,6 @@ function integer(trait) {
|
|
|
84
78
|
return [];
|
|
85
79
|
};
|
|
86
80
|
}
|
|
87
|
-
|
|
88
81
|
//#endregion
|
|
89
82
|
//#region ../core/src/processing/checks/between.ts
|
|
90
83
|
/**
|
|
@@ -92,11 +85,10 @@ function integer(trait) {
|
|
|
92
85
|
*/
|
|
93
86
|
function between(minimum, maximum, trait) {
|
|
94
87
|
return (value) => {
|
|
95
|
-
if (value < minimum || value > maximum) return trait ? [trait] : [`between ${minimum} and ${maximum}`];
|
|
88
|
+
if (Number.isNaN(value) || value < minimum || value > maximum) return trait ? [trait] : [`between ${minimum} and ${maximum}`];
|
|
96
89
|
return [];
|
|
97
90
|
};
|
|
98
91
|
}
|
|
99
|
-
|
|
100
92
|
//#endregion
|
|
101
93
|
//#region ../core/src/processing/checks/custom.ts
|
|
102
94
|
/**
|
|
@@ -105,10 +97,9 @@ function between(minimum, maximum, trait) {
|
|
|
105
97
|
*/
|
|
106
98
|
function custom(fn, ...traits) {
|
|
107
99
|
return (value) => {
|
|
108
|
-
if (!fn(value)) return traits;
|
|
100
|
+
if (!fn(value)) return traits.length > 0 ? [...traits] : ["a valid value"];
|
|
109
101
|
return [];
|
|
110
102
|
};
|
|
111
103
|
}
|
|
112
|
-
|
|
113
104
|
//#endregion
|
|
114
|
-
export { url as a, lengthBetween as c, oneOf as i, minLength as l, between as n, pattern as o, integer as r, exactLength as s, custom as t };
|
|
105
|
+
export { url as a, lengthBetween as c, oneOf as i, minLength as l, between as n, pattern as o, integer as r, exactLength as s, custom as t };
|