@fleetless/contracts 14.0.0 → 15.0.1

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 (126) hide show
  1. package/CHANGELOG.md +184 -0
  2. package/artifacts/openapi.json +20210 -11764
  3. package/artifacts/routes.json +1160 -39
  4. package/artifacts/schema/addon-catalogue-entry.schema.json +3 -1
  5. package/artifacts/schema/admin-plan-change-request.schema.json +26 -0
  6. package/artifacts/schema/app-deletion-summary.schema.json +15 -1
  7. package/artifacts/schema/asset-plan-limit-details.schema.json +3 -1
  8. package/artifacts/schema/billing-change-response.schema.json +9 -8
  9. package/artifacts/schema/checkout-response.schema.json +6 -6
  10. package/artifacts/schema/cloud-config.schema.json +5 -5
  11. package/artifacts/schema/collection-actor.schema.json +35 -0
  12. package/artifacts/schema/collection-definitions-response.schema.json +612 -0
  13. package/artifacts/schema/collection-event.schema.json +216 -0
  14. package/artifacts/schema/collection-export-query.schema.json +56 -0
  15. package/artifacts/schema/collection-filter.schema.json +9 -0
  16. package/artifacts/schema/collection-import-preview.schema.json +143 -0
  17. package/artifacts/schema/collection-import-request.schema.json +105 -0
  18. package/artifacts/schema/collection-import-result.schema.json +38 -0
  19. package/artifacts/schema/collection-list-response.schema.json +119 -0
  20. package/artifacts/schema/collection-record-get-query.schema.json +12 -0
  21. package/artifacts/schema/collection-record-history-query.schema.json +35 -0
  22. package/artifacts/schema/collection-record-history-response.schema.json +389 -0
  23. package/artifacts/schema/collection-record-list-query.schema.json +67 -0
  24. package/artifacts/schema/collection-record-list-response.schema.json +212 -0
  25. package/artifacts/schema/collection-record-restore-request.schema.json +14 -0
  26. package/artifacts/schema/collection-record-write.schema.json +31 -0
  27. package/artifacts/schema/collection-record.schema.json +180 -0
  28. package/artifacts/schema/collection-revision.schema.json +295 -0
  29. package/artifacts/schema/collection-subscribe-error.schema.json +31 -0
  30. package/artifacts/schema/collection-subscribe.schema.json +48 -0
  31. package/artifacts/schema/collection-subscribed.schema.json +22 -0
  32. package/artifacts/schema/collection-summary.schema.json +92 -0
  33. package/artifacts/schema/collection-unsubscribe.schema.json +22 -0
  34. package/artifacts/schema/collections-access-change.schema.json +34 -0
  35. package/artifacts/schema/collections-document.schema.json +732 -0
  36. package/artifacts/schema/collections-draft-response.schema.json +845 -0
  37. package/artifacts/schema/collections-effect.schema.json +384 -0
  38. package/artifacts/schema/collections-issue.schema.json +36 -0
  39. package/artifacts/schema/collections-publish-request.schema.json +18 -0
  40. package/artifacts/schema/collections-publish-response.schema.json +450 -0
  41. package/artifacts/schema/collections-purge-preview.schema.json +60 -0
  42. package/artifacts/schema/collections-purge-request.schema.json +27 -0
  43. package/artifacts/schema/collections-purge-response.schema.json +30 -0
  44. package/artifacts/schema/collections-restore-preview-query.schema.json +20 -0
  45. package/artifacts/schema/collections-restore-preview.schema.json +581 -0
  46. package/artifacts/schema/collections-restore-request.schema.json +27 -0
  47. package/artifacts/schema/collections-restore-response.schema.json +455 -0
  48. package/artifacts/schema/collections-schema-preview.schema.json +519 -0
  49. package/artifacts/schema/collections-schema-published.schema.json +22 -0
  50. package/artifacts/schema/collections-version-response.schema.json +869 -0
  51. package/artifacts/schema/collections-version-summary.schema.json +139 -0
  52. package/artifacts/schema/collections-versions-response.schema.json +167 -0
  53. package/artifacts/schema/config-draft-response.schema.json +5 -5
  54. package/artifacts/schema/config-version-response.schema.json +5 -5
  55. package/artifacts/schema/confirmation-required-details.schema.json +13 -0
  56. package/artifacts/schema/dangling-reference.schema.json +7 -6
  57. package/artifacts/schema/datapoint-list-response.schema.json +2 -2
  58. package/artifacts/schema/effective-rights-response.schema.json +87 -1
  59. package/artifacts/schema/org-plan.schema.json +29 -1
  60. package/artifacts/schema/org-quota-usage-counts.schema.json +18 -0
  61. package/artifacts/schema/org-quota-usage.schema.json +47 -1
  62. package/artifacts/schema/org-quotas.schema.json +29 -1
  63. package/artifacts/schema/org-role-list-response.schema.json +8 -7
  64. package/artifacts/schema/org-role.schema.json +1 -1
  65. package/artifacts/schema/plan-catalogue-entry.schema.json +29 -1
  66. package/artifacts/schema/plan-change-decision-status-response.schema.json +29 -1
  67. package/artifacts/schema/plan-limit-details.schema.json +3 -1
  68. package/artifacts/schema/plan-limits.schema.json +29 -1
  69. package/artifacts/schema/plan-overrides.schema.json +26 -0
  70. package/artifacts/schema/purchase-conflict-details.schema.json +6 -6
  71. package/artifacts/schema/purchase-intent-draft.schema.json +5 -5
  72. package/artifacts/schema/purchase-intent-payment-started.schema.json +1 -1
  73. package/artifacts/schema/purchase-intent-response.schema.json +10 -9
  74. package/artifacts/schema/put-collections-draft-request.schema.json +16 -0
  75. package/artifacts/schema/record-changed-details.schema.json +16 -0
  76. package/artifacts/schema/record-referenced-details.schema.json +35 -0
  77. package/artifacts/schema/reference-invalid-details.schema.json +25 -0
  78. package/artifacts/schema/reference-place.schema.json +7 -6
  79. package/artifacts/schema/required-missing-details.schema.json +19 -0
  80. package/artifacts/schema/robot-config-doc.schema.json +5 -5
  81. package/artifacts/schema/robot-deletion-summary.schema.json +33 -1
  82. package/artifacts/schema/role-collection-rights.schema.json +82 -0
  83. package/artifacts/schema/role-rename-preview.schema.json +7 -6
  84. package/dist/apps.d.ts +18 -2
  85. package/dist/apps.js +12 -2
  86. package/dist/audit.d.ts +32 -2
  87. package/dist/audit.js +40 -2
  88. package/dist/billing.js +12 -3
  89. package/dist/collections-issues.d.ts +67 -0
  90. package/dist/collections-issues.js +340 -0
  91. package/dist/collections-records.d.ts +562 -0
  92. package/dist/collections-records.js +525 -0
  93. package/dist/collections-rights.d.ts +17 -0
  94. package/dist/collections-rights.js +41 -0
  95. package/dist/collections-schema.d.ts +1064 -0
  96. package/dist/collections-schema.js +386 -0
  97. package/dist/collections-templates.d.ts +55 -0
  98. package/dist/collections-templates.js +137 -0
  99. package/dist/collections-transfer.d.ts +101 -0
  100. package/dist/collections-transfer.js +206 -0
  101. package/dist/collections-values.d.ts +67 -0
  102. package/dist/collections-values.js +284 -0
  103. package/dist/collections.d.ts +568 -0
  104. package/dist/collections.js +332 -0
  105. package/dist/config.d.ts +8 -8
  106. package/dist/config.js +13 -13
  107. package/dist/errors.d.ts +50 -1
  108. package/dist/errors.js +117 -2
  109. package/dist/index.d.ts +24 -8
  110. package/dist/index.js +13 -3
  111. package/dist/org-roles.d.ts +4 -0
  112. package/dist/org-roles.js +10 -9
  113. package/dist/plans.d.ts +22 -2
  114. package/dist/plans.js +26 -4
  115. package/dist/realtime.d.ts +166 -0
  116. package/dist/realtime.js +163 -0
  117. package/dist/rest.d.ts +28 -28
  118. package/dist/rest.js +39 -27
  119. package/dist/rights.d.ts +2 -2
  120. package/dist/rights.js +1 -1
  121. package/dist/routes.d.ts +1 -1
  122. package/dist/routes.js +495 -21
  123. package/package.json +1 -1
  124. package/artifacts/schema/put-robot-details-request.schema.json +0 -41
  125. package/artifacts/schema/put-robot-details-response.schema.json +0 -43
  126. package/artifacts/schema/robot-details-doc.schema.json +0 -33
