@pipedream/microsoft_outlook_calendar 0.6.0 → 0.7.0

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.
@@ -3,7 +3,7 @@ import microsoftOutlook from "../../microsoft_outlook_calendar.app.mjs";
3
3
  export default {
4
4
  type: "action",
5
5
  key: "microsoft_outlook_calendar-create-calendar-event",
6
- version: "0.0.10",
6
+ version: "0.0.12",
7
7
  annotations: {
8
8
  destructiveHint: false,
9
9
  openWorldHint: true,
@@ -3,7 +3,7 @@ import microsoftOutlook from "../../microsoft_outlook_calendar.app.mjs";
3
3
  export default {
4
4
  type: "action",
5
5
  key: "microsoft_outlook_calendar-delete-calendar-event",
6
- version: "0.0.5",
6
+ version: "0.0.7",
7
7
  annotations: {
8
8
  destructiveHint: true,
9
9
  openWorldHint: true,
@@ -4,7 +4,7 @@ import { ConfigurationError } from "@pipedream/platform";
4
4
  export default {
5
5
  type: "action",
6
6
  key: "microsoft_outlook_calendar-delete-recurring-event-instance",
7
- version: "0.0.2",
7
+ version: "0.0.4",
8
8
  annotations: {
9
9
  destructiveHint: true,
10
10
  openWorldHint: true,
@@ -8,7 +8,7 @@ export default {
8
8
  key: "microsoft_outlook_calendar-get-schedule",
9
9
  name: "Get Free/Busy Schedule",
10
10
  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)",
11
- version: "0.0.7",
11
+ version: "0.0.9",
12
12
  annotations: {
13
13
  destructiveHint: false,
14
14
  openWorldHint: true,
@@ -48,13 +48,6 @@ export default {
48
48
  },
49
49
  },
50
50
  methods: {
51
- getSchedule(opts = {}) {
52
- return this.microsoftOutlook._makeRequest({
53
- method: "POST",
54
- path: "/me/calendar/getSchedule",
55
- ...opts,
56
- });
57
- },
58
51
  convertWorkingHoursToItemTimezone(response) {
59
52
  const workingHours = response?.workingHours;
60
53
 
@@ -93,8 +86,8 @@ export default {
93
86
 
94
87
  const schedules = utils.parseArray(this.schedules);
95
88
 
96
- const { value } = await this.getSchedule({
97
- $,
89
+ const { value } = await this.microsoftOutlook.getSchedule({
90
+ timeZone: this.timeZone,
98
91
  data: {
99
92
  schedules,
100
93
  startTime: {
@@ -107,9 +100,6 @@ export default {
107
100
  },
108
101
  availabilityViewInterval: this.availabilityViewInterval,
109
102
  },
110
- headers: {
111
- Prefer: `outlook.timezone="${this.timeZone}"`,
112
- },
113
103
  });
114
104
 
115
105
  if (value?.length > 0 && value[0].workingHours) {
@@ -4,7 +4,7 @@ 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.6",
7
+ version: "0.0.8",
8
8
  annotations: {
9
9
  destructiveHint: false,
10
10
  openWorldHint: true,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "microsoft_outlook_calendar-search-contacts",
5
5
  name: "Search Contacts",
6
6
  description: "Search for contacts by name from your saved contacts list and retrieve their email addresses. [See the documentation](https://learn.microsoft.com/en-us/graph/api/user-list-contacts)",
7
- version: "0.0.1",
7
+ version: "0.0.3",
8
8
  type: "action",
9
9
  annotations: {
10
10
  destructiveHint: false,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "microsoft_outlook_calendar-search-people",
5
5
  name: "Search People",
6
6
  description: "Retrieve a collection of person objects ordered by their relevance to the user, based on communication and collaboration patterns and business relationships. [See the documentation](https://learn.microsoft.com/en-us/graph/api/user-list-people)",
7
- version: "0.0.1",
7
+ version: "0.0.3",
8
8
  type: "action",
9
9
  annotations: {
10
10
  destructiveHint: false,
@@ -3,7 +3,7 @@ import microsoftOutlook from "../../microsoft_outlook_calendar.app.mjs";
3
3
  export default {
4
4
  type: "action",
5
5
  key: "microsoft_outlook_calendar-update-calendar-event",
6
- version: "0.0.5",
6
+ version: "0.0.7",
7
7
  annotations: {
8
8
  destructiveHint: true,
9
9
  openWorldHint: true,
@@ -4,7 +4,7 @@ import { ConfigurationError } from "@pipedream/platform";
4
4
  export default {
5
5
  type: "action",
6
6
  key: "microsoft_outlook_calendar-update-recurring-event-instance",
7
- version: "0.0.2",
7
+ version: "0.0.4",
8
8
  annotations: {
9
9
  destructiveHint: false,
10
10
  openWorldHint: true,
@@ -1,4 +1,6 @@
1
- import { axios } from "@pipedream/platform";
1
+ import { Client } from "@microsoft/microsoft-graph-client";
2
+ import "isomorphic-fetch";
3
+ import pickBy from "lodash.pickby";
2
4
 
3
5
  export default {
4
6
  type: "app",
@@ -120,135 +122,85 @@ export default {
120
122
  },
121
123
  },
122
124
  methods: {
123
- _getUrl(path) {
124
- return `https://graph.microsoft.com/v1.0${path}`;
125
- },
126
- _getHeaders(headers = {}) {
127
- return {
128
- "Authorization": `Bearer ${this.$auth.oauth_access_token}`,
129
- "accept": "application/json",
130
- "Content-Type": "application/json",
131
- ...headers,
132
- };
133
- },
134
- async _makeRequest({
135
- $,
136
- path,
137
- headers,
138
- ...otherConfig
139
- } = {}) {
140
- const config = {
141
- url: this._getUrl(path),
142
- headers: this._getHeaders(headers),
143
- ...otherConfig,
144
- };
145
- return axios($ ?? this, config);
146
- },
147
- async createHook(args = {}) {
148
- const response = await this._makeRequest({
149
- method: "POST",
150
- path: "/subscriptions",
151
- ...args,
125
+ client() {
126
+ return Client.init({
127
+ authProvider: (done) => {
128
+ done(null, this.$auth.oauth_access_token);
129
+ },
152
130
  });
153
- return response;
131
+ },
132
+ async createHook({ data = {} } = {}) {
133
+ return await this.client().api("/subscriptions")
134
+ .post(data);
154
135
  },
155
136
  async renewHook({
156
- hookId,
157
- ...args
137
+ hookId, data = {},
158
138
  } = {}) {
159
- return this._makeRequest({
160
- method: "PATCH",
161
- path: `/subscriptions/${hookId}`,
162
- ...args,
163
- });
139
+ return await this.client().api(`/subscriptions/${hookId}`)
140
+ .patch(data);
164
141
  },
165
- async deleteHook({
166
- hookId,
167
- ...args
168
- } = {}) {
169
- return this._makeRequest({
170
- method: "DELETE",
171
- path: `/subscriptions/${hookId}`,
172
- ...args,
173
- });
142
+ async deleteHook({ hookId } = {}) {
143
+ return await this.client().api(`/subscriptions/${hookId}`)
144
+ .delete();
174
145
  },
175
146
  async getSupportedTimeZones() {
176
- return this._makeRequest({
177
- method: "GET",
178
- path: "/me/outlook/supportedTimeZones",
179
- });
147
+ return await this.client().api("/me/outlook/supportedTimeZones")
148
+ .get();
180
149
  },
181
- async createCalendarEvent(args = {}) {
182
- return this._makeRequest({
183
- method: "POST",
184
- path: "/me/events",
185
- ...args,
186
- });
150
+ async createCalendarEvent({ data = {} } = {}) {
151
+ return await this.client().api("/me/events")
152
+ .post(data);
187
153
  },
188
154
  async updateCalendarEvent({
189
- eventId, ...args
190
- }) {
191
- return this._makeRequest({
192
- method: "PATCH",
193
- path: `/me/events/${eventId}`,
194
- ...args,
195
- });
155
+ eventId, data = {},
156
+ } = {}) {
157
+ return await this.client().api(`/me/events/${eventId}`)
158
+ .patch(data);
196
159
  },
197
- async deleteCalendarEvent({
198
- eventId, ...args
199
- }) {
200
- return this._makeRequest({
201
- method: "DELETE",
202
- path: `/me/events/${eventId}`,
203
- ...args,
204
- });
160
+ async deleteCalendarEvent({ eventId } = {}) {
161
+ return await this.client().api(`/me/events/${eventId}`)
162
+ .delete();
205
163
  },
206
- async listCalendarEvents(args = {}) {
207
- return this._makeRequest({
208
- method: "GET",
209
- path: "/me/events",
210
- ...args,
211
- });
164
+ async listCalendarEvents({ params = {} } = {}) {
165
+ return await this.client().api("/me/events")
166
+ .query(pickBy(params))
167
+ .get();
212
168
  },
213
169
  async getCalendarEvent({
214
- eventId,
215
- ...args
170
+ eventId, params = {},
216
171
  } = {}) {
217
- return this._makeRequest({
218
- method: "GET",
219
- path: `/me/events/${eventId}`,
220
- ...args,
221
- });
172
+ return await this.client().api(`/me/events/${eventId}`)
173
+ .query(pickBy(params))
174
+ .get();
222
175
  },
223
- async listCalendarView(args = {}) {
224
- return this._makeRequest({
225
- method: "GET",
226
- path: "/me/calendar/calendarView",
227
- ...args,
228
- });
176
+ async listCalendarView({ params = {} } = {}) {
177
+ return await this.client().api("/me/calendar/calendarView")
178
+ .query(pickBy(params))
179
+ .get();
229
180
  },
230
181
  async listEventInstances({
231
- eventId, ...args
232
- }) {
233
- return this._makeRequest({
234
- method: "GET",
235
- path: `/me/events/${eventId}/instances`,
236
- ...args,
237
- });
238
- },
239
- async listContacts(args = {}) {
240
- return this._makeRequest({
241
- method: "GET",
242
- path: "/me/contacts",
243
- ...args,
244
- });
245
- },
246
- async listPeople(args = {}) {
247
- return this._makeRequest({
248
- method: "GET",
249
- path: "/me/people",
250
- ...args,
251
- });
182
+ eventId, params = {},
183
+ } = {}) {
184
+ return await this.client().api(`/me/events/${eventId}/instances`)
185
+ .query(pickBy(params))
186
+ .get();
187
+ },
188
+ async listContacts({ params = {} } = {}) {
189
+ return await this.client().api("/me/contacts")
190
+ .query(pickBy(params))
191
+ .get();
192
+ },
193
+ async listPeople({ params = {} } = {}) {
194
+ return await this.client().api("/me/people")
195
+ .query(pickBy(params))
196
+ .get();
197
+ },
198
+ async getSchedule({
199
+ timeZone, data = {},
200
+ } = {}) {
201
+ return await this.client().api("/me/calendar/getSchedule")
202
+ .header("Prefer", `outlook.timezone="${timeZone}"`)
203
+ .post(data);
252
204
  },
253
205
  },
254
206
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/microsoft_outlook_calendar",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "Pipedream Microsoft Outlook Calendar Components",
5
5
  "main": "microsoft_outlook_calendar.app.mjs",
6
6
  "keywords": [
@@ -15,9 +15,12 @@
15
15
  "access": "public"
16
16
  },
17
17
  "dependencies": {
18
+ "@microsoft/microsoft-graph-client": "^3.0.7",
18
19
  "@pipedream/microsoft_outlook": "^1.7.3",
19
20
  "@pipedream/pipedream": "^0.4.2",
20
21
  "@pipedream/platform": "^3.1.1",
22
+ "isomorphic-fetch": "^3.0.0",
23
+ "lodash.pickby": "^4.6.0",
21
24
  "luxon": "^3.7.2",
22
25
  "windows-iana": "^5.1.0"
23
26
  }
@@ -5,7 +5,7 @@ export default {
5
5
  key: "microsoft_outlook_calendar-new-calendar-event",
6
6
  name: "New Calendar Event (Instant)",
7
7
  description: "Emit new event when a new Calendar event is created",
8
- version: "0.0.10",
8
+ version: "0.0.12",
9
9
  type: "source",
10
10
  hooks: {
11
11
  ...common.hooks,
@@ -6,7 +6,7 @@ export default {
6
6
  key: "microsoft_outlook_calendar-new-upcoming-event",
7
7
  name: "New Upcoming Calendar Event",
8
8
  description: "Emit new event when a Calendar event is upcoming, this source is using `reminderMinutesBeforeStart` property of the event to determine the time it should emit.",
9
- version: "0.0.6",
9
+ version: "0.0.8",
10
10
  type: "source",
11
11
  props: {
12
12
  ...common.props,
@@ -5,7 +5,7 @@ export default {
5
5
  key: "microsoft_outlook_calendar-new-upcoming-event-polling",
6
6
  name: "New Upcoming Calendar Event (Polling)",
7
7
  description: "Emit new event based on a time interval before an upcoming calendar event. [See the documentation](https://docs.microsoft.com/en-us/graph/api/user-list-events)",
8
- version: "0.0.2",
8
+ version: "0.0.4",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  props: {
@@ -5,7 +5,7 @@ export default {
5
5
  key: "microsoft_outlook_calendar-updated-calendar-event",
6
6
  name: "New Calendar Event Update (Instant)",
7
7
  description: "Emit new event when a Calendar event is updated",
8
- version: "0.0.10",
8
+ version: "0.0.12",
9
9
  type: "source",
10
10
  hooks: {
11
11
  ...common.hooks,