@fleetless/contracts 13.3.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.
Files changed (98) hide show
  1. package/CHANGELOG.md +141 -0
  2. package/artifacts/openapi.json +1983 -784
  3. package/artifacts/routes.json +224 -208
  4. package/artifacts/schema/access-warning.schema.json +51 -0
  5. package/artifacts/schema/action-config.schema.json +35 -0
  6. package/artifacts/schema/app-access-response.schema.json +136 -0
  7. package/artifacts/schema/app-access.schema.json +80 -0
  8. package/artifacts/schema/app-deletion-summary.schema.json +0 -7
  9. package/artifacts/schema/app-invitation-list-response.schema.json +13 -6
  10. package/artifacts/schema/app-invitation.schema.json +5 -5
  11. package/artifacts/schema/app-list-response.schema.json +6 -6
  12. package/artifacts/schema/app-lock.schema.json +30 -0
  13. package/artifacts/schema/app-user-list-response.schema.json +13 -6
  14. package/artifacts/schema/app-user.schema.json +13 -6
  15. package/artifacts/schema/app.schema.json +6 -6
  16. package/artifacts/schema/auth-ok.schema.json +20 -6
  17. package/artifacts/schema/camera-list-response.schema.json +1 -1
  18. package/artifacts/schema/client-identity.schema.json +21 -6
  19. package/artifacts/schema/cloud-config.schema.json +359 -5
  20. package/artifacts/schema/config-draft-response.schema.json +359 -5
  21. package/artifacts/schema/config-version-response.schema.json +359 -5
  22. package/artifacts/schema/create-app-invitation-request.schema.json +4 -4
  23. package/artifacts/schema/create-app-user-request.schema.json +4 -4
  24. package/artifacts/schema/create-org-role-request.schema.json +33 -0
  25. package/artifacts/schema/dangling-reference.schema.json +129 -0
  26. package/artifacts/schema/datapoint-config.schema.json +35 -0
  27. package/artifacts/schema/datapoint-list-response.schema.json +1 -1
  28. package/artifacts/schema/effective-capability.schema.json +104 -0
  29. package/artifacts/schema/effective-rights-query.schema.json +19 -0
  30. package/artifacts/schema/effective-rights-response.schema.json +310 -0
  31. package/artifacts/schema/effective-robot-rights.schema.json +266 -0
  32. package/artifacts/schema/invoke-or-service-response.schema.json +1 -1
  33. package/artifacts/schema/invoke-response.schema.json +1 -1
  34. package/artifacts/schema/journal-intent-v2-body.schema.json +74 -0
  35. package/artifacts/schema/journal-intent-v2.schema.json +84 -0
  36. package/artifacts/schema/journal-replay-receipt-body.schema.json +1 -0
  37. package/artifacts/schema/journal-replay-receipt.schema.json +1 -0
  38. package/artifacts/schema/mcp-robot-datasheet.schema.json +2 -2
  39. package/artifacts/schema/org-role-list-response.schema.json +205 -0
  40. package/artifacts/schema/org-role.schema.json +59 -0
  41. package/artifacts/schema/patch-app-user-request.schema.json +4 -4
  42. package/artifacts/schema/patch-org-role-request.schema.json +38 -0
  43. package/artifacts/schema/publish-config-response.schema.json +48 -1
  44. package/artifacts/schema/publisher-config.schema.json +35 -0
  45. package/artifacts/schema/put-role-defaults-request.schema.json +127 -0
  46. package/artifacts/schema/reference-place.schema.json +111 -0
  47. package/artifacts/schema/rename-slug-response.schema.json +4 -3
  48. package/artifacts/schema/robot-config-doc.schema.json +359 -5
  49. package/artifacts/schema/role-cycle-details.schema.json +18 -0
  50. package/artifacts/schema/role-defaults-response.schema.json +59 -0
  51. package/artifacts/schema/role-rename-preview.schema.json +146 -0
  52. package/artifacts/schema/service-config.schema.json +35 -0
  53. package/artifacts/schema/slug-usage-response.schema.json +4 -3
  54. package/artifacts/schema/update-app-request.schema.json +0 -12
  55. package/dist/app-users.d.ts +11 -8
  56. package/dist/app-users.js +18 -10
  57. package/dist/apps.d.ts +242 -71
  58. package/dist/apps.js +205 -151
  59. package/dist/audit.d.ts +3 -3
  60. package/dist/billing.d.ts +10 -10
  61. package/dist/client-auth.d.ts +5 -2
  62. package/dist/client-auth.js +11 -3
  63. package/dist/client-robots.d.ts +1 -1
  64. package/dist/client-robots.js +1 -1
  65. package/dist/common.d.ts +1 -1
  66. package/dist/common.js +1 -1
  67. package/dist/config-issues.d.ts +1 -1
  68. package/dist/config-issues.js +1 -1
  69. package/dist/config.d.ts +77 -11
  70. package/dist/config.js +108 -14
  71. package/dist/errors.d.ts +14 -5
  72. package/dist/errors.js +37 -24
  73. package/dist/index.d.ts +18 -8
  74. package/dist/index.js +14 -4
  75. package/dist/journal-intents.d.ts +30 -0
  76. package/dist/journal-intents.js +3 -0
  77. package/dist/legal-acceptances.d.ts +2 -2
  78. package/dist/mcp.d.ts +5 -37
  79. package/dist/mcp.js +4 -14
  80. package/dist/org-roles.d.ts +182 -0
  81. package/dist/org-roles.js +198 -0
  82. package/dist/plans.d.ts +6 -6
  83. package/dist/protocol.d.ts +19 -1
  84. package/dist/realtime.d.ts +6 -3
  85. package/dist/realtime.js +1 -1
  86. package/dist/rest.d.ts +76 -25
  87. package/dist/rest.js +41 -29
  88. package/dist/rights.d.ts +197 -0
  89. package/dist/rights.js +396 -0
  90. package/dist/routes.js +185 -134
  91. package/package.json +1 -1
  92. package/artifacts/schema/mcp-role-preview-response.schema.json +0 -134
  93. package/artifacts/schema/role-delete-query.schema.json +0 -13
  94. package/artifacts/schema/role-in-use-details.schema.json +0 -28
  95. package/artifacts/schema/role-list-response.schema.json +0 -48
  96. package/artifacts/schema/role-permissions.schema.json +0 -61
  97. package/artifacts/schema/role-rename-request.schema.json +0 -16
  98. package/artifacts/schema/role.schema.json +0 -35
