@frogbotai/piece-gmail 0.21.0 → 0.23.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.
Files changed (46) hide show
  1. package/README.md +34 -0
  2. package/dist/actions/customApiCall.d.ts +36 -0
  3. package/dist/actions/customApiCall.d.ts.map +1 -0
  4. package/dist/actions/customApiCall.js +27 -0
  5. package/dist/actions/customApiCall.js.map +1 -0
  6. package/dist/actions/getEmail.d.ts +53 -0
  7. package/dist/actions/getEmail.d.ts.map +1 -0
  8. package/dist/actions/getEmail.js +18 -0
  9. package/dist/actions/getEmail.js.map +1 -0
  10. package/dist/actions/replyToEmail.d.ts +75 -0
  11. package/dist/actions/replyToEmail.d.ts.map +1 -0
  12. package/dist/actions/replyToEmail.js +45 -0
  13. package/dist/actions/replyToEmail.js.map +1 -0
  14. package/dist/actions/searchEmails.d.ts +36 -0
  15. package/dist/actions/searchEmails.d.ts.map +1 -0
  16. package/dist/actions/searchEmails.js +29 -0
  17. package/dist/actions/searchEmails.js.map +1 -0
  18. package/dist/actions/send.d.ts +56 -0
  19. package/dist/actions/send.d.ts.map +1 -0
  20. package/dist/actions/send.js +35 -0
  21. package/dist/actions/send.js.map +1 -0
  22. package/dist/client.d.ts +6 -0
  23. package/dist/client.d.ts.map +1 -0
  24. package/dist/client.js +12 -0
  25. package/dist/client.js.map +1 -0
  26. package/dist/config.d.ts +7 -0
  27. package/dist/config.d.ts.map +1 -0
  28. package/dist/config.js +11 -0
  29. package/dist/config.js.map +1 -0
  30. package/dist/files.d.ts +12 -0
  31. package/dist/files.d.ts.map +1 -0
  32. package/dist/files.js +41 -0
  33. package/dist/files.js.map +1 -0
  34. package/dist/index.d.ts +314 -19
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +35 -40
  37. package/dist/index.js.map +1 -1
  38. package/dist/mail.d.ts +77 -0
  39. package/dist/mail.d.ts.map +1 -0
  40. package/dist/mail.js +136 -0
  41. package/dist/mail.js.map +1 -0
  42. package/dist/triggers/newEmail.d.ts +42 -0
  43. package/dist/triggers/newEmail.d.ts.map +1 -0
  44. package/dist/triggers/newEmail.js +32 -0
  45. package/dist/triggers/newEmail.js.map +1 -0
  46. package/package.json +6 -4
