@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.
Files changed (100) hide show
  1. package/CHANGELOG.md +169 -0
  2. package/artifacts/openapi.json +2092 -787
  3. package/artifacts/routes.json +229 -230
  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-auth-config.schema.json +15 -0
  9. package/artifacts/schema/app-deletion-summary.schema.json +0 -7
  10. package/artifacts/schema/app-invitation-list-response.schema.json +13 -6
  11. package/artifacts/schema/app-invitation.schema.json +5 -5
  12. package/artifacts/schema/app-list-response.schema.json +6 -6
  13. package/artifacts/schema/app-lock.schema.json +30 -0
  14. package/artifacts/schema/app-user-list-response.schema.json +13 -6
  15. package/artifacts/schema/app-user.schema.json +13 -6
  16. package/artifacts/schema/app.schema.json +6 -6
  17. package/artifacts/schema/auth-ok.schema.json +20 -6
  18. package/artifacts/schema/camera-list-response.schema.json +1 -1
  19. package/artifacts/schema/client-identity.schema.json +21 -6
  20. package/artifacts/schema/cloud-config.schema.json +359 -5
  21. package/artifacts/schema/config-draft-response.schema.json +389 -5
  22. package/artifacts/schema/config-version-response.schema.json +389 -5
  23. package/artifacts/schema/config-versions-response.schema.json +30 -0
  24. package/artifacts/schema/create-app-invitation-request.schema.json +4 -4
  25. package/artifacts/schema/create-app-user-request.schema.json +4 -4
  26. package/artifacts/schema/create-org-role-request.schema.json +33 -0
  27. package/artifacts/schema/dangling-reference.schema.json +129 -0
  28. package/artifacts/schema/datapoint-config.schema.json +35 -0
  29. package/artifacts/schema/datapoint-list-response.schema.json +1 -1
  30. package/artifacts/schema/effective-capability.schema.json +104 -0
  31. package/artifacts/schema/effective-rights-query.schema.json +19 -0
  32. package/artifacts/schema/effective-rights-response.schema.json +310 -0
  33. package/artifacts/schema/effective-robot-rights.schema.json +266 -0
  34. package/artifacts/schema/invoke-or-service-response.schema.json +1 -1
  35. package/artifacts/schema/invoke-response.schema.json +1 -1
  36. package/artifacts/schema/journal-intent-v2-body.schema.json +74 -0
  37. package/artifacts/schema/journal-intent-v2.schema.json +84 -0
  38. package/artifacts/schema/journal-replay-receipt-body.schema.json +1 -0
  39. package/artifacts/schema/journal-replay-receipt.schema.json +1 -0
  40. package/artifacts/schema/mcp-robot-datasheet.schema.json +2 -2
  41. package/artifacts/schema/org-role-list-response.schema.json +205 -0
  42. package/artifacts/schema/org-role.schema.json +59 -0
  43. package/artifacts/schema/patch-app-user-request.schema.json +4 -4
  44. package/artifacts/schema/patch-org-role-request.schema.json +38 -0
  45. package/artifacts/schema/publish-config-response.schema.json +48 -1
  46. package/artifacts/schema/publisher-config.schema.json +35 -0
  47. package/artifacts/schema/put-role-defaults-request.schema.json +127 -0
  48. package/artifacts/schema/reference-place.schema.json +111 -0
  49. package/artifacts/schema/rename-slug-response.schema.json +4 -3
  50. package/artifacts/schema/robot-config-doc.schema.json +359 -5
  51. package/artifacts/schema/role-cycle-details.schema.json +18 -0
  52. package/artifacts/schema/role-defaults-response.schema.json +59 -0
  53. package/artifacts/schema/role-rename-preview.schema.json +146 -0
  54. package/artifacts/schema/service-config.schema.json +35 -0
  55. package/artifacts/schema/slug-usage-response.schema.json +4 -3
  56. package/artifacts/schema/update-app-request.schema.json +0 -12
  57. package/dist/app-users.d.ts +30 -10
  58. package/dist/app-users.js +32 -12
  59. package/dist/apps.d.ts +242 -71
  60. package/dist/apps.js +205 -151
  61. package/dist/audit.d.ts +3 -3
  62. package/dist/billing.d.ts +10 -10
  63. package/dist/client-auth.d.ts +5 -2
  64. package/dist/client-auth.js +11 -3
  65. package/dist/client-robots.d.ts +1 -1
  66. package/dist/client-robots.js +1 -1
  67. package/dist/common.d.ts +1 -1
  68. package/dist/common.js +1 -1
  69. package/dist/config-issues.d.ts +1 -1
  70. package/dist/config-issues.js +1 -1
  71. package/dist/config.d.ts +77 -11
  72. package/dist/config.js +108 -14
  73. package/dist/errors.d.ts +14 -5
  74. package/dist/errors.js +37 -24
  75. package/dist/index.d.ts +22 -12
  76. package/dist/index.js +16 -6
  77. package/dist/journal-intents.d.ts +30 -0
  78. package/dist/journal-intents.js +3 -0
  79. package/dist/legal-acceptances.d.ts +2 -2
  80. package/dist/mcp.d.ts +5 -37
  81. package/dist/mcp.js +4 -14
  82. package/dist/org-roles.d.ts +182 -0
  83. package/dist/org-roles.js +198 -0
  84. package/dist/plans.d.ts +6 -6
  85. package/dist/protocol.d.ts +19 -1
  86. package/dist/realtime.d.ts +6 -3
  87. package/dist/realtime.js +1 -1
  88. package/dist/rest.d.ts +104 -25
  89. package/dist/rest.js +67 -29
  90. package/dist/rights.d.ts +197 -0
  91. package/dist/rights.js +396 -0
  92. package/dist/routes.js +190 -148
  93. package/package.json +1 -1
  94. package/artifacts/schema/mcp-role-preview-response.schema.json +0 -134
  95. package/artifacts/schema/role-delete-query.schema.json +0 -13
  96. package/artifacts/schema/role-in-use-details.schema.json +0 -28
  97. package/artifacts/schema/role-list-response.schema.json +0 -48
  98. package/artifacts/schema/role-permissions.schema.json +0 -61
  99. package/artifacts/schema/role-rename-request.schema.json +0 -16
  100. package/artifacts/schema/role.schema.json +0 -35
