desen-core 1.0.0-draft.2 → 1.0.0-draft.3

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.
@@ -1,5 +1,5 @@
1
1
 
2
2
  
3
- > desen-core@1.0.0-draft.2 build /Users/selmanay/Desktop/desen/packages/core
3
+ > desen-core@1.0.0-draft.3 build /Users/selmanay/Desktop/desen/packages/core
4
4
  > tsc
5
5
 
@@ -38,10 +38,13 @@ const constraintsSpec = zod_1.z.object({
38
38
  // we use a custom z.lazy() that checks the `type` field to
39
39
  // dispatch to the correct schema — avoiding exponential backtracking.
40
40
  exports.nodeSpec = zod_1.z.lazy(() => zod_1.z.any().superRefine((val, ctx) => {
41
+ if (typeof val === "object" && val !== null && typeof val.$ref === "string") {
42
+ return; // Allow remote and local file refs
43
+ }
41
44
  if (typeof val !== "object" || val === null || typeof val.type !== "string") {
42
45
  ctx.addIssue({
43
46
  code: zod_1.z.ZodIssueCode.custom,
44
- message: "Node must be an object with a 'type' string property.",
47
+ message: "Node must be an object with a 'type' string property or a valid '$ref' object.",
45
48
  });
46
49
  return;
47
50
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "desen-core",
3
- "version": "1.0.0-draft.2",
3
+ "version": "1.0.0-draft.3",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "dependencies": {
@@ -50,10 +50,14 @@ const constraintsSpec = z.object({
50
50
  // dispatch to the correct schema — avoiding exponential backtracking.
51
51
  export const nodeSpec: z.ZodType<NodeSpec> = z.lazy(() =>
52
52
  z.any().superRefine((val, ctx) => {
53
+ if (typeof val === "object" && val !== null && typeof val.$ref === "string") {
54
+ return; // Allow remote and local file refs
55
+ }
56
+
53
57
  if (typeof val !== "object" || val === null || typeof val.type !== "string") {
54
58
  ctx.addIssue({
55
59
  code: z.ZodIssueCode.custom,
56
- message: "Node must be an object with a 'type' string property.",
60
+ message: "Node must be an object with a 'type' string property or a valid '$ref' object.",
57
61
  });
58
62
  return;
59
63
  }