Skip to content

Commit

Permalink
Update the code
Browse files Browse the repository at this point in the history
  • Loading branch information
seratch committed Feb 23, 2024
1 parent a7bba5d commit 35c930b
Show file tree
Hide file tree
Showing 18 changed files with 81 additions and 72 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
},
"homepage": "https://github.com/seratch/slack-edge#readme",
"dependencies": {
"slack-web-api-client": "^0.8.0"
"slack-web-api-client": "^0.8.1"
},
"devDependencies": {
"@vitest/coverage-v8": "^1.3.1",
Expand Down
4 changes: 2 additions & 2 deletions src_deno/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import {
import {
ResponseUrlSender,
SlackAPIClient,
} from "https://deno.land/x/[email protected].0/mod.ts";
} from "https://deno.land/x/[email protected].1/mod.ts";
import {
builtBaseContext,
SlackAppContext,
Expand All @@ -55,7 +55,7 @@ import { Middleware, PreAuthorizeMiddleware } from "./middleware/middleware.ts";
import {
isDebugLogEnabled,
prettyPrint,
} from "https://deno.land/x/[email protected].0/mod.ts";
} from "https://deno.land/x/[email protected].1/mod.ts";
import { Authorize } from "./authorization/authorize.ts";
import { AuthorizeResult } from "./authorization/authorize-result.ts";
import {
Expand Down
2 changes: 1 addition & 1 deletion src_deno/authorization/single-team-authorize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
AuthTestResponse,
SlackAPIClient,
SlackAPIError,
} from "https://deno.land/x/[email protected].0/mod.ts";
} from "https://deno.land/x/[email protected].1/mod.ts";
import { Authorize } from "./authorize.ts";

export const singleTeamAuthorize: Authorize = async (req) => {
Expand Down
2 changes: 1 addition & 1 deletion src_deno/context/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
ChatPostMessageResponse,
SlackAPIClient,
WebhookParams,
} from "https://deno.land/x/[email protected].0/mod.ts";
} from "https://deno.land/x/[email protected].1/mod.ts";

export interface PreAuthorizeSlackAppContext {
isEnterpriseinstall?: boolean;
Expand Down
2 changes: 1 addition & 1 deletion src_deno/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export * from "./app.ts";
export * from "./app-env.ts";
export * from "./execution-context.ts";

export * from "https://deno.land/x/[email protected].0/mod.ts";
export * from "https://deno.land/x/[email protected].1/mod.ts";

export * from "./errors.ts";
export * from "./oauth/error-codes.ts";
Expand Down
2 changes: 1 addition & 1 deletion src_deno/oauth-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
OAuthV2AccessResponse,
OpenIDConnectTokenResponse,
SlackAPIClient,
} from "https://deno.land/x/[email protected].0/mod.ts";
} from "https://deno.land/x/[email protected].1/mod.ts";
import { toInstallation } from "./oauth/installation.ts";
import {
AfterInstallation,
Expand Down
2 changes: 1 addition & 1 deletion src_deno/oauth/callback.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { OAuthV2AccessResponse } from "https://deno.land/x/[email protected].0/mod.ts";
import { OAuthV2AccessResponse } from "https://deno.land/x/[email protected].1/mod.ts";
import { InvalidStateParameter, OAuthErrorCode } from "./error-codes.ts";
import { Installation } from "./installation.ts";
import {
Expand Down
2 changes: 1 addition & 1 deletion src_deno/oauth/installation.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { OAuthV2AccessResponse } from "https://deno.land/x/[email protected].0/mod.ts";
import { OAuthV2AccessResponse } from "https://deno.land/x/[email protected].1/mod.ts";

export interface Installation {
app_id: string;
Expand Down
4 changes: 2 additions & 2 deletions src_deno/oidc/callback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { SlackLoggingLevel } from "../app-env.ts";
import {
OpenIDConnectTokenResponse,
SlackAPIClient,
} from "https://deno.land/x/[email protected].0/mod.ts";
import { prettyPrint } from "https://deno.land/x/[email protected].0/mod.ts";
} from "https://deno.land/x/[email protected].1/mod.ts";
import { prettyPrint } from "https://deno.land/x/[email protected].1/mod.ts";

export interface OpenIDConnectCallbackArgs {
env: SlackLoggingLevel;
Expand Down
2 changes: 1 addition & 1 deletion src_deno/oidc/login.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
OpenIDConnectTokenResponse,
OpenIDConnectUserInfoResponse,
} from "https://deno.land/x/[email protected].0/mod.ts";
} from "https://deno.land/x/[email protected].1/mod.ts";

export interface Login {
enterprise_id?: string;
Expand Down
2 changes: 1 addition & 1 deletion src_deno/request/payload/block-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
MessageAttachment,
MessageMetadata,
PlainTextField,
} from "https://deno.land/x/[email protected].0/mod.ts";
} from "https://deno.land/x/[email protected].1/mod.ts";
import { DataSubmissionView, ViewStateValue } from "./view-objects.ts";
import { BotProfile } from "./event.ts";

