@pristine-ts/configuration 2.0.3 → 2.0.5

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.
Files changed (47) hide show
  1. package/dist/lib/cjs/configuration.module.js +1 -0
  2. package/dist/lib/cjs/configuration.module.js.map +1 -1
  3. package/dist/lib/cjs/errors/configuration-definition-already-exists.error.js +2 -6
  4. package/dist/lib/cjs/errors/configuration-definition-already-exists.error.js.map +1 -1
  5. package/dist/lib/cjs/errors/configuration-resolver.error.js +5 -9
  6. package/dist/lib/cjs/errors/configuration-resolver.error.js.map +1 -1
  7. package/dist/lib/cjs/errors/configuration-validation.error.js +1 -5
  8. package/dist/lib/cjs/errors/configuration-validation.error.js.map +1 -1
  9. package/dist/lib/cjs/loaders/loaders.js +19 -0
  10. package/dist/lib/cjs/loaders/loaders.js.map +1 -0
  11. package/dist/lib/cjs/loaders/pristine-config-file.interface.js +3 -0
  12. package/dist/lib/cjs/loaders/pristine-config-file.interface.js.map +1 -0
  13. package/dist/lib/cjs/loaders/pristine-config-file.loader.js +130 -0
  14. package/dist/lib/cjs/loaders/pristine-config-file.loader.js.map +1 -0
  15. package/dist/lib/cjs/managers/configuration.manager.js +82 -14
  16. package/dist/lib/cjs/managers/configuration.manager.js.map +1 -1
  17. package/dist/lib/cjs/parsers/configuration.parser.js +4 -1
  18. package/dist/lib/cjs/parsers/configuration.parser.js.map +1 -1
  19. package/dist/lib/cjs/tsconfig.cjs.tsbuildinfo +1 -1
  20. package/dist/lib/esm/configuration.module.js +1 -0
  21. package/dist/lib/esm/configuration.module.js.map +1 -1
  22. package/dist/lib/esm/errors/configuration-definition-already-exists.error.js +3 -7
  23. package/dist/lib/esm/errors/configuration-definition-already-exists.error.js.map +1 -1
  24. package/dist/lib/esm/errors/configuration-resolver.error.js +6 -10
  25. package/dist/lib/esm/errors/configuration-resolver.error.js.map +1 -1
  26. package/dist/lib/esm/errors/configuration-validation.error.js +2 -6
  27. package/dist/lib/esm/errors/configuration-validation.error.js.map +1 -1
  28. package/dist/lib/esm/loaders/loaders.js +3 -0
  29. package/dist/lib/esm/loaders/loaders.js.map +1 -0
  30. package/dist/lib/esm/loaders/pristine-config-file.interface.js +2 -0
  31. package/dist/lib/esm/loaders/pristine-config-file.interface.js.map +1 -0
  32. package/dist/lib/esm/loaders/pristine-config-file.loader.js +124 -0
  33. package/dist/lib/esm/loaders/pristine-config-file.loader.js.map +1 -0
  34. package/dist/lib/esm/managers/configuration.manager.js +82 -14
  35. package/dist/lib/esm/managers/configuration.manager.js.map +1 -1
  36. package/dist/lib/esm/parsers/configuration.parser.js +4 -1
  37. package/dist/lib/esm/parsers/configuration.parser.js.map +1 -1
  38. package/dist/lib/esm/tsconfig.tsbuildinfo +1 -1
  39. package/dist/types/configuration.module.d.ts +1 -0
  40. package/dist/types/errors/configuration-definition-already-exists.error.d.ts +2 -2
  41. package/dist/types/errors/configuration-resolver.error.d.ts +2 -2
  42. package/dist/types/errors/configuration-validation.error.d.ts +2 -2
  43. package/dist/types/loaders/loaders.d.ts +2 -0
  44. package/dist/types/loaders/pristine-config-file.interface.d.ts +15 -0
  45. package/dist/types/loaders/pristine-config-file.loader.d.ts +47 -0
  46. package/dist/types/managers/configuration.manager.d.ts +34 -8
  47. package/package.json +3 -3
@@ -18,6 +18,7 @@ exports.ConfigurationModule = void 0;
18
18
  const configuration_module_keyname_1 = require("./configuration.module.keyname");
19
19
  __exportStar(require("./errors/errors"), exports);
