@stll/agent-input 0.1.0 → 0.1.2
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/dist/index.js +18 -11
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1607,15 +1607,17 @@ const normalizeLeaf = ({ annotation, path, readers, schema, value }) => {
|
|
|
1607
1607
|
case "locale": return normalizeLocale(value);
|
|
1608
1608
|
case "number": {
|
|
1609
1609
|
const locale = annotation.locale;
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1610
|
+
const types = isUnknownArray(schema["type"]) ? schema["type"] : [schema["type"]];
|
|
1611
|
+
if (annotation.range === "clamp") return normalizeNumberInRange(value, {
|
|
1612
|
+
minimum: numericKeyword(schema, "minimum"),
|
|
1613
|
+
maximum: numericKeyword(schema, "maximum"),
|
|
1614
|
+
integer: types.includes("integer"),
|
|
1615
|
+
...locale === void 0 ? {} : { locale }
|
|
1616
|
+
});
|
|
1617
|
+
if (types.includes("integer")) return normalizeNumberInRange(value, {
|
|
1618
|
+
integer: true,
|
|
1619
|
+
...locale === void 0 ? {} : { locale }
|
|
1620
|
+
});
|
|
1619
1621
|
return normalizeNumber(value, locale === void 0 ? void 0 : { locale });
|
|
1620
1622
|
}
|
|
1621
1623
|
case "string-list": return normalizeStringList(value, { split: "never" });
|
|
@@ -1835,7 +1837,7 @@ const childSchemasOf = (schema, key) => {
|
|
|
1835
1837
|
const properties = schema["properties"];
|
|
1836
1838
|
const patternProperties = schema["patternProperties"];
|
|
1837
1839
|
const childSchemas = [];
|
|
1838
|
-
if (isRecord(properties) && key
|
|
1840
|
+
if (isRecord(properties) && Object.hasOwn(properties, key)) childSchemas.push(properties[key]);
|
|
1839
1841
|
if (isRecord(patternProperties)) {
|
|
1840
1842
|
for (const [pattern, childSchema] of Object.entries(patternProperties)) if (new RegExp(pattern, "u").test(key)) childSchemas.push(childSchema);
|
|
1841
1843
|
}
|
|
@@ -1878,7 +1880,12 @@ const walkObject = ({ schema, value, path, context }) => {
|
|
|
1878
1880
|
notes.push(...child.notes);
|
|
1879
1881
|
}
|
|
1880
1882
|
}
|
|
1881
|
-
if (reading.status === "value") output
|
|
1883
|
+
if (reading.status === "value") Object.defineProperty(output, key, {
|
|
1884
|
+
value: reading.value,
|
|
1885
|
+
enumerable: true,
|
|
1886
|
+
configurable: true,
|
|
1887
|
+
writable: true
|
|
1888
|
+
});
|
|
1882
1889
|
}
|
|
1883
1890
|
return issues.length > 0 ? {
|
|
1884
1891
|
status: "invalid",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stll/agent-input",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Lenient readers for values agents write: dates, date bounds, date-format specs, numbers, booleans, locales, countries, enum and vocabulary values, ids, ELIs, string lists",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"build": "tsdown",
|
|
42
42
|
"pack:dry-run": "bun pm pack --dry-run",
|
|
43
43
|
"test": "bun test src",
|
|
44
|
-
"test:property": "bun test --preload @stll/property-testing/preload $(grep -
|
|
44
|
+
"test:property": "bun test --preload @stll/property-testing/preload $(grep -rlE 'fc\\.assert|assertProperty' src --include='*.test.ts')",
|
|
45
45
|
"typecheck": "bun ../../packages/scripts/src/tsc-native.ts --noEmit",
|
|
46
46
|
"lint": "cd ../.. && bun --bun oxlint -c oxlint.config.ts --report-unused-disable-directives-severity=error --type-aware --type-check packages/agent-input",
|
|
47
47
|
"lint:fix": "cd ../.. && bun --bun oxlint -c oxlint.config.ts --type-aware --fix packages/agent-input",
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@stll/country-codes": "^0.2.0",
|
|
53
|
-
"@stll/template-conditions": "^0.6.
|
|
54
|
-
"@stll/text-normalize": "^0.1.
|
|
53
|
+
"@stll/template-conditions": "^0.6.3",
|
|
54
|
+
"@stll/text-normalize": "^0.1.1",
|
|
55
55
|
"@stll/time": "^0.1.0",
|
|
56
56
|
"better-result": "3.0.1"
|
|
57
57
|
},
|