@waterlock/gateway 0.0.0-stage → 0.1.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.
Files changed (47) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +15 -2
  3. package/dist/checks/index.d.ts +35 -0
  4. package/dist/checks/index.js +47 -0
  5. package/dist/codegen/cli.d.ts +2 -0
  6. package/dist/codegen/cli.js +60 -0
  7. package/dist/codegen/config.d.ts +19 -0
  8. package/dist/codegen/config.js +1 -0
  9. package/dist/codegen/discovery.d.ts +42 -0
  10. package/dist/codegen/discovery.js +78 -0
  11. package/dist/codegen/generate.d.ts +9 -0
  12. package/dist/codegen/generate.js +77 -0
  13. package/dist/codegen/index.d.ts +5 -0
  14. package/dist/codegen/index.js +4 -0
  15. package/dist/codegen/model.d.ts +21 -0
  16. package/dist/codegen/model.js +1 -0
  17. package/dist/codegen/openapi.d.ts +33 -0
  18. package/dist/codegen/openapi.js +73 -0
  19. package/dist/core/credentials.d.ts +24 -0
  20. package/dist/core/credentials.js +41 -0
  21. package/dist/core/evaluate.d.ts +41 -0
  22. package/dist/core/evaluate.js +99 -0
  23. package/dist/core/gateway.d.ts +21 -0
  24. package/dist/core/gateway.js +152 -0
  25. package/dist/core/match.d.ts +16 -0
  26. package/dist/core/match.js +97 -0
  27. package/dist/core/policy.d.ts +42 -0
  28. package/dist/core/policy.js +10 -0
  29. package/dist/core/provider.d.ts +50 -0
  30. package/dist/core/provider.js +20 -0
  31. package/dist/core/session.d.ts +59 -0
  32. package/dist/core/session.js +66 -0
  33. package/dist/core/store.d.ts +44 -0
  34. package/dist/core/store.js +18 -0
  35. package/dist/core/types.d.ts +40 -0
  36. package/dist/core/types.js +1 -0
  37. package/dist/index.d.ts +9 -0
  38. package/dist/index.js +8 -0
  39. package/dist/providers/gmail/decode.d.ts +38 -0
  40. package/dist/providers/gmail/decode.js +85 -0
  41. package/dist/providers/gmail/generated.d.ts +323 -0
  42. package/dist/providers/gmail/generated.js +113 -0
  43. package/dist/providers/gmail/gmail.config.d.ts +5 -0
  44. package/dist/providers/gmail/gmail.config.js +16 -0
  45. package/dist/providers/gmail/index.d.ts +23 -0
  46. package/dist/providers/gmail/index.js +21 -0
  47. package/package.json +70 -4
