@segmentstream-cloud/app 0.17.1 → 0.17.2

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 CHANGED
@@ -347,16 +347,19 @@ export const { POST } = segmentstream.agent.connectHandler();
347
347
 
348
348
  `segmentstream.agent` holds:
349
349
 
350
- | Call | Does |
351
- | ---------------------- | ------------------------------------------------------------------------------- |
352
- | `pairing(code)` | `{ provider, display, expiresAt }`; throws `not_found` or `expired` |
353
- | `approvePairing(code)` | Links the account to the signed-in member; returns the `AgentIdentity` |
354
- | `identities()` | The member's own: `{ id, provider, externalId, display, createdAt, revokedAt }` |
355
- | `revokeIdentity(id)` | Revokes one of them at once |
356
- | `connectHandler()` | `{ POST }` for the page's form: same-origin only, takes `code`, answers `303` |
350
+ | Call | Does |
351
+ | ---------------------- | -------------------------------------------------------------------------------------- |
352
+ | `pairing(code)` | `{ provider, display, expiresAt }`; throws `not_found` or `expired` |
353
+ | `approvePairing(code)` | Links the account to the signed-in member; returns the `AgentIdentity` |
354
+ | `identities()` | The member's own: `{ id, provider, externalId, display, createdAt, revokedAt }` |
355
+ | `revokeIdentity(id)` | Revokes one of them at once |
356
+ | `connectHandler()` | `{ POST }` for the page's form: same-origin only; `303` on success; throws on conflict |
357
357
 
358
358
  The handler sends the browser back to `/agent/connect?connected=<provider>`, or to
359
- `/agent/connect?expired=1` when the code was used or is older than ten minutes. Other
359
+ `/agent/connect?expired=1` when the code was used or is older than ten minutes. An account already
360
+ connected to another member throws `SegmentStreamApiError` with status `409` and
361
+ `code === "identity_in_use"` through the app's existing error mechanism. The app owns conflict copy.
362
+ Same-member pairing is idempotent, and replacing your own previous account on a provider is supported. Other
360
363
  refusals, such as `forbidden` for a member the ontology does not admit, throw
361
364
  `SegmentStreamApiError`. All calls are server-only and run as the signed-in member;
362
365
  the ontology decides every one. The workspace starter renders the page with Tailwind CSS
package/dist/agent.d.ts CHANGED
@@ -34,7 +34,8 @@ export interface AgentIdentities {
34
34
  readonly pairing: (code: string) => Promise<AgentPairing>;
35
35
  /**
36
36
  * Links the pairing's chat account to the signed-in member. The ontology decides: it refuses a
37
- * used or expired code (`not_found`, `expired`) and a member it does not admit (`forbidden`).
37
+ * used or expired code (`not_found`, `expired`), a member it does not admit (`forbidden`), or an
38
+ * account linked to another member (`identity_in_use`, HTTP 409).
38
39
  * Server-only.
39
40
  */
40
41
  readonly approvePairing: (code: string) => Promise<AgentIdentity>;
package/dist/agent.js CHANGED
@@ -9,6 +9,7 @@ const GONE_CODES = new Set(["not_found", "expired"]);
9
9
  const STATUS_CODES = {
10
10
  403: "forbidden",
11
11
  404: "not_found",
12
+ 409: "identity_in_use",
12
13
  410: "expired",
13
14
  };
14
15
  function pairingPath(code, approve) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@segmentstream-cloud/app",
3
- "version": "0.17.1",
3
+ "version": "0.17.2",
4
4
  "description": "Sign-in, users, permissions, the ontology client and warehouse data access for SegmentStream workspace apps built with Next.js.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "SegmentStream",