@aws-amplify/api-graphql 4.6.7-graphql-multi-client.4f8e7a9.0 → 4.6.7-graphql-multi-client.93b5136.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/dist/esm/internals/generateClient.d.ts +2 -2
- package/dist/esm/internals/server/generateClientWithAmplifyInstance.d.ts +1 -1
- package/dist/esm/internals/types.d.ts +9 -14
- package/dist/esm/internals/v6.d.ts +2 -2
- package/dist/esm/server/generateClient.d.ts +4 -1
- package/dist/esm/types/index.d.ts +11 -11
- package/package.json +4 -4
- package/src/internals/generateClient.ts +3 -6
- package/src/internals/server/generateClientWithAmplifyInstance.ts +3 -3
- package/src/internals/types.ts +20 -34
- package/src/internals/v6.ts +4 -2
- package/src/server/generateClient.ts +6 -17
- package/src/types/index.ts +21 -38
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { V6Client } from '../types';
|
|
2
|
-
import { ClientGenerationParams } from './types';
|
|
2
|
+
import { ClientGenerationParams, CommonPublicClientOptions } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* @private
|
|
5
5
|
*
|
|
@@ -9,4 +9,4 @@ import { ClientGenerationParams } from './types';
|
|
|
9
9
|
* @param params
|
|
10
10
|
* @returns
|
|
11
11
|
*/
|
|
12
|
-
export declare function generateClient<T extends Record<any, any> = never,
|
|
12
|
+
export declare function generateClient<T extends Record<any, any> = never, Options extends CommonPublicClientOptions = object>(params: ClientGenerationParams): V6Client<T, Options>;
|
|
@@ -10,4 +10,4 @@ import { CommonPublicClientOptions, ServerClientGenerationParams, V6ClientSSRCoo
|
|
|
10
10
|
* @param params
|
|
11
11
|
* @returns
|
|
12
12
|
*/
|
|
13
|
-
export declare function generateClientWithAmplifyInstance<T extends Record<any, any> = never, ClientType extends V6ClientSSRRequest<T
|
|
13
|
+
export declare function generateClientWithAmplifyInstance<T extends Record<any, any> = never, ClientType extends V6ClientSSRRequest<T> | V6ClientSSRCookies<T> = V6ClientSSRCookies<T>>(params: ServerClientGenerationParams & CommonPublicClientOptions): ClientType;
|
|
@@ -6,33 +6,28 @@ import { CustomHeaders } from '@aws-amplify/data-schema/runtime';
|
|
|
6
6
|
*
|
|
7
7
|
* The knobs available for configuring `generateClient` internally.
|
|
8
8
|
*/
|
|
9
|
-
export type ClientGenerationParams
|
|
9
|
+
export type ClientGenerationParams = {
|
|
10
10
|
amplify: AmplifyClassV6;
|
|
11
|
-
} & CommonPublicClientOptions
|
|
11
|
+
} & CommonPublicClientOptions;
|
|
12
12
|
/**
|
|
13
13
|
* Common options that can be used on public `generateClient()` interfaces.
|
|
14
14
|
*/
|
|
15
|
-
export type CommonPublicClientOptions
|
|
16
|
-
endpoint
|
|
17
|
-
authMode
|
|
18
|
-
apiKey: string;
|
|
15
|
+
export type CommonPublicClientOptions = {
|
|
16
|
+
endpoint?: never;
|
|
17
|
+
authMode?: GraphQLAuthMode;
|
|
19
18
|
authToken?: string;
|
|
19
|
+
apiKey?: string;
|
|
20
20
|
headers?: CustomHeaders;
|
|
21
21
|
} | {
|
|
22
22
|
endpoint: string;
|
|
23
|
+
authMode: 'apiKey';
|
|
23
24
|
apiKey: string;
|
|
24
|
-
authMode: Exclude<GraphQLAuthMode, 'apiKey'>;
|
|
25
25
|
authToken?: string;
|
|
26
26
|
headers?: CustomHeaders;
|
|
27
|
-
}
|
|
27
|
+
} | {
|
|
28
28
|
endpoint: string;
|
|
29
29
|
authMode: Exclude<GraphQLAuthMode, 'apiKey'>;
|
|
30
|
-
apiKey?:
|
|
31
|
-
authToken?: string;
|
|
32
|
-
headers?: CustomHeaders;
|
|
33
|
-
} : {
|
|
34
|
-
endpoint?: never;
|
|
35
|
-
authMode?: GraphQLAuthMode;
|
|
30
|
+
apiKey?: string;
|
|
36
31
|
authToken?: string;
|
|
37
32
|
headers?: CustomHeaders;
|
|
38
33
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CustomHeaders } from '@aws-amplify/data-schema/runtime';
|
|
2
|
-
import { GraphQLOptionsV6, GraphQLResponseV6, V6Client } from '../types';
|
|
2
|
+
import { CommonPublicClientOptions, GraphQLOptionsV6, GraphQLResponseV6, V6Client } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* Invokes graphql operations against a graphql service, providing correct input and
|
|
5
5
|
* output types if Amplify-generated graphql from a recent version of the CLI/codegen
|
|
@@ -84,7 +84,7 @@ import { GraphQLOptionsV6, GraphQLResponseV6, V6Client } from '../types';
|
|
|
84
84
|
* @param options
|
|
85
85
|
* @param additionalHeaders
|
|
86
86
|
*/
|
|
87
|
-
export declare function graphql<FALLBACK_TYPES = unknown, TYPED_GQL_STRING extends string = string>(this: V6Client, options: GraphQLOptionsV6<FALLBACK_TYPES, TYPED_GQL_STRING>, additionalHeaders?: CustomHeaders): GraphQLResponseV6<FALLBACK_TYPES, TYPED_GQL_STRING>;
|
|
87
|
+
export declare function graphql<FALLBACK_TYPES = unknown, TYPED_GQL_STRING extends string = string, Options extends CommonPublicClientOptions = object>(this: V6Client, options: GraphQLOptionsV6<FALLBACK_TYPES, TYPED_GQL_STRING, Options>, additionalHeaders?: CustomHeaders): GraphQLResponseV6<FALLBACK_TYPES, TYPED_GQL_STRING>;
|
|
88
88
|
/**
|
|
89
89
|
* Cancels an inflight request. Only applicable for graphql queries and mutations
|
|
90
90
|
* @param {any} request - request to cancel
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ResourcesConfig } from '@aws-amplify/core';
|
|
1
2
|
import { GenerateServerClientParams, V6ClientSSRRequest } from '../types';
|
|
2
3
|
/**
|
|
3
4
|
* Generates an GraphQL API client that works with Amplify server context.
|
|
@@ -15,4 +16,6 @@ import { GenerateServerClientParams, V6ClientSSRRequest } from '../types';
|
|
|
15
16
|
* }),
|
|
16
17
|
* });
|
|
17
18
|
*/
|
|
18
|
-
export declare function generateClient<T extends Record<any, any> = never,
|
|
19
|
+
export declare function generateClient<T extends Record<any, any> = never, Options extends GenerateServerClientParams = {
|
|
20
|
+
config: ResourcesConfig;
|
|
21
|
+
}>(options: Options): V6ClientSSRRequest<T, Options>;
|
|
@@ -165,7 +165,7 @@ export type GraphQLOperation = Source | string;
|
|
|
165
165
|
* API V6 `graphql({options})` type that can leverage branded graphql `query`
|
|
166
166
|
* objects and fallback types.
|
|
167
167
|
*/
|
|
168
|
-
export type GraphQLOptionsV6<FALLBACK_TYPES = unknown, TYPED_GQL_STRING extends string = string,
|
|
168
|
+
export type GraphQLOptionsV6<FALLBACK_TYPES = unknown, TYPED_GQL_STRING extends string = string, Options extends CommonPublicClientOptions = object> = Options['endpoint'] extends string ? Options['apiKey'] extends string ? {
|
|
169
169
|
query: TYPED_GQL_STRING | DocumentNode;
|
|
170
170
|
variables?: GraphQLVariablesV6<FALLBACK_TYPES, TYPED_GQL_STRING>;
|
|
171
171
|
authMode?: GraphQLAuthMode;
|
|
@@ -324,23 +324,23 @@ export declare const __headers: unique symbol;
|
|
|
324
324
|
export declare const __endpoint: unique symbol;
|
|
325
325
|
export declare function getInternals(client: BaseClient): ClientInternals;
|
|
326
326
|
export type ClientWithModels = V6Client | V6ClientSSRRequest | V6ClientSSRCookies;
|
|
327
|
-
export type V6Client<T extends Record<any, any> = never,
|
|
328
|
-
graphql: GraphQLMethod<
|
|
327
|
+
export type V6Client<T extends Record<any, any> = never, Options extends CommonPublicClientOptions = object> = {
|
|
328
|
+
graphql: GraphQLMethod<Options>;
|
|
329
329
|
cancel(promise: Promise<any>, message?: string): boolean;
|
|
330
330
|
isCancelError(error: any): boolean;
|
|
331
331
|
} & ClientExtensions<T>;
|
|
332
|
-
export type V6ClientSSRRequest<T extends Record<any, any> = never,
|
|
333
|
-
graphql: GraphQLMethodSSR<
|
|
332
|
+
export type V6ClientSSRRequest<T extends Record<any, any> = never, Options extends CommonPublicClientOptions = object> = {
|
|
333
|
+
graphql: GraphQLMethodSSR<Options>;
|
|
334
334
|
cancel(promise: Promise<any>, message?: string): boolean;
|
|
335
335
|
isCancelError(error: any): boolean;
|
|
336
336
|
} & ClientExtensionsSSRRequest<T>;
|
|
337
|
-
export type V6ClientSSRCookies<T extends Record<any, any> = never,
|
|
338
|
-
graphql: GraphQLMethod<
|
|
337
|
+
export type V6ClientSSRCookies<T extends Record<any, any> = never, Options extends CommonPublicClientOptions = object> = {
|
|
338
|
+
graphql: GraphQLMethod<Options>;
|
|
339
339
|
cancel(promise: Promise<any>, message?: string): boolean;
|
|
340
340
|
isCancelError(error: any): boolean;
|
|
341
341
|
} & ClientExtensionsSSRCookies<T>;
|
|
342
|
-
export type GraphQLMethod<
|
|
343
|
-
export type GraphQLMethodSSR<
|
|
342
|
+
export type GraphQLMethod<Options extends CommonPublicClientOptions> = <FALLBACK_TYPES = unknown, TYPED_GQL_STRING extends string = string>(options: GraphQLOptionsV6<FALLBACK_TYPES, TYPED_GQL_STRING, Options>, additionalHeaders?: CustomHeaders | undefined) => GraphQLResponseV6<FALLBACK_TYPES, TYPED_GQL_STRING>;
|
|
343
|
+
export type GraphQLMethodSSR<Options extends CommonPublicClientOptions> = <FALLBACK_TYPES = unknown, TYPED_GQL_STRING extends string = string>(contextSpec: AmplifyServer.ContextSpec, options: GraphQLOptionsV6<FALLBACK_TYPES, TYPED_GQL_STRING, Options>, additionalHeaders?: CustomHeaders | undefined) => GraphQLResponseV6<FALLBACK_TYPES, TYPED_GQL_STRING>;
|
|
344
344
|
/**
|
|
345
345
|
* @private
|
|
346
346
|
*
|
|
@@ -361,6 +361,6 @@ export interface AuthModeParams extends Record<string, unknown> {
|
|
|
361
361
|
authMode?: GraphQLAuthMode;
|
|
362
362
|
authToken?: string;
|
|
363
363
|
}
|
|
364
|
-
export type GenerateServerClientParams
|
|
364
|
+
export type GenerateServerClientParams = {
|
|
365
365
|
config: ResourcesConfig;
|
|
366
|
-
} & CommonPublicClientOptions
|
|
366
|
+
} & CommonPublicClientOptions;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-amplify/api-graphql",
|
|
3
|
-
"version": "4.6.7-graphql-multi-client.
|
|
3
|
+
"version": "4.6.7-graphql-multi-client.93b5136.0+93b5136",
|
|
4
4
|
"description": "Api-graphql category of aws-amplify",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.mjs",
|
|
@@ -84,8 +84,8 @@
|
|
|
84
84
|
"server"
|
|
85
85
|
],
|
|
86
86
|
"dependencies": {
|
|
87
|
-
"@aws-amplify/api-rest": "4.0.64-graphql-multi-client.
|
|
88
|
-
"@aws-amplify/core": "6.7.4-graphql-multi-client.
|
|
87
|
+
"@aws-amplify/api-rest": "4.0.64-graphql-multi-client.93b5136.0+93b5136",
|
|
88
|
+
"@aws-amplify/core": "6.7.4-graphql-multi-client.93b5136.0+93b5136",
|
|
89
89
|
"@aws-amplify/data-schema": "^1.7.0",
|
|
90
90
|
"@aws-sdk/types": "3.387.0",
|
|
91
91
|
"graphql": "15.8.0",
|
|
@@ -101,5 +101,5 @@
|
|
|
101
101
|
"limit": "91.7 kB"
|
|
102
102
|
}
|
|
103
103
|
],
|
|
104
|
-
"gitHead": "
|
|
104
|
+
"gitHead": "93b51360e57e283a7d4ed64c6b701d85ec71e94b"
|
|
105
105
|
}
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
import { isApiGraphQLConfig } from './utils/runtimeTypeGuards/isApiGraphQLProviderConfig';
|
|
25
25
|
import { isConfigureEventWithResourceConfig } from './utils/runtimeTypeGuards/isConfigureEventWithResourceConfig';
|
|
26
26
|
import { cancel, graphql, isCancelError } from './v6';
|
|
27
|
-
import { ClientGenerationParams } from './types';
|
|
27
|
+
import { ClientGenerationParams, CommonPublicClientOptions } from './types';
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
* @private
|
|
@@ -37,11 +37,8 @@ import { ClientGenerationParams } from './types';
|
|
|
37
37
|
*/
|
|
38
38
|
export function generateClient<
|
|
39
39
|
T extends Record<any, any> = never,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
>(
|
|
43
|
-
params: ClientGenerationParams<WithCustomEndpoint, WithApiKey>,
|
|
44
|
-
): V6Client<T, WithCustomEndpoint, WithApiKey> {
|
|
40
|
+
Options extends CommonPublicClientOptions = object,
|
|
41
|
+
>(params: ClientGenerationParams): V6Client<T, Options> {
|
|
45
42
|
const client = {
|
|
46
43
|
[__amplify]: params.amplify,
|
|
47
44
|
[__authMode]: params.authMode,
|
|
@@ -33,10 +33,10 @@ import { cancel, graphql, isCancelError } from '..';
|
|
|
33
33
|
export function generateClientWithAmplifyInstance<
|
|
34
34
|
T extends Record<any, any> = never,
|
|
35
35
|
ClientType extends
|
|
36
|
-
| V6ClientSSRRequest<T
|
|
37
|
-
| V6ClientSSRCookies<T
|
|
36
|
+
| V6ClientSSRRequest<T>
|
|
37
|
+
| V6ClientSSRCookies<T> = V6ClientSSRCookies<T>,
|
|
38
38
|
>(
|
|
39
|
-
params: ServerClientGenerationParams & CommonPublicClientOptions
|
|
39
|
+
params: ServerClientGenerationParams & CommonPublicClientOptions,
|
|
40
40
|
): ClientType {
|
|
41
41
|
const client = {
|
|
42
42
|
[__amplify]: params.amplify,
|
package/src/internals/types.ts
CHANGED
|
@@ -9,46 +9,32 @@ import { CustomHeaders } from '@aws-amplify/data-schema/runtime';
|
|
|
9
9
|
*
|
|
10
10
|
* The knobs available for configuring `generateClient` internally.
|
|
11
11
|
*/
|
|
12
|
-
export type ClientGenerationParams
|
|
13
|
-
WithCustomEndpoint extends boolean,
|
|
14
|
-
WithApiKey extends boolean,
|
|
15
|
-
> = {
|
|
12
|
+
export type ClientGenerationParams = {
|
|
16
13
|
amplify: AmplifyClassV6;
|
|
17
|
-
} & CommonPublicClientOptions
|
|
14
|
+
} & CommonPublicClientOptions;
|
|
18
15
|
|
|
19
16
|
/**
|
|
20
17
|
* Common options that can be used on public `generateClient()` interfaces.
|
|
21
18
|
*/
|
|
22
|
-
export type CommonPublicClientOptions
|
|
23
|
-
|
|
24
|
-
WithApiKey extends boolean,
|
|
25
|
-
> = WithCustomEndpoint extends true
|
|
26
|
-
? WithApiKey extends true
|
|
27
|
-
?
|
|
28
|
-
| {
|
|
29
|
-
endpoint: string;
|
|
30
|
-
authMode: 'apiKey';
|
|
31
|
-
apiKey: string;
|
|
32
|
-
authToken?: string;
|
|
33
|
-
headers?: CustomHeaders;
|
|
34
|
-
}
|
|
35
|
-
| {
|
|
36
|
-
endpoint: string;
|
|
37
|
-
apiKey: string;
|
|
38
|
-
authMode: Exclude<GraphQLAuthMode, 'apiKey'>;
|
|
39
|
-
authToken?: string;
|
|
40
|
-
headers?: CustomHeaders;
|
|
41
|
-
}
|
|
42
|
-
: {
|
|
43
|
-
endpoint: string;
|
|
44
|
-
authMode: Exclude<GraphQLAuthMode, 'apiKey'>;
|
|
45
|
-
apiKey?: never;
|
|
46
|
-
authToken?: string;
|
|
47
|
-
headers?: CustomHeaders;
|
|
48
|
-
}
|
|
49
|
-
: {
|
|
19
|
+
export type CommonPublicClientOptions =
|
|
20
|
+
| {
|
|
50
21
|
endpoint?: never;
|
|
51
22
|
authMode?: GraphQLAuthMode;
|
|
52
23
|
authToken?: string;
|
|
24
|
+
apiKey?: string;
|
|
53
25
|
headers?: CustomHeaders;
|
|
54
|
-
|
|
26
|
+
}
|
|
27
|
+
| {
|
|
28
|
+
endpoint: string;
|
|
29
|
+
authMode: 'apiKey';
|
|
30
|
+
apiKey: string;
|
|
31
|
+
authToken?: string;
|
|
32
|
+
headers?: CustomHeaders;
|
|
33
|
+
}
|
|
34
|
+
| {
|
|
35
|
+
endpoint: string;
|
|
36
|
+
authMode: Exclude<GraphQLAuthMode, 'apiKey'>;
|
|
37
|
+
apiKey?: string;
|
|
38
|
+
authToken?: string;
|
|
39
|
+
headers?: CustomHeaders;
|
|
40
|
+
};
|
package/src/internals/v6.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { CustomHeaders } from '@aws-amplify/data-schema/runtime';
|
|
|
4
4
|
|
|
5
5
|
import { GraphQLAPI } from '../GraphQLAPI';
|
|
6
6
|
import {
|
|
7
|
+
CommonPublicClientOptions,
|
|
7
8
|
GraphQLOptionsV6,
|
|
8
9
|
GraphQLResponseV6,
|
|
9
10
|
V6Client,
|
|
@@ -97,9 +98,10 @@ import {
|
|
|
97
98
|
export function graphql<
|
|
98
99
|
FALLBACK_TYPES = unknown,
|
|
99
100
|
TYPED_GQL_STRING extends string = string,
|
|
101
|
+
Options extends CommonPublicClientOptions = object,
|
|
100
102
|
>(
|
|
101
103
|
this: V6Client,
|
|
102
|
-
options: GraphQLOptionsV6<FALLBACK_TYPES, TYPED_GQL_STRING>,
|
|
104
|
+
options: GraphQLOptionsV6<FALLBACK_TYPES, TYPED_GQL_STRING, Options>,
|
|
103
105
|
additionalHeaders?: CustomHeaders,
|
|
104
106
|
): GraphQLResponseV6<FALLBACK_TYPES, TYPED_GQL_STRING> {
|
|
105
107
|
// inject client-level auth
|
|
@@ -154,7 +156,7 @@ export function graphql<
|
|
|
154
156
|
{
|
|
155
157
|
...options,
|
|
156
158
|
endpoint: clientEndpoint,
|
|
157
|
-
},
|
|
159
|
+
} as any,
|
|
158
160
|
headers,
|
|
159
161
|
);
|
|
160
162
|
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
AmplifyServer,
|
|
6
6
|
getAmplifyServerContext,
|
|
7
7
|
} from '@aws-amplify/core/internals/adapter-core';
|
|
8
|
+
import { ResourcesConfig } from '@aws-amplify/core';
|
|
8
9
|
import { CustomHeaders } from '@aws-amplify/data-schema/runtime';
|
|
9
10
|
|
|
10
11
|
import { generateClientWithAmplifyInstance } from '../internals/server';
|
|
@@ -35,26 +36,17 @@ import {
|
|
|
35
36
|
*/
|
|
36
37
|
export function generateClient<
|
|
37
38
|
T extends Record<any, any> = never,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
>(
|
|
41
|
-
options: GenerateServerClientParams<WithCustomEndpoint, WithApiKey>,
|
|
42
|
-
): V6ClientSSRRequest<T, WithCustomEndpoint, WithApiKey> {
|
|
39
|
+
Options extends GenerateServerClientParams = { config: ResourcesConfig },
|
|
40
|
+
>(options: Options): V6ClientSSRRequest<T, Options> {
|
|
43
41
|
// passing `null` instance because each (future model) method must retrieve a valid instance
|
|
44
42
|
// from server context
|
|
45
|
-
const client = generateClientWithAmplifyInstance<
|
|
46
|
-
T,
|
|
47
|
-
V6ClientSSRRequest<T, any, any>
|
|
48
|
-
>({
|
|
43
|
+
const client = generateClientWithAmplifyInstance<T, V6ClientSSRRequest<T>>({
|
|
49
44
|
amplify: null,
|
|
50
45
|
...options,
|
|
51
46
|
});
|
|
52
47
|
|
|
53
48
|
// TODO: improve this and the next type
|
|
54
|
-
const prevGraphql = client.graphql as unknown as GraphQLMethod<
|
|
55
|
-
WithCustomEndpoint,
|
|
56
|
-
WithApiKey
|
|
57
|
-
>;
|
|
49
|
+
const prevGraphql = client.graphql as unknown as GraphQLMethod<Options>;
|
|
58
50
|
|
|
59
51
|
const wrappedGraphql = (
|
|
60
52
|
contextSpec: AmplifyServer.ContextSpec,
|
|
@@ -70,10 +62,7 @@ export function generateClient<
|
|
|
70
62
|
);
|
|
71
63
|
};
|
|
72
64
|
|
|
73
|
-
client.graphql = wrappedGraphql as unknown as GraphQLMethodSSR<
|
|
74
|
-
WithCustomEndpoint,
|
|
75
|
-
WithApiKey
|
|
76
|
-
>;
|
|
65
|
+
client.graphql = wrappedGraphql as unknown as GraphQLMethodSSR<Options>;
|
|
77
66
|
|
|
78
67
|
return client;
|
|
79
68
|
}
|
package/src/types/index.ts
CHANGED
|
@@ -216,10 +216,9 @@ export type GraphQLOperation = Source | string;
|
|
|
216
216
|
export type GraphQLOptionsV6<
|
|
217
217
|
FALLBACK_TYPES = unknown,
|
|
218
218
|
TYPED_GQL_STRING extends string = string,
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
? WithApiKey extends true
|
|
219
|
+
Options extends CommonPublicClientOptions = object,
|
|
220
|
+
> = Options['endpoint'] extends string
|
|
221
|
+
? Options['apiKey'] extends string
|
|
223
222
|
? {
|
|
224
223
|
query: TYPED_GQL_STRING | DocumentNode;
|
|
225
224
|
variables?: GraphQLVariablesV6<FALLBACK_TYPES, TYPED_GQL_STRING>;
|
|
@@ -447,58 +446,45 @@ export type ClientWithModels =
|
|
|
447
446
|
|
|
448
447
|
export type V6Client<
|
|
449
448
|
T extends Record<any, any> = never,
|
|
450
|
-
|
|
451
|
-
WithApiKey extends boolean = false,
|
|
449
|
+
Options extends CommonPublicClientOptions = object,
|
|
452
450
|
> = {
|
|
453
|
-
graphql: GraphQLMethod<
|
|
451
|
+
graphql: GraphQLMethod<Options>;
|
|
454
452
|
cancel(promise: Promise<any>, message?: string): boolean;
|
|
455
453
|
isCancelError(error: any): boolean;
|
|
456
454
|
} & ClientExtensions<T>;
|
|
457
455
|
|
|
458
456
|
export type V6ClientSSRRequest<
|
|
459
457
|
T extends Record<any, any> = never,
|
|
460
|
-
|
|
461
|
-
WithApiKey extends boolean = false,
|
|
458
|
+
Options extends CommonPublicClientOptions = object,
|
|
462
459
|
> = {
|
|
463
|
-
graphql: GraphQLMethodSSR<
|
|
460
|
+
graphql: GraphQLMethodSSR<Options>;
|
|
464
461
|
cancel(promise: Promise<any>, message?: string): boolean;
|
|
465
462
|
isCancelError(error: any): boolean;
|
|
466
463
|
} & ClientExtensionsSSRRequest<T>;
|
|
467
464
|
|
|
468
465
|
export type V6ClientSSRCookies<
|
|
469
466
|
T extends Record<any, any> = never,
|
|
470
|
-
|
|
471
|
-
WithApiKey extends boolean = false,
|
|
467
|
+
Options extends CommonPublicClientOptions = object,
|
|
472
468
|
> = {
|
|
473
|
-
graphql: GraphQLMethod<
|
|
469
|
+
graphql: GraphQLMethod<Options>;
|
|
474
470
|
cancel(promise: Promise<any>, message?: string): boolean;
|
|
475
471
|
isCancelError(error: any): boolean;
|
|
476
472
|
} & ClientExtensionsSSRCookies<T>;
|
|
477
473
|
|
|
478
|
-
export type GraphQLMethod<
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
>
|
|
482
|
-
options: GraphQLOptionsV6<
|
|
483
|
-
FALLBACK_TYPES,
|
|
484
|
-
TYPED_GQL_STRING,
|
|
485
|
-
WithCustomEndpoint,
|
|
486
|
-
WithApiKey
|
|
487
|
-
>,
|
|
474
|
+
export type GraphQLMethod<Options extends CommonPublicClientOptions> = <
|
|
475
|
+
FALLBACK_TYPES = unknown,
|
|
476
|
+
TYPED_GQL_STRING extends string = string,
|
|
477
|
+
>(
|
|
478
|
+
options: GraphQLOptionsV6<FALLBACK_TYPES, TYPED_GQL_STRING, Options>,
|
|
488
479
|
additionalHeaders?: CustomHeaders | undefined,
|
|
489
480
|
) => GraphQLResponseV6<FALLBACK_TYPES, TYPED_GQL_STRING>;
|
|
490
481
|
|
|
491
|
-
export type GraphQLMethodSSR<
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
>
|
|
482
|
+
export type GraphQLMethodSSR<Options extends CommonPublicClientOptions> = <
|
|
483
|
+
FALLBACK_TYPES = unknown,
|
|
484
|
+
TYPED_GQL_STRING extends string = string,
|
|
485
|
+
>(
|
|
495
486
|
contextSpec: AmplifyServer.ContextSpec,
|
|
496
|
-
options: GraphQLOptionsV6<
|
|
497
|
-
FALLBACK_TYPES,
|
|
498
|
-
TYPED_GQL_STRING,
|
|
499
|
-
WithCustomEndpoint,
|
|
500
|
-
WithApiKey
|
|
501
|
-
>,
|
|
487
|
+
options: GraphQLOptionsV6<FALLBACK_TYPES, TYPED_GQL_STRING, Options>,
|
|
502
488
|
additionalHeaders?: CustomHeaders | undefined,
|
|
503
489
|
) => GraphQLResponseV6<FALLBACK_TYPES, TYPED_GQL_STRING>;
|
|
504
490
|
|
|
@@ -530,9 +516,6 @@ export interface AuthModeParams extends Record<string, unknown> {
|
|
|
530
516
|
authToken?: string;
|
|
531
517
|
}
|
|
532
518
|
|
|
533
|
-
export type GenerateServerClientParams
|
|
534
|
-
WithCustomEndpoint extends boolean,
|
|
535
|
-
WithApiKey extends boolean,
|
|
536
|
-
> = {
|
|
519
|
+
export type GenerateServerClientParams = {
|
|
537
520
|
config: ResourcesConfig;
|
|
538
|
-
} & CommonPublicClientOptions
|
|
521
|
+
} & CommonPublicClientOptions;
|