@@ -0,0 +1,35 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "type": "object",
4
+ "properties": {
5
+ "references": {
6
+ "type": "array",
7
+ "items": {
8
+ "type": "object",
9
+ "properties": {
10
+ "collection": {
11
+ "type": "string",
12
+ "minLength": 1,
13
+ "description": "The key of a collection that has records pointing at this one."
14
+ },
15
+ "count": {
16
+ "type": "integer",
17
+ "minimum": 1,
18
+ "maximum": 9007199254740991,
19
+ "description": "How many records of that collection point at it."
20
+ }
21
+ },
22
+ "required": [
23
+ "collection",
24
+ "count"
25
+ ],
26
+ "additionalProperties": false
27
+ },
28
+ "description": "The collections whose records reference the record, each with how many. Only collections the caller may read are named, so the list is empty when the records that point here are all in collections the caller cannot read; the refusal still stands."
29
+ }
30
+ },
31
+ "required": [
32
+ "references"
33
+ ],
34
+ "additionalProperties": false
35
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "type": "object",
4
+ "properties": {
5
+ "field": {
6
+ "type": "string",
7
+ "minLength": 1,
8
+ "description": "The key of the reference field."
9
+ },
10
+ "reason": {
11
+ "type": "string",
12
+ "enum": [
13
+ "missing",
14
+ "other_robot",
15
+ "not_readable"
16
+ ],
17
+ "description": "`missing`: no record of the target collection has that id. `other_robot`: the target belongs to another robot than the record that points at it. `not_readable`: the caller may not read the target collection."
18
+ }
19
+ },
20
+ "required": [
21
+ "field",
22
+ "reason"
23
+ ],
24
+ "additionalProperties": false
25
+ }
@@ -6,17 +6,18 @@
6
6
  "type": "string",
