@umatch/env-parser
Advanced tools
+1
-1
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErD,qBAAa,GAAG,CAAC,MAAM,SAAS;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC,KAAK,CAAC,CAAA;CAAE;IAC/D,OAAO,CAAC,QAAQ,CAAC,SAAS,CAExB;gBAEU,MAAM,EAAE,MAAM;IAI1B,OAAO,CAAC,QAAQ;IA0BT,GAAG,CAAC,CAAC,SAAS,MAAM,MAAM,EAC/B,GAAG,EAAE,CAAC,GACL,MAAM,CAAC,CAAC,CAAC,SAAS,SAAS,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK;CAIpD"} | ||
| {"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErD,qBAAa,GAAG,CAAC,MAAM,SAAS;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC,KAAK,CAAC,CAAA;CAAE;IAC/D,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA0C;gBAExD,MAAM,EAAE,MAAM;IAI1B,OAAO,CAAC,QAAQ;IA0BT,GAAG,CAAC,CAAC,SAAS,MAAM,MAAM,EAC/B,GAAG,EAAE,CAAC,GACL,MAAM,CAAC,CAAC,CAAC,SAAS,SAAS,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK;CAIpD"} |
+27
-6
@@ -5,9 +5,30 @@ import { Env } from './env'; | ||
| import { StringValidator, type StringValidationOptions } from './Validators/StringValidator'; | ||
| declare class Validators { | ||
| static boolean(): BooleanValidator; | ||
| static number(options?: NumberValidationOptions): NumberValidator; | ||
| static port(): NumberValidator; | ||
| static string(options?: StringValidationOptions): StringValidator; | ||
| } | ||
| declare const Validators: { | ||
| /** | ||
| * Returns a boolean validator. | ||
| */ | ||
| boolean: () => BooleanValidator; | ||
| /** | ||
| * Returns a number validator. | ||
| * | ||
| * @param {NumberValidationOptions} options The options for the NumberValidator. | ||
| * @param {number} options.min The minimum value for the number. | ||
| * @param {number} options.max The maximum value for the number. | ||
| */ | ||
| number: (options?: NumberValidationOptions) => NumberValidator; | ||
| /** | ||
| * Returns a port validator. | ||
| * | ||
| * It is a number validator with a minimum of 1024 and a maximum of 65353. | ||
| */ | ||
| port: () => NumberValidator; | ||
| /** | ||
| * Returns a string validator. | ||
| * @param {StringValidationOptions} options The options for the StringValidator. | ||
| * @param {number} options.minLength The minimum length for the string. | ||
| * @param {number} options.maxLength The maximum length for the string. | ||
| */ | ||
| string: (options?: StringValidationOptions) => StringValidator; | ||
| }; | ||
| export { Env, Validators }; | ||
| //# sourceMappingURL=index.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EACL,eAAe,EACf,KAAK,uBAAuB,EAC7B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,eAAe,EACf,KAAK,uBAAuB,EAC7B,MAAM,8BAA8B,CAAC;AAEtC,cAAM,UAAU;IACd,MAAM,CAAC,OAAO;IAGd,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,uBAAuB;IAG/C,MAAM,CAAC,IAAI;IAGX,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,uBAAuB;CAGhD;AAED,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,CAAC"} | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EACL,eAAe,EACf,KAAK,uBAAuB,EAC7B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,eAAe,EACf,KAAK,uBAAuB,EAC7B,MAAM,8BAA8B,CAAC;AAEtC,QAAA,MAAM,UAAU;IACd;;OAEG;;IAEH;;;;;;OAMG;uBACgB,uBAAuB;IAC1C;;;;OAIG;;IAEH;;;;;OAKG;uBACgB,uBAAuB;CAC3C,CAAC;AAEF,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,CAAC"} |
+27
-14
@@ -9,16 +9,29 @@ "use strict"; | ||
| const StringValidator_1 = require("./Validators/StringValidator"); | ||
| class Validators { | ||
| static boolean() { | ||
| return new BooleanValidator_1.BooleanValidator(); | ||
| } | ||
| static number(options) { | ||
| return new NumberValidator_1.NumberValidator(options); | ||
| } | ||
| static port() { | ||
| return new NumberValidator_1.NumberValidator({ min: 1024, max: 65353 }); | ||
| } | ||
| static string(options) { | ||
| return new StringValidator_1.StringValidator(options); | ||
| } | ||
| } | ||
| const Validators = { | ||
| /** | ||
| * Returns a boolean validator. | ||
| */ | ||
| boolean: () => new BooleanValidator_1.BooleanValidator(), | ||
| /** | ||
| * Returns a number validator. | ||
| * | ||
| * @param {NumberValidationOptions} options The options for the NumberValidator. | ||
| * @param {number} options.min The minimum value for the number. | ||
| * @param {number} options.max The maximum value for the number. | ||
| */ | ||
| number: (options) => new NumberValidator_1.NumberValidator(options), | ||
| /** | ||
| * Returns a port validator. | ||
| * | ||
| * It is a number validator with a minimum of 1024 and a maximum of 65353. | ||
| */ | ||
| port: () => new NumberValidator_1.NumberValidator({ min: 1024, max: 65353 }), | ||
| /** | ||
| * Returns a string validator. | ||
| * @param {StringValidationOptions} options The options for the StringValidator. | ||
| * @param {number} options.minLength The minimum length for the string. | ||
| * @param {number} options.maxLength The maximum length for the string. | ||
| */ | ||
| string: (options) => new StringValidator_1.StringValidator(options), | ||
| }; | ||
| exports.Validators = Validators; |
+1
-1
| { | ||
| "name": "@umatch/env-parser", | ||
| "version": "1.0.0", | ||
| "version": "1.0.1", | ||
| "description": "Parse and validate environment variables, with TypeScript support", | ||
@@ -5,0 +5,0 @@ "author": "Gabriel Okamoto <gabrielokamoto@hotmail.com>", |
+1
-3
| import type { Validator, Value } from './Validators'; | ||
| export class Env<Schema extends { [_: string]: Validator<Value> }> { | ||
| private readonly validated: { | ||
| readonly [K in keyof Schema]: Value; | ||
| }; | ||
| private readonly validated: { readonly [K in keyof Schema]: Value }; | ||
@@ -8,0 +6,0 @@ constructor(schema: Schema) { |
+27
-14
@@ -12,17 +12,30 @@ import { Env } from './env'; | ||
| class Validators { | ||
| static boolean() { | ||
| return new BooleanValidator(); | ||
| } | ||
| static number(options?: NumberValidationOptions) { | ||
| return new NumberValidator(options); | ||
| } | ||
| static port() { | ||
| return new NumberValidator({ min: 1024, max: 65353 }); | ||
| } | ||
| static string(options?: StringValidationOptions) { | ||
| return new StringValidator(options); | ||
| } | ||
| } | ||
| const Validators = { | ||
| /** | ||
| * Returns a boolean validator. | ||
| */ | ||
| boolean: () => new BooleanValidator(), | ||
| /** | ||
| * Returns a number validator. | ||
| * | ||
| * @param {NumberValidationOptions} options The options for the NumberValidator. | ||
| * @param {number} options.min The minimum value for the number. | ||
| * @param {number} options.max The maximum value for the number. | ||
| */ | ||
| number: (options?: NumberValidationOptions) => new NumberValidator(options), | ||
| /** | ||
| * Returns a port validator. | ||
| * | ||
| * It is a number validator with a minimum of 1024 and a maximum of 65353. | ||
| */ | ||
| port: () => new NumberValidator({ min: 1024, max: 65353 }), | ||
| /** | ||
| * Returns a string validator. | ||
| * @param {StringValidationOptions} options The options for the StringValidator. | ||
| * @param {number} options.minLength The minimum length for the string. | ||
| * @param {number} options.maxLength The maximum length for the string. | ||
| */ | ||
| string: (options?: StringValidationOptions) => new StringValidator(options), | ||
| }; | ||
| export { Env, Validators }; |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.Validators = exports.Env = void 0; | ||
| const env_1 = require("./env"); | ||
| Object.defineProperty(exports, "Env", { enumerable: true, get: function () { return env_1.Env; } }); | ||
| const BooleanValidator_1 = require("./Validators/BooleanValidator"); | ||
| const NumberValidator_1 = require("./Validators/NumberValidator"); | ||
| const StringValidator_1 = require("./Validators/StringValidator"); | ||
| class Validators { | ||
| static boolean() { | ||
| return new BooleanValidator_1.BooleanValidator(); | ||
| } | ||
| static number(options) { | ||
| return new NumberValidator_1.NumberValidator(options); | ||
| } | ||
| static port() { | ||
| return new NumberValidator_1.NumberValidator({ min: 1024, max: 65353 }); | ||
| } | ||
| static string(options) { | ||
| return new StringValidator_1.StringValidator(options); | ||
| } | ||
| } | ||
| exports.Validators = Validators; |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
19651
5.92%445
5.2%0
-100%26
-3.7%