@fleetless/contracts 6.3.0-next.5 → 6.4.0-next.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.
Files changed (47) hide show
  1. package/CHANGELOG.md +79 -0
  2. package/CONTRIBUTING.md +4 -4
  3. package/artifacts/openapi.json +4386 -1883
  4. package/artifacts/routes.json +461 -2
  5. package/artifacts/schema/admin-org-detail.schema.json +641 -0
  6. package/artifacts/schema/admin-search-query.schema.json +14 -0
  7. package/artifacts/schema/admin-search-response.schema.json +219 -0
  8. package/artifacts/schema/billing-address.schema.json +49 -0
  9. package/artifacts/schema/billing-cancel-request.schema.json +12 -0
  10. package/artifacts/schema/billing-change-request.schema.json +60 -0
  11. package/artifacts/schema/billing-change-response.schema.json +799 -0
  12. package/artifacts/schema/billing-details-update.schema.json +25 -0
  13. package/artifacts/schema/billing-details.schema.json +176 -0
  14. package/artifacts/schema/billing-invoice.schema.json +76 -0
  15. package/artifacts/schema/billing-view.schema.json +705 -0
  16. package/artifacts/schema/checkout-request.schema.json +252 -0
  17. package/artifacts/schema/checkout-response.schema.json +22 -0
  18. package/artifacts/schema/checkout-status.schema.json +49 -0
  19. package/artifacts/schema/noop-command-request.schema.json +75 -0
  20. package/artifacts/schema/noop-command-response.schema.json +134 -0
  21. package/artifacts/schema/operator-audit-ref.schema.json +28 -0
  22. package/artifacts/schema/operator-preview.schema.json +66 -0
  23. package/artifacts/schema/payment-method-change-request.schema.json +19 -0
  24. package/artifacts/schema/payment-method.schema.json +86 -0
  25. package/artifacts/schema/payment-provider-unavailable-details.schema.json +29 -0
  26. package/artifacts/schema/preview-stale-details.schema.json +80 -0
  27. package/artifacts/schema/vat-id-check-request.schema.json +22 -0
  28. package/artifacts/schema/vat-id-check-response.schema.json +36 -0
  29. package/dist/admin.d.ts +217 -0
  30. package/dist/admin.js +39 -0
  31. package/dist/app-users.d.ts +3 -3
  32. package/dist/billing.d.ts +812 -0
  33. package/dist/billing.js +471 -0
  34. package/dist/errors.d.ts +23 -11
  35. package/dist/errors.js +47 -0
  36. package/dist/index.d.ts +12 -4
  37. package/dist/index.js +10 -2
  38. package/dist/operator-commands.d.ts +137 -0
  39. package/dist/operator-commands.js +51 -0
  40. package/dist/operator.d.ts +63 -0
  41. package/dist/operator.js +48 -0
  42. package/dist/plans.d.ts +25 -25
  43. package/dist/realtime.d.ts +2 -2
  44. package/dist/rest.d.ts +3 -3
  45. package/dist/routes.d.ts +21 -2
  46. package/dist/routes.js +270 -4
  47. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -11,6 +11,79 @@ version.
11
11
 
12
12
  ### Added
13
13
 
