Skip to content

Commit

Permalink
update real time provider; update exports util; update internal graph…
Browse files Browse the repository at this point in the history
…ql api
  • Loading branch information
david-mcafee committed Sep 13, 2023
1 parent 69607e2 commit e25e2f9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,7 @@ export class AWSAppSyncRealTimeProvider {
Record<string, unknown> | undefined
> {
const headerHandler: {
[key: string]: (AWSAppSyncRealTimeAuthInput) => {};
[key: string]: (arg0: AWSAppSyncRealTimeAuthInput) => {};
} = {
apiKey: this._awsRealTimeApiKeyHeader.bind(this),
iam: this._awsRealTimeIAMHeader.bind(this),
Expand Down
18 changes: 8 additions & 10 deletions packages/api-graphql/src/internals/InternalGraphQLAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -506,19 +506,17 @@ export class InternalGraphQLAPIClass {
additionalHeaders = {},
customUserAgentDetails?: CustomUserAgentDetails
): Observable<any> {
const { AppSync } = Amplify.getConfig().API ?? {};
if (!this.appSyncRealTime) {
const { AppSync } = Amplify.getConfig().API ?? {};

this.appSyncRealTime = new AWSAppSyncRealTimeProvider();

return this.appSyncRealTime.subscribe({
query: print(query as DocumentNode),
variables,
appSyncGraphqlEndpoint: AppSync.endpoint,
region: AppSync.region,
authenticationType: AppSync.defaultAuthMode,
});
}
return this.appSyncRealTime.subscribe({
query: print(query as DocumentNode),
variables,
appSyncGraphqlEndpoint: AppSync.endpoint,
region: AppSync.region,
authenticationType: AppSync.defaultAuthMode,
});
}
// if (InternalPubSub && typeof InternalPubSub.subscribe === 'function') {
// return InternalPubSub.subscribe(
Expand Down
6 changes: 5 additions & 1 deletion packages/core/src/parseAWSExports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ export const parseAWSExports = (
amplifyConfig.API = {
AppSync: {
apiKey: aws_appsync_apiKey,
defaultAuthMode: aws_appsync_authenticationType,
// defaultAuthMode: aws_appsync_authenticationType,
defaultAuthMode: {
type: aws_appsync_authenticationType,
apiKey: aws_appsync_apiKey,
},
endpoint: aws_appsync_graphqlEndpoint,
region: aws_appsync_region,
},
Expand Down

0 comments on commit e25e2f9

Please sign in to comment.