@memberjunction/config 3.3.0 → 3.4.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.
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Parses a boolean environment variable with support for common truthy values.
3
+ *
4
+ * Accepts the following as TRUE (case-insensitive):
5
+ * - 'true', 'True', 'TRUE'
6
+ * - '1'
7
+ * - 'yes', 'Yes', 'YES'
8
+ * - 'y', 'Y'
9
+ * - 'on', 'On', 'ON'
10
+ * - 't', 'T'
11
+ *
12
+ * All other values (including undefined, empty string, null) return FALSE.
13
+ *
14
+ * @param value - The environment variable value to parse
15
+ * @returns true if the value matches a truthy pattern, false otherwise
16
+ *
17
+ * @example
18
+ * ```typescript
19
+ * import { parseBooleanEnv } from '@memberjunction/config';
20
+ *
21
+ * // All return true
22
+ * parseBooleanEnv('true');
23
+ * parseBooleanEnv('True');
24
+ * parseBooleanEnv('TRUE');
25
+ * parseBooleanEnv('1');
26
+ * parseBooleanEnv('yes');
27
+ * parseBooleanEnv('Y');
28
+ * parseBooleanEnv('on');
29
+ *
30
+ * // All return false
31
+ * parseBooleanEnv('false');
32
+ * parseBooleanEnv('0');
33
+ * parseBooleanEnv('no');
34
+ * parseBooleanEnv(undefined);
35
+ * parseBooleanEnv('');
36
+ * ```
37
+ */
38
+ export declare function parseBooleanEnv(value: string | undefined | null): boolean;
39
+ //# sourceMappingURL=env-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env-utils.d.ts","sourceRoot":"","sources":["../src/env-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,OAAO,CASzE"}
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseBooleanEnv = void 0;
4
+ /**
5
+ * Parses a boolean environment variable with support for common truthy values.
6
+ *
7
+ * Accepts the following as TRUE (case-insensitive):
8
+ * - 'true', 'True', 'TRUE'
9
+ * - '1'
10
+ * - 'yes', 'Yes', 'YES'
11
+ * - 'y', 'Y'
12
+ * - 'on', 'On', 'ON'
13
+ * - 't', 'T'
14
+ *
15
+ * All other values (including undefined, empty string, null) return FALSE.
16
+ *
17
+ * @param value - The environment variable value to parse
18
+ * @returns true if the value matches a truthy pattern, false otherwise
19
+ *
20
+ * @example
21
+ * ```typescript
22
+ * import { parseBooleanEnv } from '@memberjunction/config';
23
+ *
24
+ * // All return true
25
+ * parseBooleanEnv('true');
26
+ * parseBooleanEnv('True');
27
+ * parseBooleanEnv('TRUE');
28
+ * parseBooleanEnv('1');
29
+ * parseBooleanEnv('yes');
30
+ * parseBooleanEnv('Y');
31
+ * parseBooleanEnv('on');
32
+ *
33
+ * // All return false
34
+ * parseBooleanEnv('false');
35
+ * parseBooleanEnv('0');
36
+ * parseBooleanEnv('no');
37
+ * parseBooleanEnv(undefined);
38
+ * parseBooleanEnv('');
39
+ * ```
40
+ */
41
+ function parseBooleanEnv(value) {
42
+ if (!value) {
43
+ return false;
44
+ }
45
+ const normalized = value.trim().toLowerCase();
46
+ const truthyValues = ['true', '1', 'yes', 'y', 'on', 't'];
47
+ return truthyValues.includes(normalized);
48
+ }
49
+ exports.parseBooleanEnv = parseBooleanEnv;
50
+ //# sourceMappingURL=env-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env-utils.js","sourceRoot":"","sources":["../src/env-utils.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,SAAgB,eAAe,CAAC,KAAgC;IAC9D,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC9C,MAAM,YAAY,GAAG,CAAC,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;IAE1D,OAAO,YAAY,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;AAC3C,CAAC;AATD,0CASC"}
package/dist/index.d.ts CHANGED
@@ -13,4 +13,5 @@
13
13
  export { loadMJConfig, loadMJConfigSync, buildMJConfig, type LoadConfigOptions, type LoadConfigResult } from './config-loader';