@@ -0,0 +1,51 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "type": "object",
4
+ "properties": {
5
+ "code": {
6
+ "type": "string",
7
+ "enum": [
8
+ "unknown_default_role",
9
+ "unknown_lock_slug",
10
+ "lock_robot_not_attached"
11
+ ],
12
+ "description": "`unknown_default_role`: the default role names no role of the organization. `unknown_lock_slug`: a lock names a slug the robot has no published exposure for. `lock_robot_not_attached`: a lock names a robot that is not attached to the app."
13
+ },
14
+ "message": {
15
+ "type": "string",
16
+ "minLength": 1,
17
+ "description": "A sentence a person can read, naming the key, robot or slug."
18
+ },
19
+ "robot_id": {
20
+ "anyOf": [
21
+ {
22
+ "type": "string",
23
+ "format": "uuid",
24
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
25
+ },
26
+ {
27
+ "type": "null"
28
+ }
29
+ ],
30
+ "description": "The robot a lock warning is about; `null` for `unknown_default_role`."
31
+ },
32
+ "slug": {
33
+ "anyOf": [
34
+ {
35
+ "type": "string"
36
+ },
37
+ {
38
+ "type": "null"
39
+ }
40
+ ],
41
+ "description": "The slug an `unknown_lock_slug` warning is about; `null` for the other warnings."
42
+ }
43
+ },
44
+ "required": [
45
+ "code",
46
+ "message",
47
+ "robot_id",
48
+ "slug"
49
+ ],
50
+ "additionalProperties": false
51
+ }
@@ -177,6 +177,41 @@
177
177
  "type": "string",
178
178
  "minLength": 1,
179
179
  "maxLength": 2000
