@wecode-ai/weibo-openclaw-plugin 2.2.3 → 2.2.4
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/node_modules/tar/dist/commonjs/index.min.js +3 -3
- package/node_modules/tar/dist/commonjs/index.min.js.map +3 -3
- package/node_modules/tar/dist/commonjs/pack.d.ts +3 -1
- package/node_modules/tar/dist/commonjs/pack.d.ts.map +1 -1
- package/node_modules/tar/dist/commonjs/pack.js +33 -7
- package/node_modules/tar/dist/commonjs/pack.js.map +1 -1
- package/node_modules/tar/dist/esm/index.min.js +3 -3
- package/node_modules/tar/dist/esm/index.min.js.map +3 -3
- package/node_modules/tar/dist/esm/pack.d.ts +3 -1
- package/node_modules/tar/dist/esm/pack.d.ts.map +1 -1
- package/node_modules/tar/dist/esm/pack.js +33 -7
- package/node_modules/tar/dist/esm/pack.js.map +1 -1
- package/node_modules/tar/package.json +4 -4
- package/node_modules/zod/README.md +1 -18
- package/node_modules/zod/locales/package.json +2 -1
- package/node_modules/zod/mini/package.json +2 -1
- package/node_modules/zod/package.json +1 -1
- package/node_modules/zod/src/v3/tests/all-errors.test.ts +3 -3
- package/node_modules/zod/src/v3/tests/object.test.ts +5 -5
- package/node_modules/zod/src/v3/tests/partials.test.ts +3 -3
- package/node_modules/zod/src/v4/classic/errors.ts +2 -2
- package/node_modules/zod/src/v4/classic/external.ts +1 -0
- package/node_modules/zod/src/v4/classic/from-json-schema.ts +39 -23
- package/node_modules/zod/src/v4/classic/parse.ts +6 -6
- package/node_modules/zod/src/v4/classic/schemas.ts +414 -151
- package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +6 -0
- package/node_modules/zod/src/v4/classic/tests/catch.test.ts +50 -0
- package/node_modules/zod/src/v4/classic/tests/codec.test.ts +142 -1
- package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +1 -1
- package/node_modules/zod/src/v4/classic/tests/datetime.test.ts +1 -1
- package/node_modules/zod/src/v4/classic/tests/default.test.ts +44 -0
- package/node_modules/zod/src/v4/classic/tests/detached-methods.test.ts +197 -0
- package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +34 -1
- package/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +214 -2
- package/node_modules/zod/src/v4/classic/tests/from-json-schema.test.ts +161 -0
- package/node_modules/zod/src/v4/classic/tests/function.test.ts +6 -6
- package/node_modules/zod/src/v4/classic/tests/global-config.test.ts +39 -0
- package/node_modules/zod/src/v4/classic/tests/index.test.ts +2 -2
- package/node_modules/zod/src/v4/classic/tests/jitless-allows-eval.test.ts +46 -0
- package/node_modules/zod/src/v4/classic/tests/locales_ka.test.ts +29 -0
- package/node_modules/zod/src/v4/classic/tests/locales_ro.test.ts +24 -0
- package/node_modules/zod/src/v4/classic/tests/number.test.ts +55 -0
- package/node_modules/zod/src/v4/classic/tests/object.test.ts +83 -6
- package/node_modules/zod/src/v4/classic/tests/optional.test.ts +114 -4
- package/node_modules/zod/src/v4/classic/tests/partial.test.ts +24 -1
- package/node_modules/zod/src/v4/classic/tests/prefault.test.ts +1 -1
- package/node_modules/zod/src/v4/classic/tests/preprocess-types.test.ts +26 -0
- package/node_modules/zod/src/v4/classic/tests/preprocess.test.ts +69 -0
- package/node_modules/zod/src/v4/classic/tests/record.test.ts +85 -0
- package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +49 -0
- package/node_modules/zod/src/v4/classic/tests/refine.test.ts +63 -0
- package/node_modules/zod/src/v4/classic/tests/string.test.ts +50 -1
- package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +4 -4
- package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +150 -15
- package/node_modules/zod/src/v4/classic/tests/transform.test.ts +17 -0
- package/node_modules/zod/src/v4/classic/tests/tuple.test.ts +315 -2
- package/node_modules/zod/src/v4/classic/tests/union.test.ts +54 -0
- package/node_modules/zod/src/v4/core/api.ts +31 -6
- package/node_modules/zod/src/v4/core/checks.ts +1 -1
- package/node_modules/zod/src/v4/core/core.ts +17 -2
- package/node_modules/zod/src/v4/core/errors.ts +31 -24
- package/node_modules/zod/src/v4/core/json-schema-processors.ts +17 -18
- package/node_modules/zod/src/v4/core/parse.ts +7 -7
- package/node_modules/zod/src/v4/core/regexes.ts +8 -1
- package/node_modules/zod/src/v4/core/schemas.ts +263 -71
- package/node_modules/zod/src/v4/core/tests/locales/el.test.ts +215 -0
- package/node_modules/zod/src/v4/core/tests/locales/fr.test.ts +72 -0
- package/node_modules/zod/src/v4/core/tests/locales/hr.test.ts +163 -0
- package/node_modules/zod/src/v4/core/tests/locales/uz.test.ts +22 -0
- package/node_modules/zod/src/v4/core/tests/record-constructor.test.ts +58 -0
- package/node_modules/zod/src/v4/core/to-json-schema.ts +10 -1
- package/node_modules/zod/src/v4/core/util.ts +52 -35
- package/node_modules/zod/src/v4/core/versions.ts +2 -2
- package/node_modules/zod/src/v4/locales/el.ts +121 -0
- package/node_modules/zod/src/v4/locales/en.ts +4 -0
- package/node_modules/zod/src/v4/locales/fr.ts +24 -8
- package/node_modules/zod/src/v4/locales/hr.ts +131 -0
- package/node_modules/zod/src/v4/locales/index.ts +3 -0
- package/node_modules/zod/src/v4/locales/it.ts +1 -1
- package/node_modules/zod/src/v4/locales/ka.ts +8 -8
- package/node_modules/zod/src/v4/locales/ro.ts +129 -0
- package/node_modules/zod/src/v4/locales/uz.ts +1 -0
- package/node_modules/zod/src/v4/mini/external.ts +1 -0
- package/node_modules/zod/src/v4/mini/schemas.ts +56 -25
- package/node_modules/zod/src/v4/mini/tests/codec.test.ts +19 -0
- package/node_modules/zod/src/v4/mini/tests/index.test.ts +32 -2
- package/node_modules/zod/src/v4/mini/tests/object.test.ts +9 -9
- package/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +51 -1
- package/node_modules/zod/src/v4/mini/tests/string.test.ts +5 -0
- package/node_modules/zod/v3/package.json +2 -1
- package/node_modules/zod/v4/classic/errors.js +2 -2
- package/node_modules/zod/v4/classic/external.d.cts +1 -0
- package/node_modules/zod/v4/classic/external.d.ts +1 -0
- package/node_modules/zod/v4/classic/from-json-schema.cjs +31 -16
- package/node_modules/zod/v4/classic/from-json-schema.js +31 -16
- package/node_modules/zod/v4/classic/package.json +2 -1
- package/node_modules/zod/v4/classic/schemas.cjs +358 -119
- package/node_modules/zod/v4/classic/schemas.d.cts +42 -14
- package/node_modules/zod/v4/classic/schemas.d.ts +42 -14
- package/node_modules/zod/v4/classic/schemas.js +356 -118
- package/node_modules/zod/v4/core/api.cjs +7 -2
- package/node_modules/zod/v4/core/api.d.cts +26 -5
- package/node_modules/zod/v4/core/api.d.ts +26 -5
- package/node_modules/zod/v4/core/api.js +7 -2
- package/node_modules/zod/v4/core/checks.d.cts +1 -1
- package/node_modules/zod/v4/core/checks.d.ts +1 -1
- package/node_modules/zod/v4/core/core.cjs +3 -1
- package/node_modules/zod/v4/core/core.js +4 -2
- package/node_modules/zod/v4/core/errors.cjs +26 -23
- package/node_modules/zod/v4/core/errors.d.cts +1 -0
- package/node_modules/zod/v4/core/errors.d.ts +1 -0
- package/node_modules/zod/v4/core/errors.js +26 -23
- package/node_modules/zod/v4/core/json-schema-processors.cjs +16 -20
- package/node_modules/zod/v4/core/json-schema-processors.js +16 -20
- package/node_modules/zod/v4/core/package.json +2 -1
- package/node_modules/zod/v4/core/parse.cjs +7 -7
- package/node_modules/zod/v4/core/parse.js +7 -7
- package/node_modules/zod/v4/core/regexes.cjs +9 -3
- package/node_modules/zod/v4/core/regexes.d.cts +6 -0
- package/node_modules/zod/v4/core/regexes.d.ts +6 -0
- package/node_modules/zod/v4/core/regexes.js +7 -1
- package/node_modules/zod/v4/core/schemas.cjs +211 -65
- package/node_modules/zod/v4/core/schemas.d.cts +39 -1
- package/node_modules/zod/v4/core/schemas.d.ts +39 -1
- package/node_modules/zod/v4/core/schemas.js +210 -64
- package/node_modules/zod/v4/core/to-json-schema.cjs +12 -1
- package/node_modules/zod/v4/core/to-json-schema.js +12 -1
- package/node_modules/zod/v4/core/util.cjs +54 -30
- package/node_modules/zod/v4/core/util.d.cts +1 -0
- package/node_modules/zod/v4/core/util.d.ts +1 -0
- package/node_modules/zod/v4/core/util.js +55 -32
- package/node_modules/zod/v4/core/versions.cjs +2 -2
- package/node_modules/zod/v4/core/versions.d.cts +1 -1
- package/node_modules/zod/v4/core/versions.d.ts +1 -1
- package/node_modules/zod/v4/core/versions.js +2 -2
- package/node_modules/zod/v4/locales/el.cjs +136 -0
- package/node_modules/zod/v4/locales/el.d.cts +5 -0
- package/node_modules/zod/v4/locales/el.d.ts +4 -0
- package/node_modules/zod/v4/locales/el.js +109 -0
- package/node_modules/zod/v4/locales/en.cjs +4 -0
- package/node_modules/zod/v4/locales/en.js +4 -0
- package/node_modules/zod/v4/locales/fr.cjs +24 -7
- package/node_modules/zod/v4/locales/fr.js +24 -7
- package/node_modules/zod/v4/locales/hr.cjs +149 -0
- package/node_modules/zod/v4/locales/hr.d.cts +5 -0
- package/node_modules/zod/v4/locales/hr.d.ts +4 -0
- package/node_modules/zod/v4/locales/hr.js +122 -0
- package/node_modules/zod/v4/locales/index.cjs +8 -1
- package/node_modules/zod/v4/locales/index.d.cts +3 -0
- package/node_modules/zod/v4/locales/index.d.ts +3 -0
- package/node_modules/zod/v4/locales/index.js +3 -0
- package/node_modules/zod/v4/locales/it.cjs +1 -1
- package/node_modules/zod/v4/locales/it.js +1 -1
- package/node_modules/zod/v4/locales/ka.cjs +8 -8
- package/node_modules/zod/v4/locales/ka.js +8 -8
- package/node_modules/zod/v4/locales/package.json +2 -1
- package/node_modules/zod/v4/locales/ro.cjs +146 -0
- package/node_modules/zod/v4/locales/ro.d.cts +5 -0
- package/node_modules/zod/v4/locales/ro.d.ts +4 -0
- package/node_modules/zod/v4/locales/ro.js +119 -0
- package/node_modules/zod/v4/locales/uz.cjs +1 -0
- package/node_modules/zod/v4/locales/uz.js +1 -0
- package/node_modules/zod/v4/mini/external.d.cts +1 -0
- package/node_modules/zod/v4/mini/external.d.ts +1 -0
- package/node_modules/zod/v4/mini/package.json +2 -1
- package/node_modules/zod/v4/mini/schemas.cjs +41 -4
- package/node_modules/zod/v4/mini/schemas.d.cts +28 -10
- package/node_modules/zod/v4/mini/schemas.d.ts +28 -10
- package/node_modules/zod/v4/mini/schemas.js +40 -4
- package/node_modules/zod/v4/package.json +2 -1
- package/node_modules/zod/v4-mini/package.json +2 -1
- package/package.json +2 -1
- package/src/accounts.js +1 -1
- package/src/accounts.js.map +1 -1
- package/src/channel.js +1 -1
- package/src/channel.js.map +1 -1
- package/src/outbound.d.ts.map +1 -1
- package/src/outbound.js +82 -4
- package/src/outbound.js.map +1 -1
- package/src/send.d.ts +23 -0
- package/src/send.d.ts.map +1 -1
- package/src/send.js +54 -2
- package/src/send.js.map +1 -1
- package/src/token.d.ts +8 -0
- package/src/token.d.ts.map +1 -1
- package/src/token.js +16 -1
- package/src/token.js.map +1 -1
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.default = default_1;
|
|
27
|
+
const util = __importStar(require("../core/util.cjs"));
|
|
28
|
+
const error = () => {
|
|
29
|
+
const Sizable = {
|
|
30
|
+
string: { unit: "caractere", verb: "să aibă" },
|
|
31
|
+
file: { unit: "octeți", verb: "să aibă" },
|
|
32
|
+
array: { unit: "elemente", verb: "să aibă" },
|
|
33
|
+
set: { unit: "elemente", verb: "să aibă" },
|
|
34
|
+
map: { unit: "intrări", verb: "să aibă" },
|
|
35
|
+
};
|
|
36
|
+
function getSizing(origin) {
|
|
37
|
+
return Sizable[origin] ?? null;
|
|
38
|
+
}
|
|
39
|
+
const FormatDictionary = {
|
|
40
|
+
regex: "intrare",
|
|
41
|
+
email: "adresă de email",
|
|
42
|
+
url: "URL",
|
|
43
|
+
emoji: "emoji",
|
|
44
|
+
uuid: "UUID",
|
|
45
|
+
uuidv4: "UUIDv4",
|
|
46
|
+
uuidv6: "UUIDv6",
|
|
47
|
+
nanoid: "nanoid",
|
|
48
|
+
guid: "GUID",
|
|
49
|
+
cuid: "cuid",
|
|
50
|
+
cuid2: "cuid2",
|
|
51
|
+
ulid: "ULID",
|
|
52
|
+
xid: "XID",
|
|
53
|
+
ksuid: "KSUID",
|
|
54
|
+
datetime: "dată și oră ISO",
|
|
55
|
+
date: "dată ISO",
|
|
56
|
+
time: "oră ISO",
|
|
57
|
+
duration: "durată ISO",
|
|
58
|
+
ipv4: "adresă IPv4",
|
|
59
|
+
ipv6: "adresă IPv6",
|
|
60
|
+
mac: "adresă MAC",
|
|
61
|
+
cidrv4: "interval IPv4",
|
|
62
|
+
cidrv6: "interval IPv6",
|
|
63
|
+
base64: "șir codat base64",
|
|
64
|
+
base64url: "șir codat base64url",
|
|
65
|
+
json_string: "șir JSON",
|
|
66
|
+
e164: "număr E.164",
|
|
67
|
+
jwt: "JWT",
|
|
68
|
+
template_literal: "intrare",
|
|
69
|
+
};
|
|
70
|
+
const TypeDictionary = {
|
|
71
|
+
nan: "NaN",
|
|
72
|
+
string: "șir",
|
|
73
|
+
number: "număr",
|
|
74
|
+
boolean: "boolean",
|
|
75
|
+
function: "funcție",
|
|
76
|
+
array: "matrice",
|
|
77
|
+
object: "obiect",
|
|
78
|
+
undefined: "nedefinit",
|
|
79
|
+
symbol: "simbol",
|
|
80
|
+
bigint: "număr mare",
|
|
81
|
+
void: "void",
|
|
82
|
+
never: "never",
|
|
83
|
+
map: "hartă",
|
|
84
|
+
set: "set",
|
|
85
|
+
};
|
|
86
|
+
return (issue) => {
|
|
87
|
+
switch (issue.code) {
|
|
88
|
+
case "invalid_type": {
|
|
89
|
+
const expected = TypeDictionary[issue.expected] ?? issue.expected;
|
|
90
|
+
const receivedType = util.parsedType(issue.input);
|
|
91
|
+
const received = TypeDictionary[receivedType] ?? receivedType;
|
|
92
|
+
return `Intrare invalidă: așteptat ${expected}, primit ${received}`;
|
|
93
|
+
}
|
|
94
|
+
case "invalid_value":
|
|
95
|
+
if (issue.values.length === 1)
|
|
96
|
+
return `Intrare invalidă: așteptat ${util.stringifyPrimitive(issue.values[0])}`;
|
|
97
|
+
return `Opțiune invalidă: așteptat una dintre ${util.joinValues(issue.values, "|")}`;
|
|
98
|
+
case "too_big": {
|
|
99
|
+
const adj = issue.inclusive ? "<=" : "<";
|
|
100
|
+
const sizing = getSizing(issue.origin);
|
|
101
|
+
if (sizing)
|
|
102
|
+
return `Prea mare: așteptat ca ${issue.origin ?? "valoarea"} ${sizing.verb} ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elemente"}`;
|
|
103
|
+
return `Prea mare: așteptat ca ${issue.origin ?? "valoarea"} să fie ${adj}${issue.maximum.toString()}`;
|
|
104
|
+
}
|
|
105
|
+
case "too_small": {
|
|
106
|
+
const adj = issue.inclusive ? ">=" : ">";
|
|
107
|
+
const sizing = getSizing(issue.origin);
|
|
108
|
+
if (sizing) {
|
|
109
|
+
return `Prea mic: așteptat ca ${issue.origin} ${sizing.verb} ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
|
110
|
+
}
|
|
111
|
+
return `Prea mic: așteptat ca ${issue.origin} să fie ${adj}${issue.minimum.toString()}`;
|
|
112
|
+
}
|
|
113
|
+
case "invalid_format": {
|
|
114
|
+
const _issue = issue;
|
|
115
|
+
if (_issue.format === "starts_with") {
|
|
116
|
+
return `Șir invalid: trebuie să înceapă cu "${_issue.prefix}"`;
|
|
117
|
+
}
|
|
118
|
+
if (_issue.format === "ends_with")
|
|
119
|
+
return `Șir invalid: trebuie să se termine cu "${_issue.suffix}"`;
|
|
120
|
+
if (_issue.format === "includes")
|
|
121
|
+
return `Șir invalid: trebuie să includă "${_issue.includes}"`;
|
|
122
|
+
if (_issue.format === "regex")
|
|
123
|
+
return `Șir invalid: trebuie să se potrivească cu modelul ${_issue.pattern}`;
|
|
124
|
+
return `Format invalid: ${FormatDictionary[_issue.format] ?? issue.format}`;
|
|
125
|
+
}
|
|
126
|
+
case "not_multiple_of":
|
|
127
|
+
return `Număr invalid: trebuie să fie multiplu de ${issue.divisor}`;
|
|
128
|
+
case "unrecognized_keys":
|
|
129
|
+
return `Chei nerecunoscute: ${util.joinValues(issue.keys, ", ")}`;
|
|
130
|
+
case "invalid_key":
|
|
131
|
+
return `Cheie invalidă în ${issue.origin}`;
|
|
132
|
+
case "invalid_union":
|
|
133
|
+
return "Intrare invalidă";
|
|
134
|
+
case "invalid_element":
|
|
135
|
+
return `Valoare invalidă în ${issue.origin}`;
|
|
136
|
+
default:
|
|
137
|
+
return `Intrare invalidă`;
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
function default_1() {
|
|
142
|
+
return {
|
|
143
|
+
localeError: error(),
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import * as util from "../core/util.js";
|
|
2
|
+
const error = () => {
|
|
3
|
+
const Sizable = {
|
|
4
|
+
string: { unit: "caractere", verb: "să aibă" },
|
|
5
|
+
file: { unit: "octeți", verb: "să aibă" },
|
|
6
|
+
array: { unit: "elemente", verb: "să aibă" },
|
|
7
|
+
set: { unit: "elemente", verb: "să aibă" },
|
|
8
|
+
map: { unit: "intrări", verb: "să aibă" },
|
|
9
|
+
};
|
|
10
|
+
function getSizing(origin) {
|
|
11
|
+
return Sizable[origin] ?? null;
|
|
12
|
+
}
|
|
13
|
+
const FormatDictionary = {
|
|
14
|
+
regex: "intrare",
|
|
15
|
+
email: "adresă de email",
|
|
16
|
+
url: "URL",
|
|
17
|
+
emoji: "emoji",
|
|
18
|
+
uuid: "UUID",
|
|
19
|
+
uuidv4: "UUIDv4",
|
|
20
|
+
uuidv6: "UUIDv6",
|
|
21
|
+
nanoid: "nanoid",
|
|
22
|
+
guid: "GUID",
|
|
23
|
+
cuid: "cuid",
|
|
24
|
+
cuid2: "cuid2",
|
|
25
|
+
ulid: "ULID",
|
|
26
|
+
xid: "XID",
|
|
27
|
+
ksuid: "KSUID",
|
|
28
|
+
datetime: "dată și oră ISO",
|
|
29
|
+
date: "dată ISO",
|
|
30
|
+
time: "oră ISO",
|
|
31
|
+
duration: "durată ISO",
|
|
32
|
+
ipv4: "adresă IPv4",
|
|
33
|
+
ipv6: "adresă IPv6",
|
|
34
|
+
mac: "adresă MAC",
|
|
35
|
+
cidrv4: "interval IPv4",
|
|
36
|
+
cidrv6: "interval IPv6",
|
|
37
|
+
base64: "șir codat base64",
|
|
38
|
+
base64url: "șir codat base64url",
|
|
39
|
+
json_string: "șir JSON",
|
|
40
|
+
e164: "număr E.164",
|
|
41
|
+
jwt: "JWT",
|
|
42
|
+
template_literal: "intrare",
|
|
43
|
+
};
|
|
44
|
+
const TypeDictionary = {
|
|
45
|
+
nan: "NaN",
|
|
46
|
+
string: "șir",
|
|
47
|
+
number: "număr",
|
|
48
|
+
boolean: "boolean",
|
|
49
|
+
function: "funcție",
|
|
50
|
+
array: "matrice",
|
|
51
|
+
object: "obiect",
|
|
52
|
+
undefined: "nedefinit",
|
|
53
|
+
symbol: "simbol",
|
|
54
|
+
bigint: "număr mare",
|
|
55
|
+
void: "void",
|
|
56
|
+
never: "never",
|
|
57
|
+
map: "hartă",
|
|
58
|
+
set: "set",
|
|
59
|
+
};
|
|
60
|
+
return (issue) => {
|
|
61
|
+
switch (issue.code) {
|
|
62
|
+
case "invalid_type": {
|
|
63
|
+
const expected = TypeDictionary[issue.expected] ?? issue.expected;
|
|
64
|
+
const receivedType = util.parsedType(issue.input);
|
|
65
|
+
const received = TypeDictionary[receivedType] ?? receivedType;
|
|
66
|
+
return `Intrare invalidă: așteptat ${expected}, primit ${received}`;
|
|
67
|
+
}
|
|
68
|
+
case "invalid_value":
|
|
69
|
+
if (issue.values.length === 1)
|
|
70
|
+
return `Intrare invalidă: așteptat ${util.stringifyPrimitive(issue.values[0])}`;
|
|
71
|
+
return `Opțiune invalidă: așteptat una dintre ${util.joinValues(issue.values, "|")}`;
|
|
72
|
+
case "too_big": {
|
|
73
|
+
const adj = issue.inclusive ? "<=" : "<";
|
|
74
|
+
const sizing = getSizing(issue.origin);
|
|
75
|
+
if (sizing)
|
|
76
|
+
return `Prea mare: așteptat ca ${issue.origin ?? "valoarea"} ${sizing.verb} ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elemente"}`;
|
|
77
|
+
return `Prea mare: așteptat ca ${issue.origin ?? "valoarea"} să fie ${adj}${issue.maximum.toString()}`;
|
|
78
|
+
}
|
|
79
|
+
case "too_small": {
|
|
80
|
+
const adj = issue.inclusive ? ">=" : ">";
|
|
81
|
+
const sizing = getSizing(issue.origin);
|
|
82
|
+
if (sizing) {
|
|
83
|
+
return `Prea mic: așteptat ca ${issue.origin} ${sizing.verb} ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
|
84
|
+
}
|
|
85
|
+
return `Prea mic: așteptat ca ${issue.origin} să fie ${adj}${issue.minimum.toString()}`;
|
|
86
|
+
}
|
|
87
|
+
case "invalid_format": {
|
|
88
|
+
const _issue = issue;
|
|
89
|
+
if (_issue.format === "starts_with") {
|
|
90
|
+
return `Șir invalid: trebuie să înceapă cu "${_issue.prefix}"`;
|
|
91
|
+
}
|
|
92
|
+
if (_issue.format === "ends_with")
|
|
93
|
+
return `Șir invalid: trebuie să se termine cu "${_issue.suffix}"`;
|
|
94
|
+
if (_issue.format === "includes")
|
|
95
|
+
return `Șir invalid: trebuie să includă "${_issue.includes}"`;
|
|
96
|
+
if (_issue.format === "regex")
|
|
97
|
+
return `Șir invalid: trebuie să se potrivească cu modelul ${_issue.pattern}`;
|
|
98
|
+
return `Format invalid: ${FormatDictionary[_issue.format] ?? issue.format}`;
|
|
99
|
+
}
|
|
100
|
+
case "not_multiple_of":
|
|
101
|
+
return `Număr invalid: trebuie să fie multiplu de ${issue.divisor}`;
|
|
102
|
+
case "unrecognized_keys":
|
|
103
|
+
return `Chei nerecunoscute: ${util.joinValues(issue.keys, ", ")}`;
|
|
104
|
+
case "invalid_key":
|
|
105
|
+
return `Cheie invalidă în ${issue.origin}`;
|
|
106
|
+
case "invalid_union":
|
|
107
|
+
return "Intrare invalidă";
|
|
108
|
+
case "invalid_element":
|
|
109
|
+
return `Valoare invalidă în ${issue.origin}`;
|
|
110
|
+
default:
|
|
111
|
+
return `Intrare invalidă`;
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
export default function () {
|
|
116
|
+
return {
|
|
117
|
+
localeError: error(),
|
|
118
|
+
};
|
|
119
|
+
}
|
|
@@ -31,6 +31,7 @@ const error = () => {
|
|
|
31
31
|
file: { unit: "bayt", verb: "bo‘lishi kerak" },
|
|
32
32
|
array: { unit: "element", verb: "bo‘lishi kerak" },
|
|
33
33
|
set: { unit: "element", verb: "bo‘lishi kerak" },
|
|
34
|
+
map: { unit: "yozuv", verb: "bo‘lishi kerak" },
|
|
34
35
|
};
|
|
35
36
|
function getSizing(origin) {
|
|
36
37
|
return Sizable[origin] ?? null;
|
|
@@ -5,6 +5,7 @@ const error = () => {
|
|
|
5
5
|
file: { unit: "bayt", verb: "bo‘lishi kerak" },
|
|
6
6
|
array: { unit: "element", verb: "bo‘lishi kerak" },
|
|
7
7
|
set: { unit: "element", verb: "bo‘lishi kerak" },
|
|
8
|
+
map: { unit: "yozuv", verb: "bo‘lishi kerak" },
|
|
8
9
|
};
|
|
9
10
|
function getSizing(origin) {
|
|
10
11
|
return Sizable[origin] ?? null;
|
|
@@ -3,6 +3,7 @@ export * from "./parse.cjs";
|
|
|
3
3
|
export * from "./schemas.cjs";
|
|
4
4
|
export * from "./checks.cjs";
|
|
5
5
|
export type { infer, output, input } from "../core/index.cjs";
|
|
6
|
+
export type { JSONType } from "../core/util.cjs";
|
|
6
7
|
export { globalRegistry, registry, config, $output, $input, $brand, clone, regexes, treeifyError, prettifyError, formatError, flattenError, TimePrecision, util, NEVER, } from "../core/index.cjs";
|
|
7
8
|
export { toJSONSchema } from "../core/json-schema-processors.cjs";
|
|
8
9
|
export * as locales from "../locales/index.cjs";
|
|
@@ -3,6 +3,7 @@ export * from "./parse.js";
|
|
|
3
3
|
export * from "./schemas.js";
|
|
4
4
|
export * from "./checks.js";
|
|
5
5
|
export type { infer, output, input } from "../core/index.js";
|
|
6
|
+
export type { JSONType } from "../core/util.js";
|
|
6
7
|
export { globalRegistry, registry, config, $output, $input, $brand, clone, regexes, treeifyError, prettifyError, formatError, flattenError, TimePrecision, util, NEVER, } from "../core/index.js";
|
|
7
8
|
export { toJSONSchema } from "../core/json-schema-processors.js";
|
|
8
9
|
export * as locales from "../locales/index.js";
|
|
@@ -112,6 +112,7 @@ exports.catch = _catch;
|
|
|
112
112
|
exports.nan = nan;
|
|
113
113
|
exports.pipe = pipe;
|
|
114
114
|
exports.codec = codec;
|
|
115
|
+
exports.invertCodec = invertCodec;
|
|
115
116
|
exports.readonly = readonly;
|
|
116
117
|
exports.templateLiteral = templateLiteral;
|
|
117
118
|
exports.lazy = _lazy;
|
|
@@ -144,7 +145,11 @@ exports.ZodMiniType = core.$constructor("ZodMiniType", (inst, def) => {
|
|
|
144
145
|
...def,
|
|
145
146
|
checks: [
|
|
146
147
|
...(def.checks ?? []),
|
|
147
|
-
...checks.map((ch) => typeof ch === "function"
|
|
148
|
+
...checks.map((ch) => typeof ch === "function"
|
|
149
|
+
? {
|
|
150
|
+
_zod: { check: ch, def: { check: "custom" }, onattach: [] },
|
|
151
|
+
}
|
|
152
|
+
: ch),
|
|
148
153
|
],
|
|
149
154
|
}, { parent: true });
|
|
150
155
|
};
|
|
@@ -218,7 +223,7 @@ function url(params) {
|
|
|
218
223
|
// @__NO_SIDE_EFFECTS__
|
|
219
224
|
function httpUrl(params) {
|
|
220
225
|
return core._url(exports.ZodMiniURL, {
|
|
221
|
-
protocol:
|
|
226
|
+
protocol: core.regexes.httpProtocol,
|
|
222
227
|
hostname: core.regexes.domain,
|
|
223
228
|
...util.normalizeParams(params),
|
|
224
229
|
});
|
|
@@ -239,10 +244,22 @@ exports.ZodMiniNanoID = core.$constructor("ZodMiniNanoID", (inst, def) => {
|
|
|
239
244
|
function nanoid(params) {
|
|
240
245
|
return core._nanoid(exports.ZodMiniNanoID, params);
|
|
241
246
|
}
|
|
247
|
+
/**
|
|
248
|
+
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
249
|
+
* (timestamps embedded in the id). Use {@link ZodMiniCUID2} instead.
|
|
250
|
+
* See https://github.com/paralleldrive/cuid.
|
|
251
|
+
*/
|
|
242
252
|
exports.ZodMiniCUID = core.$constructor("ZodMiniCUID", (inst, def) => {
|
|
243
253
|
core.$ZodCUID.init(inst, def);
|
|
244
254
|
exports.ZodMiniStringFormat.init(inst, def);
|
|
245
255
|
});
|
|
256
|
+
/**
|
|
257
|
+
* Validates a CUID v1 string.
|
|
258
|
+
*
|
|
259
|
+
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
260
|
+
* (timestamps embedded in the id). Use {@link cuid2 | `z.cuid2()`} instead.
|
|
261
|
+
* See https://github.com/paralleldrive/cuid.
|
|
262
|
+
*/
|
|
246
263
|
// @__NO_SIDE_EFFECTS__
|
|
247
264
|
function cuid(params) {
|
|
248
265
|
return core._cuid(exports.ZodMiniCUID, params);
|
|
@@ -668,6 +685,15 @@ exports.ZodMiniRecord = core.$constructor("ZodMiniRecord", (inst, def) => {
|
|
|
668
685
|
});
|
|
669
686
|
// @__NO_SIDE_EFFECTS__
|
|
670
687
|
function record(keyType, valueType, params) {
|
|
688
|
+
// v3-compat: z.record(valueType, params?) — defaults keyType to z.string()
|
|
689
|
+
if (!valueType || !valueType._zod) {
|
|
690
|
+
return new exports.ZodMiniRecord({
|
|
691
|
+
type: "record",
|
|
692
|
+
keyType: string(),
|
|
693
|
+
valueType: keyType,
|
|
694
|
+
...util.normalizeParams(valueType),
|
|
695
|
+
});
|
|
696
|
+
}
|
|
671
697
|
return new exports.ZodMiniRecord({
|
|
672
698
|
type: "record",
|
|
673
699
|
keyType,
|
|
@@ -915,6 +941,17 @@ function codec(in_, out, params) {
|
|
|
915
941
|
reverseTransform: params.encode,
|
|
916
942
|
});
|
|
917
943
|
}
|
|
944
|
+
// @__NO_SIDE_EFFECTS__
|
|
945
|
+
function invertCodec(codec) {
|
|
946
|
+
const def = codec._zod.def;
|
|
947
|
+
return new exports.ZodMiniCodec({
|
|
948
|
+
type: "pipe",
|
|
949
|
+
in: def.out,
|
|
950
|
+
out: def.in,
|
|
951
|
+
transform: def.reverseTransform,
|
|
952
|
+
reverseTransform: def.transform,
|
|
953
|
+
});
|
|
954
|
+
}
|
|
918
955
|
exports.ZodMiniReadonly = core.$constructor("ZodMiniReadonly", (inst, def) => {
|
|
919
956
|
core.$ZodReadonly.init(inst, def);
|
|
920
957
|
exports.ZodMiniType.init(inst, def);
|
|
@@ -990,8 +1027,8 @@ function refine(fn, _params = {}) {
|
|
|
990
1027
|
}
|
|
991
1028
|
// superRefine
|
|
992
1029
|
// @__NO_SIDE_EFFECTS__
|
|
993
|
-
function superRefine(fn) {
|
|
994
|
-
return core._superRefine(fn);
|
|
1030
|
+
function superRefine(fn, params) {
|
|
1031
|
+
return core._superRefine(fn, params);
|
|
995
1032
|
}
|
|
996
1033
|
// Re-export describe and meta from core
|
|
997
1034
|
exports.describe = core.describe;
|
|
@@ -58,9 +58,26 @@ export interface ZodMiniNanoID extends _ZodMiniString<core.$ZodNanoIDInternals>
|
|
|
58
58
|
}
|
|
59
59
|
export declare const ZodMiniNanoID: core.$constructor<ZodMiniNanoID>;
|
|
60
60
|
export declare function nanoid(params?: string | core.$ZodNanoIDParams): ZodMiniNanoID;
|
|
61
|
+
/**
|
|
62
|
+
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
63
|
+
* (timestamps embedded in the id). Use {@link ZodMiniCUID2} instead.
|
|
64
|
+
* See https://github.com/paralleldrive/cuid.
|
|
65
|
+
*/
|
|
61
66
|
export interface ZodMiniCUID extends _ZodMiniString<core.$ZodCUIDInternals> {
|
|
62
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
70
|
+
* (timestamps embedded in the id). Use {@link ZodMiniCUID2} instead.
|
|
71
|
+
* See https://github.com/paralleldrive/cuid.
|
|
72
|
+
*/
|
|
63
73
|
export declare const ZodMiniCUID: core.$constructor<ZodMiniCUID>;
|
|
74
|
+
/**
|
|
75
|
+
* Validates a CUID v1 string.
|
|
76
|
+
*
|
|
77
|
+
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
78
|
+
* (timestamps embedded in the id). Use {@link cuid2 | `z.cuid2()`} instead.
|
|
79
|
+
* See https://github.com/paralleldrive/cuid.
|
|
80
|
+
*/
|
|
64
81
|
export declare function cuid(params?: string | core.$ZodCUIDParams): ZodMiniCUID;
|
|
65
82
|
export interface ZodMiniCUID2 extends _ZodMiniString<core.$ZodCUID2Internals> {
|
|
66
83
|
}
|
|
@@ -198,23 +215,23 @@ out Shape extends core.$ZodShape = core.$ZodShape, out Config extends core.$ZodO
|
|
|
198
215
|
shape: Shape;
|
|
199
216
|
}
|
|
200
217
|
export declare const ZodMiniObject: core.$constructor<ZodMiniObject>;
|
|
201
|
-
export declare function object<T extends core.$ZodLooseShape = Record<never, SomeType>>(shape?: T, params?: string | core.$ZodObjectParams): ZodMiniObject<T
|
|
202
|
-
export declare function strictObject<T extends core.$ZodLooseShape>(shape: T, params?: string | core.$ZodObjectParams): ZodMiniObject<T
|
|
203
|
-
export declare function looseObject<T extends core.$ZodLooseShape>(shape: T, params?: string | core.$ZodObjectParams): ZodMiniObject<T
|
|
204
|
-
export declare function extend<T extends ZodMiniObject, U extends core.$ZodLooseShape>(schema: T, shape: U): ZodMiniObject<util.Extend<T["shape"], U
|
|
218
|
+
export declare function object<T extends core.$ZodLooseShape = Record<never, SomeType>>(shape?: T, params?: string | core.$ZodObjectParams): ZodMiniObject<util.Writeable<T>, core.$strip>;
|
|
219
|
+
export declare function strictObject<T extends core.$ZodLooseShape>(shape: T, params?: string | core.$ZodObjectParams): ZodMiniObject<util.Writeable<T>, core.$strict>;
|
|
220
|
+
export declare function looseObject<T extends core.$ZodLooseShape>(shape: T, params?: string | core.$ZodObjectParams): ZodMiniObject<util.Writeable<T>, core.$loose>;
|
|
221
|
+
export declare function extend<T extends ZodMiniObject, U extends core.$ZodLooseShape>(schema: T, shape: U): ZodMiniObject<util.Extend<T["shape"], util.Writeable<U>>, T["_zod"]["config"]>;
|
|
205
222
|
export type SafeExtendShape<Base extends core.$ZodShape, Ext extends core.$ZodLooseShape> = {
|
|
206
223
|
[K in keyof Ext]: K extends keyof Base ? core.output<Ext[K]> extends core.output<Base[K]> ? core.input<Ext[K]> extends core.input<Base[K]> ? Ext[K] : never : never : Ext[K];
|
|
207
224
|
};
|
|
208
|
-
export declare function safeExtend<T extends ZodMiniObject, U extends core.$ZodLooseShape>(schema: T, shape: SafeExtendShape<T["shape"], U>): ZodMiniObject<util.Extend<T["shape"], U
|
|
225
|
+
export declare function safeExtend<T extends ZodMiniObject, U extends core.$ZodLooseShape>(schema: T, shape: SafeExtendShape<T["shape"], U>): ZodMiniObject<util.Extend<T["shape"], util.Writeable<U>>, T["_zod"]["config"]>;
|
|
209
226
|
/** @deprecated Identical to `z.extend(A, B)` */
|
|
210
227
|
export declare function merge<T extends ZodMiniObject, U extends ZodMiniObject>(a: T, b: U): ZodMiniObject<util.Extend<T["shape"], U["shape"]>, T["_zod"]["config"]>;
|
|
211
228
|
export declare function pick<T extends ZodMiniObject, M extends util.Mask<keyof T["shape"]>>(schema: T, mask: M & Record<Exclude<keyof M, keyof T["shape"]>, never>): ZodMiniObject<util.Flatten<Pick<T["shape"], keyof T["shape"] & keyof M>>, T["_zod"]["config"]>;
|
|
212
229
|
export declare function omit<T extends ZodMiniObject, M extends util.Mask<keyof T["shape"]>>(schema: T, mask: M & Record<Exclude<keyof M, keyof T["shape"]>, never>): ZodMiniObject<util.Flatten<Omit<T["shape"], keyof M>>, T["_zod"]["config"]>;
|
|
213
230
|
export declare function partial<T extends ZodMiniObject>(schema: T): ZodMiniObject<{
|
|
214
|
-
[k in keyof T["shape"]]: ZodMiniOptional<T["shape"][k]>;
|
|
231
|
+
-readonly [k in keyof T["shape"]]: ZodMiniOptional<T["shape"][k]>;
|
|
215
232
|
}, T["_zod"]["config"]>;
|
|
216
233
|
export declare function partial<T extends ZodMiniObject, M extends util.Mask<keyof T["shape"]>>(schema: T, mask: M & Record<Exclude<keyof M, keyof T["shape"]>, never>): ZodMiniObject<{
|
|
217
|
-
[k in keyof T["shape"]]: k extends keyof M ? ZodMiniOptional<T["shape"][k]> : T["shape"][k];
|
|
234
|
+
-readonly [k in keyof T["shape"]]: k extends keyof M ? ZodMiniOptional<T["shape"][k]> : T["shape"][k];
|
|
218
235
|
}, T["_zod"]["config"]>;
|
|
219
236
|
export type RequiredInterfaceShape<Shape extends core.$ZodLooseShape, Keys extends PropertyKey = keyof Shape> = util.Identity<{
|
|
220
237
|
[k in keyof Shape as k extends Keys ? k : never]: ZodMiniNonOptional<Shape[k]>;
|
|
@@ -222,7 +239,7 @@ export type RequiredInterfaceShape<Shape extends core.$ZodLooseShape, Keys exten
|
|
|
222
239
|
[k in keyof Shape as k extends Keys ? never : k]: Shape[k];
|
|
223
240
|
}>;
|
|
224
241
|
export declare function required<T extends ZodMiniObject>(schema: T): ZodMiniObject<{
|
|
225
|
-
[k in keyof T["shape"]]: ZodMiniNonOptional<T["shape"][k]>;
|
|
242
|
+
-readonly [k in keyof T["shape"]]: ZodMiniNonOptional<T["shape"][k]>;
|
|
226
243
|
}, T["_zod"]["config"]>;
|
|
227
244
|
export declare function required<T extends ZodMiniObject, M extends util.Mask<keyof T["shape"]>>(schema: T, mask: M & Record<Exclude<keyof M, keyof T["shape"]>, never>): ZodMiniObject<util.Extend<T["shape"], {
|
|
228
245
|
[k in keyof M & keyof T["shape"]]: ZodMiniNonOptional<T["shape"][k]>;
|
|
@@ -243,7 +260,7 @@ export interface ZodMiniDiscriminatedUnion<Options extends readonly SomeType[] =
|
|
|
243
260
|
_zod: core.$ZodDiscriminatedUnionInternals<Options, Disc>;
|
|
244
261
|
}
|
|
245
262
|
export declare const ZodMiniDiscriminatedUnion: core.$constructor<ZodMiniDiscriminatedUnion>;
|
|
246
|
-
export declare function discriminatedUnion<Types extends readonly [core.$ZodTypeDiscriminable
|
|
263
|
+
export declare function discriminatedUnion<Types extends readonly [core.$ZodTypeDiscriminable<Disc>, ...core.$ZodTypeDiscriminable<Disc>[]], Disc extends string>(discriminator: Disc, options: Types, params?: string | core.$ZodDiscriminatedUnionParams): ZodMiniDiscriminatedUnion<Types, Disc>;
|
|
247
264
|
export interface ZodMiniIntersection<A extends SomeType = core.$ZodType, B extends SomeType = core.$ZodType> extends _ZodMiniType<core.$ZodIntersectionInternals<A, B>> {
|
|
248
265
|
}
|
|
249
266
|
export declare const ZodMiniIntersection: core.$constructor<ZodMiniIntersection>;
|
|
@@ -347,6 +364,7 @@ export declare function codec<const A extends SomeType, B extends core.SomeType
|
|
|
347
364
|
decode: (value: core.output<A>, payload: core.ParsePayload<core.output<A>>) => core.util.MaybeAsync<core.input<B>>;
|
|
348
365
|
encode: (value: core.input<B>, payload: core.ParsePayload<core.input<B>>) => core.util.MaybeAsync<core.output<A>>;
|
|
349
366
|
}): ZodMiniCodec<A, B>;
|
|
367
|
+
export declare function invertCodec<A extends SomeType, B extends SomeType>(codec: ZodMiniCodec<A, B>): ZodMiniCodec<B, A>;
|
|
350
368
|
export interface ZodMiniReadonly<T extends SomeType = core.$ZodType> extends _ZodMiniType<core.$ZodReadonlyInternals<T>> {
|
|
351
369
|
}
|
|
352
370
|
export declare const ZodMiniReadonly: core.$constructor<ZodMiniReadonly>;
|
|
@@ -370,7 +388,7 @@ export declare const ZodMiniCustom: core.$constructor<ZodMiniCustom>;
|
|
|
370
388
|
export declare function check<O = unknown>(fn: core.CheckFn<O>, params?: string | core.$ZodCustomParams): core.$ZodCheck<O>;
|
|
371
389
|
export declare function custom<O = unknown, I = O>(fn?: (data: O) => unknown, _params?: string | core.$ZodCustomParams | undefined): ZodMiniCustom<O, I>;
|
|
372
390
|
export declare function refine<T>(fn: (arg: NoInfer<T>) => util.MaybeAsync<unknown>, _params?: string | core.$ZodCustomParams): core.$ZodCheck<T>;
|
|
373
|
-
export declare function superRefine<T>(fn: (arg: T, payload: core.$RefinementCtx<T>) => void | Promise<void
|
|
391
|
+
export declare function superRefine<T>(fn: (arg: T, payload: core.$RefinementCtx<T>) => void | Promise<void>, params?: core.$ZodSuperRefineParams): core.$ZodCheck<T>;
|
|
374
392
|
export declare const describe: typeof core.describe;
|
|
375
393
|
export declare const meta: typeof core.meta;
|
|
376
394
|
declare abstract class Class {
|
|
@@ -58,9 +58,26 @@ export interface ZodMiniNanoID extends _ZodMiniString<core.$ZodNanoIDInternals>
|
|
|
58
58
|
}
|
|
59
59
|
export declare const ZodMiniNanoID: core.$constructor<ZodMiniNanoID>;
|
|
60
60
|
export declare function nanoid(params?: string | core.$ZodNanoIDParams): ZodMiniNanoID;
|
|
61
|
+
/**
|
|
62
|
+
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
63
|
+
* (timestamps embedded in the id). Use {@link ZodMiniCUID2} instead.
|
|
64
|
+
* See https://github.com/paralleldrive/cuid.
|
|
65
|
+
*/
|
|
61
66
|
export interface ZodMiniCUID extends _ZodMiniString<core.$ZodCUIDInternals> {
|
|
62
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
70
|
+
* (timestamps embedded in the id). Use {@link ZodMiniCUID2} instead.
|
|
71
|
+
* See https://github.com/paralleldrive/cuid.
|
|
72
|
+
*/
|
|
63
73
|
export declare const ZodMiniCUID: core.$constructor<ZodMiniCUID>;
|
|
74
|
+
/**
|
|
75
|
+
* Validates a CUID v1 string.
|
|
76
|
+
*
|
|
77
|
+
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
78
|
+
* (timestamps embedded in the id). Use {@link cuid2 | `z.cuid2()`} instead.
|
|
79
|
+
* See https://github.com/paralleldrive/cuid.
|
|
80
|
+
*/
|
|
64
81
|
export declare function cuid(params?: string | core.$ZodCUIDParams): ZodMiniCUID;
|
|
65
82
|
export interface ZodMiniCUID2 extends _ZodMiniString<core.$ZodCUID2Internals> {
|
|
66
83
|
}
|
|
@@ -198,23 +215,23 @@ out Shape extends core.$ZodShape = core.$ZodShape, out Config extends core.$ZodO
|
|
|
198
215
|
shape: Shape;
|
|
199
216
|
}
|
|
200
217
|
export declare const ZodMiniObject: core.$constructor<ZodMiniObject>;
|
|
201
|
-
export declare function object<T extends core.$ZodLooseShape = Record<never, SomeType>>(shape?: T, params?: string | core.$ZodObjectParams): ZodMiniObject<T
|
|
202
|
-
export declare function strictObject<T extends core.$ZodLooseShape>(shape: T, params?: string | core.$ZodObjectParams): ZodMiniObject<T
|
|
203
|
-
export declare function looseObject<T extends core.$ZodLooseShape>(shape: T, params?: string | core.$ZodObjectParams): ZodMiniObject<T
|
|
204
|
-
export declare function extend<T extends ZodMiniObject, U extends core.$ZodLooseShape>(schema: T, shape: U): ZodMiniObject<util.Extend<T["shape"], U
|
|
218
|
+
export declare function object<T extends core.$ZodLooseShape = Record<never, SomeType>>(shape?: T, params?: string | core.$ZodObjectParams): ZodMiniObject<util.Writeable<T>, core.$strip>;
|
|
219
|
+
export declare function strictObject<T extends core.$ZodLooseShape>(shape: T, params?: string | core.$ZodObjectParams): ZodMiniObject<util.Writeable<T>, core.$strict>;
|
|
220
|
+
export declare function looseObject<T extends core.$ZodLooseShape>(shape: T, params?: string | core.$ZodObjectParams): ZodMiniObject<util.Writeable<T>, core.$loose>;
|
|
221
|
+
export declare function extend<T extends ZodMiniObject, U extends core.$ZodLooseShape>(schema: T, shape: U): ZodMiniObject<util.Extend<T["shape"], util.Writeable<U>>, T["_zod"]["config"]>;
|
|
205
222
|
export type SafeExtendShape<Base extends core.$ZodShape, Ext extends core.$ZodLooseShape> = {
|
|
206
223
|
[K in keyof Ext]: K extends keyof Base ? core.output<Ext[K]> extends core.output<Base[K]> ? core.input<Ext[K]> extends core.input<Base[K]> ? Ext[K] : never : never : Ext[K];
|
|
207
224
|
};
|
|
208
|
-
export declare function safeExtend<T extends ZodMiniObject, U extends core.$ZodLooseShape>(schema: T, shape: SafeExtendShape<T["shape"], U>): ZodMiniObject<util.Extend<T["shape"], U
|
|
225
|
+
export declare function safeExtend<T extends ZodMiniObject, U extends core.$ZodLooseShape>(schema: T, shape: SafeExtendShape<T["shape"], U>): ZodMiniObject<util.Extend<T["shape"], util.Writeable<U>>, T["_zod"]["config"]>;
|
|
209
226
|
/** @deprecated Identical to `z.extend(A, B)` */
|
|
210
227
|
export declare function merge<T extends ZodMiniObject, U extends ZodMiniObject>(a: T, b: U): ZodMiniObject<util.Extend<T["shape"], U["shape"]>, T["_zod"]["config"]>;
|
|
211
228
|
export declare function pick<T extends ZodMiniObject, M extends util.Mask<keyof T["shape"]>>(schema: T, mask: M & Record<Exclude<keyof M, keyof T["shape"]>, never>): ZodMiniObject<util.Flatten<Pick<T["shape"], keyof T["shape"] & keyof M>>, T["_zod"]["config"]>;
|
|
212
229
|
export declare function omit<T extends ZodMiniObject, M extends util.Mask<keyof T["shape"]>>(schema: T, mask: M & Record<Exclude<keyof M, keyof T["shape"]>, never>): ZodMiniObject<util.Flatten<Omit<T["shape"], keyof M>>, T["_zod"]["config"]>;
|
|
213
230
|
export declare function partial<T extends ZodMiniObject>(schema: T): ZodMiniObject<{
|
|
214
|
-
[k in keyof T["shape"]]: ZodMiniOptional<T["shape"][k]>;
|
|
231
|
+
-readonly [k in keyof T["shape"]]: ZodMiniOptional<T["shape"][k]>;
|
|
215
232
|
}, T["_zod"]["config"]>;
|
|
216
233
|
export declare function partial<T extends ZodMiniObject, M extends util.Mask<keyof T["shape"]>>(schema: T, mask: M & Record<Exclude<keyof M, keyof T["shape"]>, never>): ZodMiniObject<{
|
|
217
|
-
[k in keyof T["shape"]]: k extends keyof M ? ZodMiniOptional<T["shape"][k]> : T["shape"][k];
|
|
234
|
+
-readonly [k in keyof T["shape"]]: k extends keyof M ? ZodMiniOptional<T["shape"][k]> : T["shape"][k];
|
|
218
235
|
}, T["_zod"]["config"]>;
|
|
219
236
|
export type RequiredInterfaceShape<Shape extends core.$ZodLooseShape, Keys extends PropertyKey = keyof Shape> = util.Identity<{
|
|
220
237
|
[k in keyof Shape as k extends Keys ? k : never]: ZodMiniNonOptional<Shape[k]>;
|
|
@@ -222,7 +239,7 @@ export type RequiredInterfaceShape<Shape extends core.$ZodLooseShape, Keys exten
|
|
|
222
239
|
[k in keyof Shape as k extends Keys ? never : k]: Shape[k];
|
|
223
240
|
}>;
|
|
224
241
|
export declare function required<T extends ZodMiniObject>(schema: T): ZodMiniObject<{
|
|
225
|
-
[k in keyof T["shape"]]: ZodMiniNonOptional<T["shape"][k]>;
|
|
242
|
+
-readonly [k in keyof T["shape"]]: ZodMiniNonOptional<T["shape"][k]>;
|
|
226
243
|
}, T["_zod"]["config"]>;
|
|
227
244
|
export declare function required<T extends ZodMiniObject, M extends util.Mask<keyof T["shape"]>>(schema: T, mask: M & Record<Exclude<keyof M, keyof T["shape"]>, never>): ZodMiniObject<util.Extend<T["shape"], {
|
|
228
245
|
[k in keyof M & keyof T["shape"]]: ZodMiniNonOptional<T["shape"][k]>;
|
|
@@ -243,7 +260,7 @@ export interface ZodMiniDiscriminatedUnion<Options extends readonly SomeType[] =
|
|
|
243
260
|
_zod: core.$ZodDiscriminatedUnionInternals<Options, Disc>;
|
|
244
261
|
}
|
|
245
262
|
export declare const ZodMiniDiscriminatedUnion: core.$constructor<ZodMiniDiscriminatedUnion>;
|
|
246
|
-
export declare function discriminatedUnion<Types extends readonly [core.$ZodTypeDiscriminable
|
|
263
|
+
export declare function discriminatedUnion<Types extends readonly [core.$ZodTypeDiscriminable<Disc>, ...core.$ZodTypeDiscriminable<Disc>[]], Disc extends string>(discriminator: Disc, options: Types, params?: string | core.$ZodDiscriminatedUnionParams): ZodMiniDiscriminatedUnion<Types, Disc>;
|
|
247
264
|
export interface ZodMiniIntersection<A extends SomeType = core.$ZodType, B extends SomeType = core.$ZodType> extends _ZodMiniType<core.$ZodIntersectionInternals<A, B>> {
|
|
248
265
|
}
|
|
249
266
|
export declare const ZodMiniIntersection: core.$constructor<ZodMiniIntersection>;
|
|
@@ -347,6 +364,7 @@ export declare function codec<const A extends SomeType, B extends core.SomeType
|
|
|
347
364
|
decode: (value: core.output<A>, payload: core.ParsePayload<core.output<A>>) => core.util.MaybeAsync<core.input<B>>;
|
|
348
365
|
encode: (value: core.input<B>, payload: core.ParsePayload<core.input<B>>) => core.util.MaybeAsync<core.output<A>>;
|
|
349
366
|
}): ZodMiniCodec<A, B>;
|
|
367
|
+
export declare function invertCodec<A extends SomeType, B extends SomeType>(codec: ZodMiniCodec<A, B>): ZodMiniCodec<B, A>;
|
|
350
368
|
export interface ZodMiniReadonly<T extends SomeType = core.$ZodType> extends _ZodMiniType<core.$ZodReadonlyInternals<T>> {
|
|
351
369
|
}
|
|
352
370
|
export declare const ZodMiniReadonly: core.$constructor<ZodMiniReadonly>;
|
|
@@ -370,7 +388,7 @@ export declare const ZodMiniCustom: core.$constructor<ZodMiniCustom>;
|
|
|
370
388
|
export declare function check<O = unknown>(fn: core.CheckFn<O>, params?: string | core.$ZodCustomParams): core.$ZodCheck<O>;
|
|
371
389
|
export declare function custom<O = unknown, I = O>(fn?: (data: O) => unknown, _params?: string | core.$ZodCustomParams | undefined): ZodMiniCustom<O, I>;
|
|
372
390
|
export declare function refine<T>(fn: (arg: NoInfer<T>) => util.MaybeAsync<unknown>, _params?: string | core.$ZodCustomParams): core.$ZodCheck<T>;
|
|
373
|
-
export declare function superRefine<T>(fn: (arg: T, payload: core.$RefinementCtx<T>) => void | Promise<void
|
|
391
|
+
export declare function superRefine<T>(fn: (arg: T, payload: core.$RefinementCtx<T>) => void | Promise<void>, params?: core.$ZodSuperRefineParams): core.$ZodCheck<T>;
|
|
374
392
|
export declare const describe: typeof core.describe;
|
|
375
393
|
export declare const meta: typeof core.meta;
|
|
376
394
|
declare abstract class Class {
|