@atproto/pds 0.4.145 → 0.4.147

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 (42) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/config/config.d.ts +0 -1
  3. package/dist/config/config.d.ts.map +1 -1
  4. package/dist/config/config.js +0 -1
  5. package/dist/config/config.js.map +1 -1
  6. package/dist/context.d.ts +0 -3
  7. package/dist/context.d.ts.map +1 -1
  8. package/dist/context.js +0 -30
  9. package/dist/context.js.map +1 -1
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +19 -6
  12. package/dist/index.js.map +1 -1
  13. package/dist/lexicon/index.d.ts +4 -0
  14. package/dist/lexicon/index.d.ts.map +1 -1
  15. package/dist/lexicon/index.js +8 -0
  16. package/dist/lexicon/index.js.map +1 -1
  17. package/dist/lexicon/lexicons.d.ts +418 -0
  18. package/dist/lexicon/lexicons.d.ts.map +1 -1
  19. package/dist/lexicon/lexicons.js +225 -0
  20. package/dist/lexicon/lexicons.js.map +1 -1
  21. package/dist/lexicon/types/app/bsky/notification/defs.d.ts +40 -0
  22. package/dist/lexicon/types/app/bsky/notification/defs.d.ts.map +1 -1
  23. package/dist/lexicon/types/app/bsky/notification/defs.js +36 -0
  24. package/dist/lexicon/types/app/bsky/notification/defs.js.map +1 -1
  25. package/dist/lexicon/types/app/bsky/notification/getPreferences.d.ts +35 -0
  26. package/dist/lexicon/types/app/bsky/notification/getPreferences.d.ts.map +1 -0
  27. package/dist/lexicon/types/app/bsky/notification/getPreferences.js +7 -0
  28. package/dist/lexicon/types/app/bsky/notification/getPreferences.js.map +1 -0
  29. package/dist/lexicon/types/app/bsky/notification/putPreferencesV2.d.ts +52 -0
  30. package/dist/lexicon/types/app/bsky/notification/putPreferencesV2.d.ts.map +1 -0
  31. package/dist/lexicon/types/app/bsky/notification/putPreferencesV2.js +7 -0
  32. package/dist/lexicon/types/app/bsky/notification/putPreferencesV2.js.map +1 -0
  33. package/package.json +8 -8
  34. package/src/config/config.ts +0 -2
  35. package/src/context.ts +0 -31
  36. package/src/index.ts +24 -13
  37. package/src/lexicon/index.ts +24 -0
  38. package/src/lexicon/lexicons.ts +227 -0
  39. package/src/lexicon/types/app/bsky/notification/defs.ts +76 -0
  40. package/src/lexicon/types/app/bsky/notification/getPreferences.ts +52 -0
  41. package/src/lexicon/types/app/bsky/notification/putPreferencesV2.ts +69 -0
  42. package/tsconfig.build.tsbuildinfo +1 -1
@@ -7,4 +7,44 @@ export interface RecordDeleted {
7
7
  }
8
8
  export declare function isRecordDeleted<V>(v: V): v is import("../../../../util").$TypedObject<V, "app.bsky.notification.defs", "recordDeleted">;
9
9
  export declare function validateRecordDeleted<V>(v: V): ValidationResult<RecordDeleted & V>;