package/dist/index.d.ts CHANGED
@@ -1,20 +1,315 @@
1
- import { type PieceFactoryConfig } from 'frogbot/pieces';
2
- export declare const gmailActions: readonly ["send_email", "request_approval_in_mail", "reply_to_email", "create_draft_reply", "gmail_get_mail", "gmail_search_mail"];
3
- export declare const gmailScopes: readonly ["https://www.googleapis.com/auth/gmail.send", "https://www.googleapis.com/auth/gmail.readonly", "https://www.googleapis.com/auth/gmail.compose", "email"];
4
- export declare function createGmail(config?: PieceFactoryConfig): import("frogbot/pieces").Piece & {
5
- /** Send Email: Send an email through a Gmail account */
6
- sendEmail: import("node_modules/frogbot/dist/tools/types").AnyTool;
7
- /** Request Approval in Email: Send approval request email and then wait until the email is approved or disapproved */
8
- requestApprovalInMail: import("node_modules/frogbot/dist/tools/types").AnyTool;
9
- /** Reply to Email: Reply to an existing email. */
10
- replyToEmail: import("node_modules/frogbot/dist/tools/types").AnyTool;
11
- /** Create Draft Reply: Creates a draft reply to an existing email. */
12
- createDraftReply: import("node_modules/frogbot/dist/tools/types").AnyTool;
13
- /** Get Email: Get an email via Id. */
14
- gmailGetMail: import("node_modules/frogbot/dist/tools/types").AnyTool;
15
- /** Find Email: Find emails using advanced search criteria. If no filters are provided, the latest emails are returned. */
16
- gmailSearchMail: import("node_modules/frogbot/dist/tools/types").AnyTool;
17
- /** Custom API Call: Make a custom API call to a specific endpoint */
18
- customApiCall: import("node_modules/frogbot/dist/tools/types").AnyTool;
19
- };
1
+ import { createGmailClient } from './client.js';
2
+ import { gmailScopes } from './config.js';
3
+ export declare const gmailActions: readonly ["send", "replyToEmail", "createDraftReply", "getEmail", "searchEmails", "customApiCall"];
4
+ export declare const gmailTriggers: readonly ["newEmail"];
5
+ export { gmailScopes };
6
+ export declare const createGmail: import("frogbot").PieceFactory<{
7
+ readonly slug: "gmail";
8
+ readonly label: "Gmail";
9
+ readonly admin: {
10
+ readonly description: "Send, draft, read, and search Gmail messages";
11
+ readonly group: "Communication";
12
+ };
13
+ readonly auth: import("zod").ZodObject<{
14
+ accessToken: import("zod").ZodString;
15
+ refreshToken: import("zod").ZodOptional<import("zod").ZodString>;
16
+ }, import("zod/v4/core").$strip>;
17
+ readonly client: typeof createGmailClient;
18
+ readonly oauth: {
19
+ readonly scopes: [...string[], "https://www.googleapis.com/auth/gmail.send", "https://www.googleapis.com/auth/gmail.readonly", "https://www.googleapis.com/auth/gmail.compose"];
20
+ readonly toAuth: ({ tokens }: {
21
+ tokens: import("frogbot").OAuthTokens;
22
+ }) => {
23
+ accessToken: string;
24
+ refreshToken: string | undefined;
25
+ };
26
+ readonly authorizationUrl: string;
27
+ readonly tokenUrl: string;
28
+ readonly params: {
29
+ access_type: string;
30
+ prompt: string;
31
+ };
32
+ readonly account: ({ tokens, req }: {
33
+ tokens: import("frogbot").OAuthTokens;
34
+ client: unknown;
35
+ req: import("frogbot").FrogbotRequest;
36
+ }) => Promise<{
37
+ id: string;
38
+ label: string;
39
+ email: string;
40
+ }>;
41
+ };
42
+ readonly actions: readonly [{
43
+ slug: string;
44
+ description: string;
45
+ input: import("zod").ZodObject<{
46
+ replyTo: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
47
+ senderName: import("zod").ZodOptional<import("zod").ZodString>;
48
+ from: import("zod").ZodOptional<import("zod").ZodString>;
49
+ inReplyTo: import("zod").ZodOptional<import("zod").ZodString>;
50
+ draft: import("zod").ZodDefault<import("zod").ZodBoolean>;
51
+ body: import("zod").ZodString;
52
+ bodyType: import("zod").ZodDefault<import("zod").ZodEnum<{
53
+ plainText: "plainText";
54
+ html: "html";
55
+ }>>;
56
+ attachments: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
57
+ fileId: import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodNumber]>;
58
+ name: import("zod").ZodOptional<import("zod").ZodString>;
59
+ }, import("zod/v4/core").$strip>>>;
60
+ subject: import("zod").ZodString;
61
+ to: import("zod").ZodArray<import("zod").ZodString>;
62
+ cc: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
63
+ bcc: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
64
+ }, import("zod/v4/core").$strip>;
65
+ output: import("zod").ZodObject<{
66
+ id: import("zod").ZodOptional<import("zod").ZodString>;
67
+ threadId: import("zod").ZodOptional<import("zod").ZodString>;
68
+ labelIds: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
69
+ }, import("zod/v4/core").$loose>;
70
+ idempotent: boolean;
71
+ run({ client, input, req }: import("frogbot").PieceRunArgs<import("zod").infer<import("zod").ZodObject<{
72
+ replyTo: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
73
+ senderName: import("zod").ZodOptional<import("zod").ZodString>;
74
+ from: import("zod").ZodOptional<import("zod").ZodString>;
75
+ inReplyTo: import("zod").ZodOptional<import("zod").ZodString>;
76
+ draft: import("zod").ZodDefault<import("zod").ZodBoolean>;
77
+ body: import("zod").ZodString;
78
+ bodyType: import("zod").ZodDefault<import("zod").ZodEnum<{
79
+ plainText: "plainText";
80
+ html: "html";
81
+ }>>;
82
+ attachments: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
83
+ fileId: import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodNumber]>;
84
+ name: import("zod").ZodOptional<import("zod").ZodString>;
85
+ }, import("zod/v4/core").$strip>>>;
86
+ subject: import("zod").ZodString;
87
+ to: import("zod").ZodArray<import("zod").ZodString>;
88
+ cc: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
89
+ bcc: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
90
+ }, import("zod/v4/core").$strip>>, object, import("./client.js").Gmail>): Promise<import("googleapis").gmail_v1.Schema$Message>;
91
+ }, {
92
+ slug: string;
93
+ description: string;
94
+ input: import("zod").ZodObject<{
95
+ body: import("zod").ZodString;
96
+ bodyType: import("zod").ZodDefault<import("zod").ZodEnum<{
97
+ plainText: "plainText";
98
+ html: "html";
99
+ }>>;
100
+ attachments: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
101
+ fileId: import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodNumber]>;
102
+ name: import("zod").ZodOptional<import("zod").ZodString>;
103
+ }, import("zod/v4/core").$strip>>>;
104
+ messageId: import("zod").ZodString;
105
+ replyType: import("zod").ZodDefault<import("zod").ZodEnum<{
106
+ reply: "reply";
107
+ replyAll: "replyAll";
108
+ }>>;
109
+ }, import("zod/v4/core").$strip>;
110
+ output: import("zod").ZodObject<{
111
+ id: import("zod").ZodOptional<import("zod").ZodString>;
112
+ threadId: import("zod").ZodOptional<import("zod").ZodString>;
113
+ labelIds: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
114
+ }, import("zod/v4/core").$loose>;
115
+ idempotent: boolean;
116
+ run: (args: import("frogbot").PieceRunArgs<import("zod").infer<import("zod").ZodObject<{
117
+ body: import("zod").ZodString;
118
+ bodyType: import("zod").ZodDefault<import("zod").ZodEnum<{
119
+ plainText: "plainText";
120
+ html: "html";
121
+ }>>;
122
+ attachments: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
123
+ fileId: import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodNumber]>;
124
+ name: import("zod").ZodOptional<import("zod").ZodString>;
125
+ }, import("zod/v4/core").$strip>>>;
126
+ messageId: import("zod").ZodString;
127
+ replyType: import("zod").ZodDefault<import("zod").ZodEnum<{
128
+ reply: "reply";
129
+ replyAll: "replyAll";
130
+ }>>;
131
+ }, import("zod/v4/core").$strip>>, object, import("./client.js").Gmail>) => Promise<import("googleapis").gmail_v1.Schema$Message>;
132
+ }, {
133
+ slug: string;
134
+ description: string;
135
+ input: import("zod").ZodObject<{
136
+ body: import("zod").ZodString;
137
+ bodyType: import("zod").ZodDefault<import("zod").ZodEnum<{
138
+ plainText: "plainText";
139
+ html: "html";
140
+ }>>;
141
+ attachments: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
142
+ fileId: import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodNumber]>;
143
+ name: import("zod").ZodOptional<import("zod").ZodString>;
144
+ }, import("zod/v4/core").$strip>>>;
145
+ messageId: import("zod").ZodString;
146
+ replyType: import("zod").ZodDefault<import("zod").ZodEnum<{
147
+ reply: "reply";
148
+ replyAll: "replyAll";
149
+ }>>;
150
+ }, import("zod/v4/core").$strip>;
151
+ output: import("zod").ZodObject<{
152
+ id: import("zod").ZodOptional<import("zod").ZodString>;
153
+ threadId: import("zod").ZodOptional<import("zod").ZodString>;
154
+ labelIds: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
155
+ }, import("zod/v4/core").$loose>;
156
+ idempotent: boolean;
157
+ run: (args: import("frogbot").PieceRunArgs<import("zod").infer<import("zod").ZodObject<{
158
+ body: import("zod").ZodString;
159
+ bodyType: import("zod").ZodDefault<import("zod").ZodEnum<{
160
+ plainText: "plainText";
161
+ html: "html";
162
+ }>>;
163
+ attachments: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
164
+ fileId: import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodNumber]>;
165
+ name: import("zod").ZodOptional<import("zod").ZodString>;
166
+ }, import("zod/v4/core").$strip>>>;
167
+ messageId: import("zod").ZodString;
168
+ replyType: import("zod").ZodDefault<import("zod").ZodEnum<{
169
+ reply: "reply";
170
+ replyAll: "replyAll";
171
+ }>>;
172
+ }, import("zod/v4/core").$strip>>, object, import("./client.js").Gmail>) => Promise<import("googleapis").gmail_v1.Schema$Message>;
173
+ }, {
174
+ slug: string;
175
+ description: string;
176
+ input: import("zod").ZodObject<{
177
+ messageId: import("zod").ZodString;
178
+ format: import("zod").ZodDefault<import("zod").ZodEnum<{
179
+ full: "full";
180
+ minimal: "minimal";
181
+ raw: "raw";
182
+ metadata: "metadata";
183
+ }>>;
184
+ }, import("zod/v4/core").$strip>;
185
+ output: import("zod").ZodObject<{
186
+ id: import("zod").ZodOptional<import("zod").ZodString>;
187
+ threadId: import("zod").ZodOptional<import("zod").ZodString>;
188
+ labelIds: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
189
+ snippet: import("zod").ZodOptional<import("zod").ZodString>;
190
+ payload: import("zod").ZodOptional<import("zod").ZodUnknown>;
191
+ }, import("zod/v4/core").$loose>;
192
+ idempotent: boolean;
193
+ run({ client, input, req }: import("frogbot").PieceRunArgs<import("zod").infer<import("zod").ZodObject<{
194
+ messageId: import("zod").ZodString;
195
+ format: import("zod").ZodDefault<import("zod").ZodEnum<{
196
+ full: "full";
197
+ minimal: "minimal";
198
+ raw: "raw";
199
+ metadata: "metadata";
200
+ }>>;
201
+ }, import("zod/v4/core").$strip>>, object, import("./client.js").Gmail>): Promise<import("googleapis").gmail_v1.Schema$Message | {
202
+ attachments: {
203
+ id: string | number;
204
+ name: string;
205
+ mimeType: string;
206
+ url: unknown;
207
+ }[];
208
+ classificationLabelValues?: import("googleapis").gmail_v1.Schema$ClassificationLabelValue[];
209
+ historyId?: string | null;
210
+ id?: string | null;
211
+ internalDate?: string | null;
212
+ labelIds?: string[] | null;
213
+ payload?: import("googleapis").gmail_v1.Schema$MessagePart;
214
+ raw?: string | null;
215
+ sizeEstimate?: number | null;
216
+ snippet?: string | null;
217
+ threadId?: string | null;
218
+ }>;
219
+ }, {
220
+ slug: string;
221
+ description: string;
222
+ input: import("zod").ZodObject<{
223
+ query: import("zod").ZodOptional<import("zod").ZodString>;
224
+ from: import("zod").ZodOptional<import("zod").ZodString>;
225
+ to: import("zod").ZodOptional<import("zod").ZodString>;
226
+ subject: import("zod").ZodOptional<import("zod").ZodString>;
227
+ labelIds: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
228
+ maxResults: import("zod").ZodDefault<import("zod").ZodNumber>;
229
+ includeSpamTrash: import("zod").ZodDefault<import("zod").ZodBoolean>;
230
+ }, import("zod/v4/core").$strip>;
231
+ output: import("zod").ZodArray<import("zod").ZodObject<{
232
+ id: import("zod").ZodOptional<import("zod").ZodString>;
233
+ threadId: import("zod").ZodOptional<import("zod").ZodString>;
234
+ labelIds: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
235
+ snippet: import("zod").ZodOptional<import("zod").ZodString>;
236
+ payload: import("zod").ZodOptional<import("zod").ZodUnknown>;
237
+ }, import("zod/v4/core").$loose>>;
238
+ idempotent: boolean;
239
+ run({ client, input, req }: import("frogbot").PieceRunArgs<import("zod").infer<import("zod").ZodObject<{
240
+ query: import("zod").ZodOptional<import("zod").ZodString>;
241
+ from: import("zod").ZodOptional<import("zod").ZodString>;
242
+ to: import("zod").ZodOptional<import("zod").ZodString>;
243
+ subject: import("zod").ZodOptional<import("zod").ZodString>;
244
+ labelIds: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
245
+ maxResults: import("zod").ZodDefault<import("zod").ZodNumber>;
246
+ includeSpamTrash: import("zod").ZodDefault<import("zod").ZodBoolean>;
247
+ }, import("zod/v4/core").$strip>>, object, import("./client.js").Gmail>): Promise<{}[]>;
248
+ }, {
249
+ slug: string;
250
+ description: string;
251
+ input: import("zod").ZodObject<{
252
+ method: import("zod").ZodEnum<{
253
+ GET: "GET";
254
+ POST: "POST";
255
+ PUT: "PUT";
256
+ PATCH: "PATCH";
257
+ DELETE: "DELETE";
258
+ }>;
259
+ path: import("zod").ZodString;
260
+ query: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodNumber, import("zod").ZodBoolean]>>>;
261
+ body: import("zod").ZodOptional<import("zod").ZodUnknown>;
262
+ }, import("zod/v4/core").$strip>;
263
+ output: import("zod").ZodUnknown;
264
+ idempotent: boolean;
265
+ run({ client, input }: import("frogbot").PieceRunArgs<import("zod").infer<import("zod").ZodObject<{
266
+ method: import("zod").ZodEnum<{
267
+ GET: "GET";
268
+ POST: "POST";
269
+ PUT: "PUT";
270
+ PATCH: "PATCH";
271
+ DELETE: "DELETE";
272
+ }>;
273
+ path: import("zod").ZodString;
274
+ query: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodNumber, import("zod").ZodBoolean]>>>;
275
+ body: import("zod").ZodOptional<import("zod").ZodUnknown>;
276
+ }, import("zod/v4/core").$strip>>, object, import("./client.js").Gmail>): Promise<unknown>;
277
+ }];
278
+ readonly triggers: readonly [{
279
+ slug: string;
280
+ description: string;
281
+ type: "polling";
282
+ schedule: string;
283
+ input: import("zod").ZodObject<{
284
+ query: import("zod").ZodOptional<import("zod").ZodString>;
285
+ from: import("zod").ZodOptional<import("zod").ZodString>;
286
+ to: import("zod").ZodOptional<import("zod").ZodString>;
287
+ subject: import("zod").ZodOptional<import("zod").ZodString>;
288
+ labelIds: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
289
+ maxResults: import("zod").ZodDefault<import("zod").ZodNumber>;
290
+ includeSpamTrash: import("zod").ZodDefault<import("zod").ZodBoolean>;
291
+ }, import("zod/v4/core").$strip>;
292
+ output: import("zod").ZodObject<{
293
+ id: import("zod").ZodOptional<import("zod").ZodString>;
294
+ threadId: import("zod").ZodOptional<import("zod").ZodString>;
295
+ labelIds: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
296
+ snippet: import("zod").ZodOptional<import("zod").ZodString>;
297
+ payload: import("zod").ZodOptional<import("zod").ZodUnknown>;
298
+ }, import("zod/v4/core").$loose>;
299
+ run({ client, input, cursor, req, }: import("frogbot").PieceRunArgs<import("zod").infer<import("zod").ZodObject<{
300
+ query: import("zod").ZodOptional<import("zod").ZodString>;
301
+ from: import("zod").ZodOptional<import("zod").ZodString>;
302
+ to: import("zod").ZodOptional<import("zod").ZodString>;
303
+ subject: import("zod").ZodOptional<import("zod").ZodString>;
304
+ labelIds: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
305
+ maxResults: import("zod").ZodDefault<import("zod").ZodNumber>;
306
+ includeSpamTrash: import("zod").ZodDefault<import("zod").ZodBoolean>;
307
+ }, import("zod/v4/core").$strip>>, object, import("./client.js").Gmail> & {
308
+ cursor?: number;
309
+ }): Promise<{
310
+ events: {}[];
311
+ cursor: number;
312
+ }>;
313
+ }];
314
+ }>;
20
315
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAA2B,KAAK,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAElF,eAAO,MAAM,YAAY,oIAOf,CAAC;AACX,eAAO,MAAM,WAAW,qKAKd,CAAC;AAEX,wBAAgB,WAAW,CAAC,MAAM,CAAC,EAAE,kBAAkB;IAUnD,wDAAwD;;IAExD,sHAAsH;;IAEtH,kDAAkD;;IAElD,sEAAsE;;IAEtE,sCAAsC;;IAEtC,0HAA0H;;IAE1H,qEAAqE;;EAGxE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAa,WAAW,EAAE,MAAM,aAAa,CAAC;AAGrD,eAAO,MAAM,YAAY,oGAOf,CAAC;AACX,eAAO,MAAM,aAAa,uBAAwB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,CAAC;AAEvB,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAlB2B,SAAgB;;wBAChB,SACjB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAmBF,CAAC;;;;;;EAa/B,CAAC"}
package/dist/index.js CHANGED
@@ -1,43 +1,38 @@
1
- import * as module from '@activepieces/piece-gmail';
2
- import { createActivepiecesPiece } from 'frogbot/pieces';
1
+ import { googleOAuth } from '@frogbotai/piece-google';
2
+ import { definePiece } from 'frogbot/pieces';
3
+ import { customApiCall } from './actions/customApiCall.js';
4
+ import { getEmail } from './actions/getEmail.js';
5
+ import { createDraftReply, replyToEmail } from './actions/replyToEmail.js';
6
+ import { searchEmails } from './actions/searchEmails.js';
7
+ import { send } from './actions/send.js';
8
+ import { createGmailClient } from './client.js';
9
+ import { gmailAuth, gmailScopes } from './config.js';
10
+ import { newEmail } from './triggers/newEmail.js';
3
11
  export const gmailActions = [
4
- 'send_email',
5
- 'request_approval_in_mail',
6
- 'reply_to_email',
7
- 'create_draft_reply',
8
- 'gmail_get_mail',
9
- 'gmail_search_mail',
12
+ 'send',
13
+ 'replyToEmail',
14
+ 'createDraftReply',
15
+ 'getEmail',
16
+ 'searchEmails',
17
+ 'customApiCall',
10
18
  ];
