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

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/index.d.ts CHANGED
@@ -15,7 +15,7 @@ interface ServiceParam {
15
15
  /** Key the value is sent under in the request payload. */
16
16
  key: string;
17
17
  label: string;
18
- type: 'string' | 'number' | 'boolean' | 'enum' | 'multiselect';
18
+ type: "string" | "number" | "boolean" | "enum" | "multiselect";
19
19
  description?: string;
20
20
  default?: any;
21
21
  required?: boolean;
@@ -62,10 +62,16 @@ interface DiscoveredService {
62
62
 
63
63
  interface ServiceRegistration {
64
64
  stop(): void;
65
+ /** Still serving, including while retrying a channel through a server restart. */
65
66
  isRunning(): boolean;
67
+ /** Channel open right now, i.e. the server currently sees this service as online. */
68
+ isConnected(): boolean;
66
69
  serviceInfo: ServiceInfo & { extras: any };
67
70
  }
68
71
 
72
+ /** Connection-state transitions reported by a service registration. */
73
+ type ServiceStatusEvent = 'registered' | 'reconnected' | 'disconnected';
74
+
69
75
  interface ResponseHelper {
70
76
  progress(percent: number, message: string): void;
71
77
  complete(data: any): void;
@@ -79,7 +85,12 @@ interface SSEConnection {
79
85
  }
80
86
 
81
87
  interface VocabLinksBundle {
82
- create(vocabItem: string, tokens: any[], metadata?: any, auditMessage?: string): Promise<any>;
88
+ create(
89
+ vocabItem: string,
90
+ tokens: any[],
91
+ metadata?: any,
92
+ auditMessage?: string,
93
+ ): Promise<any>;
83
94
  bulkCreate(body: any[], auditMessage?: string): Promise<{ ids: string[] }>;
84
95
  bulkDelete(body: any[], auditMessage?: string): Promise<void>;
85
96
  setMetadata(id: string, body: any, auditMessage?: string): Promise<any>;
@@ -93,43 +104,118 @@ interface VocabLayersBundle {
93
104
  get(id: string, includeItems?: boolean, asOf?: string): Promise<any>;
94
105
  delete(id: string, auditMessage?: string): Promise<any>;
95
106
  update(id: string, name: string, auditMessage?: string): Promise<any>;
96
- setConfig(id: string, namespace: string, configKey: string, configValue: any, auditMessage?: string): Promise<any>;
97
- deleteConfig(id: string, namespace: string, configKey: string, auditMessage?: string): Promise<any>;
107
+ setConfig(
108
+ id: string,
109
+ namespace: string,
110
+ configKey: string,
111
+ configValue: any,
112
+ auditMessage?: string,
113
+ ): Promise<any>;
114
+ deleteConfig(
115
+ id: string,
116
+ namespace: string,
117
+ configKey: string,
118
+ auditMessage?: string,
119
+ ): Promise<any>;
98
120
  list(asOf?: string): Promise<any[]>;
99
- listPage(opts?: { limit?: number; cursor?: string; asOf?: string }): Promise<Page>;
121
+ listPage(opts?: {
122
+ limit?: number;
123
+ cursor?: string;
124
+ asOf?: string;
125
+ }): Promise<Page>;
100
126
  iterPages(opts?: { pageSize?: number; asOf?: string }): AsyncGenerator<any[]>;
101
127
  create(name: string, auditMessage?: string): Promise<any>;
102
- addMaintainer(id: string, userId: string, auditMessage?: string): Promise<any>;
103
- removeMaintainer(id: string, userId: string, auditMessage?: string): Promise<any>;
128
+ addMaintainer(
129
+ id: string,
130
+ userId: string,
131
+ auditMessage?: string,
132
+ ): Promise<any>;
133
+ removeMaintainer(
134
+ id: string,
135
+ userId: string,
136
+ auditMessage?: string,
137
+ ): Promise<any>;
104
138
  }
105
139
 
106
140
  interface RelationsBundle {
107
- setMetadata(relationId: string, body: any, auditMessage?: string): Promise<any>;
141
+ setMetadata(
142
+ relationId: string,
143
+ body: any,
144
+ auditMessage?: string,
145
+ ): Promise<any>;
108
146
  deleteMetadata(relationId: string, auditMessage?: string): Promise<any>;
109
- patchMetadata(relationId: string, body: any, auditMessage?: string): Promise<any>;
110
- setTarget(relationId: string, spanId: string, auditMessage?: string): Promise<any>;
147
+ patchMetadata(
148
+ relationId: string,
149
+ body: any,
150
+ auditMessage?: string,
151
+ ): Promise<any>;
152
+ setTarget(
153
+ relationId: string,
154
+ spanId: string,
155
+ auditMessage?: string,
156
+ ): Promise<any>;
111
157
  get(relationId: string, asOf?: string): Promise<any>;
112
158
  delete(relationId: string, auditMessage?: string): Promise<any>;
113
159
  update(relationId: string, value: any, auditMessage?: string): Promise<any>;
114
- setSource(relationId: string, spanId: string, auditMessage?: string): Promise<any>;
115
- create(layerId: string, sourceId: string, targetId: string, value: any, metadata?: any, auditMessage?: string): Promise<any>;
160
+ setSource(
161
+ relationId: string,
162
+ spanId: string,
163
+ auditMessage?: string,
164
+ ): Promise<any>;
165
+ create(
166
+ layerId: string,
167
+ sourceId: string,
168
+ targetId: string,
169
+ value: any,
170
+ metadata?: any,
171
+ auditMessage?: string,
172
+ ): Promise<any>;
116
173
  bulkCreate(body: any[], auditMessage?: string): Promise<{ ids: string[] }>;
117
174
  bulkDelete(body: any[], auditMessage?: string): Promise<void>;
118
175
  }
119
176
 
120
177
  interface SpanLayersBundle {
121
- setConfig(spanLayerId: string, namespace: string, configKey: string, configValue: any, auditMessage?: string): Promise<any>;
122
- deleteConfig(spanLayerId: string, namespace: string, configKey: string, auditMessage?: string): Promise<any>;
178
+ setConfig(
179
+ spanLayerId: string,
180
+ namespace: string,
181
+ configKey: string,
182
+ configValue: any,
183
+ auditMessage?: string,
184
+ ): Promise<any>;
185
+ deleteConfig(
186
+ spanLayerId: string,
187
+ namespace: string,
188
+ configKey: string,
189
+ auditMessage?: string,
190
+ ): Promise<any>;
123
191
  get(spanLayerId: string, asOf?: string): Promise<any>;
124
192
  delete(spanLayerId: string, auditMessage?: string): Promise<any>;
125
- update(spanLayerId: string, name: string, auditMessage?: string): Promise<any>;
126
- create(tokenLayerId: string, name: string, auditMessage?: string): Promise<any>;
127
- shift(spanLayerId: string, direction: string, auditMessage?: string): Promise<any>;
193
+ update(
194
+ spanLayerId: string,
195
+ name: string,
196
+ auditMessage?: string,
197
+ ): Promise<any>;
198
+ create(
199
+ tokenLayerId: string,
200
+ name: string,
201
+ auditMessage?: string,
202
+ ): Promise<any>;
203
+ shift(
204
+ spanLayerId: string,
205
+ direction: string,
206
+ auditMessage?: string,
207
+ ): Promise<any>;
128
208
  }
129
209
 
130
210
  interface SpansBundle {
131
211
  setTokens(spanId: string, tokens: any[], auditMessage?: string): Promise<any>;
132
- create(spanLayerId: string, tokens: any[], value: any, metadata?: any, auditMessage?: string): Promise<any>;
212
+ create(
213
+ spanLayerId: string,
214
+ tokens: any[],
215
+ value: any,
216
+ metadata?: any,
217
+ auditMessage?: string,
218
+ ): Promise<any>;
133
219
  get(spanId: string, asOf?: string): Promise<any>;
134
220
  delete(spanId: string, auditMessage?: string): Promise<any>;
135
221
  update(spanId: string, value: any, auditMessage?: string): Promise<any>;
@@ -148,7 +234,13 @@ interface TextsBundle {
148
234
  setMetadata(textId: string, body: any, auditMessage?: string): Promise<any>;
149
235
  deleteMetadata(textId: string, auditMessage?: string): Promise<any>;
150
236
  patchMetadata(textId: string, body: any, auditMessage?: string): Promise<any>;
151
- create(textLayerId: string, documentId: string, body: string, metadata?: any, auditMessage?: string): Promise<any>;
237
+ create(
238
+ textLayerId: string,
239
+ documentId: string,
240
+ body: string,
241
+ metadata?: any,
242
+ auditMessage?: string,
243
+ ): Promise<any>;
152
244
  get(textId: string, asOf?: string): Promise<any>;
153
245
  delete(textId: string, auditMessage?: string): Promise<any>;
154
246
  update(textId: string, body: any, auditMessage?: string): Promise<any>;
@@ -156,14 +248,35 @@ interface TextsBundle {
156
248
 
157
249
  interface UsersBundle {
158
250
  list(asOf?: string): Promise<any[]>;
159
- listPage(opts?: { limit?: number; cursor?: string; asOf?: string }): Promise<Page>;
251
+ listPage(opts?: {
252
+ limit?: number;
253
+ cursor?: string;
254
+ asOf?: string;
255
+ }): Promise<Page>;
160
256
  iterPages(opts?: { pageSize?: number; asOf?: string }): AsyncGenerator<any[]>;
161
- create(username: string, password: string, isAdmin: boolean, auditMessage?: string): Promise<any>;
162
- audit(userId: string, startTime?: string, endTime?: string, asOf?: string): Promise<any[]>;
257
+ create(
258
+ email: string,
259
+ password: string,
260
+ isAdmin: boolean,
261
+ displayName?: string,
262
+ auditMessage?: string,
263
+ ): Promise<any>;
264
+ audit(
265
+ userId: string,
266
+ startTime?: string,
267
+ endTime?: string,
268
+ asOf?: string,
269
+ ): Promise<any[]>;
163
270
  get(id: string, asOf?: string): Promise<any>;
164
271
  delete(id: string, auditMessage?: string): Promise<any>;
165
272
  activate(id: string, auditMessage?: string): Promise<any>;
166
- update(id: string, password?: string, username?: string, isAdmin?: boolean, auditMessage?: string): Promise<any>;
273
+ update(
274
+ id: string,
275
+ password?: string,
276
+ displayName?: string,
277
+ isAdmin?: boolean,
278
+ auditMessage?: string,
279
+ ): Promise<any>;
167
280
  /** URL for a user's profile picture, usable as an <img> src. Null when avatarHash is explicitly null. */
168
281
  avatarUrl(id: string, avatarHash?: string | null): string | null;
169
282
  getAvatar(id: string): Promise<any>;
@@ -171,11 +284,42 @@ interface UsersBundle {
171
284
  deleteAvatar(id: string, auditMessage?: string): Promise<any>;
172
285
  }
173
286
 
287
+ interface UserDataEntry {
288
+ key: string;
289
+ updatedAt: string;
290
+ value?: any;
291
+ }
292
+
293
+ /** Private per-user key/value storage (owner or admin only; not audited). */
294
+ interface UserDataBundle {
295
+ list(
296
+ userId: string,
297
+ opts?: { prefix?: string; includeValues?: boolean },
298
+ ): Promise<UserDataEntry[]>;
299
+ get(userId: string, key: string): Promise<UserDataEntry & { value: any }>;
300
+ put(
301
+ userId: string,
302
+ key: string,
303
+ value: any,
304
+ ): Promise<{ key: string; updatedAt: string }>;
305
+ delete(userId: string, key: string): Promise<any>;
306
+ }
307
+
174
308
  interface ApiTokensBundle {
175
309
  list(userId: string): Promise<any[]>;
176
- listPage(userId: string, opts?: { limit?: number; cursor?: string }): Promise<Page>;
177
- iterPages(userId: string, opts?: { pageSize?: number }): AsyncGenerator<any[]>;
178
- create(userId: string, name: string, auditMessage?: string): Promise<{ id: string; name: string; token: string }>;
310
+ listPage(
311
+ userId: string,
312
+ opts?: { limit?: number; cursor?: string },
313
+ ): Promise<Page>;
314
+ iterPages(
315
+ userId: string,
316
+ opts?: { pageSize?: number },
317
+ ): AsyncGenerator<any[]>;
318
+ create(
319
+ userId: string,
320
+ name: string,
321
+ auditMessage?: string,
322
+ ): Promise<{ id: string; name: string; token: string }>;
179
323
  revoke(userId: string, tokenId: string, auditMessage?: string): Promise<any>;
180
324
  }
181
325
 
@@ -207,8 +351,8 @@ interface InvitePreview {
207
351
  grantAdmin: boolean;
208
352
  projectName?: string;
209
353
  projectRole?: string;
210
- /** Present only for a password reset: whose account the link belongs to. */
211
- username?: string;
354
+ /** Present only for a password reset: the email of the account it belongs to. */
355
+ email?: string;
212
356
  }
213
357
 
214
358
  interface CreateInviteOptions {
@@ -225,21 +369,56 @@ interface CreateInviteOptions {
225
369
 
226
370
  interface InvitesBundle {
227
371
  list(opts?: { projectId?: string }): Promise<Invite[]>;
228
- listPage(opts?: { projectId?: string; limit?: number; cursor?: string }): Promise<Page>;
229
- iterPages(opts?: { projectId?: string; pageSize?: number }): AsyncGenerator<Invite[]>;
372
+ listPage(opts?: {
373
+ projectId?: string;
374
+ limit?: number;
375
+ cursor?: string;
376
+ }): Promise<Page>;
377
+ iterPages(opts?: {
378
+ projectId?: string;
379
+ pageSize?: number;
380
+ }): AsyncGenerator<Invite[]>;
230
381
  /** The `code` is returned ONCE and is not recoverable afterward. */
231
- create(opts?: CreateInviteOptions, auditMessage?: string): Promise<Invite & { code: string }>;
382
+ create(
383
+ opts?: CreateInviteOptions,
384
+ auditMessage?: string,
385
+ ): Promise<Invite & { code: string }>;
232
386
  revoke(id: string, auditMessage?: string): Promise<any>;
233
387
  }
234
388
 
235
389
  interface TokenLayersBundle {
236
- shift(tokenLayerId: string, direction: string, auditMessage?: string): Promise<any>;
237
- create(textLayerId: string, name: string, overlapMode?: string, parentTokenLayerId?: string, auditMessage?: string): Promise<any>;
238
- setConfig(tokenLayerId: string, namespace: string, configKey: string, configValue: any, auditMessage?: string): Promise<any>;
239
- deleteConfig(tokenLayerId: string, namespace: string, configKey: string, auditMessage?: string): Promise<any>;
390
+ shift(
391
+ tokenLayerId: string,
392
+ direction: string,
393
+ auditMessage?: string,
394
+ ): Promise<any>;
395
+ create(
396
+ textLayerId: string,
397
+ name: string,
398
+ overlapMode?: string,
399
+ parentTokenLayerId?: string,
400
+ auditMessage?: string,
401
+ ): Promise<any>;
402
+ setConfig(
403
+ tokenLayerId: string,
404
+ namespace: string,
405
+ configKey: string,
406
+ configValue: any,
407
+ auditMessage?: string,
408
+ ): Promise<any>;
409
+ deleteConfig(
410
+ tokenLayerId: string,
411
+ namespace: string,
412
+ configKey: string,
413
+ auditMessage?: string,
414
+ ): Promise<any>;
240
415
  get(tokenLayerId: string, asOf?: string): Promise<any>;
241
416
  delete(tokenLayerId: string, auditMessage?: string): Promise<any>;
242
- update(tokenLayerId: string, name: string, auditMessage?: string): Promise<any>;
417
+ update(
418
+ tokenLayerId: string,
419
+ name: string,
420
+ auditMessage?: string,
421
+ ): Promise<any>;
243
422
  }
244
423
 
245
424
  interface DocumentsBundle {
@@ -247,28 +426,79 @@ interface DocumentsBundle {
247
426
  acquireLock(documentId: string, auditMessage?: string): Promise<any>;
248
427
  releaseLock(documentId: string, auditMessage?: string): Promise<any>;
249
428
  getMedia(documentId: string, asOf?: string): Promise<ArrayBuffer>;
250
- uploadMedia(documentId: string, file: File, auditMessage?: string): Promise<any>;
429
+ uploadMedia(
430
+ documentId: string,
431
+ file: File,
432
+ auditMessage?: string,
433
+ ): Promise<any>;
251
434
  deleteMedia(documentId: string, auditMessage?: string): Promise<any>;
252
- setMetadata(documentId: string, body: any, auditMessage?: string): Promise<any>;
435
+ setMetadata(
436
+ documentId: string,
437
+ body: any,
438
+ auditMessage?: string,
439
+ ): Promise<any>;
253
440
  deleteMetadata(documentId: string, auditMessage?: string): Promise<any>;
254
- patchMetadata(documentId: string, body: any, auditMessage?: string): Promise<any>;
255
- audit(documentId: string, startTime?: string, endTime?: string, asOf?: string): Promise<any[]>;
441
+ patchMetadata(
442
+ documentId: string,
443
+ body: any,
444
+ auditMessage?: string,
445
+ ): Promise<any>;
446
+ audit(
447
+ documentId: string,
448
+ startTime?: string,
449
+ endTime?: string,
450
+ asOf?: string,
451
+ ): Promise<any[]>;
256
452
  get(documentId: string, includeBody?: boolean, asOf?: string): Promise<any>;
257
453
  delete(documentId: string, auditMessage?: string): Promise<any>;
258
454
  update(documentId: string, name: string, auditMessage?: string): Promise<any>;
259
- create(projectId: string, name: string, metadata?: any, auditMessage?: string): Promise<any>;
455
+ create(
456
+ projectId: string,
457
+ name: string,
458
+ metadata?: any,
459
+ auditMessage?: string,
460
+ ): Promise<any>;
260
461
  }
261
462
 
262
463
  interface MessagesBundle {
263
- sendMessage(projectId: string, data: any, auditMessage?: string): Promise<any>;
264
- listen(projectId: string, onEvent: (eventType: string, data: any) => void | boolean, path?: string): SSEConnection;
464
+ sendMessage(
465
+ projectId: string,
466
+ data: any,
467
+ auditMessage?: string,
468
+ ): Promise<any>;
469
+ listen(
470
+ projectId: string,
471
+ onEvent: (eventType: string, data: any) => void | boolean,
472
+ path?: string,
473
+ ): SSEConnection;
265
474
  /** Discover the services seen on a project: online ones plus previously-seen offline ones (check `online`). */
266
475
  discoverServices(projectId: string): Promise<DiscoveredService[]>;
267
476
  /** Forget a previously-seen (offline) service. Maintainer-only; 409 if currently connected. */
268
477
  discardService(projectId: string, serviceId: string): Promise<void>;
269
- serve(projectId: string, serviceInfo: ServiceInfo, onServiceRequest: (data: any, responseHelper: ResponseHelper) => void, extras?: any): ServiceRegistration;
270
- /** Submit work to a service; streams progress to `onProgress`, resolves with the result. */
271
- requestService(projectId: string, serviceId: string, data: any, timeout?: number, onProgress?: (progress: any) => void): Promise<any>;
478
+ /**
479
+ * Register as a service and handle work requests. The registration reopens
480
+ * its channel whenever it drops, so a server restart needs no service restart.
481
+ */
482
+ serve(
483
+ projectId: string,
484
+ serviceInfo: ServiceInfo,
485
+ onServiceRequest: (data: any, responseHelper: ResponseHelper) => void,
486
+ extras?: any,
487
+ onStatus?: (event: ServiceStatusEvent, projectId: string, detail?: string) => void,
488
+ ): ServiceRegistration;
489
+ /**
490
+ * Submit work to a service; streams progress to `onProgress`, resolves with
491
+ * the result. Aborting `signal` stops waiting and rejects with an AbortError;
492
+ * the service is not told and finishes its work regardless.
493
+ */
494
+ requestService(
495
+ projectId: string,
496
+ serviceId: string,
497
+ data: any,
498
+ timeout?: number,
499
+ onProgress?: (progress: any) => void,
500
+ signal?: AbortSignal,
501
+ ): Promise<any>;
272
502
  }
273
503
 
274
504
  interface ProjectsBundle {
@@ -276,32 +506,85 @@ interface ProjectsBundle {
276
506
  removeWriter(id: string, userId: string, auditMessage?: string): Promise<any>;
277
507
  addReader(id: string, userId: string, auditMessage?: string): Promise<any>;
278
508
  removeReader(id: string, userId: string, auditMessage?: string): Promise<any>;
279
- setConfig(id: string, namespace: string, configKey: string, configValue: any, auditMessage?: string): Promise<any>;
280
- deleteConfig(id: string, namespace: string, configKey: string, auditMessage?: string): Promise<any>;
281
- addMaintainer(id: string, userId: string, auditMessage?: string): Promise<any>;
282
- removeMaintainer(id: string, userId: string, auditMessage?: string): Promise<any>;
283
- audit(projectId: string, startTime?: string, endTime?: string, asOf?: string): Promise<any[]>;
509
+ setConfig(
510
+ id: string,
511
+ namespace: string,
512
+ configKey: string,
513
+ configValue: any,
514
+ auditMessage?: string,
515
+ ): Promise<any>;
516
+ deleteConfig(
517
+ id: string,
518
+ namespace: string,
519
+ configKey: string,
520
+ auditMessage?: string,
521
+ ): Promise<any>;
522
+ addMaintainer(
523
+ id: string,
524
+ userId: string,
525
+ auditMessage?: string,
526
+ ): Promise<any>;
527
+ removeMaintainer(
528
+ id: string,
529
+ userId: string,
530
+ auditMessage?: string,
531
+ ): Promise<any>;
532
+ audit(
533
+ projectId: string,
534
+ startTime?: string,
535
+ endTime?: string,
536
+ asOf?: string,
537
+ ): Promise<any[]>;
284
538
  linkVocab(id: string, vocabId: string, auditMessage?: string): Promise<any>;
285
539
  unlinkVocab(id: string, vocabId: string, auditMessage?: string): Promise<any>;
286
540
  get(id: string, asOf?: string): Promise<any>;
287
541
  listDocuments(id: string): Promise<any[]>;
288
- listDocumentsPage(id: string, opts?: { limit?: number; cursor?: string }): Promise<Page>;
289
- iterDocuments(id: string, opts?: { pageSize?: number }): AsyncGenerator<any[]>;
542
+ listDocumentsPage(
543
+ id: string,
544
+ opts?: { limit?: number; cursor?: string },
545
+ ): Promise<Page>;
546
+ iterDocuments(
547
+ id: string,
548
+ opts?: { pageSize?: number },
549
+ ): AsyncGenerator<any[]>;
290
550
  delete(id: string, auditMessage?: string): Promise<any>;
291
551
  update(id: string, name: string, auditMessage?: string): Promise<any>;
292
552
  list(asOf?: string): Promise<any[]>;
293
- listPage(opts?: { limit?: number; cursor?: string; asOf?: string }): Promise<Page>;
553
+ listPage(opts?: {
554
+ limit?: number;
555
+ cursor?: string;
556
+ asOf?: string;
557
+ }): Promise<Page>;
294
558
  iterPages(opts?: { pageSize?: number; asOf?: string }): AsyncGenerator<any[]>;
295
559
  create(name: string, auditMessage?: string): Promise<any>;
296
560
  }
297
561
 
298
562
  interface TextLayersBundle {
299
- setConfig(textLayerId: string, namespace: string, configKey: string, configValue: any, auditMessage?: string): Promise<any>;
300
- deleteConfig(textLayerId: string, namespace: string, configKey: string, auditMessage?: string): Promise<any>;
563
+ setConfig(
564
+ textLayerId: string,
565
+ namespace: string,
566
+ configKey: string,
567
+ configValue: any,
568
+ auditMessage?: string,
569
+ ): Promise<any>;
570
+ deleteConfig(
571
+ textLayerId: string,
572
+ namespace: string,
573
+ configKey: string,
574
+ auditMessage?: string,
575
+ ): Promise<any>;
301
576
  get(textLayerId: string, asOf?: string): Promise<any>;
302
577
  delete(textLayerId: string, auditMessage?: string): Promise<any>;
303
- update(textLayerId: string, name: string, auditMessage?: string): Promise<any>;
304
- shift(textLayerId: string, direction: string, auditMessage?: string): Promise<any>;
578
+ update(
579
+ textLayerId: string,
580
+ name: string,
581
+ auditMessage?: string,
582
+ ): Promise<any>;
583
+ shift(
584
+ textLayerId: string,
585
+ direction: string,
586
+ auditMessage?: string,
587
+ ): Promise<any>;
305
588
  create(projectId: string, name: string, auditMessage?: string): Promise<any>;
306
589
  }
307
590
 
@@ -309,7 +592,12 @@ interface VocabItemsBundle {
309
592
  setMetadata(id: string, body: any, auditMessage?: string): Promise<any>;
310
593
  deleteMetadata(id: string, auditMessage?: string): Promise<any>;
311
594
  patchMetadata(id: string, body: any, auditMessage?: string): Promise<any>;
312
- create(vocabLayerId: string, form: string, metadata?: any, auditMessage?: string): Promise<any>;
595
+ create(
596
+ vocabLayerId: string,
597
+ form: string,
598
+ metadata?: any,
599
+ auditMessage?: string,
600
+ ): Promise<any>;
313
601
  bulkCreate(body: any[], auditMessage?: string): Promise<{ ids: string[] }>;
314
602
  bulkDelete(body: any[], auditMessage?: string): Promise<void>;
315
603
  get(id: string, asOf?: string): Promise<any>;
@@ -318,33 +606,90 @@ interface VocabItemsBundle {
318
606
  }
319
607
 
320
608
  interface RelationLayersBundle {
321
- shift(relationLayerId: string, direction: string, auditMessage?: string): Promise<any>;
322
- create(spanLayerId: string, name: string, auditMessage?: string): Promise<any>;
323
- setConfig(relationLayerId: string, namespace: string, configKey: string, configValue: any, auditMessage?: string): Promise<any>;
324
- deleteConfig(relationLayerId: string, namespace: string, configKey: string, auditMessage?: string): Promise<any>;
609
+ shift(
610
+ relationLayerId: string,
611
+ direction: string,
612
+ auditMessage?: string,
613
+ ): Promise<any>;
614
+ create(
615
+ spanLayerId: string,
616
+ name: string,
617
+ auditMessage?: string,
618
+ ): Promise<any>;
619
+ setConfig(
620
+ relationLayerId: string,
621
+ namespace: string,
622
+ configKey: string,
623
+ configValue: any,
624
+ auditMessage?: string,
625
+ ): Promise<any>;
626
+ deleteConfig(
627
+ relationLayerId: string,
628
+ namespace: string,
629
+ configKey: string,
630
+ auditMessage?: string,
631
+ ): Promise<any>;
325
632
  get(relationLayerId: string, asOf?: string): Promise<any>;
326
633
  delete(relationLayerId: string, auditMessage?: string): Promise<any>;
327
- update(relationLayerId: string, name: string, auditMessage?: string): Promise<any>;
634
+ update(
635
+ relationLayerId: string,
636
+ name: string,
637
+ auditMessage?: string,
638
+ ): Promise<any>;
328
639
  }
329
640
 
330
641
  interface TokensBundle {
331
- create(tokenLayerId: string, text: string, begin: number, end: number, precedence?: number | null, metadata?: any, auditMessage?: string): Promise<any>;
642
+ create(
643
+ tokenLayerId: string,
644
+ text: string,
645
+ begin: number,
646
+ end: number,
647
+ precedence?: number | null,
648
+ metadata?: any,
649
+ auditMessage?: string,
650
+ ): Promise<any>;
332
651
  get(tokenId: string, asOf?: string): Promise<any>;
333
652
  delete(tokenId: string, auditMessage?: string): Promise<any>;
334
- update(tokenId: string, begin?: number, end?: number, precedence?: number | null, auditMessage?: string): Promise<any>;
653
+ update(
654
+ tokenId: string,
655
+ begin?: number,
656
+ end?: number,
657
+ precedence?: number | null,
658
+ auditMessage?: string,
659
+ ): Promise<any>;
335
660
  bulkCreate(body: any[], auditMessage?: string): Promise<{ ids: string[] }>;
336
661
  bulkDelete(body: any[], auditMessage?: string): Promise<void>;
337
662
  split(tokenId: string, position: number, auditMessage?: string): Promise<any>;
338
- merge(tokenId: string, otherTokenId: string, auditMessage?: string): Promise<any>;
339
- shift(tokenId: string, begin?: number, end?: number, auditMessage?: string): Promise<any>;
663
+ merge(
664
+ tokenId: string,
665
+ otherTokenId: string,
666
+ auditMessage?: string,
667
+ ): Promise<any>;
668
+ shift(
669
+ tokenId: string,
670
+ begin?: number,
671
+ end?: number,
672
+ auditMessage?: string,
673
+ ): Promise<any>;
340
674
  setMetadata(tokenId: string, body: any, auditMessage?: string): Promise<any>;
341
675
  deleteMetadata(tokenId: string, auditMessage?: string): Promise<any>;
342
- patchMetadata(tokenId: string, body: any, auditMessage?: string): Promise<any>;
676
+ patchMetadata(
677
+ tokenId: string,
678
+ body: any,
679
+ auditMessage?: string,
680
+ ): Promise<any>;
343
681
  }
344
682
 
345
683
  interface PlaidClientOptions {
346
684
  /** Per-request timeout in ms (default 30000; 0 or null disables it). */
347
685
  timeout?: number | null;
686
+ /**
687
+ * Timeout for batch submissions in ms (default 180000; 0 or null disables it).
688
+ * Batches get their own, longer budget: aborting one does NOT stop the
689
+ * server, which keeps running the transaction and holding the single SQLite
690
+ * write lock. Defaults to `timeout` when that is given and this is not.
691
+ */
692
+ batchTimeout?: number | null;
348
693
  /**
349
694
  * Fired once when a request returns HTTP 401 (missing/expired/invalid token).
350
695
  * Use it to discard the stored token and route back to login. 403 (forbidden)
@@ -360,19 +705,29 @@ export interface OperationGroupsBundle {
360
705
 
361
706
  export declare class PlaidClient {
362
707
  constructor(baseUrl: string, token: string, options?: PlaidClientOptions);
363
- static login(baseUrl: string, userId: string, password: string, options?: PlaidClientOptions): Promise<PlaidClient>;
708
+ static login(
709
+ baseUrl: string,
710
+ userId: string,
711
+ password: string,
712
+ options?: PlaidClientOptions,
713
+ ): Promise<PlaidClient>;
364
714
  /** Build the link to hand someone for an invite code. */
365
715
  static inviteUrl(appUrl: string, code: string): string;
366
716
  /** Describe an invite code with no authentication (for a signup page). */
367
- static lookupInvite(baseUrl: string, code: string, options?: PlaidClientOptions): Promise<InvitePreview>;
717
+ static lookupInvite(
718
+ baseUrl: string,
719
+ code: string,
720
+ options?: PlaidClientOptions,
721
+ ): Promise<InvitePreview>;
368
722
  /** Redeem an invite code with no authentication; resolves to a logged-in client. */
369
723
  static redeemInvite(
370
724
  baseUrl: string,
371
725
  code: string,
372
- credentials: { username?: string; password: string },
726
+ credentials: { email?: string; password: string; displayName?: string },
373
727
  options?: PlaidClientOptions,
374
728
  ): Promise<{ client: PlaidClient; userId: string; kind: string }>;
375
729
  timeout: number | null;
730
+ batchTimeout: number | null;
376
731
  /** Fired once on HTTP 401 (see PlaidClientOptions.onAuthError). */
377
732
  onAuthError: ((error: Error) => void) | null;
378
733
 
@@ -394,7 +749,10 @@ export declare class PlaidClient {
394
749
  operationGroup: { id: string; message: string | null } | null;
395
750
  beginOperation(message: string, opts?: { id?: string }): string;
396
751
  endOperation(message?: string): Promise<void>;
397
- withOperation<T>(message: string, fn: (setMessage: (msg: string) => void) => Promise<T> | T): Promise<T>;
752
+ withOperation<T>(
753
+ message: string,
754
+ fn: (setMessage: (msg: string) => void) => Promise<T> | T,
755
+ ): Promise<T>;
398
756
  operationGroups: OperationGroupsBundle;
399
757
 
400
758
  // Query
@@ -409,6 +767,7 @@ export declare class PlaidClient {
409
767
  texts: TextsBundle;
410
768
  users: UsersBundle;
411
769
  apiTokens: ApiTokensBundle;
770
+ userData: UserDataBundle;
412
771
  invites: InvitesBundle;
413
772
  tokenLayers: TokenLayersBundle;
414
773
  documents: DocumentsBundle;
@@ -441,22 +800,25 @@ export function cpIndexOf(s: string, sub: string, fromCp?: number): number;
441
800
  // Substrate layers are tagged with a role at `config.plaid.role` (a scalar) so
442
801
  // that different apps can share a project. See the manual, "Layer Interoperability".
443
802
  /** The reserved config namespace for cross-app conventions. */
444
- export const PLAID_NAMESPACE: 'plaid';
803
+ export const PLAID_NAMESPACE: "plaid";
445
804
  /** The config key, under `plaid`, holding a layer's role. */
446
- export const ROLE_KEY: 'role';
805
+ export const ROLE_KEY: "role";
447
806
  /** The fixed role inventory; only these values are interoperable across apps. */
448
807
  export const ROLES: {
449
- readonly BASELINE: 'baseline';
450
- readonly SENTENCE: 'sentence';
451
- readonly WORD: 'word';
452
- readonly SYNTACTIC_WORD: 'syntactic-word';
453
- readonly MORPHEME: 'morpheme';
454
- readonly TIME_ALIGNMENT: 'time-alignment';
808
+ readonly BASELINE: "baseline";
809
+ readonly SENTENCE: "sentence";
810
+ readonly WORD: "word";
811
+ readonly SYNTACTIC_WORD: "syntactic-word";
812
+ readonly MORPHEME: "morpheme";
813
+ readonly TIME_ALIGNMENT: "time-alignment";
455
814
  };
456
815
  /** The role recorded on a layer's `config`, or null if none. */
457
816
  export function readRole(config?: object): string | null;
458
817
  /** The first layer in `layers` carrying the given role, or null. */
459
- export function findByRole<T extends { config?: object }>(layers: T[] | undefined, role: string): T | null;
818
+ export function findByRole<T extends { config?: object }>(
819
+ layers: T[] | undefined,
820
+ role: string,
821
+ ): T | null;
460
822
 
461
823
  // --- Service self-description helpers ----------------------------------------
462
824
  // Standardize how a service advertises (in `extras`) the tasks it serves, a
@@ -465,16 +827,19 @@ export function findByRole<T extends { config?: object }>(layers: T[] | undefine
465
827
  // "Describing a service".
466
828
  /** The controlled task vocabulary — the fixed integration-point goals. */
467
829
  export const TASKS: {
468
- readonly TOKENIZE: 'tokenize';
469
- readonly PARSE: 'parse';
470
- readonly TRANSCRIBE: 'transcribe';
471
- readonly LINK_VOCAB: 'link-vocab';
472
- readonly ANALYZE: 'analyze';
830
+ readonly TOKENIZE: "tokenize";
831
+ readonly PARSE: "parse";
832
+ readonly TRANSCRIBE: "transcribe";
833
+ readonly LINK_VOCAB: "link-vocab";
834
+ readonly ANALYZE: "analyze";
473
835
  };
474
836
  /** Whether a service serves a task (declared `extras.tasks`, legacy id-prefix fallback). */
475
837
  export function servesTask(service: DiscoveredService, task: string): boolean;
476
838
  /** The discovered services that serve `task`. */
477
- export function filterServicesByTask(services: DiscoveredService[] | undefined, task: string): DiscoveredService[];
839
+ export function filterServicesByTask(
840
+ services: DiscoveredService[] | undefined,
841
+ task: string,
842
+ ): DiscoveredService[];
478
843
  /** The parameter schema a service declares (ordered), or []. */
479
844
  export function getParamSchema(service: DiscoveredService): ServiceParam[];
480
845
  /** A service's human summary: `extras.summary`, else `description`, else ''. */
@@ -482,7 +847,10 @@ export function getServiceSummary(service: DiscoveredService): string;
482
847
  /** Default form values keyed by param key. */
483
848
  export function buildDefaultValues(schema: ServiceParam[]): Record<string, any>;
484
849
  /** Coerce/validate raw form values against the schema. */
485
- export function coerceParamValues(schema: ServiceParam[], raw: Record<string, any>): { values: Record<string, any>; errors: Record<string, string> };
850
+ export function coerceParamValues(
851
+ schema: ServiceParam[],
852
+ raw: Record<string, any>,
853
+ ): { values: Record<string, any>; errors: Record<string, string> };
486
854
 
487
855
  // --- Provenance ---------------------------------------------------------------
488
856
  // Cross-app convention for machine-provided vs human-labeled information,
@@ -492,32 +860,50 @@ export function coerceParamValues(schema: ServiceParam[], raw: Record<string, an
492
860
  // replace unverified machine material but must never touch human/verified
493
861
  // material without an explicit overwrite opt-in; any human edit verifies.
494
862
  // See the manual, "Provenance".
495
- type ProvState = 'human' | 'machine' | 'verified';
863
+ type ProvState = "human" | "machine" | "verified";
496
864
  export const PROV: {
497
- readonly key: 'prov';
498
- readonly sourceKey: 'provSource';
499
- readonly confirmedKey: 'provConfirmed';
500
- readonly probKey: 'provProb';
501
- readonly detailKey: 'provDetail';
502
- readonly INFERRED: 'inferred';
865
+ readonly key: "prov";
866
+ readonly sourceKey: "provSource";
867
+ readonly confirmedKey: "provConfirmed";
868
+ readonly probKey: "provProb";
869
+ readonly detailKey: "provDetail";
870
+ readonly INFERRED: "inferred";
503
871
  };
504
872
  export const PROV_STATES: {
505
- readonly HUMAN: 'human';
506
- readonly MACHINE: 'machine';
507
- readonly VERIFIED: 'verified';
873
+ readonly HUMAN: "human";
874
+ readonly MACHINE: "machine";
875
+ readonly VERIFIED: "verified";
508
876
  };
509
877
  /** Optional prediction extras: prob = a probability in [0,1] for the chosen value
510
878
  * (flat + queryable; omit unless it honestly is one); detail = an open map of
511
879
  * producer extras (top-k alternatives, model version, raw scores; keep it small).
512
880
  * Both describe the ORIGINAL prediction — check provConfirmed before presenting
513
881
  * provProb as confidence in the current value. */
514
- interface ProvExtras { prob?: number; detail?: Record<string, any> }
882
+ interface ProvExtras {
883
+ prob?: number;
884
+ detail?: Record<string, any>;
885
+ }
515
886
  /** The metadata fragment a machine writer merges into everything it creates. */
516
- export function stampInferred(source: string, extras?: ProvExtras):
517
- { prov: 'inferred'; provSource: string; provProb?: number; provDetail?: Record<string, any> };
887
+ export function stampInferred(
888
+ source: string,
889
+ extras?: ProvExtras,
890
+ ): {
891
+ prov: "inferred";
892
+ provSource: string;
893
+ provProb?: number;
894
+ provDetail?: Record<string, any>;
895
+ };
518
896
  /** stampInferred + provConfirmed — for machine material born verified (e.g. imports with upstream approval). */
519
- export function confirmedInferred(source: string, extras?: ProvExtras):
520
- { prov: 'inferred'; provSource: string; provConfirmed: true; provProb?: number; provDetail?: Record<string, any> };
897
+ export function confirmedInferred(
898
+ source: string,
899
+ extras?: ProvExtras,
900
+ ): {
901
+ prov: "inferred";
902
+ provSource: string;
903
+ provConfirmed: true;
904
+ provProb?: number;
905
+ provDetail?: Record<string, any>;
906
+ };
521
907
  /** Classify an entity's metadata into one of the three provenance states. */
522
908
  export function provState(metadata: object | null | undefined): ProvState;
523
909
  /** The verifying fragment, { provConfirmed: true }: PATCH it over existing metadata. */
@@ -527,6 +913,8 @@ export function isMachine(metadata: object | null | undefined): boolean;
527
913
  /** Whether a machine writer must leave this entity alone (human or verified). !isMachine. */
528
914
  export function isProtected(metadata: object | null | undefined): boolean;
529
915
  /** The fragment a HUMAN edit should merge in: PROV_CONFIRMED iff machine-unverified, else null. */
530
- export function verifyOnEdit(metadata: object | null | undefined): { readonly provConfirmed: true } | null;
916
+ export function verifyOnEdit(
917
+ metadata: object | null | undefined,
918
+ ): { readonly provConfirmed: true } | null;
531
919
  /** Canonical provSource for a service: 'service:<serviceId>'. */
532
920
  export function serviceSource(serviceId: string): string;