@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.
- package/README.md +103 -42
- package/dist/cli/commands/assert.d.ts +3 -4
- package/dist/cli/commands/assert.d.ts.map +1 -1
- package/dist/cli/commands/explain.d.ts +2 -3
- package/dist/cli/commands/explain.d.ts.map +1 -1
- package/dist/cli/commands/export.d.ts +4 -3
- package/dist/cli/commands/export.d.ts.map +1 -1
- package/dist/cli/commands/export.js +46 -0
- package/dist/cli/commands/generate.d.ts +2 -2
- package/dist/cli/commands/generate.d.ts.map +1 -1
- package/dist/cli/commands/infer.d.ts +15 -0
- package/dist/cli/commands/infer.d.ts.map +1 -0
- package/dist/cli/commands/infer.js +86 -0
- package/dist/cli/commands/init.d.ts +15 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +30 -0
- package/dist/cli/commands/program.d.ts +4 -0
- package/dist/cli/commands/program.d.ts.map +1 -0
- package/dist/cli/commands/program.js +1 -0
- package/dist/cli/index.js +74 -30
- package/dist/cli/utils/infer-schema.d.ts +2 -2
- package/dist/cli/utils/infer-schema.d.ts.map +1 -1
- package/dist/cli/utils/infer-schema.js +20 -22
- package/dist/cli/utils/printer.d.ts +2 -0
- package/dist/cli/utils/printer.d.ts.map +1 -1
- package/dist/cli/utils/printer.js +104 -1
- package/dist/core.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/infer/__tests__/port-vs-version.test.d.ts +2 -0
- package/dist/infer/__tests__/port-vs-version.test.d.ts.map +1 -0
- package/dist/infer/__tests__/port-vs-version.test.js +32 -0
- package/dist/infer/__tests__/rules/basic.test.d.ts +2 -0
- package/dist/infer/__tests__/rules/basic.test.d.ts.map +1 -0
- package/dist/infer/__tests__/rules/basic.test.js +85 -0
- package/dist/infer/__tests__/rules/boolean.test.d.ts +2 -0
- package/dist/infer/__tests__/rules/boolean.test.d.ts.map +1 -0
- package/dist/infer/__tests__/rules/boolean.test.js +34 -0
- package/dist/infer/__tests__/rules/duration.test.d.ts +2 -0
- package/dist/infer/__tests__/rules/duration.test.d.ts.map +1 -0
- package/dist/infer/__tests__/rules/duration.test.js +24 -0
- package/dist/infer/__tests__/rules/ip.test.d.ts +2 -0
- package/dist/infer/__tests__/rules/ip.test.d.ts.map +1 -0
- package/dist/infer/__tests__/rules/ip.test.js +24 -0
- package/dist/infer/__tests__/rules/json.test.d.ts +2 -0
- package/dist/infer/__tests__/rules/json.test.d.ts.map +1 -0
- package/dist/infer/__tests__/rules/json.test.js +38 -0
- package/dist/infer/__tests__/rules/list.test.d.ts +2 -0
- package/dist/infer/__tests__/rules/list.test.d.ts.map +1 -0
- package/dist/infer/__tests__/rules/list.test.js +130 -0
- package/dist/infer/__tests__/rules/port.test.d.ts +2 -0
- package/dist/infer/__tests__/rules/port.test.d.ts.map +1 -0
- package/dist/infer/__tests__/rules/port.test.js +24 -0
- package/dist/infer/__tests__/rules/url.test.d.ts +2 -0
- package/dist/infer/__tests__/rules/url.test.d.ts.map +1 -0
- package/dist/infer/__tests__/rules/url.test.js +39 -0
- package/dist/infer/__tests__/rules/version.test.d.ts +2 -0
- package/dist/infer/__tests__/rules/version.test.d.ts.map +1 -0
- package/dist/infer/__tests__/rules/version.test.js +37 -0
- package/dist/infer/generated/basic.d.ts +8 -0
- package/dist/infer/generated/basic.d.ts.map +1 -0
- package/dist/infer/generated/basic.js +24 -0
- package/dist/infer/generated/boolean.d.ts +3 -0
- package/dist/infer/generated/boolean.d.ts.map +1 -0
- package/dist/infer/generated/boolean.js +9 -0
- package/dist/infer/generated/duration.d.ts +3 -0
- package/dist/infer/generated/duration.d.ts.map +1 -0
- package/dist/infer/generated/duration.js +9 -0
- package/dist/infer/generated/ip.d.ts +3 -0
- package/dist/infer/generated/ip.d.ts.map +1 -0
- package/dist/infer/generated/ip.js +9 -0
- package/dist/infer/generated/json.d.ts +4 -0
- package/dist/infer/generated/json.d.ts.map +1 -0
- package/dist/infer/generated/json.js +10 -0
- package/dist/infer/generated/list.d.ts +8 -0
- package/dist/infer/generated/list.d.ts.map +1 -0
- package/dist/infer/generated/list.js +49 -0
- package/dist/infer/generated/port.d.ts +4 -0
- package/dist/infer/generated/port.d.ts.map +1 -0
- package/dist/infer/generated/port.js +10 -0
- package/dist/infer/generated/url.d.ts +14 -0
- package/dist/infer/generated/url.d.ts.map +1 -0
- package/dist/infer/generated/url.js +30 -0
- package/dist/infer/generated/version.d.ts +4 -0
- package/dist/infer/generated/version.d.ts.map +1 -0
- package/dist/infer/generated/version.js +10 -0
- package/dist/infer/helpers.d.ts +11 -0
- package/dist/infer/helpers.d.ts.map +1 -0
- package/dist/infer/helpers.js +41 -0
- package/dist/infer/index.d.ts +4 -0
- package/dist/infer/index.d.ts.map +1 -0
- package/dist/infer/index.js +35 -0
- package/dist/infer/rules/basic.d.ts +11 -0
- package/dist/infer/rules/basic.d.ts.map +1 -0
- package/dist/infer/rules/basic.js +90 -0
- package/dist/infer/rules/boolean.d.ts +3 -0
- package/dist/infer/rules/boolean.d.ts.map +1 -0
- package/dist/infer/rules/boolean.js +25 -0
- package/dist/infer/rules/duration.d.ts +3 -0
- package/dist/infer/rules/duration.d.ts.map +1 -0
- package/dist/infer/rules/duration.js +25 -0
- package/dist/infer/rules/ip.d.ts +3 -0
- package/dist/infer/rules/ip.d.ts.map +1 -0
- package/dist/infer/rules/ip.js +25 -0
- package/dist/infer/rules/json.d.ts +3 -0
- package/dist/infer/rules/json.d.ts.map +1 -0
- package/dist/infer/rules/json.js +59 -0
- package/dist/infer/rules/list.d.ts +12 -0
- package/dist/infer/rules/list.d.ts.map +1 -0
- package/dist/infer/rules/list.js +221 -0
- package/dist/infer/rules/port.d.ts +3 -0
- package/dist/infer/rules/port.d.ts.map +1 -0
- package/dist/infer/rules/port.js +30 -0
- package/dist/infer/rules/url.d.ts +4 -0
- package/dist/infer/rules/url.d.ts.map +1 -0
- package/dist/infer/rules/url.js +143 -0
- package/dist/infer/rules/version.d.ts +3 -0
- package/dist/infer/rules/version.d.ts.map +1 -0
- package/dist/infer/rules/version.js +26 -0
- package/dist/infer/types.d.ts +87 -0
- package/dist/infer/types.d.ts.map +1 -0
- package/dist/infer/types.js +1 -0
- package/dist/infer-rules/basic.d.ts +5 -0
- package/dist/infer-rules/basic.d.ts.map +1 -0
- package/dist/infer-rules/basic.js +48 -0
- package/dist/infer-rules/boolean.d.ts +3 -0
- package/dist/infer-rules/boolean.d.ts.map +1 -0
- package/dist/infer-rules/boolean.js +25 -0
- package/dist/infer-rules/dotted.d.ts +4 -0
- package/dist/infer-rules/dotted.d.ts.map +1 -0
- package/dist/infer-rules/dotted.js +48 -0
- package/dist/infer-rules/duration.d.ts +3 -0
- package/dist/infer-rules/duration.d.ts.map +1 -0
- package/dist/infer-rules/duration.js +25 -0
- package/dist/infer-rules/index.d.ts +50 -0
- package/dist/infer-rules/index.d.ts.map +1 -0
- package/dist/infer-rules/index.js +42 -0
- package/dist/infer-rules/json.d.ts +3 -0
- package/dist/infer-rules/json.d.ts.map +1 -0
- package/dist/infer-rules/json.js +50 -0
- package/dist/infer-rules/list.d.ts +5 -0
- package/dist/infer-rules/list.d.ts.map +1 -0
- package/dist/infer-rules/list.js +200 -0
- package/dist/infer-rules/path.d.ts +5 -0
- package/dist/infer-rules/path.d.ts.map +1 -0
- package/dist/infer-rules/path.js +78 -0
- package/dist/infer-rules/port.d.ts +3 -0
- package/dist/infer-rules/port.d.ts.map +1 -0
- package/dist/infer-rules/port.js +26 -0
- package/dist/infer-rules/simple.d.ts +3 -0
- package/dist/infer-rules/simple.d.ts.map +1 -0
- package/dist/infer-rules/simple.js +37 -0
- package/dist/infer-rules/url.d.ts +4 -0
- package/dist/infer-rules/url.d.ts.map +1 -0
- package/dist/infer-rules/url.js +149 -0
- package/dist/llm-kit/context.json.d.ts +2 -0
- package/dist/llm-kit/context.json.d.ts.map +1 -0
- package/dist/llm-kit/context.json.js +22 -0
- package/dist/sample/DNLTest.d.ts +2 -0
- package/dist/sample/DNLTest.d.ts.map +1 -0
- package/dist/sample/DNLTest.js +4 -0
- package/dist/sample/debug.d.ts +2 -0
- package/dist/sample/debug.d.ts.map +1 -0
- package/dist/sample/debug.js +5 -0
- package/dist/sample/env.dnl.d.ts +426 -0
- package/dist/sample/env.dnl.d.ts.map +1 -0
- package/dist/sample/env.dnl.js +429 -0
- package/dist/schemas/bool.d.ts +9 -0
- package/dist/schemas/bool.d.ts.map +1 -0
- package/dist/schemas/bool.js +22 -0
- package/dist/schemas/boolean.d.ts +9 -0
- package/dist/schemas/boolean.d.ts.map +1 -0
- package/dist/schemas/boolean.js +23 -0
- package/dist/schemas/dotted.d.ts +21 -0
- package/dist/schemas/dotted.d.ts.map +1 -0
- package/dist/schemas/dotted.js +45 -0
- package/dist/schemas/duration.d.ts +11 -0
- package/dist/schemas/duration.d.ts.map +1 -0
- package/dist/schemas/duration.js +44 -0
- package/dist/schemas/index.d.ts +9 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +8 -0
- package/dist/schemas/ip-and-version.d.ts +12 -0
- package/dist/schemas/ip-and-version.d.ts.map +1 -0
- package/dist/schemas/ip-and-version.js +35 -0
- package/dist/schemas/ip.d.ts +11 -0
- package/dist/schemas/ip.d.ts.map +1 -0
- package/dist/schemas/ip.js +33 -0
- package/dist/schemas/json.d.ts +15 -0
- package/dist/schemas/json.d.ts.map +1 -0
- package/dist/schemas/json.js +34 -0
- package/dist/schemas/list.d.ts +89 -0
- package/dist/schemas/list.d.ts.map +1 -0
- package/dist/schemas/list.js +139 -0
- package/dist/schemas/path.d.ts +23 -0
- package/dist/schemas/path.d.ts.map +1 -0
- package/dist/schemas/path.js +33 -0
- package/dist/schemas/port.d.ts +8 -0
- package/dist/schemas/port.d.ts.map +1 -0
- package/dist/schemas/port.js +9 -0
- package/dist/schemas/urls.d.ts +15 -0
- package/dist/schemas/urls.d.ts.map +1 -0
- package/dist/schemas/urls.js +54 -0
- package/package.json +11 -6
- package/dist/DnlTest.d.ts +0 -2
- package/dist/DnlTest.d.ts.map +0 -1
- package/dist/DnlTest.js +0 -12
- package/dist/cli/utils/exitCodes.d.ts +0 -8
- package/dist/cli/utils/exitCodes.d.ts.map +0 -1
- package/dist/cli/utils/exitCodes.js +0 -8
- package/dist/romaintaillandier1978-dotenv-never-lies-0.3.0.tgz +0 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { zStringGenSchema } from "./generated/basic.js";
|
|
2
|
+
import { LIST_RULES } from "./index.js";
|
|
3
|
+
export const inferSimpleSchemaForListItem = (rawValue) => {
|
|
4
|
+
for (const rule of LIST_RULES) {
|
|
5
|
+
const result = rule.tryInfer({ name: "", rawValue });
|
|
6
|
+
if (!result)
|
|
7
|
+
continue;
|
|
8
|
+
if (result.confidence >= rule.threshold) {
|
|
9
|
+
return result.generated;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
return zStringGenSchema;
|
|
13
|
+
};
|
|
14
|
+
const tokenizeEnvName = (name) => name.toUpperCase().split(/[_\-]/);
|
|
15
|
+
export const matchesEnvKey = (name, keys) => {
|
|
16
|
+
const tokens = tokenizeEnvName(name);
|
|
17
|
+
// si au moins un des marker est contenu dans le nom (tokenisé et uppercasé.)
|
|
18
|
+
for (const key of keys) {
|
|
19
|
+
if (tokens.includes(key.toUpperCase())) {
|
|
20
|
+
return { matched: true, reason: `Env name contains key: ${key}` };
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return { matched: false, reason: "No hint in the Env name" };
|
|
24
|
+
};
|
|
25
|
+
const SECRET_KEYS = ["SECRET", "KEY", "TOKEN", "PASSWORD", "PASS", "AUTH"];
|
|
26
|
+
export const guessSecret = (name) => {
|
|
27
|
+
return matchesEnvKey(name, SECRET_KEYS).matched;
|
|
28
|
+
};
|
|
29
|
+
export const areAllSameGenSchemas = (elements) => {
|
|
30
|
+
const e0 = elements[0];
|
|
31
|
+
return elements.every((e) => areSameGenSchemas(e, e0));
|
|
32
|
+
};
|
|
33
|
+
export const areSameGenSchemas = (a, b) => {
|
|
34
|
+
if (a === b)
|
|
35
|
+
return true;
|
|
36
|
+
if (a.code !== b.code)
|
|
37
|
+
return false;
|
|
38
|
+
if (a.imports.length !== b.imports.length)
|
|
39
|
+
return false;
|
|
40
|
+
return a.imports.every((i) => b.imports.some((j) => i.name === j.name && i.from === j.from));
|
|
41
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/infer/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAOvC,eAAO,MAAM,KAAK,EAAE,SAAS,EAeY,CAAC;AAE1C,eAAO,MAAM,UAAU,EAAE,SAAS,EAMO,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { booleanRule } from "./rules/boolean.js";
|
|
2
|
+
import { durationRule } from "./rules/duration.js";
|
|
3
|
+
import { jsonRule } from "./rules/json.js";
|
|
4
|
+
import { keyValueListRule, keyValueRule, listRule } from "./rules/list.js";
|
|
5
|
+
import { portRule } from "./rules/port.js";
|
|
6
|
+
import { emailRule, numberRule, stringRule } from "./rules/basic.js";
|
|
7
|
+
import { urlRule } from "./rules/url.js";
|
|
8
|
+
import { ipRule } from "./rules/ip.js";
|
|
9
|
+
import { versionRule } from "./rules/version.js";
|
|
10
|
+
// ⚠️ Règle d’or :
|
|
11
|
+
// JSON avant list,
|
|
12
|
+
// duration avant number,
|
|
13
|
+
// boolean avant enum,
|
|
14
|
+
export const RULES = [
|
|
15
|
+
jsonRule, // 10
|
|
16
|
+
keyValueListRule, // 9
|
|
17
|
+
keyValueRule, // 8
|
|
18
|
+
listRule, // 7
|
|
19
|
+
portRule, //7
|
|
20
|
+
durationRule, // 6
|
|
21
|
+
booleanRule, // 6
|
|
22
|
+
ipRule, // 5.5
|
|
23
|
+
versionRule, // 5
|
|
24
|
+
urlRule, // 5
|
|
25
|
+
emailRule, // 4
|
|
26
|
+
numberRule, // 3
|
|
27
|
+
stringRule, // 0 = fallback
|
|
28
|
+
].sort((a, b) => b.priority - a.priority);
|
|
29
|
+
export const LIST_RULES = [
|
|
30
|
+
portRule, //7
|
|
31
|
+
urlRule, //5
|
|
32
|
+
emailRule, //4
|
|
33
|
+
numberRule, //3
|
|
34
|
+
stringRule, //0
|
|
35
|
+
].sort((a, b) => b.priority - a.priority);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { InferRule } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Infers a number schema from a raw value. match vlaue like 42, "42", -1000, +7e6, etc.
|
|
4
|
+
* @param name - The name of the environment variable.
|
|
5
|
+
* @param rawValue - The raw value of the environment variable.
|
|
6
|
+
* @returns The inferred number schema.
|
|
7
|
+
*/
|
|
8
|
+
export declare const numberRule: InferRule;
|
|
9
|
+
export declare const emailRule: InferRule;
|
|
10
|
+
export declare const stringRule: InferRule;
|
|
11
|
+
//# sourceMappingURL=basic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"basic.d.ts","sourceRoot":"","sources":["../../../src/infer/rules/basic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAMxC;;;;;GAKG;AACH,eAAO,MAAM,UAAU,EAAE,SAmCxB,CAAC;AAIF,eAAO,MAAM,SAAS,EAAE,SAsBvB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,SA0BxB,CAAC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { zEmailGenSchema, zNumberGenSchema, zStringGenSchema } from "../generated/basic.js";
|
|
2
|
+
import { matchesEnvKey } from "../helpers.js";
|
|
3
|
+
const NUMBER_KEYS = ["NUMBER", "NUM", "NB", "COUNT", "SIZE", "LENGTH", "RATE", "PRICE", "COST", "TOTAL", "SUM", "AVG", "MIN", "MAX"];
|
|
4
|
+
/**
|
|
5
|
+
* Infers a number schema from a raw value. match vlaue like 42, "42", -1000, +7e6, etc.
|
|
6
|
+
* @param name - The name of the environment variable.
|
|
7
|
+
* @param rawValue - The raw value of the environment variable.
|
|
8
|
+
* @returns The inferred number schema.
|
|
9
|
+
*/
|
|
10
|
+
export const numberRule = {
|
|
11
|
+
type: "number",
|
|
12
|
+
priority: 4,
|
|
13
|
+
threshold: 5,
|
|
14
|
+
tryInfer({ name, rawValue }) {
|
|
15
|
+
let candidate = rawValue;
|
|
16
|
+
// We decided that number schema is coercive (z.coerce.number()),
|
|
17
|
+
// so we accept quotes "42" or '42', but no empty string "", '', ' '.
|
|
18
|
+
// note that number(' ') returns 0, which is not what we want
|
|
19
|
+
// never happen via dotenv, but migth happen via process.env
|
|
20
|
+
if (candidate === "" || candidate === "''" || candidate === '""')
|
|
21
|
+
return null;
|
|
22
|
+
if ((candidate.startsWith('"') && candidate.endsWith('"')) || (candidate.startsWith("'") && candidate.endsWith("'")))
|
|
23
|
+
candidate = candidate.slice(1, -1);
|
|
24
|
+
// never happen via dotenv, but migth happen via process.env
|
|
25
|
+
if (candidate.trim().match(/^\s*$/))
|
|
26
|
+
return null;
|
|
27
|
+
const n = Number(+candidate);
|
|
28
|
+
if (Number.isNaN(n))
|
|
29
|
+
return null;
|
|
30
|
+
let confidence = 5;
|
|
31
|
+
const reasons = ["Numeric value"];
|
|
32
|
+
const { matched, reason } = matchesEnvKey(name, NUMBER_KEYS);
|
|
33
|
+
if (matched) {
|
|
34
|
+
confidence += 1;
|
|
35
|
+
reasons.push(`${reason} (+1)`);
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
generated: zNumberGenSchema,
|
|
39
|
+
confidence,
|
|
40
|
+
reasons,
|
|
41
|
+
};
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
const EMAIL_KEYS = ["EMAIL", "MAIL"];
|
|
45
|
+
export const emailRule = {
|
|
46
|
+
type: "email",
|
|
47
|
+
priority: 4,
|
|
48
|
+
threshold: 5,
|
|
49
|
+
tryInfer({ name, rawValue }) {
|
|
50
|
+
if (!/^[^@]+@[^@]+\.[^@]+$/.test(rawValue))
|
|
51
|
+
return null;
|
|
52
|
+
let confidence = 6;
|
|
53
|
+
const reasons = ["Email-like value"];
|
|
54
|
+
const { matched, reason } = matchesEnvKey(name, EMAIL_KEYS);
|
|
55
|
+
if (matched) {
|
|
56
|
+
confidence += 1;
|
|
57
|
+
reasons.push(`${reason} (+1)`);
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
generated: zEmailGenSchema,
|
|
61
|
+
confidence,
|
|
62
|
+
reasons,
|
|
63
|
+
};
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
export const stringRule = {
|
|
67
|
+
type: "string",
|
|
68
|
+
priority: 0,
|
|
69
|
+
threshold: 0,
|
|
70
|
+
tryInfer({ rawValue }) {
|
|
71
|
+
const reasons = [];
|
|
72
|
+
const warnings = [];
|
|
73
|
+
// never happen via dotenv, but migth happen via process.env
|
|
74
|
+
if (rawValue === "" || rawValue === "''" || rawValue === '""') {
|
|
75
|
+
warnings.push(" ⚠️ Inferred string was detected as an empty string, may indicate optional variable of any type");
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
const containsOnlyBlank = rawValue.match(/^\s+$/);
|
|
79
|
+
if (containsOnlyBlank) {
|
|
80
|
+
warnings.push(" ⚠️ Inferred string was detected as containing only blank spaces, may indicate optional variable of any type");
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return {
|
|
84
|
+
generated: zStringGenSchema,
|
|
85
|
+
confidence: 0,
|
|
86
|
+
reasons: [...reasons, "Fallback to string"],
|
|
87
|
+
warnings,
|
|
88
|
+
};
|
|
89
|
+
},
|
|
90
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"boolean.d.ts","sourceRoot":"","sources":["../../../src/infer/rules/boolean.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAMxC,eAAO,MAAM,WAAW,EAAE,SAoBzB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { looksLikeValidBoolean } from "../../schemas/boolean.js";
|
|
2
|
+
import { matchesEnvKey } from "../helpers.js";
|
|
3
|
+
import { boolGenSchema } from "../generated/boolean.js";
|
|
4
|
+
const BOOLEAN_KEYS = ["IS", "HAS", "ENABLE", "DISABLE", "ENABLED", "DISABLED", "ALLOW", "DENY"];
|
|
5
|
+
export const booleanRule = {
|
|
6
|
+
type: "boolean",
|
|
7
|
+
priority: 6,
|
|
8
|
+
threshold: 5,
|
|
9
|
+
tryInfer({ name, rawValue }) {
|
|
10
|
+
if (!looksLikeValidBoolean(rawValue))
|
|
11
|
+
return null;
|
|
12
|
+
let confidence = 6; // valeur bool = signal fort
|
|
13
|
+
const reasons = ["Value matches strict boolean format"];
|
|
14
|
+
const { matched, reason } = matchesEnvKey(name, BOOLEAN_KEYS);
|
|
15
|
+
if (matched) {
|
|
16
|
+
confidence += 1;
|
|
17
|
+
reasons.push(`${reason} (+1)`);
|
|
18
|
+
}
|
|
19
|
+
return {
|
|
20
|
+
generated: boolGenSchema(name),
|
|
21
|
+
confidence,
|
|
22
|
+
reasons,
|
|
23
|
+
};
|
|
24
|
+
},
|
|
25
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"duration.d.ts","sourceRoot":"","sources":["../../../src/infer/rules/duration.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAMxC,eAAO,MAAM,YAAY,EAAE,SAsB1B,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { looksLikeValidDuration } from "../../schemas/duration.js";
|
|
2
|
+
import { matchesEnvKey } from "../helpers.js";
|
|
3
|
+
import { durationGenSchema } from "../generated/duration.js";
|
|
4
|
+
const DURATION_KEYS = ["TIMEOUT", "TTL", "DELAY", "DURATION", "INTERVAL"];
|
|
5
|
+
export const durationRule = {
|
|
6
|
+
type: "duration",
|
|
7
|
+
priority: 6,
|
|
8
|
+
threshold: 5,
|
|
9
|
+
tryInfer({ name, rawValue }) {
|
|
10
|
+
if (!looksLikeValidDuration(rawValue))
|
|
11
|
+
return null;
|
|
12
|
+
let confidence = 6;
|
|
13
|
+
const reasons = ["Value matches strict duration format"];
|
|
14
|
+
const { matched, reason } = matchesEnvKey(name, DURATION_KEYS);
|
|
15
|
+
if (matched) {
|
|
16
|
+
confidence += 1;
|
|
17
|
+
reasons.push(`${reason} (+1)`);
|
|
18
|
+
}
|
|
19
|
+
return {
|
|
20
|
+
generated: durationGenSchema(name),
|
|
21
|
+
confidence,
|
|
22
|
+
reasons,
|
|
23
|
+
};
|
|
24
|
+
},
|
|
25
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ip.d.ts","sourceRoot":"","sources":["../../../src/infer/rules/ip.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAIxC,eAAO,MAAM,MAAM,EAAE,SAsBpB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { looksLikeIp } from "../../schemas/dotted.js";
|
|
2
|
+
import { ipGenSchema } from "../generated/ip.js";
|
|
3
|
+
import { matchesEnvKey } from "../helpers.js";
|
|
4
|
+
const IP_KEYS = ["IP", "ADDRESS", "HOST", "HOSTNAME"];
|
|
5
|
+
export const ipRule = {
|
|
6
|
+
type: "ip",
|
|
7
|
+
priority: 5.5,
|
|
8
|
+
threshold: 5,
|
|
9
|
+
tryInfer({ name, rawValue }) {
|
|
10
|
+
if (!looksLikeIp(rawValue))
|
|
11
|
+
return null;
|
|
12
|
+
let confidence = 5;
|
|
13
|
+
const reasons = ["Value matches strict ip format"];
|
|
14
|
+
const { matched, reason } = matchesEnvKey(name, IP_KEYS);
|
|
15
|
+
if (matched) {
|
|
16
|
+
confidence += 1;
|
|
17
|
+
reasons.push(`${reason} (+1)`);
|
|
18
|
+
}
|
|
19
|
+
return {
|
|
20
|
+
generated: ipGenSchema(name),
|
|
21
|
+
confidence,
|
|
22
|
+
reasons,
|
|
23
|
+
};
|
|
24
|
+
},
|
|
25
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../../src/infer/rules/json.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAOxC,eAAO,MAAM,QAAQ,EAAE,SAuDtB,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { matchesEnvKey } from "../helpers.js";
|
|
2
|
+
import { jsonGenSchema } from "../generated/json.js";
|
|
3
|
+
import { zArrayOfUnknownGenSchema, zUnknownGenSchema } from "../generated/basic.js";
|
|
4
|
+
const JSON_KEYS_HIGH = ["JSON"];
|
|
5
|
+
const JSON_KEYS_LOW = ["PAYLOAD", "CONFIG", "DATA", "META"];
|
|
6
|
+
export const jsonRule = {
|
|
7
|
+
type: "json",
|
|
8
|
+
priority: 10,
|
|
9
|
+
threshold: 5,
|
|
10
|
+
tryInfer({ name, rawValue }) {
|
|
11
|
+
let parsed;
|
|
12
|
+
// trim the raw value to avoid issues with leading or trailing spaces
|
|
13
|
+
// never happen via dotenv, but migth happen via process.env
|
|
14
|
+
if (rawValue === "" || rawValue === "''" || rawValue === '""')
|
|
15
|
+
return null;
|
|
16
|
+
const trimedRawValue = rawValue.trim();
|
|
17
|
+
const reasons = [];
|
|
18
|
+
try {
|
|
19
|
+
parsed = JSON.parse(trimedRawValue);
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
let confidence = 0;
|
|
25
|
+
// if no {} or [], we end up with a single value, like "\"romain\"" or "\"2\"". (with quotes)
|
|
26
|
+
// This would be a valid JSON, but very unlikely to be intentional.
|
|
27
|
+
if (trimedRawValue.startsWith("{") || trimedRawValue.startsWith("[")) {
|
|
28
|
+
// strong JSON structure (+6)
|
|
29
|
+
confidence += 6;
|
|
30
|
+
reasons.push("JSON structure (+6)");
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
// JSON primitive : valid but suspicious (+2)
|
|
34
|
+
confidence += 2;
|
|
35
|
+
reasons.push("JSON primitive (+2)");
|
|
36
|
+
}
|
|
37
|
+
const { matched: matchedHigh, reason: reasonHigh } = matchesEnvKey(name, JSON_KEYS_HIGH);
|
|
38
|
+
if (matchedHigh) {
|
|
39
|
+
confidence += 2;
|
|
40
|
+
reasons.push(`${reasonHigh} (+2)`);
|
|
41
|
+
}
|
|
42
|
+
const { matched: matchedLow, reason: reasonLow } = matchesEnvKey(name, JSON_KEYS_LOW);
|
|
43
|
+
if (matchedLow) {
|
|
44
|
+
confidence += 1;
|
|
45
|
+
reasons.push(`${reasonLow} (+1)`);
|
|
46
|
+
}
|
|
47
|
+
const isArray = trimedRawValue.startsWith("[") && trimedRawValue.endsWith("]");
|
|
48
|
+
return {
|
|
49
|
+
generated: jsonGenSchema(name, isArray ? zArrayOfUnknownGenSchema : zUnknownGenSchema),
|
|
50
|
+
confidence,
|
|
51
|
+
reasons,
|
|
52
|
+
warnings: [
|
|
53
|
+
isArray
|
|
54
|
+
? " ⚠️ Inferred string was detected as containing a json array, please think to complete the 'of' parameter of the jsonSchema"
|
|
55
|
+
: " ⚠️ Inferred string was detected as containing a json object, please think to complete the 'of' parameter of the jsonSchema",
|
|
56
|
+
],
|
|
57
|
+
};
|
|
58
|
+
},
|
|
59
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { InferRule } from "../types.js";
|
|
2
|
+
export declare const keyValueListRule: InferRule;
|
|
3
|
+
export declare const keyValueRule: InferRule;
|
|
4
|
+
/**
|
|
5
|
+
* Infers a list schema from a raw value. Infer using ';' and ','.
|
|
6
|
+
* if ';' and ',' are used, ';' has priority.
|
|
7
|
+
* @param name - The name of the list.
|
|
8
|
+
* @param rawValue - The raw value of the list.
|
|
9
|
+
* @returns The inferred list schema.
|
|
10
|
+
*/
|
|
11
|
+
export declare const listRule: InferRule;
|
|
12
|
+
//# sourceMappingURL=list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/infer/rules/list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAQxC,eAAO,MAAM,gBAAgB,EAAE,SA+E9B,CAAC;AAIF,eAAO,MAAM,YAAY,EAAE,SAsB1B,CAAC;AAIF;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,EAAE,SAkHtB,CAAC"}
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { areAllSameGenSchemas, areSameGenSchemas, inferSimpleSchemaForListItem } from "../helpers.js";
|
|
2
|
+
import { matchesEnvKey } from "../helpers.js";
|
|
3
|
+
import { keyValueListSchemaGen, listSchemaGen, urlListSchemaGen, emailListSchemaGen, keyValueSchemaGen, listOfSchemaGen } from "../generated/list.js";
|
|
4
|
+
import { portGenSchemaNoName } from "../generated/port.js";
|
|
5
|
+
import { zEmailGenSchema, zNumberGenSchema, zUrlGenSchema } from "../generated/basic.js";
|
|
6
|
+
const KEY_PAIR_NAMES_LIST = ["MAPS", "LABELS", "HEADERS", "PARAMS"];
|
|
7
|
+
export const keyValueListRule = {
|
|
8
|
+
type: "keyValueList",
|
|
9
|
+
priority: 9,
|
|
10
|
+
threshold: 6,
|
|
11
|
+
tryInfer({ name, rawValue }) {
|
|
12
|
+
const pairsType1 = rawValue.split(";");
|
|
13
|
+
const pairsType2 = rawValue.split(",");
|
|
14
|
+
const pairsType3 = rawValue.split("&");
|
|
15
|
+
const hasType1 = pairsType1.length > 1;
|
|
16
|
+
const hasType2 = pairsType2.length > 1;
|
|
17
|
+
const hasType3 = pairsType3.length > 1;
|
|
18
|
+
if (hasType1 && hasType2 && hasType3)
|
|
19
|
+
return null;
|
|
20
|
+
let confidence = 2;
|
|
21
|
+
const reasons = [];
|
|
22
|
+
let pairs = [];
|
|
23
|
+
if (hasType1) {
|
|
24
|
+
pairs = pairsType1;
|
|
25
|
+
confidence += 2;
|
|
26
|
+
reasons.push("Multiple pairs separated by semicolon ';' (+2)");
|
|
27
|
+
if (hasType2 || hasType3) {
|
|
28
|
+
confidence -= 1;
|
|
29
|
+
reasons.push("Semicolon has priority over comma and &, but comma and & detected, possible bad separator identified (-1)");
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
else if (hasType2) {
|
|
33
|
+
pairs = pairsType2;
|
|
34
|
+
confidence += 2;
|
|
35
|
+
reasons.push("Multiple pairs separated by comma ',' (+2)");
|
|
36
|
+
if (hasType3) {
|
|
37
|
+
confidence -= 1;
|
|
38
|
+
reasons.push("Comma has priority over &, but & detected, possible bad separator identified (-1)");
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
else if (hasType3) {
|
|
42
|
+
pairs = pairsType3;
|
|
43
|
+
confidence += 2;
|
|
44
|
+
reasons.push("Multiple pairs separated by '&' (+2)");
|
|
45
|
+
}
|
|
46
|
+
// no pairs found
|
|
47
|
+
if (pairs.length < 1)
|
|
48
|
+
return null;
|
|
49
|
+
let validPairs1 = 0;
|
|
50
|
+
let validPairs2 = 0;
|
|
51
|
+
// TODO pairs must have all the same type of separator (= or :)
|
|
52
|
+
for (const pair of pairs) {
|
|
53
|
+
if (pair.includes("="))
|
|
54
|
+
validPairs1++;
|
|
55
|
+
if (pair.includes(":"))
|
|
56
|
+
validPairs2++;
|
|
57
|
+
}
|
|
58
|
+
if (validPairs1 !== pairs.length && validPairs2 !== pairs.length)
|
|
59
|
+
return null;
|
|
60
|
+
if (validPairs1 === pairs.length) {
|
|
61
|
+
confidence += 2;
|
|
62
|
+
reasons.push("All pairs are key=value pairs (+2)");
|
|
63
|
+
if (validPairs2 === pairs.length) {
|
|
64
|
+
confidence -= 1;
|
|
65
|
+
reasons.push("Both key=value and key:value pairs detected, possible bad separator identified (-1)");
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
else if (validPairs2 === pairs.length) {
|
|
69
|
+
confidence += 2;
|
|
70
|
+
reasons.push("All pairs are key:value pairs (+2)");
|
|
71
|
+
}
|
|
72
|
+
const { matched, reason } = matchesEnvKey(name, KEY_PAIR_NAMES_LIST);
|
|
73
|
+
if (matched) {
|
|
74
|
+
confidence += 1;
|
|
75
|
+
reasons.push(`${reason} (+1)`);
|
|
76
|
+
}
|
|
77
|
+
return {
|
|
78
|
+
generated: keyValueListSchemaGen(name),
|
|
79
|
+
confidence,
|
|
80
|
+
reasons,
|
|
81
|
+
};
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
const KEY_PAIR_NAMES = ["ENV", "VARS", "CONFIG", "OPTIONS"];
|
|
85
|
+
export const keyValueRule = {
|
|
86
|
+
type: "keyValue",
|
|
87
|
+
priority: 8,
|
|
88
|
+
threshold: 5,
|
|
89
|
+
tryInfer({ name, rawValue }) {
|
|
90
|
+
if (!rawValue.includes("=") && !rawValue.includes(":"))
|
|
91
|
+
return null;
|
|
92
|
+
const reasons = ["Single key=value or key:value structure"];
|
|
93
|
+
let confidence = 4;
|
|
94
|
+
const { matched, reason } = matchesEnvKey(name, KEY_PAIR_NAMES);
|
|
95
|
+
if (matched) {
|
|
96
|
+
confidence += 1;
|
|
97
|
+
reasons.push(`${reason} (+1)`);
|
|
98
|
+
}
|
|
99
|
+
return {
|
|
100
|
+
generated: keyValueSchemaGen(name),
|
|
101
|
+
confidence,
|
|
102
|
+
reasons,
|
|
103
|
+
};
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
const LIST_KEYS = ["LIST", "ITEMS", "ARRAY", "VALUES"];
|
|
107
|
+
/**
|
|
108
|
+
* Infers a list schema from a raw value. Infer using ';' and ','.
|
|
109
|
+
* if ';' and ',' are used, ';' has priority.
|
|
110
|
+
* @param name - The name of the list.
|
|
111
|
+
* @param rawValue - The raw value of the list.
|
|
112
|
+
* @returns The inferred list schema.
|
|
113
|
+
*/
|
|
114
|
+
export const listRule = {
|
|
115
|
+
type: "list",
|
|
116
|
+
priority: 7,
|
|
117
|
+
threshold: 5,
|
|
118
|
+
tryInfer({ name, rawValue }) {
|
|
119
|
+
const semicolonItems = rawValue.split(";");
|
|
120
|
+
const commaItems = rawValue.split(",");
|
|
121
|
+
let parts = [];
|
|
122
|
+
let confidence = 0;
|
|
123
|
+
const reasons = [];
|
|
124
|
+
const warnings = [];
|
|
125
|
+
const hasSemicolon = semicolonItems.length > 1;
|
|
126
|
+
const hasComma = commaItems.length > 1;
|
|
127
|
+
const isOnlyEmptyList = /^;+$/.test(rawValue) || /^,+$/.test(rawValue);
|
|
128
|
+
if (isOnlyEmptyList) {
|
|
129
|
+
warnings.push(" ⚠️ Inferred list was detected as containing only empty values, consider completing the 'of' parameter of the listSchema");
|
|
130
|
+
}
|
|
131
|
+
if (hasSemicolon) {
|
|
132
|
+
confidence += 4;
|
|
133
|
+
reasons.push("multiple values separated by semicolon ';' (+4)");
|
|
134
|
+
parts = semicolonItems;
|
|
135
|
+
if (hasComma) {
|
|
136
|
+
confidence -= 1;
|
|
137
|
+
reasons.push("semicolon has priority over comma, but comma detected, possible bad separator identified (-1)");
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
else if (hasComma) {
|
|
141
|
+
confidence += 4;
|
|
142
|
+
reasons.push("multiple values separated by comma ',' (+4)");
|
|
143
|
+
parts = commaItems;
|
|
144
|
+
}
|
|
145
|
+
if (!parts || parts.length === 0)
|
|
146
|
+
return null;
|
|
147
|
+
const { matched, reason } = matchesEnvKey(name, LIST_KEYS);
|
|
148
|
+
if (matched) {
|
|
149
|
+
confidence += 1;
|
|
150
|
+
reasons.push(`${reason} (+1)`);
|
|
151
|
+
}
|
|
152
|
+
const itemTypes = parts.map((value) => inferSimpleSchemaForListItem(value));
|
|
153
|
+
// if some elements are of different types => list of strings.
|
|
154
|
+
if (!areAllSameGenSchemas(itemTypes)) {
|
|
155
|
+
return {
|
|
156
|
+
generated: listSchemaGen(name),
|
|
157
|
+
confidence,
|
|
158
|
+
reasons,
|
|
159
|
+
warnings,
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
// from here, all elements are of the same type => we can generate a typed list
|
|
163
|
+
reasons.push("All elements are of the same type (+2)");
|
|
164
|
+
confidence += 2;
|
|
165
|
+
// List of ports
|
|
166
|
+
if (areSameGenSchemas(itemTypes[0], portGenSchemaNoName)) {
|
|
167
|
+
reasons.push("All elements are PORTS (+2)");
|
|
168
|
+
confidence += 2;
|
|
169
|
+
return {
|
|
170
|
+
generated: listOfSchemaGen(name, itemTypes[0]),
|
|
171
|
+
confidence,
|
|
172
|
+
reasons,
|
|
173
|
+
warnings,
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
// List of emails
|
|
177
|
+
if (areSameGenSchemas(itemTypes[0], zEmailGenSchema)) {
|
|
178
|
+
reasons.push("All elements are emails (+2)");
|
|
179
|
+
confidence += 2;
|
|
180
|
+
return {
|
|
181
|
+
generated: emailListSchemaGen(name),
|
|
182
|
+
confidence,
|
|
183
|
+
reasons,
|
|
184
|
+
warnings,
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
// here we assume we have a list of simple URLs.
|
|
188
|
+
// possible evolution with all types of URLs.
|
|
189
|
+
// List of URLs
|
|
190
|
+
if (areSameGenSchemas(itemTypes[0], zUrlGenSchema)) {
|
|
191
|
+
reasons.push("All elements are URLs (+2)");
|
|
192
|
+
confidence += 2;
|
|
193
|
+
return {
|
|
194
|
+
generated: urlListSchemaGen(name),
|
|
195
|
+
confidence,
|
|
196
|
+
reasons,
|
|
197
|
+
warnings,
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
// List of numbers
|
|
201
|
+
if (areSameGenSchemas(itemTypes[0], zNumberGenSchema)) {
|
|
202
|
+
reasons.push("All elements are numbers (+2)");
|
|
203
|
+
confidence += 2;
|
|
204
|
+
return {
|
|
205
|
+
generated: listOfSchemaGen(name, itemTypes[0]),
|
|
206
|
+
confidence,
|
|
207
|
+
reasons,
|
|
208
|
+
warnings,
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
// List of strings
|
|
212
|
+
reasons.push("All elements are strings (+2)");
|
|
213
|
+
confidence += 2;
|
|
214
|
+
return {
|
|
215
|
+
generated: listSchemaGen(name),
|
|
216
|
+
confidence,
|
|
217
|
+
reasons,
|
|
218
|
+
warnings,
|
|
219
|
+
};
|
|
220
|
+
},
|
|
221
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"port.d.ts","sourceRoot":"","sources":["../../../src/infer/rules/port.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAMxC,eAAO,MAAM,QAAQ,EAAE,SA4BtB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { matchesEnvKey } from "../helpers.js";
|
|
2
|
+
import { portGenSchema } from "../generated/port.js";
|
|
3
|
+
const PORT_KEYS = ["PORT", "PORT", "PORT"];
|
|
4
|
+
export const portRule = {
|
|
5
|
+
type: "port",
|
|
6
|
+
priority: 7,
|
|
7
|
+
threshold: 5,
|
|
8
|
+
tryInfer({ name, rawValue }) {
|
|
9
|
+
// reject floats, versions (2.0), weird numbers
|
|
10
|
+
if (!/^\d+$/.test(rawValue)) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
const port = Number(rawValue);
|
|
14
|
+
if (!Number.isInteger(port) || port < 1 || port > 65535) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
let confidence = 5; // valeur seule = déjà crédible
|
|
18
|
+
const reasons = ["Valid TCP/UDP port number"];
|
|
19
|
+
const { matched, reason } = matchesEnvKey(name, PORT_KEYS);
|
|
20
|
+
if (matched) {
|
|
21
|
+
confidence += 2;
|
|
22
|
+
reasons.push(`${reason} (+2)`);
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
generated: portGenSchema(name),
|
|
26
|
+
confidence,
|
|
27
|
+
reasons,
|
|
28
|
+
};
|
|
29
|
+
},
|
|
30
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../../src/infer/rules/url.ts"],"names":[],"mappings":"AASA,OAAO,EAAgC,SAAS,EAAE,MAAM,aAAa,CAAC;AAKtE,eAAO,MAAM,QAAQ,EAAE,MAAM,EAAyF,CAAC;AA8EvH,eAAO,MAAM,OAAO,EAAE,SA8ErB,CAAC"}
|