@cubicecho/agent-router-worker 0.3.0 → 0.4.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/chunks/worker-D1CclE3Q.js +1744 -0
- package/lib.js +1 -1
- package/package.json +1 -1
- package/types/server/core/defaults.d.ts +6 -11
- package/types/server/core/error-message.d.ts +10 -0
- package/types/server/core/wire.d.ts +2 -0
- package/worker.js +1 -1
- package/chunks/worker-knPnskLw.js +0 -16211
- package/types/server/core/errors.d.ts +0 -49
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { GraphQLError } from 'graphql';
|
|
2
|
-
/** The `extensions.code` values clients branch on. */
|
|
3
|
-
export declare const ErrorCode: {
|
|
4
|
-
readonly Unauthenticated: 'UNAUTHENTICATED';
|
|
5
|
-
readonly NotFound: 'NOT_FOUND';
|
|
6
|
-
readonly BadUserInput: 'BAD_USER_INPUT';
|
|
7
|
-
readonly TooManyRequests: 'TOO_MANY_REQUESTS';
|
|
8
|
-
readonly QueryTooComplex: 'QUERY_TOO_COMPLEX';
|
|
9
|
-
readonly Forbidden: 'FORBIDDEN';
|
|
10
|
-
readonly Conflict: 'CONFLICT';
|
|
11
|
-
readonly UpstreamFailed: 'UPSTREAM_FAILED';
|
|
12
|
-
/** The router's own failure, as Yoga masks one. Its log says why. */
|
|
13
|
-
readonly Internal: 'INTERNAL_SERVER_ERROR';
|
|
14
|
-
};
|
|
15
|
-
export type ErrorCode = (typeof ErrorCode)[keyof typeof ErrorCode];
|
|
16
|
-
/** Arguments the caller can fix. */
|
|
17
|
-
export declare const badInput: (message: string) => GraphQLError;
|
|
18
|
-
/** No such row. */
|
|
19
|
-
export declare const notFound: (message: string) => GraphQLError;
|
|
20
|
-
/** Nobody is signed in, or the session has run out. */
|
|
21
|
-
export declare const unauthenticated: (message: string) => GraphQLError;
|
|
22
|
-
/** This kind of caller may never do this: a user reaching for what only an admin may, or a key on /graphql. */
|
|
23
|
-
export declare const forbidden: (message: string) => GraphQLError;
|
|
24
|
-
/** The request is fine, but the router is in a state that refuses it, such as demoting the last admin. */
|
|
25
|
-
export declare const conflict: (message: string) => GraphQLError;
|
|
26
|
-
/** A provider the router asked on the caller's behalf could not answer: unreachable, slow, or answering wrongly. */
|
|
27
|
-
export declare const upstreamFailed: (message: string) => GraphQLError;
|
|
28
|
-
/**
|
|
29
|
-
* Builds the rate-limit refusal.
|
|
30
|
-
*
|
|
31
|
-
* @param message - What the caller is told.
|
|
32
|
-
* @param retryAfter - Seconds until the next attempt would be let through.
|
|
33
|
-
* @returns The error, coded `ErrorCode.TooManyRequests`.
|
|
34
|
-
*/
|
|
35
|
-
export declare function rateLimited(message: string, retryAfter: number): GraphQLError;
|
|
36
|
-
/**
|
|
37
|
-
* Builds the refusal for an operation that is too deep, too aliased or too costly.
|
|
38
|
-
*
|
|
39
|
-
* @param message - Which limit the operation went over.
|
|
40
|
-
* @returns The error, coded `ErrorCode.QueryTooComplex`, answered as a 400.
|
|
41
|
-
*/
|
|
42
|
-
export declare function tooComplex(message: string): GraphQLError;
|
|
43
|
-
/**
|
|
44
|
-
* Reads the message of any caught value.
|
|
45
|
-
*
|
|
46
|
-
* @param error - Whatever was thrown.
|
|
47
|
-
* @returns `error.message` for an Error, otherwise `String(error)`.
|
|
48
|
-
*/
|
|
49
|
-
export declare function errorMessage(error: unknown): string;
|