agent-contracts 0.22.4 → 0.22.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.
- package/dist/cli.js +20 -3
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +6 -3
- package/dist/index.js +20 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -825,9 +825,12 @@ type GuardrailPolicy = z.infer<typeof GuardrailPolicySchema>;
|
|
|
825
825
|
|
|
826
826
|
type AnyRecord$1 = Record<string, unknown>;
|
|
827
827
|
/**
|
|
828
|
-
*
|
|
829
|
-
*
|
|
830
|
-
*
|
|
828
|
+
* Recursively merge `allOf` arrays in a JSON Schema.
|
|
829
|
+
*
|
|
830
|
+
* Each `allOf` sub-schema is itself resolved first (handling nested
|
|
831
|
+
* `allOf`), then `properties`, `required`, and top-level scalars are
|
|
832
|
+
* merged. After merging, nested property schemas that contain their
|
|
833
|
+
* own `allOf` are also resolved so the output is fully flattened.
|
|
831
834
|
*/
|
|
832
835
|
declare function resolveAllOf(schema: AnyRecord$1): AnyRecord$1;
|
|
833
836
|
|
package/dist/index.js
CHANGED
|
@@ -49373,13 +49373,13 @@ var DslSchema = z15.object({
|
|
|
49373
49373
|
// src/schema/json-schema-utils.ts
|
|
49374
49374
|
function resolveAllOf(schema) {
|
|
49375
49375
|
const allOf = schema["allOf"];
|
|
49376
|
-
if (!Array.isArray(allOf)) return schema;
|
|
49376
|
+
if (!Array.isArray(allOf)) return resolveNestedProperties(schema);
|
|
49377
49377
|
let mergedProperties = {};
|
|
49378
49378
|
let mergedRequired = [];
|
|
49379
49379
|
const mergedTop = {};
|
|
49380
49380
|
for (const sub of allOf) {
|
|
49381
49381
|
if (typeof sub !== "object" || sub === null || Array.isArray(sub)) continue;
|
|
49382
|
-
const subSchema = sub;
|
|
49382
|
+
const subSchema = resolveAllOf(sub);
|
|
49383
49383
|
if (subSchema["properties"] && typeof subSchema["properties"] === "object") {
|
|
49384
49384
|
mergedProperties = {
|
|
49385
49385
|
...mergedProperties,
|
|
@@ -49410,13 +49410,30 @@ function resolveAllOf(schema) {
|
|
|
49410
49410
|
}
|
|
49411
49411
|
const result = { ...mergedTop };
|
|
49412
49412
|
if (Object.keys(mergedProperties).length > 0) {
|
|
49413
|
-
result["properties"] = mergedProperties;
|
|
49413
|
+
result["properties"] = resolvePropertySchemas(mergedProperties);
|
|
49414
49414
|
}
|
|
49415
49415
|
if (mergedRequired.length > 0) {
|
|
49416
49416
|
result["required"] = [...new Set(mergedRequired)];
|
|
49417
49417
|
}
|
|
49418
49418
|
return result;
|
|
49419
49419
|
}
|
|
49420
|
+
function resolveNestedProperties(schema) {
|
|
49421
|
+
const props = schema["properties"];
|
|
49422
|
+
if (!props || typeof props !== "object") return schema;
|
|
49423
|
+
return { ...schema, properties: resolvePropertySchemas(props) };
|
|
49424
|
+
}
|
|
49425
|
+
function resolvePropertySchemas(properties) {
|
|
49426
|
+
const result = {};
|
|
49427
|
+
for (const [key, value] of Object.entries(properties)) {
|
|
49428
|
+
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
49429
|
+
const propSchema = value;
|
|
49430
|
+
result[key] = propSchema["allOf"] ? resolveAllOf(propSchema) : propSchema;
|
|
49431
|
+
} else {
|
|
49432
|
+
result[key] = value;
|
|
49433
|
+
}
|
|
49434
|
+
}
|
|
49435
|
+
return result;
|
|
49436
|
+
}
|
|
49420
49437
|
|
|
49421
49438
|
// src/schema/merge-operators.ts
|
|
49422
49439
|
import { z as z16 } from "zod";
|