@fleetless/contracts 6.3.0 → 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.
@@ -0,0 +1,217 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ import { z } from 'zod';
3
+ /** The kinds `GET /api/admin/search` can answer today (fleetless/fleetless#268). A further kind joins the same union as its data arrives. */
4
+ export declare const ADMIN_SEARCH_KINDS: readonly ["org", "person", "invoice", "payment", "robot"];
5
+ /** The most hits one search answers; past it, `truncated` says so. */
6
+ export declare const ADMIN_SEARCH_LIMIT = 50;
7
+ export declare const adminSearchQuery: z.ZodObject<{
8
+ q: z.ZodString;
9
+ }, z.core.$strip>;
10
+ export type AdminSearchQuery = z.infer<typeof adminSearchQuery>;
11
+ /**
12
+ * One search result. `q` is matched literally, never as a wildcard pattern,
13
+ * and case-insensitively. A `payment` hit's `payment_id` is `null` for a
14
+ * `cst_` or `mdt_` match, which names the account and not a payment.
15
+ */
16
+ export declare const adminSearchHit: z.ZodDiscriminatedUnion<[z.ZodObject<{
17
+ kind: z.ZodLiteral<"org">;
18
+ org_id: z.ZodUUID;
19
+ name: z.ZodString;
20
+ }, z.core.$strip>, z.ZodObject<{
21
+ kind: z.ZodLiteral<"person">;
22
+ user_id: z.ZodUUID;
23
+ email: z.ZodString;
24
+ display_name: z.ZodNullable<z.ZodString>;
25
+ org_id: z.ZodUUID;
26
+ org_name: z.ZodString;
27
+ }, z.core.$strip>, z.ZodObject<{
28
+ kind: z.ZodLiteral<"invoice">;
29
+ invoice_id: z.ZodUUID;
30
+ number: z.ZodString;
31
+ org_id: z.ZodNullable<z.ZodUUID>;
32
+ org_name: z.ZodNullable<z.ZodString>;
33
+ }, z.core.$strip>, z.ZodObject<{
34
+ kind: z.ZodLiteral<"payment">;
35
+ payment_id: z.ZodNullable<z.ZodUUID>;
36
+ mollie_id: z.ZodString;
37
+ matched: z.ZodEnum<{
38
+ payment: "payment";
39
+ customer: "customer";
40
+ mandate: "mandate";
41
+ refund: "refund";
42
+ }>;
43
+ org_id: z.ZodUUID;
44
+ org_name: z.ZodString;
45
+ }, z.core.$strip>, z.ZodObject<{
46
+ kind: z.ZodLiteral<"robot">;
47
+ robot_id: z.ZodUUID;
48
+ name: z.ZodString;
49
+ org_id: z.ZodUUID;
50
+ org_name: z.ZodString;
51
+ }, z.core.$strip>], "kind">;
52
+ export type AdminSearchHit = z.infer<typeof adminSearchHit>;
53
+ export declare const adminSearchResponse: z.ZodObject<{
54
+ hits: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
55
+ kind: z.ZodLiteral<"org">;
56
+ org_id: z.ZodUUID;
57
+ name: z.ZodString;
58
+ }, z.core.$strip>, z.ZodObject<{
59
+ kind: z.ZodLiteral<"person">;
60
+ user_id: z.ZodUUID;
61
+ email: z.ZodString;
62
+ display_name: z.ZodNullable<z.ZodString>;
63
+ org_id: z.ZodUUID;
64
+ org_name: z.ZodString;
65
+ }, z.core.$strip>, z.ZodObject<{
66
+ kind: z.ZodLiteral<"invoice">;
67
+ invoice_id: z.ZodUUID;
68
+ number: z.ZodString;
69
+ org_id: z.ZodNullable<z.ZodUUID>;
70
+ org_name: z.ZodNullable<z.ZodString>;
71
+ }, z.core.$strip>, z.ZodObject<{
72
+ kind: z.ZodLiteral<"payment">;
73
+ payment_id: z.ZodNullable<z.ZodUUID>;
74
+ mollie_id: z.ZodString;
75
+ matched: z.ZodEnum<{
76
+ payment: "payment";
77
+ customer: "customer";
78
+ mandate: "mandate";
79
+ refund: "refund";
80
+ }>;
81
+ org_id: z.ZodUUID;
82
+ org_name: z.ZodString;
83
+ }, z.core.$strip>, z.ZodObject<{
84
+ kind: z.ZodLiteral<"robot">;
85
+ robot_id: z.ZodUUID;
86
+ name: z.ZodString;
87
+ org_id: z.ZodUUID;
88
+ org_name: z.ZodString;
89
+ }, z.core.$strip>], "kind">>;
90
+ truncated: z.ZodBoolean;
91
+ }, z.core.$strip>;
92
+ export type AdminSearchResponse = z.infer<typeof adminSearchResponse>;
93
+ /**
94
+ * `none` means no `billing_accounts` row; the other values mirror
95
+ * `billingAccountStatus`. The payer, address and payment method never
96
+ * appear here (fleetless/fleetless#268): support may see exactly this
97
+ * billing block, the status chip and next charge only.
98
+ */
99
+ export declare const adminOrgBillingState: z.ZodEnum<{
100
+ none: "none";
101
+ pending: "pending";
102
+ active: "active";
103
+ past_due: "past_due";
104
+ canceled: "canceled";
105
+ }>;
106
+ export type AdminOrgBillingState = z.infer<typeof adminOrgBillingState>;
107
+ /** `GET /api/admin/orgs/:id`'s response. Locks and plan changes travel in `plan`, which already carries them. */
108
+ export declare const adminOrgDetail: z.ZodObject<{
109
+ id: z.ZodUUID;
110
+ name: z.ZodString;
111
+ created_at: z.ZodISODateTime;
112
+ owner: z.ZodNullable<z.ZodObject<{
113
+ user_id: z.ZodUUID;
114
+ email: z.ZodString;
115
+ display_name: z.ZodNullable<z.ZodString>;
116
+ }, z.core.$strip>>;
117
+ plan: z.ZodObject<{
118
+ plan: z.ZodEnum<{
119
+ basic: "basic";
120
+ plus: "plus";
121
+ pro: "pro";
122
+ enterprise: "enterprise";
123
+ }>;
124
+ currency: z.ZodEnum<{
125
+ eur: "eur";
126
+ usd: "usd";
127
+ }>;
128
+ period_ends_at: z.ZodISODateTime;
129
+ addons: z.ZodObject<{
130
+ seats: z.ZodNumber;
131
+ robots: z.ZodNumber;
132
+ apps: z.ZodNumber;
133
+ app_user_packs: z.ZodNumber;
134
+ live_video_packs: z.ZodNumber;
135
+ }, z.core.$strip>;
136
+ limits: z.ZodObject<{
137
+ seats: z.ZodNullable<z.ZodNumber>;
138
+ robots: z.ZodNullable<z.ZodNumber>;
139
+ apps: z.ZodNullable<z.ZodNumber>;
140
+ app_users: z.ZodNullable<z.ZodNumber>;
141
+ live_video_ms_per_month: z.ZodNullable<z.ZodNumber>;
142
+ asset_bytes_per_robot: z.ZodNullable<z.ZodNumber>;
143
+ history_days: z.ZodNullable<z.ZodNumber>;
144
+ audit_days: z.ZodNullable<z.ZodNumber>;
145
+ }, z.core.$strip>;
146
+ features: z.ZodObject<{
147
+ app_mcp: z.ZodBoolean;
148
+ two_factor: z.ZodBoolean;
149
+ require_two_factor: z.ZodBoolean;
150
+ app_oidc: z.ZodBoolean;
151
+ hosted_logo: z.ZodBoolean;
152
+ audit_export: z.ZodBoolean;
153
+ addons: z.ZodBoolean;
154
+ }, z.core.$strip>;
155
+ usage: z.ZodObject<{
156
+ seats: z.ZodNumber;
157
+ robots: z.ZodNumber;
158
+ apps: z.ZodNumber;
159
+ app_users: z.ZodNumber;
160
+ live_video_ms_this_month: z.ZodNumber;
161
+ asset_bytes: z.ZodNumber;
162
+ }, z.core.$strip>;
163
+ pending_change: z.ZodNullable<z.ZodObject<{
164
+ target_plan: z.ZodEnum<{
165
+ basic: "basic";
166
+ plus: "plus";
167
+ pro: "pro";
168
+ enterprise: "enterprise";
169
+ }>;
170
+ reason: z.ZodEnum<{
171
+ downgrade: "downgrade";
172
+ cancel: "cancel";
173
+ migration: "migration";
174
+ lock: "lock";
175
+ }>;
176
+ effective_at: z.ZodNullable<z.ZodISODateTime>;
177
+ keep: z.ZodNullable<z.ZodObject<{
178
+ robots: z.ZodArray<z.ZodUUID>;
179
+ apps: z.ZodArray<z.ZodUUID>;
180
+ app_users: z.ZodArray<z.ZodUUID>;
181
+ developers: z.ZodArray<z.ZodUUID>;
182
+ }, z.core.$strict>>;
183
+ history_days_after: z.ZodNumber;
184
+ chosen_by: z.ZodUUID;
185
+ chosen_at: z.ZodISODateTime;
186
+ }, z.core.$strip>>;
187
+ lock: z.ZodNullable<z.ZodObject<{
188
+ reason: z.ZodEnum<{
189
+ migration: "migration";
190
+ payment: "payment";
191
+ }>;
192
+ since: z.ZodISODateTime;
193
+ }, z.core.$strip>>;
194
+ switch: z.ZodNullable<z.ZodObject<{
195
+ at: z.ZodNullable<z.ZodISODateTime>;
196
+ needs_choice: z.ZodBoolean;
197
+ }, z.core.$strip>>;
198
+ }, z.core.$strip>;
199
+ billing: z.ZodObject<{
200
+ state: z.ZodEnum<{
201
+ none: "none";
202
+ pending: "pending";
203
+ active: "active";
204
+ past_due: "past_due";
205
+ canceled: "canceled";
206
+ }>;
207
+ next_charge_at: z.ZodNullable<z.ZodISODateTime>;
208
+ }, z.core.$strip>;
209
+ counts: z.ZodObject<{
210
+ members: z.ZodNumber;
211
+ robots: z.ZodNumber;
212
+ robots_online: z.ZodNumber;
213
+ apps: z.ZodNumber;
214
+ }, z.core.$strip>;
215
+ last_activity_at: z.ZodNullable<z.ZodISODateTime>;
216
+ }, z.core.$strip>;
217
+ export type AdminOrgDetail = z.infer<typeof adminOrgDetail>;
package/dist/admin.js ADDED
@@ -0,0 +1,39 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ import { z } from 'zod';
3
+ import { orgPlan } from './plans.js';
4
+ /** The kinds `GET /api/admin/search` can answer today (fleetless/fleetless#268). A further kind joins the same union as its data arrives. */
5
+ export const ADMIN_SEARCH_KINDS = ['org', 'person', 'invoice', 'payment', 'robot'];
6
+ /** The most hits one search answers; past it, `truncated` says so. */
7
+ export const ADMIN_SEARCH_LIMIT = 50;
8
+ export const adminSearchQuery = z.object({ q: z.string().trim().min(2).max(200) });
9
+ /**
10
+ * One search result. `q` is matched literally, never as a wildcard pattern,
11
+ * and case-insensitively. A `payment` hit's `payment_id` is `null` for a
12
+ * `cst_` or `mdt_` match, which names the account and not a payment.
13
+ */
14
+ export const adminSearchHit = z.discriminatedUnion('kind', [
15
+ z.object({ kind: z.literal('org'), org_id: z.uuid(), name: z.string() }),
16
+ z.object({ kind: z.literal('person'), user_id: z.uuid(), email: z.string(), display_name: z.string().nullable(), org_id: z.uuid(), org_name: z.string() }),
17
+ z.object({ kind: z.literal('invoice'), invoice_id: z.uuid(), number: z.string(), org_id: z.uuid().nullable(), org_name: z.string().nullable() }),
18
+ z.object({ kind: z.literal('payment'), payment_id: z.uuid().nullable(), mollie_id: z.string(), matched: z.enum(['payment', 'customer', 'mandate', 'refund']), org_id: z.uuid(), org_name: z.string() }),
19
+ z.object({ kind: z.literal('robot'), robot_id: z.uuid(), name: z.string(), org_id: z.uuid(), org_name: z.string() }),
20
+ ]);
21
+ export const adminSearchResponse = z.object({ hits: z.array(adminSearchHit).max(ADMIN_SEARCH_LIMIT), truncated: z.boolean() });
22
+ /**
23
+ * `none` means no `billing_accounts` row; the other values mirror
24
+ * `billingAccountStatus`. The payer, address and payment method never
25
+ * appear here (fleetless/fleetless#268): support may see exactly this
26
+ * billing block, the status chip and next charge only.
27
+ */
28
+ export const adminOrgBillingState = z.enum(['none', 'pending', 'active', 'past_due', 'canceled']);
29
+ /** `GET /api/admin/orgs/:id`'s response. Locks and plan changes travel in `plan`, which already carries them. */
30
+ export const adminOrgDetail = z.object({
31
+ id: z.uuid(),
32
+ name: z.string(),
33
+ created_at: z.iso.datetime(),
34
+ owner: z.object({ user_id: z.uuid(), email: z.string(), display_name: z.string().nullable() }).nullable(),
35
+ plan: orgPlan,
36
+ billing: z.object({ state: adminOrgBillingState, next_charge_at: z.iso.datetime().nullable() }),
37
+ counts: z.object({ members: z.number().int().min(0), robots: z.number().int().min(0), robots_online: z.number().int().min(0), apps: z.number().int().min(0) }),
38
+ last_activity_at: z.iso.datetime().nullable(),
39
+ });
@@ -62,8 +62,8 @@ export declare const providerSlug: z.ZodString;
62
62
  * mailed token, which is why `patchAppUserRequest` cannot set it: see there.
