@fluxomni/api-client 0.11.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/README.md +253 -0
- package/dist/auth.d.ts +36 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +71 -0
- package/dist/auth.js.map +1 -0
- package/dist/client.d.ts +89 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +254 -0
- package/dist/client.js.map +1 -0
- package/dist/errors.d.ts +59 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +135 -0
- package/dist/errors.js.map +1 -0
- package/dist/generated/graphql.d.ts +6777 -0
- package/dist/generated/graphql.d.ts.map +1 -0
- package/dist/generated/graphql.js +13702 -0
- package/dist/generated/graphql.js.map +1 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +46 -0
- package/dist/index.js.map +1 -0
- package/dist/scalars.d.ts +5 -0
- package/dist/scalars.d.ts.map +1 -0
- package/dist/scalars.js +2 -0
- package/dist/scalars.js.map +1 -0
- package/package.json +61 -0
- package/src/auth.ts +127 -0
- package/src/client.ts +412 -0
- package/src/errors.ts +183 -0
- package/src/generated/graphql.ts +20296 -0
- package/src/index.ts +72 -0
- package/src/scalars.ts +4 -0
package/dist/client.js
ADDED
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import { ApolloClient, ApolloError, HttpLink, InMemoryCache, split, } from '@apollo/client/core/index.js';
|
|
2
|
+
import { GraphQLWsLink } from '@apollo/client/link/subscriptions/index.js';
|
|
3
|
+
import { getMainDefinition } from '@apollo/client/utilities/index.js';
|
|
4
|
+
import { print } from 'graphql';
|
|
5
|
+
import { createClient } from 'graphql-ws';
|
|
6
|
+
import { createSessionFetch, login, } from './auth.js';
|
|
7
|
+
import { GraphQLError, MissingDataError, NetworkError } from './errors.js';
|
|
8
|
+
/**
|
|
9
|
+
* Low-level GraphQL client wrapping Apollo Client.
|
|
10
|
+
*
|
|
11
|
+
* Provides typed query, mutation, and subscription execution with consistent error handling.
|
|
12
|
+
*/
|
|
13
|
+
export class GraphQLClient {
|
|
14
|
+
config;
|
|
15
|
+
apolloClient;
|
|
16
|
+
wsClient;
|
|
17
|
+
constructor(config, callbacks) {
|
|
18
|
+
this.config = config;
|
|
19
|
+
const headers = clientHeaders(config);
|
|
20
|
+
const httpLink = new HttpLink({
|
|
21
|
+
uri: config.httpEndpoint,
|
|
22
|
+
fetch: config.fetch,
|
|
23
|
+
credentials: config.credentials,
|
|
24
|
+
headers,
|
|
25
|
+
});
|
|
26
|
+
let link = httpLink;
|
|
27
|
+
if (config.wsEndpoint) {
|
|
28
|
+
this.wsClient = createClient({
|
|
29
|
+
url: config.wsEndpoint,
|
|
30
|
+
keepAlive: 10_000,
|
|
31
|
+
connectionParams: connectionParams(config),
|
|
32
|
+
on: {
|
|
33
|
+
connected: () => callbacks?.onConnect?.(),
|
|
34
|
+
closed: () => callbacks?.onDisconnect?.(),
|
|
35
|
+
error: (err) => callbacks?.onError?.(err),
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
const wsLink = new GraphQLWsLink(this.wsClient);
|
|
39
|
+
link = split(({ query }) => {
|
|
40
|
+
const definition = getMainDefinition(query);
|
|
41
|
+
return (definition.kind === 'OperationDefinition' &&
|
|
42
|
+
definition.operation === 'subscription');
|
|
43
|
+
}, wsLink, httpLink);
|
|
44
|
+
}
|
|
45
|
+
this.apolloClient = new ApolloClient({
|
|
46
|
+
link,
|
|
47
|
+
cache: new InMemoryCache(),
|
|
48
|
+
defaultOptions: {
|
|
49
|
+
query: { fetchPolicy: 'network-only' },
|
|
50
|
+
mutate: { fetchPolicy: 'no-cache' },
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Log in with the session endpoint and return a session-aware client.
|
|
56
|
+
*/
|
|
57
|
+
static async login(options, callbacks) {
|
|
58
|
+
const auth = await login(options);
|
|
59
|
+
const endpoints = endpointsFromLoginOptions(options);
|
|
60
|
+
const fetchFn = auth.cookieHeader
|
|
61
|
+
? createSessionFetch(auth.cookieHeader, options.fetch)
|
|
62
|
+
: options.fetch;
|
|
63
|
+
return {
|
|
64
|
+
client: new GraphQLClient({
|
|
65
|
+
httpEndpoint: endpoints.httpEndpoint,
|
|
66
|
+
wsEndpoint: endpoints.wsEndpoint,
|
|
67
|
+
cookieHeader: auth.cookieHeader,
|
|
68
|
+
credentials: options.credentials ?? 'same-origin',
|
|
69
|
+
fetch: fetchFn,
|
|
70
|
+
}, callbacks),
|
|
71
|
+
status: auth.status,
|
|
72
|
+
cookieHeader: auth.cookieHeader,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Create a client from environment variables.
|
|
77
|
+
*/
|
|
78
|
+
static fromEnv(env, callbacks) {
|
|
79
|
+
const resolvedEnv = env ?? globalThis.process?.env ?? {};
|
|
80
|
+
const httpEndpoint = resolvedEnv.FLUXOMNI_HTTP_ENDPOINT || resolvedEnv.GRAPHQL_ENDPOINT;
|
|
81
|
+
if (!httpEndpoint) {
|
|
82
|
+
throw new Error('FLUXOMNI_HTTP_ENDPOINT or GRAPHQL_ENDPOINT environment variable must be set');
|
|
83
|
+
}
|
|
84
|
+
return new GraphQLClient({
|
|
85
|
+
httpEndpoint,
|
|
86
|
+
wsEndpoint: resolvedEnv.FLUXOMNI_WS_ENDPOINT,
|
|
87
|
+
authHeader: resolvedEnv.FLUXOMNI_AUTH || resolvedEnv.GRAPHQL_AUTH,
|
|
88
|
+
}, callbacks);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Get the underlying Apollo Client instance.
|
|
92
|
+
*/
|
|
93
|
+
get apollo() {
|
|
94
|
+
return this.apolloClient;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Execute a GraphQL query.
|
|
98
|
+
*/
|
|
99
|
+
async query(options) {
|
|
100
|
+
try {
|
|
101
|
+
const result = await this.apolloClient.query(options);
|
|
102
|
+
if (result.errors?.length) {
|
|
103
|
+
throw GraphQLError.fromGraphQLErrors(result.errors);
|
|
104
|
+
}
|
|
105
|
+
if (!result.data) {
|
|
106
|
+
throw new MissingDataError();
|
|
107
|
+
}
|
|
108
|
+
return result.data;
|
|
109
|
+
}
|
|
110
|
+
catch (error) {
|
|
111
|
+
if (error instanceof GraphQLError)
|
|
112
|
+
throw error;
|
|
113
|
+
if (error instanceof ApolloError) {
|
|
114
|
+
if (error.graphQLErrors.length) {
|
|
115
|
+
throw GraphQLError.fromGraphQLErrors(error.graphQLErrors);
|
|
116
|
+
}
|
|
117
|
+
if (error.networkError) {
|
|
118
|
+
throw new NetworkError(error.networkError.message, undefined, error);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
throw new NetworkError(error instanceof Error ? error.message : 'Unknown error', undefined, error instanceof Error ? error : undefined);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Execute a GraphQL mutation.
|
|
126
|
+
*/
|
|
127
|
+
async mutate(options) {
|
|
128
|
+
try {
|
|
129
|
+
const result = await this.apolloClient.mutate(options);
|
|
130
|
+
if (result.errors?.length) {
|
|
131
|
+
throw GraphQLError.fromGraphQLErrors(result.errors);
|
|
132
|
+
}
|
|
133
|
+
if (!result.data) {
|
|
134
|
+
throw new MissingDataError();
|
|
135
|
+
}
|
|
136
|
+
return result.data;
|
|
137
|
+
}
|
|
138
|
+
catch (error) {
|
|
139
|
+
if (error instanceof GraphQLError)
|
|
140
|
+
throw error;
|
|
141
|
+
if (error instanceof ApolloError) {
|
|
142
|
+
if (error.graphQLErrors.length) {
|
|
143
|
+
throw GraphQLError.fromGraphQLErrors(error.graphQLErrors);
|
|
144
|
+
}
|
|
145
|
+
if (error.networkError) {
|
|
146
|
+
throw new NetworkError(error.networkError.message, undefined, error);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
throw new NetworkError(error instanceof Error ? error.message : 'Unknown error', undefined, error instanceof Error ? error : undefined);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Create a subscription observable.
|
|
154
|
+
*/
|
|
155
|
+
subscribe(options) {
|
|
156
|
+
return this.apolloClient.subscribe(options);
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Execute a raw GraphQL operation with untyped variables.
|
|
160
|
+
*
|
|
161
|
+
* This is the recommended automation surface when generated operation
|
|
162
|
+
* documents are more structure than needed.
|
|
163
|
+
*/
|
|
164
|
+
async executeRaw(query, variables) {
|
|
165
|
+
const fetchFn = this.config.fetch ?? globalThis.fetch;
|
|
166
|
+
if (!fetchFn) {
|
|
167
|
+
throw new NetworkError('No fetch implementation available');
|
|
168
|
+
}
|
|
169
|
+
const response = await fetchFn(this.config.httpEndpoint, {
|
|
170
|
+
method: 'POST',
|
|
171
|
+
credentials: this.config.credentials,
|
|
172
|
+
headers: {
|
|
173
|
+
'content-type': 'application/json',
|
|
174
|
+
...clientHeaders(this.config),
|
|
175
|
+
},
|
|
176
|
+
body: JSON.stringify({
|
|
177
|
+
query: typeof query === 'string' ? query : print(query),
|
|
178
|
+
variables: variables ?? {},
|
|
179
|
+
}),
|
|
180
|
+
});
|
|
181
|
+
if (!response.ok) {
|
|
182
|
+
throw new NetworkError(`HTTP ${response.status}: ${await response.text()}`, response.status);
|
|
183
|
+
}
|
|
184
|
+
const body = (await response.json());
|
|
185
|
+
if (body.errors?.length) {
|
|
186
|
+
throw GraphQLError.fromGraphQLErrors(body.errors);
|
|
187
|
+
}
|
|
188
|
+
if (!body.data) {
|
|
189
|
+
throw new MissingDataError();
|
|
190
|
+
}
|
|
191
|
+
return body.data;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Stop the client and clean up resources.
|
|
195
|
+
*/
|
|
196
|
+
stop() {
|
|
197
|
+
this.apolloClient.stop();
|
|
198
|
+
this.wsClient?.dispose();
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Clear the Apollo cache.
|
|
202
|
+
*/
|
|
203
|
+
async clearCache() {
|
|
204
|
+
await this.apolloClient.clearStore();
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Reset the Apollo store (clear cache and refetch active queries).
|
|
208
|
+
*/
|
|
209
|
+
async resetStore() {
|
|
210
|
+
await this.apolloClient.resetStore();
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
function clientHeaders(config) {
|
|
214
|
+
const headers = {};
|
|
215
|
+
if (config.authHeader) {
|
|
216
|
+
headers.Authorization = config.authHeader;
|
|
217
|
+
}
|
|
218
|
+
if (config.cookieHeader) {
|
|
219
|
+
headers.Cookie = config.cookieHeader;
|
|
220
|
+
}
|
|
221
|
+
return Object.keys(headers).length > 0 ? headers : undefined;
|
|
222
|
+
}
|
|
223
|
+
function connectionParams(config) {
|
|
224
|
+
const params = {};
|
|
225
|
+
if (config.authHeader) {
|
|
226
|
+
params.authorization = config.authHeader;
|
|
227
|
+
}
|
|
228
|
+
if (config.cookieHeader) {
|
|
229
|
+
params.cookie = config.cookieHeader;
|
|
230
|
+
}
|
|
231
|
+
return Object.keys(params).length > 0 ? params : undefined;
|
|
232
|
+
}
|
|
233
|
+
function endpointsFromLoginOptions(options) {
|
|
234
|
+
if (options.httpEndpoint) {
|
|
235
|
+
return {
|
|
236
|
+
httpEndpoint: options.httpEndpoint,
|
|
237
|
+
wsEndpoint: options.wsEndpoint,
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
const hasWebSocket = typeof globalThis.WebSocket !== 'undefined';
|
|
241
|
+
if (!options.baseUrl) {
|
|
242
|
+
return {
|
|
243
|
+
httpEndpoint: '/api',
|
|
244
|
+
wsEndpoint: options.wsEndpoint ?? (hasWebSocket ? '/api/subscriptions' : undefined),
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
const httpEndpoint = new URL('/api', options.baseUrl).toString();
|
|
248
|
+
const wsEndpoint = options.wsEndpoint ??
|
|
249
|
+
(hasWebSocket
|
|
250
|
+
? httpEndpoint.replace(/^http(?=:)/, 'ws').concat('/subscriptions')
|
|
251
|
+
: undefined);
|
|
252
|
+
return { httpEndpoint, wsEndpoint };
|
|
253
|
+
}
|
|
254
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AACA,OAAO,EACL,YAAY,EACZ,WAAW,EAIX,QAAQ,EACR,aAAa,EAMb,KAAK,GACN,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,4CAA4C,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAA8B,KAAK,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,EAAE,YAAY,EAA2B,MAAM,YAAY,CAAC;AACnE,OAAO,EAEL,kBAAkB,EAElB,KAAK,GACN,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AA2C3E;;;;GAIG;AACH,MAAM,OAAO,aAAa;IACP,MAAM,CAAsB;IACrC,YAAY,CAAsC;IAClD,QAAQ,CAAY;IAE5B,YAAY,MAA2B,EAAE,SAA+B;QACtE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;QAEtC,MAAM,QAAQ,GAAG,IAAI,QAAQ,CAAC;YAC5B,GAAG,EAAE,MAAM,CAAC,YAAY;YACxB,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B,OAAO;SACR,CAAC,CAAC;QAEH,IAAI,IAAI,GAAe,QAAQ,CAAC;QAEhC,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;YACtB,IAAI,CAAC,QAAQ,GAAG,YAAY,CAAC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C,UAAU,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,SAAS,CAAC;SAC1E,CAAC;IACJ,CAAC;IAED,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,CAAC;IACjE,MAAM,UAAU,GACd,OAAO,CAAC,UAAU;QAClB,CAAC,YAAY;YACX,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC,MAAM,CAAC,gBAAgB,CAAC;YACnE,CAAC,CAAC,SAAS,CAAC,CAAC;IAEjB,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,CAAC;AACtC,CAAC"}
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { GraphQLFormattedError } from 'graphql';
|
|
2
|
+
/**
|
|
3
|
+
* Structured error details returned by the GraphQL server.
|
|
4
|
+
*/
|
|
5
|
+
export interface GraphQLServerError {
|
|
6
|
+
message: string;
|
|
7
|
+
code?: string;
|
|
8
|
+
status?: number;
|
|
9
|
+
backtrace?: string[];
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Public automation categories for GraphQL errors.
|
|
13
|
+
*/
|
|
14
|
+
export type GraphQLErrorCategory = 'unauthenticated' | 'forbidden' | 'validation' | 'not_found' | 'conflict' | 'persistence_failure' | 'runtime_unavailable' | 'operation_rejected' | 'unknown';
|
|
15
|
+
/**
|
|
16
|
+
* Classify a GraphQL server error into the public automation taxonomy.
|
|
17
|
+
*/
|
|
18
|
+
export declare function classifyGraphQLError(error: GraphQLServerError): GraphQLErrorCategory;
|
|
19
|
+
/**
|
|
20
|
+
* High-level client errors for the TypeScript GraphQL client.
|
|
21
|
+
*/
|
|
22
|
+
export declare class ClientError extends Error {
|
|
23
|
+
readonly cause?: Error | undefined;
|
|
24
|
+
constructor(message: string, cause?: Error | undefined);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* GraphQL-specific errors.
|
|
28
|
+
*/
|
|
29
|
+
export declare class GraphQLError extends ClientError {
|
|
30
|
+
readonly errors: GraphQLServerError[];
|
|
31
|
+
constructor(message: string, errors?: GraphQLServerError[], cause?: Error);
|
|
32
|
+
static fromGraphQLErrors(errors: readonly GraphQLFormattedError[]): GraphQLError;
|
|
33
|
+
get categories(): GraphQLErrorCategory[];
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Network-related errors.
|
|
37
|
+
*/
|
|
38
|
+
export declare class NetworkError extends ClientError {
|
|
39
|
+
readonly statusCode?: number | undefined;
|
|
40
|
+
constructor(message: string, statusCode?: number | undefined, cause?: Error);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Missing field in response error.
|
|
44
|
+
*/
|
|
45
|
+
export declare class MissingFieldError extends ClientError {
|
|
46
|
+
readonly fieldName: string;
|
|
47
|
+
constructor(fieldName: string);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Missing data in response error.
|
|
51
|
+
*/
|
|
52
|
+
export declare class MissingDataError extends ClientError {
|
|
53
|
+
constructor();
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Extract a required field from an optional value.
|
|
57
|
+
*/
|
|
58
|
+
export declare function extractField<T>(value: T | null | undefined, fieldName: string): T;
|
|
59
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAErD;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB;A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_', 'EMPTY_', 'TOO_MUCH_'];
|
|
2
|
+
const VALIDATION_CODE_SUFFIXES = ['_INVALID', '_VALIDATION_FAILED'];
|
|
3
|
+
const VALIDATION_CODE_EXACT = new Set([
|
|
4
|
+
'INVALID_JSON',
|
|
5
|
+
'INVALID_SPEC',
|
|
6
|
+
'NO_API_KEY',
|
|
7
|
+
'ROUTE_SOURCES_EMPTY',
|
|
8
|
+
'WRONG_ARRAY_INDEX',
|
|
9
|
+
]);
|
|
10
|
+
const PERSISTENCE_CODE_PARTS = ['PERSIST', 'STORAGE', 'DATABASE'];
|
|
11
|
+
const RUNTIME_UNAVAILABLE_CODE_PARTS = ['RUNTIME_STATE_UNAVAILABLE', 'UNAVAILABLE'];
|
|
12
|
+
const OPERATION_REJECTED_CODE_PARTS = ['REJECTED', 'STALE_ASSIGNMENT'];
|
|
13
|
+
/**
|
|
14
|
+
* Classify a GraphQL server error into the public automation taxonomy.
|
|
15
|
+
*/
|
|
16
|
+
export function classifyGraphQLError(error) {
|
|
17
|
+
switch (error.status) {
|
|
18
|
+
case 401:
|
|
19
|
+
return 'unauthenticated';
|
|
20
|
+
case 403:
|
|
21
|
+
return 'forbidden';
|
|
22
|
+
case 404:
|
|
23
|
+
return 'not_found';
|
|
24
|
+
case 409:
|
|
25
|
+
return 'conflict';
|
|
26
|
+
case 400:
|
|
27
|
+
return 'validation';
|
|
28
|
+
default:
|
|
29
|
+
break;
|
|
30
|
+
}
|
|
31
|
+
const code = error.code?.toUpperCase();
|
|
32
|
+
if (!code)
|
|
33
|
+
return 'unknown';
|
|
34
|
+
if (code === 'UNAUTHORIZED')
|
|
35
|
+
return 'unauthenticated';
|
|
36
|
+
if (code === 'FORBIDDEN')
|
|
37
|
+
return 'forbidden';
|
|
38
|
+
if (code.endsWith('_NOT_FOUND') || code === 'NOT_FOUND')
|
|
39
|
+
return 'not_found';
|
|
40
|
+
if (code.includes('CONFLICT') || code.includes('DUPLICATE'))
|
|
41
|
+
return 'conflict';
|
|
42
|
+
if (VALIDATION_CODE_EXACT.has(code) ||
|
|
43
|
+
VALIDATION_CODE_PREFIXES.some((prefix) => code.startsWith(prefix)) ||
|
|
44
|
+
VALIDATION_CODE_SUFFIXES.some((suffix) => code.endsWith(suffix))) {
|
|
45
|
+
return 'validation';
|
|
46
|
+
}
|
|
47
|
+
if (PERSISTENCE_CODE_PARTS.some((part) => code.includes(part))) {
|
|
48
|
+
return 'persistence_failure';
|
|
49
|
+
}
|
|
50
|
+
if (RUNTIME_UNAVAILABLE_CODE_PARTS.some((part) => code.includes(part))) {
|
|
51
|
+
return 'runtime_unavailable';
|
|
52
|
+
}
|
|
53
|
+
if (OPERATION_REJECTED_CODE_PARTS.some((part) => code.includes(part))) {
|
|
54
|
+
return 'operation_rejected';
|
|
55
|
+
}
|
|
56
|
+
return 'unknown';
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* High-level client errors for the TypeScript GraphQL client.
|
|
60
|
+
*/
|
|
61
|
+
export class ClientError extends Error {
|
|
62
|
+
cause;
|
|
63
|
+
constructor(message, cause) {
|
|
64
|
+
super(message);
|
|
65
|
+
this.cause = cause;
|
|
66
|
+
this.name = 'ClientError';
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* GraphQL-specific errors.
|
|
71
|
+
*/
|
|
72
|
+
export class GraphQLError extends ClientError {
|
|
73
|
+
errors;
|
|
74
|
+
constructor(message, errors = [], cause) {
|
|
75
|
+
super(message, cause);
|
|
76
|
+
this.errors = errors;
|
|
77
|
+
this.name = 'GraphQLError';
|
|
78
|
+
}
|
|
79
|
+
static fromGraphQLErrors(errors) {
|
|
80
|
+
const serverErrors = errors.map((err) => {
|
|
81
|
+
const extensions = err.extensions;
|
|
82
|
+
return {
|
|
83
|
+
message: err.message,
|
|
84
|
+
code: extensions?.code,
|
|
85
|
+
status: extensions?.status,
|
|
86
|
+
backtrace: extensions?.backtrace,
|
|
87
|
+
};
|
|
88
|
+
});
|
|
89
|
+
return new GraphQLError(`GraphQL errors: ${serverErrors.map((e) => e.message).join(', ')}`, serverErrors);
|
|
90
|
+
}
|
|
91
|
+
get categories() {
|
|
92
|
+
return Array.from(new Set(this.errors.map((error) => classifyGraphQLError(error))));
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Network-related errors.
|
|
97
|
+
*/
|
|
98
|
+
export class NetworkError extends ClientError {
|
|
99
|
+
statusCode;
|
|
100
|
+
constructor(message, statusCode, cause) {
|
|
101
|
+
super(message, cause);
|
|
102
|
+
this.statusCode = statusCode;
|
|
103
|
+
this.name = 'NetworkError';
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Missing field in response error.
|
|
108
|
+
*/
|
|
109
|
+
export class MissingFieldError extends ClientError {
|
|
110
|
+
fieldName;
|
|
111
|
+
constructor(fieldName) {
|
|
112
|
+
super(`Missing field in response: ${fieldName}`);
|
|
113
|
+
this.fieldName = fieldName;
|
|
114
|
+
this.name = 'MissingFieldError';
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Missing data in response error.
|
|
119
|
+
*/
|
|
120
|
+
export class MissingDataError extends ClientError {
|
|
121
|
+
constructor() {
|
|
122
|
+
super('Missing data in response');
|
|
123
|
+
this.name = 'MissingDataError';
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Extract a required field from an optional value.
|
|
128
|
+
*/
|
|
129
|
+
export function extractField(value, fieldName) {
|
|
130
|
+
if (value === null || value === undefined) {
|
|
131
|
+
throw new MissingFieldError(fieldName);
|
|
132
|
+
}
|
|
133
|
+
return value;
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AA0BA,MAAM,wBAAwB,GAAG,CAAC,UAAU,EAAE,Q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