180
+ },
181
+ "role": {
182
+ "anyOf": [
183
+ {
184
+ "type": "string",
185
+ "pattern": "^(?!defaults$)[a-z][a-z0-9_]{0,62}$",
186
+ "patternErrorMessage": "A role key is lower-case: it starts with a letter and continues with letters, digits and underscores, up to 63 characters in all — `operate`, `night_shift`. A capital, a dash, a dot, a space or a leading digit is refused, and `defaults` is reserved."
187
+ },
188
+ {
189
+ "minItems": 1,
190
+ "maxItems": 50,
191
+ "type": "array",
192
+ "items": {
193
+ "type": "string",
194
+ "pattern": "^(?!defaults$)[a-z][a-z0-9_]{0,62}$",
195
+ "patternErrorMessage": "A role key is lower-case: it starts with a letter and continues with letters, digits and underscores, up to 63 characters in all — `operate`, `night_shift`. A capital, a dash, a dot, a space or a leading digit is refused, and `defaults` is reserved."
196
+ }
197
+ }
198
+ ],
199
+ "defaultSnippets": [
200
+ {
201
+ "label": "one role",
202
+ "description": "The role that may use this; a role that inherits from it may too.",
203
+ "body": "${1:operate}"
204
+ },
205
+ {
206
+ "label": "any of several roles",
207
+ "description": "A list of roles; holding one of them, or inheriting from one, is enough.",
208
+ "body": [
209
+ "${1:operate}",
210
+ "${2:admin}"
211
+ ]
212
+ }
213
+ ],
214
+ "description": "Which role may start this action: one role key, or a list of keys when several roles qualify. A role qualifies when it, or a role it inherits from, is named. Without this, the first rule of `access.rules` that fits the entry decides, and without a fitting rule the organization's default for `invoke` applies. A key that names no role of the organization is a warning when you publish, never an error, and grants nothing. The robot ignores it; the cloud enforces it."
180
215
  }
181
216
  },
