@divyacon/piece-gmail 0.0.0-stage → 0.1.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.
- package/LICENSE.MIT-AP +24 -0
- package/README.md +8 -2
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +111 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/actions/ai-get-message-action.d.ts +7 -0
- package/dist/lib/actions/ai-get-message-action.d.ts.map +1 -0
- package/dist/lib/actions/ai-get-message-action.js +24 -0
- package/dist/lib/actions/ai-get-message-action.js.map +1 -0
- package/dist/lib/actions/ai-reply-to-thread-action.d.ts +16 -0
- package/dist/lib/actions/ai-reply-to-thread-action.d.ts.map +1 -0
- package/dist/lib/actions/ai-reply-to-thread-action.js +24 -0
- package/dist/lib/actions/ai-reply-to-thread-action.js.map +1 -0
- package/dist/lib/actions/ai-search-email-action.d.ts +21 -0
- package/dist/lib/actions/ai-search-email-action.d.ts.map +1 -0
- package/dist/lib/actions/ai-search-email-action.js +24 -0
- package/dist/lib/actions/ai-search-email-action.js.map +1 -0
- package/dist/lib/actions/ai-send-email-action.d.ts +18 -0
- package/dist/lib/actions/ai-send-email-action.d.ts.map +1 -0
- package/dist/lib/actions/ai-send-email-action.js +24 -0
- package/dist/lib/actions/ai-send-email-action.js.map +1 -0
- package/dist/lib/actions/create-draft-action.d.ts +16 -0
- package/dist/lib/actions/create-draft-action.d.ts.map +1 -0
- package/dist/lib/actions/create-draft-action.js +137 -0
- package/dist/lib/actions/create-draft-action.js.map +1 -0
- package/dist/lib/actions/create-draft-reply-action.d.ts +17 -0
- package/dist/lib/actions/create-draft-reply-action.d.ts.map +1 -0
- package/dist/lib/actions/create-draft-reply-action.js +269 -0
- package/dist/lib/actions/create-draft-reply-action.js.map +1 -0
- package/dist/lib/actions/delete-draft-action.d.ts +7 -0
- package/dist/lib/actions/delete-draft-action.d.ts.map +1 -0
- package/dist/lib/actions/delete-draft-action.js +62 -0
- package/dist/lib/actions/delete-draft-action.js.map +1 -0
- package/dist/lib/actions/forward-message-action.d.ts +12 -0
- package/dist/lib/actions/forward-message-action.d.ts.map +1 -0
- package/dist/lib/actions/forward-message-action.js +139 -0
- package/dist/lib/actions/forward-message-action.js.map +1 -0
- package/dist/lib/actions/get-attachment-action.d.ts +9 -0
- package/dist/lib/actions/get-attachment-action.d.ts.map +1 -0
- package/dist/lib/actions/get-attachment-action.js +80 -0
- package/dist/lib/actions/get-attachment-action.js.map +1 -0
- package/dist/lib/actions/get-draft-action.d.ts +7 -0
- package/dist/lib/actions/get-draft-action.d.ts.map +1 -0
- package/dist/lib/actions/get-draft-action.js +56 -0
- package/dist/lib/actions/get-draft-action.js.map +1 -0
- package/dist/lib/actions/get-label-action.d.ts +7 -0
- package/dist/lib/actions/get-label-action.d.ts.map +1 -0
- package/dist/lib/actions/get-label-action.js +55 -0
- package/dist/lib/actions/get-label-action.js.map +1 -0
- package/dist/lib/actions/get-mail-action.d.ts +7 -0
- package/dist/lib/actions/get-mail-action.d.ts.map +1 -0
- package/dist/lib/actions/get-mail-action.js +44 -0
- package/dist/lib/actions/get-mail-action.js.map +1 -0
- package/dist/lib/actions/get-profile-action.d.ts +5 -0
- package/dist/lib/actions/get-profile-action.d.ts.map +1 -0
- package/dist/lib/actions/get-profile-action.js +43 -0
- package/dist/lib/actions/get-profile-action.js.map +1 -0
- package/dist/lib/actions/get-thread-action.d.ts +9 -0
- package/dist/lib/actions/get-thread-action.d.ts.map +1 -0
- package/dist/lib/actions/get-thread-action.js +53 -0
- package/dist/lib/actions/get-thread-action.js.map +1 -0
- package/dist/lib/actions/list-drafts-action.d.ts +8 -0
- package/dist/lib/actions/list-drafts-action.d.ts.map +1 -0
- package/dist/lib/actions/list-drafts-action.js +62 -0
- package/dist/lib/actions/list-drafts-action.js.map +1 -0
- package/dist/lib/actions/list-history-action.d.ts +9 -0
- package/dist/lib/actions/list-history-action.d.ts.map +1 -0
- package/dist/lib/actions/list-history-action.js +74 -0
- package/dist/lib/actions/list-history-action.js.map +1 -0
- package/dist/lib/actions/list-labels-action.d.ts +5 -0
- package/dist/lib/actions/list-labels-action.d.ts.map +1 -0
- package/dist/lib/actions/list-labels-action.js +47 -0
- package/dist/lib/actions/list-labels-action.js.map +1 -0
- package/dist/lib/actions/list-threads-action.d.ts +10 -0
- package/dist/lib/actions/list-threads-action.d.ts.map +1 -0
- package/dist/lib/actions/list-threads-action.js +74 -0
- package/dist/lib/actions/list-threads-action.js.map +1 -0
- package/dist/lib/actions/reply-to-email-action.d.ts +16 -0
- package/dist/lib/actions/reply-to-email-action.d.ts.map +1 -0
- package/dist/lib/actions/reply-to-email-action.js +202 -0
- package/dist/lib/actions/reply-to-email-action.js.map +1 -0
- package/dist/lib/actions/request-approval-in-email.d.ts +15 -0
- package/dist/lib/actions/request-approval-in-email.d.ts.map +1 -0
- package/dist/lib/actions/request-approval-in-email.js +174 -0
- package/dist/lib/actions/request-approval-in-email.js.map +1 -0
- package/dist/lib/actions/search-email-action.d.ts +22 -0
- package/dist/lib/actions/search-email-action.d.ts.map +1 -0
- package/dist/lib/actions/search-email-action.js +179 -0
- package/dist/lib/actions/search-email-action.js.map +1 -0
- package/dist/lib/actions/send-draft-action.d.ts +7 -0
- package/dist/lib/actions/send-draft-action.d.ts.map +1 -0
- package/dist/lib/actions/send-draft-action.js +57 -0
- package/dist/lib/actions/send-draft-action.js.map +1 -0
- package/dist/lib/actions/send-email-action.d.ts +18 -0
- package/dist/lib/actions/send-email-action.d.ts.map +1 -0
- package/dist/lib/actions/send-email-action.js +196 -0
- package/dist/lib/actions/send-email-action.js.map +1 -0
- package/dist/lib/actions/stop-watch-action.d.ts +5 -0
- package/dist/lib/actions/stop-watch-action.d.ts.map +1 -0
- package/dist/lib/actions/stop-watch-action.js +41 -0
- package/dist/lib/actions/stop-watch-action.js.map +1 -0
- package/dist/lib/actions/update-draft-action.d.ts +17 -0
- package/dist/lib/actions/update-draft-action.d.ts.map +1 -0
- package/dist/lib/actions/update-draft-action.js +193 -0
- package/dist/lib/actions/update-draft-action.js.map +1 -0
- package/dist/lib/auth.d.ts +12 -0
- package/dist/lib/auth.d.ts.map +1 -0
- package/dist/lib/auth.js +108 -0
- package/dist/lib/auth.js.map +1 -0
- package/dist/lib/common/data.d.ts +132 -0
- package/dist/lib/common/data.d.ts.map +1 -0
- package/dist/lib/common/data.js +209 -0
- package/dist/lib/common/data.js.map +1 -0
- package/dist/lib/common/mime.d.ts +29 -0
- package/dist/lib/common/mime.d.ts.map +1 -0
- package/dist/lib/common/mime.js +59 -0
- package/dist/lib/common/mime.js.map +1 -0
- package/dist/lib/common/models.d.ts +86 -0
- package/dist/lib/common/models.d.ts.map +1 -0
- package/dist/lib/common/models.js +26 -0
- package/dist/lib/common/models.js.map +1 -0
- package/dist/lib/common/props.d.ts +28 -0
- package/dist/lib/common/props.d.ts.map +1 -0
- package/dist/lib/common/props.js +231 -0
- package/dist/lib/common/props.js.map +1 -0
- package/dist/lib/output-schemas.d.ts +29 -0
- package/dist/lib/output-schemas.d.ts.map +1 -0
- package/dist/lib/output-schemas.js +1029 -0
- package/dist/lib/output-schemas.js.map +1 -0
- package/dist/lib/triggers/new-attachment.d.ts +144 -0
- package/dist/lib/triggers/new-attachment.d.ts.map +1 -0
- package/dist/lib/triggers/new-attachment.js +150 -0
- package/dist/lib/triggers/new-attachment.js.map +1 -0
- package/dist/lib/triggers/new-conversation.d.ts +59 -0
- package/dist/lib/triggers/new-conversation.d.ts.map +1 -0
- package/dist/lib/triggers/new-conversation.js +308 -0
- package/dist/lib/triggers/new-conversation.js.map +1 -0
- package/dist/lib/triggers/new-email.d.ts +52 -0
- package/dist/lib/triggers/new-email.d.ts.map +1 -0
- package/dist/lib/triggers/new-email.js +135 -0
- package/dist/lib/triggers/new-email.js.map +1 -0
- package/dist/lib/triggers/new-label.d.ts +15 -0
- package/dist/lib/triggers/new-label.d.ts.map +1 -0
- package/dist/lib/triggers/new-label.js +82 -0
- package/dist/lib/triggers/new-label.js.map +1 -0
- package/dist/lib/triggers/new-labeled-email.d.ts +35 -0
- package/dist/lib/triggers/new-labeled-email.d.ts.map +1 -0
- package/dist/lib/triggers/new-labeled-email.js +147 -0
- package/dist/lib/triggers/new-labeled-email.js.map +1 -0
- package/package.json +53 -3
- package/src/index.ts +107 -0
- package/src/lib/actions/ai-get-message-action.ts +20 -0
- package/src/lib/actions/ai-reply-to-thread-action.ts +20 -0
- package/src/lib/actions/ai-search-email-action.ts +21 -0
- package/src/lib/actions/ai-send-email-action.ts +20 -0
- package/src/lib/actions/create-draft-action.ts +148 -0
- package/src/lib/actions/create-draft-reply-action.ts +314 -0
- package/src/lib/actions/delete-draft-action.ts +57 -0
- package/src/lib/actions/forward-message-action.ts +159 -0
- package/src/lib/actions/get-attachment-action.ts +83 -0
- package/src/lib/actions/get-draft-action.ts +53 -0
- package/src/lib/actions/get-label-action.ts +53 -0
- package/src/lib/actions/get-mail-action.ts +52 -0
- package/src/lib/actions/get-profile-action.ts +39 -0
- package/src/lib/actions/get-thread-action.ts +47 -0
- package/src/lib/actions/list-drafts-action.ts +72 -0
- package/src/lib/actions/list-history-action.ts +83 -0
- package/src/lib/actions/list-labels-action.ts +43 -0
- package/src/lib/actions/list-threads-action.ts +89 -0
- package/src/lib/actions/reply-to-email-action.ts +228 -0
- package/src/lib/actions/request-approval-in-email.ts +197 -0
- package/src/lib/actions/search-email-action.ts +219 -0
- package/src/lib/actions/send-draft-action.ts +54 -0
- package/src/lib/actions/send-email-action.ts +213 -0
- package/src/lib/actions/stop-watch-action.ts +37 -0
- package/src/lib/actions/update-draft-action.ts +211 -0
- package/src/lib/auth.ts +116 -0
- package/src/lib/common/data.ts +268 -0
- package/src/lib/common/mime.ts +82 -0
- package/src/lib/common/models.ts +91 -0
- package/src/lib/common/props.ts +262 -0
- package/src/lib/output-schemas.ts +1061 -0
- package/src/lib/triggers/new-attachment.ts +203 -0
- package/src/lib/triggers/new-conversation.ts +413 -0
- package/src/lib/triggers/new-email.ts +173 -0
- package/src/lib/triggers/new-label.ts +83 -0
- package/src/lib/triggers/new-labeled-email.ts +197 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const gmailGetDraftAction: import("@agnocon/pieces-framework").IAction<(import("@agnocon/pieces-framework").OAuth2Property<import("@agnocon/pieces-framework").OAuth2Props> | import("@agnocon/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
serviceAccount: import("@agnocon/pieces-framework").LongTextProperty<true>;
|
|
3
|
+
userEmail: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
}>)[], {
|
|
5
|
+
draft_id: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
6
|
+
}>;
|
|
7
|
+
//# sourceMappingURL=get-draft-action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-draft-action.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/get-draft-action.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,mBAAmB;;;;;EA+C9B,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.gmailGetDraftAction = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/gmail/src/lib/actions/get-draft-action.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
8
|
+
const auth_1 = require("../auth");
|
|
9
|
+
const gmail_1 = require("@googleapis/gmail");
|
|
10
|
+
const output_schemas_1 = require("../output-schemas");
|
|
11
|
+
exports.gmailGetDraftAction = (0, pieces_framework_1.createAction)({
|
|
12
|
+
auth: auth_1.gmailAuth,
|
|
13
|
+
name: 'gmail_get_draft',
|
|
14
|
+
displayName: 'Get Draft',
|
|
15
|
+
description: 'Get a single draft email by its ID.',
|
|
16
|
+
audience: 'ai',
|
|
17
|
+
aiMetadata: {
|
|
18
|
+
description: 'Fetches a single draft email by its draft ID, returning the draft and its underlying message. Use this to inspect a draft before sending or updating it; obtain the draft ID from List Drafts. Idempotent: a read-only lookup that does not modify the mailbox.',
|
|
19
|
+
idempotent: true,
|
|
20
|
+
},
|
|
21
|
+
props: {
|
|
22
|
+
draft_id: pieces_framework_1.Property.ShortText({
|
|
23
|
+
displayName: 'Draft ID',
|
|
24
|
+
description: 'The ID of the draft to read (obtain from List Drafts).',
|
|
25
|
+
required: true,
|
|
26
|
+
}),
|
|
27
|
+
},
|
|
28
|
+
outputSchema: output_schemas_1.gmailGetDraftActionOutputSchema,
|
|
29
|
+
run(context) {
|
|
30
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
const authClient = yield (0, auth_1.createGoogleClient)(context.auth);
|
|
32
|
+
const gmail = (0, gmail_1.gmail)({ version: 'v1', auth: authClient });
|
|
33
|
+
try {
|
|
34
|
+
const response = yield gmail.users.drafts.get({
|
|
35
|
+
userId: 'me',
|
|
36
|
+
id: context.propsValue.draft_id,
|
|
37
|
+
format: 'full',
|
|
38
|
+
});
|
|
39
|
+
return response.data;
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
if (error.code === 403) {
|
|
43
|
+
throw new Error('Insufficient permissions to read drafts. Ensure the gmail.readonly scope is granted.');
|
|
44
|
+
}
|
|
45
|
+
else if (error.code === 404) {
|
|
46
|
+
throw new Error(`Draft not found: "${context.propsValue.draft_id}". Use List Drafts to find a valid draft ID.`);
|
|
47
|
+
}
|
|
48
|
+
else if (error.code === 429) {
|
|
49
|
+
throw new Error('Gmail API rate limit exceeded. Please try again later.');
|
|
50
|
+
}
|
|
51
|
+
throw new Error(`Failed to get draft: ${error.message}`);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
//# sourceMappingURL=get-draft-action.js.map
|
|
@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,CACvF,CAAC;gBACJ,CAAC;qBAAM,IAAI,KAAK,CAAC,IAAI,KAAK,GAAG,EAAE,CAAC;oBAC9B,MAAM,IAAI,KAAK,CACb,qBAAqB,OAAO,CAAC,UAAU,CAAC,QAAQ,8CAA8C,CAC/F,CAAC;gBACJ,CAAC;qBAAM,IAAI,KAAK,CAAC,IAAI,KAAK,GAAG,EAAE,CAAC;oBAC9B,MAAM,IAAI,KAAK,CACb,wDAAwD,CACzD,CAAC;gBACJ,CAAC;gBACD,MAAM,IAAI,KAAK,CAAC,wBAAwB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;YAC3D,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const gmailGetLabelAction: import("@agnocon/pieces-framework").IAction<(import("@agnocon/pieces-framework").OAuth2Property<import("@agnocon/pieces-framework").OAuth2Props> | import("@agnocon/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
serviceAccount: import("@agnocon/pieces-framework").LongTextProperty<true>;
|
|
3
|
+
userEmail: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
}>)[], {
|
|
5
|
+
label_id: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
6
|
+
}>;
|
|
7
|
+
//# sourceMappingURL=get-label-action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-label-action.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/get-label-action.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,mBAAmB;;;;;EA+C9B,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.gmailGetLabelAction = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/gmail/src/lib/actions/get-label-action.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
8
|
+
const auth_1 = require("../auth");
|
|
9
|
+
const gmail_1 = require("@googleapis/gmail");
|
|
10
|
+
const output_schemas_1 = require("../output-schemas");
|
|
11
|
+
exports.gmailGetLabelAction = (0, pieces_framework_1.createAction)({
|
|
12
|
+
auth: auth_1.gmailAuth,
|
|
13
|
+
name: 'gmail_get_label',
|
|
14
|
+
displayName: 'Get Label',
|
|
15
|
+
description: 'Get a single label by its ID, including message and thread counts.',
|
|
16
|
+
audience: 'ai',
|
|
17
|
+
aiMetadata: {
|
|
18
|
+
description: 'Fetches a single label by its label ID, returning its name, type, visibility, color, and message/thread counts. Use this to inspect a label or read how many messages carry it; obtain the label ID from List Labels. Idempotent: a read-only lookup that does not modify the mailbox.',
|
|
19
|
+
idempotent: true,
|
|
20
|
+
},
|
|
21
|
+
props: {
|
|
22
|
+
label_id: pieces_framework_1.Property.ShortText({
|
|
23
|
+
displayName: 'Label ID',
|
|
24
|
+
description: 'The ID of the label to read (obtain from List Labels).',
|
|
25
|
+
required: true,
|
|
26
|
+
}),
|
|
27
|
+
},
|
|
28
|
+
outputSchema: output_schemas_1.gmailGetLabelActionOutputSchema,
|
|
29
|
+
run(context) {
|
|
30
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
const authClient = yield (0, auth_1.createGoogleClient)(context.auth);
|
|
32
|
+
const gmail = (0, gmail_1.gmail)({ version: 'v1', auth: authClient });
|
|
33
|
+
try {
|
|
34
|
+
const response = yield gmail.users.labels.get({
|
|
35
|
+
userId: 'me',
|
|
36
|
+
id: context.propsValue.label_id,
|
|
37
|
+
});
|
|
38
|
+
return response.data;
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
if (error.code === 403) {
|
|
42
|
+
throw new Error('Insufficient permissions to read the label. Ensure the gmail.readonly scope is granted.');
|
|
43
|
+
}
|
|
44
|
+
else if (error.code === 404) {
|
|
45
|
+
throw new Error(`Label not found: "${context.propsValue.label_id}". Use List Labels to find a valid label ID.`);
|
|
46
|
+
}
|
|
47
|
+
else if (error.code === 429) {
|
|
48
|
+
throw new Error('Gmail API rate limit exceeded. Please try again later.');
|
|
49
|
+
}
|
|
50
|
+
throw new Error(`Failed to get label: ${error.message}`);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
//# sourceMappingURL=get-label-action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-label-action.js","sourceRoot":"","sources":["../../../src/lib/actions/get-label-action.ts"],"names":[],"mappings":";;;;AAAA,wGAAwG;AACxG,qEAAqE;AACrE,gEAAmE;AACnE,kCAAwD;AACxD,6CAAyD;AACzD,sDAAoE;AAEvD,QAAA,mBAAmB,GAAG,IAAA,+BAAY,EAAC;IAC9C,IAAI,EAAE,gBAAS;IACf,IAAI,EAAE,iBAAiB;IACvB,WAAW,EAAE,WAAW;IACxB,WAAW,EACT,oEAAoE;IACtE,QAAQ,EAAE,IAAI;IACd,UAAU,EAAE;QACV,WAAW,EACT,wRAAwR;QAC1R,UAAU,EAAE,IAAI;KACjB;IACD,KAAK,EAAE;QACL,QAAQ,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC3B,WAAW,EAAE,UAAU;YACvB,WAAW,EAAE,wDAAwD;YACrE,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACD,YAAY,EAAE,gDAA+B;IACvC,GAAG,CAAC,OAAO;;YACf,MAAM,UAAU,GAAG,MAAM,IAAA,yBAAkB,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAC1D,MAAM,KAAK,GAAG,IAAA,aAAW,EAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;YAE/D,IAAI,CAAC;gBACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC;oBAC5C,MAAM,EAAE,IAAI;oBACZ,EAAE,EAAE,OAAO,CAAC,UAAU,CAAC,QAAQ;iBAChC,CAAC,CAAC;gBACH,OAAO,QAAQ,CAAC,IAAI,CAAC;YACvB,CAAC;YAAC,OAAO,KAAU,EAAE,CAAC;gBACpB,IAAI,KAAK,CAAC,IAAI,KAAK,GAAG,EAAE,CAAC;oBACvB,MAAM,IAAI,KAAK,CACb,yFAAyF,CAC1F,CAAC;gBACJ,CAAC;qBAAM,IAAI,KAAK,CAAC,IAAI,KAAK,GAAG,EAAE,CAAC;oBAC9B,MAAM,IAAI,KAAK,CACb,qBAAqB,OAAO,CAAC,UAAU,CAAC,QAAQ,8CAA8C,CAC/F,CAAC;gBACJ,CAAC;qBAAM,IAAI,KAAK,CAAC,IAAI,KAAK,GAAG,EAAE,CAAC;oBAC9B,MAAM,IAAI,KAAK,CACb,wDAAwD,CACzD,CAAC;gBACJ,CAAC;gBACD,MAAM,IAAI,KAAK,CAAC,wBAAwB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;YAC3D,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const gmailGetEmailAction: import("@agnocon/pieces-framework").IAction<(import("@agnocon/pieces-framework").OAuth2Property<import("@agnocon/pieces-framework").OAuth2Props> | import("@agnocon/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
serviceAccount: import("@agnocon/pieces-framework").LongTextProperty<true>;
|
|
3
|
+
userEmail: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
}>)[], {
|
|
5
|
+
message_id: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
6
|
+
}>;
|
|
7
|
+
//# sourceMappingURL=get-mail-action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-mail-action.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/get-mail-action.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,mBAAmB;;;;;EA6C9B,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.gmailGetEmailAction = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/gmail/src/lib/actions/get-mail-action.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
8
|
+
const auth_1 = require("../auth");
|
|
9
|
+
const gmail_1 = require("@googleapis/gmail");
|
|
10
|
+
const data_1 = require("../common/data");
|
|
11
|
+
const output_schemas_1 = require("../output-schemas");
|
|
12
|
+
exports.gmailGetEmailAction = (0, pieces_framework_1.createAction)({
|
|
13
|
+
auth: auth_1.gmailAuth,
|
|
14
|
+
name: 'gmail_get_mail',
|
|
15
|
+
description: 'Get an email via Id.',
|
|
16
|
+
audience: 'human',
|
|
17
|
+
aiMetadata: {
|
|
18
|
+
description: 'Fetches a single email by its Gmail message ID and returns its parsed contents, including headers, body, and decoded attachments. Use this to read the full details of a specific known message, typically after a trigger or search yields its ID. Idempotent: a read-only lookup that does not modify the mailbox.',
|
|
19
|
+
idempotent: true,
|
|
20
|
+
},
|
|
21
|
+
displayName: 'Get Email',
|
|
22
|
+
props: {
|
|
23
|
+
message_id: pieces_framework_1.Property.ShortText({
|
|
24
|
+
displayName: 'Message ID',
|
|
25
|
+
description: 'The messageId of the mail to read.',
|
|
26
|
+
required: true,
|
|
27
|
+
}),
|
|
28
|
+
},
|
|
29
|
+
outputSchema: output_schemas_1.gmailGetMailActionOutputSchema,
|
|
30
|
+
run(context) {
|
|
31
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
const authClient = yield (0, auth_1.createGoogleClient)(context.auth);
|
|
33
|
+
const gmail = (0, gmail_1.gmail)({ version: 'v1', auth: authClient });
|
|
34
|
+
const rawMailResponse = yield gmail.users.messages.get({
|
|
35
|
+
userId: 'me',
|
|
36
|
+
id: context.propsValue.message_id,
|
|
37
|
+
format: 'raw',
|
|
38
|
+
});
|
|
39
|
+
const parsedMailResponse = yield (0, data_1.parseStream)(Buffer.from(rawMailResponse.data.raw, 'base64').toString('utf-8'));
|
|
40
|
+
return Object.assign(Object.assign({ id: context.propsValue.message_id }, parsedMailResponse), { attachments: yield (0, data_1.convertAttachment)(parsedMailResponse.attachments, context.files) });
|
|
41
|
+
});
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=get-mail-action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-mail-action.js","sourceRoot":"","sources":["../../../src/lib/actions/get-mail-action.ts"],"names":[],"mappings":";;;;AAAA,uGAAuG;AACvG,qEAAqE;AACrE,gEAAmE;AACnE,kCAAwD;AACxD,6CAAyD;AACzD,yCAAgE;AAChE,sDAAmE;AAEtD,QAAA,mBAAmB,GAAG,IAAA,+BAAY,EAAC;IAC9C,IAAI,EAAE,gBAAS;IACf,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,sBAAsB;IACnC,QAAQ,EAAE,OAAO;IACjB,UAAU,EAAE;QACV,WAAW,EACT,sTAAsT;QACxT,UAAU,EAAE,IAAI;KACjB;IACD,WAAW,EAAE,WAAW;IACxB,KAAK,EAAE;QACL,UAAU,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC7B,WAAW,EAAE,YAAY;YACzB,WAAW,EAAE,oCAAoC;YACjD,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACD,YAAY,EAAE,+CAA8B;IACtC,GAAG,CAAC,OAAO;;YACf,MAAM,UAAU,GAAG,MAAM,IAAA,yBAAkB,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAE1D,MAAM,KAAK,GAAG,IAAA,aAAW,EAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;YAE/D,MAAM,eAAe,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC;gBACrD,MAAM,EAAE,IAAI;gBACZ,EAAE,EAAE,OAAO,CAAC,UAAU,CAAC,UAAW;gBAClC,MAAM,EAAE,KAAK;aACd,CAAC,CAAC;YAEH,MAAM,kBAAkB,GAAG,MAAM,IAAA,kBAAW,EAC1C,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,GAAa,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAChE,OAAO,CACR,CACF,CAAC;YAEF,qCACE,EAAE,EAAE,OAAO,CAAC,UAAU,CAAC,UAAU,IAC9B,kBAAkB,KACrB,WAAW,EAAE,MAAM,IAAA,wBAAiB,EAClC,kBAAkB,CAAC,WAAW,EAC9B,OAAO,CAAC,KAAK,CACd,IACD;QACJ,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const gmailGetProfileAction: import("@agnocon/pieces-framework").IAction<(import("@agnocon/pieces-framework").OAuth2Property<import("@agnocon/pieces-framework").OAuth2Props> | import("@agnocon/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
serviceAccount: import("@agnocon/pieces-framework").LongTextProperty<true>;
|
|
3
|
+
userEmail: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
}>)[], {}>;
|
|
5
|
+
//# sourceMappingURL=get-profile-action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-profile-action.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/get-profile-action.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,qBAAqB;;;UAiChC,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.gmailGetProfileAction = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/gmail/src/lib/actions/get-profile-action.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
8
|
+
const auth_1 = require("../auth");
|
|
9
|
+
const gmail_1 = require("@googleapis/gmail");
|
|
10
|
+
const output_schemas_1 = require("../output-schemas");
|
|
11
|
+
exports.gmailGetProfileAction = (0, pieces_framework_1.createAction)({
|
|
12
|
+
auth: auth_1.gmailAuth,
|
|
13
|
+
name: 'gmail_get_profile',
|
|
14
|
+
displayName: 'Get Profile',
|
|
15
|
+
description: 'Get the connected mailbox profile.',
|
|
16
|
+
audience: 'ai',
|
|
17
|
+
aiMetadata: {
|
|
18
|
+
description: 'Returns the connected mailbox profile: the account email address, total message and thread counts, and the current history ID. Use this to confirm which account is connected or to obtain the starting history ID for List History. Idempotent: a read-only lookup that does not modify the mailbox.',
|
|
19
|
+
idempotent: true,
|
|
20
|
+
},
|
|
21
|
+
props: {},
|
|
22
|
+
outputSchema: output_schemas_1.gmailGetProfileActionOutputSchema,
|
|
23
|
+
run(context) {
|
|
24
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
const authClient = yield (0, auth_1.createGoogleClient)(context.auth);
|
|
26
|
+
const gmail = (0, gmail_1.gmail)({ version: 'v1', auth: authClient });
|
|
27
|
+
try {
|
|
28
|
+
const response = yield gmail.users.getProfile({ userId: 'me' });
|
|
29
|
+
return response.data;
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
if (error.code === 403) {
|
|
33
|
+
throw new Error('Insufficient permissions to read the profile. Ensure a read scope (e.g. gmail.readonly) is granted.');
|
|
34
|
+
}
|
|
35
|
+
else if (error.code === 429) {
|
|
36
|
+
throw new Error('Gmail API rate limit exceeded. Please try again later.');
|
|
37
|
+
}
|
|
38
|
+
throw new Error(`Failed to get profile: ${error.message}`);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
//# sourceMappingURL=get-profile-action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-profile-action.js","sourceRoot":"","sources":["../../../src/lib/actions/get-profile-action.ts"],"names":[],"mappings":";;;;AAAA,0GAA0G;AAC1G,qEAAqE;AACrE,gEAAyD;AACzD,kCAAwD;AACxD,6CAAyD;AACzD,sDAAsE;AAEzD,QAAA,qBAAqB,GAAG,IAAA,+BAAY,EAAC;IAChD,IAAI,EAAE,gBAAS;IACf,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,oCAAoC;IACjD,QAAQ,EAAE,IAAI;IACd,UAAU,EAAE;QACV,WAAW,EACT,uSAAuS;QACzS,UAAU,EAAE,IAAI;KACjB;IACD,KAAK,EAAE,EAAE;IACT,YAAY,EAAE,kDAAiC;IACzC,GAAG,CAAC,OAAO;;YACf,MAAM,UAAU,GAAG,MAAM,IAAA,yBAAkB,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAC1D,MAAM,KAAK,GAAG,IAAA,aAAW,EAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;YAE/D,IAAI,CAAC;gBACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;gBAChE,OAAO,QAAQ,CAAC,IAAI,CAAC;YACvB,CAAC;YAAC,OAAO,KAAU,EAAE,CAAC;gBACpB,IAAI,KAAK,CAAC,IAAI,KAAK,GAAG,EAAE,CAAC;oBACvB,MAAM,IAAI,KAAK,CACb,qGAAqG,CACtG,CAAC;gBACJ,CAAC;qBAAM,IAAI,KAAK,CAAC,IAAI,KAAK,GAAG,EAAE,CAAC;oBAC9B,MAAM,IAAI,KAAK,CACb,wDAAwD,CACzD,CAAC;gBACJ,CAAC;gBACD,MAAM,IAAI,KAAK,CAAC,0BAA0B,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;YAC7D,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { GmailMessageFormat } from '../common/models';
|
|
2
|
+
export declare const gmailGetThread: import("@agnocon/pieces-framework").IAction<(import("@agnocon/pieces-framework").OAuth2Property<import("@agnocon/pieces-framework").OAuth2Props> | import("@agnocon/pieces-framework").CustomAuthProperty<{
|
|
3
|
+
serviceAccount: import("@agnocon/pieces-framework").LongTextProperty<true>;
|
|
4
|
+
userEmail: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
5
|
+
}>)[], {
|
|
6
|
+
thread_id: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
7
|
+
format: import("@agnocon/pieces-framework").StaticDropdownProperty<GmailMessageFormat, false> | import("@agnocon/pieces-framework").StaticDropdownProperty<GmailMessageFormat, true>;
|
|
8
|
+
}>;
|
|
9
|
+
//# sourceMappingURL=get-thread-action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-thread-action.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/get-thread-action.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAItD,eAAO,MAAM,cAAc;;;;;;EAwCzB,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.gmailGetThread = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/gmail/src/lib/actions/get-thread-action.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
8
|
+
const data_1 = require("../common/data");
|
|
9
|
+
const models_1 = require("../common/models");
|
|
10
|
+
const auth_1 = require("../auth");
|
|
11
|
+
const output_schemas_1 = require("../output-schemas");
|
|
12
|
+
exports.gmailGetThread = (0, pieces_framework_1.createAction)({
|
|
13
|
+
auth: auth_1.gmailAuth,
|
|
14
|
+
name: 'gmail_get_thread',
|
|
15
|
+
description: 'Get a thread from your Gmail account via Id',
|
|
16
|
+
displayName: 'Get Thread',
|
|
17
|
+
audience: 'ai',
|
|
18
|
+
aiMetadata: {
|
|
19
|
+
description: 'Fetches an entire email conversation by its Gmail thread ID, returning every message in the thread. Use this to read a full conversation or to discover the message IDs within a thread before replying; obtain the thread ID from Search Email or List Threads. Idempotent: a read-only lookup that does not modify the mailbox.',
|
|
20
|
+
idempotent: true,
|
|
21
|
+
},
|
|
22
|
+
props: {
|
|
23
|
+
thread_id: pieces_framework_1.Property.ShortText({
|
|
24
|
+
displayName: 'Thread ID',
|
|
25
|
+
description: 'The thread Id of the mail to read',
|
|
26
|
+
required: true,
|
|
27
|
+
}),
|
|
28
|
+
format: pieces_framework_1.Property.StaticDropdown({
|
|
29
|
+
displayName: 'Format',
|
|
30
|
+
description: 'Format of the mail',
|
|
31
|
+
required: false,
|
|
32
|
+
defaultValue: 'full',
|
|
33
|
+
options: {
|
|
34
|
+
disabled: false,
|
|
35
|
+
options: [
|
|
36
|
+
{ value: models_1.GmailMessageFormat.MINIMAL, label: 'Minimal' },
|
|
37
|
+
{ value: models_1.GmailMessageFormat.FULL, label: 'Full' },
|
|
38
|
+
{ value: models_1.GmailMessageFormat.RAW, label: 'Raw' },
|
|
39
|
+
{ value: models_1.GmailMessageFormat.METADATA, label: 'Metadata' },
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
}),
|
|
43
|
+
},
|
|
44
|
+
outputSchema: output_schemas_1.gmailGetThreadActionOutputSchema,
|
|
45
|
+
run: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, propsValue: { format, thread_id } }) {
|
|
46
|
+
return yield data_1.GmailRequests.getThread({
|
|
47
|
+
access_token: yield (0, auth_1.getAccessToken)(auth),
|
|
48
|
+
thread_id,
|
|
49
|
+
format: format !== null && format !== void 0 ? format : models_1.GmailMessageFormat.FULL,
|
|
50
|
+
});
|
|
51
|
+
}),
|
|
52
|
+
});
|
|
53
|
+
//# sourceMappingURL=get-thread-action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-thread-action.js","sourceRoot":"","sources":["../../../src/lib/actions/get-thread-action.ts"],"names":[],"mappings":";;;;AAAA,yGAAyG;AACzG,qEAAqE;AACrE,gEAAmE;AACnE,yCAA+C;AAC/C,6CAAsD;AACtD,kCAAoD;AACpD,sDAAqE;AAExD,QAAA,cAAc,GAAG,IAAA,+BAAY,EAAC;IACzC,IAAI,EAAE,gBAAS;IACf,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,6CAA6C;IAC1D,WAAW,EAAE,YAAY;IACzB,QAAQ,EAAE,IAAI;IACd,UAAU,EAAE;QACV,WAAW,EACT,mUAAmU;QACrU,UAAU,EAAE,IAAI;KACjB;IACD,KAAK,EAAE;QACL,SAAS,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC5B,WAAW,EAAE,WAAW;YACxB,WAAW,EAAE,mCAAmC;YAChD,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,MAAM,EAAE,2BAAQ,CAAC,cAAc,CAAqB;YAClD,WAAW,EAAE,QAAQ;YACrB,WAAW,EAAE,oBAAoB;YACjC,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,MAAM;YACpB,OAAO,EAAE;gBACP,QAAQ,EAAE,KAAK;gBACf,OAAO,EAAE;oBACP,EAAE,KAAK,EAAE,2BAAkB,CAAC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE;oBACvD,EAAE,KAAK,EAAE,2BAAkB,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE;oBACjD,EAAE,KAAK,EAAE,2BAAkB,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE;oBAC/C,EAAE,KAAK,EAAE,2BAAkB,CAAC,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE;iBAC1D;aACF;SACF,CAAC;KACH;IACD,YAAY,EAAE,iDAAgC;IAC9C,GAAG,EAAE,KAAoD,EAAE,oDAA/C,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE;QACrD,OAAA,MAAM,oBAAa,CAAC,SAAS,CAAC;YAC5B,YAAY,EAAE,MAAM,IAAA,qBAAc,EAAC,IAAI,CAAC;YACxC,SAAS;YACT,MAAM,EAAE,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,2BAAkB,CAAC,IAAI;SAC1C,CAAC,CAAA;MAAA;CACL,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const gmailListDraftsAction: import("@agnocon/pieces-framework").IAction<(import("@agnocon/pieces-framework").OAuth2Property<import("@agnocon/pieces-framework").OAuth2Props> | import("@agnocon/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
serviceAccount: import("@agnocon/pieces-framework").LongTextProperty<true>;
|
|
3
|
+
userEmail: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
}>)[], {
|
|
5
|
+
query: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
6
|
+
max_results: import("@agnocon/pieces-framework").NumberProperty<false>;
|
|
7
|
+
}>;
|
|
8
|
+
//# sourceMappingURL=list-drafts-action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-drafts-action.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/list-drafts-action.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,qBAAqB;;;;;;EAkEhC,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.gmailListDraftsAction = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/gmail/src/lib/actions/list-drafts-action.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
8
|
+
const auth_1 = require("../auth");
|
|
9
|
+
const gmail_1 = require("@googleapis/gmail");
|
|
10
|
+
const output_schemas_1 = require("../output-schemas");
|
|
11
|
+
exports.gmailListDraftsAction = (0, pieces_framework_1.createAction)({
|
|
12
|
+
auth: auth_1.gmailAuth,
|
|
13
|
+
name: 'gmail_list_drafts',
|
|
14
|
+
displayName: 'List Drafts',
|
|
15
|
+
description: 'List draft emails in the mailbox.',
|
|
16
|
+
audience: 'ai',
|
|
17
|
+
aiMetadata: {
|
|
18
|
+
description: 'Lists draft emails in the connected mailbox, returning each draft ID and its associated message. This is the resolver for obtaining draft IDs used by Get Draft, Update Draft, Send Draft, and Delete Draft. Optionally narrow with a Gmail search query and bound with Max Results. Idempotent: a read-only listing that does not modify the mailbox.',
|
|
19
|
+
idempotent: true,
|
|
20
|
+
},
|
|
21
|
+
props: {
|
|
22
|
+
query: pieces_framework_1.Property.ShortText({
|
|
23
|
+
displayName: 'Search Query',
|
|
24
|
+
description: 'Optional Gmail search query to filter drafts (e.g. "subject:invoice").',
|
|
25
|
+
required: false,
|
|
26
|
+
}),
|
|
27
|
+
max_results: pieces_framework_1.Property.Number({
|
|
28
|
+
displayName: 'Max Results',
|
|
29
|
+
description: 'Maximum number of drafts to return (1-500).',
|
|
30
|
+
required: false,
|
|
31
|
+
defaultValue: 20,
|
|
32
|
+
}),
|
|
33
|
+
},
|
|
34
|
+
outputSchema: output_schemas_1.gmailListDraftsActionOutputSchema,
|
|
35
|
+
run(context) {
|
|
36
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
var _a;
|
|
38
|
+
const authClient = yield (0, auth_1.createGoogleClient)(context.auth);
|
|
39
|
+
const gmail = (0, gmail_1.gmail)({ version: 'v1', auth: authClient });
|
|
40
|
+
const maxResults = Math.min(Math.max(context.propsValue.max_results || 20, 1), 500);
|
|
41
|
+
try {
|
|
42
|
+
const response = yield gmail.users.drafts.list(Object.assign({ userId: 'me', maxResults }, (((_a = context.propsValue.query) === null || _a === void 0 ? void 0 : _a.trim())
|
|
43
|
+
? { q: context.propsValue.query.trim() }
|
|
44
|
+
: {})));
|
|
45
|
+
const drafts = response.data.drafts || [];
|
|
46
|
+
return Object.assign({ drafts, count: drafts.length, resultSizeEstimate: response.data.resultSizeEstimate }, (response.data.nextPageToken
|
|
47
|
+
? { nextPageToken: response.data.nextPageToken }
|
|
48
|
+
: {}));
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
if (error.code === 403) {
|
|
52
|
+
throw new Error('Insufficient permissions to list drafts. Ensure the gmail.readonly scope is granted.');
|
|
53
|
+
}
|
|
54
|
+
else if (error.code === 429) {
|
|
55
|
+
throw new Error('Gmail API rate limit exceeded. Please try again later.');
|
|
56
|
+
}
|
|
57
|
+
throw new Error(`Failed to list drafts: ${error.message}`);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
//# sourceMappingURL=list-drafts-action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-drafts-action.js","sourceRoot":"","sources":["../../../src/lib/actions/list-drafts-action.ts"],"names":[],"mappings":";;;;AAAA,0GAA0G;AAC1G,qEAAqE;AACrE,gEAAmE;AACnE,kCAAwD;AACxD,6CAAyD;AACzD,sDAAsE;AAEzD,QAAA,qBAAqB,GAAG,IAAA,+BAAY,EAAC;IAChD,IAAI,EAAE,gBAAS;IACf,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE,aAA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AI,EAAE,CAAC;gBAC1C,uBACE,MAAM,EACN,KAAK,EAAE,MAAM,CAAC,MAAM,EACpB,kBAAkB,EAAE,QAAQ,CAAC,IAAI,CAAC,kBAAkB,IACjD,CAAC,QAAQ,CAAC,IAAI,CAAC,aAAa;oBAC7B,CAAC,CAAC,EAAE,aAAa,EAAE,QAAQ,CAAC,IAAI,CAAC,aAAa,EAAE;oBAChD,CAAC,CAAC,EAAE,CAAC,EACP;YACJ,CAAC;YAAC,OAAO,KAAU,EAAE,CAAC;gBACpB,IAAI,KAAK,CAAC,IAAI,KAAK,GAAG,EAAE,CAAC;oBACvB,MAAM,IAAI,KAAK,CACb,sFAAsF,CACvF,CAAC;gBACJ,CAAC;qBAAM,IAAI,KAAK,CAAC,IAAI,KAAK,GAAG,EAAE,CAAC;oBAC9B,MAAM,IAAI,KAAK,CACb,wDAAwD,CACzD,CAAC;gBACJ,CAAC;gBACD,MAAM,IAAI,KAAK,CAAC,0BAA0B,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;YAC7D,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const gmailListHistoryAction: import("@agnocon/pieces-framework").IAction<(import("@agnocon/pieces-framework").OAuth2Property<import("@agnocon/pieces-framework").OAuth2Props> | import("@agnocon/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
serviceAccount: import("@agnocon/pieces-framework").LongTextProperty<true>;
|
|
3
|
+
userEmail: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
}>)[], {
|
|
5
|
+
start_history_id: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
6
|
+
history_types: import("@agnocon/pieces-framework").StaticMultiSelectDropdownProperty<string, false>;
|
|
7
|
+
max_results: import("@agnocon/pieces-framework").NumberProperty<false>;
|
|
8
|
+
}>;
|
|
9
|
+
//# sourceMappingURL=list-history-action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-history-action.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/list-history-action.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,sBAAsB;;;;;;;EA6EjC,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.gmailListHistoryAction = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/gmail/src/lib/actions/list-history-action.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
8
|
+
const auth_1 = require("../auth");
|
|
9
|
+
const gmail_1 = require("@googleapis/gmail");
|
|
10
|
+
const output_schemas_1 = require("../output-schemas");
|
|
11
|
+
exports.gmailListHistoryAction = (0, pieces_framework_1.createAction)({
|
|
12
|
+
auth: auth_1.gmailAuth,
|
|
13
|
+
name: 'gmail_list_history',
|
|
14
|
+
displayName: 'List History',
|
|
15
|
+
description: 'List mailbox changes since a given history ID.',
|
|
16
|
+
audience: 'ai',
|
|
17
|
+
aiMetadata: {
|
|
18
|
+
description: 'Returns the incremental change log (messages added, deleted, or relabeled) since a given starting history ID. Use this to detect what changed in the mailbox since a previous checkpoint; obtain the starting history ID from Get Profile (or a prior run). Idempotent: a read-only listing that does not modify the mailbox.',
|
|
19
|
+
idempotent: true,
|
|
20
|
+
},
|
|
21
|
+
props: {
|
|
22
|
+
start_history_id: pieces_framework_1.Property.ShortText({
|
|
23
|
+
displayName: 'Start History ID',
|
|
24
|
+
description: 'Return changes after this history ID (obtain from Get Profile or a previous history result).',
|
|
25
|
+
required: true,
|
|
26
|
+
}),
|
|
27
|
+
history_types: pieces_framework_1.Property.StaticMultiSelectDropdown({
|
|
28
|
+
displayName: 'History Types',
|
|
29
|
+
description: 'Limit results to these change types (leave empty for all).',
|
|
30
|
+
required: false,
|
|
31
|
+
options: {
|
|
32
|
+
disabled: false,
|
|
33
|
+
options: [
|
|
34
|
+
{ label: 'Message Added', value: 'messageAdded' },
|
|
35
|
+
{ label: 'Message Deleted', value: 'messageDeleted' },
|
|
36
|
+
{ label: 'Label Added', value: 'labelAdded' },
|
|
37
|
+
{ label: 'Label Removed', value: 'labelRemoved' },
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
}),
|
|
41
|
+
max_results: pieces_framework_1.Property.Number({
|
|
42
|
+
displayName: 'Max Results',
|
|
43
|
+
description: 'Maximum number of history records to return (1-500).',
|
|
44
|
+
required: false,
|
|
45
|
+
defaultValue: 100,
|
|
46
|
+
}),
|
|
47
|
+
},
|
|
48
|
+
outputSchema: output_schemas_1.gmailListHistoryActionOutputSchema,
|
|
49
|
+
run(context) {
|
|
50
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
const authClient = yield (0, auth_1.createGoogleClient)(context.auth);
|
|
52
|
+
const gmail = (0, gmail_1.gmail)({ version: 'v1', auth: authClient });
|
|
53
|
+
const maxResults = Math.min(Math.max(context.propsValue.max_results || 100, 1), 500);
|
|
54
|
+
const historyTypes = context.propsValue.history_types;
|
|
55
|
+
try {
|
|
56
|
+
const response = yield gmail.users.history.list(Object.assign({ userId: 'me', startHistoryId: context.propsValue.start_history_id, maxResults }, (historyTypes && historyTypes.length > 0 ? { historyTypes } : {})));
|
|
57
|
+
return response.data;
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
if (error.code === 403) {
|
|
61
|
+
throw new Error('Insufficient permissions to read history. Ensure the gmail.readonly scope is granted.');
|
|
62
|
+
}
|
|
63
|
+
else if (error.code === 404) {
|
|
64
|
+
throw new Error('The start history ID is too old or invalid. Fetch a fresh history ID from Get Profile.');
|
|
65
|
+
}
|
|
66
|
+
else if (error.code === 429) {
|
|
67
|
+
throw new Error('Gmail API rate limit exceeded. Please try again later.');
|
|
68
|
+
}
|
|
69
|
+
throw new Error(`Failed to list history: ${error.message}`);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
//# sourceMappingURL=list-history-action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-history-action.js","sourceRoot":"","sources":["../../../src/lib/actions/list-history-action.ts"],"names":[],"mappings":";;;;AAAA,2GAA2G;AAC3G,qEAAqE;AACrE,gEAAmE;AACnE,kCAAwD;AACxD,6CAAyD;AACzD,sDAAuE;AAE1D,QAAA,sBAAsB,GAAG,IAAA,+BAAY,EAAC;IACjD,IAAI,EAAE,gBAAS;IACf,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE,cAAc;IAC3B,WAAW,EAAE,gDAAgD;IAC7D,QAAQ,EAAE,IAAI;IACd,UAAU,EAAE;QACV,WAAW,EACT,+TAA+T;QACjU,UAAU,EAAE,IAAI;KACjB;IACD,KAAK,EAAE;QACL,gBAAgB,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACnC,WAAW,EAAE,kBAAkB;YAC/B,WAAW,EACT,8FAA8F;YAChG,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,aAAa,EAAE,2BAAQ,CAAC,yBAAyB,CAAC;YAChD,WAAW,EAAE,eAAe;YAC5B,WAAW,EAAE,4DAA4D;YACzE,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE;gBACP,QAAQ,EAAE,KAAK;gBACf,OAAO,EAAE;oBACP,EAAE,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,cAAc,EAAE;oBACjD,EAAE,KAAK,EAAE,iBAAiB,EAAE,KAAK,EAAE,gBAAgB,EAAE;oBACrD,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,YAAY,EAAE;oBAC7C,EAAE,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,cAAc,EAAE;iBAClD;aACF;SACF,CAAC;QACF,WAAW,EAAE,2BAAQ,CAAC,MAAM,CA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AC,IAAI,KAAK,GAAG,EAAE,CAAC;oBAC9B,MAAM,IAAI,KAAK,CACb,wDAAwD,CACzD,CAAC;gBACJ,CAAC;gBACD,MAAM,IAAI,KAAK,CAAC,2BAA2B,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;YAC9D,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const gmailListLabelsAction: import("@agnocon/pieces-framework").IAction<(import("@agnocon/pieces-framework").OAuth2Property<import("@agnocon/pieces-framework").OAuth2Props> | import("@agnocon/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
serviceAccount: import("@agnocon/pieces-framework").LongTextProperty<true>;
|
|
3
|
+
userEmail: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
}>)[], {}>;
|
|
5
|
+
//# sourceMappingURL=list-labels-action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-labels-action.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/list-labels-action.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,qBAAqB;;;UAqChC,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.gmailListLabelsAction = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/gmail/src/lib/actions/list-labels-action.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
8
|
+
const auth_1 = require("../auth");
|
|
9
|
+
const gmail_1 = require("@googleapis/gmail");
|
|
10
|
+
const output_schemas_1 = require("../output-schemas");
|
|
11
|
+
exports.gmailListLabelsAction = (0, pieces_framework_1.createAction)({
|
|
12
|
+
auth: auth_1.gmailAuth,
|
|
13
|
+
name: 'gmail_list_labels',
|
|
14
|
+
displayName: 'List Labels',
|
|
15
|
+
description: 'List all labels in the mailbox.',
|
|
16
|
+
audience: 'ai',
|
|
17
|
+
aiMetadata: {
|
|
18
|
+
description: 'Lists every label in the mailbox (both system labels like INBOX/UNREAD/STARRED and user-created labels) with their IDs, names, and types. This is the primary resolver for label IDs — look up a label ID by name here before passing it to Get Label or any label-aware action. Idempotent: a read-only listing that does not modify the mailbox.',
|
|
19
|
+
idempotent: true,
|
|
20
|
+
},
|
|
21
|
+
props: {},
|
|
22
|
+
outputSchema: output_schemas_1.gmailListLabelsActionOutputSchema,
|
|
23
|
+
run(context) {
|
|
24
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
const authClient = yield (0, auth_1.createGoogleClient)(context.auth);
|
|
26
|
+
const gmail = (0, gmail_1.gmail)({ version: 'v1', auth: authClient });
|
|
27
|
+
try {
|
|
28
|
+
const response = yield gmail.users.labels.list({ userId: 'me' });
|
|
29
|
+
const labels = response.data.labels || [];
|
|
30
|
+
return {
|
|
31
|
+
labels,
|
|
32
|
+
count: labels.length,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
if (error.code === 403) {
|
|
37
|
+
throw new Error('Insufficient permissions to list labels. Ensure the gmail.readonly scope is granted.');
|
|
38
|
+
}
|
|
39
|
+
else if (error.code === 429) {
|
|
40
|
+
throw new Error('Gmail API rate limit exceeded. Please try again later.');
|
|
41
|
+
}
|
|
42
|
+
throw new Error(`Failed to list labels: ${error.message}`);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
//# sourceMappingURL=list-labels-action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-labels-action.js","sourceRoot":"","sources":["../../../src/lib/actions/list-labels-action.ts"],"names":[],"mappings":";;;;AAAA,0GAA0G;AAC1G,qEAAqE;AACrE,gEAAyD;AAC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CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const gmailListThreadsAction: import("@agnocon/pieces-framework").IAction<(import("@agnocon/pieces-framework").OAuth2Property<import("@agnocon/pieces-framework").OAuth2Props> | import("@agnocon/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
serviceAccount: import("@agnocon/pieces-framework").LongTextProperty<true>;
|
|
3
|
+
userEmail: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
}>)[], {
|
|
5
|
+
query: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
6
|
+
label_ids: import("@agnocon/pieces-framework").ArrayProperty<false>;
|
|
7
|
+
include_spam_trash: import("@agnocon/pieces-framework").CheckboxProperty<false>;
|
|
8
|
+
max_results: import("@agnocon/pieces-framework").NumberProperty<false>;
|
|
9
|
+
}>;
|
|
10
|
+
//# sourceMappingURL=list-threads-action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-threads-action.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/list-threads-action.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,sBAAsB;;;;;;;;EAmFjC,CAAC"}
|