20
20
  __exportStar(require("./interfaces/interfaces"), exports);
21
+ __exportStar(require("./loaders/loaders"), exports);
21
22
  __exportStar(require("./managers/managers"), exports);
22
23
  __exportStar(require("./parsers/parsers"), exports);
23
24
  __exportStar(require("./resolvers/resolvers"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"configuration.module.js","sourceRoot":"","sources":["../../../src/configuration.module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,iFAA0E;AAE1E,kDAAgC;AAChC,0DAAwC;AACxC,sDAAoC;AACpC,oDAAkC;AAClC,wDAAsC;AACtC,gDAA8B;AAC9B,gDAA8B;AAC9B,iEAA+C;AAElC,QAAA,mBAAmB,GAAoB;IAClD,OAAO,EAAE,yDAA0B;IAEnC,aAAa,EAAE,EAAE;CAClB,CAAA"}
1
+ {"version":3,"file":"configuration.module.js","sourceRoot":"","sources":["../../../src/configuration.module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,iFAA0E;AAE1E,kDAAgC;AAChC,0DAAwC;AACxC,oDAAkC;AAClC,sDAAoC;AACpC,oDAAkC;AAClC,wDAAsC;AACtC,gDAA8B;AAC9B,gDAA8B;AAC9B,iEAA+C;AAElC,QAAA,mBAAmB,GAAoB;IAClD,OAAO,EAAE,yDAA0B;IAEnC,aAAa,EAAE,EAAE;CAClB,CAAA"}
@@ -5,13 +5,9 @@ const common_1 = require("@pristine-ts/common");
5
5
  /**
6
6
  * This Error represents a configuration error when a configuration definition already exists.
7
7
  */
8
- class ConfigurationDefinitionAlreadyExistsError extends common_1.LoggableError {
8
+ class ConfigurationDefinitionAlreadyExistsError extends common_1.PristineError {
9
9
  constructor(message, parameterName) {
10
- super(message, { parameterName });
11
- // Set the prototype explicitly.
12
- // As specified in the documentation in TypeScript
13
- // https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work
14
- Object.setPrototypeOf(this, ConfigurationDefinitionAlreadyExistsError.prototype);
10
+ super(message, { details: { parameterName } });
15
11
  }
16
12
  }
17
13
  exports.ConfigurationDefinitionAlreadyExistsError = ConfigurationDefinitionAlreadyExistsError;
@@ -1 +1 @@
1
- {"version":3,"file":"configuration-definition-already-exists.error.js","sourceRoot":"","sources":["../../../../src/errors/configuration-definition-already-exists.error.ts"],"names":[],"mappings":";;;AAAA,gDAAkD;AAElD;;GAEG;AACH,MAAa,yCAA0C,SAAQ,sBAAa;IAC1E,YAAmB,OAAe,EAAE,aAAqB;QACvD,KAAK,CAAC,OAAO,EAAE,EAAC,aAAa,EAAC,CAAC,CAAC;QAEhC,gCAAgC;QAChC,kDAAkD;QAClD,gIAAgI;QAChI,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,yCAAyC,CAAC,SAAS,CAAC,CAAC;IACnF,CAAC;CACF;AATD,8FASC"}
1
+ {"version":3,"file":"configuration-definition-already-exists.error.js","sourceRoot":"","sources":["../../../../src/errors/configuration-definition-already-exists.error.ts"],"names":[],"mappings":";;;AAAA,gDAAkD;AAElD;;GAEG;AACH,MAAa,yCAA0C,SAAQ,sBAAa;IAC1E,YAAmB,OAAe,EAAE,aAAqB;QACvD,KAAK,CAAC,OAAO,EAAE,EAAC,OAAO,EAAE,EAAC,aAAa,EAAC,EAAC,CAAC,CAAC;IAAE,CAAC;CACjD;AAHD,8FAGC"}
@@ -5,16 +5,12 @@ const common_1 = require("@pristine-ts/common");
5
5
  /**
6
6
  * This Error represents a configuration error when an error occurs in a resolver.
7
7
  */
8
- class ConfigurationResolverError extends common_1.LoggableError {
8
+ class ConfigurationResolverError extends common_1.PristineError {
9
9
  constructor(message, value) {
10
- super(message, {
11
- value,
12
- type: typeof (value),
13
- });
14
- // Set the prototype explicitly.
15
- // As specified in the documentation in TypeScript
16
- // https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work
17
- Object.setPrototypeOf(this, ConfigurationResolverError.prototype);
10
+ super(message, { details: {
11
+ value,
12
+ type: typeof (value),
13
+ } });
18
14
  }
19
15
  }
20
16
  exports.ConfigurationResolverError = ConfigurationResolverError;
@@ -1 +1 @@
1
- {"version":3,"file":"configuration-resolver.error.js","sourceRoot":"","sources":["../../../../src/errors/configuration-resolver.error.ts"],"names":[],"mappings":";;;AAAA,gDAAkD;AAElD;;GAEG;AACH,MAAa,0BAA2B,SAAQ,sBAAa;IAC3D,YAAmB,OAAe,EAAE,KAAU;QAC5C,KAAK,CAAC,OAAO,EAAE;YACb,KAAK;YACL,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC;SACrB,CAAC,CAAC;QAEH,gCAAgC;QAChC,kDAAkD;QAClD,gIAAgI;QAChI,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,0BAA0B,CAAC,SAAS,CAAC,CAAC;IACpE,CAAC;CACF;AAZD,gEAYC"}
1
+ {"version":3,"file":"configuration-resolver.error.js","sourceRoot":"","sources":["../../../../src/errors/configuration-resolver.error.ts"],"names":[],"mappings":";;;AAAA,gDAAkD;AAElD;;GAEG;AACH,MAAa,0BAA2B,SAAQ,sBAAa;IAC3D,YAAmB,OAAe,EAAE,KAAU;QAC5C,KAAK,CAAC,OAAO,EAAE,EAAC,OAAO,EAAE;gBACvB,KAAK;gBACL,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC;aACrB,EAAC,CAAC,CAAC;IAAE,CAAC;CACV;AAND,gEAMC"}
@@ -5,13 +5,9 @@ const common_1 = require("@pristine-ts/common");
5
5
  /**
6
6
  * This Error represents a configuration error when a validation fails.
7
7
  */
8
- class ConfigurationValidationError extends common_1.LoggableError {
8
+ class ConfigurationValidationError extends common_1.PristineError {
9
9
  constructor(messages) {
10
10
  super(messages.join("\n"));
11
- // Set the prototype explicitly.
12
- // As specified in the documentation in TypeScript
13
- // https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work
14
- Object.setPrototypeOf(this, ConfigurationValidationError.prototype);
15
11
  }
16
12
  }
17
13
  exports.ConfigurationValidationError = ConfigurationValidationError;
@@ -1 +1 @@
1
- {"version":3,"file":"configuration-validation.error.js","sourceRoot":"","sources":["../../../../src/errors/configuration-validation.error.ts"],"names":[],"mappings":";;;AAAA,gDAAkD;AAElD;;GAEG;AACH,MAAa,4BAA6B,SAAQ,sBAAa;IAC7D,YAAmB,QAAkB;QACnC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAE3B,gCAAgC;QAChC,kDAAkD;QAClD,gIAAgI;QAChI,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,4BAA4B,CAAC,SAAS,CAAC,CAAC;IACtE,CAAC;CACF;AATD,oEASC"}
1
+ {"version":3,"file":"configuration-validation.error.js","sourceRoot":"","sources":["../../../../src/errors/configuration-validation.error.ts"],"names":[],"mappings":";;;AAAA,gDAAkD;AAElD;;GAEG;AACH,MAAa,4BAA6B,SAAQ,sBAAa;IAC7D,YAAmB,QAAkB;QACnC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAAE,CAAC;CACjC;AAHD,oEAGC"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./pristine-config-file.interface"), exports);
18
+ __exportStar(require("./pristine-config-file.loader"), exports);
19
+ //# sourceMappingURL=loaders.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loaders.js","sourceRoot":"","sources":["../../../../src/loaders/loaders.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mEAAiD;AACjD,gEAA8C"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=pristine-config-file.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pristine-config-file.interface.js","sourceRoot":"","sources":["../../../../src/loaders/pristine-config-file.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,130 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
9
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
10
+ return new (P || (P = Promise))(function (resolve, reject) {
11
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
12
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
13
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
14
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
15
+ });
16
+ };
17
+ var __importDefault = (this && this.__importDefault) || function (mod) {
18
+ return (mod && mod.__esModule) ? mod : { "default": mod };
19
+ };
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.PristineConfigFileLoader = void 0;
22
+ const tsyringe_1 = require("tsyringe");
23
+ const fs_1 = __importDefault(require("fs"));
24
+ const path_1 = __importDefault(require("path"));
25
+ /**
26
+ * Locates and dynamically imports `pristine.config.{ts,js}`. Lives in
27
+ * `@pristine-ts/configuration` so both the configuration manager (reads the `config:`
28
+ * block during kernel boot) and the CLI bootstrap (reads the `cli:` block before the
29
+ * kernel exists) share one walker, one importer, and one cache — avoiding drift between
30
+ * two separate readers seeing different files.
31
+ *
32
+ * **Memoized per absolute path**: once a config file is found at a given path, the
33
+ * parsed object is cached for the process lifetime. Repeated calls from different parts
34
+ * of the codebase (configuration manager, CLI bootstrap, plugin loader) parse the file
35
+ * exactly once.
36
+ *
37
+ * **Optional**: if no file is found, `load()` returns `undefined`. Callers degrade
38
+ * gracefully — the configuration manager falls back to its other resolution sources, the
39
+ * CLI falls back to a `CliModule`-only AppModule.
40
+ */
41
+ let PristineConfigFileLoader = class PristineConfigFileLoader {
42
+ constructor() {
43
+ this.configFileNames = [
44
+ "pristine.config.ts",
45
+ "pristine.config.js",
46
+ ];
47
+ this.cache = new Map();
48
+ /**
49
+ * Wraps Node's real dynamic `import()` so it survives both tsc's CJS lowering and
50
+ * esbuild's bundling. Both otherwise rewrite `await import(x)` into `require(x)`, which
51
+ * fails for ESM-only packages and `file://` URLs. The Function constructor's body is
52
+ * opaque to those transforms, so the `import()` inside it goes through unrewritten.
53
+ */
54
+ this.dynamicImport = new Function("specifier", "return import(specifier);");
55
+ }
56
+ /**
57
+ * Finds the nearest `pristine.config.{ts,js}` walking up from `startDir` (defaults to
58
+ * `process.cwd()`), dynamic-imports it, and returns the parsed object. Returns
59
+ * `undefined` when no file is found anywhere up the directory tree — callers must
60
+ * treat absence as "no overrides," not as an error.
61
+ */
62
+ load() {
63
+ return __awaiter(this, arguments, void 0, function* (startDir = process.cwd()) {
64
+ const filePath = this.findConfigFile(startDir);
65
+ if (filePath === undefined) {
66
+ return undefined;
67
+ }
68
+ const cached = this.cache.get(filePath);
69
+ if (cached !== undefined) {
70
+ return cached;
71
+ }
72
+ const parsed = yield this.importConfigFile(filePath);
73
+ this.cache.set(filePath, parsed);
74
+ return parsed;
75
+ });
76
+ }
77
+ /**
78
+ * Walks up from `startDir` looking for any of the supported config file names. Stops at
79
+ * the first match. Walking up matters in monorepos: a tool invoked in `packages/foo/`
80
+ * should still find a `pristine.config.ts` at the repo root.
81
+ */
82
+ findConfigFile(startDir) {
83
+ let current = path_1.default.resolve(startDir);
84
+ while (true) {
85
+ for (const name of this.configFileNames) {
86
+ const candidate = path_1.default.join(current, name);
87
+ if (fs_1.default.existsSync(candidate) && fs_1.default.statSync(candidate).isFile()) {
88
+ return candidate;
89
+ }
90
+ }
91
+ const parent = path_1.default.dirname(current);
92
+ // path.dirname of root === root; we've hit the filesystem boundary.
93
+ if (parent === current)
94
+ return undefined;
95
+ current = parent;
96
+ }
97
+ }
98
+ /**
99
+ * Loads the config file via the appropriate mechanism for its extension: jiti for `.ts`
100
+ * (in-process TS transform with no build step needed), native dynamic import for `.js`.
101
+ * Extracts the default export, falling back to a named `pristineConfig` export.
102
+ */
103
+ importConfigFile(absolutePath) {
104
+ return __awaiter(this, void 0, void 0, function* () {
105
+ var _a, _b, _c, _d;
106
+ const ext = path_1.default.extname(absolutePath).toLowerCase();
107
+ let loaded;
108
+ if (ext === ".ts") {
109
+ const jitiModule = yield this.dynamicImport("jiti");
110
+ const createJiti = (_b = (_a = jitiModule.default) !== null && _a !== void 0 ? _a : jitiModule.createJiti) !== null && _b !== void 0 ? _b : jitiModule;
111
+ const jiti = createJiti(absolutePath, { interopDefault: true });
112
+ loaded = jiti(absolutePath);
113
+ }
114
+ else {
115
+ loaded = yield this.dynamicImport(`file://${absolutePath}`);
116
+ }
117
+ const parsed = (_d = (_c = loaded === null || loaded === void 0 ? void 0 : loaded.default) !== null && _c !== void 0 ? _c : loaded === null || loaded === void 0 ? void 0 : loaded.pristineConfig) !== null && _d !== void 0 ? _d : loaded;
118
+ if (!parsed || typeof parsed !== "object") {
119
+ throw new Error(`[pristine] Config file at '${absolutePath}' did not export a valid configuration. ` +
120
+ `Use \`export default defineConfig({ ... })\` or \`export const pristineConfig = { ... }\`.`);
121
+ }
122
+ return parsed;
123
+ });
124
+ }
125
+ };
126
+ exports.PristineConfigFileLoader = PristineConfigFileLoader;
127
+ exports.PristineConfigFileLoader = PristineConfigFileLoader = __decorate([
128
+ (0, tsyringe_1.injectable)()
129
+ ], PristineConfigFileLoader);
130
+ //# sourceMappingURL=pristine-config-file.loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pristine-config-file.loader.js","sourceRoot":"","sources":["../../../../src/loaders/pristine-config-file.loader.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,uCAAoC;AACpC,4CAAoB;AACpB,gDAAwB;AAGxB;;;;;;;;;;;;;;;GAeG;AAEI,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IAA9B;QACY,oBAAe,GAA0B;YACxD,oBAAoB;YACpB,oBAAoB;SACrB,CAAC;QAEe,UAAK,GAAG,IAAI,GAAG,EAA8B,CAAC;QAE/D;;;;;WAKG;QACc,kBAAa,GAAwC,IAAI,QAAQ,CAChF,WAAW,EACX,2BAA2B,CACW,CAAC;IA2E3C,CAAC;IAzEC;;;;;OAKG;IACU,IAAI;6DAAC,WAAmB,OAAO,CAAC,GAAG,EAAE;YAChD,MAAM,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;YAC/C,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;gBAC3B,OAAO,SAAS,CAAC;YACnB,CAAC;YAED,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YACxC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;gBACzB,OAAO,MAAM,CAAC;YAChB,CAAC;YAED,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;YACrD,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;YACjC,OAAO,MAAM,CAAC;QAChB,CAAC;KAAA;IAED;;;;OAIG;IACK,cAAc,CAAC,QAAgB;QACrC,IAAI,OAAO,GAAG,cAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAErC,OAAO,IAAI,EAAE,CAAC;YACZ,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;gBAC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,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;gBAC1C,MAAM,IAAI,KAAK,CACb,8BAA8B,YAAY,0CAA0C;oBACpF,4FAA4F,CAC7F,CAAC;YACJ,CAAC;YAED,OAAO,MAA4B,CAAC;QACtC,CAAC;KAAA;CACF,CAAA;AA5FY,4DAAwB;mCAAxB,wBAAwB;IADpC,IAAA,qBAAU,GAAE;GACA,wBAAwB,CA4FpC"}
@@ -23,9 +23,11 @@ const tsyringe_1 = require("tsyringe");
23
23
  const configuration_definition_already_exists_error_1 = require("../errors/configuration-definition-already-exists.error");
24
24
  const configuration_parser_1 = require("../parsers/configuration.parser");
25
25
  const configuration_validation_error_1 = require("../errors/configuration-validation.error");
26
+ const pristine_config_file_loader_1 = require("../loaders/pristine-config-file.loader");
26
27
  let ConfigurationManager = class ConfigurationManager {
27
- constructor(configurationParser) {
28
+ constructor(configurationParser, pristineConfigFileLoader) {
28
29
  this.configurationParser = configurationParser;
30
+ this.pristineConfigFileLoader = pristineConfigFileLoader;
29
31
  this.configurationDefinitions = {};
30
32
  }
31
33
  /**
@@ -41,28 +43,63 @@ let ConfigurationManager = class ConfigurationManager {
41
43
  this.configurationDefinitions[configurationDefinition.parameterName] = configurationDefinition;
42
44
  }
43
45
  /**
44
- * This method loads the configuration values passed dynamically when instantiating the Kernel. This method
45
- * will verify that a corresponding configurationDefinition exists and if it does, it will resolve the value.
46
+ * Loads configuration values into the container using the precedence chain:
46
47
  *
47
- * This method will also check to make sure that all the expected values are being passed. For example, if a module expects
48
- * a configuration value to be passed, this method will throw if none are passed.
48
+ * 1. `moduleConfigurationValues` explicit overrides passed to `kernel.start()`.
49
+ * Highest precedence; wins all conflicts.
50
+ * 2. `pristine.config.ts:config` — values from the user-authored config file.
51
+ * Beats `configDefaults` and the resolver chain.
52
+ * 3. `configDefaults` — merged from every module's `ModuleInterface.configDefaults`.
53
+ * Beats the resolver chain.
54
+ * 4. `configurationDefinition.defaultResolvers` — per-key resolver list (env vars,
55
+ * secrets manager, etc.). First successful resolver wins.
56
+ * 5. `configurationDefinition.defaultValue` — hard fallback.
49
57
  *
50
- * @param moduleConfigurationValues
51
- * @param container
58
+ * Conflicts:
59
+ * - **Same key in `moduleConfigurationValues` and the file** → stderr warning naming
60
+ * both sources (never the value, which may be a secret); the overrides win.
61
+ * - **Unknown key** in any of the explicit sources (overrides / file / configDefaults)
62
+ * → validation error; throws at end of `load`.
63
+ * - **Two modules' `configDefaults` disagree** — handled by the kernel before this
64
+ * method runs (throws at registration). The merged `configDefaults` reaching this
65
+ * method is already conflict-free.
66
+ *
67
+ * @param moduleConfigurationValues Explicit overrides from `kernel.start()`.
68
+ * @param container The DI container to register resolved values into.
69
+ * @param configDefaults Merged `ModuleInterface.configDefaults` from every module in the
70
+ * graph. Optional; defaults to empty.
52
71
  */
53
- load(moduleConfigurationValues, container) {
54
- return __awaiter(this, void 0, void 0, function* () {
72
+ load(moduleConfigurationValues_1, container_1) {
73
+ return __awaiter(this, arguments, void 0, function* (moduleConfigurationValues, container, configDefaults = {}) {
55
74
  const validationErrors = [];
75
+ const fileConfig = yield this.readFileConfigSafely();
76
+ // Build the merged "explicit value" map by precedence, lowest to highest, so each
77
+ // later layer overwrites earlier ones. (1) configDefaults < (2) file < (3) overrides.
78
+ const mergedValues = {};
79
+ for (const key of Object.keys(configDefaults)) {
80
+ mergedValues[key] = configDefaults[key];
81
+ }
82
+ for (const key of Object.keys(fileConfig)) {
83
+ mergedValues[key] = fileConfig[key];
84
+ }
56
85
  for (const key of Object.keys(moduleConfigurationValues)) {
57
- if (moduleConfigurationValues.hasOwnProperty(key) === false) {
58
- continue;
86
+ if (fileConfig.hasOwnProperty(key)) {
87
+ // Warn (never log values — could be secrets). The overrides win regardless.
88
+ process.stderr.write(`[pristine] WARNING: Configuration key '${key}' is set in BOTH:\n` +
89
+ ` - the explicit overrides passed to kernel.start()\n` +
90
+ ` - pristine.config.ts:config\n` +
91
+ `Using the value from the explicit overrides. Set the key in only one place to silence this warning.\n`);
59
92
  }
93
+ mergedValues[key] = moduleConfigurationValues[key];
94
+ }
95
+ // Process every merged value against the registered definitions. Unknown keys land in
96
+ // validationErrors so multiple typos surface in a single throw at the end.
97
+ for (const key of Object.keys(mergedValues)) {
60
98
  if (this.configurationDefinitions.hasOwnProperty(key) === false) {
61
99
  validationErrors.push("There are no ConfigurationDefinition in any of the modules for the following key: '" + key + "'.");
62
100
  continue;
63
101
  }
64
- const moduleConfigurationValue = moduleConfigurationValues[key];
65
- const resolvedConfigurationValue = yield this.configurationParser.resolve(moduleConfigurationValue, container);
102
+ const resolvedConfigurationValue = yield this.configurationParser.resolve(mergedValues[key], container);
66
103
  // Register the configuration in the container
67
104
  this.registerConfigurationValue(key, resolvedConfigurationValue, container);
68
105
  // Remove the configurationDefinition for the key
@@ -148,10 +185,41 @@ let ConfigurationManager = class ConfigurationManager {
148
185
  // Register the configuration in the container
149
186
  container.registerInstance("%" + configurationKey + "%", value);
150
187
  }
188
+ /**
189
+ * Reads the `config:` block from `pristine.config.{ts,js}` (if present). The file is
190
+ * optional — its absence is not an error, just produces an empty map. Failures to
191
+ * parse a present file are also swallowed (and reported via stderr) so misconfigured
192
+ * config files don't take down the whole boot.
193
+ */
194
+ readFileConfigSafely() {
195
+ return __awaiter(this, void 0, void 0, function* () {
196
+ try {
197
+ const parsed = yield this.pristineConfigFileLoader.load();
198
+ if (parsed === undefined) {
199
+ return {};
200
+ }
201
+ const block = parsed.config;
202
+ if (block === undefined || block === null) {
203
+ return {};
204
+ }
205
+ if (typeof block !== "object" || Array.isArray(block)) {
206
+ process.stderr.write(`[pristine] WARNING: pristine.config.ts:config is not a plain object. Ignoring file-based configuration overrides.\n`);
207
+ return {};
208
+ }
209
+ return block;
210
+ }
211
+ catch (error) {
212
+ process.stderr.write(`[pristine] WARNING: Failed to load pristine.config.ts for runtime configuration: ${error.message}\n` +
213
+ `Continuing without file-based configuration overrides.\n`);
214
+ return {};
215
+ }
216
+ });
217
+ }
151
218
  };
152
219
  exports.ConfigurationManager = ConfigurationManager;
153
220
  exports.ConfigurationManager = ConfigurationManager = __decorate([
154
221
  (0, tsyringe_1.injectable)(),
155
- __metadata("design:paramtypes", [configuration_parser_1.ConfigurationParser])
222
+ __metadata("design:paramtypes", [configuration_parser_1.ConfigurationParser,
223
+ pristine_config_file_loader_1.PristineConfigFileLoader])
156
224
  ], ConfigurationManager);
157
225
  //# sourceMappingURL=configuration.manager.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"configuration.manager.js","sourceRoot":"","sources":["../../../../src/managers/configuration.manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyD;AACzD,2HAAkH;AAElH,0EAAoE;AACpE,6FAAsF;AAI/E,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAG/B,YAAoC,mBAAwC;QAAxC,wBAAmB,GAAnB,mBAAmB,CAAqB;QAFrE,6BAAwB,GAA+C,EAAE,CAAC;IAGjF,CAAC;IAED;;;;;OAKG;IACI,QAAQ,CAAC,uBAAgD;QAC9D,IAAI,IAAI,CAAC,wBAAwB,CAAC,cAAc,CAAC,uBAAuB,CAAC,aAAa,CAAC,EAAE,CAAC;YACxF,MAAM,IAAI,yFAAyC,CAAC,iFAAiF,EAAE,uBAAuB,CAAC,aAAa,CAAC,CAAC;QAChL,CAAC;QAED,IAAI,CAAC,wBAAwB,CAAC,uBAAuB,CAAC,aAAa,CAAC,GAAG,uBAAuB,CAAC;IACjG,CAAC;IAED;;;;;;;;;OASG;IACU,IAAI,CAAC,yBAEjB,EAAE,SAA8B;;YAC/B,MAAM,gBAAgB,GAAa,EAAE,CAAC;YAEtC,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,yBAAyB,CAAC,EAAE,CAAC;gBACzD,IAAI,yBAAyB,CAAC,cAAc,CAAC,GAAG,CAAC,KAAK,KAAK,EAAE,CAAC;oBAC5D,SAAS;gBACX,CAAC;gBAED,IAAI,IAAI,CAAC,wBAAwB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I,EAAE,CAAC;gBACnC,SAAS;YACX,CAAC;YAED,IAAI,yBAAyB,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,yBAAyB,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE,CAAC;gBAClG,SAAS;YACX,CAAC;YAED,OAAO,CAAC,IAAI,CAAC;gBACX,aAAa,EAAE,GAAG;gBAClB,mBAAmB,EAAE,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,gBAAgB,CAAC,IAAI,UAAU,CAAC,gBAAgB,CAAC,MAAM,GAAG,CAAC;aAC1G,CAAC,CAAC;QACL,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;;;;;OAMG;IACI,0BAA0B,CAAC,gBAAwB,EAAE,KAAgC,EAAE,SAA8B;QAC1H,8CAA8C;QAC9C,SAAS,CAAC,gBAAgB,CAAC,GAAG,GAAG,gBAAgB,GAAG,GAAG,EAAE,KAAK,CAAC,CAAC;IAClE,CAAC;CACF,CAAA;AA5JY,oDAAoB;+BAApB,oBAAoB;IADhC,IAAA,qBAAU,GAAE;qCAI8C,0CAAmB;GAHjE,oBAAoB,CA4JhC"}
1
+ {"version":3,"file":"configuration.manager.js","sourceRoot":"","sources":["../../../../src/managers/configuration.manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyD;AACzD,2HAAkH;AAElH,0EAAoE;AACpE,6FAAsF;AAEtF,wFAAgF;AAGzE,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAG/B,YACmB,mBAAwC,EACxC,wBAAkD;QADlD,wBAAmB,GAAnB,mBAAmB,CAAqB;QACxC,6BAAwB,GAAxB,wBAAwB,CAA0B;QAJ9D,6BAAwB,GAA+C,EAAE,CAAC;IAMjF,CAAC;IAED;;;;;OAKG;IACI,QAAQ,CAAC,uBAAgD;QAC9D,IAAI,IAAI,CAAC,wBAAwB,CAAC,cAAc,CAAC,uBAAuB,CAAC,aAAa,CAAC,EAAE,CAAC;YACxF,MAA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O,CAAC,MAAM,CAAC,KAAK,CAClB,oFAAqF,KAAe,CAAC,OAAO,IAAI;oBAChH,0DAA0D,CAC3D,CAAC;gBACF,OAAO,EAAE,CAAC;YACZ,CAAC;QACH,CAAC;KAAA;CACF,CAAA;AAzOY,oDAAoB;+BAApB,oBAAoB;IADhC,IAAA,qBAAU,GAAE;qCAK6B,0CAAmB;QACd,sDAAwB;GAL1D,oBAAoB,CAyOhC"}
@@ -39,7 +39,10 @@ let ConfigurationParser = class ConfigurationParser {
39
39
  // If the object is DynamicConfigurationResolverInterface
40
40
  if (dynamicConfigurationResolver.dynamicResolve !== undefined && typeof dynamicConfigurationResolver.dynamicResolve === "function") {
41
41
  let instantiatedClass;
42
- // Resolve the instantiated class from the dependency container based on the injection token provided.
42
+ // ── container.resolve, justified ──────────────────────────────────────────
43
+ // Per CLAUDE.md: framework-internal dynamic resolution. The injection token
44
+ // is data carried on the configuration definition — not known when this parser
45
+ // was constructed and resolvable only at parse time. Standard factory pattern.
43
46
  if (dynamicConfigurationResolver.injectionToken) {
44
47
  instantiatedClass = container.resolve(dynamicConfigurationResolver.injectionToken);
45
48
  }
@@ -1 +1 @@
1
- {"version":3,"file":"configuration.parser.js","sourceRoot":"","sources":["../../../../src/parsers/configuration.parser.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,6FAAsF;AACtF,uCAAyD;AAKlD,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAE9B;;;;;OAKG;IACG,OAAO,CAAC,wBAAkD,EAAE,SAA8B;;YAC9F,0FAA0F;YAC1F,MAAM,aAAa,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAAA;YAErE,gHAAgH;YAChH,IAAI,OAAO,aAAa,KAAK,SAAS,IAAI,OAAO,aAAa,KAAK,QAAQ,IAAI,OAAO,aAAa,KAAK,QAAQ,EAAE,CAAC;gBACjH,OAAO,aAAa,CAAC;YACvB,CAAC;YAED,4IAA4I;YAC5I,IAAI,OA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