@fleetless/contracts 13.3.0 → 15.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 (182) hide show
  1. package/CHANGELOG.md +304 -0
  2. package/artifacts/openapi.json +20156 -10513
  3. package/artifacts/routes.json +1429 -292
  4. package/artifacts/schema/access-warning.schema.json +51 -0
  5. package/artifacts/schema/action-config.schema.json +35 -0
  6. package/artifacts/schema/addon-catalogue-entry.schema.json +3 -1
  7. package/artifacts/schema/admin-plan-change-request.schema.json +26 -0
  8. package/artifacts/schema/app-access-response.schema.json +136 -0
  9. package/artifacts/schema/app-access.schema.json +80 -0
  10. package/artifacts/schema/app-deletion-summary.schema.json +15 -8
  11. package/artifacts/schema/app-invitation-list-response.schema.json +13 -6
  12. package/artifacts/schema/app-invitation.schema.json +5 -5
  13. package/artifacts/schema/app-list-response.schema.json +6 -6
  14. package/artifacts/schema/app-lock.schema.json +30 -0
  15. package/artifacts/schema/app-user-list-response.schema.json +13 -6
  16. package/artifacts/schema/app-user.schema.json +13 -6
  17. package/artifacts/schema/app.schema.json +6 -6
  18. package/artifacts/schema/asset-plan-limit-details.schema.json +3 -1
  19. package/artifacts/schema/auth-ok.schema.json +20 -6
  20. package/artifacts/schema/camera-list-response.schema.json +1 -1
  21. package/artifacts/schema/client-identity.schema.json +21 -6
  22. package/artifacts/schema/cloud-config.schema.json +359 -5
  23. package/artifacts/schema/collection-actor.schema.json +35 -0
  24. package/artifacts/schema/collection-definitions-response.schema.json +612 -0
  25. package/artifacts/schema/collection-event.schema.json +216 -0
  26. package/artifacts/schema/collection-export-query.schema.json +56 -0
  27. package/artifacts/schema/collection-filter.schema.json +9 -0
  28. package/artifacts/schema/collection-import-preview.schema.json +143 -0
  29. package/artifacts/schema/collection-import-request.schema.json +105 -0
  30. package/artifacts/schema/collection-import-result.schema.json +38 -0
  31. package/artifacts/schema/collection-list-response.schema.json +119 -0
  32. package/artifacts/schema/collection-record-get-query.schema.json +12 -0
  33. package/artifacts/schema/collection-record-history-query.schema.json +35 -0
  34. package/artifacts/schema/collection-record-history-response.schema.json +389 -0
  35. package/artifacts/schema/collection-record-list-query.schema.json +67 -0
  36. package/artifacts/schema/collection-record-list-response.schema.json +212 -0
  37. package/artifacts/schema/collection-record-restore-request.schema.json +14 -0
  38. package/artifacts/schema/collection-record-write.schema.json +31 -0
  39. package/artifacts/schema/collection-record.schema.json +180 -0
  40. package/artifacts/schema/collection-revision.schema.json +295 -0
  41. package/artifacts/schema/collection-subscribe-error.schema.json +31 -0
  42. package/artifacts/schema/collection-subscribe.schema.json +48 -0
  43. package/artifacts/schema/collection-subscribed.schema.json +22 -0
  44. package/artifacts/schema/collection-summary.schema.json +92 -0
  45. package/artifacts/schema/collection-unsubscribe.schema.json +22 -0
  46. package/artifacts/schema/collections-access-change.schema.json +34 -0
  47. package/artifacts/schema/collections-document.schema.json +732 -0
  48. package/artifacts/schema/collections-draft-response.schema.json +845 -0
  49. package/artifacts/schema/collections-effect.schema.json +384 -0
  50. package/artifacts/schema/collections-issue.schema.json +36 -0
  51. package/artifacts/schema/collections-publish-request.schema.json +18 -0
  52. package/artifacts/schema/collections-publish-response.schema.json +450 -0
  53. package/artifacts/schema/collections-purge-preview.schema.json +60 -0
  54. package/artifacts/schema/collections-purge-request.schema.json +27 -0
  55. package/artifacts/schema/collections-purge-response.schema.json +30 -0
  56. package/artifacts/schema/collections-restore-preview-query.schema.json +20 -0
  57. package/artifacts/schema/collections-restore-preview.schema.json +581 -0
  58. package/artifacts/schema/collections-restore-request.schema.json +27 -0
  59. package/artifacts/schema/collections-restore-response.schema.json +455 -0
  60. package/artifacts/schema/collections-schema-preview.schema.json +519 -0
  61. package/artifacts/schema/collections-schema-published.schema.json +22 -0
  62. package/artifacts/schema/collections-version-response.schema.json +869 -0
  63. package/artifacts/schema/collections-version-summary.schema.json +139 -0
  64. package/artifacts/schema/collections-versions-response.schema.json +167 -0
  65. package/artifacts/schema/config-draft-response.schema.json +359 -5
  66. package/artifacts/schema/config-version-response.schema.json +359 -5
  67. package/artifacts/schema/confirmation-required-details.schema.json +13 -0
  68. package/artifacts/schema/create-app-invitation-request.schema.json +4 -4
  69. package/artifacts/schema/create-app-user-request.schema.json +4 -4
  70. package/artifacts/schema/create-org-role-request.schema.json +33 -0
  71. package/artifacts/schema/dangling-reference.schema.json +130 -0
  72. package/artifacts/schema/datapoint-config.schema.json +35 -0
  73. package/artifacts/schema/datapoint-list-response.schema.json +2 -2
  74. package/artifacts/schema/effective-capability.schema.json +104 -0
  75. package/artifacts/schema/effective-rights-query.schema.json +19 -0
  76. package/artifacts/schema/effective-rights-response.schema.json +396 -0
  77. package/artifacts/schema/effective-robot-rights.schema.json +266 -0
  78. package/artifacts/schema/invoke-or-service-response.schema.json +1 -1
  79. package/artifacts/schema/invoke-response.schema.json +1 -1
  80. package/artifacts/schema/journal-intent-v2-body.schema.json +74 -0
  81. package/artifacts/schema/journal-intent-v2.schema.json +84 -0
  82. package/artifacts/schema/journal-replay-receipt-body.schema.json +1 -0
  83. package/artifacts/schema/journal-replay-receipt.schema.json +1 -0
  84. package/artifacts/schema/mcp-robot-datasheet.schema.json +2 -2
  85. package/artifacts/schema/org-plan.schema.json +29 -1
  86. package/artifacts/schema/org-quota-usage-counts.schema.json +18 -0
  87. package/artifacts/schema/org-quota-usage.schema.json +47 -1
  88. package/artifacts/schema/org-quotas.schema.json +29 -1
  89. package/artifacts/schema/org-role-list-response.schema.json +206 -0
  90. package/artifacts/schema/org-role.schema.json +59 -0
  91. package/artifacts/schema/patch-app-user-request.schema.json +4 -4
  92. package/artifacts/schema/patch-org-role-request.schema.json +38 -0
  93. package/artifacts/schema/plan-catalogue-entry.schema.json +29 -1
  94. package/artifacts/schema/plan-change-decision-status-response.schema.json +29 -1
  95. package/artifacts/schema/plan-limit-details.schema.json +3 -1
  96. package/artifacts/schema/plan-limits.schema.json +29 -1
  97. package/artifacts/schema/plan-overrides.schema.json +26 -0
  98. package/artifacts/schema/publish-config-response.schema.json +48 -1
  99. package/artifacts/schema/publisher-config.schema.json +35 -0
  100. package/artifacts/schema/put-collections-draft-request.schema.json +16 -0
  101. package/artifacts/schema/put-role-defaults-request.schema.json +127 -0
  102. package/artifacts/schema/record-changed-details.schema.json +16 -0
  103. package/artifacts/schema/record-referenced-details.schema.json +35 -0
  104. package/artifacts/schema/reference-invalid-details.schema.json +25 -0
  105. package/artifacts/schema/reference-place.schema.json +112 -0
  106. package/artifacts/schema/rename-slug-response.schema.json +4 -3
  107. package/artifacts/schema/required-missing-details.schema.json +19 -0
  108. package/artifacts/schema/robot-config-doc.schema.json +359 -5
  109. package/artifacts/schema/robot-deletion-summary.schema.json +33 -1
  110. package/artifacts/schema/role-collection-rights.schema.json +82 -0
  111. package/artifacts/schema/role-cycle-details.schema.json +18 -0
  112. package/artifacts/schema/role-defaults-response.schema.json +59 -0
  113. package/artifacts/schema/role-rename-preview.schema.json +147 -0
  114. package/artifacts/schema/service-config.schema.json +35 -0
  115. package/artifacts/schema/slug-usage-response.schema.json +4 -3
  116. package/artifacts/schema/update-app-request.schema.json +0 -12
  117. package/dist/app-users.d.ts +11 -8
  118. package/dist/app-users.js +18 -10
  119. package/dist/apps.d.ts +258 -71
  120. package/dist/apps.js +215 -151
  121. package/dist/audit.d.ts +35 -5
  122. package/dist/audit.js +40 -2
  123. package/dist/billing.d.ts +10 -10
  124. package/dist/client-auth.d.ts +5 -2
  125. package/dist/client-auth.js +11 -3
  126. package/dist/client-robots.d.ts +1 -1
  127. package/dist/client-robots.js +1 -1
  128. package/dist/collections-issues.d.ts +67 -0
  129. package/dist/collections-issues.js +340 -0
  130. package/dist/collections-records.d.ts +562 -0
  131. package/dist/collections-records.js +525 -0
  132. package/dist/collections-rights.d.ts +17 -0
  133. package/dist/collections-rights.js +41 -0
  134. package/dist/collections-schema.d.ts +1064 -0
  135. package/dist/collections-schema.js +386 -0
  136. package/dist/collections-templates.d.ts +55 -0
  137. package/dist/collections-templates.js +137 -0
  138. package/dist/collections-transfer.d.ts +101 -0
  139. package/dist/collections-transfer.js +206 -0
  140. package/dist/collections-values.d.ts +67 -0
  141. package/dist/collections-values.js +284 -0
  142. package/dist/collections.d.ts +568 -0
  143. package/dist/collections.js +332 -0
  144. package/dist/common.d.ts +1 -1
  145. package/dist/common.js +1 -1
  146. package/dist/config-issues.d.ts +1 -1
  147. package/dist/config-issues.js +1 -1
  148. package/dist/config.d.ts +78 -12
  149. package/dist/config.js +109 -15
  150. package/dist/errors.d.ts +63 -5
  151. package/dist/errors.js +152 -24
  152. package/dist/index.d.ts +40 -14
  153. package/dist/index.js +27 -7
  154. package/dist/journal-intents.d.ts +30 -0
  155. package/dist/journal-intents.js +3 -0
  156. package/dist/legal-acceptances.d.ts +2 -2
  157. package/dist/mcp.d.ts +5 -37
  158. package/dist/mcp.js +4 -14
  159. package/dist/org-roles.d.ts +186 -0
  160. package/dist/org-roles.js +199 -0
  161. package/dist/plans.d.ts +25 -7
  162. package/dist/plans.js +21 -1
  163. package/dist/protocol.d.ts +19 -1
  164. package/dist/realtime.d.ts +172 -3
  165. package/dist/realtime.js +164 -1
  166. package/dist/rest.d.ts +104 -53
  167. package/dist/rest.js +79 -55
  168. package/dist/rights.d.ts +197 -0
  169. package/dist/rights.js +396 -0
  170. package/dist/routes.d.ts +1 -1
  171. package/dist/routes.js +675 -150
  172. package/package.json +1 -1
  173. package/artifacts/schema/mcp-role-preview-response.schema.json +0 -134
  174. package/artifacts/schema/put-robot-details-request.schema.json +0 -41
  175. package/artifacts/schema/put-robot-details-response.schema.json +0 -43
  176. package/artifacts/schema/robot-details-doc.schema.json +0 -33
  177. package/artifacts/schema/role-delete-query.schema.json +0 -13
  178. package/artifacts/schema/role-in-use-details.schema.json +0 -28
  179. package/artifacts/schema/role-list-response.schema.json +0 -48
  180. package/artifacts/schema/role-permissions.schema.json +0 -61
  181. package/artifacts/schema/role-rename-request.schema.json +0 -16
  182. package/artifacts/schema/role.schema.json +0 -35
