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