@atproto/xrpc 0.6.11 → 0.7.0
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 +22 -0
- package/dist/types.d.ts +23 -33
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +15 -22
- package/dist/types.js.map +1 -1
- package/package.json +2 -2
- package/src/types.ts +13 -22
- package/tsconfig.build.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @atproto/xrpc
|
|
2
2
|
|
|
3
|
+
## 0.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#3792](https://github.com/bluesky-social/atproto/pull/3792) [`f36ab48d9`](https://github.com/bluesky-social/atproto/commit/f36ab48d910fc4a3afcd22138ba014c814beb93b) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Rename `ResponseType.AuthRequired` into `ResponseType.AuthenticationRequired` to match actual error name.
|
|
8
|
+
|
|
9
|
+
- [#3792](https://github.com/bluesky-social/atproto/pull/3792) [`f36ab48d9`](https://github.com/bluesky-social/atproto/commit/f36ab48d910fc4a3afcd22138ba014c814beb93b) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Remove un-necessary `ResponseTypeNames` in favor of `ResponseType`.
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#3792](https://github.com/bluesky-social/atproto/pull/3792) [`f36ab48d9`](https://github.com/bluesky-social/atproto/commit/f36ab48d910fc4a3afcd22138ba014c814beb93b) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Add missing `NotAcceptable` key in `ResponseTypeStrings`
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [[`cc485d296`](https://github.com/bluesky-social/atproto/commit/cc485d29638488928b5efec3d4b0627040589812)]:
|
|
16
|
+
- @atproto/lexicon@0.4.11
|
|
17
|
+
|
|
18
|
+
## 0.6.12
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- Updated dependencies []:
|
|
23
|
+
- @atproto/lexicon@0.4.10
|
|
24
|
+
|
|
3
25
|
## 0.6.11
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
package/dist/types.d.ts
CHANGED
|
@@ -23,11 +23,17 @@ export declare const errorResponseBody: z.ZodObject<{
|
|
|
23
23
|
}>;
|
|
24
24
|
export type ErrorResponseBody = z.infer<typeof errorResponseBody>;
|
|
25
25
|
export declare enum ResponseType {
|
|
26
|
+
/**
|
|
27
|
+
* Network issue, unable to get response from the server.
|
|
28
|
+
*/
|
|
26
29
|
Unknown = 1,
|
|
30
|
+
/**
|
|
31
|
+
* Response failed lexicon validation.
|
|
32
|
+
*/
|
|
27
33
|
InvalidResponse = 2,
|
|
28
34
|
Success = 200,
|
|
29
35
|
InvalidRequest = 400,
|
|
30
|
-
|
|
36
|
+
AuthenticationRequired = 401,
|
|
31
37
|
Forbidden = 403,
|
|
32
38
|
XRPCNotSupported = 404,
|
|
33
39
|
NotAcceptable = 406,
|
|
@@ -41,40 +47,24 @@ export declare enum ResponseType {
|
|
|
41
47
|
UpstreamTimeout = 504
|
|
42
48
|
}
|
|
43
49
|
export declare function httpResponseCodeToEnum(status: number): ResponseType;
|
|
44
|
-
export declare const ResponseTypeNames: {
|
|
45
|
-
1: string;
|
|
46
|
-
2: string;
|
|
47
|
-
200: string;
|
|
48
|
-
400: string;
|
|
49
|
-
401: string;
|
|
50
|
-
403: string;
|
|
51
|
-
404: string;
|
|
52
|
-
413: string;
|
|
53
|
-
415: string;
|
|
54
|
-
429: string;
|
|
55
|
-
500: string;
|
|
56
|
-
501: string;
|
|
57
|
-
502: string;
|
|
58
|
-
503: string;
|
|
59
|
-
504: string;
|
|
60
|
-
};
|
|
61
50
|
export declare function httpResponseCodeToName(status: number): string;
|
|
62
51
|
export declare const ResponseTypeStrings: {
|
|
63
|
-
1:
|
|
64
|
-
2:
|
|
65
|
-
200:
|
|
66
|
-
400:
|
|
67
|
-
401:
|
|
68
|
-
403:
|
|
69
|
-
404:
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
52
|
+
readonly 1: "Unknown";
|
|
53
|
+
readonly 2: "Invalid Response";
|
|
54
|
+
readonly 200: "Success";
|
|
55
|
+
readonly 400: "Invalid Request";
|
|
56
|
+
readonly 401: "Authentication Required";
|
|
57
|
+
readonly 403: "Forbidden";
|
|
58
|
+
readonly 404: "XRPC Not Supported";
|
|
59
|
+
readonly 406: "Not Acceptable";
|
|
60
|
+
readonly 413: "Payload Too Large";
|
|
61
|
+
readonly 415: "Unsupported Media Type";
|
|
62
|
+
readonly 429: "Rate Limit Exceeded";
|
|
63
|
+
readonly 500: "Internal Server Error";
|
|
64
|
+
readonly 501: "Method Not Implemented";
|
|
65
|
+
readonly 502: "Upstream Failure";
|
|
66
|
+
readonly 503: "Not Enough Resources";
|
|
67
|
+
readonly 504: "Upstream Timeout";
|
|
78
68
|
};
|
|
79
69
|
export declare function httpResponseCodeToString(status: number): string;
|
|
80
70
|
export declare class XRPCResponse {
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAElD,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;AAC7C,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAA;AAE3D,YAAY;AACV,yEAAyE;AACzE,UAAU,IAAI,OAAO,GACtB,CAAA;AAED,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,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AY/B"}
|
package/dist/types.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.XRPCInvalidResponseError = exports.XRPCError = exports.XRPCResponse = exports.ResponseTypeStrings = exports.
|
|
3
|
+
exports.XRPCInvalidResponseError = exports.XRPCError = exports.XRPCResponse = exports.ResponseTypeStrings = exports.ResponseType = exports.errorResponseBody = void 0;
|
|
4
4
|
exports.httpResponseCodeToEnum = httpResponseCodeToEnum;
|
|
5
5
|
exports.httpResponseCodeToName = httpResponseCodeToName;
|
|
6
6
|
exports.httpResponseCodeToString = httpResponseCodeToString;
|
|
@@ -11,11 +11,17 @@ exports.errorResponseBody = zod_1.z.object({
|
|
|
11
11
|
});
|
|
12
12
|
var ResponseType;
|
|
13
13
|
(function (ResponseType) {
|
|
14
|
+
/**
|
|
15
|
+
* Network issue, unable to get response from the server.
|
|
16
|
+
*/
|
|
14
17
|
ResponseType[ResponseType["Unknown"] = 1] = "Unknown";
|
|
18
|
+
/**
|
|
19
|
+
* Response failed lexicon validation.
|
|
20
|
+
*/
|
|
15
21
|
ResponseType[ResponseType["InvalidResponse"] = 2] = "InvalidResponse";
|
|
16
22
|
ResponseType[ResponseType["Success"] = 200] = "Success";
|
|
17
23
|
ResponseType[ResponseType["InvalidRequest"] = 400] = "InvalidRequest";
|
|
18
|
-
ResponseType[ResponseType["
|
|
24
|
+
ResponseType[ResponseType["AuthenticationRequired"] = 401] = "AuthenticationRequired";
|
|
19
25
|
ResponseType[ResponseType["Forbidden"] = 403] = "Forbidden";
|
|
20
26
|
ResponseType[ResponseType["XRPCNotSupported"] = 404] = "XRPCNotSupported";
|
|
21
27
|
ResponseType[ResponseType["NotAcceptable"] = 406] = "NotAcceptable";
|
|
@@ -48,34 +54,18 @@ function httpResponseCodeToEnum(status) {
|
|
|
48
54
|
return ResponseType.InternalServerError;
|
|
49
55
|
}
|
|
50
56
|
}
|
|
51
|
-
exports.ResponseTypeNames = {
|
|
52
|
-
[ResponseType.Unknown]: 'Unknown',
|
|
53
|
-
[ResponseType.InvalidResponse]: 'InvalidResponse',
|
|
54
|
-
[ResponseType.Success]: 'Success',
|
|
55
|
-
[ResponseType.InvalidRequest]: 'InvalidRequest',
|
|
56
|
-
[ResponseType.AuthRequired]: 'AuthenticationRequired',
|
|
57
|
-
[ResponseType.Forbidden]: 'Forbidden',
|
|
58
|
-
[ResponseType.XRPCNotSupported]: 'XRPCNotSupported',
|
|
59
|
-
[ResponseType.PayloadTooLarge]: 'PayloadTooLarge',
|
|
60
|
-
[ResponseType.UnsupportedMediaType]: 'UnsupportedMediaType',
|
|
61
|
-
[ResponseType.RateLimitExceeded]: 'RateLimitExceeded',
|
|
62
|
-
[ResponseType.InternalServerError]: 'InternalServerError',
|
|
63
|
-
[ResponseType.MethodNotImplemented]: 'MethodNotImplemented',
|
|
64
|
-
[ResponseType.UpstreamFailure]: 'UpstreamFailure',
|
|
65
|
-
[ResponseType.NotEnoughResources]: 'NotEnoughResources',
|
|
66
|
-
[ResponseType.UpstreamTimeout]: 'UpstreamTimeout',
|
|
67
|
-
};
|
|
68
57
|
function httpResponseCodeToName(status) {
|
|
69
|
-
return
|
|
58
|
+
return ResponseType[httpResponseCodeToEnum(status)];
|
|
70
59
|
}
|
|
71
60
|
exports.ResponseTypeStrings = {
|
|
72
61
|
[ResponseType.Unknown]: 'Unknown',
|
|
73
62
|
[ResponseType.InvalidResponse]: 'Invalid Response',
|
|
74
63
|
[ResponseType.Success]: 'Success',
|
|
75
64
|
[ResponseType.InvalidRequest]: 'Invalid Request',
|
|
76
|
-
[ResponseType.
|
|
65
|
+
[ResponseType.AuthenticationRequired]: 'Authentication Required',
|
|
77
66
|
[ResponseType.Forbidden]: 'Forbidden',
|
|
78
67
|
[ResponseType.XRPCNotSupported]: 'XRPC Not Supported',
|
|
68
|
+
[ResponseType.NotAcceptable]: 'Not Acceptable',
|
|
79
69
|
[ResponseType.PayloadTooLarge]: 'Payload Too Large',
|
|
80
70
|
[ResponseType.UnsupportedMediaType]: 'Unsupported Media Type',
|
|
81
71
|
[ResponseType.RateLimitExceeded]: 'Rate Limit Exceeded',
|
|
@@ -177,7 +167,10 @@ class XRPCError extends Error {
|
|
|
177
167
|
exports.XRPCError = XRPCError;
|
|
178
168
|
class XRPCInvalidResponseError extends XRPCError {
|
|
179
169
|
constructor(lexiconNsid, validationError, responseBody) {
|
|
180
|
-
super(ResponseType.InvalidResponse,
|
|
170
|
+
super(ResponseType.InvalidResponse,
|
|
171
|
+
// @NOTE: This is probably wrong and should use ResponseTypeNames instead.
|
|
172
|
+
// But it would mean a breaking change.
|
|
173
|
+
exports.ResponseTypeStrings[ResponseType.InvalidResponse], `The server gave an invalid response and may be out of date.`, undefined, { cause: validationError });
|
|
181
174
|
Object.defineProperty(this, "lexiconNsid", {
|
|
182
175
|
enumerable: true,
|
|
183
176
|
configurable: true,
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAkDA,wDAcC;AAED,wDAEC;AAqBD,4DAEC;AA3FD,6BAAuB;AAmBV,QAAA,iBAAiB,GAAG,OAAC,CAAC,MAAM,CAAC;IACxC,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC/B,CAAC,CAAA;AAGF,IAAY,YAuBX;AAvBD,WAAY,YAAY;IACtB;;OAEG;IACH,qDAAW,CAAA;IACX;;OAEG;IACH,qEAAmB,CAAA;IACnB,uDAAa,CAAA;IACb,qEAAoB,CAAA;IACpB,qFAA4B,CAAA;IAC5B,2DAAe,CAAA;IACf,yEAAsB,CAAA;IACtB,mEAAmB,CA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CAAC,SAAS,CAAA;QAEb,OAAO,IAAI,SAAS,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC,CAAA;IACtE,CAAC;CACF;AA5DD,8BA4DC;AAED,MAAa,wBAAyB,SAAQ,SAAS;IACrD,YACS,WAAmB,EACnB,eAAgC,EAChC,YAAqB;QAE5B,KAAK,CACH,YAAY,CAAC,eAAe;QAC5B,0EAA0E;QAC1E,uCAAuC;QACvC,2BAAmB,CAAC,YAAY,CAAC,eAAe,CAAC,EACjD,6DAA6D,EAC7D,SAAS,EACT,EAAE,KAAK,EAAE,eAAe,EAAE,CAC3B,CAAA;QAZD;;;;mBAAO,WAAW;WAAQ;QAC1B;;;;mBAAO,eAAe;WAAiB;QACvC;;;;mBAAO,YAAY;WAAS;IAW9B,CAAC;CACF;AAhBD,4DAgBC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atproto/xrpc",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "atproto HTTP API (XRPC) client library",
|
|
6
6
|
"keywords": [
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"types": "dist/index.d.ts",
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"zod": "^3.23.8",
|
|
20
|
-
"@atproto/lexicon": "^0.4.
|
|
20
|
+
"@atproto/lexicon": "^0.4.11"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"typescript": "^5.6.3"
|
package/src/types.ts
CHANGED
|
@@ -24,11 +24,17 @@ export const errorResponseBody = z.object({
|
|
|
24
24
|
export type ErrorResponseBody = z.infer<typeof errorResponseBody>
|
|
25
25
|
|
|
26
26
|
export enum ResponseType {
|
|
27
|
+
/**
|
|
28
|
+
* Network issue, unable to get response from the server.
|
|
29
|
+
*/
|
|
27
30
|
Unknown = 1,
|
|
31
|
+
/**
|
|
32
|
+
* Response failed lexicon validation.
|
|
33
|
+
*/
|
|
28
34
|
InvalidResponse = 2,
|
|
29
35
|
Success = 200,
|
|
30
36
|
InvalidRequest = 400,
|
|
31
|
-
|
|
37
|
+
AuthenticationRequired = 401,
|
|
32
38
|
Forbidden = 403,
|
|
33
39
|
XRPCNotSupported = 404,
|
|
34
40
|
NotAcceptable = 406,
|
|
@@ -58,26 +64,8 @@ export function httpResponseCodeToEnum(status: number): ResponseType {
|
|
|
58
64
|
}
|
|
59
65
|
}
|
|
60
66
|
|
|
61
|
-
export const ResponseTypeNames = {
|
|
62
|
-
[ResponseType.Unknown]: 'Unknown',
|
|
63
|
-
[ResponseType.InvalidResponse]: 'InvalidResponse',
|
|
64
|
-
[ResponseType.Success]: 'Success',
|
|
65
|
-
[ResponseType.InvalidRequest]: 'InvalidRequest',
|
|
66
|
-
[ResponseType.AuthRequired]: 'AuthenticationRequired',
|
|
67
|
-
[ResponseType.Forbidden]: 'Forbidden',
|
|
68
|
-
[ResponseType.XRPCNotSupported]: 'XRPCNotSupported',
|
|
69
|
-
[ResponseType.PayloadTooLarge]: 'PayloadTooLarge',
|
|
70
|
-
[ResponseType.UnsupportedMediaType]: 'UnsupportedMediaType',
|
|
71
|
-
[ResponseType.RateLimitExceeded]: 'RateLimitExceeded',
|
|
72
|
-
[ResponseType.InternalServerError]: 'InternalServerError',
|
|
73
|
-
[ResponseType.MethodNotImplemented]: 'MethodNotImplemented',
|
|
74
|
-
[ResponseType.UpstreamFailure]: 'UpstreamFailure',
|
|
75
|
-
[ResponseType.NotEnoughResources]: 'NotEnoughResources',
|
|
76
|
-
[ResponseType.UpstreamTimeout]: 'UpstreamTimeout',
|
|
77
|
-
}
|
|
78
|
-
|
|
79
67
|
export function httpResponseCodeToName(status: number): string {
|
|
80
|
-
return
|
|
68
|
+
return ResponseType[httpResponseCodeToEnum(status)]
|
|
81
69
|
}
|
|
82
70
|
|
|
83
71
|
export const ResponseTypeStrings = {
|
|
@@ -85,9 +73,10 @@ export const ResponseTypeStrings = {
|
|
|
85
73
|
[ResponseType.InvalidResponse]: 'Invalid Response',
|
|
86
74
|
[ResponseType.Success]: 'Success',
|
|
87
75
|
[ResponseType.InvalidRequest]: 'Invalid Request',
|
|
88
|
-
[ResponseType.
|
|
76
|
+
[ResponseType.AuthenticationRequired]: 'Authentication Required',
|
|
89
77
|
[ResponseType.Forbidden]: 'Forbidden',
|
|
90
78
|
[ResponseType.XRPCNotSupported]: 'XRPC Not Supported',
|
|
79
|
+
[ResponseType.NotAcceptable]: 'Not Acceptable',
|
|
91
80
|
[ResponseType.PayloadTooLarge]: 'Payload Too Large',
|
|
92
81
|
[ResponseType.UnsupportedMediaType]: 'Unsupported Media Type',
|
|
93
82
|
[ResponseType.RateLimitExceeded]: 'Rate Limit Exceeded',
|
|
@@ -96,7 +85,7 @@ export const ResponseTypeStrings = {
|
|
|
96
85
|
[ResponseType.UpstreamFailure]: 'Upstream Failure',
|
|
97
86
|
[ResponseType.NotEnoughResources]: 'Not Enough Resources',
|
|
98
87
|
[ResponseType.UpstreamTimeout]: 'Upstream Timeout',
|
|
99
|
-
}
|
|
88
|
+
} as const satisfies Record<ResponseType, string>
|
|
100
89
|
|
|
101
90
|
export function httpResponseCodeToString(status: number): string {
|
|
102
91
|
return ResponseTypeStrings[httpResponseCodeToEnum(status)]
|
|
@@ -181,6 +170,8 @@ export class XRPCInvalidResponseError extends XRPCError {
|
|
|
181
170
|
) {
|
|
182
171
|
super(
|
|
183
172
|
ResponseType.InvalidResponse,
|
|
173
|
+
// @NOTE: This is probably wrong and should use ResponseTypeNames instead.
|
|
174
|
+
// But it would mean a breaking change.
|
|
184
175
|
ResponseTypeStrings[ResponseType.InvalidResponse],
|
|
185
176
|
`The server gave an invalid response and may be out of date.`,
|
|
186
177
|
undefined,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["./src/client.ts","./src/fetch-handler.ts","./src/index.ts","./src/types.ts","./src/util.ts","./src/xrpc-client.ts"],"version":"5.
|
|
1
|
+
{"root":["./src/client.ts","./src/fetch-handler.ts","./src/index.ts","./src/types.ts","./src/util.ts","./src/xrpc-client.ts"],"version":"5.8.2"}
|