@atproto/api 0.19.3 → 0.19.5

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.
Files changed (44) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/agent.d.ts +6 -5
  3. package/dist/agent.d.ts.map +1 -1
  4. package/dist/agent.js +6 -2
  5. package/dist/agent.js.map +1 -1
  6. package/dist/atp-agent.d.ts +0 -1
  7. package/dist/atp-agent.d.ts.map +1 -1
  8. package/dist/atp-agent.js +0 -3
  9. package/dist/atp-agent.js.map +1 -1
  10. package/dist/client/lexicons.d.ts +42 -18
  11. package/dist/client/lexicons.d.ts.map +1 -1
  12. package/dist/client/lexicons.js +22 -10
  13. package/dist/client/lexicons.js.map +1 -1
  14. package/dist/client/types/app/bsky/graph/getSuggestedFollowsByActor.d.ts +3 -3
  15. package/dist/client/types/app/bsky/graph/getSuggestedFollowsByActor.d.ts.map +1 -1
  16. package/dist/client/types/app/bsky/graph/getSuggestedFollowsByActor.js.map +1 -1
  17. package/dist/client/types/com/atproto/label/defs.d.ts +1 -1
  18. package/dist/client/types/com/atproto/label/defs.d.ts.map +1 -1
  19. package/dist/client/types/com/atproto/label/defs.js.map +1 -1
  20. package/dist/client/types/tools/ozone/moderation/defs.d.ts +10 -2
  21. package/dist/client/types/tools/ozone/moderation/defs.d.ts.map +1 -1
  22. package/dist/client/types/tools/ozone/moderation/defs.js +9 -0
  23. package/dist/client/types/tools/ozone/moderation/defs.js.map +1 -1
  24. package/dist/client/types/tools/ozone/moderation/emitEvent.d.ts +1 -1
  25. package/dist/client/types/tools/ozone/moderation/emitEvent.d.ts.map +1 -1
  26. package/dist/client/types/tools/ozone/moderation/emitEvent.js.map +1 -1
  27. package/dist/index.d.ts +2 -1
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +4 -1
  30. package/dist/index.js.map +1 -1
  31. package/package.json +6 -5
  32. package/scripts/code/labels.mjs +20 -17
  33. package/scripts/generate-code.mjs +3 -2
  34. package/src/agent.ts +10 -7
  35. package/src/atp-agent.ts +0 -4
  36. package/src/client/lexicons.ts +24 -11
  37. package/src/client/types/app/bsky/graph/getSuggestedFollowsByActor.ts +3 -3
  38. package/src/client/types/com/atproto/label/defs.ts +2 -5
  39. package/src/client/types/tools/ozone/moderation/defs.ts +19 -0
  40. package/src/client/types/tools/ozone/moderation/emitEvent.ts +1 -0
  41. package/src/index.ts +3 -1
  42. package/tests/errors.test.ts +1 -1
  43. package/tests/moderation-prefs.test.ts +9 -9
  44. package/src/moderation/const/labels.ts +0 -220
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAG3C,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AACvC,OAAO,EACL,OAAO,EACP,eAAe,EACf,SAAS,EACT,SAAS,EACT,YAAY,GACb,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA;AACvB,cAAc,QAAQ,CAAA;AACtB,cAAc,UAAU,CAAA;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAC3C,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,cAAc,uBAAuB,CAAA;AACrC,cAAc,0BAA0B,CAAA;AACxC,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA;AAChC,cAAc,cAAc,CAAA;AAC5B,cAAc,oBAAoB,CAAA;AAClC,cAAc,UAAU,CAAA;AACxB,cAAc,iBAAiB,CAAA;AAC/B,OAAO,EAAE,sBAAsB,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAC1E,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAE/B,OAAO,EAAE,QAAQ,EAAE,KAAK,eAAe,EAAE,MAAM,aAAa,CAAA;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAExC,OAAO;AACL,kBAAkB;AAClB,QAAQ,IAAI,OAAO,GACpB,MAAM,aAAa,CAAA;AAIpB,eAAO,MAAM,QAAQ,UAAiC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAG3C,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AACvC,OAAO,EACL,OAAO,EACP,eAAe,EACf,SAAS,EACT,SAAS,EACT,YAAY,GACb,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAEzC,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA;AACvB,cAAc,QAAQ,CAAA;AACtB,cAAc,UAAU,CAAA;AACxB,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAChD,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,cAAc,uBAAuB,CAAA;AACrC,cAAc,0BAA0B,CAAA;AACxC,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA;AAChC,cAAc,cAAc,CAAA;AAC5B,cAAc,oBAAoB,CAAA;AAClC,cAAc,UAAU,CAAA;AACxB,cAAc,iBAAiB,CAAA;AAC/B,OAAO,EAAE,sBAAsB,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAC1E,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAE/B,OAAO,EAAE,QAAQ,EAAE,KAAK,eAAe,EAAE,MAAM,aAAa,CAAA;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAExC,OAAO;AACL,kBAAkB;AAClB,QAAQ,IAAI,OAAO,GACpB,MAAM,aAAa,CAAA;AAIpB,eAAO,MAAM,QAAQ,UAAiC,CAAA"}
package/dist/index.js CHANGED
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.lexicons = exports.default = exports.BskyAgent = exports.CredentialSession = exports.AtpAgent = exports.Agent = exports.LABELS = exports.DEFAULT_LABEL_SETTINGS = exports.asPredicate = exports.schemas = exports.parseLanguage = exports.stringifyLex = exports.lexToJson = exports.jsonToLex = exports.jsonStringToLex = exports.BlobRef = exports.AtUri = void 0;
17
+ exports.lexicons = exports.default = exports.BskyAgent = exports.CredentialSession = exports.AtpAgent = exports.Agent = exports.LABELS = exports.DEFAULT_LABEL_SETTINGS = exports.asPredicate = exports.schemas = exports.ids = exports.XRPCError = exports.parseLanguage = exports.stringifyLex = exports.lexToJson = exports.jsonToLex = exports.jsonStringToLex = exports.BlobRef = exports.AtUri = void 0;
18
18
  const lexicon_1 = require("@atproto/lexicon");