@@ -0,0 +1,146 @@
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
+ "app_user",
23
+ "invitation",
24
+ "app_default",
25
+ "role_inherits",
26
+ "org_default"
27
+ ],
28
+ "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, `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."
29
+ },
30
+ "label": {
31
+ "type": "string",
32
+ "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`)."
33
+ },
34
+ "path": {
35
+ "anyOf": [
36
+ {
37
+ "type": "string"
38
+ },
39
+ {
40
+ "type": "null"
41
+ }
42
+ ],
43
+ "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 `role_inherits`, the key of the role that inherits from it, because display names are not unique; `null` for every other kind."
44
+ },
45
+ "robot_id": {
46
+ "anyOf": [
47
+ {
48
+ "type": "string",
49
+ "format": "uuid",
50
+ "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)$"
51
+ },
52
+ {
53
+ "type": "null"
54
+ }
55
+ ],
56
+ "description": "The robot whose document holds the key (`config`); `null` for every other kind."
57
+ },
58
+ "app_id": {
59
+ "anyOf": [
60
+ {
61
+ "type": "string",
62
+ "format": "uuid",
63
+ "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)$"
64
+ },
65
+ {
66
+ "type": "null"
67
+ }
68
+ ],
69
+ "description": "The app the user, invitation or default role belongs to (`app_user`, `invitation`, `app_default`); `null` for every other kind."
70
+ },
71
+ "user_id": {
72
+ "anyOf": [
73
+ {
74
+ "type": "string",
75
+ "format": "uuid",
76
+ "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)$"
77
+ },
78
+ {
79
+ "type": "null"
80
+ }
81
+ ],
82
+ "description": "The app user who holds the key (`app_user`); `null` for every other kind."
83
+ },
84
+ "document": {
85
+ "anyOf": [
86
+ {
87
+ "type": "string",
88
+ "enum": [
89
+ "published",
90
+ "draft"
91
+ ]
92
+ },
93
+ {
94
+ "type": "null"
95
+ }
96
+ ],
97
+ "description": "Which version of the robot's document holds the key (`config`): the published one or the draft; `null` for every other kind."
98
+ },
99
+ "new_version": {
100
+ "anyOf": [
101
+ {
102
+ "type": "integer",
103
+ "exclusiveMinimum": 0,
104
+ "maximum": 9007199254740991
105
+ },
106
+ {
107
+ "type": "null"
108
+ }
109
+ ],
110
+ "description": "For a published document, 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."
111
+ }
112
+ },
113
+ "required": [
114
+ "kind",
115
+ "label",
116
+ "path",
117
+ "robot_id",
118
+ "app_id",
119
+ "user_id",
120
+ "document",
121
+ "new_version"
122
+ ],
123
+ "additionalProperties": false
124
+ },
125
+ "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."
126
+ },
127
+ "reference_count": {
128
+ "type": "integer",
129
+ "minimum": 0,
130
+ "maximum": 9007199254740991,
131
+ "description": "How many places the rename would rewrite."
132
+ },
133
+ "confirm": {
134
+ "type": "string",
135
+ "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."
136
+ }
137
+ },
138
+ "required": [
139
+ "from",
140
+ "to",
141
+ "references",
142
+ "reference_count",
143
+ "confirm"
144
+ ],
145
+ "additionalProperties": false
146
+ }
@@ -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>;
@@ -424,10 +424,23 @@ export type AppTwoFactorPolicy = z.infer<typeof appTwoFactorPolicy>;
424
424
  export declare const appHomeUrl: z.ZodURL;
