@aws-amplify/api-graphql 4.6.7-graphql-multi-client.27123f5.0 → 4.6.7-unstable.29b6c3f.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.
Files changed (41) hide show
  1. package/dist/cjs/internals/InternalGraphQLAPI.js +15 -23
  2. package/dist/cjs/internals/InternalGraphQLAPI.js.map +1 -1
  3. package/dist/cjs/internals/generateClient.js +16 -28
  4. package/dist/cjs/internals/generateClient.js.map +1 -1
  5. package/dist/cjs/internals/server/generateClientWithAmplifyInstance.js +1 -11
  6. package/dist/cjs/internals/server/generateClientWithAmplifyInstance.js.map +1 -1
  7. package/dist/cjs/internals/v6.js +2 -32
  8. package/dist/cjs/internals/v6.js.map +1 -1
  9. package/dist/cjs/server/generateClient.js +6 -4
  10. package/dist/cjs/server/generateClient.js.map +1 -1
  11. package/dist/cjs/types/index.js +1 -5
  12. package/dist/cjs/types/index.js.map +1 -1
  13. package/dist/esm/index.mjs +1 -1
  14. package/dist/esm/internals/InternalGraphQLAPI.d.ts +1 -1
  15. package/dist/esm/internals/InternalGraphQLAPI.mjs +15 -23
  16. package/dist/esm/internals/InternalGraphQLAPI.mjs.map +1 -1
  17. package/dist/esm/internals/generateClient.d.ts +1 -1
  18. package/dist/esm/internals/generateClient.mjs +17 -29
  19. package/dist/esm/internals/generateClient.mjs.map +1 -1
  20. package/dist/esm/internals/index.d.ts +0 -1
  21. package/dist/esm/internals/server/generateClientWithAmplifyInstance.mjs +3 -25
  22. package/dist/esm/internals/server/generateClientWithAmplifyInstance.mjs.map +1 -1
  23. package/dist/esm/internals/types.d.ts +3 -18
  24. package/dist/esm/internals/v6.d.ts +2 -2
  25. package/dist/esm/internals/v6.mjs +2 -32
  26. package/dist/esm/internals/v6.mjs.map +1 -1
  27. package/dist/esm/server/generateClient.d.ts +1 -4
  28. package/dist/esm/server/generateClient.mjs +6 -4
  29. package/dist/esm/server/generateClient.mjs.map +1 -1
  30. package/dist/esm/types/index.d.ts +15 -59
  31. package/dist/esm/types/index.mjs +1 -5
  32. package/dist/esm/types/index.mjs.map +1 -1
  33. package/package.json +4 -4
  34. package/src/internals/InternalGraphQLAPI.ts +15 -46
  35. package/src/internals/generateClient.ts +19 -39
  36. package/src/internals/index.ts +0 -1
  37. package/src/internals/server/generateClientWithAmplifyInstance.ts +1 -18
  38. package/src/internals/types.ts +4 -23
  39. package/src/internals/v6.ts +5 -43
  40. package/src/server/generateClient.ts +12 -10
  41. package/src/types/index.ts +26 -90
@@ -18,26 +18,22 @@ 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
-
23
21
  export { OperationTypeNode } from 'graphql';
24
22
 
25
23
  export { CONTROL_MSG, ConnectionState } from './PubSub';
26
24
 
27
25
  export { SelectionSet } from '@aws-amplify/data-schema/runtime';
28
26
 
29
- export type { CommonPublicClientOptions };
27
+ export { CommonPublicClientOptions } from '../internals/types';
30
28
 
31
29
  /**
32
30
  * Loose/Unknown options for raw GraphQLAPICategory `graphql()`.
33
31
  */
34
32
  export interface GraphQLOptions {
35
33
  query: string | DocumentNode;
36
- endpoint?: string;
37
34
  variables?: Record<string, DocumentType>;
38
35
  authMode?: GraphQLAuthMode;
39
36
  authToken?: string;
40
- apiKey?: string;
41
37
  /**
42
38
  * @deprecated This property should not be used
43
39
  */
@@ -213,68 +209,19 @@ export type GraphQLOperation = Source | string;
213
209
  * API V6 `graphql({options})` type that can leverage branded graphql `query`
214
210
  * objects and fallback types.
215
211
  */
216
- export type GraphQLOptionsV6<
212
+ export interface GraphQLOptionsV6<
217
213
  FALLBACK_TYPES = unknown,
218
214
  TYPED_GQL_STRING extends string = string,
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
- };
215
+ > extends Record<string, unknown> {
216
+ query: TYPED_GQL_STRING | DocumentNode;
217
+ variables?: GraphQLVariablesV6<FALLBACK_TYPES, TYPED_GQL_STRING>;
218
+ authMode?: GraphQLAuthMode;
219
+ authToken?: string;
220
+ /**
221
+ * @deprecated This property should not be used
222
+ */
223
+ userAgentSuffix?: string;
224
+ }
278
225
 