10
+ export interface ChatPreference {
11
+ $type?: 'app.bsky.notification.defs#chatPreference';
12
+ filter: 'all' | 'accepted' | (string & {});
13
+ push: boolean;
14
+ }
15
+ export declare function isChatPreference<V>(v: V): v is import("../../../../util").$TypedObject<V, "app.bsky.notification.defs", "chatPreference">;
16
+ export declare function validateChatPreference<V>(v: V): ValidationResult<ChatPreference & V>;
17
+ export interface FilterablePreference {
18
+ $type?: 'app.bsky.notification.defs#filterablePreference';
19
+ filter: 'all' | 'follows' | (string & {});
20
+ list: boolean;
21
+ push: boolean;
22
+ }
23
+ export declare function isFilterablePreference<V>(v: V): v is import("../../../../util").$TypedObject<V, "app.bsky.notification.defs", "filterablePreference">;
24
+ export declare function validateFilterablePreference<V>(v: V): ValidationResult<FilterablePreference & V>;
25
+ export interface Preference {
26
+ $type?: 'app.bsky.notification.defs#preference';
27
+ list: boolean;
28
+ push: boolean;
29
+ }
30
+ export declare function isPreference<V>(v: V): v is import("../../../../util").$TypedObject<V, "app.bsky.notification.defs", "preference">;
31
+ export declare function validatePreference<V>(v: V): ValidationResult<Preference & V>;
32
+ export interface Preferences {
33
+ $type?: 'app.bsky.notification.defs#preferences';
34
+ chat: ChatPreference;
35
+ follow: FilterablePreference;
36
+ like: FilterablePreference;
37
+ likeViaRepost: FilterablePreference;
38
+ mention: FilterablePreference;
39
+ quote: FilterablePreference;
40
+ reply: FilterablePreference;
41
+ repost: FilterablePreference;
42
+ repostViaRepost: FilterablePreference;
43
+ starterpackJoined: Preference;
44
+ subscribedPost: Preference;
45
+ unverified: Preference;
46
+ verified: Preference;
47
+ }
48
+ export declare function isPreferences<V>(v: V): v is import("../../../../util").$TypedObject<V, "app.bsky.notification.defs", "preferences">;
49
+ export declare function validatePreferences<V>(v: V): ValidationResult<Preferences & V>;
10
50
  //# sourceMappingURL=defs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"defs.d.ts","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/notification/defs.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,KAAK,gBAAgB,EAAW,MAAM,kBAAkB,CAAA;AAajE,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,EAAE,0CAA0C,CAAA;CACnD;AAID,wBAAgB,eAAe,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,kGAEtC;AAED,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,uCAE5C"}
1
+ {"version":3,"file":"defs.d.ts","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/notification/defs.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,KAAK,gBAAgB,EAAW,MAAM,kBAAkB,CAAA;AAajE,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,EAAE,0CAA0C,CAAA;CACnD;AAID,wBAAgB,eAAe,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,kGAEtC;AAED,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,uCAE5C;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,2CAA2C,CAAA;IACnD,MAAM,EAAE,KAAK,GAAG,UAAU,GAAG,CAAC,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AE,UAAU,CAAA;IACtB,QAAQ,EAAE,UAAU,CAAA;CACrB;AAID,wBAAgB,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,gGAEpC;AAED,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,qCAE1C"}
@@ -2,6 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isRecordDeleted = isRecordDeleted;
4
4
  exports.validateRecordDeleted = validateRecordDeleted;
5
+ exports.isChatPreference = isChatPreference;
6
+ exports.validateChatPreference = validateChatPreference;
7
+ exports.isFilterablePreference = isFilterablePreference;
8
+ exports.validateFilterablePreference = validateFilterablePreference;
9
+ exports.isPreference = isPreference;
10
+ exports.validatePreference = validatePreference;
11
+ exports.isPreferences = isPreferences;
12
+ exports.validatePreferences = validatePreferences;
5
13
  const lexicons_1 = require("../../../../lexicons");
6
14
  const util_1 = require("../../../../util");
7
15
  const is$typed = util_1.is$typed, validate = lexicons_1.validate;
