@atproto/pds 0.4.204 → 0.4.205

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 (70) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/LICENSE.txt +1 -1
  3. package/dist/account-manager/helpers/token.d.ts +32 -32
  4. package/dist/actor-store/blob/transactor.d.ts +0 -2
  5. package/dist/actor-store/blob/transactor.d.ts.map +1 -1
  6. package/dist/actor-store/blob/transactor.js +2 -41
  7. package/dist/actor-store/blob/transactor.js.map +1 -1
  8. package/dist/actor-store/db/schema/blob.d.ts +0 -2
  9. package/dist/actor-store/db/schema/blob.d.ts.map +1 -1
  10. package/dist/actor-store/db/schema/blob.js.map +1 -1
  11. package/dist/lexicon/index.d.ts +13 -0
  12. package/dist/lexicon/index.d.ts.map +1 -1
  13. package/dist/lexicon/index.js +37 -1
  14. package/dist/lexicon/index.js.map +1 -1
  15. package/dist/lexicon/lexicons.d.ts +784 -6
  16. package/dist/lexicon/lexicons.d.ts.map +1 -1
  17. package/dist/lexicon/lexicons.js +404 -2
  18. package/dist/lexicon/lexicons.js.map +1 -1
  19. package/dist/lexicon/types/app/bsky/actor/defs.d.ts +19 -1
  20. package/dist/lexicon/types/app/bsky/actor/defs.d.ts.map +1 -1
  21. package/dist/lexicon/types/app/bsky/actor/defs.js +18 -0
  22. package/dist/lexicon/types/app/bsky/actor/defs.js.map +1 -1
  23. package/dist/lexicon/types/app/bsky/draft/createDraft.d.ts +27 -0
  24. package/dist/lexicon/types/app/bsky/draft/createDraft.d.ts.map +1 -0
  25. package/dist/lexicon/types/app/bsky/draft/createDraft.js +7 -0
  26. package/dist/lexicon/types/app/bsky/draft/createDraft.js.map +1 -0
  27. package/dist/lexicon/types/app/bsky/draft/defs.d.ts +106 -0
  28. package/dist/lexicon/types/app/bsky/draft/defs.d.ts.map +1 -0
  29. package/dist/lexicon/types/app/bsky/draft/defs.js +97 -0
  30. package/dist/lexicon/types/app/bsky/draft/defs.js.map +1 -0
  31. package/dist/lexicon/types/app/bsky/draft/deleteDraft.d.ts +14 -0
  32. package/dist/lexicon/types/app/bsky/draft/deleteDraft.d.ts.map +1 -0
  33. package/dist/lexicon/types/app/bsky/draft/deleteDraft.js +7 -0
  34. package/dist/lexicon/types/app/bsky/draft/deleteDraft.js.map +1 -0
  35. package/dist/lexicon/types/app/bsky/draft/getDrafts.d.ts +24 -0
  36. package/dist/lexicon/types/app/bsky/draft/getDrafts.d.ts.map +1 -0
  37. package/dist/lexicon/types/app/bsky/draft/getDrafts.js +7 -0
  38. package/dist/lexicon/types/app/bsky/draft/getDrafts.js.map +1 -0
  39. package/dist/lexicon/types/app/bsky/draft/updateDraft.d.ts +15 -0
  40. package/dist/lexicon/types/app/bsky/draft/updateDraft.d.ts.map +1 -0
  41. package/dist/lexicon/types/app/bsky/draft/updateDraft.js +7 -0
  42. package/dist/lexicon/types/app/bsky/draft/updateDraft.js.map +1 -0
  43. package/dist/lexicon/types/app/bsky/unspecced/getSuggestedUsers.d.ts +1 -1
  44. package/dist/lexicon/types/app/bsky/unspecced/getSuggestedUsers.js.map +1 -1
  45. package/dist/lexicon/types/app/bsky/unspecced/getSuggestedUsersSkeleton.d.ts +1 -1
  46. package/dist/lexicon/types/app/bsky/unspecced/getSuggestedUsersSkeleton.js.map +1 -1
  47. package/dist/sequencer/events.d.ts +6 -6
  48. package/dist/sequencer/events.js +1 -1
  49. package/dist/sequencer/events.js.map +1 -1
  50. package/package.json +11 -12
  51. package/src/actor-store/blob/transactor.ts +2 -10
  52. package/src/actor-store/db/schema/blob.ts +2 -2
  53. package/src/lexicon/index.ts +62 -0
  54. package/src/lexicon/lexicons.ts +414 -2
  55. package/src/lexicon/types/app/bsky/actor/defs.ts +37 -0
  56. package/src/lexicon/types/app/bsky/draft/createDraft.ts +46 -0
  57. package/src/lexicon/types/app/bsky/draft/defs.ts +208 -0
  58. package/src/lexicon/types/app/bsky/draft/deleteDraft.ts +33 -0
  59. package/src/lexicon/types/app/bsky/draft/getDrafts.ts +42 -0
  60. package/src/lexicon/types/app/bsky/draft/updateDraft.ts +34 -0
  61. package/src/lexicon/types/app/bsky/unspecced/getSuggestedUsers.ts +1 -1
  62. package/src/lexicon/types/app/bsky/unspecced/getSuggestedUsersSkeleton.ts +1 -1
  63. package/src/sequencer/events.ts +2 -2
  64. package/tests/file-uploads.test.ts +0 -6
  65. package/tsconfig.build.tsbuildinfo +1 -1
  66. package/dist/image/index.d.ts +0 -16
  67. package/dist/image/index.d.ts.map +0 -1
  68. package/dist/image/index.js +0 -59
  69. package/dist/image/index.js.map +0 -1
  70. package/src/image/index.ts +0 -67
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deleteDraft.js","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/draft/deleteDraft.ts"],"names":[],"mappings":";;AAKA,mDAA4D;AAC5D,2CAIyB;AAEzB,MAAM,QAAQ,GAAG,eAAS,EACxB,QAAQ,GAAG,mBAAS,CAAA;AACtB,MAAM,EAAE,GAAG,4BAA4B,CAAA","sourcesContent":["/**\n * GENERATED CODE - DO NOT MODIFY\n */\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'\n\nconst is$typed = _is$typed,\n validate = _validate\nconst id = 'app.bsky.draft.deleteDraft'\n\nexport type QueryParams = {}\n\nexport interface InputSchema {\n id: string\n}\n\nexport interface HandlerInput {\n encoding: 'application/json'\n body: InputSchema\n}\n\nexport interface HandlerError {\n status: number\n message?: string\n}\n\nexport type HandlerOutput = HandlerError | void\n"]}
@@ -0,0 +1,24 @@
1
+ import type * as AppBskyDraftDefs from './defs.js';
2
+ export type QueryParams = {
3
+ limit: number;
4
+ cursor?: string;
5
+ };
6
+ export type InputSchema = undefined;
7
+ export interface OutputSchema {
8
+ cursor?: string;
9
+ drafts: AppBskyDraftDefs.DraftView[];
10
+ }
11
+ export type HandlerInput = void;
12
+ export interface HandlerSuccess {
13
+ encoding: 'application/json';
14
+ body: OutputSchema;
15
+ headers?: {
16
+ [key: string]: string;
17
+ };
18
+ }
19
+ export interface HandlerError {
20
+ status: number;
21
+ message?: string;
22
+ }
23
+ export type HandlerOutput = HandlerError | HandlerSuccess;
24
+ //# sourceMappingURL=getDrafts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getDrafts.d.ts","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/draft/getDrafts.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,KAAK,gBAAgB,MAAM,WAAW,CAAA;AAMlD,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,MAAM,CAAA;IACb,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,MAAM,YAAY,GAAG,IAAI,CAAA;AAE/B,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,kBAAkB,CAAA;IAC5B,IAAI,EAAE,YAAY,CAAA;IAClB,OAAO,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;CACpC;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG,cAAc,CAAA"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const lexicons_1 = require("../../../../lexicons");
4
+ const util_1 = require("../../../../util");
5
+ const is$typed = util_1.is$typed, validate = lexicons_1.validate;
6
+ const id = 'app.bsky.draft.getDrafts';
7
+ //# sourceMappingURL=getDrafts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getDrafts.js","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/draft/getDrafts.ts"],"names":[],"mappings":";;AAKA,mDAA4D;AAC5D,2CAIyB;AAGzB,MAAM,QAAQ,GAAG,eAAS,EACxB,QAAQ,GAAG,mBAAS,CAAA;AACtB,MAAM,EAAE,GAAG,0BAA0B,CAAA","sourcesContent":["/**\n * GENERATED CODE - DO NOT MODIFY\n */\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 type HandlerInput = void\n\nexport interface HandlerSuccess {\n encoding: 'application/json'\n body: OutputSchema\n headers?: { [key: string]: string }\n}\n\nexport interface HandlerError {\n status: number\n message?: string\n}\n\nexport type HandlerOutput = HandlerError | HandlerSuccess\n"]}
@@ -0,0 +1,15 @@
1
+ import type * as AppBskyDraftDefs from './defs.js';
2
+ export type QueryParams = {};
3
+ export interface InputSchema {
4
+ draft: AppBskyDraftDefs.DraftWithId;
5
+ }
6
+ export interface HandlerInput {
7
+ encoding: 'application/json';
8
+ body: InputSchema;
9
+ }
10
+ export interface HandlerError {
11
+ status: number;
12
+ message?: string;
13
+ }
14
+ export type HandlerOutput = HandlerError | void;
15
+ //# sourceMappingURL=updateDraft.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updateDraft.d.ts","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/draft/updateDraft.ts"],"names":[],"mappings":"AAWA,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,YAAY;IAC3B,QAAQ,EAAE,kBAAkB,CAAA;IAC5B,IAAI,EAAE,WAAW,CAAA;CAClB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG,IAAI,CAAA"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const lexicons_1 = require("../../../../lexicons");
4
+ const util_1 = require("../../../../util");
5
+ const is$typed = util_1.is$typed, validate = lexicons_1.validate;
6
+ const id = 'app.bsky.draft.updateDraft';
7
+ //# sourceMappingURL=updateDraft.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updateDraft.js","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/draft/updateDraft.ts"],"names":[],"mappings":";;AAKA,mDAA4D;AAC5D,2CAIyB;AAGzB,MAAM,QAAQ,GAAG,eAAS,EACxB,QAAQ,GAAG,mBAAS,CAAA;AACtB,MAAM,EAAE,GAAG,4BAA4B,CAAA","sourcesContent":["/**\n * GENERATED CODE - DO NOT MODIFY\n */\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 HandlerInput {\n encoding: 'application/json'\n body: InputSchema\n}\n\nexport interface HandlerError {\n status: number\n message?: string\n}\n\nexport type HandlerOutput = HandlerError | void\n"]}
@@ -8,7 +8,7 @@ export type InputSchema = undefined;
8
8
  export interface OutputSchema {
9
9
  actors: AppBskyActorDefs.ProfileView[];
10
10
  /** Snowflake for this recommendation, use when submitting recommendation events. */
11
- recId?: number;
11
+ recId?: string;
12
12
  }
