@pipedream/microsoft_teams 0.1.8 → 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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/microsoft_teams",
3
- "version": "0.1.8",
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.13",
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.13",
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.13",
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.13",
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.13",
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.13",
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
  };