7
7
  "enum": [
8
8
  "config",
9
+ "collection_schema",
9
10
  "app_user",
10
11
  "invitation",
11
12
  "app_default",
12
13
  "role_inherits",
13
14
  "org_default"
14
15
  ],
15
- "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."
16
+ "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."
16
17
  },
17
18
  "label": {
18
19
  "type": "string",
19
- "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`)."
20
+ "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`)."
20
21
  },
21
22
  "path": {
22
23
  "anyOf": [
@@ -27,7 +28,7 @@
27
28
  "type": "null"
28
29
  }
29
30
  ],
30
- "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."
31
+ "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."
31
32
  },
32
33
  "robot_id": {
33
34
  "anyOf": [
@@ -53,7 +54,7 @@
53
54
  "type": "null"
54
55
  }
55
56
  ],
56
- "description": "The app the user, invitation or default role belongs to (`app_user`, `invitation`, `app_default`); `null` for every other kind."
57
+ "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."
57
58
  },
58
59
  "user_id": {
59
60
  "anyOf": [
@@ -81,7 +82,7 @@
81
82
  "type": "null"
82
83
  }
83
84
  ],
84
- "description": "Which version of the robot's document holds the key (`config`): the published one or the draft; `null` for every other kind."
85
+ "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."
85
86
  },
86
87
  "new_version": {
87
88
  "anyOf": [
@@ -94,7 +95,7 @@
94
95
  "type": "null"
95
96
  }
96
97
  ],
97
- "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."
98
+ "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."
98
99
  }
99
100
  },
100
101
  "required": [
@@ -0,0 +1,19 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "type": "object",
4
+ "properties": {
5
+ "fields": {
6
+ "minItems": 1,
7
+ "type": "array",
8
+ "items": {
9
+ "type": "string",
10
+ "minLength": 1
11
+ },
12
+ "description": "The keys of the required fields that have no value."
13
+ }
14
+ },
15
+ "required": [
16
+ "fields"
17
+ ],
18
+ "additionalProperties": false
19
+ }
@@ -465,7 +465,7 @@
465
465
  }
466
466
  ]
467
467
  },
468
- "description": "Values the robot publishes, each one field of one topic or a whole topic, and **never several topics**. Keys are slugs, one namespace across all five exposure sections, which is what lets an app lock name `{robot, slug}` without naming a kind; `bridge_state` and `robot_details` are built-in, `history` is reserved because `GET …/jobs/history` would shadow an action of that name, and `assets` and `job_history` are reserved because they name the robot-level capabilities; all five are refused when the document is validated.",
468
+ "description": "Values the robot publishes, each one field of one topic or a whole topic, and **never several topics**. Keys are slugs, one namespace across all five exposure sections, which is what lets an app lock name `{robot, slug}` without naming a kind; `bridge_state` is built-in, `history` is reserved because `GET …/jobs/history` would shadow an action of that name, and `assets` and `job_history` are reserved because they name the robot-level capabilities; all four are refused when the document is validated.",
469
469
  "defaultSnippets": [
470
470
  {
471
471
  "label": "a datapoint",
@@ -748,7 +748,7 @@
748
748
  }
749
749
  ]
750
750
  },
