sew-proto 0.11.6

Sew wire contracts: ids, addresses, errors, HTTP and gateway bodies, permissions, policies, audit.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
{
  "$defs": {
    "ArchiveOptions": {
      "additionalProperties": false,
      "description": "What an archive holds beyond records.",
      "properties": {
        "audit": {
          "description": "Whether `audit.ndjson` is present.",
          "type": "boolean"
        },
        "files": {
          "$ref": "#/$defs/FileMode",
          "description": "File bytes or metadata only."
        },
        "views": {
          "description": "Whether `view/` (HTML and CSV) is present.",
          "type": "boolean"
        }
      },
      "required": [
        "files",
        "views",
        "audit"
      ],
      "type": "object"
    },
    "ArchiveScope": {
      "additionalProperties": false,
      "description": "An eDiscovery scope as recorded: ids, dates and a keyword count, never the keywords.",
      "properties": {
        "channels": {
          "description": "Channel targets.",
          "items": {
            "description": "A Sew id: a decimal string of a 64-bit time-sortable id (1 to 9223372036854775807).",
            "pattern": "^[1-9][0-9]{0,18}$",
            "type": "string"
          },
          "type": "array"
        },
        "from": {
          "description": "Window start (inclusive) of the request's own selector.",
          "format": "date-time",
          "type": [
            "string",
            "null"
          ]
        },
        "holds": {
          "description": "Legal holds whose selectors joined the scope.",
          "items": {
            "description": "A Sew id: a decimal string of a 64-bit time-sortable id (1 to 9223372036854775807).",
            "pattern": "^[1-9][0-9]{0,18}$",
            "type": "string"
          },
          "type": "array"
        },
        "keyword_count": {
          "description": "How many keywords filtered the scope (the words never leave the request).",
          "format": "uint32",
          "minimum": 0,
          "type": "integer"
        },
        "label": {
          "description": "The requester's label.",
          "type": [
            "string",
            "null"
          ]
        },
        "member_mode": {
          "$ref": "#/$defs/MemberMode",
          "description": "How member targets select."
        },
        "members": {
          "description": "Member targets.",
          "items": {
            "description": "A Sew id: a decimal string of a 64-bit time-sortable id (1 to 9223372036854775807).",
            "pattern": "^[1-9][0-9]{0,18}$",
            "type": "string"
          },
          "type": "array"
        },
        "spaces": {
          "description": "Space targets.",
          "items": {
            "description": "A Sew id: a decimal string of a 64-bit time-sortable id (1 to 9223372036854775807).",
            "pattern": "^[1-9][0-9]{0,18}$",
            "type": "string"
          },
          "type": "array"
        },
        "to": {
          "description": "Window end (exclusive).",
          "format": "date-time",
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "member_mode",
        "keyword_count"
      ],
      "type": "object"
    },
    "ExportError": {
      "description": "Why an export failed or was cancelled (codes and reasons only, never content).",
      "properties": {
        "code": {
          "description": "An error code (`storage_full`, `internal`, `invalid_state`, …).",
          "type": "string"
        },
        "reason": {
          "description": "The reason (`requester_revoked`, `storage_full`, `decrypt_failed`, …).",
          "type": "string"
        }
      },
      "required": [
        "code",
        "reason"
      ],
      "type": "object"
    },
    "ExportKind": {
      "description": "What an archive is.",
      "oneOf": [
        {
          "const": "full",
          "description": "Everything, for a box move (mgmt only).",
          "type": "string"
        },
        {
          "const": "ediscovery",
          "description": "A scoped compliance export.",
          "type": "string"
        }
      ]
    },
    "ExportProgress": {
      "description": "An export's progress, written at most every 2 s while it runs.",
      "properties": {
        "bytes_written": {
          "default": 0,
          "description": "Ciphertext bytes written.",
          "format": "uint64",
          "minimum": 0,
          "type": "integer"
        },
        "channels_done": {
          "default": 0,
          "description": "Channels written.",
          "format": "uint64",
          "minimum": 0,
          "type": "integer"
        },
        "channels_total": {
          "default": 0,
          "description": "Channels to write.",
          "format": "uint64",
          "minimum": 0,
          "type": "integer"
        },
        "files": {
          "default": 0,
          "description": "Files written.",
          "format": "uint64",
          "minimum": 0,
          "type": "integer"
        },
        "messages": {
          "default": 0,
          "description": "Messages written.",
          "format": "uint64",
          "minimum": 0,
          "type": "integer"
        },
        "phase": {
          "description": "The phase (`snapshot`, `entities`, `messages`, `files`, `views`, `audit`, `finish`).",
          "type": [
            "string",
            "null"
          ]
        }
      },
      "type": "object"
    },
    "ExportState": {
      "description": "An export's lifecycle state.",
      "oneOf": [
        {
          "const": "queued",
          "description": "Waiting for the one export slot.",
          "type": "string"
        },
        {
          "const": "running",
          "description": "Being written.",
          "type": "string"
        },
        {
          "const": "done",
          "description": "The archive is ready for download.",
          "type": "string"
        },
        {
          "const": "failed",
          "description": "It failed (`error` says why).",
          "type": "string"
        },
        {
          "const": "cancelled",
          "description": "Cancelled (by a caller, or because the requester lost the flag).",
          "type": "string"
        },
        {
          "const": "expired",
          "description": "The archive passed `export.keep_days` and was deleted.",
          "type": "string"
        },
        {
          "const": "deleted",
          "description": "The archive was deleted by a caller.",
          "type": "string"
        }
      ]
    },
    "FileMode": {
      "description": "Whether file bytes are in the archive.",
      "oneOf": [
        {
          "const": "include",
          "description": "`files/<file_id>` entries hold the plaintext bytes.",
          "type": "string"
        },
        {
          "const": "manifest_only",
          "description": "Attachment records keep metadata only; no `files/` entries.",
          "type": "string"
        }
      ]
    },
    "MemberMode": {
      "description": "How a member target selects messages in eDiscovery.",
      "oneOf": [
        {
          "const": "conversations",
          "description": "Everything the member wrote or could read (the legal-hold member rule).",
          "type": "string"
        },
        {
          "const": "authored",
          "description": "Only what the member wrote.",
          "type": "string"
        }
      ]
    },
    "RequestedVia": {
      "description": "Who requested an export.",
      "oneOf": [
        {
          "const": "member",
          "description": "A compliance-flag holder through the client API.",
          "type": "string"
        },
        {
          "const": "service",
          "description": "The mgmt service (K2's daemon, the `sew` CLI).",
          "type": "string"
        }
      ]
    }
  },
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "description": "An export (full or eDiscovery). `id` is also its job id.",
  "properties": {
    "archive_bytes": {
      "description": "The archive's size, once done.",
      "format": "uint64",
      "minimum": 0,
      "type": [
        "integer",
        "null"
      ]
    },
    "archive_sha256": {
      "description": "SHA-256 of the archive file (ciphertext), 64 hex.",
      "type": [
        "string",
        "null"
      ]
    },
    "counts": {
      "additionalProperties": {
        "format": "uint64",
        "minimum": 0,
        "type": "integer"
      },
      "description": "Records per entity.",
      "type": [
        "object",
        "null"
      ]
    },
    "created_at": {
      "description": "Requested.",
      "format": "date-time",
      "type": "string"
    },
    "error": {
      "anyOf": [
        {
          "$ref": "#/$defs/ExportError"
        },
        {
          "type": "null"
        }
      ],
      "description": "Why it failed or was cancelled."
    },
    "expires_at": {
      "description": "When the archive is deleted.",
      "format": "date-time",
      "type": [
        "string",
        "null"
      ]
    },
    "finished_at": {
      "description": "Finished.",
      "format": "date-time",
      "type": [
        "string",
        "null"
      ]
    },
    "id": {
      "description": "The export id (= the `export` job id).",
      "pattern": "^[1-9][0-9]{0,18}$",
      "type": "string"
    },
    "kind": {
      "$ref": "#/$defs/ExportKind",
      "description": "Full or eDiscovery."
    },
    "label": {
      "description": "The requester's label.",
      "type": [
        "string",
        "null"
      ]
    },
    "options": {
      "$ref": "#/$defs/ArchiveOptions",
      "description": "Files, views, audit."
    },
    "progress": {
      "$ref": "#/$defs/ExportProgress",
      "description": "Progress."
    },
    "recipients": {
      "description": "The age recipients (request plus operator escrow recipients).",
      "items": {
        "type": "string"
      },
      "type": "array"
    },
    "requested_by": {
      "description": "The requesting member (absent for the mgmt service).",
      "pattern": "^[1-9][0-9]{0,18}$",
      "type": [
        "string",
        "null"
      ]
    },
    "requested_via": {
      "$ref": "#/$defs/RequestedVia",
      "description": "Member or service."
    },
    "root_hash": {
      "description": "The trailer's root hash, 64 hex.",
      "type": [
        "string",
        "null"
      ]
    },
    "scope": {
      "anyOf": [
        {
          "$ref": "#/$defs/ArchiveScope"
        },
        {
          "type": "null"
        }
      ],
      "description": "The eDiscovery scope (ids, dates, keyword count)."
    },
    "started_at": {
      "description": "Started.",
      "format": "date-time",
      "type": [
        "string",
        "null"
      ]
    },
    "state": {
      "$ref": "#/$defs/ExportState",
      "description": "State."
    }
  },
  "required": [
    "id",
    "kind",
    "state",
    "requested_via",
    "options",
    "recipients",
    "progress",
    "created_at"
  ],
  "title": "Export",
  "type": "object"
}