@atproto/api 0.18.14 → 0.18.16
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 +12 -0
- package/dist/agent.d.ts +9 -0
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +35 -0
- package/dist/agent.js.map +1 -1
- package/dist/client/index.d.ts +18 -0
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +49 -8
- package/dist/client/index.js.map +1 -1
- package/dist/client/lexicons.d.ts +744 -2
- package/dist/client/lexicons.d.ts.map +1 -1
- package/dist/client/lexicons.js +384 -0
- package/dist/client/lexicons.js.map +1 -1
- package/dist/client/types/app/bsky/actor/defs.d.ts +11 -1
- package/dist/client/types/app/bsky/actor/defs.d.ts.map +1 -1
- package/dist/client/types/app/bsky/actor/defs.js +9 -0
- package/dist/client/types/app/bsky/actor/defs.js.map +1 -1
- package/dist/client/types/app/bsky/draft/createDraft.d.ts +29 -0
- package/dist/client/types/app/bsky/draft/createDraft.d.ts.map +1 -0
- package/dist/client/types/app/bsky/draft/createDraft.js +26 -0
- package/dist/client/types/app/bsky/draft/createDraft.js.map +1 -0
- package/dist/client/types/app/bsky/draft/defs.d.ts +106 -0
- package/dist/client/types/app/bsky/draft/defs.d.ts.map +1 -0
- package/dist/client/types/app/bsky/draft/defs.js +97 -0
- package/dist/client/types/app/bsky/draft/defs.js.map +1 -0
- package/dist/client/types/app/bsky/draft/deleteDraft.d.ts +20 -0
- package/dist/client/types/app/bsky/draft/deleteDraft.d.ts.map +1 -0
- package/dist/client/types/app/bsky/draft/deleteDraft.js +11 -0
- package/dist/client/types/app/bsky/draft/deleteDraft.js.map +1 -0
- package/dist/client/types/app/bsky/draft/getDrafts.d.ts +25 -0
- package/dist/client/types/app/bsky/draft/getDrafts.d.ts.map +1 -0
- package/dist/client/types/app/bsky/draft/getDrafts.js +11 -0
- package/dist/client/types/app/bsky/draft/getDrafts.js.map +1 -0
- package/dist/client/types/app/bsky/draft/updateDraft.d.ts +21 -0
- package/dist/client/types/app/bsky/draft/updateDraft.d.ts.map +1 -0
- package/dist/client/types/app/bsky/draft/updateDraft.js +11 -0
- package/dist/client/types/app/bsky/draft/updateDraft.js.map +1 -0
- package/dist/predicate.d.ts +1 -0
- package/dist/predicate.d.ts.map +1 -1
- package/dist/predicate.js +2 -1
- package/dist/predicate.js.map +1 -1
- package/dist/types.d.ts +4 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +3 -3
- package/src/agent.ts +44 -0
- package/src/client/index.ts +57 -0
- package/src/client/lexicons.ts +394 -0
- package/src/client/types/app/bsky/actor/defs.ts +20 -0
- package/src/client/types/app/bsky/draft/createDraft.ts +55 -0
- package/src/client/types/app/bsky/draft/defs.ts +208 -0
- package/src/client/types/app/bsky/draft/deleteDraft.ts +38 -0
- package/src/client/types/app/bsky/draft/getDrafts.ts +43 -0
- package/src/client/types/app/bsky/draft/updateDraft.ts +39 -0
- package/src/predicate.ts +3 -0
- package/src/types.ts +4 -0
- package/tests/atp-agent.test.ts +180 -0
- package/tests/moderation-prefs.test.ts +16 -0
- package/tsconfig.build.tsbuildinfo +1 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
+
*/
|
|
4
|
+
import { HeadersMap } from '@atproto/xrpc';
|
|
5
|
+
import type * as AppBskyDraftDefs from './defs.js';
|
|
6
|
+
export type QueryParams = {
|
|
7
|
+
limit?: number;
|
|
8
|
+
cursor?: string;
|
|
9
|
+
};
|
|
10
|
+
export type InputSchema = undefined;
|
|
11
|
+
export interface OutputSchema {
|
|
12
|
+
cursor?: string;
|
|
13
|
+
drafts: AppBskyDraftDefs.DraftView[];
|
|
14
|
+
}
|
|
15
|
+
export interface CallOptions {
|
|
16
|
+
signal?: AbortSignal;
|
|
17
|
+
headers?: HeadersMap;
|
|
18
|
+
}
|
|
19
|
+
export interface Response {
|
|
20
|
+
success: boolean;
|
|
21
|
+
headers: HeadersMap;
|
|
22
|
+
data: OutputSchema;
|
|
23
|
+
}
|
|
24
|
+
export declare function toKnownErr(e: any): any;
|
|
25
|
+
//# sourceMappingURL=getDrafts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getDrafts.d.ts","sourceRoot":"","sources":["../../../../../../src/client/types/app/bsky/draft/getDrafts.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,UAAU,EAAa,MAAM,eAAe,CAAA;AASrD,OAAO,KAAK,KAAK,gBAAgB,MAAM,WAAW,CAAA;AAMlD,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AACD,MAAM,MAAM,WAAW,GAAG,SAAS,CAAA;AAEnC,MAAM,WAAW,YAAY;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,gBAAgB,CAAC,SAAS,EAAE,CAAA;CACrC;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB,OAAO,CAAC,EAAE,UAAU,CAAA;CACrB;AAED,MAAM,WAAW,QAAQ;IACvB,OAAO,EAAE,OAAO,CAAA;IAChB,OAAO,EAAE,UAAU,CAAA;IACnB,IAAI,EAAE,YAAY,CAAA;CACnB;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,GAAG,OAEhC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toKnownErr = toKnownErr;
|
|
4
|
+
const lexicons_1 = require("../../../../lexicons");
|
|
5
|
+
const util_1 = require("../../../../util");
|
|
6
|
+
const is$typed = util_1.is$typed, validate = lexicons_1.validate;
|
|
7
|
+
const id = 'app.bsky.draft.getDrafts';
|
|
8
|
+
function toKnownErr(e) {
|
|
9
|
+
return e;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=getDrafts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getDrafts.js","sourceRoot":"","sources":["../../../../../../src/client/types/app/bsky/draft/getDrafts.ts"],"names":[],"mappings":";;AAwCA,gCAEC;AApCD,mDAA4D;AAC5D,2CAIyB;AAGzB,MAAM,QAAQ,GAAG,eAAS,EACxB,QAAQ,GAAG,mBAAS,CAAA;AACtB,MAAM,EAAE,GAAG,0BAA0B,CAAA;AAwBrC,SAAgB,UAAU,CAAC,CAAM;IAC/B,OAAO,CAAC,CAAA;AACV,CAAC","sourcesContent":["/**\n * GENERATED CODE - DO NOT MODIFY\n */\nimport { HeadersMap, XRPCError } from '@atproto/xrpc'\nimport { type ValidationResult, BlobRef } from '@atproto/lexicon'\nimport { CID } from 'multiformats/cid'\nimport { validate as _validate } from '../../../../lexicons'\nimport {\n type $Typed,\n is$typed as _is$typed,\n type OmitKey,\n} from '../../../../util'\nimport type * as AppBskyDraftDefs from './defs.js'\n\nconst is$typed = _is$typed,\n validate = _validate\nconst id = 'app.bsky.draft.getDrafts'\n\nexport type QueryParams = {\n limit?: number\n cursor?: string\n}\nexport type InputSchema = undefined\n\nexport interface OutputSchema {\n cursor?: string\n drafts: AppBskyDraftDefs.DraftView[]\n}\n\nexport interface CallOptions {\n signal?: AbortSignal\n headers?: HeadersMap\n}\n\nexport interface Response {\n success: boolean\n headers: HeadersMap\n data: OutputSchema\n}\n\nexport function toKnownErr(e: any) {\n return e\n}\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
+
*/
|
|
4
|
+
import { HeadersMap } from '@atproto/xrpc';
|
|
5
|
+
import type * as AppBskyDraftDefs from './defs.js';
|
|
6
|
+
export type QueryParams = {};
|
|
7
|
+
export interface InputSchema {
|
|
8
|
+
draft: AppBskyDraftDefs.DraftWithId;
|
|
9
|
+
}
|
|
10
|
+
export interface CallOptions {
|
|
11
|
+
signal?: AbortSignal;
|
|
12
|
+
headers?: HeadersMap;
|
|
13
|
+
qp?: QueryParams;
|
|
14
|
+
encoding?: 'application/json';
|
|
15
|
+
}
|
|
16
|
+
export interface Response {
|
|
17
|
+
success: boolean;
|
|
18
|
+
headers: HeadersMap;
|
|
19
|
+
}
|
|
20
|
+
export declare function toKnownErr(e: any): any;
|
|
21
|
+
//# sourceMappingURL=updateDraft.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updateDraft.d.ts","sourceRoot":"","sources":["../../../../../../src/client/types/app/bsky/draft/updateDraft.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,UAAU,EAAa,MAAM,eAAe,CAAA;AASrD,OAAO,KAAK,KAAK,gBAAgB,MAAM,WAAW,CAAA;AAMlD,MAAM,MAAM,WAAW,GAAG,EAAE,CAAA;AAE5B,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,gBAAgB,CAAC,WAAW,CAAA;CACpC;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB,OAAO,CAAC,EAAE,UAAU,CAAA;IACpB,EAAE,CAAC,EAAE,WAAW,CAAA;IAChB,QAAQ,CAAC,EAAE,kBAAkB,CAAA;CAC9B;AAED,MAAM,WAAW,QAAQ;IACvB,OAAO,EAAE,OAAO,CAAA;IAChB,OAAO,EAAE,UAAU,CAAA;CACpB;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,GAAG,OAEhC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toKnownErr = toKnownErr;
|
|
4
|
+
const lexicons_1 = require("../../../../lexicons");
|
|
5
|
+
const util_1 = require("../../../../util");
|
|
6
|
+
const is$typed = util_1.is$typed, validate = lexicons_1.validate;
|
|
7
|
+
const id = 'app.bsky.draft.updateDraft';
|
|
8
|
+
function toKnownErr(e) {
|
|
9
|
+
return e;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=updateDraft.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updateDraft.js","sourceRoot":"","sources":["../../../../../../src/client/types/app/bsky/draft/updateDraft.ts"],"names":[],"mappings":";;AAoCA,gCAEC;AAhCD,mDAA4D;AAC5D,2CAIyB;AAGzB,MAAM,QAAQ,GAAG,eAAS,EACxB,QAAQ,GAAG,mBAAS,CAAA;AACtB,MAAM,EAAE,GAAG,4BAA4B,CAAA;AAoBvC,SAAgB,UAAU,CAAC,CAAM;IAC/B,OAAO,CAAC,CAAA;AACV,CAAC","sourcesContent":["/**\n * GENERATED CODE - DO NOT MODIFY\n */\nimport { HeadersMap, XRPCError } from '@atproto/xrpc'\nimport { type ValidationResult, BlobRef } from '@atproto/lexicon'\nimport { CID } from 'multiformats/cid'\nimport { validate as _validate } from '../../../../lexicons'\nimport {\n type $Typed,\n is$typed as _is$typed,\n type OmitKey,\n} from '../../../../util'\nimport type * as AppBskyDraftDefs from './defs.js'\n\nconst is$typed = _is$typed,\n validate = _validate\nconst id = 'app.bsky.draft.updateDraft'\n\nexport type QueryParams = {}\n\nexport interface InputSchema {\n draft: AppBskyDraftDefs.DraftWithId\n}\n\nexport interface CallOptions {\n signal?: AbortSignal\n headers?: HeadersMap\n qp?: QueryParams\n encoding?: 'application/json'\n}\n\nexport interface Response {\n success: boolean\n headers: HeadersMap\n}\n\nexport function toKnownErr(e: any) {\n return e\n}\n"]}
|
package/dist/predicate.d.ts
CHANGED
|
@@ -15,4 +15,5 @@ export declare const isValidSavedFeedsPref: <T>(v: T) => v is T & AppBskyActorDe
|
|
|
15
15
|
export declare const isValidSavedFeedsPrefV2: <T>(v: T) => v is T & AppBskyActorDefs.SavedFeedsPrefV2;
|
|
16
16
|
export declare const isValidThreadViewPref: <T>(v: T) => v is T & AppBskyActorDefs.ThreadViewPref;
|
|
17
17
|
export declare const isValidVerificationPrefs: <T>(v: T) => v is T & AppBskyActorDefs.VerificationPrefs;
|
|
18
|
+
export declare const isValidLiveEventPreferences: <T>(v: T) => v is T & AppBskyActorDefs.LiveEventPreferences;
|
|
18
19
|
//# sourceMappingURL=predicate.d.ts.map
|
package/dist/predicate.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"predicate.d.ts","sourceRoot":"","sources":["../src/predicate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAGtE,eAAO,MAAM,cAAc,gDAAkD,CAAA;AAC7E,eAAO,MAAM,uBAAuB,yDAEnC,CAAA;AACD,eAAO,MAAM,uBAAuB,yDAEnC,CAAA;AACD,eAAO,MAAM,uBAAuB,yDAEnC,CAAA;AACD,eAAO,MAAM,mBAAmB,qDAE/B,CAAA;AACD,eAAO,MAAM,sBAAsB,wDAElC,CAAA;AACD,eAAO,MAAM,oBAAoB,sDAEhC,CAAA;AACD,eAAO,MAAM,mBAAmB,qDAE/B,CAAA;AACD,eAAO,MAAM,qBAAqB,uDAEjC,CAAA;AACD,eAAO,MAAM,0BAA0B,4DAEtC,CAAA;AACD,eAAO,MAAM,sBAAsB,wDAElC,CAAA;AACD,eAAO,MAAM,kCAAkC,oEAE9C,CAAA;AACD,eAAO,MAAM,qBAAqB,uDAEjC,CAAA;AACD,eAAO,MAAM,uBAAuB,yDAEnC,CAAA;AACD,eAAO,MAAM,qBAAqB,uDAEjC,CAAA;AACD,eAAO,MAAM,wBAAwB,0DAEpC,CAAA"}
|
|
1
|
+
{"version":3,"file":"predicate.d.ts","sourceRoot":"","sources":["../src/predicate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAGtE,eAAO,MAAM,cAAc,gDAAkD,CAAA;AAC7E,eAAO,MAAM,uBAAuB,yDAEnC,CAAA;AACD,eAAO,MAAM,uBAAuB,yDAEnC,CAAA;AACD,eAAO,MAAM,uBAAuB,yDAEnC,CAAA;AACD,eAAO,MAAM,mBAAmB,qDAE/B,CAAA;AACD,eAAO,MAAM,sBAAsB,wDAElC,CAAA;AACD,eAAO,MAAM,oBAAoB,sDAEhC,CAAA;AACD,eAAO,MAAM,mBAAmB,qDAE/B,CAAA;AACD,eAAO,MAAM,qBAAqB,uDAEjC,CAAA;AACD,eAAO,MAAM,0BAA0B,4DAEtC,CAAA;AACD,eAAO,MAAM,sBAAsB,wDAElC,CAAA;AACD,eAAO,MAAM,kCAAkC,oEAE9C,CAAA;AACD,eAAO,MAAM,qBAAqB,uDAEjC,CAAA;AACD,eAAO,MAAM,uBAAuB,yDAEnC,CAAA;AACD,eAAO,MAAM,qBAAqB,uDAEjC,CAAA;AACD,eAAO,MAAM,wBAAwB,0DAEpC,CAAA;AACD,eAAO,MAAM,2BAA2B,6DAEvC,CAAA"}
|
package/dist/predicate.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isValidVerificationPrefs = exports.isValidThreadViewPref = exports.isValidSavedFeedsPrefV2 = exports.isValidSavedFeedsPref = exports.isValidPostInteractionSettingsPref = exports.isValidDeclaredAgePref = exports.isValidPersonalDetailsPref = exports.isValidMutedWordsPref = exports.isValidLabelersPref = exports.isValidInterestsPref = exports.isValidHiddenPostsPref = exports.isValidFeedViewPref = exports.isValidContentLabelPref = exports.isValidBskyAppStatePref = exports.isValidAdultContentPref = exports.isValidProfile = void 0;
|
|
3
|
+
exports.isValidLiveEventPreferences = exports.isValidVerificationPrefs = exports.isValidThreadViewPref = exports.isValidSavedFeedsPrefV2 = exports.isValidSavedFeedsPref = exports.isValidPostInteractionSettingsPref = exports.isValidDeclaredAgePref = exports.isValidPersonalDetailsPref = exports.isValidMutedWordsPref = exports.isValidLabelersPref = exports.isValidInterestsPref = exports.isValidHiddenPostsPref = exports.isValidFeedViewPref = exports.isValidContentLabelPref = exports.isValidBskyAppStatePref = exports.isValidAdultContentPref = exports.isValidProfile = void 0;
|
|
4
4
|
const index_1 = require("./client/index");
|
|
5
5
|
const util_1 = require("./client/util");
|
|
6
6
|
exports.isValidProfile = (0, util_1.asPredicate)(index_1.AppBskyActorProfile.validateRecord);
|
|
@@ -19,4 +19,5 @@ exports.isValidSavedFeedsPref = (0, util_1.asPredicate)(index_1.AppBskyActorDefs
|
|
|
19
19
|
exports.isValidSavedFeedsPrefV2 = (0, util_1.asPredicate)(index_1.AppBskyActorDefs.validateSavedFeedsPrefV2);
|
|
20
20
|
exports.isValidThreadViewPref = (0, util_1.asPredicate)(index_1.AppBskyActorDefs.validateThreadViewPref);
|
|
21
21
|
exports.isValidVerificationPrefs = (0, util_1.asPredicate)(index_1.AppBskyActorDefs.validateVerificationPrefs);
|
|
22
|
+
exports.isValidLiveEventPreferences = (0, util_1.asPredicate)(index_1.AppBskyActorDefs.validateLiveEventPreferences);
|
|
22
23
|
//# sourceMappingURL=predicate.js.map
|
package/dist/predicate.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"predicate.js","sourceRoot":"","sources":["../src/predicate.ts"],"names":[],"mappings":";;;AAAA,0CAAsE;AACtE,wCAA2C;AAE9B,QAAA,cAAc,GAAG,IAAA,kBAAW,EAAC,2BAAmB,CAAC,cAAc,CAAC,CAAA;AAChE,QAAA,uBAAuB,GAAG,IAAA,kBAAW,EAChD,wBAAgB,CAAC,wBAAwB,CAC1C,CAAA;AACY,QAAA,uBAAuB,GAAG,IAAA,kBAAW,EAChD,wBAAgB,CAAC,wBAAwB,CAC1C,CAAA;AACY,QAAA,uBAAuB,GAAG,IAAA,kBAAW,EAChD,wBAAgB,CAAC,wBAAwB,CAC1C,CAAA;AACY,QAAA,mBAAmB,GAAG,IAAA,kBAAW,EAC5C,wBAAgB,CAAC,oBAAoB,CACtC,CAAA;AACY,QAAA,sBAAsB,GAAG,IAAA,kBAAW,EAC/C,wBAAgB,CAAC,uBAAuB,CACzC,CAAA;AACY,QAAA,oBAAoB,GAAG,IAAA,kBAAW,EAC7C,wBAAgB,CAAC,qBAAqB,CACvC,CAAA;AACY,QAAA,mBAAmB,GAAG,IAAA,kBAAW,EAC5C,wBAAgB,CAAC,oBAAoB,CACtC,CAAA;AACY,QAAA,qBAAqB,GAAG,IAAA,kBAAW,EAC9C,wBAAgB,CAAC,sBAAsB,CACxC,CAAA;AACY,QAAA,0BAA0B,GAAG,IAAA,kBAAW,EACnD,wBAAgB,CAAC,2BAA2B,CAC7C,CAAA;AACY,QAAA,sBAAsB,GAAG,IAAA,kBAAW,EAC/C,wBAAgB,CAAC,uBAAuB,CACzC,CAAA;AACY,QAAA,kCAAkC,GAAG,IAAA,kBAAW,EAC3D,wBAAgB,CAAC,mCAAmC,CACrD,CAAA;AACY,QAAA,qBAAqB,GAAG,IAAA,kBAAW,EAC9C,wBAAgB,CAAC,sBAAsB,CACxC,CAAA;AACY,QAAA,uBAAuB,GAAG,IAAA,kBAAW,EAChD,wBAAgB,CAAC,wBAAwB,CAC1C,CAAA;AACY,QAAA,qBAAqB,GAAG,IAAA,kBAAW,EAC9C,wBAAgB,CAAC,sBAAsB,CACxC,CAAA;AACY,QAAA,wBAAwB,GAAG,IAAA,kBAAW,EACjD,wBAAgB,CAAC,yBAAyB,CAC3C,CAAA","sourcesContent":["import { AppBskyActorDefs, AppBskyActorProfile } from './client/index'\nimport { asPredicate } from './client/util'\n\nexport const isValidProfile = asPredicate(AppBskyActorProfile.validateRecord)\nexport const isValidAdultContentPref = asPredicate(\n AppBskyActorDefs.validateAdultContentPref,\n)\nexport const isValidBskyAppStatePref = asPredicate(\n AppBskyActorDefs.validateBskyAppStatePref,\n)\nexport const isValidContentLabelPref = asPredicate(\n AppBskyActorDefs.validateContentLabelPref,\n)\nexport const isValidFeedViewPref = asPredicate(\n AppBskyActorDefs.validateFeedViewPref,\n)\nexport const isValidHiddenPostsPref = asPredicate(\n AppBskyActorDefs.validateHiddenPostsPref,\n)\nexport const isValidInterestsPref = asPredicate(\n AppBskyActorDefs.validateInterestsPref,\n)\nexport const isValidLabelersPref = asPredicate(\n AppBskyActorDefs.validateLabelersPref,\n)\nexport const isValidMutedWordsPref = asPredicate(\n AppBskyActorDefs.validateMutedWordsPref,\n)\nexport const isValidPersonalDetailsPref = asPredicate(\n AppBskyActorDefs.validatePersonalDetailsPref,\n)\nexport const isValidDeclaredAgePref = asPredicate(\n AppBskyActorDefs.validateDeclaredAgePref,\n)\nexport const isValidPostInteractionSettingsPref = asPredicate(\n AppBskyActorDefs.validatePostInteractionSettingsPref,\n)\nexport const isValidSavedFeedsPref = asPredicate(\n AppBskyActorDefs.validateSavedFeedsPref,\n)\nexport const isValidSavedFeedsPrefV2 = asPredicate(\n AppBskyActorDefs.validateSavedFeedsPrefV2,\n)\nexport const isValidThreadViewPref = asPredicate(\n AppBskyActorDefs.validateThreadViewPref,\n)\nexport const isValidVerificationPrefs = asPredicate(\n AppBskyActorDefs.validateVerificationPrefs,\n)\n"]}
|
|
1
|
+
{"version":3,"file":"predicate.js","sourceRoot":"","sources":["../src/predicate.ts"],"names":[],"mappings":";;;AAAA,0CAAsE;AACtE,wCAA2C;AAE9B,QAAA,cAAc,GAAG,IAAA,kBAAW,EAAC,2BAAmB,CAAC,cAAc,CAAC,CAAA;AAChE,QAAA,uBAAuB,GAAG,IAAA,kBAAW,EAChD,wBAAgB,CAAC,wBAAwB,CAC1C,CAAA;AACY,QAAA,uBAAuB,GAAG,IAAA,kBAAW,EAChD,wBAAgB,CAAC,wBAAwB,CAC1C,CAAA;AACY,QAAA,uBAAuB,GAAG,IAAA,kBAAW,EAChD,wBAAgB,CAAC,wBAAwB,CAC1C,CAAA;AACY,QAAA,mBAAmB,GAAG,IAAA,kBAAW,EAC5C,wBAAgB,CAAC,oBAAoB,CACtC,CAAA;AACY,QAAA,sBAAsB,GAAG,IAAA,kBAAW,EAC/C,wBAAgB,CAAC,uBAAuB,CACzC,CAAA;AACY,QAAA,oBAAoB,GAAG,IAAA,kBAAW,EAC7C,wBAAgB,CAAC,qBAAqB,CACvC,CAAA;AACY,QAAA,mBAAmB,GAAG,IAAA,kBAAW,EAC5C,wBAAgB,CAAC,oBAAoB,CACtC,CAAA;AACY,QAAA,qBAAqB,GAAG,IAAA,kBAAW,EAC9C,wBAAgB,CAAC,sBAAsB,CACxC,CAAA;AACY,QAAA,0BAA0B,GAAG,IAAA,kBAAW,EACnD,wBAAgB,CAAC,2BAA2B,CAC7C,CAAA;AACY,QAAA,sBAAsB,GAAG,IAAA,kBAAW,EAC/C,wBAAgB,CAAC,uBAAuB,CACzC,CAAA;AACY,QAAA,kCAAkC,GAAG,IAAA,kBAAW,EAC3D,wBAAgB,CAAC,mCAAmC,CACrD,CAAA;AACY,QAAA,qBAAqB,GAAG,IAAA,kBAAW,EAC9C,wBAAgB,CAAC,sBAAsB,CACxC,CAAA;AACY,QAAA,uBAAuB,GAAG,IAAA,kBAAW,EAChD,wBAAgB,CAAC,wBAAwB,CAC1C,CAAA;AACY,QAAA,qBAAqB,GAAG,IAAA,kBAAW,EAC9C,wBAAgB,CAAC,sBAAsB,CACxC,CAAA;AACY,QAAA,wBAAwB,GAAG,IAAA,kBAAW,EACjD,wBAAgB,CAAC,yBAAyB,CAC3C,CAAA;AACY,QAAA,2BAA2B,GAAG,IAAA,kBAAW,EACpD,wBAAgB,CAAC,4BAA4B,CAC9C,CAAA","sourcesContent":["import { AppBskyActorDefs, AppBskyActorProfile } from './client/index'\nimport { asPredicate } from './client/util'\n\nexport const isValidProfile = asPredicate(AppBskyActorProfile.validateRecord)\nexport const isValidAdultContentPref = asPredicate(\n AppBskyActorDefs.validateAdultContentPref,\n)\nexport const isValidBskyAppStatePref = asPredicate(\n AppBskyActorDefs.validateBskyAppStatePref,\n)\nexport const isValidContentLabelPref = asPredicate(\n AppBskyActorDefs.validateContentLabelPref,\n)\nexport const isValidFeedViewPref = asPredicate(\n AppBskyActorDefs.validateFeedViewPref,\n)\nexport const isValidHiddenPostsPref = asPredicate(\n AppBskyActorDefs.validateHiddenPostsPref,\n)\nexport const isValidInterestsPref = asPredicate(\n AppBskyActorDefs.validateInterestsPref,\n)\nexport const isValidLabelersPref = asPredicate(\n AppBskyActorDefs.validateLabelersPref,\n)\nexport const isValidMutedWordsPref = asPredicate(\n AppBskyActorDefs.validateMutedWordsPref,\n)\nexport const isValidPersonalDetailsPref = asPredicate(\n AppBskyActorDefs.validatePersonalDetailsPref,\n)\nexport const isValidDeclaredAgePref = asPredicate(\n AppBskyActorDefs.validateDeclaredAgePref,\n)\nexport const isValidPostInteractionSettingsPref = asPredicate(\n AppBskyActorDefs.validatePostInteractionSettingsPref,\n)\nexport const isValidSavedFeedsPref = asPredicate(\n AppBskyActorDefs.validateSavedFeedsPref,\n)\nexport const isValidSavedFeedsPrefV2 = asPredicate(\n AppBskyActorDefs.validateSavedFeedsPrefV2,\n)\nexport const isValidThreadViewPref = asPredicate(\n AppBskyActorDefs.validateThreadViewPref,\n)\nexport const isValidVerificationPrefs = asPredicate(\n AppBskyActorDefs.validateVerificationPrefs,\n)\nexport const isValidLiveEventPreferences = asPredicate(\n AppBskyActorDefs.validateLiveEventPreferences,\n)\n"]}
|
package/dist/types.d.ts
CHANGED
|
@@ -103,5 +103,9 @@ export interface BskyPreferences {
|
|
|
103
103
|
};
|
|
104
104
|
postInteractionSettings: AppBskyActorDefs.PostInteractionSettingsPref;
|
|
105
105
|
verificationPrefs: AppBskyActorDefs.VerificationPrefs;
|
|
106
|
+
liveEventPreferences: {
|
|
107
|
+
hiddenFeedIds: string[];
|
|
108
|
+
hideAllFeeds: boolean;
|
|
109
|
+
};
|
|
106
110
|
}
|
|
107
111
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":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AC;AAED,SAAgB,KAAK,CAAmB,KAAQ;IAC9C,SAAS,CAAC,KAAK,CAAC,CAAA;IAChB,OAAO,KAAK,CAAA;AACd,CAAC;AAGD,SAAgB,cAAc,CAAC,KAAa;IAC1C,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAC3D,OAAO,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,IAAI,oBAAoB,CAAC,OAAO,CAAC,CAAA;AACpE,CAAC;AAED,SAAgB,kBAAkB,CAChC,KAAa;IAEb,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC;QAC3B,MAAM,IAAI,SAAS,CACjB,0BAA0B,KAAK,kDAAkD,CAClF,CAAA;IACH,CAAC;AACH,CAAC;AAED,SAAgB,cAAc,CAAmB,KAAQ;IACvD,kBAAkB,CAAC,KAAK,CAAC,CAAA;IACzB,OAAO,KAAK,CAAA;AACd,CAAC","sourcesContent":["import { AppBskyActorDefs } from './client'\nimport { ModerationPrefs } from './moderation/types'\n\nexport type UnknownServiceType = string & NonNullable<unknown>\nexport type AtprotoServiceType = 'atproto_labeler' | UnknownServiceType\nexport function isAtprotoServiceType<T extends string>(\n input: T,\n): input is T & AtprotoServiceType {\n return !input.includes(' ') && !input.includes('#')\n}\n\n// @TODO use tools from @atproto/did\nexport type Did = `did:${string}:${string}`\nexport function isDid<T extends string>(input: T): input is T & Did {\n if (!input.startsWith('did:')) return false\n if (input.length < 8) return false\n if (input.length > 2048) return false\n const msidx = input.indexOf(':', 4)\n return msidx > 4 && msidx < input.length - 1\n}\n\nexport function assertDid(input: string): asserts input is Did {\n if (!isDid(input)) throw new TypeError(`Invalid DID: ${input}`)\n}\n\nexport function asDid<T extends string>(input: T) {\n assertDid(input)\n return input\n}\n\nexport type AtprotoProxy = `${Did}#${AtprotoServiceType}`\nexport function isAtprotoProxy(input: string): input is AtprotoProxy {\n const { length, [0]: did, [1]: service } = input.split('#')\n return length === 2 && isDid(did) && isAtprotoServiceType(service)\n}\n\nexport function assertAtprotoProxy(\n input: string,\n): asserts input is AtprotoProxy {\n if (!isAtprotoProxy(input)) {\n throw new TypeError(\n `Invalid DID reference: ${input} (must be of the form did:example:alice#service)`,\n )\n }\n}\n\nexport function asAtprotoProxy<T extends string>(input: T) {\n assertAtprotoProxy(input)\n return input\n}\n\n/**\n * Used by the PersistSessionHandler to indicate what change occurred\n */\nexport type AtpSessionEvent =\n | 'create'\n | 'create-failed'\n | 'update'\n | 'expired'\n | 'network-error'\n\n/**\n * Used by AtpAgent to store active sessions\n */\nexport interface AtpSessionData {\n refreshJwt: string\n accessJwt: string\n handle: string\n did: string\n email?: string\n emailConfirmed?: boolean\n emailAuthFactor?: boolean\n active: boolean\n status?: string\n}\n\n/**\n * Handler signature passed to AtpAgent to store session data\n */\nexport type AtpPersistSessionHandler = (\n evt: AtpSessionEvent,\n session: AtpSessionData | undefined,\n) => void | Promise<void>\n\n/**\n * AtpAgent login() opts\n */\nexport interface AtpAgentLoginOpts {\n identifier: string\n password: string\n authFactorToken?: string | undefined\n allowTakendown?: boolean\n}\n\n/**\n * AtpAgent global config opts\n */\nexport interface AtpAgentGlobalOpts {\n appLabelers?: string[]\n}\n\n/**\n * Bluesky feed view preferences\n */\n\nexport interface BskyFeedViewPreference {\n hideReplies: boolean\n hideRepliesByUnfollowed: boolean\n hideRepliesByLikeCount: number\n hideReposts: boolean\n hideQuotePosts: boolean\n [key: string]: any\n}\n\n/**\n * Bluesky thread view preferences\n */\nexport interface BskyThreadViewPreference {\n sort: string\n [key: string]: any\n}\n\n/**\n * Bluesky interests preferences\n */\nexport interface BskyInterestsPreference {\n tags: string[]\n [key: string]: any\n}\n\n/**\n * Bluesky preferences\n */\nexport interface BskyPreferences {\n /**\n * @deprecated use `savedFeeds`\n */\n feeds: {\n saved?: string[]\n pinned?: string[]\n }\n savedFeeds: AppBskyActorDefs.SavedFeed[]\n feedViewPrefs: Record<string, BskyFeedViewPreference>\n threadViewPrefs: BskyThreadViewPreference\n moderationPrefs: ModerationPrefs\n birthDate: Date | undefined\n /**\n * Read-only preference containing value(s) inferred from the user's declared\n * birthdate. Absence of this preference object in the response indicates\n * that the user has not made a declaration.\n */\n declaredAge?: AppBskyActorDefs.DeclaredAgePref\n interests: BskyInterestsPreference\n bskyAppState: {\n queuedNudges: string[]\n activeProgressGuide: AppBskyActorDefs.BskyAppProgressGuide | undefined\n nuxs: AppBskyActorDefs.Nux[]\n }\n postInteractionSettings: AppBskyActorDefs.PostInteractionSettingsPref\n verificationPrefs: AppBskyActorDefs.VerificationPrefs\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;AAKA,oDAIC;AAID,sBAMC;AAED,8BAEC;AAED,sBAGC;AAGD,wCAGC;AAED,gDAQC;AAED,wCAGC;AA5CD,SAAgB,oBAAoB,CAClC,KAAQ;IAER,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;AACrD,CAAC;AAID,SAAgB,KAAK,CAAmB,KAAQ;IAC9C,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC;QAAE,OAAO,KAAK,CAAA;IAC3C,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,KAAK,CAAA;IAClC,IAAI,KAAK,CAAC,MAAM,GAAG,IAAI;QAAE,OAAO,KAAK,CAAA;IACrC,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAA;IACnC,OAAO,KAAK,GAAG,CAAC,IAAI,KAAK,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,CAAA;AAC9C,CAAC;AAED,SAAgB,SAAS,CAAC,KAAa;IACrC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;QAAE,MAAM,IAAI,SAAS,CAAC,gBAAgB,KAAK,EAAE,CAAC,CAAA;AACjE,CAAC;AAED,SAAgB,KAAK,CAAmB,KAAQ;IAC9C,SAAS,CAAC,KAAK,CAAC,CAAA;IAChB,OAAO,KAAK,CAAA;AACd,CAAC;AAGD,SAAgB,cAAc,CAAC,KAAa;IAC1C,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAC3D,OAAO,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,IAAI,oBAAoB,CAAC,OAAO,CAAC,CAAA;AACpE,CAAC;AAED,SAAgB,kBAAkB,CAChC,KAAa;IAEb,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC;QAC3B,MAAM,IAAI,SAAS,CACjB,0BAA0B,KAAK,kDAAkD,CAClF,CAAA;IACH,CAAC;AACH,CAAC;AAED,SAAgB,cAAc,CAAmB,KAAQ;IACvD,kBAAkB,CAAC,KAAK,CAAC,CAAA;IACzB,OAAO,KAAK,CAAA;AACd,CAAC","sourcesContent":["import { AppBskyActorDefs } from './client'\nimport { ModerationPrefs } from './moderation/types'\n\nexport type UnknownServiceType = string & NonNullable<unknown>\nexport type AtprotoServiceType = 'atproto_labeler' | UnknownServiceType\nexport function isAtprotoServiceType<T extends string>(\n input: T,\n): input is T & AtprotoServiceType {\n return !input.includes(' ') && !input.includes('#')\n}\n\n// @TODO use tools from @atproto/did\nexport type Did = `did:${string}:${string}`\nexport function isDid<T extends string>(input: T): input is T & Did {\n if (!input.startsWith('did:')) return false\n if (input.length < 8) return false\n if (input.length > 2048) return false\n const msidx = input.indexOf(':', 4)\n return msidx > 4 && msidx < input.length - 1\n}\n\nexport function assertDid(input: string): asserts input is Did {\n if (!isDid(input)) throw new TypeError(`Invalid DID: ${input}`)\n}\n\nexport function asDid<T extends string>(input: T) {\n assertDid(input)\n return input\n}\n\nexport type AtprotoProxy = `${Did}#${AtprotoServiceType}`\nexport function isAtprotoProxy(input: string): input is AtprotoProxy {\n const { length, [0]: did, [1]: service } = input.split('#')\n return length === 2 && isDid(did) && isAtprotoServiceType(service)\n}\n\nexport function assertAtprotoProxy(\n input: string,\n): asserts input is AtprotoProxy {\n if (!isAtprotoProxy(input)) {\n throw new TypeError(\n `Invalid DID reference: ${input} (must be of the form did:example:alice#service)`,\n )\n }\n}\n\nexport function asAtprotoProxy<T extends string>(input: T) {\n assertAtprotoProxy(input)\n return input\n}\n\n/**\n * Used by the PersistSessionHandler to indicate what change occurred\n */\nexport type AtpSessionEvent =\n | 'create'\n | 'create-failed'\n | 'update'\n | 'expired'\n | 'network-error'\n\n/**\n * Used by AtpAgent to store active sessions\n */\nexport interface AtpSessionData {\n refreshJwt: string\n accessJwt: string\n handle: string\n did: string\n email?: string\n emailConfirmed?: boolean\n emailAuthFactor?: boolean\n active: boolean\n status?: string\n}\n\n/**\n * Handler signature passed to AtpAgent to store session data\n */\nexport type AtpPersistSessionHandler = (\n evt: AtpSessionEvent,\n session: AtpSessionData | undefined,\n) => void | Promise<void>\n\n/**\n * AtpAgent login() opts\n */\nexport interface AtpAgentLoginOpts {\n identifier: string\n password: string\n authFactorToken?: string | undefined\n allowTakendown?: boolean\n}\n\n/**\n * AtpAgent global config opts\n */\nexport interface AtpAgentGlobalOpts {\n appLabelers?: string[]\n}\n\n/**\n * Bluesky feed view preferences\n */\n\nexport interface BskyFeedViewPreference {\n hideReplies: boolean\n hideRepliesByUnfollowed: boolean\n hideRepliesByLikeCount: number\n hideReposts: boolean\n hideQuotePosts: boolean\n [key: string]: any\n}\n\n/**\n * Bluesky thread view preferences\n */\nexport interface BskyThreadViewPreference {\n sort: string\n [key: string]: any\n}\n\n/**\n * Bluesky interests preferences\n */\nexport interface BskyInterestsPreference {\n tags: string[]\n [key: string]: any\n}\n\n/**\n * Bluesky preferences\n */\nexport interface BskyPreferences {\n /**\n * @deprecated use `savedFeeds`\n */\n feeds: {\n saved?: string[]\n pinned?: string[]\n }\n savedFeeds: AppBskyActorDefs.SavedFeed[]\n feedViewPrefs: Record<string, BskyFeedViewPreference>\n threadViewPrefs: BskyThreadViewPreference\n moderationPrefs: ModerationPrefs\n birthDate: Date | undefined\n /**\n * Read-only preference containing value(s) inferred from the user's declared\n * birthdate. Absence of this preference object in the response indicates\n * that the user has not made a declaration.\n */\n declaredAge?: AppBskyActorDefs.DeclaredAgePref\n interests: BskyInterestsPreference\n bskyAppState: {\n queuedNudges: string[]\n activeProgressGuide: AppBskyActorDefs.BskyAppProgressGuide | undefined\n nuxs: AppBskyActorDefs.Nux[]\n }\n postInteractionSettings: AppBskyActorDefs.PostInteractionSettingsPref\n verificationPrefs: AppBskyActorDefs.VerificationPrefs\n liveEventPreferences: {\n hiddenFeedIds: string[]\n hideAllFeeds: boolean\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atproto/api",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.16",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Client library for atproto and Bluesky",
|
|
6
6
|
"keywords": [
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"zod": "^3.23.8",
|
|
24
24
|
"@atproto/common-web": "^0.4.12",
|
|
25
25
|
"@atproto/lexicon": "^0.6.0",
|
|
26
|
-
"@atproto/
|
|
27
|
-
"@atproto/
|
|
26
|
+
"@atproto/xrpc": "^0.7.7",
|
|
27
|
+
"@atproto/syntax": "^0.4.2"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@jest/globals": "^28.1.3",
|
package/src/agent.ts
CHANGED
|
@@ -587,6 +587,10 @@ export class Agent extends XrpcClient {
|
|
|
587
587
|
verificationPrefs: {
|
|
588
588
|
hideBadges: false,
|
|
589
589
|
},
|
|
590
|
+
liveEventPreferences: {
|
|
591
|
+
hiddenFeedIds: [],
|
|
592
|
+
hideAllFeeds: false,
|
|
593
|
+
},
|
|
590
594
|
}
|
|
591
595
|
const res = await this.app.bsky.actor.getPreferences({})
|
|
592
596
|
const labelPrefs: AppBskyActorDefs.ContentLabelPref[] = []
|
|
@@ -658,6 +662,11 @@ export class Agent extends XrpcClient {
|
|
|
658
662
|
prefs.verificationPrefs = {
|
|
659
663
|
hideBadges: pref.hideBadges,
|
|
660
664
|
}
|
|
665
|
+
} else if (predicate.isValidLiveEventPreferences(pref)) {
|
|
666
|
+
prefs.liveEventPreferences = {
|
|
667
|
+
hiddenFeedIds: pref.hiddenFeedIds || [],
|
|
668
|
+
hideAllFeeds: pref.hideAllFeeds ?? false,
|
|
669
|
+
}
|
|
661
670
|
}
|
|
662
671
|
}
|
|
663
672
|
|
|
@@ -1365,6 +1374,41 @@ export class Agent extends XrpcClient {
|
|
|
1365
1374
|
})
|
|
1366
1375
|
}
|
|
1367
1376
|
|
|
1377
|
+
async updateLiveEventPreferences(
|
|
1378
|
+
action:
|
|
1379
|
+
| { type: 'hideFeed'; id: string }
|
|
1380
|
+
| { type: 'unhideFeed'; id: string }
|
|
1381
|
+
| { type: 'toggleHideAllFeeds' },
|
|
1382
|
+
) {
|
|
1383
|
+
return this.updatePreferences((prefs) => {
|
|
1384
|
+
const pref = prefs.findLast(predicate.isValidLiveEventPreferences) || {
|
|
1385
|
+
$type: 'app.bsky.actor.defs#liveEventPreferences',
|
|
1386
|
+
hiddenFeedIds: [],
|
|
1387
|
+
hideAllFeeds: false,
|
|
1388
|
+
}
|
|
1389
|
+
|
|
1390
|
+
const hiddenFeedIds = new Set(pref.hiddenFeedIds || [])
|
|
1391
|
+
|
|
1392
|
+
switch (action.type) {
|
|
1393
|
+
case 'hideFeed':
|
|
1394
|
+
hiddenFeedIds.add(action.id)
|
|
1395
|
+
break
|
|
1396
|
+
case 'unhideFeed':
|
|
1397
|
+
hiddenFeedIds.delete(action.id)
|
|
1398
|
+
break
|
|
1399
|
+
case 'toggleHideAllFeeds':
|
|
1400
|
+
pref.hideAllFeeds = !pref.hideAllFeeds
|
|
1401
|
+
break
|
|
1402
|
+
}
|
|
1403
|
+
|
|
1404
|
+
pref.hiddenFeedIds = [...hiddenFeedIds]
|
|
1405
|
+
|
|
1406
|
+
return prefs
|
|
1407
|
+
.filter((p) => !AppBskyActorDefs.isLiveEventPreferences(p))
|
|
1408
|
+
.concat(pref)
|
|
1409
|
+
})
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1368
1412
|
//- Private methods
|
|
1369
1413
|
|
|
1370
1414
|
#prefsLock = new AwaitLock()
|
package/src/client/index.ts
CHANGED
|
@@ -36,6 +36,11 @@ import * as AppBskyContactRemoveData from './types/app/bsky/contact/removeData.j
|
|
|
36
36
|
import * as AppBskyContactSendNotification from './types/app/bsky/contact/sendNotification.js'
|
|
37
37
|
import * as AppBskyContactStartPhoneVerification from './types/app/bsky/contact/startPhoneVerification.js'
|
|
38
38
|
import * as AppBskyContactVerifyPhone from './types/app/bsky/contact/verifyPhone.js'
|
|
39
|
+
import * as AppBskyDraftCreateDraft from './types/app/bsky/draft/createDraft.js'
|
|
40
|
+
import * as AppBskyDraftDefs from './types/app/bsky/draft/defs.js'
|
|
41
|
+
import * as AppBskyDraftDeleteDraft from './types/app/bsky/draft/deleteDraft.js'
|
|
42
|
+
import * as AppBskyDraftGetDrafts from './types/app/bsky/draft/getDrafts.js'
|
|
43
|
+
import * as AppBskyDraftUpdateDraft from './types/app/bsky/draft/updateDraft.js'
|
|
39
44
|
import * as AppBskyEmbedDefs from './types/app/bsky/embed/defs.js'
|
|
40
45
|
import * as AppBskyEmbedExternal from './types/app/bsky/embed/external.js'
|
|
41
46
|
import * as AppBskyEmbedImages from './types/app/bsky/embed/images.js'
|
|
@@ -343,6 +348,11 @@ export * as AppBskyContactRemoveData from './types/app/bsky/contact/removeData.j
|
|
|
343
348
|
export * as AppBskyContactSendNotification from './types/app/bsky/contact/sendNotification.js'
|
|
344
349
|
export * as AppBskyContactStartPhoneVerification from './types/app/bsky/contact/startPhoneVerification.js'
|
|
345
350
|
export * as AppBskyContactVerifyPhone from './types/app/bsky/contact/verifyPhone.js'
|
|
351
|
+
export * as AppBskyDraftCreateDraft from './types/app/bsky/draft/createDraft.js'
|
|
352
|
+
export * as AppBskyDraftDefs from './types/app/bsky/draft/defs.js'
|
|
353
|
+
export * as AppBskyDraftDeleteDraft from './types/app/bsky/draft/deleteDraft.js'
|
|
354
|
+
export * as AppBskyDraftGetDrafts from './types/app/bsky/draft/getDrafts.js'
|
|
355
|
+
export * as AppBskyDraftUpdateDraft from './types/app/bsky/draft/updateDraft.js'
|
|
346
356
|
export * as AppBskyEmbedDefs from './types/app/bsky/embed/defs.js'
|
|
347
357
|
export * as AppBskyEmbedExternal from './types/app/bsky/embed/external.js'
|
|
348
358
|
export * as AppBskyEmbedImages from './types/app/bsky/embed/images.js'
|
|
@@ -767,6 +777,7 @@ export class AppBskyNS {
|
|
|
767
777
|
ageassurance: AppBskyAgeassuranceNS
|
|
768
778
|
bookmark: AppBskyBookmarkNS
|
|
769
779
|
contact: AppBskyContactNS
|
|
780
|
+
draft: AppBskyDraftNS
|
|
770
781
|
embed: AppBskyEmbedNS
|
|
771
782
|
feed: AppBskyFeedNS
|
|
772
783
|
graph: AppBskyGraphNS
|
|
@@ -782,6 +793,7 @@ export class AppBskyNS {
|
|
|
782
793
|
this.ageassurance = new AppBskyAgeassuranceNS(client)
|
|
783
794
|
this.bookmark = new AppBskyBookmarkNS(client)
|
|
784
795
|
this.contact = new AppBskyContactNS(client)
|
|
796
|
+
this.draft = new AppBskyDraftNS(client)
|
|
785
797
|
this.embed = new AppBskyEmbedNS(client)
|
|
786
798
|
this.feed = new AppBskyFeedNS(client)
|
|
787
799
|
this.graph = new AppBskyGraphNS(client)
|
|
@@ -1239,6 +1251,51 @@ export class AppBskyContactNS {
|
|
|
1239
1251
|
}
|
|
1240
1252
|
}
|
|
1241
1253
|
|
|
1254
|
+
export class AppBskyDraftNS {
|
|
1255
|
+
_client: XrpcClient
|
|
1256
|
+
|
|
1257
|
+
constructor(client: XrpcClient) {
|
|
1258
|
+
this._client = client
|
|
1259
|
+
}
|
|
1260
|
+
|
|
1261
|
+
createDraft(
|
|
1262
|
+
data?: AppBskyDraftCreateDraft.InputSchema,
|
|
1263
|
+
opts?: AppBskyDraftCreateDraft.CallOptions,
|
|
1264
|
+
): Promise<AppBskyDraftCreateDraft.Response> {
|
|
1265
|
+
return this._client
|
|
1266
|
+
.call('app.bsky.draft.createDraft', opts?.qp, data, opts)
|
|
1267
|
+
.catch((e) => {
|
|
1268
|
+
throw AppBskyDraftCreateDraft.toKnownErr(e)
|
|
1269
|
+
})
|
|
1270
|
+
}
|
|
1271
|
+
|
|
1272
|
+
deleteDraft(
|
|
1273
|
+
data?: AppBskyDraftDeleteDraft.InputSchema,
|
|
1274
|
+
opts?: AppBskyDraftDeleteDraft.CallOptions,
|
|
1275
|
+
): Promise<AppBskyDraftDeleteDraft.Response> {
|
|
1276
|
+
return this._client.call('app.bsky.draft.deleteDraft', opts?.qp, data, opts)
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1279
|
+
getDrafts(
|
|
1280
|
+
params?: AppBskyDraftGetDrafts.QueryParams,
|
|
1281
|
+
opts?: AppBskyDraftGetDrafts.CallOptions,
|
|
1282
|
+
): Promise<AppBskyDraftGetDrafts.Response> {
|
|
1283
|
+
return this._client.call(
|
|
1284
|
+
'app.bsky.draft.getDrafts',
|
|
1285
|
+
params,
|
|
1286
|
+
undefined,
|
|
1287
|
+
opts,
|
|
1288
|
+
)
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1291
|
+
updateDraft(
|
|
1292
|
+
data?: AppBskyDraftUpdateDraft.InputSchema,
|
|
1293
|
+
opts?: AppBskyDraftUpdateDraft.CallOptions,
|
|
1294
|
+
): Promise<AppBskyDraftUpdateDraft.Response> {
|
|
1295
|
+
return this._client.call('app.bsky.draft.updateDraft', opts?.qp, data, opts)
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
1298
|
+
|
|
1242
1299
|
export class AppBskyEmbedNS {
|
|
1243
1300
|
_client: XrpcClient
|
|
1244
1301
|
|