Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Update slack functions with new type" #240

Merged
merged 1 commit into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/dev_deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export {
assertInstanceOf,
AssertionError,
assertMatch,
assertNotStrictEquals,
assertRejects,
assertStrictEquals,
assertStringIncludes,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const renderFunctionManifestTest = (
);
typescript.push(`const actual = ${functionName}.export();`);
typescript.push("");
typescript.push(`assertNotStrictEquals(actual, expected);`);
typescript.push(`assertEquals(actual, expected);`);
return `() => {${typescript.join("\n")}}`;
};

Expand Down Expand Up @@ -114,7 +114,7 @@ export function SlackTestFunctionTemplate(
const typescript: string[] = [];
typescript.push(autogeneratedComment());
typescript.push(
`import { assertEquals, assertNotStrictEquals } from "../../../dev_deps.ts";`,
`import { assertEquals } from "../../../dev_deps.ts";`,
);
typescript.push(
`import { DefineWorkflow } from "../../../workflows/mod.ts";`,
Expand Down Expand Up @@ -142,7 +142,7 @@ export function SlackTestFunctionTemplate(
}

typescript[1] =
`import { assertEquals, assertNotStrictEquals, assertExists } from "../../../dev_deps.ts";`;
`import { assertEquals, assertExists } from "../../../dev_deps.ts";`;
typescript.push("");
typescript.push(
`Deno.test("All outputs of Slack function ${functionName} should exist", ${
Expand Down
7 changes: 4 additions & 3 deletions src/schema/slack/functions/add_pin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import SlackTypes from "../schema_types.ts";
export default DefineFunction({
callback_id: "slack#/functions/add_pin",
source_file: "",
title: "Pin a message",
title: "Pin to channel",
description: "Pin a message to a channel",
input_parameters: {
properties: {
channel_id: {
Expand All @@ -16,8 +17,8 @@ export default DefineFunction({
},
message: {
type: SchemaTypes.string,
description: "Enter a message link or message timestamp",
title: "Message link or message timestamp",
description: "Enter a message URL or message timestamp",
title: "Message URL or message timestamp",
},
},
required: ["channel_id", "message"],
Expand Down
11 changes: 6 additions & 5 deletions src/schema/slack/functions/add_pin_test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/** This file was autogenerated. Follow the steps in src/schema/slack/functions/_scripts/README.md to rebuild **/
import { assertEquals, assertNotStrictEquals } from "../../../dev_deps.ts";
import { assertEquals } from "../../../dev_deps.ts";
import { DefineWorkflow } from "../../../workflows/mod.ts";
import { ManifestFunctionSchema } from "../../../manifest/manifest_schema.ts";
import SchemaTypes from "../../schema_types.ts";
Expand All @@ -10,7 +10,8 @@ Deno.test("AddPin generates valid FunctionManifest", () => {
assertEquals(AddPin.definition.callback_id, "slack#/functions/add_pin");
const expected: ManifestFunctionSchema = {
source_file: "",
title: "Pin a message",
title: "Pin to channel",
description: "Pin a message to a channel",
input_parameters: {
properties: {
channel_id: {
Expand All @@ -20,8 +21,8 @@ Deno.test("AddPin generates valid FunctionManifest", () => {
},
message: {
type: SchemaTypes.string,
description: "Enter a message link or message timestamp",
title: "Message link or message timestamp",
description: "Enter a message URL or message timestamp",
title: "Message URL or message timestamp",
},
},
required: ["channel_id", "message"],
Expand All @@ -30,7 +31,7 @@ Deno.test("AddPin generates valid FunctionManifest", () => {
};
const actual = AddPin.export();

assertNotStrictEquals(actual, expected);
assertEquals(actual, expected);
});

Deno.test("AddPin can be used as a Slack function in a workflow step", () => {
Expand Down
4 changes: 2 additions & 2 deletions src/schema/slack/functions/add_user_to_usergroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import SlackTypes from "../schema_types.ts";
export default DefineFunction({
callback_id: "slack#/functions/add_user_to_usergroup",
source_file: "",
title: "Add people to a user group",
description: "Additional permissions might be required",
title: "Add to user group",
description: "Add someone to a user group.",
input_parameters: {
properties: {
usergroup_id: {
Expand Down
12 changes: 4 additions & 8 deletions src/schema/slack/functions/add_user_to_usergroup_test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
/** This file was autogenerated. Follow the steps in src/schema/slack/functions/_scripts/README.md to rebuild **/
import {
assertEquals,
assertExists,
assertNotStrictEquals,
} from "../../../dev_deps.ts";
import { assertEquals, assertExists } from "../../../dev_deps.ts";
import { DefineWorkflow } from "../../../workflows/mod.ts";
import { ManifestFunctionSchema } from "../../../manifest/manifest_schema.ts";
import SchemaTypes from "../../schema_types.ts";
Expand All @@ -17,8 +13,8 @@ Deno.test("AddUserToUsergroup generates valid FunctionManifest", () => {
);
const expected: ManifestFunctionSchema = {
source_file: "",
title: "Add people to a user group",
description: "Additional permissions might be required",
title: "Add to user group",
description: "Add someone to a user group.",
input_parameters: {
properties: {
usergroup_id: {
Expand Down Expand Up @@ -48,7 +44,7 @@ Deno.test("AddUserToUsergroup generates valid FunctionManifest", () => {
};
const actual = AddUserToUsergroup.export();

assertNotStrictEquals(actual, expected);
assertEquals(actual, expected);
});

Deno.test("AddUserToUsergroup can be used as a Slack function in a workflow step", () => {
Expand Down
1 change: 1 addition & 0 deletions src/schema/slack/functions/archive_channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export default DefineFunction({
callback_id: "slack#/functions/archive_channel",
source_file: "",
title: "Archive a channel",
description: "Archive a Slack channel",
input_parameters: {
properties: {
channel_id: {
Expand Down
9 changes: 3 additions & 6 deletions src/schema/slack/functions/archive_channel_test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
/** This file was autogenerated. Follow the steps in src/schema/slack/functions/_scripts/README.md to rebuild **/
import {
assertEquals,
assertExists,
assertNotStrictEquals,
} from "../../../dev_deps.ts";
import { assertEquals, assertExists } from "../../../dev_deps.ts";
import { DefineWorkflow } from "../../../workflows/mod.ts";
import { ManifestFunctionSchema } from "../../../manifest/manifest_schema.ts";
import SlackTypes from "../schema_types.ts";
Expand All @@ -17,6 +13,7 @@ Deno.test("ArchiveChannel generates valid FunctionManifest", () => {
const expected: ManifestFunctionSchema = {
source_file: "",
title: "Archive a channel",
description: "Archive a Slack channel",
input_parameters: {
properties: {
channel_id: {
Expand All @@ -40,7 +37,7 @@ Deno.test("ArchiveChannel generates valid FunctionManifest", () => {
};
const actual = ArchiveChannel.export();

assertNotStrictEquals(actual, expected);
assertEquals(actual, expected);
});

Deno.test("ArchiveChannel can be used as a Slack function in a workflow step", () => {
Expand Down
1 change: 1 addition & 0 deletions src/schema/slack/functions/create_channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export default DefineFunction({
callback_id: "slack#/functions/create_channel",
source_file: "",
title: "Create a channel",
description: "Create a Slack channel",
input_parameters: {
properties: {
channel_name: {
Expand Down
9 changes: 3 additions & 6 deletions src/schema/slack/functions/create_channel_test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
/** This file was autogenerated. Follow the steps in src/schema/slack/functions/_scripts/README.md to rebuild **/
import {
assertEquals,
assertExists,
assertNotStrictEquals,
} from "../../../dev_deps.ts";
import { assertEquals, assertExists } from "../../../dev_deps.ts";
import { DefineWorkflow } from "../../../workflows/mod.ts";
import { ManifestFunctionSchema } from "../../../manifest/manifest_schema.ts";
import SchemaTypes from "../../schema_types.ts";
Expand All @@ -18,6 +14,7 @@ Deno.test("CreateChannel generates valid FunctionManifest", () => {
const expected: ManifestFunctionSchema = {
source_file: "",
title: "Create a channel",
description: "Create a Slack channel",
input_parameters: {
properties: {
channel_name: {
Expand Down Expand Up @@ -58,7 +55,7 @@ Deno.test("CreateChannel generates valid FunctionManifest", () => {
};
const actual = CreateChannel.export();

assertNotStrictEquals(actual, expected);
assertEquals(actual, expected);
});

Deno.test("CreateChannel can be used as a Slack function in a workflow step", () => {
Expand Down
2 changes: 1 addition & 1 deletion src/schema/slack/functions/create_usergroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default DefineFunction({
callback_id: "slack#/functions/create_usergroup",
source_file: "",
title: "Create a user group",
description: "Additional permissions might be required",
description: "Create a Slack user group",
input_parameters: {
properties: {
usergroup_handle: {
Expand Down
10 changes: 3 additions & 7 deletions src/schema/slack/functions/create_usergroup_test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
/** This file was autogenerated. Follow the steps in src/schema/slack/functions/_scripts/README.md to rebuild **/
import {
assertEquals,
assertExists,
assertNotStrictEquals,
} from "../../../dev_deps.ts";
import { assertEquals, assertExists } from "../../../dev_deps.ts";
import { DefineWorkflow } from "../../../workflows/mod.ts";
import { ManifestFunctionSchema } from "../../../manifest/manifest_schema.ts";
import SchemaTypes from "../../schema_types.ts";
Expand All @@ -18,7 +14,7 @@ Deno.test("CreateUsergroup generates valid FunctionManifest", () => {
const expected: ManifestFunctionSchema = {
source_file: "",
title: "Create a user group",
description: "Additional permissions might be required",
description: "Create a Slack user group",
input_parameters: {
properties: {
usergroup_handle: {
Expand Down Expand Up @@ -47,7 +43,7 @@ Deno.test("CreateUsergroup generates valid FunctionManifest", () => {
};
const actual = CreateUsergroup.export();

assertNotStrictEquals(actual, expected);
assertEquals(actual, expected);
});

Deno.test("CreateUsergroup can be used as a Slack function in a workflow step", () => {
Expand Down
4 changes: 2 additions & 2 deletions src/schema/slack/functions/delay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import SchemaTypes from "../../schema_types.ts";
export default DefineFunction({
callback_id: "slack#/functions/delay",
source_file: "",
title: "Delay this workflow",
description: "Pauses the workflow at this step",
title: "Delay",
description: "Pause the workflow for a set amount of time",
input_parameters: {
properties: {
minutes_to_delay: {
Expand Down
8 changes: 4 additions & 4 deletions src/schema/slack/functions/delay_test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/** This file was autogenerated. Follow the steps in src/schema/slack/functions/_scripts/README.md to rebuild **/
import { assertEquals, assertNotStrictEquals } from "../../../dev_deps.ts";
import { assertEquals } from "../../../dev_deps.ts";
import { DefineWorkflow } from "../../../workflows/mod.ts";
import { ManifestFunctionSchema } from "../../../manifest/manifest_schema.ts";
import SchemaTypes from "../../schema_types.ts";
Expand All @@ -9,8 +9,8 @@ Deno.test("Delay generates valid FunctionManifest", () => {
assertEquals(Delay.definition.callback_id, "slack#/functions/delay");
const expected: ManifestFunctionSchema = {
source_file: "",
title: "Delay this workflow",
description: "Pauses the workflow at this step",
title: "Delay",
description: "Pause the workflow for a set amount of time",
input_parameters: {
properties: {
minutes_to_delay: {
Expand All @@ -25,7 +25,7 @@ Deno.test("Delay generates valid FunctionManifest", () => {
};
const actual = Delay.export();

assertNotStrictEquals(actual, expected);
assertEquals(actual, expected);
});

Deno.test("Delay can be used as a Slack function in a workflow step", () => {
Expand Down
4 changes: 2 additions & 2 deletions src/schema/slack/functions/invite_user_to_channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import SlackTypes from "../schema_types.ts";
export default DefineFunction({
callback_id: "slack#/functions/invite_user_to_channel",
source_file: "",
title: "Add people to a channel",
title: "Invite to channel",
description:
"You or the people using the workflow must have permission to invite others to the channel",
"Invite someone to a channel. This will only work if this workflow created the channel.",
input_parameters: {
properties: {
channel_ids: {
Expand Down
12 changes: 4 additions & 8 deletions src/schema/slack/functions/invite_user_to_channel_test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
/** This file was autogenerated. Follow the steps in src/schema/slack/functions/_scripts/README.md to rebuild **/
import {
assertEquals,
assertExists,
assertNotStrictEquals,
} from "../../../dev_deps.ts";
import { assertEquals, assertExists } from "../../../dev_deps.ts";
import { DefineWorkflow } from "../../../workflows/mod.ts";
import { ManifestFunctionSchema } from "../../../manifest/manifest_schema.ts";
import SchemaTypes from "../../schema_types.ts";
Expand All @@ -17,9 +13,9 @@ Deno.test("InviteUserToChannel generates valid FunctionManifest", () => {
);
const expected: ManifestFunctionSchema = {
source_file: "",
title: "Add people to a channel",
title: "Invite to channel",
description:
"You or the people using the workflow must have permission to invite others to the channel",
"Invite someone to a channel. This will only work if this workflow created the channel.",
input_parameters: {
properties: {
channel_ids: {
Expand Down Expand Up @@ -51,7 +47,7 @@ Deno.test("InviteUserToChannel generates valid FunctionManifest", () => {
};
const actual = InviteUserToChannel.export();

assertNotStrictEquals(actual, expected);
assertEquals(actual, expected);
});

Deno.test("InviteUserToChannel can be used as a Slack function in a workflow step", () => {
Expand Down
2 changes: 1 addition & 1 deletion src/schema/slack/functions/mod.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** This file was autogenerated on Thu Nov 02 2023. Follow the steps in src/schema/slack/functions/_scripts/README.md to rebuild **/
/** This file was autogenerated on Thu Sep 07 2023. Follow the steps in src/schema/slack/functions/_scripts/README.md to rebuild **/
import AddPin from "./add_pin.ts";
import AddUserToUsergroup from "./add_user_to_usergroup.ts";
import ArchiveChannel from "./archive_channel.ts";
Expand Down
27 changes: 3 additions & 24 deletions src/schema/slack/functions/open_form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { InternalSlackTypes } from "../types/custom/mod.ts";
export default DefineFunction({
callback_id: "slack#/functions/open_form",
source_file: "",
title: "Collect info in a form",
description: "Uses a form to collect information",
title: "Open a form",
description: "Opens a form for the user",
input_parameters: {
properties: {
title: {
Expand Down Expand Up @@ -52,28 +52,7 @@ export default DefineFunction({
description: "Context about the form submit action interactive event",
title: "interactivity",
},
submit_user: {
type: SlackTypes.user_id,
description: "Person who submitted the form",
title: "Person who submitted the form",
},
timestamp_started: {
type: SlackTypes.timestamp,
description: "Time when step started",
title: "Time when step started",
},
timestamp_completed: {
type: SlackTypes.timestamp,
description: "Time when step ended",
title: "Time when step ended",
},
},
required: [
"fields",
"interactivity",
"submit_user",
"timestamp_started",
"timestamp_completed",
],
required: ["fields", "interactivity"],
},
});
Loading