@atproto/api 0.7.4 → 0.8.0
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/CHANGELOG.md +9 -0
- package/dist/client/index.d.ts +1 -0
- package/dist/client/lexicons.d.ts +35 -0
- package/dist/client/types/com/atproto/admin/defs.d.ts +10 -1
- package/dist/client/types/com/atproto/admin/queryModerationStatuses.d.ts +1 -0
- package/dist/client/types/com/atproto/admin/sendEmail.d.ts +1 -0
- package/dist/client/types/com/atproto/moderation/defs.d.ts +2 -1
- package/dist/index.js +62 -10
- package/dist/index.js.map +2 -2
- package/dist/types.d.ts +1 -1
- package/package.json +2 -2
- package/src/agent.ts +26 -8
- package/src/client/index.ts +1 -0
- package/src/client/lexicons.ts +40 -0
- package/src/client/types/com/atproto/admin/defs.ts +28 -0
- package/src/client/types/com/atproto/admin/queryModerationStatuses.ts +2 -0
- package/src/client/types/com/atproto/admin/sendEmail.ts +2 -0
- package/src/client/types/com/atproto/moderation/defs.ts +3 -0
- package/src/types.ts +6 -1
- package/tests/agent.test.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atproto/api
|
|
2
2
|
|
|
3
|
+
## 0.8.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#2010](https://github.com/bluesky-social/atproto/pull/2010) [`14067733`](https://github.com/bluesky-social/atproto/commit/140677335f76b99129c1f593d9e11d64624386c6) Thanks [@estrattonbailey](https://github.com/estrattonbailey)! - Improve `resumeSession` event emission. It will no longer double emit when some
|
|
8
|
+
requests fail, and the `create-failed` event has been replaced by `expired`
|
|
9
|
+
where appropriate, and with a new event `network-error` where appropriate or an
|
|
10
|
+
unknown error occurs.
|
|
11
|
+
|
|
3
12
|
## 0.7.4
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
package/dist/client/index.d.ts
CHANGED
|
@@ -177,9 +177,18 @@ export declare const schemaDict: {
|
|
|
177
177
|
type: string;
|
|
178
178
|
format: string;
|
|
179
179
|
};
|
|
180
|
+
lastAppealedAt: {
|
|
181
|
+
type: string;
|
|
182
|
+
format: string;
|
|
183
|
+
description: string;
|
|
184
|
+
};
|
|
180
185
|
takendown: {
|
|
181
186
|
type: string;
|
|
182
187
|
};
|
|
188
|
+
appealed: {
|
|
189
|
+
type: string;
|
|
190
|
+
description: string;
|
|
191
|
+
};
|
|
183
192
|
suspendUntil: {
|
|
184
193
|
type: string;
|
|
185
194
|
format: string;
|
|
@@ -606,6 +615,16 @@ export declare const schemaDict: {
|
|
|
606
615
|
};
|
|
607
616
|
};
|
|
608
617
|
};
|
|
618
|
+
modEventResolveAppeal: {
|
|
619
|
+
type: string;
|
|
620
|
+
description: string;
|
|
621
|
+
properties: {
|
|
622
|
+
comment: {
|
|
623
|
+
type: string;
|
|
624
|
+
description: string;
|
|
625
|
+
};
|
|
626
|
+
};
|
|
627
|
+
};
|
|
609
628
|
modEventComment: {
|
|
610
629
|
type: string;
|
|
611
630
|
description: string;
|
|
@@ -705,6 +724,10 @@ export declare const schemaDict: {
|
|
|
705
724
|
type: string;
|
|
706
725
|
description: string;
|
|
707
726
|
};
|
|
727
|
+
comment: {
|
|
728
|
+
type: string;
|
|
729
|
+
description: string;
|
|
730
|
+
};
|
|
708
731
|
};
|
|
709
732
|
};
|
|
710
733
|
};
|
|
@@ -1214,6 +1237,10 @@ export declare const schemaDict: {
|
|
|
1214
1237
|
type: string;
|
|
1215
1238
|
description: string;
|
|
1216
1239
|
};
|
|
1240
|
+
appealed: {
|
|
1241
|
+
type: string;
|
|
1242
|
+
description: string;
|
|
1243
|
+
};
|
|
1217
1244
|
limit: {
|
|
1218
1245
|
type: string;
|
|
1219
1246
|
minimum: number;
|
|
@@ -1324,6 +1351,10 @@ export declare const schemaDict: {
|
|
|
1324
1351
|
type: string;
|
|
1325
1352
|
format: string;
|
|
1326
1353
|
};
|
|
1354
|
+
comment: {
|
|
1355
|
+
type: string;
|
|
1356
|
+
description: string;
|
|
1357
|
+
};
|
|
1327
1358
|
};
|
|
1328
1359
|
};
|
|
1329
1360
|
};
|
|
@@ -1777,6 +1808,10 @@ export declare const schemaDict: {
|
|
|
1777
1808
|
type: string;
|
|
1778
1809
|
description: string;
|
|
1779
1810
|
};
|
|
1811
|
+
reasonAppeal: {
|
|
1812
|
+
type: string;
|
|
1813
|
+
description: string;
|
|
1814
|
+
};
|
|
1780
1815
|
};
|
|
1781
1816
|
};
|
|
1782
1817
|
ComAtprotoRepoApplyWrites: {
|
|
@@ -31,7 +31,7 @@ export declare function isModEventView(v: unknown): v is ModEventView;
|
|
|
31
31
|
export declare function validateModEventView(v: unknown): ValidationResult;
|
|
32
32
|
export interface ModEventViewDetail {
|
|
33
33
|
id: number;
|
|
34
|
-
event: ModEventTakedown | ModEventReverseTakedown | ModEventComment | ModEventReport | ModEventLabel | ModEventAcknowledge | ModEventEscalate | ModEventMute | {
|
|
34
|
+
event: ModEventTakedown | ModEventReverseTakedown | ModEventComment | ModEventReport | ModEventLabel | ModEventAcknowledge | ModEventEscalate | ModEventMute | ModEventResolveAppeal | {
|
|
35
35
|
$type: string;
|
|
36
36
|
[k: string]: unknown;
|
|
37
37
|
};
|
|
@@ -78,7 +78,9 @@ export interface SubjectStatusView {
|
|
|
78
78
|
lastReviewedBy?: string;
|
|
79
79
|
lastReviewedAt?: string;
|
|
80
80
|
lastReportedAt?: string;
|
|
81
|
+
lastAppealedAt?: string;
|
|
81
82
|
takendown?: boolean;
|
|
83
|
+
appealed?: boolean;
|
|
82
84
|
suspendUntil?: string;
|
|
83
85
|
[k: string]: unknown;
|
|
84
86
|
}
|
|
@@ -254,6 +256,12 @@ export interface ModEventReverseTakedown {
|
|
|
254
256
|
}
|
|
255
257
|
export declare function isModEventReverseTakedown(v: unknown): v is ModEventReverseTakedown;
|
|
256
258
|
export declare function validateModEventReverseTakedown(v: unknown): ValidationResult;
|
|
259
|
+
export interface ModEventResolveAppeal {
|
|
260
|
+
comment?: string;
|
|
261
|
+
[k: string]: unknown;
|
|
262
|
+
}
|
|
263
|
+
export declare function isModEventResolveAppeal(v: unknown): v is ModEventResolveAppeal;
|
|
264
|
+
export declare function validateModEventResolveAppeal(v: unknown): ValidationResult;
|
|
257
265
|
export interface ModEventComment {
|
|
258
266
|
comment: string;
|
|
259
267
|
sticky?: boolean;
|
|
@@ -303,6 +311,7 @@ export declare function isModEventUnmute(v: unknown): v is ModEventUnmute;
|
|
|
303
311
|
export declare function validateModEventUnmute(v: unknown): ValidationResult;
|
|
304
312
|
export interface ModEventEmail {
|
|
305
313
|
subjectLine: string;
|
|
314
|
+
comment?: string;
|
|
306
315
|
[k: string]: unknown;
|
|
307
316
|
}
|
|
308
317
|
export declare function isModEventEmail(v: unknown): v is ModEventEmail;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
export declare type ReasonType = 'com.atproto.moderation.defs#reasonSpam' | 'com.atproto.moderation.defs#reasonViolation' | 'com.atproto.moderation.defs#reasonMisleading' | 'com.atproto.moderation.defs#reasonSexual' | 'com.atproto.moderation.defs#reasonRude' | 'com.atproto.moderation.defs#reasonOther' | (string & {});
|
|
1
|
+
export declare type ReasonType = 'com.atproto.moderation.defs#reasonSpam' | 'com.atproto.moderation.defs#reasonViolation' | 'com.atproto.moderation.defs#reasonMisleading' | 'com.atproto.moderation.defs#reasonSexual' | 'com.atproto.moderation.defs#reasonRude' | 'com.atproto.moderation.defs#reasonOther' | 'com.atproto.moderation.defs#reasonAppeal' | (string & {});
|
|
2
2
|
export declare const REASONSPAM = "com.atproto.moderation.defs#reasonSpam";
|
|
3
3
|
export declare const REASONVIOLATION = "com.atproto.moderation.defs#reasonViolation";
|
|
4
4
|
export declare const REASONMISLEADING = "com.atproto.moderation.defs#reasonMisleading";
|
|
5
5
|
export declare const REASONSEXUAL = "com.atproto.moderation.defs#reasonSexual";
|
|
6
6
|
export declare const REASONRUDE = "com.atproto.moderation.defs#reasonRude";
|
|
7
7
|
export declare const REASONOTHER = "com.atproto.moderation.defs#reasonOther";
|
|
8
|
+
export declare const REASONAPPEAL = "com.atproto.moderation.defs#reasonAppeal";
|
package/dist/index.js
CHANGED
|
@@ -15771,7 +15771,8 @@ var schemaDict = {
|
|
|
15771
15771
|
"lex:com.atproto.admin.defs#modEventLabel",
|
|
15772
15772
|
"lex:com.atproto.admin.defs#modEventAcknowledge",
|
|
15773
15773
|
"lex:com.atproto.admin.defs#modEventEscalate",
|
|
15774
|
-
"lex:com.atproto.admin.defs#modEventMute"
|
|
15774
|
+
"lex:com.atproto.admin.defs#modEventMute",
|
|
15775
|
+
"lex:com.atproto.admin.defs#modEventResolveAppeal"
|
|
15775
15776
|
]
|
|
15776
15777
|
},
|
|
15777
15778
|
subject: {
|
|
@@ -15905,9 +15906,18 @@ var schemaDict = {
|
|
|
15905
15906
|
type: "string",
|
|
15906
15907
|
format: "datetime"
|
|
15907
15908
|
},
|
|
15909
|
+
lastAppealedAt: {
|
|
15910
|
+
type: "string",
|
|
15911
|
+
format: "datetime",
|
|
15912
|
+
description: "Timestamp referencing when the author of the subject appealed a moderation action"
|
|
15913
|
+
},
|
|
15908
15914
|
takendown: {
|
|
15909
15915
|
type: "boolean"
|
|
15910
15916
|
},
|
|
15917
|
+
appealed: {
|
|
15918
|
+
type: "boolean",
|
|
15919
|
+
description: "True indicates that the a previously taken moderator action was appealed against, by the author of the content. False indicates last appeal was resolved by moderators."
|
|
15920
|
+
},
|
|
15911
15921
|
suspendUntil: {
|
|
15912
15922
|
type: "string",
|
|
15913
15923
|
format: "datetime"
|
|
@@ -16381,6 +16391,16 @@ var schemaDict = {
|
|
|
16381
16391
|
}
|
|
16382
16392
|
}
|
|
16383
16393
|
},
|
|
16394
|
+
modEventResolveAppeal: {
|
|
16395
|
+
type: "object",
|
|
16396
|
+
description: "Resolve appeal on a subject",
|
|
16397
|
+
properties: {
|
|
16398
|
+
comment: {
|
|
16399
|
+
type: "string",
|
|
16400
|
+
description: "Describe resolution."
|
|
16401
|
+
}
|
|
16402
|
+
}
|
|
16403
|
+
},
|
|
16384
16404
|
modEventComment: {
|
|
16385
16405
|
type: "object",
|
|
16386
16406
|
description: "Add a comment to a subject",
|
|
@@ -16479,6 +16499,10 @@ var schemaDict = {
|
|
|
16479
16499
|
subjectLine: {
|
|
16480
16500
|
type: "string",
|
|
16481
16501
|
description: "The subject line of the email sent to the user."
|
|
16502
|
+
},
|
|
16503
|
+
comment: {
|
|
16504
|
+
type: "string",
|
|
16505
|
+
description: "Additional comment about the outgoing comm."
|
|
16482
16506
|
}
|
|
16483
16507
|
}
|
|
16484
16508
|
}
|
|
@@ -17013,6 +17037,10 @@ var schemaDict = {
|
|
|
17013
17037
|
type: "boolean",
|
|
17014
17038
|
description: "Get subjects that were taken down"
|
|
17015
17039
|
},
|
|
17040
|
+
appealed: {
|
|
17041
|
+
type: "boolean",
|
|
17042
|
+
description: "Get subjects in unresolved appealed status"
|
|
17043
|
+
},
|
|
17016
17044
|
limit: {
|
|
17017
17045
|
type: "integer",
|
|
17018
17046
|
minimum: 1,
|
|
@@ -17122,6 +17150,10 @@ var schemaDict = {
|
|
|
17122
17150
|
senderDid: {
|
|
17123
17151
|
type: "string",
|
|
17124
17152
|
format: "did"
|
|
17153
|
+
},
|
|
17154
|
+
comment: {
|
|
17155
|
+
type: "string",
|
|
17156
|
+
description: "Additional comment by the sender that won't be used in the email itself but helpful to provide more context for moderators/reviewers"
|
|
17125
17157
|
}
|
|
17126
17158
|
}
|
|
17127
17159
|
}
|
|
@@ -17581,7 +17613,8 @@ var schemaDict = {
|
|
|
17581
17613
|
"com.atproto.moderation.defs#reasonMisleading",
|
|
17582
17614
|
"com.atproto.moderation.defs#reasonSexual",
|
|
17583
17615
|
"com.atproto.moderation.defs#reasonRude",
|
|
17584
|
-
"com.atproto.moderation.defs#reasonOther"
|
|
17616
|
+
"com.atproto.moderation.defs#reasonOther",
|
|
17617
|
+
"com.atproto.moderation.defs#reasonAppeal"
|
|
17585
17618
|
]
|
|
17586
17619
|
},
|
|
17587
17620
|
reasonSpam: {
|
|
@@ -17607,6 +17640,10 @@ var schemaDict = {
|
|
|
17607
17640
|
reasonOther: {
|
|
17608
17641
|
type: "token",
|
|
17609
17642
|
description: "Other: reports not falling under another report category"
|
|
17643
|
+
},
|
|
17644
|
+
reasonAppeal: {
|
|
17645
|
+
type: "token",
|
|
17646
|
+
description: "Appeal: appeal a previously taken moderation action"
|
|
17610
17647
|
}
|
|
17611
17648
|
}
|
|
17612
17649
|
},
|
|
@@ -25177,6 +25214,7 @@ __export(defs_exports, {
|
|
|
25177
25214
|
isModEventLabel: () => isModEventLabel,
|
|
25178
25215
|
isModEventMute: () => isModEventMute,
|
|
25179
25216
|
isModEventReport: () => isModEventReport,
|
|
25217
|
+
isModEventResolveAppeal: () => isModEventResolveAppeal,
|
|
25180
25218
|
isModEventReverseTakedown: () => isModEventReverseTakedown,
|
|
25181
25219
|
isModEventTakedown: () => isModEventTakedown,
|
|
25182
25220
|
isModEventUnmute: () => isModEventUnmute,
|
|
@@ -25207,6 +25245,7 @@ __export(defs_exports, {
|
|
|
25207
25245
|
validateModEventLabel: () => validateModEventLabel,
|
|
25208
25246
|
validateModEventMute: () => validateModEventMute,
|
|
25209
25247
|
validateModEventReport: () => validateModEventReport,
|
|
25248
|
+
validateModEventResolveAppeal: () => validateModEventResolveAppeal,
|
|
25210
25249
|
validateModEventReverseTakedown: () => validateModEventReverseTakedown,
|
|
25211
25250
|
validateModEventTakedown: () => validateModEventTakedown,
|
|
25212
25251
|
validateModEventUnmute: () => validateModEventUnmute,
|
|
@@ -25363,6 +25402,12 @@ function isModEventReverseTakedown(v) {
|
|
|
25363
25402
|
function validateModEventReverseTakedown(v) {
|
|
25364
25403
|
return lexicons.validate("com.atproto.admin.defs#modEventReverseTakedown", v);
|
|
25365
25404
|
}
|
|
25405
|
+
function isModEventResolveAppeal(v) {
|
|
25406
|
+
return isObj2(v) && hasProp2(v, "$type") && v.$type === "com.atproto.admin.defs#modEventResolveAppeal";
|
|
25407
|
+
}
|
|
25408
|
+
function validateModEventResolveAppeal(v) {
|
|
25409
|
+
return lexicons.validate("com.atproto.admin.defs#modEventResolveAppeal", v);
|
|
25410
|
+
}
|
|
25366
25411
|
function isModEventComment(v) {
|
|
25367
25412
|
return isObj2(v) && hasProp2(v, "$type") && v.$type === "com.atproto.admin.defs#modEventComment";
|
|
25368
25413
|
}
|
|
@@ -25465,6 +25510,7 @@ function validateInfo(v) {
|
|
|
25465
25510
|
// src/client/types/com/atproto/moderation/defs.ts
|
|
25466
25511
|
var defs_exports3 = {};
|
|
25467
25512
|
__export(defs_exports3, {
|
|
25513
|
+
REASONAPPEAL: () => REASONAPPEAL,
|
|
25468
25514
|
REASONMISLEADING: () => REASONMISLEADING,
|
|
25469
25515
|
REASONOTHER: () => REASONOTHER,
|
|
25470
25516
|
REASONRUDE: () => REASONRUDE,
|
|
@@ -25478,6 +25524,7 @@ var REASONMISLEADING = "com.atproto.moderation.defs#reasonMisleading";
|
|
|
25478
25524
|
var REASONSEXUAL = "com.atproto.moderation.defs#reasonSexual";
|
|
25479
25525
|
var REASONRUDE = "com.atproto.moderation.defs#reasonRude";
|
|
25480
25526
|
var REASONOTHER = "com.atproto.moderation.defs#reasonOther";
|
|
25527
|
+
var REASONAPPEAL = "com.atproto.moderation.defs#reasonAppeal";
|
|
25481
25528
|
|
|
25482
25529
|
// src/client/types/com/atproto/repo/strongRef.ts
|
|
25483
25530
|
var strongRef_exports = {};
|
|
@@ -26226,7 +26273,8 @@ var COM_ATPROTO_MODERATION = {
|
|
|
26226
26273
|
DefsReasonMisleading: "com.atproto.moderation.defs#reasonMisleading",
|
|
26227
26274
|
DefsReasonSexual: "com.atproto.moderation.defs#reasonSexual",
|
|
26228
26275
|
DefsReasonRude: "com.atproto.moderation.defs#reasonRude",
|
|
26229
|
-
DefsReasonOther: "com.atproto.moderation.defs#reasonOther"
|
|
26276
|
+
DefsReasonOther: "com.atproto.moderation.defs#reasonOther",
|
|
26277
|
+
DefsReasonAppeal: "com.atproto.moderation.defs#reasonAppeal"
|
|
26230
26278
|
};
|
|
26231
26279
|
var APP_BSKY_GRAPH = {
|
|
26232
26280
|
DefsModlist: "app.bsky.graph.defs#modlist",
|
|
@@ -27314,23 +27362,27 @@ var _AtpAgent = class {
|
|
|
27314
27362
|
try {
|
|
27315
27363
|
this.session = session;
|
|
27316
27364
|
const res = await this.api.com.atproto.server.getSession();
|
|
27317
|
-
if (
|
|
27318
|
-
throw new
|
|
27365
|
+
if (res.data.did !== this.session.did) {
|
|
27366
|
+
throw new XRPCError(400 /* InvalidRequest */, "Invalid session", "InvalidDID");
|
|
27319
27367
|
}
|
|
27320
27368
|
this.session.email = res.data.email;
|
|
27321
27369
|
this.session.handle = res.data.handle;
|
|
27322
27370
|
this.session.emailConfirmed = res.data.emailConfirmed;
|
|
27323
27371
|
this._updateApiEndpoint(res.data.didDoc);
|
|
27372
|
+
this._persistSession?.("update", this.session);
|
|
27324
27373
|
return res;
|
|
27325
27374
|
} catch (e) {
|
|
27326
27375
|
this.session = void 0;
|
|
27327
|
-
|
|
27328
|
-
|
|
27329
|
-
|
|
27330
|
-
|
|
27376
|
+
if (e instanceof XRPCError) {
|
|
27377
|
+
if ([1, 408, 425, 429, 500, 502, 503, 504, 522, 524].includes(e.status)) {
|
|
27378
|
+
this._persistSession?.("network-error", void 0);
|
|
27379
|
+
} else {
|
|
27380
|
+
this._persistSession?.("expired", void 0);
|
|
27381
|
+
}
|
|
27331
27382
|
} else {
|
|
27332
|
-
this._persistSession?.("
|
|
27383
|
+
this._persistSession?.("network-error", void 0);
|
|
27333
27384
|
}
|
|
27385
|
+
throw e;
|
|
27334
27386
|
}
|
|
27335
27387
|
}
|
|
27336
27388
|
_addAuthHeader(reqHeaders) {
|