@atproto/api 0.3.12 → 0.3.13

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.
@@ -344,8 +344,8 @@ export declare class SyncNS {
344
344
  getRepo(params?: ComAtprotoSyncGetRepo.QueryParams, opts?: ComAtprotoSyncGetRepo.CallOptions): Promise<ComAtprotoSyncGetRepo.Response>;
345
345
  listBlobs(params?: ComAtprotoSyncListBlobs.QueryParams, opts?: ComAtprotoSyncListBlobs.CallOptions): Promise<ComAtprotoSyncListBlobs.Response>;
346
346
  listRepos(params?: ComAtprotoSyncListRepos.QueryParams, opts?: ComAtprotoSyncListRepos.CallOptions): Promise<ComAtprotoSyncListRepos.Response>;
347
- notifyOfUpdate(params?: ComAtprotoSyncNotifyOfUpdate.QueryParams, opts?: ComAtprotoSyncNotifyOfUpdate.CallOptions): Promise<ComAtprotoSyncNotifyOfUpdate.Response>;
348
- requestCrawl(params?: ComAtprotoSyncRequestCrawl.QueryParams, opts?: ComAtprotoSyncRequestCrawl.CallOptions): Promise<ComAtprotoSyncRequestCrawl.Response>;
347
+ notifyOfUpdate(data?: ComAtprotoSyncNotifyOfUpdate.InputSchema, opts?: ComAtprotoSyncNotifyOfUpdate.CallOptions): Promise<ComAtprotoSyncNotifyOfUpdate.Response>;
348
+ requestCrawl(data?: ComAtprotoSyncRequestCrawl.InputSchema, opts?: ComAtprotoSyncRequestCrawl.CallOptions): Promise<ComAtprotoSyncRequestCrawl.Response>;
349
349
  }
350
350
  export declare class AppNS {
351
351
  _service: AtpServiceClient;
@@ -2824,6 +2824,9 @@ export declare const schemaDict: {
2824
2824
  };
2825
2825
  };
2826
2826
  };
2827
+ errors: {
2828
+ name: string;
2829
+ }[];
2827
2830
  };
2828
2831
  };
2829
2832
  };