13
13
  export type HandlerInput = void;
14
14
  export interface HandlerSuccess {
@@ -1 +1 @@
1
- {"version":3,"file":"getSuggestedUsers.js","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/unspecced/getSuggestedUsers.ts"],"names":[],"mappings":";;AAKA,mDAA4D;AAC5D,2CAIyB;AAGzB,MAAM,QAAQ,GAAG,eAAS,EACxB,QAAQ,GAAG,mBAAS,CAAA;AACtB,MAAM,EAAE,GAAG,sCAAsC,CAAA","sourcesContent":["/**\n * GENERATED CODE - DO NOT MODIFY\n */\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 AppBskyActorDefs from '../actor/defs.js'\n\nconst is$typed = _is$typed,\n validate = _validate\nconst id = 'app.bsky.unspecced.getSuggestedUsers'\n\nexport type QueryParams = {\n /** Category of users to get suggestions for. */\n category?: string\n limit: number\n}\nexport type InputSchema = undefined\n\nexport interface OutputSchema {\n actors: AppBskyActorDefs.ProfileView[]\n /** Snowflake for this recommendation, use when submitting recommendation events. */\n recId?: number\n}\n\nexport type HandlerInput = void\n\nexport interface HandlerSuccess {\n encoding: 'application/json'\n body: OutputSchema\n headers?: { [key: string]: string }\n}\n\nexport interface HandlerError {\n status: number\n message?: string\n}\n\nexport type HandlerOutput = HandlerError | HandlerSuccess\n"]}
1
+ {"version":3,"file":"getSuggestedUsers.js","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/unspecced/getSuggestedUsers.ts"],"names":[],"mappings":";;AAKA,mDAA4D;AAC5D,2CAIyB;AAGzB,MAAM,QAAQ,GAAG,eAAS,EACxB,QAAQ,GAAG,mBAAS,CAAA;AACtB,MAAM,EAAE,GAAG,sCAAsC,CAAA","sourcesContent":["/**\n * GENERATED CODE - DO NOT MODIFY\n */\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 AppBskyActorDefs from '../actor/defs.js'\n\nconst is$typed = _is$typed,\n validate = _validate\nconst id = 'app.bsky.unspecced.getSuggestedUsers'\n\nexport type QueryParams = {\n /** Category of users to get suggestions for. */\n category?: string\n limit: number\n}\nexport type InputSchema = undefined\n\nexport interface OutputSchema {\n actors: AppBskyActorDefs.ProfileView[]\n /** Snowflake for this recommendation, use when submitting recommendation events. */\n recId?: string\n}\n\nexport type HandlerInput = void\n\nexport interface HandlerSuccess {\n encoding: 'application/json'\n body: OutputSchema\n headers?: { [key: string]: string }\n}\n\nexport interface HandlerError {\n status: number\n message?: string\n}\n\nexport type HandlerOutput = HandlerError | HandlerSuccess\n"]}
@@ -9,7 +9,7 @@ export type InputSchema = undefined;
9
9
  export interface OutputSchema {
10
10
  dids: string[];
11
11
  /** Snowflake for this recommendation, use when submitting recommendation events. */
12
- recId?: number;
12
+ recId?: string;
13
13
  }