182
217
  "required": [
@@ -0,0 +1,136 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "type": "object",
4
+ "properties": {
5
+ "default_role": {
6
+ "anyOf": [
7
+ {
8
+ "type": "string",
9
+ "pattern": "^(?!defaults$)[a-z][a-z0-9_]{0,62}$",
10
+ "patternErrorMessage": "A role key is lower-case: it starts with a letter and continues with letters, digits and underscores, up to 63 characters in all — `operate`, `night_shift`. A capital, a dash, a dot, a space or a leading digit is refused, and `defaults` is reserved."
11
+ },
12
+ {
13
+ "type": "null"
14
+ }
15
+ ],
16
+ "description": "The role, by key, that an app user gets when created, invited or self-registered without an explicit one. `null` means the app has none, and a create or invite that names no role is refused. A key that names no role is accepted and warns; it grants nothing."
17
+ },
18
+ "locked_kinds": {
19
+ "maxItems": 5,
20
+ "type": "array",
21
+ "items": {
22
+ "type": "string",
23
+ "enum": [
24
+ "read",
25
+ "invoke",
26
+ "publish",
27
+ "assets",
28
+ "job_history"
29
+ ]
30
+ },
31
+ "uniqueItems": true,
32
+ "description": "Kinds of access locked for every user and server key of the app, on every robot it reaches: `read`, `invoke`, `publish`, `assets` or `job_history`, each at most once. The only way to lock `assets` or `job_history`, which belong to the robot as a whole."
33
+ },
34
+ "locked": {
35
+ "maxItems": 1000,
36
+ "type": "array",
37
+ "items": {
38
+ "type": "object",
39
+ "properties": {
40
+ "robot_id": {
41
+ "type": "string",
42
+ "format": "uuid",
43
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
44
+ "description": "The robot whose capabilities are locked for this app."
45
+ },
46
+ "slugs": {
47
+ "minItems": 1,
48
+ "maxItems": 2000,
49
+ "type": "array",
50
+ "items": {
51
+ "type": "string",
52
+ "minLength": 2,
53
+ "maxLength": 63,
54
+ "pattern": "^[a-z][a-z0-9]*(?:_[a-z0-9]+)*$"
55
+ },
56
+ "uniqueItems": true,
57
+ "description": "The slugs of that robot's exposures to lock, at least one and each named once, at most 2000. A slug the robot has no exposure for is accepted and warns, and locks nothing."
58
+ }
59
+ },
60
+ "required": [
61
+ "robot_id",
62
+ "slugs"
63
+ ],
64
+ "additionalProperties": false
65
+ },
66
+ "description": "Single exposures locked on single robots, one entry per robot and at most 1000. A lock never grants anything: it only takes away what a role would give."
67
+ },
68
+ "revision": {
69
+ "type": "string",
70
+ "pattern": "^[0-9a-f]{64}$",
71
+ "description": "The revision of the access as it stands. Send it back as `revision` of the next `PUT` to have that write refused when the access has changed in between."
72
+ },
73
+ "warnings": {
74
+ "type": "array",
75
+ "items": {
76
+ "type": "object",
77
+ "properties": {
78
+ "code": {
79
+ "type": "string",
80
+ "enum": [
81
+ "unknown_default_role",
82
+ "unknown_lock_slug",
83
+ "lock_robot_not_attached"
84
+ ],
85
+ "description": "`unknown_default_role`: the default role names no role of the organization. `unknown_lock_slug`: a lock names a slug the robot has no published exposure for. `lock_robot_not_attached`: a lock names a robot that is not attached to the app."
86
+ },
87
+ "message": {
88
+ "type": "string",
89
+ "minLength": 1,
90
+ "description": "A sentence a person can read, naming the key, robot or slug."
91
+ },
92
+ "robot_id": {
93
+ "anyOf": [
94
+ {
95
+ "type": "string",
96
+ "format": "uuid",
97
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
98
+ },
99
+ {
100
+ "type": "null"
101
+ }
102
+ ],
103
+ "description": "The robot a lock warning is about; `null` for `unknown_default_role`."
104
+ },
105
+ "slug": {
106
+ "anyOf": [
107
+ {
108
+ "type": "string"
109
+ },
110
+ {
111
+ "type": "null"
112
+ }
113
+ ],
114
+ "description": "The slug an `unknown_lock_slug` warning is about; `null` for the other warnings."
115
+ }
116
+ },
117
+ "required": [
118
+ "code",
119
+ "message",
120
+ "robot_id",
121
+ "slug"
122
+ ],
123
+ "additionalProperties": false
124
+ },
125
+ "description": "What the access names that does not exist as written. Empty when nothing is out of step."
126
+ }
127
+ },
128
+ "required": [
129
+ "default_role",
130
+ "locked_kinds",
131
+ "locked",
132
+ "revision",
133
+ "warnings"
134
+ ],
135
+ "additionalProperties": false
136
+ }
@@ -0,0 +1,80 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "type": "object",
4
+ "properties": {
5
+ "default_role": {
6
+ "anyOf": [
7
+ {
8
+ "type": "string",
9
+ "pattern": "^(?!defaults$)[a-z][a-z0-9_]{0,62}$",
10
+ "patternErrorMessage": "A role key is lower-case: it starts with a letter and continues with letters, digits and underscores, up to 63 characters in all — `operate`, `night_shift`. A capital, a dash, a dot, a space or a leading digit is refused, and `defaults` is reserved."
11
+ },
12
+ {
13
+ "type": "null"
14
+ }
15
+ ],
16
+ "description": "The role, by key, that an app user gets when created, invited or self-registered without an explicit one. `null` means the app has none, and a create or invite that names no role is refused. A key that names no role is accepted and warns; it grants nothing."
17
+ },
18
+ "locked_kinds": {
19
+ "maxItems": 5,
20
+ "type": "array",
21
+ "items": {
22
+ "type": "string",
23
+ "enum": [
24
+ "read",
25
+ "invoke",
26
+ "publish",
27
+ "assets",
28
+ "job_history"
29
+ ]
30
+ },
31
+ "uniqueItems": true,
32
+ "description": "Kinds of access locked for every user and server key of the app, on every robot it reaches: `read`, `invoke`, `publish`, `assets` or `job_history`, each at most once. The only way to lock `assets` or `job_history`, which belong to the robot as a whole."
33
+ },
34
+ "locked": {
35
+ "maxItems": 1000,
36
+ "type": "array",
37
+ "items": {
38
+ "type": "object",
39
+ "properties": {
40
+ "robot_id": {
41
+ "type": "string",
42
+ "format": "uuid",
43
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
44
+ "description": "The robot whose capabilities are locked for this app."
45
+ },
46
+ "slugs": {
47
+ "minItems": 1,
48
+ "maxItems": 2000,
49
+ "type": "array",
50
+ "items": {
51
+ "type": "string",
52
+ "minLength": 2,
53
+ "maxLength": 63,
54
+ "pattern": "^[a-z][a-z0-9]*(?:_[a-z0-9]+)*$"
55
+ },
56
+ "uniqueItems": true,
57
+ "description": "The slugs of that robot's exposures to lock, at least one and each named once, at most 2000. A slug the robot has no exposure for is accepted and warns, and locks nothing."
58
+ }
59
+ },
60
+ "required": [
61
+ "robot_id",
62
+ "slugs"
63
+ ],
64
+ "additionalProperties": false
65
+ },
66
+ "description": "Single exposures locked on single robots, one entry per robot and at most 1000. A lock never grants anything: it only takes away what a role would give."
67
+ },
68
+ "revision": {
69
+ "description": "The `revision` of the access this body was composed from, as `GET` or `PUT /api/apps/:id/access` answered it. When it is sent and the stored access has changed since, the write is refused with `409 target_state_conflict` naming `revision` (rule `stale`) and nothing is written; read the access again and compose the body anew. Left out, the body replaces whatever is stored: the last writer wins.",
70
+ "type": "string",
71
+ "pattern": "^[0-9a-f]{64}$"
72
+ }
73
+ },
74
+ "required": [
75
+ "default_role",
76
+ "locked_kinds",
77
+ "locked"
78
+ ],
79
+ "additionalProperties": false
80
+ }
@@ -8,12 +8,6 @@
8
8
  "maximum": 9007199254740991,
