@pipedream/microsoft_teams 0.0.3

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/LICENSE ADDED
@@ -0,0 +1,7 @@
1
+ Copyright 2020 Pipedream, Inc.
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,50 @@
1
+ import microsoftTeams from "../../microsoft_teams.app.mjs";
2
+
3
+ export default {
4
+ key: "microsoft_teams-create-channel",
5
+ name: "Create Channel",
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
+ type: "action",
8
+ version: "0.0.1",
9
+ props: {
10
+ microsoftTeams,
11
+ teamId: {
12
+ propDefinition: [
13
+ microsoftTeams,
14
+ "team",
15
+ ],
16
+ },
17
+ displayName: {
18
+ propDefinition: [
19
+ microsoftTeams,
20
+ "channelDisplayName",
21
+ ],
22
+ },
23
+ description: {
24
+ propDefinition: [
25
+ microsoftTeams,
26
+ "channelDescription",
27
+ ],
28
+ },
29
+ },
30
+ async run({ $ }) {
31
+ const {
32
+ teamId,
33
+ displayName,
34
+ description,
35
+ } = this;
36
+
37
+ const response =
38
+ await this.microsoftTeams.createChannel({
39
+ teamId,
40
+ content: {
41
+ displayName,
42
+ description,
43
+ },
44
+ });
45
+
46
+ $.export("$summary", `Successfully created channel ${displayName}`);
47
+
48
+ return response;
49
+ },
50
+ };
@@ -0,0 +1,34 @@
1
+ import microsoftTeams from "../../microsoft_teams.app.mjs";
2
+
3
+ export default {
4
+ key: "microsoft_teams-list-channels",
5
+ name: "List Channels",
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
+ type: "action",
8
+ version: "0.0.1",
9
+ props: {
10
+ microsoftTeams,
11
+ teamId: {
12
+ propDefinition: [
13
+ microsoftTeams,
14
+ "team",
15
+ ],
16
+ },
17
+ },
18
+ async run({ $ }) {
19
+ const channels = [];
20
+ const paginator = this.microsoftTeams.paginate(this.microsoftTeams.listChannels, {
21
+ teamId: this.teamId,
22
+ });
23
+
24
+ for await (const channel of paginator) {
25
+ channels.push(channel);
26
+ }
27
+
28
+ $.export("$summary", `Successfully fetched ${channels?.length} ${channels?.length === 1
29
+ ? "channel"
30
+ : "channels"}`);
31
+
32
+ return channels;
33
+ },
34
+ };
@@ -0,0 +1,55 @@
1
+ import microsoftTeams from "../../microsoft_teams.app.mjs";
2
+
3
+ export default {
4
+ key: "microsoft_teams-send-channel-message",
5
+ name: "Send Channel Message",
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
+ type: "action",
8
+ version: "0.0.1",
9
+ props: {
10
+ microsoftTeams,
11
+ teamId: {
12
+ propDefinition: [
13
+ microsoftTeams,
14
+ "team",
15
+ ],
16
+ },
17
+ channelId: {
18
+ propDefinition: [
19
+ microsoftTeams,
20
+ "channel",
21
+ ({ teamId }) => ({
22
+ teamId,
23
+ }),
24
+ ],
25
+ },
26
+ message: {
27
+ propDefinition: [
28
+ microsoftTeams,
29
+ "message",
30
+ ],
31
+ },
32
+ },
33
+ async run({ $ }) {
34
+ const {
35
+ teamId,
36
+ channelId,
37
+ message,
38
+ } = this;
39
+
40
+ const response =
41
+ await this.microsoftTeams.sendChannelMessage({
42
+ teamId,
43
+ channelId,
44
+ content: {
45
+ body: {
46
+ content: message,
47
+ },
48
+ },
49
+ });
50
+
51
+ $.export("$summary", `Successfully sent message to channel ${channelId}`);
52
+
53
+ return response;
54
+ },
55
+ };
@@ -0,0 +1,44 @@
1
+ import microsoftTeams from "../../microsoft_teams.app.mjs";
2
+
3
+ export default {
4
+ key: "microsoft_teams-send-chat-message",
5
+ name: "Send Chat Message",
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
+ type: "action",
8
+ version: "0.0.1",
9
+ props: {
10
+ microsoftTeams,
11
+ chatId: {
12
+ propDefinition: [
13
+ microsoftTeams,
14
+ "chat",
15
+ ],
16
+ },
17
+ message: {
18
+ propDefinition: [
19
+ microsoftTeams,
20
+ "message",
21
+ ],
22
+ },
23
+ },
24
+ async run({ $ }) {
25
+ const {
26
+ chatId,
27
+ message,
28
+ } = this;
29
+
30
+ const response =
31
+ await this.microsoftTeams.sendChatMessage({
32
+ chatId,
33
+ content: {
34
+ body: {
35
+ content: message,
36
+ },
37
+ },
38
+ });
39
+
40
+ $.export("$summary", `Successfully sent message to chat ${chatId}`);
41
+
42
+ return response;
43
+ },
44
+ };
@@ -0,0 +1,7 @@
1
+ const DEFAULT_METHOD = "get";
2
+ const ORDER_BY_CREATED_DESC = "orderby=createdDateTime%20desc";
3
+
4
+ export default {
5
+ DEFAULT_METHOD,
6
+ ORDER_BY_CREATED_DESC,
7
+ };
@@ -0,0 +1,230 @@
1
+ import "isomorphic-fetch";
2
+ import { Client } from "@microsoft/microsoft-graph-client";
3
+ import constants from "./common/constants.mjs";
4
+
5
+ export default {
6
+ type: "app",
7
+ app: "microsoft_teams",
8
+ propDefinitions: {
9
+ team: {
10
+ type: "string",
11
+ label: "Team",
12
+ description: "Microsoft Team",
13
+ async options({ prevContext }) {
14
+ const response = prevContext.nextLink
15
+ ? await this.makeRequest({
16
+ path: prevContext.nextLink,
17
+ })
18
+ : await this.listTeams();
19
+ const options = response.value.map((team) => ({
20
+ label: team.displayName,
21
+ value: team.id,
22
+ }));
23
+ return {
24
+ options,
25
+ context: {
26
+ nextLink: response["@odata.nextLink"],
27
+ },
28
+ };
29
+ },
30
+ },
31
+ channel: {
32
+ type: "string",
33
+ label: "Channel",
34
+ description: "Team Channel",
35
+ async options({
36
+ teamId, prevContext,
37
+ }) {
38
+ const response = prevContext.nextLink
39
+ ? await this.makeRequest({
40
+ path: prevContext.nextLink,
41
+ })
42
+ : await this.listChannels({
43
+ teamId,
44
+ });
45
+ const options = response.value.map((channel) => ({
46
+ label: channel.displayName,
47
+ value: channel.id,
48
+ }));
49
+ return {
50
+ options,
51
+ context: {
52
+ nextLink: response["@odata.nextLink"],
53
+ },
54
+ };
55
+ },
56
+ },
57
+ chat: {
58
+ type: "string",
59
+ label: "Chat",
60
+ description: "Team Chat within the organization (No external Contacts)",
61
+ async options({ prevContext }) {
62
+ const response = prevContext.nextLink
63
+ ? await this.makeRequest({
64
+ path: prevContext.nextLink,
65
+ })
66
+ : await this.listChats();
67
+ const options = [];
68
+ for (const chat of response.value) {
69
+ const members = chat.members.map((member) => member.displayName);
70
+ options.push({
71
+ label: members.join(", "),
72
+ value: chat.id,
73
+ });
74
+ }
75
+ return {
76
+ options,
77
+ context: {
78
+ nextLink: response["@odata.nextLink"],
79
+ },
80
+ };
81
+ },
82
+ },
83
+ channelDisplayName: {
84
+ type: "string",
85
+ label: "Display Name",
86
+ description: "Display name of the channel",
87
+ },
88
+ channelDescription: {
89
+ type: "string",
90
+ label: "Description",
91
+ description: "Description of the channel",
92
+ },
93
+ message: {
94
+ type: "string",
95
+ label: "Message",
96
+ description: "Message to be sent",
97
+ },
98
+ max: {
99
+ type: "integer",
100
+ label: "Max",
101
+ description: "Maximum number of items to return",
102
+ optional: true,
103
+ default: 20,
104
+ },
105
+ },
106
+ methods: {
107
+ _accessToken() {
108
+ return this.$auth.oauth_access_token;
109
+ },
110
+ client() {
111
+ return new Client.initWithMiddleware({
112
+ authProvider: {
113
+ getAccessToken: () => Promise.resolve(this._accessToken()),
114
+ },
115
+ });
116
+ },
117
+ async makeRequest({
118
+ method, path, params = {}, content,
119
+ }) {
120
+ const api = this.client().api(path);
121
+
122
+ const builtParams = {
123
+ ...params,
124
+ [method || constants.DEFAULT_METHOD]: content,
125
+ };
126
+ return Object.entries(builtParams)
127
+ .reduce((reduction, param) => {
128
+ const [
129
+ methodName,
130
+ args,
131
+ ] = param;
132
+ const methodArgs = Array.isArray(args)
133
+ ? args
134
+ : [
135
+ args,
136
+ ];
137
+ return methodName
138
+ ? reduction[methodName](...methodArgs)
139
+ : reduction;
140
+ }, api);
141
+ },
142
+ async authenticatedUserId() {
143
+ const { id } = await this.client()
144
+ .api("/me")
145
+ .get();
146
+ return id;
147
+ },
148
+ async listTeams() {
149
+ const id = await this.authenticatedUserId();
150
+ return this.makeRequest({
151
+ path: `/users/${id}/joinedTeams?${constants.ORDER_BY_CREATED_DESC}`,
152
+ });
153
+ },
154
+ async listChannels({ teamId }) {
155
+ return this.makeRequest({
156
+ path: `/teams/${teamId}/channels?${constants.ORDER_BY_CREATED_DESC}`,
157
+ });
158
+ },
159
+ async listChats() {
160
+ return this.makeRequest({
161
+ path: `/chats?$expand=members&${constants.ORDER_BY_CREATED_DESC}`,
162
+ });
163
+ },
164
+ async createChannel({
165
+ teamId, content,
166
+ }) {
167
+ return this.makeRequest({
168
+ method: "post",
169
+ path: `/teams/${teamId}/channels`,
170
+ content,
171
+ });
172
+ },
173
+ async sendChannelMessage({
174
+ teamId, channelId, content,
175
+ }) {
176
+ return this.makeRequest({
177
+ method: "post",
178
+ path: `/teams/${teamId}/channels/${channelId}/messages`,
179
+ content,
180
+ });
181
+ },
182
+ async sendChatMessage({
183
+ chatId, content,
184
+ }) {
185
+ return this.makeRequest({
186
+ method: "post",
187
+ path: `/chats/${chatId}/messages`,
188
+ content,
189
+ });
190
+ },
191
+ async *paginate(fn, params) {
192
+ let nextLink;
193
+ do {
194
+ const response = nextLink
195
+ ? await this.makeRequest({
196
+ path: nextLink,
197
+ })
198
+ : await fn(params);
199
+
200
+ for (const value of response.value) {
201
+ yield value;
202
+ }
203
+
204
+ nextLink = response["@odata.nextLink"];
205
+ } while (nextLink);
206
+ },
207
+ async clientApiGetRequest(endpoint) {
208
+ return this.client()
209
+ .api(endpoint)
210
+ .get();
211
+ },
212
+ async listChannelMessages({
213
+ teamId, channelId,
214
+ }) {
215
+ return this.makeRequest({
216
+ path: `/teams/${teamId}/channels/${channelId}/messages/delta?${constants.ORDER_BY_CREATED_DESC}`,
217
+ });
218
+ },
219
+ async listTeamMembers({ teamId }) {
220
+ return this.makeRequest({
221
+ path: `/teams/${teamId}/members`,
222
+ });
223
+ },
224
+ async listChatMessages({ chatId }) {
225
+ return this.makeRequest({
226
+ path: `/chats/${chatId}/messages?${constants.ORDER_BY_CREATED_DESC}`,
227
+ });
228
+ },
229
+ },
230
+ };
package/package.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "@pipedream/microsoft_teams",
3
+ "version": "0.0.3",
4
+ "description": "Pipedream Microsoft Teams Components",
5
+ "main": "microsoft_teams.app.mjs",
6
+ "keywords": [
7
+ "pipedream",
8
+ "microsoft_teams",
9
+ "microsoft",
10
+ "teams"
11
+ ],
12
+ "homepage": "https://pipedream.com/apps/microsoft_teams",
13
+ "license": "MIT",
14
+ "publishConfig": {
15
+ "access": "public"
16
+ },
17
+ "dependencies": {
18
+ "@microsoft/microsoft-graph-client": "^3.0.2",
19
+ "isomorphic-fetch": "^3.0.0"
20
+ }
21
+ }
@@ -0,0 +1,77 @@
1
+ import microsoftTeams from "../../microsoft_teams.app.mjs";
2
+
3
+ export default {
4
+ props: {
5
+ microsoftTeams,
6
+ db: "$.service.db",
7
+ timer: {
8
+ label: "Polling interval",
9
+ description: "Pipedream will poll the YouTube API on this schedule",
10
+ type: "$.interface.timer",
11
+ default: {
12
+ intervalSeconds: 60 * 15, // every 15 minutes
13
+ },
14
+ },
15
+ },
16
+ methods: {
17
+ _getLastCreated() {
18
+ return this.db.get("lastCreated");
19
+ },
20
+ _setLastCreated(lastCreated) {
21
+ this.db.set("lastCreated", lastCreated);
22
+ },
23
+ isNew(resource, lastCreated) {
24
+ if (!resource.createdDateTime || !lastCreated) {
25
+ return true;
26
+ }
27
+ return Date.parse(resource.createdDateTime) > lastCreated;
28
+ },
29
+ async getNewPaginatedResources(fn, params, max, lastCreated) {
30
+ const resources = [];
31
+ const paginator = this.paginate(fn, params);
32
+
33
+ for await (const resource of paginator) {
34
+ const isNewResource = this.isNew(resource, lastCreated);
35
+ if (isNewResource) {
36
+ resources.push(resource);
37
+ }
38
+ if (!isNewResource || resources.length >= max) {
39
+ break;
40
+ }
41
+ }
42
+ return resources;
43
+ },
44
+ async *paginate(fn, params) {
45
+ let nextLink;
46
+ do {
47
+ const response = nextLink
48
+ ? await this.microsoftTeams.clientApiGetRequest(nextLink)
49
+ : await fn(params);
50
+
51
+ for (const value of response.value) {
52
+ yield value;
53
+ }
54
+
55
+ nextLink = response["@odata.nextLink"];
56
+ } while (nextLink);
57
+ },
58
+ getResources() {
59
+ throw new Error("getResources is not implemented");
60
+ },
61
+ },
62
+ async run() {
63
+ let lastCreated = Date.parse(this._getLastCreated());
64
+
65
+ const resources = await this.getResources(lastCreated);
66
+ for (const resource of resources) {
67
+ const { createdDateTime } = resource;
68
+ if (!lastCreated || (createdDateTime && Date.parse(createdDateTime) > lastCreated)) {
69
+ lastCreated = Date.parse(createdDateTime);
70
+ }
71
+ const meta = this.generateMeta(resource);
72
+ this.$emit(resource, meta);
73
+ }
74
+
75
+ this._setLastCreated(lastCreated);
76
+ },
77
+ };
@@ -0,0 +1,46 @@
1
+ import base from "../common/base.mjs";
2
+
3
+ export default {
4
+ ...base,
5
+ key: "microsoft_teams-new-channel",
6
+ name: "New Channel",
7
+ description: "Emit new event when a new channel is created within a team",
8
+ version: "0.0.1",
9
+ type: "source",
10
+ dedupe: "unique",
11
+ props: {
12
+ ...base.props,
13
+ team: {
14
+ propDefinition: [
15
+ base.props.microsoftTeams,
16
+ "team",
17
+ ],
18
+ },
19
+ max: {
20
+ propDefinition: [
21
+ base.props.microsoftTeams,
22
+ "max",
23
+ ],
24
+ },
25
+ },
26
+ methods: {
27
+ ...base.methods,
28
+ async getResources(lastCreated) {
29
+ return this.getNewPaginatedResources(
30
+ this.microsoftTeams.listChannels,
31
+ {
32
+ teamId: this.team,
33
+ },
34
+ this.max,
35
+ lastCreated,
36
+ );
37
+ },
38
+ generateMeta(channel) {
39
+ return {
40
+ id: channel.id,
41
+ summary: channel.displayName,
42
+ ts: Date.parse(channel.createdDateTime),
43
+ };
44
+ },
45
+ },
46
+ };
@@ -0,0 +1,56 @@
1
+ import base from "../common/base.mjs";
2
+
3
+ export default {
4
+ ...base,
5
+ key: "microsoft_teams-new-channel-message",
6
+ name: "New Channel Message",
7
+ description: "Emit new event when a new message is posted in a channel",
8
+ version: "0.0.1",
9
+ type: "source",
10
+ dedupe: "unique",
11
+ props: {
12
+ ...base.props,
13
+ team: {
14
+ propDefinition: [
15
+ base.props.microsoftTeams,
16
+ "team",
17
+ ],
18
+ },
19
+ channel: {
20
+ propDefinition: [
21
+ base.props.microsoftTeams,
22
+ "channel",
23
+ (c) => ({
24
+ teamId: c.team,
25
+ }),
26
+ ],
27
+ },
28
+ max: {
29
+ propDefinition: [
30
+ base.props.microsoftTeams,
31
+ "max",
32
+ ],
33
+ },
34
+ },
35
+ methods: {
36
+ ...base.methods,
37
+ async getResources(lastCreated) {
38
+ return this.getNewPaginatedResources(
39
+ this.microsoftTeams.listChannelMessages,
40
+ {
41
+ teamId: this.team,
42
+ channelId: this.channel,
43
+ },
44
+ this.max,
45
+ lastCreated,
46
+ );
47
+ },
48
+ generateMeta(message) {
49
+ return {
50
+ id: message.id,
51
+ summary: `New Message ${message.id}`,
52
+ ts: Date.parse(message.createdDateTime),
53
+ };
54
+ },
55
+ },
56
+ };
@@ -0,0 +1,38 @@
1
+ import base from "../common/base.mjs";
2
+
3
+ export default {
4
+ ...base,
5
+ key: "microsoft_teams-new-chat",
6
+ name: "New Chat",
7
+ description: "Emit new event when a new chat is created",
8
+ version: "0.0.1",
9
+ type: "source",
10
+ dedupe: "unique",
11
+ props: {
12
+ ...base.props,
13
+ max: {
14
+ propDefinition: [
15
+ base.props.microsoftTeams,
16
+ "max",
17
+ ],
18
+ },
19
+ },
20
+ methods: {
21
+ ...base.methods,
22
+ async getResources(lastCreated) {
23
+ return this.getNewPaginatedResources(
24
+ this.microsoftTeams.listChats,
25
+ {},
26
+ this.max,
27
+ lastCreated,
28
+ );
29
+ },
30
+ generateMeta(chat) {
31
+ return {
32
+ id: chat.id,
33
+ summary: chat.topic ?? `Chat ID ${chat.id}`,
34
+ ts: Date.parse(chat.createdDateTime),
35
+ };
36
+ },
37
+ },
38
+ };
@@ -0,0 +1,46 @@
1
+ import base from "../common/base.mjs";
2
+
3
+ export default {
4
+ ...base,
5
+ key: "microsoft_teams-new-chat-message",
6
+ name: "New Chat Message",
7
+ description: "Emit new event when a new message is received in a chat",
8
+ version: "0.0.1",
9
+ type: "source",
10
+ dedupe: "unique",
11
+ props: {
12
+ ...base.props,
13
+ chat: {
14
+ propDefinition: [
15
+ base.props.microsoftTeams,
16
+ "chat",
17
+ ],
18
+ },
19
+ max: {
20
+ propDefinition: [
21
+ base.props.microsoftTeams,
22
+ "max",
23
+ ],
24
+ },
25
+ },
26
+ methods: {
27
+ ...base.methods,
28
+ async getResources(lastCreated) {
29
+ return this.getNewPaginatedResources(
30
+ this.microsoftTeams.listChatMessages,
31
+ {
32
+ chatId: this.chat,
33
+ },
34
+ this.max,
35
+ lastCreated,
36
+ );
37
+ },
38
+ generateMeta(message) {
39
+ return {
40
+ id: message.id,
41
+ summary: `New Message ${message.id}`,
42
+ ts: Date.parse(message.createdDateTime),
43
+ };
44
+ },
45
+ },
46
+ };
@@ -0,0 +1,38 @@
1
+ import base from "../common/base.mjs";
2
+
3
+ export default {
4
+ ...base,
5
+ key: "microsoft_teams-new-team",
6
+ name: "New Team",
7
+ description: "Emit new event when a new team is joined by the authenticated user",
8
+ version: "0.0.1",
9
+ type: "source",
10
+ dedupe: "unique",
11
+ props: {
12
+ ...base.props,
13
+ max: {
14
+ propDefinition: [
15
+ base.props.microsoftTeams,
16
+ "max",
17
+ ],
18
+ },
19
+ },
20
+ methods: {
21
+ ...base.methods,
22
+ async getResources(lastCreated) {
23
+ return this.getNewPaginatedResources(
24
+ this.microsoftTeams.listTeams,
25
+ {},
26
+ this.max,
27
+ lastCreated,
28
+ );
29
+ },
30
+ generateMeta(team) {
31
+ return {
32
+ id: team.id,
33
+ summary: team.displayName,
34
+ ts: Date.now(),
35
+ };
36
+ },
37
+ },
38
+ };
@@ -0,0 +1,45 @@
1
+ import base from "../common/base.mjs";
2
+
3
+ export default {
4
+ ...base,
5
+ key: "microsoft_teams-new-team-member",
6
+ name: "New Team Member",
7
+ description: "Emit new event when a new member is added to a team",
8
+ version: "0.0.1",
9
+ type: "source",
10
+ dedupe: "unique",
11
+ props: {
12
+ ...base.props,
13
+ team: {
14
+ propDefinition: [
15
+ base.props.microsoftTeams,
16
+ "team",
17
+ ],
18
+ },
19
+ },
20
+ methods: {
21
+ ...base.methods,
22
+ async getResources() {
23
+ return this.getNewPaginatedResources(
24
+ this.microsoftTeams.listTeamMembers,
25
+ {
26
+ teamId: this.team,
27
+ },
28
+ );
29
+ },
30
+ generateMeta(member) {
31
+ return {
32
+ id: member.userId,
33
+ summary: member.displayName,
34
+ ts: Date.now(),
35
+ };
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
+ }
44
+ },
45
+ };