@startsimpli/integrations 0.2.128 → 0.2.129

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.128",
3
+ "version": "0.2.129",
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/ui": "^0.4.171",
53
+ "@startsimpli/utils": "^0.4.17",
54
54
  "@startsimpli/auth": "^0.4.50",
55
- "@startsimpli/utils": "^0.4.17"
55
+ "@startsimpli/ui": "^0.4.171"
56
56
  },
57
57
  "peerDependenciesMeta": {
58
58
  "react": {
@@ -98,11 +98,11 @@
98
98
  "vitest": "^3.0.0",
99
99
  "react-native": "0.85.3",
100
100
  "react-native-safe-area-context": "~5.7.0",
101
- "@startsimpli/llm": "0.4.30",
102
101
  "@startsimpli/ui": "0.4.171",
103
102
  "@startsimpli/ui-native": "0.1.14",
104
103
  "@startsimpli/auth": "0.4.50",
105
- "@startsimpli/utils": "0.4.17"
104
+ "@startsimpli/utils": "0.4.17",
105
+ "@startsimpli/llm": "0.4.30"
106
106
  },
107
107
  "scripts": {
108
108
  "type-check": "tsc --noEmit && tsc --noEmit -p tsconfig.native.json",
@@ -77,6 +77,13 @@ describe('connectionsMe — every route is /connections/me/', () => {
77
77
  expect(calls[0].body).toEqual({});
78
78
  });
79
79
 
80
+ it('syncs now through its own narrow route, with no body', async () => {
81
+ await connectionsMe.syncConnectionNow('abc');
82
+ expect(calls[0].url).toBe('/api/v1/connections/me/abc/sync/');
83
+ expect(calls[0].method).toBe('POST');
84
+ expect(calls[0].body).toEqual({});
85
+ });
86
+
80
87
  it('rotates through the credential route, wrapping the map the way the API expects', async () => {
81
88
  await connectionsMe.rotateCredential('abc', { api_key: 'grn_new' });
82
89
  expect(calls[0].url).toBe('/api/v1/connections/me/abc/credential/');
@@ -99,6 +106,7 @@ describe('connectionsMe — every route is /connections/me/', () => {
99
106
  await connectionsMe.connections();
100
107
  await connectionsMe.connect({ connector_key: 'granola' });
101
108
  await connectionsMe.checkConnection('abc');
109
+ await connectionsMe.syncConnectionNow('abc');
102
110
  await connectionsMe.rotateCredential('abc', { api_key: 'x' });
103
111
  await connectionsMe.disconnect('abc');
104
112
  await connectionsMe.connectionRuns('abc');
@@ -152,6 +152,15 @@ function build(request: Requester): MemberConnectionsApi {
152
152
  );
153
153
  },
154
154
 
155
+ /**
156
+ * Sync NOW (a task-tracker connection): push what is pending for this card.
157
+ * A narrow route with no body; the sync itself runs on the server and the
158
+ * result shows up as each item's `sync_state` (bd startsim-el0zf).
159
+ */
160
+ syncConnectionNow(id: string): Promise<{ queued: boolean }> {
161
+ return request<{ queued: boolean }>(`${BASE}/${id}/sync/`, { method: 'POST', body: {} });
162
+ },
163
+
155
164
  /**
156
165
  * Rotate MY key. The old one stays live until the new one passes `check()`,
157
166
  * so a bad paste changes nothing. A PARTIAL map is legal and normal: send the
@@ -438,6 +438,8 @@ export interface MemberConnectionsApi {
438
438
  checkConnection(id: string): Promise<{
439
439
  ok: boolean; account_label: string; detail: string;
440
440
  }>;
441
+ /** Task-tracker connections: push what is pending now (bd startsim-el0zf). Optional for older clients. */
442
+ syncConnectionNow?(id: string): Promise<{ queued: boolean }>;
441
443
  rotateCredential(id: string, credentials: Record<string, unknown>): Promise<Connection>;
442
444
  disconnect(id: string): Promise<void>;
443
445
  connectionRuns(id: string): Promise<{ results: ConnectionRun[] }>;
@@ -79,7 +79,7 @@ export function typesFrom(rows: SchemaTypeRow[]): SchemaTypeInfo[] {
79
79
  }));
80
80
  }
81
81
 
82
- const OPEN_TONES: Record<string, DisplayTone> = { open: 'info', done: 'good', blocked: 'warn', dropped: 'neutral' };
82
+ const OPEN_TONES: Record<string, DisplayTone> = { open: 'info', in_progress: 'info', done: 'good', blocked: 'warn', dropped: 'neutral' };
83
83
 
84
84
  /**
85
85
  * What a row of a well-known type reads as when the tenant has not declared a display yet. Data, not a switch:
@@ -325,6 +325,18 @@ export function createFakeTenantHttp(options: FakeTenantOptions = {}): FakeTenan
325
325
  }
326
326
  throw status(404, `${path} responded 404`);
327
327
  },
328
+ /** The tenant's GET-then-write verb: the body's `data` REPLACES the stored blob (the real tenant's PATCH). */
329
+ async patch<T>(path: string, body?: unknown): Promise<T> {
330
+ const b = (body ?? {}) as Record<string, unknown>;
331
+ requests.push({ method: 'PATCH', path, params: b });
332
+ options.onRequest?.('PATCH', path, b);
333
+ const id = /^api\/v1\/entities\/(.+?)\/?$/.exec(path.replace(/^\/+/, ''))?.[1];
334
+ const at = entities.findIndex((e) => String(e.id) === decodeURIComponent(id ?? ''));
335
+ if (at < 0) throw status(404, `No record ${id}`);
336
+ const merged = { ...entities[at], ...(b.name ? { name: String(b.name) } : {}), ...(b.data ? { data: b.data as Record<string, unknown> } : {}) };
337
+ entities[at] = merged;
338
+ return merged as T;
339
+ },
328
340
  async delete<T>(path: string): Promise<T> {
329
341
  requests.push({ method: 'DELETE', path, params: {} });
330
342
  const id = /relationships\/(.+?)\/?$/.exec(path)?.[1];
@@ -63,8 +63,8 @@ export function TrackerListScreen({ controller, onOpen, displays, now = Date.now
63
63
  subtitle={parts.who || undefined}
64
64
  meta={parts.due ?? undefined}
65
65
  metaTone={parts.overdue ? 'danger' : undefined}
66
- // Open is the default and needs no badge; blocked and dropped do.
67
- trailing={status === 'blocked' || status === 'dropped' ? <StatusChip status={status} /> : undefined}
66
+ // Open is the default and needs no badge; in progress, blocked and dropped do.
67
+ trailing={status === 'blocked' || status === 'dropped' || status === 'in_progress' ? <StatusChip status={status} /> : undefined}
68
68
  onPress={() => onOpen(row.item)}
69
69
  />
70
70
  </SwipeRow>
@@ -116,8 +116,8 @@ describe('tracker controller: mark done', () => {
116
116
  expect(titles(c)).not.toContain('Finish exhibit list'); // optimistic
117
117
  expect(c.getState().pendingIds).toContain('c1');
118
118
  await p;
119
- const post = api.tenant.requests.find((r) => r.method === 'POST');
120
- expect(post?.params).toMatchObject({ external_id: 'commit:c1', data: { status: 'done' } });
119
+ const patch = api.tenant.requests.find((r) => r.method === 'PATCH');
120
+ expect(patch?.params).toMatchObject({ data: { status: 'done' } });
121
121
  expect(c.getState().pendingIds).toEqual([]);
122
122
  expect(titles(c)).not.toContain('Finish exhibit list');
123
123
  await c.setView('closed');
@@ -127,7 +127,7 @@ describe('tracker controller: mark done', () => {
127
127
 
128
128
  it('puts the row back and says why when the write fails', async () => {
129
129
  let fail = false;
130
- const { c } = await setup({ onRequest: (m) => { if (fail && m === 'POST') throw Object.assign(new Error('Server said no'), { status: 500 }); } });
130
+ const { c } = await setup({ onRequest: (m) => { if (fail && m === 'PATCH') throw Object.assign(new Error('Server said no'), { status: 500 }); } });
131
131
  const row = c.getState().rows.find((r) => r.item.id === 'c1')!;
132
132
  fail = true;
133
133
  await c.setStatus(row.item, 'done');
@@ -63,7 +63,10 @@ describe('tracker detail controller', () => {
63
63
  const p = c.setStatus('done');
64
64
  expect(c.getState().item?.status).toBe('done');
65
65
  await p;
66
- expect(api.tenant.requests.find((r) => r.method === 'POST')?.params).toMatchObject({ external_id: 'commit:c1', data: { status: 'done' } });
66
+ // An edit is a GET-then-PATCH of the whole blob, stamped (bd startsim-kgkp1.2), not the machine upsert.
67
+ const patch = api.tenant.requests.find((r) => r.method === 'PATCH');
68
+ expect(patch?.params).toMatchObject({ data: { status: 'done' } });
69
+ expect(Object.keys((patch?.params as { data: { field_edited_at: object } }).data.field_edited_at)).toEqual(['status']);
67
70
  expect(changed()).toBe(1);
68
71
  await c.setStatus('open');
69
72
  expect(c.getState().item?.status).toBe('open');
@@ -71,7 +74,7 @@ describe('tracker detail controller', () => {
71
74
 
72
75
  it('rolls the status back and explains when the write fails', async () => {
73
76
  let fail = false;
74
- const { c } = await open('c1', { onRequest: (m) => { if (fail && m === 'POST') throw new Error('Server said no'); } });
77
+ const { c } = await open('c1', { onRequest: (m) => { if (fail && m === 'PATCH') throw new Error('Server said no'); } });
75
78
  fail = true;
76
79
  await c.setStatus('done');
77
80
  expect(c.getState().item?.status).toBe('open');
@@ -67,7 +67,7 @@ const PRIORITY = ['Critical', 'High', 'Medium', 'Low', 'Backlog'];
67
67
  export const priorityText = (p?: number): string | null => (p === undefined || p === null ? null : PRIORITY[p] ?? null);
68
68
 
69
69
  export function statusText(status: CommitmentStatus): string {
70
- return { open: 'Open', blocked: 'Blocked', done: 'Done', dropped: 'Dropped' }[status] ?? status;
70
+ return { open: 'Open', in_progress: 'In progress', blocked: 'Blocked', done: 'Done', dropped: 'Dropped' }[status] ?? status;
71
71
  }
72
72
 
73
73
  /**