63
63
  */
64
64
  export declare const appUserStatus: z.ZodEnum<{
65
- pending_verification: "pending_verification";
66
65
  active: "active";
66
+ pending_verification: "pending_verification";
67
67
  blocked: "blocked";
68
68
  }>;
69
69
  export type AppUserStatus = z.infer<typeof appUserStatus>;
@@ -80,8 +80,8 @@ export declare const appUser: z.ZodObject<{
80
80
  display_name: z.ZodNullable<z.ZodString>;
81
81
  role_id: z.ZodUUID;
82
82
  status: z.ZodEnum<{
83
- pending_verification: "pending_verification";
84
83
  active: "active";
84
+ pending_verification: "pending_verification";
85
85
  blocked: "blocked";
86
86
  }>;
87
87
  has_password: z.ZodBoolean;
@@ -104,8 +104,8 @@ export declare const appUserListResponse: z.ZodObject<{
104
104
  display_name: z.ZodNullable<z.ZodString>;
105
105
  role_id: z.ZodUUID;
106
106
  status: z.ZodEnum<{
107
- pending_verification: "pending_verification";
108
107
  active: "active";
108
+ pending_verification: "pending_verification";
109
109
  blocked: "blocked";
110
110
  }>;
111
111
  has_password: z.ZodBoolean;
package/dist/billing.d.ts CHANGED
@@ -26,8 +26,8 @@ export declare function isEuCountry(country: string): boolean;
26
26
  export declare function currencyForCountry(country: string): PlanCurrency;
27
27
  /** Who is paying: a company (may hold a VAT ID) or a person (a full name, never a VAT ID). */
28
28
  export declare const payerKind: z.ZodEnum<{
29
- company: "company";
30
29
  person: "person";
30
+ company: "company";
31
31
  }>;
32
32
  export type PayerKind = z.infer<typeof payerKind>;
33
33
  /** The billing cycle: monthly, or yearly at twelve months for 15 % off (#103). */
@@ -295,16 +295,16 @@ export type CheckoutResponse = z.infer<typeof checkoutResponse>;
295
295
  export declare const checkoutStatus: z.ZodObject<{
296
296
  checkout_id: z.ZodUUID;
297
297
  status: z.ZodEnum<{
298
- failed: "failed";
299
298
  pending: "pending";
300
- paid: "paid";
301
299
  canceled: "canceled";
300
+ failed: "failed";
301
+ paid: "paid";
302
302
  expired: "expired";
303
303
  }>;
304
304
  purpose: z.ZodEnum<{
305
+ invoice: "invoice";
305
306
  upgrade: "upgrade";
306
307
  payment_method: "payment_method";
307
- invoice: "invoice";
308
308
  }>;
309
309
  plan: z.ZodEnum<{
310
310
  basic: "basic";
@@ -397,10 +397,10 @@ export declare const paymentMethodChangeRequest: z.ZodObject<{
397
397
  export type PaymentMethodChangeRequest = z.infer<typeof paymentMethodChangeRequest>;
398
398
  /** The billing account's own status, distinct from the org's plan: `billing_accounts` holds no plan, currency or period of its own. */
399
399
  export declare const billingAccountStatus: z.ZodEnum<{
400
- active: "active";
401
400
  pending: "pending";
402
- canceled: "canceled";
401
+ active: "active";
403
402
  past_due: "past_due";
403
+ canceled: "canceled";
404
404
  }>;
405
405
  export type BillingAccountStatus = z.infer<typeof billingAccountStatus>;
406
406
  /** The payment method on file, read from the active Mollie mandate — never a card or bank number, only its display fields. */
@@ -500,10 +500,10 @@ export declare const billingAccount: z.ZodObject<{
500
500
  yearly: "yearly";
501
501
  }>;
502
502
  status: z.ZodEnum<{
503
- active: "active";
504
503
  pending: "pending";
505
- canceled: "canceled";
504
+ active: "active";
506
505
  past_due: "past_due";
506
+ canceled: "canceled";
507
507
  }>;
508
508
  period_starts_at: z.ZodNullable<z.ZodISODateTime>;
509
509
  period_ends_at: z.ZodNullable<z.ZodISODateTime>;
@@ -586,10 +586,10 @@ export declare const billingView: z.ZodObject<{
586
586
  yearly: "yearly";
587
587
  }>;
588
588
  status: z.ZodEnum<{
589
- active: "active";
590
589
  pending: "pending";
591
- canceled: "canceled";
590
+ active: "active";
592
591
  past_due: "past_due";
592
+ canceled: "canceled";
593
593
  }>;
594
594
  period_starts_at: z.ZodNullable<z.ZodISODateTime>;
595
595
  period_ends_at: z.ZodNullable<z.ZodISODateTime>;
@@ -714,10 +714,10 @@ export declare const billingChangeResponse: z.ZodObject<{
714
714
  yearly: "yearly";
715
715
  }>;
716
716
  status: z.ZodEnum<{
717
- active: "active";
718
717
  pending: "pending";
719
- canceled: "canceled";
718
+ active: "active";
720
719
  past_due: "past_due";
720
+ canceled: "canceled";
721
721
  }>;
722
722
  period_starts_at: z.ZodNullable<z.ZodISODateTime>;
723
723
  period_ends_at: z.ZodNullable<z.ZodISODateTime>;
package/dist/errors.d.ts CHANGED
@@ -87,9 +87,9 @@ export type InvalidCodeDetails = z.infer<typeof invalidCodeDetails>;
87
87
  */
88
88
  export declare const planLimitDetails: z.ZodObject<{
89
89
  limit: z.ZodEnum<{
90
- apps: "apps";
91
90
  seats: "seats";
92
91
  robots: "robots";
92
+ apps: "apps";
93
93
  app_users: "app_users";
94
94
  live_video_ms_per_month: "live_video_ms_per_month";
95
95
  asset_bytes_per_robot: "asset_bytes_per_robot";
@@ -110,9 +110,9 @@ export declare const planLimitDetails: z.ZodObject<{
110
110
  enterprise: "enterprise";
111
111
  }>>;
112
112
  addon: z.ZodNullable<z.ZodEnum<{
113
- apps: "apps";
114
113
  seats: "seats";
115
114
  robots: "robots";
115
+ apps: "apps";
116
116
  app_user_packs: "app_user_packs";
117
117
  live_video_packs: "live_video_packs";
118
118
  }>>;
@@ -141,9 +141,9 @@ export type PlanLimitDetails = z.infer<typeof planLimitDetails>;
141
141
  */
142
142
  export declare const assetPlanLimitDetails: z.ZodObject<{
143
143
  limit: z.ZodEnum<{
144
- apps: "apps";
145
144
  seats: "seats";
146
145
  robots: "robots";
146
+ apps: "apps";
147
147
  app_users: "app_users";
148
148
  live_video_ms_per_month: "live_video_ms_per_month";
149
149
  asset_bytes_per_robot: "asset_bytes_per_robot";
@@ -164,9 +164,9 @@ export declare const assetPlanLimitDetails: z.ZodObject<{
164
164
  enterprise: "enterprise";
165
165
  }>>;
166
166
  addon: z.ZodNullable<z.ZodEnum<{
167
- apps: "apps";
168
167
  seats: "seats";
169
168
  robots: "robots";
169
+ apps: "apps";
170
170
  app_user_packs: "app_user_packs";
171
171
  live_video_packs: "live_video_packs";
172
172
  }>>;
@@ -179,9 +179,9 @@ export type AssetPlanLimitDetails = z.infer<typeof assetPlanLimitDetails>;
179
179
  /** The `details` of a `403 plan_required` refusal: the feature, the org's own plan, and the cheapest plan that has it (`requiredPlanFor`). */
180
180
  export declare const planRequiredDetails: z.ZodObject<{
181
181
  feature: z.ZodEnum<{
182
- require_two_factor: "require_two_factor";
183
- two_factor: "two_factor";
184
182
  app_mcp: "app_mcp";
183
+ two_factor: "two_factor";
184
+ require_two_factor: "require_two_factor";
185
185
  app_oidc: "app_oidc";
186
186
  hosted_logo: "hosted_logo";
187
187
  audit_export: "audit_export";
@@ -242,5 +242,5 @@ export type PaymentProviderUnavailableDetails = z.infer<typeof paymentProviderUn
242
242
  * list is the shared vocabulary, not a closed set, so a new refusal never
243
243
  * needs a contracts release before it can be reported honestly.
244
244
  */
245
- export declare const ERROR_CODES: readonly ["not_found", "validation_error", "bad_request", "unknown_datapoint", "invalid_token", "protocol_mismatch", "bridge_too_old", "invalid_frame", "duplicate_slug", "reserved_slug", "unknown_slug", "unknown_field_path", "unknown_type", "unknown_topic", "invalid_rate", "invalid_range", "config_conflict", "no_data", "robot_offline", "bridge_timeout", "unauthorized", "forbidden", "invalid_credentials", "token_expired", "token_revoked", "email_taken", "identifier_taken", "weak_password", "account_blocked", "busy", "parameter_invalid", "cancel_rejected", "job_lost", "job_unknown_to_bridge", "action_server_lost", "action_failed", "goal_rejected", "goal_send_failed", "result_failed", "goal_uncontrollable", "bridge_disconnected", "config_changed", "publisher_busy", "unknown_command", "not_subscribable", "camera_offline", "no_snapshot_yet", "live_unavailable", "wrong_kind", "not_recorded", "not_aggregatable", "quota_exceeded", "credential_in_use", "goal_timeout", "robot_in_use", "robot_deletion_partial", "job_queue_full", "invalid_uuid", "rate_limited", "tier_required", "token_spent", "service_timeout", "asset_missing", "dynamic_registration_disabled", "client_limit_reached", "idp_unavailable", "mcp_disabled", "tool_not_available", "capability_required", "last_owner", "role_name_taken", "role_in_use", "last_role", "target_state_conflict", "signup_closed", "draft_not_a_document", "internal_error", "not_cancellable", "unsupported_media_type", "wrong_browser", "invalid_yaml", "unstorable_yaml", "registration_closed", "domain_not_allowed", "email_unverified", "origin_not_allowed", "template_invalid", "provider_disabled", "provider_misconfigured", "invalid_redirect_uri", "interaction_expired", "invalid_code", "method_not_allowed", "plan_limit", "plan_required", "org_locked", "file_too_large", "billing_unavailable", "payment_provider_unavailable", "history_migrating"];
245
+ export declare const ERROR_CODES: readonly ["not_found", "validation_error", "bad_request", "unknown_datapoint", "invalid_token", "protocol_mismatch", "bridge_too_old", "invalid_frame", "duplicate_slug", "reserved_slug", "unknown_slug", "unknown_field_path", "unknown_type", "unknown_topic", "invalid_rate", "invalid_range", "config_conflict", "no_data", "robot_offline", "bridge_timeout", "unauthorized", "forbidden", "invalid_credentials", "token_expired", "token_revoked", "email_taken", "identifier_taken", "weak_password", "account_blocked", "busy", "parameter_invalid", "cancel_rejected", "job_lost", "job_unknown_to_bridge", "action_server_lost", "action_failed", "goal_rejected", "goal_send_failed", "result_failed", "goal_uncontrollable", "bridge_disconnected", "config_changed", "publisher_busy", "unknown_command", "not_subscribable", "camera_offline", "no_snapshot_yet", "live_unavailable", "wrong_kind", "not_recorded", "not_aggregatable", "quota_exceeded", "credential_in_use", "goal_timeout", "robot_in_use", "robot_deletion_partial", "job_queue_full", "invalid_uuid", "rate_limited", "tier_required", "token_spent", "service_timeout", "asset_missing", "dynamic_registration_disabled", "client_limit_reached", "idp_unavailable", "mcp_disabled", "tool_not_available", "capability_required", "last_owner", "role_name_taken", "role_in_use", "last_role", "target_state_conflict", "signup_closed", "draft_not_a_document", "internal_error", "not_cancellable", "unsupported_media_type", "wrong_browser", "invalid_yaml", "unstorable_yaml", "registration_closed", "domain_not_allowed", "email_unverified", "origin_not_allowed", "template_invalid", "provider_disabled", "provider_misconfigured", "invalid_redirect_uri", "interaction_expired", "invalid_code", "method_not_allowed", "plan_limit", "plan_required", "org_locked", "file_too_large", "billing_unavailable", "payment_provider_unavailable", "history_migrating", "preview_stale", "idempotency_key_reused"];
246
246
  export type ErrorCode = (typeof ERROR_CODES)[number];
package/dist/errors.js CHANGED
@@ -1069,4 +1069,18 @@ export const ERROR_CODES = [
1069
1069
  * finished. Retry later; nothing in the request needs to change.
1070
1070
  */
1071
1071
  'history_migrating',
1072
+ // 2026-10 — the operator's admin API (fleetless/fleetless#268).
1073
+ /**
1074
+ * `409`: an execute named a preview that is no longer true — the state it
1075
+ * read has changed, or it is older than ten minutes. Nothing was done.
1076
+ * `details` (`previewStaleDetails`) carries a fresh preview and its token;
1077
+ * confirm that one instead.
1078
+ */
1079
+ 'preview_stale',
1080
+ /**
1081
+ * `409`: the `idempotency_key` was already used for a different command,
1082
+ * input or operator. Nothing was done. A retry of the same execute reuses
1083
+ * its key and gets the first answer; anything else needs a new key.
1084
+ */
1085
+ 'idempotency_key_reused',
1072
1086
  ];
package/dist/index.d.ts CHANGED
@@ -51,8 +51,14 @@ export { apiError, parameterViolation, parameterInvalidDetails, cancelRejectedDe
51
51
  export type { ApiError, ParameterViolation, ParameterInvalidDetails, CancelRejectedDetails, InvalidCodeDetails, ErrorCode, PlanLimitDetails, AssetPlanLimitDetails, PlanRequiredDetails, OrgLockedDetails, FileTooLargeDetails, PaymentProviderUnavailableDetails, } from './errors.js';
52
52
  export { oauthErrorCode, oauthError, oauthRedirectResponse, oauthCodeTokenRequest, oauthRefreshTokenRequest, oauthTokenRequest, oauthTokenResponse, redirectUri, codeChallengeMethod, oauthAuthorizeQuery, dynamicClientRegistrationRequest, MCP_DCR_MAX_REDIRECT_URIS, dynamicClientRegistrationResponse, authorizationServerMetadata, protectedResourceMetadata, } from './oauth.js';
53
53
  export type { OauthErrorCode, OauthError, OauthRedirectResponse, OauthCodeTokenRequest, OauthRefreshTokenRequest, OauthTokenRequest, OauthTokenResponse, RedirectUri, OauthAuthorizeQuery, DynamicClientRegistrationRequest, DynamicClientRegistrationResponse, AuthorizationServerMetadata, ProtectedResourceMetadata, } from './oauth.js';
54
- export { ROUTES, ROUTE_SECTIONS, IN_HANDLER_ROUTES, developerSignInRoutes } from './routes.js';
55
- export type { RouteEntry, RouteParam, RouteAudience, RouteAuth, RouteSection, RouteMethod, RouteTransport, } from './routes.js';
54
+ export { ROUTES, ROUTE_SECTIONS, IN_HANDLER_ROUTES, developerSignInRoutes, operatorAccess } from './routes.js';
55
+ export type { RouteEntry, RouteParam, RouteAudience, RouteAuth, RouteSection, RouteMethod, RouteTransport, RouteOperatorAccess, } from './routes.js';
56
+ export { OPERATOR_ROLES, operatorRole, CONFIRMATION_LEVELS, confirmationLevel, OPERATOR_ASSERTION_ISSUER, OPERATOR_AUTH_SCHEME, OPERATOR_ASSERTION_MAX_LIFETIME_SECONDS, OPERATOR_ASSERTION_MAX_FUTURE_SKEW_SECONDS, OPERATOR_ASSERTION_REPLAY_WINDOW_SECONDS, OPERATOR_REASON_MIN_LENGTH, OPERATOR_REASON_MAX_LENGTH, OPERATOR_PREVIEW_MAX_AGE_MS, operatorAssertionClaims, } from './operator.js';
57
+ export type { OperatorRole, ConfirmationLevel, OperatorAssertionClaims, } from './operator.js';
58
+ export { previewEffect, operatorPreview, operatorCommandRequest, operatorAuditRef, operatorCommandResponse, previewStaleDetails, noopCommandInput, noopCommandResult, noopCommandRequest, noopCommandResponse, } from './operator-commands.js';
59
+ export type { PreviewEffect, OperatorPreview, OperatorAuditRef, PreviewStaleDetails, NoopCommandInput, NoopCommandResult, } from './operator-commands.js';
60
+ export { ADMIN_SEARCH_KINDS, ADMIN_SEARCH_LIMIT, adminSearchQuery, adminSearchHit, adminSearchResponse, adminOrgBillingState, adminOrgDetail, } from './admin.js';
61
+ export type { AdminSearchQuery, AdminSearchHit, AdminSearchResponse, AdminOrgBillingState, AdminOrgDetail, } from './admin.js';
56
62
  export { planId, PLAN_ORDER, planLimitKey, planLimits, planFeature, planFeatures, planPrices, planSupport, planCatalogueEntry, addonKey, addonCatalogueEntry, usdCentsFromEurCents, yearlyEurCents, pricesFromEurMonth, PLANS, ADDONS, requiredPlanFor, nextPlanRaising, } from './plans.js';
57
63
  export type { PlanId, PlanLimitKey, PlanLimits, PlanFeature, PlanFeatures, PlanPrices, PlanSupport, PlanCatalogueEntry, AddonKey, AddonCatalogueEntry, } from './plans.js';
58
64
  export { planCurrency, orgAddons, orgPlanUsage, planChangeKeep, planChangeReason, pendingPlanChange, orgLock, orgPlan, planChangeRequest, planOverrides, adminPlanChangeRequest, } from './plans.js';
package/dist/index.js CHANGED
@@ -60,7 +60,11 @@ fileTooLargeDetails,
60
60
  // 2026-10-04 — billing through Mollie (#104).
61
61
  paymentProviderUnavailableDetails, } from './errors.js';
62
62
  export { oauthErrorCode, oauthError, oauthRedirectResponse, oauthCodeTokenRequest, oauthRefreshTokenRequest, oauthTokenRequest, oauthTokenResponse, redirectUri, codeChallengeMethod, oauthAuthorizeQuery, dynamicClientRegistrationRequest, MCP_DCR_MAX_REDIRECT_URIS, dynamicClientRegistrationResponse, authorizationServerMetadata, protectedResourceMetadata, } from './oauth.js';
63
- export { ROUTES, ROUTE_SECTIONS, IN_HANDLER_ROUTES, developerSignInRoutes } from './routes.js';
63
+ export { ROUTES, ROUTE_SECTIONS, IN_HANDLER_ROUTES, developerSignInRoutes, operatorAccess } from './routes.js';
64
+ // fleetless/fleetless#268 — the operator platform's admin API foundation.
65
+ export { OPERATOR_ROLES, operatorRole, CONFIRMATION_LEVELS, confirmationLevel, OPERATOR_ASSERTION_ISSUER, OPERATOR_AUTH_SCHEME, OPERATOR_ASSERTION_MAX_LIFETIME_SECONDS, OPERATOR_ASSERTION_MAX_FUTURE_SKEW_SECONDS, OPERATOR_ASSERTION_REPLAY_WINDOW_SECONDS, OPERATOR_REASON_MIN_LENGTH, OPERATOR_REASON_MAX_LENGTH, OPERATOR_PREVIEW_MAX_AGE_MS, operatorAssertionClaims, } from './operator.js';
66
+ export { previewEffect, operatorPreview, operatorCommandRequest, operatorAuditRef, operatorCommandResponse, previewStaleDetails, noopCommandInput, noopCommandResult, noopCommandRequest, noopCommandResponse, } from './operator-commands.js';
67
+ export { ADMIN_SEARCH_KINDS, ADMIN_SEARCH_LIMIT, adminSearchQuery, adminSearchHit, adminSearchResponse, adminOrgBillingState, adminOrgDetail, } from './admin.js';
64
68
  // 2026-10-02 — plans (#103). The catalogue (I-1) only: `PLANS` and `ADDONS`
65
69
  // are deliberately not constants exports (`constants.json` is vendored by
66
70
  // the bridge and must stay unchanged) but are exported values of this
@@ -0,0 +1,137 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ import { z, type ZodType } from 'zod';
3
+ /**
4
+ * One line of a command's preview (fleetless/fleetless#268): `changes`
5
+ * moves a value from `from` to `to`, `triggers` sets something off (a mail,
6
+ * a refund, a document), `keeps` states that something explicitly stays as
7
+ * it is.
8
+ */
9
+ export declare const previewEffect: z.ZodObject<{
10
+ kind: z.ZodEnum<{
11
+ changes: "changes";
12
+ triggers: "triggers";
13
+ keeps: "keeps";
14
+ }>;
15
+ label: z.ZodString;
16
+ from: z.ZodOptional<z.ZodNullable<z.ZodString>>;
17
+ to: z.ZodOptional<z.ZodNullable<z.ZodString>>;
18
+ amount_cents: z.ZodOptional<z.ZodNumber>;
19
+ }, z.core.$strip>;
20
+ export type PreviewEffect = z.infer<typeof previewEffect>;
21
+ /** What a command's preview answers before an execute: at least one effect. */
22
+ export declare const operatorPreview: z.ZodObject<{
23
+ effects: z.ZodArray<z.ZodObject<{
24
+ kind: z.ZodEnum<{
25
+ changes: "changes";
26
+ triggers: "triggers";
27
+ keeps: "keeps";
28
+ }>;
29
+ label: z.ZodString;
30
+ from: z.ZodOptional<z.ZodNullable<z.ZodString>>;
31
+ to: z.ZodOptional<z.ZodNullable<z.ZodString>>;
32
+ amount_cents: z.ZodOptional<z.ZodNumber>;
33
+ }, z.core.$strip>>;
34
+ }, z.core.$strip>;
35
+ export type OperatorPreview = z.infer<typeof operatorPreview>;
36
+ /**
37
+ * The request body of an operator command, parameterised over its own
38
+ * input shape: a `preview` that only reads, or an `execute` that carries the
39
+ * reason, the preview it confirms and a replay key (fleetless/fleetless#268).
40
+ */
41
+ export declare function operatorCommandRequest<I extends ZodType>(input: I): z.ZodDiscriminatedUnion<[z.ZodObject<{
42
+ mode: z.ZodLiteral<"preview">;
43
+ input: I;
44
+ }, z.core.$strip>, z.ZodObject<{
45
+ mode: z.ZodLiteral<"execute">;
46
+ input: I;
47
+ reason: z.ZodString;
48
+ preview_token: z.ZodString;
49
+ idempotency_key: z.ZodUUID;
50
+ }, z.core.$strip>], "mode">;
51
+ /** The audit rows a command's execute wrote: the operator audit always, the org's audit when the command named one. */
52
+ export declare const operatorAuditRef: z.ZodObject<{
53
+ operator_audit: z.ZodUUID;
54
+ org_audit: z.ZodNullable<z.ZodUUID>;
55
+ }, z.core.$strip>;
56
+ export type OperatorAuditRef = z.infer<typeof operatorAuditRef>;
57
+ /**
58
+ * The response of an operator command, parameterised over its preview and
59
+ * result shapes: a preview mode answers `preview` and a token to confirm it
60
+ * with; an execute answers `result` and the audit rows it wrote.
61
+ */
62
+ export declare function operatorCommandResponse<P extends ZodType, R extends ZodType>(preview: P, result: R): z.ZodUnion<readonly [z.ZodObject<{
63
+ preview: P;
64
+ preview_token: z.ZodString;
65
+ }, z.core.$strip>, z.ZodObject<{
66
+ result: R;
67
+ audit_ref: z.ZodObject<{
68
+ operator_audit: z.ZodUUID;
69
+ org_audit: z.ZodNullable<z.ZodUUID>;
70
+ }, z.core.$strip>;
71
+ }, z.core.$strip>]>;
72
+ /** `409 preview_stale`'s `details`: a fresh preview and its token, to confirm instead. */
73
+ export declare const previewStaleDetails: z.ZodObject<{
74
+ preview: z.ZodObject<{
75
+ effects: z.ZodArray<z.ZodObject<{
76
+ kind: z.ZodEnum<{
77
+ changes: "changes";
78
+ triggers: "triggers";
79
+ keeps: "keeps";
80
+ }>;
81
+ label: z.ZodString;
82
+ from: z.ZodOptional<z.ZodNullable<z.ZodString>>;
83
+ to: z.ZodOptional<z.ZodNullable<z.ZodString>>;
84
+ amount_cents: z.ZodOptional<z.ZodNumber>;
85
+ }, z.core.$strip>>;
86
+ }, z.core.$strip>;
87
+ preview_token: z.ZodString;
88
+ }, z.core.$strip>;
89
+ export type PreviewStaleDetails = z.infer<typeof previewStaleDetails>;
90
+ /** The no-op command's input: the org whose audit the row proves the protocol against. */
91
+ export declare const noopCommandInput: z.ZodObject<{
92
+ org_id: z.ZodUUID;
93
+ }, z.core.$strip>;
94
+ export type NoopCommandInput = z.infer<typeof noopCommandInput>;
95
+ /** The no-op command's result: it changes nothing, always. */
96
+ export declare const noopCommandResult: z.ZodObject<{
97
+ changed: z.ZodLiteral<false>;
98
+ }, z.core.$strip>;
99
+ export type NoopCommandResult = z.infer<typeof noopCommandResult>;
100
+ export declare const noopCommandRequest: z.ZodDiscriminatedUnion<[z.ZodObject<{
101
+ mode: z.ZodLiteral<"preview">;
102
+ input: z.ZodObject<{
103
+ org_id: z.ZodUUID;
104
+ }, z.core.$strip>;
105
+ }, z.core.$strip>, z.ZodObject<{
106
+ mode: z.ZodLiteral<"execute">;
107
+ input: z.ZodObject<{
108
+ org_id: z.ZodUUID;
109
+ }, z.core.$strip>;
110
+ reason: z.ZodString;
111
+ preview_token: z.ZodString;
112
+ idempotency_key: z.ZodUUID;
113
+ }, z.core.$strip>], "mode">;
114
+ export declare const noopCommandResponse: z.ZodUnion<readonly [z.ZodObject<{
115
+ preview: z.ZodObject<{
116
+ effects: z.ZodArray<z.ZodObject<{
117
+ kind: z.ZodEnum<{
118
+ changes: "changes";
119
+ triggers: "triggers";
120
+ keeps: "keeps";
121
+ }>;
122
+ label: z.ZodString;
123
+ from: z.ZodOptional<z.ZodNullable<z.ZodString>>;
124
+ to: z.ZodOptional<z.ZodNullable<z.ZodString>>;
125
+ amount_cents: z.ZodOptional<z.ZodNumber>;
126
+ }, z.core.$strip>>;
127
+ }, z.core.$strip>;
128
+ preview_token: z.ZodString;
129
+ }, z.core.$strip>, z.ZodObject<{
130
+ result: z.ZodObject<{
131
+ changed: z.ZodLiteral<false>;
132
+ }, z.core.$strip>;
133
+ audit_ref: z.ZodObject<{
134
+ operator_audit: z.ZodUUID;
135
+ org_audit: z.ZodNullable<z.ZodUUID>;
136
+ }, z.core.$strip>;
137
+ }, z.core.$strip>]>;