14
14
  export type HandlerInput = void;
15
15
  export interface HandlerSuccess {
@@ -1 +1 @@
1
- {"version":3,"file":"getSuggestedUsersSkeleton.js","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/unspecced/getSuggestedUsersSkeleton.ts"],"names":[],"mappings":";;AAKA,mDAA4D;AAC5D,2CAIyB;AAEzB,MAAM,QAAQ,GAAG,eAAS,EACxB,QAAQ,GAAG,mBAAS,CAAA;AACtB,MAAM,EAAE,GAAG,8CAA8C,CAAA","sourcesContent":["/**\n * GENERATED CODE - DO NOT MODIFY\n */\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'\n\nconst is$typed = _is$typed,\n validate = _validate\nconst id = 'app.bsky.unspecced.getSuggestedUsersSkeleton'\n\nexport type QueryParams = {\n /** DID of the account making the request (not included for public/unauthenticated queries). */\n viewer?: string\n /** Category of users to get suggestions for. */\n category?: string\n limit: number\n}\nexport type InputSchema = undefined\n\nexport interface OutputSchema {\n dids: string[]\n /** Snowflake for this recommendation, use when submitting recommendation events. */\n recId?: number\n}\n\nexport type HandlerInput = void\n\nexport interface HandlerSuccess {\n encoding: 'application/json'\n body: OutputSchema\n headers?: { [key: string]: string }\n}\n\nexport interface HandlerError {\n status: number\n message?: string\n}\n\nexport type HandlerOutput = HandlerError | HandlerSuccess\n"]}
1
+ {"version":3,"file":"getSuggestedUsersSkeleton.js","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/unspecced/getSuggestedUsersSkeleton.ts"],"names":[],"mappings":";;AAKA,mDAA4D;AAC5D,2CAIyB;AAEzB,MAAM,QAAQ,GAAG,eAAS,EACxB,QAAQ,GAAG,mBAAS,CAAA;AACtB,MAAM,EAAE,GAAG,8CAA8C,CAAA","sourcesContent":["/**\n * GENERATED CODE - DO NOT MODIFY\n */\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'\n\nconst is$typed = _is$typed,\n validate = _validate\nconst id = 'app.bsky.unspecced.getSuggestedUsersSkeleton'\n\nexport type QueryParams = {\n /** DID of the account making the request (not included for public/unauthenticated queries). */\n viewer?: string\n /** Category of users to get suggestions for. */\n category?: string\n limit: number\n}\nexport type InputSchema = undefined\n\nexport interface OutputSchema {\n dids: string[]\n /** Snowflake for this recommendation, use when submitting recommendation events. */\n recId?: string\n}\n\nexport type HandlerInput = void\n\nexport interface HandlerSuccess {\n encoding: 'application/json'\n body: OutputSchema\n headers?: { [key: string]: string }\n}\n\nexport interface HandlerError {\n status: number\n message?: string\n}\n\nexport type HandlerOutput = HandlerError | HandlerSuccess\n"]}
@@ -14,12 +14,12 @@ export declare const commitEvtOp: z.ZodObject<{
14
14
  prev: z.ZodOptional<z.ZodEffects<z.ZodUnknown, import("multiformats/cid").CID, unknown>>;
15
15
  }, "strip", z.ZodTypeAny, {
16
16
  cid: import("multiformats/cid").CID | null;
17
- action: "create" | "delete" | "update";
18
17
  path: string;
18
+ action: "create" | "delete" | "update";
19
19
  prev?: import("multiformats/cid").CID | undefined;
20
20
  }, {
21
- action: "create" | "delete" | "update";
22
21
  path: string;
22
+ action: "create" | "delete" | "update";
23
23
  cid?: unknown;
24
24
  prev?: unknown;
25
25
  }>;
