@atproto/pds 0.4.209 → 0.4.210
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/dist/lexicon/index.d.ts +2 -2
- package/dist/lexicon/index.d.ts.map +1 -1
- package/dist/lexicon/index.js +4 -4
- package/dist/lexicon/index.js.map +1 -1
- package/dist/lexicon/lexicons.d.ts +116 -100
- package/dist/lexicon/lexicons.d.ts.map +1 -1
- package/dist/lexicon/lexicons.js +59 -51
- package/dist/lexicon/lexicons.js.map +1 -1
- package/dist/lexicon/types/app/bsky/graph/getSuggestedFollowsByActor.d.ts +3 -1
- package/dist/lexicon/types/app/bsky/graph/getSuggestedFollowsByActor.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/graph/getSuggestedFollowsByActor.js.map +1 -1
- package/dist/lexicon/types/app/bsky/unspecced/{getSuggestedOnboardingUsersSkeleton.d.ts → getOnboardingSuggestedUsersSkeleton.d.ts} +1 -1
- package/dist/lexicon/types/app/bsky/unspecced/{getSuggestedOnboardingUsersSkeleton.d.ts.map → getOnboardingSuggestedUsersSkeleton.d.ts.map} +1 -1
- package/dist/lexicon/types/app/bsky/unspecced/{getSuggestedOnboardingUsersSkeleton.js → getOnboardingSuggestedUsersSkeleton.js} +2 -2
- package/dist/lexicon/types/app/bsky/unspecced/{getSuggestedOnboardingUsersSkeleton.js.map → getOnboardingSuggestedUsersSkeleton.js.map} +1 -1
- package/dist/lexicon/types/app/bsky/unspecced/getSuggestionsSkeleton.d.ts +3 -1
- package/dist/lexicon/types/app/bsky/unspecced/getSuggestionsSkeleton.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/unspecced/getSuggestionsSkeleton.js.map +1 -1
- package/dist/pipethrough.d.ts +15 -3
- package/dist/pipethrough.d.ts.map +1 -1
- package/dist/pipethrough.js +37 -4
- package/dist/pipethrough.js.map +1 -1
- package/package.json +9 -8
- package/src/lexicon/index.ts +13 -13
- package/src/lexicon/lexicons.ts +63 -55
- package/src/lexicon/types/app/bsky/graph/getSuggestedFollowsByActor.ts +3 -1
- package/src/lexicon/types/app/bsky/unspecced/{getSuggestedOnboardingUsersSkeleton.ts → getOnboardingSuggestedUsersSkeleton.ts} +1 -1
- package/src/lexicon/types/app/bsky/unspecced/getSuggestionsSkeleton.ts +3 -1
- package/src/pipethrough.ts +26 -3
- package/tests/app-passwords.test.ts +15 -5
- package/tsconfig.build.tsbuildinfo +1 -1
|
@@ -7,8 +7,10 @@ export interface OutputSchema {
|
|
|
7
7
|
suggestions: AppBskyActorDefs.ProfileView[];
|
|
8
8
|
/** If true, response has fallen-back to generic results, and is not scoped using relativeToDid */
|
|
9
9
|
isFallback?: boolean;
|
|
10
|
-
/**
|
|
10
|
+
/** DEPRECATED: use recIdStr instead. */
|
|
11
11
|
recId?: number;
|
|
12
|
+
/** Snowflake for this recommendation, use when submitting recommendation events. */
|
|
13
|
+
recIdStr?: string;
|
|
12
14
|
}
|
|
13
15
|
export type HandlerInput = void;
|
|
14
16
|
export interface HandlerSuccess {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSuggestedFollowsByActor.d.ts","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/graph/getSuggestedFollowsByActor.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,KAAK,gBAAgB,MAAM,kBAAkB,CAAA;AAMzD,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AACD,MAAM,MAAM,WAAW,GAAG,SAAS,CAAA;AAEnC,MAAM,WAAW,YAAY;IAC3B,WAAW,EAAE,gBAAgB,CAAC,WAAW,EAAE,CAAA;IAC3C,kGAAkG;IAClG,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,oFAAoF;IACpF,
|
|
1
|
+
{"version":3,"file":"getSuggestedFollowsByActor.d.ts","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/graph/getSuggestedFollowsByActor.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,KAAK,gBAAgB,MAAM,kBAAkB,CAAA;AAMzD,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AACD,MAAM,MAAM,WAAW,GAAG,SAAS,CAAA;AAEnC,MAAM,WAAW,YAAY;IAC3B,WAAW,EAAE,gBAAgB,CAAC,WAAW,EAAE,CAAA;IAC3C,kGAAkG;IAClG,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,wCAAwC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,oFAAoF;IACpF,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSuggestedFollowsByActor.js","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/graph/getSuggestedFollowsByActor.ts"],"names":[],"mappings":";;AAKA,mDAA4D;AAC5D,2CAIyB;AAGzB,MAAM,QAAQ,GAAG,eAAS,EACxB,QAAQ,GAAG,mBAAS,CAAA;AACtB,MAAM,EAAE,GAAG,2CAA2C,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.graph.getSuggestedFollowsByActor'\n\nexport type QueryParams = {\n actor: string\n}\nexport type InputSchema = undefined\n\nexport interface OutputSchema {\n suggestions: AppBskyActorDefs.ProfileView[]\n /** If true, response has fallen-back to generic results, and is not scoped using relativeToDid */\n isFallback?: boolean\n /** Snowflake for this recommendation, use when submitting recommendation events. */\n
|
|
1
|
+
{"version":3,"file":"getSuggestedFollowsByActor.js","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/graph/getSuggestedFollowsByActor.ts"],"names":[],"mappings":";;AAKA,mDAA4D;AAC5D,2CAIyB;AAGzB,MAAM,QAAQ,GAAG,eAAS,EACxB,QAAQ,GAAG,mBAAS,CAAA;AACtB,MAAM,EAAE,GAAG,2CAA2C,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.graph.getSuggestedFollowsByActor'\n\nexport type QueryParams = {\n actor: string\n}\nexport type InputSchema = undefined\n\nexport interface OutputSchema {\n suggestions: AppBskyActorDefs.ProfileView[]\n /** If true, response has fallen-back to generic results, and is not scoped using relativeToDid */\n isFallback?: boolean\n /** DEPRECATED: use recIdStr instead. */\n recId?: number\n /** Snowflake for this recommendation, use when submitting recommendation events. */\n recIdStr?: 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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
1
|
+
{"version":3,"file":"getOnboardingSuggestedUsersSkeleton.d.ts","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/unspecced/getOnboardingSuggestedUsersSkeleton.ts"],"names":[],"mappings":"AAgBA,MAAM,MAAM,WAAW,GAAG;IACxB,+FAA+F;IAC/F,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,gDAAgD;IAChD,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AACD,MAAM,MAAM,WAAW,GAAG,SAAS,CAAA;AAEnC,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,oFAAoF;IACpF,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;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"}
|
|
@@ -3,5 +3,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const lexicons_1 = require("../../../../lexicons");
|
|
4
4
|
const util_1 = require("../../../../util");
|
|
5
5
|
const is$typed = util_1.is$typed, validate = lexicons_1.validate;
|
|
6
|
-
const id = 'app.bsky.unspecced.
|
|
7
|
-
//# sourceMappingURL=
|
|
6
|
+
const id = 'app.bsky.unspecced.getOnboardingSuggestedUsersSkeleton';
|
|
7
|
+
//# sourceMappingURL=getOnboardingSuggestedUsersSkeleton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
1
|
+
{"version":3,"file":"getOnboardingSuggestedUsersSkeleton.js","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/unspecced/getOnboardingSuggestedUsersSkeleton.ts"],"names":[],"mappings":";;AAKA,mDAA4D;AAC5D,2CAIyB;AAEzB,MAAM,QAAQ,GAAG,eAAS,EACxB,QAAQ,GAAG,mBAAS,CAAA;AACtB,MAAM,EAAE,GAAG,wDAAwD,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.getOnboardingSuggestedUsersSkeleton'\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"]}
|
|
@@ -13,8 +13,10 @@ export interface OutputSchema {
|
|
|
13
13
|
actors: AppBskyUnspeccedDefs.SkeletonSearchActor[];
|
|
14
14
|
/** DID of the account these suggestions are relative to. If this is returned undefined, suggestions are based on the viewer. */
|
|
15
15
|
relativeToDid?: string;
|
|
16
|
-
/**
|
|
16
|
+
/** DEPRECATED: use recIdStr instead. */
|
|
17
17
|
recId?: number;
|
|
18
|
+
/** Snowflake for this recommendation, use when submitting recommendation events. */
|
|
19
|
+
recIdStr?: string;
|
|
18
20
|
}
|
|
19
21
|
export type HandlerInput = void;
|
|
20
22
|
export interface HandlerSuccess {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSuggestionsSkeleton.d.ts","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/unspecced/getSuggestionsSkeleton.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,KAAK,oBAAoB,MAAM,WAAW,CAAA;AAMtD,MAAM,MAAM,WAAW,GAAG;IACxB,2IAA2I;IAC3I,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,mHAAmH;IACnH,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB,CAAA;AACD,MAAM,MAAM,WAAW,GAAG,SAAS,CAAA;AAEnC,MAAM,WAAW,YAAY;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,oBAAoB,CAAC,mBAAmB,EAAE,CAAA;IAClD,gIAAgI;IAChI,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,oFAAoF;IACpF,
|
|
1
|
+
{"version":3,"file":"getSuggestionsSkeleton.d.ts","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/unspecced/getSuggestionsSkeleton.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,KAAK,oBAAoB,MAAM,WAAW,CAAA;AAMtD,MAAM,MAAM,WAAW,GAAG;IACxB,2IAA2I;IAC3I,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,mHAAmH;IACnH,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB,CAAA;AACD,MAAM,MAAM,WAAW,GAAG,SAAS,CAAA;AAEnC,MAAM,WAAW,YAAY;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,oBAAoB,CAAC,mBAAmB,EAAE,CAAA;IAClD,gIAAgI;IAChI,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,wCAAwC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,oFAAoF;IACpF,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSuggestionsSkeleton.js","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/unspecced/getSuggestionsSkeleton.ts"],"names":[],"mappings":";;AAKA,mDAA4D;AAC5D,2CAIyB;AAGzB,MAAM,QAAQ,GAAG,eAAS,EACxB,QAAQ,GAAG,mBAAS,CAAA;AACtB,MAAM,EAAE,GAAG,2CAA2C,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 AppBskyUnspeccedDefs from './defs.js'\n\nconst is$typed = _is$typed,\n validate = _validate\nconst id = 'app.bsky.unspecced.getSuggestionsSkeleton'\n\nexport type QueryParams = {\n /** DID of the account making the request (not included for public/unauthenticated queries). Used to boost followed accounts in ranking. */\n viewer?: string\n limit: number\n cursor?: string\n /** DID of the account to get suggestions relative to. If not provided, suggestions will be based on the viewer. */\n relativeToDid?: string\n}\nexport type InputSchema = undefined\n\nexport interface OutputSchema {\n cursor?: string\n actors: AppBskyUnspeccedDefs.SkeletonSearchActor[]\n /** DID of the account these suggestions are relative to. If this is returned undefined, suggestions are based on the viewer. */\n relativeToDid?: string\n /** Snowflake for this recommendation, use when submitting recommendation events. */\n
|
|
1
|
+
{"version":3,"file":"getSuggestionsSkeleton.js","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/unspecced/getSuggestionsSkeleton.ts"],"names":[],"mappings":";;AAKA,mDAA4D;AAC5D,2CAIyB;AAGzB,MAAM,QAAQ,GAAG,eAAS,EACxB,QAAQ,GAAG,mBAAS,CAAA;AACtB,MAAM,EAAE,GAAG,2CAA2C,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 AppBskyUnspeccedDefs from './defs.js'\n\nconst is$typed = _is$typed,\n validate = _validate\nconst id = 'app.bsky.unspecced.getSuggestionsSkeleton'\n\nexport type QueryParams = {\n /** DID of the account making the request (not included for public/unauthenticated queries). Used to boost followed accounts in ranking. */\n viewer?: string\n limit: number\n cursor?: string\n /** DID of the account to get suggestions relative to. If not provided, suggestions will be based on the viewer. */\n relativeToDid?: string\n}\nexport type InputSchema = undefined\n\nexport interface OutputSchema {\n cursor?: string\n actors: AppBskyUnspeccedDefs.SkeletonSearchActor[]\n /** DID of the account these suggestions are relative to. If this is returned undefined, suggestions are based on the viewer. */\n relativeToDid?: string\n /** DEPRECATED: use recIdStr instead. */\n recId?: number\n /** Snowflake for this recommendation, use when submitting recommendation events. */\n recIdStr?: 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"]}
|
package/dist/pipethrough.d.ts
CHANGED
|
@@ -36,7 +36,19 @@ export declare const parseProxyHeader: (ctx: Pick<AppContext, "cfg" | "idResolve
|
|
|
36
36
|
}>;
|
|
37
37
|
export declare function isJsonContentType(contentType?: string): boolean | undefined;
|
|
38
38
|
export declare function asPipeThroughBuffer(input: HandlerPipeThroughStream): Promise<HandlerPipeThroughBuffer>;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
/**
|
|
40
|
+
* Performs lexicon method matching on a set of methods,
|
|
41
|
+
* taking into account that they are treated case-insensitively.
|
|
42
|
+
*/
|
|
43
|
+
export declare class LxmSet {
|
|
44
|
+
private inner;
|
|
45
|
+
private original;
|
|
46
|
+
constructor(items: Iterable<string>);
|
|
47
|
+
has(lxm: string): boolean;
|
|
48
|
+
[Symbol.iterator](): Iterator<string>;
|
|
49
|
+
}
|
|
50
|
+
export declare function normalizeLxm(lxm: string): string;
|
|
51
|
+
export declare const CHAT_BSKY_METHODS: LxmSet;
|
|
52
|
+
export declare const PRIVILEGED_METHODS: LxmSet;
|
|
53
|
+
export declare const PROTECTED_METHODS: LxmSet;
|
|
42
54
|
//# sourceMappingURL=pipethrough.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipethrough.d.ts","sourceRoot":"","sources":["../src/pipethrough.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,QAAQ,EAAY,MAAM,aAAa,CAAA;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAUjC,OAAO,EACL,eAAe,EACf,wBAAwB,EACxB,wBAAwB,EAMzB,MAAM,sBAAsB,CAAA;AAG7B,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAItC,eAAO,MAAM,YAAY,GAAI,KAAK,UAA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AAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CA6CtC,CAAA;AAyGD,wBAAgB,iBAAiB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAG3E;AAkED,wBAAsB,mBAAmB,CACvC,KAAK,EAAE,wBAAwB,GAC9B,OAAO,CAAC,wBAAwB,CAAC,CASnC;AA2CD;;;GAGG;AACH,qBAAa,MAAM;IACjB,OAAO,CAAC,KAAK,CAAa;IAC1B,OAAO,CAAC,QAAQ,CAAkB;gBACtB,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC;IAInC,GAAG,CAAC,GAAG,EAAE,MAAM;IAGd,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,MAAM,CAAC;CAGvC;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,UAEvC;AAED,eAAO,MAAM,iBAAiB,QAe5B,CAAA;AAEF,eAAO,MAAM,kBAAkB,QAG7B,CAAA;AAKF,eAAO,MAAM,iBAAiB,QAiB5B,CAAA"}
|
package/dist/pipethrough.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PROTECTED_METHODS = exports.PRIVILEGED_METHODS = exports.CHAT_BSKY_METHODS = exports.parseProxyHeader = exports.proxyHandler = void 0;
|
|
3
|
+
exports.PROTECTED_METHODS = exports.PRIVILEGED_METHODS = exports.CHAT_BSKY_METHODS = exports.LxmSet = exports.parseProxyHeader = exports.proxyHandler = void 0;
|
|
4
4
|
exports.pipethrough = pipethrough;
|
|
5
5
|
exports.computeProxyTo = computeProxyTo;
|
|
6
6
|
exports.parseProxyInfo = parseProxyInfo;
|
|
7
7
|
exports.isJsonContentType = isJsonContentType;
|
|
8
8
|
exports.asPipeThroughBuffer = asPipeThroughBuffer;
|
|
9
|
+
exports.normalizeLxm = normalizeLxm;
|
|
9
10
|
const node_stream_1 = require("node:stream");
|
|
10
11
|
const common_1 = require("@atproto/common");
|
|
11
12
|
const xrpc_1 = require("@atproto/xrpc");
|
|
@@ -335,7 +336,39 @@ function* responseHeaders(headers, includeContentHeaders = true) {
|
|
|
335
336
|
}
|
|
336
337
|
// Utils
|
|
337
338
|
// -------------------
|
|
338
|
-
|
|
339
|
+
/**
|
|
340
|
+
* Performs lexicon method matching on a set of methods,
|
|
341
|
+
* taking into account that they are treated case-insensitively.
|
|
342
|
+
*/
|
|
343
|
+
class LxmSet {
|
|
344
|
+
constructor(items) {
|
|
345
|
+
Object.defineProperty(this, "inner", {
|
|
346
|
+
enumerable: true,
|
|
347
|
+
configurable: true,
|
|
348
|
+
writable: true,
|
|
349
|
+
value: void 0
|
|
350
|
+
});
|
|
351
|
+
Object.defineProperty(this, "original", {
|
|
352
|
+
enumerable: true,
|
|
353
|
+
configurable: true,
|
|
354
|
+
writable: true,
|
|
355
|
+
value: void 0
|
|
356
|
+
});
|
|
357
|
+
this.inner = new Set(Array.from(items, normalizeLxm));
|
|
358
|
+
this.original = items;
|
|
359
|
+
}
|
|
360
|
+
has(lxm) {
|
|
361
|
+
return this.inner.has(normalizeLxm(lxm));
|
|
362
|
+
}
|
|
363
|
+
*[Symbol.iterator]() {
|
|
364
|
+
yield* this.original;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
exports.LxmSet = LxmSet;
|
|
368
|
+
function normalizeLxm(lxm) {
|
|
369
|
+
return lxm.toLowerCase();
|
|
370
|
+
}
|
|
371
|
+
exports.CHAT_BSKY_METHODS = new LxmSet([
|
|
339
372
|
lexicons_1.ids.ChatBskyActorDeleteAccount,
|
|
340
373
|
lexicons_1.ids.ChatBskyActorExportAccountData,
|
|
341
374
|
lexicons_1.ids.ChatBskyConvoDeleteMessageForSelf,
|
|
@@ -351,14 +384,14 @@ exports.CHAT_BSKY_METHODS = new Set([
|
|
|
351
384
|
lexicons_1.ids.ChatBskyConvoUnmuteConvo,
|
|
352
385
|
lexicons_1.ids.ChatBskyConvoUpdateRead,
|
|
353
386
|
]);
|
|
354
|
-
exports.PRIVILEGED_METHODS = new
|
|
387
|
+
exports.PRIVILEGED_METHODS = new LxmSet([
|
|
355
388
|
...exports.CHAT_BSKY_METHODS,
|
|
356
389
|
lexicons_1.ids.ComAtprotoServerCreateAccount,
|
|
357
390
|
]);
|
|
358
391
|
// These endpoints are related to account management and must be used directly,
|
|
359
392
|
// not proxied or service-authed. Service auth may be utilized between PDS and
|
|
360
393
|
// entryway for these methods.
|
|
361
|
-
exports.PROTECTED_METHODS = new
|
|
394
|
+
exports.PROTECTED_METHODS = new LxmSet([
|
|
362
395
|
lexicons_1.ids.ComAtprotoAdminSendEmail,
|
|
363
396
|
lexicons_1.ids.ComAtprotoIdentityRequestPlcOperationSignature,
|
|
364
397
|
lexicons_1.ids.ComAtprotoIdentitySignPlcOperation,
|
package/dist/pipethrough.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipethrough.js","sourceRoot":"","sources":["../src/pipethrough.ts"],"names":[],"mappings":";;;AAqIA,kCAgEC;AAKD,wCAcC;AAED,wCAcC;AA4JD,8CAGC;AAkED,kDAWC;AAndD,6CAA6D;AAG7D,4CAKwB;AAExB,wCAA0E;AAC1E,sDAS6B;AAC7B,yDAAsE;AACtE,6CAAiD;AAEjD,iDAAwC;AACxC,qCAAqC;AAE9B,MAAM,YAAY,GAAG,CAAC,GAAe,EAAmB,EAAE;IAC/D,MAAM,WAAW,GAAG,GAAG,CAAC,YAAY,CAAC,aAAa,CAAqB;QACrE,SAAS,EAAE,CAAC,WAAW,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,WAAW,CAAC,SAAS,CAAC,MAAM,CAAC;KACtE,CAAC,CAAA;IAEF,OAAO,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;QAC9B,eAAe;QACf,IAAI,CAAC;YACH,IACE,GAAG,CAAC,MAAM,KAA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KAAK,cAAG,CAAC,gCAAgC;YACvC,OAAO;gBACL,SAAS,EAAE,iBAAiB;gBAC5B,WAAW,EAAE,GAAG,CAAC,GAAG,CAAC,aAAa;aACnC,CAAA;QACH;YACE,OAAO;gBACL,SAAS,EAAE,cAAc;gBACzB,WAAW,EAAE,GAAG,CAAC,GAAG,CAAC,WAAW;aACjC,CAAA;IACL,CAAC;AACH,CAAC,CAAA;AAED,MAAM,UAAU,GAAG,CAAC,GAAY,EAAsB,EAAE;IACtD,OAAO,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAA;AAClD,CAAC,CAAA;AAED,SAAS,gBAAgB,CAAuB,GAAY;IAC1D,mBAAU,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,EAAE,oCAAoC,CAAC,CAAA;AAChE,CAAC","sourcesContent":["import { IncomingHttpHeaders, ServerResponse } from 'node:http'\nimport { PassThrough, Readable, finished } from 'node:stream'\nimport { Request } from 'express'\nimport { Dispatcher } from 'undici'\nimport {\n decodeStream,\n getServiceEndpoint,\n omit,\n streamToNodeBuffer,\n} from '@atproto/common'\nimport { RpcPermissionMatch } from '@atproto/oauth-scopes'\nimport { ResponseType, XRPCError as XRPCClientError } from '@atproto/xrpc'\nimport {\n CatchallHandler,\n HandlerPipeThroughBuffer,\n HandlerPipeThroughStream,\n InternalServerError,\n InvalidRequestError,\n XRPCError as XRPCServerError,\n excludeErrorResult,\n parseReqNsid,\n} from '@atproto/xrpc-server'\nimport { buildProxiedContentEncoding } from '@atproto-labs/xrpc-utils'\nimport { isAccessPrivileged } from './auth-scope'\nimport { AppContext } from './context'\nimport { ids } from './lexicon/lexicons'\nimport { httpLogger } from './logger'\n\nexport const proxyHandler = (ctx: AppContext): CatchallHandler => {\n const performAuth = ctx.authVerifier.authorization<RpcPermissionMatch>({\n authorize: (permissions, { params }) => permissions.assertRpc(params),\n })\n\n return async (req, res, next) => {\n // /!\\ Hot path\n try {\n if (\n req.method !== 'GET' &&\n req.method !== 'HEAD' &&\n req.method !== 'POST'\n ) {\n throw new XRPCServerError(\n ResponseType.InvalidRequest,\n 'XRPC requests only supports GET and POST',\n )\n }\n\n const body = req.method === 'POST' ? req : undefined\n if (body != null && !body.readable) {\n // Body was already consumed by a previous middleware\n throw new InternalServerError('Request body is not readable')\n }\n\n const lxm = parseReqNsid(req)\n if (PROTECTED_METHODS.has(lxm)) {\n throw new InvalidRequestError('Bad token method', 'InvalidToken')\n }\n\n const { url: origin, did: aud } = await parseProxyInfo(ctx, req, lxm)\n\n const authResult = await performAuth({ req, res, params: { lxm, aud } })\n\n const { credentials } = excludeErrorResult(authResult)\n\n if (\n credentials.type === 'access' &&\n !isAccessPrivileged(credentials.scope) &&\n PRIVILEGED_METHODS.has(lxm)\n ) {\n throw new InvalidRequestError('Bad token method', 'InvalidToken')\n }\n\n const headers: IncomingHttpHeaders = {\n 'accept-encoding': req.headers['accept-encoding'] || 'identity',\n 'accept-language': req.headers['accept-language'],\n 'atproto-accept-labelers': req.headers['atproto-accept-labelers'],\n 'x-bsky-topics': req.headers['x-bsky-topics'],\n\n 'content-type': body && req.headers['content-type'],\n 'content-encoding': body && req.headers['content-encoding'],\n 'content-length': body && req.headers['content-length'],\n\n authorization: `Bearer ${await ctx.serviceAuthJwt(credentials.did, aud, lxm)}`,\n }\n\n const dispatchOptions: Dispatcher.RequestOptions = {\n origin,\n method: req.method,\n path: req.originalUrl,\n body,\n headers,\n }\n\n await pipethroughStream(ctx, dispatchOptions, (upstream) => {\n res.status(upstream.statusCode)\n\n for (const [name, val] of responseHeaders(upstream.headers)) {\n res.setHeader(name, val)\n }\n\n // Note that we should not need to manually handle errors here (e.g. by\n // destroying the response), as the http server will handle them for us.\n res.on('error', logResponseError)\n\n // Tell undici to write the upstream response directly to the response\n return res\n })\n } catch (err) {\n next(err)\n }\n }\n}\n\nexport type PipethroughOptions = {\n /**\n * Specify the issuer (requester) for service auth. If not provided, no\n * authorization headers will be added to the request.\n */\n iss?: string\n\n /**\n * Override the audience for service auth. If not provided, the audience will\n * be determined based on the proxy service.\n */\n aud?: string\n\n /**\n * Override the lexicon method for service auth. If not provided, the lexicon\n * method will be determined based on the request path.\n */\n lxm?: string\n}\n\nexport async function pipethrough(\n ctx: AppContext,\n req: Request,\n options?: PipethroughOptions,\n): Promise<\n HandlerPipeThroughStream & {\n stream: Readable\n headers: Record<string, string>\n encoding: string\n }\n> {\n if (req.method !== 'GET' && req.method !== 'HEAD') {\n // pipethrough() is used from within xrpcServer handlers, which means that\n // the request body either has been parsed or is a readable stream that has\n // been piped for decoding & size limiting. Because of this, forwarding the\n // request body requires re-encoding it. Since we currently do not use\n // pipethrough() with procedures, proxying of request body is not\n // implemented.\n throw new InternalServerError(\n `Proxying of ${req.method} requests is not supported`,\n )\n }\n\n const lxm = parseReqNsid(req)\n\n const { url: origin, did: aud } = await parseProxyInfo(ctx, req, lxm)\n\n const dispatchOptions: Dispatcher.RequestOptions = {\n origin,\n method: req.method,\n path: req.originalUrl,\n headers: {\n 'accept-language': req.headers['accept-language'],\n 'atproto-accept-labelers': req.headers['atproto-accept-labelers'],\n 'x-bsky-topics': req.headers['x-bsky-topics'],\n\n // Because we sometimes need to interpret the response (e.g. during\n // read-after-write, through asPipeThroughBuffer()), we need to ask the\n // upstream server for an encoding that both the requester and the PDS can\n // understand. Since we might have to do the decoding ourselves, we will\n // use our own preferences (and weight) to negotiate the encoding.\n 'accept-encoding': buildProxiedContentEncoding(\n req.headers['accept-encoding'],\n ctx.cfg.proxy.preferCompressed,\n ),\n\n authorization: options?.iss\n ? `Bearer ${await ctx.serviceAuthJwt(options.iss, options.aud ?? aud, options.lxm ?? lxm)}`\n : undefined,\n },\n\n // Use a high water mark to buffer more data while performing async\n // operations before this stream is consumed. This is especially useful\n // while processing read-after-write operations.\n highWaterMark: 2 * 65536, // twice the default (64KiB)\n }\n\n const { headers, body } = await pipethroughRequest(ctx, dispatchOptions)\n\n return {\n encoding: safeString(headers['content-type']) ?? 'application/json',\n headers: Object.fromEntries(responseHeaders(headers)),\n stream: body,\n }\n}\n\n// Request setup/formatting\n// -------------------\n\nexport function computeProxyTo(\n ctx: AppContext,\n req: Request,\n lxm: string,\n): string {\n const proxyToHeader = req.header('atproto-proxy')\n if (proxyToHeader) return proxyToHeader\n\n const service = defaultService(ctx, lxm)\n if (service.serviceInfo) {\n return `${service.serviceInfo.did}#${service.serviceId}`\n }\n\n throw new InvalidRequestError(`No service configured for ${lxm}`)\n}\n\nexport async function parseProxyInfo(\n ctx: AppContext,\n req: Request,\n lxm: string,\n): Promise<{ url: string; did: string }> {\n // /!\\ Hot path\n\n const proxyToHeader = req.header('atproto-proxy')\n if (proxyToHeader) return parseProxyHeader(ctx, proxyToHeader)\n\n const { serviceInfo } = defaultService(ctx, lxm)\n if (serviceInfo) return serviceInfo\n\n throw new InvalidRequestError(`No service configured for ${lxm}`)\n}\n\nexport const parseProxyHeader = async (\n // Using subset of AppContext for testing purposes\n ctx: Pick<AppContext, 'cfg' | 'idResolver'>,\n proxyTo: string,\n): Promise<{ did: string; url: string }> => {\n // /!\\ Hot path\n\n const hashIndex = proxyTo.indexOf('#')\n\n if (hashIndex === 0) {\n throw new InvalidRequestError('no did specified in proxy header')\n }\n\n if (hashIndex === -1 || hashIndex === proxyTo.length - 1) {\n throw new InvalidRequestError('no service id specified in proxy header')\n }\n\n // More than one hash\n if (proxyTo.indexOf('#', hashIndex + 1) !== -1) {\n throw new InvalidRequestError('invalid proxy header format')\n }\n\n // Basic validation\n if (proxyTo.includes(' ')) {\n throw new InvalidRequestError('proxy header cannot contain spaces')\n }\n\n const did = proxyTo.slice(0, hashIndex)\n\n // Special case a configured appview, while still proxying correctly any other appview\n if (\n ctx.cfg.bskyAppView &&\n proxyTo === `${ctx.cfg.bskyAppView.did}#bsky_appview`\n ) {\n return { did, url: ctx.cfg.bskyAppView.url }\n }\n\n const didDoc = await ctx.idResolver.did.resolve(did)\n if (!didDoc) {\n throw new InvalidRequestError('could not resolve proxy did')\n }\n\n const serviceId = proxyTo.slice(hashIndex)\n const url = getServiceEndpoint(didDoc, { id: serviceId })\n if (!url) {\n throw new InvalidRequestError('could not resolve proxy did service url')\n }\n\n return { did, url }\n}\n\n/**\n * Utility function that wraps the undici stream() function and handles request\n * and response errors by wrapping them in XRPCError instances. This function is\n * more efficient than \"pipethroughRequest\" when a writable stream to pipe the\n * upstream response to is available.\n */\nasync function pipethroughStream(\n ctx: AppContext,\n dispatchOptions: Dispatcher.RequestOptions,\n successStreamFactory: Dispatcher.StreamFactory,\n): Promise<void> {\n return new Promise<void>((resolve, reject) => {\n void ctx.proxyAgent\n .stream(dispatchOptions, (upstream) => {\n if (upstream.statusCode >= 400) {\n const passThrough = new PassThrough()\n\n void tryParsingError(upstream.headers, passThrough).then((parsed) => {\n const xrpcError = new XRPCClientError(\n upstream.statusCode === 500\n ? ResponseType.UpstreamFailure\n : upstream.statusCode,\n parsed.error,\n parsed.message,\n Object.fromEntries(responseHeaders(upstream.headers, false)),\n { cause: dispatchOptions },\n )\n\n reject(xrpcError)\n }, reject)\n\n return passThrough\n }\n\n const writable = successStreamFactory(upstream)\n\n // As soon as the control was passed to the writable stream (i.e. by\n // returning the writable hereafter), pipethroughStream() is considered\n // to have succeeded. Any error occurring while writing upstream data to\n // the writable stream should be handled through the stream's error\n // state (i.e. successStreamFactory() must ensure that error events on\n // the returned writable will be handled).\n resolve()\n\n return writable\n })\n // The following catch block will be triggered with either network errors\n // or writable stream errors. In the latter case, the promise will already\n // be resolved, and reject()ing it there after will have no effect. Those\n // error would still be logged by the successStreamFactory() function.\n .catch(handleUpstreamRequestError)\n .catch(reject)\n })\n}\n\n/**\n * Utility function that wraps the undici request() function and handles request\n * and response errors by wrapping them in XRPCError instances.\n */\nasync function pipethroughRequest(\n ctx: AppContext,\n dispatchOptions: Dispatcher.RequestOptions,\n) {\n // HandlerPipeThroughStream requires a readable stream to be returned, so we\n // use the (less efficient) request() function instead.\n\n const upstream = await ctx.proxyAgent\n .request(dispatchOptions)\n .catch(handleUpstreamRequestError)\n\n if (upstream.statusCode >= 400) {\n const parsed = await tryParsingError(upstream.headers, upstream.body)\n\n // Note \"XRPCClientError\" is used instead of \"XRPCServerError\" in order to\n // allow users of this function to capture & handle these errors (namely in\n // \"app.bsky.feed.getPostThread\").\n throw new XRPCClientError(\n upstream.statusCode === 500\n ? ResponseType.UpstreamFailure\n : upstream.statusCode,\n parsed.error,\n parsed.message,\n Object.fromEntries(responseHeaders(upstream.headers, false)),\n { cause: dispatchOptions },\n )\n }\n\n return upstream\n}\n\nfunction handleUpstreamRequestError(\n err: unknown,\n message = 'Upstream service unreachable',\n): never {\n httpLogger.error({ err }, message)\n throw new XRPCServerError(ResponseType.UpstreamFailure, message, undefined, {\n cause: err,\n })\n}\n\n// Request parsing/forwarding\n// -------------------\n\nexport function isJsonContentType(contentType?: string): boolean | undefined {\n if (!contentType) return undefined\n return /application\\/(?:\\w+\\+)?json/i.test(contentType)\n}\n\nasync function tryParsingError(\n headers: IncomingHttpHeaders,\n readable: Readable,\n): Promise<{ error?: string; message?: string }> {\n if (isJsonContentType(headers['content-type']) === false) {\n // We don't known how to parse non JSON content types so we can discard the\n // whole response.\n\n // Since we don't care about the response, we would normally just destroy\n // the stream. However, if the underlying HTTP connection is an HTTP/1.1\n // connection, this also destroys the underlying (keep-alive) TCP socket. In\n // order to avoid destroying the TCP socket, while avoiding the cost of\n // consuming too much IO, we give it a chance to finish first.\n\n // @NOTE we need to listen (and ignore) \"error\" events, otherwise the\n // process could crash (since we drain the stream asynchronously here). This\n // is performed through the \"finished\" call below.\n\n const to = setTimeout(() => {\n readable.destroy()\n }, 100)\n finished(readable, (_err) => {\n clearTimeout(to)\n })\n readable.resume()\n\n return {}\n }\n\n try {\n const buffer = await bufferUpstreamResponse(\n readable,\n headers['content-encoding'],\n )\n\n const errInfo: unknown = JSON.parse(buffer.toString('utf8'))\n return {\n error: safeString(errInfo?.['error']),\n message: safeString(errInfo?.['message']),\n }\n } catch (err) {\n // Failed to read, decode, buffer or parse. No big deal.\n return {}\n }\n}\n\nasync function bufferUpstreamResponse(\n readable: Readable,\n contentEncoding?: string | string[],\n): Promise<Buffer> {\n try {\n return await streamToNodeBuffer(decodeStream(readable, contentEncoding))\n } catch (err) {\n if (!readable.destroyed) readable.destroy()\n\n throw new XRPCServerError(\n ResponseType.UpstreamFailure,\n err instanceof TypeError ? err.message : 'unable to decode request body',\n undefined,\n { cause: err },\n )\n }\n}\n\nexport async function asPipeThroughBuffer(\n input: HandlerPipeThroughStream,\n): Promise<HandlerPipeThroughBuffer> {\n return {\n buffer: await bufferUpstreamResponse(\n input.stream,\n input.headers?.['content-encoding'],\n ),\n headers: omit(input.headers, ['content-encoding', 'content-length']),\n encoding: input.encoding,\n }\n}\n\n// Response parsing/forwarding\n// -------------------\n\nconst RES_HEADERS_TO_FORWARD = [\n 'atproto-repo-rev',\n 'atproto-content-labelers',\n 'retry-after',\n]\n\nfunction* responseHeaders(\n headers: IncomingHttpHeaders,\n includeContentHeaders = true,\n): Generator<[string, string]> {\n if (includeContentHeaders) {\n const length = headers['content-length']\n if (length) yield ['content-length', length]\n\n const encoding = headers['content-encoding']\n if (encoding) yield ['content-encoding', encoding]\n\n const type = headers['content-type']\n if (type) yield ['content-type', type]\n\n const language = headers['content-language']\n if (language) yield ['content-language', language]\n }\n\n for (let i = 0; i < RES_HEADERS_TO_FORWARD.length; i++) {\n const name = RES_HEADERS_TO_FORWARD[i]\n const val = headers[name]\n\n if (val != null) {\n const value: string = Array.isArray(val) ? val.join(',') : val\n yield [name, value]\n }\n }\n}\n\n// Utils\n// -------------------\n\nexport const CHAT_BSKY_METHODS = new Set<string>([\n ids.ChatBskyActorDeleteAccount,\n ids.ChatBskyActorExportAccountData,\n ids.ChatBskyConvoDeleteMessageForSelf,\n ids.ChatBskyConvoGetConvo,\n ids.ChatBskyConvoGetConvoForMembers,\n ids.ChatBskyConvoGetLog,\n ids.ChatBskyConvoGetMessages,\n ids.ChatBskyConvoLeaveConvo,\n ids.ChatBskyConvoListConvos,\n ids.ChatBskyConvoMuteConvo,\n ids.ChatBskyConvoSendMessage,\n ids.ChatBskyConvoSendMessageBatch,\n ids.ChatBskyConvoUnmuteConvo,\n ids.ChatBskyConvoUpdateRead,\n])\n\nexport const PRIVILEGED_METHODS = new Set<string>([\n ...CHAT_BSKY_METHODS,\n ids.ComAtprotoServerCreateAccount,\n])\n\n// These endpoints are related to account management and must be used directly,\n// not proxied or service-authed. Service auth may be utilized between PDS and\n// entryway for these methods.\nexport const PROTECTED_METHODS = new Set<string>([\n ids.ComAtprotoAdminSendEmail,\n ids.ComAtprotoIdentityRequestPlcOperationSignature,\n ids.ComAtprotoIdentitySignPlcOperation,\n ids.ComAtprotoIdentityUpdateHandle,\n ids.ComAtprotoServerActivateAccount,\n ids.ComAtprotoServerConfirmEmail,\n ids.ComAtprotoServerCreateAppPassword,\n ids.ComAtprotoServerDeactivateAccount,\n ids.ComAtprotoServerGetAccountInviteCodes,\n ids.ComAtprotoServerGetSession,\n ids.ComAtprotoServerListAppPasswords,\n ids.ComAtprotoServerRequestAccountDelete,\n ids.ComAtprotoServerRequestEmailConfirmation,\n ids.ComAtprotoServerRequestEmailUpdate,\n ids.ComAtprotoServerRevokeAppPassword,\n ids.ComAtprotoServerUpdateEmail,\n])\n\nconst defaultService = (\n ctx: AppContext,\n nsid: string,\n): {\n serviceId: string\n serviceInfo: { url: string; did: string } | null\n} => {\n switch (nsid) {\n case ids.ToolsOzoneTeamAddMember:\n case ids.ToolsOzoneTeamDeleteMember:\n case ids.ToolsOzoneTeamUpdateMember:\n case ids.ToolsOzoneTeamListMembers:\n case ids.ToolsOzoneCommunicationCreateTemplate:\n case ids.ToolsOzoneCommunicationDeleteTemplate:\n case ids.ToolsOzoneCommunicationUpdateTemplate:\n case ids.ToolsOzoneCommunicationListTemplates:\n case ids.ToolsOzoneModerationEmitEvent:\n case ids.ToolsOzoneModerationGetEvent:\n case ids.ToolsOzoneModerationGetRecord:\n case ids.ToolsOzoneModerationGetRepo:\n case ids.ToolsOzoneModerationQueryEvents:\n case ids.ToolsOzoneModerationQueryStatuses:\n case ids.ToolsOzoneModerationSearchRepos:\n case ids.ToolsOzoneModerationGetAccountTimeline:\n case ids.ToolsOzoneVerificationListVerifications:\n case ids.ToolsOzoneVerificationGrantVerifications:\n case ids.ToolsOzoneVerificationRevokeVerifications:\n case ids.ToolsOzoneSafelinkAddRule:\n case ids.ToolsOzoneSafelinkUpdateRule:\n case ids.ToolsOzoneSafelinkRemoveRule:\n case ids.ToolsOzoneSafelinkQueryEvents:\n case ids.ToolsOzoneSafelinkQueryRules:\n case ids.ToolsOzoneModerationListScheduledActions:\n case ids.ToolsOzoneModerationCancelScheduledActions:\n case ids.ToolsOzoneModerationScheduleAction:\n return {\n serviceId: 'atproto_labeler',\n serviceInfo: ctx.cfg.modService,\n }\n case ids.ComAtprotoModerationCreateReport:\n return {\n serviceId: 'atproto_labeler',\n serviceInfo: ctx.cfg.reportService,\n }\n default:\n return {\n serviceId: 'bsky_appview',\n serviceInfo: ctx.cfg.bskyAppView,\n }\n }\n}\n\nconst safeString = (str: unknown): string | undefined => {\n return typeof str === 'string' ? str : undefined\n}\n\nfunction logResponseError(this: ServerResponse, err: unknown): void {\n httpLogger.warn({ err }, 'error forwarding upstream response')\n}\n"]}
|
|
1
|
+
{"version":3,"file":"pipethrough.js","sourceRoot":"","sources":["../src/pipethrough.ts"],"names":[],"mappings":";;;AAqIA,kCAgEC;AAKD,wCAcC;AAED,wCAcC;AA4JD,8CAGC;AAkED,kDAWC;AA8DD,oCAEC;AAnhBD,6CAA6D;AAG7D,4CAKwB;AAExB,wCAA0E;AAC1E,sDAS6B;AAC7B,yDAAsE;AACtE,6CAAiD;AAEjD,iDAAwC;AACxC,qCAAqC;AAE9B,MAAM,YAAY,GAAG,CAAC,GAAe,EAAmB,EAAE;IAC/D,MAAM,WAAW,GAAG,GAAG,CAAC,YAAY,CAAC,aAAa,CAAqB;QACrE,SAAS,EAAE,C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AAED,SAAS,gBAAgB,CAAuB,GAAY;IAC1D,mBAAU,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,EAAE,oCAAoC,CAAC,CAAA;AAChE,CAAC","sourcesContent":["import { IncomingHttpHeaders, ServerResponse } from 'node:http'\nimport { PassThrough, Readable, finished } from 'node:stream'\nimport { Request } from 'express'\nimport { Dispatcher } from 'undici'\nimport {\n decodeStream,\n getServiceEndpoint,\n omit,\n streamToNodeBuffer,\n} from '@atproto/common'\nimport { RpcPermissionMatch } from '@atproto/oauth-scopes'\nimport { ResponseType, XRPCError as XRPCClientError } from '@atproto/xrpc'\nimport {\n CatchallHandler,\n HandlerPipeThroughBuffer,\n HandlerPipeThroughStream,\n InternalServerError,\n InvalidRequestError,\n XRPCError as XRPCServerError,\n excludeErrorResult,\n parseReqNsid,\n} from '@atproto/xrpc-server'\nimport { buildProxiedContentEncoding } from '@atproto-labs/xrpc-utils'\nimport { isAccessPrivileged } from './auth-scope'\nimport { AppContext } from './context'\nimport { ids } from './lexicon/lexicons'\nimport { httpLogger } from './logger'\n\nexport const proxyHandler = (ctx: AppContext): CatchallHandler => {\n const performAuth = ctx.authVerifier.authorization<RpcPermissionMatch>({\n authorize: (permissions, { params }) => permissions.assertRpc(params),\n })\n\n return async (req, res, next) => {\n // /!\\ Hot path\n try {\n if (\n req.method !== 'GET' &&\n req.method !== 'HEAD' &&\n req.method !== 'POST'\n ) {\n throw new XRPCServerError(\n ResponseType.InvalidRequest,\n 'XRPC requests only supports GET and POST',\n )\n }\n\n const body = req.method === 'POST' ? req : undefined\n if (body != null && !body.readable) {\n // Body was already consumed by a previous middleware\n throw new InternalServerError('Request body is not readable')\n }\n\n const lxm = parseReqNsid(req)\n if (PROTECTED_METHODS.has(lxm)) {\n throw new InvalidRequestError('Bad token method', 'InvalidToken')\n }\n\n const { url: origin, did: aud } = await parseProxyInfo(ctx, req, lxm)\n\n const authResult = await performAuth({ req, res, params: { lxm, aud } })\n\n const { credentials } = excludeErrorResult(authResult)\n\n if (\n credentials.type === 'access' &&\n !isAccessPrivileged(credentials.scope) &&\n PRIVILEGED_METHODS.has(lxm)\n ) {\n throw new InvalidRequestError('Bad token method', 'InvalidToken')\n }\n\n const headers: IncomingHttpHeaders = {\n 'accept-encoding': req.headers['accept-encoding'] || 'identity',\n 'accept-language': req.headers['accept-language'],\n 'atproto-accept-labelers': req.headers['atproto-accept-labelers'],\n 'x-bsky-topics': req.headers['x-bsky-topics'],\n\n 'content-type': body && req.headers['content-type'],\n 'content-encoding': body && req.headers['content-encoding'],\n 'content-length': body && req.headers['content-length'],\n\n authorization: `Bearer ${await ctx.serviceAuthJwt(credentials.did, aud, lxm)}`,\n }\n\n const dispatchOptions: Dispatcher.RequestOptions = {\n origin,\n method: req.method,\n path: req.originalUrl,\n body,\n headers,\n }\n\n await pipethroughStream(ctx, dispatchOptions, (upstream) => {\n res.status(upstream.statusCode)\n\n for (const [name, val] of responseHeaders(upstream.headers)) {\n res.setHeader(name, val)\n }\n\n // Note that we should not need to manually handle errors here (e.g. by\n // destroying the response), as the http server will handle them for us.\n res.on('error', logResponseError)\n\n // Tell undici to write the upstream response directly to the response\n return res\n })\n } catch (err) {\n next(err)\n }\n }\n}\n\nexport type PipethroughOptions = {\n /**\n * Specify the issuer (requester) for service auth. If not provided, no\n * authorization headers will be added to the request.\n */\n iss?: string\n\n /**\n * Override the audience for service auth. If not provided, the audience will\n * be determined based on the proxy service.\n */\n aud?: string\n\n /**\n * Override the lexicon method for service auth. If not provided, the lexicon\n * method will be determined based on the request path.\n */\n lxm?: string\n}\n\nexport async function pipethrough(\n ctx: AppContext,\n req: Request,\n options?: PipethroughOptions,\n): Promise<\n HandlerPipeThroughStream & {\n stream: Readable\n headers: Record<string, string>\n encoding: string\n }\n> {\n if (req.method !== 'GET' && req.method !== 'HEAD') {\n // pipethrough() is used from within xrpcServer handlers, which means that\n // the request body either has been parsed or is a readable stream that has\n // been piped for decoding & size limiting. Because of this, forwarding the\n // request body requires re-encoding it. Since we currently do not use\n // pipethrough() with procedures, proxying of request body is not\n // implemented.\n throw new InternalServerError(\n `Proxying of ${req.method} requests is not supported`,\n )\n }\n\n const lxm = parseReqNsid(req)\n\n const { url: origin, did: aud } = await parseProxyInfo(ctx, req, lxm)\n\n const dispatchOptions: Dispatcher.RequestOptions = {\n origin,\n method: req.method,\n path: req.originalUrl,\n headers: {\n 'accept-language': req.headers['accept-language'],\n 'atproto-accept-labelers': req.headers['atproto-accept-labelers'],\n 'x-bsky-topics': req.headers['x-bsky-topics'],\n\n // Because we sometimes need to interpret the response (e.g. during\n // read-after-write, through asPipeThroughBuffer()), we need to ask the\n // upstream server for an encoding that both the requester and the PDS can\n // understand. Since we might have to do the decoding ourselves, we will\n // use our own preferences (and weight) to negotiate the encoding.\n 'accept-encoding': buildProxiedContentEncoding(\n req.headers['accept-encoding'],\n ctx.cfg.proxy.preferCompressed,\n ),\n\n authorization: options?.iss\n ? `Bearer ${await ctx.serviceAuthJwt(options.iss, options.aud ?? aud, options.lxm ?? lxm)}`\n : undefined,\n },\n\n // Use a high water mark to buffer more data while performing async\n // operations before this stream is consumed. This is especially useful\n // while processing read-after-write operations.\n highWaterMark: 2 * 65536, // twice the default (64KiB)\n }\n\n const { headers, body } = await pipethroughRequest(ctx, dispatchOptions)\n\n return {\n encoding: safeString(headers['content-type']) ?? 'application/json',\n headers: Object.fromEntries(responseHeaders(headers)),\n stream: body,\n }\n}\n\n// Request setup/formatting\n// -------------------\n\nexport function computeProxyTo(\n ctx: AppContext,\n req: Request,\n lxm: string,\n): string {\n const proxyToHeader = req.header('atproto-proxy')\n if (proxyToHeader) return proxyToHeader\n\n const service = defaultService(ctx, lxm)\n if (service.serviceInfo) {\n return `${service.serviceInfo.did}#${service.serviceId}`\n }\n\n throw new InvalidRequestError(`No service configured for ${lxm}`)\n}\n\nexport async function parseProxyInfo(\n ctx: AppContext,\n req: Request,\n lxm: string,\n): Promise<{ url: string; did: string }> {\n // /!\\ Hot path\n\n const proxyToHeader = req.header('atproto-proxy')\n if (proxyToHeader) return parseProxyHeader(ctx, proxyToHeader)\n\n const { serviceInfo } = defaultService(ctx, lxm)\n if (serviceInfo) return serviceInfo\n\n throw new InvalidRequestError(`No service configured for ${lxm}`)\n}\n\nexport const parseProxyHeader = async (\n // Using subset of AppContext for testing purposes\n ctx: Pick<AppContext, 'cfg' | 'idResolver'>,\n proxyTo: string,\n): Promise<{ did: string; url: string }> => {\n // /!\\ Hot path\n\n const hashIndex = proxyTo.indexOf('#')\n\n if (hashIndex === 0) {\n throw new InvalidRequestError('no did specified in proxy header')\n }\n\n if (hashIndex === -1 || hashIndex === proxyTo.length - 1) {\n throw new InvalidRequestError('no service id specified in proxy header')\n }\n\n // More than one hash\n if (proxyTo.indexOf('#', hashIndex + 1) !== -1) {\n throw new InvalidRequestError('invalid proxy header format')\n }\n\n // Basic validation\n if (proxyTo.includes(' ')) {\n throw new InvalidRequestError('proxy header cannot contain spaces')\n }\n\n const did = proxyTo.slice(0, hashIndex)\n\n // Special case a configured appview, while still proxying correctly any other appview\n if (\n ctx.cfg.bskyAppView &&\n proxyTo === `${ctx.cfg.bskyAppView.did}#bsky_appview`\n ) {\n return { did, url: ctx.cfg.bskyAppView.url }\n }\n\n const didDoc = await ctx.idResolver.did.resolve(did)\n if (!didDoc) {\n throw new InvalidRequestError('could not resolve proxy did')\n }\n\n const serviceId = proxyTo.slice(hashIndex)\n const url = getServiceEndpoint(didDoc, { id: serviceId })\n if (!url) {\n throw new InvalidRequestError('could not resolve proxy did service url')\n }\n\n return { did, url }\n}\n\n/**\n * Utility function that wraps the undici stream() function and handles request\n * and response errors by wrapping them in XRPCError instances. This function is\n * more efficient than \"pipethroughRequest\" when a writable stream to pipe the\n * upstream response to is available.\n */\nasync function pipethroughStream(\n ctx: AppContext,\n dispatchOptions: Dispatcher.RequestOptions,\n successStreamFactory: Dispatcher.StreamFactory,\n): Promise<void> {\n return new Promise<void>((resolve, reject) => {\n void ctx.proxyAgent\n .stream(dispatchOptions, (upstream) => {\n if (upstream.statusCode >= 400) {\n const passThrough = new PassThrough()\n\n void tryParsingError(upstream.headers, passThrough).then((parsed) => {\n const xrpcError = new XRPCClientError(\n upstream.statusCode === 500\n ? ResponseType.UpstreamFailure\n : upstream.statusCode,\n parsed.error,\n parsed.message,\n Object.fromEntries(responseHeaders(upstream.headers, false)),\n { cause: dispatchOptions },\n )\n\n reject(xrpcError)\n }, reject)\n\n return passThrough\n }\n\n const writable = successStreamFactory(upstream)\n\n // As soon as the control was passed to the writable stream (i.e. by\n // returning the writable hereafter), pipethroughStream() is considered\n // to have succeeded. Any error occurring while writing upstream data to\n // the writable stream should be handled through the stream's error\n // state (i.e. successStreamFactory() must ensure that error events on\n // the returned writable will be handled).\n resolve()\n\n return writable\n })\n // The following catch block will be triggered with either network errors\n // or writable stream errors. In the latter case, the promise will already\n // be resolved, and reject()ing it there after will have no effect. Those\n // error would still be logged by the successStreamFactory() function.\n .catch(handleUpstreamRequestError)\n .catch(reject)\n })\n}\n\n/**\n * Utility function that wraps the undici request() function and handles request\n * and response errors by wrapping them in XRPCError instances.\n */\nasync function pipethroughRequest(\n ctx: AppContext,\n dispatchOptions: Dispatcher.RequestOptions,\n) {\n // HandlerPipeThroughStream requires a readable stream to be returned, so we\n // use the (less efficient) request() function instead.\n\n const upstream = await ctx.proxyAgent\n .request(dispatchOptions)\n .catch(handleUpstreamRequestError)\n\n if (upstream.statusCode >= 400) {\n const parsed = await tryParsingError(upstream.headers, upstream.body)\n\n // Note \"XRPCClientError\" is used instead of \"XRPCServerError\" in order to\n // allow users of this function to capture & handle these errors (namely in\n // \"app.bsky.feed.getPostThread\").\n throw new XRPCClientError(\n upstream.statusCode === 500\n ? ResponseType.UpstreamFailure\n : upstream.statusCode,\n parsed.error,\n parsed.message,\n Object.fromEntries(responseHeaders(upstream.headers, false)),\n { cause: dispatchOptions },\n )\n }\n\n return upstream\n}\n\nfunction handleUpstreamRequestError(\n err: unknown,\n message = 'Upstream service unreachable',\n): never {\n httpLogger.error({ err }, message)\n throw new XRPCServerError(ResponseType.UpstreamFailure, message, undefined, {\n cause: err,\n })\n}\n\n// Request parsing/forwarding\n// -------------------\n\nexport function isJsonContentType(contentType?: string): boolean | undefined {\n if (!contentType) return undefined\n return /application\\/(?:\\w+\\+)?json/i.test(contentType)\n}\n\nasync function tryParsingError(\n headers: IncomingHttpHeaders,\n readable: Readable,\n): Promise<{ error?: string; message?: string }> {\n if (isJsonContentType(headers['content-type']) === false) {\n // We don't known how to parse non JSON content types so we can discard the\n // whole response.\n\n // Since we don't care about the response, we would normally just destroy\n // the stream. However, if the underlying HTTP connection is an HTTP/1.1\n // connection, this also destroys the underlying (keep-alive) TCP socket. In\n // order to avoid destroying the TCP socket, while avoiding the cost of\n // consuming too much IO, we give it a chance to finish first.\n\n // @NOTE we need to listen (and ignore) \"error\" events, otherwise the\n // process could crash (since we drain the stream asynchronously here). This\n // is performed through the \"finished\" call below.\n\n const to = setTimeout(() => {\n readable.destroy()\n }, 100)\n finished(readable, (_err) => {\n clearTimeout(to)\n })\n readable.resume()\n\n return {}\n }\n\n try {\n const buffer = await bufferUpstreamResponse(\n readable,\n headers['content-encoding'],\n )\n\n const errInfo: unknown = JSON.parse(buffer.toString('utf8'))\n return {\n error: safeString(errInfo?.['error']),\n message: safeString(errInfo?.['message']),\n }\n } catch (err) {\n // Failed to read, decode, buffer or parse. No big deal.\n return {}\n }\n}\n\nasync function bufferUpstreamResponse(\n readable: Readable,\n contentEncoding?: string | string[],\n): Promise<Buffer> {\n try {\n return await streamToNodeBuffer(decodeStream(readable, contentEncoding))\n } catch (err) {\n if (!readable.destroyed) readable.destroy()\n\n throw new XRPCServerError(\n ResponseType.UpstreamFailure,\n err instanceof TypeError ? err.message : 'unable to decode request body',\n undefined,\n { cause: err },\n )\n }\n}\n\nexport async function asPipeThroughBuffer(\n input: HandlerPipeThroughStream,\n): Promise<HandlerPipeThroughBuffer> {\n return {\n buffer: await bufferUpstreamResponse(\n input.stream,\n input.headers?.['content-encoding'],\n ),\n headers: omit(input.headers, ['content-encoding', 'content-length']),\n encoding: input.encoding,\n }\n}\n\n// Response parsing/forwarding\n// -------------------\n\nconst RES_HEADERS_TO_FORWARD = [\n 'atproto-repo-rev',\n 'atproto-content-labelers',\n 'retry-after',\n]\n\nfunction* responseHeaders(\n headers: IncomingHttpHeaders,\n includeContentHeaders = true,\n): Generator<[string, string]> {\n if (includeContentHeaders) {\n const length = headers['content-length']\n if (length) yield ['content-length', length]\n\n const encoding = headers['content-encoding']\n if (encoding) yield ['content-encoding', encoding]\n\n const type = headers['content-type']\n if (type) yield ['content-type', type]\n\n const language = headers['content-language']\n if (language) yield ['content-language', language]\n }\n\n for (let i = 0; i < RES_HEADERS_TO_FORWARD.length; i++) {\n const name = RES_HEADERS_TO_FORWARD[i]\n const val = headers[name]\n\n if (val != null) {\n const value: string = Array.isArray(val) ? val.join(',') : val\n yield [name, value]\n }\n }\n}\n\n// Utils\n// -------------------\n\n/**\n * Performs lexicon method matching on a set of methods,\n * taking into account that they are treated case-insensitively.\n */\nexport class LxmSet {\n private inner: Set<string>\n private original: Iterable<string>\n constructor(items: Iterable<string>) {\n this.inner = new Set(Array.from(items, normalizeLxm))\n this.original = items\n }\n has(lxm: string) {\n return this.inner.has(normalizeLxm(lxm))\n }\n *[Symbol.iterator](): Iterator<string> {\n yield* this.original\n }\n}\n\nexport function normalizeLxm(lxm: string) {\n return lxm.toLowerCase()\n}\n\nexport const CHAT_BSKY_METHODS = new LxmSet([\n ids.ChatBskyActorDeleteAccount,\n ids.ChatBskyActorExportAccountData,\n ids.ChatBskyConvoDeleteMessageForSelf,\n ids.ChatBskyConvoGetConvo,\n ids.ChatBskyConvoGetConvoForMembers,\n ids.ChatBskyConvoGetLog,\n ids.ChatBskyConvoGetMessages,\n ids.ChatBskyConvoLeaveConvo,\n ids.ChatBskyConvoListConvos,\n ids.ChatBskyConvoMuteConvo,\n ids.ChatBskyConvoSendMessage,\n ids.ChatBskyConvoSendMessageBatch,\n ids.ChatBskyConvoUnmuteConvo,\n ids.ChatBskyConvoUpdateRead,\n])\n\nexport const PRIVILEGED_METHODS = new LxmSet([\n ...CHAT_BSKY_METHODS,\n ids.ComAtprotoServerCreateAccount,\n])\n\n// These endpoints are related to account management and must be used directly,\n// not proxied or service-authed. Service auth may be utilized between PDS and\n// entryway for these methods.\nexport const PROTECTED_METHODS = new LxmSet([\n ids.ComAtprotoAdminSendEmail,\n ids.ComAtprotoIdentityRequestPlcOperationSignature,\n ids.ComAtprotoIdentitySignPlcOperation,\n ids.ComAtprotoIdentityUpdateHandle,\n ids.ComAtprotoServerActivateAccount,\n ids.ComAtprotoServerConfirmEmail,\n ids.ComAtprotoServerCreateAppPassword,\n ids.ComAtprotoServerDeactivateAccount,\n ids.ComAtprotoServerGetAccountInviteCodes,\n ids.ComAtprotoServerGetSession,\n ids.ComAtprotoServerListAppPasswords,\n ids.ComAtprotoServerRequestAccountDelete,\n ids.ComAtprotoServerRequestEmailConfirmation,\n ids.ComAtprotoServerRequestEmailUpdate,\n ids.ComAtprotoServerRevokeAppPassword,\n ids.ComAtprotoServerUpdateEmail,\n])\n\nconst defaultService = (\n ctx: AppContext,\n nsid: string,\n): {\n serviceId: string\n serviceInfo: { url: string; did: string } | null\n} => {\n switch (nsid) {\n case ids.ToolsOzoneTeamAddMember:\n case ids.ToolsOzoneTeamDeleteMember:\n case ids.ToolsOzoneTeamUpdateMember:\n case ids.ToolsOzoneTeamListMembers:\n case ids.ToolsOzoneCommunicationCreateTemplate:\n case ids.ToolsOzoneCommunicationDeleteTemplate:\n case ids.ToolsOzoneCommunicationUpdateTemplate:\n case ids.ToolsOzoneCommunicationListTemplates:\n case ids.ToolsOzoneModerationEmitEvent:\n case ids.ToolsOzoneModerationGetEvent:\n case ids.ToolsOzoneModerationGetRecord:\n case ids.ToolsOzoneModerationGetRepo:\n case ids.ToolsOzoneModerationQueryEvents:\n case ids.ToolsOzoneModerationQueryStatuses:\n case ids.ToolsOzoneModerationSearchRepos:\n case ids.ToolsOzoneModerationGetAccountTimeline:\n case ids.ToolsOzoneVerificationListVerifications:\n case ids.ToolsOzoneVerificationGrantVerifications:\n case ids.ToolsOzoneVerificationRevokeVerifications:\n case ids.ToolsOzoneSafelinkAddRule:\n case ids.ToolsOzoneSafelinkUpdateRule:\n case ids.ToolsOzoneSafelinkRemoveRule:\n case ids.ToolsOzoneSafelinkQueryEvents:\n case ids.ToolsOzoneSafelinkQueryRules:\n case ids.ToolsOzoneModerationListScheduledActions:\n case ids.ToolsOzoneModerationCancelScheduledActions:\n case ids.ToolsOzoneModerationScheduleAction:\n return {\n serviceId: 'atproto_labeler',\n serviceInfo: ctx.cfg.modService,\n }\n case ids.ComAtprotoModerationCreateReport:\n return {\n serviceId: 'atproto_labeler',\n serviceInfo: ctx.cfg.reportService,\n }\n default:\n return {\n serviceId: 'bsky_appview',\n serviceInfo: ctx.cfg.bskyAppView,\n }\n }\n}\n\nconst safeString = (str: unknown): string | undefined => {\n return typeof str === 'string' ? str : undefined\n}\n\nfunction logResponseError(this: ServerResponse, err: unknown): void {\n httpLogger.warn({ err }, 'error forwarding upstream response')\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atproto/pds",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.210",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Reference implementation of atproto Personal Data Server (PDS)",
|
|
6
6
|
"keywords": [
|
|
@@ -53,18 +53,18 @@
|
|
|
53
53
|
"@atproto-labs/xrpc-utils": "^0.0.24",
|
|
54
54
|
"@atproto/api": "^0.18.21",
|
|
55
55
|
"@atproto/aws": "^0.2.31",
|
|
56
|
-
"@atproto/common": "^0.5.
|
|
56
|
+
"@atproto/common": "^0.5.12",
|
|
57
57
|
"@atproto/crypto": "^0.4.5",
|
|
58
58
|
"@atproto/identity": "^0.4.11",
|
|
59
|
-
"@atproto/lex-cbor": "^0.0.
|
|
60
|
-
"@atproto/lex-data": "^0.0.
|
|
59
|
+
"@atproto/lex-cbor": "^0.0.12",
|
|
60
|
+
"@atproto/lex-data": "^0.0.12",
|
|
61
61
|
"@atproto/lexicon": "^0.6.1",
|
|
62
|
-
"@atproto/oauth-provider": "^0.15.
|
|
62
|
+
"@atproto/oauth-provider": "^0.15.10",
|
|
63
63
|
"@atproto/oauth-scopes": "^0.3.1",
|
|
64
64
|
"@atproto/repo": "^0.8.12",
|
|
65
65
|
"@atproto/syntax": "^0.4.3",
|
|
66
66
|
"@atproto/xrpc": "^0.7.7",
|
|
67
|
-
"@atproto/xrpc-server": "^0.10.
|
|
67
|
+
"@atproto/xrpc-server": "^0.10.13"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"@atproto/pds-entryway": "npm:@atproto/pds@0.3.0-entryway.3",
|
|
@@ -78,12 +78,12 @@
|
|
|
78
78
|
"esbuild-plugin-handlebars": "^1.0.3",
|
|
79
79
|
"get-port": "^6.1.2",
|
|
80
80
|
"jest": "^28.1.2",
|
|
81
|
-
"puppeteer": "^23.
|
|
81
|
+
"puppeteer": "^23.11.1",
|
|
82
82
|
"ts-node": "^10.8.2",
|
|
83
83
|
"typescript": "^5.6.3",
|
|
84
84
|
"ws": "^8.12.0",
|
|
85
85
|
"@atproto/api": "^0.18.21",
|
|
86
|
-
"@atproto/bsky": "^0.0.
|
|
86
|
+
"@atproto/bsky": "^0.0.216",
|
|
87
87
|
"@atproto/lex-cli": "^0.9.8",
|
|
88
88
|
"@atproto/oauth-client-browser-example": "^0.0.10"
|
|
89
89
|
},
|
|
@@ -92,6 +92,7 @@
|
|
|
92
92
|
"build": "tsc --build tsconfig.build.json",
|
|
93
93
|
"postbuild": "node ./build.templates.js",
|
|
94
94
|
"dev": "node ./build.templates.js --watch",
|
|
95
|
+
"pretest": "puppeteer browsers install chrome",
|
|
95
96
|
"test": "../dev-infra/with-test-redis-and-db.sh jest",
|
|
96
97
|
"test:sqlite": "jest",
|
|
97
98
|
"test:sqlite-only": "jest --testPathIgnorePatterns /tests/proxied/*",
|
package/src/lexicon/index.ts
CHANGED
|
@@ -91,13 +91,13 @@ import * as AppBskyUnspeccedGetAgeAssuranceState from './types/app/bsky/unspecce
|
|
|
91
91
|
import * as AppBskyUnspeccedGetConfig from './types/app/bsky/unspecced/getConfig.js'
|
|
92
92
|
import * as AppBskyUnspeccedGetOnboardingSuggestedStarterPacks from './types/app/bsky/unspecced/getOnboardingSuggestedStarterPacks.js'
|
|
93
93
|
import * as AppBskyUnspeccedGetOnboardingSuggestedStarterPacksSkeleton from './types/app/bsky/unspecced/getOnboardingSuggestedStarterPacksSkeleton.js'
|
|
94
|
+
import * as AppBskyUnspeccedGetOnboardingSuggestedUsersSkeleton from './types/app/bsky/unspecced/getOnboardingSuggestedUsersSkeleton.js'
|
|
94
95
|
import * as AppBskyUnspeccedGetPopularFeedGenerators from './types/app/bsky/unspecced/getPopularFeedGenerators.js'
|
|
95
96
|
import * as AppBskyUnspeccedGetPostThreadOtherV2 from './types/app/bsky/unspecced/getPostThreadOtherV2.js'
|
|
96
97
|
import * as AppBskyUnspeccedGetPostThreadV2 from './types/app/bsky/unspecced/getPostThreadV2.js'
|
|
97
98
|
import * as AppBskyUnspeccedGetSuggestedFeeds from './types/app/bsky/unspecced/getSuggestedFeeds.js'
|
|
98
99
|
import * as AppBskyUnspeccedGetSuggestedFeedsSkeleton from './types/app/bsky/unspecced/getSuggestedFeedsSkeleton.js'
|
|
99
100
|
import * as AppBskyUnspeccedGetSuggestedOnboardingUsers from './types/app/bsky/unspecced/getSuggestedOnboardingUsers.js'
|
|
100
|
-
import * as AppBskyUnspeccedGetSuggestedOnboardingUsersSkeleton from './types/app/bsky/unspecced/getSuggestedOnboardingUsersSkeleton.js'
|
|
101
101
|
import * as AppBskyUnspeccedGetSuggestedStarterPacks from './types/app/bsky/unspecced/getSuggestedStarterPacks.js'
|
|
102
102
|
import * as AppBskyUnspeccedGetSuggestedStarterPacksSkeleton from './types/app/bsky/unspecced/getSuggestedStarterPacksSkeleton.js'
|
|
103
103
|
import * as AppBskyUnspeccedGetSuggestedUsers from './types/app/bsky/unspecced/getSuggestedUsers.js'
|
|
@@ -1507,6 +1507,18 @@ export class AppBskyUnspeccedNS {
|
|
|
1507
1507
|
return this._server.xrpc.method(nsid, cfg)
|
|
1508
1508
|
}
|
|
1509
1509
|
|
|
1510
|
+
getOnboardingSuggestedUsersSkeleton<A extends Auth = void>(
|
|
1511
|
+
cfg: MethodConfigOrHandler<
|
|
1512
|
+
A,
|
|
1513
|
+
AppBskyUnspeccedGetOnboardingSuggestedUsersSkeleton.QueryParams,
|
|
1514
|
+
AppBskyUnspeccedGetOnboardingSuggestedUsersSkeleton.HandlerInput,
|
|
1515
|
+
AppBskyUnspeccedGetOnboardingSuggestedUsersSkeleton.HandlerOutput
|
|
1516
|
+
>,
|
|
1517
|
+
) {
|
|
1518
|
+
const nsid = 'app.bsky.unspecced.getOnboardingSuggestedUsersSkeleton' // @ts-ignore
|
|
1519
|
+
return this._server.xrpc.method(nsid, cfg)
|
|
1520
|
+
}
|
|
1521
|
+
|
|
1510
1522
|
getPopularFeedGenerators<A extends Auth = void>(
|
|
1511
1523
|
cfg: MethodConfigOrHandler<
|
|
1512
1524
|
A,
|
|
@@ -1579,18 +1591,6 @@ export class AppBskyUnspeccedNS {
|
|
|
1579
1591
|
return this._server.xrpc.method(nsid, cfg)
|
|
1580
1592
|
}
|
|
1581
1593
|
|
|
1582
|
-
getSuggestedOnboardingUsersSkeleton<A extends Auth = void>(
|
|
1583
|
-
cfg: MethodConfigOrHandler<
|
|
1584
|
-
A,
|
|
1585
|
-
AppBskyUnspeccedGetSuggestedOnboardingUsersSkeleton.QueryParams,
|
|
1586
|
-
AppBskyUnspeccedGetSuggestedOnboardingUsersSkeleton.HandlerInput,
|
|
1587
|
-
AppBskyUnspeccedGetSuggestedOnboardingUsersSkeleton.HandlerOutput
|
|
1588
|
-
>,
|
|
1589
|
-
) {
|
|
1590
|
-
const nsid = 'app.bsky.unspecced.getSuggestedOnboardingUsersSkeleton' // @ts-ignore
|
|
1591
|
-
return this._server.xrpc.method(nsid, cfg)
|
|
1592
|
-
}
|
|
1593
|
-
|
|
1594
1594
|
getSuggestedStarterPacks<A extends Auth = void>(
|
|
1595
1595
|
cfg: MethodConfigOrHandler<
|
|
1596
1596
|
A,
|