14
+ - **The operator's admin API (fleetless/fleetless#268).** `RouteAuth`
15
+ gains `operator`: a short-lived EdDSA-signed assertion naming the acting
16
+ person and their roles (`operatorRole`: `operator-admin`,
17
+ `operator-finance`, `operator-support`), carried as
18
+ `Authorization: Operator <jwt>` and verified against
19
+ `operatorAssertionClaims`. Every `auth: 'operator'` route is
20
+ `audience: 'internal'` and carries a `RouteEntry.operator` block (roles,
21
+ and a `confirmationLevel` on a command), looked up by `operatorAccess`
22
+ and written into `routes.json` as `operator`.
23
+ - **The command protocol.** `operatorCommandRequest`/`operatorCommandResponse`
24
+ describe a preview-reason-execute cycle: a `preview` mode answering
25
+ `operatorPreview` and a token, an `execute` mode taking a `reason`, that
26
+ token and an `idempotency_key`, and a result carrying `operatorAuditRef`.
27
+ `409 preview_stale` carries a fresh preview in `previewStaleDetails`.
28
+ The no-op command (`POST /api/admin/commands/noop`,
29
+ `noopCommandRequest`/`noopCommandResponse`) proves the protocol without
30
+ changing anything.
31
+ - **Search and org reads.** `GET /api/admin/search`
32
+ (`adminSearchQuery`/`adminSearchResponse`, hit kinds org, person, invoice,
33
+ payment, robot), `GET /api/admin/orgs/:id` (`adminOrgDetail`) and
34
+ `GET /api/admin/orgs/:id/usage`, identical to the developer's own usage
35
+ read for the named org.
36
+ - **Two error codes**: `preview_stale` (409, an execute's preview is no
37
+ longer current) and `idempotency_key_reused` (409, the key was already
38
+ used for a different command, input or operator).
39
+
40
+ ## [6.3.0] — 2026-10-05
41
+
42
+ ### Added
43
+
44
+ - **Billing.** `src/billing.ts`: `EU_COUNTRIES`, `countryCode`,
45
+ `currencyForCountry`, `normalizeVatId` and `viesCountry`; `vatFor`, who
46
+ may pay and at which VAT rate (Germany 19 %, a company in another EU
47
+ country with a VAT ID VIES confirms 0 % reverse charge, outside the EU
48
+ 0 %, everyone else refused with a named rule); the money functions in
49
+ integer cents (`periodNetCents`, `periodDays`, `remainingDays`,
50
+ `prorateCents`, `changeNetCents`, `chargeAmounts`, `checkoutQuote`); and
51
+ the dunning schedule `BILLING_RETRY_DAYS` and `BILLING_LOCK_DAY`.
52
+ - **The billing read model and requests.** `billingView` (the account, the
53
+ payment method on file, the `payment_method_options` a change may offer
54
+ now, the last 24 invoices), `billingAccount`, `billingInvoice`,
55
+ `paymentMethod`, `billingDetails` and `billingAddress`;
56
+ the requests `checkoutRequest`, `vatIdCheckRequest`,
57
+ `billingChangeRequest` (absolute counts, not deltas),
58
+ `billingCancelRequest`, `billingDetailsUpdate` and
59
+ `paymentMethodChangeRequest`; the answers `checkoutResponse`,
60
+ `checkoutStatus`, `vatIdCheckResponse` and `billingChangeResponse`. Each
61
+ has a JSON Schema in `artifacts/schema/`.
62
+ - **Card, PayPal and Apple Pay.** `paymentMethodKind`
63
+ (`card | paypal | applepay`) is what `paymentMethodChangeRequest` names
64
+ and what `paymentMethod` shows: `applepay` carries the card fields,
65
+ because Mollie stores an Apple Pay mandate as a card mandate. A change
66
+ to Apple Pay may be refused with `400 validation_error`, rule
67
+ `applepay_needs_open_invoice`, where it can only be made while paying an
68
+ open invoice; `payment_method_options` says which applies.
69
+ - **The VAT-ID hold and chargebacks** (descriptions only). A renewal held
70
+ by the VAT ID is a due charge without an invoice number until it is
71
+ paid: `dunning.invoice_id` names it, `failure` is `vat_id_invalid`, and
72
+ `POST /api/billing/invoices/:id/pay` answers `409 target_state_conflict`,
73
+ rule `vat_id_invalid`, while it is held. A charged-back payment is never
74
+ recharged automatically: `next_retry_at` is `null`, `failure` is
75
+ `charged_back`.
76
+ - **The `billing` route section**, twelve routes: `GET /api/billing`, the
77
+ checkout and its status, the VAT-ID check, billing details, changes,
78
+ the payment method, cancel and resume, an invoice's PDF and paying an
79
+ open invoice, all owner-tier; and Mollie's webhook
80
+ (`POST /api/billing/mollie/webhook`, internal, no auth).
81
+ - **`billing_unavailable`** (`503`): this cloud has no payment provider
82
+ configured, so it takes no payments. Retrying does not help.
83
+ - **`payment_provider_unavailable`** (`502`): Mollie did not answer, or
84
+ answered with an error; nothing was charged. `details` is
85
+ `paymentProviderUnavailableDetails` (`provider`, Mollie's HTTP `status`
86
+ or `null` for a timeout). Retrying may work.
14
87
  - **`history_migrating`** (`409`): a slug rename refused while the robot's
15
88
  recorded history is being migrated to a new storage layout. Temporary;
16
89
  nothing is written, and the same request succeeds once the migration has
@@ -19,6 +92,12 @@ version.
19
92
 
20
93
  ### Changed
21
94
 
95
+ - **`PATCH /api/admin/orgs/:id/plan`** lists `target_state_conflict`: rule
96
+ `billed` when the org has a billing account and the change would touch
97
+ its currency or period.
98
+ - The notes of **`PUT /api/org/plan/change`** and the admin route no longer
99
+ say payment is missing; an upgrade of a billed org goes through the
100
+ billing routes.
22
101
  - `POST /api/robots/:id/config/rename-slug`: the summary and notes, and the
23
102
  `renameSlugRequest` doc comment, now say the history moves with the name
24
103
  without rewriting stored samples, and that samples sent under the old slug
package/CONTRIBUTING.md CHANGED
@@ -72,10 +72,10 @@ developer machine path or a first-name attribution.
72
72
  an issue first — so we can say what else has to move with it.
73
73
 
74
74
  **CI runs on GitHub Actions**, in this repository
75
- (`.github/workflows/verify.yml`) — the suite, on every push and every pull
76
- request. `release.yml` (the **Release** button) calls that same file on the
77
- commit it publishes, so a release is never checked by a different pipeline
78
- than a push.
75
+ (`.github/workflows/verify.yml`) — the suite, on every pull request and
76
+ every push to `main`. `release.yml` (the **Release** button) calls that same
77
+ file on the commit it publishes, so a release is never checked by a different
78
+ pipeline than a push.
79
79
 
80
80
  **Your pull request is verified, a fork's included** — the same file, the
81
81
  same suite. The first run by a first-time contributor waits for a maintainer