matrix-nodejs-homeserver 0.2.0 → 0.3.1
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 +29 -7
- package/dist/api/account.js +385 -351
- package/dist/api/admin.js +76 -60
- package/dist/api/appservice.js +37 -25
- package/dist/api/backup.js +73 -62
- package/dist/api/federation.js +172 -138
- package/dist/api/filters.js +4 -3
- package/dist/api/legacy.js +91 -78
- package/dist/api/media.js +70 -54
- package/dist/api/misc.js +46 -37
- package/dist/api/preview.js +4 -3
- package/dist/api/profile.js +108 -97
- package/dist/api/push.js +114 -99
- package/dist/api/relationships.js +64 -58
- package/dist/api/rooms.js +703 -580
- package/dist/api/rtc.d.ts +0 -1
- package/dist/api/rtc.js +48 -34
- package/dist/api/search.js +133 -127
- package/dist/api/slidingsync.js +41 -31
- package/dist/api/spaces.js +82 -77
- package/dist/api/sync.js +59 -50
- package/dist/api/threadsubs.js +72 -61
- package/dist/api/threepid.js +99 -66
- package/dist/api/uia.js +17 -16
- package/dist/api/user.js +221 -178
- package/dist/core/admin.d.ts +0 -1
- package/dist/core/admin.js +6 -5
- package/dist/core/adminroom.js +9 -8
- package/dist/core/appservices.d.ts +2 -1
- package/dist/core/appservices.js +5 -4
- package/dist/core/audit.d.ts +0 -1
- package/dist/core/authrules.js +26 -25
- package/dist/core/delayed.js +2 -1
- package/dist/core/events.js +11 -10
- package/dist/core/invitefilter.js +2 -1
- package/dist/core/keys.js +2 -1
- package/dist/core/m.d.ts +209 -0
- package/dist/core/m.js +182 -0
- package/dist/core/partialstate.js +2 -1
- package/dist/core/policy.js +4 -3
- package/dist/core/push.d.ts +0 -1
- package/dist/core/push.js +12 -11
- package/dist/core/pushrules.js +36 -35
- package/dist/core/rooms.js +76 -74
- package/dist/core/stateres.js +7 -6
- package/dist/federation/client.js +2 -1
- package/dist/federation/index.d.ts +1 -1
- package/dist/federation/index.js +30 -29
- package/dist/homeserver.d.ts +2 -1
- package/dist/homeserver.js +1 -0
- package/dist/http/handler.js +2 -23
- package/dist/http/input.js +2 -2
- package/dist/http/procedure.js +25 -0
- package/dist/http/router.d.ts +9 -26
- package/dist/http/router.js +10 -30
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/vendor/zod/LICENSE +21 -0
- package/dist/vendor/zod/v4/classic/errors.js +54 -0
- package/dist/vendor/zod/v4/classic/parse.js +17 -0
- package/dist/vendor/zod/v4/classic/schemas.js +865 -0
- package/dist/vendor/zod/v4/core/api.js +512 -0
- package/dist/vendor/zod/v4/core/checks.js +300 -0
- package/dist/vendor/zod/v4/core/core.js +109 -0
- package/dist/vendor/zod/v4/core/doc.js +35 -0
- package/dist/vendor/zod/v4/core/errors.js +118 -0
- package/dist/vendor/zod/v4/core/json-schema-processors.js +428 -0
- package/dist/vendor/zod/v4/core/memoizer.js +255 -0
- package/dist/vendor/zod/v4/core/parse.js +206 -0
- package/dist/vendor/zod/v4/core/regexes.js +73 -0
- package/dist/vendor/zod/v4/core/registries.js +48 -0
- package/dist/vendor/zod/v4/core/schemas.js +1378 -0
- package/dist/vendor/zod/v4/core/to-json-schema.js +448 -0
- package/dist/vendor/zod/v4/core/util.js +537 -0
- package/dist/vendor/zod/v4/core/versions.js +8 -0
- package/dist/vendor/zod/v4/locales/en.js +110 -0
- package/package.json +3 -5
- package/dist/core/pushrules.d.ts +0 -1
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { captureStackTrace, finalizeIssue } from "./util.js";
|
|
2
|
+
import { $ZodAsyncError, config } from "./core.js";
|
|
3
|
+
//#region node_modules/zod/v4/core/parse.js
|
|
4
|
+
function finalizeParams(callee, params) {
|
|
5
|
+
return {
|
|
6
|
+
callee: params?.callee ?? callee,
|
|
7
|
+
Err: params?.Err
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
const _parse = (_Err) => {
|
|
11
|
+
const fn = (schema, value, _ctx, _params) => {
|
|
12
|
+
const ctx = _ctx ? {
|
|
13
|
+
..._ctx,
|
|
14
|
+
async: false
|
|
15
|
+
} : { async: false };
|
|
16
|
+
const result = schema._zod.run({
|
|
17
|
+
value,
|
|
18
|
+
issues: []
|
|
19
|
+
}, ctx);
|
|
20
|
+
if (result instanceof Promise) throw new $ZodAsyncError();
|
|
21
|
+
if (result.issues.length) {
|
|
22
|
+
const e = new ((_params?.Err) ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
23
|
+
captureStackTrace(e, _params?.callee ?? fn);
|
|
24
|
+
throw e;
|
|
25
|
+
}
|
|
26
|
+
return result.value;
|
|
27
|
+
};
|
|
28
|
+
return fn;
|
|
29
|
+
};
|
|
30
|
+
const _parseAsync = (_Err) => {
|
|
31
|
+
const fn = async (schema, value, _ctx, params) => {
|
|
32
|
+
const ctx = _ctx ? {
|
|
33
|
+
..._ctx,
|
|
34
|
+
async: true
|
|
35
|
+
} : { async: true };
|
|
36
|
+
let result = schema._zod.run({
|
|
37
|
+
value,
|
|
38
|
+
issues: []
|
|
39
|
+
}, ctx);
|
|
40
|
+
if (result instanceof Promise) result = await result;
|
|
41
|
+
if (result.issues.length) {
|
|
42
|
+
const e = new ((params?.Err) ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
43
|
+
captureStackTrace(e, params?.callee ?? fn);
|
|
44
|
+
throw e;
|
|
45
|
+
}
|
|
46
|
+
return result.value;
|
|
47
|
+
};
|
|
48
|
+
return fn;
|
|
49
|
+
};
|
|
50
|
+
const _safeParse = (_Err) => (schema, value, _ctx) => {
|
|
51
|
+
const ctx = _ctx ? {
|
|
52
|
+
..._ctx,
|
|
53
|
+
async: false
|
|
54
|
+
} : { async: false };
|
|
55
|
+
const result = schema._zod.run({
|
|
56
|
+
value,
|
|
57
|
+
issues: []
|
|
58
|
+
}, ctx);
|
|
59
|
+
if (result instanceof Promise) throw new $ZodAsyncError();
|
|
60
|
+
return result.issues.length ? failure(_Err, result.issues, ctx) : {
|
|
61
|
+
success: true,
|
|
62
|
+
data: result.value
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
function failure(Err, issues, ctx) {
|
|
66
|
+
let error;
|
|
67
|
+
return {
|
|
68
|
+
success: false,
|
|
69
|
+
get error() {
|
|
70
|
+
if (!error) {
|
|
71
|
+
error = new Err(issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
72
|
+
issues = void 0;
|
|
73
|
+
ctx = void 0;
|
|
74
|
+
}
|
|
75
|
+
return error;
|
|
76
|
+
},
|
|
77
|
+
set error(e) {
|
|
78
|
+
error = e;
|
|
79
|
+
issues = void 0;
|
|
80
|
+
ctx = void 0;
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
85
|
+
const ctx = _ctx ? {
|
|
86
|
+
..._ctx,
|
|
87
|
+
async: true
|
|
88
|
+
} : { async: true };
|
|
89
|
+
let result = schema._zod.run({
|
|
90
|
+
value,
|
|
91
|
+
issues: []
|
|
92
|
+
}, ctx);
|
|
93
|
+
if (result instanceof Promise) result = await result;
|
|
94
|
+
return result.issues.length ? failure(_Err, result.issues, ctx) : {
|
|
95
|
+
success: true,
|
|
96
|
+
data: result.value
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
const COMPILE_INVALID = /* @__PURE__ */ Symbol.for("zod.compile.invalid");
|
|
100
|
+
const COMPILE_FALLBACK = /* @__PURE__ */ Symbol.for("zod.compile.fallback");
|
|
101
|
+
const validate = ((schema, value, _ctx) => {
|
|
102
|
+
const validator = schema._zod.bag.validator;
|
|
103
|
+
if (validator !== void 0) {
|
|
104
|
+
if (validator(value) !== COMPILE_INVALID) return true;
|
|
105
|
+
if (validator.definite === true && _ctx === void 0) return false;
|
|
106
|
+
}
|
|
107
|
+
return validateFallback(schema, value, _ctx);
|
|
108
|
+
});
|
|
109
|
+
function validateFallback(schema, value, _ctx) {
|
|
110
|
+
const ctx = _ctx ? {
|
|
111
|
+
..._ctx,
|
|
112
|
+
async: false,
|
|
113
|
+
abortEarly: true
|
|
114
|
+
} : {
|
|
115
|
+
async: false,
|
|
116
|
+
abortEarly: true
|
|
117
|
+
};
|
|
118
|
+
const fallbackRun = schema._zod.bag.fallbackRun;
|
|
119
|
+
let result;
|
|
120
|
+
if (fallbackRun) {
|
|
121
|
+
ctx[COMPILE_FALLBACK] = true;
|
|
122
|
+
result = fallbackRun({
|
|
123
|
+
value,
|
|
124
|
+
issues: []
|
|
125
|
+
}, ctx);
|
|
126
|
+
} else result = schema._zod.run({
|
|
127
|
+
value,
|
|
128
|
+
issues: []
|
|
129
|
+
}, ctx);
|
|
130
|
+
if (result instanceof Promise) throw new $ZodAsyncError();
|
|
131
|
+
return result.issues.length === 0;
|
|
132
|
+
}
|
|
133
|
+
const validateAsync = async (schema, value, _ctx) => {
|
|
134
|
+
const ctx = _ctx ? {
|
|
135
|
+
..._ctx,
|
|
136
|
+
async: true,
|
|
137
|
+
abortEarly: true
|
|
138
|
+
} : {
|
|
139
|
+
async: true,
|
|
140
|
+
abortEarly: true
|
|
141
|
+
};
|
|
142
|
+
let result = schema._zod.run({
|
|
143
|
+
value,
|
|
144
|
+
issues: []
|
|
145
|
+
}, ctx);
|
|
146
|
+
if (result instanceof Promise) result = await result;
|
|
147
|
+
return result.issues.length === 0;
|
|
148
|
+
};
|
|
149
|
+
const _encode = (_Err) => {
|
|
150
|
+
const parse = _parse(_Err);
|
|
151
|
+
const fn = (schema, value, _ctx, _params) => {
|
|
152
|
+
const ctx = _ctx ? {
|
|
153
|
+
..._ctx,
|
|
154
|
+
direction: "backward"
|
|
155
|
+
} : { direction: "backward" };
|
|
156
|
+
return parse(schema, value, ctx, finalizeParams(fn, _params));
|
|
157
|
+
};
|
|
158
|
+
return fn;
|
|
159
|
+
};
|
|
160
|
+
const _decode = (_Err) => {
|
|
161
|
+
const parse = _parse(_Err);
|
|
162
|
+
const fn = (schema, value, _ctx, _params) => {
|
|
163
|
+
return parse(schema, value, _ctx, finalizeParams(fn, _params));
|
|
164
|
+
};
|
|
165
|
+
return fn;
|
|
166
|
+
};
|
|
167
|
+
const _encodeAsync = (_Err) => {
|
|
168
|
+
const parseAsync = _parseAsync(_Err);
|
|
169
|
+
const fn = async (schema, value, _ctx, _params) => {
|
|
170
|
+
const ctx = _ctx ? {
|
|
171
|
+
..._ctx,
|
|
172
|
+
direction: "backward"
|
|
173
|
+
} : { direction: "backward" };
|
|
174
|
+
return await parseAsync(schema, value, ctx, finalizeParams(fn, _params));
|
|
175
|
+
};
|
|
176
|
+
return fn;
|
|
177
|
+
};
|
|
178
|
+
const _decodeAsync = (_Err) => {
|
|
179
|
+
const parseAsync = _parseAsync(_Err);
|
|
180
|
+
const fn = async (schema, value, _ctx, _params) => {
|
|
181
|
+
return await parseAsync(schema, value, _ctx, finalizeParams(fn, _params));
|
|
182
|
+
};
|
|
183
|
+
return fn;
|
|
184
|
+
};
|
|
185
|
+
const _safeEncode = (_Err) => (schema, value, _ctx) => {
|
|
186
|
+
const ctx = _ctx ? {
|
|
187
|
+
..._ctx,
|
|
188
|
+
direction: "backward"
|
|
189
|
+
} : { direction: "backward" };
|
|
190
|
+
return _safeParse(_Err)(schema, value, ctx);
|
|
191
|
+
};
|
|
192
|
+
const _safeDecode = (_Err) => (schema, value, _ctx) => {
|
|
193
|
+
return _safeParse(_Err)(schema, value, _ctx);
|
|
194
|
+
};
|
|
195
|
+
const _safeEncodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
196
|
+
const ctx = _ctx ? {
|
|
197
|
+
..._ctx,
|
|
198
|
+
direction: "backward"
|
|
199
|
+
} : { direction: "backward" };
|
|
200
|
+
return _safeParseAsync(_Err)(schema, value, ctx);
|
|
201
|
+
};
|
|
202
|
+
const _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
203
|
+
return _safeParseAsync(_Err)(schema, value, _ctx);
|
|
204
|
+
};
|
|
205
|
+
//#endregion
|
|
206
|
+
export { _decode, _decodeAsync, _encode, _encodeAsync, _parse, _parseAsync, _safeDecode, _safeDecodeAsync, _safeEncode, _safeEncodeAsync, _safeParse, _safeParseAsync, validate, validateAsync };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
//#region node_modules/zod/v4/core/regexes.js
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
4
|
+
* (timestamps embedded in the id). Use {@link cuid2} instead.
|
|
5
|
+
* See https://github.com/paralleldrive/cuid.
|
|
6
|
+
*/
|
|
7
|
+
const cuid = /^[cC][0-9a-z]{6,}$/;
|
|
8
|
+
const cuid2 = /^[0-9a-z]+$/;
|
|
9
|
+
const ulid = /^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/;
|
|
10
|
+
const xid = /^[0-9a-vA-V]{20}$/;
|
|
11
|
+
const ksuid = /^[A-Za-z0-9]{27}$/;
|
|
12
|
+
const nanoid = /^[a-zA-Z0-9_-]{21}$/;
|
|
13
|
+
function nanoidOfLength(length) {
|
|
14
|
+
return new RegExp(`^[a-zA-Z0-9_-]{${length}}$`);
|
|
15
|
+
}
|
|
16
|
+
/** ISO 8601-1 duration regex. Does not support the 8601-2 extensions like negative durations or fractional/negative components. */
|
|
17
|
+
const duration = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;
|
|
18
|
+
/** A regex for any UUID-like identifier: 8-4-4-4-12 hex pattern */
|
|
19
|
+
const guid = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/;
|
|
20
|
+
/** Returns a regex for validating an RFC 9562/4122 UUID.
|
|
21
|
+
*
|
|
22
|
+
* @param version Optionally specify a version 1-8. If no version is specified, all versions are supported. */
|
|
23
|
+
const uuid = (version) => {
|
|
24
|
+
if (!version) return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;
|
|
25
|
+
return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);
|
|
26
|
+
};
|
|
27
|
+
/** Practical email validation */
|
|
28
|
+
const email = /^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
|
|
29
|
+
const _emoji = `^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;
|
|
30
|
+
function emoji() {
|
|
31
|
+
return new RegExp(_emoji, "u");
|
|
32
|
+
}
|
|
33
|
+
const ipv4 = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
|
|
34
|
+
const ipv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;
|
|
35
|
+
const cidrv4 = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/;
|
|
36
|
+
const cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
|
|
37
|
+
const base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
|
|
38
|
+
const base64url = /^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;
|
|
39
|
+
const httpProtocol = /^https?$/;
|
|
40
|
+
const e164 = /^\+[1-9]\d{6,14}$/;
|
|
41
|
+
const dateSource = `(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;
|
|
42
|
+
/** Anchors a pattern source. The interpolation lives here rather than at the call site because
|
|
43
|
+
* esbuild will not drop a `@__PURE__` call whose own argument interpolates a variable, but it
|
|
44
|
+
* will drop `anchor(dateSource)`. Keeping it inline pinned `date` into every bundle. */
|
|
45
|
+
function anchor(source) {
|
|
46
|
+
return new RegExp(`^${source}$`);
|
|
47
|
+
}
|
|
48
|
+
const date = /*@__PURE__*/ anchor(dateSource);
|
|
49
|
+
function timeSource(args) {
|
|
50
|
+
const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`;
|
|
51
|
+
return typeof args.precision === "number" ? args.precision === -1 ? `${hhmm}` : args.precision === 0 ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args.precision}}` : args.seconds ? `${hhmm}:[0-5]\\d(?:\\.\\d+)?` : `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`;
|
|
52
|
+
}
|
|
53
|
+
function time(args) {
|
|
54
|
+
return new RegExp(`^${timeSource(args)}$`);
|
|
55
|
+
}
|
|
56
|
+
function datetime(args) {
|
|
57
|
+
const opts = ["Z"];
|
|
58
|
+
if (args.offset) opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);
|
|
59
|
+
const qualified = `${timeSource({
|
|
60
|
+
precision: args.precision,
|
|
61
|
+
seconds: true
|
|
62
|
+
})}(?:${opts.join("|")})`;
|
|
63
|
+
const timeRegex = args.local ? `${qualified}|${timeSource({ precision: args.precision })}` : qualified;
|
|
64
|
+
return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
|
|
65
|
+
}
|
|
66
|
+
const anyString = /^[\s\S]{0,}$/;
|
|
67
|
+
const integer = /^-?\d+$/;
|
|
68
|
+
const number = /^-?\d+(?:\.\d+)?$/;
|
|
69
|
+
const boolean = /^(?:true|false)$/i;
|
|
70
|
+
const lowercase = /^[^A-Z]*$/;
|
|
71
|
+
const uppercase = /^[^a-z]*$/;
|
|
72
|
+
//#endregion
|
|
73
|
+
export { anyString, base64, base64url, boolean, cidrv4, cidrv6, cuid, cuid2, date, datetime, duration, e164, email, emoji, guid, httpProtocol, integer, ipv4, ipv6, ksuid, lowercase, nanoid, nanoidOfLength, number, time, ulid, uppercase, uuid, xid };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
//#region node_modules/zod/v4/core/registries.js
|
|
2
|
+
var _a;
|
|
3
|
+
var $ZodRegistry = class {
|
|
4
|
+
constructor() {
|
|
5
|
+
this._map = /* @__PURE__ */ new WeakMap();
|
|
6
|
+
this._idmap = /* @__PURE__ */ new Map();
|
|
7
|
+
}
|
|
8
|
+
add(schema, ..._meta) {
|
|
9
|
+
const meta = _meta[0];
|
|
10
|
+
this._map.set(schema, meta);
|
|
11
|
+
if (meta && typeof meta === "object" && "id" in meta) this._idmap.set(meta.id, schema);
|
|
12
|
+
return this;
|
|
13
|
+
}
|
|
14
|
+
clear() {
|
|
15
|
+
this._map = /* @__PURE__ */ new WeakMap();
|
|
16
|
+
this._idmap = /* @__PURE__ */ new Map();
|
|
17
|
+
return this;
|
|
18
|
+
}
|
|
19
|
+
remove(schema) {
|
|
20
|
+
const meta = this._map.get(schema);
|
|
21
|
+
if (meta && typeof meta === "object" && "id" in meta) this._idmap.delete(meta.id);
|
|
22
|
+
this._map.delete(schema);
|
|
23
|
+
return this;
|
|
24
|
+
}
|
|
25
|
+
get(schema) {
|
|
26
|
+
const p = schema._zod.parent;
|
|
27
|
+
if (p) {
|
|
28
|
+
const pm = { ...this.get(p) ?? {} };
|
|
29
|
+
delete pm.id;
|
|
30
|
+
const f = {
|
|
31
|
+
...pm,
|
|
32
|
+
...this._map.get(schema)
|
|
33
|
+
};
|
|
34
|
+
return Object.keys(f).length ? f : void 0;
|
|
35
|
+
}
|
|
36
|
+
return this._map.get(schema);
|
|
37
|
+
}
|
|
38
|
+
has(schema) {
|
|
39
|
+
return this._map.has(schema);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
function registry() {
|
|
43
|
+
return new $ZodRegistry();
|
|
44
|
+
}
|
|
45
|
+
(_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
|
|
46
|
+
const globalRegistry = globalThis.__zod_globalRegistry;
|
|
47
|
+
//#endregion
|
|
48
|
+
export { $ZodRegistry, globalRegistry, registry };
|