@aws-amplify/api-graphql 4.4.1-events.619318.0 → 4.4.1

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 (98) hide show
  1. package/dist/cjs/Providers/AWSAppSyncRealTimeProvider/index.js +732 -35
  2. package/dist/cjs/Providers/AWSAppSyncRealTimeProvider/index.js.map +1 -1
  3. package/dist/cjs/Providers/constants.js +2 -32
  4. package/dist/cjs/Providers/constants.js.map +1 -1
  5. package/dist/cjs/index.js +1 -4
  6. package/dist/cjs/index.js.map +1 -1
  7. package/dist/cjs/internals/InternalGraphQLAPI.js +67 -8
  8. package/dist/cjs/internals/InternalGraphQLAPI.js.map +1 -1
  9. package/dist/cjs/utils/ReconnectionMonitor.js +1 -1
  10. package/dist/cjs/utils/ReconnectionMonitor.js.map +1 -1
  11. package/dist/cjs/utils/resolveConfig.js +0 -19
  12. package/dist/cjs/utils/resolveConfig.js.map +1 -1
  13. package/dist/esm/Providers/AWSAppSyncRealTimeProvider/index.d.ts +71 -24
  14. package/dist/esm/Providers/AWSAppSyncRealTimeProvider/index.mjs +732 -35
  15. package/dist/esm/Providers/AWSAppSyncRealTimeProvider/index.mjs.map +1 -1
  16. package/dist/esm/Providers/constants.d.ts +3 -33
  17. package/dist/esm/Providers/constants.mjs +2 -32
  18. package/dist/esm/Providers/constants.mjs.map +1 -1
  19. package/dist/esm/index.d.ts +0 -3
  20. package/dist/esm/index.mjs +0 -2
  21. package/dist/esm/index.mjs.map +1 -1
  22. package/dist/esm/internals/InternalGraphQLAPI.d.ts +1 -0
  23. package/dist/esm/internals/InternalGraphQLAPI.mjs +68 -9
  24. package/dist/esm/internals/InternalGraphQLAPI.mjs.map +1 -1
  25. package/dist/esm/utils/ConnectionStateMonitor.d.ts +1 -29
  26. package/dist/esm/utils/ReconnectionMonitor.d.ts +1 -1
  27. package/dist/esm/utils/ReconnectionMonitor.mjs +1 -1
  28. package/dist/esm/utils/ReconnectionMonitor.mjs.map +1 -1
  29. package/dist/esm/utils/resolveConfig.mjs +0 -19
  30. package/dist/esm/utils/resolveConfig.mjs.map +1 -1
  31. package/package.json +4 -4
  32. package/src/Providers/AWSAppSyncRealTimeProvider/index.ts +1051 -58
  33. package/src/Providers/constants.ts +2 -32
  34. package/src/index.ts +0 -5
  35. package/src/internals/InternalGraphQLAPI.ts +102 -15
  36. package/src/utils/ConnectionStateMonitor.ts +13 -2
  37. package/src/utils/ReconnectionMonitor.ts +1 -1
  38. package/src/utils/resolveConfig.ts +0 -23
  39. package/dist/cjs/Providers/AWSAppSyncEventsProvider/index.js +0 -94
  40. package/dist/cjs/Providers/AWSAppSyncEventsProvider/index.js.map +0 -1
  41. package/dist/cjs/Providers/AWSWebSocketProvider/appsyncUrl.js +0 -112
  42. package/dist/cjs/Providers/AWSWebSocketProvider/appsyncUrl.js.map +0 -1
  43. package/dist/cjs/Providers/AWSWebSocketProvider/authHeaders.js +0 -99
  44. package/dist/cjs/Providers/AWSWebSocketProvider/authHeaders.js.map +0 -1
  45. package/dist/cjs/Providers/AWSWebSocketProvider/index.js +0 -623
  46. package/dist/cjs/Providers/AWSWebSocketProvider/index.js.map +0 -1
  47. package/dist/cjs/internals/events/appsyncRequest.js +0 -97
  48. package/dist/cjs/internals/events/appsyncRequest.js.map +0 -1
  49. package/dist/cjs/internals/events/index.js +0 -73
  50. package/dist/cjs/internals/events/index.js.map +0 -1
  51. package/dist/cjs/internals/events/types.js +0 -6
  52. package/dist/cjs/internals/events/types.js.map +0 -1
  53. package/dist/cjs/internals/events/utils.js +0 -57
  54. package/dist/cjs/internals/events/utils.js.map +0 -1
  55. package/dist/cjs/internals/graphqlAuth.js +0 -64
  56. package/dist/cjs/internals/graphqlAuth.js.map +0 -1
  57. package/dist/cjs/internals/graphqlRequest.js +0 -20
  58. package/dist/cjs/internals/graphqlRequest.js.map +0 -1
  59. package/dist/esm/Providers/AWSAppSyncEventsProvider/index.d.ts +0 -42
  60. package/dist/esm/Providers/AWSAppSyncEventsProvider/index.mjs +0 -93
  61. package/dist/esm/Providers/AWSAppSyncEventsProvider/index.mjs.map +0 -1
  62. package/dist/esm/Providers/AWSWebSocketProvider/appsyncUrl.d.ts +0 -21
  63. package/dist/esm/Providers/AWSWebSocketProvider/appsyncUrl.mjs +0 -106
  64. package/dist/esm/Providers/AWSWebSocketProvider/appsyncUrl.mjs.map +0 -1
  65. package/dist/esm/Providers/AWSWebSocketProvider/authHeaders.d.ts +0 -8
  66. package/dist/esm/Providers/AWSWebSocketProvider/authHeaders.mjs +0 -97
  67. package/dist/esm/Providers/AWSWebSocketProvider/authHeaders.mjs.map +0 -1
  68. package/dist/esm/Providers/AWSWebSocketProvider/index.d.ts +0 -83
  69. package/dist/esm/Providers/AWSWebSocketProvider/index.mjs +0 -621
  70. package/dist/esm/Providers/AWSWebSocketProvider/index.mjs.map +0 -1
  71. package/dist/esm/internals/events/appsyncRequest.d.ts +0 -14
  72. package/dist/esm/internals/events/appsyncRequest.mjs +0 -96
  73. package/dist/esm/internals/events/appsyncRequest.mjs.map +0 -1
  74. package/dist/esm/internals/events/index.d.ts +0 -17
  75. package/dist/esm/internals/events/index.mjs +0 -69
  76. package/dist/esm/internals/events/index.mjs.map +0 -1
  77. package/dist/esm/internals/events/types.d.ts +0 -23
  78. package/dist/esm/internals/events/types.mjs +0 -2
  79. package/dist/esm/internals/events/types.mjs.map +0 -1
  80. package/dist/esm/internals/events/utils.d.ts +0 -16
  81. package/dist/esm/internals/events/utils.mjs +0 -53
  82. package/dist/esm/internals/events/utils.mjs.map +0 -1
  83. package/dist/esm/internals/graphqlAuth.d.ts +0 -3
  84. package/dist/esm/internals/graphqlAuth.mjs +0 -64
  85. package/dist/esm/internals/graphqlAuth.mjs.map +0 -1
  86. package/dist/esm/internals/graphqlRequest.d.ts +0 -3
  87. package/dist/esm/internals/graphqlRequest.mjs +0 -18
  88. package/dist/esm/internals/graphqlRequest.mjs.map +0 -1
  89. package/src/Providers/AWSAppSyncEventsProvider/index.ts +0 -187
  90. package/src/Providers/AWSWebSocketProvider/appsyncUrl.ts +0 -151
  91. package/src/Providers/AWSWebSocketProvider/authHeaders.ts +0 -146
  92. package/src/Providers/AWSWebSocketProvider/index.ts +0 -925
  93. package/src/internals/events/appsyncRequest.ts +0 -169
  94. package/src/internals/events/index.ts +0 -138
  95. package/src/internals/events/types.ts +0 -35
  96. package/src/internals/events/utils.ts +0 -77
  97. package/src/internals/graphqlAuth.ts +0 -87
  98. package/src/internals/graphqlRequest.ts +0 -30
