@superdurable/connector-google-gmail 0.1.0 → 0.1.2

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.
@@ -0,0 +1,181 @@
1
+ import { RefreshingCredentialProvider, SecretString, Query, Mutation, ConnectionRef } from '@superdurable/connectors-sdk';
2
+ import { z } from 'zod';
3
+
4
+ /** GetMessageInput identifies one Gmail message. */
5
+ interface GetMessageInput {
6
+ /** MessageID is the provider message identifier. */
7
+ "messageId": string;
8
+ }
9
+ /** Message is one decoded Gmail message. */
10
+ interface Message {
11
+ /** MessageID is the provider message identifier. */
12
+ "messageId": string;
13
+ /** ThreadID is the provider conversation thread identifier. */
14
+ "threadId": string;
15
+ /** RFCMessageID is the decoded Message-ID header. */
16
+ "rfcMessageId"?: string | undefined;
17
+ /** InReplyTo is the decoded In-Reply-To header. */
18
+ "inReplyTo"?: string | undefined;
19
+ /** References is the decoded References header. */
20
+ "references"?: string | undefined;
21
+ /** From is the sender address. */
22
+ "from": string;
23
+ /** ReplyTo is the decoded Reply-To header. */
24
+ "replyTo"?: string | undefined;
25
+ /** To lists recipient addresses. */
26
+ "to"?: Array<string> | undefined;
27
+ /** Subject is the message subject. */
28
+ "subject": string;
29
+ /** TextBody is the plain-text message body. */
30
+ "textBody"?: string | undefined;
31
+ /** HTMLBody is the optional HTML message body. */
32
+ "htmlBody"?: string | undefined;
33
+ /** Snippet is the snippet for message. */
34
+ "snippet"?: string | undefined;
35
+ /** ReceivedAt is the received at for message. */
36
+ "receivedAt": string;
37
+ /** LabelIDs lists the Gmail labels applied to the message. */
38
+ "labelIds"?: Array<string> | undefined;
39
+ }
40
+ /** SendMessageInput contains the provider request fields for send message. */
41
+ interface SendMessageInput$1 {
42
+ /** To lists recipient addresses. */
43
+ "to": Array<string> | null;
44
+ /** Subject is the message subject. */
45
+ "subject": string;
46
+ /** TextBody is the plain-text message body. */
47
+ "textBody": string;
48
+ /** HTMLBody is the optional HTML message body. */
49
+ "htmlBody"?: string | undefined;
50
+ }
51
+ /** SendMessageOutput contains the provider response fields for send message. */
52
+ interface SendMessageOutput$1 {
53
+ /** Sender is the authenticated sender address. */
54
+ "sender": string;
55
+ /** Recipients lists resolved addresses; it is empty when an earlier reply is found before reading its source. */
56
+ "recipients": Array<string> | null;
57
+ /** MessageID is the provider message identifier; empty when Gmail accepted a send but read-back found no ID. */
58
+ "messageId": string;
59
+ /** ThreadID is the provider conversation thread identifier. When an accepted reply lacks IDs, it is the requested thread.
60
+ * When an accepted new message lacks IDs, it is empty. */
61
+ "threadId": string;
62
+ }
63
+ /** ReplyToMessageInput identifies a message and supplies the reply body. */
64
+ interface ReplyToMessageInput {
65
+ /** MessageID is the provider message identifier. */
66
+ "messageId": string;
67
+ /** TextBody is the plain-text message body. */
68
+ "textBody": string;
69
+ /** HTMLBody is the optional HTML message body. */
70
+ "htmlBody"?: string | undefined;
71
+ }
72
+ /** Runtime validator for GetMessageInput. */
73
+ declare const GetMessageInputSchema: z.ZodObject<{
74
+ messageId: z.ZodString;
75
+ }, z.core.$strict>;
76
+ /** Runtime validator for Message. */
77
+ declare const MessageSchema: z.ZodObject<{
78
+ messageId: z.ZodString;
79
+ threadId: z.ZodString;
80
+ rfcMessageId: z.ZodOptional<z.ZodString>;
81
+ inReplyTo: z.ZodOptional<z.ZodString>;
82
+ references: z.ZodOptional<z.ZodString>;
83
+ from: z.ZodString;
84
+ replyTo: z.ZodOptional<z.ZodString>;
85
+ to: z.ZodOptional<z.ZodArray<z.ZodString>>;
86
+ subject: z.ZodString;
87
+ textBody: z.ZodOptional<z.ZodString>;
88
+ htmlBody: z.ZodOptional<z.ZodString>;
89
+ snippet: z.ZodOptional<z.ZodString>;
90
+ receivedAt: z.ZodISODateTime;
91
+ labelIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
92
+ }, z.core.$strict>;
93
+ /** Runtime validator for ReplyToMessageInput. */
94
+ declare const ReplyToMessageInputSchema: z.ZodObject<{
95
+ messageId: z.ZodString;
96
+ textBody: z.ZodString;
97
+ htmlBody: z.ZodOptional<z.ZodString>;
98
+ }, z.core.$strict>;
99
+
100
+ /** Public send input requires at least an array value before operation validation. */
101
+ declare const SendMessageInputSchema: z.ZodObject<{
102
+ to: z.ZodArray<z.ZodString>;
103
+ subject: z.ZodString;
104
+ textBody: z.ZodString;
105
+ htmlBody: z.ZodOptional<z.ZodString>;
106
+ }, z.core.$strict>;
107
+ /** Message input accepted by Gmail applications. */
108
+ type SendMessageInput = z.infer<typeof SendMessageInputSchema>;
109
+ /** Public send output always includes the resolved recipient list. */
110
+ declare const SendMessageOutputSchema: z.ZodObject<{
111
+ sender: z.ZodString;
112
+ recipients: z.ZodArray<z.ZodString>;
113
+ messageId: z.ZodString;
114
+ threadId: z.ZodString;
115
+ }, z.core.$strict>;
116
+ /** Confirmed Gmail delivery result. */
117
+ type SendMessageOutput = z.infer<typeof SendMessageOutputSchema>;
118
+ /** Stable Gmail connector identity. */
119
+ declare const ConnectorID = "gmail";
120
+ /** Provider identity used by named connections. */
121
+ declare const ProviderID = "google";
122
+ /** Google OAuth authorization method. */
123
+ declare const GoogleOAuthAuthMethodID = "google-oauth";
124
+ /** Google Workspace domain delegation authorization method. */
125
+ declare const WorkspaceDomainDelegationAuthMethodID = "workspace-domain-delegation";
126
+ /** Public configuration; omitted fields use the manifest defaults. */
127
+ interface Config {
128
+ /** Gmail API base URL. */ endpoint?: string;
129
+ /** Complete API response limit in bytes. */ maxResponseBytes?: number;
130
+ /** Encoded MIME message limit in bytes. */ maxMessageBytes?: number;
131
+ /** Trigger poll interval in milliseconds. */ pollIntervalMs?: number;
132
+ /** Number of recent messages per Trigger poll. */ pollPageSize?: number;
133
+ }
134
+ /** Credential material held outside Dex Flow state. */
135
+ interface Credentials {
136
+ /** Selected authorization method. */ authMethodId?: string;
137
+ /** Google OAuth application identifier. */ oauthClientId?: string;
138
+ /** Private Google OAuth application secret. */ oauthClientSecret?: SecretString;
139
+ /** Private short-lived bearer token. */ accessToken: SecretString;
140
+ /** Private long-lived OAuth renewal token. */ refreshToken?: SecretString;
141
+ /** Verified sender or delegated mailbox. */ primaryEmail: string;
142
+ /** Private Workspace service-account JSON. */ serviceAccountKey?: SecretString;
143
+ /** Workspace user to impersonate. */ delegatedUser?: string;
144
+ }
145
+ /** Host-owned refreshing credential source required by the Gmail client. */
146
+ type CredentialSource = RefreshingCredentialProvider<Credentials>;
147
+
148
+ /** Typed operations supplied by a client or mock. */
149
+ interface Operations {
150
+ /** Invoke getMessage through this connection. */
151
+ getMessage(): Query<GetMessageInput, Message>;
152
+ /** Invoke sendMessage through this connection. */
153
+ sendMessage(): Mutation<SendMessageInput$1, SendMessageOutput$1>;
154
+ /** Invoke replyToMessage through this connection. */
155
+ replyToMessage(): Mutation<ReplyToMessageInput, SendMessageOutput$1>;
156
+ }
157
+ /** Named connector connection kept outside Flow state. */
158
+ declare class Connection<BoundOperations = Operations> {
159
+ /** Stable provider and connection name. */
160
+ readonly reference: ConnectionRef;
161
+ /** Bound provider operations. */
162
+ readonly operations: BoundOperations;
163
+ /** Validate a reference and bind operations. */
164
+ constructor(reference: ConnectionRef, operations: BoundOperations);
165
+ }
166
+
167
+ /** Three operation contracts supplied by a real client or scripted mock. */
168
+ interface GmailOperations {
169
+ /** Read one message. */ getMessage(): Query<GetMessageInput, Message>;
170
+ /** Send a new message. */ sendMessage(): Mutation<SendMessageInput, SendMessageOutput>;
171
+ /** Reply in an existing thread. */ replyToMessage(): Mutation<ReplyToMessageInput, SendMessageOutput>;
172
+ }
173
+ /** Named Gmail connection passed to operation Step factories. */
174
+ declare class GmailConnection extends Connection {
175
+ /** Operation implementations constrained by Gmail's public input and output contracts. */
176
+ readonly operations: GmailOperations;
177
+ /** Bind operation implementations to a static named Google connection. */
178
+ constructor(operations: GmailOperations, reference: ConnectionRef);
179
+ }
180
+
181
+ export { type Config as C, type GetMessageInput as G, type Message as M, ProviderID as P, type ReplyToMessageInput as R, type SendMessageInput as S, WorkspaceDomainDelegationAuthMethodID as W, type CredentialSource as a, type Credentials as b, type SendMessageOutput as c, type GmailOperations as d, GmailConnection as e, ConnectorID as f, GetMessageInputSchema as g, GoogleOAuthAuthMethodID as h, MessageSchema as i, ReplyToMessageInputSchema as j, SendMessageInputSchema as k, SendMessageOutputSchema as l };
@@ -0,0 +1,181 @@
1
+ import { RefreshingCredentialProvider, SecretString, Query, Mutation, ConnectionRef } from '@superdurable/connectors-sdk';
2
+ import { z } from 'zod';
3
+
4
+ /** GetMessageInput identifies one Gmail message. */
5
+ interface GetMessageInput {
6
+ /** MessageID is the provider message identifier. */
7
+ "messageId": string;
8
+ }
9
+ /** Message is one decoded Gmail message. */
10
+ interface Message {
11
+ /** MessageID is the provider message identifier. */
12
+ "messageId": string;
13
+ /** ThreadID is the provider conversation thread identifier. */
14
+ "threadId": string;
15
+ /** RFCMessageID is the decoded Message-ID header. */
16
+ "rfcMessageId"?: string | undefined;
17
+ /** InReplyTo is the decoded In-Reply-To header. */
18
+ "inReplyTo"?: string | undefined;
19
+ /** References is the decoded References header. */
20
+ "references"?: string | undefined;
21
+ /** From is the sender address. */
22
+ "from": string;
23
+ /** ReplyTo is the decoded Reply-To header. */
24
+ "replyTo"?: string | undefined;
25
+ /** To lists recipient addresses. */
26
+ "to"?: Array<string> | undefined;
27
+ /** Subject is the message subject. */
28
+ "subject": string;
29
+ /** TextBody is the plain-text message body. */
30
+ "textBody"?: string | undefined;
31
+ /** HTMLBody is the optional HTML message body. */
32
+ "htmlBody"?: string | undefined;
33
+ /** Snippet is the snippet for message. */
34
+ "snippet"?: string | undefined;
35
+ /** ReceivedAt is the received at for message. */
36
+ "receivedAt": string;
37
+ /** LabelIDs lists the Gmail labels applied to the message. */
38
+ "labelIds"?: Array<string> | undefined;
39
+ }
40
+ /** SendMessageInput contains the provider request fields for send message. */
41
+ interface SendMessageInput$1 {
42
+ /** To lists recipient addresses. */
43
+ "to": Array<string> | null;
44
+ /** Subject is the message subject. */
45
+ "subject": string;
46
+ /** TextBody is the plain-text message body. */
47
+ "textBody": string;
48
+ /** HTMLBody is the optional HTML message body. */
49
+ "htmlBody"?: string | undefined;
50
+ }
51
+ /** SendMessageOutput contains the provider response fields for send message. */
52
+ interface SendMessageOutput$1 {
53
+ /** Sender is the authenticated sender address. */
54
+ "sender": string;
55
+ /** Recipients lists resolved addresses; it is empty when an earlier reply is found before reading its source. */
56
+ "recipients": Array<string> | null;
57
+ /** MessageID is the provider message identifier; empty when Gmail accepted a send but read-back found no ID. */
58
+ "messageId": string;
59
+ /** ThreadID is the provider conversation thread identifier. When an accepted reply lacks IDs, it is the requested thread.
60
+ * When an accepted new message lacks IDs, it is empty. */
61
+ "threadId": string;
62
+ }
63
+ /** ReplyToMessageInput identifies a message and supplies the reply body. */
64
+ interface ReplyToMessageInput {
65
+ /** MessageID is the provider message identifier. */
66
+ "messageId": string;
67
+ /** TextBody is the plain-text message body. */
68
+ "textBody": string;
69
+ /** HTMLBody is the optional HTML message body. */
70
+ "htmlBody"?: string | undefined;
71
+ }
72
+ /** Runtime validator for GetMessageInput. */
73
+ declare const GetMessageInputSchema: z.ZodObject<{
74
+ messageId: z.ZodString;
75
+ }, z.core.$strict>;
76
+ /** Runtime validator for Message. */
77
+ declare const MessageSchema: z.ZodObject<{
78
+ messageId: z.ZodString;
79
+ threadId: z.ZodString;
80
+ rfcMessageId: z.ZodOptional<z.ZodString>;
81
+ inReplyTo: z.ZodOptional<z.ZodString>;
82
+ references: z.ZodOptional<z.ZodString>;
83
+ from: z.ZodString;
84
+ replyTo: z.ZodOptional<z.ZodString>;
85
+ to: z.ZodOptional<z.ZodArray<z.ZodString>>;
86
+ subject: z.ZodString;
87
+ textBody: z.ZodOptional<z.ZodString>;
88
+ htmlBody: z.ZodOptional<z.ZodString>;
89
+ snippet: z.ZodOptional<z.ZodString>;
90
+ receivedAt: z.ZodISODateTime;
91
+ labelIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
92
+ }, z.core.$strict>;
93
+ /** Runtime validator for ReplyToMessageInput. */
94
+ declare const ReplyToMessageInputSchema: z.ZodObject<{
95
+ messageId: z.ZodString;
96
+ textBody: z.ZodString;
97
+ htmlBody: z.ZodOptional<z.ZodString>;
98
+ }, z.core.$strict>;
99
+
100
+ /** Public send input requires at least an array value before operation validation. */
101
+ declare const SendMessageInputSchema: z.ZodObject<{
102
+ to: z.ZodArray<z.ZodString>;
103
+ subject: z.ZodString;
104
+ textBody: z.ZodString;
105
+ htmlBody: z.ZodOptional<z.ZodString>;
106
+ }, z.core.$strict>;
107
+ /** Message input accepted by Gmail applications. */
108
+ type SendMessageInput = z.infer<typeof SendMessageInputSchema>;
109
+ /** Public send output always includes the resolved recipient list. */
110
+ declare const SendMessageOutputSchema: z.ZodObject<{
111
+ sender: z.ZodString;
112
+ recipients: z.ZodArray<z.ZodString>;
113
+ messageId: z.ZodString;
114
+ threadId: z.ZodString;
115
+ }, z.core.$strict>;
116
+ /** Confirmed Gmail delivery result. */
117
+ type SendMessageOutput = z.infer<typeof SendMessageOutputSchema>;
118
+ /** Stable Gmail connector identity. */
119
+ declare const ConnectorID = "gmail";
120
+ /** Provider identity used by named connections. */
121
+ declare const ProviderID = "google";
122
+ /** Google OAuth authorization method. */
123
+ declare const GoogleOAuthAuthMethodID = "google-oauth";
124
+ /** Google Workspace domain delegation authorization method. */
125
+ declare const WorkspaceDomainDelegationAuthMethodID = "workspace-domain-delegation";
126
+ /** Public configuration; omitted fields use the manifest defaults. */
127
+ interface Config {
128
+ /** Gmail API base URL. */ endpoint?: string;
129
+ /** Complete API response limit in bytes. */ maxResponseBytes?: number;
130
+ /** Encoded MIME message limit in bytes. */ maxMessageBytes?: number;
131
+ /** Trigger poll interval in milliseconds. */ pollIntervalMs?: number;
132
+ /** Number of recent messages per Trigger poll. */ pollPageSize?: number;
133
+ }
134
+ /** Credential material held outside Dex Flow state. */
135
+ interface Credentials {
136
+ /** Selected authorization method. */ authMethodId?: string;
137
+ /** Google OAuth application identifier. */ oauthClientId?: string;
138
+ /** Private Google OAuth application secret. */ oauthClientSecret?: SecretString;
139
+ /** Private short-lived bearer token. */ accessToken: SecretString;
140
+ /** Private long-lived OAuth renewal token. */ refreshToken?: SecretString;
141
+ /** Verified sender or delegated mailbox. */ primaryEmail: string;
142
+ /** Private Workspace service-account JSON. */ serviceAccountKey?: SecretString;
143
+ /** Workspace user to impersonate. */ delegatedUser?: string;
144
+ }
145
+ /** Host-owned refreshing credential source required by the Gmail client. */
146
+ type CredentialSource = RefreshingCredentialProvider<Credentials>;
147
+
148
+ /** Typed operations supplied by a client or mock. */
149
+ interface Operations {
150
+ /** Invoke getMessage through this connection. */
151
+ getMessage(): Query<GetMessageInput, Message>;
152
+ /** Invoke sendMessage through this connection. */
153
+ sendMessage(): Mutation<SendMessageInput$1, SendMessageOutput$1>;
154
+ /** Invoke replyToMessage through this connection. */
155
+ replyToMessage(): Mutation<ReplyToMessageInput, SendMessageOutput$1>;
156
+ }
157
+ /** Named connector connection kept outside Flow state. */
158
+ declare class Connection<BoundOperations = Operations> {
159
+ /** Stable provider and connection name. */
160
+ readonly reference: ConnectionRef;
161
+ /** Bound provider operations. */
162
+ readonly operations: BoundOperations;
163
+ /** Validate a reference and bind operations. */
164
+ constructor(reference: ConnectionRef, operations: BoundOperations);
165
+ }
166
+
167
+ /** Three operation contracts supplied by a real client or scripted mock. */
168
+ interface GmailOperations {
169
+ /** Read one message. */ getMessage(): Query<GetMessageInput, Message>;
170
+ /** Send a new message. */ sendMessage(): Mutation<SendMessageInput, SendMessageOutput>;
171
+ /** Reply in an existing thread. */ replyToMessage(): Mutation<ReplyToMessageInput, SendMessageOutput>;
172
+ }
173
+ /** Named Gmail connection passed to operation Step factories. */
174
+ declare class GmailConnection extends Connection {
175
+ /** Operation implementations constrained by Gmail's public input and output contracts. */
176
+ readonly operations: GmailOperations;
177
+ /** Bind operation implementations to a static named Google connection. */
178
+ constructor(operations: GmailOperations, reference: ConnectionRef);
179
+ }
180
+
181
+ export { type Config as C, type GetMessageInput as G, type Message as M, ProviderID as P, type ReplyToMessageInput as R, type SendMessageInput as S, WorkspaceDomainDelegationAuthMethodID as W, type CredentialSource as a, type Credentials as b, type SendMessageOutput as c, type GmailOperations as d, GmailConnection as e, ConnectorID as f, GetMessageInputSchema as g, GoogleOAuthAuthMethodID as h, MessageSchema as i, ReplyToMessageInputSchema as j, SendMessageInputSchema as k, SendMessageOutputSchema as l };