-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New
team_id
type, updates to built-ins, updated builtin function ge…
…neration script instructions (#327) * Alphabetize slack types, add team ID type * Built in function updates: - updated some property titles - create-channel built in now accepts an optional team id (related to #267) - added new Add Bookmark builtin * model is_hidden on builtin function parameters. * remove deprecated deno.jsonc properties. * dont warn on hidden params, instead filter them out, but, have a special list of pre-approved hidden params we publicize anyways to account for exposing it previously
- Loading branch information
Showing
33 changed files
with
331 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/** This file was autogenerated. Follow the steps in src/schema/slack/functions/_scripts/README.md to rebuild **/ | ||
import { DefineFunction } from "../../../functions/mod.ts"; | ||
import SchemaTypes from "../../schema_types.ts"; | ||
import SlackTypes from "../schema_types.ts"; | ||
|
||
export default DefineFunction({ | ||
callback_id: "slack#/functions/add_bookmark", | ||
source_file: "", | ||
title: "Add a bookmark", | ||
input_parameters: { | ||
properties: { | ||
channel_id: { | ||
type: SlackTypes.channel_id, | ||
description: "Search all channels", | ||
title: "Select a channel", | ||
}, | ||
name: { | ||
type: SchemaTypes.string, | ||
description: "Enter the bookmark name", | ||
title: "Bookmark name", | ||
}, | ||
link: { | ||
type: SchemaTypes.string, | ||
description: "https://docs.acme.com", | ||
title: "Bookmark Link", | ||
}, | ||
}, | ||
required: ["channel_id", "name", "link"], | ||
}, | ||
output_parameters: { | ||
properties: { | ||
channel_id: { | ||
type: SlackTypes.channel_id, | ||
description: "Channel", | ||
title: "Channel", | ||
}, | ||
bookmark_name: { | ||
type: SchemaTypes.string, | ||
description: "Bookmark name", | ||
title: "Bookmark name", | ||
}, | ||
bookmark_link: { | ||
type: SchemaTypes.string, | ||
description: "Bookmark link", | ||
title: "Bookmark link", | ||
}, | ||
}, | ||
required: ["channel_id", "bookmark_name", "bookmark_link"], | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
/** 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 { DefineWorkflow } from "../../../workflows/mod.ts"; | ||
import { ManifestFunctionSchema } from "../../../manifest/manifest_schema.ts"; | ||
import SchemaTypes from "../../schema_types.ts"; | ||
import SlackTypes from "../schema_types.ts"; | ||
import AddBookmark from "./add_bookmark.ts"; | ||
|
||
Deno.test("AddBookmark generates valid FunctionManifest", () => { | ||
assertEquals( | ||
AddBookmark.definition.callback_id, | ||
"slack#/functions/add_bookmark", | ||
); | ||
const expected: ManifestFunctionSchema = { | ||
source_file: "", | ||
title: "Add a bookmark", | ||
input_parameters: { | ||
properties: { | ||
channel_id: { | ||
type: SlackTypes.channel_id, | ||
description: "Search all channels", | ||
title: "Select a channel", | ||
}, | ||
name: { | ||
type: SchemaTypes.string, | ||
description: "Enter the bookmark name", | ||
title: "Bookmark name", | ||
}, | ||
link: { | ||
type: SchemaTypes.string, | ||
description: "https://docs.acme.com", | ||
title: "Bookmark Link", | ||
}, | ||
}, | ||
required: ["channel_id", "name", "link"], | ||
}, | ||
output_parameters: { | ||
properties: { | ||
channel_id: { | ||
type: SlackTypes.channel_id, | ||
description: "Channel", | ||
title: "Channel", | ||
}, | ||
bookmark_name: { | ||
type: SchemaTypes.string, | ||
description: "Bookmark name", | ||
title: "Bookmark name", | ||
}, | ||
bookmark_link: { | ||
type: SchemaTypes.string, | ||
description: "Bookmark link", | ||
title: "Bookmark link", | ||
}, | ||
}, | ||
required: ["channel_id", "bookmark_name", "bookmark_link"], | ||
}, | ||
}; | ||
const actual = AddBookmark.export(); | ||
|
||
assertNotStrictEquals(actual, expected); | ||
}); | ||
|
||
Deno.test("AddBookmark can be used as a Slack function in a workflow step", () => { | ||
const testWorkflow = DefineWorkflow({ | ||
callback_id: "test_AddBookmark_slack_function", | ||
title: "Test AddBookmark", | ||
description: "This is a generated test to test AddBookmark", | ||
}); | ||
testWorkflow.addStep(AddBookmark, { | ||
channel_id: "test", | ||
name: "test", | ||
link: "test", | ||
}); | ||
const actual = testWorkflow.steps[0].export(); | ||
|
||
assertEquals(actual.function_id, "slack#/functions/add_bookmark"); | ||
assertEquals(actual.inputs, { | ||
channel_id: "test", | ||
name: "test", | ||
link: "test", | ||
}); | ||
}); | ||
|
||
Deno.test("All outputs of Slack function AddBookmark should exist", () => { | ||
const testWorkflow = DefineWorkflow({ | ||
callback_id: "test_AddBookmark_slack_function", | ||
title: "Test AddBookmark", | ||
description: "This is a generated test to test AddBookmark", | ||
}); | ||
const step = testWorkflow.addStep(AddBookmark, { | ||
channel_id: "test", | ||
name: "test", | ||
link: "test", | ||
}); | ||
assertExists(step.outputs.channel_id); | ||
assertExists(step.outputs.bookmark_name); | ||
assertExists(step.outputs.bookmark_link); | ||
}); |
Oops, something went wrong.