Skip to content

Commit

Permalink
chore: updated slack deps
Browse files Browse the repository at this point in the history
  • Loading branch information
Q1w1N committed Dec 11, 2024
1 parent 2e8df02 commit 3e09ea0
Show file tree
Hide file tree
Showing 9 changed files with 254 additions and 241 deletions.
5 changes: 5 additions & 0 deletions .changeset/fluffy-beans-dream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@callstack/byorg-slack': minor
---

Updated slack/bolt and slack/web-api dependencies
4 changes: 2 additions & 2 deletions packages/slack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
"@callstack/byorg-core": "workspace:*",
"@callstack/byorg-utils": "workspace:*",
"@callstack/slack-rich-text": "workspace:*",
"@slack/bolt": "^3.21.1",
"@slack/web-api": "^6.12.1",
"@slack/bolt": "^4.1.1",
"@slack/web-api": "^7.8.0",
"p-debounce": "^4.0.0",
"ts-regex-builder": "^1.8.2"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/slack/src/app.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Slack, { ContextBlock, LogLevel, RichTextBlock, SayFn } from '@slack/bolt';
import { WebClient } from '@slack/web-api';
import Slack, { LogLevel, SayFn } from '@slack/bolt';
import { ContextBlock, RichTextBlock, WebClient } from '@slack/web-api';
import { Application } from '@callstack/byorg-core';
import { logger } from '@callstack/byorg-utils';
import { parseMarkdownToRichTextBlock } from '@callstack/slack-rich-text';
Expand Down
8 changes: 2 additions & 6 deletions packages/slack/src/messages.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import {
FileElement,
MessageElement,
} from '@slack/web-api/dist/response/ConversationsRepliesResponse.js';
import { WebClient } from '@slack/web-api';
import { RichTextBlock } from '@slack/bolt';
import { RichTextBlock, WebClient } from '@slack/web-api';
import { FileBuffer, Message } from '@callstack/byorg-core';
import { parseRichTextBlockToMarkdown } from '@callstack/slack-rich-text';
import { fetchFile } from './slack-api.js';
import { FileElement, MessageElement } from './types.js';

export async function toCoreMessage(
message: MessageElement,
Expand Down
2 changes: 1 addition & 1 deletion packages/slack/src/resolvers/resolver-channel.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { logger } from '@callstack/byorg-utils';
import { Channel } from '@slack/web-api/dist/response/ConversationsInfoResponse.js';
import { getWebClient } from '../slack-api.js';
import { Channel } from '../types.js';

export type SlackChannelInfo = {
name: string | undefined;
Expand Down
2 changes: 1 addition & 1 deletion packages/slack/src/resolvers/resolver-user.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { logger } from '@callstack/byorg-utils';
import { Profile } from '@slack/web-api/dist/response/UsersProfileGetResponse.js';
import { getWebClient } from '../slack-api.js';
import { Profile } from '../types.js';

export type SlackUserInfo = {
realName: string | undefined;
Expand Down
6 changes: 2 additions & 4 deletions packages/slack/src/slack-api.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import * as Path from 'node:path';
import { FileBuffer } from '@callstack/byorg-core';
import { requireEnv } from '@callstack/byorg-utils';
import { AuthTestResponse, WebClient, type FilesInfoResponse } from '@slack/web-api';
import { MessageElement } from '@slack/web-api/dist/response/ConversationsRepliesResponse.js';

export type File = NonNullable<FilesInfoResponse['file']>;
import { AuthTestResponse, WebClient } from '@slack/web-api';
import { File, MessageElement } from './types.js';

let client: WebClient | null = null;

Expand Down
18 changes: 18 additions & 0 deletions packages/slack/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import { Application } from '@callstack/byorg-core';
import Slack from '@slack/bolt';
import {
ConversationsInfoResponse,
ConversationsRepliesResponse,
FilesInfoResponse,
UsersProfileGetResponse,
} from '@slack/web-api';

/**
* This type defines a standardized structure for Slack messages,
Expand All @@ -23,4 +29,16 @@ export type SlackApplicationConfig = {
logLevel?: Slack.LogLevel;
};

export type Unpacked<T> = T extends (infer U)[] ? NonNullable<U> : NonNullable<T>;

export type MessageElement = Unpacked<ConversationsRepliesResponse['messages']>;

export type FileElement = Unpacked<MessageElement['files']>;

export type File = NonNullable<FilesInfoResponse['file']>;

export type Profile = Unpacked<UsersProfileGetResponse['profile']>;

export type Channel = Unpacked<ConversationsInfoResponse['channel']>;

export type ConversationMode = 'direct' | 'public_channel';
Loading

0 comments on commit 3e09ea0

Please sign in to comment.