@@ -1,169 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
- import { AmplifyClassV6 } from '@aws-amplify/core';
4
- import {
5
- AmplifyUrl,
6
- CustomUserAgentDetails,
7
- GraphQLAuthMode,
8
- getAmplifyUserAgent,
9
- } from '@aws-amplify/core/internals/utils';
10
- import { post } from '@aws-amplify/api-rest/internals';
11
- import {
12
- CustomHeaders,
13
- RequestOptions,
14
- } from '@aws-amplify/data-schema/runtime';
15
-
16
- import { resolveLibraryOptions } from '../../utils';
17
- import { repackageUnauthorizedError } from '../../utils/errors/repackageAuthError';
18
- import { headerBasedAuth } from '../graphqlAuth';
19
- import { isGraphQLResponseWithErrors } from '../utils/runtimeTypeGuards/isGraphQLResponseWithErrors';
20
-
21
- const USER_AGENT_HEADER = 'x-amz-user-agent';
22
-
23
- interface GqlRequestOptions {
24
- apiKey?: string;
25
- region?: string;
26
- appSyncGraphqlEndpoint: string;
27
- authenticationType: GraphQLAuthMode;
28
- query: string;
29
- variables: string[];
30
- authToken?: string;
31
- }
32
-
33
- // This is effectively a copy of InternalGraphQLAPI.ts._graphql(...)
34
- // Our existing unit tests are tightly coupled to the implementation, so i was unable to refactor
35
- // and extend _graphql() without having to change a bunch of tests as well... which in turn reduces confidence
36
- // that this feature will _not affect_ GQL behavior.
37
- export async function appsyncRequest<T = any>(
38
- amplify: AmplifyClassV6,
39
- options: GqlRequestOptions,
40
- additionalHeaders: CustomHeaders = {},
41
- abortController: AbortController,
42
- customUserAgentDetails?: CustomUserAgentDetails,
43
- ): Promise<T> {
44
- const {
45
- region,
46
- appSyncGraphqlEndpoint: endpoint,
47
- authenticationType: authMode,
48
- query,
49
- variables,
50
- } = options;
51
-
52
- if (!endpoint) {
53
- throw new Error('No endpoint');
54
- }
55
-
56
- const { withCredentials } = resolveLibraryOptions(amplify);
57
-
58
- const headers = await requestHeaders(
59
- amplify,
60
- options,
61
- additionalHeaders,
62
- customUserAgentDetails,
63
- );
64
-
65
- const body = {
66
- channel: query as string,
67
- events: variables,
68
- };
69
-
70
- const signingServiceInfo = ['apiKey', 'none'].includes(authMode)
71
- ? undefined
72
- : {
73
- service: 'appsync',
74
- region,
75
- };
76
-
77
- const { body: responseBody } = await post(amplify, {
78
- url: new AmplifyUrl(endpoint),
79
- options: {
80
- headers,
81
- body,
82
- signingServiceInfo,
83
- withCredentials,
84
- },
85
- abortController,
86
- });
87
-
88
- const response = await responseBody.json();
89
-
90
- if (isGraphQLResponseWithErrors(response)) {
91
- throw repackageUnauthorizedError(response);
92
- }
93
-
94
- return response as T;
95
- }
96
-
97
- /**
98
- * Computes all the necessary HTTP headers for the request based on:
99
- * 1. Operation-level header options
100
- * 2. Amplify.configure custom headers
101
- * 3. AuthZ headers for explicit auth mode specified for operation ?? default auth mode in config
102
- *
103
- * @returns HTTP request headers key/value
104
- */
105
- async function requestHeaders(
106
- amplify: AmplifyClassV6,
107
- options: GqlRequestOptions,
108
- additionalHeaders: CustomHeaders,
109
- customUserAgentDetails?: CustomUserAgentDetails,
110
- ) {
111
- const {
112
- apiKey,
113
- appSyncGraphqlEndpoint: endpoint,
114
- authenticationType: authMode,
115
- query,
116
- variables,
117
- authToken,
118
- } = options;
119
-
120
- const { headers: customHeadersFn } = resolveLibraryOptions(amplify);
121
-
122
- let additionalCustomHeaders: Record<string, string>;
123
-
124
- if (typeof additionalHeaders === 'function') {
125
- const requestOptions: RequestOptions = {
126
- method: 'POST',
127
- url: new AmplifyUrl(endpoint).toString(),
128
- queryString: query,
129
- };
130
-
131
- additionalCustomHeaders = await additionalHeaders(requestOptions);
132
- } else {
133
- additionalCustomHeaders = additionalHeaders;
134
- }
135
-
136
- // if an authorization header is set, have the operation-level authToken take precedence
137
- if (authToken) {
138
- additionalCustomHeaders = {
139
- ...additionalCustomHeaders,
140
- Authorization: authToken,
141
- };
142
- }
143
-
144
- const authHeaders = await headerBasedAuth(
145
- amplify,
146
- authMode,
147
- apiKey,
148
- additionalCustomHeaders,
149
- );
150
-
151
- const customHeaders =
152
- customHeadersFn &&
153
- (await customHeadersFn({
154
- query,
155
- variables: variables as any,
156
- }));
157
-
158
- const headers = {
159
- ...authHeaders,
160
- // Custom headers included in Amplify configuration options:
161
- ...customHeaders,
162
- // Custom headers from individual requests or API client configuration:
163
- ...additionalCustomHeaders,
164
- // User agent headers:
165
- [USER_AGENT_HEADER]: getAmplifyUserAgent(customUserAgentDetails),
166
- };
167
-
168
- return headers;
169
- }
@@ -1,138 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- import { Subscription } from 'rxjs';
5
- import { Amplify } from '@aws-amplify/core';
6
- import { DocumentType } from '@aws-amplify/core/internals/utils';
7
-
8
- import { AppSyncEventProvider as eventProvider } from '../../Providers/AWSAppSyncEventsProvider';
9
-
10
- import { appsyncRequest } from './appsyncRequest';
11
- import { configure, normalizeAuth, serializeEvents } from './utils';
12
- import type {
13
- EventsChannel,
14
- EventsOptions,
15
- PublishResponse,
16
- PublishedEvent,
17
- SubscriptionObserver,
18
- } from './types';
19
-
20
- /**
21
- * Establish a WebSocket connection to an Events channel
22
- *
23
- */
24
- async function connect(
25
- channelName: string,
26
- options?: EventsOptions,
27
- ): Promise<EventsChannel> {
28
- const providerOptions = configure();
29
-
30
- providerOptions.authenticationType = normalizeAuth(
31
- options?.authMode,
32
- providerOptions.authenticationType,
33
- );
34
-
35
- await eventProvider.connect(providerOptions);
36
-
37
- let _subscription: Subscription;
38
-
39
- const sub = (
40
- observer: SubscriptionObserver<any>,
41
- subOptions?: EventsOptions,
42
- ): Subscription => {
43
- const subscribeOptions = { ...providerOptions, query: channelName };
44
- subscribeOptions.authenticationType = normalizeAuth(
45
- subOptions?.authMode,
46
- subscribeOptions.authenticationType,
47
- );
48
-
49
- _subscription = eventProvider
50
- .subscribe(subscribeOptions)
51
- .subscribe(observer);
52
-
53
- return _subscription;
54
- };
55
-
56
- // WS publish is not enabled in the service yet. It will be a follow up feature
57
- const _pub = async (
58
- event: DocumentType,
59
- pubOptions?: EventsOptions,
60
- ): Promise<any> => {
61
- const publishOptions = {
62
- ...providerOptions,
63
- query: channelName,
64
- variables: event,
65
- };
66
- publishOptions.authenticationType = normalizeAuth(
67
- pubOptions?.authMode,
68
- publishOptions.authenticationType,
69
- );
70
-
71
- return eventProvider.publish(publishOptions);
72
- };
73
-
74
- const close = () => {
75
- _subscription && _subscription.unsubscribe();
76
- };
77
-
78
- return {
79
- /**
80
- * Subscribe to incoming events
81
- */
82
- subscribe: sub,
83
- /**
84
- * Close channel and any active subscriptions
85
- */
86
- close,
87
- // publish: pub,
88
- };
89
- }
90
-
91
- /**
92
- * Publish events to a channel via REST request
93
- *
94
- * @param channelName - publish destination
95
- * @param event - JSON-serializable value or an array of values
96
- * @param options
97
- */
98
- async function post(
99
- channelName: string,
100
- event: DocumentType | DocumentType[],
101
- options?: EventsOptions,
102
- ): Promise<void | PublishedEvent[]> {
103
- const providerOptions = configure();
104
- providerOptions.authenticationType = normalizeAuth(
105
- options?.authMode,
106
- providerOptions.authenticationType,
107
- );
108
-
109
- // trailing slash required in publish
110
- const normalizedChannelName =
111
- channelName[0] === '/' ? channelName : `/${channelName}`;
112
-
113
- const publishOptions = {
114
- ...providerOptions,
115
- query: normalizedChannelName,
116
- variables: serializeEvents(event),
117
- authToken: options?.authToken,
118
- };
119
-
120
- const abortController = new AbortController();
121
-
122
- const res = await appsyncRequest<PublishResponse>(
123
- Amplify,
124
- publishOptions,
125
- {},
126
- abortController,
127
- );
128
-
129
- if (res.failed?.length > 0) {
130
- return res.failed;
131
- }
132
- }
133
-
134
- function closeAll(): void {
135
- eventProvider.close();
136
- }
137
-
138
- export { connect, post, closeAll };
@@ -1,35 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- import { Subscription } from 'rxjs';
5
- import type { GraphQLAuthMode } from '@aws-amplify/core/internals/utils';
6
-
7
- export interface SubscriptionObserver<T> {
8
- next(value: T): void;
9
- error(errorValue: any): void;
10
- }
11
-
12
- export interface EventsChannel {
13
- subscribe(
14
- observer: SubscriptionObserver<any>,
15
- subOptions?: EventsOptions,
16
- ): Subscription;
17
- close(): void;
18
- }
19
-
20
- export type ResolvedGraphQLAuthModes = Exclude<GraphQLAuthMode, 'identityPool'>;
21
-
22
- export interface EventsOptions {
23
- authMode?: GraphQLAuthMode;
24
- authToken?: string;
25
- }
26
-
27
- export interface PublishedEvent {
28
- identifier: string;
29
- index: number;
30
- }
31
-
32
- export interface PublishResponse {
33
- failed: PublishedEvent[];
34
- successful: PublishedEvent[];
35
- }
@@ -1,77 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
- import { Amplify } from '@aws-amplify/core';
4
- import {
5
- DocumentType,
6
- GraphQLAuthMode,
7
- } from '@aws-amplify/core/internals/utils';
8
-
9
- import type { ResolvedGraphQLAuthModes } from './types';
10
-
11
- export const normalizeAuth = (
12
- explicitAuthMode: GraphQLAuthMode | undefined,
13
- defaultAuthMode: ResolvedGraphQLAuthModes,
14
- ): ResolvedGraphQLAuthModes => {
15
- if (!explicitAuthMode) {
16
- return defaultAuthMode;
17
- }
18
-
19
- if (explicitAuthMode === 'identityPool') {
20
- return 'iam';
21
- }
22
-
23
- return explicitAuthMode;
24
- };
25
-
26
- export const configure = () => {
27
- const config = Amplify.getConfig();
28
-
29
- const eventsConfig = config.API?.Events;
30
-
31
- if (!eventsConfig) {
32
- throw new Error(
33
- 'Amplify configuration is missing. Have you called Amplify.configure()?',
34
- );
35
- }
36
-
37
- const configAuthMode = normalizeAuth(eventsConfig.defaultAuthMode, 'apiKey');
38
-
39
- const options = {
40
- appSyncGraphqlEndpoint: eventsConfig.endpoint,
41
- region: eventsConfig.region,
42
- authenticationType: configAuthMode,
43
- apiKey: eventsConfig.apiKey,
44
- };
45
-
46
- return options;
47
- };
48
-
49
- /**
50
- * Event API expects and array of JSON strings
51
- *
52
- * @param events - JSON-serializable value or an array of values
53
- * @returns array of JSON strings
54
- */
55
- export const serializeEvents = (
56
- events: DocumentType | DocumentType[],
57
- ): string[] => {
58
- if (Array.isArray(events)) {
59
- return events.map((ev, idx) => {
60
- const eventJson = JSON.stringify(ev);
61
- if (eventJson === undefined) {
62
- throw new Error(
63
- `Event must be a valid JSON value. Received ${ev} at index ${idx}`,
64
- );
65
- }
66
-
67
- return eventJson;
68
- });
69
- }
70
-
71
- const eventJson = JSON.stringify(events);
72
- if (eventJson === undefined) {
73
- throw new Error(`Event must be a valid JSON value. Received ${events}`);
74
- }
75
-
76
- return [eventJson];
77
- };
@@ -1,87 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- import { GraphQLAuthMode } from '@aws-amplify/core/internals/utils';
5
- import { AmplifyClassV6 } from '@aws-amplify/core';
6
-
7
- import { GraphQLApiError } from '../utils/errors';
8
- import {
9
- NO_API_KEY,
10
- NO_AUTH_TOKEN_HEADER,
11
- NO_SIGNED_IN_USER,
12
- NO_VALID_AUTH_TOKEN,
13
- NO_VALID_CREDENTIALS,
14
- } from '../utils/errors/constants';
15
-
16
- export async function headerBasedAuth(
17
- amplify: AmplifyClassV6,
18
- authMode: GraphQLAuthMode,
19
- apiKey: string | undefined,
20
- additionalHeaders: Record<string, string> = {},
21
- ) {
22
- let headers = {};
23
-
24
- switch (authMode) {
25
- case 'apiKey':
26
- if (!apiKey) {
27
- throw new GraphQLApiError(NO_API_KEY);
28
- }
29
- headers = {
30
- 'X-Api-Key': apiKey,
31
- };
32
- break;
33
- case 'iam': {
34
- const session = await amplify.Auth.fetchAuthSession();
35
- if (session.credentials === undefined) {
36
- throw new GraphQLApiError(NO_VALID_CREDENTIALS);
37
- }
38
- break;
39
- }
40
- case 'oidc':
41
- case 'userPool': {
42
- let token: string | undefined;
43
-
44
- try {
45
- token = (
46
- await amplify.Auth.fetchAuthSession()
47
- ).tokens?.accessToken.toString();
48
- } catch (e) {
49
- // fetchAuthSession failed
50
- throw new GraphQLApiError({
51
- ...NO_SIGNED_IN_USER,
52
- underlyingError: e,
53
- });
54
- }
55
-
56
- // `fetchAuthSession()` succeeded but didn't return `tokens`.
57
- // This may happen when unauthenticated access is enabled and there is
58
- // no user signed in.
59
- if (!token) {
60
- throw new GraphQLApiError(NO_VALID_AUTH_TOKEN);
61
- }
62
-
63
- headers = {
64
- Authorization: token,
65
- };
66
- break;
67
- }
68
- case 'lambda':
69
- if (
70
- typeof additionalHeaders === 'object' &&
71
- !additionalHeaders.Authorization
72
- ) {
73
- throw new GraphQLApiError(NO_AUTH_TOKEN_HEADER);
74
- }
75
-
76
- headers = {
77
- Authorization: additionalHeaders.Authorization,
78
- };
79
- break;
80
- case 'none':
81
- break;
82
- default:
83
- break;
84
- }
85
-
86
- return headers;
87
- }
@@ -1,30 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- import { AmplifyUrl } from '@aws-amplify/core/internals/utils';
5
- import { AmplifyClassV6 } from '@aws-amplify/core';
6
- import {
7
- // cancel as cancelREST,
8
- post,
9
- // updateRequestToBeCancellable,
10
- } from '@aws-amplify/api-rest/internals';
11
-
12
- export async function graphqlRequest(
13
- amplify: AmplifyClassV6,
14
- url: string,
15
- options: any,
16
- abortController: AbortController,
17
- _post?: typeof post,
18
- ) {
19
- const p = _post ?? post;
20
-
21
- const { body: responseBody } = await p(amplify, {
22
- url: new AmplifyUrl(url),
23
- options,
24
- abortController,
25
- });
26
-
27
- const response = await responseBody.json();
28
-
29
- return response;
30
- }