@@ -39,12 +39,12 @@ export declare const commitEvt: z.ZodObject<{
39
39
  prev: z.ZodOptional<z.ZodEffects<z.ZodUnknown, import("multiformats/cid").CID, unknown>>;
40
40
  }, "strip", z.ZodTypeAny, {
41
41
  cid: import("multiformats/cid").CID | null;
42
- action: "create" | "delete" | "update";
43
42
  path: string;
43
+ action: "create" | "delete" | "update";
44
44
  prev?: import("multiformats/cid").CID | undefined;
45
45
  }, {
46
- action: "create" | "delete" | "update";
47
46
  path: string;
47
+ action: "create" | "delete" | "update";
48
48
  cid?: unknown;
49
49
  prev?: unknown;
50
50
  }>, "many">;
@@ -61,8 +61,8 @@ export declare const commitEvt: z.ZodObject<{
61
61
  tooBig: boolean;
62
62
  ops: {
63
63
  cid: import("multiformats/cid").CID | null;
64
- action: "create" | "delete" | "update";
65
64
  path: string;
65
+ action: "create" | "delete" | "update";
66
66
  prev?: import("multiformats/cid").CID | undefined;
67
67
  }[];
68
68
  prevData?: import("multiformats/cid").CID | undefined;
@@ -75,8 +75,8 @@ export declare const commitEvt: z.ZodObject<{
75
75
  rebase: boolean;
76
76
  tooBig: boolean;
77
77
  ops: {
78
- action: "create" | "delete" | "update";
79
78
  path: string;
79
+ action: "create" | "delete" | "update";
80
80
  cid?: unknown;
81
81
  prev?: unknown;
82
82
  }[];
@@ -30,7 +30,7 @@ const formatSeqCommit = async (did, commitData) => {
30
30
  return {
31
31
  did,
32
32
  eventType: 'append',
33
- event: (0, common_1.cborEncode)((0, common_1.noUndefinedVals)(evt)),
33
+ event: (0, common_1.cborEncode)(evt),
34
34
  sequencedAt: new Date().toISOString(),
35
35
  };
36
36
  };
@@ -1 +1 @@
1
- {"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/sequencer/events.ts"],"names":[],"mappings":";AAAA,yCAAyC;;;;;;AAEzC,8DAAgC;AAChC,6BAAuB;AACvB,4CAAqE;AACrE,wCAAyD;AACzD,wEAAkE;AAI3D,MAAM,eAAe,GAAG,KAAK,EAClC,GAAW,EACX,UAA6B,EACL,EAAE;IAC1B,MAAM,YAAY,GAAG,IAAI,eAAQ,EAAE,CAAA;IACnC,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAA;IACzC,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC,cAAc,CAAC,CAAA;IAE9C,MAAM,GAAG,GAAG;QACV,IAAI,EAAE,GAAG;QACT,MAAM,EAAE,UAAU,CAAC,GAAG;QACtB,GAAG,EAAE,UAAU,CAAC,GAAG;QACnB,KAAK,EAAE,UAAU,CAAC,KAAK;QACvB,MAAM,EAAE,MAAM,IAAA,sBAAe,EAAC,UAAU,CAAC,GAAG,EAAE,YAAY,CAAC;QAC3D,GAAG,EAAE,UAAU,CAAC,GAAG;QACnB,QAAQ,EAAE,UAAU,CAAC,QAAQ,IAAI,SAAS;QAC1C,yCAAyC;QACzC,MAAM,EAAE,KAAK;QACb,MAAM,EAAE,KAAK;QACb,KAAK,EAAE,EAAE;KACV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, noUndefinedVals, schema } from '@atproto/common'\nimport { BlockMap, blocksToCarFile } from '@atproto/repo'\nimport { AccountStatus } from '../account-manager/account-manager'\nimport { CommitDataWithOps, SyncEvtData } from '../repo'\nimport { RepoSeqInsert } from './db'\n\nexport const formatSeqCommit = async (\n did: string,\n commitData: CommitDataWithOps,\n): Promise<RepoSeqInsert> => {\n const blocksToSend = new BlockMap()\n blocksToSend.addMap(commitData.newBlocks)\n blocksToSend.addMap(commitData.relevantBlocks)\n\n const evt = {\n repo: did,\n commit: commitData.cid,\n rev: commitData.rev,\n since: commitData.since,\n blocks: await blocksToCarFile(commitData.cid, blocksToSend),\n ops: commitData.ops,\n prevData: commitData.prevData ?? undefined,\n // deprecated (but still required) fields\n rebase: false,\n tooBig: false,\n blobs: [],\n }\n\n return {\n did,\n eventType: 'append' as const,\n event: cborEncode(noUndefinedVals(evt)),\n sequencedAt: new Date().toISOString(),\n }\n}\n\nexport const formatSeqSyncEvt = async (\n did: string,\n data: SyncEvtData,\n): Promise<RepoSeqInsert> => {\n const blocks = await blocksToCarFile(data.cid, data.blocks)\n const evt: SyncEvt = {\n did,\n rev: data.rev,\n blocks,\n }\n return {\n did,\n eventType: 'sync',\n event: cborEncode(evt),\n sequencedAt: new Date().toISOString(),\n }\n}\n\nexport const syncEvtDataFromCommit = (\n commitData: CommitDataWithOps,\n): SyncEvtData => {\n const { blocks, missing } = commitData.relevantBlocks.getMany([\n commitData.cid,\n ])\n assert(\n !missing.length,\n 'commit block was not found, could not build sync event',\n )\n return {\n rev: commitData.rev,\n cid: commitData.cid,\n blocks,\n }\n}\n\nexport const formatSeqIdentityEvt = async (\n did: string,\n handle?: string,\n): Promise<RepoSeqInsert> => {\n const evt: IdentityEvt = {\n did,\n }\n if (handle) {\n evt.handle = handle\n }\n return {\n did,\n eventType: 'identity',\n event: cborEncode(evt),\n sequencedAt: new Date().toISOString(),\n }\n}\n\nexport const formatSeqAccountEvt = async (\n did: string,\n status: AccountStatus,\n): Promise<RepoSeqInsert> => {\n const evt: AccountEvt = {\n did,\n active: status === 'active',\n }\n if (status !== AccountStatus.Active) {\n evt.status = status\n }\n\n return {\n did,\n eventType: 'account',\n event: cborEncode(evt),\n sequencedAt: new Date().toISOString(),\n }\n}\n\nexport const commitEvtOp = z.object({\n action: z.union([\n z.literal('create'),\n z.literal('update'),\n z.literal('delete'),\n ]),\n path: z.string(),\n cid: schema.cid.nullable(),\n prev: schema.cid.optional(),\n})\nexport type CommitEvtOp = z.infer<typeof commitEvtOp>\n\nexport const commitEvt = z.object({\n rebase: z.boolean(),\n tooBig: z.boolean(),\n repo: z.string(),\n commit: schema.cid,\n rev: z.string(),\n since: z.string().nullable(),\n blocks: schema.bytes,\n ops: z.array(commitEvtOp),\n blobs: z.array(schema.cid),\n prevData: schema.cid.optional(),\n})\nexport type CommitEvt = z.infer<typeof commitEvt>\n\nexport const syncEvt = z.object({\n did: z.string(),\n blocks: schema.bytes,\n rev: z.string(),\n})\nexport type SyncEvt = z.infer<typeof syncEvt>\n\nexport const identityEvt = z.object({\n did: z.string(),\n handle: z.string().optional(),\n})\nexport type IdentityEvt = z.infer<typeof identityEvt>\n\nexport const accountEvt = z.object({\n did: z.string(),\n active: z.boolean(),\n status: z\n .enum([\n AccountStatus.Takendown,\n AccountStatus.Suspended,\n AccountStatus.Deleted,\n AccountStatus.Deactivated,\n ])\n .optional(),\n})\nexport type AccountEvt = z.infer<typeof accountEvt>\n\ntype TypedCommitEvt = {\n type: 'commit'\n seq: number\n time: string\n evt: CommitEvt\n}\ntype TypedSyncEvt = {\n type: 'sync'\n seq: number\n time: string\n evt: SyncEvt\n}\ntype TypedIdentityEvt = {\n type: 'identity'\n seq: number\n time: string\n evt: IdentityEvt\n}\ntype TypedAccountEvt = {\n type: 'account'\n seq: number\n time: string\n evt: AccountEvt\n}\nexport type SeqEvt =\n | TypedCommitEvt\n | TypedSyncEvt\n | TypedIdentityEvt\n | TypedAccountEvt\n"]}
1
+ {"version":3,"file":"events.js","sourceRoot":"","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AGW,QAAA,OAAO,GAAG,OAAC,CAAC,MAAM,CAAC;IAC9B,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE;IACf,MAAM,EAAE,eAAM,CAAC,KAAK;IACpB,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE;CAChB,CAAC,CAAA;AAGW,QAAA,WAAW,GAAG,OAAC,CAAC,MAAM,CAAC;IAClC,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE;IACf,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC9B,CAAC,CAAA;AAGW,QAAA,UAAU,GAAG,OAAC,CAAC,MAAM,CAAC;IACjC,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE;IACf,MAAM,EAAE,OAAC,CAAC,OAAO,EAAE;IACnB,MAAM,EAAE,OAAC;SACN,IAAI,CAAC;QACJ,+BAAa,CAAC,SAAS;QACvB,+BAAa,CAAC,SAAS;QACvB,+BAAa,CAAC,OAAO;QACrB,+BAAa,CAAC,WAAW;KAC1B,CAAC;SACD,QAAQ,EAAE;CACd,CAAC,CAAA","sourcesContent":["/* eslint-disable import/no-deprecated */\n\nimport assert from 'node:assert'\nimport { z } from 'zod'\nimport { cborEncode, schema } from '@atproto/common'\nimport { BlockMap, blocksToCarFile } from '@atproto/repo'\nimport { AccountStatus } from '../account-manager/account-manager'\nimport { CommitDataWithOps, SyncEvtData } from '../repo'\nimport { RepoSeqInsert } from './db'\n\nexport const formatSeqCommit = async (\n did: string,\n commitData: CommitDataWithOps,\n): Promise<RepoSeqInsert> => {\n const blocksToSend = new BlockMap()\n blocksToSend.addMap(commitData.newBlocks)\n blocksToSend.addMap(commitData.relevantBlocks)\n\n const evt = {\n repo: did,\n commit: commitData.cid,\n rev: commitData.rev,\n since: commitData.since,\n blocks: await blocksToCarFile(commitData.cid, blocksToSend),\n ops: commitData.ops,\n prevData: commitData.prevData ?? undefined,\n // deprecated (but still required) fields\n rebase: false,\n tooBig: false,\n blobs: [],\n }\n\n return {\n did,\n eventType: 'append' as const,\n event: cborEncode(evt),\n sequencedAt: new Date().toISOString(),\n }\n}\n\nexport const formatSeqSyncEvt = async (\n did: string,\n data: SyncEvtData,\n): Promise<RepoSeqInsert> => {\n const blocks = await blocksToCarFile(data.cid, data.blocks)\n const evt: SyncEvt = {\n did,\n rev: data.rev,\n blocks,\n }\n return {\n did,\n eventType: 'sync',\n event: cborEncode(evt),\n sequencedAt: new Date().toISOString(),\n }\n}\n\nexport const syncEvtDataFromCommit = (\n commitData: CommitDataWithOps,\n): SyncEvtData => {\n const { blocks, missing } = commitData.relevantBlocks.getMany([\n commitData.cid,\n ])\n assert(\n !missing.length,\n 'commit block was not found, could not build sync event',\n )\n return {\n rev: commitData.rev,\n cid: commitData.cid,\n blocks,\n }\n}\n\nexport const formatSeqIdentityEvt = async (\n did: string,\n handle?: string,\n): Promise<RepoSeqInsert> => {\n const evt: IdentityEvt = {\n did,\n }\n if (handle) {\n evt.handle = handle\n }\n return {\n did,\n eventType: 'identity',\n event: cborEncode(evt),\n sequencedAt: new Date().toISOString(),\n }\n}\n\nexport const formatSeqAccountEvt = async (\n did: string,\n status: AccountStatus,\n): Promise<RepoSeqInsert> => {\n const evt: AccountEvt = {\n did,\n active: status === 'active',\n }\n if (status !== AccountStatus.Active) {\n evt.status = status\n }\n\n return {\n did,\n eventType: 'account',\n event: cborEncode(evt),\n sequencedAt: new Date().toISOString(),\n }\n}\n\nexport const commitEvtOp = z.object({\n action: z.union([\n z.literal('create'),\n z.literal('update'),\n z.literal('delete'),\n ]),\n path: z.string(),\n cid: schema.cid.nullable(),\n prev: schema.cid.optional(),\n})\nexport type CommitEvtOp = z.infer<typeof commitEvtOp>\n\nexport const commitEvt = z.object({\n rebase: z.boolean(),\n tooBig: z.boolean(),\n repo: z.string(),\n commit: schema.cid,\n rev: z.string(),\n since: z.string().nullable(),\n blocks: schema.bytes,\n ops: z.array(commitEvtOp),\n blobs: z.array(schema.cid),\n prevData: schema.cid.optional(),\n})\nexport type CommitEvt = z.infer<typeof commitEvt>\n\nexport const syncEvt = z.object({\n did: z.string(),\n blocks: schema.bytes,\n rev: z.string(),\n})\nexport type SyncEvt = z.infer<typeof syncEvt>\n\nexport const identityEvt = z.object({\n did: z.string(),\n handle: z.string().optional(),\n})\nexport type IdentityEvt = z.infer<typeof identityEvt>\n\nexport const accountEvt = z.object({\n did: z.string(),\n active: z.boolean(),\n status: z\n .enum([\n AccountStatus.Takendown,\n AccountStatus.Suspended,\n AccountStatus.Deleted,\n AccountStatus.Deactivated,\n ])\n .optional(),\n})\nexport type AccountEvt = z.infer<typeof accountEvt>\n\ntype TypedCommitEvt = {\n type: 'commit'\n seq: number\n time: string\n evt: CommitEvt\n}\ntype TypedSyncEvt = {\n type: 'sync'\n seq: number\n time: string\n evt: SyncEvt\n}\ntype TypedIdentityEvt = {\n type: 'identity'\n seq: number\n time: string\n evt: IdentityEvt\n}\ntype TypedAccountEvt = {\n type: 'account'\n seq: number\n time: string\n evt: AccountEvt\n}\nexport type SeqEvt =\n | TypedCommitEvt\n | TypedSyncEvt\n | TypedIdentityEvt\n | TypedAccountEvt\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atproto/pds",
3
- "version": "0.4.204",
3
+ "version": "0.4.205",
4
4
  "license": "MIT",
5
5
  "description": "Reference implementation of atproto Personal Data Server (PDS)",
6
6
  "keywords": [
@@ -42,7 +42,6 @@
42
42
  "p-queue": "^6.6.2",
43
43
  "pino": "^8.21.0",
44
44
  "pino-http": "^8.2.1",
45
- "sharp": "^0.33.5",
46
45
  "typed-emitter": "^2.1.0",
47
46
  "uint8arrays": "3.0.0",
48
47
  "undici": "^6.19.8",
@@ -52,20 +51,20 @@
52
51
  "@atproto-labs/simple-store-memory": "0.1.4",
53
52
  "@atproto-labs/simple-store-redis": "0.0.1",
54
53
  "@atproto-labs/xrpc-utils": "0.0.24",
55
- "@atproto/api": "^0.18.14",
54
+ "@atproto/api": "^0.18.17",
56
55
  "@atproto/aws": "^0.2.31",
57
- "@atproto/common": "^0.5.8",
56
+ "@atproto/common": "^0.5.9",
58
57
  "@atproto/crypto": "^0.4.5",
59
58
  "@atproto/identity": "^0.4.10",
60
- "@atproto/lex-cbor": "^0.0.8",
61
- "@atproto/lex-data": "^0.0.8",
62
- "@atproto/lexicon": "^0.6.0",
63
- "@atproto/oauth-provider": "^0.15.4",
59
+ "@atproto/lex-cbor": "^0.0.9",
60
+ "@atproto/lex-data": "^0.0.9",
61
+ "@atproto/lexicon": "^0.6.1",
62
+ "@atproto/oauth-provider": "^0.15.5",
64
63
  "@atproto/oauth-scopes": "^0.3.0",
65
64
  "@atproto/repo": "^0.8.12",
66
- "@atproto/syntax": "^0.4.2",
65
+ "@atproto/syntax": "^0.4.3",
67
66
  "@atproto/xrpc": "^0.7.7",
68
- "@atproto/xrpc-server": "^0.10.9"
67
+ "@atproto/xrpc-server": "^0.10.10"
69
68
  },
70
69
  "devDependencies": {
71
70
  "@atproto/pds-entryway": "npm:@atproto/pds@0.3.0-entryway.3",
@@ -83,8 +82,8 @@
83
82
  "ts-node": "^10.8.2",
84
83
  "typescript": "^5.6.3",
85
84
  "ws": "^8.12.0",
86
- "@atproto/api": "^0.18.14",
87
- "@atproto/bsky": "^0.0.210",
85
+ "@atproto/api": "^0.18.17",
86
+ "@atproto/bsky": "^0.0.211",
88
87
  "@atproto/lex-cli": "^0.9.8",
89
88
  "@atproto/oauth-client-browser-example": "0.0.9"
90
89
  },
@@ -17,7 +17,6 @@ import { BlobNotFoundError, BlobStore, WriteOpAction } from '@atproto/repo'
17
17
  import { AtUri } from '@atproto/syntax'
18
18
  import { InvalidRequestError } from '@atproto/xrpc-server'
19
19
  import { BackgroundQueue } from '../../background'
20
- import * as img from '../../image'
21
20
  import { StatusAttr } from '../../lexicon/types/com/atproto/admin/defs'
22
21
  import { blobStoreLogger as log } from '../../logger'
23
22
  import { PreparedBlobRef, PreparedWrite } from '../../repo/types'
@@ -29,8 +28,6 @@ export type BlobMetadata = {
29
28
  size: number
30
29
  cid: CID
31
30
  mimeType: string
32
- width: number | null
33
- height: number | null
34
31
  }
35
32
 
36
33
  export class BlobTransactor extends BlobReader {
@@ -61,11 +58,10 @@ export class BlobTransactor extends BlobReader {
61
58
  userSuggestedMime: string,
62
59
  blobStream: stream.Readable,
63
60
  ): Promise<BlobMetadata> {
64
- const [tempKey, size, sha256, imgInfo, sniffedMime] = await Promise.all([
61
+ const [tempKey, size, sha256, sniffedMime] = await Promise.all([
65
62
  this.blobstore.putTemp(cloneStream(blobStream)),
66
63
  streamSize(cloneStream(blobStream)),
67
64
  sha256Stream(cloneStream(blobStream)),
68
- img.maybeGetInfo(cloneStream(blobStream)),
69
65
  mimeTypeFromStream(cloneStream(blobStream)),
70
66
  ])
71
67
 
@@ -77,13 +73,11 @@ export class BlobTransactor extends BlobReader {
77
73
  size,
78
74
  cid,
79
75
  mimeType,
80
- width: imgInfo?.width ?? null,
81
- height: imgInfo?.height ?? null,
82
76
  }
83
77
  }
84
78
 
85
79
  async trackUntetheredBlob(metadata: BlobMetadata) {
86
- const { tempKey, size, cid, mimeType, width, height } = metadata
80
+ const { tempKey, size, cid, mimeType } = metadata
87
81
  const found = await this.db.db
88
82
  .selectFrom('blob')
89
83
  .selectAll()
@@ -100,8 +94,6 @@ export class BlobTransactor extends BlobReader {
100
94
  mimeType,
101
95
  size,
102
96
  tempKey,
103
- width,
104
- height,
105
97
  createdAt: new Date().toISOString(),
106
98
  })
107
99
  .onConflict((oc) =>
@@ -3,8 +3,8 @@ export interface Blob {
3
3
  mimeType: string
4
4
  size: number
5
5
  tempKey: string | null
6
- width: number | null
7
- height: number | null
6
+ // width: number | null // @TODO: actually drop these columns from the db
7
+ // height: number | null
8
8
  createdAt: string
9
9
  takedownRef: string | null
10
10
  }
@@ -31,6 +31,10 @@ import * as AppBskyContactRemoveData from './types/app/bsky/contact/removeData.j
31
31
  import * as AppBskyContactSendNotification from './types/app/bsky/contact/sendNotification.js'
32
32
  import * as AppBskyContactStartPhoneVerification from './types/app/bsky/contact/startPhoneVerification.js'
33
33
  import * as AppBskyContactVerifyPhone from './types/app/bsky/contact/verifyPhone.js'
34
+ import * as AppBskyDraftCreateDraft from './types/app/bsky/draft/createDraft.js'
35
+ import * as AppBskyDraftDeleteDraft from './types/app/bsky/draft/deleteDraft.js'
36
+ import * as AppBskyDraftGetDrafts from './types/app/bsky/draft/getDrafts.js'
37
+ import * as AppBskyDraftUpdateDraft from './types/app/bsky/draft/updateDraft.js'
34
38
  import * as AppBskyFeedDescribeFeedGenerator from './types/app/bsky/feed/describeFeedGenerator.js'
35
39
  import * as AppBskyFeedGetActorFeeds from './types/app/bsky/feed/getActorFeeds.js'
36
40
  import * as AppBskyFeedGetActorLikes from './types/app/bsky/feed/getActorLikes.js'
@@ -406,6 +410,7 @@ export class AppBskyNS {
406
410
  ageassurance: AppBskyAgeassuranceNS
407
411
  bookmark: AppBskyBookmarkNS
408
412
  contact: AppBskyContactNS
413
+ draft: AppBskyDraftNS
409
414
  embed: AppBskyEmbedNS
410
415
  feed: AppBskyFeedNS
411
416
  graph: AppBskyGraphNS
@@ -421,6 +426,7 @@ export class AppBskyNS {
421
426
  this.ageassurance = new AppBskyAgeassuranceNS(server)
422
427
  this.bookmark = new AppBskyBookmarkNS(server)
423
428
  this.contact = new AppBskyContactNS(server)
429
+ this.draft = new AppBskyDraftNS(server)
424
430
  this.embed = new AppBskyEmbedNS(server)
425
431
  this.feed = new AppBskyFeedNS(server)
426
432
  this.graph = new AppBskyGraphNS(server)
@@ -716,6 +722,62 @@ export class AppBskyContactNS {
716
722
  }
717
723
  }
718
724
 
725
+ export class AppBskyDraftNS {
726
+ _server: Server
727
+
728
+ constructor(server: Server) {
729
+ this._server = server
730
+ }
731
+
732
+ createDraft<A extends Auth = void>(
733
+ cfg: MethodConfigOrHandler<
734
+ A,
735
+ AppBskyDraftCreateDraft.QueryParams,
736
+ AppBskyDraftCreateDraft.HandlerInput,
737
+ AppBskyDraftCreateDraft.HandlerOutput
738
+ >,
739
+ ) {
740
+ const nsid = 'app.bsky.draft.createDraft' // @ts-ignore
741
+ return this._server.xrpc.method(nsid, cfg)
742
+ }
743
+
744
+ deleteDraft<A extends Auth = void>(
745
+ cfg: MethodConfigOrHandler<
746
+ A,
747
+ AppBskyDraftDeleteDraft.QueryParams,
748
+ AppBskyDraftDeleteDraft.HandlerInput,
749
+ AppBskyDraftDeleteDraft.HandlerOutput
750
+ >,
751
+ ) {
752
+ const nsid = 'app.bsky.draft.deleteDraft' // @ts-ignore
753
+ return this._server.xrpc.method(nsid, cfg)
754
+ }
755
+
756
+ getDrafts<A extends Auth = void>(
757
+ cfg: MethodConfigOrHandler<
758
+ A,
759
+ AppBskyDraftGetDrafts.QueryParams,
760
+ AppBskyDraftGetDrafts.HandlerInput,
761
+ AppBskyDraftGetDrafts.HandlerOutput
762
+ >,
763
+ ) {
764
+ const nsid = 'app.bsky.draft.getDrafts' // @ts-ignore
765
+ return this._server.xrpc.method(nsid, cfg)
766
+ }
767
+
768
+ updateDraft<A extends Auth = void>(
769
+ cfg: MethodConfigOrHandler<
770
+ A,
771
+ AppBskyDraftUpdateDraft.QueryParams,
772
+ AppBskyDraftUpdateDraft.HandlerInput,
773
+ AppBskyDraftUpdateDraft.HandlerOutput
774
+ >,
775
+ ) {
776
+ const nsid = 'app.bsky.draft.updateDraft' // @ts-ignore
777
+ return this._server.xrpc.method(nsid, cfg)
778
+ }
779
+ }
780
+
719
781
  export class AppBskyEmbedNS {
720
782
  _server: Server
721
783