@larc-iu/plaid-client 0.2.0-alpha.3 → 0.2.0-alpha.5
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 +542 -105
- package/package.json +1 -1
- package/src/http.js +70 -5
- package/src/index.js +920 -341
- package/src/provenance.js +11 -0
- package/src/serviceSchema.js +49 -31
- package/src/services.js +60 -8
- package/src/sse.js +31 -0
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:
|
|
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(
|
|
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(
|
|
97
|
-
|
|
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?: {
|
|
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(
|
|
103
|
-
|
|
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(
|
|
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(
|
|
110
|
-
|
|
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(
|
|
115
|
-
|
|
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(
|
|
122
|
-
|
|
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(
|
|
126
|
-
|
|
127
|
-
|
|
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(
|
|
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(
|
|
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?: {
|
|
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(
|
|
162
|
-
|
|
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(
|
|
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,90 @@ 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
|
+
|
|
308
|
+
interface CommentFilters {
|
|
309
|
+
documentId?: string;
|
|
310
|
+
entityType?: CommentableType;
|
|
311
|
+
entityId?: string;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/** Entities that can carry a comment. */
|
|
315
|
+
type CommentableType = "document" | "text" | "token" | "span" | "relation";
|
|
316
|
+
|
|
317
|
+
interface Comment {
|
|
318
|
+
id: string;
|
|
319
|
+
projectId: string;
|
|
320
|
+
documentId: string;
|
|
321
|
+
entityType: CommentableType;
|
|
322
|
+
entityId: string;
|
|
323
|
+
authorId: string;
|
|
324
|
+
body: string;
|
|
325
|
+
createdAt: string;
|
|
326
|
+
updatedAt: string;
|
|
327
|
+
/** True once the body has been rewritten since it was posted. */
|
|
328
|
+
edited: boolean;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
interface CommentsBundle {
|
|
332
|
+
create(
|
|
333
|
+
entityType: CommentableType,
|
|
334
|
+
entityId: string,
|
|
335
|
+
body: string,
|
|
336
|
+
): Promise<Comment>;
|
|
337
|
+
get(id: string): Promise<Comment>;
|
|
338
|
+
update(id: string, body: string): Promise<Comment>;
|
|
339
|
+
delete(id: string): Promise<any>;
|
|
340
|
+
list(projectId: string, filters?: CommentFilters): Promise<Comment[]>;
|
|
341
|
+
listPage(
|
|
342
|
+
projectId: string,
|
|
343
|
+
opts?: CommentFilters & { limit?: number; cursor?: string },
|
|
344
|
+
): Promise<Page<Comment>>;
|
|
345
|
+
iterPages(
|
|
346
|
+
projectId: string,
|
|
347
|
+
opts?: CommentFilters & { pageSize?: number },
|
|
348
|
+
): AsyncGenerator<Comment[]>;
|
|
349
|
+
/** `{entityId: count}`; keys are raw entity ids, never key-transformed. */
|
|
350
|
+
counts(
|
|
351
|
+
projectId: string,
|
|
352
|
+
filters?: CommentFilters,
|
|
353
|
+
): Promise<Record<string, number>>;
|
|
354
|
+
}
|
|
355
|
+
|
|
174
356
|
interface ApiTokensBundle {
|
|
175
357
|
list(userId: string): Promise<any[]>;
|
|
176
|
-
listPage(
|
|
177
|
-
|
|
178
|
-
|
|
358
|
+
listPage(
|
|
359
|
+
userId: string,
|
|
360
|
+
opts?: { limit?: number; cursor?: string },
|
|
361
|
+
): Promise<Page>;
|
|
362
|
+
iterPages(
|
|
363
|
+
userId: string,
|
|
364
|
+
opts?: { pageSize?: number },
|
|
365
|
+
): AsyncGenerator<any[]>;
|
|
366
|
+
create(
|
|
367
|
+
userId: string,
|
|
368
|
+
name: string,
|
|
369
|
+
auditMessage?: string,
|
|
370
|
+
): Promise<{ id: string; name: string; token: string }>;
|
|
179
371
|
revoke(userId: string, tokenId: string, auditMessage?: string): Promise<any>;
|
|
180
372
|
}
|
|
181
373
|
|
|
@@ -207,8 +399,8 @@ interface InvitePreview {
|
|
|
207
399
|
grantAdmin: boolean;
|
|
208
400
|
projectName?: string;
|
|
209
401
|
projectRole?: string;
|
|
210
|
-
/** Present only for a password reset:
|
|
211
|
-
|
|
402
|
+
/** Present only for a password reset: the email of the account it belongs to. */
|
|
403
|
+
email?: string;
|
|
212
404
|
}
|
|
213
405
|
|
|
214
406
|
interface CreateInviteOptions {
|
|
@@ -225,21 +417,56 @@ interface CreateInviteOptions {
|
|
|
225
417
|
|
|
226
418
|
interface InvitesBundle {
|
|
227
419
|
list(opts?: { projectId?: string }): Promise<Invite[]>;
|
|
228
|
-
listPage(opts?: {
|
|
229
|
-
|
|
420
|
+
listPage(opts?: {
|
|
421
|
+
projectId?: string;
|
|
422
|
+
limit?: number;
|
|
423
|
+
cursor?: string;
|
|
424
|
+
}): Promise<Page>;
|
|
425
|
+
iterPages(opts?: {
|
|
426
|
+
projectId?: string;
|
|
427
|
+
pageSize?: number;
|
|
428
|
+
}): AsyncGenerator<Invite[]>;
|
|
230
429
|
/** The `code` is returned ONCE and is not recoverable afterward. */
|
|
231
|
-
create(
|
|
430
|
+
create(
|
|
431
|
+
opts?: CreateInviteOptions,
|
|
432
|
+
auditMessage?: string,
|
|
433
|
+
): Promise<Invite & { code: string }>;
|
|
232
434
|
revoke(id: string, auditMessage?: string): Promise<any>;
|
|
233
435
|
}
|
|
234
436
|
|
|
235
437
|
interface TokenLayersBundle {
|
|
236
|
-
shift(
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
438
|
+
shift(
|
|
439
|
+
tokenLayerId: string,
|
|
440
|
+
direction: string,
|
|
441
|
+
auditMessage?: string,
|
|
442
|
+
): Promise<any>;
|
|
443
|
+
create(
|
|
444
|
+
textLayerId: string,
|
|
445
|
+
name: string,
|
|
446
|
+
overlapMode?: string,
|
|
447
|
+
parentTokenLayerId?: string,
|
|
448
|
+
auditMessage?: string,
|
|
449
|
+
): Promise<any>;
|
|
450
|
+
setConfig(
|
|
451
|
+
tokenLayerId: string,
|
|
452
|
+
namespace: string,
|
|
453
|
+
configKey: string,
|
|
454
|
+
configValue: any,
|
|
455
|
+
auditMessage?: string,
|
|
456
|
+
): Promise<any>;
|
|
457
|
+
deleteConfig(
|
|
458
|
+
tokenLayerId: string,
|
|
459
|
+
namespace: string,
|
|
460
|
+
configKey: string,
|
|
461
|
+
auditMessage?: string,
|
|
462
|
+
): Promise<any>;
|
|
240
463
|
get(tokenLayerId: string, asOf?: string): Promise<any>;
|
|
241
464
|
delete(tokenLayerId: string, auditMessage?: string): Promise<any>;
|
|
242
|
-
update(
|
|
465
|
+
update(
|
|
466
|
+
tokenLayerId: string,
|
|
467
|
+
name: string,
|
|
468
|
+
auditMessage?: string,
|
|
469
|
+
): Promise<any>;
|
|
243
470
|
}
|
|
244
471
|
|
|
245
472
|
interface DocumentsBundle {
|
|
@@ -247,28 +474,79 @@ interface DocumentsBundle {
|
|
|
247
474
|
acquireLock(documentId: string, auditMessage?: string): Promise<any>;
|
|
248
475
|
releaseLock(documentId: string, auditMessage?: string): Promise<any>;
|
|
249
476
|
getMedia(documentId: string, asOf?: string): Promise<ArrayBuffer>;
|
|
250
|
-
uploadMedia(
|
|
477
|
+
uploadMedia(
|
|
478
|
+
documentId: string,
|
|
479
|
+
file: File,
|
|
480
|
+
auditMessage?: string,
|
|
481
|
+
): Promise<any>;
|
|
251
482
|
deleteMedia(documentId: string, auditMessage?: string): Promise<any>;
|
|
252
|
-
setMetadata(
|
|
483
|
+
setMetadata(
|
|
484
|
+
documentId: string,
|
|
485
|
+
body: any,
|
|
486
|
+
auditMessage?: string,
|
|
487
|
+
): Promise<any>;
|
|
253
488
|
deleteMetadata(documentId: string, auditMessage?: string): Promise<any>;
|
|
254
|
-
patchMetadata(
|
|
255
|
-
|
|
489
|
+
patchMetadata(
|
|
490
|
+
documentId: string,
|
|
491
|
+
body: any,
|
|
492
|
+
auditMessage?: string,
|
|
493
|
+
): Promise<any>;
|
|
494
|
+
audit(
|
|
495
|
+
documentId: string,
|
|
496
|
+
startTime?: string,
|
|
497
|
+
endTime?: string,
|
|
498
|
+
asOf?: string,
|
|
499
|
+
): Promise<any[]>;
|
|
256
500
|
get(documentId: string, includeBody?: boolean, asOf?: string): Promise<any>;
|
|
257
501
|
delete(documentId: string, auditMessage?: string): Promise<any>;
|
|
258
502
|
update(documentId: string, name: string, auditMessage?: string): Promise<any>;
|
|
259
|
-
create(
|
|
503
|
+
create(
|
|
504
|
+
projectId: string,
|
|
505
|
+
name: string,
|
|
506
|
+
metadata?: any,
|
|
507
|
+
auditMessage?: string,
|
|
508
|
+
): Promise<any>;
|
|
260
509
|
}
|
|
261
510
|
|
|
262
511
|
interface MessagesBundle {
|
|
263
|
-
sendMessage(
|
|
264
|
-
|
|
512
|
+
sendMessage(
|
|
513
|
+
projectId: string,
|
|
514
|
+
data: any,
|
|
515
|
+
auditMessage?: string,
|
|
516
|
+
): Promise<any>;
|
|
517
|
+
listen(
|
|
518
|
+
projectId: string,
|
|
519
|
+
onEvent: (eventType: string, data: any) => void | boolean,
|
|
520
|
+
path?: string,
|
|
521
|
+
): SSEConnection;
|
|
265
522
|
/** Discover the services seen on a project: online ones plus previously-seen offline ones (check `online`). */
|
|
266
523
|
discoverServices(projectId: string): Promise<DiscoveredService[]>;
|
|
267
524
|
/** Forget a previously-seen (offline) service. Maintainer-only; 409 if currently connected. */
|
|
268
525
|
discardService(projectId: string, serviceId: string): Promise<void>;
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
526
|
+
/**
|
|
527
|
+
* Register as a service and handle work requests. The registration reopens
|
|
528
|
+
* its channel whenever it drops, so a server restart needs no service restart.
|
|
529
|
+
*/
|
|
530
|
+
serve(
|
|
531
|
+
projectId: string,
|
|
532
|
+
serviceInfo: ServiceInfo,
|
|
533
|
+
onServiceRequest: (data: any, responseHelper: ResponseHelper) => void,
|
|
534
|
+
extras?: any,
|
|
535
|
+
onStatus?: (event: ServiceStatusEvent, projectId: string, detail?: string) => void,
|
|
536
|
+
): ServiceRegistration;
|
|
537
|
+
/**
|
|
538
|
+
* Submit work to a service; streams progress to `onProgress`, resolves with
|
|
539
|
+
* the result. Aborting `signal` stops waiting and rejects with an AbortError;
|
|
540
|
+
* the service is not told and finishes its work regardless.
|
|
541
|
+
*/
|
|
542
|
+
requestService(
|
|
543
|
+
projectId: string,
|
|
544
|
+
serviceId: string,
|
|
545
|
+
data: any,
|
|
546
|
+
timeout?: number,
|
|
547
|
+
onProgress?: (progress: any) => void,
|
|
548
|
+
signal?: AbortSignal,
|
|
549
|
+
): Promise<any>;
|
|
272
550
|
}
|
|
273
551
|
|
|
274
552
|
interface ProjectsBundle {
|
|
@@ -276,32 +554,85 @@ interface ProjectsBundle {
|
|
|
276
554
|
removeWriter(id: string, userId: string, auditMessage?: string): Promise<any>;
|
|
277
555
|
addReader(id: string, userId: string, auditMessage?: string): Promise<any>;
|
|
278
556
|
removeReader(id: string, userId: string, auditMessage?: string): Promise<any>;
|
|
279
|
-
setConfig(
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
557
|
+
setConfig(
|
|
558
|
+
id: string,
|
|
559
|
+
namespace: string,
|
|
560
|
+
configKey: string,
|
|
561
|
+
configValue: any,
|
|
562
|
+
auditMessage?: string,
|
|
563
|
+
): Promise<any>;
|
|
564
|
+
deleteConfig(
|
|
565
|
+
id: string,
|
|
566
|
+
namespace: string,
|
|
567
|
+
configKey: string,
|
|
568
|
+
auditMessage?: string,
|
|
569
|
+
): Promise<any>;
|
|
570
|
+
addMaintainer(
|
|
571
|
+
id: string,
|
|
572
|
+
userId: string,
|
|
573
|
+
auditMessage?: string,
|
|
574
|
+
): Promise<any>;
|
|
575
|
+
removeMaintainer(
|
|
576
|
+
id: string,
|
|
577
|
+
userId: string,
|
|
578
|
+
auditMessage?: string,
|
|
579
|
+
): Promise<any>;
|
|
580
|
+
audit(
|
|
581
|
+
projectId: string,
|
|
582
|
+
startTime?: string,
|
|
583
|
+
endTime?: string,
|
|
584
|
+
asOf?: string,
|
|
585
|
+
): Promise<any[]>;
|
|
284
586
|
linkVocab(id: string, vocabId: string, auditMessage?: string): Promise<any>;
|
|
285
587
|
unlinkVocab(id: string, vocabId: string, auditMessage?: string): Promise<any>;
|
|
286
588
|
get(id: string, asOf?: string): Promise<any>;
|
|
287
589
|
listDocuments(id: string): Promise<any[]>;
|
|
288
|
-
listDocumentsPage(
|
|
289
|
-
|
|
590
|
+
listDocumentsPage(
|
|
591
|
+
id: string,
|
|
592
|
+
opts?: { limit?: number; cursor?: string },
|
|
593
|
+
): Promise<Page>;
|
|
594
|
+
iterDocuments(
|
|
595
|
+
id: string,
|
|
596
|
+
opts?: { pageSize?: number },
|
|
597
|
+
): AsyncGenerator<any[]>;
|
|
290
598
|
delete(id: string, auditMessage?: string): Promise<any>;
|
|
291
599
|
update(id: string, name: string, auditMessage?: string): Promise<any>;
|
|
292
600
|
list(asOf?: string): Promise<any[]>;
|
|
293
|
-
listPage(opts?: {
|
|
601
|
+
listPage(opts?: {
|
|
602
|
+
limit?: number;
|
|
603
|
+
cursor?: string;
|
|
604
|
+
asOf?: string;
|
|
605
|
+
}): Promise<Page>;
|
|
294
606
|
iterPages(opts?: { pageSize?: number; asOf?: string }): AsyncGenerator<any[]>;
|
|
295
607
|
create(name: string, auditMessage?: string): Promise<any>;
|
|
296
608
|
}
|
|
297
609
|
|
|
298
610
|
interface TextLayersBundle {
|
|
299
|
-
setConfig(
|
|
300
|
-
|
|
611
|
+
setConfig(
|
|
612
|
+
textLayerId: string,
|
|
613
|
+
namespace: string,
|
|
614
|
+
configKey: string,
|
|
615
|
+
configValue: any,
|
|
616
|
+
auditMessage?: string,
|
|
617
|
+
): Promise<any>;
|
|
618
|
+
deleteConfig(
|
|
619
|
+
textLayerId: string,
|
|
620
|
+
namespace: string,
|
|
621
|
+
configKey: string,
|
|
622
|
+
auditMessage?: string,
|
|
623
|
+
): Promise<any>;
|
|
301
624
|
get(textLayerId: string, asOf?: string): Promise<any>;
|
|
302
625
|
delete(textLayerId: string, auditMessage?: string): Promise<any>;
|
|
303
|
-
update(
|
|
304
|
-
|
|
626
|
+
update(
|
|
627
|
+
textLayerId: string,
|
|
628
|
+
name: string,
|
|
629
|
+
auditMessage?: string,
|
|
630
|
+
): Promise<any>;
|
|
631
|
+
shift(
|
|
632
|
+
textLayerId: string,
|
|
633
|
+
direction: string,
|
|
634
|
+
auditMessage?: string,
|
|
635
|
+
): Promise<any>;
|
|
305
636
|
create(projectId: string, name: string, auditMessage?: string): Promise<any>;
|
|
306
637
|
}
|
|
307
638
|
|
|
@@ -309,7 +640,12 @@ interface VocabItemsBundle {
|
|
|
309
640
|
setMetadata(id: string, body: any, auditMessage?: string): Promise<any>;
|
|
310
641
|
deleteMetadata(id: string, auditMessage?: string): Promise<any>;
|
|
311
642
|
patchMetadata(id: string, body: any, auditMessage?: string): Promise<any>;
|
|
312
|
-
create(
|
|
643
|
+
create(
|
|
644
|
+
vocabLayerId: string,
|
|
645
|
+
form: string,
|
|
646
|
+
metadata?: any,
|
|
647
|
+
auditMessage?: string,
|
|
648
|
+
): Promise<any>;
|
|
313
649
|
bulkCreate(body: any[], auditMessage?: string): Promise<{ ids: string[] }>;
|
|
314
650
|
bulkDelete(body: any[], auditMessage?: string): Promise<void>;
|
|
315
651
|
get(id: string, asOf?: string): Promise<any>;
|
|
@@ -318,33 +654,90 @@ interface VocabItemsBundle {
|
|
|
318
654
|
}
|
|
319
655
|
|
|
320
656
|
interface RelationLayersBundle {
|
|
321
|
-
shift(
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
657
|
+
shift(
|
|
658
|
+
relationLayerId: string,
|
|
659
|
+
direction: string,
|
|
660
|
+
auditMessage?: string,
|
|
661
|
+
): Promise<any>;
|
|
662
|
+
create(
|
|
663
|
+
spanLayerId: string,
|
|
664
|
+
name: string,
|
|
665
|
+
auditMessage?: string,
|
|
666
|
+
): Promise<any>;
|
|
667
|
+
setConfig(
|
|
668
|
+
relationLayerId: string,
|
|
669
|
+
namespace: string,
|
|
670
|
+
configKey: string,
|
|
671
|
+
configValue: any,
|
|
672
|
+
auditMessage?: string,
|
|
673
|
+
): Promise<any>;
|
|
674
|
+
deleteConfig(
|
|
675
|
+
relationLayerId: string,
|
|
676
|
+
namespace: string,
|
|
677
|
+
configKey: string,
|
|
678
|
+
auditMessage?: string,
|
|
679
|
+
): Promise<any>;
|
|
325
680
|
get(relationLayerId: string, asOf?: string): Promise<any>;
|
|
326
681
|
delete(relationLayerId: string, auditMessage?: string): Promise<any>;
|
|
327
|
-
update(
|
|
682
|
+
update(
|
|
683
|
+
relationLayerId: string,
|
|
684
|
+
name: string,
|
|
685
|
+
auditMessage?: string,
|
|
686
|
+
): Promise<any>;
|
|
328
687
|
}
|
|
329
688
|
|
|
330
689
|
interface TokensBundle {
|
|
331
|
-
create(
|
|
690
|
+
create(
|
|
691
|
+
tokenLayerId: string,
|
|
692
|
+
text: string,
|
|
693
|
+
begin: number,
|
|
694
|
+
end: number,
|
|
695
|
+
precedence?: number | null,
|
|
696
|
+
metadata?: any,
|
|
697
|
+
auditMessage?: string,
|
|
698
|
+
): Promise<any>;
|
|
332
699
|
get(tokenId: string, asOf?: string): Promise<any>;
|
|
333
700
|
delete(tokenId: string, auditMessage?: string): Promise<any>;
|
|
334
|
-
update(
|
|
701
|
+
update(
|
|
702
|
+
tokenId: string,
|
|
703
|
+
begin?: number,
|
|
704
|
+
end?: number,
|
|
705
|
+
precedence?: number | null,
|
|
706
|
+
auditMessage?: string,
|
|
707
|
+
): Promise<any>;
|
|
335
708
|
bulkCreate(body: any[], auditMessage?: string): Promise<{ ids: string[] }>;
|
|
336
709
|
bulkDelete(body: any[], auditMessage?: string): Promise<void>;
|
|
337
710
|
split(tokenId: string, position: number, auditMessage?: string): Promise<any>;
|
|
338
|
-
merge(
|
|
339
|
-
|
|
711
|
+
merge(
|
|
712
|
+
tokenId: string,
|
|
713
|
+
otherTokenId: string,
|
|
714
|
+
auditMessage?: string,
|
|
715
|
+
): Promise<any>;
|
|
716
|
+
shift(
|
|
717
|
+
tokenId: string,
|
|
718
|
+
begin?: number,
|
|
719
|
+
end?: number,
|
|
720
|
+
auditMessage?: string,
|
|
721
|
+
): Promise<any>;
|
|
340
722
|
setMetadata(tokenId: string, body: any, auditMessage?: string): Promise<any>;
|
|
341
723
|
deleteMetadata(tokenId: string, auditMessage?: string): Promise<any>;
|
|
342
|
-
patchMetadata(
|
|
724
|
+
patchMetadata(
|
|
725
|
+
tokenId: string,
|
|
726
|
+
body: any,
|
|
727
|
+
auditMessage?: string,
|
|
728
|
+
): Promise<any>;
|
|
343
729
|
}
|
|
344
730
|
|
|
345
731
|
interface PlaidClientOptions {
|
|
346
732
|
/** Per-request timeout in ms (default 30000; 0 or null disables it). */
|
|
347
733
|
timeout?: number | null;
|
|
734
|
+
/**
|
|
735
|
+
* Timeout for batch submissions in ms (default 180000; 0 or null disables it).
|
|
736
|
+
* Batches get their own, longer budget: aborting one does NOT stop the
|
|
737
|
+
* server, which keeps running the transaction and holding the single SQLite
|
|
738
|
+
* write lock. Defaults to `timeout` when that is given and this is not.
|
|
739
|
+
*/
|
|
740
|
+
batchTimeout?: number | null;
|
|
348
741
|
/**
|
|
349
742
|
* Fired once when a request returns HTTP 401 (missing/expired/invalid token).
|
|
350
743
|
* Use it to discard the stored token and route back to login. 403 (forbidden)
|
|
@@ -360,19 +753,29 @@ export interface OperationGroupsBundle {
|
|
|
360
753
|
|
|
361
754
|
export declare class PlaidClient {
|
|
362
755
|
constructor(baseUrl: string, token: string, options?: PlaidClientOptions);
|
|
363
|
-
static login(
|
|
756
|
+
static login(
|
|
757
|
+
baseUrl: string,
|
|
758
|
+
userId: string,
|
|
759
|
+
password: string,
|
|
760
|
+
options?: PlaidClientOptions,
|
|
761
|
+
): Promise<PlaidClient>;
|
|
364
762
|
/** Build the link to hand someone for an invite code. */
|
|
365
763
|
static inviteUrl(appUrl: string, code: string): string;
|
|
366
764
|
/** Describe an invite code with no authentication (for a signup page). */
|
|
367
|
-
static lookupInvite(
|
|
765
|
+
static lookupInvite(
|
|
766
|
+
baseUrl: string,
|
|
767
|
+
code: string,
|
|
768
|
+
options?: PlaidClientOptions,
|
|
769
|
+
): Promise<InvitePreview>;
|
|
368
770
|
/** Redeem an invite code with no authentication; resolves to a logged-in client. */
|
|
369
771
|
static redeemInvite(
|
|
370
772
|
baseUrl: string,
|
|
371
773
|
code: string,
|
|
372
|
-
credentials: {
|
|
774
|
+
credentials: { email?: string; password: string; displayName?: string },
|
|
373
775
|
options?: PlaidClientOptions,
|
|
374
776
|
): Promise<{ client: PlaidClient; userId: string; kind: string }>;
|
|
375
777
|
timeout: number | null;
|
|
778
|
+
batchTimeout: number | null;
|
|
376
779
|
/** Fired once on HTTP 401 (see PlaidClientOptions.onAuthError). */
|
|
377
780
|
onAuthError: ((error: Error) => void) | null;
|
|
378
781
|
|
|
@@ -394,7 +797,10 @@ export declare class PlaidClient {
|
|
|
394
797
|
operationGroup: { id: string; message: string | null } | null;
|
|
395
798
|
beginOperation(message: string, opts?: { id?: string }): string;
|
|
396
799
|
endOperation(message?: string): Promise<void>;
|
|
397
|
-
withOperation<T>(
|
|
800
|
+
withOperation<T>(
|
|
801
|
+
message: string,
|
|
802
|
+
fn: (setMessage: (msg: string) => void) => Promise<T> | T,
|
|
803
|
+
): Promise<T>;
|
|
398
804
|
operationGroups: OperationGroupsBundle;
|
|
399
805
|
|
|
400
806
|
// Query
|
|
@@ -409,7 +815,9 @@ export declare class PlaidClient {
|
|
|
409
815
|
texts: TextsBundle;
|
|
410
816
|
users: UsersBundle;
|
|
411
817
|
apiTokens: ApiTokensBundle;
|
|
818
|
+
userData: UserDataBundle;
|
|
412
819
|
invites: InvitesBundle;
|
|
820
|
+
comments: CommentsBundle;
|
|
413
821
|
tokenLayers: TokenLayersBundle;
|
|
414
822
|
documents: DocumentsBundle;
|
|
415
823
|
messages: MessagesBundle;
|
|
@@ -441,22 +849,25 @@ export function cpIndexOf(s: string, sub: string, fromCp?: number): number;
|
|
|
441
849
|
// Substrate layers are tagged with a role at `config.plaid.role` (a scalar) so
|
|
442
850
|
// that different apps can share a project. See the manual, "Layer Interoperability".
|
|
443
851
|
/** The reserved config namespace for cross-app conventions. */
|
|
444
|
-
export const PLAID_NAMESPACE:
|
|
852
|
+
export const PLAID_NAMESPACE: "plaid";
|
|
445
853
|
/** The config key, under `plaid`, holding a layer's role. */
|
|
446
|
-
export const ROLE_KEY:
|
|
854
|
+
export const ROLE_KEY: "role";
|
|
447
855
|
/** The fixed role inventory; only these values are interoperable across apps. */
|
|
448
856
|
export const ROLES: {
|
|
449
|
-
readonly BASELINE:
|
|
450
|
-
readonly SENTENCE:
|
|
451
|
-
readonly WORD:
|
|
452
|
-
readonly SYNTACTIC_WORD:
|
|
453
|
-
readonly MORPHEME:
|
|
454
|
-
readonly TIME_ALIGNMENT:
|
|
857
|
+
readonly BASELINE: "baseline";
|
|
858
|
+
readonly SENTENCE: "sentence";
|
|
859
|
+
readonly WORD: "word";
|
|
860
|
+
readonly SYNTACTIC_WORD: "syntactic-word";
|
|
861
|
+
readonly MORPHEME: "morpheme";
|
|
862
|
+
readonly TIME_ALIGNMENT: "time-alignment";
|
|
455
863
|
};
|
|
456
864
|
/** The role recorded on a layer's `config`, or null if none. */
|
|
457
865
|
export function readRole(config?: object): string | null;
|
|
458
866
|
/** The first layer in `layers` carrying the given role, or null. */
|
|
459
|
-
export function findByRole<T extends { config?: object }>(
|
|
867
|
+
export function findByRole<T extends { config?: object }>(
|
|
868
|
+
layers: T[] | undefined,
|
|
869
|
+
role: string,
|
|
870
|
+
): T | null;
|
|
460
871
|
|
|
461
872
|
// --- Service self-description helpers ----------------------------------------
|
|
462
873
|
// Standardize how a service advertises (in `extras`) the tasks it serves, a
|
|
@@ -465,16 +876,19 @@ export function findByRole<T extends { config?: object }>(layers: T[] | undefine
|
|
|
465
876
|
// "Describing a service".
|
|
466
877
|
/** The controlled task vocabulary — the fixed integration-point goals. */
|
|
467
878
|
export const TASKS: {
|
|
468
|
-
readonly TOKENIZE:
|
|
469
|
-
readonly PARSE:
|
|
470
|
-
readonly TRANSCRIBE:
|
|
471
|
-
readonly LINK_VOCAB:
|
|
472
|
-
readonly ANALYZE:
|
|
879
|
+
readonly TOKENIZE: "tokenize";
|
|
880
|
+
readonly PARSE: "parse";
|
|
881
|
+
readonly TRANSCRIBE: "transcribe";
|
|
882
|
+
readonly LINK_VOCAB: "link-vocab";
|
|
883
|
+
readonly ANALYZE: "analyze";
|
|
473
884
|
};
|
|
474
885
|
/** Whether a service serves a task (declared `extras.tasks`, legacy id-prefix fallback). */
|
|
475
886
|
export function servesTask(service: DiscoveredService, task: string): boolean;
|
|
476
887
|
/** The discovered services that serve `task`. */
|
|
477
|
-
export function filterServicesByTask(
|
|
888
|
+
export function filterServicesByTask(
|
|
889
|
+
services: DiscoveredService[] | undefined,
|
|
890
|
+
task: string,
|
|
891
|
+
): DiscoveredService[];
|
|
478
892
|
/** The parameter schema a service declares (ordered), or []. */
|
|
479
893
|
export function getParamSchema(service: DiscoveredService): ServiceParam[];
|
|
480
894
|
/** A service's human summary: `extras.summary`, else `description`, else ''. */
|
|
@@ -482,7 +896,10 @@ export function getServiceSummary(service: DiscoveredService): string;
|
|
|
482
896
|
/** Default form values keyed by param key. */
|
|
483
897
|
export function buildDefaultValues(schema: ServiceParam[]): Record<string, any>;
|
|
484
898
|
/** Coerce/validate raw form values against the schema. */
|
|
485
|
-
export function coerceParamValues(
|
|
899
|
+
export function coerceParamValues(
|
|
900
|
+
schema: ServiceParam[],
|
|
901
|
+
raw: Record<string, any>,
|
|
902
|
+
): { values: Record<string, any>; errors: Record<string, string> };
|
|
486
903
|
|
|
487
904
|
// --- Provenance ---------------------------------------------------------------
|
|
488
905
|
// Cross-app convention for machine-provided vs human-labeled information,
|
|
@@ -492,32 +909,50 @@ export function coerceParamValues(schema: ServiceParam[], raw: Record<string, an
|
|
|
492
909
|
// replace unverified machine material but must never touch human/verified
|
|
493
910
|
// material without an explicit overwrite opt-in; any human edit verifies.
|
|
494
911
|
// See the manual, "Provenance".
|
|
495
|
-
type ProvState =
|
|
912
|
+
type ProvState = "human" | "machine" | "verified";
|
|
496
913
|
export const PROV: {
|
|
497
|
-
readonly key:
|
|
498
|
-
readonly sourceKey:
|
|
499
|
-
readonly confirmedKey:
|
|
500
|
-
readonly probKey:
|
|
501
|
-
readonly detailKey:
|
|
502
|
-
readonly INFERRED:
|
|
914
|
+
readonly key: "prov";
|
|
915
|
+
readonly sourceKey: "provSource";
|
|
916
|
+
readonly confirmedKey: "provConfirmed";
|
|
917
|
+
readonly probKey: "provProb";
|
|
918
|
+
readonly detailKey: "provDetail";
|
|
919
|
+
readonly INFERRED: "inferred";
|
|
503
920
|
};
|
|
504
921
|
export const PROV_STATES: {
|
|
505
|
-
readonly HUMAN:
|
|
506
|
-
readonly MACHINE:
|
|
507
|
-
readonly VERIFIED:
|
|
922
|
+
readonly HUMAN: "human";
|
|
923
|
+
readonly MACHINE: "machine";
|
|
924
|
+
readonly VERIFIED: "verified";
|
|
508
925
|
};
|
|
509
926
|
/** Optional prediction extras: prob = a probability in [0,1] for the chosen value
|
|
510
927
|
* (flat + queryable; omit unless it honestly is one); detail = an open map of
|
|
511
928
|
* producer extras (top-k alternatives, model version, raw scores; keep it small).
|
|
512
929
|
* Both describe the ORIGINAL prediction — check provConfirmed before presenting
|
|
513
930
|
* provProb as confidence in the current value. */
|
|
514
|
-
interface ProvExtras {
|
|
931
|
+
interface ProvExtras {
|
|
932
|
+
prob?: number;
|
|
933
|
+
detail?: Record<string, any>;
|
|
934
|
+
}
|
|
515
935
|
/** The metadata fragment a machine writer merges into everything it creates. */
|
|
516
|
-
export function stampInferred(
|
|
517
|
-
|
|
936
|
+
export function stampInferred(
|
|
937
|
+
source: string,
|
|
938
|
+
extras?: ProvExtras,
|
|
939
|
+
): {
|
|
940
|
+
prov: "inferred";
|
|
941
|
+
provSource: string;
|
|
942
|
+
provProb?: number;
|
|
943
|
+
provDetail?: Record<string, any>;
|
|
944
|
+
};
|
|
518
945
|
/** stampInferred + provConfirmed — for machine material born verified (e.g. imports with upstream approval). */
|
|
519
|
-
export function confirmedInferred(
|
|
520
|
-
|
|
946
|
+
export function confirmedInferred(
|
|
947
|
+
source: string,
|
|
948
|
+
extras?: ProvExtras,
|
|
949
|
+
): {
|
|
950
|
+
prov: "inferred";
|
|
951
|
+
provSource: string;
|
|
952
|
+
provConfirmed: true;
|
|
953
|
+
provProb?: number;
|
|
954
|
+
provDetail?: Record<string, any>;
|
|
955
|
+
};
|
|
521
956
|
/** Classify an entity's metadata into one of the three provenance states. */
|
|
522
957
|
export function provState(metadata: object | null | undefined): ProvState;
|
|
523
958
|
/** The verifying fragment, { provConfirmed: true }: PATCH it over existing metadata. */
|
|
@@ -527,6 +962,8 @@ export function isMachine(metadata: object | null | undefined): boolean;
|
|
|
527
962
|
/** Whether a machine writer must leave this entity alone (human or verified). !isMachine. */
|
|
528
963
|
export function isProtected(metadata: object | null | undefined): boolean;
|
|
529
964
|
/** The fragment a HUMAN edit should merge in: PROV_CONFIRMED iff machine-unverified, else null. */
|
|
530
|
-
export function verifyOnEdit(
|
|
965
|
+
export function verifyOnEdit(
|
|
966
|
+
metadata: object | null | undefined,
|
|
967
|
+
): { readonly provConfirmed: true } | null;
|
|
531
968
|
/** Canonical provSource for a service: 'service:<serviceId>'. */
|
|
532
969
|
export function serviceSource(serviceId: string): string;
|