@@ -3008,13 +3011,16 @@ export declare const schemaDict: {
3008
3011
  main: {
3009
3012
  type: string;
3010
3013
  description: string;
3011
- parameters: {
3012
- type: string;
3013
- required: string[];
3014
- properties: {
3015
- hostname: {
3016
- type: string;
3017
- description: string;
3014
+ input: {
3015
+ encoding: string;
3016
+ schema: {
3017
+ type: string;
3018
+ required: string[];
3019
+ properties: {
3020
+ hostname: {
3021
+ type: string;
3022
+ description: string;
3023
+ };
3018
3024
  };
3019
3025
  };
3020
3026
  };
@@ -3028,13 +3034,16 @@ export declare const schemaDict: {
3028
3034
  main: {
3029
3035
  type: string;
3030
3036
  description: string;
3031
- parameters: {
3032
- type: string;
3033
- required: string[];
3034
- properties: {
3035
- hostname: {
3036
- type: string;
3037
- description: string;
3037
+ input: {
3038
+ encoding: string;
3039
+ schema: {
3040
+ type: string;
3041
+ required: string[];
3042
+ properties: {
3043
+ hostname: {
3044
+ type: string;
3045
+ description: string;
3046
+ };
3038
3047
  };
3039
3048
  };
3040
3049
  };
@@ -4912,6 +4921,14 @@ export declare const schemaDict: {
4912
4921
  type: string;
4913
4922
  refs: string[];
4914
4923
  };
4924
+ langs: {
4925
+ type: string;
4926
+ maxLength: number;
4927
+ items: {
4928
+ type: string;
4929
+ format: string;
4930
+ };
4931
+ };
4915
4932
  createdAt: {
4916
4933
  type: string;
4917
4934
  format: string;
@@ -5029,6 +5046,10 @@ export declare const schemaDict: {
5029
5046
  type: string;
5030
5047
  format: string;
5031
5048
  };
5049
+ cid: {
5050
+ type: string;
5051
+ format: string;
5052
+ };
5032
5053
  name: {
5033
5054
  type: string;
5034
5055
  maxLength: number;
@@ -5059,6 +5080,10 @@ export declare const schemaDict: {
5059
5080
  type: string;
5060
5081
  format: string;
5061
5082
  };
5083
+ cid: {
5084
+ type: string;
5085
+ format: string;
5086
+ };
5062
5087
  creator: {
5063
5088
  type: string;
5064
5089
  ref: string;
@@ -1,6 +1,7 @@
1
1
  import { ValidationResult } from '@atproto/lexicon';
2
2
  import * as ComAtprotoRepoStrongRef from '../../../com/atproto/repo/strongRef';
3
3
  import * as AppBskyFeedDefs from '../feed/defs';
4
+ import * as AppBskyGraphDefs from '../graph/defs';
4
5
  import * as AppBskyActorDefs from '../actor/defs';
5
6
  import * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs';
6
7
  import * as AppBskyEmbedImages from './images';
@@ -13,7 +14,7 @@ export interface Main {
13
14
  export declare function isMain(v: unknown): v is Main;
14
15
  export declare function validateMain(v: unknown): ValidationResult;
15
16
  export interface View {
16
- record: ViewRecord | ViewNotFound | ViewBlocked | AppBskyFeedDefs.GeneratorView | {
17
+ record: ViewRecord | ViewNotFound | ViewBlocked | AppBskyFeedDefs.GeneratorView | AppBskyGraphDefs.ListView | {
17
18
  $type: string;
18
19
  [k: string]: unknown;
19
20
  };
@@ -94,7 +94,7 @@ export declare function validateBlockedPost(v: unknown): ValidationResult;
94
94
  export interface GeneratorView {
95
95
  uri: string;
96
96
  cid: string;
97
- did?: string;
97
+ did: string;
98
98
  creator: AppBskyActorDefs.ProfileView;
99
99
  displayName: string;
100
100
  description?: string;
@@ -14,6 +14,7 @@ export interface Record {
14
14
  $type: string;
15
15
  [k: string]: unknown;
16
16
  };
17
+ langs?: string[];
17
18
  createdAt: string;
18
19
  [k: string]: unknown;
19
20
  }
@@ -3,6 +3,7 @@ import * as AppBskyActorDefs from '../actor/defs';
3
3
  import * as AppBskyRichtextFacet from '../richtext/facet';
4
4
  export interface ListViewBasic {
5
5
  uri: string;
6
+ cid: string;
6
7
  name: string;
7
8
  purpose: ListPurpose;
8
9
  avatar?: string;
@@ -14,6 +15,7 @@ export declare function isListViewBasic(v: unknown): v is ListViewBasic;
14
15
  export declare function validateListViewBasic(v: unknown): ValidationResult;
15
16
  export interface ListView {
16
17
  uri: string;
18
+ cid: string;
17
19
  creator: AppBskyActorDefs.ProfileView;
18
20
  name: string;
19
21
  purpose: ListPurpose;
@@ -1,4 +1,4 @@
1
- import { Headers } from '@atproto/xrpc';
1
+ import { Headers, XRPCError } from '@atproto/xrpc';
2
2
  export interface QueryParams {
3
3
  did: string;
4
4
  }
@@ -15,4 +15,7 @@ export interface Response {
15
15
  headers: Headers;
16
16
  data: OutputSchema;
17
17
  }
18
+ export declare class HeadNotFoundError extends XRPCError {
19
+ constructor(src: XRPCError);
20
+ }
18
21
  export declare function toKnownErr(e: any): any;
@@ -1,10 +1,14 @@
1
1
  import { Headers } from '@atproto/xrpc';
2
2
  export interface QueryParams {
3
+ }
4
+ export interface InputSchema {
3
5
  hostname: string;
6
+ [k: string]: unknown;
4
7
  }
5
- export declare type InputSchema = undefined;
6
8
  export interface CallOptions {
7
9
  headers?: Headers;
10
+ qp?: QueryParams;
11
+ encoding: 'application/json';
8
12
  }
9
13
  export interface Response {
10
14
  success: boolean;
@@ -1,10 +1,14 @@
1
1
  import { Headers } from '@atproto/xrpc';
2
2
  export interface QueryParams {
3
+ }
4
+ export interface InputSchema {
3
5
  hostname: string;
6
+ [k: string]: unknown;
4
7
  }
5
- export declare type InputSchema = undefined;
6
8
  export interface CallOptions {
7
9
  headers?: Headers;
10
+ qp?: QueryParams;
11
+ encoding: 'application/json';
8
12
  }
9
13
  export interface Response {
10
14
  success: boolean;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export { AtUri } from '@atproto/uri';
2
2
  export { BlobRef, lexToJson, stringifyLex, jsonToLex, jsonStringToLex, } from '@atproto/lexicon';
3
+ export { parseLanguage } from '@atproto/common-web';
3
4
  export * from './types';
4
5
  export * from './client';
5
6
  export * from './agent';
package/dist/index.js CHANGED
@@ -9031,6 +9031,7 @@ __export(src_exports4, {
9031
9031
  jsonStringToLex: () => jsonStringToLex,
9032
9032
  jsonToLex: () => jsonToLex,
9033
9033
  lexToJson: () => lexToJson,
9034
+ parseLanguage: () => parseLanguage,
9034
9035
  sanitizeRichText: () => sanitizeRichText,
9035
9036
  stringifyLex: () => stringifyLex
9036
9037
  });
@@ -15214,6 +15215,26 @@ var graphemeLen = (str) => {
15214
15215
  const splitter = new import_graphemer.default();
15215
15216
  return splitter.countGraphemes(str);
15216
15217
  };
15218
+ var parseLanguage = (langTag) => {
15219
+ const parsed = langTag.match(bcp47Regexp);
15220
+ if (!parsed?.groups)
15221
+ return null;
15222
+ const parts = parsed.groups;
15223
+ return {
15224
+ grandfathered: parts.grandfathered,
15225
+ language: parts.language,
15226
+ extlang: parts.extlang,
15227
+ script: parts.script,
15228
+ region: parts.region,
15229
+ variant: parts.variant,
15230
+ extension: parts.extension,
15231
+ privateUse: parts.privateUseA || parts.privateUseB
15232
+ };
15233
+ };
15234
+ var validateLanguage = (langTag) => {
15235
+ return bcp47Regexp.test(langTag);
15236
+ };
15237
+ var bcp47Regexp = /^((?<grandfathered>(en-GB-oed|i-ami|i-bnn|i-default|i-enochian|i-hak|i-klingon|i-lux|i-mingo|i-navajo|i-pwn|i-tao|i-tay|i-tsu|sgn-BE-FR|sgn-BE-NL|sgn-CH-DE)|(art-lojban|cel-gaulish|no-bok|no-nyn|zh-guoyu|zh-hakka|zh-min|zh-min-nan|zh-xiang))|((?<language>([A-Za-z]{2,3}(-(?<extlang>[A-Za-z]{3}(-[A-Za-z]{3}){0,2}))?)|[A-Za-z]{4}|[A-Za-z]{5,8})(-(?<script>[A-Za-z]{4}))?(-(?<region>[A-Za-z]{2}|[0-9]{3}))?(-(?<variant>[A-Za-z0-9]{5,8}|[0-9][A-Za-z0-9]{3}))*(-(?<extension>[0-9A-WY-Za-wy-z](-[A-Za-z0-9]{2,8})+))*(-(?<privateUseA>x(-[A-Za-z0-9]{1,8})+))?)|(?<privateUseB>x(-[A-Za-z0-9]{1,8})+))$/;
15217
15238
 
15218
15239
  // ../lexicon/src/validators/formats.ts
15219
15240
  var import_iso_datestring_validator = __toESM(require_dist());
@@ -15310,6 +15331,17 @@ function cid(path, value) {
15310
15331
  }
15311
15332
  return { success: true, value };
15312
15333
  }
15334
+ function language(path, value) {
15335
+ if (validateLanguage(value)) {
15336
+ return { success: true, value };
15337
+ }
15338
+ return {
15339
+ success: false,
15340
+ error: new ValidationError(
15341
+ `${path} must be a well-formed BCP 47 language tag`
15342
+ )
15343
+ };
15344
+ }
15313
15345
 
15314
15346
  // ../lexicon/src/validators/primitives.ts
15315
15347
  function validate(lexicons2, path, def2, value) {
@@ -15509,6 +15541,8 @@ function string2(lexicons2, path, def2, value) {
15509
15541
  return nsid(path, value);
15510
15542
  case "cid":
15511
15543
  return cid(path, value);
15544
+ case "language":
15545
+ return language(path, value);
15512
15546
  }
15513
15547
  }
15514
15548
  return { success: true, value };
@@ -15874,7 +15908,8 @@ var lexStringFormat = z.enum([
15874
15908
  "handle",
15875
15909
  "at-identifier",
15876
15910
  "nsid",
15877
- "cid"
15911
+ "cid",
15912
+ "language"
15878
15913
  ]);
15879
15914
  var lexString = z.object({
15880
15915
  type: z.literal("string"),
@@ -15992,7 +16027,6 @@ var lexXrpcSubscription = z.object({
15992
16027
  description: z.string().optional(),
15993
16028
  parameters: lexXrpcParameters.optional(),
15994
16029
  message: lexXrpcSubscriptionMessage.optional(),
15995
- infos: lexXrpcError.array().optional(),
15996
16030
  errors: lexXrpcError.array().optional()
15997
16031
  }).strict();
15998
16032
  var lexRecord = z.object({
@@ -19738,7 +19772,12 @@ var schemaDict = {
19738
19772
  }
19739
19773
  }
19740
19774
  }
19741
- }
19775
+ },
19776
+ errors: [
19777
+ {
19778
+ name: "HeadNotFound"
19779
+ }
19780
+ ]
19742
19781
  }
19743
19782
  }
19744
19783
  },
@@ -19921,15 +19960,18 @@ var schemaDict = {
19921
19960
  id: "com.atproto.sync.notifyOfUpdate",
19922
19961
  defs: {
19923
19962
  main: {
19924
- type: "query",
19963
+ type: "procedure",
19925
19964
  description: "Notify a crawling service of a recent update. Often when a long break between updates causes the connection with the crawling service to break.",
19926
- parameters: {
19927
- type: "params",
19928
- required: ["hostname"],
19929
- properties: {
19930
- hostname: {
19931
- type: "string",
19932
- description: "Hostname of the service that is notifying of update."
19965
+ input: {
19966
+ encoding: "application/json",
19967
+ schema: {
19968
+ type: "object",
19969
+ required: ["hostname"],
19970
+ properties: {
19971
+ hostname: {
19972
+ type: "string",
19973
+ description: "Hostname of the service that is notifying of update."
19974
+ }
19933
19975
  }
19934
19976
  }
19935
19977
  }
@@ -19941,15 +19983,18 @@ var schemaDict = {
19941
19983
  id: "com.atproto.sync.requestCrawl",
19942
19984
  defs: {
19943
19985
  main: {
19944
- type: "query",
19986
+ type: "procedure",
19945
19987
  description: "Request a service to persistently crawl hosted repos.",
19946
- parameters: {
19947
- type: "params",
19948
- required: ["hostname"],
19949
- properties: {
19950
- hostname: {
19951
- type: "string",
19952
- description: "Hostname of the service that is requesting to be crawled."
19988
+ input: {
19989
+ encoding: "application/json",
19990
+ schema: {
19991
+ type: "object",
19992
+ required: ["hostname"],
19993
+ properties: {
19994
+ hostname: {
19995
+ type: "string",
19996
+ description: "Hostname of the service that is requesting to be crawled."
19997
+ }
19953
19998
  }
19954
19999
  }
19955
20000
  }
@@ -20796,7 +20841,8 @@ var schemaDict = {
20796
20841
  "lex:app.bsky.embed.record#viewRecord",
20797
20842
  "lex:app.bsky.embed.record#viewNotFound",
20798
20843
  "lex:app.bsky.embed.record#viewBlocked",
20799
- "lex:app.bsky.feed.defs#generatorView"
20844
+ "lex:app.bsky.feed.defs#generatorView",
20845
+ "lex:app.bsky.graph.defs#listView"
20800
20846
  ]
20801
20847
  }
20802
20848
  }
@@ -21089,7 +21135,7 @@ var schemaDict = {
21089
21135
  },
21090
21136
  generatorView: {
21091
21137
  type: "object",
21092
- required: ["uri", "cid", "creator", "displayName", "indexedAt"],
21138
+ required: ["uri", "cid", "did", "creator", "displayName", "indexedAt"],
21093
21139
  properties: {
21094
21140
  uri: {
21095
21141
  type: "string",
@@ -21907,6 +21953,14 @@ var schemaDict = {
21907
21953
  "lex:app.bsky.embed.recordWithMedia"
21908
21954
  ]
21909
21955
  },
21956
+ langs: {
21957
+ type: "array",
21958
+ maxLength: 3,
21959
+ items: {
21960
+ type: "string",
21961
+ format: "language"
21962
+ }
21963
+ },
21910
21964
  createdAt: {
21911
21965
  type: "string",
21912
21966
  format: "datetime"
@@ -22018,12 +22072,16 @@ var schemaDict = {
22018
22072
  defs: {
22019
22073
  listViewBasic: {
22020
22074
  type: "object",
22021
- required: ["uri", "name", "purpose"],
22075
+ required: ["uri", "cid", "name", "purpose"],
22022
22076
  properties: {
22023
22077
  uri: {
22024
22078
  type: "string",
22025
22079
  format: "at-uri"
22026
22080
  },
22081
+ cid: {
22082
+ type: "string",
22083
+ format: "cid"
22084
+ },
22027
22085
  name: {
22028
22086
  type: "string",
22029
22087
  maxLength: 64,
@@ -22048,12 +22106,16 @@ var schemaDict = {
22048
22106
  },
22049
22107
  listView: {
22050
22108
  type: "object",
22051
- required: ["uri", "creator", "name", "purpose", "indexedAt"],
22109
+ required: ["uri", "cid", "creator", "name", "purpose", "indexedAt"],
22052
22110
  properties: {
22053
22111
  uri: {
22054
22112
  type: "string",
22055
22113
  format: "at-uri"
22056
22114
  },
22115
+ cid: {
22116
+ type: "string",
22117
+ format: "cid"
22118
+ },
22057
22119
  creator: {
22058
22120
  type: "ref",
22059
22121
  ref: "lex:app.bsky.actor.defs#profileView"
@@ -23793,10 +23855,18 @@ function toKnownErr50(e) {
23793
23855
  // src/client/types/com/atproto/sync/getHead.ts
23794
23856
  var getHead_exports = {};
23795
23857
  __export(getHead_exports, {
23858
+ HeadNotFoundError: () => HeadNotFoundError,
23796
23859
  toKnownErr: () => toKnownErr51
23797
23860
  });
23861
+ var HeadNotFoundError = class extends XRPCError {
23862
+ constructor(src2) {
23863
+ super(src2.status, src2.error, src2.message);
23864
+ }
23865
+ };
23798
23866
  function toKnownErr51(e) {
23799
23867
  if (e instanceof XRPCError) {
23868
+ if (e.error === "HeadNotFound")
23869
+ return new HeadNotFoundError(e);
23800
23870
  }
23801
23871
  return e;
23802
23872
  }
@@ -25514,13 +25584,13 @@ var SyncNS = class {
25514
25584
  throw toKnownErr55(e);
25515
25585
  });
25516
25586
  }
25517
- notifyOfUpdate(params2, opts) {
25518
- return this._service.xrpc.call("com.atproto.sync.notifyOfUpdate", params2, void 0, opts).catch((e) => {
25587
+ notifyOfUpdate(data, opts) {
25588
+ return this._service.xrpc.call("com.atproto.sync.notifyOfUpdate", opts?.qp, data, opts).catch((e) => {
25519
25589
  throw toKnownErr56(e);
25520
25590
  });
25521
25591
  }
25522
- requestCrawl(params2, opts) {
25523
- return this._service.xrpc.call("com.atproto.sync.requestCrawl", params2, void 0, opts).catch((e) => {
25592
+ requestCrawl(data, opts) {
25593
+ return this._service.xrpc.call("com.atproto.sync.requestCrawl", opts?.qp, data, opts).catch((e) => {
25524
25594
  throw toKnownErr57(e);
25525
25595
  });
25526
25596
  }