@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.
- package/CHANGELOG.md +304 -0
- package/artifacts/openapi.json +20156 -10513
- package/artifacts/routes.json +1429 -292
- package/artifacts/schema/access-warning.schema.json +51 -0
- package/artifacts/schema/action-config.schema.json +35 -0
- package/artifacts/schema/addon-catalogue-entry.schema.json +3 -1
- package/artifacts/schema/admin-plan-change-request.schema.json +26 -0
- package/artifacts/schema/app-access-response.schema.json +136 -0
- package/artifacts/schema/app-access.schema.json +80 -0
- package/artifacts/schema/app-deletion-summary.schema.json +15 -8
- package/artifacts/schema/app-invitation-list-response.schema.json +13 -6
- package/artifacts/schema/app-invitation.schema.json +5 -5
- package/artifacts/schema/app-list-response.schema.json +6 -6
- package/artifacts/schema/app-lock.schema.json +30 -0
- package/artifacts/schema/app-user-list-response.schema.json +13 -6
- package/artifacts/schema/app-user.schema.json +13 -6
- package/artifacts/schema/app.schema.json +6 -6
- package/artifacts/schema/asset-plan-limit-details.schema.json +3 -1
- package/artifacts/schema/auth-ok.schema.json +20 -6
- package/artifacts/schema/camera-list-response.schema.json +1 -1
- package/artifacts/schema/client-identity.schema.json +21 -6
- package/artifacts/schema/cloud-config.schema.json +359 -5
- package/artifacts/schema/collection-actor.schema.json +35 -0
- package/artifacts/schema/collection-definitions-response.schema.json +612 -0
- package/artifacts/schema/collection-event.schema.json +216 -0
- package/artifacts/schema/collection-export-query.schema.json +56 -0
- package/artifacts/schema/collection-filter.schema.json +9 -0
- package/artifacts/schema/collection-import-preview.schema.json +143 -0
- package/artifacts/schema/collection-import-request.schema.json +105 -0
- package/artifacts/schema/collection-import-result.schema.json +38 -0
- package/artifacts/schema/collection-list-response.schema.json +119 -0
- package/artifacts/schema/collection-record-get-query.schema.json +12 -0
- package/artifacts/schema/collection-record-history-query.schema.json +35 -0
- package/artifacts/schema/collection-record-history-response.schema.json +389 -0
- package/artifacts/schema/collection-record-list-query.schema.json +67 -0
- package/artifacts/schema/collection-record-list-response.schema.json +212 -0
- package/artifacts/schema/collection-record-restore-request.schema.json +14 -0
- package/artifacts/schema/collection-record-write.schema.json +31 -0
- package/artifacts/schema/collection-record.schema.json +180 -0
- package/artifacts/schema/collection-revision.schema.json +295 -0
- package/artifacts/schema/collection-subscribe-error.schema.json +31 -0
- package/artifacts/schema/collection-subscribe.schema.json +48 -0
- package/artifacts/schema/collection-subscribed.schema.json +22 -0
- package/artifacts/schema/collection-summary.schema.json +92 -0
- package/artifacts/schema/collection-unsubscribe.schema.json +22 -0
- package/artifacts/schema/collections-access-change.schema.json +34 -0
- package/artifacts/schema/collections-document.schema.json +732 -0
- package/artifacts/schema/collections-draft-response.schema.json +845 -0
- package/artifacts/schema/collections-effect.schema.json +384 -0
- package/artifacts/schema/collections-issue.schema.json +36 -0
- package/artifacts/schema/collections-publish-request.schema.json +18 -0
- package/artifacts/schema/collections-publish-response.schema.json +450 -0
- package/artifacts/schema/collections-purge-preview.schema.json +60 -0
- package/artifacts/schema/collections-purge-request.schema.json +27 -0
- package/artifacts/schema/collections-purge-response.schema.json +30 -0
- package/artifacts/schema/collections-restore-preview-query.schema.json +20 -0
- package/artifacts/schema/collections-restore-preview.schema.json +581 -0
- package/artifacts/schema/collections-restore-request.schema.json +27 -0
- package/artifacts/schema/collections-restore-response.schema.json +455 -0
- package/artifacts/schema/collections-schema-preview.schema.json +519 -0
- package/artifacts/schema/collections-schema-published.schema.json +22 -0
- package/artifacts/schema/collections-version-response.schema.json +869 -0
- package/artifacts/schema/collections-version-summary.schema.json +139 -0
- package/artifacts/schema/collections-versions-response.schema.json +167 -0
- package/artifacts/schema/config-draft-response.schema.json +359 -5
- package/artifacts/schema/config-version-response.schema.json +359 -5
- package/artifacts/schema/confirmation-required-details.schema.json +13 -0
- package/artifacts/schema/create-app-invitation-request.schema.json +4 -4
- package/artifacts/schema/create-app-user-request.schema.json +4 -4
- package/artifacts/schema/create-org-role-request.schema.json +33 -0
- package/artifacts/schema/dangling-reference.schema.json +130 -0
- package/artifacts/schema/datapoint-config.schema.json +35 -0
- package/artifacts/schema/datapoint-list-response.schema.json +2 -2
- package/artifacts/schema/effective-capability.schema.json +104 -0
- package/artifacts/schema/effective-rights-query.schema.json +19 -0
- package/artifacts/schema/effective-rights-response.schema.json +396 -0
- package/artifacts/schema/effective-robot-rights.schema.json +266 -0
- package/artifacts/schema/invoke-or-service-response.schema.json +1 -1
- package/artifacts/schema/invoke-response.schema.json +1 -1
- package/artifacts/schema/journal-intent-v2-body.schema.json +74 -0
- package/artifacts/schema/journal-intent-v2.schema.json +84 -0
- package/artifacts/schema/journal-replay-receipt-body.schema.json +1 -0
- package/artifacts/schema/journal-replay-receipt.schema.json +1 -0
- package/artifacts/schema/mcp-robot-datasheet.schema.json +2 -2
- package/artifacts/schema/org-plan.schema.json +29 -1
- package/artifacts/schema/org-quota-usage-counts.schema.json +18 -0
- package/artifacts/schema/org-quota-usage.schema.json +47 -1
- package/artifacts/schema/org-quotas.schema.json +29 -1
- package/artifacts/schema/org-role-list-response.schema.json +206 -0
- package/artifacts/schema/org-role.schema.json +59 -0
- package/artifacts/schema/patch-app-user-request.schema.json +4 -4
- package/artifacts/schema/patch-org-role-request.schema.json +38 -0
- package/artifacts/schema/plan-catalogue-entry.schema.json +29 -1
- package/artifacts/schema/plan-change-decision-status-response.schema.json +29 -1
- package/artifacts/schema/plan-limit-details.schema.json +3 -1
- package/artifacts/schema/plan-limits.schema.json +29 -1
- package/artifacts/schema/plan-overrides.schema.json +26 -0
- package/artifacts/schema/publish-config-response.schema.json +48 -1
- package/artifacts/schema/publisher-config.schema.json +35 -0
- package/artifacts/schema/put-collections-draft-request.schema.json +16 -0
- package/artifacts/schema/put-role-defaults-request.schema.json +127 -0
- package/artifacts/schema/record-changed-details.schema.json +16 -0
- package/artifacts/schema/record-referenced-details.schema.json +35 -0
- package/artifacts/schema/reference-invalid-details.schema.json +25 -0
- package/artifacts/schema/reference-place.schema.json +112 -0
- package/artifacts/schema/rename-slug-response.schema.json +4 -3
- package/artifacts/schema/required-missing-details.schema.json +19 -0
- package/artifacts/schema/robot-config-doc.schema.json +359 -5
- package/artifacts/schema/robot-deletion-summary.schema.json +33 -1
- package/artifacts/schema/role-collection-rights.schema.json +82 -0
- package/artifacts/schema/role-cycle-details.schema.json +18 -0
- package/artifacts/schema/role-defaults-response.schema.json +59 -0
- package/artifacts/schema/role-rename-preview.schema.json +147 -0
- package/artifacts/schema/service-config.schema.json +35 -0
- package/artifacts/schema/slug-usage-response.schema.json +4 -3
- package/artifacts/schema/update-app-request.schema.json +0 -12
- package/dist/app-users.d.ts +11 -8
- package/dist/app-users.js +18 -10
- package/dist/apps.d.ts +258 -71
- package/dist/apps.js +215 -151
- package/dist/audit.d.ts +35 -5
- package/dist/audit.js +40 -2
- package/dist/billing.d.ts +10 -10
- package/dist/client-auth.d.ts +5 -2
- package/dist/client-auth.js +11 -3
- package/dist/client-robots.d.ts +1 -1
- package/dist/client-robots.js +1 -1
- package/dist/collections-issues.d.ts +67 -0
- package/dist/collections-issues.js +340 -0
- package/dist/collections-records.d.ts +562 -0
- package/dist/collections-records.js +525 -0
- package/dist/collections-rights.d.ts +17 -0
- package/dist/collections-rights.js +41 -0
- package/dist/collections-schema.d.ts +1064 -0
- package/dist/collections-schema.js +386 -0
- package/dist/collections-templates.d.ts +55 -0
- package/dist/collections-templates.js +137 -0
- package/dist/collections-transfer.d.ts +101 -0
- package/dist/collections-transfer.js +206 -0
- package/dist/collections-values.d.ts +67 -0
- package/dist/collections-values.js +284 -0
- package/dist/collections.d.ts +568 -0
- package/dist/collections.js +332 -0
- package/dist/common.d.ts +1 -1
- package/dist/common.js +1 -1
- package/dist/config-issues.d.ts +1 -1
- package/dist/config-issues.js +1 -1
- package/dist/config.d.ts +78 -12
- package/dist/config.js +109 -15
- package/dist/errors.d.ts +63 -5
- package/dist/errors.js +152 -24
- package/dist/index.d.ts +40 -14
- package/dist/index.js +27 -7
- package/dist/journal-intents.d.ts +30 -0
- package/dist/journal-intents.js +3 -0
- package/dist/legal-acceptances.d.ts +2 -2
- package/dist/mcp.d.ts +5 -37
- package/dist/mcp.js +4 -14
- package/dist/org-roles.d.ts +186 -0
- package/dist/org-roles.js +199 -0
- package/dist/plans.d.ts +25 -7
- package/dist/plans.js +21 -1
- package/dist/protocol.d.ts +19 -1
- package/dist/realtime.d.ts +172 -3
- package/dist/realtime.js +164 -1
- package/dist/rest.d.ts +104 -53
- package/dist/rest.js +79 -55
- package/dist/rights.d.ts +197 -0
- package/dist/rights.js +396 -0
- package/dist/routes.d.ts +1 -1
- package/dist/routes.js +675 -150
- package/package.json +1 -1
- package/artifacts/schema/mcp-role-preview-response.schema.json +0 -134
- package/artifacts/schema/put-robot-details-request.schema.json +0 -41
- package/artifacts/schema/put-robot-details-response.schema.json +0 -43
- package/artifacts/schema/robot-details-doc.schema.json +0 -33
- package/artifacts/schema/role-delete-query.schema.json +0 -13
- package/artifacts/schema/role-in-use-details.schema.json +0 -28
- package/artifacts/schema/role-list-response.schema.json +0 -48
- package/artifacts/schema/role-permissions.schema.json +0 -61
- package/artifacts/schema/role-rename-request.schema.json +0 -16
- package/artifacts/schema/role.schema.json +0 -35
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { ACCESS_KINDS, MAX_ORG_ROLES, ROLE_NAME_MAX, roleKey } from './rights.js';
|
|
4
|
+
/**
|
|
5
|
+
* Organization roles on the wire: the roles themselves, what names them, and
|
|
6
|
+
* the organization's defaults.
|
|
7
|
+
*
|
|
8
|
+
* A role belongs to the organization, not to an app. Its **key** is what
|
|
9
|
+
* `fleetless.yaml` and every assignment write; its **name** is what a person
|
|
10
|
+
* reads, and changing it changes nothing about rights. A role inherits from
|
|
11
|
+
* any number of other roles, and the only change the cloud refuses is one that
|
|
12
|
+
* would make a role inherit from itself (`role_cycle`).
|
|
13
|
+
*
|
|
14
|
+
* **A key that names no role is a warning and never an error**, wherever it is
|
|
15
|
+
* written: it grants nothing, and `GET /api/org/roles` lists it under
|
|
16
|
+
* `dangling` with every place that names it. That is what makes deleting or
|
|
17
|
+
* renaming a role safe to do first and tidy up after.
|
|
18
|
+
*/
|
|
19
|
+
/** A role's display name: free text, trimmed, 1 to 60 characters. */
|
|
20
|
+
const roleName = z.string().trim().min(1).max(ROLE_NAME_MAX);
|
|
21
|
+
/**
|
|
22
|
+
* A place that writes a role key, as the role list, the rename preview and
|
|
23
|
+
* the dangling-reference list all name it.
|
|
24
|
+
*
|
|
25
|
+
* One flat shape for every kind, with `null` for what a kind does not have,
|
|
26
|
+
* so a client renders a row without switching on `kind` to find a field.
|
|
27
|
+
*/
|
|
28
|
+
export const referencePlace = z.object({
|
|
29
|
+
kind: z.enum(['config', 'collection_schema', 'app_user', 'invitation', 'app_default', 'role_inherits', 'org_default']).meta({
|
|
30
|
+
description: 'What writes the key: `config` is a `role` or `access` value in a robot\'s `fleetless.yaml`, `collection_schema` an `access` entry of a collection ' +
|
|
31
|
+
'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 ' +
|
|
32
|
+
'default role, `role_inherits` another role that inherits from it, and `org_default` one of the organization\'s defaults.',
|
|
33
|
+
}),
|
|
34
|
+
label: z.string().meta({
|
|
35
|
+
description: 'What a person reads to find the place: the robot name (`config`), the 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`).',
|
|
36
|
+
}),
|
|
37
|
+
path: z.string().nullable().meta({
|
|
38
|
+
description: 'Where the key is written. For `config`, the place in the YAML, such as `services.arm_home.role` or `access.rules[1].role`; for ' +
|
|
39
|
+
'`collection_schema`, the place in the collections schema, such as `collections.notes.access.update.own[1]`; for ' +
|
|
40
|
+
'`role_inherits`, the key of the role that inherits from it, because display names are not unique; `null` for every other kind.',
|
|
41
|
+
}),
|
|
42
|
+
robot_id: z.uuid().nullable().meta({
|
|
43
|
+
description: 'The robot whose document holds the key (`config`); `null` for every other kind.',
|
|
44
|
+
}),
|
|
45
|
+
app_id: z.uuid().nullable().meta({
|
|
46
|
+
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.',
|
|
47
|
+
}),
|
|
48
|
+
user_id: z.uuid().nullable().meta({
|
|
49
|
+
description: 'The app user who holds the key (`app_user`); `null` for every other kind.',
|
|
50
|
+
}),
|
|
51
|
+
document: z.enum(['published', 'draft']).nullable().meta({
|
|
52
|
+
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.',
|
|
53
|
+
}),
|
|
54
|
+
new_version: z.number().int().positive().nullable().meta({
|
|
55
|
+
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; ' +
|
|
56
|
+
'`null` for a draft and for every place that is no document.',
|
|
57
|
+
}),
|
|
58
|
+
});
|
|
59
|
+
/** One role as `GET /api/org/roles` lists it, with how much depends on it. */
|
|
60
|
+
export const orgRole = z.object({
|
|
61
|
+
key: roleKey.meta({
|
|
62
|
+
description: 'The role\'s key, as `fleetless.yaml` and every assignment write it. Unique in the organization.',
|
|
63
|
+
}),
|
|
64
|
+
name: roleName.meta({
|
|
65
|
+
description: 'The display name, 1 to 60 characters and trimmed. Changing it changes nothing about rights.',
|
|
66
|
+
}),
|
|
67
|
+
inherits: z.array(z.string()).meta({
|
|
68
|
+
description: 'The keys of the roles this one inherits from. A role holds whatever its parents hold, and theirs in turn. A key that names no role ' +
|
|
69
|
+
'is kept as written; inheritance through it grants nothing, and the key appears under `dangling`.',
|
|
70
|
+
}),
|
|
71
|
+
users: z.number().int().nonnegative().meta({
|
|
72
|
+
description: 'App users, in every app of the organization, who hold this role.',
|
|
73
|
+
}),
|
|
74
|
+
invitations: z.number().int().nonnegative().meta({
|
|
75
|
+
description: 'Invitations that carry this role.',
|
|
76
|
+
}),
|
|
77
|
+
app_defaults: z.number().int().nonnegative().meta({
|
|
78
|
+
description: 'Apps that use this role as their default role.',
|
|
79
|
+
}),
|
|
80
|
+
references: z.number().int().nonnegative().meta({
|
|
81
|
+
description: 'Places in documents that name this role, such as a `role` in a robot\'s `fleetless.yaml` or an `access` entry in an app\'s collections schema. A rename with `update_references` rewrites them.',
|
|
82
|
+
}),
|
|
83
|
+
});
|
|
84
|
+
/** A key that is written somewhere and is no role, with every place that writes it. */
|
|
85
|
+
export const danglingReference = z.object({
|
|
86
|
+
key: z.string().meta({
|
|
87
|
+
description: 'A key that names no role of the organization, because the role was deleted or renamed or never existed.',
|
|
88
|
+
}),
|
|
89
|
+
places: z.array(referencePlace).meta({
|
|
90
|
+
description: 'Every place that writes the key. It grants nothing wherever it is written; creating a role with this key makes the places count again.',
|
|
91
|
+
}),
|
|
92
|
+
});
|
|
93
|
+
/** What `GET /api/org/roles` answers. */
|
|
94
|
+
export const orgRoleListResponse = z.object({
|
|
95
|
+
roles: z.array(orgRole).meta({
|
|
96
|
+
description: 'The organization\'s roles with their counts, in the order they were created: the roles every organization starts with (`observe`, `operate` and `admin`) come first.',
|
|
97
|
+
}),
|
|
98
|
+
dangling: z.array(danglingReference).meta({
|
|
99
|
+
description: 'Keys written somewhere that are no role, each with its places. Empty when nothing is out of step.',
|
|
100
|
+
}),
|
|
101
|
+
});
|
|
102
|
+
/** `POST /api/org/roles`: a new role. Strict, so a field this route does not take is refused rather than dropped. */
|
|
103
|
+
export const createOrgRoleRequest = z.object({
|
|
104
|
+
key: roleKey.meta({
|
|
105
|
+
description: 'The new role\'s key, unique in the organization. Documents and assignments name the role by it.',
|
|
106
|
+
}),
|
|
107
|
+
name: roleName.meta({
|
|
108
|
+
description: 'The display name, 1 to 60 characters; surrounding spaces are removed.',
|
|
109
|
+
}),
|
|
110
|
+
inherits: z.array(roleKey).max(MAX_ORG_ROLES).optional().meta({
|
|
111
|
+
description: 'Keys of the roles to inherit from. A key that names no role is accepted and warns. Left out, the role inherits from nobody; ' +
|
|
112
|
+
'a key that would lead back to this role is refused with `role_cycle`.',
|
|
113
|
+
}),
|
|
114
|
+
}).strict();
|
|
115
|
+
/**
|
|
116
|
+
* `PATCH /api/org/roles/:key`: change a role. Absent leaves a field alone.
|
|
117
|
+
*
|
|
118
|
+
* At least one field is required: an empty patch is a caller mistake, not a
|
|
119
|
+
* request to do nothing. `update_references` and `confirm` only mean something
|
|
120
|
+
* together with `key`.
|
|
121
|
+
*
|
|
122
|
+
* The one-field rule is a `.refine()`, which JSON Schema cannot express, so
|
|
123
|
+
* `patch-org-role-request.schema.json` describes five independent optional
|
|
124
|
+
* fields; the cloud is the only place an empty patch is refused.
|
|
125
|
+
*/
|
|
126
|
+
export const patchOrgRoleRequest = z.object({
|
|
127
|
+
name: roleName.optional().meta({
|
|
128
|
+
description: 'A new display name, 1 to 60 characters; surrounding spaces are removed.',
|
|
129
|
+
}),
|
|
130
|
+
inherits: z.array(roleKey).max(MAX_ORG_ROLES).optional().meta({
|
|
131
|
+
description: 'The role\'s parents from now on. It replaces the whole list; `[]` removes every parent. A list that would lead back to this role is refused with `role_cycle`.',
|
|
132
|
+
}),
|
|
133
|
+
key: roleKey.optional().meta({
|
|
134
|
+
description: 'A new key. On its own, the rename is accepted at once and everything that still names the old key turns into a warning. ' +
|
|
135
|
+
'To rewrite those places as well, add `update_references`.',
|
|
136
|
+
}),
|
|
137
|
+
update_references: z.boolean().optional().meta({
|
|
138
|
+
description: 'With `key`: rewrite every place that names the old key to the new one, in one transaction. Without `confirm`, when there are places ' +
|
|
139
|
+
'to rewrite the call changes nothing and answers `409 confirmation_required` with the preview; a rename with none applies at once and ' +
|
|
140
|
+
'needs no token.',
|
|
141
|
+
}),
|
|
142
|
+
confirm: z.string().min(1).optional().meta({
|
|
143
|
+
description: 'The `confirm` token of the preview the caller was shown. It confirms that preview only; if the places to rewrite have changed since, the call answers a new preview.',
|
|
144
|
+
}),
|
|
145
|
+
}).strict().refine((patch) => Object.values(patch).some((value) => value !== undefined), {
|
|
146
|
+
message: 'A patch names at least one field to change.',
|
|
147
|
+
});
|
|
148
|
+
/**
|
|
149
|
+
* What a rename with `update_references` would rewrite: the `details` of the
|
|
150
|
+
* `409 confirmation_required` that answers it. Repeating the same request with
|
|
151
|
+
* `confirm` set to this token applies the rename.
|
|
152
|
+
*/
|
|
153
|
+
export const roleRenamePreview = z.object({
|
|
154
|
+
from: z.string().meta({ description: 'The key being renamed.' }),
|
|
155
|
+
to: z.string().meta({ description: 'The key it would become.' }),
|
|
156
|
+
references: z.array(referencePlace).meta({
|
|
157
|
+
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.',
|
|
158
|
+
}),
|
|
159
|
+
reference_count: z.number().int().nonnegative().meta({
|
|
160
|
+
description: 'How many places the rename would rewrite.',
|
|
161
|
+
}),
|
|
162
|
+
confirm: z.string().meta({
|
|
163
|
+
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.',
|
|
164
|
+
}),
|
|
165
|
+
});
|
|
166
|
+
/** What each kind of access covers; one place so the request, the response and the docs say the same. */
|
|
167
|
+
const KIND_SCOPE = {
|
|
168
|
+
read: 'Reading datapoints and cameras.',
|
|
169
|
+
invoke: 'Calling services and starting actions.',
|
|
170
|
+
publish: 'Driving a robot through its publishers.',
|
|
171
|
+
assets: 'A robot\'s asset files, such as its URDF and meshes.',
|
|
172
|
+
job_history: 'The history of a robot\'s jobs.',
|
|
173
|
+
};
|
|
174
|
+
/** One property per access kind, so a kind added to `ACCESS_KINDS` is a compile error here and not a silent gap. */
|
|
175
|
+
function perKind(make) {
|
|
176
|
+
return Object.fromEntries(ACCESS_KINDS.map((kind) => [kind, make(KIND_SCOPE[kind])]));
|
|
177
|
+
}
|
|
178
|
+
/** What `GET` and `PUT /api/org/roles/defaults` answer: who holds each kind of access when a robot's configuration says nothing. */
|
|
179
|
+
export const roleDefaultsResponse = z.object({
|
|
180
|
+
defaults: z.object(perKind((scope) => z.array(z.string()).meta({
|
|
181
|
+
description: `${scope} The roles that hold this kind of access by default; an empty list means nobody does, however senior the role.`,
|
|
182
|
+
}))).meta({
|
|
183
|
+
description: 'Every kind of access, each with the keys of the roles that hold it when a robot\'s published configuration names nobody.',
|
|
184
|
+
}),
|
|
185
|
+
});
|
|
186
|
+
/** One kind's default as a caller may write it: a role, several roles, or `null`/`[]` for nobody. */
|
|
187
|
+
const defaultHolders = (scope) => z.union([roleKey, z.array(roleKey).max(MAX_ORG_ROLES), z.null()], {
|
|
188
|
+
error: (issue) => (issue.code === 'invalid_union'
|
|
189
|
+
? 'A default is one role key, `operate`, a list of keys, `[operate, admin]`, or `null` for nobody.'
|
|
190
|
+
: undefined),
|
|
191
|
+
}).optional().meta({
|
|
192
|
+
description: `${scope} One role key, a list of keys, or \`null\` or \`[]\` for nobody. Left out, the kind keeps what it has. A key that names no role is accepted and warns.`,
|
|
193
|
+
});
|
|
194
|
+
/** `PUT /api/org/roles/defaults`: change some defaults and leave the others as they are. */
|
|
195
|
+
export const putRoleDefaultsRequest = z.object({
|
|
196
|
+
defaults: z.object(perKind(defaultHolders)).strict().meta({
|
|
197
|
+
description: 'The kinds to change. A kind that is not named keeps its current default, so this is a patch of the defaults and not a replacement.',
|
|
198
|
+
}),
|
|
199
|
+
}).strict();
|
package/dist/plans.d.ts
CHANGED
|
@@ -25,17 +25,21 @@ export declare const PLAN_ORDER: readonly PlanId[];
|
|
|
25
25
|
* The limits a plan ties a number to. `history_days` and `audit_days` are
|
|
26
26
|
* not refused against — they size a retention window, not a quota that an
|
|
27
27
|
* action can exceed — but they share this vocabulary because they are read
|
|
28
|
-
* off the same catalogue row.
|
|
28
|
+
* off the same catalogue row. `collection_records` and `collection_bytes`
|
|
29
|
+
* are counted over the org's app collections, across all its apps, and
|
|
30
|
+
* refuse only what a person or an app adds: no add-on raises them.
|
|
29
31
|
*/
|
|
30
32
|
export declare const planLimitKey: z.ZodEnum<{
|
|
31
33
|
apps: "apps";
|
|
32
|
-
seats: "seats";
|
|
33
34
|
robots: "robots";
|
|
35
|
+
seats: "seats";
|
|
34
36
|
app_users: "app_users";
|
|
35
37
|
live_video_ms_per_month: "live_video_ms_per_month";
|
|
36
38
|
asset_bytes_per_robot: "asset_bytes_per_robot";
|
|
37
39
|
history_days: "history_days";
|
|
38
40
|
audit_days: "audit_days";
|
|
41
|
+
collection_records: "collection_records";
|
|
42
|
+
collection_bytes: "collection_bytes";
|
|
39
43
|
}>;
|
|
40
44
|
export type PlanLimitKey = z.infer<typeof planLimitKey>;
|
|
41
45
|
export declare const planLimits: z.ZodObject<{
|
|
@@ -47,6 +51,8 @@ export declare const planLimits: z.ZodObject<{
|
|
|
47
51
|
asset_bytes_per_robot: z.ZodNullable<z.ZodNumber>;
|
|
48
52
|
history_days: z.ZodNullable<z.ZodNumber>;
|
|
49
53
|
audit_days: z.ZodNullable<z.ZodNumber>;
|
|
54
|
+
collection_records: z.ZodNullable<z.ZodNumber>;
|
|
55
|
+
collection_bytes: z.ZodNullable<z.ZodNumber>;
|
|
50
56
|
}, z.core.$strip>;
|
|
51
57
|
export type PlanLimits = z.infer<typeof planLimits>;
|
|
52
58
|
/**
|
|
@@ -106,6 +112,8 @@ export declare const planCatalogueEntry: z.ZodObject<{
|
|
|
106
112
|
asset_bytes_per_robot: z.ZodNullable<z.ZodNumber>;
|
|
107
113
|
history_days: z.ZodNullable<z.ZodNumber>;
|
|
108
114
|
audit_days: z.ZodNullable<z.ZodNumber>;
|
|
115
|
+
collection_records: z.ZodNullable<z.ZodNumber>;
|
|
116
|
+
collection_bytes: z.ZodNullable<z.ZodNumber>;
|
|
109
117
|
}, z.core.$strip>;
|
|
110
118
|
features: z.ZodObject<{
|
|
111
119
|
require_two_factor: z.ZodBoolean;
|
|
@@ -135,8 +143,8 @@ export type PlanCatalogueEntry = z.infer<typeof planCatalogueEntry>;
|
|
|
135
143
|
*/
|
|
136
144
|
export declare const addonKey: z.ZodEnum<{
|
|
137
145
|
apps: "apps";
|
|
138
|
-
seats: "seats";
|
|
139
146
|
robots: "robots";
|
|
147
|
+
seats: "seats";
|
|
140
148
|
app_user_packs: "app_user_packs";
|
|
141
149
|
live_video_packs: "live_video_packs";
|
|
142
150
|
}>;
|
|
@@ -144,20 +152,22 @@ export type AddonKey = z.infer<typeof addonKey>;
|
|
|
144
152
|
export declare const addonCatalogueEntry: z.ZodObject<{
|
|
145
153
|
key: z.ZodEnum<{
|
|
146
154
|
apps: "apps";
|
|
147
|
-
seats: "seats";
|
|
148
155
|
robots: "robots";
|
|
156
|
+
seats: "seats";
|
|
149
157
|
app_user_packs: "app_user_packs";
|
|
150
158
|
live_video_packs: "live_video_packs";
|
|
151
159
|
}>;
|
|
152
160
|
raises: z.ZodEnum<{
|
|
153
161
|
apps: "apps";
|
|
154
|
-
seats: "seats";
|
|
155
162
|
robots: "robots";
|
|
163
|
+
seats: "seats";
|
|
156
164
|
app_users: "app_users";
|
|
157
165
|
live_video_ms_per_month: "live_video_ms_per_month";
|
|
158
166
|
asset_bytes_per_robot: "asset_bytes_per_robot";
|
|
159
167
|
history_days: "history_days";
|
|
160
168
|
audit_days: "audit_days";
|
|
169
|
+
collection_records: "collection_records";
|
|
170
|
+
collection_bytes: "collection_bytes";
|
|
161
171
|
}>;
|
|
162
172
|
per_unit: z.ZodNumber;
|
|
163
173
|
prices: z.ZodObject<{
|
|
@@ -360,6 +370,8 @@ export declare const orgPlan: z.ZodObject<{
|
|
|
360
370
|
asset_bytes_per_robot: z.ZodNullable<z.ZodNumber>;
|
|
361
371
|
history_days: z.ZodNullable<z.ZodNumber>;
|
|
362
372
|
audit_days: z.ZodNullable<z.ZodNumber>;
|
|
373
|
+
collection_records: z.ZodNullable<z.ZodNumber>;
|
|
374
|
+
collection_bytes: z.ZodNullable<z.ZodNumber>;
|
|
363
375
|
}, z.core.$strip>;
|
|
364
376
|
features: z.ZodObject<{
|
|
365
377
|
require_two_factor: z.ZodBoolean;
|
|
@@ -508,6 +520,8 @@ export declare const planChangeDecisionStatusResponse: z.ZodDiscriminatedUnion<[
|
|
|
508
520
|
asset_bytes_per_robot: z.ZodNullable<z.ZodNumber>;
|
|
509
521
|
history_days: z.ZodNullable<z.ZodNumber>;
|
|
510
522
|
audit_days: z.ZodNullable<z.ZodNumber>;
|
|
523
|
+
collection_records: z.ZodNullable<z.ZodNumber>;
|
|
524
|
+
collection_bytes: z.ZodNullable<z.ZodNumber>;
|
|
511
525
|
}, z.core.$strip>;
|
|
512
526
|
features: z.ZodObject<{
|
|
513
527
|
require_two_factor: z.ZodBoolean;
|
|
@@ -574,13 +588,15 @@ export type PlanChangeDecisionStatusResponse = z.infer<typeof planChangeDecision
|
|
|
574
588
|
*/
|
|
575
589
|
export declare const planOverrides: z.ZodObject<{
|
|
576
590
|
apps: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
577
|
-
seats: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
578
591
|
robots: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
592
|
+
seats: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
579
593
|
app_users: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
580
594
|
live_video_ms_per_month: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
581
595
|
asset_bytes_per_robot: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
582
596
|
history_days: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
583
597
|
audit_days: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
598
|
+
collection_records: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
599
|
+
collection_bytes: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
584
600
|
}, z.core.$strict>;
|
|
585
601
|
export type PlanOverrides = z.infer<typeof planOverrides>;
|
|
586
602
|
/**
|
|
@@ -609,13 +625,15 @@ export declare const adminPlanChangeRequest: z.ZodObject<{
|
|
|
609
625
|
}, z.core.$strict>>;
|
|
610
626
|
overrides: z.ZodOptional<z.ZodObject<{
|
|
611
627
|
apps: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
612
|
-
seats: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
613
628
|
robots: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
629
|
+
seats: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
614
630
|
app_users: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
615
631
|
live_video_ms_per_month: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
616
632
|
asset_bytes_per_robot: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
617
633
|
history_days: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
618
634
|
audit_days: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
635
|
+
collection_records: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
636
|
+
collection_bytes: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
619
637
|
}, z.core.$strict>>;
|
|
620
638
|
currency: z.ZodOptional<z.ZodEnum<{
|
|
621
639
|
eur: "eur";
|
package/dist/plans.js
CHANGED
|
@@ -21,7 +21,9 @@ export const PLAN_ORDER = ['basic', 'plus', 'pro', 'enterprise'];
|
|
|
21
21
|
* The limits a plan ties a number to. `history_days` and `audit_days` are
|
|
22
22
|
* not refused against — they size a retention window, not a quota that an
|
|
23
23
|
* action can exceed — but they share this vocabulary because they are read
|
|
24
|
-
* off the same catalogue row.
|
|
24
|
+
* off the same catalogue row. `collection_records` and `collection_bytes`
|
|
25
|
+
* are counted over the org's app collections, across all its apps, and
|
|
26
|
+
* refuse only what a person or an app adds: no add-on raises them.
|
|
25
27
|
*/
|
|
26
28
|
export const planLimitKey = z.enum([
|
|
27
29
|
'seats',
|
|
@@ -32,6 +34,8 @@ export const planLimitKey = z.enum([
|
|
|
32
34
|
'asset_bytes_per_robot',
|
|
33
35
|
'history_days',
|
|
34
36
|
'audit_days',
|
|
37
|
+
'collection_records',
|
|
38
|
+
'collection_bytes',
|
|
35
39
|
]);
|
|
36
40
|
/** `null` = by contract (Enterprise) or unlimited; see `orgPlan.limits`. */
|
|
37
41
|
const limit = z.number().int().positive().nullable();
|
|
@@ -48,6 +52,14 @@ export const planLimits = z.object({
|
|
|
48
52
|
}),
|
|
49
53
|
history_days: limit.meta({ description: 'Days the org\'s robot history is kept.' }),
|
|
50
54
|
audit_days: limit.meta({ description: 'Days the org\'s audit log is kept.' }),
|
|
55
|
+
collection_records: limit.meta({
|
|
56
|
+
description: 'Records in the app collections of all the org\'s apps, together. Only current records count, deleted ones and the history do not. ' +
|
|
57
|
+
'A write or an import that would add records past it is refused `409 plan_limit` naming this key; reads continue.',
|
|
58
|
+
}),
|
|
59
|
+
collection_bytes: limit.meta({
|
|
60
|
+
description: 'Bytes the current records of all the org\'s app collections occupy, as stored JSON (decimal: 1 GB = 1,000,000,000). The history is ' +
|
|
61
|
+
'shown beside it and not limited. A write or an import that would add data past it is refused `409 plan_limit` naming this key; reads continue.',
|
|
62
|
+
}),
|
|
51
63
|
});
|
|
52
64
|
/**
|
|
53
65
|
* What a plan unlocks beyond a number: `app_mcp` (the app's MCP server),
|
|
@@ -143,6 +155,8 @@ export const PLANS = {
|
|
|
143
155
|
asset_bytes_per_robot: 1_000_000_000,
|
|
144
156
|
history_days: 7,
|
|
145
157
|
audit_days: 7,
|
|
158
|
+
collection_records: 25_000,
|
|
159
|
+
collection_bytes: 1_000_000_000,
|
|
146
160
|
},
|
|
147
161
|
features: {
|
|
148
162
|
app_mcp: false,
|
|
@@ -168,6 +182,8 @@ export const PLANS = {
|
|
|
168
182
|
asset_bytes_per_robot: 2_000_000_000,
|
|
169
183
|
history_days: 30,
|
|
170
184
|
audit_days: 30,
|
|
185
|
+
collection_records: 250_000,
|
|
186
|
+
collection_bytes: 10_000_000_000,
|
|
171
187
|
},
|
|
172
188
|
features: {
|
|
173
189
|
app_mcp: true,
|
|
@@ -193,6 +209,8 @@ export const PLANS = {
|
|
|
193
209
|
asset_bytes_per_robot: 3_000_000_000,
|
|
194
210
|
history_days: 90,
|
|
195
211
|
audit_days: 90,
|
|
212
|
+
collection_records: 1_000_000,
|
|
213
|
+
collection_bytes: 50_000_000_000,
|
|
196
214
|
},
|
|
197
215
|
features: {
|
|
198
216
|
app_mcp: true,
|
|
@@ -218,6 +236,8 @@ export const PLANS = {
|
|
|
218
236
|
asset_bytes_per_robot: null,
|
|
219
237
|
history_days: null,
|
|
220
238
|
audit_days: null,
|
|
239
|
+
collection_records: null,
|
|
240
|
+
collection_bytes: null,
|
|
221
241
|
},
|
|
222
242
|
features: {
|
|
223
243
|
app_mcp: true,
|
package/dist/protocol.d.ts
CHANGED
|
@@ -424,6 +424,7 @@ export declare const cloudConfig: z.ZodObject<{
|
|
|
424
424
|
name: z.ZodOptional<z.ZodString>;
|
|
425
425
|
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
426
426
|
}, z.core.$strict>>>;
|
|
427
|
+
role: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
427
428
|
}, z.core.$strict>>>;
|
|
428
429
|
actions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
429
430
|
ros_name: z.ZodString;
|
|
@@ -455,6 +456,7 @@ export declare const cloudConfig: z.ZodObject<{
|
|
|
455
456
|
description: z.ZodOptional<z.ZodString>;
|
|
456
457
|
}, z.core.$strict>>>;
|
|
457
458
|
description: z.ZodOptional<z.ZodString>;
|
|
459
|
+
role: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
458
460
|
}, z.core.$strict>>>;
|
|
459
461
|
services: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
460
462
|
ros_name: z.ZodString;
|
|
@@ -486,6 +488,7 @@ export declare const cloudConfig: z.ZodObject<{
|
|
|
486
488
|
description: z.ZodOptional<z.ZodString>;
|
|
487
489
|
}, z.core.$strict>>>;
|
|
488
490
|
description: z.ZodOptional<z.ZodString>;
|
|
491
|
+
role: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
489
492
|
}, z.core.$strict>>>;
|
|
490
493
|
publishers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
491
494
|
topic: z.ZodString;
|
|
@@ -522,6 +525,7 @@ export declare const cloudConfig: z.ZodObject<{
|
|
|
522
525
|
}, z.core.$strict>;
|
|
523
526
|
quiet_timeout_ms: z.ZodNumber;
|
|
524
527
|
description: z.ZodOptional<z.ZodString>;
|
|
528
|
+
role: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
525
529
|
}, z.core.$strict>>>;
|
|
526
530
|
cameras: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
527
531
|
source: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -556,12 +560,26 @@ export declare const cloudConfig: z.ZodObject<{
|
|
|
556
560
|
bitrate_kbps: z.ZodNumber;
|
|
557
561
|
snapshot_interval_seconds: z.ZodNumber;
|
|
558
562
|
description: z.ZodOptional<z.ZodString>;
|
|
563
|
+
role: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
559
564
|
}, z.core.$strict>>>;
|
|
565
|
+
access: z.ZodOptional<z.ZodObject<{
|
|
566
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
567
|
+
match: z.ZodString;
|
|
568
|
+
kinds: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
569
|
+
read: "read";
|
|
570
|
+
invoke: "invoke";
|
|
571
|
+
publish: "publish";
|
|
572
|
+
}>>>;
|
|
573
|
+
role: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
|
|
574
|
+
}, z.core.$strict>>>;
|
|
575
|
+
assets: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
576
|
+
job_history: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
577
|
+
}, z.core.$strict>>;
|
|
560
578
|
low_bandwidth: z.ZodOptional<z.ZodObject<{
|
|
561
579
|
mode: z.ZodOptional<z.ZodEnum<{
|
|
562
|
-
off: "off";
|
|
563
580
|
auto: "auto";
|
|
564
581
|
on: "on";
|
|
582
|
+
off: "off";
|
|
565
583
|
}>>;
|
|
566
584
|
enter_lag_ms: z.ZodOptional<z.ZodNumber>;
|
|
567
585
|
enter_after_s: z.ZodOptional<z.ZodNumber>;
|
package/dist/realtime.d.ts
CHANGED
|
@@ -39,7 +39,10 @@ export declare const authOk: z.ZodObject<{
|
|
|
39
39
|
app_user_id: z.ZodNullable<z.ZodUUID>;
|
|
40
40
|
server_key_id: z.ZodNullable<z.ZodUUID>;
|
|
41
41
|
app_id: z.ZodNullable<z.ZodUUID>;
|
|
42
|
-
|
|
42
|
+
role: z.ZodNullable<z.ZodObject<{
|
|
43
|
+
key: z.ZodString;
|
|
44
|
+
name: z.ZodString;
|
|
45
|
+
}, z.core.$strip>>;
|
|
43
46
|
email: z.ZodNullable<z.ZodEmail>;
|
|
44
47
|
two_factor_enabled: z.ZodNullable<z.ZodBoolean>;
|
|
45
48
|
}, z.core.$strip>;
|
|
@@ -329,8 +332,8 @@ export declare const resourceHealthCleared: z.ZodObject<{
|
|
|
329
332
|
}>;
|
|
330
333
|
ref: z.ZodString;
|
|
331
334
|
facet: z.ZodEnum<{
|
|
332
|
-
source: "source";
|
|
333
335
|
publish: "publish";
|
|
336
|
+
source: "source";
|
|
334
337
|
}>;
|
|
335
338
|
cleared_at_ms: z.ZodNumber;
|
|
336
339
|
}, z.core.$strip>;
|
|
@@ -343,8 +346,8 @@ export declare const resourceHealthEvent: z.ZodObject<{
|
|
|
343
346
|
}>;
|
|
344
347
|
ref: z.ZodString;
|
|
345
348
|
facet: z.ZodEnum<{
|
|
346
|
-
source: "source";
|
|
347
349
|
publish: "publish";
|
|
350
|
+
source: "source";
|
|
348
351
|
}>;
|
|
349
352
|
state: z.ZodEnum<{
|
|
350
353
|
unknown: "unknown";
|
|
@@ -485,3 +488,169 @@ export declare const orgEventDropped: z.ZodObject<{
|
|
|
485
488
|
dropped: z.ZodNumber;
|
|
486
489
|
}, z.core.$strict>;
|
|
487
490
|
export type OrgEventDropped = z.infer<typeof orgEventDropped>;
|
|
491
|
+
/**
|
|
492
|
+
* Subscribe to the changes of one collection's records.
|
|
493
|
+
*
|
|
494
|
+
* **The cloud answers with `collection_subscribed` once the subscription is
|
|
495
|
+
* registered, and with `collection_subscribe_error` when it is refused. There
|
|
496
|
+
* is no first snapshot.** To show the records that exist, subscribe, wait for
|
|
497
|
+
* `collection_subscribed` and list then: from that frame on every change the
|
|
498
|
+
* subscription covers is delivered as an event, so none can fall between the
|
|
499
|
+
* list and the events. An event that arrives while the list is still being
|
|
500
|
+
* read may or may not be in its result; apply it to the result by `id` and
|
|
501
|
+
* `revision`. A subscription is registered afresh on every connection, so a
|
|
502
|
+
* client that reconnects and subscribes again gets a new `collection_subscribed`
|
|
503
|
+
* and lists again; changes made while it was disconnected are not replayed.
|
|
504
|
+
*
|
|
505
|
+
* The caller's rights are checked on every event, not only on subscribe: a
|
|
506
|
+
* record that the caller may no longer see, because its values changed, the
|
|
507
|
+
* role lost the right or the robot was detached, is announced once as
|
|
508
|
+
* `removed`, and one that comes into view as `entered`.
|
|
509
|
+
*
|
|
510
|
+
* **When a subscription is judged.** At the frame, with the role and status an
|
|
511
|
+
* app user has then and not as at `auth`: a user who was re-roled is answered
|
|
512
|
+
* for the new role (`collection_not_found` when it has no right on the
|
|
513
|
+
* collection, `forbidden` when it may not read it), and one who was blocked or
|
|
514
|
+
* removed is answered `forbidden` and stays unsubscribed. A frame sent before
|
|
515
|
+
* `auth` is answered with `collection_subscribe_error` and code `unauthorized`;
|
|
516
|
+
* the socket stays open. A socket holds at most 50 subscriptions.
|
|
517
|
+
*/
|
|
518
|
+
export declare const collectionSubscribe: z.ZodObject<{
|
|
519
|
+
type: z.ZodLiteral<"collection_subscribe">;
|
|
520
|
+
request_id: z.ZodString;
|
|
521
|
+
app_id: z.ZodOptional<z.ZodUUID>;
|
|
522
|
+
collection: z.ZodString;
|
|
523
|
+
robot_id: z.ZodOptional<z.ZodUUID>;
|
|
524
|
+
filter: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
525
|
+
}, z.core.$strict>;
|
|
526
|
+
export type CollectionSubscribe = z.infer<typeof collectionSubscribe>;
|
|
527
|
+
/**
|
|
528
|
+
* A collection subscription is registered. Sent once for every
|
|
529
|
+
* `collection_subscribe` that is accepted, after the cloud has judged it (the
|
|
530
|
+
* collection exists, the caller may read it, the robot and the filter fit) and
|
|
531
|
+
* registered it, and before the first `collection_event` of that
|
|
532
|
+
* subscription: a client that lists the records now misses no change, because
|
|
533
|
+
* every change from this frame on reaches it as an event.
|
|
534
|
+
*
|
|
535
|
+
* The frame is sent again for every subscribe, so a client that reconnects and
|
|
536
|
+
* subscribes again receives it again. It does not say that anything exists or
|
|
537
|
+
* changed; it carries only the `request_id`.
|
|
538
|
+
*/
|
|
539
|
+
export declare const collectionSubscribed: z.ZodObject<{
|
|
540
|
+
type: z.ZodLiteral<"collection_subscribed">;
|
|
541
|
+
request_id: z.ZodString;
|
|
542
|
+
}, z.core.$strict>;
|
|
543
|
+
export type CollectionSubscribed = z.infer<typeof collectionSubscribed>;
|
|
544
|
+
export declare const collectionUnsubscribe: z.ZodObject<{
|
|
545
|
+
type: z.ZodLiteral<"collection_unsubscribe">;
|
|
546
|
+
request_id: z.ZodString;
|
|
547
|
+
}, z.core.$strict>;
|
|
548
|
+
export type CollectionUnsubscribe = z.infer<typeof collectionUnsubscribe>;
|
|
549
|
+
/**
|
|
550
|
+
* One change to a record the subscriber can see. `record` is the whole record,
|
|
551
|
+
* up to 1 MB, in the shape the REST routes answer.
|
|
552
|
+
*
|
|
553
|
+
* **A client that cannot keep up is disconnected, not skipped.** A socket whose
|
|
554
|
+
* send buffer holds more than 8 MiB, or that has more than 2,000 collection
|
|
555
|
+
* changes waiting to be delivered (a bulk import into a big collection does
|
|
556
|
+
* that), is closed with code 1013 ("try again later"). The client reconnects,
|
|
557
|
+
* subscribes again and lists again.
|
|
558
|
+
*/
|
|
559
|
+
export declare const collectionEvent: z.ZodObject<{
|
|
560
|
+
type: z.ZodLiteral<"collection_event">;
|
|
561
|
+
request_id: z.ZodString;
|
|
562
|
+
event: z.ZodEnum<{
|
|
563
|
+
deleted: "deleted";
|
|
564
|
+
created: "created";
|
|
565
|
+
updated: "updated";
|
|
566
|
+
removed: "removed";
|
|
567
|
+
entered: "entered";
|
|
568
|
+
}>;
|
|
569
|
+
id: z.ZodUUID;
|
|
570
|
+
record: z.ZodOptional<z.ZodObject<{
|
|
571
|
+
id: z.ZodUUID;
|
|
572
|
+
robot_id: z.ZodNullable<z.ZodUUID>;
|
|
573
|
+
created_at: z.ZodISODateTime;
|
|
574
|
+
created_by: z.ZodObject<{
|
|
575
|
+
kind: z.ZodEnum<{
|
|
576
|
+
developer: "developer";
|
|
577
|
+
fleetless: "fleetless";
|
|
578
|
+
server_key: "server_key";
|
|
579
|
+
app_user: "app_user";
|
|
580
|
+
}>;
|
|
581
|
+
id: z.ZodUUID;
|
|
582
|
+
label: z.ZodString;
|
|
583
|
+
}, z.core.$strip>;
|
|
584
|
+
updated_at: z.ZodISODateTime;
|
|
585
|
+
updated_by: z.ZodObject<{
|
|
586
|
+
kind: z.ZodEnum<{
|
|
587
|
+
developer: "developer";
|
|
588
|
+
fleetless: "fleetless";
|
|
589
|
+
server_key: "server_key";
|
|
590
|
+
app_user: "app_user";
|
|
591
|
+
}>;
|
|
592
|
+
id: z.ZodUUID;
|
|
593
|
+
label: z.ZodString;
|
|
594
|
+
}, z.core.$strip>;
|
|
595
|
+
revision: z.ZodNumber;
|
|
596
|
+
display: z.ZodString;
|
|
597
|
+
missing_required: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
598
|
+
values: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
599
|
+
deleted_at: z.ZodOptional<z.ZodISODateTime>;
|
|
600
|
+
deleted_by: z.ZodOptional<z.ZodObject<{
|
|
601
|
+
kind: z.ZodEnum<{
|
|
602
|
+
developer: "developer";
|
|
603
|
+
fleetless: "fleetless";
|
|
604
|
+
server_key: "server_key";
|
|
605
|
+
app_user: "app_user";
|
|
606
|
+
}>;
|
|
607
|
+
id: z.ZodUUID;
|
|
608
|
+
label: z.ZodString;
|
|
609
|
+
}, z.core.$strip>>;
|
|
610
|
+
}, z.core.$strip>>;
|
|
611
|
+
}, z.core.$strict>;
|
|
612
|
+
export type CollectionEvent = z.infer<typeof collectionEvent>;
|
|
613
|
+
/**
|
|
614
|
+
* Refusal of a collection subscription, or the end of one. The codes are those
|
|
615
|
+
* of REST: `collection_not_found`, `forbidden`, `robot_not_attached` and
|
|
616
|
+
* `validation_error` when the subscribe is refused; `collection_removed`,
|
|
617
|
+
* `forbidden`, `robot_not_attached`, `validation_error` and `internal_error`
|
|
618
|
+
* when a running subscription ends:
|
|
619
|
+
*
|
|
620
|
+
* - `collection_removed`: a publish or restore removed its collection;
|
|
621
|
+
* - `forbidden`: the user was re-roled, blocked or removed, or the role lost the
|
|
622
|
+
* right to read the collection;
|
|
623
|
+
* - `robot_not_attached`: the robot the subscription follows was detached, or a
|
|
624
|
+
* robot with more than 5,000 records was detached (when a robot is attached
|
|
625
|
+
* or detached, at most 5,000 of its records are announced to a subscription,
|
|
626
|
+
* as `entered` or `removed`);
|
|
627
|
+
* - `validation_error`: its `filter` no longer fits the collection after a
|
|
628
|
+
* publish;
|
|
629
|
+
* - `internal_error`: it could not be judged again (the database or the rights
|
|
630
|
+
* check failed), or a robot coming or going could not be announced. The cloud
|
|
631
|
+
* ends the subscription rather than go on telling a caller what it may no
|
|
632
|
+
* longer see; subscribing again is the way back.
|
|
633
|
+
*
|
|
634
|
+
* `request_id` echoes what the client sent and is a plain string for the reason
|
|
635
|
+
* `subscribeError`'s ids are: the refusal must be constructible when the id
|
|
636
|
+
* itself was what was wrong.
|
|
637
|
+
*/
|
|
638
|
+
export declare const collectionSubscribeError: z.ZodObject<{
|
|
639
|
+
type: z.ZodLiteral<"collection_subscribe_error">;
|
|
640
|
+
request_id: z.ZodString;
|
|
641
|
+
code: z.ZodString;
|
|
642
|
+
message: z.ZodString;
|
|
643
|
+
}, z.core.$strict>;
|
|
644
|
+
export type CollectionSubscribeError = z.infer<typeof collectionSubscribeError>;
|
|
645
|
+
/**
|
|
646
|
+
* Sent to every socket that holds a collection subscription in the app after a
|
|
647
|
+
* schema version was published or restored. Rights and collections may have
|
|
648
|
+
* changed, so a client that cached definitions reads them again. Subscriptions
|
|
649
|
+
* whose collection or right is gone end with their own
|
|
650
|
+
* `collection_subscribe_error`.
|
|
651
|
+
*/
|
|
652
|
+
export declare const collectionsSchemaPublished: z.ZodObject<{
|
|
653
|
+
type: z.ZodLiteral<"collections_schema_published">;
|
|
654
|
+
version: z.ZodNumber;
|
|
655
|
+
}, z.core.$strict>;
|
|
656
|
+
export type CollectionsSchemaPublished = z.infer<typeof collectionsSchemaPublished>;
|