@aws-amplify/api-graphql 4.6.8-unstable.0f81bef.0 → 4.6.8-unstable.ca2e4b8.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/cjs/internals/InternalGraphQLAPI.js +23 -15
- package/dist/cjs/internals/InternalGraphQLAPI.js.map +1 -1
- package/dist/cjs/internals/generateClient.js +28 -16
- package/dist/cjs/internals/generateClient.js.map +1 -1
- package/dist/cjs/internals/server/generateClientWithAmplifyInstance.js +11 -1
- package/dist/cjs/internals/server/generateClientWithAmplifyInstance.js.map +1 -1
- package/dist/cjs/internals/v6.js +32 -2
- package/dist/cjs/internals/v6.js.map +1 -1
- package/dist/cjs/server/generateClient.js +4 -6
- package/dist/cjs/server/generateClient.js.map +1 -1
- package/dist/cjs/types/index.js +5 -1
- package/dist/cjs/types/index.js.map +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/internals/InternalGraphQLAPI.d.ts +1 -1
- package/dist/esm/internals/InternalGraphQLAPI.mjs +23 -15
- package/dist/esm/internals/InternalGraphQLAPI.mjs.map +1 -1
- package/dist/esm/internals/generateClient.d.ts +1 -1
- package/dist/esm/internals/generateClient.mjs +29 -17
- package/dist/esm/internals/generateClient.mjs.map +1 -1
- package/dist/esm/internals/index.d.ts +1 -0
- package/dist/esm/internals/server/generateClientWithAmplifyInstance.mjs +25 -3
- package/dist/esm/internals/server/generateClientWithAmplifyInstance.mjs.map +1 -1
- package/dist/esm/internals/types.d.ts +18 -3
- package/dist/esm/internals/v6.d.ts +2 -2
- package/dist/esm/internals/v6.mjs +32 -2
- package/dist/esm/internals/v6.mjs.map +1 -1
- package/dist/esm/server/generateClient.d.ts +4 -1
- package/dist/esm/server/generateClient.mjs +4 -6
- package/dist/esm/server/generateClient.mjs.map +1 -1
- package/dist/esm/types/index.d.ts +63 -16
- package/dist/esm/types/index.mjs +5 -1
- package/dist/esm/types/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/internals/InternalGraphQLAPI.ts +46 -15
- package/src/internals/generateClient.ts +39 -19
- package/src/internals/index.ts +1 -0
- package/src/internals/server/generateClientWithAmplifyInstance.ts +18 -1
- package/src/internals/types.ts +23 -4
- package/src/internals/v6.ts +44 -5
- package/src/server/generateClient.ts +11 -13
- package/src/types/index.ts +94 -27
package/src/types/index.ts
CHANGED
|
@@ -18,22 +18,26 @@ import {
|
|
|
18
18
|
} from '@aws-amplify/core/internals/utils';
|
|
19
19
|
import { AmplifyServer } from '@aws-amplify/core/internals/adapter-core';
|
|
20
20
|
|
|
21
|
+
import { CommonPublicClientOptions } from '../internals/types';
|
|
22
|
+
|
|
21
23
|
export { OperationTypeNode } from 'graphql';
|
|
22
24
|
|
|
23
25
|
export { CONTROL_MSG, ConnectionState } from './PubSub';
|
|
24
26
|
|
|
25
27
|
export { SelectionSet } from '@aws-amplify/data-schema/runtime';
|
|
26
28
|
|
|
27
|
-
export { CommonPublicClientOptions }
|
|
29
|
+
export type { CommonPublicClientOptions };
|
|
28
30
|
|
|
29
31
|
/**
|
|
30
32
|
* Loose/Unknown options for raw GraphQLAPICategory `graphql()`.
|
|
31
33
|
*/
|
|
32
34
|
export interface GraphQLOptions {
|
|
33
35
|
query: string | DocumentNode;
|
|
36
|
+
endpoint?: string;
|
|
34
37
|
variables?: Record<string, DocumentType>;
|
|
35
38
|
authMode?: GraphQLAuthMode;
|
|
36
39
|
authToken?: string;
|
|
40
|
+
apiKey?: string;
|
|
37
41
|
/**
|
|
38
42
|
* @deprecated This property should not be used
|
|
39
43
|
*/
|
|
@@ -209,19 +213,68 @@ export type GraphQLOperation = Source | string;
|
|
|
209
213
|
* API V6 `graphql({options})` type that can leverage branded graphql `query`
|
|
210
214
|
* objects and fallback types.
|
|
211
215
|
*/
|
|
212
|
-
export
|
|
216
|
+
export type GraphQLOptionsV6<
|
|
213
217
|
FALLBACK_TYPES = unknown,
|
|
214
218
|
TYPED_GQL_STRING extends string = string,
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
219
|
+
Options extends CommonPublicClientOptions = object,
|
|
220
|
+
> = Options['endpoint'] extends string
|
|
221
|
+
? Options['apiKey'] extends string
|
|
222
|
+
? {
|
|
223
|
+
query: TYPED_GQL_STRING | DocumentNode;
|
|
224
|
+
variables?: GraphQLVariablesV6<FALLBACK_TYPES, TYPED_GQL_STRING>;
|
|
225
|
+
authMode?: GraphQLAuthMode;
|
|
226
|
+
apiKey?: string;
|
|
227
|
+
authToken?: string;
|
|
228
|
+
/**
|
|
229
|
+
* @deprecated This property should not be used
|
|
230
|
+
*/
|
|
231
|
+
userAgentSuffix?: string;
|
|
232
|
+
}
|
|
233
|
+
:
|
|
234
|
+
| {
|
|
235
|
+
query: TYPED_GQL_STRING | DocumentNode;
|
|
236
|
+
variables?: GraphQLVariablesV6<FALLBACK_TYPES, TYPED_GQL_STRING>;
|
|
237
|
+
authMode?: never;
|
|
238
|
+
apiKey?: never;
|
|
239
|
+
authToken?: string;
|
|
240
|
+
/**
|
|
241
|
+
* @deprecated This property should not be used
|
|
242
|
+
*/
|
|
243
|
+
userAgentSuffix?: string;
|
|
244
|
+
}
|
|
245
|
+
| {
|
|
246
|
+
query: TYPED_GQL_STRING | DocumentNode;
|
|
247
|
+
variables?: GraphQLVariablesV6<FALLBACK_TYPES, TYPED_GQL_STRING>;
|
|
248
|
+
authMode: 'apiKey';
|
|
249
|
+
apiKey: string;
|
|
250
|
+
authToken?: string;
|
|
251
|
+
/**
|
|
252
|
+
* @deprecated This property should not be used
|
|
253
|
+
*/
|
|
254
|
+
userAgentSuffix?: string;
|
|
255
|
+
}
|
|
256
|
+
| {
|
|
257
|
+
query: TYPED_GQL_STRING | DocumentNode;
|
|
258
|
+
variables?: GraphQLVariablesV6<FALLBACK_TYPES, TYPED_GQL_STRING>;
|
|
259
|
+
authMode: Exclude<GraphQLAuthMode, 'apiKey'>;
|
|
260
|
+
apiKey?: never;
|
|
261
|
+
authToken?: string;
|
|
262
|
+
/**
|
|
263
|
+
* @deprecated This property should not be used
|
|
264
|
+
*/
|
|
265
|
+
userAgentSuffix?: string;
|
|
266
|
+
}
|
|
267
|
+
: {
|
|
268
|
+
query: TYPED_GQL_STRING | DocumentNode;
|
|
269
|
+
variables?: GraphQLVariablesV6<FALLBACK_TYPES, TYPED_GQL_STRING>;
|
|
270
|
+
authMode?: GraphQLAuthMode;
|
|
271
|
+
apiKey?: string;
|
|
272
|
+
authToken?: string;
|
|
273
|
+
/**
|
|
274
|
+
* @deprecated This property should not be used
|
|
275
|
+
*/
|
|
276
|
+
userAgentSuffix?: string;
|
|
277
|
+
};
|
|
225
278
|
|
|
226
279
|
/**
|
|
227
280
|
* Result type for `graphql()` operations that don't include any specific
|
|
@@ -369,15 +422,22 @@ export type GeneratedSubscription<InputType, OutputType> = string & {
|
|
|
369
422
|
export const __amplify = Symbol('amplify');
|
|
370
423
|
export const __authMode = Symbol('authMode');
|
|
371
424
|
export const __authToken = Symbol('authToken');
|
|
425
|
+
export const __apiKey = Symbol('apiKey');
|
|
372
426
|
export const __headers = Symbol('headers');
|
|
427
|
+
export const __endpoint = Symbol('endpoint');
|
|
373
428
|
|
|
374
|
-
export function getInternals(client: BaseClient): ClientInternals {
|
|
429
|
+
export function getInternals(client: BaseClient): ClientInternals & {
|
|
430
|
+
apiKey?: string;
|
|
431
|
+
endpoint?: string;
|
|
432
|
+
} {
|
|
375
433
|
const c = client as any;
|
|
376
434
|
|
|
377
435
|
return {
|
|
378
436
|
amplify: c[__amplify],
|
|
437
|
+
apiKey: c[__apiKey],
|
|
379
438
|
authMode: c[__authMode],
|
|
380
439
|
authToken: c[__authToken],
|
|
440
|
+
endpoint: c[__endpoint],
|
|
381
441
|
headers: c[__headers],
|
|
382
442
|
} as any;
|
|
383
443
|
}
|
|
@@ -387,38 +447,47 @@ export type ClientWithModels =
|
|
|
387
447
|
| V6ClientSSRRequest
|
|
388
448
|
| V6ClientSSRCookies;
|
|
389
449
|
|
|
390
|
-
export type V6Client<
|
|
391
|
-
|
|
450
|
+
export type V6Client<
|
|
451
|
+
T extends Record<any, any> = never,
|
|
452
|
+
Options extends CommonPublicClientOptions = object,
|
|
453
|
+
> = {
|
|
454
|
+
graphql: GraphQLMethod<Options>;
|
|
392
455
|
cancel(promise: Promise<any>, message?: string): boolean;
|
|
393
456
|
isCancelError(error: any): boolean;
|
|
394
457
|
} & ClientExtensions<T>;
|
|
395
458
|
|
|
396
|
-
export type V6ClientSSRRequest<
|
|
397
|
-
|
|
459
|
+
export type V6ClientSSRRequest<
|
|
460
|
+
T extends Record<any, any> = never,
|
|
461
|
+
Options extends CommonPublicClientOptions = object,
|
|
462
|
+
> = {
|
|
463
|
+
graphql: GraphQLMethodSSR<Options>;
|
|
398
464
|
cancel(promise: Promise<any>, message?: string): boolean;
|
|
399
465
|
isCancelError(error: any): boolean;
|
|
400
466
|
} & ClientExtensionsSSRRequest<T>;
|
|
401
467
|
|
|
402
|
-
export type V6ClientSSRCookies<
|
|
403
|
-
|
|
468
|
+
export type V6ClientSSRCookies<
|
|
469
|
+
T extends Record<any, any> = never,
|
|
470
|
+
Options extends CommonPublicClientOptions = object,
|
|
471
|
+
> = {
|
|
472
|
+
graphql: GraphQLMethod<Options>;
|
|
404
473
|
cancel(promise: Promise<any>, message?: string): boolean;
|
|
405
474
|
isCancelError(error: any): boolean;
|
|
406
475
|
} & ClientExtensionsSSRCookies<T>;
|
|
407
476
|
|
|
408
|
-
export type GraphQLMethod = <
|
|
477
|
+
export type GraphQLMethod<Options extends CommonPublicClientOptions> = <
|
|
409
478
|
FALLBACK_TYPES = unknown,
|
|
410
479
|
TYPED_GQL_STRING extends string = string,
|
|
411
480
|
>(
|
|
412
|
-
options: GraphQLOptionsV6<FALLBACK_TYPES, TYPED_GQL_STRING>,
|
|
481
|
+
options: GraphQLOptionsV6<FALLBACK_TYPES, TYPED_GQL_STRING, Options>,
|
|
413
482
|
additionalHeaders?: CustomHeaders | undefined,
|
|
414
483
|
) => GraphQLResponseV6<FALLBACK_TYPES, TYPED_GQL_STRING>;
|
|
415
484
|
|
|
416
|
-
export type GraphQLMethodSSR = <
|
|
485
|
+
export type GraphQLMethodSSR<Options extends CommonPublicClientOptions> = <
|
|
417
486
|
FALLBACK_TYPES = unknown,
|
|
418
487
|
TYPED_GQL_STRING extends string = string,
|
|
419
488
|
>(
|
|
420
489
|
contextSpec: AmplifyServer.ContextSpec,
|
|
421
|
-
options: GraphQLOptionsV6<FALLBACK_TYPES, TYPED_GQL_STRING>,
|
|
490
|
+
options: GraphQLOptionsV6<FALLBACK_TYPES, TYPED_GQL_STRING, Options>,
|
|
422
491
|
additionalHeaders?: CustomHeaders | undefined,
|
|
423
492
|
) => GraphQLResponseV6<FALLBACK_TYPES, TYPED_GQL_STRING>;
|
|
424
493
|
|
|
@@ -450,8 +519,6 @@ export interface AuthModeParams extends Record<string, unknown> {
|
|
|
450
519
|
authToken?: string;
|
|
451
520
|
}
|
|
452
521
|
|
|
453
|
-
export
|
|
522
|
+
export type GenerateServerClientParams = {
|
|
454
523
|
config: ResourcesConfig;
|
|
455
|
-
|
|
456
|
-
authToken?: string;
|
|
457
|
-
}
|
|
524
|
+
} & CommonPublicClientOptions;
|