@pipedream/microsoft_teams 0.1.7 → 0.1.9

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.
@@ -5,7 +5,7 @@ export default {
5
5
  name: "Create Channel",
6
6
  description: "Create a new channel in Microsoft Teams. [See the docs here](https://docs.microsoft.com/en-us/graph/api/channel-post?view=graph-rest-1.0&tabs=http)",
7
7
  type: "action",
8
- version: "0.0.10",
8
+ version: "0.0.11",
9
9
  annotations: {
10
10
  destructiveHint: false,
11
11
  openWorldHint: true,
@@ -5,7 +5,7 @@ export default {
5
5
  name: "List Channels",
6
6
  description: "Lists all channels in a Microsoft Team. [See the docs here](https://docs.microsoft.com/en-us/graph/api/channel-list?view=graph-rest-1.0&tabs=http)",
7
7
  type: "action",
8
- version: "0.0.10",
8
+ version: "0.0.11",
9
9
  annotations: {
10
10
  destructiveHint: false,
11
11
  openWorldHint: true,
@@ -5,7 +5,7 @@ export default {
5
5
  name: "List Shifts",
6
6
  description: "Get the list of shift instances for a team. [See the documentation](https://learn.microsoft.com/en-us/graph/api/schedule-list-shifts?view=graph-rest-1.0&tabs=http)",
7
7
  type: "action",
8
- version: "0.0.7",
8
+ version: "0.0.8",
9
9
  annotations: {
10
10
  destructiveHint: false,
11
11
  openWorldHint: true,
@@ -5,7 +5,7 @@ export default {
5
5
  name: "Send Channel Message",
6
6
  description: "Send a message to a team's channel. [See the docs here](https://docs.microsoft.com/en-us/graph/api/channel-post-messages?view=graph-rest-1.0&tabs=http)",
7
7
  type: "action",
8
- version: "0.0.10",
8
+ version: "0.0.11",
9
9
  annotations: {
10
10
  destructiveHint: false,
11
11
  openWorldHint: true,
@@ -5,7 +5,7 @@ export default {
5
5
  name: "Send Chat Message",
6
6
  description: "Send a message to a team's chat. [See the docs here](https://docs.microsoft.com/en-us/graph/api/chat-post-messages?view=graph-rest-1.0&tabs=http)",
7
7
  type: "action",
8
- version: "0.0.10",
8
+ version: "0.0.11",
9
9
  annotations: {
10
10
  destructiveHint: false,
11
11
  openWorldHint: true,
@@ -276,7 +276,7 @@ export default {
276
276
  channelId,
277
277
  }) {
278
278
  return this.makeRequest({
279
- path: `/teams/${teamId}/channels/${channelId}/messages/delta`,
279
+ path: `/teams/${teamId}/channels/${channelId}/messages`,
280
280
  });
281
281
  },
282
282
  async listTeamMembers({ teamId }) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/microsoft_teams",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "Pipedream Microsoft Teams Components",
5
5
  "main": "microsoft_teams.app.mjs",
6
6
  "keywords": [
@@ -15,7 +15,7 @@
15
15
  },
16
16
  "dependencies": {
17
17
  "@microsoft/microsoft-graph-client": "^3.0.2",
18
- "@pipedream/platform": "^3.1.0",
18
+ "@pipedream/platform": "^3.1.1",
19
19
  "isomorphic-fetch": "^3.0.0"
20
20
  }
21
21
  }
@@ -59,21 +59,38 @@ export default {
59
59
  getResources() {
60
60
  throw new Error("getResources is not implemented");
61
61
  },
62
- },
63
- async run() {
64
- let lastDate = this._getLastDate();
65
- const tsField = this.getTsField();
62
+ async processEvents(max) {
63
+ let lastDate = this._getLastDate();
64
+ const tsField = this.getTsField();
65
+
66
+ const resources = await this.getResources(lastDate, tsField);
67
+ let items = [];
68
+ for (const resource of resources) {
69
+ const date = resource[tsField];
70
+ if (!lastDate || (date && Date.parse(date) > lastDate)) {
71
+ lastDate = Date.parse(date);
72
+ }
73
+ items.push(resource);
74
+ }
75
+
76
+ this._setLastDate(lastDate);
66
77
 
67
- const resources = await this.getResources(lastDate, tsField);
68
- for (const resource of resources) {
69
- const date = resource[tsField];
70
- if (!lastDate || (date && Date.parse(date) > lastDate)) {
71
- lastDate = Date.parse(date);
78
+ if (max) {
79
+ items = items.slice(0, max);
72
80
  }
73
- const meta = this.generateMeta(resource);
74
- this.$emit(resource, meta);
75
- }
76
81
 
77
- this._setLastDate(lastDate);
82
+ items.forEach((item) => {
83
+ const meta = this.generateMeta(item);
84
+ this.$emit(item, meta);
85
+ });
86
+ },
87
+ },
88
+ hooks: {
89
+ async deploy() {
90
+ await this.processEvents(10);
91
+ },
92
+ },
93
+ async run() {
94
+ await this.processEvents();
78
95
  },
79
96
  };
@@ -5,7 +5,7 @@ export default {
5
5
  key: "microsoft_teams-new-channel",
6
6
  name: "New Channel",
7
7
  description: "Emit new event when a new channel is created within a team. [See the documentation](https://learn.microsoft.com/en-us/graph/api/team-list-allchannels?view=graph-rest-1.0&tabs=http)",
8
- version: "0.0.12",
8
+ version: "0.0.14",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  props: {
@@ -5,7 +5,7 @@ export default {
5
5
  key: "microsoft_teams-new-channel-message",
6
6
  name: "New Channel Message",
7
7
  description: "Emit new event when a new message is posted in a channel. [See the documentation](https://learn.microsoft.com/en-us/graph/api/channel-list-messages?view=graph-rest-1.0&tabs=http)",
8
- version: "0.0.12",
8
+ version: "0.0.14",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  props: {
@@ -5,7 +5,7 @@ export default {
5
5
  key: "microsoft_teams-new-chat",
6
6
  name: "New Chat",
7
7
  description: "Emit new event when a new chat is created. [See the documentation](https://learn.microsoft.com/en-us/graph/api/chat-list?view=graph-rest-1.0&tabs=http)",
8
- version: "0.0.12",
8
+ version: "0.0.14",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  methods: {
@@ -5,7 +5,7 @@ export default {
5
5
  key: "microsoft_teams-new-chat-message",
6
6
  name: "New Chat Message",
7
7
  description: "Emit new event when a new message is received in a chat. [See the documentation](https://learn.microsoft.com/en-us/graph/api/chat-list-messages?view=graph-rest-1.0&tabs=http)",
8
- version: "0.0.12",
8
+ version: "0.0.14",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  props: {
@@ -5,7 +5,7 @@ export default {
5
5
  key: "microsoft_teams-new-team",
6
6
  name: "New Team",
7
7
  description: "Emit new event when a new team is joined by the authenticated user. [See the documentation](https://learn.microsoft.com/en-us/graph/api/user-list-joinedteams?view=graph-rest-1.0&tabs=http)",
8
- version: "0.0.12",
8
+ version: "0.0.14",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  methods: {
@@ -5,7 +5,7 @@ export default {
5
5
  key: "microsoft_teams-new-team-member",
6
6
  name: "New Team Member",
7
7
  description: "Emit new event when a new member is added to a team. [See the documentation](https://learn.microsoft.com/en-us/graph/api/team-list-members?view=graph-rest-1.0&tabs=http)",
8
- version: "0.0.12",
8
+ version: "0.0.14",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  props: {
@@ -34,12 +34,12 @@ export default {
34
34
  ts: Date.now(),
35
35
  };
36
36
  },
37
- },
38
- async run() {
39
- const resources = await this.getResources();
40
- for (const resource of resources) {
41
- const meta = this.generateMeta(resource);
42
- this.$emit(resource, meta);
43
- }
37
+ async processEvents() {
38
+ const resources = await this.getResources();
39
+ for (const resource of resources) {
40
+ const meta = this.generateMeta(resource);
41
+ this.$emit(resource, meta);
42
+ }
43
+ },
44
44
  },
45
45
  };