@atproto/lex-client 0.0.9 → 0.0.10
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 +15 -0
- package/LICENSE.txt +1 -1
- package/dist/client.d.ts +56 -39
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +2 -6
- package/dist/client.js.map +1 -1
- package/dist/errors.d.ts +15 -15
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +17 -17
- package/dist/errors.js.map +1 -1
- package/dist/lexicons/com/atproto/repo/createRecord.defs.d.ts +20 -10
- package/dist/lexicons/com/atproto/repo/createRecord.defs.d.ts.map +1 -1
- package/dist/lexicons/com/atproto/repo/defs.defs.d.ts +1 -1
- package/dist/lexicons/com/atproto/repo/defs.defs.d.ts.map +1 -1
- package/dist/lexicons/com/atproto/repo/deleteRecord.defs.d.ts +14 -6
- package/dist/lexicons/com/atproto/repo/deleteRecord.defs.d.ts.map +1 -1
- package/dist/lexicons/com/atproto/repo/getRecord.defs.d.ts +12 -4
- package/dist/lexicons/com/atproto/repo/getRecord.defs.d.ts.map +1 -1
- package/dist/lexicons/com/atproto/repo/listRecords.defs.d.ts +11 -11
- package/dist/lexicons/com/atproto/repo/listRecords.defs.d.ts.map +1 -1
- package/dist/lexicons/com/atproto/repo/listRecords.defs.js +2 -1
- package/dist/lexicons/com/atproto/repo/listRecords.defs.js.map +1 -1
- package/dist/lexicons/com/atproto/repo/putRecord.defs.d.ts +18 -10
- package/dist/lexicons/com/atproto/repo/putRecord.defs.d.ts.map +1 -1
- package/dist/response.d.ts +12 -12
- package/dist/response.d.ts.map +1 -1
- package/dist/response.js +17 -19
- package/dist/response.js.map +1 -1
- package/dist/util.d.ts +1 -1
- package/dist/util.d.ts.map +1 -1
- package/dist/util.js.map +1 -1
- package/dist/xrpc.d.ts +17 -16
- package/dist/xrpc.d.ts.map +1 -1
- package/dist/xrpc.js +12 -16
- package/dist/xrpc.js.map +1 -1
- package/package.json +6 -6
- package/src/client.ts +33 -32
- package/src/errors.ts +26 -28
- package/src/lexicons/com/atproto/repo/listRecords.defs.ts +4 -1
- package/src/response.ts +28 -30
- package/src/util.ts +1 -1
- package/src/xrpc.ts +58 -68
package/dist/errors.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
3
|
+
exports.XrpcUnexpectedError = exports.XrpcUpstreamError = exports.XrpcResponseError = exports.XrpcError = exports.LexError = void 0;
|
|
4
|
+
exports.isXrpcErrorPayload = isXrpcErrorPayload;
|
|
5
5
|
const lex_data_1 = require("@atproto/lex-data");
|
|
6
6
|
Object.defineProperty(exports, "LexError", { enumerable: true, get: function () { return lex_data_1.LexError; } });
|
|
7
7
|
const lex_schema_1 = require("@atproto/lex-schema");
|
|
8
|
-
class
|
|
9
|
-
name = '
|
|
8
|
+
class XrpcError extends lex_data_1.LexError {
|
|
9
|
+
name = 'XrpcError';
|
|
10
10
|
constructor(error, message = `${error} Lexicon RPC error`, options) {
|
|
11
11
|
super(error, message, options);
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
exports.
|
|
14
|
+
exports.XrpcError = XrpcError;
|
|
15
15
|
/**
|
|
16
16
|
* All unsuccessful responses should follow a standard error response
|
|
17
17
|
* schema. The Content-Type should be application/json, and the payload
|
|
@@ -24,7 +24,7 @@ exports.LexRpcError = LexRpcError;
|
|
|
24
24
|
*
|
|
25
25
|
* This function checks whether a given payload matches this schema.
|
|
26
26
|
*/
|
|
27
|
-
function
|
|
27
|
+
function isXrpcErrorPayload(payload) {
|
|
28
28
|
return (payload !== null &&
|
|
29
29
|
payload.encoding === 'application/json' &&
|
|
30
30
|
lex_schema_1.l.lexErrorData.matches(payload.body));
|
|
@@ -33,12 +33,12 @@ function isLexRpcErrorPayload(payload) {
|
|
|
33
33
|
* Class used to represent an HTTP request that resulted in an XRPC method error
|
|
34
34
|
* That is, a non-2xx response with a valid XRPC error payload.
|
|
35
35
|
*/
|
|
36
|
-
class
|
|
36
|
+
class XrpcResponseError extends XrpcError {
|
|
37
37
|
method;
|
|
38
38
|
status;
|
|
39
39
|
headers;
|
|
40
40
|
payload;
|
|
41
|
-
name = '
|
|
41
|
+
name = 'XrpcResponseError';
|
|
42
42
|
constructor(method, status, headers, payload, options) {
|
|
43
43
|
const { error, message } = payload.body;
|
|
44
44
|
super(error, message, options);
|
|
@@ -71,12 +71,12 @@ class LexRpcResponseError extends LexRpcError {
|
|
|
71
71
|
return Response.json(this.toJSON(), { status, headers });
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
-
exports.
|
|
74
|
+
exports.XrpcResponseError = XrpcResponseError;
|
|
75
75
|
/**
|
|
76
76
|
* This class represents an invalid XRPC response from the server.
|
|
77
77
|
*/
|
|
78
|
-
class
|
|
79
|
-
name = '
|
|
78
|
+
class XrpcUpstreamError extends XrpcError {
|
|
79
|
+
name = 'XrpcUpstreamError';
|
|
80
80
|
// For debugging purposes, we keep the response details here
|
|
81
81
|
response;
|
|
82
82
|
constructor(error, message, response, payload, options) {
|
|
@@ -102,9 +102,9 @@ class LexRpcUpstreamError extends LexRpcError {
|
|
|
102
102
|
return Response.json(this.toJSON(), { status: 502 });
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
|
-
exports.
|
|
106
|
-
class
|
|
107
|
-
name = '
|
|
105
|
+
exports.XrpcUpstreamError = XrpcUpstreamError;
|
|
106
|
+
class XrpcUnexpectedError extends XrpcError {
|
|
107
|
+
name = 'XrpcUnexpectedError';
|
|
108
108
|
constructor(message, options) {
|
|
109
109
|
super('InternalServerError', message, options);
|
|
110
110
|
}
|
|
@@ -124,10 +124,10 @@ class LexRpcUnexpectedError extends LexRpcError {
|
|
|
124
124
|
static from(cause, message = cause instanceof lex_data_1.LexError
|
|
125
125
|
? cause.message
|
|
126
126
|
: 'XRPC request failed') {
|
|
127
|
-
if (cause instanceof
|
|
127
|
+
if (cause instanceof XrpcUnexpectedError)
|
|
128
128
|
return cause;
|
|
129
|
-
return new
|
|
129
|
+
return new XrpcUnexpectedError(message, { cause });
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
|
-
exports.
|
|
132
|
+
exports.XrpcUnexpectedError = XrpcUnexpectedError;
|
|
133
133
|
//# sourceMappingURL=errors.js.map
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":";;;AAoCA,gDAQC;AA5CD,gDAAwE;AAI/D,yFAJA,mBAAQ,OAIA;AAHjB,oDAAuC;AASvC,MAAa,SAEX,SAAQ,mBAAW;IACnB,IAAI,GAAG,WAAW,CAAA;IAElB,YACE,KAAQ,EACR,UAAkB,GAAG,KAAK,oBAAoB,EAC9C,OAAsB;QAEtB,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,CAAA;IAChC,CAAC;CACF;AAZD,8BAYC;AAED;;;;;;;;;;;GAWG;AACH,SAAgB,kBAAkB,CAChC,OAA2B;IAE3B,OAAO,CACL,OAAO,KAAK,IAAI;QAChB,OAAO,CAAC,QAAQ,KAAK,kBAAkB;QACvC,cAAC,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CACrC,CAAA;AACH,CAAC;AAWD;;;GAGG;AACH,MAAa,iBAIX,SAAQ,SAAY;IAMT;IACA;IACA;IACA;IANX,IAAI,GAAG,mBAAmB,CAAA;IAE1B,YACW,MAAS,EACT,MAAc,EACd,OAAgB,EAChB,OAA4B,EACrC,OAAsB;QAEtB,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,IAAI,CAAA;QACvC,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,C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/lex-data'\nimport { l } from '@atproto/lex-schema'\nimport { XrpcPayload } from './util.js'\n\nexport { LexError }\nexport type { LexErrorCode, LexErrorData }\n\nexport type XrpcErrorPayload<N extends LexErrorCode = LexErrorCode> =\n XrpcPayload<LexErrorData<N>, 'application/json'>\n\nexport class XrpcError<\n N extends LexErrorCode = LexErrorCode,\n> extends LexError<N> {\n name = 'XrpcError'\n\n constructor(\n error: N,\n message: string = `${error} Lexicon RPC error`,\n options?: ErrorOptions,\n ) {\n super(error, message, options)\n }\n}\n\n/**\n * All unsuccessful responses should follow a standard error response\n * schema. The Content-Type should be application/json, and the payload\n * should be a JSON object with the following fields:\n *\n * - `error` (string, required): type name of the error (generic ASCII\n * constant, no whitespace)\n * - `message` (string, optional): description of the error, appropriate for\n * display to humans\n *\n * This function checks whether a given payload matches this schema.\n */\nexport function isXrpcErrorPayload(\n payload: XrpcPayload | null,\n): payload is XrpcErrorPayload {\n return (\n payload !== null &&\n payload.encoding === 'application/json' &&\n l.lexErrorData.matches(payload.body)\n )\n}\n\n/**\n * Interface representing a failed XRPC request result.\n */\ntype LexRpcFailureResult<N extends LexErrorCode, E> = l.ResultFailure<E> & {\n readonly error: N\n shouldRetry(): boolean\n matchesSchema(): boolean\n}\n\n/**\n * Class used to represent an HTTP request that resulted in an XRPC method error\n * That is, a non-2xx response with a valid XRPC error payload.\n */\nexport class XrpcResponseError<\n M extends l.Procedure | l.Query = l.Procedure | l.Query,\n N extends LexErrorCode = LexErrorCode,\n >\n extends XrpcError<N>\n implements LexRpcFailureResult<N, XrpcResponseError<M, N>>\n{\n name = 'XrpcResponseError'\n\n constructor(\n readonly method: M,\n readonly status: number,\n readonly headers: Headers,\n readonly payload: XrpcErrorPayload<N>,\n options?: ErrorOptions,\n ) {\n const { error, message } = payload.body\n super(error, message, options)\n }\n\n readonly success = false\n\n get reason(): this {\n return this as this\n }\n\n get body(): LexErrorData {\n return this.payload.body\n }\n\n matchesSchema(): this is M extends {\n errors: readonly (infer E extends string)[]\n }\n ? XrpcResponseError<M, E>\n : never {\n return this.method.errors?.includes(this.error) ?? false\n }\n\n shouldRetry(): boolean {\n // Do not retry client errors\n if (this.status < 500) return false\n\n return true\n }\n\n toJSON() {\n return this.payload.body\n }\n\n toResponse(): Response {\n const { status, headers } = this\n return Response.json(this.toJSON(), { status, headers })\n }\n}\n\n/**\n * This class represents an invalid XRPC response from the server.\n */\nexport class XrpcUpstreamError<\n N extends 'InvalidResponse' | 'UpstreamFailure' =\n | 'InvalidResponse'\n | 'UpstreamFailure',\n >\n extends XrpcError<N>\n implements LexRpcFailureResult<N, XrpcUpstreamError<N>>\n{\n name = 'XrpcUpstreamError' as const\n\n // For debugging purposes, we keep the response details here\n readonly response: {\n status: number\n headers: Headers\n payload: XrpcPayload | null\n }\n\n constructor(\n error: N,\n message: string,\n response: { status: number; headers: Headers },\n payload: XrpcPayload | null,\n options?: ErrorOptions,\n ) {\n super(error, message, { cause: options?.cause })\n this.response = {\n status: response.status,\n headers: response.headers,\n payload,\n }\n }\n\n readonly success = false as const\n\n get reason(): this {\n return this\n }\n\n matchesSchema(): false {\n return false\n }\n\n shouldRetry(): boolean {\n // Do not retry client errors\n return this.response.status >= 500\n }\n\n toResponse(): Response {\n return Response.json(this.toJSON(), { status: 502 })\n }\n}\n\nexport class XrpcUnexpectedError\n extends XrpcError<'InternalServerError'>\n implements LexRpcFailureResult<'InternalServerError', unknown>\n{\n name = 'XrpcUnexpectedError' as const\n\n protected constructor(message: string, options: Required<ErrorOptions>) {\n super('InternalServerError', message, options)\n }\n\n readonly success = false\n\n get reason() {\n return this.cause\n }\n\n matchesSchema(): false {\n return false\n }\n\n shouldRetry(): boolean {\n return true\n }\n\n toResponse(): Response {\n return Response.json(this.toJSON(), { status: 500 })\n }\n\n static from(\n cause: unknown,\n message: string = cause instanceof LexError\n ? cause.message\n : 'XRPC request failed',\n ): XrpcUnexpectedError {\n if (cause instanceof XrpcUnexpectedError) return cause\n return new XrpcUnexpectedError(message, { cause })\n }\n}\n"]}
|
|
@@ -10,10 +10,15 @@ declare const main: l.Procedure<"com.atproto.repo.createRecord", l.ParamsSchema<
|
|
|
10
10
|
readonly collection: l.StringSchema<{
|
|
11
11
|
readonly format: "nsid";
|
|
12
12
|
}>;
|
|
13
|
-
readonly rkey: l.OptionalSchema<
|
|
14
|
-
|
|
13
|
+
readonly rkey: l.OptionalSchema<l.StringSchema<{
|
|
14
|
+
readonly format: "record-key";
|
|
15
|
+
readonly maxLength: 512;
|
|
16
|
+
}>>;
|
|
17
|
+
readonly validate: l.OptionalSchema<l.BooleanSchema>;
|
|
15
18
|
readonly record: l.UnknownObjectSchema;
|
|
16
|
-
readonly swapCommit: l.OptionalSchema<
|
|
19
|
+
readonly swapCommit: l.OptionalSchema<l.StringSchema<{
|
|
20
|
+
readonly format: "cid";
|
|
21
|
+
}>>;
|
|
17
22
|
}>>, l.Payload<"application/json", l.ObjectSchema<{
|
|
18
23
|
readonly uri: l.StringSchema<{
|
|
19
24
|
readonly format: "at-uri";
|
|
@@ -21,8 +26,8 @@ declare const main: l.Procedure<"com.atproto.repo.createRecord", l.ParamsSchema<
|
|
|
21
26
|
readonly cid: l.StringSchema<{
|
|
22
27
|
readonly format: "cid";
|
|
23
28
|
}>;
|
|
24
|
-
readonly commit: l.OptionalSchema<RepoDefs.CommitMeta
|
|
25
|
-
readonly validationStatus: l.OptionalSchema<
|
|
29
|
+
readonly commit: l.OptionalSchema<l.RefSchema<l.Validator<RepoDefs.CommitMeta, RepoDefs.CommitMeta>>>;
|
|
30
|
+
readonly validationStatus: l.OptionalSchema<l.StringSchema<{}>>;
|
|
26
31
|
}>>, readonly ["InvalidSwap"]>;
|
|
27
32
|
export { main };
|
|
28
33
|
export type Params = l.InferMethodParams<typeof main>;
|
|
@@ -37,10 +42,15 @@ export declare const $lxm: "com.atproto.repo.createRecord", $params: l.ParamsSch
|
|
|
37
42
|
readonly collection: l.StringSchema<{
|
|
38
43
|
readonly format: "nsid";
|
|
39
44
|
}>;
|
|
40
|
-
readonly rkey: l.OptionalSchema<
|
|
41
|
-
|
|
45
|
+
readonly rkey: l.OptionalSchema<l.StringSchema<{
|
|
46
|
+
readonly format: "record-key";
|
|
47
|
+
readonly maxLength: 512;
|
|
48
|
+
}>>;
|
|
49
|
+
readonly validate: l.OptionalSchema<l.BooleanSchema>;
|
|
42
50
|
readonly record: l.UnknownObjectSchema;
|
|
43
|
-
readonly swapCommit: l.OptionalSchema<
|
|
51
|
+
readonly swapCommit: l.OptionalSchema<l.StringSchema<{
|
|
52
|
+
readonly format: "cid";
|
|
53
|
+
}>>;
|
|
44
54
|
}>>, $output: l.Payload<"application/json", l.ObjectSchema<{
|
|
45
55
|
readonly uri: l.StringSchema<{
|
|
46
56
|
readonly format: "at-uri";
|
|
@@ -48,7 +58,7 @@ export declare const $lxm: "com.atproto.repo.createRecord", $params: l.ParamsSch
|
|
|
48
58
|
readonly cid: l.StringSchema<{
|
|
49
59
|
readonly format: "cid";
|
|
50
60
|
}>;
|
|
51
|
-
readonly commit: l.OptionalSchema<RepoDefs.CommitMeta
|
|
52
|
-
readonly validationStatus: l.OptionalSchema<
|
|
61
|
+
readonly commit: l.OptionalSchema<l.RefSchema<l.Validator<RepoDefs.CommitMeta, RepoDefs.CommitMeta>>>;
|
|
62
|
+
readonly validationStatus: l.OptionalSchema<l.StringSchema<{}>>;
|
|
53
63
|
}>>;
|
|
54
64
|
//# sourceMappingURL=createRecord.defs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createRecord.defs.d.ts","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/repo/createRecord.defs.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,qBAAqB,CAAA;AACvC,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAA;AAE1C,QAAA,MAAM,KAAK,kCAAkC,CAAA;AAE7C,OAAO,EAAE,KAAK,EAAE,CAAA;AAEhB,gFAAgF;AAChF,QAAA,MAAM,IAAI
|
|
1
|
+
{"version":3,"file":"createRecord.defs.d.ts","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/repo/createRecord.defs.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,qBAAqB,CAAA;AACvC,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAA;AAE1C,QAAA,MAAM,KAAK,kCAAkC,CAAA;AAE7C,OAAO,EAAE,KAAK,EAAE,CAAA;AAEhB,gFAAgF;AAChF,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;8BA4BP,CAAA;AACH,OAAO,EAAE,IAAI,EAAE,CAAA;AAEf,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,iBAAiB,CAAC,OAAO,IAAI,CAAC,CAAA;AACrD,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,gBAAgB,CAAC,OAAO,IAAI,CAAC,CAAA;AACnD,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,oBAAoB,CAAC,OAAO,IAAI,CAAC,CAAA;AAC3D,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,iBAAiB,CAAC,OAAO,IAAI,CAAC,CAAA;AACrD,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,qBAAqB,CAAC,OAAO,IAAI,CAAC,CAAA;AAE7D,eAAO,MAAM,IAAI,iCAA0B,EACzC,OAAO,oBAAgC,EACvC,MAAM;;;;;;;;;;;;;;;;GAA2B,EACjC,OAAO;;;;;;;;;GAA4B,CAAA"}
|
|
@@ -7,6 +7,6 @@ type CommitMeta = {
|
|
|
7
7
|
rev: l.TidString;
|
|
8
8
|
};
|
|
9
9
|
export type { CommitMeta };
|
|
10
|
-
declare const commitMeta: l.TypedObjectSchema<"com.atproto.repo.defs#commitMeta", l.Validator<
|
|
10
|
+
declare const commitMeta: l.TypedObjectSchema<"com.atproto.repo.defs#commitMeta", l.Validator<CommitMeta, CommitMeta>>;
|
|
11
11
|
export { commitMeta };
|
|
12
12
|
//# sourceMappingURL=defs.defs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defs.defs.d.ts","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/repo/defs.defs.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,qBAAqB,CAAA;AAEvC,QAAA,MAAM,KAAK,0BAA0B,CAAA;AAErC,OAAO,EAAE,KAAK,EAAE,CAAA;AAEhB,KAAK,UAAU,GAAG;IAChB,KAAK,CAAC,EAAE,kCAAkC,CAAA;IAC1C,GAAG,EAAE,CAAC,CAAC,SAAS,CAAA;IAChB,GAAG,EAAE,CAAC,CAAC,SAAS,CAAA;CACjB,CAAA;AAED,YAAY,EAAE,UAAU,EAAE,CAAA;AAE1B,QAAA,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"defs.defs.d.ts","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/repo/defs.defs.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,qBAAqB,CAAA;AAEvC,QAAA,MAAM,KAAK,0BAA0B,CAAA;AAErC,OAAO,EAAE,KAAK,EAAE,CAAA;AAEhB,KAAK,UAAU,GAAG;IAChB,KAAK,CAAC,EAAE,kCAAkC,CAAA;IAC1C,GAAG,EAAE,CAAC,CAAC,SAAS,CAAA;IAChB,GAAG,EAAE,CAAC,CAAC,SAAS,CAAA;CACjB,CAAA;AAED,YAAY,EAAE,UAAU,EAAE,CAAA;AAE1B,QAAA,MAAM,UAAU,8FAOf,CAAA;AAED,OAAO,EAAE,UAAU,EAAE,CAAA"}
|
|
@@ -13,10 +13,14 @@ declare const main: l.Procedure<"com.atproto.repo.deleteRecord", l.ParamsSchema<
|
|
|
13
13
|
readonly rkey: l.StringSchema<{
|
|
14
14
|
readonly format: "record-key";
|
|
15
15
|
}>;
|
|
16
|
-
readonly swapRecord: l.OptionalSchema<
|
|
17
|
-
|
|
16
|
+
readonly swapRecord: l.OptionalSchema<l.StringSchema<{
|
|
17
|
+
readonly format: "cid";
|
|
18
|
+
}>>;
|
|
19
|
+
readonly swapCommit: l.OptionalSchema<l.StringSchema<{
|
|
20
|
+
readonly format: "cid";
|
|
21
|
+
}>>;
|
|
18
22
|
}>>, l.Payload<"application/json", l.ObjectSchema<{
|
|
19
|
-
readonly commit: l.OptionalSchema<RepoDefs.CommitMeta
|
|
23
|
+
readonly commit: l.OptionalSchema<l.RefSchema<l.Validator<RepoDefs.CommitMeta, RepoDefs.CommitMeta>>>;
|
|
20
24
|
}>>, readonly ["InvalidSwap"]>;
|
|
21
25
|
export { main };
|
|
22
26
|
export type Params = l.InferMethodParams<typeof main>;
|
|
@@ -34,9 +38,13 @@ export declare const $lxm: "com.atproto.repo.deleteRecord", $params: l.ParamsSch
|
|
|
34
38
|
readonly rkey: l.StringSchema<{
|
|
35
39
|
readonly format: "record-key";
|
|
36
40
|
}>;
|
|
37
|
-
readonly swapRecord: l.OptionalSchema<
|
|
38
|
-
|
|
41
|
+
readonly swapRecord: l.OptionalSchema<l.StringSchema<{
|
|
42
|
+
readonly format: "cid";
|
|
43
|
+
}>>;
|
|
44
|
+
readonly swapCommit: l.OptionalSchema<l.StringSchema<{
|
|
45
|
+
readonly format: "cid";
|
|
46
|
+
}>>;
|
|
39
47
|
}>>, $output: l.Payload<"application/json", l.ObjectSchema<{
|
|
40
|
-
readonly commit: l.OptionalSchema<RepoDefs.CommitMeta
|
|
48
|
+
readonly commit: l.OptionalSchema<l.RefSchema<l.Validator<RepoDefs.CommitMeta, RepoDefs.CommitMeta>>>;
|
|
41
49
|
}>>;
|
|
42
50
|
//# sourceMappingURL=deleteRecord.defs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deleteRecord.defs.d.ts","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/repo/deleteRecord.defs.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,qBAAqB,CAAA;AACvC,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAA;AAE1C,QAAA,MAAM,KAAK,kCAAkC,CAAA;AAE7C,OAAO,EAAE,KAAK,EAAE,CAAA;AAEhB,iGAAiG;AACjG,QAAA,MAAM,IAAI
|
|
1
|
+
{"version":3,"file":"deleteRecord.defs.d.ts","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/repo/deleteRecord.defs.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,qBAAqB,CAAA;AACvC,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAA;AAE1C,QAAA,MAAM,KAAK,kCAAkC,CAAA;AAE7C,OAAO,EAAE,KAAK,EAAE,CAAA;AAEhB,iGAAiG;AACjG,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;8BAwBP,CAAA;AACH,OAAO,EAAE,IAAI,EAAE,CAAA;AAEf,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,iBAAiB,CAAC,OAAO,IAAI,CAAC,CAAA;AACrD,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,gBAAgB,CAAC,OAAO,IAAI,CAAC,CAAA;AACnD,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,oBAAoB,CAAC,OAAO,IAAI,CAAC,CAAA;AAC3D,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,iBAAiB,CAAC,OAAO,IAAI,CAAC,CAAA;AACrD,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,qBAAqB,CAAC,OAAO,IAAI,CAAC,CAAA;AAE7D,eAAO,MAAM,IAAI,iCAA0B,EACzC,OAAO,oBAAgC,EACvC,MAAM;;;;;;;;;;;;;;;;GAA2B,EACjC,OAAO;;GAA4B,CAAA"}
|
|
@@ -12,12 +12,16 @@ declare const main: l.Query<"com.atproto.repo.getRecord", l.ParamsSchema<{
|
|
|
12
12
|
readonly rkey: l.StringSchema<{
|
|
13
13
|
readonly format: "record-key";
|
|
14
14
|
}>;
|
|
15
|
-
readonly cid: l.OptionalSchema<
|
|
15
|
+
readonly cid: l.OptionalSchema<l.StringSchema<{
|
|
16
|
+
readonly format: "cid";
|
|
17
|
+
}>>;
|
|
16
18
|
}>, l.Payload<"application/json", l.ObjectSchema<{
|
|
17
19
|
readonly uri: l.StringSchema<{
|
|
18
20
|
readonly format: "at-uri";
|
|
19
21
|
}>;
|
|
20
|
-
readonly cid: l.OptionalSchema<
|
|
22
|
+
readonly cid: l.OptionalSchema<l.StringSchema<{
|
|
23
|
+
readonly format: "cid";
|
|
24
|
+
}>>;
|
|
21
25
|
readonly value: l.UnknownObjectSchema;
|
|
22
26
|
}>>, readonly ["RecordNotFound"]>;
|
|
23
27
|
export { main };
|
|
@@ -34,12 +38,16 @@ export declare const $lxm: "com.atproto.repo.getRecord", $params: l.ParamsSchema
|
|
|
34
38
|
readonly rkey: l.StringSchema<{
|
|
35
39
|
readonly format: "record-key";
|
|
36
40
|
}>;
|
|
37
|
-
readonly cid: l.OptionalSchema<
|
|
41
|
+
readonly cid: l.OptionalSchema<l.StringSchema<{
|
|
42
|
+
readonly format: "cid";
|
|
43
|
+
}>>;
|
|
38
44
|
}>, $output: l.Payload<"application/json", l.ObjectSchema<{
|
|
39
45
|
readonly uri: l.StringSchema<{
|
|
40
46
|
readonly format: "at-uri";
|
|
41
47
|
}>;
|
|
42
|
-
readonly cid: l.OptionalSchema<
|
|
48
|
+
readonly cid: l.OptionalSchema<l.StringSchema<{
|
|
49
|
+
readonly format: "cid";
|
|
50
|
+
}>>;
|
|
43
51
|
readonly value: l.UnknownObjectSchema;
|
|
44
52
|
}>>;
|
|
45
53
|
//# sourceMappingURL=getRecord.defs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getRecord.defs.d.ts","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/repo/getRecord.defs.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,qBAAqB,CAAA;AAEvC,QAAA,MAAM,KAAK,+BAA+B,CAAA;AAE1C,OAAO,EAAE,KAAK,EAAE,CAAA;AAEhB,oEAAoE;AACpE,QAAA,MAAM,IAAI
|
|
1
|
+
{"version":3,"file":"getRecord.defs.d.ts","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/repo/getRecord.defs.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,qBAAqB,CAAA;AAEvC,QAAA,MAAM,KAAK,+BAA+B,CAAA;AAE1C,OAAO,EAAE,KAAK,EAAE,CAAA;AAEhB,oEAAoE;AACpE,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;iCAgBP,CAAA;AACH,OAAO,EAAE,IAAI,EAAE,CAAA;AAEf,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,iBAAiB,CAAC,OAAO,IAAI,CAAC,CAAA;AACrD,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,iBAAiB,CAAC,OAAO,IAAI,CAAC,CAAA;AACrD,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,qBAAqB,CAAC,OAAO,IAAI,CAAC,CAAA;AAE7D,eAAO,MAAM,IAAI,8BAA0B,EACzC,OAAO;;;;;;;;;;;;;EAAkB,EACzB,OAAO;;;;;;;;GAAc,CAAA"}
|
|
@@ -9,12 +9,12 @@ declare const main: l.Query<"com.atproto.repo.listRecords", l.ParamsSchema<{
|
|
|
9
9
|
readonly collection: l.StringSchema<{
|
|
10
10
|
readonly format: "nsid";
|
|
11
11
|
}>;
|
|
12
|
-
readonly limit: l.OptionalSchema<
|
|
13
|
-
readonly cursor: l.OptionalSchema<
|
|
14
|
-
readonly reverse: l.OptionalSchema<
|
|
12
|
+
readonly limit: l.OptionalSchema<l.WithDefaultSchema<l.IntegerSchema>>;
|
|
13
|
+
readonly cursor: l.OptionalSchema<l.StringSchema<{}>>;
|
|
14
|
+
readonly reverse: l.OptionalSchema<l.BooleanSchema>;
|
|
15
15
|
}>, l.Payload<"application/json", l.ObjectSchema<{
|
|
16
|
-
readonly cursor: l.OptionalSchema<
|
|
17
|
-
readonly records: l.ArraySchema<l.RefSchema<Record$0
|
|
16
|
+
readonly cursor: l.OptionalSchema<l.StringSchema<{}>>;
|
|
17
|
+
readonly records: l.ArraySchema<l.RefSchema<l.Validator<Record$0, Record$0>>>;
|
|
18
18
|
}>>, undefined>;
|
|
19
19
|
export { main };
|
|
20
20
|
export type Params = l.InferMethodParams<typeof main>;
|
|
@@ -27,12 +27,12 @@ export declare const $lxm: "com.atproto.repo.listRecords", $params: l.ParamsSche
|
|
|
27
27
|
readonly collection: l.StringSchema<{
|
|
28
28
|
readonly format: "nsid";
|
|
29
29
|
}>;
|
|
30
|
-
readonly limit: l.OptionalSchema<
|
|
31
|
-
readonly cursor: l.OptionalSchema<
|
|
32
|
-
readonly reverse: l.OptionalSchema<
|
|
30
|
+
readonly limit: l.OptionalSchema<l.WithDefaultSchema<l.IntegerSchema>>;
|
|
31
|
+
readonly cursor: l.OptionalSchema<l.StringSchema<{}>>;
|
|
32
|
+
readonly reverse: l.OptionalSchema<l.BooleanSchema>;
|
|
33
33
|
}>, $output: l.Payload<"application/json", l.ObjectSchema<{
|
|
34
|
-
readonly cursor: l.OptionalSchema<
|
|
35
|
-
readonly records: l.ArraySchema<l.RefSchema<Record$0
|
|
34
|
+
readonly cursor: l.OptionalSchema<l.StringSchema<{}>>;
|
|
35
|
+
readonly records: l.ArraySchema<l.RefSchema<l.Validator<Record$0, Record$0>>>;
|
|
36
36
|
}>>;
|
|
37
37
|
type Record$0 = {
|
|
38
38
|
$type?: 'com.atproto.repo.listRecords#record';
|
|
@@ -41,6 +41,6 @@ type Record$0 = {
|
|
|
41
41
|
value: l.UnknownObject;
|
|
42
42
|
};
|
|
43
43
|
export type { Record$0 as Record };
|
|
44
|
-
declare const record$0: l.TypedObjectSchema<"com.atproto.repo.listRecords#record", l.Validator<
|
|
44
|
+
declare const record$0: l.TypedObjectSchema<"com.atproto.repo.listRecords#record", l.Validator<Record$0, Record$0>>;
|
|
45
45
|
export { record$0 as record };
|
|
46
46
|
//# sourceMappingURL=listRecords.defs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listRecords.defs.d.ts","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/repo/listRecords.defs.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,qBAAqB,CAAA;AAEvC,QAAA,MAAM,KAAK,iCAAiC,CAAA;AAE5C,OAAO,EAAE,KAAK,EAAE,CAAA;AAEhB,sGAAsG;AACtG,QAAA,MAAM,IAAI;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"listRecords.defs.d.ts","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/repo/listRecords.defs.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,qBAAqB,CAAA;AAEvC,QAAA,MAAM,KAAK,iCAAiC,CAAA;AAE5C,OAAO,EAAE,KAAK,EAAE,CAAA;AAEhB,sGAAsG;AACtG,QAAA,MAAM,IAAI;;;;;;;;;;;;;eAsBP,CAAA;AACH,OAAO,EAAE,IAAI,EAAE,CAAA;AAEf,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,iBAAiB,CAAC,OAAO,IAAI,CAAC,CAAA;AACrD,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,iBAAiB,CAAC,OAAO,IAAI,CAAC,CAAA;AACrD,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,qBAAqB,CAAC,OAAO,IAAI,CAAC,CAAA;AAE7D,eAAO,MAAM,IAAI,gCAA0B,EACzC,OAAO;;;;;;;;;;EAAkB,EACzB,OAAO;;;GAAc,CAAA;AAEvB,KAAK,QAAQ,GAAG;IACd,KAAK,CAAC,EAAE,qCAAqC,CAAA;IAC7C,GAAG,EAAE,CAAC,CAAC,WAAW,CAAA;IAClB,GAAG,EAAE,CAAC,CAAC,SAAS,CAAA;IAChB,KAAK,EAAE,CAAC,CAAC,aAAa,CAAA;CACvB,CAAA;AAED,YAAY,EAAE,QAAQ,IAAI,MAAM,EAAE,CAAA;AAElC,QAAA,MAAM,QAAQ,6FAQb,CAAA;AAED,OAAO,EAAE,QAAQ,IAAI,MAAM,EAAE,CAAA"}
|
|
@@ -15,7 +15,8 @@ lex_schema_1.l.query($nsid,
|
|
|
15
15
|
repo: /*#__PURE__*/ lex_schema_1.l.string({ format: 'at-identifier' }),
|
|
16
16
|
collection: /*#__PURE__*/ lex_schema_1.l.string({ format: 'nsid' }),
|
|
17
17
|
limit: /*#__PURE__*/ lex_schema_1.l.optional(
|
|
18
|
-
/*#__PURE__*/ lex_schema_1.l.
|
|
18
|
+
/*#__PURE__*/ lex_schema_1.l.withDefault(
|
|
19
|
+
/*#__PURE__*/ lex_schema_1.l.integer({ minimum: 1, maximum: 100 }), 50)),
|
|
19
20
|
cursor: /*#__PURE__*/ lex_schema_1.l.optional(/*#__PURE__*/ lex_schema_1.l.string()),
|
|
20
21
|
reverse: /*#__PURE__*/ lex_schema_1.l.optional(/*#__PURE__*/ lex_schema_1.l.boolean()),
|
|
21
22
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listRecords.defs.js","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/repo/listRecords.defs.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,oDAAuC;AAEvC,MAAM,KAAK,GAAG,8BAA8B,CAAA;AAEnC,sBAAK;AAEd,sGAAsG;AACtG,MAAM,IAAI;AACR,aAAa;AACb,cAAC,CAAC,KAAK,CACL,KAAK;AACL,aAAa,CAAC,cAAC,CAAC,MAAM,CAAC;IACrB,IAAI,EAAE,aAAa,CAAC,cAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,eAAe,EAAE,CAAC;IACzD,UAAU,EAAE,aAAa,CAAC,cAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IACtD,KAAK,EAAE,aAAa,CAAC,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cAAC,CAAC,GAAG,CAAW,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAQ,CAAC,CACvD;CACF,CAAC,CACH,CAAA;AACM,oBAAI;AAMA,QAAA,IAAI,GAAiB,IAAI,CAAC,IAAI,EACzC,QAAA,OAAO,GAAG,IAAI,CAAC,UAAU,EACzB,QAAA,OAAO,GAAG,IAAI,CAAC,MAAM,CAAA;AAWvB,MAAM,QAAQ,GAAG,aAAa,CAAC,cAAC,CAAC,WAAW,CAC1C,KAAK,EACL,QAAQ;AACR,aAAa,CAAC,cAAC,CAAC,MAAM,CAAC;IACrB,GAAG,EAAE,aAAa,CAAC,cAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;IACjD,GAAG,EAAE,aAAa,CAAC,cAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IAC9C,KAAK,EAAE,aAAa,CAAC,cAAC,CAAC,aAAa,EAAE;CACvC,CAAC,CACH,CAAA;AAEoB,0BAAM","sourcesContent":["/*\n * THIS FILE WAS GENERATED BY \"@atproto/lex\". DO NOT EDIT.\n */\n\nimport { l } from '@atproto/lex-schema'\n\nconst $nsid = 'com.atproto.repo.listRecords'\n\nexport { $nsid }\n\n/** List a range of records in a repository, matching a specific collection. Does not require auth. */\nconst main =\n /*#__PURE__*/\n l.query(\n $nsid,\n /*#__PURE__*/ l.params({\n repo: /*#__PURE__*/ l.string({ format: 'at-identifier' }),\n collection: /*#__PURE__*/ l.string({ format: 'nsid' }),\n limit: /*#__PURE__*/ l.optional(\n /*#__PURE__*/ l.withDefault(\n /*#__PURE__*/ l.integer({ minimum: 1, maximum: 100 }),\n 50,\n ),\n ),\n cursor: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.string()),\n reverse: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.boolean()),\n }),\n /*#__PURE__*/ l.jsonPayload({\n cursor: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.string()),\n records: /*#__PURE__*/ l.array(\n /*#__PURE__*/ l.ref<Record$0>((() => record$0) as any),\n ),\n }),\n )\nexport { main }\n\nexport type Params = l.InferMethodParams<typeof main>\nexport type Output = l.InferMethodOutput<typeof main>\nexport type OutputBody = l.InferMethodOutputBody<typeof main>\n\nexport const $lxm = /*#__PURE__*/ main.nsid,\n $params = main.parameters,\n $output = main.output\n\ntype Record$0 = {\n $type?: 'com.atproto.repo.listRecords#record'\n uri: l.AtUriString\n cid: l.CidString\n value: l.UnknownObject\n}\n\nexport type { Record$0 as Record }\n\nconst record$0 = /*#__PURE__*/ l.typedObject<Record$0>(\n $nsid,\n 'record',\n /*#__PURE__*/ l.object({\n uri: /*#__PURE__*/ l.string({ format: 'at-uri' }),\n cid: /*#__PURE__*/ l.string({ format: 'cid' }),\n value: /*#__PURE__*/ l.unknownObject(),\n }),\n)\n\nexport { record$0 as record }\n"]}
|
|
@@ -14,10 +14,14 @@ declare const main: l.Procedure<"com.atproto.repo.putRecord", l.ParamsSchema<{}>
|
|
|
14
14
|
readonly format: "record-key";
|
|
15
15
|
readonly maxLength: 512;
|
|
16
16
|
}>;
|
|
17
|
-
readonly validate: l.OptionalSchema<
|
|
17
|
+
readonly validate: l.OptionalSchema<l.BooleanSchema>;
|
|
18
18
|
readonly record: l.UnknownObjectSchema;
|
|
19
|
-
readonly swapRecord: l.OptionalSchema<
|
|
20
|
-
|
|
19
|
+
readonly swapRecord: l.OptionalSchema<l.NullableSchema<l.StringSchema<{
|
|
20
|
+
readonly format: "cid";
|
|
21
|
+
}>>>;
|
|
22
|
+
readonly swapCommit: l.OptionalSchema<l.StringSchema<{
|
|
23
|
+
readonly format: "cid";
|
|
24
|
+
}>>;
|
|
21
25
|
}>>, l.Payload<"application/json", l.ObjectSchema<{
|
|
22
26
|
readonly uri: l.StringSchema<{
|
|
23
27
|
readonly format: "at-uri";
|
|
@@ -25,8 +29,8 @@ declare const main: l.Procedure<"com.atproto.repo.putRecord", l.ParamsSchema<{}>
|
|
|
25
29
|
readonly cid: l.StringSchema<{
|
|
26
30
|
readonly format: "cid";
|
|
27
31
|
}>;
|
|
28
|
-
readonly commit: l.OptionalSchema<RepoDefs.CommitMeta
|
|
29
|
-
readonly validationStatus: l.OptionalSchema<
|
|
32
|
+
readonly commit: l.OptionalSchema<l.RefSchema<l.Validator<RepoDefs.CommitMeta, RepoDefs.CommitMeta>>>;
|
|
33
|
+
readonly validationStatus: l.OptionalSchema<l.StringSchema<{}>>;
|
|
30
34
|
}>>, readonly ["InvalidSwap"]>;
|
|
31
35
|
export { main };
|
|
32
36
|
export type Params = l.InferMethodParams<typeof main>;
|
|
@@ -45,10 +49,14 @@ export declare const $lxm: "com.atproto.repo.putRecord", $params: l.ParamsSchema
|
|
|
45
49
|
readonly format: "record-key";
|
|
46
50
|
readonly maxLength: 512;
|
|
47
51
|
}>;
|
|
48
|
-
readonly validate: l.OptionalSchema<
|
|
52
|
+
readonly validate: l.OptionalSchema<l.BooleanSchema>;
|
|
49
53
|
readonly record: l.UnknownObjectSchema;
|
|
50
|
-
readonly swapRecord: l.OptionalSchema<
|
|
51
|
-
|
|
54
|
+
readonly swapRecord: l.OptionalSchema<l.NullableSchema<l.StringSchema<{
|
|
55
|
+
readonly format: "cid";
|
|
56
|
+
}>>>;
|
|
57
|
+
readonly swapCommit: l.OptionalSchema<l.StringSchema<{
|
|
58
|
+
readonly format: "cid";
|
|
59
|
+
}>>;
|
|
52
60
|
}>>, $output: l.Payload<"application/json", l.ObjectSchema<{
|
|
53
61
|
readonly uri: l.StringSchema<{
|
|
54
62
|
readonly format: "at-uri";
|
|
@@ -56,7 +64,7 @@ export declare const $lxm: "com.atproto.repo.putRecord", $params: l.ParamsSchema
|
|
|
56
64
|
readonly cid: l.StringSchema<{
|
|
57
65
|
readonly format: "cid";
|
|
58
66
|
}>;
|
|
59
|
-
readonly commit: l.OptionalSchema<RepoDefs.CommitMeta
|
|
60
|
-
readonly validationStatus: l.OptionalSchema<
|
|
67
|
+
readonly commit: l.OptionalSchema<l.RefSchema<l.Validator<RepoDefs.CommitMeta, RepoDefs.CommitMeta>>>;
|
|
68
|
+
readonly validationStatus: l.OptionalSchema<l.StringSchema<{}>>;
|
|
61
69
|
}>>;
|
|
62
70
|
//# sourceMappingURL=putRecord.defs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"putRecord.defs.d.ts","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/repo/putRecord.defs.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,qBAAqB,CAAA;AACvC,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAA;AAE1C,QAAA,MAAM,KAAK,+BAA+B,CAAA;AAE1C,OAAO,EAAE,KAAK,EAAE,CAAA;AAEhB,uGAAuG;AACvG,QAAA,MAAM,IAAI
|
|
1
|
+
{"version":3,"file":"putRecord.defs.d.ts","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/repo/putRecord.defs.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,qBAAqB,CAAA;AACvC,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAA;AAE1C,QAAA,MAAM,KAAK,+BAA+B,CAAA;AAE1C,OAAO,EAAE,KAAK,EAAE,CAAA;AAEhB,uGAAuG;AACvG,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;8BA6BP,CAAA;AACH,OAAO,EAAE,IAAI,EAAE,CAAA;AAEf,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,iBAAiB,CAAC,OAAO,IAAI,CAAC,CAAA;AACrD,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,gBAAgB,CAAC,OAAO,IAAI,CAAC,CAAA;AACnD,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,oBAAoB,CAAC,OAAO,IAAI,CAAC,CAAA;AAC3D,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,iBAAiB,CAAC,OAAO,IAAI,CAAC,CAAA;AACrD,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,qBAAqB,CAAC,OAAO,IAAI,CAAC,CAAA;AAE7D,eAAO,MAAM,IAAI,8BAA0B,EACzC,OAAO,oBAAgC,EACvC,MAAM;;;;;;;;;;;;;;;;;;;GAA2B,EACjC,OAAO;;;;;;;;;GAA4B,CAAA"}
|
package/dist/response.d.ts
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
import { InferMethodOutputBody, InferMethodOutputEncoding, Procedure, Query, ResultSuccess } from '@atproto/lex-schema';
|
|
2
|
-
import {
|
|
3
|
-
export type
|
|
4
|
-
export type
|
|
2
|
+
import { XrpcPayload } from './util.js';
|
|
3
|
+
export type XrpcResponseBody<M extends Procedure | Query> = InferMethodOutputBody<M, Uint8Array>;
|
|
4
|
+
export type XrpcResponsePayload<M extends Procedure | Query> = InferMethodOutputEncoding<M> extends infer E extends string ? XrpcPayload<XrpcResponseBody<M>, E> : null;
|
|
5
5
|
/**
|
|
6
6
|
* Small container for XRPC response data.
|
|
7
7
|
*
|
|
8
|
-
* @implements {ResultSuccess<
|
|
8
|
+
* @implements {ResultSuccess<XrpcResponse<M>>} for convenience in result handling contexts.
|
|
9
9
|
*/
|
|
10
|
-
export declare class
|
|
10
|
+
export declare class XrpcResponse<const M extends Procedure | Query> implements ResultSuccess<XrpcResponse<M>> {
|
|
11
11
|
readonly method: M;
|
|
12
12
|
readonly status: number;
|
|
13
13
|
readonly headers: Headers;
|
|
14
|
-
readonly payload:
|
|
14
|
+
readonly payload: XrpcResponsePayload<M>;
|
|
15
15
|
/** @see {@link ResultSuccess.success} */
|
|
16
16
|
readonly success: true;
|
|
17
17
|
/** @see {@link ResultSuccess.value} */
|
|
18
18
|
get value(): this;
|
|
19
|
-
constructor(method: M, status: number, headers: Headers, payload:
|
|
19
|
+
constructor(method: M, status: number, headers: Headers, payload: XrpcResponsePayload<M>);
|
|
20
20
|
/**
|
|
21
21
|
* Whether the response payload was parsed as {@link LexValue} (`true`) or is
|
|
22
22
|
* in binary form {@link Uint8Array} (`false`).
|
|
23
23
|
*/
|
|
24
24
|
get isParsed(): boolean;
|
|
25
25
|
get encoding(): InferMethodOutputEncoding<M>;
|
|
26
|
-
get body():
|
|
26
|
+
get body(): XrpcResponseBody<M>;
|
|
27
27
|
/**
|
|
28
|
-
* @throws {
|
|
29
|
-
* {@link
|
|
28
|
+
* @throws {XrpcResponseError} in case of (valid) XRPC error responses. Use
|
|
29
|
+
* {@link XrpcResponseError.matchesSchema} to narrow the error type based on
|
|
30
30
|
* the method's declared error schema.
|
|
31
|
-
* @throws {
|
|
31
|
+
* @throws {XrpcUpstreamError} when the response is not a valid XRPC
|
|
32
32
|
* response, or if the response does not conform to the method's schema.
|
|
33
33
|
*/
|
|
34
34
|
static fromFetchResponse<const M extends Procedure | Query>(method: M, response: Response, options?: {
|
|
35
35
|
validateResponse?: boolean;
|
|
36
|
-
}): Promise<
|
|
36
|
+
}): Promise<XrpcResponse<M>>;
|
|
37
37
|
}
|
|
38
38
|
//# sourceMappingURL=response.d.ts.map
|
package/dist/response.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../src/response.ts"],"names":[],"mappings":"AACA,OAAO,EACL,qBAAqB,EACrB,yBAAyB,EACzB,SAAS,EACT,KAAK,EACL,aAAa,EACd,MAAM,qBAAqB,CAAA;AAM5B,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../src/response.ts"],"names":[],"mappings":"AACA,OAAO,EACL,qBAAqB,EACrB,yBAAyB,EACzB,SAAS,EACT,KAAK,EACL,aAAa,EACd,MAAM,qBAAqB,CAAA;AAM5B,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAEvC,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,SAAS,GAAG,KAAK,IACtD,qBAAqB,CAAC,CAAC,EAAE,UAAU,CAAC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|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.XrpcResponse = void 0;
|
|
4
4
|
const lex_json_1 = require("@atproto/lex-json");
|
|
5
5
|
const errors_js_1 = require("./errors.js");
|
|
6
6
|
/**
|
|
7
7
|
* Small container for XRPC response data.
|
|
8
8
|
*
|
|
9
|
-
* @implements {ResultSuccess<
|
|
9
|
+
* @implements {ResultSuccess<XrpcResponse<M>>} for convenience in result handling contexts.
|
|
10
10
|
*/
|
|
11
|
-
class
|
|
11
|
+
class XrpcResponse {
|
|
12
12
|
method;
|
|
13
13
|
status;
|
|
14
14
|
headers;
|
|
@@ -39,10 +39,10 @@ class LexRpcResponse {
|
|
|
39
39
|
return this.payload?.body;
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
|
-
* @throws {
|
|
43
|
-
* {@link
|
|
42
|
+
* @throws {XrpcResponseError} in case of (valid) XRPC error responses. Use
|
|
43
|
+
* {@link XrpcResponseError.matchesSchema} to narrow the error type based on
|
|
44
44
|
* the method's declared error schema.
|
|
45
|
-
* @throws {
|
|
45
|
+
* @throws {XrpcUpstreamError} when the response is not a valid XRPC
|
|
46
46
|
* response, or if the response does not conform to the method's schema.
|
|
47
47
|
*/
|
|
48
48
|
static async fromFetchResponse(method, response, options) {
|
|
@@ -53,13 +53,13 @@ class LexRpcResponse {
|
|
|
53
53
|
if (response.status < 200 || response.status >= 300) {
|
|
54
54
|
// Always parse json for error responses
|
|
55
55
|
const payload = await readPayload(response, { parse: true });
|
|
56
|
-
if (response.status >= 400 && (0, errors_js_1.
|
|
57
|
-
throw new errors_js_1.
|
|
56
|
+
if (response.status >= 400 && (0, errors_js_1.isXrpcErrorPayload)(payload)) {
|
|
57
|
+
throw new errors_js_1.XrpcResponseError(method, response.status, response.headers, payload);
|
|
58
58
|
}
|
|
59
59
|
if (response.status >= 500) {
|
|
60
|
-
throw new errors_js_1.
|
|
60
|
+
throw new errors_js_1.XrpcUpstreamError('UpstreamFailure', `Upstream server encountered an error`, response, payload);
|
|
61
61
|
}
|
|
62
|
-
throw new errors_js_1.
|
|
62
|
+
throw new errors_js_1.XrpcUpstreamError('InvalidResponse', response.status >= 400
|
|
63
63
|
? `Upstream server returned an invalid response payload`
|
|
64
64
|
: `Upstream server returned an invalid status code`, response, payload);
|
|
65
65
|
}
|
|
@@ -71,30 +71,28 @@ class LexRpcResponse {
|
|
|
71
71
|
if (method.output.encoding == null) {
|
|
72
72
|
// Schema expects no payload
|
|
73
73
|
if (payload) {
|
|
74
|
-
throw new errors_js_1.
|
|
74
|
+
throw new errors_js_1.XrpcUpstreamError('InvalidResponse', `Expected response with no body, got ${payload.encoding}`, response, payload);
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
else {
|
|
78
78
|
// Schema expects a payload
|
|
79
79
|
if (!payload || !method.output.matchesEncoding(payload.encoding)) {
|
|
80
|
-
throw new errors_js_1.
|
|
80
|
+
throw new errors_js_1.XrpcUpstreamError('InvalidResponse', payload
|
|
81
81
|
? `Expected ${method.output.encoding} response, got ${payload.encoding}`
|
|
82
82
|
: `Expected non-empty response with content-type ${method.output.encoding}`, response, payload);
|
|
83
83
|
}
|
|
84
84
|
// Assert valid response body.
|
|
85
85
|
if (method.output.schema && options?.validateResponse !== false) {
|
|
86
|
-
const result = method.output.schema.safeParse(payload.body
|
|
87
|
-
allowTransform: false,
|
|
88
|
-
});
|
|
86
|
+
const result = method.output.schema.safeParse(payload.body);
|
|
89
87
|
if (!result.success) {
|
|
90
|
-
throw new errors_js_1.
|
|
88
|
+
throw new errors_js_1.XrpcUpstreamError('InvalidResponse', `Response validation failed: ${result.reason.message}`, response, payload, { cause: result.reason });
|
|
91
89
|
}
|
|
92
90
|
}
|
|
93
91
|
}
|
|
94
|
-
return new
|
|
92
|
+
return new XrpcResponse(method, response.status, response.headers, payload);
|
|
95
93
|
}
|
|
96
94
|
}
|
|
97
|
-
exports.
|
|
95
|
+
exports.XrpcResponse = XrpcResponse;
|
|
98
96
|
function shouldParse(method) {
|
|
99
97
|
return method.output.encoding === 'application/json';
|
|
100
98
|
}
|
|
@@ -136,7 +134,7 @@ async function readPayload(response, options) {
|
|
|
136
134
|
return { encoding, body: (0, lex_json_1.lexParse)(text) };
|
|
137
135
|
}
|
|
138
136
|
catch (cause) {
|
|
139
|
-
throw new errors_js_1.
|
|
137
|
+
throw new errors_js_1.XrpcUpstreamError('InvalidResponse', 'Invalid JSON response body', response, null, { cause });
|
|
140
138
|
}
|
|
141
139
|
}
|
|
142
140
|
return { encoding, body: new Uint8Array(await response.arrayBuffer()) };
|