@atlantjs/parchment 1.0.36 → 1.0.37
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlantjs/parchment",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.37",
|
|
4
4
|
"description": "Atlantjs Parchment - A library for handling file system operations and project structure in Atlantjs.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "AtlantJS Team",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"lint:fix": "biome check src --write --unsafe"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@atlantjs/arch": "15.7.
|
|
32
|
+
"@atlantjs/arch": "15.7.14",
|
|
33
33
|
"dotenv": "17.4.2"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"ts-node": "10.9.2",
|
|
42
42
|
"tsc-alias": "1.8.17",
|
|
43
43
|
"tsconfig-paths": "4.2.0",
|
|
44
|
-
"typescript": "
|
|
44
|
+
"typescript": "5.9.3",
|
|
45
45
|
"vite-tsconfig-paths": "6.1.1",
|
|
46
46
|
"vitest": "4.0.18"
|
|
47
47
|
}
|
package/src/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Parchment } from "./parchment/parchment
|
|
1
|
+
export { Parchment } from "./parchment/parchment";
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC"}
|
package/src/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Parchment = void 0;
|
|
4
|
-
var
|
|
5
|
-
Object.defineProperty(exports, "Parchment", { enumerable: true, get: function () { return
|
|
4
|
+
var parchment_1 = require("./parchment/parchment");
|
|
5
|
+
Object.defineProperty(exports, "Parchment", { enumerable: true, get: function () { return parchment_1.Parchment; } });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "dotenv/config";
|
|
2
|
-
import { PickVerseType } from "../parchment/parchment.type
|
|
2
|
+
import { PickVerseType } from "../parchment/parchment.type";
|
|
3
3
|
export declare class Parchment {
|
|
4
4
|
static verse<VerseType>({ ...verse }: PickVerseType<VerseType>): VerseType;
|
|
5
5
|
private static convertSetValue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parchment.d.ts","sourceRoot":"","sources":["../../../src/parchment/parchment.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AAGvB,OAAO,EAAE,aAAa,EAAE,MAAM
|
|
1
|
+
{"version":3,"file":"parchment.d.ts","sourceRoot":"","sources":["../../../src/parchment/parchment.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AAGvB,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,qBAAa,SAAS;WACP,KAAK,CAAC,SAAS,EAAE,EAC9B,GAAG,KAAK,EACR,EAAE,aAAa,CAAC,SAAS,CAAC,GAAG,SAAS;IAiBvC,OAAO,CAAC,MAAM,CAAC,eAAe;CAoG9B"}
|
|
@@ -3,12 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Parchment = void 0;
|
|
4
4
|
require("dotenv/config");
|
|
5
5
|
const arch_1 = require("@atlantjs/arch");
|
|
6
|
-
const
|
|
6
|
+
const parchment_error_1 = require("../parchment/parchment.error");
|
|
7
7
|
class Parchment {
|
|
8
8
|
static verse({ ...verse }) {
|
|
9
9
|
const valueDefined = process.env[verse.name] || verse.default?.toString();
|
|
10
10
|
if (arch_1._.isNullOrUndefined(valueDefined) && verse.isRequired.truthy()) {
|
|
11
|
-
throw new
|
|
11
|
+
throw new parchment_error_1.PickEnvError(verse.name, verse.description, "The environment variable must have its value defined");
|
|
12
12
|
}
|
|
13
13
|
return Parchment.convertSetValue(verse, valueDefined);
|
|
14
14
|
}
|
|
@@ -21,37 +21,37 @@ class Parchment {
|
|
|
21
21
|
}
|
|
22
22
|
if (verse.type === "boolean") {
|
|
23
23
|
if (arch_1._.isAnyOf(value, ["false", "true"]).falsy()) {
|
|
24
|
-
throw new
|
|
24
|
+
throw new parchment_error_1.PickEnvError(verse.name, verse.description, `The value of the environment variable ${value} must be "false" or "true"`);
|
|
25
25
|
}
|
|
26
26
|
return arch_1._.isEqual(value, "true");
|
|
27
27
|
}
|
|
28
28
|
if (verse.type === "enum") {
|
|
29
29
|
if (arch_1._.isUndefined(verse.values)) {
|
|
30
|
-
throw new
|
|
30
|
+
throw new parchment_error_1.PickEnvError(verse.name, verse.description, `A definição da variável de ambiente ${verse.name} deve conter os valores de referencia`);
|
|
31
31
|
}
|
|
32
32
|
if (verse.values.includes(value).falsy()) {
|
|
33
|
-
throw new
|
|
33
|
+
throw new parchment_error_1.PickEnvError(verse.name, verse.description, `A variável ${verse.name} deve conter algum dos seguintes valores: [${verse.values.join(", ")}]`);
|
|
34
34
|
}
|
|
35
35
|
return value;
|
|
36
36
|
}
|
|
37
37
|
if (verse.type === "float") {
|
|
38
38
|
const floatValue = Number.parseFloat(value);
|
|
39
39
|
if (Number.isNaN(floatValue)) {
|
|
40
|
-
throw new
|
|
40
|
+
throw new parchment_error_1.PickEnvError(verse.name, verse.description, `The value of the environment variable ${verse.name} must be a valid float number`);
|
|
41
41
|
}
|
|
42
42
|
return floatValue;
|
|
43
43
|
}
|
|
44
44
|
if (verse.type === "int") {
|
|
45
45
|
const intValue = Number.parseInt(value, 10);
|
|
46
46
|
if (Number.isNaN(intValue)) {
|
|
47
|
-
throw new
|
|
47
|
+
throw new parchment_error_1.PickEnvError(verse.name, verse.description, `O valor da variável de ambiente ${verse.name} deve ser um número inteiro válido`);
|
|
48
48
|
}
|
|
49
49
|
return intValue;
|
|
50
50
|
}
|
|
51
51
|
if (verse.type === "port-number") {
|
|
52
52
|
const portNumber = Number.parseInt(value, 10);
|
|
53
53
|
if (Number.isNaN(portNumber) || portNumber < 1 || portNumber > 65535) {
|
|
54
|
-
throw new
|
|
54
|
+
throw new parchment_error_1.PickEnvError(verse.name, verse.description, `O valor da variável de ambiente ${verse.name} deve ser um número de porta válido entre 1 e 65535`);
|
|
55
55
|
}
|
|
56
56
|
return portNumber;
|
|
57
57
|
}
|
|
@@ -61,7 +61,7 @@ class Parchment {
|
|
|
61
61
|
if (verse.type === "url-https") {
|
|
62
62
|
const urlPattern = /^https?:\/\/[^\s/$.?#].[^\s]*$/i;
|
|
63
63
|
if (!urlPattern.test(value)) {
|
|
64
|
-
throw new
|
|
64
|
+
throw new parchment_error_1.PickEnvError(verse.name, verse.description, `O valor da variável de ambiente ${verse.name} deve ser uma URL válida começando com http ou https`);
|
|
65
65
|
}
|
|
66
66
|
return value;
|
|
67
67
|
}
|