@civitai/sdk 0.10.0 → 0.10.1

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
@@ -357,7 +357,10 @@ wider scope — and refuses without one.
357
357
  | `publishGenerationOutputs({ workflowId, imageIndexes })` | Publishes your own workflow's outputs, behind the host's confirmation; resolves the new image ids |
358
358
 
359
359
  Host failures reject with a `BridgeError` carrying a `code` (`forbidden`,
360
- `unauthenticated`, `rate-limited`, …). Timeouts are the host's to set; pass a
360
+ `unauthenticated`, `rate-limited`, …). `unauthenticated` includes a viewer whose
361
+ session ended (signed out in another tab) — offer `requestSignIn()`. A session
362
+ that now belongs to a different account is `forbidden`; its `message` asks the
363
+ viewer to reload the page. Timeouts are the host's to set; pass a
361
364
  `signal` to cancel. `ApiError` and `BridgeError` both extend `CivitaiError`, so
362
365
  one `catch` can tell a refusal from a bug.
363
366
 
@@ -20,11 +20,18 @@ export class BridgeError extends CivitaiError {
20
20
  * The messages this bridge already had report failure as the server's own
21
21
  * sentence — the host holds the tRPC code and drops it. Unmatched text is
22
22
  * `unavailable`; `message` still carries what the host said.
23
+ *
24
+ * Procedures that need the viewer's signed-in session can refuse with a bare
25
+ * `UNAUTHORIZED` (the session ended, e.g. signed out in another tab), which is
26
+ * `unauthenticated`, or with "…belongs to a different account; reload the page
27
+ * to continue" (the page's session changed account), which is `forbidden`:
28
+ * signing in again does not help, reloading the page does.
23
29
  */
24
30
  const HOST_FAILURES = [
25
31
  [/authenticated viewer|no block token/i, 'unauthenticated'],
32
+ [/^UNAUTHORIZED$/, 'unauthenticated'],
26
33
  [
27
- /(requires|lacks) .+ scope|not approved|revoked|invalid block token|not enabled|review preview|^banned$/i,
34
+ /(requires|lacks) .+ scope|not approved|revoked|invalid block token|not enabled|review preview|belongs to a different account|^banned$/i,
28
35
  'forbidden',
29
36
  ],
30
37
  [/rate limit|^busy$/i, 'rate-limited'],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@civitai/sdk",
3
- "version": "0.10.0",
3
+ "version": "0.10.1",
4
4
  "description": "The Civitai SDK: an app holds a token and calls the Civitai API and the orchestrator; a block asks its host only to show host UI.",
5
5
  "license": "MIT",
6
6
  "type": "module",