@pipedream/microsoft_outlook 1.1.0 → 1.1.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,10 +1,11 @@
1
1
  import microsoftOutlook from "../../microsoft_outlook.app.mjs";
2
+ import { ConfigurationError } from "@pipedream/platform";
2
3
 
3
4
  export default {
4
5
  key: "microsoft_outlook-add-label-to-email",
5
6
  name: "Add Label to Email",
6
7
  description: "Adds a label/category to an email in Microsoft Outlook. [See the documentation](https://learn.microsoft.com/en-us/graph/api/message-update)",
7
- version: "0.0.1",
8
+ version: "0.0.2",
8
9
  type: "action",
9
10
  props: {
10
11
  microsoftOutlook,
@@ -14,10 +15,14 @@ export default {
14
15
  "messageId",
15
16
  ],
16
17
  },
17
- labelId: {
18
+ label: {
18
19
  propDefinition: [
19
20
  microsoftOutlook,
20
- "labelId",
21
+ "label",
22
+ (c) => ({
23
+ messageId: c.messageId,
24
+ excludeMessageLabels: true,
25
+ }),
21
26
  ],
22
27
  },
23
28
  },
@@ -29,13 +34,17 @@ export default {
29
34
 
30
35
  const labels = message?.categories;
31
36
 
37
+ if (labels.includes(this.label)) {
38
+ throw new ConfigurationError(`Message already contains label "${this.label}".`);
39
+ }
40
+
32
41
  const response = await this.microsoftOutlook.updateMessage({
33
42
  $,
34
43
  messageId: this.messageId,
35
44
  data: {
36
45
  categories: [
37
46
  ...labels,
38
- this.labelId,
47
+ this.label,
39
48
  ],
40
49
  },
41
50
  });
@@ -3,7 +3,7 @@ import microsoftOutlook from "../../microsoft_outlook.app.mjs";
3
3
  export default {
4
4
  type: "action",
5
5
  key: "microsoft_outlook-create-contact",
6
- version: "0.0.8",
6
+ version: "0.0.9",
7
7
  name: "Create Contact",
8
8
  description: "Add a contact to the root Contacts folder, [See the docs](https://docs.microsoft.com/en-us/graph/api/user-post-contacts)",
9
9
  props: {
@@ -3,7 +3,7 @@ import microsoftOutlook from "../../microsoft_outlook.app.mjs";
3
3
  export default {
4
4
  type: "action",
5
5
  key: "microsoft_outlook-create-draft-email",
6
- version: "0.0.8",
6
+ version: "0.0.9",
7
7
  name: "Create Draft Email",
8
8
  description: "Create a draft email, [See the docs](https://docs.microsoft.com/en-us/graph/api/user-post-messages)",
9
9
  props: {
@@ -3,7 +3,7 @@ import microsoftOutlook from "../../microsoft_outlook.app.mjs";
3
3
  export default {
4
4
  type: "action",
5
5
  key: "microsoft_outlook-find-contacts",
6
- version: "0.0.8",
6
+ version: "0.0.9",
7
7
  name: "Find Contacts",
8
8
  description: "Finds contacts with given search string",
9
9
  props: {
@@ -3,7 +3,7 @@ import microsoftOutlook from "../../microsoft_outlook.app.mjs";
3
3
  export default {
4
4
  type: "action",
5
5
  key: "microsoft_outlook-list-contacts",
6
- version: "0.0.8",
6
+ version: "0.0.9",
7
7
  name: "List Contacts",
8
8
  description: "Get a contact collection from the default contacts folder, [See the docs](https://docs.microsoft.com/en-us/graph/api/user-list-contacts)",
9
9
  props: {
@@ -4,7 +4,7 @@ export default {
4
4
  key: "microsoft_outlook-list-labels",
5
5
  name: "List Labels",
6
6
  description: "Get all the labels/categories that have been defined for a user. [See the documentation](https://learn.microsoft.com/en-us/graph/api/outlookuser-list-mastercategories)",
7
- version: "0.0.1",
7
+ version: "0.0.2",
8
8
  type: "action",
9
9
  props: {
10
10
  microsoftOutlook,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "microsoft_outlook-remove-label-from-email",
5
5
  name: "Remove Label from Email",
6
6
  description: "Removes a label/category from an email in Microsoft Outlook. [See the documentation](https://learn.microsoft.com/en-us/graph/api/message-update)",
7
- version: "0.0.1",
7
+ version: "0.0.2",
8
8
  type: "action",
9
9
  props: {
10
10
  microsoftOutlook,
@@ -14,12 +14,16 @@ export default {
14
14
  "messageId",
15
15
  ],
16
16
  },
17
- labelId: {
17
+ label: {
18
18
  propDefinition: [
19
19
  microsoftOutlook,
20
- "labelId",
20
+ "label",
21
+ (c) => ({
22
+ messageId: c.messageId,
23
+ onlyMessageLabels: true,
24
+ }),
21
25
  ],
22
- description: "The identifier of the label/category to remove",
26
+ description: "The name of the label/category to remove",
23
27
  },
24
28
  },
25
29
  async run({ $ }) {
@@ -29,7 +33,7 @@ export default {
29
33
  });
30
34
  let labels = message?.categories;
31
35
 
32
- const index = labels.indexOf(this.labelId);
36
+ const index = labels.indexOf(this.label);
33
37
  if (index > -1) {
34
38
  labels.splice(index, 1);
35
39
  }
@@ -3,7 +3,7 @@ import microsoftOutlook from "../../microsoft_outlook.app.mjs";
3
3
  export default {
4
4
  type: "action",
5
5
  key: "microsoft_outlook-send-email",
6
- version: "0.0.9",
6
+ version: "0.0.10",
7
7
  name: "Send Email",
8
8
  description: "Send an email to one or multiple recipients, [See the docs](https://docs.microsoft.com/en-us/graph/api/user-sendmail)",
9
9
  props: {
@@ -3,7 +3,7 @@ import microsoftOutlook from "../../microsoft_outlook.app.mjs";
3
3
  export default {
4
4
  type: "action",
5
5
  key: "microsoft_outlook-update-contact",
6
- version: "0.0.8",
6
+ version: "0.0.9",
7
7
  name: "Update Contact",
8
8
  description: "Add a contact to the root Contacts folder, [See the docs](https://docs.microsoft.com/en-us/graph/api/user-post-contacts)",
9
9
  props: {
@@ -100,18 +100,26 @@ export default {
100
100
  type: "object",
101
101
  optional: true,
102
102
  },
103
- labelId: {
103
+ label: {
104
104
  type: "string",
105
- label: "Label ID",
106
- description: "The identifier of the label/category to add",
107
- async options() {
108
- const { value: labels } = await this.listLabels();
109
- return labels?.map(({
110
- id: value, displayName: label,
111
- }) => ({
112
- value,
113
- label,
114
- })) || [];
105
+ label: "Label",
106
+ description: "The name of the label/category to add",
107
+ async options({
108
+ messageId, excludeMessageLabels, onlyMessageLabels,
109
+ }) {
110
+ const { value } = await this.listLabels();
111
+ let labels = value;
112
+ if (messageId) {
113
+ const { categories } = await this.getMessage({
114
+ messageId,
115
+ });
116
+ labels = excludeMessageLabels
117
+ ? labels.filter(({ displayName }) => !categories.includes(displayName))
118
+ : onlyMessageLabels
119
+ ? labels.filter(({ displayName }) => categories.includes(displayName))
120
+ : labels;
121
+ }
122
+ return labels?.map(({ displayName }) => displayName) || [];
115
123
  },
116
124
  },
117
125
  messageId: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/microsoft_outlook",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Pipedream Microsoft Outlook Components",
5
5
  "main": "microsoft_outlook.app.mjs",
6
6
  "keywords": [
@@ -5,7 +5,7 @@ export default {
5
5
  key: "microsoft_outlook-new-contact",
6
6
  name: "New Contact Event (Instant)",
7
7
  description: "Emit new event when a new Contact is created",
8
- version: "0.0.9",
8
+ version: "0.0.10",
9
9
  type: "source",
10
10
  hooks: {
11
11
  ...common.hooks,
@@ -7,7 +7,7 @@ export default {
7
7
  key: "microsoft_outlook-new-email",
8
8
  name: "New Email Event (Instant)",
9
9
  description: "Emit new event when an email is received in specified folders.",
10
- version: "0.0.12",
10
+ version: "0.0.13",
11
11
  type: "source",
12
12
  dedupe: "unique",
13
13
  props: {