425
425
  /** The accent colour of the hosted pages: `#rrggbb`, lowercase, the one spelling the renderer compares against. */
426
426
  export declare const hostedAccent: z.ZodString;
427
- /** The largest logo the hosted pages take, in bytes: 100 KB. */
428
- export declare const HOSTED_LOGO_MAX_BYTES = 102400;
427
+ /** The largest logo the hosted pages take, in bytes: 512 KB. */
428
+ export declare const HOSTED_LOGO_MAX_BYTES = 524288;
429
429
  /** The logo types the hosted pages take. An SVG is served sandboxed and embedded only as an image. */
430
430
  export declare const HOSTED_LOGO_TYPES: readonly ["image/png", "image/svg+xml"];
431
+ /**
432
+ * **How a stored logo is laid out on the hosted pages.**
433
+ *
434
+ * `wide` is a wordmark: it replaces the app's name. `square` is a mark: it
435
+ * sits beside the name. The cloud reads it from the stored image (its width
436
+ * and height, or an SVG's `viewBox`) and calls an image `wide` when it is more
437
+ * than one and a half times as wide as it is high.
438
+ */
439
+ export declare const hostedLogoShape: z.ZodEnum<{
440
+ square: "square";
441
+ wide: "wide";
442
+ }>;
443
+ export type HostedLogoShape = z.infer<typeof hostedLogoShape>;
431
444
  /**
432
445
  * **The Fleetless-hosted pages an unset URL falls back to**, one per URL
433
446
  * field, as templates with the same placeholder the field takes. Read-only:
@@ -481,6 +494,10 @@ export declare const appAuthConfig: z.ZodObject<{
481
494
  off: "off";
482
495
  }>;
483
496
  hosted_logo_url: z.ZodNullable<z.ZodURL>;
497
+ hosted_logo_shape: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
498
+ square: "square";
499
+ wide: "wide";
500
+ }>>>;
484
501
  hosted_accent: z.ZodNullable<z.ZodString>;
485
502
  hosted_pages: z.ZodObject<{
486
503
  invite_url: z.ZodURL;
@@ -576,6 +593,9 @@ export type MailTemplateKind = z.infer<typeof mailTemplateKind>;
576
593
  * received. That is only worth anything if the permitted set is written down
577
594
  * where the renderer, the console's completion and the docs all read the same
578
595
  * one.
596
+ *
597
+ * `role.name` is the display name of the organization role the invitee will
598
+ * hold, not its key.
579
599
  */