751
- "description": "Things the robot does on request that take time, each reported as a job with progress. **At most one job runs per action slug**: a second call is refused `busy`, and every observer of that slug watches the same job. Keys are slugs, one namespace across all five exposure sections, which is what lets an app lock name `{robot, slug}` without naming a kind; `bridge_state` and `robot_details` are built-in, `history` is reserved because `GET …/jobs/history` would shadow an action of that name, and `assets` and `job_history` are reserved because they name the robot-level capabilities; all five are refused when the document is validated.",
751
+ "description": "Things the robot does on request that take time, each reported as a job with progress. **At most one job runs per action slug**: a second call is refused `busy`, and every observer of that slug watches the same job. Keys are slugs, one namespace across all five exposure sections, which is what lets an app lock name `{robot, slug}` without naming a kind; `bridge_state` is built-in, `history` is reserved because `GET …/jobs/history` would shadow an action of that name, and `assets` and `job_history` are reserved because they name the robot-level capabilities; all four are refused when the document is validated.",
752
752
  "defaultSnippets": [
753
753
  {
754
754
  "label": "an action",
@@ -1004,7 +1004,7 @@
1004
1004
  }
1005
1005
  ]
1006
1006
  },
1007
- "description": "ROS service calls the robot answers — one request, one reply. Unlike an action a service reports **no progress** and the call returns with its result already on the job, so there is nothing left to observe; a second concurrent call is still refused `busy`, exactly as for an action. Keys are slugs, one namespace across all five exposure sections, which is what lets an app lock name `{robot, slug}` without naming a kind; `bridge_state` and `robot_details` are built-in, `history` is reserved because `GET …/jobs/history` would shadow an action of that name, and `assets` and `job_history` are reserved because they name the robot-level capabilities; all five are refused when the document is validated.",
1007
+ "description": "ROS service calls the robot answers — one request, one reply. Unlike an action a service reports **no progress** and the call returns with its result already on the job, so there is nothing left to observe; a second concurrent call is still refused `busy`, exactly as for an action. Keys are slugs, one namespace across all five exposure sections, which is what lets an app lock name `{robot, slug}` without naming a kind; `bridge_state` is built-in, `history` is reserved because `GET …/jobs/history` would shadow an action of that name, and `assets` and `job_history` are reserved because they name the robot-level capabilities; all four are refused when the document is validated.",
1008
1008
  "defaultSnippets": [
1009
1009
  {
1010
1010
  "label": "a service",
@@ -1347,7 +1347,7 @@
1347
1347
  }
1348
1348
  ]
1349
1349
  },
1350
- "description": "Topics clients may send to, and where the format's whole safety story lives. The `message` template fixes every value a caller cannot change, and **`failsafe` is required**: once a client falls silent the bridge sends the failsafe message itself, so an operator whose window closed does not leave a robot driving. Keys are slugs, one namespace across all five exposure sections, which is what lets an app lock name `{robot, slug}` without naming a kind; `bridge_state` and `robot_details` are built-in, `history` is reserved because `GET …/jobs/history` would shadow an action of that name, and `assets` and `job_history` are reserved because they name the robot-level capabilities; all five are refused when the document is validated.",
1350
+ "description": "Topics clients may send to, and where the format's whole safety story lives. The `message` template fixes every value a caller cannot change, and **`failsafe` is required**: once a client falls silent the bridge sends the failsafe message itself, so an operator whose window closed does not leave a robot driving. Keys are slugs, one namespace across all five exposure sections, which is what lets an app lock name `{robot, slug}` without naming a kind; `bridge_state` is built-in, `history` is reserved because `GET …/jobs/history` would shadow an action of that name, and `assets` and `job_history` are reserved because they name the robot-level capabilities; all four are refused when the document is validated.",
1351
1351
  "defaultSnippets": [
1352
1352
  {
1353
1353
  "label": "a publisher, with its parameters and its failsafe",
@@ -1766,7 +1766,7 @@
1766
1766
  }
1767
1767
  ]
1768
1768
  },
