@@ -17,7 +17,10 @@ type AWSAppSyncRealTimeAuthInput =
1717 host ?: string | undefined ;
1818 } ;
1919
20- const awsAuthTokenHeader = async ( ctx : AmplifyContext , { host } : AWSAppSyncRealTimeAuthInput ) => {
20+ const awsAuthTokenHeader = async (
21+ ctx : AmplifyContext ,
22+ { host } : AWSAppSyncRealTimeAuthInput ,
23+ ) => {
2124 const session = await ctx . fetchAuthSession ( ) ;
2225
2326 return {
@@ -26,10 +29,10 @@ const awsAuthTokenHeader = async (ctx: AmplifyContext, { host }: AWSAppSyncRealT
2629 } ;
2730} ;
2831
29- const awsRealTimeApiKeyHeader = async ( _ctx : AmplifyContext , {
30- apiKey ,
31- host,
32- } : AWSAppSyncRealTimeAuthInput ) => {
32+ const awsRealTimeApiKeyHeader = async (
33+ _ctx : AmplifyContext ,
34+ { apiKey , host } : AWSAppSyncRealTimeAuthInput ,
35+ ) => {
3336 const dt = new Date ( ) ;
3437 const dtStr = dt . toISOString ( ) . replace ( / [: -] | \. \d { 3 } / g, '' ) ;
3538
@@ -40,12 +43,15 @@ const awsRealTimeApiKeyHeader = async (_ctx: AmplifyContext, {
4043 } ;
4144} ;
4245
43- const awsRealTimeIAMHeader = async ( ctx : AmplifyContext , {
44- payload,
45- canonicalUri,
46- appSyncGraphqlEndpoint,
47- region,
48- } : AWSAppSyncRealTimeAuthInput ) => {
46+ const awsRealTimeIAMHeader = async (
47+ ctx : AmplifyContext ,
48+ {
49+ payload,
50+ canonicalUri,
51+ appSyncGraphqlEndpoint,
52+ region,
53+ } : AWSAppSyncRealTimeAuthInput ,
54+ ) => {
4955 const endpointInfo = {
5056 region,
5157 service : 'appsync' ,
@@ -77,10 +83,10 @@ const awsRealTimeIAMHeader = async (ctx: AmplifyContext, {
7783 return signedParams . headers ;
7884} ;
7985
80- const customAuthHeader = async ( _ctx : AmplifyContext , {
81- host ,
82- additionalCustomHeaders,
83- } : AWSAppSyncRealTimeAuthInput ) => {
86+ const customAuthHeader = async (
87+ _ctx : AmplifyContext ,
88+ { host , additionalCustomHeaders } : AWSAppSyncRealTimeAuthInput ,
89+ ) => {
8490 /**
8591 * If `additionalHeaders` was provided to the subscription as a function,
8692 * the headers that are returned by that function will already have been
@@ -96,17 +102,18 @@ const customAuthHeader = async (_ctx: AmplifyContext, {
96102 } ;
97103} ;
98104
99- export const awsRealTimeHeaderBasedAuth = async ( ctx : AmplifyContext , {
100- apiKey,
101- authenticationType,
102- canonicalUri,
103- appSyncGraphqlEndpoint,
104- region,
105- additionalCustomHeaders,
106- payload,
107- } : AWSAppSyncRealTimeAuthInput ) : Promise <
108- Record < string , string | undefined > | undefined
109- > => {
105+ export const awsRealTimeHeaderBasedAuth = async (
106+ ctx : AmplifyContext ,
107+ {
108+ apiKey,
109+ authenticationType,
110+ canonicalUri,
111+ appSyncGraphqlEndpoint,
112+ region,
113+ additionalCustomHeaders,
114+ payload,
115+ } : AWSAppSyncRealTimeAuthInput ,
116+ ) : Promise < Record < string , string | undefined > | undefined > => {
110117 const headerHandler = {
111118 apiKey : awsRealTimeApiKeyHeader ,
112119 iam : awsRealTimeIAMHeader ,
0 commit comments