580
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"];
581
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({
@@ -507,10 +512,19 @@ export const appHomeUrl = z
507
512
  }, { message: 'An https URL (http only on localhost) without a placeholder.' });
508
513
  /** The accent colour of the hosted pages: `#rrggbb`, lowercase, the one spelling the renderer compares against. */
509
514
  export const hostedAccent = z.string().regex(/^#[0-9a-f]{6}$/, 'must be a lowercase hex colour, #rrggbb');
510
- /** The largest logo the hosted pages take, in bytes: 100 KB. */
511
- export const HOSTED_LOGO_MAX_BYTES = 102_400;
515
+ /** The largest logo the hosted pages take, in bytes: 512 KB. */
516
+ export const HOSTED_LOGO_MAX_BYTES = 524_288;
512
517
  /** The logo types the hosted pages take. An SVG is served sandboxed and embedded only as an image. */
513
518
  export const HOSTED_LOGO_TYPES = ['image/png', 'image/svg+xml'];
519
+ /**
520
+ * **How a stored logo is laid out on the hosted pages.**
521
+ *
522
+ * `wide` is a wordmark: it replaces the app's name. `square` is a mark: it
523
+ * sits beside the name. The cloud reads it from the stored image (its width
524
+ * and height, or an SVG's `viewBox`) and calls an image `wide` when it is more
525
+ * than one and a half times as wide as it is high.
526
+ */
527
+ export const hostedLogoShape = z.enum(['square', 'wide']);
514
528
  /**
515
529
  * **The Fleetless-hosted pages an unset URL falls back to**, one per URL
516
530
  * field, as templates with the same placeholder the field takes. Read-only:
@@ -584,6 +598,9 @@ export const appAuthConfig = z.object({
584
598
  hosted_logo_url: z.url().nullable().meta({
585
599
  description: 'Where the hosted pages load the app\'s logo from, `<portal>/app/<identifier>/logo`, or `null` when no logo is stored. **Read-only** — the logo is written through `PUT /api/apps/:id/auth-config/logo`.',
586
600
  }),
601
+ hosted_logo_shape: hostedLogoShape.nullable().optional().meta({
602
+ description: 'How the hosted pages lay the logo out: `square` beside the app\'s name, `wide` in place of it. **Read-only** — derived from the stored image, and `null` exactly when `hosted_logo_url` is `null`. An image whose size cannot be read is `square`. Absent when the server predates this field: read an absent field as unknown, not as `square`. The cloud always sends it.',
603
+ }),
587
604
  hosted_accent: hostedAccent.nullable().meta({
588
605
  description: 'The accent colour of the hosted pages, `#rrggbb` in lowercase, or `null` for the neutral shell\'s own.',
589
606
  }),
@@ -653,6 +670,9 @@ export const mailTemplateKind = z.enum(['invite', 'verify', 'reset', 'login_code
653
670
  * received. That is only worth anything if the permitted set is written down
654
671
  * where the renderer, the console's completion and the docs all read the same
655
672
  * one.
673
+ *
674
+ * `role.name` is the display name of the organization role the invitee will
675
+ * hold, not its key.
656
676
  */
657
677
  export const MAIL_TEMPLATE_VARIABLES = [
658
678
  'app.name',