@orkestrel/contract 0.0.18 → 0.0.19
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/src/core/index.cjs +30 -1
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.js +30 -1
- package/dist/src/core/index.js.map +1 -1
- package/package.json +10 -10
package/dist/src/core/index.cjs
CHANGED
|
@@ -9900,7 +9900,36 @@ var SchemaShaper = class SchemaShaper {
|
|
|
9900
9900
|
}
|
|
9901
9901
|
if (variants.length > 0) return INTRINSICS.reflect.apply(unionShape, void 0, variants);
|
|
9902
9902
|
}
|
|
9903
|
-
const
|
|
9903
|
+
const category = schema.type;
|
|
9904
|
+
if (isArray(category)) {
|
|
9905
|
+
const members = [];
|
|
9906
|
+
const seen = collectMembers([]);
|
|
9907
|
+
for (let index = 0; index < category.length; index += 1) {
|
|
9908
|
+
const member = parseEnum(category[index], JSON_SCHEMA_TYPES);
|
|
9909
|
+
if (member === void 0) return rawShape(description === void 0 ? {} : { description });
|
|
9910
|
+
if (matchesMember(seen, member)) continue;
|
|
9911
|
+
admitMember(seen, member);
|
|
9912
|
+
members[members.length] = member;
|
|
9913
|
+
}
|
|
9914
|
+
if (members.length === 0 || members.length > 256) return rawShape(description === void 0 ? {} : { description });
|
|
9915
|
+
const variants = [];
|
|
9916
|
+
for (let index = 0; index < members.length; index += 1) {
|
|
9917
|
+
const member = members[index];
|
|
9918
|
+
if (member === void 0) continue;
|
|
9919
|
+
variants[variants.length] = this.#build({
|
|
9920
|
+
...schema,
|
|
9921
|
+
type: member
|
|
9922
|
+
}, depth);
|
|
9923
|
+
}
|
|
9924
|
+
const first = variants[0];
|
|
9925
|
+
if (variants.length === 1 && first !== void 0) return first;
|
|
9926
|
+
const union = INTRINSICS.reflect.apply(unionShape, void 0, variants);
|
|
9927
|
+
return description === void 0 ? union : INTRINSICS.freeze({
|
|
9928
|
+
...union,
|
|
9929
|
+
description
|
|
9930
|
+
});
|
|
9931
|
+
}
|
|
9932
|
+
const type = isString(category) ? schema.type : void 0;
|
|
9904
9933
|
if (type === "string") return stringShape({
|
|
9905
9934
|
...deriveLengthBounds(schema.minLength, schema.maxLength),
|
|
9906
9935
|
...description === void 0 ? {} : { description }
|