@shrkcrft/config 0.1.0-alpha.15 → 0.1.0-alpha.17
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-validator.d.ts","sourceRoot":"","sources":["../src/config-validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEhE,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;CAC/B;AAED,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,qBAAqB,EAAE,CAAC;CACjC;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,iBAAiB,GAAG,sBAAsB,
|
|
1
|
+
{"version":3,"file":"config-validator.d.ts","sourceRoot":"","sources":["../src/config-validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEhE,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;CAC/B;AAED,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,qBAAqB,EAAE,CAAC;CACjC;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,iBAAiB,GAAG,sBAAsB,CAgChF"}
|
package/dist/config-validator.js
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
export function validateConfig(config) {
|
|
2
|
+
// Defensive: a malformed config file can deserialize to null / a non-object.
|
|
3
|
+
// Report it as a single root error instead of throwing on `config.<field>`.
|
|
4
|
+
if (config === null || typeof config !== 'object') {
|
|
5
|
+
return {
|
|
6
|
+
valid: false,
|
|
7
|
+
issues: [{ field: '<root>', message: 'config must be an object', severity: 'error' }],
|
|
8
|
+
};
|
|
9
|
+
}
|
|
2
10
|
const issues = [];
|
|
3
11
|
if (config.defaultMaxTokens !== undefined && config.defaultMaxTokens <= 0) {
|
|
4
12
|
issues.push({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shrkcrft/config",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.17",
|
|
4
4
|
"description": "SharkCraft config loader: sharkcraft.config.ts discovery, defaults, zod-validated schema.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "SharkCraft contributors",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"typecheck": "tsc --noEmit -p tsconfig.json"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@shrkcrft/core": "^0.1.0-alpha.
|
|
46
|
+
"@shrkcrft/core": "^0.1.0-alpha.17",
|
|
47
47
|
"zod": "^3.25.0 || ^4.0.0"
|
|
48
48
|
},
|
|
49
49
|
"publishConfig": {
|