@atproto/api 0.3.0 → 0.3.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/dist/client/index.d.ts +67 -0
- package/dist/client/lexicons.d.ts +385 -0
- package/dist/client/types/app/bsky/actor/defs.d.ts +2 -0
- package/dist/client/types/app/bsky/feed/generator.d.ts +1 -0
- package/dist/client/types/app/bsky/graph/defs.d.ts +42 -0
- package/dist/client/types/app/bsky/graph/getList.d.ts +23 -0
- package/dist/client/types/app/bsky/graph/getListMutes.d.ts +21 -0
- package/dist/client/types/app/bsky/graph/getLists.d.ts +22 -0
- package/dist/client/types/app/bsky/graph/list.d.ts +14 -0
- package/dist/client/types/app/bsky/graph/listitem.d.ts +9 -0
- package/dist/client/types/app/bsky/graph/muteActorList.d.ts +17 -0
- package/dist/client/types/app/bsky/graph/unmuteActorList.d.ts +17 -0
- package/dist/index.js +1547 -268
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
- package/src/client/index.ts +200 -0
- package/src/client/lexicons.ts +386 -0
- package/src/client/types/app/bsky/actor/defs.ts +2 -0
- package/src/client/types/app/bsky/graph/defs.ts +95 -0
- package/src/client/types/app/bsky/graph/getList.ts +40 -0
- package/src/client/types/app/bsky/graph/getListMutes.ts +38 -0
- package/src/client/types/app/bsky/graph/getLists.ts +39 -0
- package/src/client/types/app/bsky/graph/list.ts +32 -0
- package/src/client/types/app/bsky/graph/listitem.ts +27 -0
- package/src/client/types/app/bsky/graph/muteActorList.ts +32 -0
- package/src/client/types/app/bsky/graph/unmuteActorList.ts +32 -0
- package/tsconfig.build.tsbuildinfo +1 -1
package/dist/index.js
CHANGED
|
@@ -5,8 +5,8 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __commonJS = (cb,
|
|
9
|
-
return
|
|
8
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
10
|
};
|
|
11
11
|
var __export = (target, all) => {
|
|
12
12
|
for (var name2 in all)
|
|
@@ -20,11 +20,11 @@ var __copyProps = (to, from3, except, desc) => {
|
|
|
20
20
|
}
|
|
21
21
|
return to;
|
|
22
22
|
};
|
|
23
|
-
var __toESM = (
|
|
24
|
-
isNodeMode || !
|
|
25
|
-
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
26
|
));
|
|
27
|
-
var __toCommonJS = (
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
28
|
|
|
29
29
|
// ../../node_modules/iso-datestring-validator/dist/index.js
|
|
30
30
|
var require_dist = __commonJS({
|
|
@@ -78,6 +78,7 @@ var require_dist = __commonJS({
|
|
|
78
78
|
// src/index.ts
|
|
79
79
|
var src_exports4 = {};
|
|
80
80
|
__export(src_exports4, {
|
|
81
|
+
APP_BSKY_GRAPH: () => APP_BSKY_GRAPH,
|
|
81
82
|
ActorNS: () => ActorNS,
|
|
82
83
|
AdminNS: () => AdminNS,
|
|
83
84
|
AppBskyActorDefs: () => defs_exports5,
|
|
@@ -102,13 +103,21 @@ __export(src_exports4, {
|
|
|
102
103
|
AppBskyFeedPost: () => post_exports,
|
|
103
104
|
AppBskyFeedRepost: () => repost_exports,
|
|
104
105
|
AppBskyGraphBlock: () => block_exports,
|
|
106
|
+
AppBskyGraphDefs: () => defs_exports7,
|
|
105
107
|
AppBskyGraphFollow: () => follow_exports,
|
|
106
108
|
AppBskyGraphGetBlocks: () => getBlocks_exports2,
|
|
107
109
|
AppBskyGraphGetFollowers: () => getFollowers_exports,
|
|
108
110
|
AppBskyGraphGetFollows: () => getFollows_exports,
|
|
111
|
+
AppBskyGraphGetList: () => getList_exports,
|
|
112
|
+
AppBskyGraphGetListMutes: () => getListMutes_exports,
|
|
113
|
+
AppBskyGraphGetLists: () => getLists_exports,
|
|
109
114
|
AppBskyGraphGetMutes: () => getMutes_exports,
|
|
115
|
+
AppBskyGraphList: () => list_exports,
|
|
116
|
+
AppBskyGraphListitem: () => listitem_exports,
|
|
110
117
|
AppBskyGraphMuteActor: () => muteActor_exports,
|
|
118
|
+
AppBskyGraphMuteActorList: () => muteActorList_exports,
|
|
111
119
|
AppBskyGraphUnmuteActor: () => unmuteActor_exports,
|
|
120
|
+
AppBskyGraphUnmuteActorList: () => unmuteActorList_exports,
|
|
112
121
|
AppBskyNotificationGetUnreadCount: () => getUnreadCount_exports,
|
|
113
122
|
AppBskyNotificationListNotifications: () => listNotifications_exports,
|
|
114
123
|
AppBskyNotificationUpdateSeen: () => updateSeen_exports,
|
|
@@ -197,6 +206,8 @@ __export(src_exports4, {
|
|
|
197
206
|
IdentityNS: () => IdentityNS,
|
|
198
207
|
LabelNS: () => LabelNS,
|
|
199
208
|
LikeRecord: () => LikeRecord,
|
|
209
|
+
ListRecord: () => ListRecord,
|
|
210
|
+
ListitemRecord: () => ListitemRecord,
|
|
200
211
|
ModerationNS: () => ModerationNS,
|
|
201
212
|
NotificationNS: () => NotificationNS,
|
|
202
213
|
PostRecord: () => PostRecord,
|
|
@@ -1453,6 +1464,15 @@ var util;
|
|
|
1453
1464
|
return value;
|
|
1454
1465
|
};
|
|
1455
1466
|
})(util || (util = {}));
|
|
1467
|
+
var objectUtil;
|
|
1468
|
+
(function(objectUtil2) {
|
|
1469
|
+
objectUtil2.mergeShapes = (first, second) => {
|
|
1470
|
+
return {
|
|
1471
|
+
...first,
|
|
1472
|
+
...second
|
|
1473
|
+
};
|
|
1474
|
+
};
|
|
1475
|
+
})(objectUtil || (objectUtil = {}));
|
|
1456
1476
|
var ZodParsedType = util.arrayToEnum([
|
|
1457
1477
|
"string",
|
|
1458
1478
|
"nan",
|
|
@@ -1490,6 +1510,8 @@ var getParsedType = (data) => {
|
|
|
1490
1510
|
return ZodParsedType.function;
|
|
1491
1511
|
case "bigint":
|
|
1492
1512
|
return ZodParsedType.bigint;
|
|
1513
|
+
case "symbol":
|
|
1514
|
+
return ZodParsedType.symbol;
|
|
1493
1515
|
case "object":
|
|
1494
1516
|
if (Array.isArray(data)) {
|
|
1495
1517
|
return ZodParsedType.array;
|
|
@@ -1529,7 +1551,8 @@ var ZodIssueCode = util.arrayToEnum([
|
|
|
1529
1551
|
"too_small",
|
|
1530
1552
|
"too_big",
|
|
1531
1553
|
"invalid_intersection_types",
|
|
1532
|
-
"not_multiple_of"
|
|
1554
|
+
"not_multiple_of",
|
|
1555
|
+
"not_finite"
|
|
1533
1556
|
]);
|
|
1534
1557
|
var quotelessJson = (obj) => {
|
|
1535
1558
|
const json = JSON.stringify(obj, null, 2);
|
|
@@ -1659,7 +1682,12 @@ var errorMap = (issue, _ctx) => {
|
|
|
1659
1682
|
break;
|
|
1660
1683
|
case ZodIssueCode.invalid_string:
|
|
1661
1684
|
if (typeof issue.validation === "object") {
|
|
1662
|
-
if ("
|
|
1685
|
+
if ("includes" in issue.validation) {
|
|
1686
|
+
message = `Invalid input: must include "${issue.validation.includes}"`;
|
|
1687
|
+
if (typeof issue.validation.position === "number") {
|
|
1688
|
+
message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`;
|
|
1689
|
+
}
|
|
1690
|
+
} else if ("startsWith" in issue.validation) {
|
|
1663
1691
|
message = `Invalid input: must start with "${issue.validation.startsWith}"`;
|
|
1664
1692
|
} else if ("endsWith" in issue.validation) {
|
|
1665
1693
|
message = `Invalid input: must end with "${issue.validation.endsWith}"`;
|
|
@@ -1674,25 +1702,27 @@ var errorMap = (issue, _ctx) => {
|
|
|
1674
1702
|
break;
|
|
1675
1703
|
case ZodIssueCode.too_small:
|
|
1676
1704
|
if (issue.type === "array")
|
|
1677
|
-
message = `Array must contain ${issue.inclusive ? `at least` : `more than`} ${issue.minimum} element(s)`;
|
|
1705
|
+
message = `Array must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `more than`} ${issue.minimum} element(s)`;
|
|
1678
1706
|
else if (issue.type === "string")
|
|
1679
|
-
message = `String must contain ${issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;
|
|
1707
|
+
message = `String must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;
|
|
1680
1708
|
else if (issue.type === "number")
|
|
1681
|
-
message = `Number must be
|
|
1709
|
+
message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
|
|
1682
1710
|
else if (issue.type === "date")
|
|
1683
|
-
message = `Date must be
|
|
1711
|
+
message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue.minimum))}`;
|
|
1684
1712
|
else
|
|
1685
1713
|
message = "Invalid input";
|
|
1686
1714
|
break;
|
|
1687
1715
|
case ZodIssueCode.too_big:
|
|
1688
1716
|
if (issue.type === "array")
|
|
1689
|
-
message = `Array must contain ${issue.inclusive ? `at most` : `less than`} ${issue.maximum} element(s)`;
|
|
1717
|
+
message = `Array must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `less than`} ${issue.maximum} element(s)`;
|
|
1690
1718
|
else if (issue.type === "string")
|
|
1691
|
-
message = `String must contain ${issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;
|
|
1719
|
+
message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;
|
|
1692
1720
|
else if (issue.type === "number")
|
|
1693
|
-
message = `Number must be
|
|
1721
|
+
message = `Number must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
|
|
1722
|
+
else if (issue.type === "bigint")
|
|
1723
|
+
message = `BigInt must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
|
|
1694
1724
|
else if (issue.type === "date")
|
|
1695
|
-
message = `Date must be
|
|
1725
|
+
message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(Number(issue.maximum))}`;
|
|
1696
1726
|
else
|
|
1697
1727
|
message = "Invalid input";
|
|
1698
1728
|
break;
|
|
@@ -1705,6 +1735,9 @@ var errorMap = (issue, _ctx) => {
|
|
|
1705
1735
|
case ZodIssueCode.not_multiple_of:
|
|
1706
1736
|
message = `Number must be a multiple of ${issue.multipleOf}`;
|
|
1707
1737
|
break;
|
|
1738
|
+
case ZodIssueCode.not_finite:
|
|
1739
|
+
message = "Number must be finite";
|
|
1740
|
+
break;
|
|
1708
1741
|
default:
|
|
1709
1742
|
message = _ctx.defaultError;
|
|
1710
1743
|
util.assertNever(issue);
|
|
@@ -1811,7 +1844,7 @@ var OK = (value) => ({ status: "valid", value });
|
|
|
1811
1844
|
var isAborted = (x) => x.status === "aborted";
|
|
1812
1845
|
var isDirty = (x) => x.status === "dirty";
|
|
1813
1846
|
var isValid = (x) => x.status === "valid";
|
|
1814
|
-
var isAsync = (x) => typeof Promise !==
|
|
1847
|
+
var isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
|
|
1815
1848
|
var errorUtil;
|
|
1816
1849
|
(function(errorUtil2) {
|
|
1817
1850
|
errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
|
@@ -1819,13 +1852,21 @@ var errorUtil;
|
|
|
1819
1852
|
})(errorUtil || (errorUtil = {}));
|
|
1820
1853
|
var ParseInputLazyPath = class {
|
|
1821
1854
|
constructor(parent, value, path, key) {
|
|
1855
|
+
this._cachedPath = [];
|
|
1822
1856
|
this.parent = parent;
|
|
1823
1857
|
this.data = value;
|
|
1824
1858
|
this._path = path;
|
|
1825
1859
|
this._key = key;
|
|
1826
1860
|
}
|
|
1827
1861
|
get path() {
|
|
1828
|
-
|
|
1862
|
+
if (!this._cachedPath.length) {
|
|
1863
|
+
if (this._key instanceof Array) {
|
|
1864
|
+
this._cachedPath.push(...this._path, ...this._key);
|
|
1865
|
+
} else {
|
|
1866
|
+
this._cachedPath.push(...this._path, this._key);
|
|
1867
|
+
}
|
|
1868
|
+
}
|
|
1869
|
+
return this._cachedPath;
|
|
1829
1870
|
}
|
|
1830
1871
|
};
|
|
1831
1872
|
var handleResult = (ctx, result) => {
|
|
@@ -1835,8 +1876,16 @@ var handleResult = (ctx, result) => {
|
|
|
1835
1876
|
if (!ctx.common.issues.length) {
|
|
1836
1877
|
throw new Error("Validation failed but no issues detected.");
|
|
1837
1878
|
}
|
|
1838
|
-
|
|
1839
|
-
|
|
1879
|
+
return {
|
|
1880
|
+
success: false,
|
|
1881
|
+
get error() {
|
|
1882
|
+
if (this._error)
|
|
1883
|
+
return this._error;
|
|
1884
|
+
const error = new ZodError(ctx.common.issues);
|
|
1885
|
+
this._error = error;
|
|
1886
|
+
return this._error;
|
|
1887
|
+
}
|
|
1888
|
+
};
|
|
1840
1889
|
}
|
|
1841
1890
|
};
|
|
1842
1891
|
function processCreateParams(params2) {
|
|
@@ -1861,7 +1910,6 @@ function processCreateParams(params2) {
|
|
|
1861
1910
|
var ZodType = class {
|
|
1862
1911
|
constructor(def2) {
|
|
1863
1912
|
this.spa = this.safeParseAsync;
|
|
1864
|
-
this.superRefine = this._refinement;
|
|
1865
1913
|
this._def = def2;
|
|
1866
1914
|
this.parse = this.parse.bind(this);
|
|
1867
1915
|
this.safeParse = this.safeParse.bind(this);
|
|
@@ -1879,8 +1927,11 @@ var ZodType = class {
|
|
|
1879
1927
|
this.or = this.or.bind(this);
|
|
1880
1928
|
this.and = this.and.bind(this);
|
|
1881
1929
|
this.transform = this.transform.bind(this);
|
|
1930
|
+
this.brand = this.brand.bind(this);
|
|
1882
1931
|
this.default = this.default.bind(this);
|
|
1932
|
+
this.catch = this.catch.bind(this);
|
|
1883
1933
|
this.describe = this.describe.bind(this);
|
|
1934
|
+
this.pipe = this.pipe.bind(this);
|
|
1884
1935
|
this.isNullable = this.isNullable.bind(this);
|
|
1885
1936
|
this.isOptional = this.isOptional.bind(this);
|
|
1886
1937
|
}
|
|
@@ -1966,7 +2017,7 @@ var ZodType = class {
|
|
|
1966
2017
|
data,
|
|
1967
2018
|
parsedType: getParsedType(data)
|
|
1968
2019
|
};
|
|
1969
|
-
const maybeAsyncResult = this._parse({ data, path:
|
|
2020
|
+
const maybeAsyncResult = this._parse({ data, path: ctx.path, parent: ctx });
|
|
1970
2021
|
const result = await (isAsync(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult));
|
|
1971
2022
|
return handleResult(ctx, result);
|
|
1972
2023
|
}
|
|
@@ -2021,29 +2072,33 @@ var ZodType = class {
|
|
|
2021
2072
|
effect: { type: "refinement", refinement }
|
|
2022
2073
|
});
|
|
2023
2074
|
}
|
|
2075
|
+
superRefine(refinement) {
|
|
2076
|
+
return this._refinement(refinement);
|
|
2077
|
+
}
|
|
2024
2078
|
optional() {
|
|
2025
|
-
return ZodOptional.create(this);
|
|
2079
|
+
return ZodOptional.create(this, this._def);
|
|
2026
2080
|
}
|
|
2027
2081
|
nullable() {
|
|
2028
|
-
return ZodNullable.create(this);
|
|
2082
|
+
return ZodNullable.create(this, this._def);
|
|
2029
2083
|
}
|
|
2030
2084
|
nullish() {
|
|
2031
|
-
return this.
|
|
2085
|
+
return this.nullable().optional();
|
|
2032
2086
|
}
|
|
2033
2087
|
array() {
|
|
2034
|
-
return ZodArray.create(this);
|
|
2088
|
+
return ZodArray.create(this, this._def);
|
|
2035
2089
|
}
|
|
2036
2090
|
promise() {
|
|
2037
|
-
return ZodPromise.create(this);
|
|
2091
|
+
return ZodPromise.create(this, this._def);
|
|
2038
2092
|
}
|
|
2039
2093
|
or(option) {
|
|
2040
|
-
return ZodUnion.create([this, option]);
|
|
2094
|
+
return ZodUnion.create([this, option], this._def);
|
|
2041
2095
|
}
|
|
2042
2096
|
and(incoming) {
|
|
2043
|
-
return ZodIntersection.create(this, incoming);
|
|
2097
|
+
return ZodIntersection.create(this, incoming, this._def);
|
|
2044
2098
|
}
|
|
2045
2099
|
transform(transform) {
|
|
2046
2100
|
return new ZodEffects({
|
|
2101
|
+
...processCreateParams(this._def),
|
|
2047
2102
|
schema: this,
|
|
2048
2103
|
typeName: ZodFirstPartyTypeKind.ZodEffects,
|
|
2049
2104
|
effect: { type: "transform", transform }
|
|
@@ -2052,6 +2107,7 @@ var ZodType = class {
|
|
|
2052
2107
|
default(def2) {
|
|
2053
2108
|
const defaultValueFunc = typeof def2 === "function" ? def2 : () => def2;
|
|
2054
2109
|
return new ZodDefault({
|
|
2110
|
+
...processCreateParams(this._def),
|
|
2055
2111
|
innerType: this,
|
|
2056
2112
|
defaultValue: defaultValueFunc,
|
|
2057
2113
|
typeName: ZodFirstPartyTypeKind.ZodDefault
|
|
@@ -2061,7 +2117,16 @@ var ZodType = class {
|
|
|
2061
2117
|
return new ZodBranded({
|
|
2062
2118
|
typeName: ZodFirstPartyTypeKind.ZodBranded,
|
|
2063
2119
|
type: this,
|
|
2064
|
-
...processCreateParams(
|
|
2120
|
+
...processCreateParams(this._def)
|
|
2121
|
+
});
|
|
2122
|
+
}
|
|
2123
|
+
catch(def2) {
|
|
2124
|
+
const catchValueFunc = typeof def2 === "function" ? def2 : () => def2;
|
|
2125
|
+
return new ZodCatch({
|
|
2126
|
+
...processCreateParams(this._def),
|
|
2127
|
+
innerType: this,
|
|
2128
|
+
catchValue: catchValueFunc,
|
|
2129
|
+
typeName: ZodFirstPartyTypeKind.ZodCatch
|
|
2065
2130
|
});
|
|
2066
2131
|
}
|
|
2067
2132
|
describe(description) {
|
|
@@ -2071,6 +2136,9 @@ var ZodType = class {
|
|
|
2071
2136
|
description
|
|
2072
2137
|
});
|
|
2073
2138
|
}
|
|
2139
|
+
pipe(target) {
|
|
2140
|
+
return ZodPipeline.create(this, target);
|
|
2141
|
+
}
|
|
2074
2142
|
isOptional() {
|
|
2075
2143
|
return this.safeParse(void 0).success;
|
|
2076
2144
|
}
|
|
@@ -2079,8 +2147,43 @@ var ZodType = class {
|
|
|
2079
2147
|
}
|
|
2080
2148
|
};
|
|
2081
2149
|
var cuidRegex = /^c[^\s-]{8,}$/i;
|
|
2150
|
+
var cuid2Regex = /^[a-z][a-z0-9]*$/;
|
|
2151
|
+
var ulidRegex = /[0-9A-HJKMNP-TV-Z]{26}/;
|
|
2082
2152
|
var uuidRegex = /^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i;
|
|
2083
|
-
var emailRegex = /^(([^<>()[\]
|
|
2153
|
+
var emailRegex = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\])|(\[IPv6:(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))\])|([A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])*(\.[A-Za-z]{2,})+))$/;
|
|
2154
|
+
var emojiRegex = /^(\p{Extended_Pictographic}|\p{Emoji_Component})+$/u;
|
|
2155
|
+
var ipv4Regex = /^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/;
|
|
2156
|
+
var ipv6Regex = /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;
|
|
2157
|
+
var datetimeRegex = (args) => {
|
|
2158
|
+
if (args.precision) {
|
|
2159
|
+
if (args.offset) {
|
|
2160
|
+
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`);
|
|
2161
|
+
} else {
|
|
2162
|
+
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}Z$`);
|
|
2163
|
+
}
|
|
2164
|
+
} else if (args.precision === 0) {
|
|
2165
|
+
if (args.offset) {
|
|
2166
|
+
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$`);
|
|
2167
|
+
} else {
|
|
2168
|
+
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$`);
|
|
2169
|
+
}
|
|
2170
|
+
} else {
|
|
2171
|
+
if (args.offset) {
|
|
2172
|
+
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$`);
|
|
2173
|
+
} else {
|
|
2174
|
+
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$`);
|
|
2175
|
+
}
|
|
2176
|
+
}
|
|
2177
|
+
};
|
|
2178
|
+
function isValidIP(ip, version2) {
|
|
2179
|
+
if ((version2 === "v4" || !version2) && ipv4Regex.test(ip)) {
|
|
2180
|
+
return true;
|
|
2181
|
+
}
|
|
2182
|
+
if ((version2 === "v6" || !version2) && ipv6Regex.test(ip)) {
|
|
2183
|
+
return true;
|
|
2184
|
+
}
|
|
2185
|
+
return false;
|
|
2186
|
+
}
|
|
2084
2187
|
var ZodString = class extends ZodType {
|
|
2085
2188
|
constructor() {
|
|
2086
2189
|
super(...arguments);
|
|
@@ -2094,8 +2197,19 @@ var ZodString = class extends ZodType {
|
|
|
2094
2197
|
...this._def,
|
|
2095
2198
|
checks: [...this._def.checks, { kind: "trim" }]
|
|
2096
2199
|
});
|
|
2200
|
+
this.toLowerCase = () => new ZodString({
|
|
2201
|
+
...this._def,
|
|
2202
|
+
checks: [...this._def.checks, { kind: "toLowerCase" }]
|
|
2203
|
+
});
|
|
2204
|
+
this.toUpperCase = () => new ZodString({
|
|
2205
|
+
...this._def,
|
|
2206
|
+
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
2207
|
+
});
|
|
2097
2208
|
}
|
|
2098
2209
|
_parse(input) {
|
|
2210
|
+
if (this._def.coerce) {
|
|
2211
|
+
input.data = String(input.data);
|
|
2212
|
+
}
|
|
2099
2213
|
const parsedType = this._getType(input);
|
|
2100
2214
|
if (parsedType !== ZodParsedType.string) {
|
|
2101
2215
|
const ctx2 = this._getOrReturnCtx(input);
|
|
@@ -2120,6 +2234,7 @@ var ZodString = class extends ZodType {
|
|
|
2120
2234
|
minimum: check.value,
|
|
2121
2235
|
type: "string",
|
|
2122
2236
|
inclusive: true,
|
|
2237
|
+
exact: false,
|
|
2123
2238
|
message: check.message
|
|
2124
2239
|
});
|
|
2125
2240
|
status.dirty();
|
|
@@ -2132,10 +2247,37 @@ var ZodString = class extends ZodType {
|
|
|
2132
2247
|
maximum: check.value,
|
|
2133
2248
|
type: "string",
|
|
2134
2249
|
inclusive: true,
|
|
2250
|
+
exact: false,
|
|
2135
2251
|
message: check.message
|
|
2136
2252
|
});
|
|
2137
2253
|
status.dirty();
|
|
2138
2254
|
}
|
|
2255
|
+
} else if (check.kind === "length") {
|
|
2256
|
+
const tooBig = input.data.length > check.value;
|
|
2257
|
+
const tooSmall = input.data.length < check.value;
|
|
2258
|
+
if (tooBig || tooSmall) {
|
|
2259
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
2260
|
+
if (tooBig) {
|
|
2261
|
+
addIssueToContext(ctx, {
|
|
2262
|
+
code: ZodIssueCode.too_big,
|
|
2263
|
+
maximum: check.value,
|
|
2264
|
+
type: "string",
|
|
2265
|
+
inclusive: true,
|
|
2266
|
+
exact: true,
|
|
2267
|
+
message: check.message
|
|
2268
|
+
});
|
|
2269
|
+
} else if (tooSmall) {
|
|
2270
|
+
addIssueToContext(ctx, {
|
|
2271
|
+
code: ZodIssueCode.too_small,
|
|
2272
|
+
minimum: check.value,
|
|
2273
|
+
type: "string",
|
|
2274
|
+
inclusive: true,
|
|
2275
|
+
exact: true,
|
|
2276
|
+
message: check.message
|
|
2277
|
+
});
|
|
2278
|
+
}
|
|
2279
|
+
status.dirty();
|
|
2280
|
+
}
|
|
2139
2281
|
} else if (check.kind === "email") {
|
|
2140
2282
|
if (!emailRegex.test(input.data)) {
|
|
2141
2283
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
@@ -2146,6 +2288,16 @@ var ZodString = class extends ZodType {
|
|
|
2146
2288
|
});
|
|
2147
2289
|
status.dirty();
|
|
2148
2290
|
}
|
|
2291
|
+
} else if (check.kind === "emoji") {
|
|
2292
|
+
if (!emojiRegex.test(input.data)) {
|
|
2293
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
2294
|
+
addIssueToContext(ctx, {
|
|
2295
|
+
validation: "emoji",
|
|
2296
|
+
code: ZodIssueCode.invalid_string,
|
|
2297
|
+
message: check.message
|
|
2298
|
+
});
|
|
2299
|
+
status.dirty();
|
|
2300
|
+
}
|
|
2149
2301
|
} else if (check.kind === "uuid") {
|
|
2150
2302
|
if (!uuidRegex.test(input.data)) {
|
|
2151
2303
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
@@ -2166,6 +2318,26 @@ var ZodString = class extends ZodType {
|
|
|
2166
2318
|
});
|
|
2167
2319
|
status.dirty();
|
|
2168
2320
|
}
|
|
2321
|
+
} else if (check.kind === "cuid2") {
|
|
2322
|
+
if (!cuid2Regex.test(input.data)) {
|
|
2323
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
2324
|
+
addIssueToContext(ctx, {
|
|
2325
|
+
validation: "cuid2",
|
|
2326
|
+
code: ZodIssueCode.invalid_string,
|
|
2327
|
+
message: check.message
|
|
2328
|
+
});
|
|
2329
|
+
status.dirty();
|
|
2330
|
+
}
|
|
2331
|
+
} else if (check.kind === "ulid") {
|
|
2332
|
+
if (!ulidRegex.test(input.data)) {
|
|
2333
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
2334
|
+
addIssueToContext(ctx, {
|
|
2335
|
+
validation: "ulid",
|
|
2336
|
+
code: ZodIssueCode.invalid_string,
|
|
2337
|
+
message: check.message
|
|
2338
|
+
});
|
|
2339
|
+
status.dirty();
|
|
2340
|
+
}
|
|
2169
2341
|
} else if (check.kind === "url") {
|
|
2170
2342
|
try {
|
|
2171
2343
|
new URL(input.data);
|
|
@@ -2192,6 +2364,20 @@ var ZodString = class extends ZodType {
|
|
|
2192
2364
|
}
|
|
2193
2365
|
} else if (check.kind === "trim") {
|
|
2194
2366
|
input.data = input.data.trim();
|
|
2367
|
+
} else if (check.kind === "includes") {
|
|
2368
|
+
if (!input.data.includes(check.value, check.position)) {
|
|
2369
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
2370
|
+
addIssueToContext(ctx, {
|
|
2371
|
+
code: ZodIssueCode.invalid_string,
|
|
2372
|
+
validation: { includes: check.value, position: check.position },
|
|
2373
|
+
message: check.message
|
|
2374
|
+
});
|
|
2375
|
+
status.dirty();
|
|
2376
|
+
}
|
|
2377
|
+
} else if (check.kind === "toLowerCase") {
|
|
2378
|
+
input.data = input.data.toLowerCase();
|
|
2379
|
+
} else if (check.kind === "toUpperCase") {
|
|
2380
|
+
input.data = input.data.toUpperCase();
|
|
2195
2381
|
} else if (check.kind === "startsWith") {
|
|
2196
2382
|
if (!input.data.startsWith(check.value)) {
|
|
2197
2383
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
@@ -2212,6 +2398,27 @@ var ZodString = class extends ZodType {
|
|
|
2212
2398
|
});
|
|
2213
2399
|
status.dirty();
|
|
2214
2400
|
}
|
|
2401
|
+
} else if (check.kind === "datetime") {
|
|
2402
|
+
const regex = datetimeRegex(check);
|
|
2403
|
+
if (!regex.test(input.data)) {
|
|
2404
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
2405
|
+
addIssueToContext(ctx, {
|
|
2406
|
+
code: ZodIssueCode.invalid_string,
|
|
2407
|
+
validation: "datetime",
|
|
2408
|
+
message: check.message
|
|
2409
|
+
});
|
|
2410
|
+
status.dirty();
|
|
2411
|
+
}
|
|
2412
|
+
} else if (check.kind === "ip") {
|
|
2413
|
+
if (!isValidIP(input.data, check.version)) {
|
|
2414
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
2415
|
+
addIssueToContext(ctx, {
|
|
2416
|
+
validation: "ip",
|
|
2417
|
+
code: ZodIssueCode.invalid_string,
|
|
2418
|
+
message: check.message
|
|
2419
|
+
});
|
|
2420
|
+
status.dirty();
|
|
2421
|
+
}
|
|
2215
2422
|
} else {
|
|
2216
2423
|
util.assertNever(check);
|
|
2217
2424
|
}
|
|
@@ -2230,12 +2437,41 @@ var ZodString = class extends ZodType {
|
|
|
2230
2437
|
url(message) {
|
|
2231
2438
|
return this._addCheck({ kind: "url", ...errorUtil.errToObj(message) });
|
|
2232
2439
|
}
|
|
2440
|
+
emoji(message) {
|
|
2441
|
+
return this._addCheck({ kind: "emoji", ...errorUtil.errToObj(message) });
|
|
2442
|
+
}
|
|
2233
2443
|
uuid(message) {
|
|
2234
2444
|
return this._addCheck({ kind: "uuid", ...errorUtil.errToObj(message) });
|
|
2235
2445
|
}
|
|
2236
2446
|
cuid(message) {
|
|
2237
2447
|
return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) });
|
|
2238
2448
|
}
|
|
2449
|
+
cuid2(message) {
|
|
2450
|
+
return this._addCheck({ kind: "cuid2", ...errorUtil.errToObj(message) });
|
|
2451
|
+
}
|
|
2452
|
+
ulid(message) {
|
|
2453
|
+
return this._addCheck({ kind: "ulid", ...errorUtil.errToObj(message) });
|
|
2454
|
+
}
|
|
2455
|
+
ip(options) {
|
|
2456
|
+
return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
|
|
2457
|
+
}
|
|
2458
|
+
datetime(options) {
|
|
2459
|
+
var _a;
|
|
2460
|
+
if (typeof options === "string") {
|
|
2461
|
+
return this._addCheck({
|
|
2462
|
+
kind: "datetime",
|
|
2463
|
+
precision: null,
|
|
2464
|
+
offset: false,
|
|
2465
|
+
message: options
|
|
2466
|
+
});
|
|
2467
|
+
}
|
|
2468
|
+
return this._addCheck({
|
|
2469
|
+
kind: "datetime",
|
|
2470
|
+
precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
|
|
2471
|
+
offset: (_a = options === null || options === void 0 ? void 0 : options.offset) !== null && _a !== void 0 ? _a : false,
|
|
2472
|
+
...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
|
|
2473
|
+
});
|
|
2474
|
+
}
|
|
2239
2475
|
regex(regex, message) {
|
|
2240
2476
|
return this._addCheck({
|
|
2241
2477
|
kind: "regex",
|
|
@@ -2243,6 +2479,14 @@ var ZodString = class extends ZodType {
|
|
|
2243
2479
|
...errorUtil.errToObj(message)
|
|
2244
2480
|
});
|
|
2245
2481
|
}
|
|
2482
|
+
includes(value, options) {
|
|
2483
|
+
return this._addCheck({
|
|
2484
|
+
kind: "includes",
|
|
2485
|
+
value,
|
|
2486
|
+
position: options === null || options === void 0 ? void 0 : options.position,
|
|
2487
|
+
...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
|
|
2488
|
+
});
|
|
2489
|
+
}
|
|
2246
2490
|
startsWith(value, message) {
|
|
2247
2491
|
return this._addCheck({
|
|
2248
2492
|
kind: "startsWith",
|
|
@@ -2272,7 +2516,14 @@ var ZodString = class extends ZodType {
|
|
|
2272
2516
|
});
|
|
2273
2517
|
}
|
|
2274
2518
|
length(len, message) {
|
|
2275
|
-
return this.
|
|
2519
|
+
return this._addCheck({
|
|
2520
|
+
kind: "length",
|
|
2521
|
+
value: len,
|
|
2522
|
+
...errorUtil.errToObj(message)
|
|
2523
|
+
});
|
|
2524
|
+
}
|
|
2525
|
+
get isDatetime() {
|
|
2526
|
+
return !!this._def.checks.find((ch) => ch.kind === "datetime");
|
|
2276
2527
|
}
|
|
2277
2528
|
get isEmail() {
|
|
2278
2529
|
return !!this._def.checks.find((ch) => ch.kind === "email");
|
|
@@ -2280,12 +2531,24 @@ var ZodString = class extends ZodType {
|
|
|
2280
2531
|
get isURL() {
|
|
2281
2532
|
return !!this._def.checks.find((ch) => ch.kind === "url");
|
|
2282
2533
|
}
|
|
2534
|
+
get isEmoji() {
|
|
2535
|
+
return !!this._def.checks.find((ch) => ch.kind === "emoji");
|
|
2536
|
+
}
|
|
2283
2537
|
get isUUID() {
|
|
2284
2538
|
return !!this._def.checks.find((ch) => ch.kind === "uuid");
|
|
2285
2539
|
}
|
|
2286
2540
|
get isCUID() {
|
|
2287
2541
|
return !!this._def.checks.find((ch) => ch.kind === "cuid");
|
|
2288
2542
|
}
|
|
2543
|
+
get isCUID2() {
|
|
2544
|
+
return !!this._def.checks.find((ch) => ch.kind === "cuid2");
|
|
2545
|
+
}
|
|
2546
|
+
get isULID() {
|
|
2547
|
+
return !!this._def.checks.find((ch) => ch.kind === "ulid");
|
|
2548
|
+
}
|
|
2549
|
+
get isIP() {
|
|
2550
|
+
return !!this._def.checks.find((ch) => ch.kind === "ip");
|
|
2551
|
+
}
|
|
2289
2552
|
get minLength() {
|
|
2290
2553
|
let min = null;
|
|
2291
2554
|
for (const ch of this._def.checks) {
|
|
@@ -2308,9 +2571,11 @@ var ZodString = class extends ZodType {
|
|
|
2308
2571
|
}
|
|
2309
2572
|
};
|
|
2310
2573
|
ZodString.create = (params2) => {
|
|
2574
|
+
var _a;
|
|
2311
2575
|
return new ZodString({
|
|
2312
2576
|
checks: [],
|
|
2313
2577
|
typeName: ZodFirstPartyTypeKind.ZodString,
|
|
2578
|
+
coerce: (_a = params2 === null || params2 === void 0 ? void 0 : params2.coerce) !== null && _a !== void 0 ? _a : false,
|
|
2314
2579
|
...processCreateParams(params2)
|
|
2315
2580
|
});
|
|
2316
2581
|
};
|
|
@@ -2330,6 +2595,9 @@ var ZodNumber = class extends ZodType {
|
|
|
2330
2595
|
this.step = this.multipleOf;
|
|
2331
2596
|
}
|
|
2332
2597
|
_parse(input) {
|
|
2598
|
+
if (this._def.coerce) {
|
|
2599
|
+
input.data = Number(input.data);
|
|
2600
|
+
}
|
|
2333
2601
|
const parsedType = this._getType(input);
|
|
2334
2602
|
if (parsedType !== ZodParsedType.number) {
|
|
2335
2603
|
const ctx2 = this._getOrReturnCtx(input);
|
|
@@ -2363,6 +2631,7 @@ var ZodNumber = class extends ZodType {
|
|
|
2363
2631
|
minimum: check.value,
|
|
2364
2632
|
type: "number",
|
|
2365
2633
|
inclusive: check.inclusive,
|
|
2634
|
+
exact: false,
|
|
2366
2635
|
message: check.message
|
|
2367
2636
|
});
|
|
2368
2637
|
status.dirty();
|
|
@@ -2376,6 +2645,7 @@ var ZodNumber = class extends ZodType {
|
|
|
2376
2645
|
maximum: check.value,
|
|
2377
2646
|
type: "number",
|
|
2378
2647
|
inclusive: check.inclusive,
|
|
2648
|
+
exact: false,
|
|
2379
2649
|
message: check.message
|
|
2380
2650
|
});
|
|
2381
2651
|
status.dirty();
|
|
@@ -2390,6 +2660,15 @@ var ZodNumber = class extends ZodType {
|
|
|
2390
2660
|
});
|
|
2391
2661
|
status.dirty();
|
|
2392
2662
|
}
|
|
2663
|
+
} else if (check.kind === "finite") {
|
|
2664
|
+
if (!Number.isFinite(input.data)) {
|
|
2665
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
2666
|
+
addIssueToContext(ctx, {
|
|
2667
|
+
code: ZodIssueCode.not_finite,
|
|
2668
|
+
message: check.message
|
|
2669
|
+
});
|
|
2670
|
+
status.dirty();
|
|
2671
|
+
}
|
|
2393
2672
|
} else {
|
|
2394
2673
|
util.assertNever(check);
|
|
2395
2674
|
}
|
|
@@ -2473,6 +2752,25 @@ var ZodNumber = class extends ZodType {
|
|
|
2473
2752
|
message: errorUtil.toString(message)
|
|
2474
2753
|
});
|
|
2475
2754
|
}
|
|
2755
|
+
finite(message) {
|
|
2756
|
+
return this._addCheck({
|
|
2757
|
+
kind: "finite",
|
|
2758
|
+
message: errorUtil.toString(message)
|
|
2759
|
+
});
|
|
2760
|
+
}
|
|
2761
|
+
safe(message) {
|
|
2762
|
+
return this._addCheck({
|
|
2763
|
+
kind: "min",
|
|
2764
|
+
inclusive: true,
|
|
2765
|
+
value: Number.MIN_SAFE_INTEGER,
|
|
2766
|
+
message: errorUtil.toString(message)
|
|
2767
|
+
})._addCheck({
|
|
2768
|
+
kind: "max",
|
|
2769
|
+
inclusive: true,
|
|
2770
|
+
value: Number.MAX_SAFE_INTEGER,
|
|
2771
|
+
message: errorUtil.toString(message)
|
|
2772
|
+
});
|
|
2773
|
+
}
|
|
2476
2774
|
get minValue() {
|
|
2477
2775
|
let min = null;
|
|
2478
2776
|
for (const ch of this._def.checks) {
|
|
@@ -2494,39 +2792,203 @@ var ZodNumber = class extends ZodType {
|
|
|
2494
2792
|
return max;
|
|
2495
2793
|
}
|
|
2496
2794
|
get isInt() {
|
|
2497
|
-
return !!this._def.checks.find((ch) => ch.kind === "int");
|
|
2795
|
+
return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util.isInteger(ch.value));
|
|
2796
|
+
}
|
|
2797
|
+
get isFinite() {
|
|
2798
|
+
let max = null, min = null;
|
|
2799
|
+
for (const ch of this._def.checks) {
|
|
2800
|
+
if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
|
|
2801
|
+
return true;
|
|
2802
|
+
} else if (ch.kind === "min") {
|
|
2803
|
+
if (min === null || ch.value > min)
|
|
2804
|
+
min = ch.value;
|
|
2805
|
+
} else if (ch.kind === "max") {
|
|
2806
|
+
if (max === null || ch.value < max)
|
|
2807
|
+
max = ch.value;
|
|
2808
|
+
}
|
|
2809
|
+
}
|
|
2810
|
+
return Number.isFinite(min) && Number.isFinite(max);
|
|
2498
2811
|
}
|
|
2499
2812
|
};
|
|
2500
2813
|
ZodNumber.create = (params2) => {
|
|
2501
2814
|
return new ZodNumber({
|
|
2502
2815
|
checks: [],
|
|
2503
2816
|
typeName: ZodFirstPartyTypeKind.ZodNumber,
|
|
2817
|
+
coerce: (params2 === null || params2 === void 0 ? void 0 : params2.coerce) || false,
|
|
2504
2818
|
...processCreateParams(params2)
|
|
2505
2819
|
});
|
|
2506
2820
|
};
|
|
2507
2821
|
var ZodBigInt = class extends ZodType {
|
|
2822
|
+
constructor() {
|
|
2823
|
+
super(...arguments);
|
|
2824
|
+
this.min = this.gte;
|
|
2825
|
+
this.max = this.lte;
|
|
2826
|
+
}
|
|
2508
2827
|
_parse(input) {
|
|
2828
|
+
if (this._def.coerce) {
|
|
2829
|
+
input.data = BigInt(input.data);
|
|
2830
|
+
}
|
|
2509
2831
|
const parsedType = this._getType(input);
|
|
2510
2832
|
if (parsedType !== ZodParsedType.bigint) {
|
|
2511
|
-
const
|
|
2512
|
-
addIssueToContext(
|
|
2833
|
+
const ctx2 = this._getOrReturnCtx(input);
|
|
2834
|
+
addIssueToContext(ctx2, {
|
|
2513
2835
|
code: ZodIssueCode.invalid_type,
|
|
2514
2836
|
expected: ZodParsedType.bigint,
|
|
2515
|
-
received:
|
|
2837
|
+
received: ctx2.parsedType
|
|
2516
2838
|
});
|
|
2517
2839
|
return INVALID;
|
|
2518
2840
|
}
|
|
2519
|
-
|
|
2841
|
+
let ctx = void 0;
|
|
2842
|
+
const status = new ParseStatus();
|
|
2843
|
+
for (const check of this._def.checks) {
|
|
2844
|
+
if (check.kind === "min") {
|
|
2845
|
+
const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
|
|
2846
|
+
if (tooSmall) {
|
|
2847
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
2848
|
+
addIssueToContext(ctx, {
|
|
2849
|
+
code: ZodIssueCode.too_small,
|
|
2850
|
+
type: "bigint",
|
|
2851
|
+
minimum: check.value,
|
|
2852
|
+
inclusive: check.inclusive,
|
|
2853
|
+
message: check.message
|
|
2854
|
+
});
|
|
2855
|
+
status.dirty();
|
|
2856
|
+
}
|
|
2857
|
+
} else if (check.kind === "max") {
|
|
2858
|
+
const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
|
|
2859
|
+
if (tooBig) {
|
|
2860
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
2861
|
+
addIssueToContext(ctx, {
|
|
2862
|
+
code: ZodIssueCode.too_big,
|
|
2863
|
+
type: "bigint",
|
|
2864
|
+
maximum: check.value,
|
|
2865
|
+
inclusive: check.inclusive,
|
|
2866
|
+
message: check.message
|
|
2867
|
+
});
|
|
2868
|
+
status.dirty();
|
|
2869
|
+
}
|
|
2870
|
+
} else if (check.kind === "multipleOf") {
|
|
2871
|
+
if (input.data % check.value !== BigInt(0)) {
|
|
2872
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
2873
|
+
addIssueToContext(ctx, {
|
|
2874
|
+
code: ZodIssueCode.not_multiple_of,
|
|
2875
|
+
multipleOf: check.value,
|
|
2876
|
+
message: check.message
|
|
2877
|
+
});
|
|
2878
|
+
status.dirty();
|
|
2879
|
+
}
|
|
2880
|
+
} else {
|
|
2881
|
+
util.assertNever(check);
|
|
2882
|
+
}
|
|
2883
|
+
}
|
|
2884
|
+
return { status: status.value, value: input.data };
|
|
2885
|
+
}
|
|
2886
|
+
gte(value, message) {
|
|
2887
|
+
return this.setLimit("min", value, true, errorUtil.toString(message));
|
|
2888
|
+
}
|
|
2889
|
+
gt(value, message) {
|
|
2890
|
+
return this.setLimit("min", value, false, errorUtil.toString(message));
|
|
2891
|
+
}
|
|
2892
|
+
lte(value, message) {
|
|
2893
|
+
return this.setLimit("max", value, true, errorUtil.toString(message));
|
|
2894
|
+
}
|
|
2895
|
+
lt(value, message) {
|
|
2896
|
+
return this.setLimit("max", value, false, errorUtil.toString(message));
|
|
2897
|
+
}
|
|
2898
|
+
setLimit(kind, value, inclusive, message) {
|
|
2899
|
+
return new ZodBigInt({
|
|
2900
|
+
...this._def,
|
|
2901
|
+
checks: [
|
|
2902
|
+
...this._def.checks,
|
|
2903
|
+
{
|
|
2904
|
+
kind,
|
|
2905
|
+
value,
|
|
2906
|
+
inclusive,
|
|
2907
|
+
message: errorUtil.toString(message)
|
|
2908
|
+
}
|
|
2909
|
+
]
|
|
2910
|
+
});
|
|
2911
|
+
}
|
|
2912
|
+
_addCheck(check) {
|
|
2913
|
+
return new ZodBigInt({
|
|
2914
|
+
...this._def,
|
|
2915
|
+
checks: [...this._def.checks, check]
|
|
2916
|
+
});
|
|
2917
|
+
}
|
|
2918
|
+
positive(message) {
|
|
2919
|
+
return this._addCheck({
|
|
2920
|
+
kind: "min",
|
|
2921
|
+
value: BigInt(0),
|
|
2922
|
+
inclusive: false,
|
|
2923
|
+
message: errorUtil.toString(message)
|
|
2924
|
+
});
|
|
2925
|
+
}
|
|
2926
|
+
negative(message) {
|
|
2927
|
+
return this._addCheck({
|
|
2928
|
+
kind: "max",
|
|
2929
|
+
value: BigInt(0),
|
|
2930
|
+
inclusive: false,
|
|
2931
|
+
message: errorUtil.toString(message)
|
|
2932
|
+
});
|
|
2933
|
+
}
|
|
2934
|
+
nonpositive(message) {
|
|
2935
|
+
return this._addCheck({
|
|
2936
|
+
kind: "max",
|
|
2937
|
+
value: BigInt(0),
|
|
2938
|
+
inclusive: true,
|
|
2939
|
+
message: errorUtil.toString(message)
|
|
2940
|
+
});
|
|
2941
|
+
}
|
|
2942
|
+
nonnegative(message) {
|
|
2943
|
+
return this._addCheck({
|
|
2944
|
+
kind: "min",
|
|
2945
|
+
value: BigInt(0),
|
|
2946
|
+
inclusive: true,
|
|
2947
|
+
message: errorUtil.toString(message)
|
|
2948
|
+
});
|
|
2949
|
+
}
|
|
2950
|
+
multipleOf(value, message) {
|
|
2951
|
+
return this._addCheck({
|
|
2952
|
+
kind: "multipleOf",
|
|
2953
|
+
value,
|
|
2954
|
+
message: errorUtil.toString(message)
|
|
2955
|
+
});
|
|
2956
|
+
}
|
|
2957
|
+
get minValue() {
|
|
2958
|
+
let min = null;
|
|
2959
|
+
for (const ch of this._def.checks) {
|
|
2960
|
+
if (ch.kind === "min") {
|
|
2961
|
+
if (min === null || ch.value > min)
|
|
2962
|
+
min = ch.value;
|
|
2963
|
+
}
|
|
2964
|
+
}
|
|
2965
|
+
return min;
|
|
2966
|
+
}
|
|
2967
|
+
get maxValue() {
|
|
2968
|
+
let max = null;
|
|
2969
|
+
for (const ch of this._def.checks) {
|
|
2970
|
+
if (ch.kind === "max") {
|
|
2971
|
+
if (max === null || ch.value < max)
|
|
2972
|
+
max = ch.value;
|
|
2973
|
+
}
|
|
2974
|
+
}
|
|
2975
|
+
return max;
|
|
2520
2976
|
}
|
|
2521
2977
|
};
|
|
2522
2978
|
ZodBigInt.create = (params2) => {
|
|
2979
|
+
var _a;
|
|
2523
2980
|
return new ZodBigInt({
|
|
2981
|
+
checks: [],
|
|
2524
2982
|
typeName: ZodFirstPartyTypeKind.ZodBigInt,
|
|
2983
|
+
coerce: (_a = params2 === null || params2 === void 0 ? void 0 : params2.coerce) !== null && _a !== void 0 ? _a : false,
|
|
2525
2984
|
...processCreateParams(params2)
|
|
2526
2985
|
});
|
|
2527
2986
|
};
|
|
2528
2987
|
var ZodBoolean = class extends ZodType {
|
|
2529
2988
|
_parse(input) {
|
|
2989
|
+
if (this._def.coerce) {
|
|
2990
|
+
input.data = Boolean(input.data);
|
|
2991
|
+
}
|
|
2530
2992
|
const parsedType = this._getType(input);
|
|
2531
2993
|
if (parsedType !== ZodParsedType.boolean) {
|
|
2532
2994
|
const ctx = this._getOrReturnCtx(input);
|
|
@@ -2543,11 +3005,15 @@ var ZodBoolean = class extends ZodType {
|
|
|
2543
3005
|
ZodBoolean.create = (params2) => {
|
|
2544
3006
|
return new ZodBoolean({
|
|
2545
3007
|
typeName: ZodFirstPartyTypeKind.ZodBoolean,
|
|
3008
|
+
coerce: (params2 === null || params2 === void 0 ? void 0 : params2.coerce) || false,
|
|
2546
3009
|
...processCreateParams(params2)
|
|
2547
3010
|
});
|
|
2548
3011
|
};
|
|
2549
3012
|
var ZodDate = class extends ZodType {
|
|
2550
3013
|
_parse(input) {
|
|
3014
|
+
if (this._def.coerce) {
|
|
3015
|
+
input.data = new Date(input.data);
|
|
3016
|
+
}
|
|
2551
3017
|
const parsedType = this._getType(input);
|
|
2552
3018
|
if (parsedType !== ZodParsedType.date) {
|
|
2553
3019
|
const ctx2 = this._getOrReturnCtx(input);
|
|
@@ -2575,6 +3041,7 @@ var ZodDate = class extends ZodType {
|
|
|
2575
3041
|
code: ZodIssueCode.too_small,
|
|
2576
3042
|
message: check.message,
|
|
2577
3043
|
inclusive: true,
|
|
3044
|
+
exact: false,
|
|
2578
3045
|
minimum: check.value,
|
|
2579
3046
|
type: "date"
|
|
2580
3047
|
});
|
|
@@ -2587,6 +3054,7 @@ var ZodDate = class extends ZodType {
|
|
|
2587
3054
|
code: ZodIssueCode.too_big,
|
|
2588
3055
|
message: check.message,
|
|
2589
3056
|
inclusive: true,
|
|
3057
|
+
exact: false,
|
|
2590
3058
|
maximum: check.value,
|
|
2591
3059
|
type: "date"
|
|
2592
3060
|
});
|
|
@@ -2645,10 +3113,32 @@ var ZodDate = class extends ZodType {
|
|
|
2645
3113
|
ZodDate.create = (params2) => {
|
|
2646
3114
|
return new ZodDate({
|
|
2647
3115
|
checks: [],
|
|
3116
|
+
coerce: (params2 === null || params2 === void 0 ? void 0 : params2.coerce) || false,
|
|
2648
3117
|
typeName: ZodFirstPartyTypeKind.ZodDate,
|
|
2649
3118
|
...processCreateParams(params2)
|
|
2650
3119
|
});
|
|
2651
3120
|
};
|
|
3121
|
+
var ZodSymbol = class extends ZodType {
|
|
3122
|
+
_parse(input) {
|
|
3123
|
+
const parsedType = this._getType(input);
|
|
3124
|
+
if (parsedType !== ZodParsedType.symbol) {
|
|
3125
|
+
const ctx = this._getOrReturnCtx(input);
|
|
3126
|
+
addIssueToContext(ctx, {
|
|
3127
|
+
code: ZodIssueCode.invalid_type,
|
|
3128
|
+
expected: ZodParsedType.symbol,
|
|
3129
|
+
received: ctx.parsedType
|
|
3130
|
+
});
|
|
3131
|
+
return INVALID;
|
|
3132
|
+
}
|
|
3133
|
+
return OK(input.data);
|
|
3134
|
+
}
|
|
3135
|
+
};
|
|
3136
|
+
ZodSymbol.create = (params2) => {
|
|
3137
|
+
return new ZodSymbol({
|
|
3138
|
+
typeName: ZodFirstPartyTypeKind.ZodSymbol,
|
|
3139
|
+
...processCreateParams(params2)
|
|
3140
|
+
});
|
|
3141
|
+
};
|
|
2652
3142
|
var ZodUndefined = class extends ZodType {
|
|
2653
3143
|
_parse(input) {
|
|
2654
3144
|
const parsedType = this._getType(input);
|
|
@@ -2771,6 +3261,22 @@ var ZodArray = class extends ZodType {
|
|
|
2771
3261
|
});
|
|
2772
3262
|
return INVALID;
|
|
2773
3263
|
}
|
|
3264
|
+
if (def2.exactLength !== null) {
|
|
3265
|
+
const tooBig = ctx.data.length > def2.exactLength.value;
|
|
3266
|
+
const tooSmall = ctx.data.length < def2.exactLength.value;
|
|
3267
|
+
if (tooBig || tooSmall) {
|
|
3268
|
+
addIssueToContext(ctx, {
|
|
3269
|
+
code: tooBig ? ZodIssueCode.too_big : ZodIssueCode.too_small,
|
|
3270
|
+
minimum: tooSmall ? def2.exactLength.value : void 0,
|
|
3271
|
+
maximum: tooBig ? def2.exactLength.value : void 0,
|
|
3272
|
+
type: "array",
|
|
3273
|
+
inclusive: true,
|
|
3274
|
+
exact: true,
|
|
3275
|
+
message: def2.exactLength.message
|
|
3276
|
+
});
|
|
3277
|
+
status.dirty();
|
|
3278
|
+
}
|
|
3279
|
+
}
|
|
2774
3280
|
if (def2.minLength !== null) {
|
|
2775
3281
|
if (ctx.data.length < def2.minLength.value) {
|
|
2776
3282
|
addIssueToContext(ctx, {
|
|
@@ -2778,6 +3284,7 @@ var ZodArray = class extends ZodType {
|
|
|
2778
3284
|
minimum: def2.minLength.value,
|
|
2779
3285
|
type: "array",
|
|
2780
3286
|
inclusive: true,
|
|
3287
|
+
exact: false,
|
|
2781
3288
|
message: def2.minLength.message
|
|
2782
3289
|
});
|
|
2783
3290
|
status.dirty();
|
|
@@ -2790,19 +3297,20 @@ var ZodArray = class extends ZodType {
|
|
|
2790
3297
|
maximum: def2.maxLength.value,
|
|
2791
3298
|
type: "array",
|
|
2792
3299
|
inclusive: true,
|
|
3300
|
+
exact: false,
|
|
2793
3301
|
message: def2.maxLength.message
|
|
2794
3302
|
});
|
|
2795
3303
|
status.dirty();
|
|
2796
3304
|
}
|
|
2797
3305
|
}
|
|
2798
3306
|
if (ctx.common.async) {
|
|
2799
|
-
return Promise.all(ctx.data.map((item, i) => {
|
|
3307
|
+
return Promise.all([...ctx.data].map((item, i) => {
|
|
2800
3308
|
return def2.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));
|
|
2801
3309
|
})).then((result2) => {
|
|
2802
3310
|
return ParseStatus.mergeArray(status, result2);
|
|
2803
3311
|
});
|
|
2804
3312
|
}
|
|
2805
|
-
const result = ctx.data.map((item, i) => {
|
|
3313
|
+
const result = [...ctx.data].map((item, i) => {
|
|
2806
3314
|
return def2.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));
|
|
2807
3315
|
});
|
|
2808
3316
|
return ParseStatus.mergeArray(status, result);
|
|
@@ -2823,7 +3331,10 @@ var ZodArray = class extends ZodType {
|
|
|
2823
3331
|
});
|
|
2824
3332
|
}
|
|
2825
3333
|
length(len, message) {
|
|
2826
|
-
return
|
|
3334
|
+
return new ZodArray({
|
|
3335
|
+
...this._def,
|
|
3336
|
+
exactLength: { value: len, message: errorUtil.toString(message) }
|
|
3337
|
+
});
|
|
2827
3338
|
}
|
|
2828
3339
|
nonempty(message) {
|
|
2829
3340
|
return this.min(1, message);
|
|
@@ -2834,28 +3345,11 @@ ZodArray.create = (schema2, params2) => {
|
|
|
2834
3345
|
type: schema2,
|
|
2835
3346
|
minLength: null,
|
|
2836
3347
|
maxLength: null,
|
|
3348
|
+
exactLength: null,
|
|
2837
3349
|
typeName: ZodFirstPartyTypeKind.ZodArray,
|
|
2838
3350
|
...processCreateParams(params2)
|
|
2839
3351
|
});
|
|
2840
3352
|
};
|
|
2841
|
-
var objectUtil;
|
|
2842
|
-
(function(objectUtil2) {
|
|
2843
|
-
objectUtil2.mergeShapes = (first, second) => {
|
|
2844
|
-
return {
|
|
2845
|
-
...first,
|
|
2846
|
-
...second
|
|
2847
|
-
};
|
|
2848
|
-
};
|
|
2849
|
-
})(objectUtil || (objectUtil = {}));
|
|
2850
|
-
var AugmentFactory = (def2) => (augmentation) => {
|
|
2851
|
-
return new ZodObject({
|
|
2852
|
-
...def2,
|
|
2853
|
-
shape: () => ({
|
|
2854
|
-
...def2.shape(),
|
|
2855
|
-
...augmentation
|
|
2856
|
-
})
|
|
2857
|
-
});
|
|
2858
|
-
};
|
|
2859
3353
|
function deepPartialify(schema2) {
|
|
2860
3354
|
if (schema2 instanceof ZodObject) {
|
|
2861
3355
|
const newShape = {};
|
|
@@ -2868,7 +3362,10 @@ function deepPartialify(schema2) {
|
|
|
2868
3362
|
shape: () => newShape
|
|
2869
3363
|
});
|
|
2870
3364
|
} else if (schema2 instanceof ZodArray) {
|
|
2871
|
-
return ZodArray
|
|
3365
|
+
return new ZodArray({
|
|
3366
|
+
...schema2._def,
|
|
3367
|
+
type: deepPartialify(schema2.element)
|
|
3368
|
+
});
|
|
2872
3369
|
} else if (schema2 instanceof ZodOptional) {
|
|
2873
3370
|
return ZodOptional.create(deepPartialify(schema2.unwrap()));
|
|
2874
3371
|
} else if (schema2 instanceof ZodNullable) {
|
|
@@ -2884,8 +3381,7 @@ var ZodObject = class extends ZodType {
|
|
|
2884
3381
|
super(...arguments);
|
|
2885
3382
|
this._cached = null;
|
|
2886
3383
|
this.nonstrict = this.passthrough;
|
|
2887
|
-
this.augment =
|
|
2888
|
-
this.extend = AugmentFactory(this._def);
|
|
3384
|
+
this.augment = this.extend;
|
|
2889
3385
|
}
|
|
2890
3386
|
_getCached() {
|
|
2891
3387
|
if (this._cached !== null)
|
|
@@ -3014,18 +3510,30 @@ var ZodObject = class extends ZodType {
|
|
|
3014
3510
|
unknownKeys: "passthrough"
|
|
3015
3511
|
});
|
|
3016
3512
|
}
|
|
3017
|
-
|
|
3018
|
-
return
|
|
3513
|
+
extend(augmentation) {
|
|
3514
|
+
return new ZodObject({
|
|
3515
|
+
...this._def,
|
|
3516
|
+
shape: () => ({
|
|
3517
|
+
...this._def.shape(),
|
|
3518
|
+
...augmentation
|
|
3519
|
+
})
|
|
3520
|
+
});
|
|
3019
3521
|
}
|
|
3020
3522
|
merge(merging) {
|
|
3021
3523
|
const merged = new ZodObject({
|
|
3022
3524
|
unknownKeys: merging._def.unknownKeys,
|
|
3023
3525
|
catchall: merging._def.catchall,
|
|
3024
|
-
shape: () =>
|
|
3526
|
+
shape: () => ({
|
|
3527
|
+
...this._def.shape(),
|
|
3528
|
+
...merging._def.shape()
|
|
3529
|
+
}),
|
|
3025
3530
|
typeName: ZodFirstPartyTypeKind.ZodObject
|
|
3026
3531
|
});
|
|
3027
3532
|
return merged;
|
|
3028
3533
|
}
|
|
3534
|
+
setKey(key, schema2) {
|
|
3535
|
+
return this.augment({ [key]: schema2 });
|
|
3536
|
+
}
|
|
3029
3537
|
catchall(index) {
|
|
3030
3538
|
return new ZodObject({
|
|
3031
3539
|
...this._def,
|
|
@@ -3034,9 +3542,10 @@ var ZodObject = class extends ZodType {
|
|
|
3034
3542
|
}
|
|
3035
3543
|
pick(mask) {
|
|
3036
3544
|
const shape = {};
|
|
3037
|
-
util.objectKeys(mask).
|
|
3038
|
-
if (this.shape[key])
|
|
3545
|
+
util.objectKeys(mask).forEach((key) => {
|
|
3546
|
+
if (mask[key] && this.shape[key]) {
|
|
3039
3547
|
shape[key] = this.shape[key];
|
|
3548
|
+
}
|
|
3040
3549
|
});
|
|
3041
3550
|
return new ZodObject({
|
|
3042
3551
|
...this._def,
|
|
@@ -3045,8 +3554,8 @@ var ZodObject = class extends ZodType {
|
|
|
3045
3554
|
}
|
|
3046
3555
|
omit(mask) {
|
|
3047
3556
|
const shape = {};
|
|
3048
|
-
util.objectKeys(this.shape).
|
|
3049
|
-
if (
|
|
3557
|
+
util.objectKeys(this.shape).forEach((key) => {
|
|
3558
|
+
if (!mask[key]) {
|
|
3050
3559
|
shape[key] = this.shape[key];
|
|
3051
3560
|
}
|
|
3052
3561
|
});
|
|
@@ -3060,39 +3569,33 @@ var ZodObject = class extends ZodType {
|
|
|
3060
3569
|
}
|
|
3061
3570
|
partial(mask) {
|
|
3062
3571
|
const newShape = {};
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
newShape[key] = this.shape[key].optional();
|
|
3069
|
-
}
|
|
3070
|
-
});
|
|
3071
|
-
return new ZodObject({
|
|
3072
|
-
...this._def,
|
|
3073
|
-
shape: () => newShape
|
|
3074
|
-
});
|
|
3075
|
-
} else {
|
|
3076
|
-
for (const key in this.shape) {
|
|
3077
|
-
const fieldSchema = this.shape[key];
|
|
3572
|
+
util.objectKeys(this.shape).forEach((key) => {
|
|
3573
|
+
const fieldSchema = this.shape[key];
|
|
3574
|
+
if (mask && !mask[key]) {
|
|
3575
|
+
newShape[key] = fieldSchema;
|
|
3576
|
+
} else {
|
|
3078
3577
|
newShape[key] = fieldSchema.optional();
|
|
3079
3578
|
}
|
|
3080
|
-
}
|
|
3579
|
+
});
|
|
3081
3580
|
return new ZodObject({
|
|
3082
3581
|
...this._def,
|
|
3083
3582
|
shape: () => newShape
|
|
3084
3583
|
});
|
|
3085
3584
|
}
|
|
3086
|
-
required() {
|
|
3585
|
+
required(mask) {
|
|
3087
3586
|
const newShape = {};
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3587
|
+
util.objectKeys(this.shape).forEach((key) => {
|
|
3588
|
+
if (mask && !mask[key]) {
|
|
3589
|
+
newShape[key] = this.shape[key];
|
|
3590
|
+
} else {
|
|
3591
|
+
const fieldSchema = this.shape[key];
|
|
3592
|
+
let newField = fieldSchema;
|
|
3593
|
+
while (newField instanceof ZodOptional) {
|
|
3594
|
+
newField = newField._def.innerType;
|
|
3595
|
+
}
|
|
3596
|
+
newShape[key] = newField;
|
|
3093
3597
|
}
|
|
3094
|
-
|
|
3095
|
-
}
|
|
3598
|
+
});
|
|
3096
3599
|
return new ZodObject({
|
|
3097
3600
|
...this._def,
|
|
3098
3601
|
shape: () => newShape
|
|
@@ -3220,6 +3723,27 @@ ZodUnion.create = (types, params2) => {
|
|
|
3220
3723
|
...processCreateParams(params2)
|
|
3221
3724
|
});
|
|
3222
3725
|
};
|
|
3726
|
+
var getDiscriminator = (type) => {
|
|
3727
|
+
if (type instanceof ZodLazy) {
|
|
3728
|
+
return getDiscriminator(type.schema);
|
|
3729
|
+
} else if (type instanceof ZodEffects) {
|
|
3730
|
+
return getDiscriminator(type.innerType());
|
|
3731
|
+
} else if (type instanceof ZodLiteral) {
|
|
3732
|
+
return [type.value];
|
|
3733
|
+
} else if (type instanceof ZodEnum) {
|
|
3734
|
+
return type.options;
|
|
3735
|
+
} else if (type instanceof ZodNativeEnum) {
|
|
3736
|
+
return Object.keys(type.enum);
|
|
3737
|
+
} else if (type instanceof ZodDefault) {
|
|
3738
|
+
return getDiscriminator(type._def.innerType);
|
|
3739
|
+
} else if (type instanceof ZodUndefined) {
|
|
3740
|
+
return [void 0];
|
|
3741
|
+
} else if (type instanceof ZodNull) {
|
|
3742
|
+
return [null];
|
|
3743
|
+
} else {
|
|
3744
|
+
return null;
|
|
3745
|
+
}
|
|
3746
|
+
};
|
|
3223
3747
|
var ZodDiscriminatedUnion = class extends ZodType {
|
|
3224
3748
|
_parse(input) {
|
|
3225
3749
|
const { ctx } = this._processInputParams(input);
|
|
@@ -3233,11 +3757,11 @@ var ZodDiscriminatedUnion = class extends ZodType {
|
|
|
3233
3757
|
}
|
|
3234
3758
|
const discriminator = this.discriminator;
|
|
3235
3759
|
const discriminatorValue = ctx.data[discriminator];
|
|
3236
|
-
const option = this.
|
|
3760
|
+
const option = this.optionsMap.get(discriminatorValue);
|
|
3237
3761
|
if (!option) {
|
|
3238
3762
|
addIssueToContext(ctx, {
|
|
3239
3763
|
code: ZodIssueCode.invalid_union_discriminator,
|
|
3240
|
-
options: this.
|
|
3764
|
+
options: Array.from(this.optionsMap.keys()),
|
|
3241
3765
|
path: [discriminator]
|
|
3242
3766
|
});
|
|
3243
3767
|
return INVALID;
|
|
@@ -3259,29 +3783,31 @@ var ZodDiscriminatedUnion = class extends ZodType {
|
|
|
3259
3783
|
get discriminator() {
|
|
3260
3784
|
return this._def.discriminator;
|
|
3261
3785
|
}
|
|
3262
|
-
get validDiscriminatorValues() {
|
|
3263
|
-
return Array.from(this.options.keys());
|
|
3264
|
-
}
|
|
3265
3786
|
get options() {
|
|
3266
3787
|
return this._def.options;
|
|
3267
3788
|
}
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3789
|
+
get optionsMap() {
|
|
3790
|
+
return this._def.optionsMap;
|
|
3791
|
+
}
|
|
3792
|
+
static create(discriminator, options, params2) {
|
|
3793
|
+
const optionsMap = /* @__PURE__ */ new Map();
|
|
3794
|
+
for (const type of options) {
|
|
3795
|
+
const discriminatorValues = getDiscriminator(type.shape[discriminator]);
|
|
3796
|
+
if (!discriminatorValues) {
|
|
3797
|
+
throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`);
|
|
3798
|
+
}
|
|
3799
|
+
for (const value of discriminatorValues) {
|
|
3800
|
+
if (optionsMap.has(value)) {
|
|
3801
|
+
throw new Error(`Discriminator property ${String(discriminator)} has duplicate value ${String(value)}`);
|
|
3802
|
+
}
|
|
3803
|
+
optionsMap.set(value, type);
|
|
3804
|
+
}
|
|
3280
3805
|
}
|
|
3281
3806
|
return new ZodDiscriminatedUnion({
|
|
3282
3807
|
typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion,
|
|
3283
3808
|
discriminator,
|
|
3284
3809
|
options,
|
|
3810
|
+
optionsMap,
|
|
3285
3811
|
...processCreateParams(params2)
|
|
3286
3812
|
});
|
|
3287
3813
|
}
|
|
@@ -3393,6 +3919,7 @@ var ZodTuple = class extends ZodType {
|
|
|
3393
3919
|
code: ZodIssueCode.too_small,
|
|
3394
3920
|
minimum: this._def.items.length,
|
|
3395
3921
|
inclusive: true,
|
|
3922
|
+
exact: false,
|
|
3396
3923
|
type: "array"
|
|
3397
3924
|
});
|
|
3398
3925
|
return INVALID;
|
|
@@ -3403,11 +3930,12 @@ var ZodTuple = class extends ZodType {
|
|
|
3403
3930
|
code: ZodIssueCode.too_big,
|
|
3404
3931
|
maximum: this._def.items.length,
|
|
3405
3932
|
inclusive: true,
|
|
3933
|
+
exact: false,
|
|
3406
3934
|
type: "array"
|
|
3407
3935
|
});
|
|
3408
3936
|
status.dirty();
|
|
3409
3937
|
}
|
|
3410
|
-
const items = ctx.data.map((item, itemIndex) => {
|
|
3938
|
+
const items = [...ctx.data].map((item, itemIndex) => {
|
|
3411
3939
|
const schema2 = this._def.items[itemIndex] || this._def.rest;
|
|
3412
3940
|
if (!schema2)
|
|
3413
3941
|
return null;
|
|
@@ -3573,6 +4101,7 @@ var ZodSet = class extends ZodType {
|
|
|
3573
4101
|
minimum: def2.minSize.value,
|
|
3574
4102
|
type: "set",
|
|
3575
4103
|
inclusive: true,
|
|
4104
|
+
exact: false,
|
|
3576
4105
|
message: def2.minSize.message
|
|
3577
4106
|
});
|
|
3578
4107
|
status.dirty();
|
|
@@ -3585,6 +4114,7 @@ var ZodSet = class extends ZodType {
|
|
|
3585
4114
|
maximum: def2.maxSize.value,
|
|
3586
4115
|
type: "set",
|
|
3587
4116
|
inclusive: true,
|
|
4117
|
+
exact: false,
|
|
3588
4118
|
message: def2.maxSize.message
|
|
3589
4119
|
});
|
|
3590
4120
|
status.dirty();
|
|
@@ -3772,6 +4302,7 @@ var ZodLiteral = class extends ZodType {
|
|
|
3772
4302
|
if (input.data !== this._def.value) {
|
|
3773
4303
|
const ctx = this._getOrReturnCtx(input);
|
|
3774
4304
|
addIssueToContext(ctx, {
|
|
4305
|
+
received: ctx.data,
|
|
3775
4306
|
code: ZodIssueCode.invalid_literal,
|
|
3776
4307
|
expected: this._def.value
|
|
3777
4308
|
});
|
|
@@ -3845,6 +4376,12 @@ var ZodEnum = class extends ZodType {
|
|
|
3845
4376
|
}
|
|
3846
4377
|
return enumValues;
|
|
3847
4378
|
}
|
|
4379
|
+
extract(values) {
|
|
4380
|
+
return ZodEnum.create(values);
|
|
4381
|
+
}
|
|
4382
|
+
exclude(values) {
|
|
4383
|
+
return ZodEnum.create(this.options.filter((opt) => !values.includes(opt)));
|
|
4384
|
+
}
|
|
3848
4385
|
};
|
|
3849
4386
|
ZodEnum.create = createZodEnum;
|
|
3850
4387
|
var ZodNativeEnum = class extends ZodType {
|
|
@@ -3883,6 +4420,9 @@ ZodNativeEnum.create = (values, params2) => {
|
|
|
3883
4420
|
});
|
|
3884
4421
|
};
|
|
3885
4422
|
var ZodPromise = class extends ZodType {
|
|
4423
|
+
unwrap() {
|
|
4424
|
+
return this._def.type;
|
|
4425
|
+
}
|
|
3886
4426
|
_parse(input) {
|
|
3887
4427
|
const { ctx } = this._processInputParams(input);
|
|
3888
4428
|
if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {
|
|
@@ -3913,6 +4453,9 @@ var ZodEffects = class extends ZodType {
|
|
|
3913
4453
|
innerType() {
|
|
3914
4454
|
return this._def.schema;
|
|
3915
4455
|
}
|
|
4456
|
+
sourceType() {
|
|
4457
|
+
return this._def.schema._def.typeName === ZodFirstPartyTypeKind.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
|
|
4458
|
+
}
|
|
3916
4459
|
_parse(input) {
|
|
3917
4460
|
const { status, ctx } = this._processInputParams(input);
|
|
3918
4461
|
const effect = this._def.effect || null;
|
|
@@ -4075,14 +4618,68 @@ var ZodDefault = class extends ZodType {
|
|
|
4075
4618
|
parent: ctx
|
|
4076
4619
|
});
|
|
4077
4620
|
}
|
|
4078
|
-
removeDefault() {
|
|
4621
|
+
removeDefault() {
|
|
4622
|
+
return this._def.innerType;
|
|
4623
|
+
}
|
|
4624
|
+
};
|
|
4625
|
+
ZodDefault.create = (type, params2) => {
|
|
4626
|
+
return new ZodDefault({
|
|
4627
|
+
innerType: type,
|
|
4628
|
+
typeName: ZodFirstPartyTypeKind.ZodDefault,
|
|
4629
|
+
defaultValue: typeof params2.default === "function" ? params2.default : () => params2.default,
|
|
4630
|
+
...processCreateParams(params2)
|
|
4631
|
+
});
|
|
4632
|
+
};
|
|
4633
|
+
var ZodCatch = class extends ZodType {
|
|
4634
|
+
_parse(input) {
|
|
4635
|
+
const { ctx } = this._processInputParams(input);
|
|
4636
|
+
const newCtx = {
|
|
4637
|
+
...ctx,
|
|
4638
|
+
common: {
|
|
4639
|
+
...ctx.common,
|
|
4640
|
+
issues: []
|
|
4641
|
+
}
|
|
4642
|
+
};
|
|
4643
|
+
const result = this._def.innerType._parse({
|
|
4644
|
+
data: newCtx.data,
|
|
4645
|
+
path: newCtx.path,
|
|
4646
|
+
parent: {
|
|
4647
|
+
...newCtx
|
|
4648
|
+
}
|
|
4649
|
+
});
|
|
4650
|
+
if (isAsync(result)) {
|
|
4651
|
+
return result.then((result2) => {
|
|
4652
|
+
return {
|
|
4653
|
+
status: "valid",
|
|
4654
|
+
value: result2.status === "valid" ? result2.value : this._def.catchValue({
|
|
4655
|
+
get error() {
|
|
4656
|
+
return new ZodError(newCtx.common.issues);
|
|
4657
|
+
},
|
|
4658
|
+
input: newCtx.data
|
|
4659
|
+
})
|
|
4660
|
+
};
|
|
4661
|
+
});
|
|
4662
|
+
} else {
|
|
4663
|
+
return {
|
|
4664
|
+
status: "valid",
|
|
4665
|
+
value: result.status === "valid" ? result.value : this._def.catchValue({
|
|
4666
|
+
get error() {
|
|
4667
|
+
return new ZodError(newCtx.common.issues);
|
|
4668
|
+
},
|
|
4669
|
+
input: newCtx.data
|
|
4670
|
+
})
|
|
4671
|
+
};
|
|
4672
|
+
}
|
|
4673
|
+
}
|
|
4674
|
+
removeCatch() {
|
|
4079
4675
|
return this._def.innerType;
|
|
4080
4676
|
}
|
|
4081
4677
|
};
|
|
4082
|
-
|
|
4083
|
-
return new
|
|
4678
|
+
ZodCatch.create = (type, params2) => {
|
|
4679
|
+
return new ZodCatch({
|
|
4084
4680
|
innerType: type,
|
|
4085
|
-
typeName: ZodFirstPartyTypeKind.
|
|
4681
|
+
typeName: ZodFirstPartyTypeKind.ZodCatch,
|
|
4682
|
+
catchValue: typeof params2.catch === "function" ? params2.catch : () => params2.catch,
|
|
4086
4683
|
...processCreateParams(params2)
|
|
4087
4684
|
});
|
|
4088
4685
|
};
|
|
@@ -4122,13 +4719,70 @@ var ZodBranded = class extends ZodType {
|
|
|
4122
4719
|
return this._def.type;
|
|
4123
4720
|
}
|
|
4124
4721
|
};
|
|
4722
|
+
var ZodPipeline = class extends ZodType {
|
|
4723
|
+
_parse(input) {
|
|
4724
|
+
const { status, ctx } = this._processInputParams(input);
|
|
4725
|
+
if (ctx.common.async) {
|
|
4726
|
+
const handleAsync = async () => {
|
|
4727
|
+
const inResult = await this._def.in._parseAsync({
|
|
4728
|
+
data: ctx.data,
|
|
4729
|
+
path: ctx.path,
|
|
4730
|
+
parent: ctx
|
|
4731
|
+
});
|
|
4732
|
+
if (inResult.status === "aborted")
|
|
4733
|
+
return INVALID;
|
|
4734
|
+
if (inResult.status === "dirty") {
|
|
4735
|
+
status.dirty();
|
|
4736
|
+
return DIRTY(inResult.value);
|
|
4737
|
+
} else {
|
|
4738
|
+
return this._def.out._parseAsync({
|
|
4739
|
+
data: inResult.value,
|
|
4740
|
+
path: ctx.path,
|
|
4741
|
+
parent: ctx
|
|
4742
|
+
});
|
|
4743
|
+
}
|
|
4744
|
+
};
|
|
4745
|
+
return handleAsync();
|
|
4746
|
+
} else {
|
|
4747
|
+
const inResult = this._def.in._parseSync({
|
|
4748
|
+
data: ctx.data,
|
|
4749
|
+
path: ctx.path,
|
|
4750
|
+
parent: ctx
|
|
4751
|
+
});
|
|
4752
|
+
if (inResult.status === "aborted")
|
|
4753
|
+
return INVALID;
|
|
4754
|
+
if (inResult.status === "dirty") {
|
|
4755
|
+
status.dirty();
|
|
4756
|
+
return {
|
|
4757
|
+
status: "dirty",
|
|
4758
|
+
value: inResult.value
|
|
4759
|
+
};
|
|
4760
|
+
} else {
|
|
4761
|
+
return this._def.out._parseSync({
|
|
4762
|
+
data: inResult.value,
|
|
4763
|
+
path: ctx.path,
|
|
4764
|
+
parent: ctx
|
|
4765
|
+
});
|
|
4766
|
+
}
|
|
4767
|
+
}
|
|
4768
|
+
}
|
|
4769
|
+
static create(a, b) {
|
|
4770
|
+
return new ZodPipeline({
|
|
4771
|
+
in: a,
|
|
4772
|
+
out: b,
|
|
4773
|
+
typeName: ZodFirstPartyTypeKind.ZodPipeline
|
|
4774
|
+
});
|
|
4775
|
+
}
|
|
4776
|
+
};
|
|
4125
4777
|
var custom = (check, params2 = {}, fatal) => {
|
|
4126
4778
|
if (check)
|
|
4127
4779
|
return ZodAny.create().superRefine((data, ctx) => {
|
|
4780
|
+
var _a, _b;
|
|
4128
4781
|
if (!check(data)) {
|
|
4129
|
-
const p = typeof params2 === "function" ? params2(data) : params2;
|
|
4782
|
+
const p = typeof params2 === "function" ? params2(data) : typeof params2 === "string" ? { message: params2 } : params2;
|
|
4783
|
+
const _fatal = (_b = (_a = p.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;
|
|
4130
4784
|
const p2 = typeof p === "string" ? { message: p } : p;
|
|
4131
|
-
ctx.addIssue({ code: "custom", ...p2, fatal });
|
|
4785
|
+
ctx.addIssue({ code: "custom", ...p2, fatal: _fatal });
|
|
4132
4786
|
}
|
|
4133
4787
|
});
|
|
4134
4788
|
return ZodAny.create();
|
|
@@ -4144,6 +4798,7 @@ var ZodFirstPartyTypeKind;
|
|
|
4144
4798
|
ZodFirstPartyTypeKind2["ZodBigInt"] = "ZodBigInt";
|
|
4145
4799
|
ZodFirstPartyTypeKind2["ZodBoolean"] = "ZodBoolean";
|
|
4146
4800
|
ZodFirstPartyTypeKind2["ZodDate"] = "ZodDate";
|
|
4801
|
+
ZodFirstPartyTypeKind2["ZodSymbol"] = "ZodSymbol";
|
|
4147
4802
|
ZodFirstPartyTypeKind2["ZodUndefined"] = "ZodUndefined";
|
|
4148
4803
|
ZodFirstPartyTypeKind2["ZodNull"] = "ZodNull";
|
|
4149
4804
|
ZodFirstPartyTypeKind2["ZodAny"] = "ZodAny";
|
|
@@ -4168,18 +4823,21 @@ var ZodFirstPartyTypeKind;
|
|
|
4168
4823
|
ZodFirstPartyTypeKind2["ZodOptional"] = "ZodOptional";
|
|
4169
4824
|
ZodFirstPartyTypeKind2["ZodNullable"] = "ZodNullable";
|
|
4170
4825
|
ZodFirstPartyTypeKind2["ZodDefault"] = "ZodDefault";
|
|
4826
|
+
ZodFirstPartyTypeKind2["ZodCatch"] = "ZodCatch";
|
|
4171
4827
|
ZodFirstPartyTypeKind2["ZodPromise"] = "ZodPromise";
|
|
4172
4828
|
ZodFirstPartyTypeKind2["ZodBranded"] = "ZodBranded";
|
|
4829
|
+
ZodFirstPartyTypeKind2["ZodPipeline"] = "ZodPipeline";
|
|
4173
4830
|
})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
|
|
4174
4831
|
var instanceOfType = (cls, params2 = {
|
|
4175
4832
|
message: `Input not instance of ${cls.name}`
|
|
4176
|
-
}) => custom((data) => data instanceof cls, params2
|
|
4833
|
+
}) => custom((data) => data instanceof cls, params2);
|
|
4177
4834
|
var stringType = ZodString.create;
|
|
4178
4835
|
var numberType = ZodNumber.create;
|
|
4179
4836
|
var nanType = ZodNaN.create;
|
|
4180
4837
|
var bigIntType = ZodBigInt.create;
|
|
4181
4838
|
var booleanType = ZodBoolean.create;
|
|
4182
4839
|
var dateType = ZodDate.create;
|
|
4840
|
+
var symbolType = ZodSymbol.create;
|
|
4183
4841
|
var undefinedType = ZodUndefined.create;
|
|
4184
4842
|
var nullType = ZodNull.create;
|
|
4185
4843
|
var anyType = ZodAny.create;
|
|
@@ -4206,14 +4864,23 @@ var effectsType = ZodEffects.create;
|
|
|
4206
4864
|
var optionalType = ZodOptional.create;
|
|
4207
4865
|
var nullableType = ZodNullable.create;
|
|
4208
4866
|
var preprocessType = ZodEffects.createWithPreprocess;
|
|
4867
|
+
var pipelineType = ZodPipeline.create;
|
|
4209
4868
|
var ostring = () => stringType().optional();
|
|
4210
4869
|
var onumber = () => numberType().optional();
|
|
4211
4870
|
var oboolean = () => booleanType().optional();
|
|
4871
|
+
var coerce2 = {
|
|
4872
|
+
string: (arg) => ZodString.create({ ...arg, coerce: true }),
|
|
4873
|
+
number: (arg) => ZodNumber.create({ ...arg, coerce: true }),
|
|
4874
|
+
boolean: (arg) => ZodBoolean.create({
|
|
4875
|
+
...arg,
|
|
4876
|
+
coerce: true
|
|
4877
|
+
}),
|
|
4878
|
+
bigint: (arg) => ZodBigInt.create({ ...arg, coerce: true }),
|
|
4879
|
+
date: (arg) => ZodDate.create({ ...arg, coerce: true })
|
|
4880
|
+
};
|
|
4212
4881
|
var NEVER = INVALID;
|
|
4213
|
-
var
|
|
4882
|
+
var z = /* @__PURE__ */ Object.freeze({
|
|
4214
4883
|
__proto__: null,
|
|
4215
|
-
getParsedType,
|
|
4216
|
-
ZodParsedType,
|
|
4217
4884
|
defaultErrorMap: errorMap,
|
|
4218
4885
|
setErrorMap,
|
|
4219
4886
|
getErrorMap,
|
|
@@ -4228,12 +4895,21 @@ var mod = /* @__PURE__ */ Object.freeze({
|
|
|
4228
4895
|
isDirty,
|
|
4229
4896
|
isValid,
|
|
4230
4897
|
isAsync,
|
|
4898
|
+
get util() {
|
|
4899
|
+
return util;
|
|
4900
|
+
},
|
|
4901
|
+
get objectUtil() {
|
|
4902
|
+
return objectUtil;
|
|
4903
|
+
},
|
|
4904
|
+
ZodParsedType,
|
|
4905
|
+
getParsedType,
|
|
4231
4906
|
ZodType,
|
|
4232
4907
|
ZodString,
|
|
4233
4908
|
ZodNumber,
|
|
4234
4909
|
ZodBigInt,
|
|
4235
4910
|
ZodBoolean,
|
|
4236
4911
|
ZodDate,
|
|
4912
|
+
ZodSymbol,
|
|
4237
4913
|
ZodUndefined,
|
|
4238
4914
|
ZodNull,
|
|
4239
4915
|
ZodAny,
|
|
@@ -4241,9 +4917,6 @@ var mod = /* @__PURE__ */ Object.freeze({
|
|
|
4241
4917
|
ZodNever,
|
|
4242
4918
|
ZodVoid,
|
|
4243
4919
|
ZodArray,
|
|
4244
|
-
get objectUtil() {
|
|
4245
|
-
return objectUtil;
|
|
4246
|
-
},
|
|
4247
4920
|
ZodObject,
|
|
4248
4921
|
ZodUnion,
|
|
4249
4922
|
ZodDiscriminatedUnion,
|
|
@@ -4263,9 +4936,11 @@ var mod = /* @__PURE__ */ Object.freeze({
|
|
|
4263
4936
|
ZodOptional,
|
|
4264
4937
|
ZodNullable,
|
|
4265
4938
|
ZodDefault,
|
|
4939
|
+
ZodCatch,
|
|
4266
4940
|
ZodNaN,
|
|
4267
4941
|
BRAND,
|
|
4268
4942
|
ZodBranded,
|
|
4943
|
+
ZodPipeline,
|
|
4269
4944
|
custom,
|
|
4270
4945
|
Schema: ZodType,
|
|
4271
4946
|
ZodSchema: ZodType,
|
|
@@ -4273,6 +4948,7 @@ var mod = /* @__PURE__ */ Object.freeze({
|
|
|
4273
4948
|
get ZodFirstPartyTypeKind() {
|
|
4274
4949
|
return ZodFirstPartyTypeKind;
|
|
4275
4950
|
},
|
|
4951
|
+
coerce: coerce2,
|
|
4276
4952
|
any: anyType,
|
|
4277
4953
|
array: arrayType,
|
|
4278
4954
|
bigint: bigIntType,
|
|
@@ -4298,12 +4974,14 @@ var mod = /* @__PURE__ */ Object.freeze({
|
|
|
4298
4974
|
onumber,
|
|
4299
4975
|
optional: optionalType,
|
|
4300
4976
|
ostring,
|
|
4977
|
+
pipeline: pipelineType,
|
|
4301
4978
|
preprocess: preprocessType,
|
|
4302
4979
|
promise: promiseType,
|
|
4303
4980
|
record: recordType,
|
|
4304
4981
|
set: setType,
|
|
4305
4982
|
strictObject: strictObjectType,
|
|
4306
4983
|
string: stringType,
|
|
4984
|
+
symbol: symbolType,
|
|
4307
4985
|
transformer: effectsType,
|
|
4308
4986
|
tuple: tupleType,
|
|
4309
4987
|
"undefined": undefinedType,
|
|
@@ -4317,16 +4995,16 @@ var mod = /* @__PURE__ */ Object.freeze({
|
|
|
4317
4995
|
});
|
|
4318
4996
|
|
|
4319
4997
|
// ../common-web/src/types.ts
|
|
4320
|
-
var cidSchema =
|
|
4998
|
+
var cidSchema = z.any().refine((obj) => CID.asCID(obj) !== null, {
|
|
4321
4999
|
message: "Not a CID"
|
|
4322
5000
|
}).transform((obj) => CID.asCID(obj));
|
|
4323
5001
|
var schema = {
|
|
4324
5002
|
cid: cidSchema,
|
|
4325
|
-
bytes:
|
|
4326
|
-
string:
|
|
4327
|
-
array:
|
|
4328
|
-
map:
|
|
4329
|
-
unknown:
|
|
5003
|
+
bytes: z.instanceof(Uint8Array),
|
|
5004
|
+
string: z.string(),
|
|
5005
|
+
array: z.array(z.unknown()),
|
|
5006
|
+
map: z.record(z.string(), z.unknown()),
|
|
5007
|
+
unknown: z.unknown()
|
|
4330
5008
|
};
|
|
4331
5009
|
var def = {
|
|
4332
5010
|
cid: {
|
|
@@ -5731,22 +6409,22 @@ function parseRelative(str) {
|
|
|
5731
6409
|
}
|
|
5732
6410
|
|
|
5733
6411
|
// ../lexicon/src/types.ts
|
|
5734
|
-
var lexBoolean =
|
|
5735
|
-
type:
|
|
5736
|
-
description:
|
|
5737
|
-
default:
|
|
5738
|
-
const:
|
|
6412
|
+
var lexBoolean = z.object({
|
|
6413
|
+
type: z.literal("boolean"),
|
|
6414
|
+
description: z.string().optional(),
|
|
6415
|
+
default: z.boolean().optional(),
|
|
6416
|
+
const: z.boolean().optional()
|
|
5739
6417
|
});
|
|
5740
|
-
var lexInteger =
|
|
5741
|
-
type:
|
|
5742
|
-
description:
|
|
5743
|
-
default:
|
|
5744
|
-
minimum:
|
|
5745
|
-
maximum:
|
|
5746
|
-
enum:
|
|
5747
|
-
const:
|
|
6418
|
+
var lexInteger = z.object({
|
|
6419
|
+
type: z.literal("integer"),
|
|
6420
|
+
description: z.string().optional(),
|
|
6421
|
+
default: z.number().int().optional(),
|
|
6422
|
+
minimum: z.number().int().optional(),
|
|
6423
|
+
maximum: z.number().int().optional(),
|
|
6424
|
+
enum: z.number().int().array().optional(),
|
|
6425
|
+
const: z.number().int().optional()
|
|
5748
6426
|
});
|
|
5749
|
-
var lexStringFormat =
|
|
6427
|
+
var lexStringFormat = z.enum([
|
|
5750
6428
|
"datetime",
|
|
5751
6429
|
"uri",
|
|
5752
6430
|
"at-uri",
|
|
@@ -5756,132 +6434,132 @@ var lexStringFormat = mod.enum([
|
|
|
5756
6434
|
"nsid",
|
|
5757
6435
|
"cid"
|
|
5758
6436
|
]);
|
|
5759
|
-
var lexString =
|
|
5760
|
-
type:
|
|
6437
|
+
var lexString = z.object({
|
|
6438
|
+
type: z.literal("string"),
|
|
5761
6439
|
format: lexStringFormat.optional(),
|
|
5762
|
-
description:
|
|
5763
|
-
default:
|
|
5764
|
-
minLength:
|
|
5765
|
-
maxLength:
|
|
5766
|
-
minGraphemes:
|
|
5767
|
-
maxGraphemes:
|
|
5768
|
-
enum:
|
|
5769
|
-
const:
|
|
5770
|
-
knownValues:
|
|
6440
|
+
description: z.string().optional(),
|
|
6441
|
+
default: z.string().optional(),
|
|
6442
|
+
minLength: z.number().int().optional(),
|
|
6443
|
+
maxLength: z.number().int().optional(),
|
|
6444
|
+
minGraphemes: z.number().int().optional(),
|
|
6445
|
+
maxGraphemes: z.number().int().optional(),
|
|
6446
|
+
enum: z.string().array().optional(),
|
|
6447
|
+
const: z.string().optional(),
|
|
6448
|
+
knownValues: z.string().array().optional()
|
|
5771
6449
|
});
|
|
5772
|
-
var lexUnknown =
|
|
5773
|
-
type:
|
|
5774
|
-
description:
|
|
6450
|
+
var lexUnknown = z.object({
|
|
6451
|
+
type: z.literal("unknown"),
|
|
6452
|
+
description: z.string().optional()
|
|
5775
6453
|
});
|
|
5776
|
-
var lexPrimitive =
|
|
6454
|
+
var lexPrimitive = z.discriminatedUnion("type", [
|
|
5777
6455
|
lexBoolean,
|
|
5778
6456
|
lexInteger,
|
|
5779
6457
|
lexString,
|
|
5780
6458
|
lexUnknown
|
|
5781
6459
|
]);
|
|
5782
|
-
var lexBytes =
|
|
5783
|
-
type:
|
|
5784
|
-
description:
|
|
5785
|
-
maxLength:
|
|
5786
|
-
minLength:
|
|
6460
|
+
var lexBytes = z.object({
|
|
6461
|
+
type: z.literal("bytes"),
|
|
6462
|
+
description: z.string().optional(),
|
|
6463
|
+
maxLength: z.number().optional(),
|
|
6464
|
+
minLength: z.number().optional()
|
|
5787
6465
|
});
|
|
5788
|
-
var lexCidLink =
|
|
5789
|
-
type:
|
|
5790
|
-
description:
|
|
6466
|
+
var lexCidLink = z.object({
|
|
6467
|
+
type: z.literal("cid-link"),
|
|
6468
|
+
description: z.string().optional()
|
|
5791
6469
|
});
|
|
5792
|
-
var lexIpldType =
|
|
5793
|
-
var lexRef =
|
|
5794
|
-
type:
|
|
5795
|
-
description:
|
|
5796
|
-
ref:
|
|
6470
|
+
var lexIpldType = z.discriminatedUnion("type", [lexBytes, lexCidLink]);
|
|
6471
|
+
var lexRef = z.object({
|
|
6472
|
+
type: z.literal("ref"),
|
|
6473
|
+
description: z.string().optional(),
|
|
6474
|
+
ref: z.string()
|
|
5797
6475
|
});
|
|
5798
|
-
var lexRefUnion =
|
|
5799
|
-
type:
|
|
5800
|
-
description:
|
|
5801
|
-
refs:
|
|
5802
|
-
closed:
|
|
6476
|
+
var lexRefUnion = z.object({
|
|
6477
|
+
type: z.literal("union"),
|
|
6478
|
+
description: z.string().optional(),
|
|
6479
|
+
refs: z.string().array(),
|
|
6480
|
+
closed: z.boolean().optional()
|
|
5803
6481
|
});
|
|
5804
|
-
var lexRefVariant =
|
|
5805
|
-
var lexBlob =
|
|
5806
|
-
type:
|
|
5807
|
-
description:
|
|
5808
|
-
accept:
|
|
5809
|
-
maxSize:
|
|
6482
|
+
var lexRefVariant = z.discriminatedUnion("type", [lexRef, lexRefUnion]);
|
|
6483
|
+
var lexBlob = z.object({
|
|
6484
|
+
type: z.literal("blob"),
|
|
6485
|
+
description: z.string().optional(),
|
|
6486
|
+
accept: z.string().array().optional(),
|
|
6487
|
+
maxSize: z.number().optional()
|
|
5810
6488
|
});
|
|
5811
|
-
var lexArray =
|
|
5812
|
-
type:
|
|
5813
|
-
description:
|
|
5814
|
-
items:
|
|
5815
|
-
minLength:
|
|
5816
|
-
maxLength:
|
|
6489
|
+
var lexArray = z.object({
|
|
6490
|
+
type: z.literal("array"),
|
|
6491
|
+
description: z.string().optional(),
|
|
6492
|
+
items: z.union([lexPrimitive, lexIpldType, lexBlob, lexRefVariant]),
|
|
6493
|
+
minLength: z.number().int().optional(),
|
|
6494
|
+
maxLength: z.number().int().optional()
|
|
5817
6495
|
});
|
|
5818
6496
|
var lexPrimitiveArray = lexArray.merge(
|
|
5819
|
-
|
|
6497
|
+
z.object({
|
|
5820
6498
|
items: lexPrimitive
|
|
5821
6499
|
})
|
|
5822
6500
|
);
|
|
5823
|
-
var lexToken =
|
|
5824
|
-
type:
|
|
5825
|
-
description:
|
|
6501
|
+
var lexToken = z.object({
|
|
6502
|
+
type: z.literal("token"),
|
|
6503
|
+
description: z.string().optional()
|
|
5826
6504
|
});
|
|
5827
|
-
var lexObject =
|
|
5828
|
-
type:
|
|
5829
|
-
description:
|
|
5830
|
-
required:
|
|
5831
|
-
nullable:
|
|
5832
|
-
properties:
|
|
5833
|
-
|
|
6505
|
+
var lexObject = z.object({
|
|
6506
|
+
type: z.literal("object"),
|
|
6507
|
+
description: z.string().optional(),
|
|
6508
|
+
required: z.string().array().optional(),
|
|
6509
|
+
nullable: z.string().array().optional(),
|
|
6510
|
+
properties: z.record(
|
|
6511
|
+
z.union([lexRefVariant, lexIpldType, lexArray, lexBlob, lexPrimitive])
|
|
5834
6512
|
).optional()
|
|
5835
6513
|
});
|
|
5836
|
-
var lexXrpcParameters =
|
|
5837
|
-
type:
|
|
5838
|
-
description:
|
|
5839
|
-
required:
|
|
5840
|
-
properties:
|
|
6514
|
+
var lexXrpcParameters = z.object({
|
|
6515
|
+
type: z.literal("params"),
|
|
6516
|
+
description: z.string().optional(),
|
|
6517
|
+
required: z.string().array().optional(),
|
|
6518
|
+
properties: z.record(z.union([lexPrimitive, lexPrimitiveArray]))
|
|
5841
6519
|
});
|
|
5842
|
-
var lexXrpcBody =
|
|
5843
|
-
description:
|
|
5844
|
-
encoding:
|
|
5845
|
-
schema:
|
|
6520
|
+
var lexXrpcBody = z.object({
|
|
6521
|
+
description: z.string().optional(),
|
|
6522
|
+
encoding: z.string(),
|
|
6523
|
+
schema: z.union([lexRefVariant, lexObject]).optional()
|
|
5846
6524
|
});
|
|
5847
|
-
var lexXrpcSubscriptionMessage =
|
|
5848
|
-
description:
|
|
5849
|
-
schema:
|
|
6525
|
+
var lexXrpcSubscriptionMessage = z.object({
|
|
6526
|
+
description: z.string().optional(),
|
|
6527
|
+
schema: z.union([lexRefVariant, lexObject]).optional()
|
|
5850
6528
|
});
|
|
5851
|
-
var lexXrpcError =
|
|
5852
|
-
name:
|
|
5853
|
-
description:
|
|
6529
|
+
var lexXrpcError = z.object({
|
|
6530
|
+
name: z.string(),
|
|
6531
|
+
description: z.string().optional()
|
|
5854
6532
|
});
|
|
5855
|
-
var lexXrpcQuery =
|
|
5856
|
-
type:
|
|
5857
|
-
description:
|
|
6533
|
+
var lexXrpcQuery = z.object({
|
|
6534
|
+
type: z.literal("query"),
|
|
6535
|
+
description: z.string().optional(),
|
|
5858
6536
|
parameters: lexXrpcParameters.optional(),
|
|
5859
6537
|
output: lexXrpcBody.optional(),
|
|
5860
6538
|
errors: lexXrpcError.array().optional()
|
|
5861
6539
|
});
|
|
5862
|
-
var lexXrpcProcedure =
|
|
5863
|
-
type:
|
|
5864
|
-
description:
|
|
6540
|
+
var lexXrpcProcedure = z.object({
|
|
6541
|
+
type: z.literal("procedure"),
|
|
6542
|
+
description: z.string().optional(),
|
|
5865
6543
|
parameters: lexXrpcParameters.optional(),
|
|
5866
6544
|
input: lexXrpcBody.optional(),
|
|
5867
6545
|
output: lexXrpcBody.optional(),
|
|
5868
6546
|
errors: lexXrpcError.array().optional()
|
|
5869
6547
|
});
|
|
5870
|
-
var lexXrpcSubscription =
|
|
5871
|
-
type:
|
|
5872
|
-
description:
|
|
6548
|
+
var lexXrpcSubscription = z.object({
|
|
6549
|
+
type: z.literal("subscription"),
|
|
6550
|
+
description: z.string().optional(),
|
|
5873
6551
|
parameters: lexXrpcParameters.optional(),
|
|
5874
6552
|
message: lexXrpcSubscriptionMessage.optional(),
|
|
5875
6553
|
infos: lexXrpcError.array().optional(),
|
|
5876
6554
|
errors: lexXrpcError.array().optional()
|
|
5877
6555
|
});
|
|
5878
|
-
var lexRecord =
|
|
5879
|
-
type:
|
|
5880
|
-
description:
|
|
5881
|
-
key:
|
|
6556
|
+
var lexRecord = z.object({
|
|
6557
|
+
type: z.literal("record"),
|
|
6558
|
+
description: z.string().optional(),
|
|
6559
|
+
key: z.string().optional(),
|
|
5882
6560
|
record: lexObject
|
|
5883
6561
|
});
|
|
5884
|
-
var lexUserType =
|
|
6562
|
+
var lexUserType = z.discriminatedUnion("type", [
|
|
5885
6563
|
lexRecord,
|
|
5886
6564
|
lexXrpcQuery,
|
|
5887
6565
|
lexXrpcProcedure,
|
|
@@ -5897,20 +6575,20 @@ var lexUserType = mod.discriminatedUnion("type", [
|
|
|
5897
6575
|
lexCidLink,
|
|
5898
6576
|
lexUnknown
|
|
5899
6577
|
]);
|
|
5900
|
-
var lexiconDoc =
|
|
5901
|
-
lexicon:
|
|
5902
|
-
id:
|
|
6578
|
+
var lexiconDoc = z.object({
|
|
6579
|
+
lexicon: z.literal(1),
|
|
6580
|
+
id: z.string().refine((v) => NSID.isValid(v), {
|
|
5903
6581
|
message: "Must be a valid NSID"
|
|
5904
6582
|
}),
|
|
5905
|
-
revision:
|
|
5906
|
-
description:
|
|
5907
|
-
defs:
|
|
6583
|
+
revision: z.number().optional(),
|
|
6584
|
+
description: z.string().optional(),
|
|
6585
|
+
defs: z.record(lexUserType)
|
|
5908
6586
|
}).superRefine((doc, ctx) => {
|
|
5909
6587
|
for (const defId in doc.defs) {
|
|
5910
6588
|
const def2 = doc.defs[defId];
|
|
5911
6589
|
if (defId !== "main" && (def2.type === "record" || def2.type === "procedure" || def2.type === "query" || def2.type === "subscription")) {
|
|
5912
6590
|
ctx.addIssue({
|
|
5913
|
-
code:
|
|
6591
|
+
code: z.ZodIssueCode.custom,
|
|
5914
6592
|
message: `Records, procedures, queries, and subscriptions must be the main definition.`
|
|
5915
6593
|
});
|
|
5916
6594
|
}
|
|
@@ -5922,7 +6600,7 @@ function isObj(obj) {
|
|
|
5922
6600
|
function hasProp(data, prop) {
|
|
5923
6601
|
return prop in data;
|
|
5924
6602
|
}
|
|
5925
|
-
var discriminatedObject =
|
|
6603
|
+
var discriminatedObject = z.object({ $type: z.string() });
|
|
5926
6604
|
function isDiscriminatedObject(value) {
|
|
5927
6605
|
return discriminatedObject.safeParse(value).success;
|
|
5928
6606
|
}
|
|
@@ -6290,17 +6968,17 @@ function unknown(lexicons2, path, def2, value) {
|
|
|
6290
6968
|
}
|
|
6291
6969
|
|
|
6292
6970
|
// ../lexicon/src/blob-refs.ts
|
|
6293
|
-
var typedJsonBlobRef =
|
|
6294
|
-
$type:
|
|
6971
|
+
var typedJsonBlobRef = z.object({
|
|
6972
|
+
$type: z.literal("blob"),
|
|
6295
6973
|
ref: schema.cid,
|
|
6296
|
-
mimeType:
|
|
6297
|
-
size:
|
|
6974
|
+
mimeType: z.string(),
|
|
6975
|
+
size: z.number()
|
|
6298
6976
|
}).strict();
|
|
6299
|
-
var untypedJsonBlobRef =
|
|
6300
|
-
cid:
|
|
6301
|
-
mimeType:
|
|
6977
|
+
var untypedJsonBlobRef = z.object({
|
|
6978
|
+
cid: z.string(),
|
|
6979
|
+
mimeType: z.string()
|
|
6302
6980
|
}).strict();
|
|
6303
|
-
var jsonBlobRef =
|
|
6981
|
+
var jsonBlobRef = z.union([typedJsonBlobRef, untypedJsonBlobRef]);
|
|
6304
6982
|
var BlobRef = class {
|
|
6305
6983
|
constructor(ref, mimeType, size, original) {
|
|
6306
6984
|
this.ref = ref;
|
|
@@ -6818,9 +7496,9 @@ var jsonStringToLex = (val) => {
|
|
|
6818
7496
|
};
|
|
6819
7497
|
|
|
6820
7498
|
// ../xrpc/src/types.ts
|
|
6821
|
-
var errorResponseBody =
|
|
6822
|
-
error:
|
|
6823
|
-
message:
|
|
7499
|
+
var errorResponseBody = z.object({
|
|
7500
|
+
error: z.string().optional(),
|
|
7501
|
+
message: z.string().optional()
|
|
6824
7502
|
});
|
|
6825
7503
|
var ResponseType = /* @__PURE__ */ ((ResponseType2) => {
|
|
6826
7504
|
ResponseType2[ResponseType2["Unknown"] = 1] = "Unknown";
|
|
@@ -10585,6 +11263,10 @@ var schemaDict = {
|
|
|
10585
11263
|
muted: {
|
|
10586
11264
|
type: "boolean"
|
|
10587
11265
|
},
|
|
11266
|
+
mutedByList: {
|
|
11267
|
+
type: "ref",
|
|
11268
|
+
ref: "lex:app.bsky.graph.defs#listViewBasic"
|
|
11269
|
+
},
|
|
10588
11270
|
blockedBy: {
|
|
10589
11271
|
type: "boolean"
|
|
10590
11272
|
},
|
|
@@ -11768,6 +12450,114 @@ var schemaDict = {
|
|
|
11768
12450
|
}
|
|
11769
12451
|
}
|
|
11770
12452
|
},
|
|
12453
|
+
AppBskyGraphDefs: {
|
|
12454
|
+
lexicon: 1,
|
|
12455
|
+
id: "app.bsky.graph.defs",
|
|
12456
|
+
defs: {
|
|
12457
|
+
listViewBasic: {
|
|
12458
|
+
type: "object",
|
|
12459
|
+
required: ["uri", "creator", "name", "purpose"],
|
|
12460
|
+
properties: {
|
|
12461
|
+
uri: {
|
|
12462
|
+
type: "string",
|
|
12463
|
+
format: "at-uri"
|
|
12464
|
+
},
|
|
12465
|
+
name: {
|
|
12466
|
+
type: "string",
|
|
12467
|
+
maxLength: 64,
|
|
12468
|
+
minLength: 1
|
|
12469
|
+
},
|
|
12470
|
+
purpose: {
|
|
12471
|
+
type: "ref",
|
|
12472
|
+
ref: "lex:app.bsky.graph.defs#listPurpose"
|
|
12473
|
+
},
|
|
12474
|
+
avatar: {
|
|
12475
|
+
type: "string"
|
|
12476
|
+
},
|
|
12477
|
+
viewer: {
|
|
12478
|
+
type: "ref",
|
|
12479
|
+
ref: "lex:app.bsky.graph.defs#listViewerState"
|
|
12480
|
+
},
|
|
12481
|
+
indexedAt: {
|
|
12482
|
+
type: "string",
|
|
12483
|
+
format: "datetime"
|
|
12484
|
+
}
|
|
12485
|
+
}
|
|
12486
|
+
},
|
|
12487
|
+
listView: {
|
|
12488
|
+
type: "object",
|
|
12489
|
+
required: ["uri", "creator", "name", "purpose", "indexedAt"],
|
|
12490
|
+
properties: {
|
|
12491
|
+
uri: {
|
|
12492
|
+
type: "string",
|
|
12493
|
+
format: "at-uri"
|
|
12494
|
+
},
|
|
12495
|
+
creator: {
|
|
12496
|
+
type: "ref",
|
|
12497
|
+
ref: "lex:app.bsky.actor.defs#profileView"
|
|
12498
|
+
},
|
|
12499
|
+
name: {
|
|
12500
|
+
type: "string",
|
|
12501
|
+
maxLength: 64,
|
|
12502
|
+
minLength: 1
|
|
12503
|
+
},
|
|
12504
|
+
purpose: {
|
|
12505
|
+
type: "ref",
|
|
12506
|
+
ref: "lex:app.bsky.graph.defs#listPurpose"
|
|
12507
|
+
},
|
|
12508
|
+
description: {
|
|
12509
|
+
type: "string",
|
|
12510
|
+
maxGraphemes: 300,
|
|
12511
|
+
maxLength: 3e3
|
|
12512
|
+
},
|
|
12513
|
+
descriptionFacets: {
|
|
12514
|
+
type: "array",
|
|
12515
|
+
items: {
|
|
12516
|
+
type: "ref",
|
|
12517
|
+
ref: "lex:app.bsky.richtext.facet"
|
|
12518
|
+
}
|
|
12519
|
+
},
|
|
12520
|
+
avatar: {
|
|
12521
|
+
type: "string"
|
|
12522
|
+
},
|
|
12523
|
+
viewer: {
|
|
12524
|
+
type: "ref",
|
|
12525
|
+
ref: "lex:app.bsky.graph.defs#listViewerState"
|
|
12526
|
+
},
|
|
12527
|
+
indexedAt: {
|
|
12528
|
+
type: "string",
|
|
12529
|
+
format: "datetime"
|
|
12530
|
+
}
|
|
12531
|
+
}
|
|
12532
|
+
},
|
|
12533
|
+
listItemView: {
|
|
12534
|
+
type: "object",
|
|
12535
|
+
required: ["subject"],
|
|
12536
|
+
properties: {
|
|
12537
|
+
subject: {
|
|
12538
|
+
type: "ref",
|
|
12539
|
+
ref: "lex:app.bsky.actor.defs#profileView"
|
|
12540
|
+
}
|
|
12541
|
+
}
|
|
12542
|
+
},
|
|
12543
|
+
listPurpose: {
|
|
12544
|
+
type: "string",
|
|
12545
|
+
knownValues: ["app.bsky.graph.defs#modlist"]
|
|
12546
|
+
},
|
|
12547
|
+
modlist: {
|
|
12548
|
+
type: "token",
|
|
12549
|
+
description: "A list of actors to apply an aggregate moderation action (mute/block) on"
|
|
12550
|
+
},
|
|
12551
|
+
listViewerState: {
|
|
12552
|
+
type: "object",
|
|
12553
|
+
properties: {
|
|
12554
|
+
muted: {
|
|
12555
|
+
type: "boolean"
|
|
12556
|
+
}
|
|
12557
|
+
}
|
|
12558
|
+
}
|
|
12559
|
+
}
|
|
12560
|
+
},
|
|
11771
12561
|
AppBskyGraphFollow: {
|
|
11772
12562
|
lexicon: 1,
|
|
11773
12563
|
id: "app.bsky.graph.follow",
|
|
@@ -11940,6 +12730,149 @@ var schemaDict = {
|
|
|
11940
12730
|
}
|
|
11941
12731
|
}
|
|
11942
12732
|
},
|
|
12733
|
+
AppBskyGraphGetList: {
|
|
12734
|
+
lexicon: 1,
|
|
12735
|
+
id: "app.bsky.graph.getList",
|
|
12736
|
+
defs: {
|
|
12737
|
+
main: {
|
|
12738
|
+
type: "query",
|
|
12739
|
+
description: "Fetch a list of actors",
|
|
12740
|
+
parameters: {
|
|
12741
|
+
type: "params",
|
|
12742
|
+
required: ["list"],
|
|
12743
|
+
properties: {
|
|
12744
|
+
list: {
|
|
12745
|
+
type: "string",
|
|
12746
|
+
format: "at-uri"
|
|
12747
|
+
},
|
|
12748
|
+
limit: {
|
|
12749
|
+
type: "integer",
|
|
12750
|
+
minimum: 1,
|
|
12751
|
+
maximum: 100,
|
|
12752
|
+
default: 50
|
|
12753
|
+
},
|
|
12754
|
+
cursor: {
|
|
12755
|
+
type: "string"
|
|
12756
|
+
}
|
|
12757
|
+
}
|
|
12758
|
+
},
|
|
12759
|
+
output: {
|
|
12760
|
+
encoding: "application/json",
|
|
12761
|
+
schema: {
|
|
12762
|
+
type: "object",
|
|
12763
|
+
required: ["list", "items"],
|
|
12764
|
+
properties: {
|
|
12765
|
+
cursor: {
|
|
12766
|
+
type: "string"
|
|
12767
|
+
},
|
|
12768
|
+
list: {
|
|
12769
|
+
type: "ref",
|
|
12770
|
+
ref: "lex:app.bsky.graph.defs#listView"
|
|
12771
|
+
},
|
|
12772
|
+
items: {
|
|
12773
|
+
type: "array",
|
|
12774
|
+
items: {
|
|
12775
|
+
type: "ref",
|
|
12776
|
+
ref: "lex:app.bsky.graph.defs#listItemView"
|
|
12777
|
+
}
|
|
12778
|
+
}
|
|
12779
|
+
}
|
|
12780
|
+
}
|
|
12781
|
+
}
|
|
12782
|
+
}
|
|
12783
|
+
}
|
|
12784
|
+
},
|
|
12785
|
+
AppBskyGraphGetListMutes: {
|
|
12786
|
+
lexicon: 1,
|
|
12787
|
+
id: "app.bsky.graph.getListMutes",
|
|
12788
|
+
defs: {
|
|
12789
|
+
main: {
|
|
12790
|
+
type: "query",
|
|
12791
|
+
description: "Which lists is the requester's account muting?",
|
|
12792
|
+
parameters: {
|
|
12793
|
+
type: "params",
|
|
12794
|
+
properties: {
|
|
12795
|
+
limit: {
|
|
12796
|
+
type: "integer",
|
|
12797
|
+
minimum: 1,
|
|
12798
|
+
maximum: 100,
|
|
12799
|
+
default: 50
|
|
12800
|
+
},
|
|
12801
|
+
cursor: {
|
|
12802
|
+
type: "string"
|
|
12803
|
+
}
|
|
12804
|
+
}
|
|
12805
|
+
},
|
|
12806
|
+
output: {
|
|
12807
|
+
encoding: "application/json",
|
|
12808
|
+
schema: {
|
|
12809
|
+
type: "object",
|
|
12810
|
+
required: ["lists"],
|
|
12811
|
+
properties: {
|
|
12812
|
+
cursor: {
|
|
12813
|
+
type: "string"
|
|
12814
|
+
},
|
|
12815
|
+
lists: {
|
|
12816
|
+
type: "array",
|
|
12817
|
+
items: {
|
|
12818
|
+
type: "ref",
|
|
12819
|
+
ref: "lex:app.bsky.graph.defs#listView"
|
|
12820
|
+
}
|
|
12821
|
+
}
|
|
12822
|
+
}
|
|
12823
|
+
}
|
|
12824
|
+
}
|
|
12825
|
+
}
|
|
12826
|
+
}
|
|
12827
|
+
},
|
|
12828
|
+
AppBskyGraphGetLists: {
|
|
12829
|
+
lexicon: 1,
|
|
12830
|
+
id: "app.bsky.graph.getLists",
|
|
12831
|
+
defs: {
|
|
12832
|
+
main: {
|
|
12833
|
+
type: "query",
|
|
12834
|
+
description: "Fetch a list of lists that belong to an actor",
|
|
12835
|
+
parameters: {
|
|
12836
|
+
type: "params",
|
|
12837
|
+
required: ["actor"],
|
|
12838
|
+
properties: {
|
|
12839
|
+
actor: {
|
|
12840
|
+
type: "string",
|
|
12841
|
+
format: "at-identifier"
|
|
12842
|
+
},
|
|
12843
|
+
limit: {
|
|
12844
|
+
type: "integer",
|
|
12845
|
+
minimum: 1,
|
|
12846
|
+
maximum: 100,
|
|
12847
|
+
default: 50
|
|
12848
|
+
},
|
|
12849
|
+
cursor: {
|
|
12850
|
+
type: "string"
|
|
12851
|
+
}
|
|
12852
|
+
}
|
|
12853
|
+
},
|
|
12854
|
+
output: {
|
|
12855
|
+
encoding: "application/json",
|
|
12856
|
+
schema: {
|
|
12857
|
+
type: "object",
|
|
12858
|
+
required: ["lists"],
|
|
12859
|
+
properties: {
|
|
12860
|
+
cursor: {
|
|
12861
|
+
type: "string"
|
|
12862
|
+
},
|
|
12863
|
+
lists: {
|
|
12864
|
+
type: "array",
|
|
12865
|
+
items: {
|
|
12866
|
+
type: "ref",
|
|
12867
|
+
ref: "lex:app.bsky.graph.defs#listView"
|
|
12868
|
+
}
|
|
12869
|
+
}
|
|
12870
|
+
}
|
|
12871
|
+
}
|
|
12872
|
+
}
|
|
12873
|
+
}
|
|
12874
|
+
}
|
|
12875
|
+
},
|
|
11943
12876
|
AppBskyGraphGetMutes: {
|
|
11944
12877
|
lexicon: 1,
|
|
11945
12878
|
id: "app.bsky.graph.getMutes",
|
|
@@ -11983,6 +12916,82 @@ var schemaDict = {
|
|
|
11983
12916
|
}
|
|
11984
12917
|
}
|
|
11985
12918
|
},
|
|
12919
|
+
AppBskyGraphList: {
|
|
12920
|
+
lexicon: 1,
|
|
12921
|
+
id: "app.bsky.graph.list",
|
|
12922
|
+
defs: {
|
|
12923
|
+
main: {
|
|
12924
|
+
type: "record",
|
|
12925
|
+
description: "A declaration of a list of actors.",
|
|
12926
|
+
key: "tid",
|
|
12927
|
+
record: {
|
|
12928
|
+
type: "object",
|
|
12929
|
+
required: ["name", "purpose", "createdAt"],
|
|
12930
|
+
properties: {
|
|
12931
|
+
purpose: {
|
|
12932
|
+
type: "ref",
|
|
12933
|
+
ref: "lex:app.bsky.graph.defs#listPurpose"
|
|
12934
|
+
},
|
|
12935
|
+
name: {
|
|
12936
|
+
type: "string",
|
|
12937
|
+
maxLength: 64,
|
|
12938
|
+
minLength: 1
|
|
12939
|
+
},
|
|
12940
|
+
description: {
|
|
12941
|
+
type: "string",
|
|
12942
|
+
maxGraphemes: 300,
|
|
12943
|
+
maxLength: 3e3
|
|
12944
|
+
},
|
|
12945
|
+
descriptionFacets: {
|
|
12946
|
+
type: "array",
|
|
12947
|
+
items: {
|
|
12948
|
+
type: "ref",
|
|
12949
|
+
ref: "lex:app.bsky.richtext.facet"
|
|
12950
|
+
}
|
|
12951
|
+
},
|
|
12952
|
+
avatar: {
|
|
12953
|
+
type: "blob",
|
|
12954
|
+
accept: ["image/png", "image/jpeg"],
|
|
12955
|
+
maxSize: 1e6
|
|
12956
|
+
},
|
|
12957
|
+
createdAt: {
|
|
12958
|
+
type: "string",
|
|
12959
|
+
format: "datetime"
|
|
12960
|
+
}
|
|
12961
|
+
}
|
|
12962
|
+
}
|
|
12963
|
+
}
|
|
12964
|
+
}
|
|
12965
|
+
},
|
|
12966
|
+
AppBskyGraphListitem: {
|
|
12967
|
+
lexicon: 1,
|
|
12968
|
+
id: "app.bsky.graph.listitem",
|
|
12969
|
+
defs: {
|
|
12970
|
+
main: {
|
|
12971
|
+
type: "record",
|
|
12972
|
+
description: "An item under a declared list of actors",
|
|
12973
|
+
key: "tid",
|
|
12974
|
+
record: {
|
|
12975
|
+
type: "object",
|
|
12976
|
+
required: ["subject", "list", "createdAt"],
|
|
12977
|
+
properties: {
|
|
12978
|
+
subject: {
|
|
12979
|
+
type: "string",
|
|
12980
|
+
format: "did"
|
|
12981
|
+
},
|
|
12982
|
+
list: {
|
|
12983
|
+
type: "string",
|
|
12984
|
+
format: "at-uri"
|
|
12985
|
+
},
|
|
12986
|
+
createdAt: {
|
|
12987
|
+
type: "string",
|
|
12988
|
+
format: "datetime"
|
|
12989
|
+
}
|
|
12990
|
+
}
|
|
12991
|
+
}
|
|
12992
|
+
}
|
|
12993
|
+
}
|
|
12994
|
+
},
|
|
11986
12995
|
AppBskyGraphMuteActor: {
|
|
11987
12996
|
lexicon: 1,
|
|
11988
12997
|
id: "app.bsky.graph.muteActor",
|
|
@@ -12006,6 +13015,29 @@ var schemaDict = {
|
|
|
12006
13015
|
}
|
|
12007
13016
|
}
|
|
12008
13017
|
},
|
|
13018
|
+
AppBskyGraphMuteActorList: {
|
|
13019
|
+
lexicon: 1,
|
|
13020
|
+
id: "app.bsky.graph.muteActorList",
|
|
13021
|
+
defs: {
|
|
13022
|
+
main: {
|
|
13023
|
+
type: "procedure",
|
|
13024
|
+
description: "Mute a list of actors.",
|
|
13025
|
+
input: {
|
|
13026
|
+
encoding: "application/json",
|
|
13027
|
+
schema: {
|
|
13028
|
+
type: "object",
|
|
13029
|
+
required: ["list"],
|
|
13030
|
+
properties: {
|
|
13031
|
+
list: {
|
|
13032
|
+
type: "string",
|
|
13033
|
+
format: "at-uri"
|
|
13034
|
+
}
|
|
13035
|
+
}
|
|
13036
|
+
}
|
|
13037
|
+
}
|
|
13038
|
+
}
|
|
13039
|
+
}
|
|
13040
|
+
},
|
|
12009
13041
|
AppBskyGraphUnmuteActor: {
|
|
12010
13042
|
lexicon: 1,
|
|
12011
13043
|
id: "app.bsky.graph.unmuteActor",
|
|
@@ -12029,6 +13061,29 @@ var schemaDict = {
|
|
|
12029
13061
|
}
|
|
12030
13062
|
}
|
|
12031
13063
|
},
|
|
13064
|
+
AppBskyGraphUnmuteActorList: {
|
|
13065
|
+
lexicon: 1,
|
|
13066
|
+
id: "app.bsky.graph.unmuteActorList",
|
|
13067
|
+
defs: {
|
|
13068
|
+
main: {
|
|
13069
|
+
type: "procedure",
|
|
13070
|
+
description: "Unmute a list of actors.",
|
|
13071
|
+
input: {
|
|
13072
|
+
encoding: "application/json",
|
|
13073
|
+
schema: {
|
|
13074
|
+
type: "object",
|
|
13075
|
+
required: ["list"],
|
|
13076
|
+
properties: {
|
|
13077
|
+
list: {
|
|
13078
|
+
type: "string",
|
|
13079
|
+
format: "at-uri"
|
|
13080
|
+
}
|
|
13081
|
+
}
|
|
13082
|
+
}
|
|
13083
|
+
}
|
|
13084
|
+
}
|
|
13085
|
+
}
|
|
13086
|
+
},
|
|
12032
13087
|
AppBskyNotificationGetUnreadCount: {
|
|
12033
13088
|
lexicon: 1,
|
|
12034
13089
|
id: "app.bsky.notification.getUnreadCount",
|
|
@@ -13351,12 +14406,45 @@ function toKnownErr70(e) {
|
|
|
13351
14406
|
return e;
|
|
13352
14407
|
}
|
|
13353
14408
|
|
|
14409
|
+
// src/client/types/app/bsky/graph/getList.ts
|
|
14410
|
+
var getList_exports = {};
|
|
14411
|
+
__export(getList_exports, {
|
|
14412
|
+
toKnownErr: () => toKnownErr71
|
|
14413
|
+
});
|
|
14414
|
+
function toKnownErr71(e) {
|
|
14415
|
+
if (e instanceof XRPCError) {
|
|
14416
|
+
}
|
|
14417
|
+
return e;
|
|
14418
|
+
}
|
|
14419
|
+
|
|
14420
|
+
// src/client/types/app/bsky/graph/getListMutes.ts
|
|
14421
|
+
var getListMutes_exports = {};
|
|
14422
|
+
__export(getListMutes_exports, {
|
|
14423
|
+
toKnownErr: () => toKnownErr72
|
|
14424
|
+
});
|
|
14425
|
+
function toKnownErr72(e) {
|
|
14426
|
+
if (e instanceof XRPCError) {
|
|
14427
|
+
}
|
|
14428
|
+
return e;
|
|
14429
|
+
}
|
|
14430
|
+
|
|
14431
|
+
// src/client/types/app/bsky/graph/getLists.ts
|
|
14432
|
+
var getLists_exports = {};
|
|
14433
|
+
__export(getLists_exports, {
|
|
14434
|
+
toKnownErr: () => toKnownErr73
|
|
14435
|
+
});
|
|
14436
|
+
function toKnownErr73(e) {
|
|
14437
|
+
if (e instanceof XRPCError) {
|
|
14438
|
+
}
|
|
14439
|
+
return e;
|
|
14440
|
+
}
|
|
14441
|
+
|
|
13354
14442
|
// src/client/types/app/bsky/graph/getMutes.ts
|
|
13355
14443
|
var getMutes_exports = {};
|
|
13356
14444
|
__export(getMutes_exports, {
|
|
13357
|
-
toKnownErr: () =>
|
|
14445
|
+
toKnownErr: () => toKnownErr74
|
|
13358
14446
|
});
|
|
13359
|
-
function
|
|
14447
|
+
function toKnownErr74(e) {
|
|
13360
14448
|
if (e instanceof XRPCError) {
|
|
13361
14449
|
}
|
|
13362
14450
|
return e;
|
|
@@ -13365,9 +14453,20 @@ function toKnownErr71(e) {
|
|
|
13365
14453
|
// src/client/types/app/bsky/graph/muteActor.ts
|
|
13366
14454
|
var muteActor_exports = {};
|
|
13367
14455
|
__export(muteActor_exports, {
|
|
13368
|
-
toKnownErr: () =>
|
|
14456
|
+
toKnownErr: () => toKnownErr75
|
|
13369
14457
|
});
|
|
13370
|
-
function
|
|
14458
|
+
function toKnownErr75(e) {
|
|
14459
|
+
if (e instanceof XRPCError) {
|
|
14460
|
+
}
|
|
14461
|
+
return e;
|
|
14462
|
+
}
|
|
14463
|
+
|
|
14464
|
+
// src/client/types/app/bsky/graph/muteActorList.ts
|
|
14465
|
+
var muteActorList_exports = {};
|
|
14466
|
+
__export(muteActorList_exports, {
|
|
14467
|
+
toKnownErr: () => toKnownErr76
|
|
14468
|
+
});
|
|
14469
|
+
function toKnownErr76(e) {
|
|
13371
14470
|
if (e instanceof XRPCError) {
|
|
13372
14471
|
}
|
|
13373
14472
|
return e;
|
|
@@ -13376,9 +14475,20 @@ function toKnownErr72(e) {
|
|
|
13376
14475
|
// src/client/types/app/bsky/graph/unmuteActor.ts
|
|
13377
14476
|
var unmuteActor_exports = {};
|
|
13378
14477
|
__export(unmuteActor_exports, {
|
|
13379
|
-
toKnownErr: () =>
|
|
14478
|
+
toKnownErr: () => toKnownErr77
|
|
13380
14479
|
});
|
|
13381
|
-
function
|
|
14480
|
+
function toKnownErr77(e) {
|
|
14481
|
+
if (e instanceof XRPCError) {
|
|
14482
|
+
}
|
|
14483
|
+
return e;
|
|
14484
|
+
}
|
|
14485
|
+
|
|
14486
|
+
// src/client/types/app/bsky/graph/unmuteActorList.ts
|
|
14487
|
+
var unmuteActorList_exports = {};
|
|
14488
|
+
__export(unmuteActorList_exports, {
|
|
14489
|
+
toKnownErr: () => toKnownErr78
|
|
14490
|
+
});
|
|
14491
|
+
function toKnownErr78(e) {
|
|
13382
14492
|
if (e instanceof XRPCError) {
|
|
13383
14493
|
}
|
|
13384
14494
|
return e;
|
|
@@ -13387,9 +14497,9 @@ function toKnownErr73(e) {
|
|
|
13387
14497
|
// src/client/types/app/bsky/notification/getUnreadCount.ts
|
|
13388
14498
|
var getUnreadCount_exports = {};
|
|
13389
14499
|
__export(getUnreadCount_exports, {
|
|
13390
|
-
toKnownErr: () =>
|
|
14500
|
+
toKnownErr: () => toKnownErr79
|
|
13391
14501
|
});
|
|
13392
|
-
function
|
|
14502
|
+
function toKnownErr79(e) {
|
|
13393
14503
|
if (e instanceof XRPCError) {
|
|
13394
14504
|
}
|
|
13395
14505
|
return e;
|
|
@@ -13399,10 +14509,10 @@ function toKnownErr74(e) {
|
|
|
13399
14509
|
var listNotifications_exports = {};
|
|
13400
14510
|
__export(listNotifications_exports, {
|
|
13401
14511
|
isNotification: () => isNotification,
|
|
13402
|
-
toKnownErr: () =>
|
|
14512
|
+
toKnownErr: () => toKnownErr80,
|
|
13403
14513
|
validateNotification: () => validateNotification
|
|
13404
14514
|
});
|
|
13405
|
-
function
|
|
14515
|
+
function toKnownErr80(e) {
|
|
13406
14516
|
if (e instanceof XRPCError) {
|
|
13407
14517
|
}
|
|
13408
14518
|
return e;
|
|
@@ -13420,9 +14530,9 @@ function validateNotification(v) {
|
|
|
13420
14530
|
// src/client/types/app/bsky/notification/updateSeen.ts
|
|
13421
14531
|
var updateSeen_exports = {};
|
|
13422
14532
|
__export(updateSeen_exports, {
|
|
13423
|
-
toKnownErr: () =>
|
|
14533
|
+
toKnownErr: () => toKnownErr81
|
|
13424
14534
|
});
|
|
13425
|
-
function
|
|
14535
|
+
function toKnownErr81(e) {
|
|
13426
14536
|
if (e instanceof XRPCError) {
|
|
13427
14537
|
}
|
|
13428
14538
|
return e;
|
|
@@ -13431,9 +14541,9 @@ function toKnownErr76(e) {
|
|
|
13431
14541
|
// src/client/types/app/bsky/unspecced/getPopular.ts
|
|
13432
14542
|
var getPopular_exports = {};
|
|
13433
14543
|
__export(getPopular_exports, {
|
|
13434
|
-
toKnownErr: () =>
|
|
14544
|
+
toKnownErr: () => toKnownErr82
|
|
13435
14545
|
});
|
|
13436
|
-
function
|
|
14546
|
+
function toKnownErr82(e) {
|
|
13437
14547
|
if (e instanceof XRPCError) {
|
|
13438
14548
|
}
|
|
13439
14549
|
return e;
|
|
@@ -14053,6 +15163,45 @@ function validateRecord6(v) {
|
|
|
14053
15163
|
return lexicons.validate("app.bsky.graph.block#main", v);
|
|
14054
15164
|
}
|
|
14055
15165
|
|
|
15166
|
+
// src/client/types/app/bsky/graph/defs.ts
|
|
15167
|
+
var defs_exports7 = {};
|
|
15168
|
+
__export(defs_exports7, {
|
|
15169
|
+
MODLIST: () => MODLIST,
|
|
15170
|
+
isListItemView: () => isListItemView,
|
|
15171
|
+
isListView: () => isListView,
|
|
15172
|
+
isListViewBasic: () => isListViewBasic,
|
|
15173
|
+
isListViewerState: () => isListViewerState,
|
|
15174
|
+
validateListItemView: () => validateListItemView,
|
|
15175
|
+
validateListView: () => validateListView,
|
|
15176
|
+
validateListViewBasic: () => validateListViewBasic,
|
|
15177
|
+
validateListViewerState: () => validateListViewerState
|
|
15178
|
+
});
|
|
15179
|
+
function isListViewBasic(v) {
|
|
15180
|
+
return isObj2(v) && hasProp2(v, "$type") && v.$type === "app.bsky.graph.defs#listViewBasic";
|
|
15181
|
+
}
|
|
15182
|
+
function validateListViewBasic(v) {
|
|
15183
|
+
return lexicons.validate("app.bsky.graph.defs#listViewBasic", v);
|
|
15184
|
+
}
|
|
15185
|
+
function isListView(v) {
|
|
15186
|
+
return isObj2(v) && hasProp2(v, "$type") && v.$type === "app.bsky.graph.defs#listView";
|
|
15187
|
+
}
|
|
15188
|
+
function validateListView(v) {
|
|
15189
|
+
return lexicons.validate("app.bsky.graph.defs#listView", v);
|
|
15190
|
+
}
|
|
15191
|
+
function isListItemView(v) {
|
|
15192
|
+
return isObj2(v) && hasProp2(v, "$type") && v.$type === "app.bsky.graph.defs#listItemView";
|
|
15193
|
+
}
|
|
15194
|
+
function validateListItemView(v) {
|
|
15195
|
+
return lexicons.validate("app.bsky.graph.defs#listItemView", v);
|
|
15196
|
+
}
|
|
15197
|
+
var MODLIST = "app.bsky.graph.defs#modlist";
|
|
15198
|
+
function isListViewerState(v) {
|
|
15199
|
+
return isObj2(v) && hasProp2(v, "$type") && v.$type === "app.bsky.graph.defs#listViewerState";
|
|
15200
|
+
}
|
|
15201
|
+
function validateListViewerState(v) {
|
|
15202
|
+
return lexicons.validate("app.bsky.graph.defs#listViewerState", v);
|
|
15203
|
+
}
|
|
15204
|
+
|
|
14056
15205
|
// src/client/types/app/bsky/graph/follow.ts
|
|
14057
15206
|
var follow_exports = {};
|
|
14058
15207
|
__export(follow_exports, {
|
|
@@ -14066,6 +15215,32 @@ function validateRecord7(v) {
|
|
|
14066
15215
|
return lexicons.validate("app.bsky.graph.follow#main", v);
|
|
14067
15216
|
}
|
|
14068
15217
|
|
|
15218
|
+
// src/client/types/app/bsky/graph/list.ts
|
|
15219
|
+
var list_exports = {};
|
|
15220
|
+
__export(list_exports, {
|
|
15221
|
+
isRecord: () => isRecord8,
|
|
15222
|
+
validateRecord: () => validateRecord8
|
|
15223
|
+
});
|
|
15224
|
+
function isRecord8(v) {
|
|
15225
|
+
return isObj2(v) && hasProp2(v, "$type") && (v.$type === "app.bsky.graph.list#main" || v.$type === "app.bsky.graph.list");
|
|
15226
|
+
}
|
|
15227
|
+
function validateRecord8(v) {
|
|
15228
|
+
return lexicons.validate("app.bsky.graph.list#main", v);
|
|
15229
|
+
}
|
|
15230
|
+
|
|
15231
|
+
// src/client/types/app/bsky/graph/listitem.ts
|
|
15232
|
+
var listitem_exports = {};
|
|
15233
|
+
__export(listitem_exports, {
|
|
15234
|
+
isRecord: () => isRecord9,
|
|
15235
|
+
validateRecord: () => validateRecord9
|
|
15236
|
+
});
|
|
15237
|
+
function isRecord9(v) {
|
|
15238
|
+
return isObj2(v) && hasProp2(v, "$type") && (v.$type === "app.bsky.graph.listitem#main" || v.$type === "app.bsky.graph.listitem");
|
|
15239
|
+
}
|
|
15240
|
+
function validateRecord9(v) {
|
|
15241
|
+
return lexicons.validate("app.bsky.graph.listitem#main", v);
|
|
15242
|
+
}
|
|
15243
|
+
|
|
14069
15244
|
// src/client/types/app/bsky/richtext/facet.ts
|
|
14070
15245
|
var facet_exports = {};
|
|
14071
15246
|
__export(facet_exports, {
|
|
@@ -14118,6 +15293,9 @@ var COM_ATPROTO_MODERATION = {
|
|
|
14118
15293
|
DefsReasonRude: "com.atproto.moderation.defs#reasonRude",
|
|
14119
15294
|
DefsReasonOther: "com.atproto.moderation.defs#reasonOther"
|
|
14120
15295
|
};
|
|
15296
|
+
var APP_BSKY_GRAPH = {
|
|
15297
|
+
DefsModlist: "app.bsky.graph.defs#modlist"
|
|
15298
|
+
};
|
|
14121
15299
|
var AtpBaseClient = class {
|
|
14122
15300
|
constructor() {
|
|
14123
15301
|
this.xrpc = new Client();
|
|
@@ -14716,6 +15894,8 @@ var GraphNS = class {
|
|
|
14716
15894
|
this._service = service;
|
|
14717
15895
|
this.block = new BlockRecord(service);
|
|
14718
15896
|
this.follow = new FollowRecord(service);
|
|
15897
|
+
this.list = new ListRecord(service);
|
|
15898
|
+
this.listitem = new ListitemRecord(service);
|
|
14719
15899
|
}
|
|
14720
15900
|
getBlocks(params2, opts) {
|
|
14721
15901
|
return this._service.xrpc.call("app.bsky.graph.getBlocks", params2, void 0, opts).catch((e) => {
|
|
@@ -14732,19 +15912,44 @@ var GraphNS = class {
|
|
|
14732
15912
|
throw toKnownErr70(e);
|
|
14733
15913
|
});
|
|
14734
15914
|
}
|
|
15915
|
+
getList(params2, opts) {
|
|
15916
|
+
return this._service.xrpc.call("app.bsky.graph.getList", params2, void 0, opts).catch((e) => {
|
|
15917
|
+
throw toKnownErr71(e);
|
|
15918
|
+
});
|
|
15919
|
+
}
|
|
15920
|
+
getListMutes(params2, opts) {
|
|
15921
|
+
return this._service.xrpc.call("app.bsky.graph.getListMutes", params2, void 0, opts).catch((e) => {
|
|
15922
|
+
throw toKnownErr72(e);
|
|
15923
|
+
});
|
|
15924
|
+
}
|
|
15925
|
+
getLists(params2, opts) {
|
|
15926
|
+
return this._service.xrpc.call("app.bsky.graph.getLists", params2, void 0, opts).catch((e) => {
|
|
15927
|
+
throw toKnownErr73(e);
|
|
15928
|
+
});
|
|
15929
|
+
}
|
|
14735
15930
|
getMutes(params2, opts) {
|
|
14736
15931
|
return this._service.xrpc.call("app.bsky.graph.getMutes", params2, void 0, opts).catch((e) => {
|
|
14737
|
-
throw
|
|
15932
|
+
throw toKnownErr74(e);
|
|
14738
15933
|
});
|
|
14739
15934
|
}
|
|
14740
15935
|
muteActor(data, opts) {
|
|
14741
15936
|
return this._service.xrpc.call("app.bsky.graph.muteActor", opts?.qp, data, opts).catch((e) => {
|
|
14742
|
-
throw
|
|
15937
|
+
throw toKnownErr75(e);
|
|
15938
|
+
});
|
|
15939
|
+
}
|
|
15940
|
+
muteActorList(data, opts) {
|
|
15941
|
+
return this._service.xrpc.call("app.bsky.graph.muteActorList", opts?.qp, data, opts).catch((e) => {
|
|
15942
|
+
throw toKnownErr76(e);
|
|
14743
15943
|
});
|
|
14744
15944
|
}
|
|
14745
15945
|
unmuteActor(data, opts) {
|
|
14746
15946
|
return this._service.xrpc.call("app.bsky.graph.unmuteActor", opts?.qp, data, opts).catch((e) => {
|
|
14747
|
-
throw
|
|
15947
|
+
throw toKnownErr77(e);
|
|
15948
|
+
});
|
|
15949
|
+
}
|
|
15950
|
+
unmuteActorList(data, opts) {
|
|
15951
|
+
return this._service.xrpc.call("app.bsky.graph.unmuteActorList", opts?.qp, data, opts).catch((e) => {
|
|
15952
|
+
throw toKnownErr78(e);
|
|
14748
15953
|
});
|
|
14749
15954
|
}
|
|
14750
15955
|
};
|
|
@@ -14822,23 +16027,97 @@ var FollowRecord = class {
|
|
|
14822
16027
|
);
|
|
14823
16028
|
}
|
|
14824
16029
|
};
|
|
16030
|
+
var ListRecord = class {
|
|
16031
|
+
constructor(service) {
|
|
16032
|
+
this._service = service;
|
|
16033
|
+
}
|
|
16034
|
+
async list(params2) {
|
|
16035
|
+
const res = await this._service.xrpc.call("com.atproto.repo.listRecords", {
|
|
16036
|
+
collection: "app.bsky.graph.list",
|
|
16037
|
+
...params2
|
|
16038
|
+
});
|
|
16039
|
+
return res.data;
|
|
16040
|
+
}
|
|
16041
|
+
async get(params2) {
|
|
16042
|
+
const res = await this._service.xrpc.call("com.atproto.repo.getRecord", {
|
|
16043
|
+
collection: "app.bsky.graph.list",
|
|
16044
|
+
...params2
|
|
16045
|
+
});
|
|
16046
|
+
return res.data;
|
|
16047
|
+
}
|
|
16048
|
+
async create(params2, record, headers) {
|
|
16049
|
+
record.$type = "app.bsky.graph.list";
|
|
16050
|
+
const res = await this._service.xrpc.call(
|
|
16051
|
+
"com.atproto.repo.createRecord",
|
|
16052
|
+
void 0,
|
|
16053
|
+
{ collection: "app.bsky.graph.list", ...params2, record },
|
|
16054
|
+
{ encoding: "application/json", headers }
|
|
16055
|
+
);
|
|
16056
|
+
return res.data;
|
|
16057
|
+
}
|
|
16058
|
+
async delete(params2, headers) {
|
|
16059
|
+
await this._service.xrpc.call(
|
|
16060
|
+
"com.atproto.repo.deleteRecord",
|
|
16061
|
+
void 0,
|
|
16062
|
+
{ collection: "app.bsky.graph.list", ...params2 },
|
|
16063
|
+
{ headers }
|
|
16064
|
+
);
|
|
16065
|
+
}
|
|
16066
|
+
};
|
|
16067
|
+
var ListitemRecord = class {
|
|
16068
|
+
constructor(service) {
|
|
16069
|
+
this._service = service;
|
|
16070
|
+
}
|
|
16071
|
+
async list(params2) {
|
|
16072
|
+
const res = await this._service.xrpc.call("com.atproto.repo.listRecords", {
|
|
16073
|
+
collection: "app.bsky.graph.listitem",
|
|
16074
|
+
...params2
|
|
16075
|
+
});
|
|
16076
|
+
return res.data;
|
|
16077
|
+
}
|
|
16078
|
+
async get(params2) {
|
|
16079
|
+
const res = await this._service.xrpc.call("com.atproto.repo.getRecord", {
|
|
16080
|
+
collection: "app.bsky.graph.listitem",
|
|
16081
|
+
...params2
|
|
16082
|
+
});
|
|
16083
|
+
return res.data;
|
|
16084
|
+
}
|
|
16085
|
+
async create(params2, record, headers) {
|
|
16086
|
+
record.$type = "app.bsky.graph.listitem";
|
|
16087
|
+
const res = await this._service.xrpc.call(
|
|
16088
|
+
"com.atproto.repo.createRecord",
|
|
16089
|
+
void 0,
|
|
16090
|
+
{ collection: "app.bsky.graph.listitem", ...params2, record },
|
|
16091
|
+
{ encoding: "application/json", headers }
|
|
16092
|
+
);
|
|
16093
|
+
return res.data;
|
|
16094
|
+
}
|
|
16095
|
+
async delete(params2, headers) {
|
|
16096
|
+
await this._service.xrpc.call(
|
|
16097
|
+
"com.atproto.repo.deleteRecord",
|
|
16098
|
+
void 0,
|
|
16099
|
+
{ collection: "app.bsky.graph.listitem", ...params2 },
|
|
16100
|
+
{ headers }
|
|
16101
|
+
);
|
|
16102
|
+
}
|
|
16103
|
+
};
|
|
14825
16104
|
var NotificationNS = class {
|
|
14826
16105
|
constructor(service) {
|
|
14827
16106
|
this._service = service;
|
|
14828
16107
|
}
|
|
14829
16108
|
getUnreadCount(params2, opts) {
|
|
14830
16109
|
return this._service.xrpc.call("app.bsky.notification.getUnreadCount", params2, void 0, opts).catch((e) => {
|
|
14831
|
-
throw
|
|
16110
|
+
throw toKnownErr79(e);
|
|
14832
16111
|
});
|
|
14833
16112
|
}
|
|
14834
16113
|
listNotifications(params2, opts) {
|
|
14835
16114
|
return this._service.xrpc.call("app.bsky.notification.listNotifications", params2, void 0, opts).catch((e) => {
|
|
14836
|
-
throw
|
|
16115
|
+
throw toKnownErr80(e);
|
|
14837
16116
|
});
|
|
14838
16117
|
}
|
|
14839
16118
|
updateSeen(data, opts) {
|
|
14840
16119
|
return this._service.xrpc.call("app.bsky.notification.updateSeen", opts?.qp, data, opts).catch((e) => {
|
|
14841
|
-
throw
|
|
16120
|
+
throw toKnownErr81(e);
|
|
14842
16121
|
});
|
|
14843
16122
|
}
|
|
14844
16123
|
};
|
|
@@ -14853,7 +16132,7 @@ var UnspeccedNS = class {
|
|
|
14853
16132
|
}
|
|
14854
16133
|
getPopular(params2, opts) {
|
|
14855
16134
|
return this._service.xrpc.call("app.bsky.unspecced.getPopular", params2, void 0, opts).catch((e) => {
|
|
14856
|
-
throw
|
|
16135
|
+
throw toKnownErr82(e);
|
|
14857
16136
|
});
|
|
14858
16137
|
}
|
|
14859
16138
|
};
|