@particle-academy/gmail-inbox-ui 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/CHANGELOG.md +40 -0
- package/LICENSE +21 -0
- package/README.md +137 -2
- package/art/fancified.svg +26 -0
- package/dist/index.cjs +339 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +178 -0
- package/dist/index.d.ts +178 -0
- package/dist/index.js +312 -0
- package/dist/index.js.map +1 -0
- package/package.json +67 -4
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import * as _particle_academy_fancy_flow_connectors from '@particle-academy/fancy-flow/connectors';
|
|
2
|
+
import { ConnectorMeta, OutputField } from '@particle-academy/fancy-flow/connectors';
|
|
3
|
+
import { NodeKindDefinition } from '@particle-academy/fancy-flow/engine';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* GENERATED FILE — do not edit.
|
|
7
|
+
*
|
|
8
|
+
* Emitted from provider/manifest.json by weaver's generator.
|
|
9
|
+
* A hand-edit here is destroyed by the next protocol sync, which is worse than
|
|
10
|
+
* being rejected, because it works until it silently does not. Fix
|
|
11
|
+
* provider/manifest.json (or weaver's template/) and regenerate:
|
|
12
|
+
*
|
|
13
|
+
* npm run provider -- gmail_inbox
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Gmail Inbox's identity on the authoring surface, shared by every Gmail Inbox
|
|
17
|
+
* node.
|
|
18
|
+
*
|
|
19
|
+
* This file must import nothing from the js package: a PHP or Python project
|
|
20
|
+
* installs the ui package and never that one, and the import would be a
|
|
21
|
+
* dangling module the moment it did.
|
|
22
|
+
*
|
|
23
|
+
* ## The sandbox trap
|
|
24
|
+
*
|
|
25
|
+
* Gmail has no sandbox. Every read reaches the connected account's real mail.
|
|
26
|
+
* The faker is the only way to develop against it without touching a real
|
|
27
|
+
* mailbox.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The connector API version this package was GENERATED against.
|
|
32
|
+
*
|
|
33
|
+
* A literal, never imported — an imported constant lets an upgrade rewrite the
|
|
34
|
+
* very claim it exists to detect.
|
|
35
|
+
*/
|
|
36
|
+
declare const CONNECTOR_API_VERSION = 1;
|
|
37
|
+
/** The parts of a connector's identity that belong to the SERVICE, not the node. */
|
|
38
|
+
declare const GMAIL_INBOX_SERVICE: {
|
|
39
|
+
readonly service: "gmail_inbox";
|
|
40
|
+
readonly serviceTitle: "Gmail Inbox";
|
|
41
|
+
readonly domain: "email";
|
|
42
|
+
readonly sandbox: "none";
|
|
43
|
+
};
|
|
44
|
+
/** The credentials a Gmail Inbox connection holds. */
|
|
45
|
+
declare const GMAIL_INBOX_CREDENTIALS: readonly [{
|
|
46
|
+
readonly key: "clientId";
|
|
47
|
+
readonly label: "OAuth client ID";
|
|
48
|
+
readonly scope: "provider";
|
|
49
|
+
readonly secret: false;
|
|
50
|
+
readonly help: "A DIFFERENT OAuth app than `gmail`'s, from Google Cloud Console -> APIs & Services -> Credentials. This one requests a restricted scope and carries Google's annual CASA assessment; `gmail`'s does not. Do not reuse the same client for both.";
|
|
51
|
+
}, {
|
|
52
|
+
readonly key: "clientSecret";
|
|
53
|
+
readonly label: "OAuth client secret";
|
|
54
|
+
readonly scope: "provider";
|
|
55
|
+
readonly secret: true;
|
|
56
|
+
readonly help: "The client secret for the same OAuth app. One value for the whole installation.";
|
|
57
|
+
}, {
|
|
58
|
+
readonly key: "accessToken";
|
|
59
|
+
readonly label: "Access token";
|
|
60
|
+
readonly scope: "account";
|
|
61
|
+
readonly secret: true;
|
|
62
|
+
readonly help: "Per connected Google account, and it expires after ONE HOUR. The host refreshes it with the refresh token.";
|
|
63
|
+
}, {
|
|
64
|
+
readonly key: "refreshToken";
|
|
65
|
+
readonly label: "Refresh token";
|
|
66
|
+
readonly scope: "account";
|
|
67
|
+
readonly secret: true;
|
|
68
|
+
readonly help: "Per connected Google account. Google issues one only when the consent request asks for offline access; without it the connection dies within the hour.";
|
|
69
|
+
}];
|
|
70
|
+
/**
|
|
71
|
+
* The OAuth2 exchange Gmail Inbox requires — DECLARED here, performed by the
|
|
72
|
+
* host.
|
|
73
|
+
*
|
|
74
|
+
* A consent screen needs a browser, a redirect URI and somewhere to persist
|
|
75
|
+
* the result, and all three belong to the host; a package that ran the dance
|
|
76
|
+
* itself would have to own a web server. So this says precisely enough for a
|
|
77
|
+
* host to do it.
|
|
78
|
+
*
|
|
79
|
+
* The access token lasts 3600 seconds. A host that never refreshes will work
|
|
80
|
+
* all afternoon and be broken by morning, which is why the lifetime is stated
|
|
81
|
+
* rather than left to be discovered.
|
|
82
|
+
*
|
|
83
|
+
* Its refresh tokens do NOT rotate: the same one is reusable, so a refresh may
|
|
84
|
+
* safely be retried and may run concurrently. That is stated rather than
|
|
85
|
+
* assumed because the opposite — a provider that spends the token and revokes
|
|
86
|
+
* the grant on a replay — looks identical until it happens.
|
|
87
|
+
*/
|
|
88
|
+
declare const GMAIL_INBOX_OAUTH: {
|
|
89
|
+
readonly flow: "authorization_code";
|
|
90
|
+
readonly authorizeUrl: "https://accounts.google.com/o/oauth2/v2/auth";
|
|
91
|
+
readonly tokenUrl: "https://oauth2.googleapis.com/token";
|
|
92
|
+
readonly scopes: readonly ["https://www.googleapis.com/auth/gmail.readonly"];
|
|
93
|
+
readonly accessTokenCredential: "accessToken";
|
|
94
|
+
readonly refreshTokenCredential: "refreshToken";
|
|
95
|
+
readonly refreshTokenRotates: false;
|
|
96
|
+
readonly accessTokenTtlSeconds: 3600;
|
|
97
|
+
};
|
|
98
|
+
/** Build a Gmail Inbox node's connector metadata from the operation it performs. */
|
|
99
|
+
declare function gmailInboxMeta(role: ConnectorMeta["role"], operation: string, docs: string): ConnectorMeta;
|
|
100
|
+
|
|
101
|
+
declare const GMAIL_INBOX_LABEL_LIST_KIND = "@particle-academy/gmail_inbox_label_list";
|
|
102
|
+
declare const GMAIL_INBOX_LABEL_LIST_OPERATION = "label_list";
|
|
103
|
+
declare const GMAIL_INBOX_LABEL_LIST_META: _particle_academy_fancy_flow_connectors.ConnectorMeta;
|
|
104
|
+
/**
|
|
105
|
+
* What this node emits — the "ingredients" a downstream node can reference.
|
|
106
|
+
*
|
|
107
|
+
* fancy-flow reads `outputShape` off the kind and offers it in the variable
|
|
108
|
+
* picker, so declaring it is the whole of the work: an author configuring the
|
|
109
|
+
* next node picks `{{ $json.data.id }}` off a list instead of typing a path
|
|
110
|
+
* and hoping.
|
|
111
|
+
*/
|
|
112
|
+
declare const GMAIL_INBOX_LABEL_LIST_OUTPUT: OutputField[];
|
|
113
|
+
declare const gmailInboxLabelListKind: NodeKindDefinition;
|
|
114
|
+
|
|
115
|
+
declare const GMAIL_INBOX_MESSAGE_GET_KIND = "@particle-academy/gmail_inbox_message_get";
|
|
116
|
+
declare const GMAIL_INBOX_MESSAGE_GET_OPERATION = "message_get";
|
|
117
|
+
declare const GMAIL_INBOX_MESSAGE_GET_META: _particle_academy_fancy_flow_connectors.ConnectorMeta;
|
|
118
|
+
/**
|
|
119
|
+
* What this node emits — the "ingredients" a downstream node can reference.
|
|
120
|
+
*
|
|
121
|
+
* fancy-flow reads `outputShape` off the kind and offers it in the variable
|
|
122
|
+
* picker, so declaring it is the whole of the work: an author configuring the
|
|
123
|
+
* next node picks `{{ $json.data.id }}` off a list instead of typing a path
|
|
124
|
+
* and hoping.
|
|
125
|
+
*/
|
|
126
|
+
declare const GMAIL_INBOX_MESSAGE_GET_OUTPUT: OutputField[];
|
|
127
|
+
declare const gmailInboxMessageGetKind: NodeKindDefinition;
|
|
128
|
+
|
|
129
|
+
declare const GMAIL_INBOX_MESSAGE_LIST_KIND = "@particle-academy/gmail_inbox_message_list";
|
|
130
|
+
declare const GMAIL_INBOX_MESSAGE_LIST_OPERATION = "message_list";
|
|
131
|
+
declare const GMAIL_INBOX_MESSAGE_LIST_META: _particle_academy_fancy_flow_connectors.ConnectorMeta;
|
|
132
|
+
/**
|
|
133
|
+
* What this node emits — the "ingredients" a downstream node can reference.
|
|
134
|
+
*
|
|
135
|
+
* fancy-flow reads `outputShape` off the kind and offers it in the variable
|
|
136
|
+
* picker, so declaring it is the whole of the work: an author configuring the
|
|
137
|
+
* next node picks `{{ $json.data.id }}` off a list instead of typing a path
|
|
138
|
+
* and hoping.
|
|
139
|
+
*/
|
|
140
|
+
declare const GMAIL_INBOX_MESSAGE_LIST_OUTPUT: OutputField[];
|
|
141
|
+
declare const gmailInboxMessageListKind: NodeKindDefinition;
|
|
142
|
+
|
|
143
|
+
declare const GMAIL_INBOX_THREAD_GET_KIND = "@particle-academy/gmail_inbox_thread_get";
|
|
144
|
+
declare const GMAIL_INBOX_THREAD_GET_OPERATION = "thread_get";
|
|
145
|
+
declare const GMAIL_INBOX_THREAD_GET_META: _particle_academy_fancy_flow_connectors.ConnectorMeta;
|
|
146
|
+
/**
|
|
147
|
+
* What this node emits — the "ingredients" a downstream node can reference.
|
|
148
|
+
*
|
|
149
|
+
* fancy-flow reads `outputShape` off the kind and offers it in the variable
|
|
150
|
+
* picker, so declaring it is the whole of the work: an author configuring the
|
|
151
|
+
* next node picks `{{ $json.data.id }}` off a list instead of typing a path
|
|
152
|
+
* and hoping.
|
|
153
|
+
*/
|
|
154
|
+
declare const GMAIL_INBOX_THREAD_GET_OUTPUT: OutputField[];
|
|
155
|
+
declare const gmailInboxThreadGetKind: NodeKindDefinition;
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* GENERATED FILE — do not edit.
|
|
159
|
+
*
|
|
160
|
+
* Emitted from provider/manifest.json by weaver's generator.
|
|
161
|
+
* A hand-edit here is destroyed by the next protocol sync, which is worse than
|
|
162
|
+
* being rejected, because it works until it silently does not. Fix
|
|
163
|
+
* provider/manifest.json (or weaver's template/) and regenerate:
|
|
164
|
+
*
|
|
165
|
+
* npm run provider -- gmail_inbox
|
|
166
|
+
*/
|
|
167
|
+
/**
|
|
168
|
+
* Gmail Inbox's node kinds for fancy-flow.
|
|
169
|
+
*
|
|
170
|
+
* Install this on every host. The TypeScript executors live in the js
|
|
171
|
+
* package's `./flow` subpath; PHP and Python hosts run their own and need only
|
|
172
|
+
* this.
|
|
173
|
+
*/
|
|
174
|
+
|
|
175
|
+
/** Every Gmail Inbox kind, for a host that registers the lot. */
|
|
176
|
+
declare const GMAIL_INBOX_KINDS: NodeKindDefinition[];
|
|
177
|
+
|
|
178
|
+
export { CONNECTOR_API_VERSION, GMAIL_INBOX_CREDENTIALS, GMAIL_INBOX_KINDS, GMAIL_INBOX_LABEL_LIST_KIND, GMAIL_INBOX_LABEL_LIST_META, GMAIL_INBOX_LABEL_LIST_OPERATION, GMAIL_INBOX_LABEL_LIST_OUTPUT, GMAIL_INBOX_MESSAGE_GET_KIND, GMAIL_INBOX_MESSAGE_GET_META, GMAIL_INBOX_MESSAGE_GET_OPERATION, GMAIL_INBOX_MESSAGE_GET_OUTPUT, GMAIL_INBOX_MESSAGE_LIST_KIND, GMAIL_INBOX_MESSAGE_LIST_META, GMAIL_INBOX_MESSAGE_LIST_OPERATION, GMAIL_INBOX_MESSAGE_LIST_OUTPUT, GMAIL_INBOX_OAUTH, GMAIL_INBOX_SERVICE, GMAIL_INBOX_THREAD_GET_KIND, GMAIL_INBOX_THREAD_GET_META, GMAIL_INBOX_THREAD_GET_OPERATION, GMAIL_INBOX_THREAD_GET_OUTPUT, gmailInboxLabelListKind, gmailInboxMessageGetKind, gmailInboxMessageListKind, gmailInboxMeta, gmailInboxThreadGetKind };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import * as _particle_academy_fancy_flow_connectors from '@particle-academy/fancy-flow/connectors';
|
|
2
|
+
import { ConnectorMeta, OutputField } from '@particle-academy/fancy-flow/connectors';
|
|
3
|
+
import { NodeKindDefinition } from '@particle-academy/fancy-flow/engine';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* GENERATED FILE — do not edit.
|
|
7
|
+
*
|
|
8
|
+
* Emitted from provider/manifest.json by weaver's generator.
|
|
9
|
+
* A hand-edit here is destroyed by the next protocol sync, which is worse than
|
|
10
|
+
* being rejected, because it works until it silently does not. Fix
|
|
11
|
+
* provider/manifest.json (or weaver's template/) and regenerate:
|
|
12
|
+
*
|
|
13
|
+
* npm run provider -- gmail_inbox
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Gmail Inbox's identity on the authoring surface, shared by every Gmail Inbox
|
|
17
|
+
* node.
|
|
18
|
+
*
|
|
19
|
+
* This file must import nothing from the js package: a PHP or Python project
|
|
20
|
+
* installs the ui package and never that one, and the import would be a
|
|
21
|
+
* dangling module the moment it did.
|
|
22
|
+
*
|
|
23
|
+
* ## The sandbox trap
|
|
24
|
+
*
|
|
25
|
+
* Gmail has no sandbox. Every read reaches the connected account's real mail.
|
|
26
|
+
* The faker is the only way to develop against it without touching a real
|
|
27
|
+
* mailbox.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The connector API version this package was GENERATED against.
|
|
32
|
+
*
|
|
33
|
+
* A literal, never imported — an imported constant lets an upgrade rewrite the
|
|
34
|
+
* very claim it exists to detect.
|
|
35
|
+
*/
|
|
36
|
+
declare const CONNECTOR_API_VERSION = 1;
|
|
37
|
+
/** The parts of a connector's identity that belong to the SERVICE, not the node. */
|
|
38
|
+
declare const GMAIL_INBOX_SERVICE: {
|
|
39
|
+
readonly service: "gmail_inbox";
|
|
40
|
+
readonly serviceTitle: "Gmail Inbox";
|
|
41
|
+
readonly domain: "email";
|
|
42
|
+
readonly sandbox: "none";
|
|
43
|
+
};
|
|
44
|
+
/** The credentials a Gmail Inbox connection holds. */
|
|
45
|
+
declare const GMAIL_INBOX_CREDENTIALS: readonly [{
|
|
46
|
+
readonly key: "clientId";
|
|
47
|
+
readonly label: "OAuth client ID";
|
|
48
|
+
readonly scope: "provider";
|
|
49
|
+
readonly secret: false;
|
|
50
|
+
readonly help: "A DIFFERENT OAuth app than `gmail`'s, from Google Cloud Console -> APIs & Services -> Credentials. This one requests a restricted scope and carries Google's annual CASA assessment; `gmail`'s does not. Do not reuse the same client for both.";
|
|
51
|
+
}, {
|
|
52
|
+
readonly key: "clientSecret";
|
|
53
|
+
readonly label: "OAuth client secret";
|
|
54
|
+
readonly scope: "provider";
|
|
55
|
+
readonly secret: true;
|
|
56
|
+
readonly help: "The client secret for the same OAuth app. One value for the whole installation.";
|
|
57
|
+
}, {
|
|
58
|
+
readonly key: "accessToken";
|
|
59
|
+
readonly label: "Access token";
|
|
60
|
+
readonly scope: "account";
|
|
61
|
+
readonly secret: true;
|
|
62
|
+
readonly help: "Per connected Google account, and it expires after ONE HOUR. The host refreshes it with the refresh token.";
|
|
63
|
+
}, {
|
|
64
|
+
readonly key: "refreshToken";
|
|
65
|
+
readonly label: "Refresh token";
|
|
66
|
+
readonly scope: "account";
|
|
67
|
+
readonly secret: true;
|
|
68
|
+
readonly help: "Per connected Google account. Google issues one only when the consent request asks for offline access; without it the connection dies within the hour.";
|
|
69
|
+
}];
|
|
70
|
+
/**
|
|
71
|
+
* The OAuth2 exchange Gmail Inbox requires — DECLARED here, performed by the
|
|
72
|
+
* host.
|
|
73
|
+
*
|
|
74
|
+
* A consent screen needs a browser, a redirect URI and somewhere to persist
|
|
75
|
+
* the result, and all three belong to the host; a package that ran the dance
|
|
76
|
+
* itself would have to own a web server. So this says precisely enough for a
|
|
77
|
+
* host to do it.
|
|
78
|
+
*
|
|
79
|
+
* The access token lasts 3600 seconds. A host that never refreshes will work
|
|
80
|
+
* all afternoon and be broken by morning, which is why the lifetime is stated
|
|
81
|
+
* rather than left to be discovered.
|
|
82
|
+
*
|
|
83
|
+
* Its refresh tokens do NOT rotate: the same one is reusable, so a refresh may
|
|
84
|
+
* safely be retried and may run concurrently. That is stated rather than
|
|
85
|
+
* assumed because the opposite — a provider that spends the token and revokes
|
|
86
|
+
* the grant on a replay — looks identical until it happens.
|
|
87
|
+
*/
|
|
88
|
+
declare const GMAIL_INBOX_OAUTH: {
|
|
89
|
+
readonly flow: "authorization_code";
|
|
90
|
+
readonly authorizeUrl: "https://accounts.google.com/o/oauth2/v2/auth";
|
|
91
|
+
readonly tokenUrl: "https://oauth2.googleapis.com/token";
|
|
92
|
+
readonly scopes: readonly ["https://www.googleapis.com/auth/gmail.readonly"];
|
|
93
|
+
readonly accessTokenCredential: "accessToken";
|
|
94
|
+
readonly refreshTokenCredential: "refreshToken";
|
|
95
|
+
readonly refreshTokenRotates: false;
|
|
96
|
+
readonly accessTokenTtlSeconds: 3600;
|
|
97
|
+
};
|
|
98
|
+
/** Build a Gmail Inbox node's connector metadata from the operation it performs. */
|
|
99
|
+
declare function gmailInboxMeta(role: ConnectorMeta["role"], operation: string, docs: string): ConnectorMeta;
|
|
100
|
+
|
|
101
|
+
declare const GMAIL_INBOX_LABEL_LIST_KIND = "@particle-academy/gmail_inbox_label_list";
|
|
102
|
+
declare const GMAIL_INBOX_LABEL_LIST_OPERATION = "label_list";
|
|
103
|
+
declare const GMAIL_INBOX_LABEL_LIST_META: _particle_academy_fancy_flow_connectors.ConnectorMeta;
|
|
104
|
+
/**
|
|
105
|
+
* What this node emits — the "ingredients" a downstream node can reference.
|
|
106
|
+
*
|
|
107
|
+
* fancy-flow reads `outputShape` off the kind and offers it in the variable
|
|
108
|
+
* picker, so declaring it is the whole of the work: an author configuring the
|
|
109
|
+
* next node picks `{{ $json.data.id }}` off a list instead of typing a path
|
|
110
|
+
* and hoping.
|
|
111
|
+
*/
|
|
112
|
+
declare const GMAIL_INBOX_LABEL_LIST_OUTPUT: OutputField[];
|
|
113
|
+
declare const gmailInboxLabelListKind: NodeKindDefinition;
|
|
114
|
+
|
|
115
|
+
declare const GMAIL_INBOX_MESSAGE_GET_KIND = "@particle-academy/gmail_inbox_message_get";
|
|
116
|
+
declare const GMAIL_INBOX_MESSAGE_GET_OPERATION = "message_get";
|
|
117
|
+
declare const GMAIL_INBOX_MESSAGE_GET_META: _particle_academy_fancy_flow_connectors.ConnectorMeta;
|
|
118
|
+
/**
|
|
119
|
+
* What this node emits — the "ingredients" a downstream node can reference.
|
|
120
|
+
*
|
|
121
|
+
* fancy-flow reads `outputShape` off the kind and offers it in the variable
|
|
122
|
+
* picker, so declaring it is the whole of the work: an author configuring the
|
|
123
|
+
* next node picks `{{ $json.data.id }}` off a list instead of typing a path
|
|
124
|
+
* and hoping.
|
|
125
|
+
*/
|
|
126
|
+
declare const GMAIL_INBOX_MESSAGE_GET_OUTPUT: OutputField[];
|
|
127
|
+
declare const gmailInboxMessageGetKind: NodeKindDefinition;
|
|
128
|
+
|
|
129
|
+
declare const GMAIL_INBOX_MESSAGE_LIST_KIND = "@particle-academy/gmail_inbox_message_list";
|
|
130
|
+
declare const GMAIL_INBOX_MESSAGE_LIST_OPERATION = "message_list";
|
|
131
|
+
declare const GMAIL_INBOX_MESSAGE_LIST_META: _particle_academy_fancy_flow_connectors.ConnectorMeta;
|
|
132
|
+
/**
|
|
133
|
+
* What this node emits — the "ingredients" a downstream node can reference.
|
|
134
|
+
*
|
|
135
|
+
* fancy-flow reads `outputShape` off the kind and offers it in the variable
|
|
136
|
+
* picker, so declaring it is the whole of the work: an author configuring the
|
|
137
|
+
* next node picks `{{ $json.data.id }}` off a list instead of typing a path
|
|
138
|
+
* and hoping.
|
|
139
|
+
*/
|
|
140
|
+
declare const GMAIL_INBOX_MESSAGE_LIST_OUTPUT: OutputField[];
|
|
141
|
+
declare const gmailInboxMessageListKind: NodeKindDefinition;
|
|
142
|
+
|
|
143
|
+
declare const GMAIL_INBOX_THREAD_GET_KIND = "@particle-academy/gmail_inbox_thread_get";
|
|
144
|
+
declare const GMAIL_INBOX_THREAD_GET_OPERATION = "thread_get";
|
|
145
|
+
declare const GMAIL_INBOX_THREAD_GET_META: _particle_academy_fancy_flow_connectors.ConnectorMeta;
|
|
146
|
+
/**
|
|
147
|
+
* What this node emits — the "ingredients" a downstream node can reference.
|
|
148
|
+
*
|
|
149
|
+
* fancy-flow reads `outputShape` off the kind and offers it in the variable
|
|
150
|
+
* picker, so declaring it is the whole of the work: an author configuring the
|
|
151
|
+
* next node picks `{{ $json.data.id }}` off a list instead of typing a path
|
|
152
|
+
* and hoping.
|
|
153
|
+
*/
|
|
154
|
+
declare const GMAIL_INBOX_THREAD_GET_OUTPUT: OutputField[];
|
|
155
|
+
declare const gmailInboxThreadGetKind: NodeKindDefinition;
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* GENERATED FILE — do not edit.
|
|
159
|
+
*
|
|
160
|
+
* Emitted from provider/manifest.json by weaver's generator.
|
|
161
|
+
* A hand-edit here is destroyed by the next protocol sync, which is worse than
|
|
162
|
+
* being rejected, because it works until it silently does not. Fix
|
|
163
|
+
* provider/manifest.json (or weaver's template/) and regenerate:
|
|
164
|
+
*
|
|
165
|
+
* npm run provider -- gmail_inbox
|
|
166
|
+
*/
|
|
167
|
+
/**
|
|
168
|
+
* Gmail Inbox's node kinds for fancy-flow.
|
|
169
|
+
*
|
|
170
|
+
* Install this on every host. The TypeScript executors live in the js
|
|
171
|
+
* package's `./flow` subpath; PHP and Python hosts run their own and need only
|
|
172
|
+
* this.
|
|
173
|
+
*/
|
|
174
|
+
|
|
175
|
+
/** Every Gmail Inbox kind, for a host that registers the lot. */
|
|
176
|
+
declare const GMAIL_INBOX_KINDS: NodeKindDefinition[];
|
|
177
|
+
|
|
178
|
+
export { CONNECTOR_API_VERSION, GMAIL_INBOX_CREDENTIALS, GMAIL_INBOX_KINDS, GMAIL_INBOX_LABEL_LIST_KIND, GMAIL_INBOX_LABEL_LIST_META, GMAIL_INBOX_LABEL_LIST_OPERATION, GMAIL_INBOX_LABEL_LIST_OUTPUT, GMAIL_INBOX_MESSAGE_GET_KIND, GMAIL_INBOX_MESSAGE_GET_META, GMAIL_INBOX_MESSAGE_GET_OPERATION, GMAIL_INBOX_MESSAGE_GET_OUTPUT, GMAIL_INBOX_MESSAGE_LIST_KIND, GMAIL_INBOX_MESSAGE_LIST_META, GMAIL_INBOX_MESSAGE_LIST_OPERATION, GMAIL_INBOX_MESSAGE_LIST_OUTPUT, GMAIL_INBOX_OAUTH, GMAIL_INBOX_SERVICE, GMAIL_INBOX_THREAD_GET_KIND, GMAIL_INBOX_THREAD_GET_META, GMAIL_INBOX_THREAD_GET_OPERATION, GMAIL_INBOX_THREAD_GET_OUTPUT, gmailInboxLabelListKind, gmailInboxMessageGetKind, gmailInboxMessageListKind, gmailInboxMeta, gmailInboxThreadGetKind };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
import { defineConnectorKind, summarize } from '@particle-academy/fancy-flow/connectors';
|
|
2
|
+
|
|
3
|
+
// src/service.ts
|
|
4
|
+
var CONNECTOR_API_VERSION = 1;
|
|
5
|
+
var GMAIL_INBOX_SERVICE = {
|
|
6
|
+
service: "gmail_inbox",
|
|
7
|
+
serviceTitle: "Gmail Inbox",
|
|
8
|
+
domain: "email",
|
|
9
|
+
sandbox: "none"
|
|
10
|
+
};
|
|
11
|
+
var GMAIL_INBOX_CREDENTIALS = [
|
|
12
|
+
{
|
|
13
|
+
"key": "clientId",
|
|
14
|
+
"label": "OAuth client ID",
|
|
15
|
+
"scope": "provider",
|
|
16
|
+
"secret": false,
|
|
17
|
+
"help": "A DIFFERENT OAuth app than `gmail`'s, from Google Cloud Console -> APIs & Services -> Credentials. This one requests a restricted scope and carries Google's annual CASA assessment; `gmail`'s does not. Do not reuse the same client for both."
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"key": "clientSecret",
|
|
21
|
+
"label": "OAuth client secret",
|
|
22
|
+
"scope": "provider",
|
|
23
|
+
"secret": true,
|
|
24
|
+
"help": "The client secret for the same OAuth app. One value for the whole installation."
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"key": "accessToken",
|
|
28
|
+
"label": "Access token",
|
|
29
|
+
"scope": "account",
|
|
30
|
+
"secret": true,
|
|
31
|
+
"help": "Per connected Google account, and it expires after ONE HOUR. The host refreshes it with the refresh token."
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"key": "refreshToken",
|
|
35
|
+
"label": "Refresh token",
|
|
36
|
+
"scope": "account",
|
|
37
|
+
"secret": true,
|
|
38
|
+
"help": "Per connected Google account. Google issues one only when the consent request asks for offline access; without it the connection dies within the hour."
|
|
39
|
+
}
|
|
40
|
+
];
|
|
41
|
+
var GMAIL_INBOX_OAUTH = {
|
|
42
|
+
"flow": "authorization_code",
|
|
43
|
+
"authorizeUrl": "https://accounts.google.com/o/oauth2/v2/auth",
|
|
44
|
+
"tokenUrl": "https://oauth2.googleapis.com/token",
|
|
45
|
+
"scopes": [
|
|
46
|
+
"https://www.googleapis.com/auth/gmail.readonly"
|
|
47
|
+
],
|
|
48
|
+
"accessTokenCredential": "accessToken",
|
|
49
|
+
"refreshTokenCredential": "refreshToken",
|
|
50
|
+
"refreshTokenRotates": false,
|
|
51
|
+
"accessTokenTtlSeconds": 3600
|
|
52
|
+
};
|
|
53
|
+
function gmailInboxMeta(role, operation, docs) {
|
|
54
|
+
return { ...GMAIL_INBOX_SERVICE, role, operation, docs };
|
|
55
|
+
}
|
|
56
|
+
var GMAIL_INBOX_LABEL_LIST_KIND = "@particle-academy/gmail_inbox_label_list";
|
|
57
|
+
var GMAIL_INBOX_LABEL_LIST_OPERATION = "label_list";
|
|
58
|
+
var GMAIL_INBOX_LABEL_LIST_META = gmailInboxMeta("action", "list labels", "https://developers.google.com/workspace/gmail/api/reference/rest/v1/users.labels/list");
|
|
59
|
+
var GMAIL_INBOX_LABEL_LIST_OUTPUT = [
|
|
60
|
+
{
|
|
61
|
+
"path": "data.labels",
|
|
62
|
+
"type": "array",
|
|
63
|
+
"description": "Each with id, name and type (system or user). messagesTotal/messagesUnread/threadsTotal/threadsUnread are part of Label's schema but not confirmed present on every list row -- read one label with labels.get if a count comes back missing."
|
|
64
|
+
}
|
|
65
|
+
];
|
|
66
|
+
var gmailInboxLabelListKind = defineConnectorKind(GMAIL_INBOX_LABEL_LIST_META, {
|
|
67
|
+
name: GMAIL_INBOX_LABEL_LIST_KIND,
|
|
68
|
+
aliases: ["gmail_inbox_label_list"],
|
|
69
|
+
label: "List Gmail labels",
|
|
70
|
+
description: "List every label on the mailbox, system and user-created.",
|
|
71
|
+
inputs: [{ id: "in" }],
|
|
72
|
+
outputs: [{ id: "out" }],
|
|
73
|
+
sideEffects: "none",
|
|
74
|
+
outputShape: GMAIL_INBOX_LABEL_LIST_OUTPUT,
|
|
75
|
+
configSchema: [
|
|
76
|
+
{
|
|
77
|
+
"type": "text",
|
|
78
|
+
"key": "userId",
|
|
79
|
+
"label": "Mailbox",
|
|
80
|
+
"required": true,
|
|
81
|
+
"default": "me"
|
|
82
|
+
}
|
|
83
|
+
],
|
|
84
|
+
defaultConfig: {
|
|
85
|
+
"mode": "auto"
|
|
86
|
+
},
|
|
87
|
+
renderBody: ({ config }) => summarize(GMAIL_INBOX_LABEL_LIST_META, config, "list labels")
|
|
88
|
+
});
|
|
89
|
+
var GMAIL_INBOX_MESSAGE_GET_KIND = "@particle-academy/gmail_inbox_message_get";
|
|
90
|
+
var GMAIL_INBOX_MESSAGE_GET_OPERATION = "message_get";
|
|
91
|
+
var GMAIL_INBOX_MESSAGE_GET_META = gmailInboxMeta("action", "read a message", "https://developers.google.com/workspace/gmail/api/reference/rest/v1/users.messages/get");
|
|
92
|
+
var GMAIL_INBOX_MESSAGE_GET_OUTPUT = [
|
|
93
|
+
{
|
|
94
|
+
"path": "data.id",
|
|
95
|
+
"type": "string",
|
|
96
|
+
"description": "The message id."
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"path": "data.threadId",
|
|
100
|
+
"type": "string",
|
|
101
|
+
"description": "The thread this message belongs to."
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"path": "data.labelIds",
|
|
105
|
+
"type": "array",
|
|
106
|
+
"description": "System and user label ids currently on this message."
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"path": "data.snippet",
|
|
110
|
+
"type": "string",
|
|
111
|
+
"description": "Gmail's own short plain-text preview of the body -- a few hundred characters, not the whole message."
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"path": "data.internalDate",
|
|
115
|
+
"type": "string",
|
|
116
|
+
"description": "Unix epoch MILLISECONDS, as a string -- when Gmail received it, which can differ from the Date header."
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"path": "data.payload.headers",
|
|
120
|
+
"type": "array",
|
|
121
|
+
"description": "Every RFC 2822 header as { name, value }, unparsed. From/To/Subject/Date live here."
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"path": "data.payload",
|
|
125
|
+
"type": "unknown",
|
|
126
|
+
"description": "The full MIME tree, raw -- mimeType, body (base64url in body.data for a leaf part), and nested parts for a multipart message. Decode it yourself for plain-text or HTML content; this connector does not flatten it."
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"path": "mode",
|
|
130
|
+
"type": "string",
|
|
131
|
+
"description": "Which estate this ran against. Google has no sandbox, so: fake or live."
|
|
132
|
+
}
|
|
133
|
+
];
|
|
134
|
+
var gmailInboxMessageGetKind = defineConnectorKind(GMAIL_INBOX_MESSAGE_GET_META, {
|
|
135
|
+
name: GMAIL_INBOX_MESSAGE_GET_KIND,
|
|
136
|
+
aliases: ["gmail_inbox_message_get"],
|
|
137
|
+
label: "Gmail message",
|
|
138
|
+
description: "Read one message's headers and preview. The body's plain/HTML text is NOT decoded -- see the raw payload for that.",
|
|
139
|
+
inputs: [{ id: "in" }],
|
|
140
|
+
outputs: [{ id: "out" }],
|
|
141
|
+
sideEffects: "none",
|
|
142
|
+
outputShape: GMAIL_INBOX_MESSAGE_GET_OUTPUT,
|
|
143
|
+
configSchema: [
|
|
144
|
+
{
|
|
145
|
+
"type": "text",
|
|
146
|
+
"key": "userId",
|
|
147
|
+
"label": "Mailbox",
|
|
148
|
+
"required": true,
|
|
149
|
+
"default": "me"
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"type": "text",
|
|
153
|
+
"key": "id",
|
|
154
|
+
"label": "Message ID",
|
|
155
|
+
"required": true,
|
|
156
|
+
"description": "From message_list, or another node's output."
|
|
157
|
+
}
|
|
158
|
+
],
|
|
159
|
+
defaultConfig: {
|
|
160
|
+
"mode": "auto"
|
|
161
|
+
},
|
|
162
|
+
renderBody: ({ config }) => summarize(GMAIL_INBOX_MESSAGE_GET_META, config, "read a message")
|
|
163
|
+
});
|
|
164
|
+
var GMAIL_INBOX_MESSAGE_LIST_KIND = "@particle-academy/gmail_inbox_message_list";
|
|
165
|
+
var GMAIL_INBOX_MESSAGE_LIST_OPERATION = "message_list";
|
|
166
|
+
var GMAIL_INBOX_MESSAGE_LIST_META = gmailInboxMeta("action", "list messages", "https://developers.google.com/workspace/gmail/api/reference/rest/v1/users.messages/list");
|
|
167
|
+
var GMAIL_INBOX_MESSAGE_LIST_OUTPUT = [
|
|
168
|
+
{
|
|
169
|
+
"path": "data.messages",
|
|
170
|
+
"type": "array",
|
|
171
|
+
"description": "Each row is { id, threadId } only. Read a message's content with message_get."
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
"path": "data.nextPageToken",
|
|
175
|
+
"type": "string",
|
|
176
|
+
"description": "Present when there is another page."
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"path": "data.resultSizeEstimate",
|
|
180
|
+
"type": "number",
|
|
181
|
+
"description": "Gmail's own word for it: an ESTIMATE, not an exact count."
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
"path": "mode",
|
|
185
|
+
"type": "string",
|
|
186
|
+
"description": "Which estate this ran against. Google has no sandbox, so: fake or live."
|
|
187
|
+
}
|
|
188
|
+
];
|
|
189
|
+
var gmailInboxMessageListKind = defineConnectorKind(GMAIL_INBOX_MESSAGE_LIST_META, {
|
|
190
|
+
name: GMAIL_INBOX_MESSAGE_LIST_KIND,
|
|
191
|
+
aliases: ["gmail_inbox_message_list"],
|
|
192
|
+
label: "List Gmail messages",
|
|
193
|
+
description: "List message ids matching a search, newest first.",
|
|
194
|
+
inputs: [{ id: "in" }],
|
|
195
|
+
outputs: [{ id: "out" }],
|
|
196
|
+
sideEffects: "none",
|
|
197
|
+
outputShape: GMAIL_INBOX_MESSAGE_LIST_OUTPUT,
|
|
198
|
+
configSchema: [
|
|
199
|
+
{
|
|
200
|
+
"type": "text",
|
|
201
|
+
"key": "userId",
|
|
202
|
+
"label": "Mailbox",
|
|
203
|
+
"required": true,
|
|
204
|
+
"default": "me",
|
|
205
|
+
"description": "`me` is the connected account and is almost always what you want."
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
"type": "text",
|
|
209
|
+
"key": "q",
|
|
210
|
+
"label": "Search",
|
|
211
|
+
"description": `Gmail's own search syntax, exactly as typed into the Gmail search box -- e.g. "from:ada@example.test has:attachment newer_than:7d". Leave blank to list everything.`
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
"type": "text",
|
|
215
|
+
"key": "labelId",
|
|
216
|
+
"label": "Label ID",
|
|
217
|
+
"description": "Only messages with this label -- e.g. INBOX, or a label_list id. Gmail's own query parameter accepts several, repeated; this connector offers one for now -- combine more in the search field above instead, using Gmail's own label: search operator."
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
"type": "switch",
|
|
221
|
+
"key": "includeSpamTrash",
|
|
222
|
+
"label": "Include spam and trash",
|
|
223
|
+
"default": false
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
"type": "number",
|
|
227
|
+
"key": "maxResults",
|
|
228
|
+
"label": "Page size",
|
|
229
|
+
"min": 1,
|
|
230
|
+
"max": 500,
|
|
231
|
+
"default": 100,
|
|
232
|
+
"description": "Gmail's own maximum is 500."
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
"type": "text",
|
|
236
|
+
"key": "pageToken",
|
|
237
|
+
"label": "Page token",
|
|
238
|
+
"description": "From a previous page's nextPageToken."
|
|
239
|
+
}
|
|
240
|
+
],
|
|
241
|
+
defaultConfig: {
|
|
242
|
+
"mode": "auto"
|
|
243
|
+
},
|
|
244
|
+
renderBody: ({ config }) => summarize(GMAIL_INBOX_MESSAGE_LIST_META, config, "list messages")
|
|
245
|
+
});
|
|
246
|
+
var GMAIL_INBOX_THREAD_GET_KIND = "@particle-academy/gmail_inbox_thread_get";
|
|
247
|
+
var GMAIL_INBOX_THREAD_GET_OPERATION = "thread_get";
|
|
248
|
+
var GMAIL_INBOX_THREAD_GET_META = gmailInboxMeta("action", "read a thread", "https://developers.google.com/workspace/gmail/api/reference/rest/v1/users.threads/get");
|
|
249
|
+
var GMAIL_INBOX_THREAD_GET_OUTPUT = [
|
|
250
|
+
{
|
|
251
|
+
"path": "data.id",
|
|
252
|
+
"type": "string",
|
|
253
|
+
"description": "The thread id."
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
"path": "data.historyId",
|
|
257
|
+
"type": "string",
|
|
258
|
+
"description": "Gmail's change-tracking cursor as of this read."
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
"path": "data.messages",
|
|
262
|
+
"type": "array",
|
|
263
|
+
"description": "Every message in the thread, oldest first, each shaped like message_get's output."
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
"path": "mode",
|
|
267
|
+
"type": "string",
|
|
268
|
+
"description": "Which estate this ran against. Google has no sandbox, so: fake or live."
|
|
269
|
+
}
|
|
270
|
+
];
|
|
271
|
+
var gmailInboxThreadGetKind = defineConnectorKind(GMAIL_INBOX_THREAD_GET_META, {
|
|
272
|
+
name: GMAIL_INBOX_THREAD_GET_KIND,
|
|
273
|
+
aliases: ["gmail_inbox_thread_get"],
|
|
274
|
+
label: "Gmail thread",
|
|
275
|
+
description: "Read every message in a conversation thread, oldest first.",
|
|
276
|
+
inputs: [{ id: "in" }],
|
|
277
|
+
outputs: [{ id: "out" }],
|
|
278
|
+
sideEffects: "none",
|
|
279
|
+
outputShape: GMAIL_INBOX_THREAD_GET_OUTPUT,
|
|
280
|
+
configSchema: [
|
|
281
|
+
{
|
|
282
|
+
"type": "text",
|
|
283
|
+
"key": "userId",
|
|
284
|
+
"label": "Mailbox",
|
|
285
|
+
"required": true,
|
|
286
|
+
"default": "me"
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
"type": "text",
|
|
290
|
+
"key": "id",
|
|
291
|
+
"label": "Thread ID",
|
|
292
|
+
"required": true,
|
|
293
|
+
"description": "A message's threadId, from message_list or message_get."
|
|
294
|
+
}
|
|
295
|
+
],
|
|
296
|
+
defaultConfig: {
|
|
297
|
+
"mode": "auto"
|
|
298
|
+
},
|
|
299
|
+
renderBody: ({ config }) => summarize(GMAIL_INBOX_THREAD_GET_META, config, "read a thread")
|
|
300
|
+
});
|
|
301
|
+
|
|
302
|
+
// src/index.ts
|
|
303
|
+
var GMAIL_INBOX_KINDS = [
|
|
304
|
+
gmailInboxLabelListKind,
|
|
305
|
+
gmailInboxMessageGetKind,
|
|
306
|
+
gmailInboxMessageListKind,
|
|
307
|
+
gmailInboxThreadGetKind
|
|
308
|
+
];
|
|
309
|
+
|
|
310
|
+
export { CONNECTOR_API_VERSION, GMAIL_INBOX_CREDENTIALS, GMAIL_INBOX_KINDS, GMAIL_INBOX_LABEL_LIST_KIND, GMAIL_INBOX_LABEL_LIST_META, GMAIL_INBOX_LABEL_LIST_OPERATION, GMAIL_INBOX_LABEL_LIST_OUTPUT, GMAIL_INBOX_MESSAGE_GET_KIND, GMAIL_INBOX_MESSAGE_GET_META, GMAIL_INBOX_MESSAGE_GET_OPERATION, GMAIL_INBOX_MESSAGE_GET_OUTPUT, GMAIL_INBOX_MESSAGE_LIST_KIND, GMAIL_INBOX_MESSAGE_LIST_META, GMAIL_INBOX_MESSAGE_LIST_OPERATION, GMAIL_INBOX_MESSAGE_LIST_OUTPUT, GMAIL_INBOX_OAUTH, GMAIL_INBOX_SERVICE, GMAIL_INBOX_THREAD_GET_KIND, GMAIL_INBOX_THREAD_GET_META, GMAIL_INBOX_THREAD_GET_OPERATION, GMAIL_INBOX_THREAD_GET_OUTPUT, gmailInboxLabelListKind, gmailInboxMessageGetKind, gmailInboxMessageListKind, gmailInboxMeta, gmailInboxThreadGetKind };
|
|
311
|
+
//# sourceMappingURL=index.js.map
|
|
312
|
+
//# sourceMappingURL=index.js.map
|