1769
- "description": "Video the robot streams, and the still frames the cloud serves from it. `width`, `height`, `fps` and `bitrate_kbps` are what **the bridge produces before sending**, not what the camera captures — they live in the configuration rather than in a viewer's request precisely so that no viewer can make a robot send more. Keys are slugs, one namespace across all five exposure sections, which is what lets an app lock name `{robot, slug}` without naming a kind; `bridge_state` and `robot_details` are built-in, `history` is reserved because `GET …/jobs/history` would shadow an action of that name, and `assets` and `job_history` are reserved because they name the robot-level capabilities; all five are refused when the document is validated.",
1769
+ "description": "Video the robot streams, and the still frames the cloud serves from it. `width`, `height`, `fps` and `bitrate_kbps` are what **the bridge produces before sending**, not what the camera captures — they live in the configuration rather than in a viewer's request precisely so that no viewer can make a robot send more. Keys are slugs, one namespace across all five exposure sections, which is what lets an app lock name `{robot, slug}` without naming a kind; `bridge_state` is built-in, `history` is reserved because `GET …/jobs/history` would shadow an action of that name, and `assets` and `job_history` are reserved because they name the robot-level capabilities; all four are refused when the document is validated.",
1770
1770
  "defaultSnippets": [
1771
1771
  {
1772
1772
  "label": "a camera",
@@ -47,6 +47,37 @@
47
47
  },
48
48
  "had_unpublished_draft": {
49
49
  "type": "boolean"
50
+ },
51
+ "collection_records": {
52
+ "type": "array",
53
+ "items": {
54
+ "type": "object",
55
+ "properties": {
56
+ "app_id": {
57
+ "type": "string",
58
+ "format": "uuid",
59
+ "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)$",
60
+ "description": "The app whose collections hold records of the robot."
61
+ },
62
+ "app_name": {
63
+ "type": "string",
64
+ "description": "The app's name."
65
+ },
66
+ "records": {
67
+ "type": "integer",
68
+ "minimum": 0,
69
+ "maximum": 9007199254740991,
70
+ "description": "How many records of the robot the app's collections hold, deleted with the robot."
71
+ }
72
+ },
73
+ "required": [
74
+ "app_id",
75
+ "app_name",
76
+ "records"
77
+ ],
78
+ "additionalProperties": false
79
+ },
80
+ "description": "App collection records that go with the robot, per app. A robot's records are kept in every app it was attached to, also in one it was detached from, and are deleted with their history when the robot is; apps without records of this robot are left out."
50
81
  }
51
82
  },
52
83
  "required": [
@@ -58,7 +89,8 @@
58
89
  "asset_bytes_freed",
59
90
  "job_run_count",
60
91
  "had_live_session",
61
- "had_unpublished_draft"
92
+ "had_unpublished_draft",
93
+ "collection_records"
62
94
  ],
63
95
  "additionalProperties": false
64
96
  }
@@ -0,0 +1,82 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "type": "object",
4
+ "properties": {
5
+ "collection": {
6
+ "type": "string",
7
+ "pattern": "^[a-z][a-z0-9_]{0,62}$",
8
+ "description": "The collection's key."
9
+ },
10
+ "label": {
11
+ "type": "string",
12
+ "description": "The collection's label for people to read; its key when the schema gives none."
13
+ },
14
+ "binding": {
15
+ "type": "string",
16
+ "enum": [
17
+ "global",
18
+ "per_robot",
19
+ "one_per_robot"
20
+ ],
21
+ "description": "`global`: records belong to the app and no robot. `per_robot`: every record belongs to one robot (system field `robot_id`, fixed when the record is created). `one_per_robot`: every robot of the app has exactly one record, which Fleetless creates itself."
22
+ },
23
+ "read": {
24
+ "type": "boolean",
25
+ "description": "Whether the role may read the records."
26
+ },
27
+ "create": {
28
+ "type": "boolean",
29
+ "description": "Whether the role may create records."
30
+ },
31
+ "update": {
32
+ "anyOf": [
33
+ {
34
+ "type": "string",
35
+ "const": "all"
36
+ },
37
+ {
38
+ "type": "string",
39
+ "const": "own"
40
+ },
41
+ {
42
+ "type": "boolean",
43
+ "const": false
44
+ }
45
+ ],
46
+ "description": "`all`: the role may change every record. `own`: only records its user created. `false`: none."
47
+ },
48
+ "delete": {
49
+ "anyOf": [
50
+ {
51
+ "type": "string",
52
+ "const": "all"
53
+ },
54
+ {
55
+ "type": "string",
56
+ "const": "own"
57
+ },
58
+ {
59
+ "type": "boolean",
60
+ "const": false
61
+ }
62
+ ],
63
+ "description": "`all`: the role may delete every record. `own`: only records its user created. `false`: none."
64
+ },
65
+ "robot_filter": {
66
+ "type": "boolean",
67
+ "description": "`true` on a collection that belongs to robots (`per_robot`, `one_per_robot`): the role sees and writes only the records of robots a session of the role reaches, whatever the rights above say. `false` on a `global` collection."
68
+ }
69
+ },
70
+ "required": [
71
+ "collection",
72
+ "label",
73
+ "binding",
74
+ "read",
75
+ "create",
76
+ "update",
77
+ "delete",
78
+ "robot_filter"
79
+ ],
80
+ "additionalProperties": false,
81
+ "description": "What one role may do with the records of one collection."
82
+ }
@@ -19,17 +19,18 @@
19
19
  "type": "string",
20
20
  "enum": [
21
21
  "config",
22
+ "collection_schema",
22
23
  "app_user",
23
24
  "invitation",
24
25
  "app_default",
25
26
  "role_inherits",
26
27
  "org_default"
27
28
  ],
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
+ "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."
29
30
  },
30
31
  "label": {
31
32
  "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
+ "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`)."
33
34
  },