@@ -0,0 +1,59 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "type": "object",
4
+ "properties": {
5
+ "defaults": {
6
+ "type": "object",
7
+ "properties": {
8
+ "read": {
9
+ "type": "array",
10
+ "items": {
11
+ "type": "string"
12
+ },
13
+ "description": "Reading datapoints and cameras. The roles that hold this kind of access by default; an empty list means nobody does, however senior the role."
14
+ },
15
+ "invoke": {
16
+ "type": "array",
17
+ "items": {
18
+ "type": "string"
19
+ },
20
+ "description": "Calling services and starting actions. The roles that hold this kind of access by default; an empty list means nobody does, however senior the role."
21
+ },
22
+ "publish": {
23
+ "type": "array",
24
+ "items": {
25
+ "type": "string"
26
+ },
27
+ "description": "Driving a robot through its publishers. The roles that hold this kind of access by default; an empty list means nobody does, however senior the role."
28
+ },
29
+ "assets": {
30
+ "type": "array",
31
+ "items": {
32
+ "type": "string"
33
+ },
34
+ "description": "A robot's asset files, such as its URDF and meshes. The roles that hold this kind of access by default; an empty list means nobody does, however senior the role."
35
+ },
36
+ "job_history": {
37
+ "type": "array",
38
+ "items": {
39
+ "type": "string"
40
+ },
41
+ "description": "The history of a robot's jobs. The roles that hold this kind of access by default; an empty list means nobody does, however senior the role."
42
+ }
43
+ },
44
+ "required": [
45
+ "read",
46
+ "invoke",
47
+ "publish",
48
+ "assets",
49
+ "job_history"
50
+ ],
51
+ "additionalProperties": false,
52
+ "description": "Every kind of access, each with the keys of the roles that hold it when a robot's published configuration names nobody."
53
+ }
54
+ },
55
+ "required": [
56
+ "defaults"
57
+ ],
58
+ "additionalProperties": false
59
+ }
@@ -0,0 +1,147 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "type": "object",
4
+ "properties": {
5
+ "from": {
6
+ "type": "string",
7
+ "description": "The key being renamed."
8
+ },
9
+ "to": {
10
+ "type": "string",
11
+ "description": "The key it would become."
12
+ },
13
+ "references": {
14
+ "type": "array",
15
+ "items": {
16
+ "type": "object",
17
+ "properties": {
18
+ "kind": {
19
+ "type": "string",
20
+ "enum": [
21
+ "config",
22
+ "collection_schema",
23
+ "app_user",
24
+ "invitation",
25
+ "app_default",
26
+ "role_inherits",
27
+ "org_default"
28
+ ],
29
+ "description": "What writes the key: `config` is a `role` or `access` value in a robot's `fleetless.yaml`, `collection_schema` an `access` entry of a collection in an app's collections schema, `app_user` an app user who holds it, `invitation` an invitation that carries it, `app_default` an app's default role, `role_inherits` another role that inherits from it, and `org_default` one of the organization's defaults."
30
+ },
31
+ "label": {
32
+ "type": "string",
33
+ "description": "What a person reads to find the place: the robot name (`config`), the app name (`collection_schema`, `app_default`), the e-mail address of the app user or of the invitee (`app_user`, `invitation`), the name of the inheriting role (`role_inherits`), or the access kind of an organization default (`org_default`)."
34
+ },
35
+ "path": {
36
+ "anyOf": [
37
+ {
38
+ "type": "string"
39
+ },
40
+ {
41
+ "type": "null"
42
+ }
43
+ ],
44
+ "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 `collection_schema`, the place in the collections schema, such as `collections.notes.access.update.own[1]`; for `role_inherits`, the key of the role that inherits from it, because display names are not unique; `null` for every other kind."
45
+ },
46
+ "robot_id": {
47
+ "anyOf": [
48
+ {
49
+ "type": "string",
50
+ "format": "uuid",
51
+ "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)$"
52
+ },
53
+ {
54
+ "type": "null"
55
+ }
56
+ ],
57
+ "description": "The robot whose document holds the key (`config`); `null` for every other kind."
58
+ },
59
+ "app_id": {
60
+ "anyOf": [
61
+ {
62
+ "type": "string",
63
+ "format": "uuid",
64
+ "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)$"
65
+ },
66
+ {
67
+ "type": "null"
68
+ }
69
+ ],
70
+ "description": "The app the key belongs to: the app whose collections schema holds it (`collection_schema`), or the app of the user, invitation or default role (`app_user`, `invitation`, `app_default`); `null` for every other kind."
71
+ },
72
+ "user_id": {
73
+ "anyOf": [
74
+ {
75
+ "type": "string",
76
+ "format": "uuid",
77
+ "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)$"
78
+ },
79
+ {
80
+ "type": "null"
81
+ }
82
+ ],
83
+ "description": "The app user who holds the key (`app_user`); `null` for every other kind."
84
+ },
85
+ "document": {
86
+ "anyOf": [
87
+ {
88
+ "type": "string",
89
+ "enum": [
90
+ "published",
91
+ "draft"
92
+ ]
93
+ },
94
+ {
95
+ "type": "null"
96
+ }
97
+ ],
98
+ "description": "Which version of the document holds the key (`config`: the robot's configuration, `collection_schema`: the app's collections schema): the published one or the draft; `null` for every other kind."
99
+ },
100
+ "new_version": {
101
+ "anyOf": [
102
+ {
103
+ "type": "integer",
104
+ "exclusiveMinimum": 0,
105
+ "maximum": 9007199254740991
106
+ },
107
+ {
108
+ "type": "null"
109
+ }
110
+ ],
111
+ "description": "For a published document (`config` or `collection_schema`), the version number a rename with `update_references` would give it, a copy that differs only in the key; `null` for a draft and for every place that is no document."
112
+ }
113
+ },
114
+ "required": [
115
+ "kind",
116
+ "label",
117
+ "path",
118
+ "robot_id",
119
+ "app_id",
120
+ "user_id",
121
+ "document",
122
+ "new_version"
123
+ ],
124
+ "additionalProperties": false
125
+ },
126
+ "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."
127
+ },
128
+ "reference_count": {
129
+ "type": "integer",
130
+ "minimum": 0,
131
+ "maximum": 9007199254740991,
132
+ "description": "How many places the rename would rewrite."
133
+ },
134
+ "confirm": {
135
+ "type": "string",
136
+ "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."
137
+ }
138
+ },
139
+ "required": [
140
+ "from",
141
+ "to",
142
+ "references",
143
+ "reference_count",
144
+ "confirm"
145
+ ],
146
+ "additionalProperties": false
147
+ }
@@ -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 call this service: 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": [
@@ -2,10 +2,11 @@
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "type": "object",
4
4
  "properties": {
5
- "grant_count": {
5
+ "lock_count": {
6
6
  "type": "integer",
7
7
  "minimum": 0,
8
- "maximum": 9007199254740991
8
+ "maximum": 9007199254740991,
9
+ "description": "The app locks that list this slug, which a rename would extend with the new name. The count is what the rename rewrites, in every app of the organization."
9
10
  },
10
11
  "app_identifiers": {
11
12
  "type": "array",
@@ -23,7 +24,7 @@
23
24
  }
24
25
  },
25
26
  "required": [
26
- "grant_count",
27
+ "lock_count",
27
28
  "app_identifiers",
28
29
  "has_recorded_history",
29
30
  "alert_count"
@@ -14,18 +14,6 @@
14
14
  "format": "uuid",
15
15
  "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)$"
16
16
  }
17
- },
18
- "default_role_id": {
19
- "anyOf": [
20
- {
21
- "type": "string",
22
- "format": "uuid",
23
- "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)$"
24
- },
25
- {
26
- "type": "null"
27
- }
28
- ]
29
17
  }
