@elizaos/core 1.0.0-alpha.43 → 1.0.0-alpha.45
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 +22 -6
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -4808,16 +4808,32 @@ ZodReadonly.create = (type, params) => {
|
|
|
4808
4808
|
...processCreateParams(params)
|
|
4809
4809
|
});
|
|
4810
4810
|
};
|
|
4811
|
-
function
|
|
4811
|
+
function cleanParams(params, data) {
|
|
4812
|
+
const p = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
|
|
4813
|
+
const p2 = typeof p === "string" ? { message: p } : p;
|
|
4814
|
+
return p2;
|
|
4815
|
+
}
|
|
4816
|
+
function custom(check, _params = {}, fatal) {
|
|
4812
4817
|
if (check)
|
|
4813
4818
|
return ZodAny.create().superRefine((data, ctx) => {
|
|
4814
4819
|
var _a, _b;
|
|
4815
|
-
|
|
4816
|
-
|
|
4817
|
-
|
|
4818
|
-
|
|
4819
|
-
|
|
4820
|
+
const r = check(data);
|
|
4821
|
+
if (r instanceof Promise) {
|
|
4822
|
+
return r.then((r2) => {
|
|
4823
|
+
var _a2, _b2;
|
|
4824
|
+
if (!r2) {
|
|
4825
|
+
const params = cleanParams(_params, data);
|
|
4826
|
+
const _fatal = (_b2 = (_a2 = params.fatal) !== null && _a2 !== void 0 ? _a2 : fatal) !== null && _b2 !== void 0 ? _b2 : true;
|
|
4827
|
+
ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
|
|
4828
|
+
}
|
|
4829
|
+
});
|
|
4820
4830
|
}
|
|
4831
|
+
if (!r) {
|
|
4832
|
+
const params = cleanParams(_params, data);
|
|
4833
|
+
const _fatal = (_b = (_a = params.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;
|
|
4834
|
+
ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
|
|
4835
|
+
}
|
|
4836
|
+
return;
|
|
4821
4837
|
});
|
|
4822
4838
|
return ZodAny.create();
|
|
4823
4839
|
}
|