@fleetless/contracts 13.2.0 → 14.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +169 -0
- package/artifacts/openapi.json +2092 -787
- package/artifacts/routes.json +229 -230
- package/artifacts/schema/access-warning.schema.json +51 -0
- package/artifacts/schema/action-config.schema.json +35 -0
- package/artifacts/schema/app-access-response.schema.json +136 -0
- package/artifacts/schema/app-access.schema.json +80 -0
- package/artifacts/schema/app-auth-config.schema.json +15 -0
- package/artifacts/schema/app-deletion-summary.schema.json +0 -7
- package/artifacts/schema/app-invitation-list-response.schema.json +13 -6
- package/artifacts/schema/app-invitation.schema.json +5 -5
- package/artifacts/schema/app-list-response.schema.json +6 -6
- package/artifacts/schema/app-lock.schema.json +30 -0
- package/artifacts/schema/app-user-list-response.schema.json +13 -6
- package/artifacts/schema/app-user.schema.json +13 -6
- package/artifacts/schema/app.schema.json +6 -6
- package/artifacts/schema/auth-ok.schema.json +20 -6
- package/artifacts/schema/camera-list-response.schema.json +1 -1
- package/artifacts/schema/client-identity.schema.json +21 -6
- package/artifacts/schema/cloud-config.schema.json +359 -5
- package/artifacts/schema/config-draft-response.schema.json +389 -5
- package/artifacts/schema/config-version-response.schema.json +389 -5
- package/artifacts/schema/config-versions-response.schema.json +30 -0
- package/artifacts/schema/create-app-invitation-request.schema.json +4 -4
- package/artifacts/schema/create-app-user-request.schema.json +4 -4
- package/artifacts/schema/create-org-role-request.schema.json +33 -0
- package/artifacts/schema/dangling-reference.schema.json +129 -0
- package/artifacts/schema/datapoint-config.schema.json +35 -0
- package/artifacts/schema/datapoint-list-response.schema.json +1 -1
- package/artifacts/schema/effective-capability.schema.json +104 -0
- package/artifacts/schema/effective-rights-query.schema.json +19 -0
- package/artifacts/schema/effective-rights-response.schema.json +310 -0
- package/artifacts/schema/effective-robot-rights.schema.json +266 -0
- package/artifacts/schema/invoke-or-service-response.schema.json +1 -1
- package/artifacts/schema/invoke-response.schema.json +1 -1
- package/artifacts/schema/journal-intent-v2-body.schema.json +74 -0
- package/artifacts/schema/journal-intent-v2.schema.json +84 -0
- package/artifacts/schema/journal-replay-receipt-body.schema.json +1 -0
- package/artifacts/schema/journal-replay-receipt.schema.json +1 -0
- package/artifacts/schema/mcp-robot-datasheet.schema.json +2 -2
- package/artifacts/schema/org-role-list-response.schema.json +205 -0
- package/artifacts/schema/org-role.schema.json +59 -0
- package/artifacts/schema/patch-app-user-request.schema.json +4 -4
- package/artifacts/schema/patch-org-role-request.schema.json +38 -0
- package/artifacts/schema/publish-config-response.schema.json +48 -1
- package/artifacts/schema/publisher-config.schema.json +35 -0
- package/artifacts/schema/put-role-defaults-request.schema.json +127 -0
- package/artifacts/schema/reference-place.schema.json +111 -0
- package/artifacts/schema/rename-slug-response.schema.json +4 -3
- package/artifacts/schema/robot-config-doc.schema.json +359 -5
- package/artifacts/schema/role-cycle-details.schema.json +18 -0
- package/artifacts/schema/role-defaults-response.schema.json +59 -0
- package/artifacts/schema/role-rename-preview.schema.json +146 -0
- package/artifacts/schema/service-config.schema.json +35 -0
- package/artifacts/schema/slug-usage-response.schema.json +4 -3
- package/artifacts/schema/update-app-request.schema.json +0 -12
- package/dist/app-users.d.ts +30 -10
- package/dist/app-users.js +32 -12
- package/dist/apps.d.ts +242 -71
- package/dist/apps.js +205 -151
- package/dist/audit.d.ts +3 -3
- package/dist/billing.d.ts +10 -10
- package/dist/client-auth.d.ts +5 -2
- package/dist/client-auth.js +11 -3
- package/dist/client-robots.d.ts +1 -1
- package/dist/client-robots.js +1 -1
- package/dist/common.d.ts +1 -1
- package/dist/common.js +1 -1
- package/dist/config-issues.d.ts +1 -1
- package/dist/config-issues.js +1 -1
- package/dist/config.d.ts +77 -11
- package/dist/config.js +108 -14
- package/dist/errors.d.ts +14 -5
- package/dist/errors.js +37 -24
- package/dist/index.d.ts +22 -12
- package/dist/index.js +16 -6
- package/dist/journal-intents.d.ts +30 -0
- package/dist/journal-intents.js +3 -0
- package/dist/legal-acceptances.d.ts +2 -2
- package/dist/mcp.d.ts +5 -37
- package/dist/mcp.js +4 -14
- package/dist/org-roles.d.ts +182 -0
- package/dist/org-roles.js +198 -0
- package/dist/plans.d.ts +6 -6
- package/dist/protocol.d.ts +19 -1
- package/dist/realtime.d.ts +6 -3
- package/dist/realtime.js +1 -1
- package/dist/rest.d.ts +104 -25
- package/dist/rest.js +67 -29
- package/dist/rights.d.ts +197 -0
- package/dist/rights.js +396 -0
- package/dist/routes.js +190 -148
- package/package.json +1 -1
- package/artifacts/schema/mcp-role-preview-response.schema.json +0 -134
- package/artifacts/schema/role-delete-query.schema.json +0 -13
- package/artifacts/schema/role-in-use-details.schema.json +0 -28
- package/artifacts/schema/role-list-response.schema.json +0 -48
- package/artifacts/schema/role-permissions.schema.json +0 -61
- package/artifacts/schema/role-rename-request.schema.json +0 -16
- package/artifacts/schema/role.schema.json +0 -35
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
/**
|
|
4
|
+
* A place that writes a role key, as the role list, the rename preview and
|
|
5
|
+
* the dangling-reference list all name it.
|
|
6
|
+
*
|
|
7
|
+
* One flat shape for every kind, with `null` for what a kind does not have,
|
|
8
|
+
* so a client renders a row without switching on `kind` to find a field.
|
|
9
|
+
*/
|
|
10
|
+
export declare const referencePlace: z.ZodObject<{
|
|
11
|
+
kind: z.ZodEnum<{
|
|
12
|
+
org_default: "org_default";
|
|
13
|
+
app_user: "app_user";
|
|
14
|
+
config: "config";
|
|
15
|
+
invitation: "invitation";
|
|
16
|
+
app_default: "app_default";
|
|
17
|
+
role_inherits: "role_inherits";
|
|
18
|
+
}>;
|
|
19
|
+
label: z.ZodString;
|
|
20
|
+
path: z.ZodNullable<z.ZodString>;
|
|
21
|
+
robot_id: z.ZodNullable<z.ZodUUID>;
|
|
22
|
+
app_id: z.ZodNullable<z.ZodUUID>;
|
|
23
|
+
user_id: z.ZodNullable<z.ZodUUID>;
|
|
24
|
+
document: z.ZodNullable<z.ZodEnum<{
|
|
25
|
+
published: "published";
|
|
26
|
+
draft: "draft";
|
|
27
|
+
}>>;
|
|
28
|
+
new_version: z.ZodNullable<z.ZodNumber>;
|
|
29
|
+
}, z.core.$strip>;
|
|
30
|
+
export type ReferencePlace = z.infer<typeof referencePlace>;
|
|
31
|
+
/** One role as `GET /api/org/roles` lists it, with how much depends on it. */
|
|
32
|
+
export declare const orgRole: z.ZodObject<{
|
|
33
|
+
key: z.ZodString;
|
|
34
|
+
name: z.ZodString;
|
|
35
|
+
inherits: z.ZodArray<z.ZodString>;
|
|
36
|
+
users: z.ZodNumber;
|
|
37
|
+
invitations: z.ZodNumber;
|
|
38
|
+
app_defaults: z.ZodNumber;
|
|
39
|
+
references: z.ZodNumber;
|
|
40
|
+
}, z.core.$strip>;
|
|
41
|
+
export type OrgRole = z.infer<typeof orgRole>;
|
|
42
|
+
/** A key that is written somewhere and is no role, with every place that writes it. */
|
|
43
|
+
export declare const danglingReference: z.ZodObject<{
|
|
44
|
+
key: z.ZodString;
|
|
45
|
+
places: z.ZodArray<z.ZodObject<{
|
|
46
|
+
kind: z.ZodEnum<{
|
|
47
|
+
org_default: "org_default";
|
|
48
|
+
app_user: "app_user";
|
|
49
|
+
config: "config";
|
|
50
|
+
invitation: "invitation";
|
|
51
|
+
app_default: "app_default";
|
|
52
|
+
role_inherits: "role_inherits";
|
|
53
|
+
}>;
|
|
54
|
+
label: z.ZodString;
|
|
55
|
+
path: z.ZodNullable<z.ZodString>;
|
|
56
|
+
robot_id: z.ZodNullable<z.ZodUUID>;
|
|
57
|
+
app_id: z.ZodNullable<z.ZodUUID>;
|
|
58
|
+
user_id: z.ZodNullable<z.ZodUUID>;
|
|
59
|
+
document: z.ZodNullable<z.ZodEnum<{
|
|
60
|
+
published: "published";
|
|
61
|
+
draft: "draft";
|
|
62
|
+
}>>;
|
|
63
|
+
new_version: z.ZodNullable<z.ZodNumber>;
|
|
64
|
+
}, z.core.$strip>>;
|
|
65
|
+
}, z.core.$strip>;
|
|
66
|
+
export type DanglingReference = z.infer<typeof danglingReference>;
|
|
67
|
+
/** What `GET /api/org/roles` answers. */
|
|
68
|
+
export declare const orgRoleListResponse: z.ZodObject<{
|
|
69
|
+
roles: z.ZodArray<z.ZodObject<{
|
|
70
|
+
key: z.ZodString;
|
|
71
|
+
name: z.ZodString;
|
|
72
|
+
inherits: z.ZodArray<z.ZodString>;
|
|
73
|
+
users: z.ZodNumber;
|
|
74
|
+
invitations: z.ZodNumber;
|
|
75
|
+
app_defaults: z.ZodNumber;
|
|
76
|
+
references: z.ZodNumber;
|
|
77
|
+
}, z.core.$strip>>;
|
|
78
|
+
dangling: z.ZodArray<z.ZodObject<{
|
|
79
|
+
key: z.ZodString;
|
|
80
|
+
places: z.ZodArray<z.ZodObject<{
|
|
81
|
+
kind: z.ZodEnum<{
|
|
82
|
+
org_default: "org_default";
|
|
83
|
+
app_user: "app_user";
|
|
84
|
+
config: "config";
|
|
85
|
+
invitation: "invitation";
|
|
86
|
+
app_default: "app_default";
|
|
87
|
+
role_inherits: "role_inherits";
|
|
88
|
+
}>;
|
|
89
|
+
label: z.ZodString;
|
|
90
|
+
path: z.ZodNullable<z.ZodString>;
|
|
91
|
+
robot_id: z.ZodNullable<z.ZodUUID>;
|
|
92
|
+
app_id: z.ZodNullable<z.ZodUUID>;
|
|
93
|
+
user_id: z.ZodNullable<z.ZodUUID>;
|
|
94
|
+
document: z.ZodNullable<z.ZodEnum<{
|
|
95
|
+
published: "published";
|
|
96
|
+
draft: "draft";
|
|
97
|
+
}>>;
|
|
98
|
+
new_version: z.ZodNullable<z.ZodNumber>;
|
|
99
|
+
}, z.core.$strip>>;
|
|
100
|
+
}, z.core.$strip>>;
|
|
101
|
+
}, z.core.$strip>;
|
|
102
|
+
export type OrgRoleListResponse = z.infer<typeof orgRoleListResponse>;
|
|
103
|
+
/** `POST /api/org/roles`: a new role. Strict, so a field this route does not take is refused rather than dropped. */
|
|
104
|
+
export declare const createOrgRoleRequest: z.ZodObject<{
|
|
105
|
+
key: z.ZodString;
|
|
106
|
+
name: z.ZodString;
|
|
107
|
+
inherits: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
108
|
+
}, z.core.$strict>;
|
|
109
|
+
export type CreateOrgRoleRequest = z.infer<typeof createOrgRoleRequest>;
|
|
110
|
+
/**
|
|
111
|
+
* `PATCH /api/org/roles/:key`: change a role. Absent leaves a field alone.
|
|
112
|
+
*
|
|
113
|
+
* At least one field is required: an empty patch is a caller mistake, not a
|
|
114
|
+
* request to do nothing. `update_references` and `confirm` only mean something
|
|
115
|
+
* together with `key`.
|
|
116
|
+
*
|
|
117
|
+
* The one-field rule is a `.refine()`, which JSON Schema cannot express, so
|
|
118
|
+
* `patch-org-role-request.schema.json` describes five independent optional
|
|
119
|
+
* fields; the cloud is the only place an empty patch is refused.
|
|
120
|
+
*/
|
|
121
|
+
export declare const patchOrgRoleRequest: z.ZodObject<{
|
|
122
|
+
name: z.ZodOptional<z.ZodString>;
|
|
123
|
+
inherits: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
124
|
+
key: z.ZodOptional<z.ZodString>;
|
|
125
|
+
update_references: z.ZodOptional<z.ZodBoolean>;
|
|
126
|
+
confirm: z.ZodOptional<z.ZodString>;
|
|
127
|
+
}, z.core.$strict>;
|
|
128
|
+
export type PatchOrgRoleRequest = z.infer<typeof patchOrgRoleRequest>;
|
|
129
|
+
/**
|
|
130
|
+
* What a rename with `update_references` would rewrite: the `details` of the
|
|
131
|
+
* `409 confirmation_required` that answers it. Repeating the same request with
|
|
132
|
+
* `confirm` set to this token applies the rename.
|
|
133
|
+
*/
|
|
134
|
+
export declare const roleRenamePreview: z.ZodObject<{
|
|
135
|
+
from: z.ZodString;
|
|
136
|
+
to: z.ZodString;
|
|
137
|
+
references: z.ZodArray<z.ZodObject<{
|
|
138
|
+
kind: z.ZodEnum<{
|
|
139
|
+
org_default: "org_default";
|
|
140
|
+
app_user: "app_user";
|
|
141
|
+
config: "config";
|
|
142
|
+
invitation: "invitation";
|
|
143
|
+
app_default: "app_default";
|
|
144
|
+
role_inherits: "role_inherits";
|
|
145
|
+
}>;
|
|
146
|
+
label: z.ZodString;
|
|
147
|
+
path: z.ZodNullable<z.ZodString>;
|
|
148
|
+
robot_id: z.ZodNullable<z.ZodUUID>;
|
|
149
|
+
app_id: z.ZodNullable<z.ZodUUID>;
|
|
150
|
+
user_id: z.ZodNullable<z.ZodUUID>;
|
|
151
|
+
document: z.ZodNullable<z.ZodEnum<{
|
|
152
|
+
published: "published";
|
|
153
|
+
draft: "draft";
|
|
154
|
+
}>>;
|
|
155
|
+
new_version: z.ZodNullable<z.ZodNumber>;
|
|
156
|
+
}, z.core.$strip>>;
|
|
157
|
+
reference_count: z.ZodNumber;
|
|
158
|
+
confirm: z.ZodString;
|
|
159
|
+
}, z.core.$strip>;
|
|
160
|
+
export type RoleRenamePreview = z.infer<typeof roleRenamePreview>;
|
|
161
|
+
/** What `GET` and `PUT /api/org/roles/defaults` answer: who holds each kind of access when a robot's configuration says nothing. */
|
|
162
|
+
export declare const roleDefaultsResponse: z.ZodObject<{
|
|
163
|
+
defaults: z.ZodObject<{
|
|
164
|
+
read: z.ZodArray<z.ZodString>;
|
|
165
|
+
invoke: z.ZodArray<z.ZodString>;
|
|
166
|
+
publish: z.ZodArray<z.ZodString>;
|
|
167
|
+
assets: z.ZodArray<z.ZodString>;
|
|
168
|
+
job_history: z.ZodArray<z.ZodString>;
|
|
169
|
+
}, z.core.$strip>;
|
|
170
|
+
}, z.core.$strip>;
|
|
171
|
+
export type RoleDefaultsResponse = z.infer<typeof roleDefaultsResponse>;
|
|
172
|
+
/** `PUT /api/org/roles/defaults`: change some defaults and leave the others as they are. */
|
|
173
|
+
export declare const putRoleDefaultsRequest: z.ZodObject<{
|
|
174
|
+
defaults: z.ZodObject<{
|
|
175
|
+
read: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodNull]>>;
|
|
176
|
+
invoke: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodNull]>>;
|
|
177
|
+
publish: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodNull]>>;
|
|
178
|
+
assets: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodNull]>>;
|
|
179
|
+
job_history: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodNull]>>;
|
|
180
|
+
}, z.core.$strict>;
|
|
181
|
+
}, z.core.$strict>;
|
|
182
|
+
export type PutRoleDefaultsRequest = z.infer<typeof putRoleDefaultsRequest>;
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { ACCESS_KINDS, MAX_ORG_ROLES, ROLE_NAME_MAX, roleKey } from './rights.js';
|
|
4
|
+
/**
|
|
5
|
+
* Organization roles on the wire: the roles themselves, what names them, and
|
|
6
|
+
* the organization's defaults.
|
|
7
|
+
*
|
|
8
|
+
* A role belongs to the organization, not to an app. Its **key** is what
|
|
9
|
+
* `fleetless.yaml` and every assignment write; its **name** is what a person
|
|
10
|
+
* reads, and changing it changes nothing about rights. A role inherits from
|
|
11
|
+
* any number of other roles, and the only change the cloud refuses is one that
|
|
12
|
+
* would make a role inherit from itself (`role_cycle`).
|
|
13
|
+
*
|
|
14
|
+
* **A key that names no role is a warning and never an error**, wherever it is
|
|
15
|
+
* written: it grants nothing, and `GET /api/org/roles` lists it under
|
|
16
|
+
* `dangling` with every place that names it. That is what makes deleting or
|
|
17
|
+
* renaming a role safe to do first and tidy up after.
|
|
18
|
+
*/
|
|
19
|
+
/** A role's display name: free text, trimmed, 1 to 60 characters. */
|
|
20
|
+
const roleName = z.string().trim().min(1).max(ROLE_NAME_MAX);
|
|
21
|
+
/**
|
|
22
|
+
* A place that writes a role key, as the role list, the rename preview and
|
|
23
|
+
* the dangling-reference list all name it.
|
|
24
|
+
*
|
|
25
|
+
* One flat shape for every kind, with `null` for what a kind does not have,
|
|
26
|
+
* so a client renders a row without switching on `kind` to find a field.
|
|
27
|
+
*/
|
|
28
|
+
export const referencePlace = z.object({
|
|
29
|
+
kind: z.enum(['config', 'app_user', 'invitation', 'app_default', 'role_inherits', 'org_default']).meta({
|
|
30
|
+
description: 'What writes the key: `config` is a `role` or `access` value in a robot\'s `fleetless.yaml`, `app_user` an app user who holds it, ' +
|
|
31
|
+
'`invitation` an invitation that carries it, `app_default` an app\'s default role, `role_inherits` another role that inherits from it, ' +
|
|
32
|
+
'and `org_default` one of the organization\'s defaults.',
|
|
33
|
+
}),
|
|
34
|
+
label: z.string().meta({
|
|
35
|
+
description: 'What a person reads to find the place: the robot name (`config`), the e-mail address of the app user or of the invitee (`app_user`, `invitation`), the app name (`app_default`), the name of the inheriting role (`role_inherits`), or the access kind of an organization default (`org_default`).',
|
|
36
|
+
}),
|
|
37
|
+
path: z.string().nullable().meta({
|
|
38
|
+
description: 'Where the key is written. For `config`, the place in the YAML, such as `services.arm_home.role` or `access.rules[1].role`; for ' +
|
|
39
|
+
'`role_inherits`, the key of the role that inherits from it, because display names are not unique; `null` for every other kind.',
|
|
40
|
+
}),
|
|
41
|
+
robot_id: z.uuid().nullable().meta({
|
|
42
|
+
description: 'The robot whose document holds the key (`config`); `null` for every other kind.',
|
|
43
|
+
}),
|
|
44
|
+
app_id: z.uuid().nullable().meta({
|
|
45
|
+
description: 'The app the user, invitation or default role belongs to (`app_user`, `invitation`, `app_default`); `null` for every other kind.',
|
|
46
|
+
}),
|
|
47
|
+
user_id: z.uuid().nullable().meta({
|
|
48
|
+
description: 'The app user who holds the key (`app_user`); `null` for every other kind.',
|
|
49
|
+
}),
|
|
50
|
+
document: z.enum(['published', 'draft']).nullable().meta({
|
|
51
|
+
description: 'Which version of the robot\'s document holds the key (`config`): the published one or the draft; `null` for every other kind.',
|
|
52
|
+
}),
|
|
53
|
+
new_version: z.number().int().positive().nullable().meta({
|
|
54
|
+
description: 'For a published document, the version number a rename with `update_references` would give it, a copy that differs only in the key; ' +
|
|
55
|
+
'`null` for a draft and for every place that is no document.',
|
|
56
|
+
}),
|
|
57
|
+
});
|
|
58
|
+
/** One role as `GET /api/org/roles` lists it, with how much depends on it. */
|
|
59
|
+
export const orgRole = z.object({
|
|
60
|
+
key: roleKey.meta({
|
|
61
|
+
description: 'The role\'s key, as `fleetless.yaml` and every assignment write it. Unique in the organization.',
|
|
62
|
+
}),
|
|
63
|
+
name: roleName.meta({
|
|
64
|
+
description: 'The display name, 1 to 60 characters and trimmed. Changing it changes nothing about rights.',
|
|
65
|
+
}),
|
|
66
|
+
inherits: z.array(z.string()).meta({
|
|
67
|
+
description: 'The keys of the roles this one inherits from. A role holds whatever its parents hold, and theirs in turn. A key that names no role ' +
|
|
68
|
+
'is kept as written; inheritance through it grants nothing, and the key appears under `dangling`.',
|
|
69
|
+
}),
|
|
70
|
+
users: z.number().int().nonnegative().meta({
|
|
71
|
+
description: 'App users, in every app of the organization, who hold this role.',
|
|
72
|
+
}),
|
|
73
|
+
invitations: z.number().int().nonnegative().meta({
|
|
74
|
+
description: 'Invitations that carry this role.',
|
|
75
|
+
}),
|
|
76
|
+
app_defaults: z.number().int().nonnegative().meta({
|
|
77
|
+
description: 'Apps that use this role as their default role.',
|
|
78
|
+
}),
|
|
79
|
+
references: z.number().int().nonnegative().meta({
|
|
80
|
+
description: 'Places in documents that name this role, such as a `role` in a robot\'s `fleetless.yaml`. A rename with `update_references` rewrites them.',
|
|
81
|
+
}),
|
|
82
|
+
});
|
|
83
|
+
/** A key that is written somewhere and is no role, with every place that writes it. */
|
|
84
|
+
export const danglingReference = z.object({
|
|
85
|
+
key: z.string().meta({
|
|
86
|
+
description: 'A key that names no role of the organization, because the role was deleted or renamed or never existed.',
|
|
87
|
+
}),
|
|
88
|
+
places: z.array(referencePlace).meta({
|
|
89
|
+
description: 'Every place that writes the key. It grants nothing wherever it is written; creating a role with this key makes the places count again.',
|
|
90
|
+
}),
|
|
91
|
+
});
|
|
92
|
+
/** What `GET /api/org/roles` answers. */
|
|
93
|
+
export const orgRoleListResponse = z.object({
|
|
94
|
+
roles: z.array(orgRole).meta({
|
|
95
|
+
description: 'The organization\'s roles with their counts, in the order they were created: the roles every organization starts with (`observe`, `operate` and `admin`) come first.',
|
|
96
|
+
}),
|
|
97
|
+
dangling: z.array(danglingReference).meta({
|
|
98
|
+
description: 'Keys written somewhere that are no role, each with its places. Empty when nothing is out of step.',
|
|
99
|
+
}),
|
|
100
|
+
});
|
|
101
|
+
/** `POST /api/org/roles`: a new role. Strict, so a field this route does not take is refused rather than dropped. */
|
|
102
|
+
export const createOrgRoleRequest = z.object({
|
|
103
|
+
key: roleKey.meta({
|
|
104
|
+
description: 'The new role\'s key, unique in the organization. Documents and assignments name the role by it.',
|
|
105
|
+
}),
|
|
106
|
+
name: roleName.meta({
|
|
107
|
+
description: 'The display name, 1 to 60 characters; surrounding spaces are removed.',
|
|
108
|
+
}),
|
|
109
|
+
inherits: z.array(roleKey).max(MAX_ORG_ROLES).optional().meta({
|
|
110
|
+
description: 'Keys of the roles to inherit from. A key that names no role is accepted and warns. Left out, the role inherits from nobody; ' +
|
|
111
|
+
'a key that would lead back to this role is refused with `role_cycle`.',
|
|
112
|
+
}),
|
|
113
|
+
}).strict();
|
|
114
|
+
/**
|
|
115
|
+
* `PATCH /api/org/roles/:key`: change a role. Absent leaves a field alone.
|
|
116
|
+
*
|
|
117
|
+
* At least one field is required: an empty patch is a caller mistake, not a
|
|
118
|
+
* request to do nothing. `update_references` and `confirm` only mean something
|
|
119
|
+
* together with `key`.
|
|
120
|
+
*
|
|
121
|
+
* The one-field rule is a `.refine()`, which JSON Schema cannot express, so
|
|
122
|
+
* `patch-org-role-request.schema.json` describes five independent optional
|
|
123
|
+
* fields; the cloud is the only place an empty patch is refused.
|
|
124
|
+
*/
|
|
125
|
+
export const patchOrgRoleRequest = z.object({
|
|
126
|
+
name: roleName.optional().meta({
|
|
127
|
+
description: 'A new display name, 1 to 60 characters; surrounding spaces are removed.',
|
|
128
|
+
}),
|
|
129
|
+
inherits: z.array(roleKey).max(MAX_ORG_ROLES).optional().meta({
|
|
130
|
+
description: 'The role\'s parents from now on. It replaces the whole list; `[]` removes every parent. A list that would lead back to this role is refused with `role_cycle`.',
|
|
131
|
+
}),
|
|
132
|
+
key: roleKey.optional().meta({
|
|
133
|
+
description: 'A new key. On its own, the rename is accepted at once and everything that still names the old key turns into a warning. ' +
|
|
134
|
+
'To rewrite those places as well, add `update_references`.',
|
|
135
|
+
}),
|
|
136
|
+
update_references: z.boolean().optional().meta({
|
|
137
|
+
description: 'With `key`: rewrite every place that names the old key to the new one, in one transaction. Without `confirm`, when there are places ' +
|
|
138
|
+
'to rewrite the call changes nothing and answers `409 confirmation_required` with the preview; a rename with none applies at once and ' +
|
|
139
|
+
'needs no token.',
|
|
140
|
+
}),
|
|
141
|
+
confirm: z.string().min(1).optional().meta({
|
|
142
|
+
description: 'The `confirm` token of the preview the caller was shown. It confirms that preview only; if the places to rewrite have changed since, the call answers a new preview.',
|
|
143
|
+
}),
|
|
144
|
+
}).strict().refine((patch) => Object.values(patch).some((value) => value !== undefined), {
|
|
145
|
+
message: 'A patch names at least one field to change.',
|
|
146
|
+
});
|
|
147
|
+
/**
|
|
148
|
+
* What a rename with `update_references` would rewrite: the `details` of the
|
|
149
|
+
* `409 confirmation_required` that answers it. Repeating the same request with
|
|
150
|
+
* `confirm` set to this token applies the rename.
|
|
151
|
+
*/
|
|
152
|
+
export const roleRenamePreview = z.object({
|
|
153
|
+
from: z.string().meta({ description: 'The key being renamed.' }),
|
|
154
|
+
to: z.string().meta({ description: 'The key it would become.' }),
|
|
155
|
+
references: z.array(referencePlace).meta({
|
|
156
|
+
description: 'Every place that would be rewritten, each with the document it is in and, for a published document, the version the rewrite would create.',
|
|
157
|
+
}),
|
|
158
|
+
reference_count: z.number().int().nonnegative().meta({
|
|
159
|
+
description: 'How many places the rename would rewrite.',
|
|
160
|
+
}),
|
|
161
|
+
confirm: z.string().meta({
|
|
162
|
+
description: 'The token that confirms this preview. It only fits the effects listed here: when anything they cover changes, the token is stale and the call answers a new preview.',
|
|
163
|
+
}),
|
|
164
|
+
});
|
|
165
|
+
/** What each kind of access covers; one place so the request, the response and the docs say the same. */
|
|
166
|
+
const KIND_SCOPE = {
|
|
167
|
+
read: 'Reading datapoints and cameras.',
|
|
168
|
+
invoke: 'Calling services and starting actions.',
|
|
169
|
+
publish: 'Driving a robot through its publishers.',
|
|
170
|
+
assets: 'A robot\'s asset files, such as its URDF and meshes.',
|
|
171
|
+
job_history: 'The history of a robot\'s jobs.',
|
|
172
|
+
};
|
|
173
|
+
/** One property per access kind, so a kind added to `ACCESS_KINDS` is a compile error here and not a silent gap. */
|
|
174
|
+
function perKind(make) {
|
|
175
|
+
return Object.fromEntries(ACCESS_KINDS.map((kind) => [kind, make(KIND_SCOPE[kind])]));
|
|
176
|
+
}
|
|
177
|
+
/** What `GET` and `PUT /api/org/roles/defaults` answer: who holds each kind of access when a robot's configuration says nothing. */
|
|
178
|
+
export const roleDefaultsResponse = z.object({
|
|
179
|
+
defaults: z.object(perKind((scope) => z.array(z.string()).meta({
|
|
180
|
+
description: `${scope} The roles that hold this kind of access by default; an empty list means nobody does, however senior the role.`,
|
|
181
|
+
}))).meta({
|
|
182
|
+
description: 'Every kind of access, each with the keys of the roles that hold it when a robot\'s published configuration names nobody.',
|
|
183
|
+
}),
|
|
184
|
+
});
|
|
185
|
+
/** One kind's default as a caller may write it: a role, several roles, or `null`/`[]` for nobody. */
|
|
186
|
+
const defaultHolders = (scope) => z.union([roleKey, z.array(roleKey).max(MAX_ORG_ROLES), z.null()], {
|
|
187
|
+
error: (issue) => (issue.code === 'invalid_union'
|
|
188
|
+
? 'A default is one role key, `operate`, a list of keys, `[operate, admin]`, or `null` for nobody.'
|
|
189
|
+
: undefined),
|
|
190
|
+
}).optional().meta({
|
|
191
|
+
description: `${scope} One role key, a list of keys, or \`null\` or \`[]\` for nobody. Left out, the kind keeps what it has. A key that names no role is accepted and warns.`,
|
|
192
|
+
});
|
|
193
|
+
/** `PUT /api/org/roles/defaults`: change some defaults and leave the others as they are. */
|
|
194
|
+
export const putRoleDefaultsRequest = z.object({
|
|
195
|
+
defaults: z.object(perKind(defaultHolders)).strict().meta({
|
|
196
|
+
description: 'The kinds to change. A kind that is not named keeps its current default, so this is a patch of the defaults and not a replacement.',
|
|
197
|
+
}),
|
|
198
|
+
}).strict();
|
package/dist/plans.d.ts
CHANGED
|
@@ -29,8 +29,8 @@ export declare const PLAN_ORDER: readonly PlanId[];
|
|
|
29
29
|
*/
|
|
30
30
|
export declare const planLimitKey: z.ZodEnum<{
|
|
31
31
|
apps: "apps";
|
|
32
|
-
seats: "seats";
|
|
33
32
|
robots: "robots";
|
|
33
|
+
seats: "seats";
|
|
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";
|
|
@@ -135,8 +135,8 @@ export type PlanCatalogueEntry = z.infer<typeof planCatalogueEntry>;
|
|
|
135
135
|
*/
|
|
136
136
|
export declare const addonKey: z.ZodEnum<{
|
|
137
137
|
apps: "apps";
|
|
138
|
-
seats: "seats";
|
|
139
138
|
robots: "robots";
|
|
139
|
+
seats: "seats";
|
|
140
140
|
app_user_packs: "app_user_packs";
|
|
141
141
|
live_video_packs: "live_video_packs";
|
|
142
142
|
}>;
|
|
@@ -144,15 +144,15 @@ export type AddonKey = z.infer<typeof addonKey>;
|
|
|
144
144
|
export declare const addonCatalogueEntry: z.ZodObject<{
|
|
145
145
|
key: z.ZodEnum<{
|
|
146
146
|
apps: "apps";
|
|
147
|
-
seats: "seats";
|
|
148
147
|
robots: "robots";
|
|
148
|
+
seats: "seats";
|
|
149
149
|
app_user_packs: "app_user_packs";
|
|
150
150
|
live_video_packs: "live_video_packs";
|
|
151
151
|
}>;
|
|
152
152
|
raises: z.ZodEnum<{
|
|
153
153
|
apps: "apps";
|
|
154
|
-
seats: "seats";
|
|
155
154
|
robots: "robots";
|
|
155
|
+
seats: "seats";
|
|
156
156
|
app_users: "app_users";
|
|
157
157
|
live_video_ms_per_month: "live_video_ms_per_month";
|
|
158
158
|
asset_bytes_per_robot: "asset_bytes_per_robot";
|
|
@@ -574,8 +574,8 @@ export type PlanChangeDecisionStatusResponse = z.infer<typeof planChangeDecision
|
|
|
574
574
|
*/
|
|
575
575
|
export declare const planOverrides: z.ZodObject<{
|
|
576
576
|
apps: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
577
|
-
seats: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
578
577
|
robots: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
578
|
+
seats: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
579
579
|
app_users: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
580
580
|
live_video_ms_per_month: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
581
581
|
asset_bytes_per_robot: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
@@ -609,8 +609,8 @@ export declare const adminPlanChangeRequest: z.ZodObject<{
|
|
|
609
609
|
}, z.core.$strict>>;
|
|
610
610
|
overrides: z.ZodOptional<z.ZodObject<{
|
|
611
611
|
apps: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
612
|
-
seats: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
613
612
|
robots: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
613
|
+
seats: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
614
614
|
app_users: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
615
615
|
live_video_ms_per_month: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
616
616
|
asset_bytes_per_robot: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
package/dist/protocol.d.ts
CHANGED
|
@@ -424,6 +424,7 @@ export declare const cloudConfig: z.ZodObject<{
|
|
|
424
424
|
name: z.ZodOptional<z.ZodString>;
|
|
425
425
|
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
426
426
|
}, z.core.$strict>>>;
|
|
427
|
+
role: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
427
428
|
}, z.core.$strict>>>;
|
|
428
429
|
actions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
429
430
|
ros_name: z.ZodString;
|
|
@@ -455,6 +456,7 @@ export declare const cloudConfig: z.ZodObject<{
|
|
|
455
456
|
description: z.ZodOptional<z.ZodString>;
|
|
456
457
|
}, z.core.$strict>>>;
|
|
457
458
|
description: z.ZodOptional<z.ZodString>;
|
|
459
|
+
role: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
458
460
|
}, z.core.$strict>>>;
|
|
459
461
|
services: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
460
462
|
ros_name: z.ZodString;
|
|
@@ -486,6 +488,7 @@ export declare const cloudConfig: z.ZodObject<{
|
|
|
486
488
|
description: z.ZodOptional<z.ZodString>;
|
|
487
489
|
}, z.core.$strict>>>;
|
|
488
490
|
description: z.ZodOptional<z.ZodString>;
|
|
491
|
+
role: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
489
492
|
}, z.core.$strict>>>;
|
|
490
493
|
publishers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
491
494
|
topic: z.ZodString;
|
|
@@ -522,6 +525,7 @@ export declare const cloudConfig: z.ZodObject<{
|
|
|
522
525
|
}, z.core.$strict>;
|
|
523
526
|
quiet_timeout_ms: z.ZodNumber;
|
|
524
527
|
description: z.ZodOptional<z.ZodString>;
|
|
528
|
+
role: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
525
529
|
}, z.core.$strict>>>;
|
|
526
530
|
cameras: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
527
531
|
source: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -556,12 +560,26 @@ export declare const cloudConfig: z.ZodObject<{
|
|
|
556
560
|
bitrate_kbps: z.ZodNumber;
|
|
557
561
|
snapshot_interval_seconds: z.ZodNumber;
|
|
558
562
|
description: z.ZodOptional<z.ZodString>;
|
|
563
|
+
role: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
559
564
|
}, z.core.$strict>>>;
|
|
565
|
+
access: z.ZodOptional<z.ZodObject<{
|
|
566
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
567
|
+
match: z.ZodString;
|
|
568
|
+
kinds: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
569
|
+
read: "read";
|
|
570
|
+
invoke: "invoke";
|
|
571
|
+
publish: "publish";
|
|
572
|
+
}>>>;
|
|
573
|
+
role: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
|
|
574
|
+
}, z.core.$strict>>>;
|
|
575
|
+
assets: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
576
|
+
job_history: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
577
|
+
}, z.core.$strict>>;
|
|
560
578
|
low_bandwidth: z.ZodOptional<z.ZodObject<{
|
|
561
579
|
mode: z.ZodOptional<z.ZodEnum<{
|
|
562
|
-
off: "off";
|
|
563
580
|
auto: "auto";
|
|
564
581
|
on: "on";
|
|
582
|
+
off: "off";
|
|
565
583
|
}>>;
|
|
566
584
|
enter_lag_ms: z.ZodOptional<z.ZodNumber>;
|
|
567
585
|
enter_after_s: z.ZodOptional<z.ZodNumber>;
|
package/dist/realtime.d.ts
CHANGED
|
@@ -39,7 +39,10 @@ export declare const authOk: z.ZodObject<{
|
|
|
39
39
|
app_user_id: z.ZodNullable<z.ZodUUID>;
|
|
40
40
|
server_key_id: z.ZodNullable<z.ZodUUID>;
|
|
41
41
|
app_id: z.ZodNullable<z.ZodUUID>;
|
|
42
|
-
|
|
42
|
+
role: z.ZodNullable<z.ZodObject<{
|
|
43
|
+
key: z.ZodString;
|
|
44
|
+
name: z.ZodString;
|
|
45
|
+
}, z.core.$strip>>;
|
|
43
46
|
email: z.ZodNullable<z.ZodEmail>;
|
|
44
47
|
two_factor_enabled: z.ZodNullable<z.ZodBoolean>;
|
|
45
48
|
}, z.core.$strip>;
|
|
@@ -329,8 +332,8 @@ export declare const resourceHealthCleared: z.ZodObject<{
|
|
|
329
332
|
}>;
|
|
330
333
|
ref: z.ZodString;
|
|
331
334
|
facet: z.ZodEnum<{
|
|
332
|
-
source: "source";
|
|
333
335
|
publish: "publish";
|
|
336
|
+
source: "source";
|
|
334
337
|
}>;
|
|
335
338
|
cleared_at_ms: z.ZodNumber;
|
|
336
339
|
}, z.core.$strip>;
|
|
@@ -343,8 +346,8 @@ export declare const resourceHealthEvent: z.ZodObject<{
|
|
|
343
346
|
}>;
|
|
344
347
|
ref: z.ZodString;
|
|
345
348
|
facet: z.ZodEnum<{
|
|
346
|
-
source: "source";
|
|
347
349
|
publish: "publish";
|
|
350
|
+
source: "source";
|
|
348
351
|
}>;
|
|
349
352
|
state: z.ZodEnum<{
|
|
350
353
|
unknown: "unknown";
|
package/dist/realtime.js
CHANGED
|
@@ -213,7 +213,7 @@ export const clientSubscribe = z.object({
|
|
|
213
213
|
*/
|
|
214
214
|
/**
|
|
215
215
|
* `publisher` is here even though a publisher is not subscribable: a client
|
|
216
|
-
* that models the five
|
|
216
|
+
* that models the five exposure kinds and honestly names one gets the
|
|
217
217
|
* informative `not_subscribable` the cloud already computes, instead of a
|
|
218
218
|
* `validation_error` reciting an enum. Refusing the *word* rather than the
|
|
219
219
|
* request was the same mistake as the silent wrong-verb subscribe this
|