@fleetless/contracts 6.4.0-next.1 → 6.5.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 +23 -25
- package/CONTRIBUTING.md +11 -1
- package/README.md +4 -0
- package/artifacts/routes.json +29 -137
- package/dist/app-users.d.ts +3 -3
- package/dist/billing.d.ts +12 -12
- package/dist/errors.d.ts +7 -7
- package/dist/errors.js +0 -14
- package/dist/index.d.ts +2 -8
- package/dist/index.js +1 -5
- package/dist/plans.d.ts +16 -16
- package/dist/routes.d.ts +1 -20
- package/dist/routes.js +29 -79
- package/package.json +2 -2
- package/artifacts/schema/admin-org-detail.schema.json +0 -641
- package/artifacts/schema/admin-search-query.schema.json +0 -14
- package/artifacts/schema/admin-search-response.schema.json +0 -219
- package/artifacts/schema/noop-command-request.schema.json +0 -75
- package/artifacts/schema/noop-command-response.schema.json +0 -134
- package/artifacts/schema/operator-audit-ref.schema.json +0 -28
- package/artifacts/schema/operator-preview.schema.json +0 -66
- package/artifacts/schema/preview-stale-details.schema.json +0 -80
- package/dist/admin.d.ts +0 -217
- package/dist/admin.js +0 -39
- package/dist/operator-commands.d.ts +0 -137
- package/dist/operator-commands.js +0 -51
- package/dist/operator.d.ts +0 -63
- package/dist/operator.js +0 -48
package/dist/plans.d.ts
CHANGED
|
@@ -28,9 +28,9 @@ export declare const PLAN_ORDER: readonly PlanId[];
|
|
|
28
28
|
* off the same catalogue row.
|
|
29
29
|
*/
|
|
30
30
|
export declare const planLimitKey: z.ZodEnum<{
|
|
31
|
+
apps: "apps";
|
|
31
32
|
seats: "seats";
|
|
32
33
|
robots: "robots";
|
|
33
|
-
apps: "apps";
|
|
34
34
|
app_users: "app_users";
|
|
35
35
|
live_video_ms_per_month: "live_video_ms_per_month";
|
|
36
36
|
asset_bytes_per_robot: "asset_bytes_per_robot";
|
|
@@ -58,9 +58,9 @@ export type PlanLimits = z.infer<typeof planLimits>;
|
|
|
58
58
|
* may be bought at all — `pro` and `enterprise`).
|
|
59
59
|
*/
|
|
60
60
|
export declare const planFeature: z.ZodEnum<{
|
|
61
|
-
app_mcp: "app_mcp";
|
|
62
|
-
two_factor: "two_factor";
|
|
63
61
|
require_two_factor: "require_two_factor";
|
|
62
|
+
two_factor: "two_factor";
|
|
63
|
+
app_mcp: "app_mcp";
|
|
64
64
|
app_oidc: "app_oidc";
|
|
65
65
|
hosted_logo: "hosted_logo";
|
|
66
66
|
audit_export: "audit_export";
|
|
@@ -68,9 +68,9 @@ export declare const planFeature: z.ZodEnum<{
|
|
|
68
68
|
}>;
|
|
69
69
|
export type PlanFeature = z.infer<typeof planFeature>;
|
|
70
70
|
export declare const planFeatures: z.ZodObject<{
|
|
71
|
-
app_mcp: z.ZodBoolean;
|
|
72
|
-
two_factor: z.ZodBoolean;
|
|
73
71
|
require_two_factor: z.ZodBoolean;
|
|
72
|
+
two_factor: z.ZodBoolean;
|
|
73
|
+
app_mcp: z.ZodBoolean;
|
|
74
74
|
app_oidc: z.ZodBoolean;
|
|
75
75
|
hosted_logo: z.ZodBoolean;
|
|
76
76
|
audit_export: z.ZodBoolean;
|
|
@@ -85,8 +85,8 @@ export declare const planPrices: z.ZodObject<{
|
|
|
85
85
|
}, z.core.$strip>;
|
|
86
86
|
export type PlanPrices = z.infer<typeof planPrices>;
|
|
87
87
|
export declare const planSupport: z.ZodEnum<{
|
|
88
|
-
community: "community";
|
|
89
88
|
email: "email";
|
|
89
|
+
community: "community";
|
|
90
90
|
priority: "priority";
|
|
91
91
|
named_contact: "named_contact";
|
|
92
92
|
}>;
|
|
@@ -110,9 +110,9 @@ export declare const planCatalogueEntry: z.ZodObject<{
|
|
|
110
110
|
audit_days: z.ZodNullable<z.ZodNumber>;
|
|
111
111
|
}, z.core.$strip>;
|
|
112
112
|
features: z.ZodObject<{
|
|
113
|
-
app_mcp: z.ZodBoolean;
|
|
114
|
-
two_factor: z.ZodBoolean;
|
|
115
113
|
require_two_factor: z.ZodBoolean;
|
|
114
|
+
two_factor: z.ZodBoolean;
|
|
115
|
+
app_mcp: z.ZodBoolean;
|
|
116
116
|
app_oidc: z.ZodBoolean;
|
|
117
117
|
hosted_logo: z.ZodBoolean;
|
|
118
118
|
audit_export: z.ZodBoolean;
|
|
@@ -125,8 +125,8 @@ export declare const planCatalogueEntry: z.ZodObject<{
|
|
|
125
125
|
usd_year: z.ZodNumber;
|
|
126
126
|
}, z.core.$strip>>;
|
|
127
127
|
support: z.ZodEnum<{
|
|
128
|
-
community: "community";
|
|
129
128
|
email: "email";
|
|
129
|
+
community: "community";
|
|
130
130
|
priority: "priority";
|
|
131
131
|
named_contact: "named_contact";
|
|
132
132
|
}>;
|
|
@@ -138,25 +138,25 @@ export type PlanCatalogueEntry = z.infer<typeof planCatalogueEntry>;
|
|
|
138
138
|
* buy them (`planFeature.addons`: `pro` and `enterprise`).
|
|
139
139
|
*/
|
|
140
140
|
export declare const addonKey: z.ZodEnum<{
|
|
141
|
+
apps: "apps";
|
|
141
142
|
seats: "seats";
|
|
142
143
|
robots: "robots";
|
|
143
|
-
apps: "apps";
|
|
144
144
|
app_user_packs: "app_user_packs";
|
|
145
145
|
live_video_packs: "live_video_packs";
|
|
146
146
|
}>;
|
|
147
147
|
export type AddonKey = z.infer<typeof addonKey>;
|
|
148
148
|
export declare const addonCatalogueEntry: z.ZodObject<{
|
|
149
149
|
key: z.ZodEnum<{
|
|
150
|
+
apps: "apps";
|
|
150
151
|
seats: "seats";
|
|
151
152
|
robots: "robots";
|
|
152
|
-
apps: "apps";
|
|
153
153
|
app_user_packs: "app_user_packs";
|
|
154
154
|
live_video_packs: "live_video_packs";
|
|
155
155
|
}>;
|
|
156
156
|
raises: z.ZodEnum<{
|
|
157
|
+
apps: "apps";
|
|
157
158
|
seats: "seats";
|
|
158
159
|
robots: "robots";
|
|
159
|
-
apps: "apps";
|
|
160
160
|
app_users: "app_users";
|
|
161
161
|
live_video_ms_per_month: "live_video_ms_per_month";
|
|
162
162
|
asset_bytes_per_robot: "asset_bytes_per_robot";
|
|
@@ -367,9 +367,9 @@ export declare const orgPlan: z.ZodObject<{
|
|
|
367
367
|
audit_days: z.ZodNullable<z.ZodNumber>;
|
|
368
368
|
}, z.core.$strip>;
|
|
369
369
|
features: z.ZodObject<{
|
|
370
|
-
app_mcp: z.ZodBoolean;
|
|
371
|
-
two_factor: z.ZodBoolean;
|
|
372
370
|
require_two_factor: z.ZodBoolean;
|
|
371
|
+
two_factor: z.ZodBoolean;
|
|
372
|
+
app_mcp: z.ZodBoolean;
|
|
373
373
|
app_oidc: z.ZodBoolean;
|
|
374
374
|
hosted_logo: z.ZodBoolean;
|
|
375
375
|
audit_export: z.ZodBoolean;
|
|
@@ -454,9 +454,9 @@ export type PlanChangeRequest = z.infer<typeof planChangeRequest>;
|
|
|
454
454
|
* optional — omitted and `null` are two different instructions.
|
|
455
455
|
*/
|
|
456
456
|
export declare const planOverrides: z.ZodObject<{
|
|
457
|
+
apps: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
457
458
|
seats: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
458
459
|
robots: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
459
|
-
apps: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
460
460
|
app_users: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
461
461
|
live_video_ms_per_month: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
462
462
|
asset_bytes_per_robot: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
@@ -489,9 +489,9 @@ export declare const adminPlanChangeRequest: z.ZodObject<{
|
|
|
489
489
|
live_video_packs: z.ZodOptional<z.ZodNumber>;
|
|
490
490
|
}, z.core.$strict>>;
|
|
491
491
|
overrides: z.ZodOptional<z.ZodObject<{
|
|
492
|
+
apps: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
492
493
|
seats: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
493
494
|
robots: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
494
|
-
apps: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
495
495
|
app_users: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
496
496
|
live_video_ms_per_month: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
497
497
|
asset_bytes_per_robot: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
package/dist/routes.d.ts
CHANGED
|
@@ -28,17 +28,13 @@
|
|
|
28
28
|
*/
|
|
29
29
|
import type { ZodType } from 'zod';
|
|
30
30
|
import type { ErrorCode } from './errors.js';
|
|
31
|
-
import type { ConfirmationLevel, OperatorRole } from './operator.js';
|
|
32
31
|
export type RouteMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
33
32
|
export type RouteAudience = 'developer' | 'client' | 'internal';
|
|
34
33
|
/**
|
|
35
34
|
* `ops` (2026-10-02, fleetless/fleetless#103): a bearer token the operator
|
|
36
35
|
* holds (`OPS_API_TOKEN`); never reachable through a public host.
|
|
37
|
-
*
|
|
38
|
-
* `operator` (fleetless/fleetless#268): a short-lived assertion naming the
|
|
39
|
-
* acting person and their roles; the roles a route needs are in `operator`.
|
|
40
36
|
*/
|
|
41
|
-
export type RouteAuth = 'developer' | 'developer_or_client' | 'none' | 'robot_upload' | 'in_handler' | 'ops'
|
|
37
|
+
export type RouteAuth = 'developer' | 'developer_or_client' | 'none' | 'robot_upload' | 'in_handler' | 'ops';
|
|
42
38
|
export type RouteTransport = 'http' | 'websocket';
|
|
43
39
|
export type RouteSection = 'health' | 'developer-auth' | 'client-auth' | 'org' | 'billing' | 'users' | 'apps' | 'robots' | 'config' | 'alerts' | 'commands' | 'cameras' | 'assets' | 'mcp' | 'transports';
|
|
44
40
|
export interface RouteParam {
|
|
@@ -46,13 +42,6 @@ export interface RouteParam {
|
|
|
46
42
|
/** One sentence: what the segment identifies and where a caller gets it. */
|
|
47
43
|
readonly description: string;
|
|
48
44
|
}
|
|
49
|
-
/** Set exactly when `auth` is `operator` (fleetless/fleetless#268). */
|
|
50
|
-
export interface RouteOperatorAccess {
|
|
51
|
-
/** The roles that may call this route (fleetless/fleetless#268). Never empty. */
|
|
52
|
-
readonly roles: readonly OperatorRole[];
|
|
53
|
-
/** Set on command routes only: how the operator app confirms an execute. */
|
|
54
|
-
readonly confirmation?: ConfirmationLevel;
|
|
55
|
-
}
|
|
56
45
|
export interface RouteEntry {
|
|
57
46
|
readonly method: RouteMethod;
|
|
58
47
|
/** The display path with `:name` params and no inline regex. */
|
|
@@ -100,8 +89,6 @@ export interface RouteEntry {
|
|
|
100
89
|
readonly transport: RouteTransport;
|
|
101
90
|
/** Markdown rendered under the route; the place for what the schema cannot say. */
|
|
102
91
|
readonly notes?: string;
|
|
103
|
-
/** Set exactly when `auth` is `operator`. */
|
|
104
|
-
readonly operator?: RouteOperatorAccess;
|
|
105
92
|
}
|
|
106
93
|
export declare const ROUTE_SECTIONS: readonly {
|
|
107
94
|
readonly id: RouteSection;
|
|
@@ -136,9 +123,3 @@ export declare const IN_HANDLER_ROUTES: readonly string[];
|
|
|
136
123
|
*/
|
|
137
124
|
export declare function developerSignInRoutes(prefix: '/console/oauth' | '/mcp/oauth'): RouteEntry[];
|
|
138
125
|
export declare const ROUTES: readonly RouteEntry[];
|
|
139
|
-
/**
|
|
140
|
-
* The roles (and, for a command, the confirmation level) a caller of this
|
|
141
|
-
* operator route needs, looked up by method and path (fleetless/fleetless#268).
|
|
142
|
-
* Throws for a route that is not `auth: 'operator'`.
|
|
143
|
-
*/
|
|
144
|
-
export declare function operatorAccess(method: RouteMethod, path: string): RouteOperatorAccess;
|
package/dist/routes.js
CHANGED
|
@@ -12,9 +12,6 @@ import { jobRunListResponse, jobRunQuery, jobRunSummary, jobRunSummaryQuery } fr
|
|
|
12
12
|
import { MCP_APP_PATHS, mcpRobotDatasheet, mcpRolePreviewResponse } from './mcp.js';
|
|
13
13
|
import { authorizationServerMetadata, dynamicClientRegistrationRequest, dynamicClientRegistrationResponse, oauthAuthorizeQuery, oauthRedirectResponse, oauthTokenRequest, oauthTokenResponse, protectedResourceMetadata, } from './oauth.js';
|
|
14
14
|
import { adminPlanChangeRequest, orgPlan, planChangeRequest } from './plans.js';
|
|
15
|
-
import { OPERATOR_ROLES } from './operator.js';
|
|
16
|
-
import { noopCommandRequest, noopCommandResponse } from './operator-commands.js';
|
|
17
|
-
import { adminSearchQuery, adminSearchResponse, adminOrgDetail } from './admin.js';
|
|
18
15
|
import { billingCancelRequest, billingChangeRequest, billingChangeResponse, billingDetailsUpdate, billingView, checkoutRequest, checkoutResponse, checkoutStatus, paymentMethodChangeRequest, vatIdCheckRequest, vatIdCheckResponse, } from './billing.js';
|
|
19
16
|
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
17
|
export const ROUTE_SECTIONS = [
|
|
@@ -1409,6 +1406,22 @@ export const ROUTES = [
|
|
|
1409
1406
|
'page resolves nothing about the address typed into it, so there is no enumeration oracle here at all.',
|
|
1410
1407
|
},
|
|
1411
1408
|
...developerSignInRoutes('/console/oauth'),
|
|
1409
|
+
{
|
|
1410
|
+
method: 'GET', path: '/waitlist-invite/:token', section: 'developer-auth',
|
|
1411
|
+
summary: 'Starts invite-bound console sign-up for a new Basic organization.',
|
|
1412
|
+
audience: 'internal', auth: 'none', rateLimited: true, ownerTier: false, status: 303,
|
|
1413
|
+
params: [{ name: 'token', description: 'The opaque waiting-list invitation token from the mailed link; never a query parameter.' }],
|
|
1414
|
+
query: null, request: null, response: null, errors: ['rate_limited'], transport: 'http',
|
|
1415
|
+
notes: 'Exchanges a valid seven-day invitation for a short-lived browser-proof cookie, then redirects with `303` into console sign-up. ' +
|
|
1416
|
+
'The response uses `Cache-Control: no-store` and `Referrer-Policy: no-referrer`; no caller-supplied redirect is accepted. ' +
|
|
1417
|
+
'Invalid, expired, used, declined or replaced links render the same `410` page; the per-IP backstop answers `429 rate_limited`. ' +
|
|
1418
|
+
'Only the invited normalized email address may register a new Basic organization under `SIGNUP_MODE=closed`, and the signup code ' +
|
|
1419
|
+
'still proves control of that address. Every step rechecks the unspent generation, expiry and address; re-inviting immediately ' +
|
|
1420
|
+
'invalidates the old link and any signup it started. The GET does not consume the invitation: final organization/Owner creation, ' +
|
|
1421
|
+
'waiting-list transition and single-use consumption share one transaction. The interaction binds the invitation id/generation, ' +
|
|
1422
|
+
'never the raw token. Tokens, proof values and recipient links stay out of the directory, logs and operator responses. ' +
|
|
1423
|
+
'Team invitations through `/accept-invite/:token` still join an existing organization.',
|
|
1424
|
+
},
|
|
1412
1425
|
{
|
|
1413
1426
|
method: 'GET', path: '/console/oauth/signup/:id', section: 'developer-auth',
|
|
1414
1427
|
summary: 'Serves step one of console sign-up, the email card.',
|
|
@@ -1417,7 +1430,9 @@ export const ROUTES = [
|
|
|
1417
1430
|
query: null, request: null, response: null, errors: [], transport: 'http',
|
|
1418
1431
|
notes: 'HTML: the email field and `Email me a code`, the first of three steps — email, code, organization. While the deployment runs in ' +
|
|
1419
1432
|
'closed beta this renders the "sign-up is closed" card at `403` instead, keeping the interaction alive and pointing back at sign-in and ' +
|
|
1420
|
-
'the waiting list — the person may well already have an account.'
|
|
1433
|
+
'the waiting list — the person may well already have an account. Under `SIGNUP_MODE=closed`, only a valid invite-bound interaction ' +
|
|
1434
|
+
'may continue for the invited normalized email address and a new Basic organization. Each step rechecks its unspent invitation ' +
|
|
1435
|
+
'generation, expiry and address; ordinary public sign-up remains refused.',
|
|
1421
1436
|
},
|
|
1422
1437
|
{
|
|
1423
1438
|
method: 'POST', path: '/console/oauth/signup', section: 'developer-auth',
|
|
@@ -1428,7 +1443,9 @@ export const ROUTES = [
|
|
|
1428
1443
|
notes: 'A browser form post gets the code card; a JSON caller gets `{ "next", "email" }`, which has no schema. **No password**: the code ' +
|
|
1429
1444
|
'mailed here, six digits valid ten minutes, proves the address. A per-interaction proof cookie is set here — it is what stops a third ' +
|
|
1430
1445
|
'party from finishing a sign-up somebody else started. Sign-up is the one surface whose job is to say an address is taken, so `409 ' +
|
|
1431
|
-
'email_taken` is not a leak here.'
|
|
1446
|
+
'email_taken` is not a leak here. Under `SIGNUP_MODE=closed`, only a valid invite-bound interaction may request the code for the ' +
|
|
1447
|
+
'invited normalized email address; the unspent invitation generation, expiry and address are rechecked. Ordinary public sign-up ' +
|
|
1448
|
+
'still answers `403 signup_closed`.',
|
|
1432
1449
|
},
|
|
1433
1450
|
{
|
|
1434
1451
|
method: 'POST', path: '/console/oauth/signup/code', section: 'developer-auth',
|
|
@@ -1438,7 +1455,9 @@ export const ROUTES = [
|
|
|
1438
1455
|
errors: ['rate_limited', 'token_spent', 'signup_closed', 'wrong_browser', 'validation_error', 'invalid_code'], transport: 'http',
|
|
1439
1456
|
notes: 'A wrong code renders the code card again with the attempts left (`400 invalid_code`); a spent, expired or exhausted one is `410 ' +
|
|
1440
1457
|
'token_spent`. The step before must have run in **this** browser (`401 wrong_browser`). A browser form post gets the organization card, ' +
|
|
1441
|
-
'the address shown `confirmed`; a JSON caller gets `{ "next" }`, which has no schema.'
|
|
1458
|
+
'the address shown `confirmed`; a JSON caller gets `{ "next" }`, which has no schema. Under `SIGNUP_MODE=closed`, only a valid ' +
|
|
1459
|
+
'invite-bound interaction may continue after rechecking its unspent invitation generation, expiry and invited normalized email ' +
|
|
1460
|
+
'address. Ordinary public sign-up still answers `403 signup_closed`.',
|
|
1442
1461
|
},
|
|
1443
1462
|
{
|
|
1444
1463
|
method: 'POST', path: '/console/oauth/signup/organization', section: 'developer-auth',
|
|
@@ -1450,7 +1469,10 @@ export const ROUTES = [
|
|
|
1450
1469
|
'confirmed the address. Both steps before must have run in **this** browser: a missing or mismatched proof cookie is `401 ' +
|
|
1451
1470
|
'wrong_browser` and the person is sent back to step one. `409 email_taken` when the address was taken meanwhile. A browser form post ' +
|
|
1452
1471
|
'gets a `303` to the console callback; a JSON caller gets `redirect_to` at `200`. This is the only way an organisation is created: ' +
|
|
1453
|
-
'`POST /api/auth/signup` is gone, because without a password it would hand a session to anybody who names an address.'
|
|
1472
|
+
'`POST /api/auth/signup` is gone, because without a password it would hand a session to anybody who names an address. Under ' +
|
|
1473
|
+
'`SIGNUP_MODE=closed`, only a valid invite-bound interaction may create a new Basic organization for the invited normalized email ' +
|
|
1474
|
+
'address. Rechecking the unspent invitation generation, expiry and address, creating the org/Owner, transitioning the waiting-list ' +
|
|
1475
|
+
'entry and consuming the invitation happen in that same transaction. Ordinary public sign-up still answers `403 signup_closed`.',
|
|
1454
1476
|
},
|
|
1455
1477
|
{
|
|
1456
1478
|
method: 'POST', path: '/console/oauth/token', section: 'developer-auth',
|
|
@@ -2869,65 +2891,6 @@ export const ROUTES = [
|
|
|
2869
2891
|
'owns them from then on. The plan itself keeps working on a billed org — a plan, an add-on or an override the operator sets here is ' +
|
|
2870
2892
|
'charged from the next renewal, except `enterprise` and `basic`, which the sweep cancels the billing account for instead.',
|
|
2871
2893
|
},
|
|
2872
|
-
/* --- operator admin API (fleetless/fleetless#268) -----------------------
|
|
2873
|
-
*
|
|
2874
|
-
* Every route below is `audience: 'internal'`, `section: 'org'` and
|
|
2875
|
-
* reachable only on the cloud's private admin listener, behind the
|
|
2876
|
-
* operator gate: with it off, each answers exactly what an unregistered
|
|
2877
|
-
* path answers, even for a perfectly valid assertion.
|
|
2878
|
-
*/
|
|
2879
|
-
{
|
|
2880
|
-
method: 'POST', path: '/api/admin/commands/noop', section: 'org',
|
|
2881
|
-
summary: 'Runs the no-op command: proves the preview-reason-execute protocol without changing anything.',
|
|
2882
|
-
audience: 'internal', auth: 'operator', rateLimited: true, ownerTier: false, status: 200,
|
|
2883
|
-
operator: { roles: OPERATOR_ROLES, confirmation: 'click' },
|
|
2884
|
-
params: [], query: null, request: noopCommandRequest, response: noopCommandResponse,
|
|
2885
|
-
errors: ['unauthorized', 'forbidden', 'not_found', 'validation_error', 'preview_stale', 'idempotency_key_reused', 'rate_limited'],
|
|
2886
|
-
transport: 'http',
|
|
2887
|
-
notes: 'Reachable only where the cloud enables it (`OPERATOR_NOOP_COMMAND=true`; refused in production). Proves the command path end to ' +
|
|
2888
|
-
'end without a real effect: a preview always answers one `keeps` effect, and an execute writes the operator audit plus an ' +
|
|
2889
|
-
'`operator.noop` row in the named org\'s audit, and nothing else. Every public host, and the private address while the operator ' +
|
|
2890
|
-
'API is not enabled, answers `404 not_found` for this path like any other unregistered one. A role the route does not list is ' +
|
|
2891
|
-
'refused with `403 forbidden`: a command says no where a read stays silent.',
|
|
2892
|
-
},
|
|
2893
|
-
{
|
|
2894
|
-
method: 'GET', path: '/api/admin/search', section: 'org',
|
|
2895
|
-
summary: 'Finds an org, person, invoice, payment or robot by a literal, case-insensitive match.',
|
|
2896
|
-
audience: 'internal', auth: 'operator', rateLimited: true, ownerTier: false, status: 200,
|
|
2897
|
-
operator: { roles: OPERATOR_ROLES },
|
|
2898
|
-
params: [], query: adminSearchQuery, request: null, response: adminSearchResponse,
|
|
2899
|
-
errors: ['unauthorized', 'not_found', 'validation_error', 'rate_limited'], transport: 'http',
|
|
2900
|
-
notes: '`q` is matched literally — `%`, `_` and `\\` carry no wildcard meaning — never as an `ILIKE` pattern, so a two-character query ' +
|
|
2901
|
-
'never dumps a table. At most `ADMIN_SEARCH_LIMIT` hits come back; `truncated` says whether more exist. A hit kind the caller\'s ' +
|
|
2902
|
-
'role may not see is left out rather than refused: `operator-support` gets no `invoice` or `payment` hits. Every public host, and ' +
|
|
2903
|
-
'the private address while the operator API is not enabled, answers `404 not_found` for this path. A role the route does not ' +
|
|
2904
|
-
'list gets that same `404 not_found`, so a read never reveals that it exists.',
|
|
2905
|
-
},
|
|
2906
|
-
{
|
|
2907
|
-
method: 'GET', path: '/api/admin/orgs/:id', section: 'org',
|
|
2908
|
-
summary: "Reads an org's detail as the operator: its owner, plan, billing state and counts.",
|
|
2909
|
-
audience: 'internal', auth: 'operator', rateLimited: true, ownerTier: false, status: 200,
|
|
2910
|
-
operator: { roles: OPERATOR_ROLES },
|
|
2911
|
-
params: [{ name: 'id', description: "The org's uuid, whose detail the operator is reading." }],
|
|
2912
|
-
query: null, request: null, response: adminOrgDetail,
|
|
2913
|
-
errors: ['unauthorized', 'not_found', 'rate_limited'], transport: 'http',
|
|
2914
|
-
notes: '`billing` carries the account\'s state and next charge only — never the payer, address or payment method. An unknown `:id` is ' +
|
|
2915
|
-
'`404 not_found`, the same every public host and the private address answer for this path while the operator API is not ' +
|
|
2916
|
-
'enabled. A role the route does not list gets that same `404 not_found`, so a read never reveals that it exists.',
|
|
2917
|
-
},
|
|
2918
|
-
{
|
|
2919
|
-
method: 'GET', path: '/api/admin/orgs/:id/usage', section: 'org',
|
|
2920
|
-
summary: "Reads what an org consumed per day, per app and per metric, as the operator.",
|
|
2921
|
-
audience: 'internal', auth: 'operator', rateLimited: true, ownerTier: false, status: 200,
|
|
2922
|
-
operator: { roles: OPERATOR_ROLES },
|
|
2923
|
-
params: [{ name: 'id', description: "The org's uuid, whose usage the operator is reading." }],
|
|
2924
|
-
query: orgUsageQuery, request: null, response: orgUsageResponse,
|
|
2925
|
-
errors: ['unauthorized', 'not_found', 'validation_error', 'rate_limited'], transport: 'http',
|
|
2926
|
-
notes: "Identical to `GET /api/org/usage` for the named org: the same window rule, the same `from_day <= to_day` cross-field check, and " +
|
|
2927
|
-
'the same echoed window. An unknown `:id` is `404 not_found`, the same every public host and the private address answer for ' +
|
|
2928
|
-
'this path while the operator API is not enabled. A role the route does not list gets that same `404 not_found`, so a read ' +
|
|
2929
|
-
'never reveals that it exists.',
|
|
2930
|
-
},
|
|
2931
2894
|
/* --- billing (2026-10-04, fleetless/fleetless#104) ----------------------
|
|
2932
2895
|
*
|
|
2933
2896
|
* Every route here but the webhook is owner-only (`ownerTier: true`), a
|
|
@@ -3136,16 +3099,3 @@ export const ROUTES = [
|
|
|
3136
3099
|
notes: 'Authentication happens in the first frame, not on the upgrade. The frame types are the `realtime` schemas.',
|
|
3137
3100
|
},
|
|
3138
3101
|
];
|
|
3139
|
-
/** Every `auth: 'operator'` route, keyed `METHOD path`, for `operatorAccess`. */
|
|
3140
|
-
const OPERATOR_ACCESS = new Map(ROUTES.filter((r) => r.auth === 'operator').map((r) => [`${r.method} ${r.path}`, r.operator]));
|
|
3141
|
-
/**
|
|
3142
|
-
* The roles (and, for a command, the confirmation level) a caller of this
|
|
3143
|
-
* operator route needs, looked up by method and path (fleetless/fleetless#268).
|
|
3144
|
-
* Throws for a route that is not `auth: 'operator'`.
|
|
3145
|
-
*/
|
|
3146
|
-
export function operatorAccess(method, path) {
|
|
3147
|
-
const access = OPERATOR_ACCESS.get(`${method} ${path}`);
|
|
3148
|
-
if (!access)
|
|
3149
|
-
throw new Error(`${method} ${path} is not an operator route`);
|
|
3150
|
-
return access;
|
|
3151
|
-
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fleetless/contracts",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.5.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",
|
|
@@ -62,6 +62,6 @@
|
|
|
62
62
|
"@types/node": "^26.2.0",
|
|
63
63
|
"tsx": "^4.19.0",
|
|
64
64
|
"typescript": "^5.7.0",
|
|
65
|
-
"vitest": "^
|
|
65
|
+
"vitest": "^4.1.11"
|
|
66
66
|
}
|
|
67
67
|
}
|