14
14
  export { mergeConfigs, validateConfigStructure, type MergeOptions } from './config-merger';
15
15
  export { type MJConfig, isValidConfig } from './config-types';
16
+ export { parseBooleanEnv } from './env-utils';
16
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACtB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,YAAY,EACZ,uBAAuB,EACvB,KAAK,YAAY,EAClB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,KAAK,QAAQ,EACb,aAAa,EACd,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACtB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,YAAY,EACZ,uBAAuB,EACvB,KAAK,YAAY,EAClB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,KAAK,QAAQ,EACb,aAAa,EACd,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,eAAe,EAChB,MAAM,aAAa,CAAC"}
package/dist/index.js CHANGED
@@ -12,7 +12,7 @@
12
12
  * - Environment variables override everything
13
13
  */
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.isValidConfig = exports.validateConfigStructure = exports.mergeConfigs = exports.buildMJConfig = exports.loadMJConfigSync = exports.loadMJConfig = void 0;
15
+ exports.parseBooleanEnv = exports.isValidConfig = exports.validateConfigStructure = exports.mergeConfigs = exports.buildMJConfig = exports.loadMJConfigSync = exports.loadMJConfig = void 0;
16
16
  var config_loader_1 = require("./config-loader");
17
17
  Object.defineProperty(exports, "loadMJConfig", { enumerable: true, get: function () { return config_loader_1.loadMJConfig; } });
18
18
  Object.defineProperty(exports, "loadMJConfigSync", { enumerable: true, get: function () { return config_loader_1.loadMJConfigSync; } });
@@ -22,4 +22,6 @@ Object.defineProperty(exports, "mergeConfigs", { enumerable: true, get: function
22
22
  Object.defineProperty(exports, "validateConfigStructure", { enumerable: true, get: function () { return config_merger_1.validateConfigStructure; } });
23
23
  var config_types_1 = require("./config-types");
24
24
  Object.defineProperty(exports, "isValidConfig", { enumerable: true, get: function () { return config_types_1.isValidConfig; } });
25
+ var env_utils_1 = require("./env-utils");
26
+ Object.defineProperty(exports, "parseBooleanEnv", { enumerable: true, get: function () { return env_utils_1.parseBooleanEnv; } });
25
27
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AAEH,iDAMyB;AALvB,6GAAA,YAAY,OAAA;AACZ,iHAAA,gBAAgB,OAAA;AAChB,8GAAA,aAAa,OAAA;AAKf,iDAIyB;AAHvB,6GAAA,YAAY,OAAA;AACZ,wHAAA,uBAAuB,OAAA;AAIzB,+CAGwB;AADtB,6GAAA,aAAa,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AAEH,iDAMyB;AALvB,6GAAA,YAAY,OAAA;AACZ,iHAAA,gBAAgB,OAAA;AAChB,8GAAA,aAAa,OAAA;AAKf,iDAIyB;AAHvB,6GAAA,YAAY,OAAA;AACZ,wHAAA,uBAAuB,OAAA;AAIzB,+CAGwB;AADtB,6GAAA,aAAa,OAAA;AAGf,yCAEqB;AADnB,4GAAA,eAAe,OAAA"}
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@memberjunction/config",
3
- "version": "3.3.0",
3
+ "version": "3.4.0",
4
4
  "description": "Central configuration package for MemberJunction framework with default configurations and merge utilities",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "scripts": {
8
8
  "build": "tsc",
9
9
  "watch": "tsc --watch",
10
- "clean": "rm -rf dist",
10
+ "clean": "rimraf dist",
11
11
  "test": "jest"
12
12
  },
13
13
  "keywords": [