From 0336a73fa6f412a020c2c7eb9f04b3690d8b233b Mon Sep 17 00:00:00 2001 From: Jorge Cortes Date: Fri, 1 Aug 2025 16:51:22 -0500 Subject: [PATCH] [BUG] Microsoft Calendar using Get Busy/Free action throwing error --- .../actions/get-schedule/get-schedule.mjs | 16 +++++-- .../common/utils.mjs | 38 +++++++++++++++++ .../microsoft_outlook_calendar/package.json | 2 +- pnpm-lock.yaml | 42 +++++++------------ 4 files changed, 67 insertions(+), 31 deletions(-) create mode 100644 components/microsoft_outlook_calendar/common/utils.mjs diff --git a/components/microsoft_outlook_calendar/actions/get-schedule/get-schedule.mjs b/components/microsoft_outlook_calendar/actions/get-schedule/get-schedule.mjs index 1538441a0298b..fc9428397a1d9 100644 --- a/components/microsoft_outlook_calendar/actions/get-schedule/get-schedule.mjs +++ b/components/microsoft_outlook_calendar/actions/get-schedule/get-schedule.mjs @@ -1,16 +1,18 @@ +import { ConfigurationError } from "@pipedream/platform"; import microsoftOutlook from "../../microsoft_outlook_calendar.app.mjs"; +import utils from "../../common/utils.mjs"; export default { key: "microsoft_outlook_calendar-get-schedule", name: "Get Free/Busy Schedule", 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)", - version: "0.0.2", + version: "0.0.3", type: "action", props: { microsoftOutlook, schedules: { type: "string[]", - label: "Emails", + label: "Schedules", description: "A list of emails of users, distribution lists, or resources. For example: `[ \"adelev@contoso.com\" , \"meganb@contoso.com\" ]`", }, start: { @@ -48,10 +50,16 @@ export default { }, }, async run({ $ }) { + if (this.schedules === null || this.schedules === undefined || this.schedules?.length === 0) { + throw new ConfigurationError("The **Schedules** property is required"); + } + + const schedules = utils.parseArray(this.schedules); + const { value } = await this.getSchedule({ $, data: { - schedules: this.schedules, + schedules, startTime: { dateTime: this.start, timeZone: this.timeZone, @@ -64,7 +72,7 @@ export default { }, }); - $.export("$summary", `Successfully retrieved schedules for \`${this.schedules.join("`, `")}\``); + $.export("$summary", `Successfully retrieved schedules for \`${schedules.join("`, `")}\``); return value; }, diff --git a/components/microsoft_outlook_calendar/common/utils.mjs b/components/microsoft_outlook_calendar/common/utils.mjs new file mode 100644 index 0000000000000..3c558fbcd5bdf --- /dev/null +++ b/components/microsoft_outlook_calendar/common/utils.mjs @@ -0,0 +1,38 @@ +export default { + parseArray(input) { + if (!input) { + return []; + } + + if (typeof input === "string") { + try { + // Try to parse as JSON array first + const parsed = JSON.parse(input); + return Array.isArray(parsed) + ? parsed.map((item) => String(item)) + : [ + String(input), + ]; + } catch { + // If JSON parsing fails, treat as single string + return [ + input, + ]; + } + } + + if (Array.isArray(input)) { + return input.map((item) => String(item)); + } + + if (typeof input === "object") { + // Convert object to array of its values as strings + return Object.values(input).map((item) => String(item)); + } + + // For any other type, convert to string and wrap in array + return [ + String(input), + ]; + }, +}; diff --git a/components/microsoft_outlook_calendar/package.json b/components/microsoft_outlook_calendar/package.json index 2f8c6d0156821..3b8593bd5e0fb 100644 --- a/components/microsoft_outlook_calendar/package.json +++ b/components/microsoft_outlook_calendar/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/microsoft_outlook_calendar", - "version": "0.3.1", + "version": "0.3.2", "description": "Pipedream Microsoft Outlook Calendar Components", "main": "microsoft_outlook_calendar.app.mjs", "keywords": [ diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f72e96fb68534..3d53b621aa87a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -15275,8 +15275,7 @@ importers: specifier: ^1.1.1 version: 1.6.6 - components/workday: - specifiers: {} + components/workday: {} components/workflow_max: dependencies: @@ -16073,14 +16072,6 @@ importers: specifier: ^6.0.0 version: 6.2.0 - modelcontextprotocol/node_modules2/@modelcontextprotocol/sdk/dist/cjs: {} - - modelcontextprotocol/node_modules2/@modelcontextprotocol/sdk/dist/esm: {} - - modelcontextprotocol/node_modules2/zod-to-json-schema/dist/cjs: {} - - modelcontextprotocol/node_modules2/zod-to-json-schema/dist/esm: {} - packages/ai: dependencies: '@pipedream/sdk': @@ -17701,12 +17692,12 @@ packages: '@datadog/sketches-js@2.1.1': resolution: {integrity: sha512-d5RjycE+MObE/hU+8OM5Zp4VjTwiPLRa8299fj7muOmR16fb942z8byoMbCErnGh0lBevvgkGrLclQDvINbIyg==} - '@definitelytyped/header-parser@0.2.19': - resolution: {integrity: sha512-zu+RxQpUCgorYUQZoyyrRIn9CljL1CeM4qak3NDeMO1r7tjAkodfpAGnVzx/6JR2OUk0tAgwmZxNMSwd9LVgxw==} + '@definitelytyped/header-parser@0.2.20': + resolution: {integrity: sha512-97YPAlUo8XjWNtZ+6k+My+50/ljE2iX6KEPjOZ1Az1RsZdKwJ6taAX3F5g6SY1SJr50bzdm2RZzyQNdRmHcs4w==} engines: {node: '>=18.18.0'} - '@definitelytyped/typescript-versions@0.1.8': - resolution: {integrity: sha512-iz6q9aTwWW7CzN2g8jFQfZ955D63LA+wdIAKz4+2pCc/7kokmEHie1/jVWSczqLFOlmH+69bWQxIurryBP/sig==} + '@definitelytyped/typescript-versions@0.1.9': + resolution: {integrity: sha512-Qjalw9eNlcTjXhzx0Q6kHKuRCOUt/M5RGGRGKsiYlm/nveGvPX9liZSQlGXZVwyQ5I9qvq/GdaWiPchQ+ZXOrQ==} engines: {node: '>=18.18.0'} '@definitelytyped/utils@0.1.8': @@ -29697,6 +29688,7 @@ packages: source-map@0.8.0-beta.0: resolution: {integrity: sha512-2ymg6oRBpebeZi9UUNsgQ89bhx01TcTkmNTGnNO88imTmbSgy4nfujrgVEFKWpMTEGA11EDkTt7mqObTPdigIA==} engines: {node: '>= 8'} + deprecated: The work that was done in this beta branch won't be included in future versions space-separated-tokens@2.0.2: resolution: {integrity: sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==} @@ -30062,22 +30054,22 @@ packages: superagent@3.8.1: resolution: {integrity: sha512-VMBFLYgFuRdfeNQSMLbxGSLfmXL/xc+OO+BZp41Za/NRDBet/BNbkRJrYzCUu0u4GU0i/ml2dtT8b9qgkw9z6Q==} engines: {node: '>= 4.0'} - deprecated: Please upgrade to superagent v10.2.2+, see release notes at https://github.com/forwardemail/superagent/releases/tag/v10.2.2 - maintenance is supported by Forward Email @ https://forwardemail.net + deprecated: Please upgrade to v9.0.0+ as we have fixed a public vulnerability with formidable dependency. Note that v9.0.0+ requires Node.js v14.18.0+. See https://github.com/ladjs/superagent/pull/1800 for insight. This project is supported and maintained by the team at Forward Email @ https://forwardemail.net superagent@4.1.0: resolution: {integrity: sha512-FT3QLMasz0YyCd4uIi5HNe+3t/onxMyEho7C3PSqmti3Twgy2rXT4fmkTz6wRL6bTF4uzPcfkUCa8u4JWHw8Ag==} engines: {node: '>= 6.0'} - deprecated: Please upgrade to superagent v10.2.2+, see release notes at https://github.com/forwardemail/superagent/releases/tag/v10.2.2 - maintenance is supported by Forward Email @ https://forwardemail.net + deprecated: Please upgrade to v9.0.0+ as we have fixed a public vulnerability with formidable dependency. Note that v9.0.0+ requires Node.js v14.18.0+. See https://github.com/ladjs/superagent/pull/1800 for insight. This project is supported and maintained by the team at Forward Email @ https://forwardemail.net superagent@5.3.1: resolution: {integrity: sha512-wjJ/MoTid2/RuGCOFtlacyGNxN9QLMgcpYLDQlWFIhhdJ93kNscFonGvrpAHSCVjRVj++DGCglocF7Aej1KHvQ==} engines: {node: '>= 7.0.0'} - deprecated: Please upgrade to superagent v10.2.2+, see release notes at https://github.com/forwardemail/superagent/releases/tag/v10.2.2 - maintenance is supported by Forward Email @ https://forwardemail.net + deprecated: Please upgrade to v9.0.0+ as we have fixed a public vulnerability with formidable dependency. Note that v9.0.0+ requires Node.js v14.18.0+. See https://github.com/ladjs/superagent/pull/1800 for insight. This project is supported and maintained by the team at Forward Email @ https://forwardemail.net superagent@7.1.6: resolution: {integrity: sha512-gZkVCQR1gy/oUXr+kxJMLDjla434KmSOKbx5iGD30Ql+AkJQ/YlPKECJy2nhqOsHLjGHzoDTXNSjhnvWhzKk7g==} engines: {node: '>=6.4.0 <13 || >=14'} - deprecated: Please upgrade to superagent v10.2.2+, see release notes at https://github.com/forwardemail/superagent/releases/tag/v10.2.2 - maintenance is supported by Forward Email @ https://forwardemail.net + deprecated: Please upgrade to v9.0.0+ as we have fixed a public vulnerability with formidable dependency. Note that v9.0.0+ requires Node.js v14.18.0+. See https://github.com/ladjs/superagent/pull/1800 for insight. This project is supported and maintained by the team at Forward Email @ https://forwardemail.net supports-color@2.0.0: resolution: {integrity: sha512-KKNVtd6pCYgPIKU4cp2733HWYCpplQhddZLBUryaAHou723x+FRzQ5Df824Fj+IyyuiQTRoub4SnIFfIcrp70g==} @@ -34932,13 +34924,13 @@ snapshots: '@datadog/sketches-js@2.1.1': {} - '@definitelytyped/header-parser@0.2.19': + '@definitelytyped/header-parser@0.2.20': dependencies: - '@definitelytyped/typescript-versions': 0.1.8 + '@definitelytyped/typescript-versions': 0.1.9 '@definitelytyped/utils': 0.1.8 semver: 7.7.2 - '@definitelytyped/typescript-versions@0.1.8': {} + '@definitelytyped/typescript-versions@0.1.9': {} '@definitelytyped/utils@0.1.8': dependencies: @@ -37402,8 +37394,6 @@ snapshots: '@putout/operator-filesystem': 5.0.0(putout@36.13.1(eslint@8.57.1)(typescript@5.6.3)) '@putout/operator-json': 2.2.0 putout: 36.13.1(eslint@8.57.1)(typescript@5.6.3) - transitivePeerDependencies: - - supports-color '@putout/operator-regexp@1.0.0(putout@36.13.1(eslint@8.57.1)(typescript@5.6.3))': dependencies: @@ -42301,7 +42291,7 @@ snapshots: dts-critic@3.3.11(typescript@5.7.2): dependencies: - '@definitelytyped/header-parser': 0.2.19 + '@definitelytyped/header-parser': 0.2.20 command-exists: 1.2.9 rimraf: 3.0.2 semver: 6.3.1 @@ -42313,8 +42303,8 @@ snapshots: dtslint@4.2.1(typescript@5.7.2): dependencies: - '@definitelytyped/header-parser': 0.2.19 - '@definitelytyped/typescript-versions': 0.1.8 + '@definitelytyped/header-parser': 0.2.20 + '@definitelytyped/typescript-versions': 0.1.9 '@definitelytyped/utils': 0.1.8 dts-critic: 3.3.11(typescript@5.7.2) fs-extra: 6.0.1