34
35
  "path": {
35
36
  "anyOf": [
@@ -40,7 +41,7 @@
40
41
  "type": "null"
41
42
  }
42
43
  ],
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
+ "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."
44
45
  },
45
46
  "robot_id": {
46
47
  "anyOf": [
@@ -66,7 +67,7 @@
66
67
  "type": "null"
67
68
  }
68
69
  ],
69
- "description": "The app the user, invitation or default role belongs to (`app_user`, `invitation`, `app_default`); `null` for every other kind."
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."
70
71
  },
71
72
  "user_id": {
72
73
  "anyOf": [
@@ -94,7 +95,7 @@
94
95
  "type": "null"
95
96
  }
96
97
  ],
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
+ "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."
98
99
  },
99
100
  "new_version": {
100
101
  "anyOf": [
@@ -107,7 +108,7 @@
107
108
  "type": "null"
108
109
  }
109
110
  ],
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
+ "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."
111
112
  }
112
113
  },
113
114
  "required": [
package/dist/apps.d.ts CHANGED
@@ -49,9 +49,9 @@ export type AppListResponse = z.infer<typeof appListResponse>;
49
49
  * What deleting an app would destroy — read before the irreversible click,
50
50
  * and carried again by the `app.deleted` audit event.
51
51
  *
52
- * **Five numbers, never a sum**, for the reason `robotDeletionSummary` states
52
+ * **Seven numbers, never a sum**, for the reason `robotDeletionSummary` states
53
53
  * at length: the console reads this aloud as one sentence, and a total would
54
- * describe five unrelated magnitudes with one figure on the one screen whose
54
+ * describe seven unrelated magnitudes with one figure on the one screen whose
55
55
  * entire justification is naming what cannot be undone.
56
56
  *
57
57
  * Roles are not here: they belong to the organization, so deleting an app
@@ -67,6 +67,8 @@ export declare const appDeletionSummary: z.ZodObject<{
67
67
  invitation_count: z.ZodNumber;
68
68
  oidc_provider_count: z.ZodNumber;
69
69
  mail_template_count: z.ZodNumber;
70
+ collection_count: z.ZodNumber;
71
+ record_count: z.ZodNumber;
70
72
  }, z.core.$strip>;
71
73
  export type AppDeletionSummary = z.infer<typeof appDeletionSummary>;
72
74
  /**
@@ -395,5 +397,19 @@ export declare const effectiveRightsResponse: z.ZodObject<{
395
397
  }, z.core.$strip>>;
396
398
  }, z.core.$strip>;
397
399
  }, z.core.$strip>>;
400
+ collections: z.ZodArray<z.ZodObject<{
401
+ collection: z.ZodString;
402
+ label: z.ZodString;
403
+ binding: z.ZodEnum<{
404
+ global: "global";
405
+ per_robot: "per_robot";
406
+ one_per_robot: "one_per_robot";
407
+ }>;
408
+ read: z.ZodBoolean;
409
+ create: z.ZodBoolean;
410
+ update: z.ZodUnion<readonly [z.ZodLiteral<"all">, z.ZodLiteral<"own">, z.ZodLiteral<false>]>;
411
+ delete: z.ZodUnion<readonly [z.ZodLiteral<"all">, z.ZodLiteral<"own">, z.ZodLiteral<false>]>;
412
+ robot_filter: z.ZodBoolean;
413
+ }, z.core.$strip>>;
398
414
  }, z.core.$strip>;
399
415
  export type EffectiveRightsResponse = z.infer<typeof effectiveRightsResponse>;
package/dist/apps.js CHANGED
@@ -2,6 +2,7 @@
2
2
  import { z } from 'zod';
3
3
  import { slug } from './common.js';
4
4
  import { mcpRobotDatasheet } from './mcp.js';
5
+ import { roleCollectionRights } from './collections-rights.js';
5
6
  import { ACCESS_KINDS, accessKind, roleKey } from './rights.js';
6
7
  /**
7
8
  * Apps, roles and rights.
@@ -75,9 +76,9 @@ export const appListResponse = z.object({
75
76
  * What deleting an app would destroy — read before the irreversible click,
76
77
  * and carried again by the `app.deleted` audit event.
77
78
  *
78
- * **Five numbers, never a sum**, for the reason `robotDeletionSummary` states
79
+ * **Seven numbers, never a sum**, for the reason `robotDeletionSummary` states
79
80
  * at length: the console reads this aloud as one sentence, and a total would
80
- * describe five unrelated magnitudes with one figure on the one screen whose
81
+ * describe seven unrelated magnitudes with one figure on the one screen whose
81
82
  * entire justification is naming what cannot be undone.
82
83
  *
83
84
  * Roles are not here: they belong to the organization, so deleting an app
@@ -103,6 +104,12 @@ export const appDeletionSummary = z.object({
103
104
  mail_template_count: z.number().int().nonnegative().meta({
104
105
  description: 'Custom mail templates, of at most three. A kind using the Fleetless default text is not counted — there is no row to lose.',
105
106
  }),
107
+ collection_count: z.number().int().nonnegative().meta({
108
+ description: 'Collections of the app\'s latest published schema. They go with the app, together with their records and history.',
109
+ }),
110
+ record_count: z.number().int().nonnegative().meta({
111
+ description: 'Records of the app\'s collections, deleted with the app.',
112
+ }),
106
113
  });
107
114
  /**
108
115
  * **`robot_ids` is accepted here, and `.strict()` catches everything else.**
@@ -383,4 +390,7 @@ export const effectiveRightsResponse = z.object({
383
390
  robots: z.array(effectiveRobotRights).meta({
384
391
  description: 'The robots attached to the app, each with what the role may use.',
385
392
  }),
393
+ collections: z.array(roleCollectionRights).meta({
394
+ description: 'What the role may do with the records of each collection of the app\'s latest published schema, in the schema\'s order. Empty when the app has no published schema. A role that is no role, and a user who is not `active`, are granted nothing in any row.',
395
+ }),
386
396
  });
package/dist/audit.d.ts CHANGED
@@ -6,8 +6,9 @@ import { z } from 'zod';
6
6
  * its actor — never anonymous**. Reads are not audited.
7
7
  *
8
8
  * What is written: logins, failed logins, user management, configuration
9
- * publishes, bridge connect and disconnect. The log is filterable, exportable
10
- * as CSV, and kept for ninety days.
9
+ * publishes, bridge connect and disconnect, and the writes of app collections
10
+ * (`COLLECTION_AUDIT_ACTIONS`). The log is filterable, exportable as CSV, and
11
+ * kept for ninety days.
11
12
  */
12
13
  /**
13
14
  * The kinds of actor the platform knows. `label` is what a human reads in the
@@ -135,3 +136,32 @@ export declare const AUDIT_CSV_COLUMNS: readonly ["seq", "at", "actor_kind", "ac
135
136
  * as `ROBOT_ASSET_STORE_BYTES`.
136
137
  */
137
138
  export declare const AUDIT_RETENTION_DAYS = 90;
139
+ /**
140
+ * **The audit actions of app collections.** Each write request writes exactly
141
+ * one entry, whatever it changed: an import of 5,000 rows is one
142
+ * `collection_import.completed`, not 5,000 record entries. Reads and exports
143
+ * are not audited, here as everywhere in this log.
144
+ *
145
+ * - `collection_schema.published`: a schema version was published; the entry
146
+ * names the version and counts the effects it had on data. A role rename
147
+ * that rewrites the key in the `access` of an app's collections also appends
148
+ * a version, which changes no record: its entry has no effects and carries
149
+ * `role_rename` with the `from` and `to` keys, and its actor is the
150
+ * developer who renamed the role.
151
+ * - `collection_schema.restored`: an earlier version was restored; the entry
152
+ * names the version, says whether records were put back too and counts what
153
+ * changed.
154
+ * - `collection_record.created`, `.updated`, `.deleted`, `.restored`: one
155
+ * record write; the entry names the collection, the record and its robot.
156
+ * - `collection_import.completed`: an import was carried out; the entry names
157
+ * the collection and the mode and counts the records created, updated and
158
+ * deleted.
159
+ * - `collection_history.purged`: an organization owner removed history older
160
+ * than a date; the entry names the date, the collection or the whole app,
161
+ * and how many revisions went. The actor is the owner.
162
+ *
163
+ * The strings are stable: filter the log with `action` or with
164
+ * `action_prefix` (`collection_record.`).
165
+ */
166
+ export declare const COLLECTION_AUDIT_ACTIONS: readonly ["collection_schema.published", "collection_schema.restored", "collection_record.created", "collection_record.updated", "collection_record.deleted", "collection_record.restored", "collection_import.completed", "collection_history.purged"];
167
+ export type CollectionAuditAction = (typeof COLLECTION_AUDIT_ACTIONS)[number];
package/dist/audit.js CHANGED
@@ -7,8 +7,9 @@ import { wireSeqCursor, wireTimestampMs } from './common.js';
7
7
  * its actor — never anonymous**. Reads are not audited.
8
8
  *
9
9
  * What is written: logins, failed logins, user management, configuration
10
- * publishes, bridge connect and disconnect. The log is filterable, exportable
11
- * as CSV, and kept for ninety days.
10
+ * publishes, bridge connect and disconnect, and the writes of app collections
11
+ * (`COLLECTION_AUDIT_ACTIONS`). The log is filterable, exportable as CSV, and
12
+ * kept for ninety days.
12
13
  */
13
14
  /**
14
15
  * The kinds of actor the platform knows. `label` is what a human reads in the
@@ -226,3 +227,40 @@ export const AUDIT_CSV_COLUMNS = ['seq', 'at', 'actor_kind', 'actor_id', 'action
226
227
  * as `ROBOT_ASSET_STORE_BYTES`.
227
228
  */
228
229
  export const AUDIT_RETENTION_DAYS = 90;
230
+ /**
231
+ * **The audit actions of app collections.** Each write request writes exactly
232
+ * one entry, whatever it changed: an import of 5,000 rows is one
233
+ * `collection_import.completed`, not 5,000 record entries. Reads and exports
234
+ * are not audited, here as everywhere in this log.
235
+ *
236
+ * - `collection_schema.published`: a schema version was published; the entry
237
+ * names the version and counts the effects it had on data. A role rename
238
+ * that rewrites the key in the `access` of an app's collections also appends
239
+ * a version, which changes no record: its entry has no effects and carries
240
+ * `role_rename` with the `from` and `to` keys, and its actor is the
241
+ * developer who renamed the role.
242
+ * - `collection_schema.restored`: an earlier version was restored; the entry
243
+ * names the version, says whether records were put back too and counts what
244
+ * changed.
245
+ * - `collection_record.created`, `.updated`, `.deleted`, `.restored`: one
246
+ * record write; the entry names the collection, the record and its robot.
247
+ * - `collection_import.completed`: an import was carried out; the entry names
248
+ * the collection and the mode and counts the records created, updated and
249
+ * deleted.
250
+ * - `collection_history.purged`: an organization owner removed history older
251
+ * than a date; the entry names the date, the collection or the whole app,
252
+ * and how many revisions went. The actor is the owner.
253
+ *
254
+ * The strings are stable: filter the log with `action` or with
255
+ * `action_prefix` (`collection_record.`).
256
+ */
257
+ export const COLLECTION_AUDIT_ACTIONS = [
258
+ 'collection_schema.published',
259
+ 'collection_schema.restored',
260
+ 'collection_record.created',
261
+ 'collection_record.updated',
262
+ 'collection_record.deleted',
263
+ 'collection_record.restored',
264
+ 'collection_import.completed',
265
+ 'collection_history.purged',
266
+ ];
package/dist/billing.js CHANGED
@@ -491,7 +491,11 @@ const intentIdentity = {
491
491
  intent_id: z.uuid().meta({ description: 'Opaque persisted purchase intent identity.' }),
492
492
  operation_key: purchaseOperationKey,
493
493
  operation: chargeOperation,
494
- invoice_id: z.uuid().optional().meta({ description: 'The due charge or issued invoice, for invoice-paying operations.' }),
494
+ invoice_id: z.uuid().optional().meta({
495
+ description: 'For an invoice-paying operation, the due charge or issued invoice being paid. For a confirmed paid_change with ' +
496
+ 'payment_started, the charge or invoice created for that decision; when the charge was issued through Lexware ' +
497
+ '(`charged` is `null`), it identifies the matching billing.charges[].id. Absent on a paid_change in any other state.',
498
+ }),
495
499
  };
496
500
  export const purchaseHoldReason = z.enum([
497
501
  'legacy_usd_invoice', 'legacy_payer_unresolved', 'mandate_policy_unresolved',
@@ -971,7 +975,10 @@ export const billingDocumentFileQuery = z.object({
971
975
  /** Accepted paid changes retain their provider identity; accepted no-payment changes have none. */
972
976
  const acceptedBillingFields = {
973
977
  billing: billingView.meta({ description: 'The billing view after the change.' }),
974
- charged: billingInvoice.nullable().meta({ description: 'The invoice charged now, or `null` when the change was only scheduled for the period\'s end.' }),
978
+ charged: billingInvoice.nullable().meta({
979
+ description: 'The Fleetless invoice charged now, or `null` when nothing was charged now (a change scheduled for the period end, ' +
980
+ 'or an increase that cost nothing) or the change was charged through Lexware (then the charge is in `billing.charges`).',
981
+ }),
975
982
  };
976
983
  const acceptedPaidChange = z.object({
977
984
  ...acceptedBillingFields,
@@ -979,7 +986,9 @@ const acceptedPaidChange = z.object({
979
986
  }).strict();
980
987
  const acceptedNoPaymentChange = z.object({
981
988
  billing: billingView,
982
- charged: z.null(),
989
+ charged: z.null().meta({
990
+ description: 'Always `null`: nothing was charged now (a scheduled change or an increase that cost nothing).',
991
+ }),
983
992
  intent: purchaseIntentAcceptedWithoutPayment,
984
993
  }).strict();
985
994
  export const billingChangeResponse = z.union([