Skip to content

Commit 806dba1

Browse files
committed
feat: remove concurrency from authentication
1 parent 8e06b08 commit 806dba1

File tree

5 files changed

+15
-16
lines changed

5 files changed

+15
-16
lines changed

libraries/nestjs-libraries/src/integrations/social/facebook.provider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ export class FacebookProvider extends SocialAbstract implements SocialProvider {
428428
const since = dayjs().subtract(date, 'day').unix();
429429

430430
const { data } = await (
431-
await this.fetch(
431+
await fetch(
432432
`https://graph.facebook.com/v20.0/${id}/insights?metric=page_impressions_unique,page_posts_impressions_unique,page_post_engagements,page_daily_follows,page_video_views&access_token=${accessToken}&period=day&since=${since}&until=${until}`
433433
)
434434
).json();

libraries/nestjs-libraries/src/integrations/social/instagram.provider.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ export class InstagramProvider
385385

386386
async pages(accessToken: string) {
387387
const { data } = await (
388-
await this.fetch(
388+
await fetch(
389389
`https://graph.facebook.com/v20.0/me/accounts?fields=id,instagram_business_account,username,name,picture.type(large)&access_token=${accessToken}&limit=500`
390390
)
391391
).json();
@@ -397,7 +397,7 @@ export class InstagramProvider
397397
return {
398398
pageId: p.id,
399399
...(await (
400-
await this.fetch(
400+
await fetch(
401401
`https://graph.facebook.com/v20.0/${p.instagram_business_account.id}?fields=name,profile_picture_url&access_token=${accessToken}&limit=500`
402402
)
403403
).json()),
@@ -430,7 +430,6 @@ export class InstagramProvider
430430
)
431431
).json();
432432

433-
console.log(id, name, profile_picture_url, username);
434433
return {
435434
id,
436435
name,
@@ -667,13 +666,13 @@ export class InstagramProvider
667666
const since = dayjs().subtract(date, 'day').unix();
668667

669668
const { data, ...all } = await (
670-
await this.fetch(
669+
await fetch(
671670
`https://${type}/v21.0/${id}/insights?metric=follower_count,reach&access_token=${accessToken}&period=day&since=${since}&until=${until}`
672671
)
673672
).json();
674673

675674
const { data: data2, ...all2 } = await (
676-
await this.fetch(
675+
await fetch(
677676
`https://${type}/v21.0/${id}/insights?metric_type=total_value&metric=likes,views,comments,shares,saves,replies&access_token=${accessToken}&period=day&since=${since}&until=${until}`
678677
)
679678
).json();

libraries/nestjs-libraries/src/integrations/social/instagram.standalone.provider.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ export class InstagramStandaloneProvider
3535

3636
async refreshToken(refresh_token: string): Promise<AuthTokenDetails> {
3737
const { access_token } = await (
38-
await this.fetch(
38+
await fetch(
3939
`https://graph.instagram.com/refresh_access_token?grant_type=ig_refresh_token&access_token=${refresh_token}`
4040
)
4141
).json();
4242

4343
const { user_id, name, username, profile_picture_url } = await (
44-
await this.fetch(
44+
await fetch(
4545
`https://graph.instagram.com/v21.0/me?fields=user_id,username,name,profile_picture_url&access_token=${access_token}`
4646
)
4747
).json();
@@ -97,14 +97,14 @@ export class InstagramStandaloneProvider
9797
formData.append('code', params.code);
9898

9999
const getAccessToken = await (
100-
await this.fetch('https://api.instagram.com/oauth/access_token', {
100+
await fetch('https://api.instagram.com/oauth/access_token', {
101101
method: 'POST',
102102
body: formData,
103103
})
104104
).json();
105105

106106
const { access_token, expires_in, ...all } = await (
107-
await this.fetch(
107+
await fetch(
108108
'https://graph.instagram.com/access_token' +
109109
'?grant_type=ig_exchange_token' +
110110
`&client_id=${process.env.INSTAGRAM_APP_ID}` +
@@ -116,7 +116,7 @@ export class InstagramStandaloneProvider
116116
this.checkScopes(this.scopes, getAccessToken.permissions);
117117

118118
const { user_id, name, username, profile_picture_url } = await (
119-
await this.fetch(
119+
await fetch(
120120
`https://graph.instagram.com/v21.0/me?fields=user_id,username,name,profile_picture_url&access_token=${access_token}`
121121
)
122122
).json();

libraries/nestjs-libraries/src/integrations/social/linkedin.page.provider.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export class LinkedinPageProvider
3030
'r_organization_social',
3131
];
3232

33-
editor = 'normal' as const;
33+
override editor = 'normal' as const;
3434

3535
override async refreshToken(
3636
refresh_token: string
@@ -264,7 +264,7 @@ export class LinkedinPageProvider
264264
const startDate = dayjs().subtract(date, 'days').unix() * 1000;
265265

266266
const { elements }: { elements: Root[]; paging: any } = await (
267-
await this.fetch(
267+
await fetch(
268268
`https://api.linkedin.com/v2/organizationPageStatistics?q=organization&organization=${encodeURIComponent(
269269
`urn:li:organization:${id}`
270270
)}&timeIntervals=(timeRange:(start:${startDate},end:${endDate}),timeGranularityType:DAY)`,
@@ -279,7 +279,7 @@ export class LinkedinPageProvider
279279
).json();
280280

281281
const { elements: elements2 }: { elements: Root[]; paging: any } = await (
282-
await this.fetch(
282+
await fetch(
283283
`https://api.linkedin.com/v2/organizationalEntityFollowerStatistics?q=organizationalEntity&organizationalEntity=${encodeURIComponent(
284284
`urn:li:organization:${id}`
285285
)}&timeIntervals=(timeRange:(start:${startDate},end:${endDate}),timeGranularityType:DAY)`,
@@ -294,7 +294,7 @@ export class LinkedinPageProvider
294294
).json();
295295

296296
const { elements: elements3 }: { elements: Root[]; paging: any } = await (
297-
await this.fetch(
297+
await fetch(
298298
`https://api.linkedin.com/v2/organizationalEntityShareStatistics?q=organizationalEntity&organizationalEntity=${encodeURIComponent(
299299
`urn:li:organization:${id}`
300300
)}&timeIntervals=(timeRange:(start:${startDate},end:${endDate}),timeGranularityType:DAY)`,

libraries/nestjs-libraries/src/integrations/social/pinterest.provider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ export class PinterestProvider
289289
const {
290290
all: { daily_metrics },
291291
} = await (
292-
await this.fetch(
292+
await fetch(
293293
`https://api.pinterest.com/v5/user_account/analytics?start_date=${since}&end_date=${until}`,
294294
{
295295
method: 'GET',

0 commit comments

Comments
 (0)