@@ -0,0 +1,66 @@
1
+ const PREFIX = "as1";
2
+ const enc = new TextEncoder();
3
+ export function createSessions(opts) {
4
+ const keyBytes = typeof opts.signingKey === "string" ? enc.encode(opts.signingKey) : opts.signingKey;
5
+ if (keyBytes.length < 32)
6
+ throw new Error("session signingKey must be at least 32 bytes");
7
+ const now = opts.now ?? (() => Date.now());
8
+ const defaultTtl = opts.defaultTtlSeconds ?? 900;
9
+ const key = crypto.subtle.importKey("raw", keyBytes, { name: "HMAC", hash: "SHA-256" }, false, [
10
+ "sign",
11
+ "verify",
12
+ ]);
13
+ return {
14
+ store: opts.store,
15
+ async addUserMessage(input) {
16
+ if (!opts.store?.addUserMessage)
17
+ throw new Error("session store does not support addUserMessage");
18
+ await opts.store.addUserMessage(input);
19
+ },
20
+ async mint(input) {
21
+ const iat = Math.floor(now() / 1000);
22
+ const claims = {
23
+ sid: input.sid ?? crypto.randomUUID(),
24
+ provider: input.provider,
25
+ agent: input.agent,
26
+ onBehalfOf: input.onBehalfOf,
27
+ ...(input.intent ? { intent: input.intent } : {}),
28
+ iat,
29
+ exp: iat + (input.ttlSeconds ?? defaultTtl),
30
+ };
31
+ const payload = `${PREFIX}.${b64url(enc.encode(JSON.stringify(claims)))}`;
32
+ const sig = new Uint8Array(await crypto.subtle.sign("HMAC", await key, enc.encode(payload)));
33
+ return { token: `${payload}.${b64url(sig)}`, claims };
34
+ },
35
+ async verify({ token }) {
36
+ const parts = token.split(".");
37
+ if (parts.length !== 3 || parts[0] !== PREFIX)
38
+ return { error: "malformed" };
39
+ let sig;
40
+ let claims;
41
+ try {
42
+ sig = fromB64url(parts[2]);
43
+ const ok = await crypto.subtle.verify("HMAC", await key, sig, enc.encode(`${parts[0]}.${parts[1]}`));
44
+ if (!ok)
45
+ return { error: "bad_signature" };
46
+ claims = JSON.parse(new TextDecoder().decode(fromB64url(parts[1])));
47
+ }
48
+ catch {
49
+ return { error: "malformed" };
50
+ }
51
+ if (typeof claims.exp !== "number" || typeof claims.provider !== "string")
52
+ return { error: "malformed" };
53
+ if (claims.exp * 1000 <= now())
54
+ return { error: "expired" };
55
+ return { claims };
56
+ },
57
+ };
58
+ }
59
+ function b64url(bytes) {
60
+ return Buffer.from(bytes).toString("base64url");
61
+ }
62
+ function fromB64url(s) {
63
+ if (!/^[A-Za-z0-9_-]*$/.test(s))
64
+ throw new Error("bad base64url");
65
+ return new Uint8Array(Buffer.from(s, "base64url"));
66
+ }
@@ -0,0 +1,44 @@
1
+ import type { SessionClaims } from "./session.js";
2
+ /** One message the human typed. An object so it can gain fields (id, role, source...) later. */
3
+ export interface UserMessage {
4
+ text: string;
5
+ at?: Date;
6
+ }
7
+ /** A page of user messages. An object so it can gain fields (hasMore, cursor...) later. */
8
+ export interface UserMessages {
9
+ items: UserMessage[];
10
+ }
11
+ /** Points at a session. Grows with new identifiers without breaking stores. */
12
+ export interface SessionRef {
13
+ sid: string;
14
+ }
15
+ /**
16
+ * Pluggable session storage. Every method is optional: implement one and the gateway uses
17
+ * the feature it unlocks. No store at all = stateless signed tokens, no extras.
18
+ * Methods take a single input object so new fields never break existing stores.
19
+ *
20
+ * Trust: this is the gateway's view of the truth. Only trusted code (your front door /
21
+ * backend) may write to it, never the agent. A store that returns agent-written data
22
+ * lets a rogue agent forge context.
23
+ */
24
+ export interface SessionStore {
25
+ /** Record what the human said. Called by your trusted front door via `sessions.addUserMessage`. */
26
+ addUserMessage?(input: {
27
+ session: SessionRef;
28
+ message: UserMessage;
29
+ }): Promise<void>;
30
+ /**
31
+ * Messages the human typed in this session, oldest first. When implemented, `checkPrompt`
32
+ * reads them (via the `store` handed to `check`) and adds them as intent context.
33
+ * Must return only messages written by trusted code (filter out assistant/tool/agent rows).
34
+ * `limit`: return at most the last N.
35
+ */
36
+ getUserMessages?(input: {
37
+ session: SessionClaims;
38
+ limit?: number;
39
+ }): Promise<UserMessages>;
40
+ }
41
+ /** In-process store. One gateway process only; data is lost on restart. */
42
+ export declare function memoryStore(opts?: {
43
+ maxMessagesPerSession?: number;
44
+ }): Required<SessionStore>;
@@ -0,0 +1,18 @@
1
+ /** In-process store. One gateway process only; data is lost on restart. */
2
+ export function memoryStore(opts = {}) {
3
+ const max = opts.maxMessagesPerSession ?? 50;
4
+ const messages = new Map();
5
+ return {
6
+ async addUserMessage({ session, message }) {
7
+ const list = messages.get(session.sid) ?? [];
8
+ list.push({ ...message, at: message.at ?? new Date() });
9
+ if (list.length > max)
10
+ list.splice(0, list.length - max);
11
+ messages.set(session.sid, list);
12
+ },
13
+ async getUserMessages({ session, limit }) {
14
+ const list = messages.get(session.sid) ?? [];
15
+ return { items: (limit === undefined ? list : list.slice(-limit)).map((m) => ({ ...m })) };
16
+ },
17
+ };
18
+ }
@@ -0,0 +1,40 @@
1
+ /** May gain members later (e.g. "HEAD"). */
2
+ export type HttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
3
+ export declare const HTTP_METHODS: readonly HttpMethod[];
4
+ export type ParamType = "string" | "integer" | "number" | "boolean";
5
+ export interface ParamSpec {
6
+ name: string;
7
+ in: "path" | "query";
8
+ type: ParamType;
9
+ required?: boolean;
10
+ repeated?: boolean;
11
+ enum?: readonly string[];
12
+ /** `{+name}` template: value may span multiple path segments. */
13
+ multiSegment?: boolean;
14
+ }
15
+ /**
16
+ * Same action can be reachable through several routes. Google APIs expose
17
+ * `/upload/...` and `/resumable/upload/...` twins for media methods — each is
18
+ * a separate route to the same action and must be governed the same way.
19
+ */
20
+ export type OperationVariant = "standard" | "upload" | "resumable";
21
+ export interface Operation {
22
+ action: string;
23
+ method: HttpMethod;
24
+ path: string;
25
+ variant: OperationVariant;
26
+ params: readonly ParamSpec[];
27
+ hasBody: boolean;
28
+ }
29
+ export interface OperationTable {
30
+ provider: string;
31
+ source: {
32
+ kind: "discovery" | "openapi";
33
+ title: string;
34
+ version: string;
35
+ revision?: string;
36
+ url?: string;
37
+ };
38
+ globalQueryParams: readonly ParamSpec[];
39
+ operations: readonly Operation[];
40
+ }
@@ -0,0 +1 @@
1
+ export const HTTP_METHODS = ["GET", "POST", "PUT", "PATCH", "DELETE"];
@@ -0,0 +1,9 @@
1
+ export { createGateway, type GatewayOptions } from "./core/gateway.js";
2
+ export { definePolicy, type AnyRequest, type Policy, type PolicyRule, type ProviderRequest, } from "./core/policy.js";
3
+ export { evaluatePolicy, type Check, type CheckOptions, type Decision } from "./core/evaluate.js";
4
+ export { createSessions, type MintInput, type SessionClaims, type Sessions, type VerifyError } from "./core/session.js";
5
+ export { memoryStore, type SessionRef, type SessionStore, type UserMessage, type UserMessages } from "./core/store.js";
6
+ export { oauth2Refresh, staticToken, type Credential, type CredentialSource } from "./core/credentials.js";
7
+ export { createProvider, type Decoder, type ProviderDefinition, type RequestOf } from "./core/provider.js";
8
+ export { createMatcher, type Matcher, type MatchResult } from "./core/match.js";
9
+ export type { HttpMethod, Operation, OperationTable, OperationVariant, ParamSpec } from "./core/types.js";
package/dist/index.js ADDED
@@ -0,0 +1,8 @@
1
+ export { createGateway } from "./core/gateway.js";
2
+ export { definePolicy, } from "./core/policy.js";
3
+ export { evaluatePolicy } from "./core/evaluate.js";
4
+ export { createSessions } from "./core/session.js";
5
+ export { memoryStore } from "./core/store.js";
6
+ export { oauth2Refresh, staticToken } from "./core/credentials.js";
7
+ export { createProvider } from "./core/provider.js";
8
+ export { createMatcher } from "./core/match.js";
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Gmail sends opaque base64url RFC 822 in `raw`. Recipients live in the MIME headers and
3
+ * content in (possibly nested, encoded) MIME parts, so policy can't see either without
4
+ * decoding. postal-mime does the parsing; it is lenient like a mail client, so the checks
5
+ * below turn anything ambiguous into a throw, which denies the call.
6
+ */
7
+ export interface GmailAttachment {
8
+ contentType: string;
9
+ filename: string | null;
10
+ }
11
+ export interface GmailMessageContext {
12
+ /** Lowercased addresses from every To, Cc and Bcc header. */
13
+ recipients: string[];
14
+ recipient_domains: string[];
15
+ subject: string | null;
16
+ /** The text/plain body as sent. Null when the message has none (e.g. HTML-only). */
17
+ text: string | null;
18
+ /** The text/html body as sent, markup included. Null when the message has none. */
19
+ html: string | null;
20
+ attachments: GmailAttachment[];
21
+ }
22
+ /**
23
+ * drafts.send sends a stored draft by id. The body may contain a message, but
24
+ * Gmail sends the stored version, so recipients and content are unknown to the
25
+ * gateway. Typed as null so policies must decide explicitly what to do.
26
+ */
27
+ export interface GmailDraftSendContext {
28
+ recipients: null;
29
+ recipient_domains: null;
30
+ subject: null;
31
+ text: null;
32
+ html: null;
33
+ attachments: null;
34
+ draft_id: string;
35
+ }
36
+ export declare function decodeMessageSend(body: Uint8Array): Promise<GmailMessageContext>;
37
+ export declare function decodeDraftWrite(body: Uint8Array): Promise<GmailMessageContext>;
38
+ export declare function decodeDraftSend(body: Uint8Array): GmailDraftSendContext;
@@ -0,0 +1,85 @@
1
+ import PostalMime from "postal-mime";
2
+ export async function decodeMessageSend(body) {
3
+ const json = parseJson(body);
4
+ return fromRaw(json.raw);
5
+ }
6
+ export async function decodeDraftWrite(body) {
7
+ const json = parseJson(body);
8
+ return fromRaw(json.message?.raw);
9
+ }
10
+ export function decodeDraftSend(body) {
11
+ const json = parseJson(body);
12
+ if (typeof json.id !== "string" || !json.id)
13
+ throw new Error("drafts.send requires a draft id");
14
+ return { recipients: null, recipient_domains: null, subject: null, text: null, html: null, attachments: null, draft_id: json.id };
15
+ }
16
+ function parseJson(body) {
17
+ const parsed = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(body));
18
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed))
19
+ throw new Error("body must be a JSON object");
20
+ return parsed;
21
+ }
22
+ /** Strict on purpose: no quotes, spaces, brackets or comments. Anything fancier denies. */
23
+ const ADDR = /^[^\s@<>()",;:[\]\\]+@[A-Za-z0-9.-]+$/;
24
+ async function fromRaw(raw) {
25
+ if (typeof raw !== "string" || !raw)
26
+ throw new Error("missing raw message");
27
+ if (!/^[A-Za-z0-9+/_-]+={0,2}$/.test(raw))
28
+ throw new Error("raw is not base64");
29
+ const bytes = Buffer.from(raw, "base64url");
30
+ // Limits throw (deny) instead of truncating.
31
+ const email = await PostalMime.parse(bytes, { maxNestingDepth: 8, maxPartCount: 100, attachmentEncoding: "arraybuffer" });
32
+ const headerValues = (key) => email.headers.filter((h) => h.key === key).map((h) => h.value);
33
+ const recipients = [
34
+ ...addresses(email.to, headerValues("to")),
35
+ ...addresses(email.cc, headerValues("cc")),
36
+ ...addresses(email.bcc, headerValues("bcc")),
37
+ ];
38
+ const unique = [...new Set(recipients)];
39
+ assertBodyParsed(bytes, email);
40
+ return {
41
+ recipients: unique,
42
+ recipient_domains: [...new Set(unique.map((a) => a.slice(a.lastIndexOf("@") + 1)))],
43
+ subject: email.subject ?? null,
44
+ text: email.text ?? null,
45
+ html: email.html ?? null,
46
+ attachments: email.attachments.map((a) => ({ contentType: a.mimeType, filename: a.filename })),
47
+ };
48
+ }
49
+ /**
50
+ * postal-mime keeps going on malformed lists: `a@x <b@y> <c@z>` yields b@y with
51
+ * "a@x c@z" as the display name. Gmail may read that differently, so: every address must
52
+ * be plain, and an address-like display name is only accepted when it was quoted or a comment.
53
+ */
54
+ function addresses(list, rawHeaders) {
55
+ const raw = rawHeaders.join("\n");
56
+ return (list ?? [])
57
+ .flatMap((a) => (a.group ? a.group : [a]))
58
+ .map(({ address, name }) => {
59
+ if (!ADDR.test(address))
60
+ throw new Error(`unparseable recipient ${JSON.stringify(address || name)}`);
61
+ const delimited = raw.includes(`"${name}"`) || raw.includes(`(${name})`);
62
+ if (/[@<>]/.test(name) && !delimited)
63
+ throw new Error(`ambiguous recipient ${JSON.stringify(name)} <${address}>`);
64
+ return address.toLowerCase();
65
+ });
66
+ }
67
+ /**
68
+ * Lenient parsing can drop content it doesn't understand (e.g. a broken multipart boundary),
69
+ * which a content check would then never see. Deny when a non-empty body produced nothing,
70
+ * or a top-level multipart is never closed.
71
+ */
72
+ function assertBodyParsed(bytes, email) {
73
+ const source = Buffer.from(bytes).toString("latin1");
74
+ const split = source.search(/\r?\n\r?\n/);
75
+ const body = split === -1 ? "" : source.slice(split).trim();
76
+ if (body && !email.text && !email.html && email.attachments.length === 0)
77
+ throw new Error("message body could not be parsed");
78
+ const contentType = email.headers.find((h) => h.key === "content-type")?.value ?? "";
79
+ const boundary = contentType.match(/boundary\s*=\s*(?:"([^"]+)"|([^\s;]+))/i);
80
+ if (/^\s*multipart\//i.test(contentType)) {
81
+ const b = boundary?.[1] ?? boundary?.[2];
82
+ if (!b || !source.includes(`--${b}--`))
83
+ throw new Error("multipart message is missing its closing boundary");
84
+ }
85
+ }
@@ -0,0 +1,323 @@
1
+ import type { OperationTable } from "../../core/types.js";
2
+ export type GmailAction = "gmail.users.drafts.create" | "gmail.users.drafts.delete" | "gmail.users.drafts.get" | "gmail.users.drafts.list" | "gmail.users.drafts.send" | "gmail.users.drafts.update" | "gmail.users.getProfile" | "gmail.users.history.list" | "gmail.users.labels.create" | "gmail.users.labels.delete" | "gmail.users.labels.get" | "gmail.users.labels.list" | "gmail.users.labels.patch" | "gmail.users.labels.update" | "gmail.users.messages.attachments.get" | "gmail.users.messages.batchDelete" | "gmail.users.messages.batchModify" | "gmail.users.messages.delete" | "gmail.users.messages.get" | "gmail.users.messages.import" | "gmail.users.messages.insert" | "gmail.users.messages.list" | "gmail.users.messages.modify" | "gmail.users.messages.send" | "gmail.users.messages.trash" | "gmail.users.messages.untrash" | "gmail.users.settings.cse.identities.create" | "gmail.users.settings.cse.identities.delete" | "gmail.users.settings.cse.identities.get" | "gmail.users.settings.cse.identities.list" | "gmail.users.settings.cse.identities.patch" | "gmail.users.settings.cse.keypairs.create" | "gmail.users.settings.cse.keypairs.disable" | "gmail.users.settings.cse.keypairs.enable" | "gmail.users.settings.cse.keypairs.get" | "gmail.users.settings.cse.keypairs.list" | "gmail.users.settings.cse.keypairs.obliterate" | "gmail.users.settings.delegates.create" | "gmail.users.settings.delegates.delete" | "gmail.users.settings.delegates.get" | "gmail.users.settings.delegates.list" | "gmail.users.settings.filters.create" | "gmail.users.settings.filters.delete" | "gmail.users.settings.filters.get" | "gmail.users.settings.filters.list" | "gmail.users.settings.forwardingAddresses.create" | "gmail.users.settings.forwardingAddresses.delete" | "gmail.users.settings.forwardingAddresses.get" | "gmail.users.settings.forwardingAddresses.list" | "gmail.users.settings.getAutoForwarding" | "gmail.users.settings.getImap" | "gmail.users.settings.getLanguage" | "gmail.users.settings.getPop" | "gmail.users.settings.getVacation" | "gmail.users.settings.sendAs.create" | "gmail.users.settings.sendAs.delete" | "gmail.users.settings.sendAs.get" | "gmail.users.settings.sendAs.list" | "gmail.users.settings.sendAs.patch" | "gmail.users.settings.sendAs.smimeInfo.delete" | "gmail.users.settings.sendAs.smimeInfo.get" | "gmail.users.settings.sendAs.smimeInfo.insert" | "gmail.users.settings.sendAs.smimeInfo.list" | "gmail.users.settings.sendAs.smimeInfo.setDefault" | "gmail.users.settings.sendAs.update" | "gmail.users.settings.sendAs.verify" | "gmail.users.settings.updateAutoForwarding" | "gmail.users.settings.updateImap" | "gmail.users.settings.updateLanguage" | "gmail.users.settings.updatePop" | "gmail.users.settings.updateVacation" | "gmail.users.stop" | "gmail.users.threads.delete" | "gmail.users.threads.get" | "gmail.users.threads.list" | "gmail.users.threads.modify" | "gmail.users.threads.trash" | "gmail.users.threads.untrash" | "gmail.users.watch";
3
+ /** Typed path + query params per action, as seen by policy rules. */
4
+ export interface GmailParams {
5
+ "gmail.users.drafts.create": {
6
+ "userId": string;
7
+ };
8
+ "gmail.users.drafts.delete": {
9
+ "id": string;
10
+ "userId": string;
11
+ };
12
+ "gmail.users.drafts.get": {
13
+ "format"?: "minimal" | "full" | "raw" | "metadata";
14
+ "id": string;
15
+ "userId": string;
16
+ };
17
+ "gmail.users.drafts.list": {
18
+ "includeSpamTrash"?: boolean;
19
+ "maxResults"?: number;
20
+ "pageToken"?: string;
21
+ "q"?: string;
22
+ "userId": string;
23
+ };
24
+ "gmail.users.drafts.send": {
25
+ "userId": string;
26
+ };
27
+ "gmail.users.drafts.update": {
28
+ "id": string;
29
+ "userId": string;
30
+ };
31
+ "gmail.users.getProfile": {
32
+ "userId": string;
33
+ };
34
+ "gmail.users.history.list": {
35
+ "historyTypes"?: ("messageAdded" | "messageDeleted" | "labelAdded" | "labelRemoved")[];
36
+ "labelId"?: string;
37
+ "maxResults"?: number;
38
+ "pageToken"?: string;
39
+ "startHistoryId"?: string;
40
+ "userId": string;
41
+ };
42
+ "gmail.users.labels.create": {
43
+ "userId": string;
44
+ };
45
+ "gmail.users.labels.delete": {
46
+ "id": string;
47
+ "userId": string;
48
+ };
49
+ "gmail.users.labels.get": {
50
+ "id": string;
51
+ "userId": string;
52
+ };
53
+ "gmail.users.labels.list": {
54
+ "userId": string;
55
+ };
56
+ "gmail.users.labels.patch": {
57
+ "id": string;
58
+ "userId": string;
59
+ };
60
+ "gmail.users.labels.update": {
61
+ "id": string;
62
+ "userId": string;
63
+ };
64
+ "gmail.users.messages.attachments.get": {
65
+ "id": string;
66
+ "messageId": string;
67
+ "userId": string;
68
+ };
69
+ "gmail.users.messages.batchDelete": {
70
+ "userId": string;
71
+ };
72
+ "gmail.users.messages.batchModify": {
73
+ "userId": string;
74
+ };
75
+ "gmail.users.messages.delete": {
76
+ "id": string;
77
+ "userId": string;
78
+ };
79
+ "gmail.users.messages.get": {
80
+ "format"?: "minimal" | "full" | "raw" | "metadata";
81
+ "id": string;
82
+ "metadataHeaders"?: string[];
83
+ "userId": string;
84
+ };
85
+ "gmail.users.messages.import": {
86
+ "deleted"?: boolean;
87
+ "internalDateSource"?: "receivedTime" | "dateHeader";
88
+ "neverMarkSpam"?: boolean;
89
+ "processForCalendar"?: boolean;
90
+ "userId": string;
91
+ };
92
+ "gmail.users.messages.insert": {
93
+ "deleted"?: boolean;
94
+ "internalDateSource"?: "receivedTime" | "dateHeader";
95
+ "userId": string;
96
+ };
97
+ "gmail.users.messages.list": {
98
+ "includeSpamTrash"?: boolean;
99
+ "labelIds"?: string[];
100
+ "maxResults"?: number;
101
+ "pageToken"?: string;
102
+ "q"?: string;
103
+ "userId": string;
104
+ };
105
+ "gmail.users.messages.modify": {
106
+ "id": string;
107
+ "userId": string;
108
+ };
109
+ "gmail.users.messages.send": {
110
+ "userId": string;
111
+ };
112
+ "gmail.users.messages.trash": {
113
+ "id": string;
114
+ "userId": string;
115
+ };
116
+ "gmail.users.messages.untrash": {
117
+ "id": string;
118
+ "userId": string;
119
+ };
120
+ "gmail.users.settings.cse.identities.create": {
121
+ "userId": string;
122
+ };
123
+ "gmail.users.settings.cse.identities.delete": {
124
+ "cseEmailAddress": string;
125
+ "userId": string;
126
+ };
127
+ "gmail.users.settings.cse.identities.get": {
128
+ "cseEmailAddress": string;
129
+ "userId": string;
130
+ };
131
+ "gmail.users.settings.cse.identities.list": {
132
+ "pageSize"?: number;
133
+ "pageToken"?: string;
134
+ "userId": string;
135
+ };
136
+ "gmail.users.settings.cse.identities.patch": {
137
+ "emailAddress": string;
138
+ "userId": string;
139
+ };
140
+ "gmail.users.settings.cse.keypairs.create": {
141
+ "chainValidation"?: "all" | "none";
142
+ "userId": string;
143
+ };
144
+ "gmail.users.settings.cse.keypairs.disable": {
145
+ "keyPairId": string;
146
+ "userId": string;
147
+ };
148
+ "gmail.users.settings.cse.keypairs.enable": {
149
+ "keyPairId": string;
150
+ "userId": string;
151
+ };
152
+ "gmail.users.settings.cse.keypairs.get": {
153
+ "keyPairId": string;
154
+ "userId": string;
155
+ };
156
+ "gmail.users.settings.cse.keypairs.list": {
157
+ "pageSize"?: number;
158
+ "pageToken"?: string;
159
+ "userId": string;
160
+ };
161
+ "gmail.users.settings.cse.keypairs.obliterate": {
162
+ "keyPairId": string;
163
+ "userId": string;
164
+ };
165
+ "gmail.users.settings.delegates.create": {
166
+ "userId": string;
167
+ };
168
+ "gmail.users.settings.delegates.delete": {
169
+ "delegateEmail": string;
170
+ "userId": string;
171
+ };
172
+ "gmail.users.settings.delegates.get": {
173
+ "delegateEmail": string;
174
+ "userId": string;
175
+ };
176
+ "gmail.users.settings.delegates.list": {
177
+ "userId": string;
178
+ };
179
+ "gmail.users.settings.filters.create": {
180
+ "userId": string;
181
+ };
182
+ "gmail.users.settings.filters.delete": {
183
+ "id": string;
184
+ "userId": string;
185
+ };
186
+ "gmail.users.settings.filters.get": {
187
+ "id": string;
188
+ "userId": string;
189
+ };
190
+ "gmail.users.settings.filters.list": {
191
+ "userId": string;
192
+ };
193
+ "gmail.users.settings.forwardingAddresses.create": {
194
+ "userId": string;
195
+ };
196
+ "gmail.users.settings.forwardingAddresses.delete": {
197
+ "forwardingEmail": string;
198
+ "userId": string;
199
+ };
200
+ "gmail.users.settings.forwardingAddresses.get": {
201
+ "forwardingEmail": string;
202
+ "userId": string;
203
+ };
204
+ "gmail.users.settings.forwardingAddresses.list": {
205
+ "userId": string;
206
+ };
207
+ "gmail.users.settings.getAutoForwarding": {
208
+ "userId": string;
209
+ };
210
+ "gmail.users.settings.getImap": {
211
+ "userId": string;
212
+ };
213
+ "gmail.users.settings.getLanguage": {
214
+ "userId": string;
215
+ };
216
+ "gmail.users.settings.getPop": {
217
+ "userId": string;
218
+ };
219
+ "gmail.users.settings.getVacation": {
220
+ "userId": string;
221
+ };
222
+ "gmail.users.settings.sendAs.create": {
223
+ "userId": string;
224
+ };
225
+ "gmail.users.settings.sendAs.delete": {
226
+ "sendAsEmail": string;
227
+ "userId": string;
228
+ };
229
+ "gmail.users.settings.sendAs.get": {
230
+ "sendAsEmail": string;
231
+ "userId": string;
232
+ };
233
+ "gmail.users.settings.sendAs.list": {
234
+ "userId": string;
235
+ };
236
+ "gmail.users.settings.sendAs.patch": {
237
+ "sendAsEmail": string;
238
+ "userId": string;
239
+ };
240
+ "gmail.users.settings.sendAs.smimeInfo.delete": {
241
+ "id": string;
242
+ "sendAsEmail": string;
243
+ "userId": string;
244
+ };
245
+ "gmail.users.settings.sendAs.smimeInfo.get": {
246
+ "id": string;
247
+ "sendAsEmail": string;
248
+ "userId": string;
249
+ };
250
+ "gmail.users.settings.sendAs.smimeInfo.insert": {
251
+ "sendAsEmail": string;
252
+ "userId": string;
253
+ };
254
+ "gmail.users.settings.sendAs.smimeInfo.list": {
255
+ "sendAsEmail": string;
256
+ "userId": string;
257
+ };
258
+ "gmail.users.settings.sendAs.smimeInfo.setDefault": {
259
+ "id": string;
260
+ "sendAsEmail": string;
261
+ "userId": string;
262
+ };
263
+ "gmail.users.settings.sendAs.update": {
264
+ "sendAsEmail": string;
265
+ "userId": string;
266
+ };
267
+ "gmail.users.settings.sendAs.verify": {
268
+ "sendAsEmail": string;
269
+ "userId": string;
270
+ };
271
+ "gmail.users.settings.updateAutoForwarding": {
272
+ "userId": string;
273
+ };
274
+ "gmail.users.settings.updateImap": {
275
+ "userId": string;
276
+ };
277
+ "gmail.users.settings.updateLanguage": {
278
+ "userId": string;
279
+ };
280
+ "gmail.users.settings.updatePop": {
281
+ "userId": string;
282
+ };
283
+ "gmail.users.settings.updateVacation": {
284
+ "userId": string;
285
+ };
286
+ "gmail.users.stop": {
287
+ "userId": string;
288
+ };
289
+ "gmail.users.threads.delete": {
290
+ "id": string;
291
+ "userId": string;
292
+ };
293
+ "gmail.users.threads.get": {
294
+ "format"?: "full" | "metadata" | "minimal";
295
+ "id": string;
296
+ "metadataHeaders"?: string[];
297
+ "userId": string;
298
+ };
299
+ "gmail.users.threads.list": {
300
+ "includeSpamTrash"?: boolean;
301
+ "labelIds"?: string[];
302
+ "maxResults"?: number;
303
+ "pageToken"?: string;
304
+ "q"?: string;
305
+ "userId": string;
306
+ };
307
+ "gmail.users.threads.modify": {
308
+ "id": string;
309
+ "userId": string;
310
+ };
311
+ "gmail.users.threads.trash": {
312
+ "id": string;
313
+ "userId": string;
314
+ };
315
+ "gmail.users.threads.untrash": {
316
+ "id": string;
317
+ "userId": string;
318
+ };
319
+ "gmail.users.watch": {
320
+ "userId": string;
321
+ };
322
+ }
323
+ export declare const gmailTable: OperationTable;