19
19
  const lexicons_1 = require("./client/lexicons");
20
20
  var syntax_1 = require("@atproto/syntax");
@@ -27,11 +27,14 @@ Object.defineProperty(exports, "lexToJson", { enumerable: true, get: function ()
27
27
  Object.defineProperty(exports, "stringifyLex", { enumerable: true, get: function () { return lexicon_2.stringifyLex; } });
28
28
  var common_web_1 = require("@atproto/common-web");
29
29
  Object.defineProperty(exports, "parseLanguage", { enumerable: true, get: function () { return common_web_1.parseLanguage; } });
30
+ var xrpc_1 = require("@atproto/xrpc");
31
+ Object.defineProperty(exports, "XRPCError", { enumerable: true, get: function () { return xrpc_1.XRPCError; } });
30
32
  __exportStar(require("./types"), exports);
31
33
  __exportStar(require("./const"), exports);
32
34
  __exportStar(require("./util"), exports);
33
35
  __exportStar(require("./client"), exports);
34
36
  var lexicons_2 = require("./client/lexicons");
37
+ Object.defineProperty(exports, "ids", { enumerable: true, get: function () { return lexicons_2.ids; } });
35
38
  Object.defineProperty(exports, "schemas", { enumerable: true, get: function () { return lexicons_2.schemas; } });
36
39
  var util_1 = require("./client/util");
37
40
  Object.defineProperty(exports, "asPredicate", { enumerable: true, get: function () { return util_1.asPredicate; } });
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,8CAA2C;AAC3C,gDAAgE;AAEhE,0CAAuC;AAA9B,+FAAA,KAAK,OAAA;AACd,4CAMyB;AALvB,kGAAA,OAAO,OAAA;AACP,0GAAA,eAAe,OAAA;AACf,oGAAA,SAAS,OAAA;AACT,oGAAA,SAAS,OAAA;AACT,uGAAA,YAAY,OAAA;AAEd,kDAAmD;AAA1C,2GAAA,aAAa,OAAA;AACtB,0CAAuB;AACvB,0CAAuB;AACvB,yCAAsB;AACtB,2CAAwB;AACxB,8CAA2C;AAAlC,mGAAA,OAAO,OAAA;AAEhB,sCAA2C;AAAlC,mGAAA,WAAW,OAAA;AACpB,wDAAqC;AACrC,2DAAwC;AACxC,sDAAmC;AACnC,mDAAgC;AAChC,+CAA4B;AAC5B,qDAAkC;AAClC,2CAAwB;AACxB,kDAA+B;AAC/B,oDAA0E;AAAjE,gHAAA,sBAAsB,OAAA;AAAE,gGAAA,MAAM,OAAA;AACvC,iCAA+B;AAAtB,8FAAA,KAAK,OAAA;AAEd,yCAA4D;AAAnD,qGAAA,QAAQ,OAAA;AACjB,yCAA+C;AAAtC,8GAAA,iBAAiB,OAAA;AAC1B,2CAAwC;AAA/B,uGAAA,SAAS,OAAA;AAElB,yCAGoB;AAFlB,kBAAkB;AAClB,oGAAA,QAAQ,OAAW;AAGrB,+EAA+E;AAC/E,2BAA2B;AACd,QAAA,QAAQ,GAAG,IAAI,kBAAQ,CAAC,mBAAgB,CAAC,CAAA","sourcesContent":["import { Lexicons } from '@atproto/lexicon'\nimport { lexicons as internalLexicons } from './client/lexicons'\n\nexport { AtUri } from '@atproto/syntax'\nexport {\n BlobRef,\n jsonStringToLex,\n jsonToLex,\n lexToJson,\n stringifyLex,\n} from '@atproto/lexicon'\nexport { parseLanguage } from '@atproto/common-web'\nexport * from './types'\nexport * from './const'\nexport * from './util'\nexport * from './client'\nexport { schemas } from './client/lexicons'\nexport type { $Typed, Un$Typed } from './client/util'\nexport { asPredicate } from './client/util'\nexport * from './rich-text/rich-text'\nexport * from './rich-text/sanitization'\nexport * from './rich-text/unicode'\nexport * from './rich-text/util'\nexport * from './moderation'\nexport * from './moderation/types'\nexport * from './mocker'\nexport * from './age-assurance'\nexport { DEFAULT_LABEL_SETTINGS, LABELS } from './moderation/const/labels'\nexport { Agent } from './agent'\n\nexport { AtpAgent, type AtpAgentOptions } from './atp-agent'\nexport { CredentialSession } from './atp-agent'\nexport { BskyAgent } from './bsky-agent'\n\nexport {\n /** @deprecated */\n AtpAgent as default,\n} from './atp-agent'\n\n// Expose a copy to prevent alteration of the internal Lexicon instance used by\n// the AtpBaseClient class.\nexport const lexicons = new Lexicons(internalLexicons)\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,8CAA2C;AAC3C,gDAAgE;AAEhE,0CAAuC;AAA9B,+FAAA,KAAK,OAAA;AACd,4CAMyB;AALvB,kGAAA,OAAO,OAAA;AACP,0GAAA,eAAe,OAAA;AACf,oGAAA,SAAS,OAAA;AACT,oGAAA,SAAS,OAAA;AACT,uGAAA,YAAY,OAAA;AAEd,kDAAmD;AAA1C,2GAAA,aAAa,OAAA;AACtB,sCAAyC;AAAhC,iGAAA,SAAS,OAAA;AAElB,0CAAuB;AACvB,0CAAuB;AACvB,yCAAsB;AACtB,2CAAwB;AACxB,8CAAgD;AAAvC,+FAAA,GAAG,OAAA;AAAE,mGAAA,OAAO,OAAA;AAErB,sCAA2C;AAAlC,mGAAA,WAAW,OAAA;AACpB,wDAAqC;AACrC,2DAAwC;AACxC,sDAAmC;AACnC,mDAAgC;AAChC,+CAA4B;AAC5B,qDAAkC;AAClC,2CAAwB;AACxB,kDAA+B;AAC/B,oDAA0E;AAAjE,gHAAA,sBAAsB,OAAA;AAAE,gGAAA,MAAM,OAAA;AACvC,iCAA+B;AAAtB,8FAAA,KAAK,OAAA;AAEd,yCAA4D;AAAnD,qGAAA,QAAQ,OAAA;AACjB,yCAA+C;AAAtC,8GAAA,iBAAiB,OAAA;AAC1B,2CAAwC;AAA/B,uGAAA,SAAS,OAAA;AAElB,yCAGoB;AAFlB,kBAAkB;AAClB,oGAAA,QAAQ,OAAW;AAGrB,+EAA+E;AAC/E,2BAA2B;AACd,QAAA,QAAQ,GAAG,IAAI,kBAAQ,CAAC,mBAAgB,CAAC,CAAA","sourcesContent":["import { Lexicons } from '@atproto/lexicon'\nimport { lexicons as internalLexicons } from './client/lexicons'\n\nexport { AtUri } from '@atproto/syntax'\nexport {\n BlobRef,\n jsonStringToLex,\n jsonToLex,\n lexToJson,\n stringifyLex,\n} from '@atproto/lexicon'\nexport { parseLanguage } from '@atproto/common-web'\nexport { XRPCError } from '@atproto/xrpc'\n\nexport * from './types'\nexport * from './const'\nexport * from './util'\nexport * from './client'\nexport { ids, schemas } from './client/lexicons'\nexport type { $Typed, Un$Typed } from './client/util'\nexport { asPredicate } from './client/util'\nexport * from './rich-text/rich-text'\nexport * from './rich-text/sanitization'\nexport * from './rich-text/unicode'\nexport * from './rich-text/util'\nexport * from './moderation'\nexport * from './moderation/types'\nexport * from './mocker'\nexport * from './age-assurance'\nexport { DEFAULT_LABEL_SETTINGS, LABELS } from './moderation/const/labels'\nexport { Agent } from './agent'\n\nexport { AtpAgent, type AtpAgentOptions } from './atp-agent'\nexport { CredentialSession } from './atp-agent'\nexport { BskyAgent } from './bsky-agent'\n\nexport {\n /** @deprecated */\n AtpAgent as default,\n} from './atp-agent'\n\n// Expose a copy to prevent alteration of the internal Lexicon instance used by\n// the AtpBaseClient class.\nexport const lexicons = new Lexicons(internalLexicons)\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atproto/api",
3
- "version": "0.19.3",
3
+ "version": "0.19.5",
4
4
  "license": "MIT",
5
5
  "description": "Client library for atproto and Bluesky",
6
6
  "keywords": [
@@ -21,10 +21,10 @@
21
21
  "multiformats": "^9.9.0",
22
22
  "tlds": "^1.234.0",
23
23
  "zod": "^3.23.8",
24
- "@atproto/common-web": "^0.4.18",
24
+ "@atproto/common-web": "^0.4.19",
25
25
  "@atproto/lexicon": "^0.6.2",
26
- "@atproto/xrpc": "^0.7.7",
27
- "@atproto/syntax": "^0.5.0"
26
+ "@atproto/syntax": "^0.5.2",
27
+ "@atproto/xrpc": "^0.7.7"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@jest/globals": "^28.1.3",
@@ -34,7 +34,8 @@
34
34
  "@atproto/lex-cli": "^0.9.9"
35
35
  },
36
36
  "scripts": {
37
- "codegen": "node ./scripts/generate-code.mjs && lex gen-api --yes ./src/client ../../lexicons/com/atproto/*/* ../../lexicons/app/bsky/*/* ../../lexicons/chat/bsky/*/* ../../lexicons/tools/ozone/*/* ../../lexicons/com/germnetwork/*",
37
+ "codegen": "lex gen-api --yes ./src/client ../../lexicons/com/atproto/*/* ../../lexicons/app/bsky/*/* ../../lexicons/chat/bsky/*/* ../../lexicons/tools/ozone/*/* ../../lexicons/com/germnetwork/*",
38
+ "prebuild": "node ./scripts/generate-code.mjs && ([ -f ./src/client/index.ts ] || pnpm run codegen)",
38
39
  "build": "tsc --build tsconfig.build.json",
39
40
  "test": "jest"
40
41
  }
@@ -1,22 +1,27 @@
1
- import * as url from 'url'
2
- import { readFileSync, writeFileSync } from 'fs'
3
- import { join } from 'path'
1
+ import { mkdir, writeFile } from 'node:fs/promises'
2
+ import { dirname, join } from 'node:path'
3
+ import { fileURLToPath } from 'node:url'
4
4
  import * as prettier from 'prettier'
5
+ import labelsDef from '../../definitions/labels.json' with { type: 'json' }
5
6
 
6
- const __dirname = url.fileURLToPath(new URL('.', import.meta.url))
7
+ const __dirname = dirname(fileURLToPath(import.meta.url))
7
8
 
8
- const labelsDef = JSON.parse(
9
- readFileSync(
10
- join(__dirname, '..', '..', 'definitions', 'labels.json'),
11
- 'utf8',
12
- ),
13
- )
9
+ export async function labels() {
10
+ const content = await gen()
14
11
 
15
- writeFileSync(
16
- join(__dirname, '..', '..', 'src', 'moderation', 'const', 'labels.ts'),
17
- await gen(),
18
- 'utf8',
19
- )
12
+ const path = join(
13
+ __dirname,
14
+ '..',
15
+ '..',
16
+ 'src',
17
+ 'moderation',
18
+ 'const',
19
+ 'labels.ts',
20
+ )
21
+
22
+ await mkdir(dirname(path), { recursive: true })
23
+ await writeFile(path, content, 'utf8')
24
+ }
20
25
 
21
26
  async function gen() {
22
27
  const knownValues = new Set()
@@ -70,5 +75,3 @@ async function gen() {
70
75
  { semi: false, parser: 'typescript', singleQuote: true },
71
76
  )
72
77
  }
73
-
74
- export {}
@@ -1,3 +1,4 @@
1
- import './code/labels.mjs'
1
+ import { labels } from './code/labels.mjs'
2
+ export { labels }
2
3
 
3
- export {}
4
+ labels()
package/src/agent.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import AwaitLock from 'await-lock'
2
2
  import { TID, retry } from '@atproto/common-web'
3
- import { AtUri, ensureValidDid } from '@atproto/syntax'
3
+ import { AtUri, DidString, ensureValidDidRegex } from '@atproto/syntax'
4
4
  import {
5
5
  FetchHandler,
6
6
  FetchHandlerOptions,
@@ -63,7 +63,7 @@ const THREAD_VIEW_PREF_DEFAULTS = {
63
63
  sort: 'hotness',
64
64
  }
65
65
 
66
- export type { FetchHandler }
66
+ export type { DidString, FetchHandler }
67
67
 
68
68
  /**
69
69
  * An {@link Agent} is an {@link AtpBaseClient} with the following
@@ -207,8 +207,11 @@ export class Agent extends XrpcClient {
207
207
  /**
208
208
  * Get the authenticated user's DID, if any.
209
209
  */
210
- get did() {
211
- return this.sessionManager.did
210
+ get did(): DidString | undefined {
211
+ const { did } = this.sessionManager
212
+ if (!did) return undefined
213
+ ensureValidDidRegex(did)
214
+ return did
212
215
  }
213
216
 
214
217
  /** @deprecated Use {@link Agent.assertDid} instead */
@@ -219,7 +222,7 @@ export class Agent extends XrpcClient {
219
222
  /**
220
223
  * Get the authenticated user's DID, or throw an error if not authenticated.
221
224
  */
222
- get assertDid(): string {
225
+ get assertDid(): DidString {
223
226
  this.assertAuthenticated()
224
227
  return this.did
225
228
  }
@@ -227,7 +230,7 @@ export class Agent extends XrpcClient {
227
230
  /**
228
231
  * Assert that the user is authenticated.
229
232
  */
230
- public assertAuthenticated(): asserts this is { did: string } {
233
+ public assertAuthenticated(): asserts this is { did: DidString } {
231
234
  if (!this.did) throw new Error('Not logged in')
232
235
  }
233
236
 
@@ -890,7 +893,7 @@ export class Agent extends XrpcClient {
890
893
  labelerDid?: string,
891
894
  ) {
892
895
  if (labelerDid) {
893
- ensureValidDid(labelerDid)
896
+ ensureValidDidRegex(labelerDid)
894
897
  }
895
898
  await this.updatePreferences((prefs) => {
896
899
  const labelPref = prefs
package/src/atp-agent.ts CHANGED
@@ -88,10 +88,6 @@ export class AtpAgent extends Agent {
88
88
  return this.sessionManager.hasSession
89
89
  }
90
90
 
91
- get did() {
92
- return this.sessionManager.did
93
- }
94
-
95
91
  get serviceUrl() {
96
92
  return this.sessionManager.serviceUrl
97
93
  }
@@ -6243,21 +6243,21 @@ export const schemaDict = {
6243
6243
  ref: 'lex:app.bsky.actor.defs#profileView',
6244
6244
  },
6245
6245
  },
6246
+ recIdStr: {
6247
+ type: 'string',
6248
+ description:
6249
+ 'Snowflake for this recommendation, use when submitting recommendation events.',
6250
+ },
6246
6251
  isFallback: {
6247
6252
  type: 'boolean',
6248
6253
  description:
6249
- 'If true, response has fallen-back to generic results, and is not scoped using relativeToDid',
6254
+ 'DEPRECATED, unused. Previously: if true, response has fallen-back to generic results, and is not scoped using relativeToDid',
6250
6255
  default: false,
6251
6256
  },
6252
6257
  recId: {
6253
6258
  type: 'integer',
6254
6259
  description: 'DEPRECATED: use recIdStr instead.',
6255
6260
  },
6256
- recIdStr: {
6257
- type: 'string',
6258
- description:
6259
- 'Snowflake for this recommendation, use when submitting recommendation events.',
6260
- },
6261
6261
  },
6262
6262
  },
6263
6263
  },
@@ -11842,16 +11842,13 @@ export const schemaDict = {
11842
11842
  type: 'string',
11843
11843
  knownValues: [
11844
11844
  '!hide',
11845
- '!no-promote',
11846
11845
  '!warn',
11847
11846
  '!no-unauthenticated',
11848
- 'dmca-violation',
11849
- 'doxxing',
11850
11847
  'porn',
11851
11848
  'sexual',
11852
11849
  'nudity',
11853
- 'nsfl',
11854
- 'gore',
11850
+ 'graphic-media',
11851
+ 'bot',
11855
11852
  ],
11856
11853
  },
11857
11854
  },
@@ -16018,6 +16015,7 @@ export const schemaDict = {
16018
16015
  'lex:tools.ozone.moderation.defs#modEventPriorityScore',
16019
16016
  'lex:tools.ozone.moderation.defs#ageAssuranceEvent',
16020
16017
  'lex:tools.ozone.moderation.defs#ageAssuranceOverrideEvent',
16018
+ 'lex:tools.ozone.moderation.defs#ageAssurancePurgeEvent',
16021
16019
  'lex:tools.ozone.moderation.defs#revokeAccountCredentialsEvent',
16022
16020
  'lex:tools.ozone.moderation.defs#scheduleTakedownEvent',
16023
16021
  'lex:tools.ozone.moderation.defs#cancelScheduledTakedownEvent',
@@ -16095,6 +16093,7 @@ export const schemaDict = {
16095
16093
  'lex:tools.ozone.moderation.defs#modEventPriorityScore',
16096
16094
  'lex:tools.ozone.moderation.defs#ageAssuranceEvent',
16097
16095
  'lex:tools.ozone.moderation.defs#ageAssuranceOverrideEvent',
16096
+ 'lex:tools.ozone.moderation.defs#ageAssurancePurgeEvent',
16098
16097
  'lex:tools.ozone.moderation.defs#revokeAccountCredentialsEvent',
16099
16098
  'lex:tools.ozone.moderation.defs#scheduleTakedownEvent',
16100
16099
  'lex:tools.ozone.moderation.defs#cancelScheduledTakedownEvent',
@@ -16661,6 +16660,19 @@ export const schemaDict = {
16661
16660
  },
16662
16661
  },
16663
16662
  },
16663
+ ageAssurancePurgeEvent: {
16664
+ type: 'object',
16665
+ description:
16666
+ 'Purges all age assurance events for the subject. Only works on DID subjects. Moderator-only.',
16667
+ required: ['comment'],
16668
+ properties: {
16669
+ comment: {
16670
+ type: 'string',
16671
+ minLength: 1,
16672
+ description: 'Comment describing the reason for the purge.',
16673
+ },
16674
+ },
16675
+ },
16664
16676
  revokeAccountCredentialsEvent: {
16665
16677
  type: 'object',
16666
16678
  description:
@@ -17534,6 +17546,7 @@ export const schemaDict = {
17534
17546
  'lex:tools.ozone.moderation.defs#modEventPriorityScore',
17535
17547
  'lex:tools.ozone.moderation.defs#ageAssuranceEvent',
17536
17548
  'lex:tools.ozone.moderation.defs#ageAssuranceOverrideEvent',
17549
+ 'lex:tools.ozone.moderation.defs#ageAssurancePurgeEvent',
17537
17550
  'lex:tools.ozone.moderation.defs#revokeAccountCredentialsEvent',
17538
17551
  'lex:tools.ozone.moderation.defs#scheduleTakedownEvent',
17539
17552
  'lex:tools.ozone.moderation.defs#cancelScheduledTakedownEvent',
@@ -23,12 +23,12 @@ export type InputSchema = undefined
23
23
 
24
24
  export interface OutputSchema {
25
25
  suggestions: AppBskyActorDefs.ProfileView[]
26
- /** If true, response has fallen-back to generic results, and is not scoped using relativeToDid */
26
+ /** Snowflake for this recommendation, use when submitting recommendation events. */
27
+ recIdStr?: string
28
+ /** DEPRECATED, unused. Previously: if true, response has fallen-back to generic results, and is not scoped using relativeToDid */
27
29
  isFallback: boolean
28
30
  /** DEPRECATED: use recIdStr instead. */
29
31
  recId?: number
30
- /** Snowflake for this recommendation, use when submitting recommendation events. */
31
- recIdStr?: string
32
32
  }
33
33
 
34
34
  export interface CallOptions {
@@ -133,14 +133,11 @@ export function validateLabelValueDefinitionStrings<V>(v: V) {
133
133
 
134
134
  export type LabelValue =
135
135
  | '!hide'
136
- | '!no-promote'
137
136
  | '!warn'
138
137
  | '!no-unauthenticated'
139
- | 'dmca-violation'
140
- | 'doxxing'
141
138
  | 'porn'
142
139
  | 'sexual'
143
140
  | 'nudity'
144
- | 'nsfl'
145
- | 'gore'
141
+ | 'graphic-media'
142
+ | 'bot'
146
143
  | (string & {})
@@ -46,6 +46,7 @@ export interface ModEventView {
46
46
  | $Typed<ModEventPriorityScore>
47
47
  | $Typed<AgeAssuranceEvent>
48
48
  | $Typed<AgeAssuranceOverrideEvent>
49
+ | $Typed<AgeAssurancePurgeEvent>
49
50
  | $Typed<RevokeAccountCredentialsEvent>
50
51
  | $Typed<ScheduleTakedownEvent>
51
52
  | $Typed<CancelScheduledTakedownEvent>
@@ -98,6 +99,7 @@ export interface ModEventViewDetail {
98
99
  | $Typed<ModEventPriorityScore>
99
100
  | $Typed<AgeAssuranceEvent>
100
101
  | $Typed<AgeAssuranceOverrideEvent>
102
+ | $Typed<AgeAssurancePurgeEvent>
101
103
  | $Typed<RevokeAccountCredentialsEvent>
102
104
  | $Typed<ScheduleTakedownEvent>
103
105
  | $Typed<CancelScheduledTakedownEvent>
@@ -503,6 +505,23 @@ export function validateAgeAssuranceOverrideEvent<V>(v: V) {
503
505
  )
504
506
  }
505
507
 
508
+ /** Purges all age assurance events for the subject. Only works on DID subjects. Moderator-only. */
509
+ export interface AgeAssurancePurgeEvent {
510
+ $type?: 'tools.ozone.moderation.defs#ageAssurancePurgeEvent'
511
+ /** Comment describing the reason for the purge. */
512
+ comment: string
513
+ }
514
+
515
+ const hashAgeAssurancePurgeEvent = 'ageAssurancePurgeEvent'
516
+
517
+ export function isAgeAssurancePurgeEvent<V>(v: V) {
518
+ return is$typed(v, id, hashAgeAssurancePurgeEvent)
519
+ }
520
+
521
+ export function validateAgeAssurancePurgeEvent<V>(v: V) {
522
+ return validate<AgeAssurancePurgeEvent & V>(v, id, hashAgeAssurancePurgeEvent)
523
+ }
524
+
506
525
  /** Account credentials revocation by moderators. Only works on DID subjects. */
507
526
  export interface RevokeAccountCredentialsEvent {
508
527
  $type?: 'tools.ozone.moderation.defs#revokeAccountCredentialsEvent'
@@ -43,6 +43,7 @@ export interface InputSchema {
43
43
  | $Typed<ToolsOzoneModerationDefs.ModEventPriorityScore>
44
44
  | $Typed<ToolsOzoneModerationDefs.AgeAssuranceEvent>
45
45
  | $Typed<ToolsOzoneModerationDefs.AgeAssuranceOverrideEvent>
46
+ | $Typed<ToolsOzoneModerationDefs.AgeAssurancePurgeEvent>
46
47
  | $Typed<ToolsOzoneModerationDefs.RevokeAccountCredentialsEvent>
47
48
  | $Typed<ToolsOzoneModerationDefs.ScheduleTakedownEvent>
48
49
  | $Typed<ToolsOzoneModerationDefs.CancelScheduledTakedownEvent>
package/src/index.ts CHANGED
@@ -10,11 +10,13 @@ export {
10
10
  stringifyLex,
11
11
  } from '@atproto/lexicon'
12
12
  export { parseLanguage } from '@atproto/common-web'
13
+ export { XRPCError } from '@atproto/xrpc'
14
+
13
15
  export * from './types'
14
16
  export * from './const'
15
17
  export * from './util'
16
18
  export * from './client'
17
- export { schemas } from './client/lexicons'
19
+ export { ids, schemas } from './client/lexicons'
18
20
  export type { $Typed, Un$Typed } from './client/util'
19
21
  export { asPredicate } from './client/util'
20
22
  export * from './rich-text/rich-text'
@@ -9,7 +9,7 @@ describe('errors', () => {
9
9
  network = await TestNetworkNoAppView.create({
10
10
  dbPostgresSchema: 'known_errors',
11
11
  })
12
- client = network.pds.getClient()
12
+ client = network.pds.getAgent()
13
13
  })
14
14
 
15
15
  afterAll(async () => {
@@ -17,7 +17,7 @@ describe('agent', () => {
17
17
  })
18
18
 
19
19
  it('migrates legacy content-label prefs (no mutations)', async () => {
20
- const agent = network.pds.getClient()
20
+ const agent = network.pds.getAgent()
21
21
 
22
22
  await agent.createAccount({
23
23
  handle: 'user1.test',
@@ -101,7 +101,7 @@ describe('agent', () => {
101
101
  })
102
102
 
103
103
  it('adds/removes moderation services', async () => {
104
- const agent = network.pds.getClient()
104
+ const agent = network.pds.getAgent()
105
105
 
106
106
  await agent.createAccount({
107
107
  handle: 'user5.test',
@@ -207,7 +207,7 @@ describe('agent', () => {
207
207
  })
208
208
 
209
209
  it('sets label preferences globally and per-moderator', async () => {
210
- const agent = network.pds.getClient()
210
+ const agent = network.pds.getAgent()
211
211
 
212
212
  await agent.createAccount({
213
213
  handle: 'user7.test',
@@ -273,7 +273,7 @@ describe('agent', () => {
273
273
  })
274
274
 
275
275
  it(`updates label pref`, async () => {
276
- const agent = network.pds.getClient()
276
+ const agent = network.pds.getAgent()
277
277
 
278
278
  await agent.createAccount({
279
279
  handle: 'user8.test',
@@ -297,7 +297,7 @@ describe('agent', () => {
297
297
  })
298
298
 
299
299
  it(`double-write for legacy: 'graphic-media' in sync with 'gore'`, async () => {
300
- const agent = network.pds.getClient()
300
+ const agent = network.pds.getAgent()
301
301
 
302
302
  await agent.createAccount({
303
303
  handle: 'user9.test',
@@ -319,7 +319,7 @@ describe('agent', () => {
319
319
  })
320
320
 
321
321
  it(`double-write for legacy: 'porn' in sync with 'nsfw'`, async () => {
322
- const agent = network.pds.getClient()
322
+ const agent = network.pds.getAgent()
323
323
 
324
324
  await agent.createAccount({
325
325
  handle: 'user10.test',
@@ -341,7 +341,7 @@ describe('agent', () => {
341
341
  })
342
342
 
343
343
  it(`double-write for legacy: 'sexual' in sync with 'suggestive'`, async () => {
344
- const agent = network.pds.getClient()
344
+ const agent = network.pds.getAgent()
345
345
 
346
346
  await agent.createAccount({
347
347
  handle: 'user11.test',
@@ -363,7 +363,7 @@ describe('agent', () => {
363
363
  })
364
364
 
365
365
  it(`double-write for legacy: filters out existing old label pref if double-written`, async () => {
366
- const agent = network.pds.getClient()
366
+ const agent = network.pds.getAgent()
367
367
 
368
368
  await agent.createAccount({
369
369
  handle: 'user12.test',
@@ -382,7 +382,7 @@ describe('agent', () => {
382
382
  })
383
383
 
384
384
  it(`remaps old values to new on read`, async () => {
385
- const agent = network.pds.getClient()
385
+ const agent = network.pds.getAgent()
386
386
 
387
387
  await agent.createAccount({
388
388
  handle: 'user13.test',