@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.
- package/CHANGELOG.md +184 -0
- package/artifacts/openapi.json +20210 -11764
- package/artifacts/routes.json +1160 -39
- 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-deletion-summary.schema.json +15 -1
- package/artifacts/schema/asset-plan-limit-details.schema.json +3 -1
- package/artifacts/schema/billing-change-response.schema.json +9 -8
- package/artifacts/schema/checkout-response.schema.json +6 -6
- package/artifacts/schema/cloud-config.schema.json +5 -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 +5 -5
- package/artifacts/schema/config-version-response.schema.json +5 -5
- package/artifacts/schema/confirmation-required-details.schema.json +13 -0
- package/artifacts/schema/dangling-reference.schema.json +7 -6
- package/artifacts/schema/datapoint-list-response.schema.json +2 -2
- package/artifacts/schema/effective-rights-response.schema.json +87 -1
- 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 +8 -7
- package/artifacts/schema/org-role.schema.json +1 -1
- 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/purchase-conflict-details.schema.json +6 -6
- package/artifacts/schema/purchase-intent-draft.schema.json +5 -5
- package/artifacts/schema/purchase-intent-payment-started.schema.json +1 -1
- package/artifacts/schema/purchase-intent-response.schema.json +10 -9
- package/artifacts/schema/put-collections-draft-request.schema.json +16 -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 +7 -6
- package/artifacts/schema/required-missing-details.schema.json +19 -0
- package/artifacts/schema/robot-config-doc.schema.json +5 -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-rename-preview.schema.json +7 -6
- package/dist/apps.d.ts +18 -2
- package/dist/apps.js +12 -2
- package/dist/audit.d.ts +32 -2
- package/dist/audit.js +40 -2
- package/dist/billing.js +12 -3
- 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/config.d.ts +8 -8
- package/dist/config.js +13 -13
- package/dist/errors.d.ts +50 -1
- package/dist/errors.js +117 -2
- package/dist/index.d.ts +24 -8
- package/dist/index.js +13 -3
- package/dist/org-roles.d.ts +4 -0
- package/dist/org-roles.js +10 -9
- package/dist/plans.d.ts +22 -2
- package/dist/plans.js +26 -4
- package/dist/realtime.d.ts +166 -0
- package/dist/realtime.js +163 -0
- package/dist/rest.d.ts +28 -28
- package/dist/rest.js +39 -27
- package/dist/rights.d.ts +2 -2
- package/dist/rights.js +1 -1
- package/dist/routes.d.ts +1 -1
- package/dist/routes.js +495 -21
- package/package.json +1 -1
- 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
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"properties": {
|
|
5
|
+
"type": {
|
|
6
|
+
"type": "string",
|
|
7
|
+
"const": "collection_event"
|
|
8
|
+
},
|
|
9
|
+
"request_id": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"minLength": 1,
|
|
12
|
+
"maxLength": 64,
|
|
13
|
+
"description": "The `request_id` of the subscription the event belongs to."
|
|
14
|
+
},
|
|
15
|
+
"event": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"enum": [
|
|
18
|
+
"created",
|
|
19
|
+
"updated",
|
|
20
|
+
"deleted",
|
|
21
|
+
"removed",
|
|
22
|
+
"entered"
|
|
23
|
+
],
|
|
24
|
+
"description": "`created`, `updated` and `deleted`: the record was written. `removed`: the record left the view of this subscription without being deleted, because its values no longer match the filter, the role lost the right to read it or its robot was detached. `entered`: the record came into view the same way."
|
|
25
|
+
},
|
|
26
|
+
"id": {
|
|
27
|
+
"type": "string",
|
|
28
|
+
"format": "uuid",
|
|
29
|
+
"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)$",
|
|
30
|
+
"description": "The id of the record."
|
|
31
|
+
},
|
|
32
|
+
"record": {
|
|
33
|
+
"type": "object",
|
|
34
|
+
"properties": {
|
|
35
|
+
"id": {
|
|
36
|
+
"type": "string",
|
|
37
|
+
"format": "uuid",
|
|
38
|
+
"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)$"
|
|
39
|
+
},
|
|
40
|
+
"robot_id": {
|
|
41
|
+
"anyOf": [
|
|
42
|
+
{
|
|
43
|
+
"type": "string",
|
|
44
|
+
"format": "uuid",
|
|
45
|
+
"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)$"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"type": "null"
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
"description": "The robot a record of a `per_robot` or `one_per_robot` collection belongs to; null in a `global` collection."
|
|
52
|
+
},
|
|
53
|
+
"created_at": {
|
|
54
|
+
"type": "string",
|
|
55
|
+
"format": "date-time",
|
|
56
|
+
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
|
|
57
|
+
},
|
|
58
|
+
"created_by": {
|
|
59
|
+
"type": "object",
|
|
60
|
+
"properties": {
|
|
61
|
+
"kind": {
|
|
62
|
+
"type": "string",
|
|
63
|
+
"enum": [
|
|
64
|
+
"developer",
|
|
65
|
+
"app_user",
|
|
66
|
+
"server_key",
|
|
67
|
+
"fleetless"
|
|
68
|
+
],
|
|
69
|
+
"description": "What made the change: a developer, a user of the app, a server key of the app, or the platform itself."
|
|
70
|
+
},
|
|
71
|
+
"id": {
|
|
72
|
+
"type": "string",
|
|
73
|
+
"format": "uuid",
|
|
74
|
+
"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)$",
|
|
75
|
+
"description": "The id of the developer, app user or server key. The nil id for the platform."
|
|
76
|
+
},
|
|
77
|
+
"label": {
|
|
78
|
+
"type": "string",
|
|
79
|
+
"minLength": 1,
|
|
80
|
+
"maxLength": 200,
|
|
81
|
+
"description": "A name to show: the person's display name, the name of a server key, `Fleetless`, `Deleted user` when the user no longer exists, or `Deleted key` when the key does. A person without a display name reads as their email address to a developer or a server key and to themselves, and to an app user reading someone else as `Team member` (a developer) or `User` (an app user): an app user never learns another person's address."
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
"required": [
|
|
85
|
+
"kind",
|
|
86
|
+
"id",
|
|
87
|
+
"label"
|
|
88
|
+
],
|
|
89
|
+
"description": "Who or what made a change to a record."
|
|
90
|
+
},
|
|
91
|
+
"updated_at": {
|
|
92
|
+
"type": "string",
|
|
93
|
+
"format": "date-time",
|
|
94
|
+
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
|
|
95
|
+
},
|
|
96
|
+
"updated_by": {
|
|
97
|
+
"type": "object",
|
|
98
|
+
"properties": {
|
|
99
|
+
"kind": {
|
|
100
|
+
"type": "string",
|
|
101
|
+
"enum": [
|
|
102
|
+
"developer",
|
|
103
|
+
"app_user",
|
|
104
|
+
"server_key",
|
|
105
|
+
"fleetless"
|
|
106
|
+
],
|
|
107
|
+
"description": "What made the change: a developer, a user of the app, a server key of the app, or the platform itself."
|
|
108
|
+
},
|
|
109
|
+
"id": {
|
|
110
|
+
"type": "string",
|
|
111
|
+
"format": "uuid",
|
|
112
|
+
"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)$",
|
|
113
|
+
"description": "The id of the developer, app user or server key. The nil id for the platform."
|
|
114
|
+
},
|
|
115
|
+
"label": {
|
|
116
|
+
"type": "string",
|
|
117
|
+
"minLength": 1,
|
|
118
|
+
"maxLength": 200,
|
|
119
|
+
"description": "A name to show: the person's display name, the name of a server key, `Fleetless`, `Deleted user` when the user no longer exists, or `Deleted key` when the key does. A person without a display name reads as their email address to a developer or a server key and to themselves, and to an app user reading someone else as `Team member` (a developer) or `User` (an app user): an app user never learns another person's address."
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
"required": [
|
|
123
|
+
"kind",
|
|
124
|
+
"id",
|
|
125
|
+
"label"
|
|
126
|
+
],
|
|
127
|
+
"description": "Who or what made a change to a record."
|
|
128
|
+
},
|
|
129
|
+
"revision": {
|
|
130
|
+
"type": "integer",
|
|
131
|
+
"minimum": 1,
|
|
132
|
+
"maximum": 9007199254740991,
|
|
133
|
+
"description": "Starts at 1 and grows by one with every change. Send it as `expected_revision` to refuse a write that would overwrite a newer one."
|
|
134
|
+
},
|
|
135
|
+
"display": {
|
|
136
|
+
"type": "string",
|
|
137
|
+
"description": "The collection's display template filled in for this record."
|
|
138
|
+
},
|
|
139
|
+
"missing_required": {
|
|
140
|
+
"type": "array",
|
|
141
|
+
"items": {
|
|
142
|
+
"type": "string"
|
|
143
|
+
},
|
|
144
|
+
"description": "Required fields that are empty because the schema changed after the record was written. The record can still be updated in its other fields. Absent when nothing is missing."
|
|
145
|
+
},
|
|
146
|
+
"values": {
|
|
147
|
+
"type": "object",
|
|
148
|
+
"propertyNames": {
|
|
149
|
+
"type": "string"
|
|
150
|
+
},
|
|
151
|
+
"additionalProperties": {},
|
|
152
|
+
"description": "The record's fields by key. A field without a value is absent. With `expand`, a reference field holds the referenced record in this same shape instead of its id, when the caller may read that collection."
|
|
153
|
+
},
|
|
154
|
+
"deleted_at": {
|
|
155
|
+
"type": "string",
|
|
156
|
+
"format": "date-time",
|
|
157
|
+
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
|
|
158
|
+
"description": "When the record was deleted. Present only in the list of deleted records (`deleted=true`); absent on a live record."
|
|
159
|
+
},
|
|
160
|
+
"deleted_by": {
|
|
161
|
+
"type": "object",
|
|
162
|
+
"properties": {
|
|
163
|
+
"kind": {
|
|
164
|
+
"type": "string",
|
|
165
|
+
"enum": [
|
|
166
|
+
"developer",
|
|
167
|
+
"app_user",
|
|
168
|
+
"server_key",
|
|
169
|
+
"fleetless"
|
|
170
|
+
],
|
|
171
|
+
"description": "What made the change: a developer, a user of the app, a server key of the app, or the platform itself."
|
|
172
|
+
},
|
|
173
|
+
"id": {
|
|
174
|
+
"type": "string",
|
|
175
|
+
"format": "uuid",
|
|
176
|
+
"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)$",
|
|
177
|
+
"description": "The id of the developer, app user or server key. The nil id for the platform."
|
|
178
|
+
},
|
|
179
|
+
"label": {
|
|
180
|
+
"type": "string",
|
|
181
|
+
"minLength": 1,
|
|
182
|
+
"maxLength": 200,
|
|
183
|
+
"description": "A name to show: the person's display name, the name of a server key, `Fleetless`, `Deleted user` when the user no longer exists, or `Deleted key` when the key does. A person without a display name reads as their email address to a developer or a server key and to themselves, and to an app user reading someone else as `Team member` (a developer) or `User` (an app user): an app user never learns another person's address."
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
"required": [
|
|
187
|
+
"kind",
|
|
188
|
+
"id",
|
|
189
|
+
"label"
|
|
190
|
+
],
|
|
191
|
+
"description": "Who deleted the record. Present only in the list of deleted records (`deleted=true`); absent on a live record."
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
"required": [
|
|
195
|
+
"id",
|
|
196
|
+
"robot_id",
|
|
197
|
+
"created_at",
|
|
198
|
+
"created_by",
|
|
199
|
+
"updated_at",
|
|
200
|
+
"updated_by",
|
|
201
|
+
"revision",
|
|
202
|
+
"display",
|
|
203
|
+
"values"
|
|
204
|
+
],
|
|
205
|
+
"description": "The record: as it is now for `created`, `updated`, `entered` and `removed`, and as it was for `deleted`. Absent only on a `removed` event for a record the subscriber may no longer read, so that its values are not told: that is the case when the robot of the record was detached, or when the role lost the right to read the collection."
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
"required": [
|
|
209
|
+
"type",
|
|
210
|
+
"request_id",
|
|
211
|
+
"event",
|
|
212
|
+
"id"
|
|
213
|
+
],
|
|
214
|
+
"additionalProperties": false,
|
|
215
|
+
"description": "A record came into view, changed or went away."
|
|
216
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"properties": {
|
|
5
|
+
"format": {
|
|
6
|
+
"type": "string",
|
|
7
|
+
"enum": [
|
|
8
|
+
"csv",
|
|
9
|
+
"json"
|
|
10
|
+
],
|
|
11
|
+
"description": "`csv`: UTF-8 text with a header row. `json`: an array of objects."
|
|
12
|
+
},
|
|
13
|
+
"filter": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"minLength": 1,
|
|
16
|
+
"description": "A filter as JSON text, for example `{\"location.name\":{\"eq\":\"XTD1\"}}`. A condition names a field of the collection, one of the system fields `id`, `robot_id`, `created_at`, `updated_at` and `created_by`, or a field of a referenced record written `reference.field`. `created_by` is compared with the id of the developer, user or key that created the record."
|
|
17
|
+
},
|
|
18
|
+
"search": {
|
|
19
|
+
"type": "string",
|
|
20
|
+
"description": "Words that must all occur, in any letter case, in at least one searchable field of the record. At most 10 words, separated by whitespace."
|
|
21
|
+
},
|
|
22
|
+
"sort": {
|
|
23
|
+
"type": "string",
|
|
24
|
+
"minLength": 1,
|
|
25
|
+
"description": "Up to 3 fields separated by commas; a leading `-` sorts descending, for example `-position_m,name`. A field is named as in `filter`: a field of the collection, one of the system fields `id`, `robot_id`, `created_at`, `updated_at` and `created_by`, or `reference.field`. Ties are broken by `id`."
|
|
26
|
+
},
|
|
27
|
+
"robot": {
|
|
28
|
+
"type": "string",
|
|
29
|
+
"format": "uuid",
|
|
30
|
+
"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)$",
|
|
31
|
+
"description": "Only the records of this robot, in a collection that belongs to robots."
|
|
32
|
+
},
|
|
33
|
+
"fields": {
|
|
34
|
+
"type": "string",
|
|
35
|
+
"minLength": 1,
|
|
36
|
+
"description": "The fields to export by key, separated by commas, in the order given. Default: all fields, in the order of the schema."
|
|
37
|
+
},
|
|
38
|
+
"references": {
|
|
39
|
+
"type": "string",
|
|
40
|
+
"minLength": 1,
|
|
41
|
+
"description": "How reference fields are written: `id` (the default) or the key of a unique field of the target collection, such as `name`, so that the file can be imported again. A reference field in the file whose target collection has no such unique field is `400 validation_error` (field `references`, rule `not_unique`); with no reference field among the columns the value is ignored."
|
|
42
|
+
},
|
|
43
|
+
"system": {
|
|
44
|
+
"type": "string",
|
|
45
|
+
"enum": [
|
|
46
|
+
"true",
|
|
47
|
+
"false"
|
|
48
|
+
],
|
|
49
|
+
"description": "`true` adds the system fields after the fields: `robot_id` in a collection that belongs to robots, then `id`, `created_at`, `created_by`, `updated_at`, `updated_by` and `revision`. `created_by` and `updated_by` are the actors' labels. Default `false`."
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"required": [
|
|
53
|
+
"format"
|
|
54
|
+
],
|
|
55
|
+
"additionalProperties": false
|
|
56
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"propertyNames": {
|
|
5
|
+
"type": "string"
|
|
6
|
+
},
|
|
7
|
+
"additionalProperties": {},
|
|
8
|
+
"description": "A filter is a JSON object. A condition names a field and one operator: `{ \"location.name\": { \"eq\": \"XTD1\" } }`. The operators are `eq`, `ne`, `lt`, `lte`, `gt`, `gte`, `contains` (case-insensitive text search), `in` (a list of at most 100 values) and `empty` (`true` or `false`). Conditions are combined with `{ \"and\": [ ... ] }` and `{ \"or\": [ ... ] }`, nested at most 3 levels deep, 50 conditions in all. A field is a field key, `reference.field` to go one hop through a reference field, or one of the system fields `id`, `robot_id`, `created_at`, `updated_at` and `created_by`."
|
|
9
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"properties": {
|
|
5
|
+
"counts": {
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"unchanged": {
|
|
9
|
+
"type": "integer",
|
|
10
|
+
"minimum": 0,
|
|
11
|
+
"maximum": 9007199254740991,
|
|
12
|
+
"description": "Rows that match a record that already has these values."
|
|
13
|
+
},
|
|
14
|
+
"new": {
|
|
15
|
+
"type": "integer",
|
|
16
|
+
"minimum": 0,
|
|
17
|
+
"maximum": 9007199254740991,
|
|
18
|
+
"description": "Records that would be created."
|
|
19
|
+
},
|
|
20
|
+
"updated": {
|
|
21
|
+
"type": "integer",
|
|
22
|
+
"minimum": 0,
|
|
23
|
+
"maximum": 9007199254740991,
|
|
24
|
+
"description": "Records that would change."
|
|
25
|
+
},
|
|
26
|
+
"deleted": {
|
|
27
|
+
"type": "integer",
|
|
28
|
+
"minimum": 0,
|
|
29
|
+
"maximum": 9007199254740991,
|
|
30
|
+
"description": "Records that `mirror` would delete."
|
|
31
|
+
},
|
|
32
|
+
"errors": {
|
|
33
|
+
"type": "integer",
|
|
34
|
+
"minimum": 0,
|
|
35
|
+
"maximum": 9007199254740991,
|
|
36
|
+
"description": "Problems found in the file. The same number as `errors_total`."
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"required": [
|
|
40
|
+
"unchanged",
|
|
41
|
+
"new",
|
|
42
|
+
"updated",
|
|
43
|
+
"deleted",
|
|
44
|
+
"errors"
|
|
45
|
+
],
|
|
46
|
+
"additionalProperties": false,
|
|
47
|
+
"description": "What the import would do, counted."
|
|
48
|
+
},
|
|
49
|
+
"errors": {
|
|
50
|
+
"maxItems": 1000,
|
|
51
|
+
"type": "array",
|
|
52
|
+
"items": {
|
|
53
|
+
"type": "object",
|
|
54
|
+
"properties": {
|
|
55
|
+
"row": {
|
|
56
|
+
"type": "integer",
|
|
57
|
+
"minimum": 0,
|
|
58
|
+
"maximum": 9007199254740991,
|
|
59
|
+
"description": "The row the problem is in, counted from 1 over the records of the file, so the header of a CSV is not counted. 0 marks a problem with the file as a whole, and a deletion of a `mirror` that a `prevent` reference blocks (the column is then the key column and the value the key of the record)."
|
|
60
|
+
},
|
|
61
|
+
"column": {
|
|
62
|
+
"type": "string",
|
|
63
|
+
"maxLength": 200,
|
|
64
|
+
"description": "The column as named in the file. Empty when the problem is not about one column. Cut to 200 characters, an ellipsis included."
|
|
65
|
+
},
|
|
66
|
+
"value": {
|
|
67
|
+
"type": "string",
|
|
68
|
+
"maxLength": 200,
|
|
69
|
+
"description": "The value as found in the file, cut to 200 characters with an ellipsis (`…`) at the end when it was longer."
|
|
70
|
+
},
|
|
71
|
+
"reason": {
|
|
72
|
+
"type": "string",
|
|
73
|
+
"minLength": 1,
|
|
74
|
+
"description": "What is wrong with it, in words."
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"required": [
|
|
78
|
+
"row",
|
|
79
|
+
"column",
|
|
80
|
+
"value",
|
|
81
|
+
"reason"
|
|
82
|
+
],
|
|
83
|
+
"additionalProperties": false,
|
|
84
|
+
"description": "A row, column and value that stop the import, with the reason."
|
|
85
|
+
},
|
|
86
|
+
"description": "The problems found, in file order, at most 1,000; `errors_total` is the exact number."
|
|
87
|
+
},
|
|
88
|
+
"errors_total": {
|
|
89
|
+
"type": "integer",
|
|
90
|
+
"minimum": 0,
|
|
91
|
+
"maximum": 9007199254740991,
|
|
92
|
+
"description": "The exact number of problems found."
|
|
93
|
+
},
|
|
94
|
+
"mirror_scope": {
|
|
95
|
+
"anyOf": [
|
|
96
|
+
{
|
|
97
|
+
"type": "string",
|
|
98
|
+
"enum": [
|
|
99
|
+
"collection",
|
|
100
|
+
"filter",
|
|
101
|
+
"robot"
|
|
102
|
+
]
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"type": "null"
|
|
106
|
+
}
|
|
107
|
+
],
|
|
108
|
+
"description": "Where `mirror` would delete records: `collection` is every record of the collection, which the preview should say prominently; `filter` and `robot` are the scope that was sent. Null when the mode is not `mirror`."
|
|
109
|
+
},
|
|
110
|
+
"warnings": {
|
|
111
|
+
"type": "array",
|
|
112
|
+
"items": {
|
|
113
|
+
"type": "string",
|
|
114
|
+
"enum": [
|
|
115
|
+
"plan_limit"
|
|
116
|
+
]
|
|
117
|
+
},
|
|
118
|
+
"description": "`plan_limit`: importing the file would take the organization over a limit of its plan, so the import itself would be refused."
|
|
119
|
+
},
|
|
120
|
+
"token": {
|
|
121
|
+
"anyOf": [
|
|
122
|
+
{
|
|
123
|
+
"type": "string",
|
|
124
|
+
"minLength": 1
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"type": "null"
|
|
128
|
+
}
|
|
129
|
+
],
|
|
130
|
+
"description": "Stands for exactly this import: send it as `confirm` to carry it out. Null while the file has errors. It is not single-use; see the note on the import routes."
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
"required": [
|
|
134
|
+
"counts",
|
|
135
|
+
"errors",
|
|
136
|
+
"errors_total",
|
|
137
|
+
"mirror_scope",
|
|
138
|
+
"warnings",
|
|
139
|
+
"token"
|
|
140
|
+
],
|
|
141
|
+
"additionalProperties": false,
|
|
142
|
+
"description": "The preview of an import: what it would do, the problems that stop it and the token that confirms it."
|
|
143
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"properties": {
|
|
5
|
+
"format": {
|
|
6
|
+
"type": "string",
|
|
7
|
+
"enum": [
|
|
8
|
+
"csv",
|
|
9
|
+
"json"
|
|
10
|
+
],
|
|
11
|
+
"description": "`csv`: UTF-8 text with a header row, as in RFC 4180; a `json` field is written as JSON text in its cell. `json`: an array of objects, one per record."
|
|
12
|
+
},
|
|
13
|
+
"content": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"maxLength": 10000000,
|
|
16
|
+
"description": "The file as text, at most 10,000,000 characters and as many bytes of UTF-8, and 50,000 rows (`400 validation_error`, rule `too_large` or `too_many_rows`; the latter is raised as soon as the 50,001st row is read, so it does not say how many there are). A byte order mark at the start of a JSON file is ignored."
|
|
17
|
+
},
|
|
18
|
+
"mapping": {
|
|
19
|
+
"type": "object",
|
|
20
|
+
"propertyNames": {
|
|
21
|
+
"type": "string"
|
|
22
|
+
},
|
|
23
|
+
"additionalProperties": {
|
|
24
|
+
"anyOf": [
|
|
25
|
+
{
|
|
26
|
+
"type": "string",
|
|
27
|
+
"pattern": "^[a-z][a-z0-9_]{0,62}$",
|
|
28
|
+
"description": "A collection key or a field key: `^[a-z][a-z0-9_]{0,62}$`. Keys appear in URLs, filters and record bodies; `label` is the text people read."
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"type": "string",
|
|
32
|
+
"const": ""
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
"description": "The key of the field the column is imported into, the literal `robot`, or an empty string to leave the column out."
|
|
36
|
+
},
|
|
37
|
+
"description": "Where each column of the file goes, by the column name in the header (for JSON, the property name). A column that is not listed is imported into the field with the same key. A column named after a system field (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `revision`, `robot_id`) is left out unless it is mapped."
|
|
38
|
+
},
|
|
39
|
+
"references": {
|
|
40
|
+
"type": "object",
|
|
41
|
+
"propertyNames": {
|
|
42
|
+
"type": "string",
|
|
43
|
+
"pattern": "^[a-z][a-z0-9_]{0,62}$",
|
|
44
|
+
"description": "A collection key or a field key: `^[a-z][a-z0-9_]{0,62}$`. Keys appear in URLs, filters and record bodies; `label` is the text people read."
|
|
45
|
+
},
|
|
46
|
+
"additionalProperties": {
|
|
47
|
+
"type": "string",
|
|
48
|
+
"pattern": "^[a-z][a-z0-9_]{0,62}$",
|
|
49
|
+
"description": "A collection key or a field key: `^[a-z][a-z0-9_]{0,62}$`. Keys appear in URLs, filters and record bodies; `label` is the text people read."
|
|
50
|
+
},
|
|
51
|
+
"description": "For each reference field, by its key: the unique field of the target collection that the values in its column identify, for example `name`. A reference field that is not listed takes record ids."
|
|
52
|
+
},
|
|
53
|
+
"key": {
|
|
54
|
+
"type": "string",
|
|
55
|
+
"pattern": "^[a-z][a-z0-9_]{0,62}$",
|
|
56
|
+
"description": "A unique field that matches rows to existing records: a row whose value is found updates that record, the rest create records. Without a key every row creates a record. A collection with one record per robot is only updated, matched by robot, takes no key and no mirror, and two rows for one robot are an error."
|
|
57
|
+
},
|
|
58
|
+
"mode": {
|
|
59
|
+
"type": "string",
|
|
60
|
+
"enum": [
|
|
61
|
+
"upsert",
|
|
62
|
+
"mirror"
|
|
63
|
+
],
|
|
64
|
+
"description": "`upsert` (the default) creates and updates records. `mirror` also deletes the records of `scope` that are not in the file, and needs `key`. A mirror deletes at most 50,000 records, a file without rows is refused, and a deletion that a `prevent` reference blocks fails the whole import. A collection with one record per robot takes neither a `key` nor a `mirror` (`400 validation_error`, rule `one_per_robot_is_automatic`)."
|
|
65
|
+
},
|
|
66
|
+
"scope": {
|
|
67
|
+
"type": "object",
|
|
68
|
+
"properties": {
|
|
69
|
+
"filter": {
|
|
70
|
+
"type": "object",
|
|
71
|
+
"propertyNames": {
|
|
72
|
+
"type": "string"
|
|
73
|
+
},
|
|
74
|
+
"additionalProperties": {},
|
|
75
|
+
"description": "Only records matching this filter can be deleted. The same filter object that record lists take as JSON text."
|
|
76
|
+
},
|
|
77
|
+
"robot_id": {
|
|
78
|
+
"type": "string",
|
|
79
|
+
"format": "uuid",
|
|
80
|
+
"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)$",
|
|
81
|
+
"description": "Only records of this robot can be deleted."
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
"additionalProperties": false,
|
|
85
|
+
"description": "Limits which records `mirror` may delete: those matching a filter, or those of one robot. Name exactly one of them: an empty `scope` is `400 validation_error` (rule `empty`), and so is a `scope` on an import that is not a `mirror` (rule `needs_mirror`). Without a scope the whole collection is mirrored, every robot's records included. `robot_id` of the request does not narrow a mirror; use `scope.robot_id`."
|
|
86
|
+
},
|
|
87
|
+
"robot_id": {
|
|
88
|
+
"type": "string",
|
|
89
|
+
"format": "uuid",
|
|
90
|
+
"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)$",
|
|
91
|
+
"description": "The robot every row belongs to, in a collection that belongs to robots, when the file has no `robot` column; sent together with a `robot` column it is refused (rule `robot_column_present`). It says which robot the rows are for and does not narrow a `mirror`: that is `scope.robot_id`."
|
|
92
|
+
},
|
|
93
|
+
"confirm": {
|
|
94
|
+
"type": "string",
|
|
95
|
+
"minLength": 1,
|
|
96
|
+
"description": "The `token` of the preview of exactly this import. Without it the import route answers the preview and imports nothing. A token that is not the one of the current preview, because the data moved on or it belongs to another import, is answered `409 confirmation_required` with the current preview in `details.preview`. A file with errors is never imported: its preview comes back with `token: null`, whatever `confirm` says."
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
"required": [
|
|
100
|
+
"format",
|
|
101
|
+
"content"
|
|
102
|
+
],
|
|
103
|
+
"additionalProperties": false,
|
|
104
|
+
"description": "Imports a file of records into a collection, all or nothing."
|
|
105
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"properties": {
|
|
5
|
+
"created": {
|
|
6
|
+
"type": "integer",
|
|
7
|
+
"minimum": 0,
|
|
8
|
+
"maximum": 9007199254740991,
|
|
9
|
+
"description": "Records created."
|
|
10
|
+
},
|
|
11
|
+
"updated": {
|
|
12
|
+
"type": "integer",
|
|
13
|
+
"minimum": 0,
|
|
14
|
+
"maximum": 9007199254740991,
|
|
15
|
+
"description": "Records changed."
|
|
16
|
+
},
|
|
17
|
+
"deleted": {
|
|
18
|
+
"type": "integer",
|
|
19
|
+
"minimum": 0,
|
|
20
|
+
"maximum": 9007199254740991,
|
|
21
|
+
"description": "Records deleted by `mirror`."
|
|
22
|
+
},
|
|
23
|
+
"unchanged": {
|
|
24
|
+
"type": "integer",
|
|
25
|
+
"minimum": 0,
|
|
26
|
+
"maximum": 9007199254740991,
|
|
27
|
+
"description": "Rows that matched a record that already had these values."
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"required": [
|
|
31
|
+
"created",
|
|
32
|
+
"updated",
|
|
33
|
+
"deleted",
|
|
34
|
+
"unchanged"
|
|
35
|
+
],
|
|
36
|
+
"additionalProperties": false,
|
|
37
|
+
"description": "What an import did."
|
|
38
|
+
}
|