9
9
  "description": "App users deleted with the app. They are the developer's own customers, not Fleetless users, and exist in no other app."
10
10
  },
11
- "role_count": {
12
- "type": "integer",
13
- "minimum": 0,
14
- "maximum": 9007199254740991,
15
- "description": "Roles deleted with the app, each with its per-robot slug grants."
16
- },
17
11
  "server_key_count": {
18
12
  "type": "integer",
19
13
  "minimum": 0,
@@ -41,7 +35,6 @@
41
35
  },
42
36
  "required": [
43
37
  "user_count",
44
- "role_count",
45
38
  "server_key_count",
46
39
  "invitation_count",
47
40
  "oidc_provider_count",
@@ -25,11 +25,18 @@
25
25
  "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$",
26
26
  "description": "The address the invitation was addressed to."
27
27
  },
28
- "role_id": {
29
- "type": "string",
30
- "format": "uuid",
31
- "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
32
- "description": "The role the invitee holds once they accept. Resolved at creation, so a later change to the app's default role does not silently re-aim an outstanding invitation."
28
+ "role": {
29
+ "anyOf": [
30
+ {
31
+ "type": "string",
32
+ "pattern": "^(?!defaults$)[a-z][a-z0-9_]{0,62}$",
33
+ "patternErrorMessage": "A role key is lower-case: it starts with a letter and continues with letters, digits and underscores, up to 63 characters in all — `operate`, `night_shift`. A capital, a dash, a dot, a space or a leading digit is refused, and `defaults` is reserved."
34
+ },
35
+ {
36
+ "type": "null"
37
+ }
38
+ ],
39
+ "description": "The key of the role the invitee holds once they accept, or `null` for an invitation that holds none and whose app has no default role to stand in for it. Such an invitation is answered `409 target_state_conflict` naming `default_role` when it is accepted or reissued: set the app's default role, or revoke it and invite again. A role deleted in the meantime leaves the key behind, and it grants nothing."
33
40
  },
34
41
  "expires_at": {
35
42
  "type": "string",
@@ -42,7 +49,7 @@
42
49
  "id",
43
50
  "app_id",
44
51
  "email",
45
- "role_id",
52
+ "role",
46
53
  "expires_at"
47
54
  ],
48
55
  "additionalProperties": false
@@ -20,11 +20,11 @@
20
20
  "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$",
21
21
  "description": "The address the invitation was addressed to."
22
22
  },
