@fleetless/contracts 9.1.0 → 10.0.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/CHANGELOG.md +22 -0
- package/artifacts/openapi.json +18597 -10329
- package/artifacts/routes.json +96 -16
- package/artifacts/schema/billing-change-response.schema.json +1527 -1727
- package/artifacts/schema/billing-decision-amounts.schema.json +244 -0
- package/artifacts/schema/billing-decision-display-request.schema.json +24 -0
- package/artifacts/schema/billing-decision-display-response.schema.json +3130 -0
- package/artifacts/schema/billing-decision-period.schema.json +550 -0
- package/artifacts/schema/billing-decision-snapshot.schema.json +3103 -0
- package/artifacts/schema/checkout-request.schema.json +3 -4
- package/artifacts/schema/checkout-response.schema.json +492 -402
- package/artifacts/schema/confirmation-proof.schema.json +6 -0
- package/artifacts/schema/plan-change-decision-lookup-query.schema.json +16 -0
- package/artifacts/schema/plan-change-decision-status-response.schema.json +543 -0
- package/artifacts/schema/plan-change-prepare-request.schema.json +84 -0
- package/artifacts/schema/plan-change-prepare-response.schema.json +3162 -0
- package/artifacts/schema/plan-change-request.schema.json +177 -65
- package/artifacts/schema/purchase-conflict-details.schema.json +94 -0
- package/artifacts/schema/purchase-intent-accepted-without-payment.schema.json +95 -0
- package/artifacts/schema/purchase-intent-confirm-request.schema.json +146 -33
- package/artifacts/schema/purchase-intent-draft.schema.json +449 -0
- package/artifacts/schema/purchase-intent-payment-started.schema.json +184 -0
- package/artifacts/schema/purchase-intent-response.schema.json +1235 -168
- package/dist/billing.d.ts +5665 -210
- package/dist/billing.js +224 -29
- package/dist/confirmation-proof.d.ts +5 -0
- package/dist/confirmation-proof.js +6 -0
- package/dist/iana-time-zones.d.ts +2 -0
- package/dist/iana-time-zones.js +426 -0
- package/dist/index.d.ts +5 -4
- package/dist/index.js +3 -2
- package/dist/plans.d.ts +125 -1
- package/dist/plans.js +19 -1
- package/dist/purchase-operation-key.d.ts +4 -0
- package/dist/purchase-operation-key.js +4 -0
- package/dist/routes.js +42 -21
- package/package.json +3 -1
package/dist/routes.js
CHANGED
|
@@ -13,9 +13,9 @@ import { jobRunListResponse, jobRunQuery, jobRunSummary, jobRunSummaryQuery } fr
|
|
|
13
13
|
import { legalAcceptanceListQuery, legalAcceptanceListResponse } from './legal-acceptances.js';
|
|
14
14
|
import { MCP_APP_PATHS, mcpRobotDatasheet, mcpRolePreviewResponse } from './mcp.js';
|
|
15
15
|
import { authorizationServerMetadata, dynamicClientRegistrationRequest, dynamicClientRegistrationResponse, oauthAuthorizeQuery, oauthRedirectResponse, oauthTokenRequest, oauthTokenResponse, protectedResourceMetadata, } from './oauth.js';
|
|
16
|
-
import { adminPlanChangeRequest, orgPlan, planChangeRequest } from './plans.js';
|
|
16
|
+
import { adminPlanChangeRequest, orgPlan, planChangeRequest, planChangePrepareRequest, planChangeDecisionLookupQuery, planChangeDecisionStatusResponse } from './plans.js';
|
|
17
17
|
import { supportRenewFailRequest, supportTokenRequest, supportTokenResponse } from './support.js';
|
|
18
|
-
import { purchaseIntentLookupQuery, purchaseIntentConfirmRequest, purchaseIntentResponse, invoicePayRequest, billingCancelRequest, billingChangeRequest, billingChangeResponse, billingDetailsUpdate, billingDocumentDetail, billingDocumentFileQuery, billingDocumentList, billingView, chargePayRequest, checkoutRequest, checkoutResponse, checkoutStatus, paymentMethodChangeRequest, vatIdCheckRequest, vatIdCheckResponse, } from './billing.js';
|
|
18
|
+
import { purchaseIntentLookupQuery, purchaseIntentConfirmRequest, billingDecisionDisplayRequest, billingDecisionDisplayResponse, planChangePrepareResponse, purchaseIntentResponse, invoicePayRequest, billingCancelRequest, billingChangeRequest, billingChangeResponse, billingDetailsUpdate, billingDocumentDetail, billingDocumentFileQuery, billingDocumentList, billingView, chargePayRequest, checkoutRequest, checkoutResponse, checkoutStatus, paymentMethodChangeRequest, vatIdCheckRequest, vatIdCheckResponse, } from './billing.js';
|
|
19
19
|
import { cameraListResponse, cancelRequest, configDraftResponse, configVersionResponse, configVersionsResponse, createRobotRequest, createRobotResponse, datapointListResponse, datapointValue, exposureListResponse, fetchTypesRequest, fetchTypesResponse, historyQuery, historyResponse, introspectionResponse, invokeOrServiceResponse, invokeRequest, jobResponse, liveSessionResponse, orgHealthQuery, orgLatencyQuery, orgLatencyResponse, orgQuotaUsage, orgUsageQuery, orgUsageResponse, patchRobotRequest, patchRobotResponse, publishConfigResponse, publishRequest, putConfigDraftRequest, putRobotDetailsRequest, putRobotDetailsResponse, robotTokenRotateResponse, jointStatePutRequest, jointStatePutResponse, releaseLiveQuery, renameSlugRequest, renameSlugResponse, robotDeleteQuery, resourceHealthListResponse, robotDeletionSummary, robotDetailResponse, robotJobsResponse, robotListResponse, slugUsageResponse, snapshotMetaResponse, typesResponse, } from './rest.js';
|
|
20
20
|
export const ROUTE_SECTIONS = [
|
|
21
21
|
{ id: 'health', title: 'Health' },
|
|
@@ -2926,13 +2926,21 @@ export const ROUTES = [
|
|
|
2926
2926
|
'`addons` or replaced by an operator\'s override, so a consumer never recomputes it from the catalogue. `usage` is counted fresh on ' +
|
|
2927
2927
|
'every call, never cached. `switch` is present only for an organization still on the beta that has not yet landed on a priced plan.',
|
|
2928
2928
|
},
|
|
2929
|
+
{
|
|
2930
|
+
method: 'POST', path: '/api/org/plan/change/prepare', section: 'org',
|
|
2931
|
+
summary: 'Prepares a nonbinding downward-plan decision and its C.4 display.',
|
|
2932
|
+
audience: 'developer', auth: 'developer', rateLimited: false, ownerTier: true, status: 200,
|
|
2933
|
+
params: [], query: null, request: planChangePrepareRequest, response: planChangePrepareResponse,
|
|
2934
|
+
errors: [...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'plan_limit', 'target_state_conflict'], transport: 'http',
|
|
2935
|
+
notes: 'Owner only. Persists a prepared change reference and a short-lived display, without mutating the plan, pending_change, or legal acceptance. A same-key, same-input retry while undecided returns the same change_id with a fresh display. A Basic cancellation reason belongs only in the final PUT.',
|
|
2936
|
+
},
|
|
2929
2937
|
{
|
|
2930
2938
|
method: 'PUT', path: '/api/org/plan/change', section: 'org',
|
|
2931
|
-
summary: "
|
|
2939
|
+
summary: "Confirms a prepared downward-plan decision with its C.4 proof.",
|
|
2932
2940
|
audience: 'developer', auth: 'developer', rateLimited: false, ownerTier: true, status: 200,
|
|
2933
2941
|
params: [], query: null, request: planChangeRequest, response: orgPlan,
|
|
2934
2942
|
errors: [...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'plan_limit', 'target_state_conflict'], transport: 'http',
|
|
2935
|
-
notes: 'Owner tier, and **downward only**: this route moves the org to a lower plan or cancels it outright to Basic. It never moves the org ' +
|
|
2943
|
+
notes: 'Owner tier, and **downward only**: a prior prepare returns change_id and a displayed snapshot; this final PUT requires its confirmation_proof and the same operation_key, target_plan and keep. Only Basic permits cancellation_reason (at most 500 input characters). The reason is final idempotency metadata, not price or legal evidence. An exact replay returns the original result; a changed reason with the same key conflicts before effect. The decision and legal acceptance commit together. This route moves the org to a lower plan or cancels it outright to Basic. It never moves the org ' +
|
|
2936
2944
|
'up — an upgrade or an add-on goes through the billing routes instead (`POST /api/billing/checkout`, `POST /api/billing/change`). ' +
|
|
2937
2945
|
'`409 target_state_conflict` names `target_plan` with rule `not_lower` when the ' +
|
|
2938
2946
|
'chosen plan is not below the org\'s current one; with rule `locked_basic_only` when the org is locked (`orgLock`) and the chosen ' +
|
|
@@ -2945,7 +2953,15 @@ export const ROUTES = [
|
|
|
2945
2953
|
'kind not named in `keep` is deleted at that instant, never before** — except a choice made while the org is locked, which takes ' +
|
|
2946
2954
|
'effect at once, and a beta org\'s choice, which takes effect at the switch date instead. Anything created while the choice is ' +
|
|
2947
2955
|
'pending is checked against the target plan too and, when it passes, is folded into `keep`, so exactly what the confirmation counted ' +
|
|
2948
|
-
'is what is actually deleted.
|
|
2956
|
+
'is what is actually deleted. Replacing a still-pending choice requires a new prepare and proof-bound final PUT.',
|
|
2957
|
+
},
|
|
2958
|
+
{
|
|
2959
|
+
method: 'GET', path: '/api/org/plan/change/decisions', section: 'org',
|
|
2960
|
+
summary: 'Looks up the prepared or accepted owner plan decision by operation key.',
|
|
2961
|
+
audience: 'developer', auth: 'developer', rateLimited: false, ownerTier: true, status: 200,
|
|
2962
|
+
params: [], query: planChangeDecisionLookupQuery, request: null, response: planChangeDecisionStatusResponse,
|
|
2963
|
+
errors: [...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'not_found'], transport: 'http',
|
|
2964
|
+
notes: 'Scope the operation key to the authenticated real Owner and organization. An unknown or foreign key returns 404 without disclosure. Prepared returns only change_id; accepted returns the stored original orgPlan result. No proof is returned. Console checks this before asking for a fresh display after a lost final response.',
|
|
2949
2965
|
},
|
|
2950
2966
|
{
|
|
2951
2967
|
method: 'DELETE', path: '/api/org/plan/change', section: 'org',
|
|
@@ -2954,8 +2970,7 @@ export const ROUTES = [
|
|
|
2954
2970
|
params: [], query: null, request: null, response: null,
|
|
2955
2971
|
errors: [...DEVELOPER_GUARD, 'tier_required', 'not_found'], transport: 'http',
|
|
2956
2972
|
notes: 'Owner tier. `404 not_found` when the org has no `pending_change` to withdraw. The org stays on its current plan, unchanged, as if ' +
|
|
2957
|
-
'the choice had never been made;
|
|
2958
|
-
'anyway.',
|
|
2973
|
+
'the choice had never been made; an Owner who wants a different one prepares a new display and confirms it with a final PUT.',
|
|
2959
2974
|
},
|
|
2960
2975
|
{
|
|
2961
2976
|
method: 'PATCH', path: '/api/admin/orgs/:id/plan', section: 'org',
|
|
@@ -2993,7 +3008,7 @@ export const ROUTES = [
|
|
|
2993
3008
|
params: [], query: null, request: null, response: billingView,
|
|
2994
3009
|
errors: [...DEVELOPER_GUARD, 'tier_required'], transport: 'http',
|
|
2995
3010
|
notes: '`available: false` when `MOLLIE_API_KEY` is not configured — this cloud takes no payments, and every billing route that ' +
|
|
2996
|
-
'charges or opens a Mollie checkout answers `503 billing_unavailable` instead of acting;
|
|
3011
|
+
'charges or opens a Mollie checkout answers `503 billing_unavailable` instead of acting; plan-change prepare, resume, the details and the ' +
|
|
2997
3012
|
'VAT-ID check need no Mollie and answer normally. `account` is `null` before the org has ever checked out; the plan ' +
|
|
2998
3013
|
'and its limits still come from `GET /api/org/plan` (fleetless/fleetless issue 103) and are not repeated here.',
|
|
2999
3014
|
},
|
|
@@ -3004,7 +3019,7 @@ export const ROUTES = [
|
|
|
3004
3019
|
params: [], query: null, request: checkoutRequest, response: checkoutResponse,
|
|
3005
3020
|
errors: [...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'plan_limit', 'target_state_conflict', 'rate_limited', ...BILLING_OFF, ...MOLLIE],
|
|
3006
3021
|
transport: 'http',
|
|
3007
|
-
notes: "Basic stays free for every payer.
|
|
3022
|
+
notes: "Basic stays free for every payer. This start creates only a nonbinding draft; accept_terms is deprecated and cannot confirm an order. Current company, buyer, VIES and EUR quote checks still apply. Persist operation_key before POST; same key/input recovers the intent, changed input conflicts. An eligible Owner obtains a no-store C.4 display, then explicitly confirms with its proof. No payment or acceptance occurs at start. Hosted payment later offers card, PayPal or Apple Pay; its return is <console>/settings/billing?checkout=<checkout_id>. An active/past_due account uses billing/change.",
|
|
3008
3023
|
},
|
|
3009
3024
|
{
|
|
3010
3025
|
method: 'GET', path: '/api/billing/intents', section: 'billing',
|
|
@@ -3012,7 +3027,16 @@ export const ROUTES = [
|
|
|
3012
3027
|
audience: 'developer', auth: 'developer', rateLimited: false, ownerTier: true, status: 200,
|
|
3013
3028
|
params: [], query: purchaseIntentLookupQuery, request: null, response: purchaseIntentResponse,
|
|
3014
3029
|
errors: [...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'not_found'], transport: 'http',
|
|
3015
|
-
notes: 'Supply exactly one of operation_key or intent_id and the expected operation. Scope lookup to the authenticated owner and org; unknown, foreign-org or mismatched-operation intents return 404 without disclosure. Repeating a lookup after restart or lost response returns the same intent/payment identity and, for a paid change, its billing result.
|
|
3030
|
+
notes: 'Supply exactly one of operation_key or intent_id and the expected operation. Scope lookup to the authenticated owner and org; unknown, foreign-org or mismatched-operation intents return 404 without disclosure. Repeating a lookup after restart or lost response returns the same intent/payment identity and, for a paid change, its billing result. A proof is never returned here; a still-eligible decision needs a fresh C.4 display and explicit Owner click.',
|
|
3031
|
+
},
|
|
3032
|
+
{
|
|
3033
|
+
method: 'POST', path: '/api/billing/intents/:id/display', section: 'billing',
|
|
3034
|
+
summary: 'Issues a short-lived C.4 decision display and opaque confirmation proof.',
|
|
3035
|
+
audience: 'developer', auth: 'developer', rateLimited: false, ownerTier: true, status: 200,
|
|
3036
|
+
params: [{ name: 'id', description: 'The eligible intent ID returned by checkout or billing change.' }],
|
|
3037
|
+
query: null, request: billingDecisionDisplayRequest, response: billingDecisionDisplayResponse,
|
|
3038
|
+
errors: [...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'not_found', 'target_state_conflict'], transport: 'http',
|
|
3039
|
+
notes: 'Owner only, Cache-Control: no-store. Cloud persists the snapshot and proof hash for an eligible current checkout or paid-change intent of this Owner and org. Pending, held, refused or accepted intents cannot mint a new proof. The proof never appears in lookup, billing views or logs.',
|
|
3016
3040
|
},
|
|
3017
3041
|
{
|
|
3018
3042
|
method: 'POST', path: '/api/billing/intents/:id/confirm', section: 'billing',
|
|
@@ -3021,7 +3045,7 @@ export const ROUTES = [
|
|
|
3021
3045
|
params: [{ name: 'id', description: 'The intent ID returned by the start or lookup response.' }],
|
|
3022
3046
|
query: null, request: purchaseIntentConfirmRequest, response: purchaseIntentResponse,
|
|
3023
3047
|
errors: [...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'not_found', 'target_state_conflict', 'plan_limit', 'rate_limited', ...BILLING_OFF, ...MOLLIE], transport: 'http',
|
|
3024
|
-
notes: '
|
|
3048
|
+
notes: 'Checkout and paid-change decisions require confirmation_proof along with the operation key, quote revision and buyer fingerprint shown in the persisted C.4 display. Cloud rechecks buyer, quote, selection, legal references, period and current state under the org lock; stale or spent proof conflicts without effect. One decision and one legal acceptance commit together. An exact same-key replay returns the original result without another payment or acceptance. Foreign ownership answers 404 without disclosure; pending or held cannot charge.',
|
|
3025
3049
|
},
|
|
3026
3050
|
{
|
|
3027
3051
|
method: 'GET', path: '/api/billing/checkout/:id', section: 'billing',
|
|
@@ -3053,12 +3077,12 @@ export const ROUTES = [
|
|
|
3053
3077
|
},
|
|
3054
3078
|
{
|
|
3055
3079
|
method: 'POST', path: '/api/billing/change', section: 'billing',
|
|
3056
|
-
summary: "Records a paid-change intent or
|
|
3080
|
+
summary: "Records a nonbinding paid-change intent for a plan, cycle or add-on target.",
|
|
3057
3081
|
audience: 'developer', auth: 'developer', rateLimited: false, ownerTier: true, status: 200,
|
|
3058
3082
|
params: [], query: null, request: billingChangeRequest, response: billingChangeResponse,
|
|
3059
3083
|
errors: [...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'plan_limit', 'target_state_conflict', ...BILLING_OFF, ...MOLLIE],
|
|
3060
3084
|
transport: 'http',
|
|
3061
|
-
notes: "The request names an absolute plan/cycle/add-on target and a stable operation_key.
|
|
3085
|
+
notes: "The request names an absolute plan/cycle/add-on target and a stable operation_key. Start is nonbinding for every change, including zero-charge, scheduled and formerly immediate decreases: it neither changes the plan nor writes legal acceptance. An eligible Owner obtains a C.4 display and explicitly confirms with its proof. Confirmation may return accepted_no_payment with charged: null and no provider payment or redirect, or payment_started for a charged change. Exact-key lookup recovers the accepted result. Existing no_account, past_due, no_valid_mandate and plan_limit conflicts remain.",
|
|
3062
3086
|
},
|
|
3063
3087
|
{
|
|
3064
3088
|
method: 'POST', path: '/api/billing/payment-method', section: 'billing',
|
|
@@ -3071,14 +3095,11 @@ export const ROUTES = [
|
|
|
3071
3095
|
},
|
|
3072
3096
|
{
|
|
3073
3097
|
method: 'POST', path: '/api/billing/cancel', section: 'billing',
|
|
3074
|
-
summary:
|
|
3075
|
-
audience: 'developer', auth: 'developer', rateLimited: false, ownerTier: true, status:
|
|
3076
|
-
params: [], query: null, request: billingCancelRequest, requestOptional: true, response:
|
|
3077
|
-
errors: [...DEVELOPER_GUARD, 'tier_required', '
|
|
3078
|
-
notes: '
|
|
3079
|
-
'cancel. Takes effect at the period\'s end, nothing credited or refunded; over Basic\'s limits this is refused `409 ' +
|
|
3080
|
-
'plan_limit` and the console sends the owner to its choose-what-stays page instead, the same as a plan downgrade. "Cancel at ' +
|
|
3081
|
-
'period end" is not a flag here — it reads as `pending_change.target_plan === \'basic\'` on `GET /api/org/plan`.',
|
|
3098
|
+
summary: 'Rejects legacy direct cancellation after the C.4 gate is active.',
|
|
3099
|
+
audience: 'developer', auth: 'developer', rateLimited: false, ownerTier: true, status: 409,
|
|
3100
|
+
params: [], query: null, request: billingCancelRequest, requestOptional: true, response: null,
|
|
3101
|
+
errors: [...DEVELOPER_GUARD, 'tier_required', 'target_state_conflict'], transport: 'http',
|
|
3102
|
+
notes: 'The C.4 gate rejects this legacy POST with 409 target_state_conflict before mutation, audit or mail. Console uses POST /api/org/plan/change/prepare and the proof-bound final PUT for Basic, including an optional reason there. This route cannot confirm a customer decision.',
|
|
3082
3103
|
},
|
|
3083
3104
|
{
|
|
3084
3105
|
method: 'POST', path: '/api/billing/resume', section: 'billing',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fleetless/contracts",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.0",
|
|
4
4
|
"description": "Fleetless wire contracts: the bridge-cloud protocol, the REST API schemas and the error codes, as zod schemas with generated JSON Schema and OpenAPI artifacts.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Dehne Robotik GmbH",
|
|
@@ -60,6 +60,8 @@
|
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@types/node": "^26.2.0",
|
|
63
|
+
"ajv": "^8.20.0",
|
|
64
|
+
"ajv-formats": "^3.0.1",
|
|
63
65
|
"tsx": "^4.19.0",
|
|
64
66
|
"typescript": "^5.7.0",
|
|
65
67
|
"vitest": "^4.1.11"
|