@larc-iu/plaid-client 0.2.0-alpha.29 → 0.2.0-alpha.30
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/package.json +3 -2
- package/src/apiAnnotations.d.ts +508 -0
- package/src/apiAnnotations.js +543 -0
- package/src/apiDocuments.d.ts +569 -0
- package/src/apiDocuments.js +551 -0
- package/src/apiLayers.d.ts +369 -0
- package/src/apiLayers.js +222 -0
- package/src/apiMessages.d.ts +293 -0
- package/src/apiMessages.js +265 -0
- package/src/apiPeople.d.ts +626 -0
- package/src/apiPeople.js +698 -0
- package/src/apiProject.d.ts +761 -0
- package/src/apiProject.js +774 -0
- package/src/apiServer.d.ts +455 -0
- package/src/apiServer.js +422 -0
- package/src/apiVocab.d.ts +456 -0
- package/src/apiVocab.js +425 -0
- package/src/batch.d.ts +54 -0
- package/src/batch.js +323 -0
- package/src/client.d.ts +1321 -0
- package/src/client.js +743 -0
- package/src/constraints.d.ts +8 -0
- package/src/constraints.js +14 -0
- package/src/documentLock.d.ts +18 -4
- package/src/documentLock.js +43 -9
- package/src/entryForms.d.ts +63 -0
- package/src/entryForms.js +152 -0
- package/src/events.js +2 -1
- package/src/families.d.ts +349 -0
- package/src/families.js +396 -0
- package/src/http.d.ts +39 -18
- package/src/http.js +127 -87
- package/src/index.d.ts +90 -4557
- package/src/index.js +113 -5172
- package/src/operations.d.ts +36 -0
- package/src/operations.js +164 -0
- package/src/provenance.d.ts +47 -4
- package/src/provenance.js +168 -12
- package/src/roles.d.ts +39 -0
- package/src/roles.js +44 -0
- package/src/serviceSchema.d.ts +19 -13
- package/src/serviceSchema.js +30 -15
- package/src/services.d.ts +20 -3
- package/src/services.js +45 -8
- package/src/sse.js +10 -1
- package/src/testing.d.ts +128 -0
- package/src/testing.js +379 -0
- package/src/types.d.ts +867 -0
- package/src/types.js +663 -0
package/src/index.d.ts
CHANGED
|
@@ -1,4568 +1,101 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* How long `admin.backup()` waits for the server to finish writing a backup:
|
|
3
|
-
* minutes on a large database, past the usual per-request timeout.
|
|
4
|
-
*/
|
|
5
|
-
export const BACKUP_TIMEOUT_MS: number;
|
|
6
1
|
export default PlaidClient;
|
|
2
|
+
export { PlaidClient };
|
|
3
|
+
export { BACKUP_TIMEOUT_MS } from "./apiServer.js";
|
|
7
4
|
export { wasReplayed } from "./replayed.js";
|
|
8
|
-
export
|
|
9
|
-
export type
|
|
10
|
-
export type
|
|
11
|
-
export type
|
|
12
|
-
export type
|
|
13
|
-
export type
|
|
14
|
-
export type
|
|
15
|
-
export type
|
|
16
|
-
export type
|
|
17
|
-
export type
|
|
18
|
-
export type
|
|
19
|
-
export type
|
|
20
|
-
export type
|
|
21
|
-
export type
|
|
22
|
-
export type
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
export type
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
export type
|
|
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
|
-
export type
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
export type
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
export type
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
*/
|
|
94
|
-
export type AuditPageOptions = {
|
|
95
|
-
startTime?: string;
|
|
96
|
-
endTime?: string;
|
|
97
|
-
opTypes?: string[] | string;
|
|
98
|
-
kinds?: OperationKind[] | string;
|
|
99
|
-
order?: "asc" | "desc";
|
|
100
|
-
limit?: number;
|
|
101
|
-
cursor?: string;
|
|
102
|
-
opsLimit?: number;
|
|
103
|
-
entryId?: string;
|
|
104
|
-
};
|
|
105
|
-
/**
|
|
106
|
-
* What `vocabLayers.restoreItem` did, or with `dryRun` would do.
|
|
107
|
-
*/
|
|
108
|
-
export type VocabItemRestoreSummary = {
|
|
109
|
-
/**
|
|
110
|
-
* The entry was gone and came back under its old id.
|
|
111
|
-
*/
|
|
112
|
-
inserted: boolean;
|
|
113
|
-
/**
|
|
114
|
-
* A living entry's form was set back.
|
|
115
|
-
*/
|
|
116
|
-
form: boolean;
|
|
117
|
-
/**
|
|
118
|
-
* A living entry's fields were set back.
|
|
119
|
-
*/
|
|
120
|
-
metadata: boolean;
|
|
121
|
-
/**
|
|
122
|
-
* 0 when nothing changes.
|
|
123
|
-
*/
|
|
124
|
-
total: number;
|
|
125
|
-
};
|
|
126
|
-
/**
|
|
127
|
-
* One private data entry. `version` is raised by one on every write of the
|
|
128
|
-
* entry, and a new entry is 1.
|
|
129
|
-
*/
|
|
130
|
-
export type UserDataEntry = {
|
|
131
|
-
key: string;
|
|
132
|
-
updatedAt: string;
|
|
133
|
-
version: number;
|
|
134
|
-
value?: any;
|
|
135
|
-
};
|
|
136
|
-
export type AdminUserDataEntry = UserDataEntry & {
|
|
137
|
-
userId: string;
|
|
138
|
-
};
|
|
139
|
-
/**
|
|
140
|
-
* One user's activity over a scope and window (`audit.tally`).
|
|
141
|
-
*/
|
|
142
|
-
export type ActivityTallyRow = {
|
|
143
|
-
user: {
|
|
144
|
-
id: string;
|
|
145
|
-
displayName?: string;
|
|
146
|
-
};
|
|
147
|
-
operations: number;
|
|
148
|
-
changes: number;
|
|
149
|
-
documents: number;
|
|
150
|
-
firstTs: string;
|
|
151
|
-
lastTs: string;
|
|
152
|
-
byDay?: Array<{
|
|
153
|
-
date: string;
|
|
154
|
-
changes: number;
|
|
155
|
-
}>;
|
|
156
|
-
};
|
|
157
|
-
/**
|
|
158
|
-
* What a constraint repair did in one document.
|
|
159
|
-
*/
|
|
160
|
-
export type ConstraintRepair = {
|
|
161
|
-
document: string;
|
|
162
|
-
constraint: string;
|
|
163
|
-
deleted: number;
|
|
164
|
-
joined: number;
|
|
165
|
-
};
|
|
166
|
-
/**
|
|
167
|
-
* A value-set rule as `refusedValues` takes it: the list, the characters a
|
|
168
|
-
* value is split on, and whether every part (`"all"`, the default) or only
|
|
169
|
-
* the first must be listed.
|
|
170
|
-
*/
|
|
171
|
-
export type ValueSetRule = {
|
|
172
|
-
values: string[];
|
|
173
|
-
delimiters?: string;
|
|
174
|
-
parts?: "all" | "first";
|
|
175
|
-
};
|
|
176
|
-
/**
|
|
177
|
-
* What a value-set rule would refuse in a layer's stored values: how many,
|
|
178
|
-
* how many distinct, and the most frequent with the parts not listed.
|
|
179
|
-
*/
|
|
180
|
-
export type RefusedValues = {
|
|
181
|
-
count: number;
|
|
182
|
-
valueCount: number;
|
|
183
|
-
values: Array<{
|
|
184
|
-
value: any;
|
|
185
|
-
parts: string[];
|
|
186
|
-
count: number;
|
|
187
|
-
}>;
|
|
188
|
-
};
|
|
189
|
-
/**
|
|
190
|
-
* Entities that can carry a comment.
|
|
191
|
-
*/
|
|
192
|
-
export type CommentableType = "document" | "text" | "token" | "span" | "relation" | "vocab-item";
|
|
193
|
-
/**
|
|
194
|
-
* One comment. `projectId` and `documentId` are null for a comment on a
|
|
195
|
-
* vocabulary entry, and `vocabLayerId` is set only for one. `anchorLabel` is
|
|
196
|
-
* what the comment is about, in words, captured when it was posted: a
|
|
197
|
-
* comment outlives its anchor. `edited` is true once the body has been
|
|
198
|
-
* rewritten since it was posted.
|
|
199
|
-
*/
|
|
200
|
-
export type Comment = {
|
|
201
|
-
id: string;
|
|
202
|
-
projectId: string | null;
|
|
203
|
-
documentId: string | null;
|
|
204
|
-
vocabLayerId: string | null;
|
|
205
|
-
entityType: CommentableType;
|
|
206
|
-
entityId: string;
|
|
207
|
-
anchorLabel: string | null;
|
|
208
|
-
authorId: string;
|
|
209
|
-
body: string;
|
|
210
|
-
createdAt: string;
|
|
211
|
-
updatedAt: string;
|
|
212
|
-
edited: boolean;
|
|
213
|
-
};
|
|
214
|
-
/**
|
|
215
|
-
* One entry in a project's annotation manual. `body` is present on a single
|
|
216
|
-
* read and on a list made with `includeBodies`, `bodyChars` on a list made
|
|
217
|
-
* without. `pinned`: the assistant is given this one in full on every turn.
|
|
218
|
-
*/
|
|
219
|
-
export type Guideline = {
|
|
220
|
-
id: string;
|
|
221
|
-
projectId: string;
|
|
222
|
-
title: string;
|
|
223
|
-
body?: string;
|
|
224
|
-
bodyChars?: number;
|
|
225
|
-
pinned: boolean;
|
|
226
|
-
createdAt: string;
|
|
227
|
-
updatedAt: string;
|
|
228
|
-
};
|
|
229
|
-
/**
|
|
230
|
-
* A research-telemetry event type.
|
|
231
|
-
*/
|
|
232
|
-
export type ClientEventType = "suggestion.shown" | "suggestion.adopted" | "suggestion.dismissed" | "plan.opened";
|
|
233
|
-
/**
|
|
234
|
-
* One research-telemetry event as the server stores it.
|
|
235
|
-
*/
|
|
236
|
-
export type ClientEvent = {
|
|
237
|
-
id: number;
|
|
238
|
-
projectId: string;
|
|
239
|
-
documentId: string | null;
|
|
240
|
-
userId: string;
|
|
241
|
-
type: ClientEventType;
|
|
242
|
-
targetId: string | null;
|
|
243
|
-
data: Record<string, any> | null;
|
|
244
|
-
clientTs: string | null;
|
|
245
|
-
ts: string;
|
|
246
|
-
};
|
|
247
|
-
/**
|
|
248
|
-
* An invite. `kind` is "signup" or "password-reset", `status` "active",
|
|
249
|
-
* "used", "expired", "revoked" or "inactive".
|
|
250
|
-
*/
|
|
251
|
-
export type Invite = {
|
|
252
|
-
id: string;
|
|
253
|
-
kind: string;
|
|
254
|
-
status: string;
|
|
255
|
-
createdBy: string;
|
|
256
|
-
createdAt: string;
|
|
257
|
-
expiresAt: string;
|
|
258
|
-
maxUses: number;
|
|
259
|
-
uses: number;
|
|
260
|
-
revokedAt: string | null;
|
|
261
|
-
note: string | null;
|
|
262
|
-
targetUserId: string | null;
|
|
263
|
-
grantAdmin: boolean;
|
|
264
|
-
projectId: string | null;
|
|
265
|
-
projectRole: string | null;
|
|
266
|
-
};
|
|
267
|
-
/**
|
|
268
|
-
* Server limits, as reported by /api/v1/info. An unset limit is absent.
|
|
269
|
-
* `passwordMinLength` is the shortest password the server accepts on any
|
|
270
|
-
* path, `lockExpirationMs` how long a document lock is held before it lapses.
|
|
271
|
-
*/
|
|
272
|
-
export type ServerLimits = {
|
|
273
|
-
mediaFileBytes?: number;
|
|
274
|
-
jsonBodyBytes?: number;
|
|
275
|
-
batchOperations?: number;
|
|
276
|
-
metadataDepth?: number;
|
|
277
|
-
metadataKeyCount?: number;
|
|
278
|
-
metadataStringLength?: number;
|
|
279
|
-
metadataTotalBytes?: number;
|
|
280
|
-
userDataValueBytes?: number;
|
|
281
|
-
guidelineTitleLength?: number;
|
|
282
|
-
guidelineBodyLength?: number;
|
|
283
|
-
commentBodyLength?: number;
|
|
284
|
-
passwordMinLength?: number;
|
|
285
|
-
lockExpirationMs?: number;
|
|
286
|
-
};
|
|
287
|
-
export type ServerHealth = {
|
|
288
|
-
ok: boolean;
|
|
289
|
-
version: string;
|
|
290
|
-
uptimeMs: number;
|
|
291
|
-
audit: {
|
|
292
|
-
dbSizeMb?: number;
|
|
293
|
-
auditRows?: number;
|
|
294
|
-
error?: string;
|
|
295
|
-
};
|
|
296
|
-
};
|
|
297
|
-
export type RateLimitBucket = {
|
|
298
|
-
ip: string;
|
|
299
|
-
userId?: string;
|
|
300
|
-
failures: number;
|
|
301
|
-
limit: number;
|
|
302
|
-
blocked: boolean;
|
|
303
|
-
};
|
|
304
|
-
export type RateLimitSnapshot = {
|
|
305
|
-
windowMs: number;
|
|
306
|
-
logins: RateLimitBucket[];
|
|
307
|
-
ips: RateLimitBucket[];
|
|
308
|
-
invites: RateLimitBucket[];
|
|
309
|
-
};
|
|
310
|
-
export type BackupStatus = {
|
|
311
|
-
enabled: boolean;
|
|
312
|
-
directory: string;
|
|
313
|
-
retention: number;
|
|
314
|
-
time: string;
|
|
315
|
-
backups: Array<{
|
|
316
|
-
name: string;
|
|
317
|
-
bytes: number;
|
|
318
|
-
modified: string;
|
|
319
|
-
}>;
|
|
320
|
-
ok?: boolean;
|
|
321
|
-
};
|
|
322
|
-
export type ServerReport = {
|
|
323
|
-
version: string;
|
|
324
|
-
jvm: {
|
|
325
|
-
uptimeMs: number;
|
|
326
|
-
startedAt: string;
|
|
327
|
-
java: string;
|
|
328
|
-
heapUsed: number;
|
|
329
|
-
heapMax: number;
|
|
330
|
-
};
|
|
331
|
-
database: {
|
|
332
|
-
path: string | null;
|
|
333
|
-
bytes: number | null;
|
|
334
|
-
walBytes: number | null;
|
|
335
|
-
slowQueryThresholdMs?: number;
|
|
336
|
-
journalMode?: string;
|
|
337
|
-
maxPoolSize?: number;
|
|
338
|
-
tables: Record<string, number | null>;
|
|
339
|
-
};
|
|
340
|
-
media: {
|
|
341
|
-
directory: string;
|
|
342
|
-
files: number;
|
|
343
|
-
bytes: number;
|
|
344
|
-
orphans: number;
|
|
345
|
-
orphanBytes: number;
|
|
346
|
-
};
|
|
347
|
-
backup: BackupStatus;
|
|
348
|
-
settings: Record<string, any>;
|
|
349
|
-
};
|
|
350
|
-
/**
|
|
351
|
-
* The live log. Requests and events are buffered separately, so a burst of
|
|
352
|
-
* requests cannot evict an error. In each, `matched` is how many passed the
|
|
353
|
-
* filters (which may exceed what `entries` holds) and `held` how many are
|
|
354
|
-
* buffered in total. `file` is the configured log file's absolute path, or
|
|
355
|
-
* null when logging to stdout.
|
|
356
|
-
*/
|
|
357
|
-
export type LiveLog = {
|
|
358
|
-
requests: {
|
|
359
|
-
entries: object[];
|
|
360
|
-
matched: number;
|
|
361
|
-
held: number;
|
|
362
|
-
capacity: number;
|
|
363
|
-
stats: Record<string, number | null>;
|
|
364
|
-
};
|
|
365
|
-
events: {
|
|
366
|
-
entries: object[];
|
|
367
|
-
matched: number;
|
|
368
|
-
held: number;
|
|
369
|
-
capacity: number;
|
|
370
|
-
byLevel: Record<string, number>;
|
|
371
|
-
};
|
|
372
|
-
file: string | null;
|
|
373
|
-
};
|
|
374
|
-
/**
|
|
375
|
-
* An open server-sent-events stream. Once CLOSED, `error` says why: null when
|
|
376
|
-
* this side closed it. A refused stream's error carries the HTTP `status`,
|
|
377
|
-
* and one the server ended is named "StreamClosed".
|
|
378
|
-
*/
|
|
379
|
-
export type SSEConnection = {
|
|
380
|
-
close: () => void;
|
|
381
|
-
getStats: () => SSEStats;
|
|
382
|
-
readyState: number;
|
|
383
|
-
error: (Error & {
|
|
384
|
-
status?: number;
|
|
385
|
-
}) | null;
|
|
386
|
-
};
|
|
387
|
-
/**
|
|
388
|
-
* How an SSE connection has fared so far. `events` counts what arrived by
|
|
389
|
-
* event type ("audit-log", "message", "heartbeat", "connected", "other").
|
|
390
|
-
*/
|
|
391
|
-
export type SSEStats = {
|
|
392
|
-
durationSeconds: number;
|
|
393
|
-
isConnected: boolean;
|
|
394
|
-
isClosed: boolean;
|
|
395
|
-
clientId: string | null;
|
|
396
|
-
events: Record<string, number>;
|
|
397
|
-
readyState: number;
|
|
398
|
-
};
|
|
399
|
-
/**
|
|
400
|
-
* A value a span or relation holds: a JSON scalar.
|
|
401
|
-
*/
|
|
402
|
-
export type AtomicValue = string | number | boolean | null;
|
|
403
|
-
/**
|
|
404
|
-
* What a create answers: the new record's id.
|
|
405
|
-
*/
|
|
406
|
-
export type Created = {
|
|
407
|
-
id: string;
|
|
408
|
-
};
|
|
409
|
-
/**
|
|
410
|
-
* A project. `textLayers` nests its layers in their display order, each
|
|
411
|
-
* with the layers built on it, and `vocabs` lists the vocabularies linked to
|
|
412
|
-
* it.
|
|
413
|
-
*/
|
|
414
|
-
export type Project = {
|
|
415
|
-
id: string;
|
|
416
|
-
name: string;
|
|
417
|
-
config: Record<string, any>;
|
|
418
|
-
readers: string[];
|
|
419
|
-
writers: string[];
|
|
420
|
-
maintainers: string[];
|
|
421
|
-
textLayers: ProjectTextLayer[];
|
|
422
|
-
vocabs: ProjectVocab[];
|
|
423
|
-
};
|
|
424
|
-
export type ProjectTextLayer = {
|
|
425
|
-
id: string;
|
|
426
|
-
name: string;
|
|
427
|
-
config: Record<string, any>;
|
|
428
|
-
tokenLayers: ProjectTokenLayer[];
|
|
429
|
-
};
|
|
430
|
-
export type ProjectTokenLayer = {
|
|
431
|
-
id: string;
|
|
432
|
-
name: string;
|
|
433
|
-
config: Record<string, any>;
|
|
434
|
-
constraints: Record<string, LayerConstraint[]>;
|
|
435
|
-
spanLayers: ProjectSpanLayer[];
|
|
436
|
-
};
|
|
437
|
-
export type ProjectSpanLayer = {
|
|
438
|
-
id: string;
|
|
439
|
-
name: string;
|
|
440
|
-
config: Record<string, any>;
|
|
441
|
-
constraints: Record<string, LayerConstraint[]>;
|
|
442
|
-
relationLayers: ProjectRelationLayer[];
|
|
443
|
-
};
|
|
444
|
-
export type ProjectRelationLayer = {
|
|
445
|
-
id: string;
|
|
446
|
-
name: string;
|
|
447
|
-
config: Record<string, any>;
|
|
448
|
-
constraints: Record<string, LayerConstraint[]>;
|
|
449
|
-
};
|
|
450
|
-
export type ProjectVocab = {
|
|
451
|
-
id: string;
|
|
452
|
-
name: string;
|
|
453
|
-
maintainers: string[];
|
|
454
|
-
config: Record<string, any>;
|
|
455
|
-
};
|
|
456
|
-
/**
|
|
457
|
-
* A document. `version` rises by one on every write to it or its layers.
|
|
458
|
-
* A read with `includeBody` also carries `textLayers`, the document's
|
|
459
|
-
* annotation nested under each layer.
|
|
460
|
-
*/
|
|
461
|
-
export type PlaidDocument = {
|
|
462
|
-
id: string;
|
|
463
|
-
name: string;
|
|
464
|
-
project: string;
|
|
465
|
-
version: number;
|
|
466
|
-
timeCreated: string;
|
|
467
|
-
timeModified: string;
|
|
468
|
-
metadata?: Record<string, any>;
|
|
469
|
-
textLayers?: DocumentTextLayer[];
|
|
470
|
-
};
|
|
471
|
-
/**
|
|
472
|
-
* A text layer as a document read nests it: `text` is null where the
|
|
473
|
-
* document has no text in this layer.
|
|
474
|
-
*/
|
|
475
|
-
export type DocumentTextLayer = {
|
|
476
|
-
id: string;
|
|
477
|
-
name: string;
|
|
478
|
-
config: Record<string, any>;
|
|
479
|
-
text: {
|
|
480
|
-
id: string;
|
|
481
|
-
document: string;
|
|
482
|
-
body: string;
|
|
483
|
-
digest: string;
|
|
484
|
-
metadata?: Record<string, any>;
|
|
485
|
-
} | null;
|
|
486
|
-
tokenLayers: DocumentTokenLayer[];
|
|
487
|
-
};
|
|
488
|
-
export type DocumentTokenLayer = {
|
|
489
|
-
id: string;
|
|
490
|
-
name: string;
|
|
491
|
-
config: Record<string, any>;
|
|
492
|
-
constraints: Record<string, LayerConstraint[]>;
|
|
493
|
-
overlapMode: string;
|
|
494
|
-
parentTokenLayer: string | null;
|
|
495
|
-
tokens: Array<{
|
|
496
|
-
id: string;
|
|
497
|
-
begin: number;
|
|
498
|
-
end: number;
|
|
499
|
-
precedence: number | null;
|
|
500
|
-
metadata?: Record<string, any>;
|
|
501
|
-
}>;
|
|
502
|
-
spanLayers: DocumentSpanLayer[];
|
|
503
|
-
vocabs: Array<ProjectVocab & {
|
|
504
|
-
vocabLinks: Array<{
|
|
505
|
-
id: string;
|
|
506
|
-
vocabItem: VocabItem;
|
|
507
|
-
tokens: string[];
|
|
508
|
-
metadata?: Record<string, any>;
|
|
509
|
-
}>;
|
|
510
|
-
}>;
|
|
511
|
-
};
|
|
512
|
-
export type DocumentSpanLayer = {
|
|
513
|
-
id: string;
|
|
514
|
-
name: string;
|
|
515
|
-
config: Record<string, any>;
|
|
516
|
-
constraints: Record<string, LayerConstraint[]>;
|
|
517
|
-
spans: Array<{
|
|
518
|
-
id: string;
|
|
519
|
-
value: AtomicValue;
|
|
520
|
-
tokens: string[];
|
|
521
|
-
metadata?: Record<string, any>;
|
|
522
|
-
}>;
|
|
523
|
-
relationLayers: Array<ProjectRelationLayer & {
|
|
524
|
-
relations: Array<{
|
|
525
|
-
id: string;
|
|
526
|
-
source: string;
|
|
527
|
-
target: string;
|
|
528
|
-
value: AtomicValue;
|
|
529
|
-
metadata?: Record<string, any>;
|
|
530
|
-
}>;
|
|
531
|
-
}>;
|
|
532
|
-
};
|
|
533
|
-
/**
|
|
534
|
-
* A text: one document's body in one text layer. `digest` names the body,
|
|
535
|
-
* as an edit's `base`.
|
|
536
|
-
*/
|
|
537
|
-
export type PlaidText = {
|
|
538
|
-
id: string;
|
|
539
|
-
body: string;
|
|
540
|
-
document: string;
|
|
541
|
-
layer: string;
|
|
542
|
-
digest: string;
|
|
543
|
-
metadata?: Record<string, any>;
|
|
544
|
-
};
|
|
545
|
-
/**
|
|
546
|
-
* What a text write changed besides the body: the tokens whose extent
|
|
547
|
-
* moved (with `layer` and `text` on one the write made), the spans and
|
|
548
|
-
* vocabulary links whose tokens or value changed, and the ids of what it
|
|
549
|
-
* deleted.
|
|
550
|
-
*/
|
|
551
|
-
export type TextReshape = {
|
|
552
|
-
tokens: Array<{
|
|
553
|
-
id: string;
|
|
554
|
-
begin: number;
|
|
555
|
-
end: number;
|
|
556
|
-
layer?: string;
|
|
557
|
-
text?: string;
|
|
558
|
-
}>;
|
|
559
|
-
spans: Array<{
|
|
560
|
-
id: string;
|
|
561
|
-
tokens?: string[];
|
|
562
|
-
value?: AtomicValue;
|
|
563
|
-
}>;
|
|
564
|
-
vocabLinks: Array<{
|
|
565
|
-
id: string;
|
|
566
|
-
tokens: string[];
|
|
567
|
-
}>;
|
|
568
|
-
deleted: {
|
|
569
|
-
tokens: string[];
|
|
570
|
-
spans: string[];
|
|
571
|
-
relations: string[];
|
|
572
|
-
vocabLinks: string[];
|
|
573
|
-
};
|
|
574
|
-
};
|
|
575
|
-
/**
|
|
576
|
-
* A token. `value` is the text it covers.
|
|
577
|
-
*/
|
|
578
|
-
export type Token = {
|
|
579
|
-
id: string;
|
|
580
|
-
text: string;
|
|
581
|
-
begin: number;
|
|
582
|
-
end: number;
|
|
583
|
-
layer: string;
|
|
584
|
-
document: string;
|
|
585
|
-
precedence: number | null;
|
|
586
|
-
value: string;
|
|
587
|
-
metadata?: Record<string, any>;
|
|
588
|
-
};
|
|
589
|
-
export type Span = {
|
|
590
|
-
id: string;
|
|
591
|
-
layer: string;
|
|
592
|
-
document: string;
|
|
593
|
-
value: AtomicValue;
|
|
594
|
-
tokens: string[];
|
|
595
|
-
metadata?: Record<string, any>;
|
|
596
|
-
};
|
|
597
|
-
/**
|
|
598
|
-
* A relation, from the span `source` to the span `target`.
|
|
599
|
-
*/
|
|
600
|
-
export type Relation = {
|
|
601
|
-
id: string;
|
|
602
|
-
layer: string;
|
|
603
|
-
document: string;
|
|
604
|
-
source: string;
|
|
605
|
-
target: string;
|
|
606
|
-
value: AtomicValue;
|
|
607
|
-
metadata?: Record<string, any>;
|
|
608
|
-
};
|
|
609
|
-
export type VocabItem = {
|
|
610
|
-
id: string;
|
|
611
|
-
layer: string;
|
|
612
|
-
form: string;
|
|
613
|
-
metadata?: Record<string, any>;
|
|
614
|
-
};
|
|
615
|
-
/**
|
|
616
|
-
* A link from a vocabulary entry to the tokens of one occurrence.
|
|
617
|
-
*/
|
|
618
|
-
export type VocabLink = {
|
|
619
|
-
id: string;
|
|
620
|
-
vocabItem: string;
|
|
621
|
-
document: string;
|
|
622
|
-
tokens: string[];
|
|
623
|
-
metadata?: Record<string, any>;
|
|
624
|
-
};
|
|
625
|
-
/**
|
|
626
|
-
* A vocabulary. `items` is there on a read made with `includeItems`.
|
|
627
|
-
*/
|
|
628
|
-
export type VocabLayer = {
|
|
629
|
-
id: string;
|
|
630
|
-
name: string;
|
|
631
|
-
timeCreated: string;
|
|
632
|
-
timeModified: string;
|
|
633
|
-
config: Record<string, any>;
|
|
634
|
-
maintainers: string[];
|
|
635
|
-
items?: VocabItem[];
|
|
636
|
-
};
|
|
637
|
-
export type TextLayer = {
|
|
638
|
-
id: string;
|
|
639
|
-
name: string;
|
|
640
|
-
project: string;
|
|
641
|
-
config: Record<string, any>;
|
|
642
|
-
};
|
|
643
|
-
export type TokenLayer = {
|
|
644
|
-
id: string;
|
|
645
|
-
name: string;
|
|
646
|
-
textLayer: string;
|
|
647
|
-
project: string;
|
|
648
|
-
overlapMode: string;
|
|
649
|
-
parentTokenLayer: string | null;
|
|
650
|
-
config: Record<string, any>;
|
|
651
|
-
constraints: Record<string, LayerConstraint[]>;
|
|
652
|
-
};
|
|
653
|
-
export type SpanLayer = {
|
|
654
|
-
id: string;
|
|
655
|
-
name: string;
|
|
656
|
-
tokenLayer: string;
|
|
657
|
-
project: string;
|
|
658
|
-
config: Record<string, any>;
|
|
659
|
-
constraints: Record<string, LayerConstraint[]>;
|
|
660
|
-
};
|
|
661
|
-
export type RelationLayer = {
|
|
662
|
-
id: string;
|
|
663
|
-
name: string;
|
|
664
|
-
spanLayer: string;
|
|
665
|
-
project: string;
|
|
666
|
-
config: Record<string, any>;
|
|
667
|
-
constraints: Record<string, LayerConstraint[]>;
|
|
668
|
-
};
|
|
669
|
-
/**
|
|
670
|
-
* The records with metadata, by the path segment of their routes.
|
|
671
|
-
*/
|
|
672
|
-
export type MetadataRecords = {
|
|
673
|
-
documents: PlaidDocument;
|
|
674
|
-
texts: PlaidText;
|
|
675
|
-
tokens: Token;
|
|
676
|
-
spans: Span;
|
|
677
|
-
relations: Relation;
|
|
678
|
-
"vocab-items": VocabItem;
|
|
679
|
-
"vocab-links": VocabLink;
|
|
680
|
-
};
|
|
681
|
-
/**
|
|
682
|
-
* The four layer kinds, by the path segment of their routes.
|
|
683
|
-
*/
|
|
684
|
-
export type LayerRecords = {
|
|
685
|
-
"text-layers": TextLayer;
|
|
686
|
-
"token-layers": TokenLayer;
|
|
687
|
-
"span-layers": SpanLayer;
|
|
688
|
-
"relation-layers": RelationLayer;
|
|
689
|
-
};
|
|
690
|
-
export type User = {
|
|
691
|
-
id: string;
|
|
692
|
-
displayName: string;
|
|
693
|
-
isAdmin: boolean;
|
|
694
|
-
deactivatedAt: string | null;
|
|
695
|
-
avatarHash: string | null;
|
|
696
|
-
};
|
|
697
|
-
/**
|
|
698
|
-
* A project as the project list gives it: the project, with how many
|
|
699
|
-
* documents it has and when the newest of them last changed.
|
|
700
|
-
*/
|
|
701
|
-
export type ProjectListEntry = Project & {
|
|
702
|
-
documentCount: number;
|
|
703
|
-
lastModified: string | null;
|
|
704
|
-
};
|
|
705
|
-
/**
|
|
706
|
-
* A document as a project's document list gives it.
|
|
707
|
-
*/
|
|
708
|
-
export type DocumentListEntry = {
|
|
709
|
-
id: string;
|
|
710
|
-
name: string;
|
|
711
|
-
version: number;
|
|
712
|
-
timeCreated: string;
|
|
713
|
-
timeModified: string;
|
|
714
|
-
};
|
|
715
|
-
/**
|
|
716
|
-
* A named API token, without the signed token itself, which only `create`
|
|
717
|
-
* returns.
|
|
718
|
-
*/
|
|
719
|
-
export type ApiToken = {
|
|
720
|
-
id: string;
|
|
721
|
-
userId: string;
|
|
722
|
-
name: string;
|
|
723
|
-
createdAt: string;
|
|
724
|
-
lastUsedAt: string | null;
|
|
725
|
-
revokedAt: string | null;
|
|
726
|
-
};
|
|
727
|
-
/**
|
|
728
|
-
* Who made an operation, as the audit log names them.
|
|
729
|
-
*/
|
|
730
|
-
export type AuditUser = {
|
|
731
|
-
id: string;
|
|
732
|
-
displayName: string;
|
|
733
|
-
avatarHash: string | null;
|
|
734
|
-
};
|
|
735
|
-
/**
|
|
736
|
-
* A project or a document an audit entry names, while it exists.
|
|
737
|
-
*/
|
|
738
|
-
export type AuditTarget = {
|
|
739
|
-
id: string;
|
|
740
|
-
name: string;
|
|
741
|
-
};
|
|
742
|
-
/**
|
|
743
|
-
* One operation of an audit entry.
|
|
744
|
-
*/
|
|
745
|
-
export type AuditOp = {
|
|
746
|
-
id: string;
|
|
747
|
-
/**
|
|
748
|
-
* The kind of write, such as "document/update".
|
|
749
|
-
*/
|
|
750
|
-
type: string;
|
|
751
|
-
description: string;
|
|
752
|
-
time: string;
|
|
753
|
-
/**
|
|
754
|
-
* The time to read at to see the operation done.
|
|
755
|
-
*/
|
|
756
|
-
endTime: string;
|
|
757
|
-
user: AuditUser | null;
|
|
758
|
-
credential?: string;
|
|
759
|
-
project?: AuditTarget;
|
|
760
|
-
document?: AuditTarget;
|
|
761
|
-
batchId?: string;
|
|
762
|
-
};
|
|
763
|
-
/**
|
|
764
|
-
* One entry of an audit log: a logical operation, an atomic batch or a lone
|
|
765
|
-
* write, with its operations oldest first (`ops`, cut to `opsLimit` when one
|
|
766
|
-
* was asked for, while `opCount` counts them all).
|
|
767
|
-
*/
|
|
768
|
-
export type AuditEntry = {
|
|
769
|
-
id: string;
|
|
770
|
-
time: string;
|
|
771
|
-
endTime: string;
|
|
772
|
-
user: AuditUser | null;
|
|
773
|
-
projects: AuditTarget[];
|
|
774
|
-
documents: AuditTarget[];
|
|
775
|
-
ops: AuditOp[];
|
|
776
|
-
opCount: number;
|
|
777
|
-
groupId?: string;
|
|
778
|
-
message?: string;
|
|
779
|
-
kind?: OperationKind;
|
|
780
|
-
ref?: string;
|
|
781
|
-
batchId?: string;
|
|
782
|
-
apiToken?: {
|
|
783
|
-
id: string;
|
|
784
|
-
name: string;
|
|
785
|
-
};
|
|
786
|
-
credential?: string;
|
|
787
|
-
};
|
|
788
|
-
/**
|
|
789
|
-
* A document lock as its holder sees it. `expiresAt` is in epoch
|
|
790
|
-
* milliseconds.
|
|
791
|
-
*/
|
|
792
|
-
export type LockGrant = {
|
|
793
|
-
lockId: string;
|
|
794
|
-
userId: string;
|
|
795
|
-
expiresAt: number;
|
|
796
|
-
};
|
|
797
|
-
/**
|
|
798
|
-
* What `documents.restore` did, or with `dryRun` would do: per kind of
|
|
799
|
-
* record, how many come back, are set back and are removed (per layer for
|
|
800
|
-
* the layered kinds), and what could not come back, with why.
|
|
801
|
-
*/
|
|
802
|
-
export type DocumentRestoreSummary = {
|
|
803
|
-
name: boolean;
|
|
804
|
-
documentMetadata: boolean;
|
|
805
|
-
texts: RestoreCounts;
|
|
806
|
-
tokens: RestoreCounts & {
|
|
807
|
-
byLayer: Array<RestoreCounts & {
|
|
808
|
-
layerId: string;
|
|
809
|
-
}>;
|
|
810
|
-
};
|
|
811
|
-
spans: RestoreCounts & {
|
|
812
|
-
byLayer: Array<RestoreCounts & {
|
|
813
|
-
layerId: string;
|
|
814
|
-
}>;
|
|
815
|
-
};
|
|
816
|
-
relations: RestoreCounts & {
|
|
817
|
-
byLayer: Array<RestoreCounts & {
|
|
818
|
-
layerId: string;
|
|
819
|
-
}>;
|
|
820
|
-
};
|
|
821
|
-
vocabLinks: RestoreCounts;
|
|
822
|
-
skipped: Array<{
|
|
823
|
-
kind: string;
|
|
824
|
-
count: number;
|
|
825
|
-
reason: string;
|
|
826
|
-
}>;
|
|
827
|
-
/**
|
|
828
|
-
* When the name the
|
|
829
|
-
* document had then belongs to another document now: the name it keeps,
|
|
830
|
-
* and that other document's name.
|
|
831
|
-
*/
|
|
832
|
-
nameKept?: {
|
|
833
|
-
name: string;
|
|
834
|
-
taken: string;
|
|
835
|
-
};
|
|
836
|
-
/**
|
|
837
|
-
* 0 when nothing changes.
|
|
838
|
-
*/
|
|
839
|
-
total: number;
|
|
840
|
-
};
|
|
841
|
-
export type RestoreCounts = {
|
|
842
|
-
inserted: number;
|
|
843
|
-
updated: number;
|
|
844
|
-
deleted: number;
|
|
845
|
-
};
|
|
846
|
-
/**
|
|
847
|
-
* A logical-operation group: its label, who made it and when, and the kind
|
|
848
|
-
* and reference of the operation when it has them.
|
|
849
|
-
*/
|
|
850
|
-
export type OperationGroup = {
|
|
851
|
-
id: string;
|
|
852
|
-
message: string | null;
|
|
853
|
-
user: string;
|
|
854
|
-
createdAt: string;
|
|
855
|
-
kind?: string;
|
|
856
|
-
ref?: string;
|
|
857
|
-
};
|
|
858
|
-
/**
|
|
859
|
-
* A query's answer. For "ids" and "entities", one row of `results` per
|
|
860
|
-
* match, a cell per `columns` entry: an id, or the entity as its GET
|
|
861
|
-
* answers it. For "count", only the count. `truncated`: the rows or the
|
|
862
|
-
* count stopped at the server's cap.
|
|
863
|
-
*/
|
|
864
|
-
export type QueryResult = {
|
|
865
|
-
return: string;
|
|
866
|
-
count: number;
|
|
867
|
-
truncated: boolean;
|
|
868
|
-
columns?: string[];
|
|
869
|
-
results?: any[][];
|
|
870
|
-
};
|
|
871
|
-
export class PlaidClient {
|
|
872
|
-
/**
|
|
873
|
-
* Liveness, version and database size, with NO authentication and no client
|
|
874
|
-
* instance — for a launcher or status page checking whether a server is up
|
|
875
|
-
* before anyone logs in.
|
|
876
|
-
* @param {string} baseUrl - The API base URL
|
|
877
|
-
* @param {{timeout?: number | null}} [options]
|
|
878
|
-
* @returns {Promise<ServerHealth>}
|
|
879
|
-
*/
|
|
880
|
-
static health(baseUrl: string, options?: {
|
|
881
|
-
timeout?: number | null;
|
|
882
|
-
}): Promise<ServerHealth>;
|
|
883
|
-
/**
|
|
884
|
-
* The limits this server enforces, with NO authentication and no client
|
|
885
|
-
* instance. See the instance method for the shape.
|
|
886
|
-
* @param {string} baseUrl - The API base URL
|
|
887
|
-
* @param {{timeout?: number | null}} [options]
|
|
888
|
-
* @returns {Promise<{limits: ServerLimits}>}
|
|
889
|
-
*/
|
|
890
|
-
static info(baseUrl: string, options?: {
|
|
891
|
-
timeout?: number | null;
|
|
892
|
-
}): Promise<{
|
|
893
|
-
limits: ServerLimits;
|
|
894
|
-
}>;
|
|
895
|
-
/**
|
|
896
|
-
* Build the link to hand someone for an invite code. The server never sees
|
|
897
|
-
* an app URL, so the app that minted the invite is the one that names it.
|
|
898
|
-
* Both SPAs use HashRouter, so the code rides in the fragment — which also
|
|
899
|
-
* keeps it out of server access logs.
|
|
900
|
-
* @param {string} appUrl - Where the SPA lives, e.g. "https://plaid.example.org/igt/"
|
|
901
|
-
* @param {string} code - The code returned by invites.create()
|
|
902
|
-
* @returns {string}
|
|
903
|
-
*/
|
|
904
|
-
static inviteUrl(appUrl: string, code: string): string;
|
|
905
|
-
/**
|
|
906
|
-
* Describe an invite code, with NO authentication — this is what a signup
|
|
907
|
-
* page calls before the redeemer has an account. Returns the kind of link
|
|
908
|
-
* ("signup" or "password-reset"), its status ("active", "used", "expired",
|
|
909
|
-
* "revoked", or "inactive" when its creator can no longer grant what it
|
|
910
|
-
* grants), and the project it grants access to, if any.
|
|
911
|
-
*
|
|
912
|
-
* Throws a 404-shaped error if the code is unknown. A known-but-dead code
|
|
913
|
-
* resolves normally with a non-"active" status, so the page can say why.
|
|
914
|
-
* @param {string} baseUrl - The API base URL
|
|
915
|
-
* @param {string} code - The invite code
|
|
916
|
-
* @param {object} [options]
|
|
917
|
-
* @returns {Promise<{kind: string, status: string, expiresAt: string, projectName?: string, projectRole?: string, email?: string, grantAdmin: boolean}>}
|
|
918
|
-
*/
|
|
919
|
-
static lookupInvite(baseUrl: string, code: string, options?: object): Promise<{
|
|
920
|
-
kind: string;
|
|
921
|
-
status: string;
|
|
922
|
-
expiresAt: string;
|
|
923
|
-
projectName?: string;
|
|
924
|
-
projectRole?: string;
|
|
925
|
-
email?: string;
|
|
926
|
-
grantAdmin: boolean;
|
|
927
|
-
}>;
|
|
928
|
-
/**
|
|
929
|
-
* Redeem an invite code, with NO authentication.
|
|
930
|
-
*
|
|
931
|
-
* For a signup invite, pass `email` and `password` to create the account
|
|
932
|
-
* (and optionally `displayName`); the invite's grants are applied in the
|
|
933
|
-
* same transaction. For a password reset link, pass `password` only.
|
|
934
|
-
* Resolves to a logged-in client, exactly like login() — the redeemer just
|
|
935
|
-
* chose these credentials, so there is no reason to send them to a login
|
|
936
|
-
* form to retype them.
|
|
937
|
-
* @param {string} baseUrl - The API base URL
|
|
938
|
-
* @param {string} code - The invite code
|
|
939
|
-
* @param {object} credentials
|
|
940
|
-
* @param {string} [credentials.email] - The new account's email address,
|
|
941
|
-
* which becomes its id and login (signup only)
|
|
942
|
-
* @param {string} [credentials.displayName] - How the new user is shown in
|
|
943
|
-
* the UI; defaults to the local part of the email (signup only)
|
|
944
|
-
* @param {string} credentials.password - Desired password (min 8 characters)
|
|
945
|
-
* @param {object} [options]
|
|
946
|
-
* @returns {Promise<{client: PlaidClient, userId: string, kind: string}>}
|
|
947
|
-
*/
|
|
948
|
-
static redeemInvite(baseUrl: string, code: string, { email, password, displayName }?: {
|
|
949
|
-
email?: string;
|
|
950
|
-
displayName?: string;
|
|
951
|
-
password: string;
|
|
952
|
-
}, options?: object): Promise<{
|
|
953
|
-
client: PlaidClient;
|
|
954
|
-
userId: string;
|
|
955
|
-
kind: string;
|
|
956
|
-
}>;
|
|
957
|
-
/**
|
|
958
|
-
* Authenticate and return a new client instance with token. This is the
|
|
959
|
-
* single auth entry point — there is no `client.login` resource.
|
|
960
|
-
* @param {string} baseUrl - The base URL for the API
|
|
961
|
-
* @param {string} userId - User ID for authentication
|
|
962
|
-
* @param {string} password - Password for authentication
|
|
963
|
-
* @param {object} [options] - Client options forwarded to the constructor (e.g. { timeout })
|
|
964
|
-
* @returns {Promise<PlaidClient>} - Authenticated client instance
|
|
965
|
-
*/
|
|
966
|
-
static login(baseUrl: string, userId: string, password: string, options?: object): Promise<PlaidClient>;
|
|
967
|
-
/**
|
|
968
|
-
* Create a new PlaidClient instance
|
|
969
|
-
* @param {string} baseUrl - The base URL for the API
|
|
970
|
-
* @param {string} token - The authentication token
|
|
971
|
-
* @param {PlaidClientOptions} [options] - Client options
|
|
972
|
-
*/
|
|
973
|
-
constructor(baseUrl: string, token: string, options?: PlaidClientOptions);
|
|
974
|
-
baseUrl: string;
|
|
975
|
-
token: string;
|
|
976
|
-
/** @type {number | null} */
|
|
977
|
-
timeout: number | null;
|
|
978
|
-
/** @type {number | null} */
|
|
979
|
-
batchTimeout: number | null;
|
|
980
|
-
/** @type {number[] | undefined} */
|
|
981
|
-
retryDelaysMs: number[] | undefined;
|
|
982
|
-
/**
|
|
983
|
-
* The latest version seen for each document written through this client,
|
|
984
|
-
* keyed by document id.
|
|
985
|
-
* @type {Record<string, number>}
|
|
986
|
-
*/
|
|
987
|
-
documentVersions: Record<string, number>;
|
|
988
|
-
/**
|
|
989
|
-
* True once a response left its version list out
|
|
990
|
-
* (X-Document-Versions-Omitted, past fifty documents). Every version held
|
|
991
|
-
* was then forgotten, and the strict-mode document's is read again before
|
|
992
|
-
* the next write.
|
|
993
|
-
* @type {boolean | undefined}
|
|
994
|
-
*/
|
|
995
|
-
documentVersionsOmitted: boolean | undefined;
|
|
996
|
-
/** @type {number | null} */
|
|
997
|
-
serverClockOffsetMs: number | null;
|
|
998
|
-
/**
|
|
999
|
-
* The document strict mode is entered for, or null.
|
|
1000
|
-
* @type {string | null}
|
|
1001
|
-
*/
|
|
1002
|
-
strictModeDocumentId: string | null;
|
|
1003
|
-
/** @type {import("./documentLock.js").DocumentLockLost | null} */
|
|
1004
|
-
documentLockLost: import("./documentLock.js").DocumentLockLost | null;
|
|
1005
|
-
/**
|
|
1006
|
-
* @type {{id: string, message: string | null, kind: OperationKind | null,
|
|
1007
|
-
* ref: string | null, depth: number, written: boolean, refined: any,
|
|
1008
|
-
* frames: object[]} | null}
|
|
1009
|
-
*/
|
|
1010
|
-
operationGroup: {
|
|
1011
|
-
id: string;
|
|
1012
|
-
message: string | null;
|
|
1013
|
-
kind: OperationKind | null;
|
|
1014
|
-
ref: string | null;
|
|
1015
|
-
depth: number;
|
|
1016
|
-
written: boolean;
|
|
1017
|
-
refined: any;
|
|
1018
|
-
frames: object[];
|
|
1019
|
-
} | null;
|
|
1020
|
-
/** @type {((error: Error) => void) | null} */
|
|
1021
|
-
onAuthError: ((error: Error) => void) | null;
|
|
1022
|
-
/** @private */
|
|
1023
|
-
private _authErrorFired;
|
|
1024
|
-
/** @private */
|
|
1025
|
-
private _retryListeners;
|
|
1026
|
-
/** @private */
|
|
1027
|
-
private _serverFacts;
|
|
1028
|
-
/** @private @type {object | null} */
|
|
1029
|
-
private _openedFrame;
|
|
1030
|
-
/**
|
|
1031
|
-
* A stream of this client ended without being closed here: the server may
|
|
1032
|
-
* have restarted, with other limits.
|
|
1033
|
-
* @private
|
|
1034
|
-
*/
|
|
1035
|
-
private _noteStreamDropped;
|
|
1036
|
-
/**
|
|
1037
|
-
* A stream of this client is open. After a drop the limits are read again,
|
|
1038
|
-
* once however many streams reopen.
|
|
1039
|
-
* @private
|
|
1040
|
-
*/
|
|
1041
|
-
private _noteStreamOpened;
|
|
1042
|
-
/**
|
|
1043
|
-
* Hear every time a request is sent again: after a 503 (the database was
|
|
1044
|
-
* busy), or for a keyed write after its answer was lost (no response, 502,
|
|
1045
|
-
* 504). The listener gets `{ attempt, retries, delay, error }` before the
|
|
1046
|
-
* wait. A screen that writes through the client directly can say it is
|
|
1047
|
-
* retrying while the server does not answer, though the browser is online.
|
|
1048
|
-
* @param {(info: {attempt: number, retries: number, delay: number, error: Error}) => void} listener
|
|
1049
|
-
* @returns {() => void} the unsubscribe
|
|
1050
|
-
*/
|
|
1051
|
-
onRetry(listener: (info: {
|
|
1052
|
-
attempt: number;
|
|
1053
|
-
retries: number;
|
|
1054
|
-
delay: number;
|
|
1055
|
-
error: Error;
|
|
1056
|
-
}) => void): () => void;
|
|
1057
|
-
/**
|
|
1058
|
-
* Tell every `onRetry` listener. A listener that throws is passed over.
|
|
1059
|
-
* @private
|
|
1060
|
-
*/
|
|
1061
|
-
private _noteRetry;
|
|
1062
|
-
/**
|
|
1063
|
-
* The server's time now, as its last response's Date header put it (to the
|
|
1064
|
-
* second), else this machine's. Judge a time the server stamped, such as an
|
|
1065
|
-
* audit entry's `ts`, against this rather than `Date.now()`: a browser
|
|
1066
|
-
* clock can be minutes off.
|
|
1067
|
-
* @returns {Date}
|
|
1068
|
-
*/
|
|
1069
|
-
serverNow(): Date;
|
|
1070
|
-
/**
|
|
1071
|
-
* The API bundles (`client.documents`, `client.tokens`, ...). Installed on
|
|
1072
|
-
* the client, and again on every batch it opens (see `batch()`): a batch is
|
|
1073
|
-
* a view of the client with its own `_request`, so the same bundles built
|
|
1074
|
-
* on it queue instead of sending.
|
|
1075
|
-
* @private
|
|
1076
|
-
*/
|
|
1077
|
-
private _installResources;
|
|
1078
|
-
vocabLinks: {
|
|
1079
|
-
/**
|
|
1080
|
-
* Get a vocab link by ID
|
|
1081
|
-
* @param {string} id - The resource ID
|
|
1082
|
-
* @returns {Promise<VocabLink>}
|
|
1083
|
-
*/
|
|
1084
|
-
get: (id: string) => Promise<VocabLink>;
|
|
1085
|
-
/**
|
|
1086
|
-
* Delete a vocab link
|
|
1087
|
-
* @param {string} id - The resource ID
|
|
1088
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
1089
|
-
* @returns {Promise<void>}
|
|
1090
|
-
*/
|
|
1091
|
-
delete: (id: string, auditMessage?: string) => Promise<void>;
|
|
1092
|
-
/**
|
|
1093
|
-
* Replace all metadata of an entity. Keys left out of the new map are removed.
|
|
1094
|
-
* @param {string} id - The entity's ID
|
|
1095
|
-
* @param {object} body - The new metadata map
|
|
1096
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
1097
|
-
* @returns {Promise<MetadataRecords[K]>}
|
|
1098
|
-
*/
|
|
1099
|
-
setMetadata: (id: string, body: object, auditMessage?: string) => Promise<VocabLink>;
|
|
1100
|
-
/**
|
|
1101
|
-
* Remove all metadata from an entity.
|
|
1102
|
-
* @param {string} id - The entity's ID
|
|
1103
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
1104
|
-
* @returns {Promise<MetadataRecords[K]>}
|
|
1105
|
-
*/
|
|
1106
|
-
deleteMetadata: (id: string, auditMessage?: string) => Promise<VocabLink>;
|
|
1107
|
-
/**
|
|
1108
|
-
* Edit an entity's metadata with a list of ops applied in order, in one operation. `{op: 'set', path, value}` writes value at path, creating missing objects along it; `{op: 'delete', path}` removes the key at path (a no-op when absent). A path is a non-empty array of keys, the first a top-level key. A path through a non-object is refused (400). See metadataOps and applyMetadataOps.
|
|
1109
|
-
* @param {string} id - The entity's ID
|
|
1110
|
-
* @param {MetadataOp[]} body - The metadata ops
|
|
1111
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
1112
|
-
* @returns {Promise<MetadataRecords[K]>}
|
|
1113
|
-
*/
|
|
1114
|
-
patchMetadata: (id: string, body: MetadataOp[], auditMessage?: string) => Promise<VocabLink>;
|
|
1115
|
-
/**
|
|
1116
|
-
* Create a new vocab link between tokens and a vocab item.
|
|
1117
|
-
* @param {string} vocabItem - The vocab item to link
|
|
1118
|
-
* @param {Array} tokens - The tokens to link
|
|
1119
|
-
* @param {any} [metadata] - Metadata for the link. Omit to leave unset; pass null to send JSON null.
|
|
1120
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
1121
|
-
* @param {object} [opts]
|
|
1122
|
-
* @param {string} [opts.id] - The new entity's id, minted by the caller (see uuidv7)
|
|
1123
|
-
* @returns {Promise<Created>}
|
|
1124
|
-
*/
|
|
1125
|
-
create: (vocabItem: string, tokens: any[], metadata?: any, auditMessage?: string, { id }?: {
|
|
1126
|
-
id?: string;
|
|
1127
|
-
}) => Promise<Created>;
|
|
1128
|
-
/**
|
|
1129
|
-
* Create multiple vocab links in a single operation. Entries may
|
|
1130
|
-
* reference different vocab items, but all tokens across the call must
|
|
1131
|
-
* belong to one document.
|
|
1132
|
-
* @param {Array<{vocabItem: string, tokens: string[], metadata?: any}>} body - The vocab links to create
|
|
1133
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
1134
|
-
* @returns {Promise<{ids: string[]}>} The created entity IDs, in input order. (bulkDelete resolves to no value.)
|
|
1135
|
-
*/
|
|
1136
|
-
bulkCreate: (body: Array<{
|
|
1137
|
-
vocabItem: string;
|
|
1138
|
-
tokens: string[];
|
|
1139
|
-
metadata?: any;
|
|
1140
|
-
}>, auditMessage?: string) => Promise<{
|
|
1141
|
-
ids: string[];
|
|
1142
|
-
}>;
|
|
1143
|
-
/**
|
|
1144
|
-
* Delete multiple vocab links in a single operation. Provide an array of IDs.
|
|
1145
|
-
* @param {string[]} body - The vocab link IDs to delete
|
|
1146
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
1147
|
-
* @returns {Promise<void>}
|
|
1148
|
-
*/
|
|
1149
|
-
bulkDelete: (body: string[], auditMessage?: string) => Promise<void>;
|
|
1150
|
-
};
|
|
1151
|
-
vocabLayers: {
|
|
1152
|
-
/**
|
|
1153
|
-
* List all vocab layers accessible to user. Transparently follows
|
|
1154
|
-
* pagination cursors and returns the full flat array.
|
|
1155
|
-
* @returns {Promise<VocabLayer[]>}
|
|
1156
|
-
*/
|
|
1157
|
-
list: () => Promise<VocabLayer[]>;
|
|
1158
|
-
/**
|
|
1159
|
-
* Fetch a single page of vocab layers.
|
|
1160
|
-
* @param {object} [opts]
|
|
1161
|
-
* @param {number} [opts.limit] - Page size (1..1000; server default 100)
|
|
1162
|
-
* @param {string} [opts.cursor] - Opaque cursor from a previous page
|
|
1163
|
-
* @returns {Promise<Page<VocabLayer>>}
|
|
1164
|
-
*/
|
|
1165
|
-
listPage: ({ limit, cursor }?: {
|
|
1166
|
-
limit?: number;
|
|
1167
|
-
cursor?: string;
|
|
1168
|
-
}) => Promise<Page<VocabLayer>>;
|
|
1169
|
-
/**
|
|
1170
|
-
* Async-iterate vocab layers page by page; yields each page's entries array.
|
|
1171
|
-
* @param {object} [opts]
|
|
1172
|
-
* @param {number} [opts.pageSize] - Per-request page size
|
|
1173
|
-
* @returns {AsyncGenerator<VocabLayer[]>}
|
|
1174
|
-
*/
|
|
1175
|
-
iterPages: ({ pageSize }?: {
|
|
1176
|
-
pageSize?: number;
|
|
1177
|
-
}) => AsyncGenerator<VocabLayer[]>;
|
|
1178
|
-
/**
|
|
1179
|
-
* Create a new vocab layer. Note: this also registers the user as a maintainer.
|
|
1180
|
-
* @param {string} name - The name
|
|
1181
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
1182
|
-
* @param {object} [opts]
|
|
1183
|
-
* @param {string} [opts.id] - The new entity's id, minted by the caller (see uuidv7)
|
|
1184
|
-
* @returns {Promise<Created>}
|
|
1185
|
-
*/
|
|
1186
|
-
create: (name: string, auditMessage?: string, { id }?: {
|
|
1187
|
-
id?: string;
|
|
1188
|
-
}) => Promise<Created>;
|
|
1189
|
-
/**
|
|
1190
|
-
* Assign a user as a maintainer for this vocab layer.
|
|
1191
|
-
* @param {string} id - The resource ID
|
|
1192
|
-
* @param {string} userId - The user ID
|
|
1193
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
1194
|
-
* @returns {Promise<void>}
|
|
1195
|
-
*/
|
|
1196
|
-
addMaintainer: (id: string, userId: string, auditMessage?: string) => Promise<void>;
|
|
1197
|
-
/**
|
|
1198
|
-
* Remove a user's maintainer privileges for this vocab layer.
|
|
1199
|
-
* @param {string} id - The resource ID
|
|
1200
|
-
* @param {string} userId - The user ID
|
|
1201
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
1202
|
-
* @returns {Promise<void>}
|
|
1203
|
-
*/
|
|
1204
|
-
removeMaintainer: (id: string, userId: string, auditMessage?: string) => Promise<void>;
|
|
1205
|
-
/**
|
|
1206
|
-
* Set a configuration value in an editor namespace.
|
|
1207
|
-
* @param {string} id - The record's ID
|
|
1208
|
-
* @param {string} namespace - The config namespace
|
|
1209
|
-
* @param {string} configKey - The config key
|
|
1210
|
-
* @param {any} configValue - Configuration value to set
|
|
1211
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
1212
|
-
* @param {{expected?: any}} [options] - `expected`: the value read for this key (null or undefined when it
|
|
1213
|
-
* was absent). The write is then refused with a 409 when the stored value differs. A value the key
|
|
1214
|
-
* already holds is not written and leaves no audit row, so the value read, expecting it, states in a
|
|
1215
|
-
* batch that the key is unchanged.
|
|
1216
|
-
* @returns {Promise<void>}
|
|
1217
|
-
*/
|
|
1218
|
-
setConfig: (id: string, namespace: string, configKey: string, configValue: any, auditMessage?: string, options?: {
|
|
1219
|
-
expected?: any;
|
|
1220
|
-
}) => Promise<void>;
|
|
1221
|
-
/**
|
|
1222
|
-
* Remove a configuration value.
|
|
1223
|
-
* @param {string} id - The record's ID
|
|
1224
|
-
* @param {string} namespace - The config namespace
|
|
1225
|
-
* @param {string} configKey - The config key
|
|
1226
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
1227
|
-
* @param {{expected?: any}} [options] - `expected`, as on setConfig. A key that is absent is not
|
|
1228
|
-
* written, so expecting null states in a batch that it is still absent.
|
|
1229
|
-
* @returns {Promise<void>}
|
|
1230
|
-
*/
|
|
1231
|
-
deleteConfig: (id: string, namespace: string, configKey: string, auditMessage?: string, options?: {
|
|
1232
|
-
expected?: any;
|
|
1233
|
-
}) => Promise<void>;
|
|
1234
|
-
/**
|
|
1235
|
-
* Get a vocab layer by ID. With `asOf`, the vocabulary as it was at that
|
|
1236
|
-
* instant, read from its history: the same shape as the live read, its
|
|
1237
|
-
* entries with `includeItems`. A vocabulary that did not exist then is a
|
|
1238
|
-
* 404, a malformed or pruned time a 400.
|
|
1239
|
-
* @param {string} id - The resource ID
|
|
1240
|
-
* @param {boolean} [includeItems] - Include vocab items
|
|
1241
|
-
* @param {string} [asOf] - The moment to read at (ISO-8601 instant)
|
|
1242
|
-
* @returns {Promise<VocabLayer>}
|
|
1243
|
-
*/
|
|
1244
|
-
get: (id: string, includeItems?: boolean, asOf?: string) => Promise<VocabLayer>;
|
|
1245
|
-
/**
|
|
1246
|
-
* One entry of the vocabulary as it was at `asOf`, also when it has
|
|
1247
|
-
* been deleted since. The same shape as `vocabItems.get`. A 404 when
|
|
1248
|
-
* the entry was not in this vocabulary at that time.
|
|
1249
|
-
* @param {string} id - The vocabulary ID
|
|
1250
|
-
* @param {string} itemId - The entry ID
|
|
1251
|
-
* @param {string} asOf - The moment to read at (ISO-8601 instant)
|
|
1252
|
-
* @returns {Promise<VocabItem>}
|
|
1253
|
-
*/
|
|
1254
|
-
getItemAt: (id: string, itemId: string, asOf: string) => Promise<VocabItem>;
|
|
1255
|
-
/**
|
|
1256
|
-
* Get the audit log of a vocabulary: every change to it or to its
|
|
1257
|
-
* entries, folded into entries as the document log is. Links are not
|
|
1258
|
-
* listed, they belong to the document they annotate. Transparently
|
|
1259
|
-
* follows pagination cursors and returns the full flat array.
|
|
1260
|
-
* @param {string} id - The vocabulary ID
|
|
1261
|
-
* @param {string} [startTime] - Start of time range
|
|
1262
|
-
* @param {string} [endTime] - End of time range
|
|
1263
|
-
* @param {string[]|string} [opTypes] - Only return operations of these
|
|
1264
|
-
* types, spelled as in an entry's `op/type` (e.g.
|
|
1265
|
-
* `['vocab-item/delete', 'vocab-item/restore']`)
|
|
1266
|
-
* @param {string} [itemId] - Only the changes that wrote this one entry,
|
|
1267
|
-
* each with only its operations that did
|
|
1268
|
-
* @param {string[]|string} [kinds] - Only the entries of operations of
|
|
1269
|
-
* these kinds (e.g. `['review', 'guess-adoption']`), each whole
|
|
1270
|
-
* @returns {Promise<AuditEntry[]>}
|
|
1271
|
-
*/
|
|
1272
|
-
audit: (id: string, startTime?: string, endTime?: string, opTypes?: string[] | string, itemId?: string, kinds?: string[] | string) => Promise<AuditEntry[]>;
|
|
1273
|
-
/**
|
|
1274
|
-
* One page of the same log, newest-first with `order: "desc"`. Use this
|
|
1275
|
-
* rather than audit() wherever the caller wants the recent end of a log
|
|
1276
|
-
* that may be long: audit() walks every page before it resolves.
|
|
1277
|
-
* @param {string} id - The vocabulary ID
|
|
1278
|
-
* @param {object} [opts]
|
|
1279
|
-
* @param {string} [opts.startTime] - Only entries at or after this instant
|
|
1280
|
-
* @param {string} [opts.endTime] - Only entries at or before this instant
|
|
1281
|
-
* @param {string[]|string} [opts.opTypes] - Only these op types
|
|
1282
|
-
* @param {OperationKind[]|string} [opts.kinds] - Only the entries of operations of these kinds, each whole
|
|
1283
|
-
* @param {"asc"|"desc"} [opts.order] - "desc" pages newest-first
|
|
1284
|
-
* @param {number} [opts.limit] - Page size (1..1000; server default 100)
|
|
1285
|
-
* @param {string} [opts.cursor] - Opaque cursor from a previous page
|
|
1286
|
-
* @param {number} [opts.opsLimit] - Keep only each entry's oldest N
|
|
1287
|
-
* operations in `ops` (1..1000). `opCount` on every entry says how
|
|
1288
|
-
* many it has
|
|
1289
|
-
* @param {string} [opts.entryId] - Read only this entry, not a page
|
|
1290
|
-
* @param {string} [opts.itemId] - Only the changes that wrote this one
|
|
1291
|
-
* entry, each with only its operations that did
|
|
1292
|
-
* @returns {Promise<Page<AuditEntry>>}
|
|
1293
|
-
*/
|
|
1294
|
-
auditPage: (id: string, { startTime, endTime, opTypes, kinds, order, limit, cursor, opsLimit, entryId, itemId }?: {
|
|
1295
|
-
startTime?: string;
|
|
1296
|
-
endTime?: string;
|
|
1297
|
-
opTypes?: string[] | string;
|
|
1298
|
-
kinds?: OperationKind[] | string;
|
|
1299
|
-
order?: "asc" | "desc";
|
|
1300
|
-
limit?: number;
|
|
1301
|
-
cursor?: string;
|
|
1302
|
-
opsLimit?: number;
|
|
1303
|
-
entryId?: string;
|
|
1304
|
-
itemId?: string;
|
|
1305
|
-
}) => Promise<Page<AuditEntry>>;
|
|
1306
|
-
/**
|
|
1307
|
-
* Put one entry of the vocabulary back as it was at `asOf`, as one
|
|
1308
|
-
* operation. A deleted entry comes back under its original id with its
|
|
1309
|
-
* form and fields, and a living one has its form and fields set back.
|
|
1310
|
-
* Links are not part of an entry: a deleted entry's links come back
|
|
1311
|
-
* through each document's own `documents.restore`. Resolves to
|
|
1312
|
-
* `{inserted, form, metadata, total}`, `total` 0 when nothing changes.
|
|
1313
|
-
* A form set back bumps every linking document, and the new versions
|
|
1314
|
-
* come back in X-Document-Versions (or, past fifty documents,
|
|
1315
|
-
* X-Document-Versions-Omitted), which the client takes up as on any
|
|
1316
|
-
* write. A time when the entry did not exist is a 400. Maintainers of
|
|
1317
|
-
* the vocabulary only.
|
|
1318
|
-
* @param {string} id - The vocabulary ID
|
|
1319
|
-
* @param {string} itemId - The entry ID
|
|
1320
|
-
* @param {string} asOf - The moment to go back to (ISO-8601 instant),
|
|
1321
|
-
* typically a history entry's `endTime`
|
|
1322
|
-
* @param {{dryRun?: boolean}} [options] - `{ dryRun }`: with `dryRun` true nothing
|
|
1323
|
-
* is written and the summary says what would change
|
|
1324
|
-
* @param {string} [auditMessage] - Custom audit message for this operation
|
|
1325
|
-
* @returns {Promise<VocabItemRestoreSummary>}
|
|
1326
|
-
*/
|
|
1327
|
-
restoreItem: (id: string, itemId: string, asOf: string, { dryRun }?: {
|
|
1328
|
-
dryRun?: boolean;
|
|
1329
|
-
}, auditMessage?: string) => Promise<VocabItemRestoreSummary>;
|
|
1330
|
-
/**
|
|
1331
|
-
* Delete a vocab layer.
|
|
1332
|
-
* @param {string} id - The resource ID
|
|
1333
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
1334
|
-
* @returns {Promise<void>}
|
|
1335
|
-
*/
|
|
1336
|
-
delete: (id: string, auditMessage?: string) => Promise<void>;
|
|
1337
|
-
/**
|
|
1338
|
-
* Update a vocab layer's name.
|
|
1339
|
-
* @param {string} id - The resource ID
|
|
1340
|
-
* @param {string} name - The name
|
|
1341
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
1342
|
-
* @returns {Promise<VocabLayer>}
|
|
1343
|
-
*/
|
|
1344
|
-
update: (id: string, name: string, auditMessage?: string) => Promise<VocabLayer>;
|
|
1345
|
-
};
|
|
1346
|
-
relations: {
|
|
1347
|
-
/**
|
|
1348
|
-
* Update the target span of a relation.
|
|
1349
|
-
* @param {string} relationId - The relation ID
|
|
1350
|
-
* @param {string} spanId - The span ID
|
|
1351
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
1352
|
-
* @returns {Promise<Relation>}
|
|
1353
|
-
*/
|
|
1354
|
-
setTarget: (relationId: string, spanId: string, auditMessage?: string) => Promise<Relation>;
|
|
1355
|
-
/**
|
|
1356
|
-
* Get a relation by ID.
|
|
1357
|
-
* @param {string} relationId - The relation ID
|
|
1358
|
-
* @returns {Promise<Relation>}
|
|
1359
|
-
*/
|
|
1360
|
-
get: (relationId: string) => Promise<Relation>;
|
|
1361
|
-
/**
|
|
1362
|
-
* Delete a relation.
|
|
1363
|
-
* @param {string} relationId - The relation ID
|
|
1364
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
1365
|
-
* @returns {Promise<void>}
|
|
1366
|
-
*/
|
|
1367
|
-
delete: (relationId: string, auditMessage?: string) => Promise<void>;
|
|
1368
|
-
/**
|
|
1369
|
-
* Update a relation's value.
|
|
1370
|
-
* @param {string} relationId - The relation ID
|
|
1371
|
-
* @param {any} value - The value
|
|
1372
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
1373
|
-
* @returns {Promise<Relation>}
|
|
1374
|
-
*/
|
|
1375
|
-
update: (relationId: string, value: any, auditMessage?: string) => Promise<Relation>;
|
|
1376
|
-
/**
|
|
1377
|
-
* Update the source span of a relation.
|
|
1378
|
-
* @param {string} relationId - The relation ID
|
|
1379
|
-
* @param {string} spanId - The span ID
|
|
1380
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
1381
|
-
* @returns {Promise<Relation>}
|
|
1382
|
-
*/
|
|
1383
|
-
setSource: (relationId: string, spanId: string, auditMessage?: string) => Promise<Relation>;
|
|
1384
|
-
/**
|
|
1385
|
-
* Create a new relation. A relation is a directed edge between two spans
|
|
1386
|
-
* with a value, useful for expressing phenomena such as syntactic or
|
|
1387
|
-
* semantic relations.
|
|
1388
|
-
* @param {string} relationLayerId - The relation layer ID
|
|
1389
|
-
* @param {string} source - The source span ID
|
|
1390
|
-
* @param {string} target - The target span ID
|
|
1391
|
-
* @param {any} value - The value
|
|
1392
|
-
* @param {any} [metadata] - Metadata map. Omit to leave unset; pass null to send JSON null.
|
|
1393
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
1394
|
-
* @param {object} [opts]
|
|
1395
|
-
* @param {string} [opts.id] - The new entity's id, minted by the caller (see uuidv7)
|
|
1396
|
-
* @returns {Promise<Created>}
|
|
1397
|
-
*/
|
|
1398
|
-
create: (relationLayerId: string, source: string, target: string, value: any, metadata?: any, auditMessage?: string, { id }?: {
|
|
1399
|
-
id?: string;
|
|
1400
|
-
}) => Promise<Created>;
|
|
1401
|
-
/**
|
|
1402
|
-
* Create multiple relations in a single operation.
|
|
1403
|
-
* @param {Array} body - The request body
|
|
1404
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
1405
|
-
* @returns {Promise<{ids: string[]}>} The created entity IDs, in input order. (bulkDelete resolves to no value.)
|
|
1406
|
-
*/
|
|
1407
|
-
bulkCreate: (body: any[], auditMessage?: string) => Promise<{
|
|
1408
|
-
ids: string[];
|
|
1409
|
-
}>;
|
|
1410
|
-
/**
|
|
1411
|
-
* Delete multiple relations in a single operation. Provide an array of IDs.
|
|
1412
|
-
* @param {Array} body - The request body
|
|
1413
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
1414
|
-
* @returns {Promise<void>}
|
|
1415
|
-
*/
|
|
1416
|
-
bulkDelete: (body: any[], auditMessage?: string) => Promise<void>;
|
|
1417
|
-
/**
|
|
1418
|
-
* Update many relations in a single operation: set values and/or patch metadata.
|
|
1419
|
-
* @param {Array} body - Objects of the shape `{id, value?, metadata?}`. `value` is set only when the key is present (null sends JSON null); `metadata` is a list of metadata ops, as for patchMetadata. The relations may lie in several documents of one project; every document touched has its version bumped and every new version comes back in `X-Document-Versions` (past fifty documents, only their number, in `X-Document-Versions-Omitted`). A `document-version` precondition is accepted only when every entry lies in one document. An unknown id refuses the whole update.
|
|
1420
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
1421
|
-
* @returns {Promise<{count: number}>} How many relations were updated.
|
|
1422
|
-
*/
|
|
1423
|
-
bulkUpdate: (body: any[], auditMessage?: string) => Promise<{
|
|
1424
|
-
count: number;
|
|
1425
|
-
}>;
|
|
1426
|
-
/**
|
|
1427
|
-
* Replace all metadata of an entity. Keys left out of the new map are removed.
|
|
1428
|
-
* @param {string} id - The entity's ID
|
|
1429
|
-
* @param {object} body - The new metadata map
|
|
1430
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
1431
|
-
* @returns {Promise<MetadataRecords[K]>}
|
|
1432
|
-
*/
|
|
1433
|
-
setMetadata: (id: string, body: object, auditMessage?: string) => Promise<Relation>;
|
|
1434
|
-
/**
|
|
1435
|
-
* Remove all metadata from an entity.
|
|
1436
|
-
* @param {string} id - The entity's ID
|
|
1437
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
1438
|
-
* @returns {Promise<MetadataRecords[K]>}
|
|
1439
|
-
*/
|
|
1440
|
-
deleteMetadata: (id: string, auditMessage?: string) => Promise<Relation>;
|
|
1441
|
-
/**
|
|
1442
|
-
* Edit an entity's metadata with a list of ops applied in order, in one operation. `{op: 'set', path, value}` writes value at path, creating missing objects along it; `{op: 'delete', path}` removes the key at path (a no-op when absent). A path is a non-empty array of keys, the first a top-level key. A path through a non-object is refused (400). See metadataOps and applyMetadataOps.
|
|
1443
|
-
* @param {string} id - The entity's ID
|
|
1444
|
-
* @param {MetadataOp[]} body - The metadata ops
|
|
1445
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
1446
|
-
* @returns {Promise<MetadataRecords[K]>}
|
|
1447
|
-
*/
|
|
1448
|
-
patchMetadata: (id: string, body: MetadataOp[], auditMessage?: string) => Promise<Relation>;
|
|
1449
|
-
};
|
|
1450
|
-
spanLayers: {
|
|
1451
|
-
/**
|
|
1452
|
-
* Create a new span layer.
|
|
1453
|
-
* @param {string} tokenLayerId - The token layer ID
|
|
1454
|
-
* @param {string} name - The name
|
|
1455
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
1456
|
-
* @param {object} [opts]
|
|
1457
|
-
* @param {string} [opts.id] - The new entity's id, minted by the caller (see uuidv7)
|
|
1458
|
-
* @returns {Promise<Created>}
|
|
1459
|
-
*/
|
|
1460
|
-
create: (tokenLayerId: string, name: string, auditMessage?: string, { id }?: {
|
|
1461
|
-
id?: string;
|
|
1462
|
-
}) => Promise<Created>;
|
|
1463
|
-
/**
|
|
1464
|
-
* Get a layer by ID.
|
|
1465
|
-
* @param {string} layerId - The layer ID
|
|
1466
|
-
* @returns {Promise<LayerRecords[K]>}
|
|
1467
|
-
*/
|
|
1468
|
-
get: (layerId: string) => Promise<SpanLayer>;
|
|
1469
|
-
/**
|
|
1470
|
-
* Delete a layer.
|
|
1471
|
-
* @param {string} layerId - The layer ID
|
|
1472
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
1473
|
-
* @returns {Promise<void>}
|
|
1474
|
-
*/
|
|
1475
|
-
delete: (layerId: string, auditMessage?: string) => Promise<void>;
|
|
1476
|
-
/**
|
|
1477
|
-
* Rename a layer.
|
|
1478
|
-
* @param {string} layerId - The layer ID
|
|
1479
|
-
* @param {string} name - The new name
|
|
1480
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
1481
|
-
* @returns {Promise<LayerRecords[K]>}
|
|
1482
|
-
*/
|
|
1483
|
-
update: (layerId: string, name: string, auditMessage?: string) => Promise<SpanLayer>;
|
|
1484
|
-
/**
|
|
1485
|
-
* Move a layer one place in its display order.
|
|
1486
|
-
* @param {string} layerId - The layer ID
|
|
1487
|
-
* @param {string} direction - The direction ("up" or "down")
|
|
1488
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
1489
|
-
* @returns {Promise<void>}
|
|
1490
|
-
*/
|
|
1491
|
-
shift: (layerId: string, direction: string, auditMessage?: string) => Promise<void>;
|
|
1492
|
-
/**
|
|
1493
|
-
* The stored values of this layer that a value-set rule would refuse,
|
|
1494
|
-
* before it is declared: exactly what a declaration of it would meet,
|
|
1495
|
-
* with the rule's exemptions (an unconfirmed machine value, a value an
|
|
1496
|
-
* import, a document copy or a restore set). Writes nothing, and a
|
|
1497
|
-
* reader may ask.
|
|
1498
|
-
* @param {string} layerId - The layer ID
|
|
1499
|
-
* @param {ValueSetRule} rule - The list as a value-set declaration takes it
|
|
1500
|
-
* @param {{limit?: number}} [options] - `limit`: how many values to list, the most frequent first
|
|
1501
|
-
* (default 20, at most 100)
|
|
1502
|
-
* @returns {Promise<RefusedValues>}
|
|
1503
|
-
*/
|
|
1504
|
-
refusedValues: (layerId: string, rule: ValueSetRule, options?: {
|
|
1505
|
-
limit?: number;
|
|
1506
|
-
}) => Promise<RefusedValues>;
|
|
1507
|
-
/**
|
|
1508
|
-
* Declare an app namespace's constraints on this layer, replacing that
|
|
1509
|
-
* namespace's list. Refused with 422 and the violations when the layer's
|
|
1510
|
-
* stored data breaks them (see violationsOf).
|
|
1511
|
-
* @param {string} layerId - The layer ID
|
|
1512
|
-
* @param {string} namespace - The declaring app's namespace, e.g. "igt"
|
|
1513
|
-
* @param {LayerConstraint[]} constraints - e.g. [{type: "single-span"}, {type: "value-set", values: ["N"]}]
|
|
1514
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
1515
|
-
* @param {{expected?: Array<object>|null}} [options] - `expected`: the list read for this
|
|
1516
|
-
* namespace (null when it was absent). The write is then refused with a 409 when the stored
|
|
1517
|
-
* list differs.
|
|
1518
|
-
* @returns {Promise<{constraints: Record<string, LayerConstraint[]>}>} the layer's whole constraint map
|
|
1519
|
-
*/
|
|
1520
|
-
setConstraints: (layerId: string, namespace: string, constraints: LayerConstraint[], auditMessage?: string, options?: {
|
|
1521
|
-
expected?: Array<object> | null;
|
|
1522
|
-
}) => Promise<{
|
|
1523
|
-
constraints: Record<string, LayerConstraint[]>;
|
|
1524
|
-
}>;
|
|
1525
|
-
/**
|
|
1526
|
-
* Remove an app namespace's constraints from this layer.
|
|
1527
|
-
* @param {string} layerId - The layer ID
|
|
1528
|
-
* @param {string} namespace - The declaring app's namespace
|
|
1529
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
1530
|
-
* @param {{expected?: Array<object>|null}} [options] - `expected`, as on setConstraints.
|
|
1531
|
-
* @returns {Promise<void>}
|
|
1532
|
-
*/
|
|
1533
|
-
deleteConstraints: (layerId: string, namespace: string, auditMessage?: string, options?: {
|
|
1534
|
-
expected?: Array<object> | null;
|
|
1535
|
-
}) => Promise<void>;
|
|
1536
|
-
/**
|
|
1537
|
-
* The violations the given constraints would meet in this layer's stored
|
|
1538
|
-
* data. Writes nothing.
|
|
1539
|
-
* @param {string} layerId - The layer ID
|
|
1540
|
-
* @param {LayerConstraint[]} constraints - The list to check
|
|
1541
|
-
* @param {{limit?: number}} [options] - `limit`: how many violations to list (default 100)
|
|
1542
|
-
* @returns {Promise<{violations: ConstraintViolation[], violationCount: number}>}
|
|
1543
|
-
*/
|
|
1544
|
-
checkConstraints: (layerId: string, constraints: LayerConstraint[], options?: {
|
|
1545
|
-
limit?: number;
|
|
1546
|
-
}) => Promise<{
|
|
1547
|
-
violations: ConstraintViolation[];
|
|
1548
|
-
violationCount: number;
|
|
1549
|
-
}>;
|
|
1550
|
-
/**
|
|
1551
|
-
* Apply the remedies of the given constraints' remediable types
|
|
1552
|
-
* (coextensive, single-span, single-link, same-ancestor) to every
|
|
1553
|
-
* violation in this layer's stored data, one operation per document.
|
|
1554
|
-
* With `document`, only that document is repaired, and a writer may
|
|
1555
|
-
* ask. A document another user holds the lock on is left as it is and
|
|
1556
|
-
* listed under `locked`.
|
|
1557
|
-
* @param {string} layerId - The layer ID
|
|
1558
|
-
* @param {LayerConstraint[]} constraints - The list to repair for
|
|
1559
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
1560
|
-
* @param {{document?: string}} [options]
|
|
1561
|
-
* @returns {Promise<{repaired: ConstraintRepair[], locked: Array<{document: string, lockedBy: string}>, violations: ConstraintViolation[], violationCount: number}>}
|
|
1562
|
-
*/
|
|
1563
|
-
repairConstraints: (layerId: string, constraints: LayerConstraint[], auditMessage?: string, options?: {
|
|
1564
|
-
document?: string;
|
|
1565
|
-
}) => Promise<{
|
|
1566
|
-
repaired: ConstraintRepair[];
|
|
1567
|
-
locked: Array<{
|
|
1568
|
-
document: string;
|
|
1569
|
-
lockedBy: string;
|
|
1570
|
-
}>;
|
|
1571
|
-
violations: ConstraintViolation[];
|
|
1572
|
-
violationCount: number;
|
|
1573
|
-
}>;
|
|
1574
|
-
/**
|
|
1575
|
-
* Set a configuration value in an editor namespace.
|
|
1576
|
-
* @param {string} id - The record's ID
|
|
1577
|
-
* @param {string} namespace - The config namespace
|
|
1578
|
-
* @param {string} configKey - The config key
|
|
1579
|
-
* @param {any} configValue - Configuration value to set
|
|
1580
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
1581
|
-
* @param {{expected?: any}} [options] - `expected`: the value read for this key (null or undefined when it
|
|
1582
|
-
* was absent). The write is then refused with a 409 when the stored value differs. A value the key
|
|
1583
|
-
* already holds is not written and leaves no audit row, so the value read, expecting it, states in a
|
|
1584
|
-
* batch that the key is unchanged.
|
|
1585
|
-
* @returns {Promise<void>}
|
|
1586
|
-
*/
|
|
1587
|
-
setConfig: (id: string, namespace: string, configKey: string, configValue: any, auditMessage?: string, options?: {
|
|
1588
|
-
expected?: any;
|
|
1589
|
-
}) => Promise<void>;
|
|
1590
|
-
/**
|
|
1591
|
-
* Remove a configuration value.
|
|
1592
|
-
* @param {string} id - The record's ID
|
|
1593
|
-
* @param {string} namespace - The config namespace
|
|
1594
|
-
* @param {string} configKey - The config key
|
|
1595
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
1596
|
-
* @param {{expected?: any}} [options] - `expected`, as on setConfig. A key that is absent is not
|
|
1597
|
-
* written, so expecting null states in a batch that it is still absent.
|
|
1598
|
-
* @returns {Promise<void>}
|
|
1599
|
-
*/
|
|
1600
|
-
deleteConfig: (id: string, namespace: string, configKey: string, auditMessage?: string, options?: {
|
|
1601
|
-
expected?: any;
|
|
1602
|
-
}) => Promise<void>;
|
|
1603
|
-
};
|
|
1604
|
-
spans: {
|
|
1605
|
-
/**
|
|
1606
|
-
* Replace all metadata of an entity. Keys left out of the new map are removed.
|
|
1607
|
-
* @param {string} id - The entity's ID
|
|
1608
|
-
* @param {object} body - The new metadata map
|
|
1609
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
1610
|
-
* @returns {Promise<MetadataRecords[K]>}
|
|
1611
|
-
*/
|
|
1612
|
-
setMetadata: (id: string, body: object, auditMessage?: string) => Promise<Span>;
|
|
1613
|
-
/**
|
|
1614
|
-
* Remove all metadata from an entity.
|
|
1615
|
-
* @param {string} id - The entity's ID
|
|
1616
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
1617
|
-
* @returns {Promise<MetadataRecords[K]>}
|
|
1618
|
-
*/
|
|
1619
|
-
deleteMetadata: (id: string, auditMessage?: string) => Promise<Span>;
|
|
1620
|
-
/**
|
|
1621
|
-
* Edit an entity's metadata with a list of ops applied in order, in one operation. `{op: 'set', path, value}` writes value at path, creating missing objects along it; `{op: 'delete', path}` removes the key at path (a no-op when absent). A path is a non-empty array of keys, the first a top-level key. A path through a non-object is refused (400). See metadataOps and applyMetadataOps.
|
|
1622
|
-
* @param {string} id - The entity's ID
|
|
1623
|
-
* @param {MetadataOp[]} body - The metadata ops
|
|
1624
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
1625
|
-
* @returns {Promise<MetadataRecords[K]>}
|
|
1626
|
-
*/
|
|
1627
|
-
patchMetadata: (id: string, body: MetadataOp[], auditMessage?: string) => Promise<Span>;
|
|
1628
|
-
/**
|
|
1629
|
-
* Replace tokens for a span.
|
|
1630
|
-
* @param {string} spanId - The span ID
|
|
1631
|
-
* @param {Array} tokens - The tokens
|
|
1632
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
1633
|
-
* @returns {Promise<Span>}
|
|
1634
|
-
*/
|
|
1635
|
-
setTokens: (spanId: string, tokens: any[], auditMessage?: string) => Promise<Span>;
|
|
1636
|
-
/**
|
|
1637
|
-
* Create a new span. A span holds a primary atomic value and optional
|
|
1638
|
-
* metadata, and must at all times be associated with one or more tokens.
|
|
1639
|
-
* @param {string} spanLayerId - The span layer ID
|
|
1640
|
-
* @param {Array} tokens - The tokens
|
|
1641
|
-
* @param {any} value - The value
|
|
1642
|
-
* @param {any} [metadata] - Metadata map. Omit to leave unset; pass null to send JSON null.
|
|
1643
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
1644
|
-
* @param {object} [opts]
|
|
1645
|
-
* @param {string} [opts.id] - The new entity's id, minted by the caller (see uuidv7)
|
|
1646
|
-
* @returns {Promise<Created>}
|
|
1647
|
-
*/
|
|
1648
|
-
create: (spanLayerId: string, tokens: any[], value: any, metadata?: any, auditMessage?: string, { id }?: {
|
|
1649
|
-
id?: string;
|
|
1650
|
-
}) => Promise<Created>;
|
|
1651
|
-
/**
|
|
1652
|
-
* Get a span by ID.
|
|
1653
|
-
* @param {string} spanId - The span ID
|
|
1654
|
-
* @returns {Promise<Span>}
|
|
1655
|
-
*/
|
|
1656
|
-
get: (spanId: string) => Promise<Span>;
|
|
1657
|
-
/**
|
|
1658
|
-
* Delete a span.
|
|
1659
|
-
* @param {string} spanId - The span ID
|
|
1660
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
1661
|
-
* @returns {Promise<void>}
|
|
1662
|
-
*/
|
|
1663
|
-
delete: (spanId: string, auditMessage?: string) => Promise<void>;
|
|
1664
|
-
/**
|
|
1665
|
-
* Update a span's value.
|
|
1666
|
-
* @param {string} spanId - The span ID
|
|
1667
|
-
* @param {any} value - The value
|
|
1668
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
1669
|
-
* @returns {Promise<Span>}
|
|
1670
|
-
*/
|
|
1671
|
-
update: (spanId: string, value: any, auditMessage?: string) => Promise<Span>;
|
|
1672
|
-
/**
|
|
1673
|
-
* Create multiple spans in a single operation.
|
|
1674
|
-
* @param {Array} body - The request body
|
|
1675
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
1676
|
-
* @returns {Promise<{ids: string[]}>} The created entity IDs, in input order. (bulkDelete resolves to no value.)
|
|
1677
|
-
*/
|
|
1678
|
-
bulkCreate: (body: any[], auditMessage?: string) => Promise<{
|
|
1679
|
-
ids: string[];
|
|
1680
|
-
}>;
|
|
1681
|
-
/**
|
|
1682
|
-
* Delete multiple spans in a single operation. Provide an array of IDs.
|
|
1683
|
-
* @param {Array} body - The request body
|
|
1684
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
1685
|
-
* @returns {Promise<void>}
|
|
1686
|
-
*/
|
|
1687
|
-
bulkDelete: (body: any[], auditMessage?: string) => Promise<void>;
|
|
1688
|
-
/**
|
|
1689
|
-
* Update many spans in a single operation: set values and/or patch metadata.
|
|
1690
|
-
* @param {Array} body - Objects of the shape `{id, value?, metadata?}`. `value` is set only when the key is present (null sends JSON null); `metadata` is a list of metadata ops, as for patchMetadata. The spans may lie in several documents of one project; every document touched has its version bumped and every new version comes back in `X-Document-Versions` (past fifty documents, only their number, in `X-Document-Versions-Omitted`). A `document-version` precondition is accepted only when every entry lies in one document. An unknown id refuses the whole update.
|
|
1691
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
1692
|
-
* @returns {Promise<{count: number}>} How many spans were updated.
|
|
1693
|
-
*/
|
|
1694
|
-
bulkUpdate: (body: any[], auditMessage?: string) => Promise<{
|
|
1695
|
-
count: number;
|
|
1696
|
-
}>;
|
|
1697
|
-
};
|
|
1698
|
-
server: {
|
|
1699
|
-
/**
|
|
1700
|
-
* This server's version and the limits it enforces, e.g.
|
|
1701
|
-
* `{ limits: { mediaFileBytes, jsonBodyBytes, batchOperations, … } }`.
|
|
1702
|
-
* Sizes are in bytes. Unauthenticated.
|
|
1703
|
-
* @returns {Promise<{limits: ServerLimits}>}
|
|
1704
|
-
*/
|
|
1705
|
-
info: () => Promise<{
|
|
1706
|
-
limits: ServerLimits;
|
|
1707
|
-
}>;
|
|
1708
|
-
/**
|
|
1709
|
-
* Read `GET /info` again and resolve to it. Until it answers, a reader
|
|
1710
|
-
* waits for it. The facts known before are kept when the server does
|
|
1711
|
-
* not answer, and the error is thrown.
|
|
1712
|
-
* @returns {Promise<{limits: ServerLimits}>}
|
|
1713
|
-
*/
|
|
1714
|
-
refresh: () => Promise<{
|
|
1715
|
-
limits: ServerLimits;
|
|
1716
|
-
}>;
|
|
1717
|
-
/**
|
|
1718
|
-
* Just the limits, which is what a caller almost always wants.
|
|
1719
|
-
* @returns {Promise<ServerLimits>}
|
|
1720
|
-
*/
|
|
1721
|
-
limits: () => Promise<ServerLimits>;
|
|
1722
|
-
/**
|
|
1723
|
-
* Liveness, version and database size. Unauthenticated, and served
|
|
1724
|
-
* outside the REST router at /health, so it answers even while the API
|
|
1725
|
-
* is refusing requests. Never cached — the point is that it is current.
|
|
1726
|
-
* @returns {Promise<ServerHealth>}
|
|
1727
|
-
*/
|
|
1728
|
-
health: () => Promise<ServerHealth>;
|
|
1729
|
-
};
|
|
1730
|
-
auth: {
|
|
1731
|
-
/**
|
|
1732
|
-
* End every sign-in of this user on every device: each browser tab,
|
|
1733
|
-
* script and service holding one of the user's sign-in tokens is
|
|
1734
|
-
* refused from now on, this client included. Named API tokens are not
|
|
1735
|
-
* affected (revoke one with `apiTokens.revoke`). To sign out of one tab
|
|
1736
|
-
* only, discard its token instead. A signal rather than project data:
|
|
1737
|
-
* made on a batch it still goes out at once, and it never joins an
|
|
1738
|
-
* operation.
|
|
1739
|
-
* @returns {Promise<void>}
|
|
1740
|
-
*/
|
|
1741
|
-
logoutEverywhere: () => Promise<void>;
|
|
1742
|
-
};
|
|
1743
|
-
texts: {
|
|
1744
|
-
/**
|
|
1745
|
-
* Create a new text in a document's text layer. A text is a container for
|
|
1746
|
-
* one long string in `body` for a given layer.
|
|
1747
|
-
* @param {string} textLayerId - The text layer ID
|
|
1748
|
-
* @param {string} documentId - The document ID
|
|
1749
|
-
* @param {string} body - The request body
|
|
1750
|
-
* @param {any} [metadata] - Metadata map. Omit to leave unset; pass null to send JSON null.
|
|
1751
|
-
* @param {string} [auditMessage]
|
|
1752
|
-
* @param {{id?: string, tokenEdges?: number[], tokenizeLayer?: string}} [options] - `id`: the
|
|
1753
|
-
* new text's id, a UUIDv7 this client minted. `tokenEdges`: the code-point offsets where
|
|
1754
|
-
* the tokens made next on this text begin and end. The body is stored composed, except a
|
|
1755
|
-
* character one of them falls inside, which stays as sent (see composeText).
|
|
1756
|
-
* `tokenizeLayer`: a word layer of the text, which gets the body's words, cut by the
|
|
1757
|
-
* server ("Tokenize new text").
|
|
1758
|
-
* @returns {Promise<Created>}
|
|
1759
|
-
*/
|
|
1760
|
-
create: (textLayerId: string, documentId: string, body: string, metadata?: any, auditMessage?: string, { id, tokenEdges, tokenizeLayer }?: {
|
|
1761
|
-
id?: string;
|
|
1762
|
-
tokenEdges?: number[];
|
|
1763
|
-
tokenizeLayer?: string;
|
|
1764
|
-
}) => Promise<Created>;
|
|
1765
|
-
/**
|
|
1766
|
-
* Get a text.
|
|
1767
|
-
* @param {string} textId - The text ID
|
|
1768
|
-
* @returns {Promise<PlaidText>}
|
|
1769
|
-
*/
|
|
1770
|
-
get: (textId: string) => Promise<PlaidText>;
|
|
1771
|
-
/**
|
|
1772
|
-
* Delete a text and all dependent data.
|
|
1773
|
-
* @param {string} textId - The text ID
|
|
1774
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
1775
|
-
* @returns {Promise<void>}
|
|
1776
|
-
*/
|
|
1777
|
-
delete: (textId: string, auditMessage?: string) => Promise<void>;
|
|
1778
|
-
/**
|
|
1779
|
-
* Update a text's body. A diff is computed and token indices are updated
|
|
1780
|
-
* so that tokens remain intact. Alternatively, `body` can be a list of
|
|
1781
|
-
* edit directives (code-point indices, applied in order):
|
|
1782
|
-
* {type: 'delete', index, value: count}
|
|
1783
|
-
* {type: 'insert', index, value: string}
|
|
1784
|
-
* {type: 'replace', index, length, value: string} — unlike
|
|
1785
|
-
* delete+insert, a token covering the whole range is resized to keep
|
|
1786
|
-
* it (respell a word in place without losing its annotations).
|
|
1787
|
-
* A list is applied exactly as sent. With `base` (the `digest` of the
|
|
1788
|
-
* body the update was made on, as every read of a text gives it) the
|
|
1789
|
-
* update applies only to that body, and is refused with 409 and
|
|
1790
|
-
* `text-changed` otherwise. Strict mode then does not stamp it, unless
|
|
1791
|
-
* `versioned` is true (a batch whose later writes are stamped needs its
|
|
1792
|
-
* first write stamped too).
|
|
1793
|
-
* @param {string} textId - The text ID
|
|
1794
|
-
* @param {any} body - The request body
|
|
1795
|
-
* @param {string} [auditMessage]
|
|
1796
|
-
* `tokenizeLayer`: a word layer of the text, whose words the server makes for the text the
|
|
1797
|
-
* update types, after it places the old tokens ("Tokenize new text"). They come in the
|
|
1798
|
-
* answer's `reshape`.
|
|
1799
|
-
* @param {{base?: string, versioned?: boolean, tokenizeLayer?: string}} [options]
|
|
1800
|
-
* @returns {Promise<PlaidText & {reshape: TextReshape}>}
|
|
1801
|
-
*/
|
|
1802
|
-
update: (textId: string, body: any, auditMessage?: string, { base, versioned, tokenizeLayer }?: {
|
|
1803
|
-
base?: string;
|
|
1804
|
-
versioned?: boolean;
|
|
1805
|
-
tokenizeLayer?: string;
|
|
1806
|
-
}) => Promise<PlaidText & {
|
|
1807
|
-
reshape: TextReshape;
|
|
1808
|
-
}>;
|
|
1809
|
-
/**
|
|
1810
|
-
* Change a text's body by the edits made at the caret: a list of edit
|
|
1811
|
-
* directives as `update` takes them (code-point indices, applied in
|
|
1812
|
-
* order, each index in the body the ones before it left). Only their
|
|
1813
|
-
* net change counts. An insert or a delete stays where it was made, and
|
|
1814
|
-
* a stretch deleted and typed over is read as a whole new body is. The
|
|
1815
|
-
* answer is the text with its new `digest` and `reshape` (the tokens
|
|
1816
|
-
* moved, the spans and vocab links trimmed, the rows deleted). With
|
|
1817
|
-
* `base`, the digest of the body the edits were made on, the edit
|
|
1818
|
-
* applies only to that body and is refused with 409 and `text-changed`
|
|
1819
|
-
* otherwise, and strict mode does not stamp it unless `versioned` is
|
|
1820
|
-
* true. `tokenizeLayer` is as `update` takes it. See composeTextEdits and gapsToOps.
|
|
1821
|
-
* @param {string} textId - The text ID
|
|
1822
|
-
* @param {Array<object>} edits - The edit directives
|
|
1823
|
-
* @param {string} [auditMessage]
|
|
1824
|
-
* @param {{base?: string, versioned?: boolean, tokenizeLayer?: string}} [options]
|
|
1825
|
-
* @returns {Promise<PlaidText & {reshape: TextReshape}>}
|
|
1826
|
-
*/
|
|
1827
|
-
edit: (textId: string, edits: Array<object>, auditMessage?: string, { base, versioned, tokenizeLayer }?: {
|
|
1828
|
-
base?: string;
|
|
1829
|
-
versioned?: boolean;
|
|
1830
|
-
tokenizeLayer?: string;
|
|
1831
|
-
}) => Promise<PlaidText & {
|
|
1832
|
-
reshape: TextReshape;
|
|
1833
|
-
}>;
|
|
1834
|
-
/**
|
|
1835
|
-
* Replace all metadata of an entity. Keys left out of the new map are removed.
|
|
1836
|
-
* @param {string} id - The entity's ID
|
|
1837
|
-
* @param {object} body - The new metadata map
|
|
1838
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
1839
|
-
* @returns {Promise<MetadataRecords[K]>}
|
|
1840
|
-
*/
|
|
1841
|
-
setMetadata: (id: string, body: object, auditMessage?: string) => Promise<PlaidText>;
|
|
1842
|
-
/**
|
|
1843
|
-
* Remove all metadata from an entity.
|
|
1844
|
-
* @param {string} id - The entity's ID
|
|
1845
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
1846
|
-
* @returns {Promise<MetadataRecords[K]>}
|
|
1847
|
-
*/
|
|
1848
|
-
deleteMetadata: (id: string, auditMessage?: string) => Promise<PlaidText>;
|
|
1849
|
-
/**
|
|
1850
|
-
* Edit an entity's metadata with a list of ops applied in order, in one operation. `{op: 'set', path, value}` writes value at path, creating missing objects along it; `{op: 'delete', path}` removes the key at path (a no-op when absent). A path is a non-empty array of keys, the first a top-level key. A path through a non-object is refused (400). See metadataOps and applyMetadataOps.
|
|
1851
|
-
* @param {string} id - The entity's ID
|
|
1852
|
-
* @param {MetadataOp[]} body - The metadata ops
|
|
1853
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
1854
|
-
* @returns {Promise<MetadataRecords[K]>}
|
|
1855
|
-
*/
|
|
1856
|
-
patchMetadata: (id: string, body: MetadataOp[], auditMessage?: string) => Promise<PlaidText>;
|
|
1857
|
-
};
|
|
1858
|
-
users: {
|
|
1859
|
-
/**
|
|
1860
|
-
* List (or search) users. Transparently follows pagination cursors and
|
|
1861
|
-
* returns the full flat array. Admin-or-maintainer only.
|
|
1862
|
-
* @param {object} [opts]
|
|
1863
|
-
* @param {string} [opts.q] - Filter to users whose display name contains this text, or whose email starts with it (contains it, when the text holds an at sign), case-insensitive
|
|
1864
|
-
* @returns {Promise<User[]>}
|
|
1865
|
-
*/
|
|
1866
|
-
list: ({ q }?: {
|
|
1867
|
-
q?: string;
|
|
1868
|
-
}) => Promise<User[]>;
|
|
1869
|
-
/**
|
|
1870
|
-
* Fetch a single page of users (optionally filtered by `q`).
|
|
1871
|
-
* @param {object} [opts]
|
|
1872
|
-
* @param {string} [opts.q] - Filter to users whose display name contains this text, or whose email starts with it (contains it, when the text holds an at sign), case-insensitive
|
|
1873
|
-
* @param {number} [opts.limit] - Page size (1..1000; server default 100)
|
|
1874
|
-
* @param {string} [opts.cursor] - Opaque cursor from a previous page
|
|
1875
|
-
* @returns {Promise<Page<User>>}
|
|
1876
|
-
*/
|
|
1877
|
-
listPage: ({ q, limit, cursor }?: {
|
|
1878
|
-
q?: string;
|
|
1879
|
-
limit?: number;
|
|
1880
|
-
cursor?: string;
|
|
1881
|
-
}) => Promise<Page<User>>;
|
|
1882
|
-
/**
|
|
1883
|
-
* Async-iterate users page by page; yields each page's entries array.
|
|
1884
|
-
* @param {object} [opts]
|
|
1885
|
-
* @param {string} [opts.q] - Filter to users whose display name contains this text, or whose email starts with it (contains it, when the text holds an at sign), case-insensitive
|
|
1886
|
-
* @param {number} [opts.pageSize] - Per-request page size
|
|
1887
|
-
* @returns {AsyncGenerator<User[]>}
|
|
1888
|
-
*/
|
|
1889
|
-
iterPages: ({ q, pageSize }?: {
|
|
1890
|
-
q?: string;
|
|
1891
|
-
pageSize?: number;
|
|
1892
|
-
}) => AsyncGenerator<User[]>;
|
|
1893
|
-
/**
|
|
1894
|
-
* Create a new user. Admin only, and not with a named API token (403):
|
|
1895
|
-
* it needs a sign-in token.
|
|
1896
|
-
* @param {string} email - The account's email address. It becomes the
|
|
1897
|
-
* user's id and is what they log in with; it can never be changed.
|
|
1898
|
-
* @param {string} password - The password
|
|
1899
|
-
* @param {boolean} isAdmin - Whether the user is an admin
|
|
1900
|
-
* @param {string} [displayName] - How the user is shown in the UI.
|
|
1901
|
-
* Defaults to the local part of the email.
|
|
1902
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
1903
|
-
* @returns {Promise<Created>}
|
|
1904
|
-
*/
|
|
1905
|
-
create: (email: string, password: string, isAdmin: boolean, displayName?: string, auditMessage?: string) => Promise<Created>;
|
|
1906
|
-
/**
|
|
1907
|
-
* Get audit log for a user's actions. Transparently follows pagination
|
|
1908
|
-
* cursors and returns the full flat array.
|
|
1909
|
-
* @param {string} userId - The user ID
|
|
1910
|
-
* @param {string} [startTime] - Start of time range
|
|
1911
|
-
* @param {string} [endTime] - End of time range
|
|
1912
|
-
* @param {string[]|string} [opTypes] - Only return operations of these
|
|
1913
|
-
* types, spelled as in an entry's `op/type` (e.g.
|
|
1914
|
-
* `['span-layer/create', 'span-layer/delete']`). An entry appears when
|
|
1915
|
-
* one of its operations matches, carrying only the ones that did.
|
|
1916
|
-
* @param {string[]|string} [kinds] - Only the entries of operations of
|
|
1917
|
-
* these kinds (e.g. `['review', 'guess-adoption']`), each whole
|
|
1918
|
-
* @returns {Promise<AuditEntry[]>}
|
|
1919
|
-
*/
|
|
1920
|
-
audit: (userId: string, startTime?: string, endTime?: string, opTypes?: string[] | string, kinds?: string[] | string) => Promise<AuditEntry[]>;
|
|
1921
|
-
/**
|
|
1922
|
-
* One page of the same log, newest-first with `order: "desc"`. Use this
|
|
1923
|
-
* rather than audit() wherever the caller wants the recent end of a log
|
|
1924
|
-
* that may be long: audit() walks every page before it resolves.
|
|
1925
|
-
* @param {string} userId - The user ID
|
|
1926
|
-
* @param {object} [opts]
|
|
1927
|
-
* @param {string} [opts.startTime] - Only entries at or after this instant
|
|
1928
|
-
* @param {string} [opts.endTime] - Only entries at or before this instant
|
|
1929
|
-
* @param {string[]|string} [opts.opTypes] - Only these op types
|
|
1930
|
-
* @param {OperationKind[]|string} [opts.kinds] - Only the entries of operations of these kinds, each whole
|
|
1931
|
-
* @param {"asc"|"desc"} [opts.order] - "desc" pages newest-first
|
|
1932
|
-
* @param {number} [opts.limit] - Page size (1..1000; server default 100)
|
|
1933
|
-
* @param {string} [opts.cursor] - Opaque cursor from a previous page
|
|
1934
|
-
* @param {number} [opts.opsLimit] - Keep only each entry's oldest N
|
|
1935
|
-
* operations in `ops` (1..1000). `opCount` on every entry says how
|
|
1936
|
-
* many it has
|
|
1937
|
-
* @param {string} [opts.entryId] - Read only this entry, not a page
|
|
1938
|
-
* @returns {Promise<Page<AuditEntry>>}
|
|
1939
|
-
*/
|
|
1940
|
-
auditPage: (userId: string, { startTime, endTime, opTypes, kinds, order, limit, cursor, opsLimit, entryId }?: {
|
|
1941
|
-
startTime?: string;
|
|
1942
|
-
endTime?: string;
|
|
1943
|
-
opTypes?: string[] | string;
|
|
1944
|
-
kinds?: OperationKind[] | string;
|
|
1945
|
-
order?: "asc" | "desc";
|
|
1946
|
-
limit?: number;
|
|
1947
|
-
cursor?: string;
|
|
1948
|
-
opsLimit?: number;
|
|
1949
|
-
entryId?: string;
|
|
1950
|
-
}) => Promise<Page<AuditEntry>>;
|
|
1951
|
-
/**
|
|
1952
|
-
* Get a user by ID
|
|
1953
|
-
* @param {string} id - The resource ID
|
|
1954
|
-
* @returns {Promise<User>}
|
|
1955
|
-
*/
|
|
1956
|
-
get: (id: string) => Promise<User>;
|
|
1957
|
-
/**
|
|
1958
|
-
* Deactivate a user. Users are never hard-deleted: deactivation
|
|
1959
|
-
* rejects their logins and tokens, strips their project memberships
|
|
1960
|
-
* and vocab maintainerships, and revokes their API tokens. The user
|
|
1961
|
-
* stays visible in listings with a deactivated-at timestamp.
|
|
1962
|
-
* Reversible via activate(), which restores login only.
|
|
1963
|
-
* @param {string} id - The resource ID
|
|
1964
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
1965
|
-
* @returns {Promise<void>}
|
|
1966
|
-
*/
|
|
1967
|
-
delete: (id: string, auditMessage?: string) => Promise<void>;
|
|
1968
|
-
/**
|
|
1969
|
-
* Reactivate a deactivated user, restoring their ability to log in.
|
|
1970
|
-
* Project memberships, vocab maintainerships, and API tokens removed
|
|
1971
|
-
* at deactivation are NOT restored — re-grant them deliberately.
|
|
1972
|
-
* @param {string} id - The resource ID
|
|
1973
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
1974
|
-
* @returns {Promise<User>}
|
|
1975
|
-
*/
|
|
1976
|
-
activate: (id: string, auditMessage?: string) => Promise<User>;
|
|
1977
|
-
/**
|
|
1978
|
-
* Modify a user. Admins may change the display name, password, and admin
|
|
1979
|
-
* status of any user. All other users may only modify their own display
|
|
1980
|
-
* name or password. A password change cannot be made with a named API
|
|
1981
|
-
* token (403): it needs a sign-in token.
|
|
1982
|
-
*
|
|
1983
|
-
* A user's id is their email address and is fixed for the life of the
|
|
1984
|
-
* account — it is what they log in with, so nothing can change it.
|
|
1985
|
-
* @param {string} id - The resource ID (the user's email address)
|
|
1986
|
-
* @param {string} [password] - New password
|
|
1987
|
-
* @param {string} [displayName] - New display name
|
|
1988
|
-
* @param {boolean} [isAdmin] - New admin status
|
|
1989
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
1990
|
-
* @returns {Promise<User>}
|
|
1991
|
-
*/
|
|
1992
|
-
update: (id: string, password?: string, displayName?: string, isAdmin?: boolean, auditMessage?: string) => Promise<User>;
|
|
1993
|
-
/**
|
|
1994
|
-
* A token that shows any user's profile picture without an
|
|
1995
|
-
* Authorization header, for an `<img>`, which cannot send one. Resolves
|
|
1996
|
-
* to `{ token, expiresAt }` (`expiresAt` an ISO-8601 instant, a day on by
|
|
1997
|
-
* default). The server refuses it on every route but the picture, and
|
|
1998
|
-
* it stops working when the user signs out or changes password.
|
|
1999
|
-
*
|
|
2000
|
-
* One token serves the whole client: it is kept and handed out again
|
|
2001
|
-
* until under ten minutes of it remain (half its life, for one minted
|
|
2002
|
-
* near the end of a login), calls made while one is being minted share
|
|
2003
|
-
* that request, and it is dropped when the client's token changes.
|
|
2004
|
-
* avatarUrl() uses it.
|
|
2005
|
-
* @param {{renew?: boolean}} [options] - `renew`: mint a new one
|
|
2006
|
-
* whatever is kept, unless one was minted in the last few seconds
|
|
2007
|
-
* (or is being minted), which is shared
|
|
2008
|
-
* @returns {Promise<{token: string, expiresAt: string}>}
|
|
2009
|
-
*/
|
|
2010
|
-
avatarToken: ({ renew }?: {
|
|
2011
|
-
renew?: boolean;
|
|
2012
|
-
}) => Promise<{
|
|
2013
|
-
token: string;
|
|
2014
|
-
expiresAt: string;
|
|
2015
|
-
}>;
|
|
2016
|
-
/**
|
|
2017
|
-
* Build a URL for a user's profile picture, for an `<img>` src. The
|
|
2018
|
-
* URL carries the client's avatar token (see avatarToken()), never the
|
|
2019
|
-
* login token.
|
|
2020
|
-
*
|
|
2021
|
-
* Pass the user record's `avatarHash` as the second argument whenever you
|
|
2022
|
-
* have it: the URL then addresses that exact picture, so the browser can
|
|
2023
|
-
* cache it indefinitely and still pick up a replacement the moment the
|
|
2024
|
-
* user changes it. Resolves to null when `avatarHash` is null (the user
|
|
2025
|
-
* has no picture), so callers can fall back to initials without a
|
|
2026
|
-
* wasted request.
|
|
2027
|
-
* @param {string} id - The user ID
|
|
2028
|
-
* @param {string|null} [avatarHash] - The user record's `avatarHash`
|
|
2029
|
-
* @param {{renew?: boolean}} [options] - `renew`: mint a new avatar
|
|
2030
|
-
* token first, for a picture its URL failed to load (the token
|
|
2031
|
-
* stops working when the login it was minted under ends)
|
|
2032
|
-
* @returns {Promise<string|null>}
|
|
2033
|
-
*/
|
|
2034
|
-
avatarUrl: (id: string, avatarHash?: string | null, { renew }?: {
|
|
2035
|
-
renew?: boolean;
|
|
2036
|
-
}) => Promise<string | null>;
|
|
2037
|
-
/**
|
|
2038
|
-
* Fetch a user's profile picture as raw bytes. Most callers want
|
|
2039
|
-
* avatarUrl() instead. This one is for non-browser consumers.
|
|
2040
|
-
* @param {string} id - The user ID
|
|
2041
|
-
* @returns {Promise<ArrayBuffer>}
|
|
2042
|
-
*/
|
|
2043
|
-
getAvatar: (id: string) => Promise<ArrayBuffer>;
|
|
2044
|
-
/**
|
|
2045
|
-
* Upload a profile picture. Your own, or anyone's if you are an admin.
|
|
2046
|
-
* The server center-crops to a square, scales to the configured edge
|
|
2047
|
-
* length, and re-encodes, so no client-side resizing is needed. Accepts
|
|
2048
|
-
* PNG, JPEG, WebP, and GIF. Resolves to the updated user record.
|
|
2049
|
-
* @param {string} id - The user ID
|
|
2050
|
-
* @param {File} file - The image to upload
|
|
2051
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
2052
|
-
* @returns {Promise<User>}
|
|
2053
|
-
*/
|
|
2054
|
-
setAvatar: (id: string, file: File, auditMessage?: string) => Promise<User>;
|
|
2055
|
-
/**
|
|
2056
|
-
* Remove a profile picture. Your own, or anyone's if you are an admin.
|
|
2057
|
-
* @param {string} id - The user ID
|
|
2058
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
2059
|
-
* @returns {Promise<void>}
|
|
2060
|
-
*/
|
|
2061
|
-
deleteAvatar: (id: string, auditMessage?: string) => Promise<void>;
|
|
2062
|
-
};
|
|
2063
|
-
userData: {
|
|
2064
|
-
/**
|
|
2065
|
-
* List a user's private data entries ({key, updatedAt}, plus value when
|
|
2066
|
-
* includeValues), ordered by key. Owner or admin only. Transparently
|
|
2067
|
-
* follows pagination cursors and returns the full flat array.
|
|
2068
|
-
*
|
|
2069
|
-
* Narrow with `prefix` (the literal head of a key) and/or `pattern`, a
|
|
2070
|
-
* GLOB over the whole key (`*` any run, `?` one character) — the way to
|
|
2071
|
-
* ask for a key convention identified by a segment in the middle, e.g.
|
|
2072
|
-
* `igt:assistant:*:meta:*` for every conversation's sidebar entry across
|
|
2073
|
-
* every project without dragging down the transcripts beside them.
|
|
2074
|
-
*
|
|
2075
|
-
* `pageSize` is exposed here, and defaults lower than elsewhere, because
|
|
2076
|
-
* one value runs to megabytes (`userDataValueBytes` in
|
|
2077
|
-
* `server.limits()`): a page of them with `includeValues` is the
|
|
2078
|
-
* largest response this API can be asked for. Raise it when the listing
|
|
2079
|
-
* is keys, or the values are known to be small.
|
|
2080
|
-
* @param {string} userId
|
|
2081
|
-
* @param {object} [opts]
|
|
2082
|
-
* @param {string} [opts.prefix] - Only keys starting with this prefix
|
|
2083
|
-
* @param {string} [opts.pattern] - Only keys matching this GLOB
|
|
2084
|
-
* @param {boolean} [opts.includeValues] - Also return each entry's value
|
|
2085
|
-
* @param {number} [opts.pageSize=100] - Entries per request (1..1000)
|
|
2086
|
-
* @returns {Promise<UserDataEntry[]>}
|
|
2087
|
-
*/
|
|
2088
|
-
list: (userId: string, { prefix, pattern, includeValues, pageSize }?: {
|
|
2089
|
-
prefix?: string;
|
|
2090
|
-
pattern?: string;
|
|
2091
|
-
includeValues?: boolean;
|
|
2092
|
-
pageSize?: number;
|
|
2093
|
-
}) => Promise<UserDataEntry[]>;
|
|
2094
|
-
/**
|
|
2095
|
-
* One page of a user's private data entries, ordered by key.
|
|
2096
|
-
* @param {string} userId
|
|
2097
|
-
* @param {object} [opts]
|
|
2098
|
-
* @param {string} [opts.prefix] - Only keys starting with this prefix
|
|
2099
|
-
* @param {string} [opts.pattern] - Only keys matching this GLOB
|
|
2100
|
-
* @param {boolean} [opts.includeValues] - Also return each entry's value
|
|
2101
|
-
* @param {number} [opts.limit] - Page size (1..1000; server default 100)
|
|
2102
|
-
* @param {string} [opts.cursor] - Opaque cursor from a previous page
|
|
2103
|
-
* @returns {Promise<Page<UserDataEntry>>}
|
|
2104
|
-
*/
|
|
2105
|
-
listPage: (userId: string, { prefix, pattern, includeValues, limit, cursor }?: {
|
|
2106
|
-
prefix?: string;
|
|
2107
|
-
pattern?: string;
|
|
2108
|
-
includeValues?: boolean;
|
|
2109
|
-
limit?: number;
|
|
2110
|
-
cursor?: string;
|
|
2111
|
-
}) => Promise<Page<UserDataEntry>>;
|
|
2112
|
-
/**
|
|
2113
|
-
* Async generator over a user's private data entries, one page at a time.
|
|
2114
|
-
* @param {string} userId
|
|
2115
|
-
* @param {object} [opts]
|
|
2116
|
-
* @param {string} [opts.prefix] - Only keys starting with this prefix
|
|
2117
|
-
* @param {string} [opts.pattern] - Only keys matching this GLOB
|
|
2118
|
-
* @param {boolean} [opts.includeValues] - Also return each entry's value
|
|
2119
|
-
* @param {number} [opts.pageSize=100] - Entries per request (1..1000)
|
|
2120
|
-
* @returns {AsyncGenerator<UserDataEntry[]>}
|
|
2121
|
-
*/
|
|
2122
|
-
iterPages: (userId: string, { prefix, pattern, includeValues, pageSize }?: {
|
|
2123
|
-
prefix?: string;
|
|
2124
|
-
pattern?: string;
|
|
2125
|
-
includeValues?: boolean;
|
|
2126
|
-
pageSize?: number;
|
|
2127
|
-
}) => AsyncGenerator<UserDataEntry[]>;
|
|
2128
|
-
/**
|
|
2129
|
-
* Read one private data entry ({key, updatedAt, version, value}); 404 if absent.
|
|
2130
|
-
* @param {string} userId
|
|
2131
|
-
* @param {string} key
|
|
2132
|
-
* @returns {Promise<UserDataEntry & {value: any}>}
|
|
2133
|
-
*/
|
|
2134
|
-
get: (userId: string, key: string) => Promise<UserDataEntry & {
|
|
2135
|
-
value: any;
|
|
2136
|
-
}>;
|
|
2137
|
-
/**
|
|
2138
|
-
* Create or replace one private data entry. `value` is any JSON, up to
|
|
2139
|
-
* the server's `userDataValueBytes` (`server.limits()`, 5 MB by
|
|
2140
|
-
* default), and is refused with 413 over it, after which
|
|
2141
|
-
* `server.limits()` answers the figure the server has now. Not audited,
|
|
2142
|
-
* not batchable.
|
|
2143
|
-
*
|
|
2144
|
-
* The server stores it verbatim, but this client recases object keys on
|
|
2145
|
-
* the way out and back like any other body (`myKey` <-> `my-key`), so a
|
|
2146
|
-
* value whose keys are camelCase round-trips unchanged while one keyed
|
|
2147
|
-
* by arbitrary strings does not. Put such a map under a `metadata` key,
|
|
2148
|
-
* which both clients pass through untouched.
|
|
2149
|
-
*
|
|
2150
|
-
* Every write raises the entry's `version` by one, and reads answer it.
|
|
2151
|
-
* With `version`, the write lands only when the entry is still at that
|
|
2152
|
-
* version (0: only when there is no entry), and is otherwise refused with
|
|
2153
|
-
* 409, `error: "version-mismatch"`, and the stored `version` and
|
|
2154
|
-
* `updatedAt` on the error's `responseData`: read it again and make the
|
|
2155
|
-
* change on what is there.
|
|
2156
|
-
* @param {string} userId
|
|
2157
|
-
* @param {string} key
|
|
2158
|
-
* @param {*} value
|
|
2159
|
-
* @param {object} [opts]
|
|
2160
|
-
* @param {number} [opts.version] - The version this write was made from
|
|
2161
|
-
* @returns {Promise<{key: string, updatedAt: string, version: number}>}
|
|
2162
|
-
*/
|
|
2163
|
-
put: (userId: string, key: string, value: any, { version }?: {
|
|
2164
|
-
version?: number;
|
|
2165
|
-
}) => Promise<{
|
|
2166
|
-
key: string;
|
|
2167
|
-
updatedAt: string;
|
|
2168
|
-
version: number;
|
|
2169
|
-
}>;
|
|
2170
|
-
/**
|
|
2171
|
-
* Delete one private data entry; 404 if absent.
|
|
2172
|
-
* @param {string} userId
|
|
2173
|
-
* @param {string} key
|
|
2174
|
-
* @returns {Promise<void>}
|
|
2175
|
-
*/
|
|
2176
|
-
delete: (userId: string, key: string) => Promise<void>;
|
|
2177
|
-
};
|
|
2178
|
-
apiTokens: {
|
|
2179
|
-
/**
|
|
2180
|
-
* List a user's named API tokens. Never includes the signed token
|
|
2181
|
-
* string itself — that is only returned once, by create().
|
|
2182
|
-
* Transparently follows pagination cursors and returns the full flat array.
|
|
2183
|
-
* @param {string} userId - The user ID who owns the tokens
|
|
2184
|
-
* @returns {Promise<ApiToken[]>}
|
|
2185
|
-
*/
|
|
2186
|
-
list: (userId: string) => Promise<ApiToken[]>;
|
|
2187
|
-
/**
|
|
2188
|
-
* Fetch a single page of a user's named API tokens.
|
|
2189
|
-
* @param {string} userId - The user ID who owns the tokens
|
|
2190
|
-
* @param {object} [opts]
|
|
2191
|
-
* @param {number} [opts.limit] - Page size (1..1000; server default 100)
|
|
2192
|
-
* @param {string} [opts.cursor] - Opaque cursor from a previous page
|
|
2193
|
-
* @returns {Promise<Page<ApiToken>>}
|
|
2194
|
-
*/
|
|
2195
|
-
listPage: (userId: string, { limit, cursor }?: {
|
|
2196
|
-
limit?: number;
|
|
2197
|
-
cursor?: string;
|
|
2198
|
-
}) => Promise<Page<ApiToken>>;
|
|
2199
|
-
/**
|
|
2200
|
-
* Async-iterate a user's named API tokens page by page; yields each
|
|
2201
|
-
* page's entries array.
|
|
2202
|
-
* @param {string} userId - The user ID who owns the tokens
|
|
2203
|
-
* @param {object} [opts]
|
|
2204
|
-
* @param {number} [opts.pageSize] - Per-request page size
|
|
2205
|
-
* @returns {AsyncGenerator<ApiToken[]>}
|
|
2206
|
-
*/
|
|
2207
|
-
iterPages: (userId: string, { pageSize }?: {
|
|
2208
|
-
pageSize?: number;
|
|
2209
|
-
}) => AsyncGenerator<ApiToken[]>;
|
|
2210
|
-
/**
|
|
2211
|
-
* Mint a named API token for a user. The returned `token` is the signed
|
|
2212
|
-
* credential and is shown ONLY here — store it immediately. API tokens
|
|
2213
|
-
* do not expire and survive password changes / logout; revoke to kill.
|
|
2214
|
-
* A client signed in with a named API token cannot do this (403): it
|
|
2215
|
-
* needs a sign-in token.
|
|
2216
|
-
* @param {string} userId - The user ID who will own the token
|
|
2217
|
-
* @param {string} name - A human label, e.g. "Stanza parser"
|
|
2218
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
2219
|
-
* @returns {Promise<{id: string, name: string, token: string}>}
|
|
2220
|
-
*/
|
|
2221
|
-
create: (userId: string, name: string, auditMessage?: string) => Promise<{
|
|
2222
|
-
id: string;
|
|
2223
|
-
name: string;
|
|
2224
|
-
token: string;
|
|
2225
|
-
}>;
|
|
2226
|
-
/**
|
|
2227
|
-
* Revoke a named API token (soft-revoke; idempotent).
|
|
2228
|
-
* A client signed in with a named API token cannot do this (403): it
|
|
2229
|
-
* needs a sign-in token.
|
|
2230
|
-
* @param {string} userId - The user ID who owns the token
|
|
2231
|
-
* @param {string} tokenId - The token ID to revoke
|
|
2232
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
2233
|
-
* @returns {Promise<void>}
|
|
2234
|
-
*/
|
|
2235
|
-
revoke: (userId: string, tokenId: string, auditMessage?: string) => Promise<void>;
|
|
2236
|
-
};
|
|
2237
|
-
invites: {
|
|
2238
|
-
/**
|
|
2239
|
-
* List invites you minted, oldest first. With `projectId`, lists that
|
|
2240
|
-
* project's invites instead (including co-maintainers'), which requires
|
|
2241
|
-
* maintainer or admin on it. Never includes invite codes — the code is
|
|
2242
|
-
* returned once, by create(), and is not recoverable afterward.
|
|
2243
|
-
* Transparently follows pagination cursors and returns the full flat array.
|
|
2244
|
-
* @param {object} [opts]
|
|
2245
|
-
* @param {string} [opts.projectId] - List this project's invites instead of your own
|
|
2246
|
-
* @param {boolean} [opts.all] - List every invite on the server (admin only)
|
|
2247
|
-
* @returns {Promise<Invite[]>}
|
|
2248
|
-
*/
|
|
2249
|
-
list: ({ projectId, all }?: {
|
|
2250
|
-
projectId?: string;
|
|
2251
|
-
all?: boolean;
|
|
2252
|
-
}) => Promise<Invite[]>;
|
|
2253
|
-
/**
|
|
2254
|
-
* Fetch a single page of invites.
|
|
2255
|
-
* @param {object} [opts]
|
|
2256
|
-
* @param {string} [opts.projectId] - List this project's invites instead of your own
|
|
2257
|
-
* @param {boolean} [opts.all] - List every invite on the server (admin only)
|
|
2258
|
-
* @param {number} [opts.limit] - Page size (1..1000; server default 100)
|
|
2259
|
-
* @param {string} [opts.cursor] - Opaque cursor from a previous page
|
|
2260
|
-
* @returns {Promise<Page<Invite>>}
|
|
2261
|
-
*/
|
|
2262
|
-
listPage: ({ projectId, all, limit, cursor }?: {
|
|
2263
|
-
projectId?: string;
|
|
2264
|
-
all?: boolean;
|
|
2265
|
-
limit?: number;
|
|
2266
|
-
cursor?: string;
|
|
2267
|
-
}) => Promise<Page<Invite>>;
|
|
2268
|
-
/**
|
|
2269
|
-
* Async-iterate invites page by page; yields each page's entries array.
|
|
2270
|
-
* @param {object} [opts]
|
|
2271
|
-
* @param {string} [opts.projectId] - List this project's invites instead of your own
|
|
2272
|
-
* @param {boolean} [opts.all] - List every invite on the server (admin only)
|
|
2273
|
-
* @param {number} [opts.pageSize] - Per-request page size
|
|
2274
|
-
* @returns {AsyncGenerator<Invite[]>}
|
|
2275
|
-
*/
|
|
2276
|
-
iterPages: ({ projectId, all, pageSize }?: {
|
|
2277
|
-
projectId?: string;
|
|
2278
|
-
all?: boolean;
|
|
2279
|
-
pageSize?: number;
|
|
2280
|
-
}) => AsyncGenerator<Invite[]>;
|
|
2281
|
-
/**
|
|
2282
|
-
* Mint an invite. The returned `code` is shown ONLY here — it is never
|
|
2283
|
-
* stored and cannot be recovered, so build and hand off the link now.
|
|
2284
|
-
* Use PlaidClient.inviteUrl() to turn it into one.
|
|
2285
|
-
*
|
|
2286
|
-
* Admins may mint anything. A project maintainer may mint role grants on
|
|
2287
|
-
* projects they maintain, and nothing else: no admin grant, no grantless
|
|
2288
|
-
* invite, no password resets — so for a non-admin, projectId/projectRole
|
|
2289
|
-
* are required in practice (403 without them).
|
|
2290
|
-
*
|
|
2291
|
-
* Needs a signed-in session: a client signed in with a named API token
|
|
2292
|
-
* cannot mint any invite (403).
|
|
2293
|
-
*
|
|
2294
|
-
* EVERY option is optional; `create()` with no arguments mints a
|
|
2295
|
-
* single-use signup link granting nothing but an account. Two pairing
|
|
2296
|
-
* rules the server enforces with a 400: projectId and projectRole must be
|
|
2297
|
-
* given TOGETHER, and targetUserId may not be combined with projectId,
|
|
2298
|
-
* grantAdmin, or a maxUses above 1.
|
|
2299
|
-
* @param {object} [opts]
|
|
2300
|
-
* @param {string} [opts.projectId] - Project the redeemer joins (requires projectRole)
|
|
2301
|
-
* @param {string} [opts.projectRole] - "reader" | "writer" | "maintainer" (requires projectId)
|
|
2302
|
-
* @param {boolean} [opts.grantAdmin] - Make the new account a global admin (admin only)
|
|
2303
|
-
* @param {string} [opts.targetUserId] - Password reset for that user instead of a signup; admin only, single-use, grants nothing
|
|
2304
|
-
* @param {number} [opts.maxUses] - How many accounts this link may create (default 1)
|
|
2305
|
-
* @param {number} [opts.ttlDays] - Days until it expires (default 14, max 365)
|
|
2306
|
-
* @param {string} [opts.note] - Human label shown in your invite list
|
|
2307
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
2308
|
-
* @returns {Promise<Invite & {code: string}>}
|
|
2309
|
-
*/
|
|
2310
|
-
create: ({ projectId, projectRole, grantAdmin, targetUserId, maxUses, ttlDays, note, }?: {
|
|
2311
|
-
projectId?: string;
|
|
2312
|
-
projectRole?: string;
|
|
2313
|
-
grantAdmin?: boolean;
|
|
2314
|
-
targetUserId?: string;
|
|
2315
|
-
maxUses?: number;
|
|
2316
|
-
ttlDays?: number;
|
|
2317
|
-
note?: string;
|
|
2318
|
-
}, auditMessage?: string) => Promise<Invite & {
|
|
2319
|
-
code: string;
|
|
2320
|
-
}>;
|
|
2321
|
-
/**
|
|
2322
|
-
* Revoke an invite, killing the link immediately. Idempotent. Allowed for
|
|
2323
|
-
* the creator, an admin, or a maintainer of the invite's project.
|
|
2324
|
-
* @param {string} id - The invite ID
|
|
2325
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
2326
|
-
* @returns {Promise<void>}
|
|
2327
|
-
*/
|
|
2328
|
-
revoke: (id: string, auditMessage?: string) => Promise<void>;
|
|
2329
|
-
};
|
|
2330
|
-
admin: {
|
|
2331
|
-
/**
|
|
2332
|
-
* Everything about the server in one read: version and JVM uptime,
|
|
2333
|
-
* database size and per-table row counts, media directory usage, backup
|
|
2334
|
-
* configuration and the backups on disk, and the settings an operator
|
|
2335
|
-
* gets asked to confirm. Carries no secrets. Runs a count per table and
|
|
2336
|
-
* walks the media directory, so open it, do not poll it. Admin only.
|
|
2337
|
-
* @returns {Promise<ServerReport>}
|
|
2338
|
-
*/
|
|
2339
|
-
server: () => Promise<ServerReport>;
|
|
2340
|
-
/**
|
|
2341
|
-
* Take a database backup right now, outside the nightly schedule.
|
|
2342
|
-
* Resolves to the backup block with `ok` reporting whether the snapshot
|
|
2343
|
-
* succeeded. Uses VACUUM INTO, which only reads, so it is safe while
|
|
2344
|
-
* people are working. Admin only.
|
|
2345
|
-
*
|
|
2346
|
-
* The server answers once the backup is written, which takes minutes on
|
|
2347
|
-
* a large database, so this waits up to `BACKUP_TIMEOUT_MS` (30 minutes)
|
|
2348
|
-
* rather than the client's usual timeout. A proxy in front of the server
|
|
2349
|
-
* may still give up first (a 504): the backup goes on, and its file
|
|
2350
|
-
* shows in `server().backup.backups` once it is written.
|
|
2351
|
-
* @returns {Promise<BackupStatus>}
|
|
2352
|
-
*
|
|
2353
|
-
* outOfBand, as every admin action on the server itself is: none of them
|
|
2354
|
-
* writes project data (see the note at the top of http.js).
|
|
2355
|
-
*/
|
|
2356
|
-
backup: () => Promise<BackupStatus>;
|
|
2357
|
-
/**
|
|
2358
|
-
* Documents currently held by an editing lock, with who holds each and
|
|
2359
|
-
* when it expires on its own. Admin only.
|
|
2360
|
-
* @returns {Promise<{entries: Array<{documentId: string, userId: string, expiresAt: number}>}>}
|
|
2361
|
-
*/
|
|
2362
|
-
locks: () => Promise<{
|
|
2363
|
-
entries: Array<{
|
|
2364
|
-
documentId: string;
|
|
2365
|
-
userId: string;
|
|
2366
|
-
expiresAt: number;
|
|
2367
|
-
}>;
|
|
2368
|
-
}>;
|
|
2369
|
-
/**
|
|
2370
|
-
* Drop the lock on a document whoever holds it. Idempotent. For a client
|
|
2371
|
-
* that went away without releasing one. Admin only.
|
|
2372
|
-
* @param {string} documentId - The document ID
|
|
2373
|
-
* @returns {Promise<{result: string}>}
|
|
2374
|
-
*/
|
|
2375
|
-
releaseLock: (documentId: string) => Promise<{
|
|
2376
|
-
result: string;
|
|
2377
|
-
}>;
|
|
2378
|
-
/**
|
|
2379
|
-
* Live login and invite rate-limit buckets: the address, the account
|
|
2380
|
-
* where there is one, failures inside the window, the limit, and whether
|
|
2381
|
-
* it is currently blocking. Admin only.
|
|
2382
|
-
* @returns {Promise<RateLimitSnapshot>}
|
|
2383
|
-
*/
|
|
2384
|
-
rateLimits: () => Promise<RateLimitSnapshot>;
|
|
2385
|
-
/**
|
|
2386
|
-
* Forget recorded rate-limit failures. With `ip`, clears that address,
|
|
2387
|
-
* narrowed to one account with `userId`. With neither, clears every
|
|
2388
|
-
* bucket. Only ever unblocks. Admin only.
|
|
2389
|
-
* @param {object} [opts]
|
|
2390
|
-
* @param {string} [opts.ip] - Clear only this address
|
|
2391
|
-
* @param {string} [opts.userId] - Narrow to one account on that address
|
|
2392
|
-
* @returns {Promise<{result: string}>}
|
|
2393
|
-
*/
|
|
2394
|
-
clearRateLimits: ({ ip, userId }?: {
|
|
2395
|
-
ip?: string;
|
|
2396
|
-
userId?: string;
|
|
2397
|
-
}) => Promise<{
|
|
2398
|
-
result: string;
|
|
2399
|
-
}>;
|
|
2400
|
-
/**
|
|
2401
|
-
* What the server has logged, structured and filtered, from an in-memory
|
|
2402
|
-
* buffer kept whether or not a log file is configured. `requests` is one
|
|
2403
|
-
* entry per HTTP request (method, path, status, duration, and who made
|
|
2404
|
-
* it), `events` is everything else, with a stack trace where there was
|
|
2405
|
-
* one. They are buffered separately so a burst of requests cannot evict
|
|
2406
|
-
* an error. Both come newest first, `matched` counts what passed the
|
|
2407
|
-
* filters, and request `stats` describe the filtered set. Covers Plaid's
|
|
2408
|
-
* own log stream since the last restart: for library messages and older
|
|
2409
|
-
* history, see `logFile`. Admin only.
|
|
2410
|
-
* @param {object} [opts]
|
|
2411
|
-
* @param {number} [opts.limit] - Max entries per kind (default 200, max 2000)
|
|
2412
|
-
* @param {string} [opts.q] - Substring of any field, case-insensitive
|
|
2413
|
-
* @param {string} [opts.level] - Minimum level for events, e.g. "warn"
|
|
2414
|
-
* @param {string} [opts.status] - "2xx".."5xx", an exact code, or "failures"
|
|
2415
|
-
* @param {string} [opts.user] - Only requests made by this account
|
|
2416
|
-
* @param {string} [opts.method] - Only requests with this HTTP method
|
|
2417
|
-
* @returns {Promise<LiveLog>}
|
|
2418
|
-
*/
|
|
2419
|
-
logs: ({ limit, q, level, status, user, method }?: {
|
|
2420
|
-
limit?: number;
|
|
2421
|
-
q?: string;
|
|
2422
|
-
level?: string;
|
|
2423
|
-
status?: string;
|
|
2424
|
-
user?: string;
|
|
2425
|
-
method?: string;
|
|
2426
|
-
}) => Promise<LiveLog>;
|
|
2427
|
-
/**
|
|
2428
|
-
* The tail of the configured log file, as text lines. The only place
|
|
2429
|
-
* third-party library messages and anything from before the last restart
|
|
2430
|
-
* can be read. Resolves with an `error` string instead of lines when no
|
|
2431
|
-
* log file is configured or it does not exist yet. Admin only.
|
|
2432
|
-
* @param {object} [opts]
|
|
2433
|
-
* @param {number} [opts.lines] - How many lines (default 200, max 2000)
|
|
2434
|
-
* @returns {Promise<{file: (string|null), lines: string[], error?: string}>}
|
|
2435
|
-
*/
|
|
2436
|
-
logFile: ({ lines }?: {
|
|
2437
|
-
lines?: number;
|
|
2438
|
-
}) => Promise<{
|
|
2439
|
-
file: (string | null);
|
|
2440
|
-
lines: string[];
|
|
2441
|
-
error?: string;
|
|
2442
|
-
}>;
|
|
2443
|
-
/**
|
|
2444
|
-
* Private user-data entries across every account, each carrying its
|
|
2445
|
-
* `userId`. `/users/:userId/data` has always been owner-or-admin; this
|
|
2446
|
-
* is the same reach across accounts at once. Transparently follows
|
|
2447
|
-
* pagination cursors and returns the full flat array. Admin only.
|
|
2448
|
-
*
|
|
2449
|
-
* Narrow with `prefix` (the literal head of a key) and/or `pattern`, a
|
|
2450
|
-
* GLOB over the whole key (`*` any run, `?` one character) — the way to
|
|
2451
|
-
* ask for a key convention identified by a segment in the middle, e.g.
|
|
2452
|
-
* `igt:assistant:*:meta:*`. Values come only with `includeValues`, and
|
|
2453
|
-
* are recased like any other body (see `userData.put`).
|
|
2454
|
-
* @param {object} [opts]
|
|
2455
|
-
* @param {string} [opts.prefix] - Only keys starting with this
|
|
2456
|
-
* @param {string} [opts.pattern] - Only keys matching this GLOB
|
|
2457
|
-
* @param {boolean} [opts.includeValues] - Also return each entry's value
|
|
2458
|
-
* @returns {Promise<AdminUserDataEntry[]>}
|
|
2459
|
-
*/
|
|
2460
|
-
userData: ({ prefix, pattern, includeValues }?: {
|
|
2461
|
-
prefix?: string;
|
|
2462
|
-
pattern?: string;
|
|
2463
|
-
includeValues?: boolean;
|
|
2464
|
-
}) => Promise<AdminUserDataEntry[]>;
|
|
2465
|
-
/**
|
|
2466
|
-
* One page of private user-data entries across accounts, ordered by
|
|
2467
|
-
* (user, key). Admin only.
|
|
2468
|
-
* @param {object} [opts]
|
|
2469
|
-
* @param {string} [opts.prefix] - Only keys starting with this
|
|
2470
|
-
* @param {string} [opts.pattern] - Only keys matching this GLOB
|
|
2471
|
-
* @param {boolean} [opts.includeValues] - Also return each entry's value
|
|
2472
|
-
* @param {number} [opts.limit] - Page size (1..1000; server default 100)
|
|
2473
|
-
* @param {string} [opts.cursor] - Opaque cursor from a previous page
|
|
2474
|
-
* @returns {Promise<Page<AdminUserDataEntry>>}
|
|
2475
|
-
*/
|
|
2476
|
-
userDataPage: ({ prefix, pattern, includeValues, limit, cursor }?: {
|
|
2477
|
-
prefix?: string;
|
|
2478
|
-
pattern?: string;
|
|
2479
|
-
includeValues?: boolean;
|
|
2480
|
-
limit?: number;
|
|
2481
|
-
cursor?: string;
|
|
2482
|
-
}) => Promise<Page<AdminUserDataEntry>>;
|
|
2483
|
-
};
|
|
2484
|
-
audit: {
|
|
2485
|
-
/**
|
|
2486
|
-
* The audit log across every project, oldest first. Same fold, window
|
|
2487
|
-
* and op-type filter as the per-project read, with the entity scope
|
|
2488
|
-
* dropped. Admin only. Transparently follows pagination cursors and
|
|
2489
|
-
* returns the full flat array.
|
|
2490
|
-
* @param {object} [opts]
|
|
2491
|
-
* @param {string} [opts.startTime] - Only operations at or after this instant
|
|
2492
|
-
* @param {string} [opts.endTime] - Only operations at or before this instant
|
|
2493
|
-
* @param {string[]|string} [opts.opTypes] - Only these op types (e.g.
|
|
2494
|
-
* `['span-layer/create']`). An entry appears when one of its operations
|
|
2495
|
-
* matches, carrying only the ones that did.
|
|
2496
|
-
* @param {string[]|string} [opts.kinds] - Only the entries of operations
|
|
2497
|
-
* of these kinds (e.g. `['review']`), each whole
|
|
2498
|
-
* @returns {Promise<AuditEntry[]>}
|
|
2499
|
-
*/
|
|
2500
|
-
list: ({ startTime, endTime, opTypes, kinds }?: {
|
|
2501
|
-
startTime?: string;
|
|
2502
|
-
endTime?: string;
|
|
2503
|
-
opTypes?: string[] | string;
|
|
2504
|
-
kinds?: string[] | string;
|
|
2505
|
-
}) => Promise<AuditEntry[]>;
|
|
2506
|
-
/**
|
|
2507
|
-
* Fetch a single page of the instance-wide audit log. Admin only.
|
|
2508
|
-
* @param {object} [opts]
|
|
2509
|
-
* @param {string} [opts.startTime] - Only entries at or after this instant
|
|
2510
|
-
* @param {string} [opts.endTime] - Only entries at or before this instant
|
|
2511
|
-
* @param {string[]|string} [opts.opTypes] - Only these op types
|
|
2512
|
-
* @param {OperationKind[]|string} [opts.kinds] - Only the entries of operations of these kinds, each whole
|
|
2513
|
-
* @param {"asc"|"desc"} [opts.order] - "desc" pages newest-first, which
|
|
2514
|
-
* is what a feed wants. A cursor belongs to the direction that made it.
|
|
2515
|
-
* @param {number} [opts.limit] - Page size (1..1000; server default 100)
|
|
2516
|
-
* @param {string} [opts.cursor] - Opaque cursor from a previous page
|
|
2517
|
-
* @param {number} [opts.opsLimit] - Keep only each entry's oldest N
|
|
2518
|
-
* operations in `ops` (1..1000). `opCount` on every entry says how
|
|
2519
|
-
* many it has
|
|
2520
|
-
* @param {string} [opts.entryId] - Read only this entry, not a page
|
|
2521
|
-
* @returns {Promise<Page<AuditEntry>>}
|
|
2522
|
-
*/
|
|
2523
|
-
listPage: ({ startTime, endTime, opTypes, kinds, order, limit, cursor, opsLimit, entryId }?: {
|
|
2524
|
-
startTime?: string;
|
|
2525
|
-
endTime?: string;
|
|
2526
|
-
opTypes?: string[] | string;
|
|
2527
|
-
kinds?: OperationKind[] | string;
|
|
2528
|
-
order?: "asc" | "desc";
|
|
2529
|
-
limit?: number;
|
|
2530
|
-
cursor?: string;
|
|
2531
|
-
opsLimit?: number;
|
|
2532
|
-
entryId?: string;
|
|
2533
|
-
}) => Promise<Page<AuditEntry>>;
|
|
2534
|
-
/**
|
|
2535
|
-
* Async-iterate the instance-wide audit log page by page. Admin only.
|
|
2536
|
-
* @param {object} [opts]
|
|
2537
|
-
* @param {string} [opts.startTime] - Only entries at or after this instant
|
|
2538
|
-
* @param {string} [opts.endTime] - Only entries at or before this instant
|
|
2539
|
-
* @param {string[]|string} [opts.opTypes] - Only these op types
|
|
2540
|
-
* @param {OperationKind[]|string} [opts.kinds] - Only the entries of operations of these kinds, each whole
|
|
2541
|
-
* @param {number} [opts.pageSize] - Per-request page size
|
|
2542
|
-
* @returns {AsyncGenerator<AuditEntry[]>}
|
|
2543
|
-
*/
|
|
2544
|
-
iterPages: ({ startTime, endTime, opTypes, kinds, pageSize }?: {
|
|
2545
|
-
startTime?: string;
|
|
2546
|
-
endTime?: string;
|
|
2547
|
-
opTypes?: string[] | string;
|
|
2548
|
-
kinds?: OperationKind[] | string;
|
|
2549
|
-
pageSize?: number;
|
|
2550
|
-
}) => AsyncGenerator<AuditEntry[]>;
|
|
2551
|
-
/**
|
|
2552
|
-
* Per-user activity counts. `changes` is the number of logical actions,
|
|
2553
|
-
* folded the way the audit feed folds them, so one "Confirm word
|
|
2554
|
-
* analysis" counts once however many rows it wrote; `operations` is the
|
|
2555
|
-
* unfolded row count. Only users who did something appear — subtract
|
|
2556
|
-
* from the roster you already hold to find the ones who did not.
|
|
2557
|
-
*
|
|
2558
|
-
* With `projectId`, scoped to that project and open to its maintainers.
|
|
2559
|
-
* Without one, instance-wide and admin only.
|
|
2560
|
-
* @param {object} [opts]
|
|
2561
|
-
* @param {string} [opts.projectId] - Scope to one project
|
|
2562
|
-
* @param {string} [opts.startTime] - Only count at or after this instant
|
|
2563
|
-
* @param {string} [opts.endTime] - Only count at or before this instant
|
|
2564
|
-
* @param {boolean} [opts.daily] - Also return `byDay`, a list of
|
|
2565
|
-
* `{date, changes}` per user, oldest first, at the cost of a second
|
|
2566
|
-
* grouped scan
|
|
2567
|
-
* @returns {Promise<ActivityTallyRow[]>}
|
|
2568
|
-
*/
|
|
2569
|
-
tally: ({ projectId, startTime, endTime, daily }?: {
|
|
2570
|
-
projectId?: string;
|
|
2571
|
-
startTime?: string;
|
|
2572
|
-
endTime?: string;
|
|
2573
|
-
daily?: boolean;
|
|
2574
|
-
}) => Promise<ActivityTallyRow[]>;
|
|
2575
|
-
};
|
|
2576
|
-
tokenLayers: {
|
|
2577
|
-
/**
|
|
2578
|
-
* Declare an app namespace's constraints on this layer, replacing that
|
|
2579
|
-
* namespace's list. Refused with 422 and the violations when the layer's
|
|
2580
|
-
* stored data breaks them (see violationsOf).
|
|
2581
|
-
* @param {string} layerId - The layer ID
|
|
2582
|
-
* @param {string} namespace - The declaring app's namespace, e.g. "igt"
|
|
2583
|
-
* @param {LayerConstraint[]} constraints - e.g. [{type: "single-span"}, {type: "value-set", values: ["N"]}]
|
|
2584
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
2585
|
-
* @param {{expected?: Array<object>|null}} [options] - `expected`: the list read for this
|
|
2586
|
-
* namespace (null when it was absent). The write is then refused with a 409 when the stored
|
|
2587
|
-
* list differs.
|
|
2588
|
-
* @returns {Promise<{constraints: Record<string, LayerConstraint[]>}>} the layer's whole constraint map
|
|
2589
|
-
*/
|
|
2590
|
-
setConstraints: (layerId: string, namespace: string, constraints: LayerConstraint[], auditMessage?: string, options?: {
|
|
2591
|
-
expected?: Array<object> | null;
|
|
2592
|
-
}) => Promise<{
|
|
2593
|
-
constraints: Record<string, LayerConstraint[]>;
|
|
2594
|
-
}>;
|
|
2595
|
-
/**
|
|
2596
|
-
* Remove an app namespace's constraints from this layer.
|
|
2597
|
-
* @param {string} layerId - The layer ID
|
|
2598
|
-
* @param {string} namespace - The declaring app's namespace
|
|
2599
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
2600
|
-
* @param {{expected?: Array<object>|null}} [options] - `expected`, as on setConstraints.
|
|
2601
|
-
* @returns {Promise<void>}
|
|
2602
|
-
*/
|
|
2603
|
-
deleteConstraints: (layerId: string, namespace: string, auditMessage?: string, options?: {
|
|
2604
|
-
expected?: Array<object> | null;
|
|
2605
|
-
}) => Promise<void>;
|
|
2606
|
-
/**
|
|
2607
|
-
* The violations the given constraints would meet in this layer's stored
|
|
2608
|
-
* data. Writes nothing.
|
|
2609
|
-
* @param {string} layerId - The layer ID
|
|
2610
|
-
* @param {LayerConstraint[]} constraints - The list to check
|
|
2611
|
-
* @param {{limit?: number}} [options] - `limit`: how many violations to list (default 100)
|
|
2612
|
-
* @returns {Promise<{violations: ConstraintViolation[], violationCount: number}>}
|
|
2613
|
-
*/
|
|
2614
|
-
checkConstraints: (layerId: string, constraints: LayerConstraint[], options?: {
|
|
2615
|
-
limit?: number;
|
|
2616
|
-
}) => Promise<{
|
|
2617
|
-
violations: ConstraintViolation[];
|
|
2618
|
-
violationCount: number;
|
|
2619
|
-
}>;
|
|
2620
|
-
/**
|
|
2621
|
-
* Apply the remedies of the given constraints' remediable types
|
|
2622
|
-
* (coextensive, single-span, single-link, same-ancestor) to every
|
|
2623
|
-
* violation in this layer's stored data, one operation per document.
|
|
2624
|
-
* With `document`, only that document is repaired, and a writer may
|
|
2625
|
-
* ask. A document another user holds the lock on is left as it is and
|
|
2626
|
-
* listed under `locked`.
|
|
2627
|
-
* @param {string} layerId - The layer ID
|
|
2628
|
-
* @param {LayerConstraint[]} constraints - The list to repair for
|
|
2629
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
2630
|
-
* @param {{document?: string}} [options]
|
|
2631
|
-
* @returns {Promise<{repaired: ConstraintRepair[], locked: Array<{document: string, lockedBy: string}>, violations: ConstraintViolation[], violationCount: number}>}
|
|
2632
|
-
*/
|
|
2633
|
-
repairConstraints: (layerId: string, constraints: LayerConstraint[], auditMessage?: string, options?: {
|
|
2634
|
-
document?: string;
|
|
2635
|
-
}) => Promise<{
|
|
2636
|
-
repaired: ConstraintRepair[];
|
|
2637
|
-
locked: Array<{
|
|
2638
|
-
document: string;
|
|
2639
|
-
lockedBy: string;
|
|
2640
|
-
}>;
|
|
2641
|
-
violations: ConstraintViolation[];
|
|
2642
|
-
violationCount: number;
|
|
2643
|
-
}>;
|
|
2644
|
-
/**
|
|
2645
|
-
* Set a configuration value in an editor namespace.
|
|
2646
|
-
* @param {string} id - The record's ID
|
|
2647
|
-
* @param {string} namespace - The config namespace
|
|
2648
|
-
* @param {string} configKey - The config key
|
|
2649
|
-
* @param {any} configValue - Configuration value to set
|
|
2650
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
2651
|
-
* @param {{expected?: any}} [options] - `expected`: the value read for this key (null or undefined when it
|
|
2652
|
-
* was absent). The write is then refused with a 409 when the stored value differs. A value the key
|
|
2653
|
-
* already holds is not written and leaves no audit row, so the value read, expecting it, states in a
|
|
2654
|
-
* batch that the key is unchanged.
|
|
2655
|
-
* @returns {Promise<void>}
|
|
2656
|
-
*/
|
|
2657
|
-
setConfig: (id: string, namespace: string, configKey: string, configValue: any, auditMessage?: string, options?: {
|
|
2658
|
-
expected?: any;
|
|
2659
|
-
}) => Promise<void>;
|
|
2660
|
-
/**
|
|
2661
|
-
* Remove a configuration value.
|
|
2662
|
-
* @param {string} id - The record's ID
|
|
2663
|
-
* @param {string} namespace - The config namespace
|
|
2664
|
-
* @param {string} configKey - The config key
|
|
2665
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
2666
|
-
* @param {{expected?: any}} [options] - `expected`, as on setConfig. A key that is absent is not
|
|
2667
|
-
* written, so expecting null states in a batch that it is still absent.
|
|
2668
|
-
* @returns {Promise<void>}
|
|
2669
|
-
*/
|
|
2670
|
-
deleteConfig: (id: string, namespace: string, configKey: string, auditMessage?: string, options?: {
|
|
2671
|
-
expected?: any;
|
|
2672
|
-
}) => Promise<void>;
|
|
2673
|
-
/**
|
|
2674
|
-
* Count, per document, the tokens of each layer whose surface matches a
|
|
2675
|
-
* regex, as a query's `value: {regex}` on a token decides. Each text is
|
|
2676
|
-
* read once, so it stays fast on a long document. Layers you cannot read
|
|
2677
|
-
* are left out.
|
|
2678
|
-
* @param {string[]} layerIds - The token layer ids
|
|
2679
|
-
* @param {{regex: string, flags?: string}} value - The regex spec
|
|
2680
|
-
* @returns {Promise<{results: Array<[string, string, number]>}>} [layerId,
|
|
2681
|
-
* documentId, count] rows, a document with tokens of the layer and no
|
|
2682
|
-
* match counting 0.
|
|
2683
|
-
*/
|
|
2684
|
-
countMatching: (layerIds: string[], value: {
|
|
2685
|
-
regex: string;
|
|
2686
|
-
flags?: string;
|
|
2687
|
-
}) => Promise<{
|
|
2688
|
-
results: Array<[string, string, number]>;
|
|
2689
|
-
}>;
|
|
2690
|
-
/**
|
|
2691
|
-
* Create a new token layer.
|
|
2692
|
-
* @param {string} textLayerId - The text layer ID
|
|
2693
|
-
* @param {string} name - The name
|
|
2694
|
-
* @param {string} [overlapMode] - Per-layer, immutable token invariant: "any" (default), "non-overlapping", or "partitioning". On partitioning layers, single token create/update/delete are rejected; use bulkCreate plus split/merge/shift.
|
|
2695
|
-
* @param {string} [parentTokenLayerId] - Optional immutable parent token layer. Tokens in this layer must nest within a parent-layer token; the parent layer must be in the same text layer and be "non-overlapping" or "partitioning" (an "any" parent is rejected). A nested layer may be "any" or "non-overlapping" but not "partitioning" (partitioning is only for root layers), e.g. words (non-overlapping, parent=sentences) within sentences (partitioning).
|
|
2696
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
2697
|
-
* @param {object} [opts]
|
|
2698
|
-
* @param {string} [opts.id] - The new entity's id, minted by the caller (see uuidv7)
|
|
2699
|
-
* @returns {Promise<Created>}
|
|
2700
|
-
*/
|
|
2701
|
-
create: (textLayerId: string, name: string, overlapMode?: string, parentTokenLayerId?: string, auditMessage?: string, { id }?: {
|
|
2702
|
-
id?: string;
|
|
2703
|
-
}) => Promise<Created>;
|
|
2704
|
-
/**
|
|
2705
|
-
* Get a layer by ID.
|
|
2706
|
-
* @param {string} layerId - The layer ID
|
|
2707
|
-
* @returns {Promise<LayerRecords[K]>}
|
|
2708
|
-
*/
|
|
2709
|
-
get: (layerId: string) => Promise<TokenLayer>;
|
|
2710
|
-
/**
|
|
2711
|
-
* Delete a layer.
|
|
2712
|
-
* @param {string} layerId - The layer ID
|
|
2713
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
2714
|
-
* @returns {Promise<void>}
|
|
2715
|
-
*/
|
|
2716
|
-
delete: (layerId: string, auditMessage?: string) => Promise<void>;
|
|
2717
|
-
/**
|
|
2718
|
-
* Rename a layer.
|
|
2719
|
-
* @param {string} layerId - The layer ID
|
|
2720
|
-
* @param {string} name - The new name
|
|
2721
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
2722
|
-
* @returns {Promise<LayerRecords[K]>}
|
|
2723
|
-
*/
|
|
2724
|
-
update: (layerId: string, name: string, auditMessage?: string) => Promise<TokenLayer>;
|
|
2725
|
-
/**
|
|
2726
|
-
* Move a layer one place in its display order.
|
|
2727
|
-
* @param {string} layerId - The layer ID
|
|
2728
|
-
* @param {string} direction - The direction ("up" or "down")
|
|
2729
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
2730
|
-
* @returns {Promise<void>}
|
|
2731
|
-
*/
|
|
2732
|
-
shift: (layerId: string, direction: string, auditMessage?: string) => Promise<void>;
|
|
2733
|
-
};
|
|
2734
|
-
documents: {
|
|
2735
|
-
/**
|
|
2736
|
-
* Get audit log for a document. Transparently follows pagination cursors
|
|
2737
|
-
* and returns the full flat array. Each entry, and each of its `ops`,
|
|
2738
|
-
* says what kind of credential made it as `credential`: `login`,
|
|
2739
|
-
* `named-token` or `delegated` (absent on older operations, `service`
|
|
2740
|
-
* on some from 2026-10-06 to 2026-10-08),
|
|
2741
|
-
* beside `apiToken` (the named token's id and name) when there was one.
|
|
2742
|
-
* @param {string} documentId - The document ID
|
|
2743
|
-
* @param {string} [startTime] - Start of time range
|
|
2744
|
-
* @param {string} [endTime] - End of time range
|
|
2745
|
-
* @param {string[]|string} [opTypes] - Only return operations of these
|
|
2746
|
-
* types, spelled as in an entry's `op/type` (e.g.
|
|
2747
|
-
* `['span-layer/create', 'span-layer/delete']`). An entry appears when
|
|
2748
|
-
* one of its operations matches, carrying only the ones that did.
|
|
2749
|
-
* @param {string[]|string} [kinds] - Only the entries of operations of
|
|
2750
|
-
* these kinds (e.g. `['review', 'guess-adoption']`), each whole
|
|
2751
|
-
* @returns {Promise<AuditEntry[]>}
|
|
2752
|
-
*/
|
|
2753
|
-
audit: (documentId: string, startTime?: string, endTime?: string, opTypes?: string[] | string, kinds?: string[] | string) => Promise<AuditEntry[]>;
|
|
2754
|
-
/**
|
|
2755
|
-
* One page of the same log, newest-first with `order: "desc"`. Use this
|
|
2756
|
-
* rather than audit() wherever the caller wants the recent end of a log
|
|
2757
|
-
* that may be long: audit() walks every page before it resolves.
|
|
2758
|
-
* @param {string} documentId - The document ID
|
|
2759
|
-
* @param {object} [opts]
|
|
2760
|
-
* @param {string} [opts.startTime] - Only entries at or after this instant
|
|
2761
|
-
* @param {string} [opts.endTime] - Only entries at or before this instant
|
|
2762
|
-
* @param {string[]|string} [opts.opTypes] - Only these op types
|
|
2763
|
-
* @param {OperationKind[]|string} [opts.kinds] - Only the entries of operations of these kinds, each whole
|
|
2764
|
-
* @param {"asc"|"desc"} [opts.order] - "desc" pages newest-first
|
|
2765
|
-
* @param {number} [opts.limit] - Page size (1..1000; server default 100)
|
|
2766
|
-
* @param {string} [opts.cursor] - Opaque cursor from a previous page
|
|
2767
|
-
* @param {number} [opts.opsLimit] - Keep only each entry's oldest N
|
|
2768
|
-
* operations in `ops` (1..1000). `opCount` on every entry says how
|
|
2769
|
-
* many it has
|
|
2770
|
-
* @param {string} [opts.entryId] - Read only this entry, not a page
|
|
2771
|
-
* @returns {Promise<Page<AuditEntry>>}
|
|
2772
|
-
*/
|
|
2773
|
-
auditPage: (documentId: string, { startTime, endTime, opTypes, kinds, order, limit, cursor, opsLimit, entryId }?: {
|
|
2774
|
-
startTime?: string;
|
|
2775
|
-
endTime?: string;
|
|
2776
|
-
opTypes?: string[] | string;
|
|
2777
|
-
kinds?: OperationKind[] | string;
|
|
2778
|
-
order?: "asc" | "desc";
|
|
2779
|
-
limit?: number;
|
|
2780
|
-
cursor?: string;
|
|
2781
|
-
opsLimit?: number;
|
|
2782
|
-
entryId?: string;
|
|
2783
|
-
}) => Promise<Page<AuditEntry>>;
|
|
2784
|
-
/**
|
|
2785
|
-
* Restore a document to its state at an earlier time, as one
|
|
2786
|
-
* operation: what was deleted since then comes back under its original
|
|
2787
|
-
* id, what was added since is removed, and what changed is set back,
|
|
2788
|
-
* across every layer. A layer deleted since then, or a vocabulary entry
|
|
2789
|
-
* that no longer exists, is skipped and reported under `skipped`. A name
|
|
2790
|
-
* another document holds now stays with it, and the document keeps its
|
|
2791
|
-
* current name, reported under `nameKept` (`{name, taken}`).
|
|
2792
|
-
* Resolves to a summary of the changes. Maintainers only.
|
|
2793
|
-
* @param {string} documentId - The document ID
|
|
2794
|
-
* @param {string} asOf - The moment to go back to (ISO-8601 instant),
|
|
2795
|
-
* typically a history entry's `endTime`
|
|
2796
|
-
* @param {{dryRun?: boolean}} [options] - `{ dryRun }`: with `dryRun` true nothing
|
|
2797
|
-
* is written and the summary says what would change
|
|
2798
|
-
* @param {string} [auditMessage] - Custom audit message for this operation
|
|
2799
|
-
* @returns {Promise<DocumentRestoreSummary>}
|
|
2800
|
-
*/
|
|
2801
|
-
restore: (documentId: string, asOf: string, { dryRun }?: {
|
|
2802
|
-
dryRun?: boolean;
|
|
2803
|
-
}, auditMessage?: string) => Promise<DocumentRestoreSummary>;
|
|
2804
|
-
/**
|
|
2805
|
-
* Get a document. Set `includeBody` to true to include all data.
|
|
2806
|
-
*
|
|
2807
|
-
* A document with a recording has `mediaUrl`, and `mediaDuration`, the
|
|
2808
|
-
* recording's length in seconds, when the server could read it from the
|
|
2809
|
-
* file at upload (WAV, MP4, M4A, MOV, FLAC, MP3).
|
|
2810
|
-
*
|
|
2811
|
-
* `layers` narrows a body read to the layers you name (ids of any kind:
|
|
2812
|
-
* text, token, span, or relation). A layer comes back when it is named
|
|
2813
|
-
* or is an ancestor of a named layer, and carries its own
|
|
2814
|
-
* texts/tokens/spans/relations/vocabs only when it is itself named — so
|
|
2815
|
-
* name the text layer too if you also want the text body. An id that is
|
|
2816
|
-
* not a layer of this document's project is an error, not a quietly
|
|
2817
|
-
* smaller response. Requires `includeBody`.
|
|
2818
|
-
* @param {string} documentId - The document ID
|
|
2819
|
-
* @param {boolean} [includeBody] - Include document body data
|
|
2820
|
-
* @param {string} [asOf] - Temporal query timestamp
|
|
2821
|
-
* @param {string[]|string} [layers] - Layer ids to restrict a body read to
|
|
2822
|
-
* @returns {Promise<PlaidDocument>}
|
|
2823
|
-
*/
|
|
2824
|
-
get: (documentId: string, includeBody?: boolean, asOf?: string, layers?: string[] | string) => Promise<PlaidDocument>;
|
|
2825
|
-
/**
|
|
2826
|
-
* Delete a document and all data contained.
|
|
2827
|
-
* @param {string} documentId - The document ID
|
|
2828
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
2829
|
-
* @returns {Promise<void>}
|
|
2830
|
-
*/
|
|
2831
|
-
delete: (documentId: string, auditMessage?: string) => Promise<void>;
|
|
2832
|
-
/**
|
|
2833
|
-
* Update a document's name. A name another document of the project holds,
|
|
2834
|
-
* ignoring case,
|
|
2835
|
-
* is refused with 422 and `name-taken`.
|
|
2836
|
-
* @param {string} documentId - The document ID
|
|
2837
|
-
* @param {string} name - The name
|
|
2838
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
2839
|
-
* @returns {Promise<PlaidDocument>}
|
|
2840
|
-
*/
|
|
2841
|
-
update: (documentId: string, name: string, auditMessage?: string) => Promise<PlaidDocument>;
|
|
2842
|
-
/**
|
|
2843
|
-
* Create a new document in a project.
|
|
2844
|
-
* @param {string} projectId - The project ID
|
|
2845
|
-
* @param {string} name - The name
|
|
2846
|
-
* @param {any} [metadata] - Metadata map. Omit to leave unset; pass null to send JSON null.
|
|
2847
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
2848
|
-
* @param {object} [opts]
|
|
2849
|
-
* @param {string} [opts.id] - The new entity's id, minted by the caller (see uuidv7)
|
|
2850
|
-
* @param {boolean} [opts.freeName] - A name another document of the project holds, ignoring case, becomes
|
|
2851
|
-
* the first free "name (2)", "name (3)" and on. Without it such a name is refused with 422
|
|
2852
|
-
* and `name-taken`.
|
|
2853
|
-
* @returns {Promise<{id: string, name: string}>} The new id and the name stored
|
|
2854
|
-
*/
|
|
2855
|
-
create: (projectId: string, name: string, metadata?: any, auditMessage?: string, { id, freeName }?: {
|
|
2856
|
-
id?: string;
|
|
2857
|
-
freeName?: boolean;
|
|
2858
|
-
}) => Promise<{
|
|
2859
|
-
id: string;
|
|
2860
|
-
name: string;
|
|
2861
|
-
}>;
|
|
2862
|
-
/**
|
|
2863
|
-
* Copy a document and everything in it into a new document of the same
|
|
2864
|
-
* project, as one operation. The copy shares the source's layers and
|
|
2865
|
-
* the vocabulary entries its links name, and holds the source's texts,
|
|
2866
|
-
* tokens, spans, relations and vocab links under fresh ids, with their
|
|
2867
|
-
* metadata. Comments do not travel. The media file does, unless
|
|
2868
|
-
* `includeMedia` is false. Resolves to `{ id, name }`, plus `mediaError` when
|
|
2869
|
-
* the source had media the copy could not take with it. A name another
|
|
2870
|
-
* document of the project holds, ignoring case, is refused with 422 and `name-taken`,
|
|
2871
|
-
* unless `freeName`, which takes the first free "name (2)", "name (3)"
|
|
2872
|
-
* and on.
|
|
2873
|
-
* @param {string} documentId - The document to copy
|
|
2874
|
-
* @param {string} name - The new document's name
|
|
2875
|
-
* @param {{includeMedia?: boolean, id?: string, freeName?: boolean}} [options] - `{ includeMedia }`: false leaves the media
|
|
2876
|
-
* file behind
|
|
2877
|
-
* @param {string} [auditMessage] - Custom audit message for this operation
|
|
2878
|
-
* @returns {Promise<{id: string, name: string, mediaError?: string}>}
|
|
2879
|
-
*/
|
|
2880
|
-
copy: (documentId: string, name: string, { includeMedia, id, freeName }?: {
|
|
2881
|
-
includeMedia?: boolean;
|
|
2882
|
-
id?: string;
|
|
2883
|
-
freeName?: boolean;
|
|
2884
|
-
}, auditMessage?: string) => Promise<{
|
|
2885
|
-
id: string;
|
|
2886
|
-
name: string;
|
|
2887
|
-
mediaError?: string;
|
|
2888
|
-
}>;
|
|
2889
|
-
/**
|
|
2890
|
-
* Replace all metadata of an entity. Keys left out of the new map are removed.
|
|
2891
|
-
* @param {string} id - The entity's ID
|
|
2892
|
-
* @param {object} body - The new metadata map
|
|
2893
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
2894
|
-
* @returns {Promise<MetadataRecords[K]>}
|
|
2895
|
-
*/
|
|
2896
|
-
setMetadata: (id: string, body: object, auditMessage?: string) => Promise<PlaidDocument>;
|
|
2897
|
-
/**
|
|
2898
|
-
* Remove all metadata from an entity.
|
|
2899
|
-
* @param {string} id - The entity's ID
|
|
2900
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
2901
|
-
* @returns {Promise<MetadataRecords[K]>}
|
|
2902
|
-
*/
|
|
2903
|
-
deleteMetadata: (id: string, auditMessage?: string) => Promise<PlaidDocument>;
|
|
2904
|
-
/**
|
|
2905
|
-
* Edit an entity's metadata with a list of ops applied in order, in one operation. `{op: 'set', path, value}` writes value at path, creating missing objects along it; `{op: 'delete', path}` removes the key at path (a no-op when absent). A path is a non-empty array of keys, the first a top-level key. A path through a non-object is refused (400). See metadataOps and applyMetadataOps.
|
|
2906
|
-
* @param {string} id - The entity's ID
|
|
2907
|
-
* @param {MetadataOp[]} body - The metadata ops
|
|
2908
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
2909
|
-
* @returns {Promise<MetadataRecords[K]>}
|
|
2910
|
-
*/
|
|
2911
|
-
patchMetadata: (id: string, body: MetadataOp[], auditMessage?: string) => Promise<PlaidDocument>;
|
|
2912
|
-
/**
|
|
2913
|
-
* Check the lock status of a document.
|
|
2914
|
-
* @param {string} documentId - The document ID
|
|
2915
|
-
* @returns {Promise<{userId: string, expiresAt: number} | void>}
|
|
2916
|
-
*/
|
|
2917
|
-
checkLock: (documentId: string) => Promise<{
|
|
2918
|
-
userId: string;
|
|
2919
|
-
expiresAt: number;
|
|
2920
|
-
} | void>;
|
|
2921
|
-
/**
|
|
2922
|
-
* Acquire a document lock as a new holder.
|
|
2923
|
-
*
|
|
2924
|
-
* The answer's `lockId` names the holder: `renewLock` and `releaseLock`
|
|
2925
|
-
* take it. While the lock is held, a second acquire is refused with
|
|
2926
|
-
* HTTP 423, whoever makes it, this user included.
|
|
2927
|
-
*
|
|
2928
|
-
* `newLockId` names the holder from the client's side (a fresh UUID). An
|
|
2929
|
-
* acquire whose answer never arrived can then be sent again, which
|
|
2930
|
-
* answers 200 while that holder has the lock, or released. Without it
|
|
2931
|
-
* the server mints the id, and a lost answer leaves a lock nobody can
|
|
2932
|
-
* release until it expires.
|
|
2933
|
-
*
|
|
2934
|
-
* outOfBand: the lock is a signal, not project data (see the note at
|
|
2935
|
-
* the top of http.js). Queued on a batch it would be taken only at
|
|
2936
|
-
* submit, after every write it was meant to guard, and until then answer
|
|
2937
|
-
* success to a caller that does not hold it and cannot see the 423
|
|
2938
|
-
* saying somebody else does.
|
|
2939
|
-
* @param {string} documentId - The document ID
|
|
2940
|
-
* @param {string} [auditMessage]
|
|
2941
|
-
* @param {string} [newLockId] - A holder id this client minted
|
|
2942
|
-
* @returns {Promise<LockGrant>}
|
|
2943
|
-
*/
|
|
2944
|
-
acquireLock: (documentId: string, auditMessage?: string, newLockId?: string) => Promise<LockGrant>;
|
|
2945
|
-
/**
|
|
2946
|
-
* Renew the lock `lockId` holds while it is live. HTTP 423 if another
|
|
2947
|
-
* holder has it, and also once it has expired or been dropped, even when
|
|
2948
|
-
* nobody holds the document now: a renewal never takes a free document.
|
|
2949
|
-
* outOfBand, for the same reason as acquireLock.
|
|
2950
|
-
* @param {string} documentId - The document ID
|
|
2951
|
-
* @param {string} lockId - The `lockId` acquireLock answered with
|
|
2952
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
2953
|
-
* @returns {Promise<LockGrant>}
|
|
2954
|
-
*/
|
|
2955
|
-
renewLock: (documentId: string, lockId: string, auditMessage?: string) => Promise<LockGrant>;
|
|
2956
|
-
/**
|
|
2957
|
-
* Release the lock `lockId` holds. Idempotent: a lock that holder no
|
|
2958
|
-
* longer has is left alone. outOfBand, for the same reason as
|
|
2959
|
-
* acquireLock: queued, the lock would be held until the batch submits,
|
|
2960
|
-
* and not released at all if it aborts.
|
|
2961
|
-
* @param {string} documentId - The document ID
|
|
2962
|
-
* @param {string} lockId - The `lockId` acquireLock answered with
|
|
2963
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
2964
|
-
* @returns {Promise<void>}
|
|
2965
|
-
*/
|
|
2966
|
-
releaseLock: (documentId: string, lockId: string, auditMessage?: string) => Promise<void>;
|
|
2967
|
-
/**
|
|
2968
|
-
* Hold this document's server-enforced lock for the length of `fn`,
|
|
2969
|
-
* releasing it on the way out (including on error). Resolves to what
|
|
2970
|
-
* `fn` returned.
|
|
2971
|
-
*
|
|
2972
|
-
* await client.documents.locked(docId, async () => {
|
|
2973
|
-
* // delete + recreate tokens
|
|
2974
|
-
* });
|
|
2975
|
-
*
|
|
2976
|
-
* Wrap any multi-step, server-side mutation of a document that must not
|
|
2977
|
-
* interleave with a human editor or another service, e.g. a parser or
|
|
2978
|
-
* tokenizer that deletes and recreates a document's tokens, spans and
|
|
2979
|
-
* relations. A single atomic call does not need it. While the lock is
|
|
2980
|
-
* held, writes to the document by ANOTHER user are refused with HTTP
|
|
2981
|
-
* 423; the holder's own writes pass and renew it. If anyone already
|
|
2982
|
-
* holds it, another block of this same user included, this rejects with
|
|
2983
|
-
* a readable 423 and `fn` does not run.
|
|
2984
|
-
*
|
|
2985
|
-
* The lock is renewed for as long as `fn` runs, so work that computes
|
|
2986
|
-
* for minutes before it writes holds the lock the whole time rather than
|
|
2987
|
-
* only for its first minute. If a renewal fails the lock is gone: every
|
|
2988
|
-
* later write from this client throws `DocumentLockLost`, and a block
|
|
2989
|
-
* that got to the end anyway ends with that error rather than reporting
|
|
2990
|
-
* success. `fn` receives a lock handle and may read `lock.lost` (or call
|
|
2991
|
-
* `lock.raiseIfLost()`) to give up sooner.
|
|
2992
|
-
*
|
|
2993
|
-
* The lock is per HOLDER: each block is its own, named by
|
|
2994
|
-
* `lock.lockId`, and only that id renews or releases it. NOT
|
|
2995
|
-
* re-entrant: a nested `locked()` block on one document is a second
|
|
2996
|
-
* holder and gets the 423. Lock at exactly one level per call path.
|
|
2997
|
-
* The block mints its holder id and sends it with the acquire, so an
|
|
2998
|
-
* acquire whose answer was lost is sent again (up to three tries) and,
|
|
2999
|
-
* if none is answered, released rather than left to expire. A
|
|
3000
|
-
* lost lock is recorded on the CLIENT, like strict mode, so it stops
|
|
3001
|
-
* every write the client makes (on any batch of it too) and not only the
|
|
3002
|
-
* ones this block makes.
|
|
3003
|
-
*
|
|
3004
|
-
* A core restart drops every lock, and until the next renewal finds it
|
|
3005
|
-
* gone (up to half the lock window) this block's writes still pass, since
|
|
3006
|
-
* writes carry no lock id. When a write must not land past that point,
|
|
3007
|
-
* hold the document in strict mode too (`enterStrictMode`), so such a
|
|
3008
|
-
* write is refused with a 409.
|
|
3009
|
-
* @template T
|
|
3010
|
-
* @param {string} documentId - The document ID
|
|
3011
|
-
* @param {(lock: import("./documentLock.js").DocumentLock) => T | Promise<T>} fn - The work to run while holding it
|
|
3012
|
-
* @param {{keepAlive?: boolean}} [options] - `{ keepAlive }`: renew on a timer (default true)
|
|
3013
|
-
* @returns {Promise<T>}
|
|
3014
|
-
*/
|
|
3015
|
-
locked: <T>(documentId: string, fn: (lock: import("./documentLock.js").DocumentLock) => T | Promise<T>, options?: {
|
|
3016
|
-
keepAlive?: boolean;
|
|
3017
|
-
}) => Promise<T>;
|
|
3018
|
-
/**
|
|
3019
|
-
* Get the media file for a document. Media is not versioned, so there is
|
|
3020
|
-
* no as-of form: the route refuses the parameter. Prefer the document's
|
|
3021
|
-
* own `mediaUrl`, which carries the file's version for caching.
|
|
3022
|
-
* @param {string} documentId - The document ID
|
|
3023
|
-
* @returns {Promise<ArrayBuffer>}
|
|
3024
|
-
*/
|
|
3025
|
-
getMedia: (documentId: string) => Promise<ArrayBuffer>;
|
|
3026
|
-
/**
|
|
3027
|
-
* Get a link that plays the document's recording without an
|
|
3028
|
-
* Authorization header, for an audio or video element's `src`, which
|
|
3029
|
-
* cannot send one. `url` is the document's media URL with a
|
|
3030
|
-
* `media-token` added, resolved against the client's base URL. The token
|
|
3031
|
-
* opens only this recording, for this user, and the server refuses it on
|
|
3032
|
-
* every other route. It expires at `expiresAt` (an ISO-8601 instant, six
|
|
3033
|
-
* hours on by default), and sooner when the user signs out, changes
|
|
3034
|
-
* password or loses access to the project: ask for a new link then. A
|
|
3035
|
-
* document with no recording is a 404. Writes nothing, so it takes no
|
|
3036
|
-
* Idempotency-Key and goes over the wire when made on a batch.
|
|
3037
|
-
* @param {string} documentId - The document ID
|
|
3038
|
-
* @returns {Promise<{url: string, expiresAt: string}>}
|
|
3039
|
-
*/
|
|
3040
|
-
mediaLink: (documentId: string) => Promise<{
|
|
3041
|
-
url: string;
|
|
3042
|
-
expiresAt: string;
|
|
3043
|
-
}>;
|
|
3044
|
-
/**
|
|
3045
|
-
* Upload a media file for a document. Uses Apache Tika for content validation.
|
|
3046
|
-
* A document that already has a recording refuses it with a 409
|
|
3047
|
-
* (`media-exists`, and the current `media-url`): delete that one first.
|
|
3048
|
-
* A WAV whose samples are not PCM, 32-bit float, A-law or mu-law (IMA or
|
|
3049
|
-
* MS ADPCM, GSM, 64-bit float and the rest), which browsers cannot play,
|
|
3050
|
-
* is refused with a 415 whose `error` names its coding.
|
|
3051
|
-
* @param {string} documentId - The document ID
|
|
3052
|
-
* @param {File} file - The file to upload
|
|
3053
|
-
* @param {string} [auditMessage] - Custom audit-log message for this write
|
|
3054
|
-
* @param {{onProgress?: (progress: {loaded: number, total: number | null}) => void}} [options] - `{ onProgress }`: called with `{ loaded, total }` (bytes) as the file goes up. In a browser the upload then travels by XMLHttpRequest, and the request timeout only fires when the upload stalls, not on total time.
|
|
3055
|
-
* @returns {Promise<{message: string, extension: string, contentType: string}>}
|
|
3056
|
-
*/
|
|
3057
|
-
uploadMedia: (documentId: string, file: File, auditMessage?: string, { onProgress }?: {
|
|
3058
|
-
onProgress?: (progress: {
|
|
3059
|
-
loaded: number;
|
|
3060
|
-
total: number | null;
|
|
3061
|
-
}) => void;
|
|
3062
|
-
}) => Promise<{
|
|
3063
|
-
message: string;
|
|
3064
|
-
extension: string;
|
|
3065
|
-
contentType: string;
|
|
3066
|
-
}>;
|
|
3067
|
-
/**
|
|
3068
|
-
* Delete media file for a document
|
|
3069
|
-
* @param {string} documentId - The document ID
|
|
3070
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
3071
|
-
* @param {{mediaVersion?: string}} [options] - `mediaVersion`: the
|
|
3072
|
-
* recording meant, the `?v=` of the document's `mediaUrl`. The delete
|
|
3073
|
-
* is refused with a 409 (`media-changed`, and the current `media-url`)
|
|
3074
|
-
* when the stored recording is another one.
|
|
3075
|
-
* @returns {Promise<void>}
|
|
3076
|
-
*/
|
|
3077
|
-
deleteMedia: (documentId: string, auditMessage?: string, { mediaVersion }?: {
|
|
3078
|
-
mediaVersion?: string;
|
|
3079
|
-
}) => Promise<void>;
|
|
3080
|
-
};
|
|
3081
|
-
projects: {
|
|
3082
|
-
/**
|
|
3083
|
-
* Assign a user as a maintainer for this project.
|
|
3084
|
-
* @param {string} id - The resource ID
|
|
3085
|
-
* @param {string} userId - The user ID
|
|
3086
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
3087
|
-
* @returns {Promise<void>}
|
|
3088
|
-
*/
|
|
3089
|
-
addMaintainer: (id: string, userId: string, auditMessage?: string) => Promise<void>;
|
|
3090
|
-
/**
|
|
3091
|
-
* Remove a user's maintainer privileges for this project.
|
|
3092
|
-
* @param {string} id - The resource ID
|
|
3093
|
-
* @param {string} userId - The user ID
|
|
3094
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
3095
|
-
* @returns {Promise<void>}
|
|
3096
|
-
*/
|
|
3097
|
-
removeMaintainer: (id: string, userId: string, auditMessage?: string) => Promise<void>;
|
|
3098
|
-
/**
|
|
3099
|
-
* Get audit log for a project. Transparently follows pagination cursors
|
|
3100
|
-
* and returns the full flat array. Each entry, and each of its `ops`,
|
|
3101
|
-
* says what kind of credential made it as `credential`: `login`,
|
|
3102
|
-
* `named-token` or `delegated` (absent on older operations, `service`
|
|
3103
|
-
* on some from 2026-10-06 to 2026-10-08),
|
|
3104
|
-
* beside `apiToken` (the named token's id and name) when there was one.
|
|
3105
|
-
* @param {string} projectId - The project ID
|
|
3106
|
-
* @param {string} [startTime] - Start of time range
|
|
3107
|
-
* @param {string} [endTime] - End of time range
|
|
3108
|
-
* @param {string[]|string} [opTypes] - Only return operations of these
|
|
3109
|
-
* types, spelled as in an entry's `op/type` (e.g.
|
|
3110
|
-
* `['span-layer/create', 'span-layer/delete']`). An entry appears when
|
|
3111
|
-
* one of its operations matches, carrying only the ones that did.
|
|
3112
|
-
* @param {string[]|string} [kinds] - Only the entries of operations of
|
|
3113
|
-
* these kinds (e.g. `['review', 'guess-adoption']`), each whole
|
|
3114
|
-
* @returns {Promise<AuditEntry[]>}
|
|
3115
|
-
*/
|
|
3116
|
-
audit: (projectId: string, startTime?: string, endTime?: string, opTypes?: string[] | string, kinds?: string[] | string) => Promise<AuditEntry[]>;
|
|
3117
|
-
/**
|
|
3118
|
-
* One page of the same log, newest-first with `order: "desc"`. Use this
|
|
3119
|
-
* rather than audit() wherever the caller wants the recent end of a log
|
|
3120
|
-
* that may be long: audit() walks every page before it resolves.
|
|
3121
|
-
* @param {string} projectId - The project ID
|
|
3122
|
-
* @param {object} [opts]
|
|
3123
|
-
* @param {string} [opts.startTime] - Only entries at or after this instant
|
|
3124
|
-
* @param {string} [opts.endTime] - Only entries at or before this instant
|
|
3125
|
-
* @param {string[]|string} [opts.opTypes] - Only these op types
|
|
3126
|
-
* @param {OperationKind[]|string} [opts.kinds] - Only the entries of operations of these kinds, each whole
|
|
3127
|
-
* @param {"asc"|"desc"} [opts.order] - "desc" pages newest-first
|
|
3128
|
-
* @param {number} [opts.limit] - Page size (1..1000; server default 100)
|
|
3129
|
-
* @param {string} [opts.cursor] - Opaque cursor from a previous page
|
|
3130
|
-
* @param {number} [opts.opsLimit] - Keep only each entry's oldest N
|
|
3131
|
-
* operations in `ops` (1..1000). `opCount` on every entry says how
|
|
3132
|
-
* many it has
|
|
3133
|
-
* @param {string} [opts.entryId] - Read only this entry, not a page
|
|
3134
|
-
* @returns {Promise<Page<AuditEntry>>}
|
|
3135
|
-
*/
|
|
3136
|
-
auditPage: (projectId: string, { startTime, endTime, opTypes, kinds, order, limit, cursor, opsLimit, entryId }?: {
|
|
3137
|
-
startTime?: string;
|
|
3138
|
-
endTime?: string;
|
|
3139
|
-
opTypes?: string[] | string;
|
|
3140
|
-
kinds?: OperationKind[] | string;
|
|
3141
|
-
order?: "asc" | "desc";
|
|
3142
|
-
limit?: number;
|
|
3143
|
-
cursor?: string;
|
|
3144
|
-
opsLimit?: number;
|
|
3145
|
-
entryId?: string;
|
|
3146
|
-
}) => Promise<Page<AuditEntry>>;
|
|
3147
|
-
/**
|
|
3148
|
-
* When the calling user last wrote to each document in a project, as a
|
|
3149
|
-
* `{documentId: timestamp}` map. Documents they have never written to
|
|
3150
|
-
* are absent. One request covers a whole document list.
|
|
3151
|
-
*
|
|
3152
|
-
* The response is NOT key-transformed: its keys are document ids, and
|
|
3153
|
-
* camelCasing would mangle the hyphens in a UUID.
|
|
3154
|
-
* @param {string} projectId - The project ID
|
|
3155
|
-
* @returns {Promise<Object<string, string>>}
|
|
3156
|
-
*/
|
|
3157
|
-
myLastEdits: (projectId: string) => Promise<{
|
|
3158
|
-
[x: string]: string;
|
|
3159
|
-
}>;
|
|
3160
|
-
/**
|
|
3161
|
-
* Link a vocabulary to a project.
|
|
3162
|
-
* @param {string} id - The resource ID
|
|
3163
|
-
* @param {string} vocabId - The vocab layer ID
|
|
3164
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
3165
|
-
* @returns {Promise<void>}
|
|
3166
|
-
*/
|
|
3167
|
-
linkVocab: (id: string, vocabId: string, auditMessage?: string) => Promise<void>;
|
|
3168
|
-
/**
|
|
3169
|
-
* Unlink a vocabulary from a project.
|
|
3170
|
-
* @param {string} id - The resource ID
|
|
3171
|
-
* @param {string} vocabId - The vocab layer ID
|
|
3172
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
3173
|
-
* @returns {Promise<void>}
|
|
3174
|
-
*/
|
|
3175
|
-
unlinkVocab: (id: string, vocabId: string, auditMessage?: string) => Promise<void>;
|
|
3176
|
-
/**
|
|
3177
|
-
* Get a project by ID. To fetch the project's documents, use
|
|
3178
|
-
* listDocuments(id) — the include-documents flag has been removed.
|
|
3179
|
-
* @param {string} id - The resource ID
|
|
3180
|
-
* @returns {Promise<Project>}
|
|
3181
|
-
*/
|
|
3182
|
-
get: (id: string) => Promise<Project>;
|
|
3183
|
-
/**
|
|
3184
|
-
* List all documents in a project. Transparently follows pagination
|
|
3185
|
-
* cursors and returns the full flat array.
|
|
3186
|
-
*
|
|
3187
|
-
* Note: this endpoint does not support temporal (`as-of`) queries; the
|
|
3188
|
-
* server rejects `?as-of=` on the documents-list route with a 400.
|
|
3189
|
-
* @param {string} id - The project ID
|
|
3190
|
-
* @returns {Promise<DocumentListEntry[]>}
|
|
3191
|
-
*/
|
|
3192
|
-
listDocuments: (id: string) => Promise<DocumentListEntry[]>;
|
|
3193
|
-
/**
|
|
3194
|
-
* Fetch a single page of a project's documents.
|
|
3195
|
-
*
|
|
3196
|
-
* Note: this endpoint does not support temporal (`as-of`) queries; the
|
|
3197
|
-
* server rejects `?as-of=` on the documents-list route with a 400.
|
|
3198
|
-
* @param {string} id - The project ID
|
|
3199
|
-
* @param {object} [opts]
|
|
3200
|
-
* @param {number} [opts.limit] - Page size (1..1000; server default 100)
|
|
3201
|
-
* @param {string} [opts.cursor] - Opaque cursor from a previous page
|
|
3202
|
-
* @returns {Promise<Page<DocumentListEntry>>}
|
|
3203
|
-
*/
|
|
3204
|
-
listDocumentsPage: (id: string, { limit, cursor }?: {
|
|
3205
|
-
limit?: number;
|
|
3206
|
-
cursor?: string;
|
|
3207
|
-
}) => Promise<Page<DocumentListEntry>>;
|
|
3208
|
-
/**
|
|
3209
|
-
* Async-iterate a project's documents page by page; yields each page's
|
|
3210
|
-
* entries array.
|
|
3211
|
-
*
|
|
3212
|
-
* Note: this endpoint does not support temporal (`as-of`) queries; the
|
|
3213
|
-
* server rejects `?as-of=` on the documents-list route with a 400.
|
|
3214
|
-
* @param {string} id - The project ID
|
|
3215
|
-
* @param {object} [opts]
|
|
3216
|
-
* @param {number} [opts.pageSize] - Per-request page size
|
|
3217
|
-
* @returns {AsyncGenerator<DocumentListEntry[]>}
|
|
3218
|
-
*/
|
|
3219
|
-
iterDocuments: (id: string, { pageSize }?: {
|
|
3220
|
-
pageSize?: number;
|
|
3221
|
-
}) => AsyncGenerator<DocumentListEntry[]>;
|
|
3222
|
-
/**
|
|
3223
|
-
* Delete a project and everything in it. This is irrecoverable. The
|
|
3224
|
-
* project is gone when this returns, and what it holds is removed on
|
|
3225
|
-
* the server afterwards.
|
|
3226
|
-
* @param {string} id - The resource ID
|
|
3227
|
-
* @param {string} [auditMessage] - Custom audit-log message
|
|
3228
|
-
* @param {object} [options]
|
|
3229
|
-
* @param {number} [options.timeout] - Per-request timeout in ms, the client's own by default (0/null disables)
|
|
3230
|
-
* @returns {Promise<void>}
|
|
3231
|
-
*/
|
|
3232
|
-
delete: (id: string, auditMessage?: string, { timeout }?: {
|
|
3233
|
-
timeout?: number;
|
|
3234
|
-
}) => Promise<void>;
|
|
3235
|
-
/**
|
|
3236
|
-
* Update a project's name.
|
|
3237
|
-
* @param {string} id - The resource ID
|
|
3238
|
-
* @param {string} name - The name
|
|
3239
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
3240
|
-
* @returns {Promise<Project>}
|
|
3241
|
-
*/
|
|
3242
|
-
update: (id: string, name: string, auditMessage?: string) => Promise<Project>;
|
|
3243
|
-
/**
|
|
3244
|
-
* List all projects accessible to user. Transparently follows pagination
|
|
3245
|
-
* cursors and returns the full flat array.
|
|
3246
|
-
* @returns {Promise<ProjectListEntry[]>}
|
|
3247
|
-
*/
|
|
3248
|
-
list: () => Promise<ProjectListEntry[]>;
|
|
3249
|
-
/**
|
|
3250
|
-
* Fetch a single page of projects.
|
|
3251
|
-
* @param {object} [opts]
|
|
3252
|
-
* @param {number} [opts.limit] - Page size (1..1000; server default 100)
|
|
3253
|
-
* @param {string} [opts.cursor] - Opaque cursor from a previous page
|
|
3254
|
-
* @returns {Promise<Page<ProjectListEntry>>}
|
|
3255
|
-
*/
|
|
3256
|
-
listPage: ({ limit, cursor }?: {
|
|
3257
|
-
limit?: number;
|
|
3258
|
-
cursor?: string;
|
|
3259
|
-
}) => Promise<Page<ProjectListEntry>>;
|
|
3260
|
-
/**
|
|
3261
|
-
* Async-iterate projects page by page; yields each page's entries array.
|
|
3262
|
-
* @param {object} [opts]
|
|
3263
|
-
* @param {number} [opts.pageSize] - Per-request page size
|
|
3264
|
-
* @returns {AsyncGenerator<ProjectListEntry[]>}
|
|
3265
|
-
*/
|
|
3266
|
-
iterPages: ({ pageSize }?: {
|
|
3267
|
-
pageSize?: number;
|
|
3268
|
-
}) => AsyncGenerator<ProjectListEntry[]>;
|
|
3269
|
-
/**
|
|
3270
|
-
* Create a new project. Note: this also registers the user as a maintainer.
|
|
3271
|
-
* @param {string} name - The name
|
|
3272
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
3273
|
-
* @param {object} [opts]
|
|
3274
|
-
* @param {string} [opts.id] - The new entity's id, minted by the caller (see uuidv7)
|
|
3275
|
-
* @returns {Promise<Created>}
|
|
3276
|
-
*/
|
|
3277
|
-
create: (name: string, auditMessage?: string, { id }?: {
|
|
3278
|
-
id?: string;
|
|
3279
|
-
}) => Promise<Created>;
|
|
3280
|
-
/**
|
|
3281
|
-
* Set a configuration value in an editor namespace.
|
|
3282
|
-
* @param {string} id - The record's ID
|
|
3283
|
-
* @param {string} namespace - The config namespace
|
|
3284
|
-
* @param {string} configKey - The config key
|
|
3285
|
-
* @param {any} configValue - Configuration value to set
|
|
3286
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
3287
|
-
* @param {{expected?: any}} [options] - `expected`: the value read for this key (null or undefined when it
|
|
3288
|
-
* was absent). The write is then refused with a 409 when the stored value differs. A value the key
|
|
3289
|
-
* already holds is not written and leaves no audit row, so the value read, expecting it, states in a
|
|
3290
|
-
* batch that the key is unchanged.
|
|
3291
|
-
* @returns {Promise<void>}
|
|
3292
|
-
*/
|
|
3293
|
-
setConfig: (id: string, namespace: string, configKey: string, configValue: any, auditMessage?: string, options?: {
|
|
3294
|
-
expected?: any;
|
|
3295
|
-
}) => Promise<void>;
|
|
3296
|
-
/**
|
|
3297
|
-
* Remove a configuration value.
|
|
3298
|
-
* @param {string} id - The record's ID
|
|
3299
|
-
* @param {string} namespace - The config namespace
|
|
3300
|
-
* @param {string} configKey - The config key
|
|
3301
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
3302
|
-
* @param {{expected?: any}} [options] - `expected`, as on setConfig. A key that is absent is not
|
|
3303
|
-
* written, so expecting null states in a batch that it is still absent.
|
|
3304
|
-
* @returns {Promise<void>}
|
|
3305
|
-
*/
|
|
3306
|
-
deleteConfig: (id: string, namespace: string, configKey: string, auditMessage?: string, options?: {
|
|
3307
|
-
expected?: any;
|
|
3308
|
-
}) => Promise<void>;
|
|
3309
|
-
/**
|
|
3310
|
-
* Set a user's access level to read and write for this project.
|
|
3311
|
-
* @param {string} id - The resource ID
|
|
3312
|
-
* @param {string} userId - The user ID
|
|
3313
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
3314
|
-
* @returns {Promise<void>}
|
|
3315
|
-
*/
|
|
3316
|
-
addWriter: (id: string, userId: string, auditMessage?: string) => Promise<void>;
|
|
3317
|
-
/**
|
|
3318
|
-
* Remove a user's writer privileges for this project.
|
|
3319
|
-
* @param {string} id - The resource ID
|
|
3320
|
-
* @param {string} userId - The user ID
|
|
3321
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
3322
|
-
* @returns {Promise<void>}
|
|
3323
|
-
*/
|
|
3324
|
-
removeWriter: (id: string, userId: string, auditMessage?: string) => Promise<void>;
|
|
3325
|
-
/**
|
|
3326
|
-
* Set a user's access level to read-only for this project.
|
|
3327
|
-
* @param {string} id - The resource ID
|
|
3328
|
-
* @param {string} userId - The user ID
|
|
3329
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
3330
|
-
* @returns {Promise<void>}
|
|
3331
|
-
*/
|
|
3332
|
-
addReader: (id: string, userId: string, auditMessage?: string) => Promise<void>;
|
|
3333
|
-
/**
|
|
3334
|
-
* Remove a user's reader privileges for this project.
|
|
3335
|
-
* @param {string} id - The resource ID
|
|
3336
|
-
* @param {string} userId - The user ID
|
|
3337
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
3338
|
-
* @returns {Promise<void>}
|
|
3339
|
-
*/
|
|
3340
|
-
removeReader: (id: string, userId: string, auditMessage?: string) => Promise<void>;
|
|
3341
|
-
};
|
|
3342
|
-
textLayers: {
|
|
3343
|
-
/**
|
|
3344
|
-
* Create a new text layer for a project.
|
|
3345
|
-
* @param {string} projectId - The project ID
|
|
3346
|
-
* @param {string} name - The name
|
|
3347
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
3348
|
-
* @param {object} [opts]
|
|
3349
|
-
* @param {string} [opts.id] - The new entity's id, minted by the caller (see uuidv7)
|
|
3350
|
-
* @returns {Promise<Created>}
|
|
3351
|
-
*/
|
|
3352
|
-
create: (projectId: string, name: string, auditMessage?: string, { id }?: {
|
|
3353
|
-
id?: string;
|
|
3354
|
-
}) => Promise<Created>;
|
|
3355
|
-
/**
|
|
3356
|
-
* Get a layer by ID.
|
|
3357
|
-
* @param {string} layerId - The layer ID
|
|
3358
|
-
* @returns {Promise<LayerRecords[K]>}
|
|
3359
|
-
*/
|
|
3360
|
-
get: (layerId: string) => Promise<TextLayer>;
|
|
3361
|
-
/**
|
|
3362
|
-
* Delete a layer.
|
|
3363
|
-
* @param {string} layerId - The layer ID
|
|
3364
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
3365
|
-
* @returns {Promise<void>}
|
|
3366
|
-
*/
|
|
3367
|
-
delete: (layerId: string, auditMessage?: string) => Promise<void>;
|
|
3368
|
-
/**
|
|
3369
|
-
* Rename a layer.
|
|
3370
|
-
* @param {string} layerId - The layer ID
|
|
3371
|
-
* @param {string} name - The new name
|
|
3372
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
3373
|
-
* @returns {Promise<LayerRecords[K]>}
|
|
3374
|
-
*/
|
|
3375
|
-
update: (layerId: string, name: string, auditMessage?: string) => Promise<TextLayer>;
|
|
3376
|
-
/**
|
|
3377
|
-
* Move a layer one place in its display order.
|
|
3378
|
-
* @param {string} layerId - The layer ID
|
|
3379
|
-
* @param {string} direction - The direction ("up" or "down")
|
|
3380
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
3381
|
-
* @returns {Promise<void>}
|
|
3382
|
-
*/
|
|
3383
|
-
shift: (layerId: string, direction: string, auditMessage?: string) => Promise<void>;
|
|
3384
|
-
/**
|
|
3385
|
-
* Set a configuration value in an editor namespace.
|
|
3386
|
-
* @param {string} id - The record's ID
|
|
3387
|
-
* @param {string} namespace - The config namespace
|
|
3388
|
-
* @param {string} configKey - The config key
|
|
3389
|
-
* @param {any} configValue - Configuration value to set
|
|
3390
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
3391
|
-
* @param {{expected?: any}} [options] - `expected`: the value read for this key (null or undefined when it
|
|
3392
|
-
* was absent). The write is then refused with a 409 when the stored value differs. A value the key
|
|
3393
|
-
* already holds is not written and leaves no audit row, so the value read, expecting it, states in a
|
|
3394
|
-
* batch that the key is unchanged.
|
|
3395
|
-
* @returns {Promise<void>}
|
|
3396
|
-
*/
|
|
3397
|
-
setConfig: (id: string, namespace: string, configKey: string, configValue: any, auditMessage?: string, options?: {
|
|
3398
|
-
expected?: any;
|
|
3399
|
-
}) => Promise<void>;
|
|
3400
|
-
/**
|
|
3401
|
-
* Remove a configuration value.
|
|
3402
|
-
* @param {string} id - The record's ID
|
|
3403
|
-
* @param {string} namespace - The config namespace
|
|
3404
|
-
* @param {string} configKey - The config key
|
|
3405
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
3406
|
-
* @param {{expected?: any}} [options] - `expected`, as on setConfig. A key that is absent is not
|
|
3407
|
-
* written, so expecting null states in a batch that it is still absent.
|
|
3408
|
-
* @returns {Promise<void>}
|
|
3409
|
-
*/
|
|
3410
|
-
deleteConfig: (id: string, namespace: string, configKey: string, auditMessage?: string, options?: {
|
|
3411
|
-
expected?: any;
|
|
3412
|
-
}) => Promise<void>;
|
|
3413
|
-
};
|
|
3414
|
-
vocabItems: {
|
|
3415
|
-
/**
|
|
3416
|
-
* Create a new vocab item
|
|
3417
|
-
* @param {string} vocabLayerId - The vocab layer ID
|
|
3418
|
-
* @param {string} form - The vocab item form
|
|
3419
|
-
* @param {any} [metadata] - Metadata map. Omit to leave unset; pass null to send JSON null.
|
|
3420
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
3421
|
-
* @param {object} [opts]
|
|
3422
|
-
* @param {string} [opts.id] - The new entity's id, minted by the caller (see uuidv7)
|
|
3423
|
-
* @returns {Promise<Created>}
|
|
3424
|
-
*/
|
|
3425
|
-
create: (vocabLayerId: string, form: string, metadata?: any, auditMessage?: string, { id }?: {
|
|
3426
|
-
id?: string;
|
|
3427
|
-
}) => Promise<Created>;
|
|
3428
|
-
/**
|
|
3429
|
-
* Create multiple vocab items in a single operation. Entries may target
|
|
3430
|
-
* different vocab layers; the user must have write access to each.
|
|
3431
|
-
* @param {Array<{vocabLayerId: string, form: string, metadata?: any}>} body - The vocab items to create
|
|
3432
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
3433
|
-
* @returns {Promise<{ids: string[]}>}
|
|
3434
|
-
*/
|
|
3435
|
-
bulkCreate: (body: Array<{
|
|
3436
|
-
vocabLayerId: string;
|
|
3437
|
-
form: string;
|
|
3438
|
-
metadata?: any;
|
|
3439
|
-
}>, auditMessage?: string) => Promise<{
|
|
3440
|
-
ids: string[];
|
|
3441
|
-
}>;
|
|
3442
|
-
/**
|
|
3443
|
-
* Update many vocab items in a single operation: set forms and/or patch
|
|
3444
|
-
* metadata.
|
|
3445
|
-
* @param {Array<{id: string, form?: string, metadata?: Array<object>}>} body - `form` is set only when the key is present; `metadata` is a list of metadata ops, as for patchMetadata. The entries may lie in several vocab layers; the user must have write access to each. An unknown id refuses the whole update, and an id may appear only once. Only an entry whose form really changes restates the documents linking it, and a strict-mode client picks up their new versions from the response.
|
|
3446
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
3447
|
-
* @returns {Promise<{count: number}>} How many vocab items were updated.
|
|
3448
|
-
*/
|
|
3449
|
-
bulkUpdate: (body: Array<{
|
|
3450
|
-
id: string;
|
|
3451
|
-
form?: string;
|
|
3452
|
-
metadata?: Array<object>;
|
|
3453
|
-
}>, auditMessage?: string) => Promise<{
|
|
3454
|
-
count: number;
|
|
3455
|
-
}>;
|
|
3456
|
-
/**
|
|
3457
|
-
* Delete multiple vocab items in a single operation. Each item's
|
|
3458
|
-
* descendant vocab links are deleted too. Provide an array of IDs.
|
|
3459
|
-
*
|
|
3460
|
-
* Every document holding one of those links has its version bumped, and
|
|
3461
|
-
* a strict-mode client picks up their new versions from the response.
|
|
3462
|
-
* @param {string[]} body - The vocab item IDs to delete
|
|
3463
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
3464
|
-
* @returns {Promise<void>}
|
|
3465
|
-
*/
|
|
3466
|
-
bulkDelete: (body: string[], auditMessage?: string) => Promise<void>;
|
|
3467
|
-
/**
|
|
3468
|
-
* Get a vocab item by ID
|
|
3469
|
-
* @param {string} id - The resource ID
|
|
3470
|
-
* @returns {Promise<VocabItem>}
|
|
3471
|
-
*/
|
|
3472
|
-
get: (id: string) => Promise<VocabItem>;
|
|
3473
|
-
/**
|
|
3474
|
-
* Delete a vocab item, and every link to it. Every document holding one
|
|
3475
|
-
* of those links has its version bumped, and a strict-mode client picks
|
|
3476
|
-
* up their new versions from the response.
|
|
3477
|
-
* @param {string} id - The resource ID
|
|
3478
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
3479
|
-
* @param {{expectedLinkCount?: number}} [options] - `expectedLinkCount`: the
|
|
3480
|
-
* number of links the caller showed. The delete is refused with a 409 when
|
|
3481
|
-
* the entry has any other number of links by then.
|
|
3482
|
-
* @returns {Promise<void>}
|
|
3483
|
-
*/
|
|
3484
|
-
delete: (id: string, auditMessage?: string, { expectedLinkCount }?: {
|
|
3485
|
-
expectedLinkCount?: number;
|
|
3486
|
-
}) => Promise<void>;
|
|
3487
|
-
/**
|
|
3488
|
-
* Merge entries into this one, in one operation. Every link to a loser
|
|
3489
|
-
* moves to the survivor (keeping its id and metadata), except a link on
|
|
3490
|
-
* words the survivor is already linked to, which is deleted, and then the
|
|
3491
|
-
* losers are deleted. Links are read when the merge runs, so one made
|
|
3492
|
-
* after the caller looked moves too. Every loser must be in the
|
|
3493
|
-
* survivor's vocabulary, and a loser that is already gone is skipped, so
|
|
3494
|
-
* a repeated merge changes nothing. Metadata naming a loser by its id,
|
|
3495
|
-
* in the vocabulary's other entries and in the documents of every
|
|
3496
|
-
* project it is linked to, is rewritten to name the survivor. A
|
|
3497
|
-
* reference to a loser in the survivor's own metadata is the caller's to
|
|
3498
|
-
* rewrite, in the same batch.
|
|
3499
|
-
* Needs maintainer rights on the vocabulary.
|
|
3500
|
-
* @param {string} survivorId - The entry that stays
|
|
3501
|
-
* @param {string[]} loserIds - The entries merged into it
|
|
3502
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
3503
|
-
* @returns {Promise<{moved: number, duplicates: number, removed: string[]}>}
|
|
3504
|
-
*/
|
|
3505
|
-
merge: (survivorId: string, loserIds: string[], auditMessage?: string) => Promise<{
|
|
3506
|
-
moved: number;
|
|
3507
|
-
duplicates: number;
|
|
3508
|
-
removed: string[];
|
|
3509
|
-
}>;
|
|
3510
|
-
/**
|
|
3511
|
-
* Update a vocab item's form. A document read carries the entry's form on
|
|
3512
|
-
* every link to it, so a rename restates those documents: each has its
|
|
3513
|
-
* version bumped, and a strict-mode client picks up their new versions
|
|
3514
|
-
* from the response.
|
|
3515
|
-
* @param {string} id - The resource ID
|
|
3516
|
-
* @param {string} form - The vocab item form
|
|
3517
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
3518
|
-
* @returns {Promise<VocabItem>}
|
|
3519
|
-
*/
|
|
3520
|
-
update: (id: string, form: string, auditMessage?: string) => Promise<VocabItem>;
|
|
3521
|
-
/**
|
|
3522
|
-
* Replace all metadata of an entity. Keys left out of the new map are removed.
|
|
3523
|
-
* @param {string} id - The entity's ID
|
|
3524
|
-
* @param {object} body - The new metadata map
|
|
3525
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
3526
|
-
* @returns {Promise<MetadataRecords[K]>}
|
|
3527
|
-
*/
|
|
3528
|
-
setMetadata: (id: string, body: object, auditMessage?: string) => Promise<VocabItem>;
|
|
3529
|
-
/**
|
|
3530
|
-
* Remove all metadata from an entity.
|
|
3531
|
-
* @param {string} id - The entity's ID
|
|
3532
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
3533
|
-
* @returns {Promise<MetadataRecords[K]>}
|
|
3534
|
-
*/
|
|
3535
|
-
deleteMetadata: (id: string, auditMessage?: string) => Promise<VocabItem>;
|
|
3536
|
-
/**
|
|
3537
|
-
* Edit an entity's metadata with a list of ops applied in order, in one operation. `{op: 'set', path, value}` writes value at path, creating missing objects along it; `{op: 'delete', path}` removes the key at path (a no-op when absent). A path is a non-empty array of keys, the first a top-level key. A path through a non-object is refused (400). See metadataOps and applyMetadataOps.
|
|
3538
|
-
* @param {string} id - The entity's ID
|
|
3539
|
-
* @param {MetadataOp[]} body - The metadata ops
|
|
3540
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
3541
|
-
* @returns {Promise<MetadataRecords[K]>}
|
|
3542
|
-
*/
|
|
3543
|
-
patchMetadata: (id: string, body: MetadataOp[], auditMessage?: string) => Promise<VocabItem>;
|
|
3544
|
-
};
|
|
3545
|
-
relationLayers: {
|
|
3546
|
-
/**
|
|
3547
|
-
* The stored values of this layer that a value-set rule would refuse,
|
|
3548
|
-
* before it is declared: exactly what a declaration of it would meet,
|
|
3549
|
-
* with the rule's exemptions (an unconfirmed machine value, a value an
|
|
3550
|
-
* import, a document copy or a restore set). Writes nothing, and a
|
|
3551
|
-
* reader may ask.
|
|
3552
|
-
* @param {string} layerId - The layer ID
|
|
3553
|
-
* @param {ValueSetRule} rule - The list as a value-set declaration takes it
|
|
3554
|
-
* @param {{limit?: number}} [options] - `limit`: how many values to list, the most frequent first
|
|
3555
|
-
* (default 20, at most 100)
|
|
3556
|
-
* @returns {Promise<RefusedValues>}
|
|
3557
|
-
*/
|
|
3558
|
-
refusedValues: (layerId: string, rule: ValueSetRule, options?: {
|
|
3559
|
-
limit?: number;
|
|
3560
|
-
}) => Promise<RefusedValues>;
|
|
3561
|
-
/**
|
|
3562
|
-
* Declare an app namespace's constraints on this layer, replacing that
|
|
3563
|
-
* namespace's list. Refused with 422 and the violations when the layer's
|
|
3564
|
-
* stored data breaks them (see violationsOf).
|
|
3565
|
-
* @param {string} layerId - The layer ID
|
|
3566
|
-
* @param {string} namespace - The declaring app's namespace, e.g. "igt"
|
|
3567
|
-
* @param {LayerConstraint[]} constraints - e.g. [{type: "single-span"}, {type: "value-set", values: ["N"]}]
|
|
3568
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
3569
|
-
* @param {{expected?: Array<object>|null}} [options] - `expected`: the list read for this
|
|
3570
|
-
* namespace (null when it was absent). The write is then refused with a 409 when the stored
|
|
3571
|
-
* list differs.
|
|
3572
|
-
* @returns {Promise<{constraints: Record<string, LayerConstraint[]>}>} the layer's whole constraint map
|
|
3573
|
-
*/
|
|
3574
|
-
setConstraints: (layerId: string, namespace: string, constraints: LayerConstraint[], auditMessage?: string, options?: {
|
|
3575
|
-
expected?: Array<object> | null;
|
|
3576
|
-
}) => Promise<{
|
|
3577
|
-
constraints: Record<string, LayerConstraint[]>;
|
|
3578
|
-
}>;
|
|
3579
|
-
/**
|
|
3580
|
-
* Remove an app namespace's constraints from this layer.
|
|
3581
|
-
* @param {string} layerId - The layer ID
|
|
3582
|
-
* @param {string} namespace - The declaring app's namespace
|
|
3583
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
3584
|
-
* @param {{expected?: Array<object>|null}} [options] - `expected`, as on setConstraints.
|
|
3585
|
-
* @returns {Promise<void>}
|
|
3586
|
-
*/
|
|
3587
|
-
deleteConstraints: (layerId: string, namespace: string, auditMessage?: string, options?: {
|
|
3588
|
-
expected?: Array<object> | null;
|
|
3589
|
-
}) => Promise<void>;
|
|
3590
|
-
/**
|
|
3591
|
-
* The violations the given constraints would meet in this layer's stored
|
|
3592
|
-
* data. Writes nothing.
|
|
3593
|
-
* @param {string} layerId - The layer ID
|
|
3594
|
-
* @param {LayerConstraint[]} constraints - The list to check
|
|
3595
|
-
* @param {{limit?: number}} [options] - `limit`: how many violations to list (default 100)
|
|
3596
|
-
* @returns {Promise<{violations: ConstraintViolation[], violationCount: number}>}
|
|
3597
|
-
*/
|
|
3598
|
-
checkConstraints: (layerId: string, constraints: LayerConstraint[], options?: {
|
|
3599
|
-
limit?: number;
|
|
3600
|
-
}) => Promise<{
|
|
3601
|
-
violations: ConstraintViolation[];
|
|
3602
|
-
violationCount: number;
|
|
3603
|
-
}>;
|
|
3604
|
-
/**
|
|
3605
|
-
* Apply the remedies of the given constraints' remediable types
|
|
3606
|
-
* (coextensive, single-span, single-link, same-ancestor) to every
|
|
3607
|
-
* violation in this layer's stored data, one operation per document.
|
|
3608
|
-
* With `document`, only that document is repaired, and a writer may
|
|
3609
|
-
* ask. A document another user holds the lock on is left as it is and
|
|
3610
|
-
* listed under `locked`.
|
|
3611
|
-
* @param {string} layerId - The layer ID
|
|
3612
|
-
* @param {LayerConstraint[]} constraints - The list to repair for
|
|
3613
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
3614
|
-
* @param {{document?: string}} [options]
|
|
3615
|
-
* @returns {Promise<{repaired: ConstraintRepair[], locked: Array<{document: string, lockedBy: string}>, violations: ConstraintViolation[], violationCount: number}>}
|
|
3616
|
-
*/
|
|
3617
|
-
repairConstraints: (layerId: string, constraints: LayerConstraint[], auditMessage?: string, options?: {
|
|
3618
|
-
document?: string;
|
|
3619
|
-
}) => Promise<{
|
|
3620
|
-
repaired: ConstraintRepair[];
|
|
3621
|
-
locked: Array<{
|
|
3622
|
-
document: string;
|
|
3623
|
-
lockedBy: string;
|
|
3624
|
-
}>;
|
|
3625
|
-
violations: ConstraintViolation[];
|
|
3626
|
-
violationCount: number;
|
|
3627
|
-
}>;
|
|
3628
|
-
/**
|
|
3629
|
-
* Set a configuration value in an editor namespace.
|
|
3630
|
-
* @param {string} id - The record's ID
|
|
3631
|
-
* @param {string} namespace - The config namespace
|
|
3632
|
-
* @param {string} configKey - The config key
|
|
3633
|
-
* @param {any} configValue - Configuration value to set
|
|
3634
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
3635
|
-
* @param {{expected?: any}} [options] - `expected`: the value read for this key (null or undefined when it
|
|
3636
|
-
* was absent). The write is then refused with a 409 when the stored value differs. A value the key
|
|
3637
|
-
* already holds is not written and leaves no audit row, so the value read, expecting it, states in a
|
|
3638
|
-
* batch that the key is unchanged.
|
|
3639
|
-
* @returns {Promise<void>}
|
|
3640
|
-
*/
|
|
3641
|
-
setConfig: (id: string, namespace: string, configKey: string, configValue: any, auditMessage?: string, options?: {
|
|
3642
|
-
expected?: any;
|
|
3643
|
-
}) => Promise<void>;
|
|
3644
|
-
/**
|
|
3645
|
-
* Remove a configuration value.
|
|
3646
|
-
* @param {string} id - The record's ID
|
|
3647
|
-
* @param {string} namespace - The config namespace
|
|
3648
|
-
* @param {string} configKey - The config key
|
|
3649
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
3650
|
-
* @param {{expected?: any}} [options] - `expected`, as on setConfig. A key that is absent is not
|
|
3651
|
-
* written, so expecting null states in a batch that it is still absent.
|
|
3652
|
-
* @returns {Promise<void>}
|
|
3653
|
-
*/
|
|
3654
|
-
deleteConfig: (id: string, namespace: string, configKey: string, auditMessage?: string, options?: {
|
|
3655
|
-
expected?: any;
|
|
3656
|
-
}) => Promise<void>;
|
|
3657
|
-
/**
|
|
3658
|
-
* Create a new relation layer.
|
|
3659
|
-
* @param {string} spanLayerId - The span layer ID
|
|
3660
|
-
* @param {string} name - The name
|
|
3661
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
3662
|
-
* @param {object} [opts]
|
|
3663
|
-
* @param {string} [opts.id] - The new entity's id, minted by the caller (see uuidv7)
|
|
3664
|
-
* @returns {Promise<Created>}
|
|
3665
|
-
*/
|
|
3666
|
-
create: (spanLayerId: string, name: string, auditMessage?: string, { id }?: {
|
|
3667
|
-
id?: string;
|
|
3668
|
-
}) => Promise<Created>;
|
|
3669
|
-
/**
|
|
3670
|
-
* Get a layer by ID.
|
|
3671
|
-
* @param {string} layerId - The layer ID
|
|
3672
|
-
* @returns {Promise<LayerRecords[K]>}
|
|
3673
|
-
*/
|
|
3674
|
-
get: (layerId: string) => Promise<RelationLayer>;
|
|
3675
|
-
/**
|
|
3676
|
-
* Delete a layer.
|
|
3677
|
-
* @param {string} layerId - The layer ID
|
|
3678
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
3679
|
-
* @returns {Promise<void>}
|
|
3680
|
-
*/
|
|
3681
|
-
delete: (layerId: string, auditMessage?: string) => Promise<void>;
|
|
3682
|
-
/**
|
|
3683
|
-
* Rename a layer.
|
|
3684
|
-
* @param {string} layerId - The layer ID
|
|
3685
|
-
* @param {string} name - The new name
|
|
3686
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
3687
|
-
* @returns {Promise<LayerRecords[K]>}
|
|
3688
|
-
*/
|
|
3689
|
-
update: (layerId: string, name: string, auditMessage?: string) => Promise<RelationLayer>;
|
|
3690
|
-
/**
|
|
3691
|
-
* Move a layer one place in its display order.
|
|
3692
|
-
* @param {string} layerId - The layer ID
|
|
3693
|
-
* @param {string} direction - The direction ("up" or "down")
|
|
3694
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
3695
|
-
* @returns {Promise<void>}
|
|
3696
|
-
*/
|
|
3697
|
-
shift: (layerId: string, direction: string, auditMessage?: string) => Promise<void>;
|
|
3698
|
-
};
|
|
3699
|
-
tokens: {
|
|
3700
|
-
/**
|
|
3701
|
-
* Replace all metadata of an entity. Keys left out of the new map are removed.
|
|
3702
|
-
* @param {string} id - The entity's ID
|
|
3703
|
-
* @param {object} body - The new metadata map
|
|
3704
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
3705
|
-
* @returns {Promise<MetadataRecords[K]>}
|
|
3706
|
-
*/
|
|
3707
|
-
setMetadata: (id: string, body: object, auditMessage?: string) => Promise<Token>;
|
|
3708
|
-
/**
|
|
3709
|
-
* Remove all metadata from an entity.
|
|
3710
|
-
* @param {string} id - The entity's ID
|
|
3711
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
3712
|
-
* @returns {Promise<MetadataRecords[K]>}
|
|
3713
|
-
*/
|
|
3714
|
-
deleteMetadata: (id: string, auditMessage?: string) => Promise<Token>;
|
|
3715
|
-
/**
|
|
3716
|
-
* Edit an entity's metadata with a list of ops applied in order, in one operation. `{op: 'set', path, value}` writes value at path, creating missing objects along it; `{op: 'delete', path}` removes the key at path (a no-op when absent). A path is a non-empty array of keys, the first a top-level key. A path through a non-object is refused (400). See metadataOps and applyMetadataOps.
|
|
3717
|
-
* @param {string} id - The entity's ID
|
|
3718
|
-
* @param {MetadataOp[]} body - The metadata ops
|
|
3719
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
3720
|
-
* @returns {Promise<MetadataRecords[K]>}
|
|
3721
|
-
*/
|
|
3722
|
-
patchMetadata: (id: string, body: MetadataOp[], auditMessage?: string) => Promise<Token>;
|
|
3723
|
-
/**
|
|
3724
|
-
* Create a new token in a token layer. Tokens define text substrings
|
|
3725
|
-
* using begin and end offsets. Tokens may be zero-width and may overlap.
|
|
3726
|
-
* For tokens sharing the same begin, precedence controls the linear
|
|
3727
|
-
* ordering.
|
|
3728
|
-
*
|
|
3729
|
-
* Offsets are 0-based indices in Unicode CODE POINTS (not UTF-16 code
|
|
3730
|
-
* units): a supplementary-plane character (emoji, SMP script) is one
|
|
3731
|
-
* position. JS strings are UTF-16, so do NOT use `str.length` /
|
|
3732
|
-
* `str.substring` to compute offsets — count code points instead
|
|
3733
|
-
* (e.g. `[...str].length`, or iterate with `codePointAt`).
|
|
3734
|
-
* @param {string} tokenLayerId - The token layer ID
|
|
3735
|
-
* @param {string} text - The text ID
|
|
3736
|
-
* @param {number} begin - Start offset, inclusive (Unicode code points)
|
|
3737
|
-
* @param {number} end - End offset, exclusive (Unicode code points)
|
|
3738
|
-
* @param {number} [precedence] - Ordering precedence
|
|
3739
|
-
* @param {any} [metadata] - Metadata map. Omit to leave unset; pass null to send JSON null.
|
|
3740
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
3741
|
-
* @param {object} [opts]
|
|
3742
|
-
* @param {string} [opts.id] - The new entity's id, minted by the caller (see uuidv7)
|
|
3743
|
-
* @returns {Promise<Created>}
|
|
3744
|
-
*/
|
|
3745
|
-
create: (tokenLayerId: string, text: string, begin: number, end: number, precedence?: number, metadata?: any, auditMessage?: string, { id }?: {
|
|
3746
|
-
id?: string;
|
|
3747
|
-
}) => Promise<Created>;
|
|
3748
|
-
/**
|
|
3749
|
-
* Get a token.
|
|
3750
|
-
* @param {string} tokenId - The token ID
|
|
3751
|
-
* @returns {Promise<Token>}
|
|
3752
|
-
*/
|
|
3753
|
-
get: (tokenId: string) => Promise<Token>;
|
|
3754
|
-
/**
|
|
3755
|
-
* Delete a token and remove it from any spans. If this causes a span to
|
|
3756
|
-
* have no remaining tokens, the span will also be deleted.
|
|
3757
|
-
* @param {string} tokenId - The token ID
|
|
3758
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
3759
|
-
* @returns {Promise<void>}
|
|
3760
|
-
*/
|
|
3761
|
-
delete: (tokenId: string, auditMessage?: string) => Promise<void>;
|
|
3762
|
-
/**
|
|
3763
|
-
* Update a token.
|
|
3764
|
-
* @param {string} tokenId - The token ID
|
|
3765
|
-
* @param {number} [begin] - New start offset, inclusive (Unicode code points)
|
|
3766
|
-
* @param {number} [end] - New end offset, exclusive (Unicode code points)
|
|
3767
|
-
* @param {?number} [precedence] - Ordering precedence. Omit (undefined)
|
|
3768
|
-
* to leave unchanged; pass a number to set; pass null explicitly to
|
|
3769
|
-
* CLEAR it (revert to no explicit ordering). bodyOf keeps null but
|
|
3770
|
-
* drops undefined, so the three cases map correctly to the server.
|
|
3771
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
3772
|
-
* @returns {Promise<Token>}
|
|
3773
|
-
*/
|
|
3774
|
-
update: (tokenId: string, begin?: number, end?: number, precedence?: number | null, auditMessage?: string) => Promise<Token>;
|
|
3775
|
-
/**
|
|
3776
|
-
* Create multiple tokens in a single operation.
|
|
3777
|
-
* @param {Array} body - The request body
|
|
3778
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
3779
|
-
* @returns {Promise<{ids: string[]}>} The created entity IDs, in input order. (bulkDelete resolves to no value.)
|
|
3780
|
-
*/
|
|
3781
|
-
bulkCreate: (body: any[], auditMessage?: string) => Promise<{
|
|
3782
|
-
ids: string[];
|
|
3783
|
-
}>;
|
|
3784
|
-
/**
|
|
3785
|
-
* Delete multiple tokens in a single operation. Provide an array of IDs.
|
|
3786
|
-
* @param {Array} body - The request body
|
|
3787
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
3788
|
-
* @returns {Promise<void>}
|
|
3789
|
-
*/
|
|
3790
|
-
bulkDelete: (body: any[], auditMessage?: string) => Promise<void>;
|
|
3791
|
-
/**
|
|
3792
|
-
* Update many tokens in a single operation: patch metadata.
|
|
3793
|
-
* @param {Array} body - Objects of the shape `{id, metadata}`. `metadata` is a list of metadata ops, as for patchMetadata. The tokens may lie in several documents of one project; every document touched has its version bumped and every new version comes back in `X-Document-Versions` (past fifty documents, only their number, in `X-Document-Versions-Omitted`). A `document-version` precondition is accepted only when every entry lies in one document. An unknown id refuses the whole update.
|
|
3794
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
3795
|
-
* @returns {Promise<{count: number}>} How many tokens were updated.
|
|
3796
|
-
*/
|
|
3797
|
-
bulkUpdate: (body: any[], auditMessage?: string) => Promise<{
|
|
3798
|
-
count: number;
|
|
3799
|
-
}>;
|
|
3800
|
-
/**
|
|
3801
|
-
* Split a token at a Unicode code-point offset. A new token is made for one
|
|
3802
|
-
* half and its ID is returned. The original token keeps its ID, spans and
|
|
3803
|
-
* vocab-links on the left half, or on the right half with `keep: "right"`.
|
|
3804
|
-
* @param {string} tokenId - The token ID
|
|
3805
|
-
* @param {number} position - Code-point offset to split at (strictly between begin and end)
|
|
3806
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
3807
|
-
* @param {{id?: string, keep?: "left"|"right"}} [options] - `id`: the new
|
|
3808
|
-
* token's id, a UUIDv7 this client minted. `keep`: the half the original token
|
|
3809
|
-
* (its id, spans, vocab-links, comments and metadata) stays on, `"left"` by
|
|
3810
|
-
* default. With `"right"` the new token, whose id is answered, is the left
|
|
3811
|
-
* half. A relation layer whose relations must stay inside one token
|
|
3812
|
-
* of this layer declares a same-ancestor constraint, and the server deletes
|
|
3813
|
-
* the relations the split leaves crossing in the same transaction.
|
|
3814
|
-
* @returns {Promise<Created>}
|
|
3815
|
-
*/
|
|
3816
|
-
split: (tokenId: string, position: number, auditMessage?: string, { id, keep }?: {
|
|
3817
|
-
id?: string;
|
|
3818
|
-
keep?: "left" | "right";
|
|
3819
|
-
}) => Promise<Created>;
|
|
3820
|
-
/**
|
|
3821
|
-
* Merge two tokens. The left token (smaller begin) survives with the combined
|
|
3822
|
-
* extent; the right is deleted and its spans/vocab-links are reparented to the left.
|
|
3823
|
-
* On partitioning layers the tokens must be adjacent; on non-overlapping layers the
|
|
3824
|
-
* merged extent must not engulf a third token.
|
|
3825
|
-
* @param {string} tokenId - The anchor token ID
|
|
3826
|
-
* @param {string} otherTokenId - The other token to merge in
|
|
3827
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
3828
|
-
* @returns {Promise<Token>}
|
|
3829
|
-
*/
|
|
3830
|
-
merge: (tokenId: string, otherTokenId: string, auditMessage?: string) => Promise<Token>;
|
|
3831
|
-
/**
|
|
3832
|
-
* Shift a token's boundary. On partitioning layers the adjacent token is
|
|
3833
|
-
* auto-adjusted to preserve the partition; on non-overlapping layers a shift that
|
|
3834
|
-
* would create an overlap is rejected.
|
|
3835
|
-
* @param {string} tokenId - The token ID
|
|
3836
|
-
* @param {number} [begin] - New start offset, inclusive (Unicode code points)
|
|
3837
|
-
* @param {number} [end] - New end offset, exclusive (Unicode code points)
|
|
3838
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
3839
|
-
* @returns {Promise<Token>}
|
|
3840
|
-
*/
|
|
3841
|
-
shift: (tokenId: string, begin?: number, end?: number, auditMessage?: string) => Promise<Token>;
|
|
3842
|
-
};
|
|
3843
|
-
messages: {
|
|
3844
|
-
/**
|
|
3845
|
-
* Open a Server-Sent Events stream for a project.
|
|
3846
|
-
* @param {string} projectId - The UUID of the project to listen to
|
|
3847
|
-
* @param {(eventType: string, data: any) => void | boolean} onEvent - Callback function that receives (eventType, data). If it returns true, listening will stop.
|
|
3848
|
-
* @param {string} [path] - Stream path under baseUrl (defaults to the project /listen bus; service channels pass their own).
|
|
3849
|
-
* @returns {SSEConnection} SSE connection object with .close() and .getStats() methods
|
|
3850
|
-
*/
|
|
3851
|
-
listen: (projectId: string, onEvent: (eventType: string, data: any) => void | boolean, path?: string) => SSEConnection;
|
|
3852
|
-
/**
|
|
3853
|
-
* Send a message to project listeners.
|
|
3854
|
-
*
|
|
3855
|
-
* `data` may be any JSON value and is sent VERBATIM (`rawBody`): a
|
|
3856
|
-
* message payload is opaque application data, like `metadata` and
|
|
3857
|
-
* `config`, so its keys must not be re-cased on the way out. Without
|
|
3858
|
-
* this a key such as `case-marker` would reach listeners as
|
|
3859
|
-
* `caseMarker` in JS and `case_marker` in Python. `listen` restores it
|
|
3860
|
-
* verbatim on the way in.
|
|
3861
|
-
*
|
|
3862
|
-
* A message is not saved and writes nothing to History, so it never
|
|
3863
|
-
* joins an open operation (`withOperation`). Made on a batch it still
|
|
3864
|
-
* queues, so a message queued after the writes goes out after them.
|
|
3865
|
-
* @param {string} projectId - The UUID of the project to send to
|
|
3866
|
-
* @param {any} data - The message data to send
|
|
3867
|
-
* @returns {Promise<{success: boolean, message: string}>}
|
|
3868
|
-
*/
|
|
3869
|
-
sendMessage: (projectId: string, data: any) => Promise<{
|
|
3870
|
-
success: boolean;
|
|
3871
|
-
message: string;
|
|
3872
|
-
}>;
|
|
3873
|
-
/**
|
|
3874
|
-
* Discover the services seen on a project (synchronous GET). Currently
|
|
3875
|
-
* connected services carry `online: true`; previously-seen offline ones
|
|
3876
|
-
* carry `online: false` plus a `lastSeenAt` stamp.
|
|
3877
|
-
* @param {string} projectId - The UUID of the project to query
|
|
3878
|
-
* @returns {Promise<DiscoveredService[]>} Array of discovered service information
|
|
3879
|
-
*/
|
|
3880
|
-
discoverServices: (projectId: string) => Promise<DiscoveredService[]>;
|
|
3881
|
-
/**
|
|
3882
|
-
* Forget a previously-seen (offline) service. Maintainer-only; 409 if
|
|
3883
|
-
* the service is currently connected.
|
|
3884
|
-
* @param {string} projectId - The UUID of the project
|
|
3885
|
-
* @param {string} serviceId - The ID of the service to forget
|
|
3886
|
-
* @returns {Promise<void>}
|
|
3887
|
-
*/
|
|
3888
|
-
discardService: (projectId: string, serviceId: string) => Promise<void>;
|
|
3889
|
-
/**
|
|
3890
|
-
* Register as a service and handle incoming work requests.
|
|
3891
|
-
*
|
|
3892
|
-
* The registration reopens its channel whenever it drops, so a server
|
|
3893
|
-
* restart needs no service restart.
|
|
3894
|
-
* @param {string} projectId - The UUID of the project to serve
|
|
3895
|
-
* @param {ServiceInfo} serviceInfo - Service information {serviceId, serviceName, description}
|
|
3896
|
-
* @param {(data: any, responseHelper: ResponseHelper) => void} onServiceRequest - Callback (data, responseHelper)
|
|
3897
|
-
* @param {Object} [extras] - Optional additional service metadata
|
|
3898
|
-
* @param {(event: ServiceStatusEvent, projectId: string, detail?: string) => void} [onStatus] - Optional callback (event, projectId, detail) for
|
|
3899
|
-
* connection transitions: 'registered', 'reconnected', 'disconnected',
|
|
3900
|
-
* and 'stopped' when the server refuses the channel for good, which
|
|
3901
|
-
* ends the registration
|
|
3902
|
-
* @returns {ServiceRegistration} Service registration with .stop(), .isRunning(), .isConnected()
|
|
3903
|
-
*/
|
|
3904
|
-
serve: (projectId: string, serviceInfo: ServiceInfo, onServiceRequest: (data: any, responseHelper: ResponseHelper) => void, extras?: any, onStatus?: (event: ServiceStatusEvent, projectId: string, detail?: string) => void) => ServiceRegistration;
|
|
3905
|
-
/**
|
|
3906
|
-
* Request a service to perform work and await its result.
|
|
3907
|
-
*
|
|
3908
|
-
* The request outlives this call: after a timeout, an abort, or a
|
|
3909
|
-
* dropped connection the service goes on, and `attachServiceRequest`
|
|
3910
|
-
* collects the result given the request id, which `opts.onAccepted`
|
|
3911
|
-
* receives as soon as the server has taken the request. Pass
|
|
3912
|
-
* `opts.requestId` (a UUID you mint) to know the id before submitting;
|
|
3913
|
-
* submitting an id that names a request you already made rejoins it
|
|
3914
|
-
* instead of starting another.
|
|
3915
|
-
* @param {string} projectId - The UUID of the project
|
|
3916
|
-
* @param {string} serviceId - The ID of the service to request
|
|
3917
|
-
* @param {any} data - The request data
|
|
3918
|
-
* @param {number} [timeout=10000] - Timeout in ms
|
|
3919
|
-
* @param {function} [onProgress] - Called with each progress payload {percent, message}
|
|
3920
|
-
* @param {AbortSignal} [signal] - Abort to stop waiting; rejects with an AbortError
|
|
3921
|
-
* @param {{requestId?: string, onAccepted?: (requestId: string) => void, projectIds?: string[], noOperation?: boolean}} [opts] - {requestId, onAccepted, projectIds, noOperation}
|
|
3922
|
-
* @returns {Promise<any>} The service's result
|
|
3923
|
-
*/
|
|
3924
|
-
requestService: (projectId: string, serviceId: string, data: any, timeout?: number, onProgress?: Function, signal?: AbortSignal, opts?: {
|
|
3925
|
-
requestId?: string;
|
|
3926
|
-
onAccepted?: (requestId: string) => void;
|
|
3927
|
-
projectIds?: string[];
|
|
3928
|
-
noOperation?: boolean;
|
|
3929
|
-
}) => Promise<any>;
|
|
3930
|
-
/**
|
|
3931
|
-
* Rejoin a service request made earlier and await its result: the
|
|
3932
|
-
* latest progress is replayed, then the result comes, or at once if the
|
|
3933
|
-
* request already finished. Only the user who submitted it (or an
|
|
3934
|
-
* admin). Rejects with an error whose `status` is 404 when the request
|
|
3935
|
-
* is unknown or expired (a finished request's result is kept for a
|
|
3936
|
-
* while, not forever).
|
|
3937
|
-
* @param {string} projectId - The UUID of the project
|
|
3938
|
-
* @param {string} requestId - The request id
|
|
3939
|
-
* @param {number} [timeout=10000] - Timeout in ms
|
|
3940
|
-
* @param {function} [onProgress] - Called with each progress payload
|
|
3941
|
-
* @param {AbortSignal} [signal] - Abort to stop waiting
|
|
3942
|
-
* @returns {Promise<any>} The service's result
|
|
3943
|
-
*/
|
|
3944
|
-
attachServiceRequest: (projectId: string, requestId: string, timeout?: number, onProgress?: Function, signal?: AbortSignal) => Promise<any>;
|
|
3945
|
-
/**
|
|
3946
|
-
* Ask the service to stop a request made earlier. The request still
|
|
3947
|
-
* ends with whatever the service then reports, on the stream of whoever
|
|
3948
|
-
* is awaiting it. Rejects with 404 if unknown or expired, 409 once
|
|
3949
|
-
* finished.
|
|
3950
|
-
* @param {string} projectId - The UUID of the project
|
|
3951
|
-
* @param {string} requestId - The request id
|
|
3952
|
-
* @returns {Promise<void>}
|
|
3953
|
-
*/
|
|
3954
|
-
cancelServiceRequest: (projectId: string, requestId: string) => Promise<void>;
|
|
3955
|
-
};
|
|
3956
|
-
/**
|
|
3957
|
-
* Run a query over every project you can read.
|
|
3958
|
-
*
|
|
3959
|
-
* `body` is the query AST. Its keys follow the usual client convention
|
|
3960
|
-
* (camelCase, e.g. `scope.projectIds`) and are converted to the wire
|
|
3961
|
-
* format automatically; clause heads and variables are plain strings you
|
|
3962
|
-
* write literally (e.g. `'span'`, `'?s1'`, `'vocab-link'`). Example:
|
|
3963
|
-
*
|
|
3964
|
-
* await client.query({
|
|
3965
|
-
* find: ['?s1', '?s2'],
|
|
3966
|
-
* where: [
|
|
3967
|
-
* ['span', '?s1', { layer: posLayerId, value: 'NOUN' }],
|
|
3968
|
-
* ['span', '?s2', { layer: posLayerId, value: 'VERB' }],
|
|
3969
|
-
* ['covers', '?s1', '?t1'], ['covers', '?s2', '?t2'],
|
|
3970
|
-
* ['precedes', '?t1', '?t2'],
|
|
3971
|
-
* ],
|
|
3972
|
-
* return: 'entities', // 'ids' (default) | 'entities' | 'count'
|
|
3973
|
-
* limit: 100,
|
|
3974
|
-
* });
|
|
3975
|
-
*
|
|
3976
|
-
* A `layer` is referenced by its id (its UUID) only — not by name or
|
|
3977
|
-
* path. To match a layer by name, bind it with a `*-layer` clause (e.g.
|
|
3978
|
-
* `['span-layer', '?sl', { name: 'pos' }]`) and use the variable.
|
|
3979
|
-
*
|
|
3980
|
-
* Optional keys: `scope` (restrict to projects by id, `{projectIds}`), `orderBy`
|
|
3981
|
-
* (sort rows), and `bindings` (substitute `?name` placeholders with literals).
|
|
3982
|
-
* `return` may also be an aggregate spec `{group, aggregates}`. See the query
|
|
3983
|
-
* language reference.
|
|
3984
|
-
*
|
|
3985
|
-
* @param {Object} body - The query AST ({find, where, scope?, limit?, orderBy?,
|
|
3986
|
-
* return?, bindings?}).
|
|
3987
|
-
* @returns {Promise<QueryResult>} For 'ids'/'entities': {columns, results, count, truncated}.
|
|
3988
|
-
* For 'count': {return: 'count', count, truncated}, where `truncated` says
|
|
3989
|
-
* the count stopped at the server's cap. Entity cells are full entity
|
|
3990
|
-
* objects (same shape as the GET endpoints).
|
|
3991
|
-
*/
|
|
3992
|
-
query: (body: any) => Promise<QueryResult>;
|
|
3993
|
-
operationGroups: {
|
|
3994
|
-
/**
|
|
3995
|
-
* Get a logical-operation group (its label + creator).
|
|
3996
|
-
* @param {string} id - The group id
|
|
3997
|
-
* @returns {Promise<OperationGroup>}
|
|
3998
|
-
*/
|
|
3999
|
-
get: (id: string) => Promise<OperationGroup>;
|
|
4000
|
-
/**
|
|
4001
|
-
* Relabel a logical-operation group after the fact. Owner or admin only.
|
|
4002
|
-
* @param {string} id - The group id
|
|
4003
|
-
* @param {string|null} message - The new label
|
|
4004
|
-
* @returns {Promise<OperationGroup>}
|
|
4005
|
-
*/
|
|
4006
|
-
update: (id: string, message: string | null) => Promise<OperationGroup>;
|
|
4007
|
-
};
|
|
4008
|
-
comments: {
|
|
4009
|
-
/**
|
|
4010
|
-
* Post a comment on an entity. Requires write access to the entity's
|
|
4011
|
-
* project, or to the vocabulary for a vocab-item; the author is the
|
|
4012
|
-
* authenticated caller. Comments are not audited and do not bump the
|
|
4013
|
-
* document version.
|
|
4014
|
-
*
|
|
4015
|
-
* A comment outlives its anchor: deleting the entity does not delete
|
|
4016
|
-
* the comment. `anchorLabel` is the caption shown once that happens
|
|
4017
|
-
* ("Gloss of ktab, sentence 4"), so pass what the comment is about.
|
|
4018
|
-
* @param {CommentableType} entityType - What kind of thing is being commented on
|
|
4019
|
-
* @param {string} entityId - The commented entity's id
|
|
4020
|
-
* @param {string} body - The comment text (1..10000 characters)
|
|
4021
|
-
* @param {object} [opts]
|
|
4022
|
-
* @param {string} [opts.anchorLabel] - What the comment is about, in words (at most 200 characters)
|
|
4023
|
-
* @param {string} [opts.id] - The new comment's id, minted by the caller (see uuidv7)
|
|
4024
|
-
* @returns {Promise<Comment>}
|
|
4025
|
-
*/
|
|
4026
|
-
create: (entityType: CommentableType, entityId: string, body: string, { anchorLabel, id }?: {
|
|
4027
|
-
anchorLabel?: string;
|
|
4028
|
-
id?: string;
|
|
4029
|
-
}) => Promise<Comment>;
|
|
4030
|
-
/**
|
|
4031
|
-
* Read one comment.
|
|
4032
|
-
* @param {string} id - The comment id
|
|
4033
|
-
* @returns {Promise<Comment>}
|
|
4034
|
-
*/
|
|
4035
|
-
get: (id: string) => Promise<Comment>;
|
|
4036
|
-
/**
|
|
4037
|
-
* Edit a comment's body. Only the comment's AUTHOR may do this - not
|
|
4038
|
-
* maintainers, not admins. Sets `edited` on the comment.
|
|
4039
|
-
* @param {string} id - The comment id
|
|
4040
|
-
* @param {string} body - The replacement text
|
|
4041
|
-
* @returns {Promise<Comment>}
|
|
4042
|
-
*/
|
|
4043
|
-
update: (id: string, body: string) => Promise<Comment>;
|
|
4044
|
-
/**
|
|
4045
|
-
* Delete a comment. The author may delete their own; a project
|
|
4046
|
-
* maintainer (or admin) may delete any.
|
|
4047
|
-
* @param {string} id - The comment id
|
|
4048
|
-
* @returns {Promise<void>}
|
|
4049
|
-
*/
|
|
4050
|
-
delete: (id: string) => Promise<void>;
|
|
4051
|
-
/**
|
|
4052
|
-
* List comments in a project, oldest first. Transparently follows
|
|
4053
|
-
* pagination cursors and returns the full flat array.
|
|
4054
|
-
* @param {string} projectId - The project to read
|
|
4055
|
-
* @param {object} [filters] - Narrow the scope
|
|
4056
|
-
* @param {string} [filters.documentId] - Every comment anywhere in one document
|
|
4057
|
-
* @param {string} [filters.entityType] - With entityId, one entity's thread
|
|
4058
|
-
* @param {string} [filters.entityId] - With entityType, one entity's thread
|
|
4059
|
-
* @returns {Promise<Comment[]>}
|
|
4060
|
-
*/
|
|
4061
|
-
list: (projectId: string, { documentId, entityType, entityId }?: {
|
|
4062
|
-
documentId?: string;
|
|
4063
|
-
entityType?: string;
|
|
4064
|
-
entityId?: string;
|
|
4065
|
-
}) => Promise<Comment[]>;
|
|
4066
|
-
/**
|
|
4067
|
-
* Fetch a single page of a project's comments.
|
|
4068
|
-
* @param {string} projectId - The project to read
|
|
4069
|
-
* @param {object} [opts]
|
|
4070
|
-
* @param {number} [opts.limit] - Page size (1..1000; server default 100)
|
|
4071
|
-
* @param {string} [opts.cursor] - Opaque cursor from a previous page
|
|
4072
|
-
* @param {string} [opts.documentId] - Every comment anywhere in one document
|
|
4073
|
-
* @param {string} [opts.entityType] - With entityId, one entity's thread
|
|
4074
|
-
* @param {string} [opts.entityId] - With entityType, one entity's thread
|
|
4075
|
-
* @returns {Promise<Page<Comment>>}
|
|
4076
|
-
*/
|
|
4077
|
-
listPage: (projectId: string, { limit, cursor, documentId, entityType, entityId }?: {
|
|
4078
|
-
limit?: number;
|
|
4079
|
-
cursor?: string;
|
|
4080
|
-
documentId?: string;
|
|
4081
|
-
entityType?: string;
|
|
4082
|
-
entityId?: string;
|
|
4083
|
-
}) => Promise<Page<Comment>>;
|
|
4084
|
-
/**
|
|
4085
|
-
* Async-iterate a project's comments page by page; yields each page's entries array.
|
|
4086
|
-
* @param {string} projectId - The project to read
|
|
4087
|
-
* @param {object} [opts]
|
|
4088
|
-
* @param {number} [opts.pageSize] - Per-request page size
|
|
4089
|
-
* @param {string} [opts.documentId] - Every comment anywhere in one document
|
|
4090
|
-
* @param {string} [opts.entityType] - With entityId, one entity's thread
|
|
4091
|
-
* @param {string} [opts.entityId] - With entityType, one entity's thread
|
|
4092
|
-
* @returns {AsyncGenerator<Comment[]>}
|
|
4093
|
-
*/
|
|
4094
|
-
iterPages: (projectId: string, { pageSize, documentId, entityType, entityId }?: {
|
|
4095
|
-
pageSize?: number;
|
|
4096
|
-
documentId?: string;
|
|
4097
|
-
entityType?: string;
|
|
4098
|
-
entityId?: string;
|
|
4099
|
-
}) => AsyncGenerator<Comment[]>;
|
|
4100
|
-
/**
|
|
4101
|
-
* Comment counts per entity, as an `{entityId: n}` map, over the same
|
|
4102
|
-
* scope and filters as `list`. One cheap request paints a comment
|
|
4103
|
-
* indicator on every annotated item in a document without paging
|
|
4104
|
-
* through the bodies.
|
|
4105
|
-
*
|
|
4106
|
-
* The response is NOT key-transformed: its keys are entity ids, and
|
|
4107
|
-
* camelCasing would mangle the hyphens in a UUID.
|
|
4108
|
-
* @param {string} projectId - The project to read
|
|
4109
|
-
* @param {{documentId?: string, entityType?: CommentableType, entityId?: string}} [filters] - Same filters as list()
|
|
4110
|
-
* @returns {Promise<Object<string, number>>}
|
|
4111
|
-
*/
|
|
4112
|
-
counts: (projectId: string, { documentId, entityType, entityId }?: {
|
|
4113
|
-
documentId?: string;
|
|
4114
|
-
entityType?: CommentableType;
|
|
4115
|
-
entityId?: string;
|
|
4116
|
-
}) => Promise<{
|
|
4117
|
-
[x: string]: number;
|
|
4118
|
-
}>;
|
|
4119
|
-
/**
|
|
4120
|
-
* List the comments on a vocabulary's entries, oldest first. Requires
|
|
4121
|
-
* read access to the vocabulary. Transparently follows pagination
|
|
4122
|
-
* cursors and returns the full flat array.
|
|
4123
|
-
* @param {string} vocabId - The vocab layer to read
|
|
4124
|
-
* @param {object} [filters]
|
|
4125
|
-
* @param {string} [filters.entityId] - One entry's thread
|
|
4126
|
-
* @returns {Promise<Comment[]>}
|
|
4127
|
-
*/
|
|
4128
|
-
listInVocab: (vocabId: string, { entityId }?: {
|
|
4129
|
-
entityId?: string;
|
|
4130
|
-
}) => Promise<Comment[]>;
|
|
4131
|
-
/**
|
|
4132
|
-
* Fetch a single page of a vocabulary's comments.
|
|
4133
|
-
* @param {string} vocabId - The vocab layer to read
|
|
4134
|
-
* @param {object} [opts]
|
|
4135
|
-
* @param {number} [opts.limit] - Page size (1..1000; server default 100)
|
|
4136
|
-
* @param {string} [opts.cursor] - Opaque cursor from a previous page
|
|
4137
|
-
* @param {string} [opts.entityId] - One entry's thread
|
|
4138
|
-
* @returns {Promise<Page<Comment>>}
|
|
4139
|
-
*/
|
|
4140
|
-
listInVocabPage: (vocabId: string, { limit, cursor, entityId }?: {
|
|
4141
|
-
limit?: number;
|
|
4142
|
-
cursor?: string;
|
|
4143
|
-
entityId?: string;
|
|
4144
|
-
}) => Promise<Page<Comment>>;
|
|
4145
|
-
/**
|
|
4146
|
-
* Async-iterate a vocabulary's comments page by page, oldest first;
|
|
4147
|
-
* yields each page's entries array.
|
|
4148
|
-
* @param {string} vocabId - The vocab layer to read
|
|
4149
|
-
* @param {object} [opts]
|
|
4150
|
-
* @param {string} [opts.entityId] - One entry's thread
|
|
4151
|
-
* @param {number} [opts.pageSize] - Per-request page size
|
|
4152
|
-
* @returns {AsyncGenerator<Comment[]>}
|
|
4153
|
-
*/
|
|
4154
|
-
iterInVocabPages: (vocabId: string, { entityId, pageSize }?: {
|
|
4155
|
-
entityId?: string;
|
|
4156
|
-
pageSize?: number;
|
|
4157
|
-
}) => AsyncGenerator<Comment[]>;
|
|
4158
|
-
/**
|
|
4159
|
-
* Comment counts per entry of a vocabulary, as an `{entityId: n}` map.
|
|
4160
|
-
* The response is NOT key-transformed: its keys are entry ids.
|
|
4161
|
-
* @param {string} vocabId - The vocab layer to read
|
|
4162
|
-
* @param {object} [filters]
|
|
4163
|
-
* @param {string} [filters.entityId] - One entry only
|
|
4164
|
-
* @returns {Promise<Object<string, number>>}
|
|
4165
|
-
*/
|
|
4166
|
-
countsInVocab: (vocabId: string, { entityId }?: {
|
|
4167
|
-
entityId?: string;
|
|
4168
|
-
}) => Promise<{
|
|
4169
|
-
[x: string]: number;
|
|
4170
|
-
}>;
|
|
4171
|
-
};
|
|
4172
|
-
events: {
|
|
4173
|
-
/**
|
|
4174
|
-
* Record one research-telemetry event (plaid-core sql/client_event.clj).
|
|
4175
|
-
* Fire and forget: the event is buffered and sent with
|
|
4176
|
-
* others every ten seconds, at fifty events, and when the page is
|
|
4177
|
-
* hidden. A batch that fails is dropped, nothing is retried, and
|
|
4178
|
-
* nothing is ever thrown. Sends nothing for a project whose switch
|
|
4179
|
-
* (`config.plaid.research.telemetry`) is off, which it reads from the
|
|
4180
|
-
* project itself. `suggestion.shown` is recorded once per target,
|
|
4181
|
-
* field and value in a page session.
|
|
4182
|
-
* @param {ClientEventType} type - The event type
|
|
4183
|
-
* @param {object} fields
|
|
4184
|
-
* @param {string} fields.projectId - The project it happened in
|
|
4185
|
-
* @param {string} [fields.documentId] - The document it happened in
|
|
4186
|
-
* @param {string} [fields.targetId] - What it is about: a token, a plan
|
|
4187
|
-
* @param {object} [fields.data] - Its details, keyed by single lowercase words (`value`, `source`, `field`, `written`, `conversation`)
|
|
4188
|
-
* @returns {boolean} Whether the event was buffered
|
|
4189
|
-
*/
|
|
4190
|
-
record: (type: ClientEventType, fields: {
|
|
4191
|
-
projectId: string;
|
|
4192
|
-
documentId?: string;
|
|
4193
|
-
targetId?: string;
|
|
4194
|
-
data?: object;
|
|
4195
|
-
}) => boolean;
|
|
4196
|
-
/**
|
|
4197
|
-
* Send what the recorder holds now, rather than at its next interval.
|
|
4198
|
-
* @returns {void}
|
|
4199
|
-
*/
|
|
4200
|
-
flush: () => void;
|
|
4201
|
-
/**
|
|
4202
|
-
* Tell the recorder a project's switch at once, e.g. right after a
|
|
4203
|
-
* maintainer changed it. Turning it off drops what is buffered.
|
|
4204
|
-
* @param {string} projectId - The project
|
|
4205
|
-
* @param {boolean} on - Whether telemetry is on
|
|
4206
|
-
* @returns {void}
|
|
4207
|
-
*/
|
|
4208
|
-
setEnabled: (projectId: string, on: boolean) => void;
|
|
4209
|
-
/**
|
|
4210
|
-
* Record events directly, with no buffering. Requires write access, and
|
|
4211
|
-
* the server refuses with a 403 while the project's switch is off. All
|
|
4212
|
-
* or nothing: one bad event refuses the request with a 400 naming it.
|
|
4213
|
-
* @param {string} projectId - The project the events happened in
|
|
4214
|
-
* @param {Array<{type: string, documentId?: string, targetId?: string, data?: object, clientTs?: string}>} events - At most 500 events
|
|
4215
|
-
* @returns {Promise<{count: number}>}
|
|
4216
|
-
*/
|
|
4217
|
-
create: (projectId: string, events: Array<{
|
|
4218
|
-
type: string;
|
|
4219
|
-
documentId?: string;
|
|
4220
|
-
targetId?: string;
|
|
4221
|
-
data?: object;
|
|
4222
|
-
clientTs?: string;
|
|
4223
|
-
}>) => Promise<{
|
|
4224
|
-
count: number;
|
|
4225
|
-
}>;
|
|
4226
|
-
/**
|
|
4227
|
-
* A project's events in arrival order. Maintainer or admin only.
|
|
4228
|
-
* Transparently follows pagination cursors and returns the full flat
|
|
4229
|
-
* array.
|
|
4230
|
-
* @param {string} projectId - The project to read
|
|
4231
|
-
* @param {object} [filters]
|
|
4232
|
-
* @param {string|string[]} [filters.types] - Only these types
|
|
4233
|
-
* @param {string} [filters.startTime] - Only events the server stamped at or after this instant
|
|
4234
|
-
* @param {string} [filters.endTime] - Only events the server stamped at or before this instant
|
|
4235
|
-
* @returns {Promise<ClientEvent[]>}
|
|
4236
|
-
*/
|
|
4237
|
-
list: (projectId: string, { types, startTime, endTime }?: {
|
|
4238
|
-
types?: string | string[];
|
|
4239
|
-
startTime?: string;
|
|
4240
|
-
endTime?: string;
|
|
4241
|
-
}) => Promise<ClientEvent[]>;
|
|
4242
|
-
/**
|
|
4243
|
-
* One page of a project's events. Maintainer or admin only.
|
|
4244
|
-
* @param {string} projectId - The project to read
|
|
4245
|
-
* @param {object} [opts]
|
|
4246
|
-
* @param {number} [opts.limit] - Page size (1..1000; server default 100)
|
|
4247
|
-
* @param {string} [opts.cursor] - Opaque cursor from a previous page
|
|
4248
|
-
* @param {string|string[]} [opts.types] - Only these types
|
|
4249
|
-
* @param {string} [opts.startTime] - Only events at or after this instant
|
|
4250
|
-
* @param {string} [opts.endTime] - Only events at or before this instant
|
|
4251
|
-
* @returns {Promise<Page<ClientEvent>>}
|
|
4252
|
-
*/
|
|
4253
|
-
listPage: (projectId: string, { limit, cursor, types, startTime, endTime }?: {
|
|
4254
|
-
limit?: number;
|
|
4255
|
-
cursor?: string;
|
|
4256
|
-
types?: string | string[];
|
|
4257
|
-
startTime?: string;
|
|
4258
|
-
endTime?: string;
|
|
4259
|
-
}) => Promise<Page<ClientEvent>>;
|
|
4260
|
-
/**
|
|
4261
|
-
* Async-iterate a project's events page by page; yields each page's entries array.
|
|
4262
|
-
* @param {string} projectId - The project to read
|
|
4263
|
-
* @param {object} [opts]
|
|
4264
|
-
* @param {number} [opts.pageSize] - Per-request page size
|
|
4265
|
-
* @param {string|string[]} [opts.types] - Only these types
|
|
4266
|
-
* @param {string} [opts.startTime] - Only events at or after this instant
|
|
4267
|
-
* @param {string} [opts.endTime] - Only events at or before this instant
|
|
4268
|
-
* @returns {AsyncGenerator<ClientEvent[]>}
|
|
4269
|
-
*/
|
|
4270
|
-
iterPages: (projectId: string, { pageSize, types, startTime, endTime }?: {
|
|
4271
|
-
pageSize?: number;
|
|
4272
|
-
types?: string | string[];
|
|
4273
|
-
startTime?: string;
|
|
4274
|
-
endTime?: string;
|
|
4275
|
-
}) => AsyncGenerator<ClientEvent[]>;
|
|
4276
|
-
};
|
|
4277
|
-
guidelines: {
|
|
4278
|
-
/**
|
|
4279
|
-
* Create a guideline in a project. `title` is the handle an assistant
|
|
4280
|
-
* asks for one by, and the only thing a person has to keep current. It is
|
|
4281
|
-
* NOT required to be unique, so a title already in use is written like
|
|
4282
|
-
* any other: warn about it, do not refuse it. A `pinned` guideline is one
|
|
4283
|
-
* the assistant is given in full on every turn.
|
|
4284
|
-
* @param {string} projectId - The project the guideline belongs to
|
|
4285
|
-
* @param {string} title - The handle an assistant asks for one by (1..100 characters)
|
|
4286
|
-
* @param {object} [opts]
|
|
4287
|
-
* @param {string} [opts.body] - The Markdown text (up to 20000 characters; may be empty)
|
|
4288
|
-
* @param {boolean} [opts.pinned] - Send this one to the assistant in full on every turn
|
|
4289
|
-
* @param {string} [opts.id] - The new guideline's id, minted by the caller (see uuidv7)
|
|
4290
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
4291
|
-
* @returns {Promise<{id: string}>}
|
|
4292
|
-
*/
|
|
4293
|
-
create: (projectId: string, title: string, { body, pinned, id }?: {
|
|
4294
|
-
body?: string;
|
|
4295
|
-
pinned?: boolean;
|
|
4296
|
-
id?: string;
|
|
4297
|
-
}, auditMessage?: string) => Promise<{
|
|
4298
|
-
id: string;
|
|
4299
|
-
}>;
|
|
4300
|
-
/**
|
|
4301
|
-
* Read one guideline, Markdown body included.
|
|
4302
|
-
* @param {string} id - The guideline id
|
|
4303
|
-
* @returns {Promise<Guideline>}
|
|
4304
|
-
*/
|
|
4305
|
-
get: (id: string) => Promise<Guideline>;
|
|
4306
|
-
/**
|
|
4307
|
-
* Update a guideline. Every field is optional and an omitted one is
|
|
4308
|
-
* left alone, so an edit to the body need not restate the title.
|
|
4309
|
-
*
|
|
4310
|
-
* Pass `expectedUpdatedAt` (the `updatedAt` you last read) when a person
|
|
4311
|
-
* has been editing prose: the write then fails with 409 rather than
|
|
4312
|
-
* overwriting somebody who saved in between. Leave it off for a pin
|
|
4313
|
-
* toggle or a script, which have nothing of anyone's to lose.
|
|
4314
|
-
* @param {string} id - The guideline id
|
|
4315
|
-
* @param {object} [changes]
|
|
4316
|
-
* @param {string} [changes.title] - The new handle
|
|
4317
|
-
* @param {string} [changes.body] - The new Markdown text
|
|
4318
|
-
* @param {boolean} [changes.pinned] - Whether the assistant always gets it in full
|
|
4319
|
-
* @param {string} [changes.expectedUpdatedAt] - Write only if this is still the stored updatedAt
|
|
4320
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
4321
|
-
* @returns {Promise<Guideline>}
|
|
4322
|
-
*/
|
|
4323
|
-
update: (id: string, { title, body, pinned, expectedUpdatedAt }?: {
|
|
4324
|
-
title?: string;
|
|
4325
|
-
body?: string;
|
|
4326
|
-
pinned?: boolean;
|
|
4327
|
-
expectedUpdatedAt?: string;
|
|
4328
|
-
}, auditMessage?: string) => Promise<Guideline>;
|
|
4329
|
-
/**
|
|
4330
|
-
* Delete a guideline.
|
|
4331
|
-
* @param {string} id - The guideline id
|
|
4332
|
-
* @param {string} [auditMessage] - Audit message for this write
|
|
4333
|
-
* @returns {Promise<void>}
|
|
4334
|
-
*/
|
|
4335
|
-
delete: (id: string, auditMessage?: string) => Promise<void>;
|
|
4336
|
-
/**
|
|
4337
|
-
* List a project's guidelines, by title. Transparently follows
|
|
4338
|
-
* pagination cursors and returns the full flat array.
|
|
4339
|
-
*
|
|
4340
|
-
* Without `includeBodies` each entry carries `bodyChars`, the length of
|
|
4341
|
-
* its body, so a caller can budget before fetching any. Pinned
|
|
4342
|
-
* guidelines are NOT sorted first: `pinned` is on every entry and
|
|
4343
|
-
* grouping is the caller's.
|
|
4344
|
-
* @param {string} projectId - The project to read
|
|
4345
|
-
* @param {object} [opts]
|
|
4346
|
-
* @param {boolean} [opts.includeBodies] - Return each body instead of its length
|
|
4347
|
-
* @returns {Promise<Guideline[]>}
|
|
4348
|
-
*/
|
|
4349
|
-
list: (projectId: string, { includeBodies }?: {
|
|
4350
|
-
includeBodies?: boolean;
|
|
4351
|
-
}) => Promise<Guideline[]>;
|
|
4352
|
-
/**
|
|
4353
|
-
* Fetch a single page of a project's guidelines.
|
|
4354
|
-
* @param {string} projectId - The project to read
|
|
4355
|
-
* @param {object} [opts]
|
|
4356
|
-
* @param {number} [opts.limit] - Page size (1..1000; server default 100)
|
|
4357
|
-
* @param {string} [opts.cursor] - Opaque cursor from a previous page
|
|
4358
|
-
* @param {boolean} [opts.includeBodies] - Return each body instead of its length
|
|
4359
|
-
* @returns {Promise<Page<Guideline>>}
|
|
4360
|
-
*/
|
|
4361
|
-
listPage: (projectId: string, { limit, cursor, includeBodies }?: {
|
|
4362
|
-
limit?: number;
|
|
4363
|
-
cursor?: string;
|
|
4364
|
-
includeBodies?: boolean;
|
|
4365
|
-
}) => Promise<Page<Guideline>>;
|
|
4366
|
-
/**
|
|
4367
|
-
* Async-iterate a project's guidelines page by page; yields each page's entries array.
|
|
4368
|
-
* @param {string} projectId - The project to read
|
|
4369
|
-
* @param {object} [opts]
|
|
4370
|
-
* @param {number} [opts.pageSize] - Per-request page size
|
|
4371
|
-
* @param {boolean} [opts.includeBodies] - Return each body instead of its length
|
|
4372
|
-
* @returns {AsyncGenerator<Guideline[]>}
|
|
4373
|
-
*/
|
|
4374
|
-
iterPages: (projectId: string, { pageSize, includeBodies }?: {
|
|
4375
|
-
pageSize?: number;
|
|
4376
|
-
includeBodies?: boolean;
|
|
4377
|
-
}) => AsyncGenerator<Guideline[]>;
|
|
4378
|
-
};
|
|
4379
|
-
/** @private */
|
|
4380
|
-
private _request;
|
|
4381
|
-
/**
|
|
4382
|
-
* Enter strict mode for a specific document, requiring document version
|
|
4383
|
-
* headers so that conflicting concurrent writes are rejected.
|
|
4384
|
-
* @param {string} documentId - The ID of the document to track versions for
|
|
4385
|
-
*/
|
|
4386
|
-
enterStrictMode(documentId: string): void;
|
|
4387
|
-
/** Exit strict mode and stop tracking document versions for writes. */
|
|
4388
|
-
exitStrictMode(): void;
|
|
4389
|
-
/**
|
|
4390
|
-
* Begin a LOGICAL OPERATION: a user-meaningful action ("Merge morphemes",
|
|
4391
|
-
* "Re-transcribe") implemented as many low-level writes, possibly across
|
|
4392
|
-
* several batches and even a service round-trip. Until `endOperation()`,
|
|
4393
|
-
* every write is stamped with a client-minted `?group-id=` (and the message)
|
|
4394
|
-
* so the audit log shows the whole run as ONE expandable entry labeled
|
|
4395
|
-
* `message`, with each write's own description underneath.
|
|
4396
|
-
*
|
|
4397
|
-
* Grouping is orthogonal to batches: a batch is a transaction boundary, an
|
|
4398
|
-
* operation is an intent boundary. An operation is NOT atomic — if write 3
|
|
4399
|
-
* of 5 fails, writes 1–2 stay committed (and logged under the group). Use a
|
|
4400
|
-
* batch inside the operation for any step that must be all-or-nothing.
|
|
4401
|
-
*
|
|
4402
|
-
* Nesting flattens: a `beginOperation` while one is open is a no-op that
|
|
4403
|
-
* joins the outer operation (the outer label wins), and the matching
|
|
4404
|
-
* `endOperation` is likewise a no-op. The label is recorded on the FIRST
|
|
4405
|
-
* write, so an operation that is never ended (crash, closed tab) is still
|
|
4406
|
-
* labeled in the log.
|
|
4407
|
-
*
|
|
4408
|
-
* "Every write" is the writes of project data. Reads never join, and neither
|
|
4409
|
-
* do the out-of-band signals shaped like a write (a document lock taken or
|
|
4410
|
-
* renewed, a stopped service request, a service reporting itself, an admin
|
|
4411
|
-
* control), and neither does a broadcast message (`messages.sendMessage`):
|
|
4412
|
-
* none of them is audited, so there would be nothing under the label.
|
|
4413
|
-
*
|
|
4414
|
-
* `kind` says what kind of operation this is, for a program reading the
|
|
4415
|
-
* log: one of `assistant-plan`, `service-run`, `import`, `bulk-edit`,
|
|
4416
|
-
* `guess-adoption`, `repair` or `review` (the server refuses any other).
|
|
4417
|
-
* Any other kind throws here, before anything is written.
|
|
4418
|
-
* `ref` is a short string naming what the operation came from, in the
|
|
4419
|
-
* shape its kind documents (the core manual, "Kinds of operation"). Both
|
|
4420
|
-
* are recorded from the first write like the label, and a nested operation
|
|
4421
|
-
* keeps the outer one's.
|
|
4422
|
-
*
|
|
4423
|
-
* `keys` (from `keySeed()`) makes a run of the operation send the same
|
|
4424
|
-
* requests as an earlier run with the same keys: the nth keyed request that
|
|
4425
|
-
* joins it takes the Idempotency-Key `<seed>.<n>` and the document-version
|
|
4426
|
-
* its first run claimed, so a request that landed is answered from its
|
|
4427
|
-
* first send and writes nothing again. The count starts at 0 at each
|
|
4428
|
-
* outermost begin. A nested operation joins the outer one's keys, unless it
|
|
4429
|
-
* brings its own: then it numbers from 0 under its own seed until its
|
|
4430
|
-
* matching end, and the outer numbering resumes after it.
|
|
4431
|
-
*
|
|
4432
|
-
* @param {string} message - Human label for the operation.
|
|
4433
|
-
* @param {{groupId?: string, kind?: OperationKind, ref?: string, keys?: KeySeed, minted?: Iterable<string>}} [opts] - Optional `{ groupId, kind, ref, keys, minted }`. `groupId` adopts an existing group id instead of minting one (a service joining the requester's operation; `requestService` propagates an open operation to the service automatically). Python's is `group_id`. `kind`, `ref` and `keys` are described above. `minted` is the ids the operation mints for what it creates: a create refused 409 id-taken for one of them was made by an earlier send of the operation, and answers as made.
|
|
4434
|
-
* @returns {string} The operation's group id.
|
|
4435
|
-
*/
|
|
4436
|
-
beginOperation(message: string, { groupId, kind, ref, keys, minted }?: {
|
|
4437
|
-
groupId?: string;
|
|
4438
|
-
kind?: OperationKind;
|
|
4439
|
-
ref?: string;
|
|
4440
|
-
keys?: KeySeed;
|
|
4441
|
-
minted?: Iterable<string>;
|
|
4442
|
-
}): string;
|
|
4443
|
-
/**
|
|
4444
|
-
* A seed for the Idempotency-Keys of a logical operation that may be run
|
|
4445
|
-
* again from the top (see beginOperation's `keys`). Keep it with the work
|
|
4446
|
-
* it belongs to and pass it to every run.
|
|
4447
|
-
* @returns {KeySeed}
|
|
4448
|
-
*/
|
|
4449
|
-
keySeed(): KeySeed;
|
|
4450
|
-
/**
|
|
4451
|
-
* End the current logical operation. With no argument this is purely local
|
|
4452
|
-
* (no request). Pass a refined `message` to relabel the group now that the
|
|
4453
|
-
* outcome is known (e.g. `endOperation('Merged 3 morphemes')`) — that sends
|
|
4454
|
-
* one PATCH, skipped if the operation never wrote anything. A refine from a
|
|
4455
|
-
* nested (flattened) `endOperation` is ignored; the outer label wins.
|
|
4456
|
-
* @param {string} [message] - Optional refined label.
|
|
4457
|
-
* @returns {Promise<void>}
|
|
4458
|
-
*/
|
|
4459
|
-
endOperation(message?: string): Promise<void>;
|
|
4460
|
-
/**
|
|
4461
|
-
* Run `fn` as one logical operation (see beginOperation), ending it when
|
|
4462
|
-
* `fn` settles — including on throw. `fn` receives a `setMessage(msg)`
|
|
4463
|
-
* callback to refine the label once the outcome is known.
|
|
4464
|
-
*
|
|
4465
|
-
* await client.withOperation('Merge morphemes', async (setMessage) => {
|
|
4466
|
-
* await client.batched(async (b) => { ... });
|
|
4467
|
-
* setMessage(`Merged ${n} morphemes`);
|
|
4468
|
-
* });
|
|
4469
|
-
*
|
|
4470
|
-
* The kind and reference (see beginOperation) come after `fn`:
|
|
4471
|
-
*
|
|
4472
|
-
* await client.withOperation('Import ELAN corpus', run, { kind: 'import', ref: 'format:elan' });
|
|
4473
|
-
*
|
|
4474
|
-
* @template T
|
|
4475
|
-
* @param {string} message - Human label for the operation.
|
|
4476
|
-
* @param {(setMessage: (msg: string) => void) => T | Promise<T>} fn - The work to run; receives `setMessage(msg)` to refine the label once the outcome is known.
|
|
4477
|
-
* @param {{kind?: OperationKind, ref?: string, groupId?: string, keys?: KeySeed, minted?: Iterable<string>}} [opts] - Optional `{ kind, ref, groupId, keys, minted }`, as for beginOperation. `kind` is one of `assistant-plan`, `service-run`, `import`, `bulk-edit`, `guess-adoption`, `repair` or `review`, and any other throws before `fn` runs.
|
|
4478
|
-
* @returns {Promise<T>} Whatever `fn` resolves to.
|
|
4479
|
-
*/
|
|
4480
|
-
withOperation<T>(message: string, fn: (setMessage: (msg: string) => void) => T | Promise<T>, { kind, ref, groupId, keys, minted }?: {
|
|
4481
|
-
kind?: OperationKind;
|
|
4482
|
-
ref?: string;
|
|
4483
|
-
groupId?: string;
|
|
4484
|
-
keys?: KeySeed;
|
|
4485
|
-
minted?: Iterable<string>;
|
|
4486
|
-
}): Promise<T>;
|
|
4487
|
-
/**
|
|
4488
|
-
* Open a batch: a view of this client with the same bundles, on which every
|
|
4489
|
-
* write of project data queues instead of going out. `submit()` sends the
|
|
4490
|
-
* queued operations as ONE atomic request (larger than the server's cap,
|
|
4491
|
-
* as consecutive requests with the results concatenated in queue order,
|
|
4492
|
-
* each atomic on its own, so a failure in a later one leaves the earlier
|
|
4493
|
-
* ones committed, and the error it throws carries `committed`, the count
|
|
4494
|
-
* saved, and `committedResults`, their results) and
|
|
4495
|
-
* resolves to one result per operation; `abort()` drops them. A call made
|
|
4496
|
-
* on the client itself is never touched by an open batch, and a read or an
|
|
4497
|
-
* out-of-band signal made on the batch goes over the wire now (see the note
|
|
4498
|
-
* at the top of `http.js`).
|
|
4499
|
-
*
|
|
4500
|
-
* const b = client.batch();
|
|
4501
|
-
* b.tokens.bulkCreate(sentenceOps);
|
|
4502
|
-
* b.tokens.bulkCreate(wordOps);
|
|
4503
|
-
* const [sentRes, wordRes] = await b.submit();
|
|
4504
|
-
*
|
|
4505
|
-
* Server-side a batch runs sequentially in one transaction: a child op sees
|
|
4506
|
-
* parents created earlier in the same batch, and any op's failure rolls the
|
|
4507
|
-
* whole batch back. A batch is not nestable. Prefer `batched()`, which
|
|
4508
|
-
* submits or aborts for you.
|
|
4509
|
-
*
|
|
4510
|
-
* `timeout` (ms, or null for none) is how long each of this batch's
|
|
4511
|
-
* requests may wait for its answer, in place of the client's
|
|
4512
|
-
* `batchTimeout`, for this batch alone.
|
|
4513
|
-
* @param {{timeout?: number | null}} [options]
|
|
4514
|
-
* @returns {PlaidBatch} the batch view
|
|
4515
|
-
*/
|
|
4516
|
-
batch({ timeout }?: {
|
|
4517
|
-
timeout?: number | null;
|
|
4518
|
-
}): PlaidBatch;
|
|
4519
|
-
/**
|
|
4520
|
-
* POST one batch request (at most MAX_BATCH_OPS operations). Resolves to
|
|
4521
|
-
* one `{ status, headers, body }` per operation, with only the body
|
|
4522
|
-
* recased: the headers keep the server's spelling. `key` is the request's
|
|
4523
|
-
* Idempotency-Key: a batch whose answer is lost (no response, 502, 504) is
|
|
4524
|
-
* sent again under it, and answered from the first send if that landed.
|
|
4525
|
-
* `timeout` is this request's, in place of `batchTimeout` when given.
|
|
4526
|
-
* @private
|
|
4527
|
-
*/
|
|
4528
|
-
private _postBatch;
|
|
4529
|
-
/**
|
|
4530
|
-
* Run `fn` with a batch, then submit all queued ops as `submit()` does (ONE
|
|
4531
|
-
* atomic request up to MAX_BATCH_OPS operations, consecutive requests past
|
|
4532
|
-
* it), or abort the batch if `fn` throws. `fn` receives the batch and makes its
|
|
4533
|
-
* writes on it; it must NOT call `submit()` itself. Resolves to the batch
|
|
4534
|
-
* results array (`[]` if `fn` queued nothing).
|
|
4535
|
-
*
|
|
4536
|
-
* const [sentRes, wordRes] = await client.batched(async (b) => {
|
|
4537
|
-
* b.tokens.bulkCreate(sentenceOps);
|
|
4538
|
-
* b.tokens.bulkCreate(wordOps);
|
|
4539
|
-
* });
|
|
4540
|
-
*
|
|
4541
|
-
* A write made on `client` inside `fn` is not part of the batch: it goes
|
|
4542
|
-
* over the wire at once, as it would anywhere else. See `batch()`, which
|
|
4543
|
-
* also says what `timeout` does.
|
|
4544
|
-
* @param {(batch: PlaidBatch) => (void | Promise<void>)} fn
|
|
4545
|
-
* @param {{timeout?: number | null}} [options]
|
|
4546
|
-
* @returns {Promise<any[]>}
|
|
4547
|
-
*/
|
|
4548
|
-
batched(fn: (batch: PlaidBatch) => (void | Promise<void>), { timeout }?: {
|
|
4549
|
-
timeout?: number | null;
|
|
4550
|
-
}): Promise<any[]>;
|
|
4551
|
-
}
|
|
4552
|
-
/**
|
|
4553
|
-
* The server's cap on operations per batch request (plaid.rest-api.v1.batch).
|
|
4554
|
-
* A batch queued past it is submitted as consecutive requests.
|
|
4555
|
-
*/
|
|
4556
|
-
export const MAX_BATCH_OPS: 1000;
|
|
4557
|
-
export { valueSetAllows, violationsOf } from "./constraints.js";
|
|
5
|
+
export { MAX_BATCH_OPS } from "./batch.js";
|
|
6
|
+
export type TextEditOp = import("./types.js").TextEditOp;
|
|
7
|
+
export type TextGap = import("./types.js").TextGap;
|
|
8
|
+
export type MetadataOp = import("./types.js").MetadataOp;
|
|
9
|
+
export type LayerConstraint = import("./types.js").LayerConstraint;
|
|
10
|
+
export type ConstraintWriteOptions = import("./types.js").ConstraintWriteOptions;
|
|
11
|
+
export type ConstraintViolation = import("./types.js").ConstraintViolation;
|
|
12
|
+
export type Requester = import("./types.js").Requester;
|
|
13
|
+
export type BatchRef = import("./types.js").BatchRef;
|
|
14
|
+
export type ServiceParam = import("./types.js").ServiceParam;
|
|
15
|
+
export type ServiceInfo = import("./types.js").ServiceInfo;
|
|
16
|
+
export type DiscoveredService = import("./types.js").DiscoveredService;
|
|
17
|
+
export type ResponseHelper = import("./types.js").ResponseHelper;
|
|
18
|
+
export type ServiceRegistration = import("./types.js").ServiceRegistration;
|
|
19
|
+
export type ServiceStatusEvent = import("./types.js").ServiceStatusEvent;
|
|
20
|
+
export type OperationGroupsBundle = import("./types.js").OperationGroupsBundle;
|
|
21
|
+
export type PlaidClientOptions = import("./types.js").PlaidClientOptions;
|
|
22
|
+
export type OperationKind = import("./types.js").OperationKind;
|
|
23
|
+
export type KeySeed = import("./types.js").KeySeed;
|
|
24
|
+
export type PlaidBatch = import("./types.js").PlaidBatch;
|
|
25
|
+
export type AuditPageOptions = import("./types.js").AuditPageOptions;
|
|
26
|
+
export type VocabItemRestoreSummary = import("./types.js").VocabItemRestoreSummary;
|
|
27
|
+
export type UserDataEntry = import("./types.js").UserDataEntry;
|
|
28
|
+
export type AdminUserDataEntry = import("./types.js").AdminUserDataEntry;
|
|
29
|
+
export type ActivityTallyRow = import("./types.js").ActivityTallyRow;
|
|
30
|
+
export type ConstraintRepair = import("./types.js").ConstraintRepair;
|
|
31
|
+
export type ValueSetRule = import("./types.js").ValueSetRule;
|
|
32
|
+
export type RefusedValues = import("./types.js").RefusedValues;
|
|
33
|
+
export type CommentableType = import("./types.js").CommentableType;
|
|
34
|
+
export type Comment = import("./types.js").Comment;
|
|
35
|
+
export type Guideline = import("./types.js").Guideline;
|
|
36
|
+
export type ClientEventType = import("./types.js").ClientEventType;
|
|
37
|
+
export type ClientEvent = import("./types.js").ClientEvent;
|
|
38
|
+
export type Invite = import("./types.js").Invite;
|
|
39
|
+
export type ServerLimits = import("./types.js").ServerLimits;
|
|
40
|
+
export type ServerHealth = import("./types.js").ServerHealth;
|
|
41
|
+
export type RateLimitBucket = import("./types.js").RateLimitBucket;
|
|
42
|
+
export type RateLimitSnapshot = import("./types.js").RateLimitSnapshot;
|
|
43
|
+
export type BackupStatus = import("./types.js").BackupStatus;
|
|
44
|
+
export type ServerReport = import("./types.js").ServerReport;
|
|
45
|
+
export type LiveLog = import("./types.js").LiveLog;
|
|
46
|
+
export type SSEConnection = import("./types.js").SSEConnection;
|
|
47
|
+
export type SSEStats = import("./types.js").SSEStats;
|
|
48
|
+
export type AtomicValue = import("./types.js").AtomicValue;
|
|
49
|
+
export type Created = import("./types.js").Created;
|
|
50
|
+
export type Project = import("./types.js").Project;
|
|
51
|
+
export type ProjectTextLayer = import("./types.js").ProjectTextLayer;
|
|
52
|
+
export type ProjectTokenLayer = import("./types.js").ProjectTokenLayer;
|
|
53
|
+
export type ProjectSpanLayer = import("./types.js").ProjectSpanLayer;
|
|
54
|
+
export type ProjectRelationLayer = import("./types.js").ProjectRelationLayer;
|
|
55
|
+
export type ProjectVocab = import("./types.js").ProjectVocab;
|
|
56
|
+
export type PlaidDocument = import("./types.js").PlaidDocument;
|
|
57
|
+
export type DocumentTextLayer = import("./types.js").DocumentTextLayer;
|
|
58
|
+
export type DocumentTokenLayer = import("./types.js").DocumentTokenLayer;
|
|
59
|
+
export type DocumentSpanLayer = import("./types.js").DocumentSpanLayer;
|
|
60
|
+
export type PlaidText = import("./types.js").PlaidText;
|
|
61
|
+
export type TextReshape = import("./types.js").TextReshape;
|
|
62
|
+
export type Token = import("./types.js").Token;
|
|
63
|
+
export type Span = import("./types.js").Span;
|
|
64
|
+
export type Relation = import("./types.js").Relation;
|
|
65
|
+
export type VocabItem = import("./types.js").VocabItem;
|
|
66
|
+
export type VocabLink = import("./types.js").VocabLink;
|
|
67
|
+
export type VocabLayer = import("./types.js").VocabLayer;
|
|
68
|
+
export type TextLayer = import("./types.js").TextLayer;
|
|
69
|
+
export type TokenLayer = import("./types.js").TokenLayer;
|
|
70
|
+
export type SpanLayer = import("./types.js").SpanLayer;
|
|
71
|
+
export type RelationLayer = import("./types.js").RelationLayer;
|
|
72
|
+
export type MetadataRecords = import("./types.js").MetadataRecords;
|
|
73
|
+
export type LayerRecords = import("./types.js").LayerRecords;
|
|
74
|
+
export type User = import("./types.js").User;
|
|
75
|
+
export type ProjectListEntry = import("./types.js").ProjectListEntry;
|
|
76
|
+
export type DocumentListEntry = import("./types.js").DocumentListEntry;
|
|
77
|
+
export type ApiToken = import("./types.js").ApiToken;
|
|
78
|
+
export type AuditUser = import("./types.js").AuditUser;
|
|
79
|
+
export type AuditTarget = import("./types.js").AuditTarget;
|
|
80
|
+
export type AuditOp = import("./types.js").AuditOp;
|
|
81
|
+
export type AuditEntry = import("./types.js").AuditEntry;
|
|
82
|
+
export type LockGrant = import("./types.js").LockGrant;
|
|
83
|
+
export type DocumentRestoreSummary = import("./types.js").DocumentRestoreSummary;
|
|
84
|
+
export type RestoreCounts = import("./types.js").RestoreCounts;
|
|
85
|
+
export type OperationGroup = import("./types.js").OperationGroup;
|
|
86
|
+
export type QueryResult = import("./types.js").QueryResult;
|
|
87
|
+
export type Page<T = any> = import("./types.js").Page<T>;
|
|
88
|
+
import { PlaidClient } from "./client.js";
|
|
89
|
+
export { valueSetAllows, violationCountOf, violationsOf } from "./constraints.js";
|
|
4558
90
|
export { cpLength, cpSlice, cpSlicer, utf16ToCp, cpIndexOf, composeText } from "./codepoint.js";
|
|
4559
91
|
export { composeTextEdits, gapsToOps, applyTextOps } from "./textEdits.js";
|
|
4560
|
-
export { PLAID_NAMESPACE, ROLE_KEY, PRESERVE_ON_SPLIT_KEY, SPLIT_ON_SPACE_KEY, ROLES, readRole, findByRole } from "./roles.js";
|
|
92
|
+
export { PLAID_NAMESPACE, ROLE_KEY, PRESERVE_ON_SPLIT_KEY, SPLIT_ON_SPACE_KEY, IGNORED_TOKENS_KEY, TARTAN_KEY, RESEARCH_KEY, readResearchTelemetry, ROLES, readRole, readIgnoredTokens, findByRole } from "./roles.js";
|
|
4561
93
|
export { TASKS, servesTask, filterServicesByTask, getParamSchema, getServiceSummary, buildDefaultValues, coerceParamValues } from "./serviceSchema.js";
|
|
4562
94
|
export { ServiceCancelled, createCancelScope, UNKNOWN_OUTCOME, UNREACHABLE } from "./services.js";
|
|
4563
95
|
export { REQUESTED_BY, makeRequester, requesterOf } from "./requester.js";
|
|
4564
96
|
export { DocumentLock, DocumentLockLost } from "./documentLock.js";
|
|
4565
|
-
export { PROV, PROV_STATES, PROVENANCE_KEYS, stampInferred, confirmedInferred, stampContributed, provState, provOrigin, isMachine, isProtected, needsReview, contributeOnEdit, serviceSource, REVIEW_KEY, readReview, projectRole, isReviewed, withReviewedUser, writerPolicy } from "./provenance.js";
|
|
97
|
+
export { PROV, PROV_STATES, PROVENANCE_KEYS, stampInferred, confirmedInferred, stampContributed, provState, provOrigin, isMachine, isProtected, needsReview, contributeOnEdit, serviceSource, REVIEW_KEY, readReview, reviewsAnyone, projectRole, isReviewed, withReviewedUser, CONFIDENCE_KEY, DEFAULT_CONFIDENCE_THRESHOLD, readConfidenceThreshold, machineProb, isDoubtful, VALUE_PROBS_KEY, FORM_PROBS_KEY, readValueProbs, writerPolicy } from "./provenance.js";
|
|
98
|
+
export { MORPH_TYPES, entryForm, readAffixMarkers, decorateWithAffixMarkers } from "./entryForms.js";
|
|
4566
99
|
export { metadataOps, applyMetadataOps, mergeMetadata, isReservedMetadataKey } from "./metadataOps.js";
|
|
4567
100
|
export { createdId, createdIds } from "./created.js";
|
|
4568
101
|
export { uuidv4, uuidv7, normalizeUserId } from "./ids.js";
|