@elizaos/plugin-telegram 1.0.0-alpha.44 → 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
|
@@ -3837,16 +3837,32 @@ ZodReadonly.create = (type, params) => {
|
|
|
3837
3837
|
...processCreateParams(params)
|
|
3838
3838
|
});
|
|
3839
3839
|
};
|
|
3840
|
-
function
|
|
3840
|
+
function cleanParams(params, data) {
|
|
3841
|
+
const p = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
|
|
3842
|
+
const p2 = typeof p === "string" ? { message: p } : p;
|
|
3843
|
+
return p2;
|
|
3844
|
+
}
|
|
3845
|
+
function custom(check, _params = {}, fatal) {
|
|
3841
3846
|
if (check)
|
|
3842
3847
|
return ZodAny.create().superRefine((data, ctx) => {
|
|
3843
3848
|
var _a, _b;
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
+
const r = check(data);
|
|
3850
|
+
if (r instanceof Promise) {
|
|
3851
|
+
return r.then((r2) => {
|
|
3852
|
+
var _a2, _b2;
|
|
3853
|
+
if (!r2) {
|
|
3854
|
+
const params = cleanParams(_params, data);
|
|
3855
|
+
const _fatal = (_b2 = (_a2 = params.fatal) !== null && _a2 !== void 0 ? _a2 : fatal) !== null && _b2 !== void 0 ? _b2 : true;
|
|
3856
|
+
ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
|
|
3857
|
+
}
|
|
3858
|
+
});
|
|
3859
|
+
}
|
|
3860
|
+
if (!r) {
|
|
3861
|
+
const params = cleanParams(_params, data);
|
|
3862
|
+
const _fatal = (_b = (_a = params.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;
|
|
3863
|
+
ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
|
|
3849
3864
|
}
|
|
3865
|
+
return;
|
|
3850
3866
|
});
|
|
3851
3867
|
return ZodAny.create();
|
|
3852
3868
|
}
|