@startsimpli/integrations 0.2.196 → 0.2.197
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/package.json +5 -5
- package/src/__tests__/email-evidence.test.tsx +52 -0
- package/src/api/connections.ts +2 -2
- package/src/components/pages/TaskDetailPage.tsx +1 -1
- package/src/components/pages/connections/ConnectionCard.tsx +12 -1
- package/src/components/pages/connections/bound-api.ts +1 -1
- package/src/components/pages/home/CompactItemRow.tsx +1 -1
- package/src/components/pages/task-tracker/TaskTrackerSettings.tsx +13 -0
- package/src/components/pages/types.ts +2 -1
- package/src/components/pages/work-items.tsx +2 -2
- package/src/corpus/commitments.ts +2 -0
- package/src/corpus/entities.ts +4 -0
- package/src/corpus/extract.ts +6 -1
- package/src/corpus/types.ts +7 -0
- package/src/task-tracker/sync-config.ts +4 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@startsimpli/integrations",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.197",
|
|
4
4
|
"description": "Provider-agnostic types, API clients, hooks, and UI primitives for email + calendar integrations across StartSimpli apps, plus foundry customer email (subpath ./comms).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://startsimpli.com",
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
"react-native": ">=0.74.0",
|
|
51
51
|
"@startsimpli/ui-native": ">=0.1.12",
|
|
52
52
|
"react-native-safe-area-context": ">=4.0.0",
|
|
53
|
-
"@startsimpli/
|
|
54
|
-
"@startsimpli/
|
|
55
|
-
"@startsimpli/
|
|
53
|
+
"@startsimpli/utils": "^0.4.20",
|
|
54
|
+
"@startsimpli/ui": "^0.4.191",
|
|
55
|
+
"@startsimpli/auth": "^0.4.53"
|
|
56
56
|
},
|
|
57
57
|
"peerDependenciesMeta": {
|
|
58
58
|
"react": {
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
"react-native": "0.85.3",
|
|
100
100
|
"react-native-safe-area-context": "~5.7.0",
|
|
101
101
|
"@startsimpli/llm": "0.4.31",
|
|
102
|
-
"@startsimpli/ui": "0.4.
|
|
102
|
+
"@startsimpli/ui": "0.4.191",
|
|
103
103
|
"@startsimpli/ui-native": "0.1.15",
|
|
104
104
|
"@startsimpli/auth": "0.4.53",
|
|
105
105
|
"@startsimpli/utils": "0.4.20"
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import { describe, expect, it } from 'vitest';
|
|
3
|
+
|
|
4
|
+
import { CompactItemRow } from '../components/pages/home/CompactItemRow';
|
|
5
|
+
import { renderExtractPrompt, extractSystemPrompt } from '../corpus/extract';
|
|
6
|
+
import { commitmentToEntity } from '../corpus/entities';
|
|
7
|
+
import type { Commitment } from '../corpus/types';
|
|
8
|
+
|
|
9
|
+
const base = {
|
|
10
|
+
id: 'c1', title: 'Send pricing sheet to Pat', detail: '', subtype: 'action', status: 'open', ownerName: 'Owner',
|
|
11
|
+
firstSeenAt: '2026-11-15T10:00:00Z', lastSeenAt: '2026-11-15T10:00:00Z', source: 'extracted',
|
|
12
|
+
} as unknown as Commitment;
|
|
13
|
+
const mention = (documentKind?: string) => ({
|
|
14
|
+
documentId: 'd1', originKey: 'model:send', occurredAt: '2026-11-15T10:00:00Z', quote: 'sending the pricing sheet tomorrow morning',
|
|
15
|
+
extractor: 'model' as const, ...(documentKind ? { documentKind } : {}),
|
|
16
|
+
...(documentKind === 'email' ? { documentUrl: 'https://mail.example/#all/t1', documentTitle: 'Re: Atlas' } : {}),
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
describe('email evidence', () => {
|
|
20
|
+
it('says "an email" on the item when the mention came from mail, "a meeting" otherwise', () => {
|
|
21
|
+
const { rerender } = render(<ul><CompactItemRow item={{ ...base, mentions: [mention('email')] }} days={null} due={null} /></ul>);
|
|
22
|
+
expect(screen.getByTestId('item-evidence').textContent).toMatch(/^From an email/);
|
|
23
|
+
rerender(<ul><CompactItemRow item={{ ...base, mentions: [mention('meeting')] }} days={null} due={null} /></ul>);
|
|
24
|
+
expect(screen.getByTestId('item-evidence').textContent).toMatch(/^From a meeting/);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('keeps the document kind through the tenant round trip', () => {
|
|
28
|
+
const entity = commitmentToEntity({ ...base, mentions: [mention('email')] });
|
|
29
|
+
const written = (entity.data.mentions as Array<Record<string, unknown>>)[0];
|
|
30
|
+
expect(written.document_kind).toBe('email');
|
|
31
|
+
expect(written.document_url).toBe('https://mail.example/#all/t1');
|
|
32
|
+
expect(written.document_title).toBe('Re: Atlas');
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('prompt tells the model a document is an email and how to read waiting-on', () => {
|
|
36
|
+
const prompt = renderExtractPrompt({ documents: [{ id: 'd1', title: 'Re: Atlas', source: 'Google', occurredAt: null, participants: ['Pat'], kind: 'email', text: 'From: Pat\nDirection: received\n\nhi', alreadyFound: [] }] });
|
|
37
|
+
expect(prompt).toContain('kind: email');
|
|
38
|
+
expect(extractSystemPrompt()).toMatch(/waiting on/i);
|
|
39
|
+
expect(extractSystemPrompt()).toMatch(/ENG-42/);
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
describe('email push switch', () => {
|
|
44
|
+
it('is stored only when off, and a save of other fields keeps it', async () => {
|
|
45
|
+
const { readTaskSync, withTaskSync } = await import('../task-tracker/sync-config');
|
|
46
|
+
const off = { config: { task_sync: { push_from_email: false, default_container_id: 't1' } } };
|
|
47
|
+
expect(readTaskSync(off).push_from_email).toBe(false);
|
|
48
|
+
expect(withTaskSync(off, { default_project_id: 'p1' }).push_from_email).toBe(false);
|
|
49
|
+
expect('push_from_email' in withTaskSync(off, { push_from_email: undefined })).toBe(false);
|
|
50
|
+
expect('push_from_email' in withTaskSync({ config: {} }, { default_container_id: 't1' })).toBe(false);
|
|
51
|
+
});
|
|
52
|
+
});
|
package/src/api/connections.ts
CHANGED
|
@@ -226,8 +226,8 @@ function build(request: Requester): MemberConnectionsApi {
|
|
|
226
226
|
* A card that is not mine answers 404 rather than 403 — on this surface
|
|
227
227
|
* existence is itself the payload.
|
|
228
228
|
*/
|
|
229
|
-
disconnect(id: string): Promise<void> {
|
|
230
|
-
return request<void>(`${BASE}/${id}
|
|
229
|
+
disconnect(id: string, options?: { removeData?: boolean }): Promise<void> {
|
|
230
|
+
return request<void>(`${BASE}/${id}/${options?.removeData ? '?remove_data=true' : ''}`, { method: 'DELETE' });
|
|
231
231
|
},
|
|
232
232
|
|
|
233
233
|
/** Recent activity on my card: a merge over the run tables it owns. */
|
|
@@ -314,7 +314,7 @@ export function TaskDetailPage({
|
|
|
314
314
|
{item.mentions.map((m) => (
|
|
315
315
|
<li key={`${m.documentId}:${m.originKey}`}>
|
|
316
316
|
<button type="button" className="text-sm text-blue-700 underline" onClick={() => onOpenDocument?.(m.documentId)}>
|
|
317
|
-
{m.occurredAt ? new Date(m.occurredAt).toLocaleDateString() : 'Undated meeting'}
|
|
317
|
+
{m.occurredAt ? new Date(m.occurredAt).toLocaleDateString() : m.documentKind === 'email' ? 'Undated email' : 'Undated meeting'}{m.documentKind === 'email' ? ' (email)' : ''}
|
|
318
318
|
</button>
|
|
319
319
|
{m.quote ? <span className={`ml-2 ${cn.muted}`}>“{m.quote}”</span> : null}
|
|
320
320
|
</li>
|
|
@@ -40,6 +40,7 @@ export function ConnectionCard({
|
|
|
40
40
|
const [replacing, setReplacing] = React.useState(false);
|
|
41
41
|
const [settingsOpen, setSettingsOpen] = React.useState(false);
|
|
42
42
|
const [confirmingDisconnect, setConfirmingDisconnect] = React.useState(false);
|
|
43
|
+
const [removeData, setRemoveData] = React.useState(false);
|
|
43
44
|
const [activityOpen, setActivityOpen] = React.useState(false);
|
|
44
45
|
/** `null` is NOT LOADED YET, which reads differently from a connection that
|
|
45
46
|
has never run — the distinction the empty state below turns on. */
|
|
@@ -339,6 +340,15 @@ export function ConnectionCard({
|
|
|
339
340
|
here, marked disabled, and you can connect it again later with a new
|
|
340
341
|
key.
|
|
341
342
|
</p>
|
|
343
|
+
{entry?.kind === 'mailbox' ? (
|
|
344
|
+
<label className="flex items-start gap-2 text-sm text-gray-800">
|
|
345
|
+
<input type="checkbox" checked={removeData} onChange={(e) => setRemoveData(e.target.checked)} />
|
|
346
|
+
<span>
|
|
347
|
+
Also delete the emails, events and people this account brought into Tandem. To-dos you made from them
|
|
348
|
+
stay, but their link back to the email stops working.
|
|
349
|
+
</span>
|
|
350
|
+
</label>
|
|
351
|
+
) : null}
|
|
342
352
|
{trackerApi ? (
|
|
343
353
|
<p className={cn.muted}>
|
|
344
354
|
{`Your to-dos stay in Tandem. Nothing is deleted in ${connection.connector_name}; they simply stop syncing.`}
|
|
@@ -350,8 +360,9 @@ export function ConnectionCard({
|
|
|
350
360
|
className={cn.button}
|
|
351
361
|
disabled={Boolean(busy)}
|
|
352
362
|
onClick={() => void guard('disconnect', async () => {
|
|
353
|
-
await api.disconnect(connection.id);
|
|
363
|
+
await (removeData ? api.disconnect(connection.id, { removeData: true }) : api.disconnect(connection.id));
|
|
354
364
|
setConfirmingDisconnect(false);
|
|
365
|
+
setRemoveData(false);
|
|
355
366
|
setNotice('Disconnected.');
|
|
356
367
|
onChanged();
|
|
357
368
|
})}
|
|
@@ -53,7 +53,7 @@ export interface BoundApi {
|
|
|
53
53
|
}): Promise<Connection>;
|
|
54
54
|
checkConnection(id: string): Promise<{ ok: boolean; account_label: string; detail: string; reason?: string; next_step?: string }>;
|
|
55
55
|
rotateCredential(id: string, credentials: Record<string, unknown>): Promise<Connection>;
|
|
56
|
-
disconnect(id: string): Promise<void>;
|
|
56
|
+
disconnect(id: string, options?: { removeData?: boolean }): Promise<void>;
|
|
57
57
|
updateConnection?(id: string, input: {
|
|
58
58
|
name?: string; capabilities_enabled?: string[]; config?: Record<string, unknown>;
|
|
59
59
|
}): Promise<Connection>;
|
|
@@ -50,7 +50,7 @@ function MeetingEvidence({ item }: { item: Commitment }) {
|
|
|
50
50
|
const more = item.mentions.length > 1 ? ` · +${item.mentions.length - 1} more` : '';
|
|
51
51
|
return (
|
|
52
52
|
<span className="block truncate text-xs text-gray-500" data-testid="item-evidence">
|
|
53
|
-
From a meeting{when ? ` ${when}` : ''}: “{stripMarkdown(latest.quote)}”{more}
|
|
53
|
+
From {latest.documentKind === 'email' ? 'an email' : 'a meeting'}{when ? ` ${when}` : ''}: “{stripMarkdown(latest.quote)}”{more}
|
|
54
54
|
</span>
|
|
55
55
|
);
|
|
56
56
|
}
|
|
@@ -70,6 +70,19 @@ export function TaskTrackerSettings({ api, connection, classNames: cn, onSaved }
|
|
|
70
70
|
{picker('Your private space for personal to-dos', 'personal_container_id', 'team', 'Not set (personal to-dos stay in Tandem)')}
|
|
71
71
|
{picker(`Also bring in ${tracker} issues assigned to`, 'assignee_id', 'user', 'Nobody in particular')}
|
|
72
72
|
|
|
73
|
+
<label className="flex items-start gap-2 text-sm text-gray-900">
|
|
74
|
+
<input
|
|
75
|
+
type="checkbox"
|
|
76
|
+
checked={s.value.push_from_email !== false}
|
|
77
|
+
disabled={s.loading}
|
|
78
|
+
onChange={(e) => controller.set({ push_from_email: e.target.checked ? undefined : false })}
|
|
79
|
+
/>
|
|
80
|
+
<span>
|
|
81
|
+
{`Send to-dos that came from my email to ${tracker}`}
|
|
82
|
+
<span className="block text-xs text-gray-500">Each one gets a “Pushed from email” link to the message. Turn off to keep them in Tandem only; turning it back on sends them.</span>
|
|
83
|
+
</span>
|
|
84
|
+
</label>
|
|
85
|
+
|
|
73
86
|
<div>
|
|
74
87
|
<p className="text-sm font-medium text-gray-900">{`${tracker} states and Tandem status`}</p>
|
|
75
88
|
{s.rows.length === 0 && !s.loading ? <p className={cn.muted}>No states found.</p> : null}
|
|
@@ -447,7 +447,8 @@ export interface MemberConnectionsApi {
|
|
|
447
447
|
/** What a task-tracker account reaches (teams, projects, states, users): `kind` picks the list. */
|
|
448
448
|
connectionChoices?(id: string, params?: { kind?: string; cursor?: string }): Promise<ConnectionChoicePage>;
|
|
449
449
|
rotateCredential(id: string, credentials: Record<string, unknown>): Promise<Connection>;
|
|
450
|
-
|
|
450
|
+
/** `removeData` also deletes what the account brought in (mailbox connectors). */
|
|
451
|
+
disconnect(id: string, options?: { removeData?: boolean }): Promise<void>;
|
|
451
452
|
connectionRuns(id: string): Promise<{ results: ConnectionRun[] }>;
|
|
452
453
|
/**
|
|
453
454
|
* The OAuth half of the surface (bd startsim-768w.22.25.14/.21). Optional so
|
|
@@ -183,7 +183,7 @@ export function WorkItemRow({
|
|
|
183
183
|
) : (
|
|
184
184
|
<details className="mt-2">
|
|
185
185
|
<summary className="cursor-pointer text-sm text-gray-600">
|
|
186
|
-
From {item.mentions.length} meeting{item.mentions.length === 1 ? '' : 's'}
|
|
186
|
+
From {item.mentions.length} {item.mentions.every((m) => m.documentKind === 'email') ? 'email' : item.mentions.some((m) => m.documentKind === 'email') ? 'source' : 'meeting'}{item.mentions.length === 1 ? '' : 's'}
|
|
187
187
|
</summary>
|
|
188
188
|
<div className="mt-2 space-y-2">
|
|
189
189
|
{item.mentions.map((mention) => (
|
|
@@ -196,7 +196,7 @@ export function WorkItemRow({
|
|
|
196
196
|
>
|
|
197
197
|
{mention.occurredAt
|
|
198
198
|
? new Date(mention.occurredAt).toLocaleDateString()
|
|
199
|
-
: 'Undated meeting'}
|
|
199
|
+
: mention.documentKind === 'email' ? 'Undated email' : 'Undated meeting'}
|
|
200
200
|
</button>
|
|
201
201
|
{/* Where the row came from. A model-derived item and one the
|
|
202
202
|
summariser itself wrote down are different levels of
|
|
@@ -395,6 +395,8 @@ function toMention(draft: CommitmentDraft, document: SourceDocument): Commitment
|
|
|
395
395
|
return {
|
|
396
396
|
documentId: draft.documentId,
|
|
397
397
|
originKey: draft.originKey,
|
|
398
|
+
...(document.subtype ? { documentKind: document.subtype } : {}),
|
|
399
|
+
...(document.subtype === 'email' && document.url ? { documentUrl: document.url, documentTitle: document.title } : {}),
|
|
398
400
|
occurredAt: iso(document.occurredAt),
|
|
399
401
|
quote: draft.quote ?? '',
|
|
400
402
|
extractor: draft.extractor,
|
package/src/corpus/entities.ts
CHANGED
|
@@ -784,6 +784,8 @@ function toMention(value: unknown): CommitmentMention | null {
|
|
|
784
784
|
return {
|
|
785
785
|
documentId,
|
|
786
786
|
originKey: asText(pick(data, 'origin_key', 'originKey')),
|
|
787
|
+
...(asText(pick(data, 'document_kind', 'documentKind')) ? { documentKind: asText(pick(data, 'document_kind', 'documentKind')) } : {}),
|
|
788
|
+
...(asText(pick(data, 'document_url', 'documentUrl')) ? { documentUrl: asText(pick(data, 'document_url', 'documentUrl')), documentTitle: asText(pick(data, 'document_title', 'documentTitle')) } : {}),
|
|
787
789
|
occurredAt: asIso(pick(data, 'occurred_at', 'occurredAt')),
|
|
788
790
|
quote: asText(pick(data, 'quote')),
|
|
789
791
|
extractor: extractor === 'model' ? 'model' : 'rules',
|
|
@@ -832,6 +834,8 @@ export function commitmentToEntity(commitment: Commitment): {
|
|
|
832
834
|
mentions: commitment.mentions.slice(-MAX_MENTIONS).map((mention) => ({
|
|
833
835
|
document_id: mention.documentId,
|
|
834
836
|
origin_key: mention.originKey,
|
|
837
|
+
...(mention.documentKind ? { document_kind: mention.documentKind } : {}),
|
|
838
|
+
...(mention.documentUrl ? { document_url: mention.documentUrl, document_title: (mention.documentTitle ?? '').slice(0, 200) } : {}),
|
|
835
839
|
occurred_at: mention.occurredAt,
|
|
836
840
|
quote: mention.quote.slice(0, 400),
|
|
837
841
|
extractor: mention.extractor,
|
package/src/corpus/extract.ts
CHANGED
|
@@ -276,6 +276,9 @@ export function extractSystemPrompt(): string {
|
|
|
276
276
|
'Set "subject" to what the item is ABOUT — a matter or case number, a property, a client, a system, a person. Copy an identifier verbatim when the text has one.',
|
|
277
277
|
'Set "owner" only to a name the document actually names. Leave it out otherwise.',
|
|
278
278
|
'Never estimate or invent a due date, and do not compute one: the system reads the date itself from your "quote". When the item has a stated date or day ("by 29th July", "tomorrow", "on Monday"), make sure those exact words are inside the quote; when the document states none, say nothing about a date.',
|
|
279
|
+
'Some documents are EMAILS (kind: email). The text starts with From, To and Direction lines. Direction "sent" means the mailbox owner wrote it, so commitments in it ("I will send...", "I will update...") belong to the owner. Direction "received" means somebody wrote to the owner: what the sender promises is theirs, what they ask for is the owner\'s.',
|
|
280
|
+
'In an email, "waiting on" matters as much as "to do": when the writer says they are blocked on, or waiting for, another person ("waiting on your reply", "I need the sheet before Friday"), report a "need" with status "blocked", owner set to the person being waited on, and the writer named in the detail. Quoted older messages (lines starting with >) are history, not new statements.',
|
|
281
|
+
'An issue key such as ENG-42 in a document is a strong "subject": copy it verbatim, including when the email says the work is finished or moved.',
|
|
279
282
|
'Also report RESOLUTIONS: statements that something previously outstanding is now done or abandoned. Give the subject, what happened, and a verbatim quote.',
|
|
280
283
|
'Respond with JSON only: {"items":[{"documentId":string,"subtype":"action"|"decision"|"need"|"risk"|"question","title":string,"detail":string,"status":"open"|"done"|"blocked","owner":string,"subject":string,"quote":string}],"resolutions":[{"documentId":string,"subject":string,"statement":string,"quote":string,"outcome":"done"|"dropped"}]}',
|
|
281
284
|
'"title" must be one short imperative line.',
|
|
@@ -286,7 +289,7 @@ export function extractSystemPrompt(): string {
|
|
|
286
289
|
export function renderExtractPrompt(input: {
|
|
287
290
|
documents: Array<{
|
|
288
291
|
id: string; title: string; source: string; occurredAt: string | null;
|
|
289
|
-
participants: string[]; text: string; alreadyFound: string[];
|
|
292
|
+
participants: string[]; kind?: string; text: string; alreadyFound: string[];
|
|
290
293
|
}>;
|
|
291
294
|
}): string {
|
|
292
295
|
const blocks = input.documents.map((document) =>
|
|
@@ -294,6 +297,7 @@ export function renderExtractPrompt(input: {
|
|
|
294
297
|
`<document id="${document.id}">`,
|
|
295
298
|
`title: ${document.title}`,
|
|
296
299
|
`source: ${document.source}`,
|
|
300
|
+
document.kind ? `kind: ${document.kind}` : '',
|
|
297
301
|
`occurred_at: ${document.occurredAt ?? 'unknown'}`,
|
|
298
302
|
document.participants.length ? `participants: ${document.participants.join(', ')}` : '',
|
|
299
303
|
document.alreadyFound.length
|
|
@@ -505,6 +509,7 @@ export async function extractCommitments(
|
|
|
505
509
|
source: document.sourceLabel || document.source,
|
|
506
510
|
occurredAt: document.occurredAt,
|
|
507
511
|
participants: document.participants.map((party) => party.name),
|
|
512
|
+
...(document.subtype ? { kind: document.subtype } : {}),
|
|
508
513
|
text: promptText.get(document.id) ?? '',
|
|
509
514
|
alreadyFound: foundByDocument.get(document.id) ?? [],
|
|
510
515
|
})),
|
package/src/corpus/types.ts
CHANGED
|
@@ -639,6 +639,11 @@ export interface CommitmentMention {
|
|
|
639
639
|
documentId: string;
|
|
640
640
|
/** Stable within a document: the vendor's own bullet, or the model's item. */
|
|
641
641
|
originKey: string;
|
|
642
|
+
/** What kind of document the mention came from (`email`, `meeting`, ...): the evidence line says "email", never "meeting", for mail. */
|
|
643
|
+
documentKind?: string;
|
|
644
|
+
/** Link back to the original (an email in its mailbox) and its title: what a pushed tracker item points at. */
|
|
645
|
+
documentUrl?: string;
|
|
646
|
+
documentTitle?: string;
|
|
642
647
|
/** When the meeting happened — NOT when the row was written. */
|
|
643
648
|
occurredAt: string | null;
|
|
644
649
|
/** Verbatim span from that document, so the claim can be checked. */
|
|
@@ -1088,6 +1093,8 @@ export interface ExtractionRequest {
|
|
|
1088
1093
|
source: string;
|
|
1089
1094
|
occurredAt: string | null;
|
|
1090
1095
|
participants: string[];
|
|
1096
|
+
/** `email`, `meeting`, ...: lets the prompt read a message as a message. */
|
|
1097
|
+
kind?: string;
|
|
1091
1098
|
text: string;
|
|
1092
1099
|
/**
|
|
1093
1100
|
* What the deterministic pre-pass already found in this document. Sent so
|
|
@@ -22,6 +22,8 @@ export interface TaskSyncConfig {
|
|
|
22
22
|
/** tracker workflow state id -> Tandem status. */
|
|
23
23
|
state_overrides?: Record<string, TrackerStatus>;
|
|
24
24
|
assignee_id?: string;
|
|
25
|
+
/** `false` pauses sending to-dos that exist only because of an email; absent means on. */
|
|
26
|
+
push_from_email?: boolean;
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
export const TASK_SYNC_KEY = 'task_sync';
|
|
@@ -50,6 +52,7 @@ export function readTaskSync(connection: Pick<Connection, 'config'>): TaskSyncCo
|
|
|
50
52
|
const src = raw as Record<string, unknown>;
|
|
51
53
|
const out: Record<string, unknown> = {};
|
|
52
54
|
for (const k of STRINGS) if (typeof src[k] === 'string' && src[k]) out[k] = src[k];
|
|
55
|
+
if (src.push_from_email === false) out.push_from_email = false;
|
|
53
56
|
for (const k of MAPS) {
|
|
54
57
|
const m = src[k];
|
|
55
58
|
if (m && typeof m === 'object' && Object.keys(m).length) out[k] = { ...(m as object) };
|
|
@@ -61,6 +64,7 @@ export function readTaskSync(connection: Pick<Connection, 'config'>): TaskSyncCo
|
|
|
61
64
|
export function withTaskSync(connection: Pick<Connection, 'config'>, edit: Partial<TaskSyncConfig>): TaskSyncConfig {
|
|
62
65
|
const merged: Record<string, unknown> = { ...readTaskSync(connection), ...edit };
|
|
63
66
|
for (const k of STRINGS) if (!merged[k]) delete merged[k];
|
|
67
|
+
if (merged.push_from_email !== false) delete merged.push_from_email;
|
|
64
68
|
for (const k of MAPS) {
|
|
65
69
|
const m = merged[k] as Record<string, unknown> | undefined;
|
|
66
70
|
if (!m || !Object.keys(m).length) delete merged[k];
|