@crouter/api 0.3.392 → 0.3.394

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.
@@ -1,5 +1,13 @@
1
1
  /** A provider's setup state for the account (directory spec, "Provider setup state"). */
2
2
  export type SetupState = 'not_started' | 'pending' | 'ready' | 'failed';
3
+ /** One provider the grantee requires, as the directory's grant sync carried it. */
4
+ export interface ProviderDependency {
5
+ state: SetupState;
6
+ /** The provider's own sentence for `pending` and `failed` (its `message_pending` / `message_failed`); absent for `not_started` and `ready`. */
7
+ message?: string;
8
+ /** Absolute URL of the directory's setup page for this provider and this app (`<issuer>/connect/setup/<provider>?client_id=<grantee>`); the app may append `return_to` (its own registered redirect origin) so Continue brings the person back. */
9
+ next: string;
10
+ }
3
11
  export interface GrantGetDTO {
4
12
  sub: string;
5
13
  grantee: string;
@@ -13,6 +21,6 @@ export interface GrantGetDTO {
13
21
  }[];
14
22
  spend_cap: number | null;
15
23
  payer: 'user';
16
- /** `{ <provider id>: <setup state> }` as the directory's grant sync carried it; `{}` when the grantee has none. The daemon performs no `requires` check: an app polls this and refuses its own operation with `provider_setup_pending`. */
17
- dependencies: Record<string, SetupState>;
24
+ /** `{ <provider id>: ProviderDependency }` as the directory's grant sync carried it; `{}` when the grantee has none. The daemon performs no `requires` check: an app polls this and refuses its own operation with `provider_setup_pending`. When an entry's `state` is not `ready`, show its `message` (the provider's own sentence, when it has one) and send the person to its `next` (the directory's setup page) — never copy the provider's prose into the app. */
25
+ dependencies: Record<string, ProviderDependency>;
18
26
  }
@@ -18,7 +18,7 @@ export const errorCodes = {
18
18
  user_denied: { type: 'permission_error', status: 403, retryable: false },
19
19
  provider_refused: { type: 'permission_error', status: 403, retryable: false },
20
20
  provider_not_connected: { type: 'permission_error', status: 403, retryable: false },
21
- // An app refusing its own operation because a provider in its `requires` is not `ready`; details `{ provider, state, next }`, `next` = `<issuer>/connect/setup/<provider>`. The daemon never raises it (it only carries `dependencies`).
21
+ // An app refusing its own operation because a provider in its `requires` is not `ready`; details `{ provider, state, message?, next }`, copied from `grant.get`'s `dependencies[provider]` entry (`next` = `<issuer>/connect/setup/<provider>?client_id=<grantee>`). The daemon never raises it (it only carries `dependencies`).
22
22
  provider_setup_pending: { type: 'permission_error', status: 403, retryable: false },
23
23
  question_pages_off: { type: 'permission_error', status: 403, retryable: false },
24
24
  isolated_run: { type: 'permission_error', status: 403, retryable: false },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crouter/api",
3
- "version": "0.3.392",
3
+ "version": "0.3.394",
4
4
  "description": "Typed crtrd /v1 API contract — DTOs, route builders, the error contract, the CrtrClient, and the command-plugin manifest format. Zero runtime dependencies.",
5
5
  "type": "module",
6
6
  "main": "./dist/api/index.js",