@startsimpli/integrations 0.2.178 → 0.2.179
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@startsimpli/integrations",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.179",
|
|
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/utils": "^0.4.20",
|
|
54
53
|
"@startsimpli/auth": "^0.4.53",
|
|
55
|
-
"@startsimpli/ui": "^0.4.186"
|
|
54
|
+
"@startsimpli/ui": "^0.4.186",
|
|
55
|
+
"@startsimpli/utils": "^0.4.20"
|
|
56
56
|
},
|
|
57
57
|
"peerDependenciesMeta": {
|
|
58
58
|
"react": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @vitest-environment node
|
|
2
2
|
/** The relay CLI's live-sync parts (bd startsim-ym54h): the composed snapshot, the shared access token, the login agent. */
|
|
3
|
-
import { mkdtempSync, readFileSync } from 'node:fs';
|
|
3
|
+
import { chmodSync, mkdtempSync, readFileSync, writeFileSync } from 'node:fs';
|
|
4
4
|
import { tmpdir } from 'node:os';
|
|
5
5
|
import { join } from 'node:path';
|
|
6
6
|
import { describe, expect, it, vi } from 'vitest';
|
|
@@ -10,6 +10,8 @@ import { composeSnapshot, loadNotes, parseSessions, saveNotes } from '../../../.
|
|
|
10
10
|
// @ts-expect-error plain .mjs scripts
|
|
11
11
|
import { accessToken, saveState } from '../../../../scripts/relay-converse/oauth.mjs';
|
|
12
12
|
// @ts-expect-error plain .mjs scripts
|
|
13
|
+
import { decisionMail, deliver, orderMail, relayTarget } from '../../../../scripts/relay-converse/mail.mjs';
|
|
14
|
+
// @ts-expect-error plain .mjs scripts
|
|
13
15
|
import { plist } from '../../../../scripts/relay-converse/install-sync.mjs';
|
|
14
16
|
|
|
15
17
|
describe('fleet snapshot composition', () => {
|
|
@@ -55,3 +57,36 @@ describe('login agent', () => {
|
|
|
55
57
|
expect(xml).toContain('<key>RELAY_BRIDGE_CMD</key><string>python3 /b.py</string>');
|
|
56
58
|
});
|
|
57
59
|
});
|
|
60
|
+
|
|
61
|
+
describe('relay mail', () => {
|
|
62
|
+
const dir = mkdtempSync(join(tmpdir(), 'rc-'));
|
|
63
|
+
const fake = join(dir, 'bridge.sh');
|
|
64
|
+
writeFileSync(fake, `#!/bin/sh\necho "$@" >> "${join(dir, 'sent.log')}"\n[ -f "${join(dir, 'fail')}" ] && exit 1\nexit 0\n`);
|
|
65
|
+
chmodSync(fake, 0o755);
|
|
66
|
+
writeFileSync(join(dir, 'relay.json'), JSON.stringify({ current: { session: 'relay-now' }, previous: [{ session: 'old' }] }));
|
|
67
|
+
const env = { RELAY_BRIDGE_CMD: fake, RELAY_REGISTRY: join(dir, 'relay.json') };
|
|
68
|
+
const order = { conversation_id: 'conv12345', turn: 3, text: 'ask the relay about deploys', at: '2026-11-15T10:00:00Z' };
|
|
69
|
+
const decision = { id: 'd1', title: 'Ship it?', answered_at: '2026-11-15T11:00:00Z', questions: [{ n: 1, text: 'Ship?' }], answers: [{ n: 1, answer: 'Yes' }] };
|
|
70
|
+
|
|
71
|
+
it('sends the current relay each new order and answer once, with the ids to reply to', async () => {
|
|
72
|
+
expect(relayTarget(env)).toBe('relay-now');
|
|
73
|
+
const items = [orderMail(order), decisionMail(decision)];
|
|
74
|
+
const first = await deliver({ env, items, mailed: [] });
|
|
75
|
+
expect(first.sent).toBe(2);
|
|
76
|
+
const second = await deliver({ env, items, mailed: first.mailed });
|
|
77
|
+
expect(second.sent).toBe(0);
|
|
78
|
+
const log = readFileSync(join(dir, 'sent.log'), 'utf8');
|
|
79
|
+
expect(log).toContain('--to relay-now');
|
|
80
|
+
expect(log).toContain('reply conv12345');
|
|
81
|
+
expect(log).toContain('Ship?: Yes');
|
|
82
|
+
expect(log.match(/--to/g)).toHaveLength(2);
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it('keeps an item unmailed when the send fails, so the next cycle retries it', async () => {
|
|
86
|
+
writeFileSync(join(dir, 'fail'), '1');
|
|
87
|
+
const failed = await deliver({ env, items: [orderMail({ ...order, turn: 9 })], mailed: [] });
|
|
88
|
+
expect(failed.sent).toBe(0);
|
|
89
|
+
expect(failed.mailed).toEqual([]);
|
|
90
|
+
expect(failed.error).toBeTruthy();
|
|
91
|
+
});
|
|
92
|
+
});
|