11
- export const gmailScopes = [
12
- 'https://www.googleapis.com/auth/gmail.send',
13
- 'https://www.googleapis.com/auth/gmail.readonly',
14
- 'https://www.googleapis.com/auth/gmail.compose',
15
- 'email',
16
- ];
17
- export function createGmail(config) {
18
- const piece = createActivepiecesPiece({
19
- module: module,
20
- service: 'gmail',
21
- credentialType: 'oauth2',
22
- defaultActions: gmailActions,
23
- scopes: gmailScopes,
24
- config,
25
- });
26
- return Object.assign(piece, {
27
- /** Send Email: Send an email through a Gmail account */
28
- sendEmail: piece.tool('send_email'),
29
- /** Request Approval in Email: Send approval request email and then wait until the email is approved or disapproved */
30
- requestApprovalInMail: piece.tool('request_approval_in_mail'),
31
- /** Reply to Email: Reply to an existing email. */
32
- replyToEmail: piece.tool('reply_to_email'),
33
- /** Create Draft Reply: Creates a draft reply to an existing email. */
34
- createDraftReply: piece.tool('create_draft_reply'),
35
- /** Get Email: Get an email via Id. */
36
- gmailGetMail: piece.tool('gmail_get_mail'),
37
- /** Find Email: Find emails using advanced search criteria. If no filters are provided, the latest emails are returned. */
38
- gmailSearchMail: piece.tool('gmail_search_mail'),
39
- /** Custom API Call: Make a custom API call to a specific endpoint */
40
- customApiCall: piece.tool('custom_api_call'),
41
- });
42
- }
19
+ export const gmailTriggers = ['newEmail'];
20
+ export { gmailScopes };
21
+ export const createGmail = definePiece({
22
+ slug: 'gmail',
23
+ label: 'Gmail',
24
+ admin: { description: 'Send, draft, read, and search Gmail messages', group: 'Communication' },
25
+ auth: gmailAuth,
26
+ client: createGmailClient,
27
+ oauth: {
28
+ ...googleOAuth,
29
+ scopes: [...googleOAuth.scopes, ...gmailScopes],
30
+ toAuth: ({ tokens }) => ({
31
+ accessToken: tokens.access_token ?? '',
32
+ refreshToken: tokens.refresh_token,
33
+ }),
34
+ },
35
+ actions: [send, replyToEmail, createDraftReply, getEmail, searchEmails, customApiCall],
36
+ triggers: [newEmail],
37
+ });
43
38
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAA2B,MAAM,gBAAgB,CAAC;AAElF,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,YAAY;IACZ,0BAA0B;IAC1B,gBAAgB;IAChB,oBAAoB;IACpB,gBAAgB;IAChB,mBAAmB;CACX,CAAC;AACX,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,4CAA4C;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M,2BAA2B,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,MAAM;IACN,cAAc;IACd,kBAAkB;IAClB,UAAU;IACV,cAAc;IACd,eAAe;CACP,CAAC;AACX,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,UAAU,CAAU,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,CAAC;AAEvB,MAAM,CAAC,MAAM,WAAW,GAAG,WAAW,CAAC;IACrC,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,EAAE,WAAW,EAAE,8CAA8C,EAAE,KAAK,EAAE,eAAe,EAAE;IAC9F,IAAI,EAAE,SAAS;IACf,MAAM,EAAE,iBAAiB;IACzB,KAAK,EAAE;QACL,GAAG,WAAW;QACd,MAAM,EAAE,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,GAAG,WAAW,CAAC;QAC/C,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC;YACvB,WAAW,EAAE,MAAM,CAAC,YAAY,IAAI,EAAE;YACtC,YAAY,EAAE,MAAM,CAAC,aAAa;SACnC,CAAC;KACH;IACD,OAAO,EAAE,CAAC,IAAI,EAAE,YAAY,EAAE,gBAAgB,EAAE,QAAQ,EAAE,YAAY,EAAE,aAAa,CAAC;IACtF,QAAQ,EAAE,CAAC,QAAQ,CAAC;CACrB,CAAC,CAAC"}
package/dist/mail.d.ts ADDED
@@ -0,0 +1,77 @@
1
+ import type { FrogbotRequest } from 'frogbot';
2
+ import { type gmail_v1 } from 'googleapis';
3
+ import { z } from 'zod';
4
+ import type { Gmail } from './client.js';
5
+ import { attachment } from './files.js';
6
+ export declare const recipients: {
7
+ to: z.ZodArray<z.ZodString>;
8
+ cc: z.ZodOptional<z.ZodArray<z.ZodString>>;
9
+ bcc: z.ZodOptional<z.ZodArray<z.ZodString>>;
10
+ };
11
+ export declare const messageBody: {
12
+ body: z.ZodString;
13
+ bodyType: z.ZodDefault<z.ZodEnum<{
14
+ plainText: "plainText";
15
+ html: "html";
16
+ }>>;
17
+ attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
18
+ fileId: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
19
+ name: z.ZodOptional<z.ZodString>;
20
+ }, z.core.$strip>>>;
21
+ };
22
+ export declare const messageOutput: z.ZodObject<{
23
+ id: z.ZodOptional<z.ZodString>;
24
+ threadId: z.ZodOptional<z.ZodString>;
25
+ labelIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
26
+ }, z.core.$loose>;
27
+ export declare const emailOutput: z.ZodObject<{
28
+ id: z.ZodOptional<z.ZodString>;
29
+ threadId: z.ZodOptional<z.ZodString>;
30
+ labelIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
31
+ snippet: z.ZodOptional<z.ZodString>;
32
+ payload: z.ZodOptional<z.ZodUnknown>;
33
+ }, z.core.$loose>;
34
+ export declare function splitAddresses(value?: string | null): string[];
35
+ export declare function findHeader(message: gmail_v1.Schema$Message, name: string): string | null | undefined;
36
+ export declare function getOriginal(client: Gmail, id: string): Promise<gmail_v1.Schema$Message>;
37
+ export declare function saveAttachments(client: Gmail, req: FrogbotRequest, message: gmail_v1.Schema$Message): Promise<gmail_v1.Schema$Message | {
38
+ attachments: {
39
+ id: string | number;
40
+ name: string;
41
+ mimeType: string;
42
+ url: unknown;
43
+ }[];
44
+ classificationLabelValues?: gmail_v1.Schema$ClassificationLabelValue[];
45
+ historyId?: string | null;
46
+ id?: string | null;
47
+ internalDate?: string | null;
48
+ labelIds?: string[] | null;
49
+ payload?: gmail_v1.Schema$MessagePart;
50
+ raw?: string | null;
51
+ sizeEstimate?: number | null;
52
+ snippet?: string | null;
53
+ threadId?: string | null;
54
+ }>;
55
+ export declare function createRawMessage({ input, req, extraHeaders, }: {
56
+ input: {
57
+ attachments?: z.output<typeof attachment>[];
58
+ body: string;
59
+ bodyType: 'plainText' | 'html';
60
+ bcc?: string[];
61
+ cc?: string[];
62
+ from?: string;
63
+ replyTo?: string[];
64
+ senderName?: string;
65
+ subject: string;
66
+ to: string[];
67
+ };
68
+ req: FrogbotRequest;
69
+ extraHeaders?: string[];
70
+ }): Promise<string>;
71
+ export declare function searchQuery(input: {
72
+ query?: string;
73
+ from?: string;
74
+ to?: string;
75
+ subject?: string;
76
+ }, after?: number): string;
77
+ //# sourceMappingURL=mail.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mail.d.ts","sourceRoot":"","sources":["../src/mail.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAsB,MAAM,YAAY,CAAC;AAE5D,eAAO,MAAM,UAAU;;;;CAItB,CAAC;AACF,eAAO,MAAM,WAAW;;;;;;;;;;CAIvB,CAAC;AACF,eAAO,MAAM,aAAa;;;;iBAMV,CAAC;AACjB,eAAO,MAAM,WAAW;;;;;;iBAQR,CAAC;AAYjB,wBAAgB,cAAc,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,YAOnD;AACD,wBAAgB,UAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,cAAc,EAAE,IAAI,EAAE,MAAM,6BAGxE;AACD,wBAAsB,WAAW,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,oCAE1D;AAED,wBAAsB,eAAe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