@larc-iu/plaid-client 0.2.0-alpha.3 → 0.2.0-alpha.32

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 (73) hide show
  1. package/README.md +39 -0
  2. package/package.json +13 -6
  3. package/src/apiAnnotations.d.ts +508 -0
  4. package/src/apiAnnotations.js +543 -0
  5. package/src/apiDocuments.d.ts +569 -0
  6. package/src/apiDocuments.js +551 -0
  7. package/src/apiLayers.d.ts +369 -0
  8. package/src/apiLayers.js +222 -0
  9. package/src/apiMessages.d.ts +293 -0
  10. package/src/apiMessages.js +265 -0
  11. package/src/apiPeople.d.ts +626 -0
  12. package/src/apiPeople.js +698 -0
  13. package/src/apiProject.d.ts +761 -0
  14. package/src/apiProject.js +774 -0
  15. package/src/apiServer.d.ts +457 -0
  16. package/src/apiServer.js +424 -0
  17. package/src/apiVocab.d.ts +456 -0
  18. package/src/apiVocab.js +425 -0
  19. package/src/batch.d.ts +54 -0
  20. package/src/batch.js +323 -0
  21. package/src/batchRef.d.ts +30 -0
  22. package/src/batchRef.js +128 -0
  23. package/src/client.d.ts +1321 -0
  24. package/src/client.js +743 -0
  25. package/src/codepoint.d.ts +94 -0
  26. package/src/codepoint.js +131 -1
  27. package/src/constraints.d.ts +85 -0
  28. package/src/constraints.js +112 -0
  29. package/src/created.d.ts +2 -0
  30. package/src/created.js +29 -0
  31. package/src/documentLock.d.ts +172 -0
  32. package/src/documentLock.js +384 -0
  33. package/src/entryForms.d.ts +68 -0
  34. package/src/entryForms.js +164 -0
  35. package/src/events.d.ts +60 -0
  36. package/src/events.js +271 -0
  37. package/src/families.d.ts +349 -0
  38. package/src/families.js +396 -0
  39. package/src/http.d.ts +233 -0
  40. package/src/http.js +809 -93
  41. package/src/ids.d.ts +26 -0
  42. package/src/ids.js +96 -0
  43. package/src/index.d.ts +101 -0
  44. package/src/index.js +183 -2105
  45. package/src/metadataOps.d.ts +15 -0
  46. package/src/metadataOps.js +124 -0
  47. package/src/operations.d.ts +36 -0
  48. package/src/operations.js +164 -0
  49. package/src/pagination.d.ts +49 -0
  50. package/src/pagination.js +20 -53
  51. package/src/provenance.d.ts +243 -0
  52. package/src/provenance.js +458 -36
  53. package/src/replayed.d.ts +3 -0
  54. package/src/replayed.js +31 -0
  55. package/src/requester.d.ts +60 -0
  56. package/src/requester.js +74 -0
  57. package/src/roles.d.ts +104 -0
  58. package/src/roles.js +64 -2
  59. package/src/serviceSchema.d.ts +337 -0
  60. package/src/serviceSchema.js +177 -60
  61. package/src/services.d.ts +319 -0
  62. package/src/services.js +742 -58
  63. package/src/sse.d.ts +30 -0
  64. package/src/sse.js +80 -3
  65. package/src/testing.d.ts +128 -0
  66. package/src/testing.js +379 -0
  67. package/src/textEdits.d.ts +59 -0
  68. package/src/textEdits.js +234 -0
  69. package/src/transforms.d.ts +25 -0
  70. package/src/transforms.js +11 -1
  71. package/src/types.d.ts +867 -0
  72. package/src/types.js +663 -0
  73. package/index.d.ts +0 -532
