@framers/agentos-ext-gmail-source 0.1.0 → 0.3.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/README.md +59 -2
- package/dist/index.d.ts +8 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/dist/mailSanitize.d.ts +100 -0
- package/dist/mailSanitize.d.ts.map +1 -0
- package/dist/mailSanitize.js +257 -0
- package/dist/mailSanitize.js.map +1 -0
- package/dist/mapThread.d.ts +66 -0
- package/dist/mapThread.d.ts.map +1 -0
- package/dist/mapThread.js +228 -0
- package/dist/mapThread.js.map +1 -0
- package/dist/messageText.d.ts +27 -0
- package/dist/messageText.d.ts.map +1 -0
- package/dist/messageText.js +153 -0
- package/dist/messageText.js.map +1 -0
- package/dist/mime.d.ts +141 -0
- package/dist/mime.d.ts.map +1 -0
- package/dist/mime.js +377 -0
- package/dist/mime.js.map +1 -0
- package/manifest.json +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Gmail source
|
|
2
2
|
|
|
3
|
-
This library provides read-only Gmail authorization on the AgentOS redirect grant and sealed-token contracts. It requests the sole Gmail read-only scope, offline access and incremental consent. It exports no send, reply, label-modification or attachment-download tool.
|
|
3
|
+
This library provides read-only Gmail authorization on the AgentOS redirect grant and sealed-token contracts, text helpers that sanitize and trim mail before it is stored (see Text ingestion below), and a bounded mapper that turns one thread response into a sanitized source document (see Thread documents below). It requests the sole Gmail read-only scope, offline access and incremental consent. It exports no send, reply, label-modification or attachment-download tool.
|
|
4
4
|
|
|
5
|
-
Install it next to `@framers/agentos` 0.13.134 or later and `@framers/agentos-ext-account-sources` 0.
|
|
5
|
+
Install it next to `@framers/agentos` 0.13.134 or later and `@framers/agentos-ext-account-sources` 0.7.0 or later. Both are peer dependencies with a floor and no upper bound. Node.js 20.19 or later is required.
|
|
6
6
|
|
|
7
7
|
```ts
|
|
8
8
|
import { GmailOAuthFlow } from '@framers/agentos-ext-gmail-source';
|
|
@@ -37,3 +37,60 @@ OAuth responses are capped at 65,536 bytes and must finish within 15 seconds. Pa
|
|
|
37
37
|
The host supplies informed consent, cache permission, retention policy, account isolation and a truthful availability state. Authorization alone does not establish permission to store or send mailbox content to a model. Do not infer those permissions from this package's successful tests.
|
|
38
38
|
|
|
39
39
|
Protocol references: https://developers.google.com/identity/protocols/oauth2/web-server and https://developers.google.com/workspace/gmail/api/auth/scopes.
|
|
40
|
+
|
|
41
|
+
## Text ingestion
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
import { messageText, sanitizeMailHeaders, sanitizeMailMetadata } from '@framers/agentos-ext-gmail-source';
|
|
45
|
+
|
|
46
|
+
const policy = { maxInputCharacters: 2_097_152, maxLineCharacters: 65_536, maxOutputCharacters: 20_000 };
|
|
47
|
+
|
|
48
|
+
// Strings the host's MIME reader has already decoded within its byte and structure bounds.
|
|
49
|
+
const headers = sanitizeMailHeaders(decodedHeaders, policy); // { subject, date, from, to, cc }
|
|
50
|
+
const body = messageText(decodedPlainText, policy);
|
|
51
|
+
const filename = sanitizeMailMetadata(decodedFilename, { ...policy, maxOutputCharacters: 200 }).text;
|
|
52
|
+
// body.text is sanitized and trimmed; body.trimmedQuote, body.trimmedSignature and body.truncated report omissions.
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
`sanitizeMailText(input, policy)` removes address tokens and credential-shaped content without a network call. `sanitizeMailMetadata` applies the same rules and folds whitespace for filenames, label names and display fields. `sanitizeMailHeaders` retains only Subject, Date, From, To and Cc; its Subject output is capped at 200 characters. MIME header decoding and structural validation must happen before these functions receive strings. Bcc is never returned.
|
|
56
|
+
|
|
57
|
+
`policy` supplies `maxInputCharacters`, `maxLineCharacters` and `maxOutputCharacters` as positive UTF-16 code-unit counts. The input ceiling is 2,097,152 and the line ceiling is 65,536. The output cap cannot exceed the input cap. Oversized input throws `GmailTextFault` with a fixed reason; an overlong line is suppressed. Processing never scans only a truncated prefix for credentials. Repeated percent and common entity decoding is bounded, and unresolved encoded-byte lines are removed. Output truncation avoids splitting a surrogate pair and is marked in the result.
|
|
58
|
+
|
|
59
|
+
`messageText(input, policy)` sanitizes first, trims recognized reply history and short signatures, then applies the output cap. Explicit forwarded content and ambiguous prose are retained. Its `trimmedQuote`, `trimmedSignature` and `truncated` flags describe omissions. Quote spans must refer to its returned string, without inserted summaries or an ellipsis presented as source text. A host should disclose that attachments are listed and their contents are not read when its mapper implements that boundary.
|
|
60
|
+
|
|
61
|
+
The functions return text and counts only. They do not store raw values or a reverse-redaction map, log matches, fetch URLs, interpret mail as instructions or invoke a model. Sanitization can remove benign text and cannot identify every possible secret. It does not make personal mail anonymous or authorize model processing, sharing or retention. Hosts must preserve the source's privacy, expiry and deletion rules for both text and derived results.
|
|
62
|
+
|
|
63
|
+
## Thread documents
|
|
64
|
+
|
|
65
|
+
```ts
|
|
66
|
+
import { GmailThreadMapper } from '@framers/agentos-ext-gmail-source';
|
|
67
|
+
|
|
68
|
+
const mapper = new GmailThreadMapper({
|
|
69
|
+
maxResponseBytes: 2_097_152, maxDecodedBytes: 2_097_152, maxMimeDepth: 20, maxMimeParts: 1_000,
|
|
70
|
+
maxMessages: 100, maxMessageCharacters: 20_000, maxThreadCharacters: 200_000,
|
|
71
|
+
maxMetadataCharacters: 200_000, maxInputCharacters: 2_097_152, maxLineCharacters: 65_536,
|
|
72
|
+
maximumCacheMs: 86_400_000,
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
// `response` is the parsed threads.get (format=full) body from a transport that capped its bytes.
|
|
76
|
+
const result = await mapper.map(response, {
|
|
77
|
+
sourceId: response.id,
|
|
78
|
+
sourceDetailUrl: detailPath, // the host's authenticated source-detail route, never a Gmail link
|
|
79
|
+
cutoff, windowMs: 30 * 86_400_000, readStartedAt, receivedAt,
|
|
80
|
+
permission, cacheHeaders, labelNames, labelCache, signal,
|
|
81
|
+
});
|
|
82
|
+
// result.kind is 'document' (text, message spans, metadata, cache expiry) or 'skipped' with a fixed reason.
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Construct `GmailThreadMapper(bounds)` with explicit response, decoded-byte, MIME depth/part, retained-message, message/thread text, metadata, sanitizer and cache ceilings. `map(thread, options)` returns the account-source `SourceSyncReadResult` union. The input is the parsed response from a transport that already enforced its byte cap before JSON decoding. The mapper separately checks recognized MIME data and the entire part tree before decoding any selected body. A parsed object alone cannot establish its original wire size.
|
|
86
|
+
|
|
87
|
+
Supply a fixed selection cutoff, message window, original read start and completion times, actual response cache headers, independently established cache permission and a host-generated relative detail path. The path must resolve authentication and current source generation in the host. It is never a Gmail deep link or a request-derived external URL. A successful OAuth grant does not establish cache or model-processing permission.
|
|
88
|
+
Pass `labelCache` as the separate labels response’s cache decision. Missing, refused or expired label permission keeps ids without names. Permitted names shorten the entire document’s expiry when their allowed lifetime ends first.
|
|
89
|
+
|
|
90
|
+
Each message is filtered by its internal timestamp and excluded labels. Retained messages are selected newest first with stable id ties, within the explicit cap, and rendered chronologically. Plain text wins within a MIME alternative. Other multipart containers retain their non-attachment text children in MIME order. HTML uses the public AgentOS `HtmlLoader` with an in-memory Buffer. No browser or remote resource is loaded. The resulting text, structured headers, filenames, media types and label names all pass the text sanitizer.
|
|
91
|
+
|
|
92
|
+
Attachments are listed; their contents are not read. An external body or attachment contributes only sanitized filename, media type and size. Inline attachment bytes and attachment ids are discarded. Bcc, raw payloads, snippets and unknown fields are not returned. The mapper never calls any Gmail endpoint. Unsupported charset, invalid bytes and omitted content have fixed counted reasons. Invalid protocol shape is a failure rather than an empty successful source.
|
|
93
|
+
|
|
94
|
+
A returned document has matching item/ref versions, a normalized-content hash, message ids and body spans, earliest allowed expiry and explicit omission/truncation metadata. Spans count UTF-16 code units in the returned text and exclude the header prefix. Quote trimming preserves normalized source text; no generated summary or ellipsis is inserted into a quote. Header-only messages can have an empty body span. Render structured metadata as escaped text and treat all mail as untrusted data.
|
|
95
|
+
|
|
96
|
+
A history-only change does not extend cache life or change the normalized hash. Storage still requires the account-source transactional fence, fresh expiry checks and host allowances. Derived results retain the whole source's personal-use, expiry and deletion restrictions. Never persist the transient MIME types or bypass the account-source store with a mapper result.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview A read-only Gmail source's grant: Google's read-only scope on the AgentOS redirect OAuth flow and
|
|
3
|
-
* sealed-token store, with capped, cancellable OAuth calls and fixed failures
|
|
3
|
+
* sealed-token store, with capped, cancellable OAuth calls and fixed failures; its text helpers: bounded
|
|
4
|
+
* pre-storage sanitization of mail text, allow-listed headers and metadata, and conservative trimming of reply history
|
|
5
|
+
* and signatures; and its thread mapper: bounded MIME reading of one thread into a sanitized account-source document
|
|
6
|
+
* with message provenance, attachment listings and an explicit cache decision.
|
|
4
7
|
* @module agentos-ext-gmail-source
|
|
5
8
|
*/
|
|
6
9
|
export { GmailOAuthFlow } from './GmailOAuthFlow.js';
|
|
7
10
|
export { GMAIL_READONLY_SCOPE, GmailOAuthFault, type GmailOAuthFailure, type GmailGrantCleanup, type GmailOAuthClient, type GmailOAuthEndpoints, type GmailOAuthOptions, } from './types.js';
|
|
11
|
+
export { GmailTextFault, sanitizeMailText, sanitizeMailMetadata, sanitizeMailHeaders, type GmailTextPolicy, type GmailSanitizedText, type GmailHeaderInput, type GmailSanitizedHeaders, type GmailTextFailure, } from './mailSanitize.js';
|
|
12
|
+
export { messageText, type GmailMessageText } from './messageText.js';
|
|
13
|
+
export { GmailThreadMapper, type GmailMapThreadOptions } from './mapThread.js';
|
|
14
|
+
export { GmailMappingFault, type GmailMappingBounds } from './mime.js';
|
|
8
15
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EACL,oBAAoB,EAAE,eAAe,EAAE,KAAK,iBAAiB,EAAE,KAAK,iBAAiB,EACrF,KAAK,gBAAgB,EAAE,KAAK,mBAAmB,EAAE,KAAK,iBAAiB,GACxE,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,cAAc,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,mBAAmB,EAC3E,KAAK,eAAe,EAAE,KAAK,kBAAkB,EAAE,KAAK,gBAAgB,EACpE,KAAK,qBAAqB,EAAE,KAAK,gBAAgB,GAClD,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,KAAK,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAC/E,OAAO,EAAE,iBAAiB,EAAE,KAAK,kBAAkB,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview A read-only Gmail source's grant: Google's read-only scope on the AgentOS redirect OAuth flow and
|
|
3
|
-
* sealed-token store, with capped, cancellable OAuth calls and fixed failures
|
|
3
|
+
* sealed-token store, with capped, cancellable OAuth calls and fixed failures; its text helpers: bounded
|
|
4
|
+
* pre-storage sanitization of mail text, allow-listed headers and metadata, and conservative trimming of reply history
|
|
5
|
+
* and signatures; and its thread mapper: bounded MIME reading of one thread into a sanitized account-source document
|
|
6
|
+
* with message provenance, attachment listings and an explicit cache decision.
|
|
4
7
|
* @module agentos-ext-gmail-source
|
|
5
8
|
*/
|
|
6
9
|
export { GmailOAuthFlow } from './GmailOAuthFlow.js';
|
|
7
10
|
export { GMAIL_READONLY_SCOPE, GmailOAuthFault, } from './types.js';
|
|
11
|
+
export { GmailTextFault, sanitizeMailText, sanitizeMailMetadata, sanitizeMailHeaders, } from './mailSanitize.js';
|
|
12
|
+
export { messageText } from './messageText.js';
|
|
13
|
+
export { GmailThreadMapper } from './mapThread.js';
|
|
14
|
+
export { GmailMappingFault } from './mime.js';
|
|
8
15
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EACL,oBAAoB,EAAE,eAAe,GAEtC,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,cAAc,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,mBAAmB,GAG5E,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAyB,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAA8B,MAAM,gBAAgB,CAAC;AAC/E,OAAO,EAAE,iBAAiB,EAA2B,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Deterministic pre-storage sanitization of mail text: address tokens, credential assignments, known
|
|
3
|
+
* credential shapes, private-key blocks and long mixed tokens are replaced with fixed marks, and a final gate
|
|
4
|
+
* suppresses any line that still carries a credential cue. Every count is a number; no matched value, offset or
|
|
5
|
+
* reverse mapping is kept, nothing is logged and no model or network is called.
|
|
6
|
+
* @module agentos-ext-gmail-source/mailSanitize
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* The bounds of one sanitization call, as positive safe integer UTF-16 code-unit counts. The input ceiling is
|
|
10
|
+
* 2,097,152, the line ceiling 65,536, and the output cap cannot exceed the input cap.
|
|
11
|
+
*/
|
|
12
|
+
export interface GmailTextPolicy {
|
|
13
|
+
/** The largest input accepted, before and after decoding; larger input throws `GmailTextFault('input_too_large')`. */
|
|
14
|
+
readonly maxInputCharacters: number;
|
|
15
|
+
/** The longest line inspected; a longer line is suppressed whole before any token matching. */
|
|
16
|
+
readonly maxLineCharacters: number;
|
|
17
|
+
/** The longest text returned; the complete input is checked before this cap clips the result. */
|
|
18
|
+
readonly maxOutputCharacters: number;
|
|
19
|
+
}
|
|
20
|
+
/** Sanitized text and content-free counts of what was removed. The counts are not permission to log the text. */
|
|
21
|
+
export interface GmailSanitizedText {
|
|
22
|
+
/** The sanitized text, clipped to the output cap without splitting a surrogate pair. */
|
|
23
|
+
readonly text: string;
|
|
24
|
+
/** How many address tokens became `[address removed]`. */
|
|
25
|
+
readonly addressRedactions: number;
|
|
26
|
+
/** How many credential lines, shapes, long mixed tokens and private-key blocks became `[secret removed]`. */
|
|
27
|
+
readonly secretRedactions: number;
|
|
28
|
+
/** How many lines became `[line removed by the secret gate]`. */
|
|
29
|
+
readonly suppressedLines: number;
|
|
30
|
+
/** Whether the output cap removed text. */
|
|
31
|
+
readonly truncated: boolean;
|
|
32
|
+
}
|
|
33
|
+
/** One message header after bounded MIME header decoding: its name and its decoded value. */
|
|
34
|
+
export interface GmailHeaderInput {
|
|
35
|
+
readonly name: string;
|
|
36
|
+
readonly value: string;
|
|
37
|
+
}
|
|
38
|
+
/** The retained headers, each sanitized; Bcc and every other header are never returned. */
|
|
39
|
+
export interface GmailSanitizedHeaders {
|
|
40
|
+
/** The first Subject, at most 200 characters. */
|
|
41
|
+
readonly subject: string;
|
|
42
|
+
/** The first Date, at most 1,000 characters. */
|
|
43
|
+
readonly date: string;
|
|
44
|
+
/** Every From value, joined with commas, at most 4,000 characters. */
|
|
45
|
+
readonly from: string;
|
|
46
|
+
/** Every To value, joined with commas, at most 4,000 characters. */
|
|
47
|
+
readonly to: string;
|
|
48
|
+
/** Every Cc value, joined with commas, at most 4,000 characters. */
|
|
49
|
+
readonly cc: string;
|
|
50
|
+
}
|
|
51
|
+
/** Why a text helper refused its input, as a fixed word: an invalid policy or input above its cap. */
|
|
52
|
+
export type GmailTextFailure = 'configuration' | 'input_too_large';
|
|
53
|
+
/** A text helper's fixed refusal; its message is `gmail_text_<reason>` and never carries source text. */
|
|
54
|
+
export declare class GmailTextFault extends Error {
|
|
55
|
+
readonly reason: GmailTextFailure;
|
|
56
|
+
/** @param reason Why the helper refused its input. */
|
|
57
|
+
constructor(reason: GmailTextFailure);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Pure pre-storage transformation. It never records matched values or invokes a model.
|
|
61
|
+
*
|
|
62
|
+
* Decodes repeated percent and character-reference encoding (at most four passes), normalizes Unicode and line breaks,
|
|
63
|
+
* then works line by line: private-key blocks, credential assignments and authenticated URLs are replaced, credential
|
|
64
|
+
* shapes and long mixed tokens become `[secret removed]`, address tokens become `[address removed]`, and a line with
|
|
65
|
+
* unresolved encoded bytes or character references, above the line cap or still carrying a credential cue becomes
|
|
66
|
+
* `[line removed by the secret gate]`. An assignment with an empty value, a block scalar or an unclosed quote also
|
|
67
|
+
* suppresses the rest of the text. A replaced assignment and a line the final gate suppresses keep their quote markers
|
|
68
|
+
* (`>`). The complete input is checked before the output cap clips the result.
|
|
69
|
+
*
|
|
70
|
+
* @param input Decoded text: a body or one display field.
|
|
71
|
+
* @param policy The input, line and output bounds.
|
|
72
|
+
* @returns The sanitized text and content-free counts.
|
|
73
|
+
* @throws {GmailTextFault} `configuration` for an invalid policy, `input_too_large` above the input cap.
|
|
74
|
+
*/
|
|
75
|
+
export declare function sanitizeMailText(input: string, policy: GmailTextPolicy): GmailSanitizedText;
|
|
76
|
+
/**
|
|
77
|
+
* Use for every filename, label name and display field, after MIME decoding. Applies the same rules as
|
|
78
|
+
* `sanitizeMailText` to the complete value, folds each whitespace run to one space and trims, then applies the
|
|
79
|
+
* output cap.
|
|
80
|
+
*
|
|
81
|
+
* @param input One decoded metadata value.
|
|
82
|
+
* @param policy The input, line and output bounds.
|
|
83
|
+
* @returns The sanitized one-line value and content-free counts.
|
|
84
|
+
* @throws {GmailTextFault} `configuration` for an invalid policy, `input_too_large` above the input cap.
|
|
85
|
+
*/
|
|
86
|
+
export declare function sanitizeMailMetadata(input: string, policy: GmailTextPolicy): GmailSanitizedText;
|
|
87
|
+
/**
|
|
88
|
+
* Input values must already have passed bounded MIME header decoding. Retains only Subject, Date, From, To and Cc,
|
|
89
|
+
* matched without regard to case, and sanitizes each as metadata: the first Subject (at most 200 characters) and Date
|
|
90
|
+
* (at most 1,000), and every From, To and Cc value joined with commas (at most 4,000 each), each also within the
|
|
91
|
+
* policy's output cap.
|
|
92
|
+
*
|
|
93
|
+
* @param headers At most 1,000 decoded headers, whose names and values together fit the input cap.
|
|
94
|
+
* @param policy The input, line and output bounds.
|
|
95
|
+
* @returns The five retained fields; a missing header is an empty string.
|
|
96
|
+
* @throws {GmailTextFault} `configuration` for an invalid policy, `input_too_large` for more than 1,000 headers or
|
|
97
|
+
* text above the input cap.
|
|
98
|
+
*/
|
|
99
|
+
export declare function sanitizeMailHeaders(headers: readonly GmailHeaderInput[], policy: GmailTextPolicy): GmailSanitizedHeaders;
|
|
100
|
+
//# sourceMappingURL=mailSanitize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mailSanitize.d.ts","sourceRoot":"","sources":["../src/mailSanitize.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,sHAAsH;IACtH,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,+FAA+F;IAC/F,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,iGAAiG;IACjG,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;CACtC;AACD,iHAAiH;AACjH,MAAM,WAAW,kBAAkB;IACjC,wFAAwF;IACxF,QAAQ,CAAC,IAAI,EAAE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AAE,SAAS,gBAAgB,EAAE,EAAE,MAAM,EAAE,eAAe,GAAG,qBAAqB,CAsBxH"}
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Deterministic pre-storage sanitization of mail text: address tokens, credential assignments, known
|
|
3
|
+
* credential shapes, private-key blocks and long mixed tokens are replaced with fixed marks, and a final gate
|
|
4
|
+
* suppresses any line that still carries a credential cue. Every count is a number; no matched value, offset or
|
|
5
|
+
* reverse mapping is kept, nothing is logged and no model or network is called.
|
|
6
|
+
* @module agentos-ext-gmail-source/mailSanitize
|
|
7
|
+
*/
|
|
8
|
+
/** A text helper's fixed refusal; its message is `gmail_text_<reason>` and never carries source text. */
|
|
9
|
+
export class GmailTextFault extends Error {
|
|
10
|
+
reason;
|
|
11
|
+
/** @param reason Why the helper refused its input. */
|
|
12
|
+
constructor(reason) {
|
|
13
|
+
super(`gmail_text_${reason}`);
|
|
14
|
+
this.reason = reason;
|
|
15
|
+
this.name = 'GmailTextFault';
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
const addressMark = '[address removed]';
|
|
19
|
+
const secretMark = '[secret removed]';
|
|
20
|
+
const lineMark = '[line removed by the secret gate]';
|
|
21
|
+
// Named character references decoded during canonicalization; any other name stays as written.
|
|
22
|
+
const namedEntities = Object.freeze({
|
|
23
|
+
amp: '&', lt: '<', gt: '>', quot: '"', apos: "'", commat: '@', period: '.',
|
|
24
|
+
colon: ':', sol: '/', bsol: '\\', equals: '=', percnt: '%', num: '#',
|
|
25
|
+
lowbar: '_', hyphen: '-', semi: ';', plus: '+', quest: '?', nbsp: ' ',
|
|
26
|
+
Tab: '\t', NewLine: '\n',
|
|
27
|
+
});
|
|
28
|
+
// Credential shapes replaced in place. They are a conservative policy, not a claim about every provider's format. A
|
|
29
|
+
// prefix right after a letter or digit is part of a word (`risk-adjusted`), not a credential. A JWT is matched only
|
|
30
|
+
// from the start of its run of token characters, so a long `-` joined run cannot make the scan quadratic.
|
|
31
|
+
const shapeSources = [
|
|
32
|
+
String.raw `(?<![A-Za-z0-9])(?:GOCSPX-|ya29\.|1//0|ghp_|github_pat_|xox[bpas]-|sk-ant-|sk-proj-|sk-|tvly-|whsec_)[A-Za-z0-9._~+/=-]{6,}`,
|
|
33
|
+
String.raw `\b(?:AKIA|ASIA)[A-Z0-9]{16}\b`,
|
|
34
|
+
String.raw `\bfc-[0-9a-f]{32}\b`,
|
|
35
|
+
String.raw `\bAIza[A-Za-z0-9_-]{20,}`,
|
|
36
|
+
String.raw `\bre_[A-Za-z0-9]{6,}_[A-Za-z0-9_]{10,}`,
|
|
37
|
+
String.raw `\b[rs]k_(?:live|test)_[A-Za-z0-9]{10,}`,
|
|
38
|
+
String.raw `(?<![A-Za-z0-9_-])eyJ[A-Za-z0-9_-]{4,}\.[A-Za-z0-9_-]{4,}\.[A-Za-z0-9_-]{4,}\b`,
|
|
39
|
+
];
|
|
40
|
+
// A credential label followed by `:` or `=`: the whole line is replaced. The password words (also plural), `token`,
|
|
41
|
+
// `secret`, `secret key` and the compound labels count at the end of any identifier (`DB_PASSWORD=`, `PGPASSWORD=`,
|
|
42
|
+
// `GITHUB_TOKEN=`, `authToken:`, `SECRET_KEY=`, `Passwords:`). The short or common labels count only after a character
|
|
43
|
+
// other than a letter or digit, so `Compass:` and `Preauthorization:` stay.
|
|
44
|
+
const assignment = /(?:(?<![a-z0-9])(?:pass|pwd|pw|authorization|cookie|set-cookie|database[ _-]?url|signing[ _-]?key|one[ _-]?time[ _-]?code)|pass(?:word|wd|code|phrase)s?|api[ _-]?key|access[ _-]?(?:key|token)|refresh[ _-]?token|client[ _-]?secret|secret(?:[ _-]?key)?|token|auth[ _-]?key|provisioning[ _-]?key|verification[ _-]?code)["']?\s*[:=]\s*/i;
|
|
45
|
+
// The final gate's cues: a line still carrying one after replacement is suppressed whole. The password words (also
|
|
46
|
+
// plural) and the compound cues count at the end of any identifier (`DB_PASSWORD`, `rsaPrivateKey`); `bearer` and the
|
|
47
|
+
// SSH cues need a character other than a letter or digit before them. No cue continues into a letter or digit.
|
|
48
|
+
const residual = /(?:(?<![a-z0-9])(?:bearer|ssh-(?:rsa|ed25519)|sshpass)|pass(?:word|wd|phrase)s?|api[ _-]?(?:key|token)|access[ _-]?token|refresh[ _-]?token|client[ _-]?secret|private[ _-]?key)(?![a-z0-9])/i;
|
|
49
|
+
const beginKey = /-----BEGIN [A-Z0-9 ]*PRIVATE KEY-----/;
|
|
50
|
+
const endKey = /-----END [A-Z0-9 ]*PRIVATE KEY-----/;
|
|
51
|
+
// Encoded bytes still present after the bounded decoding passes.
|
|
52
|
+
const unresolved = /%[0-9a-f]{2}|&#(?:x[0-9a-f]+|[0-9]+);?/i;
|
|
53
|
+
// A named reference the decoder knows, still present after the passes: the text was nested deeper than four levels.
|
|
54
|
+
const unresolvedName = new RegExp(`&(?:${Object.keys(namedEntities).join('|')});`);
|
|
55
|
+
function validate(policy) {
|
|
56
|
+
for (const value of [policy.maxInputCharacters, policy.maxLineCharacters, policy.maxOutputCharacters]) {
|
|
57
|
+
if (!Number.isSafeInteger(value) || value < 1)
|
|
58
|
+
throw new GmailTextFault('configuration');
|
|
59
|
+
}
|
|
60
|
+
if (policy.maxInputCharacters > 2_097_152 || policy.maxLineCharacters > 65_536
|
|
61
|
+
|| policy.maxOutputCharacters > policy.maxInputCharacters)
|
|
62
|
+
throw new GmailTextFault('configuration');
|
|
63
|
+
}
|
|
64
|
+
// At most four passes of percent and character-reference decoding, Unicode compatibility normalization, line-break
|
|
65
|
+
// unification and removal of format and control characters. The cap is checked before decoding and again after each
|
|
66
|
+
// pass, since normalization can lengthen text.
|
|
67
|
+
function canonical(input, limit) {
|
|
68
|
+
if (input.length > limit)
|
|
69
|
+
throw new GmailTextFault('input_too_large');
|
|
70
|
+
let text = input;
|
|
71
|
+
for (let pass = 0; pass < 4; pass++) {
|
|
72
|
+
const previous = text;
|
|
73
|
+
text = text.replace(/(?:%[0-9a-f]{2})+/gi, (run) => {
|
|
74
|
+
try {
|
|
75
|
+
return decodeURIComponent(run);
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
78
|
+
return run;
|
|
79
|
+
}
|
|
80
|
+
}).replace(/&(#x[0-9a-f]+|#[0-9]+|[a-z][a-z0-9]+);/gi, (whole, entity) => {
|
|
81
|
+
if (!entity.startsWith('#'))
|
|
82
|
+
return namedEntities[entity] ?? whole;
|
|
83
|
+
const hex = entity[1]?.toLowerCase() === 'x';
|
|
84
|
+
const point = Number.parseInt(entity.slice(hex ? 2 : 1), hex ? 16 : 10);
|
|
85
|
+
return Number.isSafeInteger(point) && point >= 0 && point <= 0x10ffff
|
|
86
|
+
&& !(point >= 0xd800 && point <= 0xdfff) ? String.fromCodePoint(point) : whole;
|
|
87
|
+
});
|
|
88
|
+
text = text.normalize('NFKC').replace(/\r\n?/g, '\n').replace(/[\u2028\u2029]/g, '\n')
|
|
89
|
+
.replace(/\p{Cf}/gu, '').replace(/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f-\x9f]/g, '');
|
|
90
|
+
if (text.length > limit)
|
|
91
|
+
throw new GmailTextFault('input_too_large');
|
|
92
|
+
if (text === previous)
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
return text;
|
|
96
|
+
}
|
|
97
|
+
// Clips without leaving the high half of a surrogate pair at the end.
|
|
98
|
+
function clipped(text, maximum) {
|
|
99
|
+
let end = Math.min(text.length, maximum);
|
|
100
|
+
if (end > 0 && end < text.length && /[\uD800-\uDBFF]/.test(text[end - 1])
|
|
101
|
+
&& /[\uDC00-\uDFFF]/.test(text[end]))
|
|
102
|
+
end--;
|
|
103
|
+
return text.slice(0, end);
|
|
104
|
+
}
|
|
105
|
+
// Whether the line holds a URL with a user name or password, or an unparsable URL with an `@`. The scheme is at most
|
|
106
|
+
// 64 characters, so a long run of scheme characters cannot make the scan quadratic; a longer one still leaves the `@`
|
|
107
|
+
// for the address rule.
|
|
108
|
+
function containsAuthenticatedUrl(line) {
|
|
109
|
+
for (const match of line.matchAll(/\b[a-z][a-z0-9+.-]{0,63}:\/\/[^\s<>"']+/gi)) {
|
|
110
|
+
try {
|
|
111
|
+
const url = new URL(match[0]);
|
|
112
|
+
if (url.username || url.password)
|
|
113
|
+
return true;
|
|
114
|
+
}
|
|
115
|
+
catch {
|
|
116
|
+
if (match[0].includes('@'))
|
|
117
|
+
return true;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Pure pre-storage transformation. It never records matched values or invokes a model.
|
|
124
|
+
*
|
|
125
|
+
* Decodes repeated percent and character-reference encoding (at most four passes), normalizes Unicode and line breaks,
|
|
126
|
+
* then works line by line: private-key blocks, credential assignments and authenticated URLs are replaced, credential
|
|
127
|
+
* shapes and long mixed tokens become `[secret removed]`, address tokens become `[address removed]`, and a line with
|
|
128
|
+
* unresolved encoded bytes or character references, above the line cap or still carrying a credential cue becomes
|
|
129
|
+
* `[line removed by the secret gate]`. An assignment with an empty value, a block scalar or an unclosed quote also
|
|
130
|
+
* suppresses the rest of the text. A replaced assignment and a line the final gate suppresses keep their quote markers
|
|
131
|
+
* (`>`). The complete input is checked before the output cap clips the result.
|
|
132
|
+
*
|
|
133
|
+
* @param input Decoded text: a body or one display field.
|
|
134
|
+
* @param policy The input, line and output bounds.
|
|
135
|
+
* @returns The sanitized text and content-free counts.
|
|
136
|
+
* @throws {GmailTextFault} `configuration` for an invalid policy, `input_too_large` above the input cap.
|
|
137
|
+
*/
|
|
138
|
+
export function sanitizeMailText(input, policy) {
|
|
139
|
+
validate(policy);
|
|
140
|
+
const normalized = canonical(input, policy.maxInputCharacters);
|
|
141
|
+
let addressRedactions = 0;
|
|
142
|
+
let secretRedactions = 0;
|
|
143
|
+
let suppressedLines = 0;
|
|
144
|
+
let insideKey = false;
|
|
145
|
+
let credentialTail = false;
|
|
146
|
+
const lines = [];
|
|
147
|
+
for (const raw of normalized.split('\n')) {
|
|
148
|
+
if (credentialTail) {
|
|
149
|
+
suppressedLines++;
|
|
150
|
+
lines.push(lineMark);
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
if (insideKey || beginKey.test(raw)) {
|
|
154
|
+
if (!insideKey)
|
|
155
|
+
secretRedactions++;
|
|
156
|
+
insideKey = !endKey.test(raw);
|
|
157
|
+
lines.push(secretMark);
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
if (raw.length > policy.maxLineCharacters || unresolved.test(raw) || unresolvedName.test(raw)) {
|
|
161
|
+
suppressedLines++;
|
|
162
|
+
lines.push(lineMark);
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
// Preserve quote depth so removal cannot turn quoted history into fresh text.
|
|
166
|
+
const quote = raw.match(/^([ \t]*(?:>[ \t]*)+)/)?.[0] ?? '';
|
|
167
|
+
let line = raw.slice(quote.length);
|
|
168
|
+
if (assignment.test(line) || containsAuthenticatedUrl(line) || /\bsshpass\s+-p\b/i.test(line)) {
|
|
169
|
+
const found = assignment.exec(line);
|
|
170
|
+
const value = found ? line.slice(found.index + found[0].length).trim() : null;
|
|
171
|
+
credentialTail = value !== null && (value === '' || /^[|>][+-]?$/.test(value) || ((value[0] === '"' || value[0] === "'") && value.lastIndexOf(value[0]) === 0));
|
|
172
|
+
secretRedactions++;
|
|
173
|
+
lines.push(quote + secretMark);
|
|
174
|
+
continue;
|
|
175
|
+
}
|
|
176
|
+
for (const source of shapeSources) {
|
|
177
|
+
line = line.replace(new RegExp(source, 'g'), () => { secretRedactions++; return secretMark; });
|
|
178
|
+
}
|
|
179
|
+
line = line.replace(/[A-Za-z0-9_+/=-]{32,}/g, (token) => {
|
|
180
|
+
if ((/[a-z]/i.test(token) && /[0-9]/.test(token)) || /^[0-9a-f]{40,}$/i.test(token)) {
|
|
181
|
+
secretRedactions++;
|
|
182
|
+
return secretMark;
|
|
183
|
+
}
|
|
184
|
+
return token;
|
|
185
|
+
});
|
|
186
|
+
line = line.replace(/"[^"\n]{1,512}"\s*@[^\s<>;,"']+/gu, () => { addressRedactions++; return addressMark; });
|
|
187
|
+
line = line.replace(/[^\s<>;,"'()\[\]]+/gu, (token) => { if (!token.includes('@'))
|
|
188
|
+
return token; addressRedactions++; return addressMark; });
|
|
189
|
+
const inspected = line.split(secretMark).join('').split(lineMark).join('');
|
|
190
|
+
if (residual.test(inspected) || endKey.test(inspected)) {
|
|
191
|
+
suppressedLines++;
|
|
192
|
+
lines.push(quote + lineMark);
|
|
193
|
+
continue;
|
|
194
|
+
}
|
|
195
|
+
lines.push(quote + line);
|
|
196
|
+
}
|
|
197
|
+
const complete = lines.join('\n');
|
|
198
|
+
const text = clipped(complete, policy.maxOutputCharacters);
|
|
199
|
+
return { text, addressRedactions, secretRedactions, suppressedLines, truncated: text.length < complete.length };
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Use for every filename, label name and display field, after MIME decoding. Applies the same rules as
|
|
203
|
+
* `sanitizeMailText` to the complete value, folds each whitespace run to one space and trims, then applies the
|
|
204
|
+
* output cap.
|
|
205
|
+
*
|
|
206
|
+
* @param input One decoded metadata value.
|
|
207
|
+
* @param policy The input, line and output bounds.
|
|
208
|
+
* @returns The sanitized one-line value and content-free counts.
|
|
209
|
+
* @throws {GmailTextFault} `configuration` for an invalid policy, `input_too_large` above the input cap.
|
|
210
|
+
*/
|
|
211
|
+
export function sanitizeMailMetadata(input, policy) {
|
|
212
|
+
validate(policy);
|
|
213
|
+
const safe = sanitizeMailText(input, { ...policy, maxOutputCharacters: policy.maxInputCharacters });
|
|
214
|
+
const complete = safe.text.replace(/\s+/gu, ' ').trim();
|
|
215
|
+
const text = clipped(complete, policy.maxOutputCharacters);
|
|
216
|
+
return { ...safe, text, truncated: safe.truncated || text.length < complete.length };
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Input values must already have passed bounded MIME header decoding. Retains only Subject, Date, From, To and Cc,
|
|
220
|
+
* matched without regard to case, and sanitizes each as metadata: the first Subject (at most 200 characters) and Date
|
|
221
|
+
* (at most 1,000), and every From, To and Cc value joined with commas (at most 4,000 each), each also within the
|
|
222
|
+
* policy's output cap.
|
|
223
|
+
*
|
|
224
|
+
* @param headers At most 1,000 decoded headers, whose names and values together fit the input cap.
|
|
225
|
+
* @param policy The input, line and output bounds.
|
|
226
|
+
* @returns The five retained fields; a missing header is an empty string.
|
|
227
|
+
* @throws {GmailTextFault} `configuration` for an invalid policy, `input_too_large` for more than 1,000 headers or
|
|
228
|
+
* text above the input cap.
|
|
229
|
+
*/
|
|
230
|
+
export function sanitizeMailHeaders(headers, policy) {
|
|
231
|
+
validate(policy);
|
|
232
|
+
if (headers.length > 1000)
|
|
233
|
+
throw new GmailTextFault('input_too_large');
|
|
234
|
+
let characters = 0;
|
|
235
|
+
const retained = new Map();
|
|
236
|
+
for (const header of headers) {
|
|
237
|
+
characters += header.name.length + header.value.length;
|
|
238
|
+
if (characters > policy.maxInputCharacters)
|
|
239
|
+
throw new GmailTextFault('input_too_large');
|
|
240
|
+
const name = header.name.toLowerCase();
|
|
241
|
+
if (!['subject', 'date', 'from', 'to', 'cc'].includes(name))
|
|
242
|
+
continue;
|
|
243
|
+
const values = retained.get(name) ?? [];
|
|
244
|
+
values.push(header.value);
|
|
245
|
+
retained.set(name, values);
|
|
246
|
+
}
|
|
247
|
+
const field = (name, single, maximum) => {
|
|
248
|
+
const values = retained.get(name) ?? [];
|
|
249
|
+
const raw = single ? values[0] ?? '' : values.join(', ');
|
|
250
|
+
return sanitizeMailMetadata(raw, { ...policy, maxOutputCharacters: Math.min(maximum, policy.maxOutputCharacters) }).text;
|
|
251
|
+
};
|
|
252
|
+
return {
|
|
253
|
+
subject: field('subject', true, 200), date: field('date', true, 1000),
|
|
254
|
+
from: field('from', false, 4000), to: field('to', false, 4000), cc: field('cc', false, 4000),
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
//# sourceMappingURL=mailSanitize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mail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AAE,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,EAAE,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC;KAC7F,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { type SourceCachePermission, type SourceCacheHeaders, type SourceCacheDecision, type SourceSyncReadResult } from '@framers/agentos-ext-account-sources';
|
|
2
|
+
import { type GmailMappingBounds } from './mime.js';
|
|
3
|
+
/** The per-read values of one `map` call. The host supplies every value; none comes from a browser request. */
|
|
4
|
+
export interface GmailMapThreadOptions {
|
|
5
|
+
/** The requested thread id; the response must carry the same id. */
|
|
6
|
+
readonly sourceId: string;
|
|
7
|
+
/**
|
|
8
|
+
* The host's authenticated source-detail path, used as `SourceRef.url`: a relative path of segments made of letters,
|
|
9
|
+
* digits, `_` and `-`, with no query, fragment or origin, at most 512 characters. Never a Gmail link.
|
|
10
|
+
*/
|
|
11
|
+
readonly sourceDetailUrl: string;
|
|
12
|
+
/** The selection cutoff, epoch milliseconds, no later than `receivedAt`: a message received after it is left out. */
|
|
13
|
+
readonly cutoff: number;
|
|
14
|
+
/**
|
|
15
|
+
* The message window in milliseconds, 1 to 90 days. A message received at or before `cutoff - windowMs`, or whose
|
|
16
|
+
* window has ended by `receivedAt`, is left out.
|
|
17
|
+
*/
|
|
18
|
+
readonly windowMs: number;
|
|
19
|
+
/** When the thread request started, epoch milliseconds. */
|
|
20
|
+
readonly readStartedAt: number;
|
|
21
|
+
/** When the thread response was complete, epoch milliseconds; it becomes `SourceRef.readAt`. */
|
|
22
|
+
readonly receivedAt: number;
|
|
23
|
+
/** The host's evidenced cache permission; null refuses durable content. */
|
|
24
|
+
readonly permission: SourceCachePermission | null;
|
|
25
|
+
/** The thread response's own cache headers. */
|
|
26
|
+
readonly cacheHeaders: SourceCacheHeaders;
|
|
27
|
+
/** Label names from the cycle's labels response, by label id. */
|
|
28
|
+
readonly labelNames: Readonly<Record<string, string>>;
|
|
29
|
+
/** The labels response's own cache decision. Null, a refusal or an expired decision keeps ids without names. */
|
|
30
|
+
readonly labelCache: SourceCacheDecision | null;
|
|
31
|
+
/** Cancels the call between steps. */
|
|
32
|
+
readonly signal?: AbortSignal;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Maps one parsed Gmail thread into a sanitized account-source document: one thread, one document, with each retained
|
|
36
|
+
* message's id, dates, sanitized headers, labels, attachment listing and body span. It calls no endpoint, writes no log
|
|
37
|
+
* and keeps no state between calls.
|
|
38
|
+
*/
|
|
39
|
+
export declare class GmailThreadMapper {
|
|
40
|
+
private readonly bounds;
|
|
41
|
+
/**
|
|
42
|
+
* @param bounds Every operational ceiling; see `GmailMappingBounds`.
|
|
43
|
+
* @throws {GmailMappingFault} `configuration` for an invalid bound.
|
|
44
|
+
*/
|
|
45
|
+
constructor(bounds: GmailMappingBounds);
|
|
46
|
+
private policy;
|
|
47
|
+
private normalize;
|
|
48
|
+
/**
|
|
49
|
+
* Validates the whole response, filters each message by its internal date and by the spam, trash and draft labels,
|
|
50
|
+
* keeps the newest eligible messages up to the cap with ties broken by id, spends the thread's character budget
|
|
51
|
+
* newest first and renders the kept messages oldest first. A message's text is its sanitized header prefix followed
|
|
52
|
+
* by its sanitized, trimmed body, and its span covers the body alone. A message that cannot be read is counted under
|
|
53
|
+
* `metadata.omitted` by a fixed reason. The cache expiry is the earliest of the permission's retention, the read start
|
|
54
|
+
* plus `maximumCacheMs`, the response's cache headers, every kept message's window end and the label names' expiry.
|
|
55
|
+
*
|
|
56
|
+
* @param input The parsed `threads.get` response in the `full` format, from a transport that capped its bytes.
|
|
57
|
+
* @param options The per-read values.
|
|
58
|
+
* @returns A document, or a skip with a fixed reason: a thread-wide bound was exceeded, no message survived, or the
|
|
59
|
+
* cache policy refused durable content.
|
|
60
|
+
* @throws {GmailMappingFault} `configuration` for invalid options.
|
|
61
|
+
* @throws {SourceSyncFault} `invalid_response` for an invalid response, never an empty success; `cancelled` once the
|
|
62
|
+
* signal is aborted.
|
|
63
|
+
*/
|
|
64
|
+
map(input: unknown, options: GmailMapThreadOptions): Promise<SourceSyncReadResult>;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=mapThread.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapThread.d.ts","sourceRoot":"","sources":["../src/mapThread.ts"],"names":[],"mappings":"AAQA,OAAO,EAEL,KAAK,qBAAqB,EAAE,KAAK,kBAAkB,EAAE,KAAK,mBAAmB,EACjD,KAAK,oBAAoB,EACtD,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAGL,KAAK,kBAAkB,EACxB,MAAM,WAAW,CAAC;AAOnB,+GAA+G;AAC/G,MAAM,WAAW,qBAAqB;IACpC,oEAAoE;IACpE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B;;;OAGG;IACH,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,qHAAqH;IACrH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,2DAA2D;IAC3D,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,gGAAgG;IAChG,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,2EAA2E;IAC3E,QAAQ,CAAC,UAAU,EAAE,qBAAqB,GAAG,IAAI,CAAC;IAClD,+CAA+C;IAC/C,QAAQ,CAAC,YAAY,EAAE,kBAAkB,CAAC;IAC1C,iEAAiE;IACjE,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACtD,gHAAgH;IAChH,QAAQ,CAAC,UAAU,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAChD,sCAAsC;IACtC,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC/B;AAyC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