23
- "role_id": {
23
+ "role": {
24
24
  "type": "string",
25
- "format": "uuid",
26
- "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
27
- "description": "The role the invitee holds once they accept. Resolved at creation, so a later change to the app's default role does not silently re-aim an outstanding invitation."
25
+ "pattern": "^(?!defaults$)[a-z][a-z0-9_]{0,62}$",
26
+ "patternErrorMessage": "A role key is lower-case: it starts with a letter and continues with letters, digits and underscores, up to 63 characters in all — `operate`, `night_shift`. A capital, a dash, a dot, a space or a leading digit is refused, and `defaults` is reserved.",
27
+ "description": "The key of the role the invitee holds once they accept. Resolved at creation, so a later change to the app's default role does not silently re-aim an outstanding invitation. A role deleted in the meantime leaves the key behind, and it grants nothing."
28
28
  },
29
29
  "expires_at": {
30
30
  "type": "string",
@@ -53,7 +53,7 @@
53
53
  "id",
54
54
  "app_id",
55
55
  "email",
56
- "role_id",
56
+ "role",
57
57
  "expires_at",
58
58
  "accept_url",
59
59
  "mail"
@@ -39,20 +39,20 @@
39
39
  "format": "uuid",
40
40
  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
41
41
  },
42
- "description": "The robots this app may reach, each referenced individually. Tags never grant rights, and a robot absent from this list is invisible to the app whatever a role grants."
42
+ "description": "The robots this app may reach, each referenced individually. Tags never grant rights, and a robot absent from this list is invisible to the app. What a user of the app may use on an attached robot follows that robot's `fleetless.yaml` and the organization's defaults, less what the app locks."
43
43
  },
44
- "default_role_id": {
44
+ "default_role": {
45
45
  "anyOf": [
46
46
  {
47
47
  "type": "string",
48
- "format": "uuid",
49
- "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
48
+ "pattern": "^(?!defaults$)[a-z][a-z0-9_]{0,62}$",
49
+ "patternErrorMessage": "A role key is lower-case: it starts with a letter and continues with letters, digits and underscores, up to 63 characters in all — `operate`, `night_shift`. A capital, a dash, a dot, a space or a leading digit is refused, and `defaults` is reserved."
50
50
  },
51
51
  {
52
52
  "type": "null"
53
53
  }
54
54
  ],
55
- "description": "The role an app user gets when created or invited without an explicit one. `null` means this app has not chosen a default, the normal state of an app created before its roles were configured — and then a create or invite that omits `role_id` gets `validation_error`, not a user with no role. An invitation resolves the role when issued, so changing this never re-aims an outstanding one. The role must belong to this app, which `PATCH /api/apps/:id` checks and the schema cannot."
55
+ "description": "The role, by key, that an app user gets when created, invited or self-registered without an explicit one. `null` means this app has not chosen a default, the normal state of an app until someone picks one, and then a create or invite that names no role is refused. An invitation resolves the role when issued, so changing this never re-aims an outstanding one. The key is shown as stored and may name no role, which grants nothing; `GET /api/apps/:id/access` warns about it. It is set by `PUT /api/apps/:id/access`, not by `PATCH /api/apps/:id`."
56
56
  },
57
57
  "created_at": {
58
58
  "type": "string",
@@ -67,7 +67,7 @@
67
67
  "name",
68
68
  "identifier",
69
69
  "robot_ids",
70
- "default_role_id",
70
+ "default_role",
71
71
  "created_at"
72
72
  ],
73
73
  "additionalProperties": false
@@ -0,0 +1,30 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "type": "object",
4
+ "properties": {
5
+ "robot_id": {
6
+ "type": "string",
7
+ "format": "uuid",
8
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
9
+ "description": "The robot whose capabilities are locked for this app."
10
+ },
11
+ "slugs": {
12
+ "minItems": 1,
13
+ "maxItems": 2000,
14
+ "type": "array",
15
+ "items": {
16
+ "type": "string",
17
+ "minLength": 2,
18
+ "maxLength": 63,
19
+ "pattern": "^[a-z][a-z0-9]*(?:_[a-z0-9]+)*$"
20
+ },
21
+ "uniqueItems": true,
22
+ "description": "The slugs of that robot's exposures to lock, at least one and each named once, at most 2000. A slug the robot has no exposure for is accepted and warns, and locks nothing."
23
+ }
24
+ },
25
+ "required": [
26
+ "robot_id",
27
+ "slugs"
28
+ ],
29
+ "additionalProperties": false
30
+ }
@@ -38,11 +38,18 @@
38
38
  ],