Expand Down
2 changes: 1 addition & 1 deletion src_deno/request/payload/block-suggestion.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AnyOption } from "https://deno.land/x/[email protected].0/mod.ts";
import { AnyOption } from "https://deno.land/x/[email protected].1/mod.ts";
import { DataSubmissionView } from "./view-objects.ts";

export interface BlockSuggestion {
Expand Down
88 changes: 46 additions & 42 deletions src_deno/request/payload/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
HomeTabView,
MessageAttachment,
MessageMetadata,
} from "https://deno.land/x/[email protected].0/mod.ts";
} from "https://deno.land/x/[email protected].1/mod.ts";

export type AnySlackEvent =
| AppRequestedEvent
Expand Down Expand Up @@ -202,15 +202,19 @@ export interface AppHomeOpenedEvent extends SlackEvent<"app_home_opened"> {

export interface AppMentionEvent extends SlackEvent<"app_mention"> {
type: "app_mention";
client_msg_id?: string;
subtype?: string;
bot_id?: string;
bot_profile?: BotProfile;
username: string;
username?: string;
team?: string;
user?: string;
text: string;
attachments?: MessageAttachment[];
blocks?: AnyMessageBlock[];
files?: FileElement[];
upload?: boolean;
display_as_bot?: boolean;
edited?: {
user: string;
ts: string;
Expand Down Expand Up @@ -1816,44 +1820,44 @@ export interface FileItem {
subtype?: string;
thumb_1024?: string;
thumb_1024_gif?: string;
thumb_1024_h?: string;
thumb_1024_w?: string;
thumb_1024_h?: number;
thumb_1024_w?: number;
thumb_160?: string;
thumb_160_gif?: string;
thumb_160_h?: string;
thumb_160_w?: string;
thumb_160_h?: number;
thumb_160_w?: number;
thumb_360?: string;
thumb_360_gif?: string;
thumb_360_h?: string;
thumb_360_w?: string;
thumb_360_h?: number;
thumb_360_w?: number;
thumb_480?: string;
thumb_480_gif?: string;
thumb_480_h?: string;
thumb_480_w?: string;
thumb_480_h?: number;
thumb_480_w?: number;
thumb_64?: string;
thumb_64_gif?: string;
thumb_64_h?: string;
thumb_64_w?: string;
thumb_64_h?: number;
thumb_64_w?: number;
thumb_720?: string;
thumb_720_gif?: string;
thumb_720_h?: string;
thumb_720_w?: string;
thumb_720_h?: number;
thumb_720_w?: number;
thumb_80?: string;
thumb_800?: string;
thumb_800_gif?: string;
thumb_800_h?: string;
thumb_800_w?: string;
thumb_800_h?: number;
thumb_800_w?: number;
thumb_80_gif?: string;
thumb_80_h?: string;
thumb_80_w?: string;
thumb_80_h?: number;
thumb_80_w?: number;
thumb_960?: string;
thumb_960_gif?: string;
thumb_960_h?: string;
thumb_960_w?: string;
thumb_960_h?: number;
thumb_960_w?: number;
thumb_gif?: string;
thumb_pdf?: string;
thumb_pdf_h?: string;
thumb_pdf_w?: string;
thumb_pdf_h?: number;
thumb_pdf_w?: number;
thumb_tiny?: string;
thumb_video?: string;
thumb_video_h?: number;
Expand Down Expand Up @@ -2029,44 +2033,44 @@ export interface FileElement {
subtype?: string;
thumb_1024?: string;
thumb_1024_gif?: string;
thumb_1024_h?: string;
thumb_1024_w?: string;
thumb_1024_h?: number;
thumb_1024_w?: number;
thumb_160?: string;
thumb_160_gif?: string;
thumb_160_h?: string;
thumb_160_w?: string;
thumb_160_h?: number;
thumb_160_w?: number;
thumb_360?: string;
thumb_360_gif?: string;
thumb_360_h?: string;
thumb_360_w?: string;
thumb_360_h?: number;
thumb_360_w?: number;
thumb_480?: string;
thumb_480_gif?: string;
thumb_480_h?: string;
thumb_480_w?: string;
thumb_480_h?: number;
thumb_480_w?: number;
thumb_64?: string;
thumb_64_gif?: string;
thumb_64_h?: string;
thumb_64_w?: string;
thumb_64_h?: number;
thumb_64_w?: number;
thumb_720?: string;
thumb_720_gif?: string;
thumb_720_h?: string;
thumb_720_w?: string;
thumb_720_h?: number;
thumb_720_w?: number;
thumb_80?: string;
thumb_800?: string;
thumb_800_gif?: string;
thumb_800_h?: string;
thumb_800_w?: string;
thumb_800_h?: number;
thumb_800_w?: number;
thumb_80_gif?: string;
thumb_80_h?: string;
thumb_80_w?: string;
thumb_80_h?: number;
thumb_80_w?: number;
thumb_960?: string;
thumb_960_gif?: string;
thumb_960_h?: string;
thumb_960_w?: string;
thumb_960_h?: number;
thumb_960_w?: number;
thumb_gif?: string;
thumb_pdf?: string;
thumb_pdf_h?: string;
thumb_pdf_w?: string;
thumb_pdf_h?: number;
thumb_pdf_w?: number;
thumb_tiny?: string;
thumb_video?: string;
thumb_video_h?: number;
Expand Down
2 changes: 1 addition & 1 deletion src_deno/request/payload/view-objects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
AnyModalBlock,
PlainTextField,
RichTextBlock,
} from "https://deno.land/x/[email protected].0/mod.ts";
} from "https://deno.land/x/[email protected].1/mod.ts";

export interface ViewStateSelectedOption {
text: PlainTextField;
Expand Down
2 changes: 1 addition & 1 deletion src_deno/response/response-body.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
MessageAttachment,
MessageMetadata,
ModalView,
} from "https://deno.land/x/[email protected].0/mod.ts";
} from "https://deno.land/x/[email protected].1/mod.ts";

export interface MessageResponse {
response_type?: "ephemeral" | "in_channel";
Expand Down
5 changes: 4 additions & 1 deletion src_deno/socket-mode/payload-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ export function fromSocketModeToRequest({
body,
retryNum,
retryReason,
}: fromSocketModeToRequestArgs): Request {
}: fromSocketModeToRequestArgs): Request | undefined {
if (!body) {
return undefined;
}
const payload = JSON.stringify(body);
const headers: Record<string, string> = {
"content-type": "application/json",
Expand Down
20 changes: 11 additions & 9 deletions src_deno/socket-mode/socket-mode-client.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
isDebugLogEnabled,
SlackAPIClient,
} from "https://deno.land/x/[email protected].0/mod.ts";
} from "https://deno.land/x/[email protected].1/mod.ts";
import { SlackApp } from "../app.ts";
import { ConfigError, SocketModeError } from "../errors.ts";
import { SlackSocketModeAppEnv } from "../app-env.ts";
Expand Down Expand Up @@ -101,14 +101,16 @@ export class SocketModeClient {
}
return;
}
const response = await app.run(
fromSocketModeToRequest({
url: ws.url,
body: data.payload,
retryNum: data.retry_attempt,
retryReason: data.retry_reason,
}),
);
const request = fromSocketModeToRequest({
url: ws.url,
body: data.payload,
retryNum: data.retry_attempt,
retryReason: data.retry_reason,
});
if (!request) {
return;
}
const response = await app.run(request);
const message: Record<string, unknown> = {
envelope_id: data.envelope_id,
};
Expand Down

0 comments on commit 35c930b

Please sign in to comment.