@atproto/api 0.6.15 → 0.6.17

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atproto/api
2
2
 
3
+ ## 0.6.17
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1637](https://github.com/bluesky-social/atproto/pull/1637) [`d96f7d9b`](https://github.com/bluesky-social/atproto/commit/d96f7d9b84c6fbab9711059c8584a77d892dcedd) Thanks [@estrattonbailey](https://github.com/estrattonbailey)! - Introduce general support for tags on posts
8
+
9
+ ## 0.6.16
10
+
11
+ ### Patch Changes
12
+
13
+ - [#1653](https://github.com/bluesky-social/atproto/pull/1653) [`56e2cf89`](https://github.com/bluesky-social/atproto/commit/56e2cf8999f6d7522529a9be8652c47545f82242) Thanks [@pfrazee](https://github.com/pfrazee)! - Improve the types of the thread and feed preferences APIs
14
+
3
15
  ## 0.6.15
4
16
 
5
17
  ### Patch Changes
package/README.md CHANGED
@@ -31,6 +31,8 @@ Log into a server or create accounts using these APIs. You'll need an active ses
31
31
 
32
32
  ```typescript
33
33
  import { BskyAgent, AtpSessionEvent, AtpSessionData } from '@atproto/api'
34
+
35
+ // configure connection to the server, without account authentication
34
36
  const agent = new BskyAgent({
35
37
  service: 'https://example.com',
36
38
  persistSession: (evt: AtpSessionEvent, sess?: AtpSessionData) => {
@@ -38,13 +40,19 @@ const agent = new BskyAgent({
38
40
  },
39
41
  })
40
42
 
41
- await agent.login({ identifier: 'alice@mail.com', password: 'hunter2' })
42
- await agent.resumeSession(savedSessionData)
43
+ // create a new account on the server
43
44
  await agent.createAccount({
44
45
  email: 'alice@mail.com',
45
46
  password: 'hunter2',
46
47
  handle: 'alice.example.com',
48
+ inviteCode: 'some-code-12345-abcde',
47
49
  })
50
+
51
+ // if an existing session (accessed with 'agent.session') was securely stored previously, then reuse that
52
+ await agent.resumeSession(savedSessionData)
53
+
54
+ // if no old session was available, create a new one by logging in with password (App Password)
55
+ await agent.login({ identifier: 'alice@mail.com', password: 'hunter2' })
48
56
  ```
49
57
 
50
58
  ### API calls
@@ -1,6 +1,6 @@
1
1
  import { AtpAgent } from './agent';
2
- import { AppBskyFeedPost, AppBskyActorProfile, AppBskyActorDefs } from './client';
3
- import { BskyPreferences, BskyLabelPreference } from './types';
2
+ import { AppBskyFeedPost, AppBskyActorProfile } from './client';
3
+ import { BskyPreferences, BskyLabelPreference, BskyFeedViewPreference, BskyThreadViewPreference } from './types';
4
4
  declare global {
5
5
  interface Array<T> {
6
6
  findLast(predicate: (value: T, index: number, obj: T[]) => unknown, thisArg?: any): T;
@@ -75,6 +75,6 @@ export declare class BskyAgent extends AtpAgent {
75
75
  setPersonalDetails({ birthDate, }: {
76
76
  birthDate: string | Date | undefined;
77
77
  }): Promise<void>;
78
- setFeedViewPrefs(feed: string, pref: Omit<AppBskyActorDefs.FeedViewPref, '$type' | 'feed'>): Promise<void>;
79
- setThreadViewPrefs(pref: Omit<AppBskyActorDefs.ThreadViewPref, '$type'>): Promise<void>;
78
+ setFeedViewPrefs(feed: string, pref: Partial<BskyFeedViewPreference>): Promise<void>;
79
+ setThreadViewPrefs(pref: Partial<BskyThreadViewPreference>): Promise<void>;
80
80
  }
@@ -5272,6 +5272,16 @@ export declare const schemaDict: {
5272
5272
  type: string;
5273
5273
  refs: string[];
5274
5274
  };
5275
+ tags: {
5276
+ type: string;
5277
+ maxLength: number;
5278
+ items: {
5279
+ type: string;
5280
+ maxLength: number;
5281
+ maxGraphemes: number;
5282
+ };
5283
+ description: string;
5284
+ };
5275
5285
  createdAt: {
5276
5286
  type: string;
5277
5287
  format: string;
@@ -6408,6 +6418,18 @@ export declare const schemaDict: {
6408
6418
  };
6409
6419
  };
6410
6420
  };
6421
+ tag: {
6422
+ type: string;
6423
+ description: string;
6424
+ required: string[];
6425
+ properties: {
6426
+ tag: {
6427
+ type: string;
6428
+ maxLength: number;
6429
+ maxGraphemes: number;
6430
+ };
6431
+ };
6432
+ };
6411
6433
  byteSlice: {
6412
6434
  type: string;
6413
6435
  description: string;
@@ -20,6 +20,7 @@ export interface Record {
20
20
  $type: string;
21
21
  [k: string]: unknown;
22
22
  };
23
+ tags?: string[];
23
24
  createdAt: string;
24
25
  [k: string]: unknown;
25
26
  }
@@ -1,7 +1,7 @@
1
1
  import { ValidationResult } from '@atproto/lexicon';
2
2
  export interface Main {
3
3
  index: ByteSlice;
4
- features: (Mention | Link | {
4
+ features: (Mention | Link | Tag | {
5
5
  $type: string;
6
6
  [k: string]: unknown;
7
7
  })[];
@@ -21,6 +21,12 @@ export interface Link {
21
21
  }
22
22
  export declare function isLink(v: unknown): v is Link;
23
23
  export declare function validateLink(v: unknown): ValidationResult;
24
+ export interface Tag {
25
+ tag: string;
26
+ [k: string]: unknown;
27
+ }
28
+ export declare function isTag(v: unknown): v is Tag;
29
+ export declare function validateTag(v: unknown): ValidationResult;
24
30
  export interface ByteSlice {
25
31
  byteStart: number;
26
32
  byteEnd: number;
package/dist/index.js CHANGED
@@ -21172,6 +21172,16 @@ var schemaDict = {
21172
21172
  type: "union",
21173
21173
  refs: ["lex:com.atproto.label.defs#selfLabels"]
21174
21174
  },
21175
+ tags: {
21176
+ type: "array",
21177
+ maxLength: 8,
21178
+ items: {
21179
+ type: "string",
21180
+ maxLength: 640,
21181
+ maxGraphemes: 64
21182
+ },
21183
+ description: "Additional non-inline tags describing this post."
21184
+ },
21175
21185
  createdAt: {
21176
21186
  type: "string",
21177
21187
  format: "datetime"
@@ -22305,7 +22315,8 @@ var schemaDict = {
22305
22315
  type: "union",
22306
22316
  refs: [
22307
22317
  "lex:app.bsky.richtext.facet#mention",
22308
- "lex:app.bsky.richtext.facet#link"
22318
+ "lex:app.bsky.richtext.facet#link",
22319
+ "lex:app.bsky.richtext.facet#tag"
22309
22320
  ]
22310
22321
  }
22311
22322
  }
@@ -22333,6 +22344,18 @@ var schemaDict = {
22333
22344
  }
22334
22345
  }
22335
22346
  },
22347
+ tag: {
22348
+ type: "object",
22349
+ description: "A hashtag.",
22350
+ required: ["tag"],
22351
+ properties: {
22352
+ tag: {
22353
+ type: "string",
22354
+ maxLength: 640,
22355
+ maxGraphemes: 64
22356
+ }
22357
+ }
22358
+ },
22336
22359
  byteSlice: {
22337
22360
  type: "object",
22338
22361
  description: "A text segment. Start is inclusive, end is exclusive. Indices are for utf8-encoded strings.",
@@ -22382,7 +22405,7 @@ var schemaDict = {
22382
22405
  defs: {
22383
22406
  main: {
22384
22407
  type: "query",
22385
- description: "An unspecced view of globally popular items",
22408
+ description: "DEPRECATED: will be removed soon, please find a feed generator alternative",
22386
22409
  parameters: {
22387
22410
  type: "params",
22388
22411
  properties: {
@@ -24904,10 +24927,12 @@ __export(facet_exports, {
24904
24927
  isLink: () => isLink,
24905
24928
  isMain: () => isMain6,
24906
24929
  isMention: () => isMention,
24930
+ isTag: () => isTag,
24907
24931
  validateByteSlice: () => validateByteSlice,
24908
24932
  validateLink: () => validateLink,
24909
24933
  validateMain: () => validateMain6,
24910
- validateMention: () => validateMention
24934
+ validateMention: () => validateMention,
24935
+ validateTag: () => validateTag
24911
24936
  });
24912
24937
  function isMain6(v) {
24913
24938
  return isObj2(v) && hasProp2(v, "$type") && (v.$type === "app.bsky.richtext.facet#main" || v.$type === "app.bsky.richtext.facet");
@@ -24927,6 +24952,12 @@ function isLink(v) {
24927
24952
  function validateLink(v) {
24928
24953
  return lexicons.validate("app.bsky.richtext.facet#link", v);
24929
24954
  }
24955
+ function isTag(v) {
24956
+ return isObj2(v) && hasProp2(v, "$type") && v.$type === "app.bsky.richtext.facet#tag";
24957
+ }
24958
+ function validateTag(v) {
24959
+ return lexicons.validate("app.bsky.richtext.facet#tag", v);
24960
+ }
24930
24961
  function isByteSlice(v) {
24931
24962
  return isObj2(v) && hasProp2(v, "$type") && v.$type === "app.bsky.richtext.facet#byteSlice";
24932
24963
  }
@@ -28892,12 +28923,12 @@ function decideQuotedPostWithMediaAccount(subject, opts) {
28892
28923
  }
28893
28924
 
28894
28925
  // src/moderation/subjects/feed-generator.ts
28895
- function decideFeedGenerator(subject, opts) {
28926
+ function decideFeedGenerator(_subject, _opts) {
28896
28927
  return ModerationDecision.noop();
28897
28928
  }
28898
28929
 
28899
28930
  // src/moderation/subjects/user-list.ts
28900
- function decideUserList(subject, opts) {
28931
+ function decideUserList(_subject, _opts) {
28901
28932
  return ModerationDecision.noop();
28902
28933
  }
28903
28934