@@ -13,4 +21,32 @@ function isRecordDeleted(v) {
13
21
  function validateRecordDeleted(v) {
14
22
  return validate(v, id, hashRecordDeleted);
15
23
  }
24
+ const hashChatPreference = 'chatPreference';
25
+ function isChatPreference(v) {
26
+ return is$typed(v, id, hashChatPreference);
27
+ }
28
+ function validateChatPreference(v) {
29
+ return validate(v, id, hashChatPreference);
30
+ }
31
+ const hashFilterablePreference = 'filterablePreference';
32
+ function isFilterablePreference(v) {
33
+ return is$typed(v, id, hashFilterablePreference);
34
+ }
35
+ function validateFilterablePreference(v) {
36
+ return validate(v, id, hashFilterablePreference);
37
+ }
38
+ const hashPreference = 'preference';
39
+ function isPreference(v) {
40
+ return is$typed(v, id, hashPreference);
41
+ }
42
+ function validatePreference(v) {
43
+ return validate(v, id, hashPreference);
44
+ }
45
+ const hashPreferences = 'preferences';
46
+ function isPreferences(v) {
47
+ return is$typed(v, id, hashPreferences);
48
+ }
49
+ function validatePreferences(v) {
50
+ return validate(v, id, hashPreferences);
51
+ }
16
52
  //# sourceMappingURL=defs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"defs.js","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/notification/defs.ts"],"names":[],"mappings":";;AAsBA,0CAEC;AAED,sDAEC;AAvBD,mDAA4D;AAC5D,2CAIyB;AAEzB,MAAM,QAAQ,GAAG,eAAS,EACxB,QAAQ,GAAG,mBAAS,CAAA;AACtB,MAAM,EAAE,GAAG,4BAA4B,CAAA;AAMvC,MAAM,iBAAiB,GAAG,eAAe,CAAA;AAEzC,SAAgB,eAAe,CAAI,CAAI;IACrC,OAAO,QAAQ,CAAC,CAAC,EAAE,EAAE,EAAE,iBAAiB,CAAC,CAAA;AAC3C,CAAC;AAED,SAAgB,qBAAqB,CAAI,CAAI;IAC3C,OAAO,QAAQ,CAAoB,CAAC,EAAE,EAAE,EAAE,iBAAiB,CAAC,CAAA;AAC9D,CAAC"}
1
+ {"version":3,"file":"defs.js","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/notification/defs.ts"],"names":[],"mappings":";;AAsBA,0CAEC;AAED,sDAEC;AAUD,4CAEC;AAED,wDAEC;AAWD,wDAEC;AAED,oEAEC;AAUD,oCAEC;AAED,gDAEC;AAqBD,sCAEC;AAED,kDAEC;AAnGD,mDAA4D;AAC5D,2CAIyB;AAEzB,MAAM,QAAQ,GAAG,eAAS,EACxB,QAAQ,GAAG,mBAAS,CAAA;AACtB,MAAM,EAAE,GAAG,4BAA4B,CAAA;AAMvC,MAAM,iBAAiB,GAAG,eAAe,CAAA;AAEzC,SAAgB,eAAe,CAAI,CAAI;IACrC,OAAO,QAAQ,CAAC,CAAC,EAAE,EAAE,EAAE,iBAAiB,CAAC,CAAA;AAC3C,CAAC;AAED,SAAgB,qBAAqB,CAAI,CAAI;IAC3C,OAAO,QAAQ,CAAoB,CAAC,EAAE,EAAE,EAAE,iBAAiB,CAAC,CAAA;AAC9D,CAAC;AAQD,MAAM,kBAAkB,GAAG,gBAAgB,CAAA;AAE3C,SAAgB,gBAAgB,CAAI,CAAI;IACtC,OAAO,QAAQ,CAAC,CAAC,EAAE,EAAE,EAAE,kBAAkB,CAAC,CAAA;AAC5C,CAAC;AAED,SAAgB,sBAAsB,CAAI,CAAI;IAC5C,OAAO,QAAQ,CAAqB,CAAC,EAAE,EAAE,EAAE,kBAAkB,CAAC,CAAA;AAChE,CAAC;AASD,MAAM,wBAAwB,GAAG,sBAAsB,CAAA;AAEvD,SAAgB,sBAAsB,CAAI,CAAI;IAC5C,OAAO,QAAQ,CAAC,CAAC,EAAE,EAAE,EAAE,wBAAwB,CAAC,CAAA;AAClD,CAAC;AAED,SAAgB,4BAA4B,CAAI,CAAI;IAClD,OAAO,QAAQ,CAA2B,CAAC,EAAE,EAAE,EAAE,wBAAwB,CAAC,CAAA;AAC5E,CAAC;AAQD,MAAM,cAAc,GAAG,YAAY,CAAA;AAEnC,SAAgB,YAAY,CAAI,CAAI;IAClC,OAAO,QAAQ,CAAC,CAAC,EAAE,EAAE,EAAE,cAAc,CAAC,CAAA;AACxC,CAAC;AAED,SAAgB,kBAAkB,CAAI,CAAI;IACxC,OAAO,QAAQ,CAAiB,CAAC,EAAE,EAAE,EAAE,cAAc,CAAC,CAAA;AACxD,CAAC;AAmBD,MAAM,eAAe,GAAG,aAAa,CAAA;AAErC,SAAgB,aAAa,CAAI,CAAI;IACnC,OAAO,QAAQ,CAAC,CAAC,EAAE,EAAE,EAAE,eAAe,CAAC,CAAA;AACzC,CAAC;AAED,SAAgB,mBAAmB,CAAI,CAAI;IACzC,OAAO,QAAQ,CAAkB,CAAC,EAAE,EAAE,EAAE,eAAe,CAAC,CAAA;AAC1D,CAAC"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * GENERATED CODE - DO NOT MODIFY
3
+ */
4
+ import express from 'express';
5
+ import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server';
6
+ import type * as AppBskyNotificationDefs from './defs.js';
7
+ export interface QueryParams {
8
+ }
9
+ export type InputSchema = undefined;
10
+ export interface OutputSchema {
11
+ preferences: AppBskyNotificationDefs.Preferences;
12
+ }
13
+ export type HandlerInput = undefined;
14
+ export interface HandlerSuccess {
15
+ encoding: 'application/json';
16
+ body: OutputSchema;
17
+ headers?: {
18
+ [key: string]: string;
19
+ };
20
+ }
21
+ export interface HandlerError {
22
+ status: number;
23
+ message?: string;
24
+ }
25
+ export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough;
26
+ export type HandlerReqCtx<HA extends HandlerAuth = never> = {
27
+ auth: HA;
28
+ params: QueryParams;
29
+ input: HandlerInput;
30
+ req: express.Request;
31
+ res: express.Response;
32
+ resetRouteRateLimits: () => Promise<void>;
33
+ };
34
+ export type Handler<HA extends HandlerAuth = never> = (ctx: HandlerReqCtx<HA>) => Promise<HandlerOutput> | HandlerOutput;
35
+ //# sourceMappingURL=getPreferences.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getPreferences.d.ts","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/notification/getPreferences.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,OAAO,MAAM,SAAS,CAAA;AAS7B,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AACtE,OAAO,KAAK,KAAK,uBAAuB,MAAM,WAAW,CAAA;AAMzD,MAAM,WAAW,WAAW;CAAG;AAE/B,MAAM,MAAM,WAAW,GAAG,SAAS,CAAA;AAEnC,MAAM,WAAW,YAAY;IAC3B,WAAW,EAAE,uBAAuB,CAAC,WAAW,CAAA;CACjD;AAED,MAAM,MAAM,YAAY,GAAG,SAAS,CAAA;AAEpC,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,GAAG,kBAAkB,CAAA;AAC9E,MAAM,MAAM,aAAa,CAAC,EAAE,SAAS,WAAW,GAAG,KAAK,IAAI;IAC1D,IAAI,EAAE,EAAE,CAAA;IACR,MAAM,EAAE,WAAW,CAAA;IACnB,KAAK,EAAE,YAAY,CAAA;IACnB,GAAG,EAAE,OAAO,CAAC,OAAO,CAAA;IACpB,GAAG,EAAE,OAAO,CAAC,QAAQ,CAAA;IACrB,oBAAoB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAC1C,CAAA;AACD,MAAM,MAAM,OAAO,CAAC,EAAE,SAAS,WAAW,GAAG,KAAK,IAAI,CACpD,GAAG,EAAE,aAAa,CAAC,EAAE,CAAC,KACnB,OAAO,CAAC,aAAa,CAAC,GAAG,aAAa,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.notification.getPreferences';
7
+ //# sourceMappingURL=getPreferences.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getPreferences.js","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/notification/getPreferences.ts"],"names":[],"mappings":";;AAMA,mDAA4D;AAC5D,2CAIyB;AAIzB,MAAM,QAAQ,GAAG,eAAS,EACxB,QAAQ,GAAG,mBAAS,CAAA;AACtB,MAAM,EAAE,GAAG,sCAAsC,CAAA"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * GENERATED CODE - DO NOT MODIFY
3
+ */
4
+ import express from 'express';
5
+ import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server';
6
+ import type * as AppBskyNotificationDefs from './defs.js';
7
+ export interface QueryParams {
8
+ }
9
+ export interface InputSchema {
10
+ chat?: AppBskyNotificationDefs.ChatPreference;
11
+ follow?: AppBskyNotificationDefs.FilterablePreference;
12
+ like?: AppBskyNotificationDefs.FilterablePreference;
13
+ likeViaRepost?: AppBskyNotificationDefs.FilterablePreference;
14
+ mention?: AppBskyNotificationDefs.FilterablePreference;
15
+ quote?: AppBskyNotificationDefs.FilterablePreference;
16
+ reply?: AppBskyNotificationDefs.FilterablePreference;
17
+ repost?: AppBskyNotificationDefs.FilterablePreference;
18
+ repostViaRepost?: AppBskyNotificationDefs.FilterablePreference;
19
+ starterpackJoined?: AppBskyNotificationDefs.Preference;
20
+ subscribedPost?: AppBskyNotificationDefs.Preference;
21
+ unverified?: AppBskyNotificationDefs.Preference;
22
+ verified?: AppBskyNotificationDefs.Preference;
23
+ }
24
+ export interface OutputSchema {
25
+ preferences: AppBskyNotificationDefs.Preferences;
26
+ }
27
+ export interface HandlerInput {
28
+ encoding: 'application/json';
29
+ body: InputSchema;
30
+ }
31
+ export interface HandlerSuccess {
32
+ encoding: 'application/json';
33
+ body: OutputSchema;
34
+ headers?: {
35
+ [key: string]: string;
36
+ };
37
+ }
38
+ export interface HandlerError {
39
+ status: number;
40
+ message?: string;
41
+ }
42
+ export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough;
43
+ export type HandlerReqCtx<HA extends HandlerAuth = never> = {
44
+ auth: HA;
45
+ params: QueryParams;
46
+ input: HandlerInput;
47
+ req: express.Request;
48
+ res: express.Response;
49
+ resetRouteRateLimits: () => Promise<void>;
50
+ };
51
+ export type Handler<HA extends HandlerAuth = never> = (ctx: HandlerReqCtx<HA>) => Promise<HandlerOutput> | HandlerOutput;
52
+ //# sourceMappingURL=putPreferencesV2.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"putPreferencesV2.d.ts","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/notification/putPreferencesV2.ts"],"names":[],"m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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,GAAG,kBAAkB,CAAA;AAC9E,MAAM,MAAM,aAAa,CAAC,EAAE,SAAS,WAAW,GAAG,KAAK,IAAI;IAC1D,IAAI,EAAE,EAAE,CAAA;IACR,MAAM,EAAE,WAAW,CAAA;IACnB,KAAK,EAAE,YAAY,CAAA;IACnB,GAAG,EAAE,OAAO,CAAC,OAAO,CAAA;IACpB,GAAG,EAAE,OAAO,CAAC,QAAQ,CAAA;IACrB,oBAAoB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAC1C,CAAA;AACD,MAAM,MAAM,OAAO,CAAC,EAAE,SAAS,WAAW,GAAG,KAAK,IAAI,CACpD,GAAG,EAAE,aAAa,CAAC,EAAE,CAAC,KACnB,OAAO,CAAC,aAAa,CAAC,GAAG,aAAa,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.notification.putPreferencesV2';
7
+ //# sourceMappingURL=putPreferencesV2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"putPreferencesV2.js","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/notification/putPreferencesV2.ts"],"names":[],"mappings":";;AAMA,mDAA4D;AAC5D,2CAIyB;AAIzB,MAAM,QAAQ,GAAG,eAAS,EACxB,QAAQ,GAAG,mBAAS,CAAA;AACtB,MAAM,EAAE,GAAG,wCAAwC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atproto/pds",
3
- "version": "0.4.145",
3
+ "version": "0.4.147",
4
4
  "license": "MIT",
5
5
  "description": "Reference implementation of atproto Personal Data Server (PDS)",
6
6
  "keywords": [
@@ -48,18 +48,18 @@
48
48
  "undici": "^6.19.8",
49
49
  "zod": "^3.23.8",
50
50
  "@atproto-labs/fetch-node": "0.1.9",
51
- "@atproto-labs/xrpc-utils": "0.0.15",
52
- "@atproto/api": "^0.15.13",
51
+ "@atproto/api": "^0.15.14",
53
52
  "@atproto/aws": "^0.2.21",
53
+ "@atproto-labs/xrpc-utils": "0.0.16",
54
54
  "@atproto/common": "^0.4.11",
55
55
  "@atproto/crypto": "^0.4.4",
56
56
  "@atproto/identity": "^0.4.8",
57
57
  "@atproto/lexicon": "^0.4.11",
58
- "@atproto/oauth-provider": "^0.8.0",
58
+ "@atproto/oauth-provider": "^0.8.1",
59
59
  "@atproto/repo": "^0.8.1",
60
60
  "@atproto/syntax": "^0.4.0",
61
61
  "@atproto/xrpc": "^0.7.0",
62
- "@atproto/xrpc-server": "^0.7.19"
62
+ "@atproto/xrpc-server": "^0.8.0"
63
63
  },
64
64
  "devDependencies": {
65
65
  "@atproto/pds-entryway": "npm:@atproto/pds@0.3.0-entryway.3",
@@ -77,9 +77,9 @@
77
77
  "ts-node": "^10.8.2",
78
78
  "typescript": "^5.6.3",
79
79
  "ws": "^8.12.0",
80
- "@atproto/api": "^0.15.13",
81
- "@atproto/bsky": "^0.0.156",
82
- "@atproto/dev-env": "^0.3.139",
80
+ "@atproto/api": "^0.15.14",
81
+ "@atproto/bsky": "^0.0.158",
82
+ "@atproto/dev-env": "^0.3.141",
83
83
  "@atproto/lex-cli": "^0.8.2",
84
84
  "@atproto/oauth-client-browser-example": "0.0.4"
85
85
  },
@@ -225,7 +225,6 @@ export const envToCfg = (env: ServerEnvironment): ServerConfig => {
225
225
  const rateLimitsCfg: ServerConfig['rateLimits'] = env.rateLimitsEnabled
226
226
  ? {
227
227
  enabled: true,
228
- mode: redisCfg !== null ? 'redis' : 'memory',
229
228
  bypassKey: env.rateLimitBypassKey,
230
229
  bypassIps: env.rateLimitBypassIps?.map((ipOrCidr) =>
231
230
  ipOrCidr.split('/')[0]?.trim(),
@@ -489,7 +488,6 @@ export type RedisScratchConfig = {
489
488
  export type RateLimitsConfig =
490
489
  | {
491
490
  enabled: true
492
- mode: 'memory' | 'redis'
493
491
  bypassKey?: string
494
492
  bypassIps?: string[]
495
493
  }
package/src/context.ts CHANGED
@@ -17,9 +17,6 @@ import {
17
17
  } from '@atproto/oauth-provider'
18
18
  import { BlobStore } from '@atproto/repo'
19
19
  import {
20
- RateLimiter,
21
- RateLimiterCreator,
22
- RateLimiterOpts,
23
20
  createServiceAuthHeaders,
24
21
  createServiceJwt,
25
22
  } from '@atproto/xrpc-server'
@@ -66,7 +63,6 @@ export type AppContextOptions = {
66
63
  sequencer: Sequencer
67
64
  backgroundQueue: BackgroundQueue
68
65
  redisScratch?: Redis
69
- ratelimitCreator?: RateLimiterCreator
70
66
  crawlers: Crawlers
71
67
  bskyAppView?: BskyAppView
72
68
  moderationAgent?: AtpAgent
@@ -94,7 +90,6 @@ export class AppContext {
94
90
  public sequencer: Sequencer
95
91
  public backgroundQueue: BackgroundQueue
96
92
  public redisScratch?: Redis
97
- public ratelimitCreator?: RateLimiterCreator
98
93
  public crawlers: Crawlers
99
94
  public bskyAppView?: BskyAppView
100
95
  public moderationAgent: AtpAgent | undefined
@@ -121,7 +116,6 @@ export class AppContext {
121
116
  this.sequencer = opts.sequencer
122
117
  this.backgroundQueue = opts.backgroundQueue
123
118
  this.redisScratch = opts.redisScratch
124
- this.ratelimitCreator = opts.ratelimitCreator
125
119
  this.crawlers = opts.crawlers
126
120
  this.bskyAppView = opts.bskyAppView
127
121
  this.moderationAgent = opts.moderationAgent
@@ -202,30 +196,6 @@ export class AppContext {
202
196
  ? getRedisClient(cfg.redis.address, cfg.redis.password)
203
197
  : undefined
204
198
 
205
- let ratelimitCreator: RateLimiterCreator | undefined = undefined
206
- if (cfg.rateLimits.enabled) {
207
- const bypassSecret = cfg.rateLimits.bypassKey
208
- const bypassIps = cfg.rateLimits.bypassIps
209
- if (cfg.rateLimits.mode === 'redis') {
210
- if (!redisScratch) {
211
- throw new Error('Redis not set up for ratelimiting mode: `redis`')
212
- }
213
- ratelimitCreator = (opts: RateLimiterOpts) =>
214
- RateLimiter.redis(redisScratch, {
215
- bypassSecret,
216
- bypassIps,
217
- ...opts,
218
- })
219
- } else {
220
- ratelimitCreator = (opts: RateLimiterOpts) =>
221
- RateLimiter.memory({
222
- bypassSecret,
223
- bypassIps,
224
- ...opts,
225
- })
226
- }
227
- }
228
-
229
199
  const bskyAppView = cfg.bskyAppView
230
200
  ? new BskyAppView(cfg.bskyAppView)
231
201
  : undefined
@@ -415,7 +385,6 @@ export class AppContext {
415
385
  sequencer,
416
386
  backgroundQueue,
417
387
  redisScratch,
418
- ratelimitCreator,
419
388
  crawlers,
420
389
  bskyAppView,
421
390
  moderationAgent,
package/src/index.ts CHANGED
@@ -11,12 +11,8 @@ import cors from 'cors'
11
11
  import express from 'express'
12
12
  import { HttpTerminator, createHttpTerminator } from 'http-terminator'
13
13
  import { DAY, HOUR, MINUTE, SECOND } from '@atproto/common'
14
- import {
15
- Options as XrpcServerOptions,
16
- ResponseType,
17
- XRPCError,
18
- } from '@atproto/xrpc-server'
19
- import API from './api'
14
+ import { RateLimiter, ResponseType, XRPCError } from '@atproto/xrpc-server'
15
+ import apiRoutes from './api'
20
16
  import * as authRoutes from './auth-routes'
21
17
  import * as basicRoutes from './basic-routes'
22
18
  import { ServerConfig, ServerSecrets } from './config'
@@ -61,7 +57,9 @@ export class PDS {
61
57
  ): Promise<PDS> {
62
58
  const ctx = await AppContext.fromConfig(cfg, secrets, overrides)
63
59
 
64
- const xrpcOpts: XrpcServerOptions = {
60
+ const { rateLimits } = ctx.cfg
61
+
62
+ const server = createServer({
65
63
  validateResponse: false,
66
64
  payload: {
67
65
  jsonLimit: 150 * 1024, // 150kb
@@ -91,9 +89,24 @@ export class PDS {
91
89
 
92
90
  return XRPCError.fromError(err)
93
91
  },
94
- rateLimits: ctx.ratelimitCreator
92
+ rateLimits: rateLimits.enabled
95
93
  ? {
96
- creator: ctx.ratelimitCreator,
94
+ creator: ctx.redisScratch
95
+ ? (opts) => RateLimiter.redis(ctx.redisScratch, opts)
96
+ : (opts) => RateLimiter.memory(opts),
97
+ bypass: ({ req }) => {
98
+ const { bypassKey, bypassIps } = rateLimits
99
+ if (
100
+ bypassKey &&
101
+ bypassKey === req.headers['x-ratelimit-bypass']
102
+ ) {
103
+ return true
104
+ }
105
+ if (bypassIps && bypassIps.includes(req.ip)) {
106
+ return true
107
+ }
108
+ return false
109
+ },
97
110
  global: [
98
111
  {
99
112
  name: 'global-ip',
@@ -115,11 +128,9 @@ export class PDS {
115
128
  ],
116
129
  }
117
130
  : undefined,
118
- }
119
-
120
- let server = createServer(xrpcOpts)
131
+ })
121
132
 
122
- server = API(server, ctx)
133
+ apiRoutes(server, ctx)
123
134
 
124
135
  const app = express()
125
136
  app.set('trust proxy', [
@@ -138,9 +138,11 @@ import * as AppBskyGraphUnmuteActor from './types/app/bsky/graph/unmuteActor.js'
138
138
  import * as AppBskyGraphUnmuteActorList from './types/app/bsky/graph/unmuteActorList.js'
139
139
  import * as AppBskyGraphUnmuteThread from './types/app/bsky/graph/unmuteThread.js'
140
140
  import * as AppBskyLabelerGetServices from './types/app/bsky/labeler/getServices.js'
141
+ import * as AppBskyNotificationGetPreferences from './types/app/bsky/notification/getPreferences.js'
141
142
  import * as AppBskyNotificationGetUnreadCount from './types/app/bsky/notification/getUnreadCount.js'
142
143
  import * as AppBskyNotificationListNotifications from './types/app/bsky/notification/listNotifications.js'
143
144
  import * as AppBskyNotificationPutPreferences from './types/app/bsky/notification/putPreferences.js'
145
+ import * as AppBskyNotificationPutPreferencesV2 from './types/app/bsky/notification/putPreferencesV2.js'
144
146
  import * as AppBskyNotificationRegisterPush from './types/app/bsky/notification/registerPush.js'
145
147
  import * as AppBskyNotificationUpdateSeen from './types/app/bsky/notification/updateSeen.js'
146
148
  import * as AppBskyUnspeccedGetConfig from './types/app/bsky/unspecced/getConfig.js'
@@ -1903,6 +1905,17 @@ export class AppBskyNotificationNS {
1903
1905
  this._server = server
1904
1906
  }
1905
1907
 
1908
+ getPreferences<AV extends AuthVerifier>(
1909
+ cfg: ConfigOf<
1910
+ AV,
1911
+ AppBskyNotificationGetPreferences.Handler<ExtractAuth<AV>>,
1912
+ AppBskyNotificationGetPreferences.HandlerReqCtx<ExtractAuth<AV>>
1913
+ >,
1914
+ ) {
1915
+ const nsid = 'app.bsky.notification.getPreferences' // @ts-ignore
1916
+ return this._server.xrpc.method(nsid, cfg)
1917
+ }
1918
+
1906
1919
  getUnreadCount<AV extends AuthVerifier>(
1907
1920
  cfg: ConfigOf<
1908
1921
  AV,
@@ -1936,6 +1949,17 @@ export class AppBskyNotificationNS {
1936
1949
  return this._server.xrpc.method(nsid, cfg)
1937
1950
  }
1938
1951
 
1952
+ putPreferencesV2<AV extends AuthVerifier>(
1953
+ cfg: ConfigOf<
1954
+ AV,
1955
+ AppBskyNotificationPutPreferencesV2.Handler<ExtractAuth<AV>>,
1956
+ AppBskyNotificationPutPreferencesV2.HandlerReqCtx<ExtractAuth<AV>>
1957
+ >,
1958
+ ) {
1959
+ const nsid = 'app.bsky.notification.putPreferencesV2' // @ts-ignore
1960
+ return this._server.xrpc.method(nsid, cfg)
1961
+ }
1962
+
1939
1963
  registerPush<AV extends AuthVerifier>(
1940
1964
  cfg: ConfigOf<
1941
1965
  AV,