@farthershore/client 0.6.0 → 0.8.0

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/dist/index.js CHANGED
@@ -159,9 +159,10 @@ var PLATFORM_PERMISSION_CATALOG = {
159
159
  defaultRoles: OWNER_ADMIN,
160
160
  delegation: "maker_token"
161
161
  }),
162
+ // Business presentation and the organization's seller details.
162
163
  "brand:update": permission("brand:update", {
163
164
  effect: "write",
164
- allowedTargetKinds: BUSINESS,
165
+ allowedTargetKinds: BUSINESS_OR_ORGANIZATION,
165
166
  defaultRoles: OWNER_ADMIN,
166
167
  delegation: "maker_token"
167
168
  }),
@@ -183,6 +184,46 @@ var PLATFORM_PERMISSION_CATALOG = {
183
184
  defaultRoles: OWNER_ADMIN,
184
185
  delegation: "maker_token"
185
186
  }),
187
+ "account_erasure:request": permission("account_erasure:request", {
188
+ selfService: true,
189
+ effect: "write",
190
+ allowedTargetKinds: SELF,
191
+ defaultRoles: BUILDER_ROLES_AND_SUBSCRIBER,
192
+ humanOnly: true,
193
+ delegation: "browser_only"
194
+ }),
195
+ "account_erasure:read": permission("account_erasure:read", {
196
+ selfService: true,
197
+ effect: "read",
198
+ allowedTargetKinds: SELF,
199
+ defaultRoles: BUILDER_ROLES_AND_SUBSCRIBER,
200
+ delegation: "maker_token"
201
+ }),
202
+ "personal_data:export": permission("personal_data:export", {
203
+ selfService: true,
204
+ effect: "read",
205
+ allowedTargetKinds: SELF,
206
+ defaultRoles: BUILDER_ROLES_AND_SUBSCRIBER,
207
+ delegation: "maker_token"
208
+ }),
209
+ "platform_legal:read": permission("platform_legal:read", {
210
+ selfService: true,
211
+ effect: "read",
212
+ allowedTargetKinds: SELF,
213
+ defaultRoles: BUILDER_ROLES_AND_SUBSCRIBER,
214
+ delegation: "maker_token"
215
+ }),
216
+ "platform_legal:accept": permission("platform_legal:accept", {
217
+ selfService: true,
218
+ effect: "write",
219
+ allowedTargetKinds: SELF,
220
+ defaultRoles: BUILDER_ROLES_AND_SUBSCRIBER,
221
+ humanOnly: true,
222
+ // Agreeing to the documents is the person's own act in their own
223
+ // session; asking for an emailed code first protects nothing.
224
+ humanOnlyFreshSession: false,
225
+ delegation: "browser_only"
226
+ }),
186
227
  "business:create": permission("business:create", {
187
228
  effect: "write",
188
229
  allowedTargetKinds: ORGANIZATION,
@@ -634,25 +675,25 @@ var PLATFORM_PERMISSION_CATALOG = {
634
675
  defaultRoles: OWNER_ADMIN,
635
676
  delegation: "maker_token"
636
677
  }),
637
- "runtime_token:mint": permission("runtime_token:mint", {
678
+ "secret_key:mint": permission("secret_key:mint", {
638
679
  effect: "write",
639
680
  allowedTargetKinds: BUSINESS,
640
681
  defaultRoles: OWNER_ADMIN,
641
682
  delegation: "maker_token"
642
683
  }),
643
- "runtime_token:read": permission("runtime_token:read", {
684
+ "secret_key:read": permission("secret_key:read", {
644
685
  effect: "read",
645
686
  allowedTargetKinds: BUSINESS,
646
687
  defaultRoles: BUILDER_ROLES,
647
688
  delegation: "maker_token"
648
689
  }),
649
- "runtime_token:revoke": permission("runtime_token:revoke", {
690
+ "secret_key:revoke": permission("secret_key:revoke", {
650
691
  effect: "write",
651
692
  allowedTargetKinds: BUSINESS,
652
693
  defaultRoles: OWNER_ADMIN,
653
694
  delegation: "maker_token"
654
695
  }),
655
- "runtime_token:rotate": permission("runtime_token:rotate", {
696
+ "secret_key:rotate": permission("secret_key:rotate", {
656
697
  effect: "write",
657
698
  allowedTargetKinds: BUSINESS,
658
699
  defaultRoles: OWNER_ADMIN,
@@ -766,6 +807,9 @@ function validatePlatformPermissionCatalog() {
766
807
  throw new Error(`Platform permission must be exact: ${permission2}`);
767
808
  }
768
809
  const metadata = PLATFORM_PERMISSION_CATALOG[permission2];
810
+ if (metadata.selfService && (metadata.allowedTargetKinds.length !== 1 || metadata.allowedTargetKinds[0] !== "self")) {
811
+ throw new Error(`Self-service permission must target only the caller: ${permission2}`);
812
+ }
769
813
  if (metadata.allowedTargetKinds.length === 0) {
770
814
  throw new Error(`Platform permission has no target kind: ${permission2}`);
771
815
  }
@@ -790,6 +834,19 @@ var REPO_AUTHORED = (declaration) => ({
790
834
  });
791
835
  var PLATFORM_OPERATION_DEFINITIONS = [
792
836
  // ── contract — managed as code; repo canonical; MCP read-only ──────────────
837
+ {
838
+ key: "account_erasure.request",
839
+ class: "operate",
840
+ domain: "account",
841
+ unavailable: {
842
+ reason: "human_decision",
843
+ detail: "Only a person can delete their account, in the dashboard settings."
844
+ }
845
+ },
846
+ { key: "account_erasure.read", class: "operate", domain: "account" },
847
+ { key: "personal_data.export", class: "operate", domain: "account" },
848
+ { key: "platform_legal.read", class: "operate", domain: "legal" },
849
+ { key: "platform_legal.accept", class: "operate", domain: "legal" },
793
850
  {
794
851
  key: "plan.create",
795
852
  class: "contract",
@@ -1050,6 +1107,14 @@ var PLATFORM_OPERATION_DEFINITIONS = [
1050
1107
  { key: "webhook.listen", class: "operate", domain: WEBHOOKS_DOMAIN },
1051
1108
  // Wire v1: issue a replacement signing secret (24 h dual-signing grace).
1052
1109
  { key: "webhook.rotate_secret", class: "operate", domain: WEBHOOKS_DOMAIN },
1110
+ // Send one delivery again (same webhook-id), or every failed / dead
1111
+ // delivery of an endpoint in a time range.
1112
+ {
1113
+ key: "webhook.delivery.redeliver",
1114
+ class: "operate",
1115
+ domain: WEBHOOKS_DOMAIN
1116
+ },
1117
+ { key: "webhook.redeliver", class: "operate", domain: WEBHOOKS_DOMAIN },
1053
1118
  // The subscribable event catalog, served so clients validate without an
1054
1119
  // SDK bump.
1055
1120
  { key: "webhook.event_type.read", class: "operate", domain: WEBHOOKS_DOMAIN },
@@ -1081,6 +1146,17 @@ var PLATFORM_OPERATION_DEFINITIONS = [
1081
1146
  class: "operate",
1082
1147
  domain: PROMO_CODES_DOMAIN
1083
1148
  },
1149
+ {
1150
+ key: "consumer.data.erase",
1151
+ class: "operate",
1152
+ domain: "consumers",
1153
+ unavailable: {
1154
+ reason: "human_decision",
1155
+ detail: "Only a person can erase customer data, in the dashboard."
1156
+ }
1157
+ },
1158
+ { key: "consumer.data.erasure.read", class: "operate", domain: "consumers" },
1159
+ { key: "consumer.data.export", class: "operate", domain: "consumers" },
1084
1160
  { key: "consumer.read", class: "operate", domain: "consumers" },
1085
1161
  { key: "consumer.block", class: "operate", domain: "consumers" },
1086
1162
  {
@@ -1158,17 +1234,17 @@ var PLATFORM_OPERATION_DEFINITIONS = [
1158
1234
  class: "operate",
1159
1235
  domain: VARIABLES_DOMAIN
1160
1236
  },
1161
- { key: "runtime_token.mint", class: "operate", domain: "runtime-tokens" },
1162
- { key: "runtime_token.rotate", class: "operate", domain: "runtime-tokens" },
1163
- { key: "runtime_token.revoke", class: "operate", domain: "runtime-tokens" },
1164
- { key: "runtime_token.read", class: "operate", domain: "runtime-tokens" },
1237
+ { key: "secret_key.mint", class: "operate", domain: "secret-keys" },
1238
+ { key: "secret_key.rotate", class: "operate", domain: "secret-keys" },
1239
+ { key: "secret_key.revoke", class: "operate", domain: "secret-keys" },
1240
+ { key: "secret_key.read", class: "operate", domain: "secret-keys" },
1165
1241
  {
1166
1242
  key: "metering_token.mint",
1167
1243
  class: "operate",
1168
1244
  domain: "metering",
1169
1245
  unavailable: {
1170
1246
  reason: "runtime_surface",
1171
- detail: "The metering credential is DERIVED from the runtime token at backend bootstrap (/runtime/*), not minted separately. Issue the runtime token with `farthershore backend tokens create --operations metering`."
1247
+ detail: "The metering credential is DERIVED from the secret key at backend bootstrap (/runtime/*), not minted separately. Issue the secret key with `farthershore backend tokens create --operations metering`."
1172
1248
  }
1173
1249
  },
1174
1250
  {
@@ -1345,6 +1421,13 @@ var PLATFORM_OPERATION_DEFINITIONS = [
1345
1421
  class: "operate",
1346
1422
  domain: "organizations"
1347
1423
  },
1424
+ // One seller per organization: every business in the organization sells as
1425
+ // the organization, with the details of its one payment account.
1426
+ {
1427
+ key: "organization.seller_details.read",
1428
+ class: "operate",
1429
+ domain: "organizations"
1430
+ },
1348
1431
  {
1349
1432
  key: "organization.billing.manage",
1350
1433
  class: "operate",
@@ -1583,6 +1666,26 @@ var MAKER_TOKEN_CREATE_ORG_PERMISSION = "maker_token:create_org";
1583
1666
  var BUSINESS_READ_PERMISSION = "business:read";
1584
1667
  var LOCAL_REPOSITORY_WRITE_PERMISSION = "local_repository:write";
1585
1668
  var AGENT_OPERATION_AUTHORIZATIONS = {
1669
+ "account_erasure.request": {
1670
+ permission: "account_erasure:request",
1671
+ targetKind: "self"
1672
+ },
1673
+ "account_erasure.read": {
1674
+ permission: "account_erasure:read",
1675
+ targetKind: "self"
1676
+ },
1677
+ "personal_data.export": {
1678
+ permission: "personal_data:export",
1679
+ targetKind: "self"
1680
+ },
1681
+ "platform_legal.read": {
1682
+ permission: "platform_legal:read",
1683
+ targetKind: "self"
1684
+ },
1685
+ "platform_legal.accept": {
1686
+ permission: "platform_legal:accept",
1687
+ targetKind: "self"
1688
+ },
1586
1689
  "auth.context.issue": {
1587
1690
  permission: "auth_context:issue",
1588
1691
  targetKind: "business"
@@ -1835,6 +1938,18 @@ var AGENT_OPERATION_AUTHORIZATIONS = {
1835
1938
  permission: "consumer:migrate_latest",
1836
1939
  targetKind: "business"
1837
1940
  },
1941
+ "consumer.data.erase": {
1942
+ permission: "consumer:remove",
1943
+ targetKind: "business"
1944
+ },
1945
+ "consumer.data.erasure.read": {
1946
+ permission: "consumer:read",
1947
+ targetKind: "business"
1948
+ },
1949
+ "consumer.data.export": {
1950
+ permission: "consumer:read",
1951
+ targetKind: "business"
1952
+ },
1838
1953
  "consumer.read": { permission: "consumer:read", targetKind: "business" },
1839
1954
  "consumer.remove": { permission: "consumer:remove", targetKind: "business" },
1840
1955
  "consumer.roles.assign": {
@@ -1968,6 +2083,10 @@ var AGENT_OPERATION_AUTHORIZATIONS = {
1968
2083
  permission: "organization:read",
1969
2084
  targetKind: "organization"
1970
2085
  },
2086
+ "organization.seller_details.read": {
2087
+ permission: "organization:read",
2088
+ targetKind: "organization"
2089
+ },
1971
2090
  "organization.ownership.transfer": {
1972
2091
  permission: "organization:ownership_transfer",
1973
2092
  targetKind: "organization"
@@ -2035,20 +2154,20 @@ var AGENT_OPERATION_AUTHORIZATIONS = {
2035
2154
  // bound to this key serves the accepted business config, so reading either
2036
2155
  // is a business read (`rbac:read` stays the subject/role catalog authority).
2037
2156
  "rbac.read": { permission: BUSINESS_READ_PERMISSION, targetKind: "business" },
2038
- "runtime_token.mint": {
2039
- permission: "runtime_token:mint",
2157
+ "secret_key.mint": {
2158
+ permission: "secret_key:mint",
2040
2159
  targetKind: "business"
2041
2160
  },
2042
- "runtime_token.read": {
2043
- permission: "runtime_token:read",
2161
+ "secret_key.read": {
2162
+ permission: "secret_key:read",
2044
2163
  targetKind: "business"
2045
2164
  },
2046
- "runtime_token.revoke": {
2047
- permission: "runtime_token:revoke",
2165
+ "secret_key.revoke": {
2166
+ permission: "secret_key:revoke",
2048
2167
  targetKind: "business"
2049
2168
  },
2050
- "runtime_token.rotate": {
2051
- permission: "runtime_token:rotate",
2169
+ "secret_key.rotate": {
2170
+ permission: "secret_key:rotate",
2052
2171
  targetKind: "business"
2053
2172
  },
2054
2173
  "resource_count.report": {
@@ -2091,6 +2210,14 @@ var AGENT_OPERATION_AUTHORIZATIONS = {
2091
2210
  permission: "webhook:update",
2092
2211
  targetKind: "business"
2093
2212
  },
2213
+ "webhook.delivery.redeliver": {
2214
+ permission: "webhook:update",
2215
+ targetKind: "business"
2216
+ },
2217
+ "webhook.redeliver": {
2218
+ permission: "webhook:update",
2219
+ targetKind: "business"
2220
+ },
2094
2221
  "webhook.event_type.read": {
2095
2222
  permission: "webhook:read",
2096
2223
  targetKind: "business"
@@ -2290,12 +2417,65 @@ function operationAuthorizationFor(key) {
2290
2417
  return AGENT_OPERATION_AUTHORIZATIONS[key];
2291
2418
  }
2292
2419
  function isHumanOnlyOperation(key) {
2420
+ if (PLATFORM_OPERATION_DEFINITIONS.find((operation2) => operation2.key === key)?.unavailable?.reason === "human_decision")
2421
+ return true;
2293
2422
  const permission2 = operationAuthorizationFor(key)?.permission;
2294
2423
  return permission2 !== void 0 && permission2 !== LOCAL_REPOSITORY_WRITE_PERMISSION && PLATFORM_PERMISSION_CATALOG[permission2].humanOnly === true;
2295
2424
  }
2296
2425
 
2297
2426
  // ../contracts/dist/operation-spec.js
2298
2427
  var SPECS = {
2428
+ "account_erasure.request": {
2429
+ summary: "Delete your account",
2430
+ description: "Request account erasure in the dashboard after typing your account email. Transfer or delete shared organizations and published businesses, and settle money first.",
2431
+ destructive: true,
2432
+ oneTimeSecret: false,
2433
+ preview: false,
2434
+ reconcile: { op: "account_erasure.read" }
2435
+ },
2436
+ "account_erasure.read": {
2437
+ summary: "Read your account deletion status",
2438
+ description: "Read progress or refusal for your own account deletion request.",
2439
+ destructive: false,
2440
+ oneTimeSecret: false,
2441
+ preview: false
2442
+ },
2443
+ "consumer.data.erase": {
2444
+ summary: "Erase customer data",
2445
+ description: "Erase one customer relationship after settlement and dashboard confirmation. Retain financial, usage, legal and audit evidence.",
2446
+ destructive: true,
2447
+ oneTimeSecret: false,
2448
+ preview: false,
2449
+ reconcile: { op: "consumer.data.erasure.read" }
2450
+ },
2451
+ "consumer.data.erasure.read": {
2452
+ summary: "Read customer erasure status",
2453
+ description: "Read the progress or refusal of customer data erasure for one business.",
2454
+ destructive: false,
2455
+ oneTimeSecret: false,
2456
+ preview: false
2457
+ },
2458
+ "consumer.data.export": {
2459
+ summary: "Export a customer's data",
2460
+ description: "Export one customer's data for one business as JSON.",
2461
+ destructive: false,
2462
+ oneTimeSecret: false,
2463
+ preview: false
2464
+ },
2465
+ "personal_data.export": {
2466
+ summary: "Export your personal data",
2467
+ description: "Download your own account data as JSON. Organization credentials cannot export personal data.",
2468
+ destructive: false,
2469
+ oneTimeSecret: false,
2470
+ preview: false
2471
+ },
2472
+ "platform_legal.read": {
2473
+ summary: "Read required legal document acceptance",
2474
+ description: "Read which current platform legal documents the signed-in person has accepted and the dashboard link for outstanding documents. Acceptance is a human decision in the dashboard.",
2475
+ destructive: false,
2476
+ oneTimeSecret: false,
2477
+ preview: false
2478
+ },
2299
2479
  "business.list": {
2300
2480
  summary: "List businesses in the current org",
2301
2481
  description: "List every business in the authenticated FartherShore workspace (id, name, status). Read-only; use this to discover business ids for the other tools.",
@@ -2380,9 +2560,9 @@ var SPECS = {
2380
2560
  },
2381
2561
  "business.create": {
2382
2562
  summary: "Create a new business and provision its managed GitHub repo",
2383
- description: "Create a new business and provision its managed GitHub repo",
2563
+ description: "Create a new business and provision its managed GitHub repo. Also issues the business's default key (every environment, every runtime operation) and returns it ONCE as defaultKey \u2014 set it as FS_SECRET_KEY in your backend.",
2384
2564
  destructive: false,
2385
- oneTimeSecret: false,
2565
+ oneTimeSecret: true,
2386
2566
  preview: false,
2387
2567
  reconcile: { op: "business.list" }
2388
2568
  },
@@ -2515,7 +2695,7 @@ var SPECS = {
2515
2695
  },
2516
2696
  "backend.read": {
2517
2697
  summary: "List backends for a business (id, scope, name, transport, status)",
2518
- description: "List a business's backends (origins) \u2014 id, scope (production|environment), environmentId, name, slug, transport (direct|tunnel), default flag, and derived status. Backends are per-(business, environment) rows, so the same declared backend can legitimately appear once per scope and be default in each. Read-only.",
2698
+ description: "List a business's backend deployments \u2014 id, scope (all | production | non-production | kind:<kind> | env:<environment>), name, slug, transport (direct|tunnel), default flag, and derived status. A backend has one deployment per scope; each environment is served by the most specific one. Read-only.",
2519
2699
  destructive: false,
2520
2700
  oneTimeSecret: false,
2521
2701
  preview: false,
@@ -2523,60 +2703,60 @@ var SPECS = {
2523
2703
  },
2524
2704
  "backend.create": {
2525
2705
  summary: "Create a backend (default transport: direct)",
2526
- description: "Create a backend (origin) for a business. Pick a transport mode: direct (public HTTPS URL, secured by Ed25519 request signing) or tunnel (private outbound-only cloudflared, secure bring-your-own-backend). Mark it default to route traffic to it.",
2706
+ description: "Create a backend deployment for a business. Pick a transport mode: direct (public HTTPS URL, secured by request signing) or tunnel (private outbound-only connection). Mark it default to route traffic to it. With an origin, the default backend gets its webhook receiver at <origin>/_fs/webhooks automatically, and a business without a default key gets one, returned ONCE as defaultKey.",
2527
2707
  destructive: false,
2528
- oneTimeSecret: false,
2708
+ oneTimeSecret: true,
2529
2709
  preview: true,
2530
2710
  reconcile: { op: "backend.read" }
2531
2711
  },
2532
2712
  "backend.bind": {
2533
- summary: "Bind a logical backend to a direct upstream in one environment",
2534
- description: "Bind a logical backend id to a concrete direct upstream URL in one environment. Previews inherit the production backend until a concrete override is bound. Omit environmentId for production.",
2713
+ summary: "Set a backend's origin (every environment unless overridden)",
2714
+ description: "Set the origin of a backend declared in business/. Without a scope it sets the `all` deployment, which serves every environment; with scope env:<environment> (or non-production / kind:<kind>, or an origin template with {env}) it creates or updates that override. Farther Shore keeps the default backend's webhook receiver at <origin>/_fs/webhooks, and a business without a default key gets one, returned ONCE as defaultKey.",
2535
2715
  destructive: false,
2536
- oneTimeSecret: false,
2716
+ oneTimeSecret: true,
2537
2717
  preview: true,
2538
2718
  reconcile: { op: "backend.read" }
2539
2719
  },
2540
2720
  "backend.delete": {
2541
- summary: "Delete a backend (revokes its runtime tokens)",
2721
+ summary: "Delete a backend (revokes its secret keys)",
2542
2722
  description: "Delete a backend (origin). Traffic routed to it stops; re-create to restore.",
2543
2723
  destructive: true,
2544
2724
  oneTimeSecret: false,
2545
2725
  preview: false,
2546
2726
  reconcile: { op: "backend.read" }
2547
2727
  },
2548
- "runtime_token.read": {
2549
- summary: "List runtime tokens for a business",
2550
- description: "List a business's runtime tokens (fsrt_) \u2014 id, last-four, operations, status, and env scope. Read-only; secrets are never shown.",
2728
+ "secret_key.read": {
2729
+ summary: "List secret keys for a business",
2730
+ description: "List a business's secret keys (fsrt_) \u2014 id, last-four, operations, status, and env scope. Read-only; secrets are never shown.",
2551
2731
  destructive: false,
2552
2732
  oneTimeSecret: false,
2553
2733
  preview: false,
2554
2734
  pagination: "offset"
2555
2735
  },
2556
- "runtime_token.mint": {
2557
- summary: "Create a runtime token (returns FS_RUNTIME_TOKEN once)",
2558
- description: "Mint a new runtime token (fsrt_) for a backend. Returns the plaintext token ONCE \u2014 store it now (e.g. as FS_RUNTIME_TOKEN). Operations default to the backend's needs (gateway_verification, metering, health).",
2736
+ "secret_key.mint": {
2737
+ summary: "Create a secret key (returns it once)",
2738
+ description: "Mint an additional secret key (fsrt_), e.g. a dedicated key for one environment (scope env:<environment>) that can act for no other. The business's default key already covers every environment. Returns the plaintext ONCE. Operations default to gateway_verification, metering, health and webhook_secrets.",
2559
2739
  destructive: false,
2560
2740
  oneTimeSecret: true,
2561
2741
  preview: false,
2562
- reconcile: { op: "runtime_token.read" }
2742
+ reconcile: { op: "secret_key.read" }
2563
2743
  },
2564
- // DECISION: NEITHER side → destructive (+ oneTimeSecret, already declared). Rotation revokes the previous FS_RUNTIME_TOKEN immediately; a backend still using it starts failing.
2565
- "runtime_token.rotate": {
2566
- summary: "Rotate a runtime token (returns a fresh FS_RUNTIME_TOKEN once)",
2567
- description: "Rotate a runtime token: mint a fresh secret carrying the same scope and revoke the old one. Returns the new plaintext token ONCE.",
2744
+ // DECISION: NEITHER side → destructive (+ oneTimeSecret, already declared). Rotation revokes the previous FS_SECRET_KEY immediately; a backend still using it starts failing.
2745
+ "secret_key.rotate": {
2746
+ summary: "Rotate a secret key (returns a fresh FS_SECRET_KEY once)",
2747
+ description: "Rotate a secret key: mint a fresh secret carrying the same scope and revoke the old one. Returns the new plaintext token ONCE.",
2568
2748
  destructive: true,
2569
2749
  oneTimeSecret: true,
2570
2750
  preview: false,
2571
- reconcile: { op: "runtime_token.read" }
2751
+ reconcile: { op: "secret_key.read" }
2572
2752
  },
2573
- "runtime_token.revoke": {
2574
- summary: "Revoke a runtime token",
2575
- description: "Revoke a runtime token. The backend using it stops verifying.",
2753
+ "secret_key.revoke": {
2754
+ summary: "Revoke a secret key",
2755
+ description: "Revoke a secret key. The backend using it stops verifying.",
2576
2756
  destructive: true,
2577
2757
  oneTimeSecret: false,
2578
2758
  preview: false,
2579
- reconcile: { op: "runtime_token.read" }
2759
+ reconcile: { op: "secret_key.read" }
2580
2760
  },
2581
2761
  "frontend.status": {
2582
2762
  summary: "Show the current frontend release, recent releases, and recent builds (incl. failure reasons)",
@@ -2667,6 +2847,25 @@ var SPECS = {
2667
2847
  preview: false,
2668
2848
  reconcile: { op: "webhook.read" }
2669
2849
  },
2850
+ // Redelivery queues the SAME delivery again (same webhook-id), so a
2851
+ // receiver that already processed it can dedupe. Each call sends again;
2852
+ // read the delivery log before repeating an ambiguous one.
2853
+ "webhook.delivery.redeliver": {
2854
+ summary: "Send one webhook delivery again",
2855
+ description: "Queue one delivery to be sent again right away, with the same webhook-id and payload. Works for a delivered, failed or dead delivery; one still being sent is refused. It gets a fresh 72-hour retry window.",
2856
+ destructive: false,
2857
+ oneTimeSecret: false,
2858
+ preview: false,
2859
+ reconcile: { op: "webhook.delivery.read" }
2860
+ },
2861
+ "webhook.redeliver": {
2862
+ summary: "Send every failed or dead delivery of a webhook endpoint in a time range again",
2863
+ description: "Queue every failed or dead delivery of one webhook endpoint created in [since, until) to be sent again right away, each with its own webhook-id and a fresh 72-hour retry window. Returns how many were queued.",
2864
+ destructive: false,
2865
+ oneTimeSecret: false,
2866
+ preview: false,
2867
+ reconcile: { op: "webhook.delivery.read" }
2868
+ },
2670
2869
  "webhook.event_type.read": {
2671
2870
  summary: "List the event names a webhook endpoint can subscribe to",
2672
2871
  description: "List the event names a webhook endpoint can subscribe to, with descriptions.",
@@ -3159,6 +3358,13 @@ var SPECS = {
3159
3358
  preview: false,
3160
3359
  pagination: "cursor"
3161
3360
  },
3361
+ "organization.seller_details.read": {
3362
+ summary: "Read the organization's seller details",
3363
+ description: "Read the public seller details every business in the organization shows customers on its site, at checkout, on receipts and in emails. They come from the organization's payment account (legal name, support email, postal address, support URL); a business cannot go live until the account has them.",
3364
+ destructive: false,
3365
+ oneTimeSecret: false,
3366
+ preview: false
3367
+ },
3162
3368
  "org_maker_token.permission_catalog.read": {
3163
3369
  summary: "List the exact permissions a human may delegate to an org MakerToken",
3164
3370
  description: "List the exact permissions a human may delegate to an org MakerToken",
@@ -3568,6 +3774,9 @@ function operationSpecFor(key) {
3568
3774
  return Object.hasOwn(OPERATION_SPECS, key) ? OPERATION_SPECS[key] : void 0;
3569
3775
  }
3570
3776
  var ROOT_NAMESPACES = {
3777
+ account_erasure: ["account", "erasure"],
3778
+ personal_data: ["personalData"],
3779
+ platform_legal: ["platform", "legal"],
3571
3780
  analytics: ["analytics"],
3572
3781
  apply_timeline: ["changeSets", "timeline"],
3573
3782
  auth: ["auth"],
@@ -3612,14 +3821,14 @@ function namespacePathFor(key) {
3612
3821
  }
3613
3822
 
3614
3823
  // ../contracts/dist/runtime.js
3615
- var FS_RUNTIME_TOKEN_ENV = "FS_RUNTIME_TOKEN";
3824
+ var FS_SECRET_KEY_ENV = "FS_SECRET_KEY";
3616
3825
  var RESPONSE_METERING_HEADER_NAMES = {
3617
3826
  payload: "x-fs-metering",
3618
3827
  signature: "x-fs-metering-sig",
3619
3828
  token: "x-fs-metering-token"
3620
3829
  };
3621
3830
  var RESPONSE_METERING_TOKEN_CONTRACT = {
3622
- environmentVariable: FS_RUNTIME_TOKEN_ENV,
3831
+ environmentVariable: FS_SECRET_KEY_ENV,
3623
3832
  presentation: RESPONSE_METERING_HEADER_NAMES.token,
3624
3833
  storage: "sha256-hash-only"
3625
3834
  };
@@ -3636,6 +3845,7 @@ var RUNTIME_ERROR_CODES = {
3636
3845
  replayedNonce: "replayed_nonce",
3637
3846
  bodyTooLarge: "body_too_large",
3638
3847
  environmentMismatch: "environment_mismatch",
3848
+ environmentUnknown: "environment_unknown",
3639
3849
  missingToken: "missing_token",
3640
3850
  invalidToken: "invalid_token",
3641
3851
  /** UA-6 — `contextVerification: "required"` and the signed X-Fs-Context
@@ -3662,6 +3872,17 @@ var STREAMING_EXEMPT_CONTENT_TYPE_SET = new Set(STREAMING_EXEMPT_CONTENT_TYPES);
3662
3872
 
3663
3873
  // ../contracts/dist/error-codes.js
3664
3874
  var ERROR_CODES = {
3875
+ CUSTOMER_ERASURE_UNSETTLED_MONEY: "CUSTOMER_ERASURE_UNSETTLED_MONEY",
3876
+ CUSTOMER_ERASURE_ORGANIZATION_AUTHORITY: "CUSTOMER_ERASURE_ORGANIZATION_AUTHORITY",
3877
+ CUSTOMER_ERASURE_CONFIRMATION_MISMATCH: "CUSTOMER_ERASURE_CONFIRMATION_MISMATCH",
3878
+ ACCOUNT_ERASURE_SHARED_ORGANIZATION: "ACCOUNT_ERASURE_SHARED_ORGANIZATION",
3879
+ ACCOUNT_ERASURE_PUBLISHED_BUSINESS: "ACCOUNT_ERASURE_PUBLISHED_BUSINESS",
3880
+ ACCOUNT_ERASURE_UNSETTLED_MONEY: "ACCOUNT_ERASURE_UNSETTLED_MONEY",
3881
+ ACCOUNT_ERASURE_CONFIRMATION_MISMATCH: "ACCOUNT_ERASURE_CONFIRMATION_MISMATCH",
3882
+ /** A legal obligation stands in front of the action; `details.unmet` names each fix. */
3883
+ LEGAL_OBLIGATION_UNMET: "LEGAL_OBLIGATION_UNMET",
3884
+ /** The agreement versions submitted for acceptance are no longer the ones required. */
3885
+ LEGAL_DOCUMENT_VERSION_CHANGED: "LEGAL_DOCUMENT_VERSION_CHANGED",
3665
3886
  MAINTENANCE_JOB_RETIRED: "MAINTENANCE_JOB_RETIRED",
3666
3887
  INVALID_USAGE_UNIT_LABEL: "INVALID_USAGE_UNIT_LABEL",
3667
3888
  HUMAN_ONLY_ACTION: "HUMAN_ONLY_ACTION",
@@ -3993,6 +4214,7 @@ var RUNTIME_ERROR_CODE_TO_ERROR_CODE = {
3993
4214
  body_hash_mismatch: ERROR_CODES.UNAUTHORIZED,
3994
4215
  route_mismatch: ERROR_CODES.UNAUTHORIZED,
3995
4216
  environment_mismatch: ERROR_CODES.UNAUTHORIZED,
4217
+ environment_unknown: ERROR_CODES.UNAUTHORIZED,
3996
4218
  // JWKS fetch unavailable — a dependency fault, but the backend still
3997
4219
  // fail-closes the request as 401 (statusForCode), so the canonical code is
3998
4220
  // SERVICE_UNAVAILABLE to preserve the "dependency down" semantic for callers.
@@ -4317,6 +4539,22 @@ var auditNotificationOperations = {
4317
4539
 
4318
4540
  // src/operations/auth.ts
4319
4541
  var authOperations = {
4542
+ "account.erasure.read": operation({
4543
+ op: "account_erasure.read",
4544
+ run: (ctx) => send(ctx, "GET", "/agent/v1/account-erasure")
4545
+ }),
4546
+ "personalData.export": operation({
4547
+ op: "personal_data.export",
4548
+ run: (ctx) => send(ctx, "GET", "/agent/v1/personal-data/export")
4549
+ }),
4550
+ "platform.legal.read": operation({
4551
+ op: "platform_legal.read",
4552
+ run: (ctx) => send(
4553
+ ctx,
4554
+ "GET",
4555
+ "/agent/v1/platform-legal"
4556
+ )
4557
+ }),
4320
4558
  "auth.context.read": operation({
4321
4559
  op: "auth.context.read",
4322
4560
  async run(ctx) {
@@ -4368,7 +4606,7 @@ var authOperations = {
4368
4606
 
4369
4607
  // src/operations/backends.ts
4370
4608
  var backends = (businessId) => `/businesses/${seg(businessId)}/backends`;
4371
- var runtimeTokens = (businessId) => `/businesses/${seg(businessId)}/runtime-tokens`;
4609
+ var secretKeys = (businessId) => `/businesses/${seg(businessId)}/secret-keys`;
4372
4610
  var backendOperations = {
4373
4611
  "backends.read": operation({
4374
4612
  op: "backend.read",
@@ -4394,29 +4632,29 @@ var backendOperations = {
4394
4632
  op: "backend.delete",
4395
4633
  run: (ctx, { businessId, backendId }) => send(ctx, "DELETE", `${backends(businessId)}/${seg(backendId)}`)
4396
4634
  }),
4397
- "runtimeTokens.read": operation({
4398
- op: "runtime_token.read",
4635
+ "secretKeys.read": operation({
4636
+ op: "secret_key.read",
4399
4637
  run: (ctx, { businessId, environmentId, limit, offset }) => send(
4400
4638
  ctx,
4401
4639
  "GET",
4402
- withQuery(runtimeTokens(businessId), {
4640
+ withQuery(secretKeys(businessId), {
4403
4641
  environmentId,
4404
4642
  limit: num(limit),
4405
4643
  offset: num(offset)
4406
4644
  })
4407
4645
  )
4408
4646
  }),
4409
- "runtimeTokens.mint": operation({
4410
- op: "runtime_token.mint",
4411
- run: (ctx, { businessId, ...data }) => send(ctx, "POST", runtimeTokens(businessId), data)
4647
+ "secretKeys.mint": operation({
4648
+ op: "secret_key.mint",
4649
+ run: (ctx, { businessId, ...data }) => send(ctx, "POST", secretKeys(businessId), data)
4412
4650
  }),
4413
- "runtimeTokens.rotate": operation({
4414
- op: "runtime_token.rotate",
4415
- run: (ctx, { businessId, tokenId }) => send(ctx, "POST", `${runtimeTokens(businessId)}/${seg(tokenId)}/rotate`)
4651
+ "secretKeys.rotate": operation({
4652
+ op: "secret_key.rotate",
4653
+ run: (ctx, { businessId, tokenId }) => send(ctx, "POST", `${secretKeys(businessId)}/${seg(tokenId)}/rotate`)
4416
4654
  }),
4417
- "runtimeTokens.revoke": operation({
4418
- op: "runtime_token.revoke",
4419
- run: (ctx, { businessId, tokenId }) => send(ctx, "DELETE", `${runtimeTokens(businessId)}/${seg(tokenId)}`)
4655
+ "secretKeys.revoke": operation({
4656
+ op: "secret_key.revoke",
4657
+ run: (ctx, { businessId, tokenId }) => send(ctx, "DELETE", `${secretKeys(businessId)}/${seg(tokenId)}`)
4420
4658
  })
4421
4659
  };
4422
4660
 
@@ -4693,6 +4931,16 @@ var setRbac = (op, enabled) => operation({
4693
4931
  })
4694
4932
  });
4695
4933
  var consumerOperations = {
4934
+ "consumers.data.export": operation({
4935
+ op: "consumer.data.export",
4936
+ run: (ctx, { businessId, subscriberId }) => send(ctx, "GET", `${consumer(businessId, subscriberId)}/data-export`)
4937
+ }),
4938
+ // Status of a customer's erasure request for this business, or null when
4939
+ // none exists. Starting an erasure is done by a person in the dashboard.
4940
+ "consumers.data.erasure.read": operation({
4941
+ op: "consumer.data.erasure.read",
4942
+ run: (ctx, { businessId, subscriberId }) => send(ctx, "GET", `${consumer(businessId, subscriberId)}/data-erasure`)
4943
+ }),
4696
4944
  "consumers.read": operation({
4697
4945
  op: "consumer.read",
4698
4946
  run: (ctx, { businessId, env }) => send(
@@ -4907,6 +5155,10 @@ var organizationOperations = {
4907
5155
  })
4908
5156
  )
4909
5157
  }),
5158
+ "organizations.sellerDetails.read": operation({
5159
+ op: "organization.seller_details.read",
5160
+ run: (ctx, { organizationId }) => send(ctx, "GET", `${org(organizationId)}/seller-details`)
5161
+ }),
4910
5162
  "organizations.role.list": operation({
4911
5163
  op: "organization.role.list",
4912
5164
  run: (ctx, { organizationId, query }) => send(
@@ -5473,6 +5725,13 @@ var webhookOperations = {
5473
5725
  op: "webhook.rotate_secret",
5474
5726
  run: (ctx, { businessId, webhookId }) => send(ctx, "POST", `${webhook(businessId, webhookId)}/rotate-secret`)
5475
5727
  }),
5728
+ "webhooks.redeliver": operation({
5729
+ op: "webhook.redeliver",
5730
+ run: (ctx, { businessId, webhookId, since, until }) => send(ctx, "POST", `${webhook(businessId, webhookId)}/redeliver`, {
5731
+ since,
5732
+ ...until !== void 0 ? { until } : {}
5733
+ })
5734
+ }),
5476
5735
  "webhooks.eventType.read": operation({
5477
5736
  op: "webhook.event_type.read",
5478
5737
  run: (ctx, { businessId }) => send(
@@ -5502,6 +5761,14 @@ var webhookOperations = {
5502
5761
  `${webhook(businessId, webhookId)}/deliveries/${seg(deliveryId)}`
5503
5762
  )
5504
5763
  }),
5764
+ "webhooks.delivery.redeliver": operation({
5765
+ op: "webhook.delivery.redeliver",
5766
+ run: (ctx, { businessId, webhookId, deliveryId }) => send(
5767
+ ctx,
5768
+ "POST",
5769
+ `${webhook(businessId, webhookId)}/deliveries/${seg(deliveryId)}/redeliver`
5770
+ )
5771
+ }),
5505
5772
  "webhooks.delivery.payload.read": operation({
5506
5773
  op: "webhook.delivery.payload.read",
5507
5774
  run: (ctx, { businessId, webhookId, deliveryId }) => send(
@@ -6088,7 +6355,7 @@ function diagnosticsOf(parsed) {
6088
6355
  }
6089
6356
 
6090
6357
  // src/version.ts
6091
- var CLIENT_VERSION = "0.6.0";
6358
+ var CLIENT_VERSION = "0.8.0";
6092
6359
  var CLIENT_PRODUCT = `@farthershore/client/${CLIENT_VERSION}`;
6093
6360
 
6094
6361
  // src/transport.ts