39
39
  "description": "Optional human name, shown by the developer's own UI instead of the address where present. `null` when the user never supplied one; never used for authentication."
40
40
  },
41
- "role_id": {
42
- "type": "string",
43
- "format": "uuid",
44
- "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
45
- "description": "The role that decides what this user may reach. Roles are the only visibility filter: what a role does not grant does not exist for that user."
41
+ "role": {
42
+ "anyOf": [
43
+ {
44
+ "type": "string",
45
+ "pattern": "^(?!defaults$)[a-z][a-z0-9_]{0,62}$",
46
+ "patternErrorMessage": "A role key is lower-case: it starts with a letter and continues with letters, digits and underscores, up to 63 characters in all — `operate`, `night_shift`. A capital, a dash, a dot, a space or a leading digit is refused, and `defaults` is reserved."
47
+ },
48
+ {
49
+ "type": "null"
50
+ }
51
+ ],
52
+ "description": "The key of the organization role this user holds, or `null` for an account that holds none (one the move to organization roles could not map to a key). The role, the robots' `fleetless.yaml` and what the app locks decide what the user may reach: what none of them grants does not exist for that user. The key is shown as stored, and it may name no role (the role was deleted since): that grants nothing, and the user can still sign in. Without a key the user reaches nothing and can still sign in; `PATCH /api/apps/:id/users/:userId` sets one."
46
53
  },
47
54
  "status": {
48
55
  "type": "string",
@@ -127,7 +134,7 @@
127
134
  "app_id",
128
135
  "email",
129
136
  "display_name",
130
- "role_id",
137
+ "role",
131
138
  "status",
132
139
  "has_password",
133
140
  "providers",
@@ -33,11 +33,18 @@
33
33
  ],
34
34
  "description": "Optional human name, shown by the developer's own UI instead of the address where present. `null` when the user never supplied one; never used for authentication."
35
35
  },
36
- "role_id": {
37
- "type": "string",
38
- "format": "uuid",
39
- "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
40
- "description": "The role that decides what this user may reach. Roles are the only visibility filter: what a role does not grant does not exist for that user."
36
+ "role": {
37
+ "anyOf": [
38
+ {
39
+ "type": "string",
40
+ "pattern": "^(?!defaults$)[a-z][a-z0-9_]{0,62}$",
41
+ "patternErrorMessage": "A role key is lower-case: it starts with a letter and continues with letters, digits and underscores, up to 63 characters in all — `operate`, `night_shift`. A capital, a dash, a dot, a space or a leading digit is refused, and `defaults` is reserved."
42
+ },
43
+ {
44
+ "type": "null"
45
+ }
46
+ ],
47
+ "description": "The key of the organization role this user holds, or `null` for an account that holds none (one the move to organization roles could not map to a key). The role, the robots' `fleetless.yaml` and what the app locks decide what the user may reach: what none of them grants does not exist for that user. The key is shown as stored, and it may name no role (the role was deleted since): that grants nothing, and the user can still sign in. Without a key the user reaches nothing and can still sign in; `PATCH /api/apps/:id/users/:userId` sets one."
41
48
  },
42
49
  "status": {
43
50
  "type": "string",
@@ -122,7 +129,7 @@
122
129
  "app_id",
123
130
  "email",
124
131
  "display_name",
125
- "role_id",
132
+ "role",
126
133
  "status",
127
134
  "has_password",
128
135
  "providers",
@@ -34,20 +34,20 @@
34
34
  "format": "uuid",
35
35
  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
36
36
  },
37
- "description": "The robots this app may reach, each referenced individually. Tags never grant rights, and a robot absent from this list is invisible to the app whatever a role grants."
37
+ "description": "The robots this app may reach, each referenced individually. Tags never grant rights, and a robot absent from this list is invisible to the app. What a user of the app may use on an attached robot follows that robot's `fleetless.yaml` and the organization's defaults, less what the app locks."
38
38
  },
