zodvex 0.7.7 → 0.7.8-beta.2

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.
Files changed (51) hide show
  1. package/README.md +30 -10
  2. package/dist/cli/index.js +133 -86
  3. package/dist/cli/index.js.map +1 -1
  4. package/dist/client/index.js +17 -6
  5. package/dist/client/index.js.map +1 -1
  6. package/dist/codegen/index.js +7 -4
  7. package/dist/codegen/index.js.map +1 -1
  8. package/dist/core/index.js +13 -5
  9. package/dist/core/index.js.map +1 -1
  10. package/dist/index.js +13 -5
  11. package/dist/index.js.map +1 -1
  12. package/dist/internal/boundaryHelpers.d.ts +9 -0
  13. package/dist/internal/boundaryHelpers.d.ts.map +1 -1
  14. package/dist/internal/customization.d.ts +27 -1
  15. package/dist/internal/customization.d.ts.map +1 -1
  16. package/dist/internal/db.d.ts +43 -17
  17. package/dist/internal/db.d.ts.map +1 -1
  18. package/dist/internal/init.d.ts +15 -1
  19. package/dist/internal/init.d.ts.map +1 -1
  20. package/dist/internal/rules.d.ts.map +1 -1
  21. package/dist/labs/index.js +122 -78
  22. package/dist/labs/index.js.map +1 -1
  23. package/dist/mini/client/index.js +17 -6
  24. package/dist/mini/client/index.js.map +1 -1
  25. package/dist/mini/index.js +13 -5
  26. package/dist/mini/index.js.map +1 -1
  27. package/dist/mini/react/index.js +23 -13
  28. package/dist/mini/react/index.js.map +1 -1
  29. package/dist/mini/server/index.js +78 -27
  30. package/dist/mini/server/index.js.map +1 -1
  31. package/dist/public/client/zodvexClient.d.ts.map +1 -1
  32. package/dist/public/codegen/zodToSource.d.ts.map +1 -1
  33. package/dist/public/react/hooks.d.ts.map +1 -1
  34. package/dist/public/react/zodvexReactClient.d.ts.map +1 -1
  35. package/dist/public/server/index.d.ts +2 -2
  36. package/dist/public/server/index.d.ts.map +1 -1
  37. package/dist/react/index.js +23 -13
  38. package/dist/react/index.js.map +1 -1
  39. package/dist/server/index.js +78 -27
  40. package/dist/server/index.js.map +1 -1
  41. package/package.json +2 -1
  42. package/src/internal/boundaryHelpers.ts +25 -5
  43. package/src/internal/customization.ts +42 -3
  44. package/src/internal/db.ts +88 -25
  45. package/src/internal/init.ts +40 -5
  46. package/src/internal/rules.ts +19 -11
  47. package/src/public/client/zodvexClient.ts +4 -1
  48. package/src/public/codegen/zodToSource.ts +12 -4
  49. package/src/public/react/hooks.ts +8 -11
  50. package/src/public/react/zodvexReactClient.ts +6 -2
  51. package/src/public/server/index.ts +7 -2
@@ -104,6 +104,7 @@ var ZodvexDecodeError = class extends $ZodError {
104
104
  var warnedPaths = /* @__PURE__ */ new Set();
105
105
  function createBoundaryHelpers(registry, options) {
106
106
  const onDecodeError = options?.onDecodeError ?? "warn";
107
+ const warnWirePreview = options?.warnWirePreview === true;
107
108
  function encodeArgs(ref, args) {
108
109
  if (args == null) return args;
109
110
  const path = resolveFunctionPath(ref);
@@ -130,11 +131,18 @@ function createBoundaryHelpers(registry, options) {
130
131
  if (onDecodeError === "throw") {
131
132
  throw new ZodvexDecodeError(path, result.error.issues, wireResult);
132
133
  }
133
- const preview = JSON.stringify(wireResult);
134
- const truncated = preview.length > 200 ? `${preview.slice(0, 200)}...` : preview;
135
- console.warn(
136
- `[zodvex] Decode failed for ${path}: ${result.error.issues.map((i) => `${i.path.join(".")}: ${i.message}`).join(", ")}. Returning raw wire data. Preview: ${truncated}`
137
- );
134
+ const issueList = result.error.issues.map((i) => `${i.path.join(".")}: ${i.message}`).join(", ");
135
+ let message = `[zodvex] Decode failed for ${path}: ${issueList}. Returning raw wire data.`;
136
+ if (warnWirePreview) {
137
+ let preview = "[unavailable]";
138
+ try {
139
+ preview = JSON.stringify(wireResult) ?? "[unavailable]";
140
+ } catch {
141
+ }
142
+ const truncated = preview.length > 200 ? `${preview.slice(0, 200)}...` : preview;
143
+ message += ` Preview: ${truncated}`;
144
+ }
145
+ console.warn(message);
138
146
  return wireResult;
139
147
  }
140
148
  return { encodeArgs, decodeResult };