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.
- package/README.md +30 -10
- package/dist/cli/index.js +133 -86
- package/dist/cli/index.js.map +1 -1
- package/dist/client/index.js +17 -6
- package/dist/client/index.js.map +1 -1
- package/dist/codegen/index.js +7 -4
- package/dist/codegen/index.js.map +1 -1
- package/dist/core/index.js +13 -5
- package/dist/core/index.js.map +1 -1
- package/dist/index.js +13 -5
- package/dist/index.js.map +1 -1
- package/dist/internal/boundaryHelpers.d.ts +9 -0
- package/dist/internal/boundaryHelpers.d.ts.map +1 -1
- package/dist/internal/customization.d.ts +27 -1
- package/dist/internal/customization.d.ts.map +1 -1
- package/dist/internal/db.d.ts +43 -17
- package/dist/internal/db.d.ts.map +1 -1
- package/dist/internal/init.d.ts +15 -1
- package/dist/internal/init.d.ts.map +1 -1
- package/dist/internal/rules.d.ts.map +1 -1
- package/dist/labs/index.js +122 -78
- package/dist/labs/index.js.map +1 -1
- package/dist/mini/client/index.js +17 -6
- package/dist/mini/client/index.js.map +1 -1
- package/dist/mini/index.js +13 -5
- package/dist/mini/index.js.map +1 -1
- package/dist/mini/react/index.js +23 -13
- package/dist/mini/react/index.js.map +1 -1
- package/dist/mini/server/index.js +78 -27
- package/dist/mini/server/index.js.map +1 -1
- package/dist/public/client/zodvexClient.d.ts.map +1 -1
- package/dist/public/codegen/zodToSource.d.ts.map +1 -1
- package/dist/public/react/hooks.d.ts.map +1 -1
- package/dist/public/react/zodvexReactClient.d.ts.map +1 -1
- package/dist/public/server/index.d.ts +2 -2
- package/dist/public/server/index.d.ts.map +1 -1
- package/dist/react/index.js +23 -13
- package/dist/react/index.js.map +1 -1
- package/dist/server/index.js +78 -27
- package/dist/server/index.js.map +1 -1
- package/package.json +2 -1
- package/src/internal/boundaryHelpers.ts +25 -5
- package/src/internal/customization.ts +42 -3
- package/src/internal/db.ts +88 -25
- package/src/internal/init.ts +40 -5
- package/src/internal/rules.ts +19 -11
- package/src/public/client/zodvexClient.ts +4 -1
- package/src/public/codegen/zodToSource.ts +12 -4
- package/src/public/react/hooks.ts +8 -11
- package/src/public/react/zodvexReactClient.ts +6 -2
- package/src/public/server/index.ts +7 -2
package/dist/core/index.js
CHANGED
|
@@ -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
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
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 };
|