30
18
  },
31
19
  "additionalProperties": false
@@ -78,7 +78,7 @@ export declare const appUser: z.ZodObject<{
78
78
  app_id: z.ZodUUID;
79
79
  email: z.ZodEmail;
80
80
  display_name: z.ZodNullable<z.ZodString>;
81
- role_id: z.ZodUUID;
81
+ role: z.ZodNullable<z.ZodString>;
82
82
  status: z.ZodEnum<{
83
83
  pending_verification: "pending_verification";
84
84
  active: "active";
@@ -102,7 +102,7 @@ export declare const appUserListResponse: z.ZodObject<{
102
102
  app_id: z.ZodUUID;
103
103
  email: z.ZodEmail;
104
104
  display_name: z.ZodNullable<z.ZodString>;
105
- role_id: z.ZodUUID;
105
+ role: z.ZodNullable<z.ZodString>;
106
106
  status: z.ZodEnum<{
107
107
  pending_verification: "pending_verification";
108
108
  active: "active";
@@ -132,7 +132,7 @@ export declare const createAppUserRequest: z.ZodObject<{
132
132
  email: z.ZodEmail;
133
133
  password: z.ZodString;
134
134
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
135
- role_id: z.ZodOptional<z.ZodUUID>;
135
+ role: z.ZodOptional<z.ZodString>;
136
136
  }, z.core.$strict>;
137
137
  export type CreateAppUserRequest = z.infer<typeof createAppUserRequest>;
138
138
  /**
@@ -153,7 +153,7 @@ export type CreateAppUserRequest = z.infer<typeof createAppUserRequest>;
153
153
  */
154
154
  export declare const patchAppUserRequest: z.ZodObject<{
155
155
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
156
- role_id: z.ZodOptional<z.ZodUUID>;
156
+ role: z.ZodOptional<z.ZodString>;
157
157
  status: z.ZodOptional<z.ZodEnum<{
158
158
  active: "active";
159
159
  blocked: "blocked";
@@ -167,7 +167,7 @@ export type PatchAppUserRequest = z.infer<typeof patchAppUserRequest>;
167
167
  */
168
168
  export declare const createAppInvitationRequest: z.ZodObject<{
169
169
  email: z.ZodEmail;
170
- role_id: z.ZodOptional<z.ZodUUID>;
170
+ role: z.ZodOptional<z.ZodString>;
171
171
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
172
172
  send_mail: z.ZodBoolean;
173
173
  }, z.core.$strict>;
@@ -184,7 +184,7 @@ export declare const appInvitation: z.ZodObject<{
184
184
  id: z.ZodUUID;
185
185
  app_id: z.ZodUUID;
186
186
  email: z.ZodEmail;
187
- role_id: z.ZodUUID;
187
+ role: z.ZodString;
188
188
  expires_at: z.ZodISODateTime;
189
189
  accept_url: z.ZodURL;
190
190
  mail: z.ZodEnum<{
@@ -212,7 +212,7 @@ export declare const pendingAppInvitation: z.ZodObject<{
212
212
  email: z.ZodEmail;
213
213
  expires_at: z.ZodISODateTime;
214
214
  app_id: z.ZodUUID;
215
- role_id: z.ZodUUID;
215
+ role: z.ZodNullable<z.ZodString>;
216
216
  }, z.core.$strip>;
217
217
  export type PendingAppInvitation = z.infer<typeof pendingAppInvitation>;
218
218
  /** `GET /api/apps/:id/invitations` — pending only. An accepted invitation is history, not something to revoke. */
@@ -222,7 +222,7 @@ export declare const appInvitationListResponse: z.ZodObject<{
222
222
  email: z.ZodEmail;
223
223
  expires_at: z.ZodISODateTime;
224
224
  app_id: z.ZodUUID;
225
- role_id: z.ZodUUID;
225
+ role: z.ZodNullable<z.ZodString>;
226
226
  }, z.core.$strip>>;
227
227
  }, z.core.$strip>;
228
228
  export type AppInvitationListResponse = z.infer<typeof appInvitationListResponse>;
@@ -593,6 +593,9 @@ export type MailTemplateKind = z.infer<typeof mailTemplateKind>;
593
593
  * received. That is only worth anything if the permitted set is written down
594
594
  * where the renderer, the console's completion and the docs all read the same
595
595
  * one.
596
+ *
597
+ * `role.name` is the display name of the organization role the invitee will
598
+ * hold, not its key.
596
599
  */
597
600
  export declare const MAIL_TEMPLATE_VARIABLES: readonly ["app.name", "org.name", "user.email", "user.display_name", "role.name", "link", "expires_in_hours", "code", "expires_in_minutes", "app.operator_info_url", "app.privacy_policy_url"];
598
601
  /**
package/dist/app-users.js CHANGED
@@ -2,6 +2,7 @@
2
2
  import { z } from 'zod';
3
3
  import { idpIssuer, mailStatus, password } from './identity.js';
4
4
  import { httpsLegalUrl } from './legal.js';
5
+ import { roleKey } from './rights.js';
5
6
  /**
6
7
  * **App users: the per-app identity space.**
7
8
  *
@@ -86,8 +87,8 @@ export const appUser = z.object({
86
87
  display_name: z.string().min(1).max(APP_USER_DISPLAY_NAME_MAX).nullable().meta({
87
88
  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.',
88
89
  }),
89
- role_id: z.uuid().meta({
90
- 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.',
90
+ role: roleKey.nullable().meta({
91
+ 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.',
91
92
  }),
92
93
  status: appUserStatus.meta({
93
94
  description: 'Where the account is in its lifecycle. Only `active` may log in; `pending_verification` and `blocked` are both refused with the same `invalid_credentials` a wrong password gets, so a failed login is not an account-enumeration oracle.',
@@ -151,8 +152,8 @@ export const createAppUserRequest = z
151
152
  display_name: z.string().min(1).max(APP_USER_DISPLAY_NAME_MAX).nullable().optional().meta({
152
153
  description: 'Optional human name. Absent leaves it unset; an explicit `null` is the same end state.',
153
154
  }),
154
- role_id: z.uuid().optional().meta({
155
- description: 'The role the new user holds. Absent means the app\'s `default_role_id`, and `409 target_state_conflict` when the app has none or its default no longer resolves; a role belonging to another app is `404 not_found`, the same refusal a role that never existed gets.',
155
+ role: roleKey.optional().meta({
156
+ description: 'The role the new user holds, by key. Absent means the app\'s `default_role`, and `409 target_state_conflict` naming `default_role` when the app has none. A key that names no role is accepted and grants nothing; `GET /api/org/roles` lists it under `dangling`.',
156
157
  }),
157
158
  })
158
159
  .strict();
@@ -177,8 +178,8 @@ export const patchAppUserRequest = z
177
178
  display_name: z.string().min(1).max(APP_USER_DISPLAY_NAME_MAX).nullable().optional().meta({
178
179
  description: 'The user\'s display name. Absent leaves it alone; an explicit `null` clears it.',
179
180
  }),
180
- role_id: z.uuid().optional().meta({
181
- description: 'The role the user holds from now on. A role belonging to another app is `404 not_found`, the same refusal a role that never existed gets; re-roling closes the user\'s live subscriptions.',
181
+ role: roleKey.optional().meta({
182
+ description: 'The role the user holds from now on, by key. A key that names no role is accepted and grants nothing. The change applies at once: the user\'s live subscriptions are re-checked against the new role, and those it no longer allows end.',
182
183
  }),
183
184
  status: z.enum(['active', 'blocked']).meta({
184
185
  description: 'Block the account or let it back in. **`pending_verification` cannot be set here**: it is reached only by self-registration and left only by spending the mailed verification token, so a developer setting it would strand the account in a state nothing re-mails them out of.',
@@ -195,8 +196,8 @@ export const createAppInvitationRequest = z
195
196
  email: z.email().meta({
196
197
  description: 'The address to invite. An invitation always bypasses the domain whitelist — a developer inviting somebody by hand has already made the decision the whitelist automates.',
197
198
  }),
198
- role_id: z.uuid().optional().meta({
199
- description: 'The role the invitee gets on acceptance. Absent means the app\'s `default_role_id`.',
199
+ role: roleKey.optional().meta({
200
+ description: 'The role the invitee gets on acceptance, by key. Absent means the app\'s `default_role`, and `409 target_state_conflict` naming `default_role` when the app has none. A key that names no role is accepted and grants nothing.',
200
201
  }),
201
202
  display_name: z.string().min(1).max(APP_USER_DISPLAY_NAME_MAX).nullable().optional().meta({
202
203
  description: 'An optional name to pre-fill the account with; the invitee can change it afterwards.',
@@ -218,7 +219,7 @@ export const appInvitation = z.object({
218
219
  id: z.uuid().meta({ description: 'The invitation, as listed and revoked by the developer.' }),
219
220
  app_id: z.uuid().meta({ description: 'The app the invitee will belong to.' }),
220
221
  email: z.email().meta({ description: 'The address the invitation was addressed to.' }),
221
- role_id: z.uuid().meta({ 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.' }),
222
+ role: roleKey.meta({ 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.' }),
222
223
  expires_at: z.iso.datetime().meta({ description: 'When the token stops working. Seven days from issue; an expired token answers exactly as an unknown one does.' }),
223
224
  accept_url: z.url().max(500).meta({
224
225
  description: 'The link to give the invitee: the app\'s `invite_url` with the token substituted for `{token}`, or the Fleetless-hosted invitation page when the app has configured none. Bounded like every other URL that gets mailed, logged and rendered.',
@@ -239,7 +240,11 @@ export const appInvitation = z.object({
239
240
  * `mail` is omitted for a duller reason: it described what happened at
240
241
  * creation time, and re-serving it invites a reader to take it as current.
241
242
  */
242
- export const pendingAppInvitation = appInvitation.omit({ accept_url: true, mail: true });
243
+ export const pendingAppInvitation = appInvitation.omit({ accept_url: true, mail: true }).extend({
244
+ role: roleKey.nullable().meta({
245
+ 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.',
246
+ }),
247
+ });
243
248
  /** `GET /api/apps/:id/invitations` — pending only. An accepted invitation is history, not something to revoke. */
244
249
  export const appInvitationListResponse = z.object({
245
250
  invitations: z.array(pendingAppInvitation).meta({
@@ -665,6 +670,9 @@ export const mailTemplateKind = z.enum(['invite', 'verify', 'reset', 'login_code
665
670
  * received. That is only worth anything if the permitted set is written down
666
671
  * where the renderer, the console's completion and the docs all read the same
667
672
  * one.
673
+ *
674
+ * `role.name` is the display name of the organization role the invitee will
675
+ * hold, not its key.
668
676
  */
669
677
  export const MAIL_TEMPLATE_VARIABLES = [
670
678
  'app.name',