automate.ax 0.3.1 → 0.4.1
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/README.md +58 -6
- package/dist/automation/account-planning.d.ts +17 -0
- package/dist/automation/account-planning.d.ts.map +1 -0
- package/dist/automation/account-planning.js +48 -0
- package/dist/automation/actions.d.ts +2 -1
- package/dist/automation/actions.d.ts.map +1 -1
- package/dist/automation/actions.js +3 -36
- package/dist/cli/commands/deploy.d.ts.map +1 -1
- package/dist/cli/commands/deploy.js +4 -4
- package/dist/cli/usage.d.ts +2 -1
- package/dist/cli/usage.d.ts.map +1 -1
- package/dist/cli/usage.js +2 -1
- package/dist/components/core/actions.d.ts +29 -0
- package/dist/components/core/actions.d.ts.map +1 -0
- package/dist/components/core/actions.js +57 -0
- package/dist/components/core/index.d.ts +3 -0
- package/dist/components/core/index.d.ts.map +1 -0
- package/dist/components/core/index.js +2 -0
- package/dist/components/core/triggers.d.ts +21 -0
- package/dist/components/core/triggers.d.ts.map +1 -0
- package/dist/components/core/triggers.js +9 -0
- package/dist/components/gmail/actions/add-label.d.ts +12 -0
- package/dist/components/gmail/actions/add-label.d.ts.map +1 -0
- package/dist/components/gmail/actions/add-label.js +33 -0
- package/dist/components/gmail/actions/archive.d.ts +9 -0
- package/dist/components/gmail/actions/archive.d.ts.map +1 -0
- package/dist/components/gmail/actions/archive.js +7 -0
- package/dist/components/gmail/actions/create-label.d.ts +43 -0
- package/dist/components/gmail/actions/create-label.d.ts.map +1 -0
- package/dist/components/gmail/actions/create-label.js +27 -0
- package/dist/components/gmail/actions/delete-draft.d.ts +6 -0
- package/dist/components/gmail/actions/delete-draft.d.ts.map +1 -0
- package/dist/components/gmail/actions/delete-draft.js +20 -0
- package/dist/components/gmail/actions/delete-label.d.ts +6 -0
- package/dist/components/gmail/actions/delete-label.d.ts.map +1 -0
- package/dist/components/gmail/actions/delete-label.js +22 -0
- package/dist/components/gmail/actions/draft-email.d.ts +66 -0
- package/dist/components/gmail/actions/draft-email.d.ts.map +1 -0
- package/dist/components/gmail/actions/draft-email.js +32 -0
- package/dist/components/gmail/actions/draft-reply.d.ts +67 -0
- package/dist/components/gmail/actions/draft-reply.d.ts.map +1 -0
- package/dist/components/gmail/actions/draft-reply.js +42 -0
- package/dist/components/gmail/actions/forward.d.ts +67 -0
- package/dist/components/gmail/actions/forward.d.ts.map +1 -0
- package/dist/components/gmail/actions/forward.js +130 -0
- package/dist/components/gmail/actions/get-draft.d.ts +66 -0
- package/dist/components/gmail/actions/get-draft.d.ts.map +1 -0
- package/dist/components/gmail/actions/get-draft.js +28 -0
- package/dist/components/gmail/actions/get-message.d.ts +68 -0
- package/dist/components/gmail/actions/get-message.d.ts.map +1 -0
- package/dist/components/gmail/actions/get-message.js +24 -0
- package/dist/components/gmail/actions/get-messages.d.ts +63 -0
- package/dist/components/gmail/actions/get-messages.d.ts.map +1 -0
- package/dist/components/gmail/actions/get-messages.js +23 -0
- package/dist/components/gmail/actions/get-profile.d.ts +8 -0
- package/dist/components/gmail/actions/get-profile.d.ts.map +1 -0
- package/dist/components/gmail/actions/get-profile.js +23 -0
- package/dist/components/gmail/actions/get-raw-message.d.ts +11 -0
- package/dist/components/gmail/actions/get-raw-message.d.ts.map +1 -0
- package/dist/components/gmail/actions/get-raw-message.js +28 -0
- package/dist/components/gmail/actions/get-thread.d.ts +67 -0
- package/dist/components/gmail/actions/get-thread.d.ts.map +1 -0
- package/dist/components/gmail/actions/get-thread.js +28 -0
- package/dist/components/gmail/actions/has-label.d.ts +7 -0
- package/dist/components/gmail/actions/has-label.d.ts.map +1 -0
- package/dist/components/gmail/actions/has-label.js +23 -0
- package/dist/components/gmail/actions/index.d.ts +42 -0
- package/dist/components/gmail/actions/index.d.ts.map +1 -0
- package/dist/components/gmail/actions/index.js +41 -0
- package/dist/components/gmail/actions/is-important.d.ts +5 -0
- package/dist/components/gmail/actions/is-important.d.ts.map +1 -0
- package/dist/components/gmail/actions/is-important.js +3 -0
- package/dist/components/gmail/actions/is-starred.d.ts +5 -0
- package/dist/components/gmail/actions/is-starred.d.ts.map +1 -0
- package/dist/components/gmail/actions/is-starred.js +3 -0
- package/dist/components/gmail/actions/is-unread.d.ts +5 -0
- package/dist/components/gmail/actions/is-unread.d.ts.map +1 -0
- package/dist/components/gmail/actions/is-unread.js +3 -0
- package/dist/components/gmail/actions/list-labels.d.ts +27 -0
- package/dist/components/gmail/actions/list-labels.d.ts.map +1 -0
- package/dist/components/gmail/actions/list-labels.js +15 -0
- package/dist/components/gmail/actions/mark-as-important.d.ts +5 -0
- package/dist/components/gmail/actions/mark-as-important.d.ts.map +1 -0
- package/dist/components/gmail/actions/mark-as-important.js +3 -0
- package/dist/components/gmail/actions/mark-as-not-spam.d.ts +5 -0
- package/dist/components/gmail/actions/mark-as-not-spam.d.ts.map +1 -0
- package/dist/components/gmail/actions/mark-as-not-spam.js +3 -0
- package/dist/components/gmail/actions/mark-as-read.d.ts +5 -0
- package/dist/components/gmail/actions/mark-as-read.d.ts.map +1 -0
- package/dist/components/gmail/actions/mark-as-read.js +3 -0
- package/dist/components/gmail/actions/mark-as-spam.d.ts +5 -0
- package/dist/components/gmail/actions/mark-as-spam.d.ts.map +1 -0
- package/dist/components/gmail/actions/mark-as-spam.js +3 -0
- package/dist/components/gmail/actions/mark-as-unread.d.ts +5 -0
- package/dist/components/gmail/actions/mark-as-unread.d.ts.map +1 -0
- package/dist/components/gmail/actions/mark-as-unread.js +3 -0
- package/dist/components/gmail/actions/modify-labels.d.ts +12 -0
- package/dist/components/gmail/actions/modify-labels.d.ts.map +1 -0
- package/dist/components/gmail/actions/modify-labels.js +41 -0
- package/dist/components/gmail/actions/move-to-inbox.d.ts +5 -0
- package/dist/components/gmail/actions/move-to-inbox.d.ts.map +1 -0
- package/dist/components/gmail/actions/move-to-inbox.js +3 -0
- package/dist/components/gmail/actions/remove-label.d.ts +12 -0
- package/dist/components/gmail/actions/remove-label.d.ts.map +1 -0
- package/dist/components/gmail/actions/remove-label.js +33 -0
- package/dist/components/gmail/actions/reply-thread.d.ts +65 -0
- package/dist/components/gmail/actions/reply-thread.d.ts.map +1 -0
- package/dist/components/gmail/actions/reply-thread.js +35 -0
- package/dist/components/gmail/actions/reply.d.ts +66 -0
- package/dist/components/gmail/actions/reply.d.ts.map +1 -0
- package/dist/components/gmail/actions/reply.js +23 -0
- package/dist/components/gmail/actions/search-drafts.d.ts +18 -0
- package/dist/components/gmail/actions/search-drafts.d.ts.map +1 -0
- package/dist/components/gmail/actions/search-drafts.js +50 -0
- package/dist/components/gmail/actions/search-messages.d.ts +16 -0
- package/dist/components/gmail/actions/search-messages.d.ts.map +1 -0
- package/dist/components/gmail/actions/search-messages.js +45 -0
- package/dist/components/gmail/actions/search-threads.d.ts +15 -0
- package/dist/components/gmail/actions/search-threads.d.ts.map +1 -0
- package/dist/components/gmail/actions/search-threads.js +43 -0
- package/dist/components/gmail/actions/send-draft.d.ts +11 -0
- package/dist/components/gmail/actions/send-draft.d.ts.map +1 -0
- package/dist/components/gmail/actions/send-draft.js +18 -0
- package/dist/components/gmail/actions/send-email.d.ts +65 -0
- package/dist/components/gmail/actions/send-email.d.ts.map +1 -0
- package/dist/components/gmail/actions/send-email.js +35 -0
- package/dist/components/gmail/actions/star.d.ts +5 -0
- package/dist/components/gmail/actions/star.d.ts.map +1 -0
- package/dist/components/gmail/actions/star.js +3 -0
- package/dist/components/gmail/actions/trash.d.ts +15 -0
- package/dist/components/gmail/actions/trash.d.ts.map +1 -0
- package/dist/components/gmail/actions/trash.js +26 -0
- package/dist/components/gmail/actions/unmark-as-important.d.ts +5 -0
- package/dist/components/gmail/actions/unmark-as-important.d.ts.map +1 -0
- package/dist/components/gmail/actions/unmark-as-important.js +3 -0
- package/dist/components/gmail/actions/unstar.d.ts +5 -0
- package/dist/components/gmail/actions/unstar.d.ts.map +1 -0
- package/dist/components/gmail/actions/unstar.js +3 -0
- package/dist/components/gmail/actions/untrash.d.ts +15 -0
- package/dist/components/gmail/actions/untrash.d.ts.map +1 -0
- package/dist/components/gmail/actions/untrash.js +26 -0
- package/dist/components/gmail/actions/update-draft.d.ts +67 -0
- package/dist/components/gmail/actions/update-draft.d.ts.map +1 -0
- package/dist/components/gmail/actions/update-draft.js +67 -0
- package/dist/components/gmail/actions/update-label.d.ts +44 -0
- package/dist/components/gmail/actions/update-label.d.ts.map +1 -0
- package/dist/components/gmail/actions/update-label.js +38 -0
- package/dist/components/gmail/index.d.ts +5 -0
- package/dist/components/gmail/index.d.ts.map +1 -0
- package/dist/components/gmail/index.js +4 -0
- package/dist/components/gmail/lib/action-factories.d.ts +27 -0
- package/dist/components/gmail/lib/action-factories.d.ts.map +1 -0
- package/dist/components/gmail/lib/action-factories.js +55 -0
- package/dist/components/gmail/lib/gmail.d.ts +178 -0
- package/dist/components/gmail/lib/gmail.d.ts.map +1 -0
- package/dist/components/gmail/lib/gmail.js +411 -0
- package/dist/components/gmail/lib/schemas.d.ts +380 -0
- package/dist/components/gmail/lib/schemas.d.ts.map +1 -0
- package/dist/components/gmail/lib/schemas.js +226 -0
- package/dist/components/gmail/lib/scopes.d.ts +10 -0
- package/dist/components/gmail/lib/scopes.d.ts.map +1 -0
- package/dist/components/gmail/lib/scopes.js +16 -0
- package/dist/components/gmail/triggers/index.d.ts +2 -0
- package/dist/components/gmail/triggers/index.d.ts.map +1 -0
- package/dist/components/gmail/triggers/index.js +1 -0
- package/dist/components/gmail/triggers/on-new-email.d.ts +75 -0
- package/dist/components/gmail/triggers/on-new-email.d.ts.map +1 -0
- package/dist/components/gmail/triggers/on-new-email.js +30 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/package.json +26 -6
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { IntegrationAccountReference } from "../../../automation/integrations.js";
|
|
2
|
+
/** Options for subscribing to newly received Gmail messages. */
|
|
3
|
+
export interface OnNewEmailOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Google account binding to watch.
|
|
6
|
+
*
|
|
7
|
+
* Omitting this value uses the project's default Google account binding.
|
|
8
|
+
*/
|
|
9
|
+
account?: string | IntegrationAccountReference<"google">;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Subscribes to messages newly added to the Gmail inbox.
|
|
13
|
+
*
|
|
14
|
+
* The signal contains the same fully parsed message shape returned by
|
|
15
|
+
* {@link getMessage}, including MIME bodies, headers, labels, and attachments.
|
|
16
|
+
*
|
|
17
|
+
* @param options - Gmail account selection.
|
|
18
|
+
* @throws When the account selection is dynamic or belongs to another service.
|
|
19
|
+
*/
|
|
20
|
+
export declare function onNewEmail(options?: OnNewEmailOptions): import("../../..").Signal<{
|
|
21
|
+
messageId: string;
|
|
22
|
+
threadId: string;
|
|
23
|
+
labelIds: string[];
|
|
24
|
+
attachments: {
|
|
25
|
+
file: File;
|
|
26
|
+
filename: string;
|
|
27
|
+
mimeType: string;
|
|
28
|
+
related: boolean;
|
|
29
|
+
contentId?: string | undefined;
|
|
30
|
+
description?: string | undefined;
|
|
31
|
+
disposition?: "attachment" | "inline" | undefined;
|
|
32
|
+
}[];
|
|
33
|
+
bcc: {
|
|
34
|
+
address: string;
|
|
35
|
+
name?: string | undefined;
|
|
36
|
+
}[];
|
|
37
|
+
cc: {
|
|
38
|
+
address: string;
|
|
39
|
+
name?: string | undefined;
|
|
40
|
+
}[];
|
|
41
|
+
headers: {
|
|
42
|
+
name: string;
|
|
43
|
+
value: string;
|
|
44
|
+
}[];
|
|
45
|
+
receivedAt: Date | null;
|
|
46
|
+
references: string[];
|
|
47
|
+
replyTo: {
|
|
48
|
+
address: string;
|
|
49
|
+
name?: string | undefined;
|
|
50
|
+
}[];
|
|
51
|
+
subject: string;
|
|
52
|
+
to: {
|
|
53
|
+
address: string;
|
|
54
|
+
name?: string | undefined;
|
|
55
|
+
}[];
|
|
56
|
+
historyId?: string | undefined;
|
|
57
|
+
deliveredTo?: string | undefined;
|
|
58
|
+
from?: {
|
|
59
|
+
address: string;
|
|
60
|
+
name?: string | undefined;
|
|
61
|
+
} | undefined;
|
|
62
|
+
html?: string | undefined;
|
|
63
|
+
inReplyTo?: string | undefined;
|
|
64
|
+
rfc822MessageId?: string | undefined;
|
|
65
|
+
returnPath?: string | undefined;
|
|
66
|
+
sender?: {
|
|
67
|
+
address: string;
|
|
68
|
+
name?: string | undefined;
|
|
69
|
+
} | undefined;
|
|
70
|
+
sentAt?: Date | undefined;
|
|
71
|
+
sizeEstimate?: number | undefined;
|
|
72
|
+
snippet?: string | undefined;
|
|
73
|
+
text?: string | undefined;
|
|
74
|
+
}>;
|
|
75
|
+
//# sourceMappingURL=on-new-email.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"on-new-email.d.ts","sourceRoot":"","sources":["../../../../src/components/gmail/triggers/on-new-email.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,2BAA2B,EAAE,4CAAwC;AASnF,gEAAgE;AAChE,MAAM,WAAW,iBAAiB;IAChC;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,2BAA2B,CAAC,QAAQ,CAAC,CAAA;CACzD;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,OAAO,GAAE,iBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoBzD"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { planIntegrationAccountUse } from "../../../automation/account-planning.js";
|
|
2
|
+
import { serializedIntegrationAccountDefinition } from "../../../automation/integrations.js";
|
|
3
|
+
import { subscribe } from "../../../automation/subscribe.js";
|
|
4
|
+
import { GMAIL_READ_REQUIREMENT } from "../lib/scopes.js";
|
|
5
|
+
const GMAIL_MESSAGE_RECEIVED_EVENT_TYPE = "gmail.message.received";
|
|
6
|
+
/**
|
|
7
|
+
* Subscribes to messages newly added to the Gmail inbox.
|
|
8
|
+
*
|
|
9
|
+
* The signal contains the same fully parsed message shape returned by
|
|
10
|
+
* {@link getMessage}, including MIME bodies, headers, labels, and attachments.
|
|
11
|
+
*
|
|
12
|
+
* @param options - Gmail account selection.
|
|
13
|
+
* @throws When the account selection is dynamic or belongs to another service.
|
|
14
|
+
*/
|
|
15
|
+
export function onNewEmail(options = {}) {
|
|
16
|
+
const selection = planIntegrationAccountUse(options.account, "google", [
|
|
17
|
+
GMAIL_READ_REQUIREMENT,
|
|
18
|
+
]);
|
|
19
|
+
if (selection.dynamic) {
|
|
20
|
+
throw new Error("Gmail trigger account selection must be static.");
|
|
21
|
+
}
|
|
22
|
+
return subscribe(GMAIL_MESSAGE_RECEIVED_EVENT_TYPE, {
|
|
23
|
+
account: {
|
|
24
|
+
[serializedIntegrationAccountDefinition]: {
|
|
25
|
+
binding: selection.binding,
|
|
26
|
+
serviceId: "google",
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,iCAA6B;AAE7B,4BAAwB;AACxB,uCAAmC;AACnC,0CAAsC;AACtC,2CAAuC;AACvC,wCAAoC;AACpC,6CAAyC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,iCAA6B;AAE7B,4BAAwB;AACxB,uCAAmC;AACnC,0CAAsC;AACtC,2CAAuC;AACvC,wCAAoC;AACpC,6CAAyC;AACzC,2CAAiC"}
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "automate.ax",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "TypeScript SDK and CLI for Automate.ax automations.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
},
|
|
19
19
|
"zshy": {
|
|
20
20
|
"exports": {
|
|
21
|
-
".": "./src/index.ts"
|
|
21
|
+
".": "./src/index.ts",
|
|
22
|
+
"./gmail": "./src/components/gmail/index.ts"
|
|
22
23
|
},
|
|
23
24
|
"bin": {
|
|
24
25
|
"automate": "./src/cli.ts"
|
|
@@ -26,12 +27,13 @@
|
|
|
26
27
|
"cjs": false
|
|
27
28
|
},
|
|
28
29
|
"dependencies": {
|
|
30
|
+
"@automate.ax/client": "0.4.1",
|
|
31
|
+
"@automate.ax/codec": "0.4.1",
|
|
29
32
|
"@better-auth/api-key": "1.6.10",
|
|
30
33
|
"@better-auth/stripe": "1.6.10",
|
|
31
34
|
"@better-fetch/fetch": "*",
|
|
32
35
|
"@clack/prompts": "^1.4.0",
|
|
33
|
-
"@
|
|
34
|
-
"@automate.ax/codec": "0.1.3",
|
|
36
|
+
"@googleapis/gmail": "^12.0.0",
|
|
35
37
|
"@orpc/client": "1.13.14",
|
|
36
38
|
"@standard-schema/spec": "^1.1.0",
|
|
37
39
|
"@zachsents/zippy": "^1.1.4",
|
|
@@ -42,12 +44,17 @@
|
|
|
42
44
|
"citty": "^0.2.2",
|
|
43
45
|
"dedent": "^1.7.2",
|
|
44
46
|
"esbuild": "^0.27.7",
|
|
47
|
+
"escape-html": "^1.0.3",
|
|
45
48
|
"fuse.js": "^7.1.0",
|
|
46
49
|
"globby": "^16.2.0",
|
|
50
|
+
"html-to-text": "^10.0.0",
|
|
47
51
|
"nanoid": "^5.1.7",
|
|
48
52
|
"nanoid-dictionary": "^5.0.0",
|
|
53
|
+
"nodemailer": "^9.0.3",
|
|
49
54
|
"open": "^11.0.0",
|
|
50
55
|
"ora": "^9.3.0",
|
|
56
|
+
"p-map": "^7.0.6",
|
|
57
|
+
"postal-mime": "^2.7.5",
|
|
51
58
|
"remeda": "^2.33.7",
|
|
52
59
|
"string-width": "^8.2.1",
|
|
53
60
|
"type-fest": "^5.6.0",
|
|
@@ -61,12 +68,16 @@
|
|
|
61
68
|
".": {
|
|
62
69
|
"types": "./dist/index.d.ts",
|
|
63
70
|
"default": "./dist/index.js"
|
|
71
|
+
},
|
|
72
|
+
"./gmail": {
|
|
73
|
+
"types": "./dist/components/gmail/index.d.ts",
|
|
74
|
+
"default": "./dist/components/gmail/index.js"
|
|
64
75
|
}
|
|
65
76
|
},
|
|
66
77
|
"scripts": {
|
|
67
78
|
"typecheck": "tsc --noEmit",
|
|
68
|
-
"lint": "oxlint --type-aware",
|
|
69
|
-
"lint:fix": "oxlint --type-aware --fix-suggestions",
|
|
79
|
+
"lint": "concurrently --success all --kill-others-on-fail \"oxlint --type-aware\" \"bun --bun eslint .\"",
|
|
80
|
+
"lint:fix": "concurrently --success all --kill-others-on-fail \"oxlint --type-aware --fix --fix-suggestions\" \"bun --bun eslint . --fix\"",
|
|
70
81
|
"check": "bun run typecheck && bun run lint",
|
|
71
82
|
"test": "bun test",
|
|
72
83
|
"build": "zshy -p tsconfig.build.json && chmod +x dist/cli.js",
|
|
@@ -87,6 +98,15 @@
|
|
|
87
98
|
"devDependencies": {
|
|
88
99
|
"@internal/config": "0.0.0",
|
|
89
100
|
"@types/bun": "latest",
|
|
101
|
+
"@types/escape-html": "^1.0.4",
|
|
102
|
+
"@types/html-to-text": "^9.0.4",
|
|
103
|
+
"@types/nodemailer": "^8.0.1",
|
|
104
|
+
"@typescript/native": "npm:typescript@^7.0.2",
|
|
105
|
+
"@zachsents/oxlint-config": "^0.4.1",
|
|
106
|
+
"concurrently": "^10.0.4",
|
|
107
|
+
"eslint": "^9.39.5",
|
|
108
|
+
"oxlint": "^1.76.0",
|
|
109
|
+
"oxlint-tsgolint": "^7.0.2001",
|
|
90
110
|
"zshy": "^0.7.2"
|
|
91
111
|
}
|
|
92
112
|
}
|