279
226
  /**
280
227
  * Result type for `graphql()` operations that don't include any specific
@@ -422,19 +369,15 @@ export type GeneratedSubscription<InputType, OutputType> = string & {
422
369
  export const __amplify = Symbol('amplify');
423
370
  export const __authMode = Symbol('authMode');
424
371
  export const __authToken = Symbol('authToken');
425
- export const __apiKey = Symbol('apiKey');
426
372
  export const __headers = Symbol('headers');
427
- export const __endpoint = Symbol('endpoint');
428
373
 
429
374
  export function getInternals(client: BaseClient): ClientInternals {
430
375
  const c = client as any;
431
376
 
432
377
  return {
433
378
  amplify: c[__amplify],
434
- apiKey: c[__apiKey],
435
379
  authMode: c[__authMode],
436
380
  authToken: c[__authToken],
437
- endpoint: c[__endpoint],
438
381
  headers: c[__headers],
439
382
  } as any;
440
383
  }
@@ -444,47 +387,38 @@ export type ClientWithModels =
444
387
  | V6ClientSSRRequest
445
388
  | V6ClientSSRCookies;
446
389
 
447
- export type V6Client<
448
- T extends Record<any, any> = never,
449
- Options extends CommonPublicClientOptions = object,
450
- > = {
451
- graphql: GraphQLMethod<Options>;
390
+ export type V6Client<T extends Record<any, any> = never> = {
391
+ graphql: GraphQLMethod;
452
392
  cancel(promise: Promise<any>, message?: string): boolean;
453
393
  isCancelError(error: any): boolean;
454
394
  } & ClientExtensions<T>;
455
395
 
456
- export type V6ClientSSRRequest<
457
- T extends Record<any, any> = never,
458
- Options extends CommonPublicClientOptions = object,
459
- > = {
460
- graphql: GraphQLMethodSSR<Options>;
396
+ export type V6ClientSSRRequest<T extends Record<any, any> = never> = {
397
+ graphql: GraphQLMethodSSR;
461
398
  cancel(promise: Promise<any>, message?: string): boolean;
462
399
  isCancelError(error: any): boolean;
463
400
  } & ClientExtensionsSSRRequest<T>;
464
401
 
465
- export type V6ClientSSRCookies<
466
- T extends Record<any, any> = never,
467
- Options extends CommonPublicClientOptions = object,
468
- > = {
469
- graphql: GraphQLMethod<Options>;
402
+ export type V6ClientSSRCookies<T extends Record<any, any> = never> = {
403
+ graphql: GraphQLMethod;
470
404
  cancel(promise: Promise<any>, message?: string): boolean;
471
405
  isCancelError(error: any): boolean;
472
406
  } & ClientExtensionsSSRCookies<T>;
473
407
 
474
- export type GraphQLMethod<Options extends CommonPublicClientOptions> = <
408
+ export type GraphQLMethod = <
475
409
  FALLBACK_TYPES = unknown,
476
410
  TYPED_GQL_STRING extends string = string,
477
411
  >(
478
- options: GraphQLOptionsV6<FALLBACK_TYPES, TYPED_GQL_STRING, Options>,
412
+ options: GraphQLOptionsV6<FALLBACK_TYPES, TYPED_GQL_STRING>,
479
413
  additionalHeaders?: CustomHeaders | undefined,
480
414
  ) => GraphQLResponseV6<FALLBACK_TYPES, TYPED_GQL_STRING>;
481
415
 
482
- export type GraphQLMethodSSR<Options extends CommonPublicClientOptions> = <
416
+ export type GraphQLMethodSSR = <
483
417
  FALLBACK_TYPES = unknown,
484
418
  TYPED_GQL_STRING extends string = string,
485
419
  >(
486
420
  contextSpec: AmplifyServer.ContextSpec,
487
- options: GraphQLOptionsV6<FALLBACK_TYPES, TYPED_GQL_STRING, Options>,
421
+ options: GraphQLOptionsV6<FALLBACK_TYPES, TYPED_GQL_STRING>,
488
422
  additionalHeaders?: CustomHeaders | undefined,
489
423
  ) => GraphQLResponseV6<FALLBACK_TYPES, TYPED_GQL_STRING>;
490
424
 
@@ -516,6 +450,8 @@ export interface AuthModeParams extends Record<string, unknown> {
516
450
  authToken?: string;
517
451
  }
518
452
 
519
- export type GenerateServerClientParams = {
453
+ export interface GenerateServerClientParams {
520
454
  config: ResourcesConfig;
521
- } & CommonPublicClientOptions;
455
+ authMode?: GraphQLAuthMode;
456
+ authToken?: string;
457
+ }