@atproto/api 0.13.6 → 0.13.8
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 +22 -0
- package/README.md +1 -1
- package/dist/agent.d.ts +9 -1
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +62 -0
- package/dist/agent.js.map +1 -1
- package/dist/client/lexicons.d.ts +77 -0
- package/dist/client/lexicons.d.ts.map +1 -1
- package/dist/client/lexicons.js +86 -3
- package/dist/client/lexicons.js.map +1 -1
- package/dist/client/types/app/bsky/actor/defs.d.ts +16 -0
- package/dist/client/types/app/bsky/actor/defs.d.ts.map +1 -1
- package/dist/client/types/app/bsky/actor/defs.js +9 -1
- package/dist/client/types/app/bsky/actor/defs.js.map +1 -1
- package/dist/client/types/app/bsky/actor/profile.d.ts +1 -0
- package/dist/client/types/app/bsky/actor/profile.d.ts.map +1 -1
- package/dist/client/types/app/bsky/actor/profile.js.map +1 -1
- package/dist/client/types/app/bsky/feed/defs.d.ts +13 -2
- package/dist/client/types/app/bsky/feed/defs.d.ts.map +1 -1
- package/dist/client/types/app/bsky/feed/defs.js +21 -1
- package/dist/client/types/app/bsky/feed/defs.js.map +1 -1
- package/dist/client/types/app/bsky/feed/getAuthorFeed.d.ts +1 -0
- package/dist/client/types/app/bsky/feed/getAuthorFeed.d.ts.map +1 -1
- package/dist/client/types/app/bsky/feed/getAuthorFeed.js.map +1 -1
- package/dist/client/types/app/bsky/graph/getSuggestedFollowsByActor.d.ts +2 -0
- package/dist/client/types/app/bsky/graph/getSuggestedFollowsByActor.d.ts.map +1 -1
- package/dist/client/types/app/bsky/graph/getSuggestedFollowsByActor.js.map +1 -1
- package/dist/client/types/app/bsky/unspecced/getSuggestionsSkeleton.d.ts +2 -0
- package/dist/client/types/app/bsky/unspecced/getSuggestionsSkeleton.d.ts.map +1 -1
- package/dist/client/types/app/bsky/unspecced/getSuggestionsSkeleton.js.map +1 -1
- package/dist/client/types/tools/ozone/moderation/defs.d.ts +2 -0
- package/dist/client/types/tools/ozone/moderation/defs.d.ts.map +1 -1
- package/dist/client/types/tools/ozone/moderation/defs.js.map +1 -1
- package/dist/client/types/tools/ozone/moderation/queryStatuses.d.ts +3 -0
- package/dist/client/types/tools/ozone/moderation/queryStatuses.d.ts.map +1 -1
- package/dist/client/types/tools/ozone/moderation/queryStatuses.js.map +1 -1
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/util.d.ts +19 -0
- package/dist/util.d.ts.map +1 -1
- package/dist/util.js +17 -1
- package/dist/util.js.map +1 -1
- package/package.json +6 -5
- package/src/agent.ts +80 -1
- package/src/client/lexicons.ts +92 -3
- package/src/client/types/app/bsky/actor/defs.ts +25 -0
- package/src/client/types/app/bsky/actor/profile.ts +1 -0
- package/src/client/types/app/bsky/feed/defs.ts +38 -2
- package/src/client/types/app/bsky/feed/getAuthorFeed.ts +1 -0
- package/src/client/types/app/bsky/graph/getSuggestedFollowsByActor.ts +2 -0
- package/src/client/types/app/bsky/unspecced/getSuggestionsSkeleton.ts +2 -0
- package/src/client/types/tools/ozone/moderation/defs.ts +2 -0
- package/src/client/types/tools/ozone/moderation/queryStatuses.ts +3 -0
- package/src/types.ts +1 -0
- package/src/util.ts +15 -0
- package/tests/bsky-agent.test.ts +91 -0
- package/tests/moderation-prefs.test.ts +4 -0
package/dist/util.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.asDid = exports.isDid = exports.validateSavedFeed = exports.getSavedFeedType = exports.savedFeedsToUriArrays = exports.sanitizeMutedWordValue = void 0;
|
|
6
|
+
exports.validateNux = exports.nuxSchema = exports.asDid = exports.isDid = exports.validateSavedFeed = exports.getSavedFeedType = exports.savedFeedsToUriArrays = exports.sanitizeMutedWordValue = void 0;
|
|
4
7
|
const syntax_1 = require("@atproto/syntax");
|
|
5
8
|
const common_web_1 = require("@atproto/common-web");
|
|
9
|
+
const zod_1 = __importDefault(require("zod"));
|
|
6
10
|
function sanitizeMutedWordValue(value) {
|
|
7
11
|
return (value
|
|
8
12
|
.trim()
|
|
@@ -76,4 +80,16 @@ const asDid = (value) => {
|
|
|
76
80
|
throw new TypeError(`Invalid DID: ${value}`);
|
|
77
81
|
};
|
|
78
82
|
exports.asDid = asDid;
|
|
83
|
+
exports.nuxSchema = zod_1.default
|
|
84
|
+
.object({
|
|
85
|
+
id: zod_1.default.string().max(64),
|
|
86
|
+
completed: zod_1.default.boolean(),
|
|
87
|
+
data: zod_1.default.string().max(300).optional(),
|
|
88
|
+
expiresAt: zod_1.default.string().datetime().optional(),
|
|
89
|
+
})
|
|
90
|
+
.strict();
|
|
91
|
+
function validateNux(nux) {
|
|
92
|
+
exports.nuxSchema.parse(nux);
|
|
93
|
+
}
|
|
94
|
+
exports.validateNux = validateNux;
|
|
79
95
|
//# sourceMappingURL=util.js.map
|
package/dist/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAuC;AACvC,oDAAyC;AACzC,8CAAqB;AAKrB,SAAgB,sBAAsB,CAAC,KAAa;IAClD,OAAO,CACL,KAAK;SACF,IAAI,EAAE;SACN,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC;QAC5B,yDAAyD;SACxD,OAAO,CAAC,uCAAuC,EAAE,EAAE,CAAC,CACxD,CAAA;AACH,CAAC;AARD,wDAQC;AAED,SAAgB,qBAAqB,CACnC,UAAwC;IAKxC,MAAM,MAAM,GAAa,EAAE,CAAA;IAC3B,MAAM,KAAK,G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.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atproto/api",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.8",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Client library for atproto and Bluesky",
|
|
6
6
|
"keywords": [
|
|
@@ -20,16 +20,17 @@
|
|
|
20
20
|
"await-lock": "^2.2.2",
|
|
21
21
|
"multiformats": "^9.9.0",
|
|
22
22
|
"tlds": "^1.234.0",
|
|
23
|
-
"
|
|
24
|
-
"@atproto/
|
|
23
|
+
"zod": "^3.23.8",
|
|
24
|
+
"@atproto/common-web": "^0.3.1",
|
|
25
|
+
"@atproto/lexicon": "^0.4.2",
|
|
25
26
|
"@atproto/syntax": "^0.3.0",
|
|
26
|
-
"@atproto/xrpc": "^0.6.
|
|
27
|
+
"@atproto/xrpc": "^0.6.3"
|
|
27
28
|
},
|
|
28
29
|
"devDependencies": {
|
|
29
30
|
"get-port": "^6.1.2",
|
|
30
31
|
"jest": "^28.1.2",
|
|
31
32
|
"prettier": "^3.2.5",
|
|
32
|
-
"@atproto/lex-cli": "^0.5.
|
|
33
|
+
"@atproto/lex-cli": "^0.5.1"
|
|
33
34
|
},
|
|
34
35
|
"scripts": {
|
|
35
36
|
"codegen": "node ./scripts/generate-code.mjs && lex gen-api --yes ./src/client ../../lexicons/com/atproto/*/* ../../lexicons/app/bsky/*/* ../../lexicons/chat/bsky/*/* ../../lexicons/tools/ozone/*/*",
|
package/src/agent.ts
CHANGED
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
ToolsNS,
|
|
15
15
|
} from './client/index'
|
|
16
16
|
import { schemas } from './client/lexicons'
|
|
17
|
-
import { MutedWord } from './client/types/app/bsky/actor/defs'
|
|
17
|
+
import { MutedWord, Nux } from './client/types/app/bsky/actor/defs'
|
|
18
18
|
import { BSKY_LABELER_DID } from './const'
|
|
19
19
|
import { interpretLabelValueDefinitions } from './moderation'
|
|
20
20
|
import { DEFAULT_LABEL_SETTINGS } from './moderation/const/labels'
|
|
@@ -40,6 +40,7 @@ import {
|
|
|
40
40
|
sanitizeMutedWordValue,
|
|
41
41
|
savedFeedsToUriArrays,
|
|
42
42
|
validateSavedFeed,
|
|
43
|
+
validateNux,
|
|
43
44
|
} from './util'
|
|
44
45
|
|
|
45
46
|
const FEED_VIEW_PREF_DEFAULTS = {
|
|
@@ -570,6 +571,7 @@ export class Agent extends XrpcClient {
|
|
|
570
571
|
bskyAppState: {
|
|
571
572
|
queuedNudges: [],
|
|
572
573
|
activeProgressGuide: undefined,
|
|
574
|
+
nuxs: [],
|
|
573
575
|
},
|
|
574
576
|
}
|
|
575
577
|
const res = await this.app.bsky.actor.getPreferences({})
|
|
@@ -674,6 +676,7 @@ export class Agent extends XrpcClient {
|
|
|
674
676
|
const { $type, ...v } = pref
|
|
675
677
|
prefs.bskyAppState.queuedNudges = v.queuedNudges || []
|
|
676
678
|
prefs.bskyAppState.activeProgressGuide = v.activeProgressGuide
|
|
679
|
+
prefs.bskyAppState.nuxs = v.nuxs || []
|
|
677
680
|
}
|
|
678
681
|
}
|
|
679
682
|
|
|
@@ -1374,6 +1377,82 @@ export class Agent extends XrpcClient {
|
|
|
1374
1377
|
})
|
|
1375
1378
|
}
|
|
1376
1379
|
|
|
1380
|
+
/**
|
|
1381
|
+
* Insert or update a NUX in user prefs
|
|
1382
|
+
*/
|
|
1383
|
+
async bskyAppUpsertNux(nux: Nux) {
|
|
1384
|
+
validateNux(nux)
|
|
1385
|
+
|
|
1386
|
+
await this.updatePreferences((prefs: AppBskyActorDefs.Preferences) => {
|
|
1387
|
+
let bskyAppStatePref: AppBskyActorDefs.BskyAppStatePref = prefs.findLast(
|
|
1388
|
+
(pref) =>
|
|
1389
|
+
AppBskyActorDefs.isBskyAppStatePref(pref) &&
|
|
1390
|
+
AppBskyActorDefs.validateBskyAppStatePref(pref).success,
|
|
1391
|
+
)
|
|
1392
|
+
|
|
1393
|
+
bskyAppStatePref = bskyAppStatePref || {}
|
|
1394
|
+
bskyAppStatePref.nuxs = bskyAppStatePref.nuxs || []
|
|
1395
|
+
|
|
1396
|
+
const existing = bskyAppStatePref.nuxs?.find((n) => {
|
|
1397
|
+
return n.id === nux.id
|
|
1398
|
+
})
|
|
1399
|
+
|
|
1400
|
+
let next: AppBskyActorDefs.Nux
|
|
1401
|
+
|
|
1402
|
+
if (existing) {
|
|
1403
|
+
next = {
|
|
1404
|
+
id: existing.id,
|
|
1405
|
+
completed: nux.completed,
|
|
1406
|
+
data: nux.data,
|
|
1407
|
+
expiresAt: nux.expiresAt,
|
|
1408
|
+
}
|
|
1409
|
+
} else {
|
|
1410
|
+
next = nux
|
|
1411
|
+
}
|
|
1412
|
+
|
|
1413
|
+
// remove duplicates and append
|
|
1414
|
+
bskyAppStatePref.nuxs = bskyAppStatePref.nuxs
|
|
1415
|
+
.filter((n) => n.id !== nux.id)
|
|
1416
|
+
.concat(next)
|
|
1417
|
+
|
|
1418
|
+
return prefs
|
|
1419
|
+
.filter((p) => !AppBskyActorDefs.isBskyAppStatePref(p))
|
|
1420
|
+
.concat([
|
|
1421
|
+
{
|
|
1422
|
+
...bskyAppStatePref,
|
|
1423
|
+
$type: 'app.bsky.actor.defs#bskyAppStatePref',
|
|
1424
|
+
},
|
|
1425
|
+
])
|
|
1426
|
+
})
|
|
1427
|
+
}
|
|
1428
|
+
|
|
1429
|
+
/**
|
|
1430
|
+
* Removes NUXs from user preferences.
|
|
1431
|
+
*/
|
|
1432
|
+
async bskyAppRemoveNuxs(ids: string[]) {
|
|
1433
|
+
await this.updatePreferences((prefs: AppBskyActorDefs.Preferences) => {
|
|
1434
|
+
let bskyAppStatePref: AppBskyActorDefs.BskyAppStatePref = prefs.findLast(
|
|
1435
|
+
(pref) =>
|
|
1436
|
+
AppBskyActorDefs.isBskyAppStatePref(pref) &&
|
|
1437
|
+
AppBskyActorDefs.validateBskyAppStatePref(pref).success,
|
|
1438
|
+
)
|
|
1439
|
+
|
|
1440
|
+
bskyAppStatePref = bskyAppStatePref || {}
|
|
1441
|
+
bskyAppStatePref.nuxs = (bskyAppStatePref.nuxs || []).filter((nux) => {
|
|
1442
|
+
return !ids.includes(nux.id)
|
|
1443
|
+
})
|
|
1444
|
+
|
|
1445
|
+
return prefs
|
|
1446
|
+
.filter((p) => !AppBskyActorDefs.isBskyAppStatePref(p))
|
|
1447
|
+
.concat([
|
|
1448
|
+
{
|
|
1449
|
+
...bskyAppStatePref,
|
|
1450
|
+
$type: 'app.bsky.actor.defs#bskyAppStatePref',
|
|
1451
|
+
},
|
|
1452
|
+
])
|
|
1453
|
+
})
|
|
1454
|
+
}
|
|
1455
|
+
|
|
1377
1456
|
//- Private methods
|
|
1378
1457
|
|
|
1379
1458
|
#prefsLock = new AwaitLock()
|
package/src/client/lexicons.ts
CHANGED
|
@@ -4190,6 +4190,10 @@ export const schemaDict = {
|
|
|
4190
4190
|
ref: 'lex:com.atproto.label.defs#label',
|
|
4191
4191
|
},
|
|
4192
4192
|
},
|
|
4193
|
+
pinnedPost: {
|
|
4194
|
+
type: 'ref',
|
|
4195
|
+
ref: 'lex:com.atproto.repo.strongRef',
|
|
4196
|
+
},
|
|
4193
4197
|
},
|
|
4194
4198
|
},
|
|
4195
4199
|
profileAssociated: {
|
|
@@ -4572,6 +4576,15 @@ export const schemaDict = {
|
|
|
4572
4576
|
maxLength: 100,
|
|
4573
4577
|
},
|
|
4574
4578
|
},
|
|
4579
|
+
nuxs: {
|
|
4580
|
+
description: 'Storage for NUXs the user has encountered.',
|
|
4581
|
+
type: 'array',
|
|
4582
|
+
maxLength: 100,
|
|
4583
|
+
items: {
|
|
4584
|
+
type: 'ref',
|
|
4585
|
+
ref: 'lex:app.bsky.actor.defs#nux',
|
|
4586
|
+
},
|
|
4587
|
+
},
|
|
4575
4588
|
},
|
|
4576
4589
|
},
|
|
4577
4590
|
bskyAppProgressGuide: {
|
|
@@ -4586,6 +4599,34 @@ export const schemaDict = {
|
|
|
4586
4599
|
},
|
|
4587
4600
|
},
|
|
4588
4601
|
},
|
|
4602
|
+
nux: {
|
|
4603
|
+
type: 'object',
|
|
4604
|
+
description: 'A new user experiences (NUX) storage object',
|
|
4605
|
+
required: ['id', 'completed'],
|
|
4606
|
+
properties: {
|
|
4607
|
+
id: {
|
|
4608
|
+
type: 'string',
|
|
4609
|
+
maxLength: 100,
|
|
4610
|
+
},
|
|
4611
|
+
completed: {
|
|
4612
|
+
type: 'boolean',
|
|
4613
|
+
default: false,
|
|
4614
|
+
},
|
|
4615
|
+
data: {
|
|
4616
|
+
description:
|
|
4617
|
+
'Arbitrary data for the NUX. The structure is defined by the NUX itself. Limited to 300 characters.',
|
|
4618
|
+
type: 'string',
|
|
4619
|
+
maxLength: 3000,
|
|
4620
|
+
maxGraphemes: 300,
|
|
4621
|
+
},
|
|
4622
|
+
expiresAt: {
|
|
4623
|
+
type: 'string',
|
|
4624
|
+
format: 'datetime',
|
|
4625
|
+
description:
|
|
4626
|
+
'The date and time at which the NUX will expire and should be considered completed.',
|
|
4627
|
+
},
|
|
4628
|
+
},
|
|
4629
|
+
},
|
|
4589
4630
|
},
|
|
4590
4631
|
},
|
|
4591
4632
|
AppBskyActorGetPreferences: {
|
|
@@ -4775,6 +4816,10 @@ export const schemaDict = {
|
|
|
4775
4816
|
type: 'ref',
|
|
4776
4817
|
ref: 'lex:com.atproto.repo.strongRef',
|
|
4777
4818
|
},
|
|
4819
|
+
pinnedPost: {
|
|
4820
|
+
type: 'ref',
|
|
4821
|
+
ref: 'lex:com.atproto.repo.strongRef',
|
|
4822
|
+
},
|
|
4778
4823
|
createdAt: {
|
|
4779
4824
|
type: 'string',
|
|
4780
4825
|
format: 'datetime',
|
|
@@ -5431,6 +5476,9 @@ export const schemaDict = {
|
|
|
5431
5476
|
embeddingDisabled: {
|
|
5432
5477
|
type: 'boolean',
|
|
5433
5478
|
},
|
|
5479
|
+
pinned: {
|
|
5480
|
+
type: 'boolean',
|
|
5481
|
+
},
|
|
5434
5482
|
},
|
|
5435
5483
|
},
|
|
5436
5484
|
feedViewPost: {
|
|
@@ -5447,7 +5495,10 @@ export const schemaDict = {
|
|
|
5447
5495
|
},
|
|
5448
5496
|
reason: {
|
|
5449
5497
|
type: 'union',
|
|
5450
|
-
refs: [
|
|
5498
|
+
refs: [
|
|
5499
|
+
'lex:app.bsky.feed.defs#reasonRepost',
|
|
5500
|
+
'lex:app.bsky.feed.defs#reasonPin',
|
|
5501
|
+
],
|
|
5451
5502
|
},
|
|
5452
5503
|
feedContext: {
|
|
5453
5504
|
type: 'string',
|
|
@@ -5499,6 +5550,10 @@ export const schemaDict = {
|
|
|
5499
5550
|
},
|
|
5500
5551
|
},
|
|
5501
5552
|
},
|
|
5553
|
+
reasonPin: {
|
|
5554
|
+
type: 'object',
|
|
5555
|
+
properties: {},
|
|
5556
|
+
},
|
|
5502
5557
|
threadViewPost: {
|
|
5503
5558
|
type: 'object',
|
|
5504
5559
|
required: ['post'],
|
|
@@ -5656,7 +5711,10 @@ export const schemaDict = {
|
|
|
5656
5711
|
},
|
|
5657
5712
|
reason: {
|
|
5658
5713
|
type: 'union',
|
|
5659
|
-
refs: [
|
|
5714
|
+
refs: [
|
|
5715
|
+
'lex:app.bsky.feed.defs#skeletonReasonRepost',
|
|
5716
|
+
'lex:app.bsky.feed.defs#skeletonReasonPin',
|
|
5717
|
+
],
|
|
5660
5718
|
},
|
|
5661
5719
|
feedContext: {
|
|
5662
5720
|
type: 'string',
|
|
@@ -5676,6 +5734,10 @@ export const schemaDict = {
|
|
|
5676
5734
|
},
|
|
5677
5735
|
},
|
|
5678
5736
|
},
|
|
5737
|
+
skeletonReasonPin: {
|
|
5738
|
+
type: 'object',
|
|
5739
|
+
properties: {},
|
|
5740
|
+
},
|
|
5679
5741
|
threadgateView: {
|
|
5680
5742
|
type: 'object',
|
|
5681
5743
|
properties: {
|
|
@@ -6041,6 +6103,10 @@ export const schemaDict = {
|
|
|
6041
6103
|
],
|
|
6042
6104
|
default: 'posts_with_replies',
|
|
6043
6105
|
},
|
|
6106
|
+
includePins: {
|
|
6107
|
+
type: 'boolean',
|
|
6108
|
+
default: false,
|
|
6109
|
+
},
|
|
6044
6110
|
},
|
|
6045
6111
|
},
|
|
6046
6112
|
output: {
|
|
@@ -7125,7 +7191,7 @@ export const schemaDict = {
|
|
|
7125
7191
|
type: 'record',
|
|
7126
7192
|
key: 'tid',
|
|
7127
7193
|
description:
|
|
7128
|
-
"Record defining interaction gating rules for a thread (aka, reply controls). The record key (rkey) of the threadgate record must match the record key of the thread's root post, and that record must be in the same repository
|
|
7194
|
+
"Record defining interaction gating rules for a thread (aka, reply controls). The record key (rkey) of the threadgate record must match the record key of the thread's root post, and that record must be in the same repository.",
|
|
7129
7195
|
record: {
|
|
7130
7196
|
type: 'object',
|
|
7131
7197
|
required: ['post', 'createdAt'],
|
|
@@ -8199,6 +8265,12 @@ export const schemaDict = {
|
|
|
8199
8265
|
ref: 'lex:app.bsky.actor.defs#profileView',
|
|
8200
8266
|
},
|
|
8201
8267
|
},
|
|
8268
|
+
isFallback: {
|
|
8269
|
+
type: 'boolean',
|
|
8270
|
+
description:
|
|
8271
|
+
'If true, response has fallen-back to generic results, and is not scoped using relativeToDid',
|
|
8272
|
+
default: false,
|
|
8273
|
+
},
|
|
8202
8274
|
},
|
|
8203
8275
|
},
|
|
8204
8276
|
},
|
|
@@ -9155,6 +9227,12 @@ export const schemaDict = {
|
|
|
9155
9227
|
ref: 'lex:app.bsky.unspecced.defs#skeletonSearchActor',
|
|
9156
9228
|
},
|
|
9157
9229
|
},
|
|
9230
|
+
relativeToDid: {
|
|
9231
|
+
type: 'string',
|
|
9232
|
+
format: 'did',
|
|
9233
|
+
description:
|
|
9234
|
+
'DID of the account these suggestions are relative to. If this is returned undefined, suggestions are based on the viewer.',
|
|
9235
|
+
},
|
|
9158
9236
|
},
|
|
9159
9237
|
},
|
|
9160
9238
|
},
|
|
@@ -10920,6 +10998,11 @@ export const schemaDict = {
|
|
|
10920
10998
|
description:
|
|
10921
10999
|
'Indicates how long the takedown should be in effect before automatically expiring.',
|
|
10922
11000
|
},
|
|
11001
|
+
acknowledgeAccountSubjects: {
|
|
11002
|
+
type: 'boolean',
|
|
11003
|
+
description:
|
|
11004
|
+
'If true, all other reports on content authored by this account will be resolved (acknowledged).',
|
|
11005
|
+
},
|
|
10923
11006
|
},
|
|
10924
11007
|
},
|
|
10925
11008
|
modEventReverseTakedown: {
|
|
@@ -11731,9 +11814,15 @@ export const schemaDict = {
|
|
|
11731
11814
|
parameters: {
|
|
11732
11815
|
type: 'params',
|
|
11733
11816
|
properties: {
|
|
11817
|
+
includeAllUserRecords: {
|
|
11818
|
+
type: 'boolean',
|
|
11819
|
+
description:
|
|
11820
|
+
"All subjects belonging to the account specified in the 'subject' param will be returned.",
|
|
11821
|
+
},
|
|
11734
11822
|
subject: {
|
|
11735
11823
|
type: 'string',
|
|
11736
11824
|
format: 'uri',
|
|
11825
|
+
description: 'The subject to get the status for.',
|
|
11737
11826
|
},
|
|
11738
11827
|
comment: {
|
|
11739
11828
|
type: 'string',
|
|
@@ -7,6 +7,7 @@ import { lexicons } from '../../../../lexicons'
|
|
|
7
7
|
import { CID } from 'multiformats/cid'
|
|
8
8
|
import * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs'
|
|
9
9
|
import * as AppBskyGraphDefs from '../graph/defs'
|
|
10
|
+
import * as ComAtprotoRepoStrongRef from '../../../com/atproto/repo/strongRef'
|
|
10
11
|
|
|
11
12
|
export interface ProfileViewBasic {
|
|
12
13
|
did: string
|
|
@@ -74,6 +75,7 @@ export interface ProfileViewDetailed {
|
|
|
74
75
|
createdAt?: string
|
|
75
76
|
viewer?: ViewerState
|
|
76
77
|
labels?: ComAtprotoLabelDefs.Label[]
|
|
78
|
+
pinnedPost?: ComAtprotoRepoStrongRef.Main
|
|
77
79
|
[k: string]: unknown
|
|
78
80
|
}
|
|
79
81
|
|
|
@@ -469,6 +471,8 @@ export interface BskyAppStatePref {
|
|
|
469
471
|
activeProgressGuide?: BskyAppProgressGuide
|
|
470
472
|
/** An array of tokens which identify nudges (modals, popups, tours, highlight dots) that should be shown to the user. */
|
|
471
473
|
queuedNudges?: string[]
|
|
474
|
+
/** Storage for NUXs the user has encountered. */
|
|
475
|
+
nuxs?: Nux[]
|
|
472
476
|
[k: string]: unknown
|
|
473
477
|
}
|
|
474
478
|
|
|
@@ -501,3 +505,24 @@ export function isBskyAppProgressGuide(v: unknown): v is BskyAppProgressGuide {
|
|
|
501
505
|
export function validateBskyAppProgressGuide(v: unknown): ValidationResult {
|
|
502
506
|
return lexicons.validate('app.bsky.actor.defs#bskyAppProgressGuide', v)
|
|
503
507
|
}
|
|
508
|
+
|
|
509
|
+
/** A new user experiences (NUX) storage object */
|
|
510
|
+
export interface Nux {
|
|
511
|
+
id: string
|
|
512
|
+
completed: boolean
|
|
513
|
+
/** Arbitrary data for the NUX. The structure is defined by the NUX itself. Limited to 300 characters. */
|
|
514
|
+
data?: string
|
|
515
|
+
/** The date and time at which the NUX will expire and should be considered completed. */
|
|
516
|
+
expiresAt?: string
|
|
517
|
+
[k: string]: unknown
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
export function isNux(v: unknown): v is Nux {
|
|
521
|
+
return (
|
|
522
|
+
isObj(v) && hasProp(v, '$type') && v.$type === 'app.bsky.actor.defs#nux'
|
|
523
|
+
)
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
export function validateNux(v: unknown): ValidationResult {
|
|
527
|
+
return lexicons.validate('app.bsky.actor.defs#nux', v)
|
|
528
|
+
}
|
|
@@ -55,6 +55,7 @@ export interface ViewerState {
|
|
|
55
55
|
threadMuted?: boolean
|
|
56
56
|
replyDisabled?: boolean
|
|
57
57
|
embeddingDisabled?: boolean
|
|
58
|
+
pinned?: boolean
|
|
58
59
|
[k: string]: unknown
|
|
59
60
|
}
|
|
60
61
|
|
|
@@ -73,7 +74,7 @@ export function validateViewerState(v: unknown): ValidationResult {
|
|
|
73
74
|
export interface FeedViewPost {
|
|
74
75
|
post: PostView
|
|
75
76
|
reply?: ReplyRef
|
|
76
|
-
reason?: ReasonRepost | { $type: string; [k: string]: unknown }
|
|
77
|
+
reason?: ReasonRepost | ReasonPin | { $type: string; [k: string]: unknown }
|
|
77
78
|
/** Context provided by feed generator that may be passed back alongside interactions. */
|
|
78
79
|
feedContext?: string
|
|
79
80
|
[k: string]: unknown
|
|
@@ -134,6 +135,22 @@ export function validateReasonRepost(v: unknown): ValidationResult {
|
|
|
134
135
|
return lexicons.validate('app.bsky.feed.defs#reasonRepost', v)
|
|
135
136
|
}
|
|
136
137
|
|
|
138
|
+
export interface ReasonPin {
|
|
139
|
+
[k: string]: unknown
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export function isReasonPin(v: unknown): v is ReasonPin {
|
|
143
|
+
return (
|
|
144
|
+
isObj(v) &&
|
|
145
|
+
hasProp(v, '$type') &&
|
|
146
|
+
v.$type === 'app.bsky.feed.defs#reasonPin'
|
|
147
|
+
)
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export function validateReasonPin(v: unknown): ValidationResult {
|
|
151
|
+
return lexicons.validate('app.bsky.feed.defs#reasonPin', v)
|
|
152
|
+
}
|
|
153
|
+
|
|
137
154
|
export interface ThreadViewPost {
|
|
138
155
|
post: PostView
|
|
139
156
|
parent?:
|
|
@@ -265,7 +282,10 @@ export function validateGeneratorViewerState(v: unknown): ValidationResult {
|
|
|
265
282
|
|
|
266
283
|
export interface SkeletonFeedPost {
|
|
267
284
|
post: string
|
|
268
|
-
reason?:
|
|
285
|
+
reason?:
|
|
286
|
+
| SkeletonReasonRepost
|
|
287
|
+
| SkeletonReasonPin
|
|
288
|
+
| { $type: string; [k: string]: unknown }
|
|
269
289
|
/** Context that will be passed through to client and may be passed to feed generator back alongside interactions. */
|
|
270
290
|
feedContext?: string
|
|
271
291
|
[k: string]: unknown
|
|
@@ -300,6 +320,22 @@ export function validateSkeletonReasonRepost(v: unknown): ValidationResult {
|
|
|
300
320
|
return lexicons.validate('app.bsky.feed.defs#skeletonReasonRepost', v)
|
|
301
321
|
}
|
|
302
322
|
|
|
323
|
+
export interface SkeletonReasonPin {
|
|
324
|
+
[k: string]: unknown
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
export function isSkeletonReasonPin(v: unknown): v is SkeletonReasonPin {
|
|
328
|
+
return (
|
|
329
|
+
isObj(v) &&
|
|
330
|
+
hasProp(v, '$type') &&
|
|
331
|
+
v.$type === 'app.bsky.feed.defs#skeletonReasonPin'
|
|
332
|
+
)
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
export function validateSkeletonReasonPin(v: unknown): ValidationResult {
|
|
336
|
+
return lexicons.validate('app.bsky.feed.defs#skeletonReasonPin', v)
|
|
337
|
+
}
|
|
338
|
+
|
|
303
339
|
export interface ThreadgateView {
|
|
304
340
|
uri?: string
|
|
305
341
|
cid?: string
|
|
@@ -16,6 +16,8 @@ export type InputSchema = undefined
|
|
|
16
16
|
|
|
17
17
|
export interface OutputSchema {
|
|
18
18
|
suggestions: AppBskyActorDefs.ProfileView[]
|
|
19
|
+
/** If true, response has fallen-back to generic results, and is not scoped using relativeToDid */
|
|
20
|
+
isFallback: boolean
|
|
19
21
|
[k: string]: unknown
|
|
20
22
|
}
|
|
21
23
|
|
|
@@ -22,6 +22,8 @@ export type InputSchema = undefined
|
|
|
22
22
|
export interface OutputSchema {
|
|
23
23
|
cursor?: string
|
|
24
24
|
actors: AppBskyUnspeccedDefs.SkeletonSearchActor[]
|
|
25
|
+
/** DID of the account these suggestions are relative to. If this is returned undefined, suggestions are based on the viewer. */
|
|
26
|
+
relativeToDid?: string
|
|
25
27
|
[k: string]: unknown
|
|
26
28
|
}
|
|
27
29
|
|
|
@@ -162,6 +162,8 @@ export interface ModEventTakedown {
|
|
|
162
162
|
comment?: string
|
|
163
163
|
/** Indicates how long the takedown should be in effect before automatically expiring. */
|
|
164
164
|
durationInHours?: number
|
|
165
|
+
/** If true, all other reports on content authored by this account will be resolved (acknowledged). */
|
|
166
|
+
acknowledgeAccountSubjects?: boolean
|
|
165
167
|
[k: string]: unknown
|
|
166
168
|
}
|
|
167
169
|
|
|
@@ -9,6 +9,9 @@ import { CID } from 'multiformats/cid'
|
|
|
9
9
|
import * as ToolsOzoneModerationDefs from './defs'
|
|
10
10
|
|
|
11
11
|
export interface QueryParams {
|
|
12
|
+
/** All subjects belonging to the account specified in the 'subject' param will be returned. */
|
|
13
|
+
includeAllUserRecords?: boolean
|
|
14
|
+
/** The subject to get the status for. */
|
|
12
15
|
subject?: string
|
|
13
16
|
/** Search subjects by keyword from comments */
|
|
14
17
|
comment?: string
|
package/src/types.ts
CHANGED
package/src/util.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { AtUri } from '@atproto/syntax'
|
|
2
2
|
import { TID } from '@atproto/common-web'
|
|
3
|
+
import zod from 'zod'
|
|
3
4
|
|
|
5
|
+
import { Nux } from './client/types/app/bsky/actor/defs'
|
|
4
6
|
import { AppBskyActorDefs } from './client'
|
|
5
7
|
|
|
6
8
|
export function sanitizeMutedWordValue(value: string) {
|
|
@@ -94,3 +96,16 @@ export const asDid = (value: string): Did => {
|
|
|
94
96
|
if (isDid(value)) return value
|
|
95
97
|
throw new TypeError(`Invalid DID: ${value}`)
|
|
96
98
|
}
|
|
99
|
+
|
|
100
|
+
export const nuxSchema = zod
|
|
101
|
+
.object({
|
|
102
|
+
id: zod.string().max(64),
|
|
103
|
+
completed: zod.boolean(),
|
|
104
|
+
data: zod.string().max(300).optional(),
|
|
105
|
+
expiresAt: zod.string().datetime().optional(),
|
|
106
|
+
})
|
|
107
|
+
.strict()
|
|
108
|
+
|
|
109
|
+
export function validateNux(nux: Nux) {
|
|
110
|
+
nuxSchema.parse(nux)
|
|
111
|
+
}
|