@kirha/planner 0.1.4 → 0.1.6
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 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -20853,13 +20853,27 @@ function getSchemaAtPath(schema, path2) {
|
|
|
20853
20853
|
if (!(unwrapped instanceof exports_external.ZodObject)) {
|
|
20854
20854
|
return;
|
|
20855
20855
|
}
|
|
20856
|
-
const
|
|
20857
|
-
const childSchema = shape[segment];
|
|
20856
|
+
const childSchema = getObjectChildSchema(unwrapped, segment);
|
|
20858
20857
|
if (!childSchema) {
|
|
20859
20858
|
return;
|
|
20860
20859
|
}
|
|
20861
20860
|
return getSchemaAtPath(childSchema, remainingPath);
|
|
20862
20861
|
}
|
|
20862
|
+
function getObjectChildSchema(schema, segment) {
|
|
20863
|
+
const shape = schema.shape;
|
|
20864
|
+
const direct = shape[segment];
|
|
20865
|
+
if (direct) {
|
|
20866
|
+
return direct;
|
|
20867
|
+
}
|
|
20868
|
+
const catchall = schema.def.catchall;
|
|
20869
|
+
if (catchall && !(catchall instanceof exports_external.ZodUnknown) && !(catchall instanceof exports_external.ZodAny) && !(catchall instanceof exports_external.ZodNever)) {
|
|
20870
|
+
return catchall;
|
|
20871
|
+
}
|
|
20872
|
+
if (Object.keys(shape).length === 0) {
|
|
20873
|
+
return exports_external.any();
|
|
20874
|
+
}
|
|
20875
|
+
return;
|
|
20876
|
+
}
|
|
20863
20877
|
function unwrapSchema(schema) {
|
|
20864
20878
|
if (schema instanceof exports_external.ZodOptional || schema instanceof exports_external.ZodDefault || schema instanceof exports_external.ZodNullable) {
|
|
20865
20879
|
return unwrapSchema(schema.def.innerType);
|
|
@@ -20869,7 +20883,7 @@ function unwrapSchema(schema) {
|
|
|
20869
20883
|
function isSchemaCompatible(expected, actual) {
|
|
20870
20884
|
const expectedUnwrapped = unwrapSchema(expected);
|
|
20871
20885
|
const actualUnwrapped = unwrapSchema(actual);
|
|
20872
|
-
if (expectedUnwrapped instanceof exports_external.ZodAny) {
|
|
20886
|
+
if (expectedUnwrapped instanceof exports_external.ZodAny || actualUnwrapped instanceof exports_external.ZodAny) {
|
|
20873
20887
|
return true;
|
|
20874
20888
|
}
|
|
20875
20889
|
if (expectedUnwrapped instanceof exports_external.ZodUnion || expectedUnwrapped instanceof exports_external.ZodXor) {
|
|
@@ -20924,6 +20938,7 @@ function isOptionalField(schema) {
|
|
|
20924
20938
|
}
|
|
20925
20939
|
var KNOWN_ZOD_TYPES = [
|
|
20926
20940
|
[exports_external.ZodAny, "any"],
|
|
20941
|
+
[exports_external.ZodUnknown, "any"],
|
|
20927
20942
|
[exports_external.ZodString, "string"],
|
|
20928
20943
|
[exports_external.ZodNumber, "number"],
|
|
20929
20944
|
[exports_external.ZodBoolean, "boolean"],
|