package/src/types.d.ts ADDED
@@ -0,0 +1,867 @@
1
+ export type TextEditOp = import("./textEdits.js").TextEditOp;
2
+ export type TextGap = import("./textEdits.js").TextGap;
3
+ export type MetadataOp = import("./metadataOps.js").MetadataOp;
4
+ export type LayerConstraint = import("./constraints.js").LayerConstraint;
5
+ export type ConstraintWriteOptions = import("./constraints.js").ConstraintWriteOptions;
6
+ export type ConstraintViolation = import("./constraints.js").ConstraintViolation;
7
+ export type Requester = import("./requester.js").Requester;
8
+ export type BatchRef = import("./batchRef.js").BatchRef;
9
+ export type ServiceParam = import("./serviceSchema.js").ServiceParam;
10
+ export type ServiceInfo = import("./serviceSchema.js").ServiceInfo;
11
+ export type DiscoveredService = import("./serviceSchema.js").DiscoveredService;
12
+ export type ResponseHelper = import("./services.js").ResponseHelper;
13
+ export type ServiceRegistration = import("./services.js").ServiceRegistration;
14
+ export type ServiceStatusEvent = import("./services.js").ServiceStatusEvent;
15
+ export type OperationGroupsBundle = import("./client.js").PlaidClient["operationGroups"];
16
+ /**
17
+ * A single page of a cursor-paginated collection.
18
+ */
19
+ export type Page<T = any> = {
20
+ entries: T[];
21
+ nextCursor: string | null;
22
+ };
23
+ /**
24
+ * Client options.
25
+ */
26
+ export type PlaidClientOptions = {
27
+ /**
28
+ * Per-request timeout in ms (default
29
+ * 30000, 0 or null disables it).
30
+ */
31
+ timeout?: number | null;
32
+ /**
33
+ * Timeout for batch submissions in
34
+ * ms (default 180000, 0 or null disables it). Aborting a batch does NOT
35
+ * stop the server, which keeps running the transaction and holding the
36
+ * write lock. Defaults to `timeout` when that is given and this is not.
37
+ */
38
+ batchTimeout?: number | null;
39
+ /**
40
+ * Delays in ms before sending a keyed
41
+ * write again when its answer was lost (no response, 502 or 504). Default
42
+ * [1000, 3000, 9000].
43
+ */
44
+ retryDelaysMs?: number[];
45
+ /**
46
+ * Fired once when
47
+ * a request returns HTTP 401 (missing, expired or invalid token). 403 does
48
+ * NOT trigger it.
49
+ */
50
+ onAuthError?: ((error: Error) => void) | null;
51
+ };
52
+ /**
53
+ * What kind of operation a logical-operation group is (`?group-kind=`).
54
+ */
55
+ export type OperationKind = "assistant-plan" | "service-run" | "import" | "bulk-edit" | "guess-adoption" | "repair" | "review";
56
+ /**
57
+ * Idempotency-Key seed for an operation run more than once (`client.keySeed()`).
58
+ */
59
+ export type KeySeed = {
60
+ seed: string;
61
+ stamps: Map<number, number | null>;
62
+ };
63
+ /**
64
+ * A batch: the client's bundles, on which every write of project data queues
65
+ * until `submit()`. See `PlaidClient.batch()`. `submit()` resolves to one
66
+ * result per operation, in order. `ref(opIndex, index)` stands for the id a
67
+ * queued operation will create, in the body of a later write on this batch.
68
+ */
69
+ export type PlaidBatch = import("./client.js").PlaidClient & {
70
+ readonly client: import("./client.js").PlaidClient;
71
+ readonly operations: Array<{
72
+ path: string;
73
+ method: string;
74
+ body?: any;
75
+ }>;
76
+ submit(): Promise<any[]>;
77
+ abort(): void;
78
+ ref(opIndex?: number, index?: number): BatchRef;
79
+ };
80
+ /**
81
+ * Options for a single page of any audit log. `kinds` keeps only the entries
82
+ * of operations of these kinds, each whole. `order: "desc"` pages newest
83
+ * first, and a cursor belongs to the direction that made it. `opsLimit` keeps
84
+ * only each entry's oldest N operations in `ops` (1..1000), and every entry
85
+ * has `opCount`. `entryId` reads only that entry rather than a page.
86
+ */
87
+ export type AuditPageOptions = {
88
+ startTime?: string;
89
+ endTime?: string;
90
+ opTypes?: string[] | string;
91
+ kinds?: OperationKind[] | string;
92
+ order?: "asc" | "desc";
93
+ limit?: number;
94
+ cursor?: string;
95
+ opsLimit?: number;
96
+ entryId?: string;
97
+ };
98
+ /**
99
+ * What `vocabLayers.restoreItem` did, or with `dryRun` would do.
100
+ */
101
+ export type VocabItemRestoreSummary = {
102
+ /**
103
+ * The entry was gone and came back under its old id.
104
+ */
105
+ inserted: boolean;
106
+ /**
107
+ * A living entry's form was set back.
108
+ */
109
+ form: boolean;
110
+ /**
111
+ * A living entry's fields were set back.
112
+ */
113
+ metadata: boolean;
114
+ /**
115
+ * 0 when nothing changes.
116
+ */
117
+ total: number;
118
+ };
119
+ /**
120
+ * One private data entry. `version` is raised by one on every write of the
121
+ * entry, and a new entry is 1.
122
+ */
123
+ export type UserDataEntry = {
124
+ key: string;
125
+ updatedAt: string;
126
+ version: number;
127
+ value?: any;
128
+ };
129
+ export type AdminUserDataEntry = UserDataEntry & {
130
+ userId: string;
131
+ };
132
+ /**
133
+ * One user's activity over a scope and window (`audit.tally`).
134
+ */
135
+ export type ActivityTallyRow = {
136
+ user: {
137
+ id: string;
138
+ displayName?: string;
139
+ };
140
+ operations: number;
141
+ changes: number;
142
+ documents: number;
143
+ firstTs: string;
144
+ lastTs: string;
145
+ byDay?: Array<{
146
+ date: string;
147
+ changes: number;
148
+ }>;
149
+ };
150
+ /**
151
+ * What a constraint repair did in one document.
152
+ */
153
+ export type ConstraintRepair = {
154
+ document: string;
155
+ constraint: string;
156
+ deleted: number;
157
+ joined: number;
158
+ };
159
+ /**
160
+ * A value-set rule as `refusedValues` takes it: the list, the characters a
161
+ * value is split on, and whether every part (`"all"`, the default) or only
162
+ * the first must be listed.
163
+ */
164
+ export type ValueSetRule = {
165
+ values: string[];
166
+ delimiters?: string;
167
+ parts?: "all" | "first";
168
+ };
169
+ /**
170
+ * What a value-set rule would refuse in a layer's stored values: how many,
171
+ * how many distinct, and the most frequent with the parts not listed.
172
+ */
173
+ export type RefusedValues = {
174
+ count: number;
175
+ valueCount: number;
176
+ values: Array<{
177
+ value: any;
178
+ parts: string[];
179
+ count: number;
180
+ }>;
181
+ };
182
+ /**
183
+ * Entities that can carry a comment.
184
+ */
185
+ export type CommentableType = "document" | "text" | "token" | "span" | "relation" | "vocab-item";
186
+ /**
187
+ * One comment. `projectId` and `documentId` are null for a comment on a
188
+ * vocabulary entry, and `vocabLayerId` is set only for one. `anchorLabel` is
189
+ * what the comment is about, in words, captured when it was posted: a
190
+ * comment outlives its anchor. `edited` is true once the body has been
191
+ * rewritten since it was posted.
192
+ */
193
+ export type Comment = {
194
+ id: string;
195
+ projectId: string | null;
196
+ documentId: string | null;
197
+ vocabLayerId: string | null;
198
+ entityType: CommentableType;
199
+ entityId: string;
200
+ anchorLabel: string | null;
201
+ authorId: string;
202
+ body: string;
203
+ createdAt: string;
204
+ updatedAt: string;
205
+ edited: boolean;
206
+ };
207
+ /**
208
+ * One entry in a project's annotation manual. `body` is present on a single
209
+ * read and on a list made with `includeBodies`, `bodyChars` on a list made
210
+ * without. `pinned`: the assistant is given this one in full on every turn.
211
+ */
212
+ export type Guideline = {
213
+ id: string;
214
+ projectId: string;
215
+ title: string;
216
+ body?: string;
217
+ bodyChars?: number;
218
+ pinned: boolean;
219
+ createdAt: string;
220
+ updatedAt: string;
221
+ };
222
+ /**
223
+ * A research-telemetry event type.
224
+ */
225
+ export type ClientEventType = "suggestion.shown" | "suggestion.adopted" | "suggestion.dismissed" | "plan.opened";
226
+ /**
227
+ * One research-telemetry event as the server stores it.
228
+ */
229
+ export type ClientEvent = {
230
+ id: number;
231
+ projectId: string;
232
+ documentId: string | null;
233
+ userId: string;
234
+ type: ClientEventType;
235
+ targetId: string | null;
236
+ data: Record<string, any> | null;
237
+ clientTs: string | null;
238
+ ts: string;
239
+ };
240
+ /**
241
+ * An invite. `kind` is "signup" or "password-reset", `status` "active",
242
+ * "used", "expired", "revoked" or "inactive".
243
+ */
244
+ export type Invite = {
245
+ id: string;
246
+ kind: string;
247
+ status: string;
248
+ createdBy: string;
249
+ createdAt: string;
250
+ expiresAt: string;
251
+ maxUses: number;
252
+ uses: number;
253
+ revokedAt: string | null;
254
+ note: string | null;
255
+ targetUserId: string | null;
256
+ grantAdmin: boolean;
257
+ projectId: string | null;
258
+ projectRole: string | null;
259
+ };
260
+ /**
261
+ * Server limits, as reported by /api/v1/info. An unset limit is absent.
262
+ * `passwordMinLength` is the shortest password the server accepts on any
263
+ * path, `lockExpirationMs` how long a document lock is held before it lapses.
264
+ * `queryBranches` is the most branches a query's `or` and `seq` may expand
265
+ * to, `queryClauseDepth` the deepest its clauses may nest.
266
+ */
267
+ export type ServerLimits = {
268
+ mediaFileBytes?: number;
269
+ jsonBodyBytes?: number;
270
+ batchOperations?: number;
271
+ metadataDepth?: number;
272
+ metadataKeyCount?: number;
273
+ metadataStringLength?: number;
274
+ metadataTotalBytes?: number;
275
+ userDataValueBytes?: number;
276
+ guidelineTitleLength?: number;
277
+ guidelineBodyLength?: number;
278
+ commentBodyLength?: number;
279
+ passwordMinLength?: number;
280
+ lockExpirationMs?: number;
281
+ queryBranches?: number;
282
+ queryClauseDepth?: number;
283
+ };
284
+ export type ServerHealth = {
285
+ ok: boolean;
286
+ version: string;
287
+ uptimeMs: number;
288
+ audit: {
289
+ dbSizeMb?: number;
290
+ auditRows?: number;
291
+ error?: string;
292
+ };
293
+ };
294
+ export type RateLimitBucket = {
295
+ ip: string;
296
+ userId?: string;
297
+ failures: number;
298
+ limit: number;
299
+ blocked: boolean;
300
+ };
301
+ export type RateLimitSnapshot = {
302
+ windowMs: number;
303
+ logins: RateLimitBucket[];
304
+ ips: RateLimitBucket[];
305
+ invites: RateLimitBucket[];
306
+ };
307
+ export type BackupStatus = {
308
+ enabled: boolean;
309
+ directory: string;
310
+ retention: number;
311
+ time: string;
312
+ backups: Array<{
313
+ name: string;
314
+ bytes: number;
315
+ modified: string;
316
+ }>;
317
+ ok?: boolean;
318
+ };
319
+ export type ServerReport = {
320
+ version: string;
321
+ jvm: {
322
+ uptimeMs: number;
323
+ startedAt: string;
324
+ java: string;
325
+ heapUsed: number;
326
+ heapMax: number;
327
+ };
328
+ database: {
329
+ path: string | null;
330
+ bytes: number | null;
331
+ walBytes: number | null;
332
+ slowQueryThresholdMs?: number;
333
+ journalMode?: string;
334
+ maxPoolSize?: number;
335
+ tables: Record<string, number | null>;
336
+ };
337
+ media: {
338
+ directory: string;
339
+ files: number;
340
+ bytes: number;
341
+ orphans: number;
342
+ orphanBytes: number;
343
+ };
344
+ backup: BackupStatus;
345
+ settings: Record<string, any>;
346
+ };
347
+ /**
348
+ * The live log. Requests and events are buffered separately, so a burst of
349
+ * requests cannot evict an error. In each, `matched` is how many passed the
350
+ * filters (which may exceed what `entries` holds) and `held` how many are
351
+ * buffered in total. `file` is the configured log file's absolute path, or
352
+ * null when logging to stdout.
353
+ */
354
+ export type LiveLog = {
355
+ requests: {
356
+ entries: object[];
357
+ matched: number;
358
+ held: number;
359
+ capacity: number;
360
+ stats: Record<string, number | null>;
361
+ };
362
+ events: {
363
+ entries: object[];
364
+ matched: number;
365
+ held: number;
366
+ capacity: number;
367
+ byLevel: Record<string, number>;
368
+ };
369
+ file: string | null;
370
+ };
371
+ /**
372
+ * An open server-sent-events stream. Once CLOSED, `error` says why: null when
373
+ * this side closed it. A refused stream's error carries the HTTP `status`,
374
+ * and one the server ended is named "StreamClosed".
375
+ */
376
+ export type SSEConnection = {
377
+ close: () => void;
378
+ getStats: () => SSEStats;
379
+ readyState: number;
380
+ error: (Error & {
381
+ status?: number;
382
+ }) | null;
383
+ };
384
+ /**
385
+ * How an SSE connection has fared so far. `events` counts what arrived by
386
+ * event type ("audit-log", "message", "heartbeat", "connected", "other").
387
+ */
388
+ export type SSEStats = {
389
+ durationSeconds: number;
390
+ isConnected: boolean;
391
+ isClosed: boolean;
392
+ clientId: string | null;
393
+ events: Record<string, number>;
394
+ readyState: number;
395
+ };
396
+ /**
397
+ * A value a span or relation holds: a JSON scalar.
398
+ */
399
+ export type AtomicValue = string | number | boolean | null;
400
+ /**
401
+ * What a create answers: the new record's id.
402
+ */
403
+ export type Created = {
404
+ id: string;
405
+ };
406
+ /**
407
+ * A project. `textLayers` nests its layers in their display order, each
408
+ * with the layers built on it, and `vocabs` lists the vocabularies linked to
409
+ * it.
410
+ */
411
+ export type Project = {
412
+ id: string;
413
+ name: string;
414
+ config: Record<string, any>;
415
+ readers: string[];
416
+ writers: string[];
417
+ maintainers: string[];
418
+ textLayers: ProjectTextLayer[];
419
+ vocabs: ProjectVocab[];
420
+ };
421
+ export type ProjectTextLayer = {
422
+ id: string;
423
+ name: string;
424
+ config: Record<string, any>;
425
+ tokenLayers: ProjectTokenLayer[];
426
+ };
427
+ export type ProjectTokenLayer = {
428
+ id: string;
429
+ name: string;
430
+ config: Record<string, any>;
431
+ constraints: Record<string, LayerConstraint[]>;
432
+ spanLayers: ProjectSpanLayer[];
433
+ };
434
+ export type ProjectSpanLayer = {
435
+ id: string;
436
+ name: string;
437
+ config: Record<string, any>;
438
+ constraints: Record<string, LayerConstraint[]>;
439
+ relationLayers: ProjectRelationLayer[];
440
+ };
441
+ export type ProjectRelationLayer = {
442
+ id: string;
443
+ name: string;
444
+ config: Record<string, any>;
445
+ constraints: Record<string, LayerConstraint[]>;
446
+ };
447
+ export type ProjectVocab = {
448
+ id: string;
449
+ name: string;
450
+ maintainers: string[];
451
+ config: Record<string, any>;
452
+ };
453
+ /**
454
+ * A document. `version` rises by one on every write to it or its layers.
455
+ * A read with `includeBody` also carries `textLayers`, the document's
456
+ * annotation nested under each layer.
457
+ */
458
+ export type PlaidDocument = {
459
+ id: string;
460
+ name: string;
461
+ project: string;
462
+ version: number;
463
+ timeCreated: string;
464
+ timeModified: string;
465
+ metadata?: Record<string, any>;
466
+ textLayers?: DocumentTextLayer[];
467
+ };
468
+ /**
469
+ * A text layer as a document read nests it: `text` is null where the
470
+ * document has no text in this layer.
471
+ */
472
+ export type DocumentTextLayer = {
473
+ id: string;
474
+ name: string;
475
+ config: Record<string, any>;
476
+ text: {
477
+ id: string;
478
+ document: string;
479
+ body: string;
480
+ digest: string;
481
+ metadata?: Record<string, any>;
482
+ } | null;
483
+ tokenLayers: DocumentTokenLayer[];
484
+ };
485
+ export type DocumentTokenLayer = {
486
+ id: string;
487
+ name: string;
488
+ config: Record<string, any>;
489
+ constraints: Record<string, LayerConstraint[]>;
490
+ overlapMode: string;
491
+ parentTokenLayer: string | null;
492
+ tokens: Array<{
493
+ id: string;
494
+ begin: number;
495
+ end: number;
496
+ precedence: number | null;
497
+ metadata?: Record<string, any>;
498
+ }>;
499
+ spanLayers: DocumentSpanLayer[];
500
+ vocabs: Array<ProjectVocab & {
501
+ vocabLinks: Array<{
502
+ id: string;
503
+ vocabItem: VocabItem;
504
+ tokens: string[];
505
+ metadata?: Record<string, any>;
506
+ }>;
507
+ }>;
508
+ };
509
+ export type DocumentSpanLayer = {
510
+ id: string;
511
+ name: string;
512
+ config: Record<string, any>;
513
+ constraints: Record<string, LayerConstraint[]>;
514
+ spans: Array<{
515
+ id: string;
516
+ value: AtomicValue;
517
+ tokens: string[];
518
+ metadata?: Record<string, any>;
519
+ }>;
520
+ relationLayers: Array<ProjectRelationLayer & {
521
+ relations: Array<{
522
+ id: string;
523
+ source: string;
524
+ target: string;
525
+ value: AtomicValue;
526
+ metadata?: Record<string, any>;
527
+ }>;
528
+ }>;
529
+ };
530
+ /**
531
+ * A text: one document's body in one text layer. `digest` names the body,
532
+ * as an edit's `base`.
533
+ */
534
+ export type PlaidText = {
535
+ id: string;
536
+ body: string;
537
+ document: string;
538
+ layer: string;
539
+ digest: string;
540
+ metadata?: Record<string, any>;
541
+ };
542
+ /**
543
+ * What a text write changed besides the body: the tokens whose extent
544
+ * moved (with `layer` and `text` on one the write made), the spans and
545
+ * vocabulary links whose tokens or value changed, and the ids of what it
546
+ * deleted.
547
+ */
548
+ export type TextReshape = {
549
+ tokens: Array<{
550
+ id: string;
551
+ begin: number;
552
+ end: number;
553
+ layer?: string;
554
+ text?: string;
555
+ }>;
556
+ spans: Array<{
557
+ id: string;
558
+ tokens?: string[];
559
+ value?: AtomicValue;
560
+ }>;
561
+ vocabLinks: Array<{
562
+ id: string;
563
+ tokens: string[];
564
+ }>;
565
+ deleted: {
566
+ tokens: string[];
567
+ spans: string[];
568
+ relations: string[];
569
+ vocabLinks: string[];
570
+ };
571
+ };
572
+ /**
573
+ * A token. `value` is the text it covers.
574
+ */
575
+ export type Token = {
576
+ id: string;
577
+ text: string;
578
+ begin: number;
579
+ end: number;
580
+ layer: string;
581
+ document: string;
582
+ precedence: number | null;
583
+ value: string;
584
+ metadata?: Record<string, any>;
585
+ };
586
+ export type Span = {
587
+ id: string;
588
+ layer: string;
589
+ document: string;
590
+ value: AtomicValue;
591
+ tokens: string[];
592
+ metadata?: Record<string, any>;
593
+ };
594
+ /**
595
+ * A relation, from the span `source` to the span `target`.
596
+ */
597
+ export type Relation = {
598
+ id: string;
599
+ layer: string;
600
+ document: string;
601
+ source: string;
602
+ target: string;
603
+ value: AtomicValue;
604
+ metadata?: Record<string, any>;
605
+ };
606
+ export type VocabItem = {
607
+ id: string;
608
+ layer: string;
609
+ form: string;
610
+ metadata?: Record<string, any>;
611
+ };
612
+ /**
613
+ * A link from a vocabulary entry to the tokens of one occurrence.
614
+ */
615
+ export type VocabLink = {
616
+ id: string;
617
+ vocabItem: string;
618
+ document: string;
619
+ tokens: string[];
620
+ metadata?: Record<string, any>;
621
+ };
622
+ /**
623
+ * A vocabulary. `items` is there on a read made with `includeItems`.
624
+ */
625
+ export type VocabLayer = {
626
+ id: string;
627
+ name: string;
628
+ timeCreated: string;
629
+ timeModified: string;
630
+ config: Record<string, any>;
631
+ maintainers: string[];
632
+ items?: VocabItem[];
633
+ };
634
+ export type TextLayer = {
635
+ id: string;
636
+ name: string;
637
+ project: string;
638
+ config: Record<string, any>;
639
+ };
640
+ export type TokenLayer = {
641
+ id: string;
642
+ name: string;
643
+ textLayer: string;
644
+ project: string;
645
+ overlapMode: string;
646
+ parentTokenLayer: string | null;
647
+ config: Record<string, any>;
648
+ constraints: Record<string, LayerConstraint[]>;
649
+ };
650
+ export type SpanLayer = {
651
+ id: string;
652
+ name: string;
653
+ tokenLayer: string;
654
+ project: string;
655
+ config: Record<string, any>;
656
+ constraints: Record<string, LayerConstraint[]>;
657
+ };
658
+ export type RelationLayer = {
659
+ id: string;
660
+ name: string;
661
+ spanLayer: string;
662
+ project: string;
663
+ config: Record<string, any>;
664
+ constraints: Record<string, LayerConstraint[]>;
665
+ };
666
+ /**
667
+ * The records with metadata, by the path segment of their routes.
668
+ */
669
+ export type MetadataRecords = {
670
+ documents: PlaidDocument;
671
+ texts: PlaidText;
672
+ tokens: Token;
673
+ spans: Span;
674
+ relations: Relation;
675
+ "vocab-items": VocabItem;
676
+ "vocab-links": VocabLink;
677
+ };
678
+ /**
679
+ * The four layer kinds, by the path segment of their routes.
680
+ */
681
+ export type LayerRecords = {
682
+ "text-layers": TextLayer;
683
+ "token-layers": TokenLayer;
684
+ "span-layers": SpanLayer;
685
+ "relation-layers": RelationLayer;
686
+ };
687
+ export type User = {
688
+ id: string;
689
+ displayName: string;
690
+ isAdmin: boolean;
691
+ deactivatedAt: string | null;
692
+ avatarHash: string | null;
693
+ };
694
+ /**
695
+ * A project as the project list gives it: the project, with how many
696
+ * documents it has and when the newest of them last changed.
697
+ */
698
+ export type ProjectListEntry = Project & {
699
+ documentCount: number;
700
+ lastModified: string | null;
701
+ };
702
+ /**
703
+ * A document as a project's document list gives it.
704
+ */
705
+ export type DocumentListEntry = {
706
+ id: string;
707
+ name: string;
708
+ version: number;
709
+ timeCreated: string;
710
+ timeModified: string;
711
+ };
712
+ /**
713
+ * A named API token, without the signed token itself, which only `create`
714
+ * returns.
715
+ */
716
+ export type ApiToken = {
717
+ id: string;
718
+ userId: string;
719
+ name: string;
720
+ createdAt: string;
721
+ lastUsedAt: string | null;
722
+ revokedAt: string | null;
723
+ };
724
+ /**
725
+ * Who made an operation, as the audit log names them.
726
+ */
727
+ export type AuditUser = {
728
+ id: string;
729
+ displayName: string;
730
+ avatarHash: string | null;
731
+ };
732
+ /**
733
+ * A project or a document an audit entry names, while it exists.
734
+ */
735
+ export type AuditTarget = {
736
+ id: string;
737
+ name: string;
738
+ };
739
+ /**
740
+ * One operation of an audit entry.
741
+ */
742
+ export type AuditOp = {
743
+ id: string;
744
+ /**
745
+ * The kind of write, such as "document/update".
746
+ */
747
+ type: string;
748
+ description: string;
749
+ time: string;
750
+ /**
751
+ * The time to read at to see the operation done.
752
+ */
753
+ endTime: string;
754
+ user: AuditUser | null;
755
+ credential?: string;
756
+ project?: AuditTarget;
757
+ document?: AuditTarget;
758
+ batchId?: string;
759
+ };
760
+ /**
761
+ * One entry of an audit log: a logical operation, an atomic batch or a lone
762
+ * write, with its operations oldest first (`ops`, cut to `opsLimit` when one
763
+ * was asked for, while `opCount` counts them all).
764
+ */
765
+ export type AuditEntry = {
766
+ id: string;
767
+ time: string;
768
+ endTime: string;
769
+ user: AuditUser | null;
770
+ projects: AuditTarget[];
771
+ documents: AuditTarget[];
772
+ ops: AuditOp[];
773
+ opCount: number;
774
+ groupId?: string;
775
+ message?: string;
776
+ kind?: OperationKind;
777
+ ref?: string;
778
+ batchId?: string;
779
+ apiToken?: {
780
+ id: string;
781
+ name: string;
782
+ };
783
+ credential?: string;
784
+ };
785
+ /**
786
+ * A document lock as its holder sees it. `expiresAt` is in epoch
787
+ * milliseconds.
788
+ */
789
+ export type LockGrant = {
790
+ lockId: string;
791
+ userId: string;
792
+ expiresAt: number;
793
+ };
794
+ /**
795
+ * What `documents.restore` did, or with `dryRun` would do: per kind of
796
+ * record, how many come back, are set back and are removed (per layer for
797
+ * the layered kinds), and what could not come back, with why.
798
+ */
799
+ export type DocumentRestoreSummary = {
800
+ name: boolean;
801
+ documentMetadata: boolean;
802
+ texts: RestoreCounts;
803
+ tokens: RestoreCounts & {
804
+ byLayer: Array<RestoreCounts & {
805
+ layerId: string;
806
+ }>;
807
+ };
808
+ spans: RestoreCounts & {
809
+ byLayer: Array<RestoreCounts & {
810
+ layerId: string;
811
+ }>;
812
+ };
813
+ relations: RestoreCounts & {
814
+ byLayer: Array<RestoreCounts & {
815
+ layerId: string;
816
+ }>;
817
+ };
818
+ vocabLinks: RestoreCounts;
819
+ skipped: Array<{
820
+ kind: string;
821
+ count: number;
822
+ reason: string;
823
+ }>;
824
+ /**
825
+ * When the name the
826
+ * document had then belongs to another document now: the name it keeps,
827
+ * and that other document's name.
828
+ */
829
+ nameKept?: {
830
+ name: string;
831
+ taken: string;
832
+ };
833
+ /**
834
+ * 0 when nothing changes.
835
+ */
836
+ total: number;
837
+ };
838
+ export type RestoreCounts = {
839
+ inserted: number;
840
+ updated: number;
841
+ deleted: number;
842
+ };
843
+ /**
844
+ * A logical-operation group: its label, who made it and when, and the kind
845
+ * and reference of the operation when it has them.
846
+ */
847
+ export type OperationGroup = {
848
+ id: string;
849
+ message: string | null;
850
+ user: string;
851
+ createdAt: string;
852
+ kind?: string;
853
+ ref?: string;
854
+ };
855
+ /**
856
+ * A query's answer. For "ids" and "entities", one row of `results` per
857
+ * match, a cell per `columns` entry: an id, or the entity as its GET
858
+ * answers it. For "count", only the count. `truncated`: the rows or the
859
+ * count stopped at the server's cap.
860
+ */
861
+ export type QueryResult = {
862
+ return: string;
863
+ count: number;
864
+ truncated: boolean;
865
+ columns?: string[];
866
+ results?: any[][];
867
+ };