39
- "default_role_id": {
39
+ "default_role": {
40
40
  "anyOf": [
41
41
  {
42
42
  "type": "string",
43
- "format": "uuid",
44
- "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
43
+ "pattern": "^(?!defaults$)[a-z][a-z0-9_]{0,62}$",
44
+ "patternErrorMessage": "A role key is lower-case: it starts with a letter and continues with letters, digits and underscores, up to 63 characters in all — `operate`, `night_shift`. A capital, a dash, a dot, a space or a leading digit is refused, and `defaults` is reserved."
45
45
  },
46
46
  {
47
47
  "type": "null"
48
48
  }
49
49
  ],
50
- "description": "The role an app user gets when created or invited without an explicit one. `null` means this app has not chosen a default, the normal state of an app created before its roles were configured — and then a create or invite that omits `role_id` gets `validation_error`, not a user with no role. An invitation resolves the role when issued, so changing this never re-aims an outstanding one. The role must belong to this app, which `PATCH /api/apps/:id` checks and the schema cannot."
50
+ "description": "The role, by key, that an app user gets when created, invited or self-registered without an explicit one. `null` means this app has not chosen a default, the normal state of an app until someone picks one, and then a create or invite that names no role is refused. An invitation resolves the role when issued, so changing this never re-aims an outstanding one. The key is shown as stored and may name no role, which grants nothing; `GET /api/apps/:id/access` warns about it. It is set by `PUT /api/apps/:id/access`, not by `PATCH /api/apps/:id`."
51
51
  },
52
52
  "created_at": {
53
53
  "type": "string",
@@ -62,7 +62,7 @@
62
62
  "name",
63
63
  "identifier",
64
64
  "robot_ids",
65
- "default_role_id",
65
+ "default_role",
66
66
  "created_at"
67
67
  ],
68
68
  "additionalProperties": false
@@ -70,18 +70,32 @@
70
70
  ],
71
71
  "description": "The app this session belongs to, and `null` for a developer — a developer is organisation-scoped and owns the configuration of every robot in the organisation rather than reaching one through an app."
72
72
  },
73
- "role_id": {
73
+ "role": {
74
74
  "anyOf": [
75
75
  {
76
- "type": "string",
77
- "format": "uuid",
78
- "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
76
+ "type": "object",
77
+ "properties": {
78
+ "key": {
79
+ "type": "string",
80
+ "pattern": "^(?!defaults$)[a-z][a-z0-9_]{0,62}$",
81
+ "patternErrorMessage": "A role key is lower-case: it starts with a letter and continues with letters, digits and underscores, up to 63 characters in all — `operate`, `night_shift`. A capital, a dash, a dot, a space or a leading digit is refused, and `defaults` is reserved.",
82
+ "description": "The role's key, the same string `fleetless.yaml` and the organization's role list write."
83
+ },
84
+ "name": {
85
+ "type": "string",
86
+ "description": "The role's display name, for showing the caller what they hold. Changing it changes nothing about rights."
87
+ }
88
+ },
89
+ "required": [
90
+ "key",
91
+ "name"
92
+ ]
79
93
  },
80
94
  {
81
95
  "type": "null"
82
96
  }
83
97
  ],
84
- "description": "The role that decides what this caller may reach, and `null` for a developer. Roles are the only visibility filter: what a role does not grant does not exist for that user."
98
+ "description": "The organization role that decides what this caller may reach: its key and display name. `null` when there is no role to name: for a developer and for a server key, which are not filtered by a role, and for an app user whose key names no role (the role was deleted), who then reaches nothing."
85
99
  },
86
100
  "email": {
87
101
  "anyOf": [
@@ -114,7 +128,7 @@
114
128
  "app_user_id",
115
129
  "server_key_id",
116
130
  "app_id",
117
- "role_id",
131
+ "role",
118
132
  "email",
119
133
  "two_factor_enabled"
120
134
  ]
@@ -48,7 +48,7 @@
48
48
  ],
49
49
  "additionalProperties": false
50
50
  },
51
- "description": "Every camera the published configuration exposes on this robot **and** the caller's role grants. A developer sees all of them; an end user sees what their role allows."
51
+ "description": "Every camera the published configuration exposes on this robot **and** the caller's role may use. A developer sees all of them; an end user sees what their role allows."
52
52
  }
53
53
  },
54
54
  "required": [