@pipedream/slack 0.9.5 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,6 @@
1
1
  import {
2
- ConfigurationError, axios,
2
+ ConfigurationError, axios, getFileStreamAndMetadata,
3
3
  } from "@pipedream/platform";
4
- import fs from "fs";
5
4
  import FormData from "form-data";
6
5
  import slack from "../../slack.app.mjs";
7
6
 
@@ -9,7 +8,7 @@ export default {
9
8
  key: "slack-upload-file",
10
9
  name: "Upload File",
11
10
  description: "Upload a file. [See the documentation](https://api.slack.com/messaging/files#uploading_files)",
12
- version: "0.0.27",
11
+ version: "0.1.0",
13
12
  type: "action",
14
13
  props: {
15
14
  slack,
@@ -35,16 +34,16 @@ export default {
35
34
  },
36
35
  },
37
36
  async run({ $ }) {
38
- if (!fs.existsSync(this.content)) {
39
- throw new ConfigurationError(`\`${this.content}\` not found, a valid \`/tmp\` path is needed`);
40
- }
37
+ const {
38
+ stream, metadata,
39
+ } = await getFileStreamAndMetadata(this.content);
41
40
 
42
41
  const filename = this.content.split("/").pop();
43
42
 
44
43
  // Get an upload URL from Slack
45
44
  const getUploadUrlResponse = await this.slack.getUploadUrl({
46
45
  filename,
47
- length: fs.statSync(this.content).size,
46
+ length: metadata.size,
48
47
  });
49
48
 
50
49
  if (!getUploadUrlResponse.ok) {
@@ -57,7 +56,11 @@ export default {
57
56
 
58
57
  // Upload the file to the provided URL
59
58
  const formData = new FormData();
60
- formData.append("file", fs.createReadStream(this.content));
59
+ formData.append("file", stream, {
60
+ contentType: metadata.contentType,
61
+ knownLength: metadata.size,
62
+ filename: metadata.name,
63
+ });
61
64
  formData.append("filename", filename);
62
65
 
63
66
  await axios($, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/slack",
3
- "version": "0.9.5",
3
+ "version": "0.10.1",
4
4
  "description": "Pipedream Slack Components",
5
5
  "main": "slack.app.mjs",
6
6
  "keywords": [
@@ -14,7 +14,7 @@
14
14
  "access": "public"
15
15
  },
16
16
  "dependencies": {
17
- "@pipedream/platform": "^3.0.0",
17
+ "@pipedream/platform": "^3.1.0",
18
18
  "@slack/web-api": "^7.9.0",
19
19
  "async-retry": "^1.3.3",
20
20
  "lodash": "^4.17.21"
package/slack.app.mjs CHANGED
@@ -356,8 +356,8 @@ export default {
356
356
  },
357
357
  },
358
358
  content: {
359
- label: "File Path",
360
- description: "Full path to the file in `/tmp/` directory. E.g. `/tmp/cute_cat.jpg`",
359
+ label: "File Path or URL",
360
+ description: "The file to upload. Provide either a file URL or a path to a file in the `/tmp` directory (for example, `/tmp/myFile.txt`)",
361
361
  type: "string",
362
362
  },
363
363
  link_names: {
@@ -144,7 +144,7 @@ export default {
144
144
  return await this.maybeCached(
145
145
  `lastMessage:${channel}:${ts}`,
146
146
  async () => {
147
- const response = await this.slack.sdk().getConversationReplies({
147
+ const response = await this.slack.getConversationReplies({
148
148
  channel,
149
149
  ts,
150
150
  limit: 1,
@@ -5,7 +5,7 @@ export default {
5
5
  ...common,
6
6
  key: "slack-new-channel-created",
7
7
  name: "New Channel Created (Instant)",
8
- version: "0.0.9",
8
+ version: "0.0.10",
9
9
  description: "Emit new event when a new channel is created.",
10
10
  type: "source",
11
11
  dedupe: "unique",
@@ -5,7 +5,7 @@ export default {
5
5
  ...common,
6
6
  key: "slack-new-direct-message",
7
7
  name: "New Direct Message (Instant)",
8
- version: "1.0.22",
8
+ version: "1.0.23",
9
9
  description: "Emit new event when a message was posted in a direct message channel",
10
10
  type: "source",
11
11
  dedupe: "unique",
@@ -3,7 +3,7 @@ import sampleEmit from "./test-event.mjs";
3
3
 
4
4
  export default {
5
5
  name: "New Interaction Events (Instant)",
6
- version: "0.0.19",
6
+ version: "0.0.20",
7
7
  key: "slack-new-interaction-event-received",
8
8
  description: "Emit new events on new Slack [interactivity events](https://api.slack.com/interactivity) sourced from [Block Kit interactive elements](https://api.slack.com/interactivity/components), [Slash commands](https://api.slack.com/interactivity/slash-commands), or [Shortcuts](https://api.slack.com/interactivity/shortcuts).",
9
9
  type: "source",
@@ -6,7 +6,7 @@ export default {
6
6
  ...common,
7
7
  key: "slack-new-keyword-mention",
8
8
  name: "New Keyword Mention (Instant)",
9
- version: "0.0.7",
9
+ version: "0.0.8",
10
10
  description: "Emit new event when a specific keyword is mentioned in a channel",
11
11
  type: "source",
12
12
  dedupe: "unique",
@@ -6,7 +6,7 @@ export default {
6
6
  ...common,
7
7
  key: "slack-new-message-in-channels",
8
8
  name: "New Message In Channels (Instant)",
9
- version: "1.0.24",
9
+ version: "1.0.25",
10
10
  description: "Emit new event when a new message is posted to one or more channels",
11
11
  type: "source",
12
12
  dedupe: "unique",
@@ -5,7 +5,7 @@ export default {
5
5
  ...common,
6
6
  key: "slack-new-reaction-added",
7
7
  name: "New Reaction Added (Instant)",
8
- version: "1.1.25",
8
+ version: "1.1.26",
9
9
  description: "Emit new event when a member has added an emoji reaction to a message",
10
10
  type: "source",
11
11
  dedupe: "unique",
@@ -5,7 +5,7 @@ export default {
5
5
  ...common,
6
6
  key: "slack-new-saved-message",
7
7
  name: "New Saved Message (Instant)",
8
- version: "0.0.5",
8
+ version: "0.0.6",
9
9
  description: "Emit new event when a message is saved. Note: The endpoint is marked as deprecated, and Slack might shut this off at some point down the line.",
10
10
  type: "source",
11
11
  dedupe: "unique",
@@ -5,7 +5,7 @@ export default {
5
5
  ...common,
6
6
  key: "slack-new-user-added",
7
7
  name: "New User Added (Instant)",
8
- version: "0.0.3",
8
+ version: "0.0.4",
9
9
  description: "Emit new event when a new member joins a workspace.",
10
10
  type: "source",
11
11
  dedupe: "unique",
@@ -6,7 +6,7 @@ export default {
6
6
  ...common,
7
7
  key: "slack-new-user-mention",
8
8
  name: "New User Mention (Instant)",
9
- version: "0.0.7",
9
+ version: "0.0.8",
10
10
  description: "Emit new event when a username or specific keyword is mentioned in a channel",
11
11
  type: "source",
12
12
  dedupe: "unique",