π¨ The ultimate agentic social media scheduling tool π€
TypeScript nextjsopen-sourceopen-source-social-media-scheduling-toolosspostiz-cloudpostiz-hostedredisscheduling-toolsocial-media-scheduling-tooltypescript
feat: x errors
Nevo David0458cffc18ce
diff --git a/libraries/nestjs-libraries/src/integrations/social.abstract.ts b/libraries/nestjs-libraries/src/integrations/social.abstract.tsindex 9c5cad807..5fd260568 100644--- a/libraries/nestjs-libraries/src/integrations/social.abstract.ts+++ b/libraries/nestjs-libraries/src/integrations/social.abstract.ts@@ -59,7 +59,7 @@ export abstract class SocialAbstract {public handleErrors(body: string,- status: number,+ status: number):| { type: 'refresh-token' | 'bad-body' | 'retry'; value: string }| undefined {@@ -117,12 +117,14 @@ export abstract class SocialAbstract {func: (...args: any[]) => Promise<T>,ignoreConcurrency?: boolean) {+ let globalErr = {};let value: any;try {value = await func();} catch (err) {const handle = this.handleErrors(safeStringify(err), 200);value = { err: true, value: 'Unknown Error', ...(handle || {}) };+ globalErr = err;}if (value && value?.err && value?.value) {@@ -134,7 +136,7 @@ export abstract class SocialAbstract {value.value || '');}- throw new BadBody('', safeStringify({}), {} as any, value.value || '');+ throw new BadBody('', safeStringify(globalErr), {} as any, value.value || '');}return value;diff --git a/libraries/nestjs-libraries/src/integrations/social/x.provider.ts b/libraries/nestjs-libraries/src/integrations/social/x.provider.tsindex e7b972ec1..b64269e10 100644--- a/libraries/nestjs-libraries/src/integrations/social/x.provider.ts+++ b/libraries/nestjs-libraries/src/integrations/social/x.provider.ts@@ -24,7 +24,11 @@ import { Rules } from '@gitroom/nestjs-libraries/chat/rules.description.decoratoimport { hasExtension } from '@gitroom/helpers/utils/has.extension';@Rules(- `X can have maximum 4 pictures, or maximum one video, it can also be without attachments ${process.env.STRIP_LINKS_FROM_X_POSTS ? 'do not add links, they will be stripped from the post' : ''}`+ `X can have maximum 4 pictures, or maximum one video, it can also be without attachments ${+ process.env.STRIP_LINKS_FROM_X_POSTS+ ? 'do not add links, they will be stripped from the post'+ : ''+ }`)export class XProvider extends SocialAbstract implements SocialProvider {identifier = 'x';@@ -451,17 +455,11 @@ export class XProvider extends SocialAbstract implements SocialProvider {| 'verified';made_with_ai?: boolean;paid_partnership?: boolean;- }>[]+ }>[],+ integration: Integration): Promise<PostResponse[]> {const [accessTokenSplit, accessSecretSplit] = accessToken.split(':');const client = await this.getClient(accessToken);- const {- data: { username },- } = await this.runInConcurrent(async () =>- client.v2.me({- 'user.fields': 'username',- })- );const [firstPost] = postDetails;@@ -514,7 +512,7 @@ export class XProvider extends SocialAbstract implements SocialProvider {{postId: data.id,id: firstPost.id,- releaseURL: `https://twitter.com/${username}/status/${data.id}`,+ releaseURL: `https://twitter.com/${integration.profile}/status/${data.id}`,status: 'posted',},];@@ -535,14 +533,6 @@ export class XProvider extends SocialAbstract implements SocialProvider {): Promise<PostResponse[]> {const [accessTokenSplit, accessSecretSplit] = accessToken.split(':');const client = await this.getClient(accessToken);- const {- data: { username },- } = await this.runInConcurrent(async () =>- client.v2.me({- 'user.fields': 'username',- })- );-const [commentPost] = postDetails;// upload media for the comment@@ -584,7 +574,7 @@ export class XProvider extends SocialAbstract implements SocialProvider {{postId: data.id,id: commentPost.id,- releaseURL: `https://twitter.com/${username}/status/${data.id}`,+ releaseURL: `https://twitter.com/${integration.profile}/status/${data.id}`,status: 'posted',},];