@fleetless/contracts 6.3.0-next.5 → 6.4.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +79 -0
- package/CONTRIBUTING.md +4 -4
- package/artifacts/openapi.json +4386 -1883
- package/artifacts/routes.json +461 -2
- package/artifacts/schema/admin-org-detail.schema.json +641 -0
- package/artifacts/schema/admin-search-query.schema.json +14 -0
- package/artifacts/schema/admin-search-response.schema.json +219 -0
- package/artifacts/schema/billing-address.schema.json +49 -0
- package/artifacts/schema/billing-cancel-request.schema.json +12 -0
- package/artifacts/schema/billing-change-request.schema.json +60 -0
- package/artifacts/schema/billing-change-response.schema.json +799 -0
- package/artifacts/schema/billing-details-update.schema.json +25 -0
- package/artifacts/schema/billing-details.schema.json +176 -0
- package/artifacts/schema/billing-invoice.schema.json +76 -0
- package/artifacts/schema/billing-view.schema.json +705 -0
- package/artifacts/schema/checkout-request.schema.json +252 -0
- package/artifacts/schema/checkout-response.schema.json +22 -0
- package/artifacts/schema/checkout-status.schema.json +49 -0
- package/artifacts/schema/noop-command-request.schema.json +75 -0
- package/artifacts/schema/noop-command-response.schema.json +134 -0
- package/artifacts/schema/operator-audit-ref.schema.json +28 -0
- package/artifacts/schema/operator-preview.schema.json +66 -0
- package/artifacts/schema/payment-method-change-request.schema.json +19 -0
- package/artifacts/schema/payment-method.schema.json +86 -0
- package/artifacts/schema/payment-provider-unavailable-details.schema.json +29 -0
- package/artifacts/schema/preview-stale-details.schema.json +80 -0
- package/artifacts/schema/vat-id-check-request.schema.json +22 -0
- package/artifacts/schema/vat-id-check-response.schema.json +36 -0
- package/dist/admin.d.ts +217 -0
- package/dist/admin.js +39 -0
- package/dist/app-users.d.ts +3 -3
- package/dist/billing.d.ts +812 -0
- package/dist/billing.js +471 -0
- package/dist/errors.d.ts +23 -11
- package/dist/errors.js +47 -0
- package/dist/index.d.ts +12 -4
- package/dist/index.js +10 -2
- package/dist/operator-commands.d.ts +137 -0
- package/dist/operator-commands.js +51 -0
- package/dist/operator.d.ts +63 -0
- package/dist/operator.js +48 -0
- package/dist/plans.d.ts +25 -25
- package/dist/realtime.d.ts +2 -2
- package/dist/rest.d.ts +3 -3
- package/dist/routes.d.ts +21 -2
- package/dist/routes.js +270 -4
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -47,13 +47,21 @@ export { auditActor, auditEvent, auditQuery, auditListResponse, AUDIT_CSV_COLUMN
|
|
|
47
47
|
export type { AuditActor, AuditEvent, AuditQuery, AuditListResponse } from './audit.js';
|
|
48
48
|
export { alertRowCondition, alertSeverity, alertState, datapointAlertRow, alertListResponse, orgFiringAlertsResponse, orgAlertsQuery, datapointDisplay, putDatapointDisplayRequest, } from './alerts.js';
|
|
49
49
|
export type { AlertRowCondition, AlertSeverity, AlertState, DatapointAlertRow, AlertListResponse, OrgFiringAlertsResponse, OrgAlertsQuery, DatapointDisplay, PutDatapointDisplayRequest, } from './alerts.js';
|
|
50
|
-
export { apiError, parameterViolation, parameterInvalidDetails, cancelRejectedDetails, invalidCodeDetails, ERROR_CODES, planLimitDetails, assetPlanLimitDetails, planRequiredDetails, orgLockedDetails, fileTooLargeDetails, } from './errors.js';
|
|
51
|
-
export type { ApiError, ParameterViolation, ParameterInvalidDetails, CancelRejectedDetails, InvalidCodeDetails, ErrorCode, PlanLimitDetails, AssetPlanLimitDetails, PlanRequiredDetails, OrgLockedDetails, FileTooLargeDetails, } from './errors.js';
|
|
50
|
+
export { apiError, parameterViolation, parameterInvalidDetails, cancelRejectedDetails, invalidCodeDetails, ERROR_CODES, planLimitDetails, assetPlanLimitDetails, planRequiredDetails, orgLockedDetails, fileTooLargeDetails, paymentProviderUnavailableDetails, } from './errors.js';
|
|
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';
|
|
59
65
|
export type { PlanCurrency, OrgAddons, OrgPlanUsage, PlanChangeKeep, PlanChangeReason, PendingPlanChange, OrgLock, OrgPlan, PlanChangeRequest, PlanOverrides, AdminPlanChangeRequest, } from './plans.js';
|
|
66
|
+
export { countryCode, EU_COUNTRIES, SELLER_COUNTRY, DE_VAT_RATE_PERCENT, isEuCountry, currencyForCountry, payerKind, billingCycle, vatTreatment, payerRefusalRule, vatFor, viesCountry, normalizeVatId, periodNetCents, prorateCents, vatCents, chargeAmounts, DAY_MS, periodDays, remainingDays, changeNetCents, checkoutQuote, BILLING_RETRY_DAYS, BILLING_LOCK_DAY, billingAddress, billingDetails, checkoutRequest, checkoutResponse, checkoutStatus, vatIdStatus, vatIdCheckRequest, vatIdCheckResponse, billingChangeRequest, billingCancelRequest, billingDetailsUpdate, paymentMethodKind, paymentMethodChangeRequest, billingAccountStatus, paymentMethod, invoiceStatus, billingInvoice, billingAccount, billingView, billingChangeResponse, } from './billing.js';
|
|
67
|
+
export type { PayerKind, BillingCycle, VatTreatment, PayerRefusalRule, VatDecision, ChargeAmounts, BillingState, QuoteLine, CheckoutQuote, BillingAddress, BillingDetails, CheckoutRequest, CheckoutResponse, CheckoutStatus, VatIdStatus, VatIdCheckRequest, VatIdCheckResponse, BillingChangeRequest, BillingCancelRequest, BillingDetailsUpdate, PaymentMethodKind, PaymentMethodChangeRequest, BillingAccountStatus, PaymentMethod, InvoiceStatus, BillingInvoice, BillingAccount, BillingView, BillingChangeResponse, } from './billing.js';
|
package/dist/index.js
CHANGED
|
@@ -56,9 +56,15 @@ export { apiError, parameterViolation, parameterInvalidDetails, cancelRejectedDe
|
|
|
56
56
|
// 2026-10-02 — plans (#103). The plan errors (I-3).
|
|
57
57
|
planLimitDetails, assetPlanLimitDetails, planRequiredDetails, orgLockedDetails,
|
|
58
58
|
// 2026-10-03 — the per-file asset limit (#136).
|
|
59
|
-
fileTooLargeDetails,
|
|
59
|
+
fileTooLargeDetails,
|
|
60
|
+
// 2026-10-04 — billing through Mollie (#104).
|
|
61
|
+
paymentProviderUnavailableDetails, } from './errors.js';
|
|
60
62
|
export { oauthErrorCode, oauthError, oauthRedirectResponse, oauthCodeTokenRequest, oauthRefreshTokenRequest, oauthTokenRequest, oauthTokenResponse, redirectUri, codeChallengeMethod, oauthAuthorizeQuery, dynamicClientRegistrationRequest, MCP_DCR_MAX_REDIRECT_URIS, dynamicClientRegistrationResponse, authorizationServerMetadata, protectedResourceMetadata, } from './oauth.js';
|
|
61
|
-
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';
|
|
62
68
|
// 2026-10-02 — plans (#103). The catalogue (I-1) only: `PLANS` and `ADDONS`
|
|
63
69
|
// are deliberately not constants exports (`constants.json` is vendored by
|
|
64
70
|
// the bridge and must stay unchanged) but are exported values of this
|
|
@@ -67,3 +73,5 @@ export { planId, PLAN_ORDER, planLimitKey, planLimits, planFeature, planFeatures
|
|
|
67
73
|
// 2026-10-02 — plans (#103). The organization's plan, plan changes and the
|
|
68
74
|
// admin request (I-2).
|
|
69
75
|
export { planCurrency, orgAddons, orgPlanUsage, planChangeKeep, planChangeReason, pendingPlanChange, orgLock, orgPlan, planChangeRequest, planOverrides, adminPlanChangeRequest, } from './plans.js';
|
|
76
|
+
// 2026-10-04 — billing through Mollie (#104).
|
|
77
|
+
export { countryCode, EU_COUNTRIES, SELLER_COUNTRY, DE_VAT_RATE_PERCENT, isEuCountry, currencyForCountry, payerKind, billingCycle, vatTreatment, payerRefusalRule, vatFor, viesCountry, normalizeVatId, periodNetCents, prorateCents, vatCents, chargeAmounts, DAY_MS, periodDays, remainingDays, changeNetCents, checkoutQuote, BILLING_RETRY_DAYS, BILLING_LOCK_DAY, billingAddress, billingDetails, checkoutRequest, checkoutResponse, checkoutStatus, vatIdStatus, vatIdCheckRequest, vatIdCheckResponse, billingChangeRequest, billingCancelRequest, billingDetailsUpdate, paymentMethodKind, paymentMethodChangeRequest, billingAccountStatus, paymentMethod, invoiceStatus, billingInvoice, billingAccount, billingView, billingChangeResponse, } from './billing.js';
|
|
@@ -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>]>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { OPERATOR_REASON_MAX_LENGTH, OPERATOR_REASON_MIN_LENGTH } from './operator.js';
|
|
4
|
+
/**
|
|
5
|
+
* One line of a command's preview (fleetless/fleetless#268): `changes`
|
|
6
|
+
* moves a value from `from` to `to`, `triggers` sets something off (a mail,
|
|
7
|
+
* a refund, a document), `keeps` states that something explicitly stays as
|
|
8
|
+
* it is.
|
|
9
|
+
*/
|
|
10
|
+
export const previewEffect = z.object({
|
|
11
|
+
kind: z.enum(['changes', 'triggers', 'keeps']).meta({ description: '`changes`: a value moves from `from` to `to`. `triggers`: something is set off (a mail, a refund, a document). `keeps`: something explicitly stays as it is.' }),
|
|
12
|
+
label: z.string().min(1).max(300),
|
|
13
|
+
from: z.string().max(300).nullable().optional(),
|
|
14
|
+
to: z.string().max(300).nullable().optional(),
|
|
15
|
+
amount_cents: z.number().int().optional(),
|
|
16
|
+
});
|
|
17
|
+
/** What a command's preview answers before an execute: at least one effect. */
|
|
18
|
+
export const operatorPreview = z.object({ effects: z.array(previewEffect).min(1).max(50) });
|
|
19
|
+
const reason = z.string().trim().min(OPERATOR_REASON_MIN_LENGTH).max(OPERATOR_REASON_MAX_LENGTH);
|
|
20
|
+
/**
|
|
21
|
+
* The request body of an operator command, parameterised over its own
|
|
22
|
+
* input shape: a `preview` that only reads, or an `execute` that carries the
|
|
23
|
+
* reason, the preview it confirms and a replay key (fleetless/fleetless#268).
|
|
24
|
+
*/
|
|
25
|
+
export function operatorCommandRequest(input) {
|
|
26
|
+
return z.discriminatedUnion('mode', [
|
|
27
|
+
z.object({ mode: z.literal('preview'), input }),
|
|
28
|
+
z.object({ mode: z.literal('execute'), input, reason, preview_token: z.string().min(1).max(512), idempotency_key: z.uuid() }),
|
|
29
|
+
]);
|
|
30
|
+
}
|
|
31
|
+
/** The audit rows a command's execute wrote: the operator audit always, the org's audit when the command named one. */
|
|
32
|
+
export const operatorAuditRef = z.object({ operator_audit: z.uuid(), org_audit: z.uuid().nullable() });
|
|
33
|
+
/**
|
|
34
|
+
* The response of an operator command, parameterised over its preview and
|
|
35
|
+
* result shapes: a preview mode answers `preview` and a token to confirm it
|
|
36
|
+
* with; an execute answers `result` and the audit rows it wrote.
|
|
37
|
+
*/
|
|
38
|
+
export function operatorCommandResponse(preview, result) {
|
|
39
|
+
return z.union([
|
|
40
|
+
z.object({ preview, preview_token: z.string().min(1) }),
|
|
41
|
+
z.object({ result, audit_ref: operatorAuditRef }),
|
|
42
|
+
]);
|
|
43
|
+
}
|
|
44
|
+
/** `409 preview_stale`'s `details`: a fresh preview and its token, to confirm instead. */
|
|
45
|
+
export const previewStaleDetails = z.object({ preview: operatorPreview, preview_token: z.string().min(1) });
|
|
46
|
+
/** The no-op command's input: the org whose audit the row proves the protocol against. */
|
|
47
|
+
export const noopCommandInput = z.object({ org_id: z.uuid() });
|
|
48
|
+
/** The no-op command's result: it changes nothing, always. */
|
|
49
|
+
export const noopCommandResult = z.object({ changed: z.literal(false) });
|
|
50
|
+
export const noopCommandRequest = operatorCommandRequest(noopCommandInput);
|
|
51
|
+
export const noopCommandResponse = operatorCommandResponse(operatorPreview, noopCommandResult);
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
/**
|
|
4
|
+
* The three roles an operator assertion may name (fleetless/fleetless#268). The
|
|
5
|
+
* cloud looks up which of them a route needs from `RouteEntry.operator`;
|
|
6
|
+
* a role not listed here makes an assertion malformed (`401`).
|
|
7
|
+
*/
|
|
8
|
+
export declare const OPERATOR_ROLES: readonly ["operator-admin", "operator-finance", "operator-support"];
|
|
9
|
+
export declare const operatorRole: z.ZodEnum<{
|
|
10
|
+
"operator-admin": "operator-admin";
|
|
11
|
+
"operator-finance": "operator-finance";
|
|
12
|
+
"operator-support": "operator-support";
|
|
13
|
+
}>;
|
|
14
|
+
export type OperatorRole = z.infer<typeof operatorRole>;
|
|
15
|
+
/**
|
|
16
|
+
* How the operator app confirms a command's execute (fleetless/fleetless#268).
|
|
17
|
+
* Set only on command routes, never on a read.
|
|
18
|
+
*/
|
|
19
|
+
export declare const CONFIRMATION_LEVELS: readonly ["click", "second_click", "type_to_confirm"];
|
|
20
|
+
export declare const confirmationLevel: z.ZodEnum<{
|
|
21
|
+
click: "click";
|
|
22
|
+
second_click: "second_click";
|
|
23
|
+
type_to_confirm: "type_to_confirm";
|
|
24
|
+
}>;
|
|
25
|
+
export type ConfirmationLevel = z.infer<typeof confirmationLevel>;
|
|
26
|
+
/** The operator assertion's `iss` claim; the cloud refuses any other issuer. */
|
|
27
|
+
export declare const OPERATOR_ASSERTION_ISSUER = "fleetless-operator";
|
|
28
|
+
/** The `Authorization` header scheme the assertion is sent with: `Authorization: Operator <jwt>`. */
|
|
29
|
+
export declare const OPERATOR_AUTH_SCHEME = "Operator";
|
|
30
|
+
/** The longest `exp - iat` the cloud accepts; a longer-lived assertion is malformed (`401`). */
|
|
31
|
+
export declare const OPERATOR_ASSERTION_MAX_LIFETIME_SECONDS = 60;
|
|
32
|
+
/** How far into the future `iat` may lie before the cloud refuses it as malformed (`401`). */
|
|
33
|
+
export declare const OPERATOR_ASSERTION_MAX_FUTURE_SKEW_SECONDS = 30;
|
|
34
|
+
/** How long a `jti` is remembered to refuse a replay, in the cloud process's memory. */
|
|
35
|
+
export declare const OPERATOR_ASSERTION_REPLAY_WINDOW_SECONDS = 120;
|
|
36
|
+
/** The shortest `reason` a command execute may send, after trimming. */
|
|
37
|
+
export declare const OPERATOR_REASON_MIN_LENGTH = 10;
|
|
38
|
+
/** The longest `reason` a command execute may send. */
|
|
39
|
+
export declare const OPERATOR_REASON_MAX_LENGTH = 2000;
|
|
40
|
+
/** How long a preview token stays valid before an execute against it answers `409 preview_stale`. */
|
|
41
|
+
export declare const OPERATOR_PREVIEW_MAX_AGE_MS: number;
|
|
42
|
+
/**
|
|
43
|
+
* The claims of an operator assertion (fleetless/fleetless#268): an EdDSA JWT
|
|
44
|
+
* naming the acting person and their roles. The cloud verifies the
|
|
45
|
+
* signature against `OPERATOR_ASSERTION_KEYS` and this shape against the
|
|
46
|
+
* claims before trusting any of it.
|
|
47
|
+
*/
|
|
48
|
+
export declare const operatorAssertionClaims: z.ZodObject<{
|
|
49
|
+
iss: z.ZodLiteral<"fleetless-operator">;
|
|
50
|
+
aud: z.ZodString;
|
|
51
|
+
sub: z.ZodString;
|
|
52
|
+
name: z.ZodString;
|
|
53
|
+
email: z.ZodEmail;
|
|
54
|
+
roles: z.ZodArray<z.ZodEnum<{
|
|
55
|
+
"operator-admin": "operator-admin";
|
|
56
|
+
"operator-finance": "operator-finance";
|
|
57
|
+
"operator-support": "operator-support";
|
|
58
|
+
}>>;
|
|
59
|
+
iat: z.ZodNumber;
|
|
60
|
+
exp: z.ZodNumber;
|
|
61
|
+
jti: z.ZodString;
|
|
62
|
+
}, z.core.$strip>;
|
|
63
|
+
export type OperatorAssertionClaims = z.infer<typeof operatorAssertionClaims>;
|
package/dist/operator.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
/**
|
|
4
|
+
* The three roles an operator assertion may name (fleetless/fleetless#268). The
|
|
5
|
+
* cloud looks up which of them a route needs from `RouteEntry.operator`;
|
|
6
|
+
* a role not listed here makes an assertion malformed (`401`).
|
|
7
|
+
*/
|
|
8
|
+
export const OPERATOR_ROLES = ['operator-admin', 'operator-finance', 'operator-support'];
|
|
9
|
+
export const operatorRole = z.enum(OPERATOR_ROLES);
|
|
10
|
+
/**
|
|
11
|
+
* How the operator app confirms a command's execute (fleetless/fleetless#268).
|
|
12
|
+
* Set only on command routes, never on a read.
|
|
13
|
+
*/
|
|
14
|
+
export const CONFIRMATION_LEVELS = ['click', 'second_click', 'type_to_confirm'];
|
|
15
|
+
export const confirmationLevel = z.enum(CONFIRMATION_LEVELS);
|
|
16
|
+
/** The operator assertion's `iss` claim; the cloud refuses any other issuer. */
|
|
17
|
+
export const OPERATOR_ASSERTION_ISSUER = 'fleetless-operator';
|
|
18
|
+
/** The `Authorization` header scheme the assertion is sent with: `Authorization: Operator <jwt>`. */
|
|
19
|
+
export const OPERATOR_AUTH_SCHEME = 'Operator';
|
|
20
|
+
/** The longest `exp - iat` the cloud accepts; a longer-lived assertion is malformed (`401`). */
|
|
21
|
+
export const OPERATOR_ASSERTION_MAX_LIFETIME_SECONDS = 60;
|
|
22
|
+
/** How far into the future `iat` may lie before the cloud refuses it as malformed (`401`). */
|
|
23
|
+
export const OPERATOR_ASSERTION_MAX_FUTURE_SKEW_SECONDS = 30;
|
|
24
|
+
/** How long a `jti` is remembered to refuse a replay, in the cloud process's memory. */
|
|
25
|
+
export const OPERATOR_ASSERTION_REPLAY_WINDOW_SECONDS = 120;
|
|
26
|
+
/** The shortest `reason` a command execute may send, after trimming. */
|
|
27
|
+
export const OPERATOR_REASON_MIN_LENGTH = 10;
|
|
28
|
+
/** The longest `reason` a command execute may send. */
|
|
29
|
+
export const OPERATOR_REASON_MAX_LENGTH = 2000;
|
|
30
|
+
/** How long a preview token stays valid before an execute against it answers `409 preview_stale`. */
|
|
31
|
+
export const OPERATOR_PREVIEW_MAX_AGE_MS = 10 * 60 * 1000;
|
|
32
|
+
/**
|
|
33
|
+
* The claims of an operator assertion (fleetless/fleetless#268): an EdDSA JWT
|
|
34
|
+
* naming the acting person and their roles. The cloud verifies the
|
|
35
|
+
* signature against `OPERATOR_ASSERTION_KEYS` and this shape against the
|
|
36
|
+
* claims before trusting any of it.
|
|
37
|
+
*/
|
|
38
|
+
export const operatorAssertionClaims = z.object({
|
|
39
|
+
iss: z.literal(OPERATOR_ASSERTION_ISSUER),
|
|
40
|
+
aud: z.string().min(1),
|
|
41
|
+
sub: z.string().min(1).max(200),
|
|
42
|
+
name: z.string().min(1).max(200),
|
|
43
|
+
email: z.email().max(320),
|
|
44
|
+
roles: z.array(operatorRole).max(OPERATOR_ROLES.length),
|
|
45
|
+
iat: z.number().int(),
|
|
46
|
+
exp: z.number().int(),
|
|
47
|
+
jti: z.string().min(16).max(128),
|
|
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";
|
|
32
|
-
robots: "robots";
|
|
33
31
|
seats: "seats";
|
|
32
|
+
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
|
-
require_two_factor: "require_two_factor";
|
|
62
|
-
two_factor: "two_factor";
|
|
63
61
|
app_mcp: "app_mcp";
|
|
62
|
+
two_factor: "two_factor";
|
|
63
|
+
require_two_factor: "require_two_factor";
|
|
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
|
-
require_two_factor: z.ZodBoolean;
|
|
72
|
-
two_factor: z.ZodBoolean;
|
|
73
71
|
app_mcp: z.ZodBoolean;
|
|
72
|
+
two_factor: z.ZodBoolean;
|
|
73
|
+
require_two_factor: 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
|
-
email: "email";
|
|
89
88
|
community: "community";
|
|
89
|
+
email: "email";
|
|
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
|
-
require_two_factor: z.ZodBoolean;
|
|
114
|
-
two_factor: z.ZodBoolean;
|
|
115
113
|
app_mcp: z.ZodBoolean;
|
|
114
|
+
two_factor: z.ZodBoolean;
|
|
115
|
+
require_two_factor: 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
|
-
email: "email";
|
|
129
128
|
community: "community";
|
|
129
|
+
email: "email";
|
|
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";
|
|
142
|
-
robots: "robots";
|
|
143
141
|
seats: "seats";
|
|
142
|
+
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";
|
|
151
|
-
robots: "robots";
|
|
152
150
|
seats: "seats";
|
|
151
|
+
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";
|
|
158
|
-
robots: "robots";
|
|
159
157
|
seats: "seats";
|
|
158
|
+
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";
|
|
@@ -260,8 +260,8 @@ export type PlanChangeKeep = z.infer<typeof planChangeKeep>;
|
|
|
260
260
|
* is locked (see `orgLock`) and must land on Basic.
|
|
261
261
|
*/
|
|
262
262
|
export declare const planChangeReason: z.ZodEnum<{
|
|
263
|
-
cancel: "cancel";
|
|
264
263
|
downgrade: "downgrade";
|
|
264
|
+
cancel: "cancel";
|
|
265
265
|
migration: "migration";
|
|
266
266
|
lock: "lock";
|
|
267
267
|
}>;
|
|
@@ -292,8 +292,8 @@ export declare const pendingPlanChange: z.ZodObject<{
|
|
|
292
292
|
enterprise: "enterprise";
|
|
293
293
|
}>;
|
|
294
294
|
reason: z.ZodEnum<{
|
|
295
|
-
cancel: "cancel";
|
|
296
295
|
downgrade: "downgrade";
|
|
296
|
+
cancel: "cancel";
|
|
297
297
|
migration: "migration";
|
|
298
298
|
lock: "lock";
|
|
299
299
|
}>;
|
|
@@ -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
|
-
require_two_factor: z.ZodBoolean;
|
|
371
|
-
two_factor: z.ZodBoolean;
|
|
372
370
|
app_mcp: z.ZodBoolean;
|
|
371
|
+
two_factor: z.ZodBoolean;
|
|
372
|
+
require_two_factor: z.ZodBoolean;
|
|
373
373
|
app_oidc: z.ZodBoolean;
|
|
374
374
|
hosted_logo: z.ZodBoolean;
|
|
375
375
|
audit_export: z.ZodBoolean;
|
|
@@ -391,8 +391,8 @@ export declare const orgPlan: z.ZodObject<{
|
|
|
391
391
|
enterprise: "enterprise";
|
|
392
392
|
}>;
|
|
393
393
|
reason: z.ZodEnum<{
|
|
394
|
-
cancel: "cancel";
|
|
395
394
|
downgrade: "downgrade";
|
|
395
|
+
cancel: "cancel";
|
|
396
396
|
migration: "migration";
|
|
397
397
|
lock: "lock";
|
|
398
398
|
}>;
|
|
@@ -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>>;
|
|
458
|
-
robots: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
459
457
|
seats: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
458
|
+
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>>;
|
|
493
|
-
robots: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
494
492
|
seats: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
493
|
+
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/realtime.d.ts
CHANGED
|
@@ -260,13 +260,13 @@ export type DatapointEvent = z.infer<typeof datapointEvent>;
|
|
|
260
260
|
*/
|
|
261
261
|
export declare const liveSessionEndReason: z.ZodEnum<{
|
|
262
262
|
unknown: "unknown";
|
|
263
|
+
expired: "expired";
|
|
263
264
|
plan_limit: "plan_limit";
|
|
264
265
|
publish_failed: "publish_failed";
|
|
265
266
|
robot_offline: "robot_offline";
|
|
266
267
|
config_changed: "config_changed";
|
|
267
268
|
released_by_peer: "released_by_peer";
|
|
268
269
|
revoked: "revoked";
|
|
269
|
-
expired: "expired";
|
|
270
270
|
robot_deleted: "robot_deleted";
|
|
271
271
|
}>;
|
|
272
272
|
export type LiveSessionEndReason = z.infer<typeof liveSessionEndReason>;
|
|
@@ -292,13 +292,13 @@ export declare const liveSessionEvent: z.ZodObject<{
|
|
|
292
292
|
state: z.ZodLiteral<"ended">;
|
|
293
293
|
reason: z.ZodEnum<{
|
|
294
294
|
unknown: "unknown";
|
|
295
|
+
expired: "expired";
|
|
295
296
|
plan_limit: "plan_limit";
|
|
296
297
|
publish_failed: "publish_failed";
|
|
297
298
|
robot_offline: "robot_offline";
|
|
298
299
|
config_changed: "config_changed";
|
|
299
300
|
released_by_peer: "released_by_peer";
|
|
300
301
|
revoked: "revoked";
|
|
301
|
-
expired: "expired";
|
|
302
302
|
robot_deleted: "robot_deleted";
|
|
303
303
|
}>;
|
|
304
304
|
detail: z.ZodNullable<z.ZodString>;
|
package/dist/rest.d.ts
CHANGED
|
@@ -1847,10 +1847,10 @@ export declare const USAGE_WINDOW_MAX_DAYS = 366;
|
|
|
1847
1847
|
* told to look at the wrong thing.
|
|
1848
1848
|
*/
|
|
1849
1849
|
export declare const usageMetric: z.ZodEnum<{
|
|
1850
|
+
asset_bytes: "asset_bytes";
|
|
1850
1851
|
api_calls: "api_calls";
|
|
1851
1852
|
live_session_ms: "live_session_ms";
|
|
1852
1853
|
retention_bytes: "retention_bytes";
|
|
1853
|
-
asset_bytes: "asset_bytes";
|
|
1854
1854
|
robot_online_ms: "robot_online_ms";
|
|
1855
1855
|
}>;
|
|
1856
1856
|
export type UsageMetric = z.infer<typeof usageMetric>;
|
|
@@ -1970,10 +1970,10 @@ export declare const usageRow: z.ZodObject<{
|
|
|
1970
1970
|
app_id: z.ZodNullable<z.ZodUUID>;
|
|
1971
1971
|
app_name: z.ZodNullable<z.ZodString>;
|
|
1972
1972
|
metric: z.ZodEnum<{
|
|
1973
|
+
asset_bytes: "asset_bytes";
|
|
1973
1974
|
api_calls: "api_calls";
|
|
1974
1975
|
live_session_ms: "live_session_ms";
|
|
1975
1976
|
retention_bytes: "retention_bytes";
|
|
1976
|
-
asset_bytes: "asset_bytes";
|
|
1977
1977
|
robot_online_ms: "robot_online_ms";
|
|
1978
1978
|
}>;
|
|
1979
1979
|
day: z.ZodString;
|
|
@@ -1986,10 +1986,10 @@ export declare const orgUsageResponse: z.ZodObject<{
|
|
|
1986
1986
|
app_id: z.ZodNullable<z.ZodUUID>;
|
|
1987
1987
|
app_name: z.ZodNullable<z.ZodString>;
|
|
1988
1988
|
metric: z.ZodEnum<{
|
|
1989
|
+
asset_bytes: "asset_bytes";
|
|
1989
1990
|
api_calls: "api_calls";
|
|
1990
1991
|
live_session_ms: "live_session_ms";
|
|
1991
1992
|
retention_bytes: "retention_bytes";
|
|
1992
|
-
asset_bytes: "asset_bytes";
|
|
1993
1993
|
robot_online_ms: "robot_online_ms";
|
|
1994
1994
|
}>;
|
|
1995
1995
|
day: z.ZodString;
|
package/dist/routes.d.ts
CHANGED
|
@@ -28,20 +28,31 @@
|
|
|
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';
|
|
31
32
|
export type RouteMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
32
33
|
export type RouteAudience = 'developer' | 'client' | 'internal';
|
|
33
34
|
/**
|
|
34
35
|
* `ops` (2026-10-02, fleetless/fleetless#103): a bearer token the operator
|
|
35
36
|
* 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`.
|
|
36
40
|
*/
|
|
37
|
-
export type RouteAuth = 'developer' | 'developer_or_client' | 'none' | 'robot_upload' | 'in_handler' | 'ops';
|
|
41
|
+
export type RouteAuth = 'developer' | 'developer_or_client' | 'none' | 'robot_upload' | 'in_handler' | 'ops' | 'operator';
|
|
38
42
|
export type RouteTransport = 'http' | 'websocket';
|
|
39
|
-
export type RouteSection = 'health' | 'developer-auth' | 'client-auth' | 'org' | 'users' | 'apps' | 'robots' | 'config' | 'alerts' | 'commands' | 'cameras' | 'assets' | 'mcp' | 'transports';
|
|
43
|
+
export type RouteSection = 'health' | 'developer-auth' | 'client-auth' | 'org' | 'billing' | 'users' | 'apps' | 'robots' | 'config' | 'alerts' | 'commands' | 'cameras' | 'assets' | 'mcp' | 'transports';
|
|
40
44
|
export interface RouteParam {
|
|
41
45
|
readonly name: string;
|
|
42
46
|
/** One sentence: what the segment identifies and where a caller gets it. */
|
|
43
47
|
readonly description: string;
|
|
44
48
|
}
|
|
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
|
+
}
|
|
45
56
|
export interface RouteEntry {
|
|
46
57
|
readonly method: RouteMethod;
|
|
47
58
|
/** The display path with `:name` params and no inline regex. */
|
|
@@ -89,6 +100,8 @@ export interface RouteEntry {
|
|
|
89
100
|
readonly transport: RouteTransport;
|
|
90
101
|
/** Markdown rendered under the route; the place for what the schema cannot say. */
|
|
91
102
|
readonly notes?: string;
|
|
103
|
+
/** Set exactly when `auth` is `operator`. */
|
|
104
|
+
readonly operator?: RouteOperatorAccess;
|
|
92
105
|
}
|
|
93
106
|
export declare const ROUTE_SECTIONS: readonly {
|
|
94
107
|
readonly id: RouteSection;
|
|
@@ -123,3 +136,9 @@ export declare const IN_HANDLER_ROUTES: readonly string[];
|
|
|
123
136
|
*/
|
|
124
137
|
export declare function developerSignInRoutes(prefix: '/console/oauth' | '/mcp/oauth'): RouteEntry[];
|
|
125
138
|
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;
|