@fleetless/contracts 9.2.0-next.1 → 10.1.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 +24 -0
- package/artifacts/openapi.json +18609 -10341
- 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, recoverHeldJobRequest, recoverHeldJobResponse, 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' },
|
|
@@ -2939,13 +2939,21 @@ export const ROUTES = [
|
|
|
2939
2939
|
'`addons` or replaced by an operator\'s override, so a consumer never recomputes it from the catalogue. `usage` is counted fresh on ' +
|
|
2940
2940
|
'every call, never cached. `switch` is present only for an organization still on the beta that has not yet landed on a priced plan.',
|
|
2941
2941
|
},
|
|
2942
|
+
{
|
|
2943
|
+
method: 'POST', path: '/api/org/plan/change/prepare', section: 'org',
|
|
2944
|
+
summary: 'Prepares a nonbinding downward-plan decision and its C.4 display.',
|
|
2945
|
+
audience: 'developer', auth: 'developer', rateLimited: false, ownerTier: true, status: 200,
|
|
2946
|
+
params: [], query: null, request: planChangePrepareRequest, response: planChangePrepareResponse,
|
|
2947
|
+
errors: [...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'plan_limit', 'target_state_conflict'], transport: 'http',
|
|
2948
|
+
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.',
|
|
2949
|
+
},
|
|
2942
2950
|
{
|
|
2943
2951
|
method: 'PUT', path: '/api/org/plan/change', section: 'org',
|
|
2944
|
-
summary: "
|
|
2952
|
+
summary: "Confirms a prepared downward-plan decision with its C.4 proof.",
|
|
2945
2953
|
audience: 'developer', auth: 'developer', rateLimited: false, ownerTier: true, status: 200,
|
|
2946
2954
|
params: [], query: null, request: planChangeRequest, response: orgPlan,
|
|
2947
2955
|
errors: [...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'plan_limit', 'target_state_conflict'], transport: 'http',
|
|
2948
|
-
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 ' +
|
|
2956
|
+
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 ' +
|
|
2949
2957
|
'up — an upgrade or an add-on goes through the billing routes instead (`POST /api/billing/checkout`, `POST /api/billing/change`). ' +
|
|
2950
2958
|
'`409 target_state_conflict` names `target_plan` with rule `not_lower` when the ' +
|
|
2951
2959
|
'chosen plan is not below the org\'s current one; with rule `locked_basic_only` when the org is locked (`orgLock`) and the chosen ' +
|
|
@@ -2958,7 +2966,15 @@ export const ROUTES = [
|
|
|
2958
2966
|
'kind not named in `keep` is deleted at that instant, never before** — except a choice made while the org is locked, which takes ' +
|
|
2959
2967
|
'effect at once, and a beta org\'s choice, which takes effect at the switch date instead. Anything created while the choice is ' +
|
|
2960
2968
|
'pending is checked against the target plan too and, when it passes, is folded into `keep`, so exactly what the confirmation counted ' +
|
|
2961
|
-
'is what is actually deleted.
|
|
2969
|
+
'is what is actually deleted. Replacing a still-pending choice requires a new prepare and proof-bound final PUT.',
|
|
2970
|
+
},
|
|
2971
|
+
{
|
|
2972
|
+
method: 'GET', path: '/api/org/plan/change/decisions', section: 'org',
|
|
2973
|
+
summary: 'Looks up the prepared or accepted owner plan decision by operation key.',
|
|
2974
|
+
audience: 'developer', auth: 'developer', rateLimited: false, ownerTier: true, status: 200,
|
|
2975
|
+
params: [], query: planChangeDecisionLookupQuery, request: null, response: planChangeDecisionStatusResponse,
|
|
2976
|
+
errors: [...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'not_found'], transport: 'http',
|
|
2977
|
+
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.',
|
|
2962
2978
|
},
|
|
2963
2979
|
{
|
|
2964
2980
|
method: 'DELETE', path: '/api/org/plan/change', section: 'org',
|
|
@@ -2967,8 +2983,7 @@ export const ROUTES = [
|
|
|
2967
2983
|
params: [], query: null, request: null, response: null,
|
|
2968
2984
|
errors: [...DEVELOPER_GUARD, 'tier_required', 'not_found'], transport: 'http',
|
|
2969
2985
|
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 ' +
|
|
2970
|
-
'the choice had never been made;
|
|
2971
|
-
'anyway.',
|
|
2986
|
+
'the choice had never been made; an Owner who wants a different one prepares a new display and confirms it with a final PUT.',
|
|
2972
2987
|
},
|
|
2973
2988
|
{
|
|
2974
2989
|
method: 'PATCH', path: '/api/admin/orgs/:id/plan', section: 'org',
|
|
@@ -3006,7 +3021,7 @@ export const ROUTES = [
|
|
|
3006
3021
|
params: [], query: null, request: null, response: billingView,
|
|
3007
3022
|
errors: [...DEVELOPER_GUARD, 'tier_required'], transport: 'http',
|
|
3008
3023
|
notes: '`available: false` when `MOLLIE_API_KEY` is not configured — this cloud takes no payments, and every billing route that ' +
|
|
3009
|
-
'charges or opens a Mollie checkout answers `503 billing_unavailable` instead of acting;
|
|
3024
|
+
'charges or opens a Mollie checkout answers `503 billing_unavailable` instead of acting; plan-change prepare, resume, the details and the ' +
|
|
3010
3025
|
'VAT-ID check need no Mollie and answer normally. `account` is `null` before the org has ever checked out; the plan ' +
|
|
3011
3026
|
'and its limits still come from `GET /api/org/plan` (fleetless/fleetless issue 103) and are not repeated here.',
|
|
3012
3027
|
},
|
|
@@ -3017,7 +3032,7 @@ export const ROUTES = [
|
|
|
3017
3032
|
params: [], query: null, request: checkoutRequest, response: checkoutResponse,
|
|
3018
3033
|
errors: [...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'plan_limit', 'target_state_conflict', 'rate_limited', ...BILLING_OFF, ...MOLLIE],
|
|
3019
3034
|
transport: 'http',
|
|
3020
|
-
notes: "Basic stays free for every payer.
|
|
3035
|
+
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.",
|
|
3021
3036
|
},
|
|
3022
3037
|
{
|
|
3023
3038
|
method: 'GET', path: '/api/billing/intents', section: 'billing',
|
|
@@ -3025,7 +3040,16 @@ export const ROUTES = [
|
|
|
3025
3040
|
audience: 'developer', auth: 'developer', rateLimited: false, ownerTier: true, status: 200,
|
|
3026
3041
|
params: [], query: purchaseIntentLookupQuery, request: null, response: purchaseIntentResponse,
|
|
3027
3042
|
errors: [...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'not_found'], transport: 'http',
|
|
3028
|
-
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.
|
|
3043
|
+
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.',
|
|
3044
|
+
},
|
|
3045
|
+
{
|
|
3046
|
+
method: 'POST', path: '/api/billing/intents/:id/display', section: 'billing',
|
|
3047
|
+
summary: 'Issues a short-lived C.4 decision display and opaque confirmation proof.',
|
|
3048
|
+
audience: 'developer', auth: 'developer', rateLimited: false, ownerTier: true, status: 200,
|
|
3049
|
+
params: [{ name: 'id', description: 'The eligible intent ID returned by checkout or billing change.' }],
|
|
3050
|
+
query: null, request: billingDecisionDisplayRequest, response: billingDecisionDisplayResponse,
|
|
3051
|
+
errors: [...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'not_found', 'target_state_conflict'], transport: 'http',
|
|
3052
|
+
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.',
|
|
3029
3053
|
},
|
|
3030
3054
|
{
|
|
3031
3055
|
method: 'POST', path: '/api/billing/intents/:id/confirm', section: 'billing',
|
|
@@ -3034,7 +3058,7 @@ export const ROUTES = [
|
|
|
3034
3058
|
params: [{ name: 'id', description: 'The intent ID returned by the start or lookup response.' }],
|
|
3035
3059
|
query: null, request: purchaseIntentConfirmRequest, response: purchaseIntentResponse,
|
|
3036
3060
|
errors: [...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'not_found', 'target_state_conflict', 'plan_limit', 'rate_limited', ...BILLING_OFF, ...MOLLIE], transport: 'http',
|
|
3037
|
-
notes: '
|
|
3061
|
+
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.',
|
|
3038
3062
|
},
|
|
3039
3063
|
{
|
|
3040
3064
|
method: 'GET', path: '/api/billing/checkout/:id', section: 'billing',
|
|
@@ -3066,12 +3090,12 @@ export const ROUTES = [
|
|
|
3066
3090
|
},
|
|
3067
3091
|
{
|
|
3068
3092
|
method: 'POST', path: '/api/billing/change', section: 'billing',
|
|
3069
|
-
summary: "Records a paid-change intent or
|
|
3093
|
+
summary: "Records a nonbinding paid-change intent for a plan, cycle or add-on target.",
|
|
3070
3094
|
audience: 'developer', auth: 'developer', rateLimited: false, ownerTier: true, status: 200,
|
|
3071
3095
|
params: [], query: null, request: billingChangeRequest, response: billingChangeResponse,
|
|
3072
3096
|
errors: [...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'plan_limit', 'target_state_conflict', ...BILLING_OFF, ...MOLLIE],
|
|
3073
3097
|
transport: 'http',
|
|
3074
|
-
notes: "The request names an absolute plan/cycle/add-on target and a stable operation_key.
|
|
3098
|
+
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.",
|
|
3075
3099
|
},
|
|
3076
3100
|
{
|
|
3077
3101
|
method: 'POST', path: '/api/billing/payment-method', section: 'billing',
|
|
@@ -3084,14 +3108,11 @@ export const ROUTES = [
|
|
|
3084
3108
|
},
|
|
3085
3109
|
{
|
|
3086
3110
|
method: 'POST', path: '/api/billing/cancel', section: 'billing',
|
|
3087
|
-
summary:
|
|
3088
|
-
audience: 'developer', auth: 'developer', rateLimited: false, ownerTier: true, status:
|
|
3089
|
-
params: [], query: null, request: billingCancelRequest, requestOptional: true, response:
|
|
3090
|
-
errors: [...DEVELOPER_GUARD, 'tier_required', '
|
|
3091
|
-
notes: '
|
|
3092
|
-
'cancel. Takes effect at the period\'s end, nothing credited or refunded; over Basic\'s limits this is refused `409 ' +
|
|
3093
|
-
'plan_limit` and the console sends the owner to its choose-what-stays page instead, the same as a plan downgrade. "Cancel at ' +
|
|
3094
|
-
'period end" is not a flag here — it reads as `pending_change.target_plan === \'basic\'` on `GET /api/org/plan`.',
|
|
3111
|
+
summary: 'Rejects legacy direct cancellation after the C.4 gate is active.',
|
|
3112
|
+
audience: 'developer', auth: 'developer', rateLimited: false, ownerTier: true, status: 409,
|
|
3113
|
+
params: [], query: null, request: billingCancelRequest, requestOptional: true, response: null,
|
|
3114
|
+
errors: [...DEVELOPER_GUARD, 'tier_required', 'target_state_conflict'], transport: 'http',
|
|
3115
|
+
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.',
|
|
3095
3116
|
},
|
|
3096
3117
|
{
|
|
3097
3118
|
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.1.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"
|