@pipedream/microsoft_outlook_calendar 0.3.0 → 0.3.2

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,17 +1,19 @@
1
+ import { ConfigurationError } from "@pipedream/platform";
1
2
  import microsoftOutlook from "../../microsoft_outlook_calendar.app.mjs";
3
+ import utils from "../../common/utils.mjs";
2
4
 
3
5
  export default {
4
6
  key: "microsoft_outlook_calendar-get-schedule",
5
7
  name: "Get Free/Busy Schedule",
6
8
  description: "Get the free/busy availability information for a collection of users, distributions lists, or resources (rooms or equipment) for a specified time period. [See the documentation](https://learn.microsoft.com/en-us/graph/api/calendar-getschedule)",
7
- version: "0.0.1",
9
+ version: "0.0.3",
8
10
  type: "action",
9
11
  props: {
10
12
  microsoftOutlook,
11
13
  schedules: {
12
14
  type: "string[]",
13
15
  label: "Schedules",
14
- description: "A collection of SMTP addresses of users, distribution lists, or resources to get availability information for",
16
+ description: "A list of emails of users, distribution lists, or resources. For example: `[ \"adelev@contoso.com\" , \"meganb@contoso.com\" ]`",
15
17
  },
16
18
  start: {
17
19
  propDefinition: [
@@ -48,10 +50,16 @@ export default {
48
50
  },
49
51
  },
50
52
  async run({ $ }) {
53
+ if (this.schedules === null || this.schedules === undefined || this.schedules?.length === 0) {
54
+ throw new ConfigurationError("The **Schedules** property is required");
55
+ }
56
+
57
+ const schedules = utils.parseArray(this.schedules);
58
+
51
59
  const { value } = await this.getSchedule({
52
60
  $,
53
61
  data: {
54
- schedules: this.schedules,
62
+ schedules,
55
63
  startTime: {
56
64
  dateTime: this.start,
57
65
  timeZone: this.timeZone,
@@ -64,7 +72,7 @@ export default {
64
72
  },
65
73
  });
66
74
 
67
- $.export("$summary", `Successfully retrieved schedules for \`${this.schedules.join("`, `")}\``);
75
+ $.export("$summary", `Successfully retrieved schedules for \`${schedules.join("`, `")}\``);
68
76
 
69
77
  return value;
70
78
  },
@@ -4,38 +4,21 @@ export default {
4
4
  key: "microsoft_outlook_calendar-list-events",
5
5
  name: "List Events",
6
6
  description: "Get a list of event objects in the user's mailbox. [See the documentation](https://learn.microsoft.com/en-us/graph/api/user-list-events)",
7
- version: "0.0.1",
7
+ version: "0.0.2",
8
8
  type: "action",
9
9
  props: {
10
10
  microsoftOutlook,
11
11
  filter: {
12
12
  type: "string",
13
13
  label: "Filter",
14
- description: "Use the `$filter` query parameter to filter events. E.g. `contains(subject, 'my event')` [See the documentation](https://learn.microsoft.com/en-us/graph/filter-query-parameter) for more information about the `$filter` parameter.",
14
+ description: "Filters results. For example, `contains(subject, 'meet for lunch?')` will include events whose title contains ‘meet for lunch?’. [See documentation](https://learn.microsoft.com/en-us/graph/filter-query-parameter) for the full list of operations.",
15
15
  optional: true,
16
16
  },
17
17
  orderBy: {
18
18
  type: "string",
19
19
  label: "Order By",
20
- description: "The field to sort the results by. Default is `createdDateTime`. [See the documentation](https://learn.microsoft.com/en-us/graph/query-parameters?tabs=http#orderby-parameter) for more info about the `$orderby` parameter.",
21
- default: "createdDateTime",
22
- optional: true,
23
- },
24
- sortOrder: {
25
- type: "string",
26
- label: "Sort Order",
27
- description: "Whether to sort the results in ascending or descending order. Default is `descending`.",
28
- options: [
29
- {
30
- label: "ascending",
31
- value: "asc",
32
- },
33
- {
34
- label: "descending",
35
- value: "desc",
36
- },
37
- ],
38
- default: "desc",
20
+ description: "Orders results. For example, `displayName desc` will sort the results by Display Name in decending order.",
21
+ default: "createdDateTime desc",
39
22
  optional: true,
40
23
  },
41
24
  maxResults: {
@@ -49,7 +32,7 @@ export default {
49
32
  const { value = [] } = await this.microsoftOutlook.listCalendarEvents({
50
33
  $,
51
34
  params: {
52
- "$orderby": `${this.orderBy} ${this.sortOrder}`,
35
+ "$orderby": this.orderBy,
53
36
  "$filter": this.filter,
54
37
  "$top": this.maxResults,
55
38
  },
@@ -0,0 +1,38 @@
1
+ export default {
2
+ parseArray(input) {
3
+ if (!input) {
4
+ return [];
5
+ }
6
+
7
+ if (typeof input === "string") {
8
+ try {
9
+ // Try to parse as JSON array first
10
+ const parsed = JSON.parse(input);
11
+ return Array.isArray(parsed)
12
+ ? parsed.map((item) => String(item))
13
+ : [
14
+ String(input),
15
+ ];
16
+ } catch {
17
+ // If JSON parsing fails, treat as single string
18
+ return [
19
+ input,
20
+ ];
21
+ }
22
+ }
23
+
24
+ if (Array.isArray(input)) {
25
+ return input.map((item) => String(item));
26
+ }
27
+
28
+ if (typeof input === "object") {
29
+ // Convert object to array of its values as strings
30
+ return Object.values(input).map((item) => String(item));
31
+ }
32
+
33
+ // For any other type, convert to string and wrap in array
34
+ return [
35
+ String(input),
36
+ ];
37
+ },
38
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/microsoft_outlook_calendar",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "Pipedream Microsoft Outlook Calendar Components",
5
5
  "main": "microsoft_outlook_calendar.app.mjs",
6
6
  "keywords": [