@larc-iu/plaid-client 0.2.0-alpha.26 → 0.2.0-alpha.29
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 +1 -1
- package/src/index.d.ts +1006 -252
- package/src/index.js +680 -81
- package/src/services.js +15 -1
- package/src/textEdits.js +7 -5
package/src/index.d.ts
CHANGED
|
@@ -163,6 +163,29 @@ export type ConstraintRepair = {
|
|
|
163
163
|
deleted: number;
|
|
164
164
|
joined: number;
|
|
165
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
|
+
};
|
|
166
189
|
/**
|
|
167
190
|
* Entities that can carry a comment.
|
|
168
191
|
*/
|
|
@@ -257,6 +280,7 @@ export type ServerLimits = {
|
|
|
257
280
|
userDataValueBytes?: number;
|
|
258
281
|
guidelineTitleLength?: number;
|
|
259
282
|
guidelineBodyLength?: number;
|
|
283
|
+
commentBodyLength?: number;
|
|
260
284
|
passwordMinLength?: number;
|
|
261
285
|
lockExpirationMs?: number;
|
|
262
286
|
};
|
|
@@ -354,12 +378,496 @@ export type LiveLog = {
|
|
|
354
378
|
*/
|
|
355
379
|
export type SSEConnection = {
|
|
356
380
|
close: () => void;
|
|
357
|
-
getStats: () =>
|
|
381
|
+
getStats: () => SSEStats;
|
|
358
382
|
readyState: number;
|
|
359
383
|
error: (Error & {
|
|
360
384
|
status?: number;
|
|
361
385
|
}) | null;
|
|
362
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
|
+
};
|
|
363
871
|
export class PlaidClient {
|
|
364
872
|
/**
|
|
365
873
|
* Liveness, version and database size, with NO authentication and no client
|
|
@@ -571,34 +1079,39 @@ export class PlaidClient {
|
|
|
571
1079
|
/**
|
|
572
1080
|
* Get a vocab link by ID
|
|
573
1081
|
* @param {string} id - The resource ID
|
|
1082
|
+
* @returns {Promise<VocabLink>}
|
|
574
1083
|
*/
|
|
575
|
-
get: (id: string) => Promise<
|
|
1084
|
+
get: (id: string) => Promise<VocabLink>;
|
|
576
1085
|
/**
|
|
577
1086
|
* Delete a vocab link
|
|
578
1087
|
* @param {string} id - The resource ID
|
|
579
1088
|
* @param {string} [auditMessage] - Audit message for this write
|
|
1089
|
+
* @returns {Promise<void>}
|
|
580
1090
|
*/
|
|
581
|
-
delete: (id: string, auditMessage?: string) => Promise<
|
|
1091
|
+
delete: (id: string, auditMessage?: string) => Promise<void>;
|
|
582
1092
|
/**
|
|
583
1093
|
* Replace all metadata of an entity. Keys left out of the new map are removed.
|
|
584
1094
|
* @param {string} id - The entity's ID
|
|
585
1095
|
* @param {object} body - The new metadata map
|
|
586
1096
|
* @param {string} [auditMessage] - Audit message for this write
|
|
1097
|
+
* @returns {Promise<MetadataRecords[K]>}
|
|
587
1098
|
*/
|
|
588
|
-
setMetadata: (id: string, body: object, auditMessage?: string) => Promise<
|
|
1099
|
+
setMetadata: (id: string, body: object, auditMessage?: string) => Promise<VocabLink>;
|
|
589
1100
|
/**
|
|
590
1101
|
* Remove all metadata from an entity.
|
|
591
1102
|
* @param {string} id - The entity's ID
|
|
592
1103
|
* @param {string} [auditMessage] - Audit message for this write
|
|
1104
|
+
* @returns {Promise<MetadataRecords[K]>}
|
|
593
1105
|
*/
|
|
594
|
-
deleteMetadata: (id: string, auditMessage?: string) => Promise<
|
|
1106
|
+
deleteMetadata: (id: string, auditMessage?: string) => Promise<VocabLink>;
|
|
595
1107
|
/**
|
|
596
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.
|
|
597
1109
|
* @param {string} id - The entity's ID
|
|
598
1110
|
* @param {MetadataOp[]} body - The metadata ops
|
|
599
1111
|
* @param {string} [auditMessage] - Audit message for this write
|
|
1112
|
+
* @returns {Promise<MetadataRecords[K]>}
|
|
600
1113
|
*/
|
|
601
|
-
patchMetadata: (id: string, body: MetadataOp[], auditMessage?: string) => Promise<
|
|
1114
|
+
patchMetadata: (id: string, body: MetadataOp[], auditMessage?: string) => Promise<VocabLink>;
|
|
602
1115
|
/**
|
|
603
1116
|
* Create a new vocab link between tokens and a vocab item.
|
|
604
1117
|
* @param {string} vocabItem - The vocab item to link
|
|
@@ -607,10 +1120,11 @@ export class PlaidClient {
|
|
|
607
1120
|
* @param {string} [auditMessage] - Audit message for this write
|
|
608
1121
|
* @param {object} [opts]
|
|
609
1122
|
* @param {string} [opts.id] - The new entity's id, minted by the caller (see uuidv7)
|
|
1123
|
+
* @returns {Promise<Created>}
|
|
610
1124
|
*/
|
|
611
1125
|
create: (vocabItem: string, tokens: any[], metadata?: any, auditMessage?: string, { id }?: {
|
|
612
1126
|
id?: string;
|
|
613
|
-
}) => Promise<
|
|
1127
|
+
}) => Promise<Created>;
|
|
614
1128
|
/**
|
|
615
1129
|
* Create multiple vocab links in a single operation. Entries may
|
|
616
1130
|
* reference different vocab items, but all tokens across the call must
|
|
@@ -638,55 +1152,56 @@ export class PlaidClient {
|
|
|
638
1152
|
/**
|
|
639
1153
|
* List all vocab layers accessible to user. Transparently follows
|
|
640
1154
|
* pagination cursors and returns the full flat array.
|
|
1155
|
+
* @returns {Promise<VocabLayer[]>}
|
|
641
1156
|
*/
|
|
642
|
-
list: () => Promise<
|
|
1157
|
+
list: () => Promise<VocabLayer[]>;
|
|
643
1158
|
/**
|
|
644
1159
|
* Fetch a single page of vocab layers.
|
|
645
1160
|
* @param {object} [opts]
|
|
646
1161
|
* @param {number} [opts.limit] - Page size (1..1000; server default 100)
|
|
647
1162
|
* @param {string} [opts.cursor] - Opaque cursor from a previous page
|
|
648
|
-
* @returns {Promise<
|
|
1163
|
+
* @returns {Promise<Page<VocabLayer>>}
|
|
649
1164
|
*/
|
|
650
1165
|
listPage: ({ limit, cursor }?: {
|
|
651
1166
|
limit?: number;
|
|
652
1167
|
cursor?: string;
|
|
653
|
-
}) => Promise<
|
|
654
|
-
entries: any[];
|
|
655
|
-
nextCursor: (string | null);
|
|
656
|
-
}>;
|
|
1168
|
+
}) => Promise<Page<VocabLayer>>;
|
|
657
1169
|
/**
|
|
658
1170
|
* Async-iterate vocab layers page by page; yields each page's entries array.
|
|
659
1171
|
* @param {object} [opts]
|
|
660
1172
|
* @param {number} [opts.pageSize] - Per-request page size
|
|
661
|
-
* @returns {AsyncGenerator<
|
|
1173
|
+
* @returns {AsyncGenerator<VocabLayer[]>}
|
|
662
1174
|
*/
|
|
663
1175
|
iterPages: ({ pageSize }?: {
|
|
664
1176
|
pageSize?: number;
|
|
665
|
-
}) => AsyncGenerator<
|
|
1177
|
+
}) => AsyncGenerator<VocabLayer[]>;
|
|
666
1178
|
/**
|
|
667
1179
|
* Create a new vocab layer. Note: this also registers the user as a maintainer.
|
|
668
1180
|
* @param {string} name - The name
|
|
669
1181
|
* @param {string} [auditMessage] - Audit message for this write
|
|
670
1182
|
* @param {object} [opts]
|
|
671
1183
|
* @param {string} [opts.id] - The new entity's id, minted by the caller (see uuidv7)
|
|
1184
|
+
* @returns {Promise<Created>}
|
|
672
1185
|
*/
|
|
673
1186
|
create: (name: string, auditMessage?: string, { id }?: {
|
|
674
1187
|
id?: string;
|
|
675
|
-
}) => Promise<
|
|
1188
|
+
}) => Promise<Created>;
|
|
676
1189
|
/**
|
|
677
1190
|
* Assign a user as a maintainer for this vocab layer.
|
|
678
1191
|
* @param {string} id - The resource ID
|
|
679
1192
|
* @param {string} userId - The user ID
|
|
680
1193
|
* @param {string} [auditMessage] - Audit message for this write
|
|
1194
|
+
* @returns {Promise<void>}
|
|
681
1195
|
*/
|
|
682
|
-
addMaintainer: (id: string, userId: string, auditMessage?: string) => Promise<
|
|
1196
|
+
addMaintainer: (id: string, userId: string, auditMessage?: string) => Promise<void>;
|
|
683
1197
|
/**
|
|
684
1198
|
* Remove a user's maintainer privileges for this vocab layer.
|
|
685
1199
|
* @param {string} id - The resource ID
|
|
686
1200
|
* @param {string} userId - The user ID
|
|
687
1201
|
* @param {string} [auditMessage] - Audit message for this write
|
|
1202
|
+
* @returns {Promise<void>}
|
|
688
1203
|
*/
|
|
689
|
-
removeMaintainer: (id: string, userId: string, auditMessage?: string) => Promise<
|
|
1204
|
+
removeMaintainer: (id: string, userId: string, auditMessage?: string) => Promise<void>;
|
|
690
1205
|
/**
|
|
691
1206
|
* Set a configuration value in an editor namespace.
|
|
692
1207
|
* @param {string} id - The record's ID
|
|
@@ -695,22 +1210,27 @@ export class PlaidClient {
|
|
|
695
1210
|
* @param {any} configValue - Configuration value to set
|
|
696
1211
|
* @param {string} [auditMessage] - Audit message for this write
|
|
697
1212
|
* @param {{expected?: any}} [options] - `expected`: the value read for this key (null or undefined when it
|
|
698
|
-
* was absent). The write is then refused with a 409 when the stored value differs.
|
|
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>}
|
|
699
1217
|
*/
|
|
700
1218
|
setConfig: (id: string, namespace: string, configKey: string, configValue: any, auditMessage?: string, options?: {
|
|
701
1219
|
expected?: any;
|
|
702
|
-
}) => Promise<
|
|
1220
|
+
}) => Promise<void>;
|
|
703
1221
|
/**
|
|
704
1222
|
* Remove a configuration value.
|
|
705
1223
|
* @param {string} id - The record's ID
|
|
706
1224
|
* @param {string} namespace - The config namespace
|
|
707
1225
|
* @param {string} configKey - The config key
|
|
708
1226
|
* @param {string} [auditMessage] - Audit message for this write
|
|
709
|
-
* @param {{expected?: any}} [options] - `expected`, as on setConfig.
|
|
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>}
|
|
710
1230
|
*/
|
|
711
1231
|
deleteConfig: (id: string, namespace: string, configKey: string, auditMessage?: string, options?: {
|
|
712
1232
|
expected?: any;
|
|
713
|
-
}) => Promise<
|
|
1233
|
+
}) => Promise<void>;
|
|
714
1234
|
/**
|
|
715
1235
|
* Get a vocab layer by ID. With `asOf`, the vocabulary as it was at that
|
|
716
1236
|
* instant, read from its history: the same shape as the live read, its
|
|
@@ -719,8 +1239,9 @@ export class PlaidClient {
|
|
|
719
1239
|
* @param {string} id - The resource ID
|
|
720
1240
|
* @param {boolean} [includeItems] - Include vocab items
|
|
721
1241
|
* @param {string} [asOf] - The moment to read at (ISO-8601 instant)
|
|
1242
|
+
* @returns {Promise<VocabLayer>}
|
|
722
1243
|
*/
|
|
723
|
-
get: (id: string, includeItems?: boolean, asOf?: string) => Promise<
|
|
1244
|
+
get: (id: string, includeItems?: boolean, asOf?: string) => Promise<VocabLayer>;
|
|
724
1245
|
/**
|
|
725
1246
|
* One entry of the vocabulary as it was at `asOf`, also when it has
|
|
726
1247
|
* been deleted since. The same shape as `vocabItems.get`. A 404 when
|
|
@@ -728,8 +1249,9 @@ export class PlaidClient {
|
|
|
728
1249
|
* @param {string} id - The vocabulary ID
|
|
729
1250
|
* @param {string} itemId - The entry ID
|
|
730
1251
|
* @param {string} asOf - The moment to read at (ISO-8601 instant)
|
|
1252
|
+
* @returns {Promise<VocabItem>}
|
|
731
1253
|
*/
|
|
732
|
-
getItemAt: (id: string, itemId: string, asOf: string) => Promise<
|
|
1254
|
+
getItemAt: (id: string, itemId: string, asOf: string) => Promise<VocabItem>;
|
|
733
1255
|
/**
|
|
734
1256
|
* Get the audit log of a vocabulary: every change to it or to its
|
|
735
1257
|
* entries, folded into entries as the document log is. Links are not
|
|
@@ -745,8 +1267,9 @@ export class PlaidClient {
|
|
|
745
1267
|
* each with only its operations that did
|
|
746
1268
|
* @param {string[]|string} [kinds] - Only the entries of operations of
|
|
747
1269
|
* these kinds (e.g. `['review', 'guess-adoption']`), each whole
|
|
1270
|
+
* @returns {Promise<AuditEntry[]>}
|
|
748
1271
|
*/
|
|
749
|
-
audit: (id: string, startTime?: string, endTime?: string, opTypes?: string[] | string, itemId?: string, kinds?: string[] | string) => Promise<
|
|
1272
|
+
audit: (id: string, startTime?: string, endTime?: string, opTypes?: string[] | string, itemId?: string, kinds?: string[] | string) => Promise<AuditEntry[]>;
|
|
750
1273
|
/**
|
|
751
1274
|
* One page of the same log, newest-first with `order: "desc"`. Use this
|
|
752
1275
|
* rather than audit() wherever the caller wants the recent end of a log
|
|
@@ -766,7 +1289,7 @@ export class PlaidClient {
|
|
|
766
1289
|
* @param {string} [opts.entryId] - Read only this entry, not a page
|
|
767
1290
|
* @param {string} [opts.itemId] - Only the changes that wrote this one
|
|
768
1291
|
* entry, each with only its operations that did
|
|
769
|
-
* @returns {Promise<
|
|
1292
|
+
* @returns {Promise<Page<AuditEntry>>}
|
|
770
1293
|
*/
|
|
771
1294
|
auditPage: (id: string, { startTime, endTime, opTypes, kinds, order, limit, cursor, opsLimit, entryId, itemId }?: {
|
|
772
1295
|
startTime?: string;
|
|
@@ -779,10 +1302,7 @@ export class PlaidClient {
|
|
|
779
1302
|
opsLimit?: number;
|
|
780
1303
|
entryId?: string;
|
|
781
1304
|
itemId?: string;
|
|
782
|
-
}) => Promise<
|
|
783
|
-
entries: any[];
|
|
784
|
-
nextCursor: (string | null);
|
|
785
|
-
}>;
|
|
1305
|
+
}) => Promise<Page<AuditEntry>>;
|
|
786
1306
|
/**
|
|
787
1307
|
* Put one entry of the vocabulary back as it was at `asOf`, as one
|
|
788
1308
|
* operation. A deleted entry comes back under its original id with its
|
|
@@ -811,15 +1331,17 @@ export class PlaidClient {
|
|
|
811
1331
|
* Delete a vocab layer.
|
|
812
1332
|
* @param {string} id - The resource ID
|
|
813
1333
|
* @param {string} [auditMessage] - Audit message for this write
|
|
1334
|
+
* @returns {Promise<void>}
|
|
814
1335
|
*/
|
|
815
|
-
delete: (id: string, auditMessage?: string) => Promise<
|
|
1336
|
+
delete: (id: string, auditMessage?: string) => Promise<void>;
|
|
816
1337
|
/**
|
|
817
1338
|
* Update a vocab layer's name.
|
|
818
1339
|
* @param {string} id - The resource ID
|
|
819
1340
|
* @param {string} name - The name
|
|
820
1341
|
* @param {string} [auditMessage] - Audit message for this write
|
|
1342
|
+
* @returns {Promise<VocabLayer>}
|
|
821
1343
|
*/
|
|
822
|
-
update: (id: string, name: string, auditMessage?: string) => Promise<
|
|
1344
|
+
update: (id: string, name: string, auditMessage?: string) => Promise<VocabLayer>;
|
|
823
1345
|
};
|
|
824
1346
|
relations: {
|
|
825
1347
|
/**
|
|
@@ -827,49 +1349,55 @@ export class PlaidClient {
|
|
|
827
1349
|
* @param {string} relationId - The relation ID
|
|
828
1350
|
* @param {string} spanId - The span ID
|
|
829
1351
|
* @param {string} [auditMessage] - Audit message for this write
|
|
1352
|
+
* @returns {Promise<Relation>}
|
|
830
1353
|
*/
|
|
831
|
-
setTarget: (relationId: string, spanId: string, auditMessage?: string) => Promise<
|
|
1354
|
+
setTarget: (relationId: string, spanId: string, auditMessage?: string) => Promise<Relation>;
|
|
832
1355
|
/**
|
|
833
1356
|
* Get a relation by ID.
|
|
834
1357
|
* @param {string} relationId - The relation ID
|
|
1358
|
+
* @returns {Promise<Relation>}
|
|
835
1359
|
*/
|
|
836
|
-
get: (relationId: string) => Promise<
|
|
1360
|
+
get: (relationId: string) => Promise<Relation>;
|
|
837
1361
|
/**
|
|
838
1362
|
* Delete a relation.
|
|
839
1363
|
* @param {string} relationId - The relation ID
|
|
840
1364
|
* @param {string} [auditMessage] - Audit message for this write
|
|
1365
|
+
* @returns {Promise<void>}
|
|
841
1366
|
*/
|
|
842
|
-
delete: (relationId: string, auditMessage?: string) => Promise<
|
|
1367
|
+
delete: (relationId: string, auditMessage?: string) => Promise<void>;
|
|
843
1368
|
/**
|
|
844
1369
|
* Update a relation's value.
|
|
845
1370
|
* @param {string} relationId - The relation ID
|
|
846
1371
|
* @param {any} value - The value
|
|
847
1372
|
* @param {string} [auditMessage] - Audit message for this write
|
|
1373
|
+
* @returns {Promise<Relation>}
|
|
848
1374
|
*/
|
|
849
|
-
update: (relationId: string, value: any, auditMessage?: string) => Promise<
|
|
1375
|
+
update: (relationId: string, value: any, auditMessage?: string) => Promise<Relation>;
|
|
850
1376
|
/**
|
|
851
1377
|
* Update the source span of a relation.
|
|
852
1378
|
* @param {string} relationId - The relation ID
|
|
853
1379
|
* @param {string} spanId - The span ID
|
|
854
1380
|
* @param {string} [auditMessage] - Audit message for this write
|
|
1381
|
+
* @returns {Promise<Relation>}
|
|
855
1382
|
*/
|
|
856
|
-
setSource: (relationId: string, spanId: string, auditMessage?: string) => Promise<
|
|
1383
|
+
setSource: (relationId: string, spanId: string, auditMessage?: string) => Promise<Relation>;
|
|
857
1384
|
/**
|
|
858
1385
|
* Create a new relation. A relation is a directed edge between two spans
|
|
859
1386
|
* with a value, useful for expressing phenomena such as syntactic or
|
|
860
1387
|
* semantic relations.
|
|
861
|
-
* @param {string}
|
|
862
|
-
* @param {string}
|
|
863
|
-
* @param {string}
|
|
1388
|
+
* @param {string} relationLayerId - The relation layer ID
|
|
1389
|
+
* @param {string} source - The source span ID
|
|
1390
|
+
* @param {string} target - The target span ID
|
|
864
1391
|
* @param {any} value - The value
|
|
865
1392
|
* @param {any} [metadata] - Metadata map. Omit to leave unset; pass null to send JSON null.
|
|
866
1393
|
* @param {string} [auditMessage] - Audit message for this write
|
|
867
1394
|
* @param {object} [opts]
|
|
868
1395
|
* @param {string} [opts.id] - The new entity's id, minted by the caller (see uuidv7)
|
|
1396
|
+
* @returns {Promise<Created>}
|
|
869
1397
|
*/
|
|
870
|
-
create: (
|
|
1398
|
+
create: (relationLayerId: string, source: string, target: string, value: any, metadata?: any, auditMessage?: string, { id }?: {
|
|
871
1399
|
id?: string;
|
|
872
|
-
}) => Promise<
|
|
1400
|
+
}) => Promise<Created>;
|
|
873
1401
|
/**
|
|
874
1402
|
* Create multiple relations in a single operation.
|
|
875
1403
|
* @param {Array} body - The request body
|
|
@@ -900,21 +1428,24 @@ export class PlaidClient {
|
|
|
900
1428
|
* @param {string} id - The entity's ID
|
|
901
1429
|
* @param {object} body - The new metadata map
|
|
902
1430
|
* @param {string} [auditMessage] - Audit message for this write
|
|
1431
|
+
* @returns {Promise<MetadataRecords[K]>}
|
|
903
1432
|
*/
|
|
904
|
-
setMetadata: (id: string, body: object, auditMessage?: string) => Promise<
|
|
1433
|
+
setMetadata: (id: string, body: object, auditMessage?: string) => Promise<Relation>;
|
|
905
1434
|
/**
|
|
906
1435
|
* Remove all metadata from an entity.
|
|
907
1436
|
* @param {string} id - The entity's ID
|
|
908
1437
|
* @param {string} [auditMessage] - Audit message for this write
|
|
1438
|
+
* @returns {Promise<MetadataRecords[K]>}
|
|
909
1439
|
*/
|
|
910
|
-
deleteMetadata: (id: string, auditMessage?: string) => Promise<
|
|
1440
|
+
deleteMetadata: (id: string, auditMessage?: string) => Promise<Relation>;
|
|
911
1441
|
/**
|
|
912
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.
|
|
913
1443
|
* @param {string} id - The entity's ID
|
|
914
1444
|
* @param {MetadataOp[]} body - The metadata ops
|
|
915
1445
|
* @param {string} [auditMessage] - Audit message for this write
|
|
1446
|
+
* @returns {Promise<MetadataRecords[K]>}
|
|
916
1447
|
*/
|
|
917
|
-
patchMetadata: (id: string, body: MetadataOp[], auditMessage?: string) => Promise<
|
|
1448
|
+
patchMetadata: (id: string, body: MetadataOp[], auditMessage?: string) => Promise<Relation>;
|
|
918
1449
|
};
|
|
919
1450
|
spanLayers: {
|
|
920
1451
|
/**
|
|
@@ -924,35 +1455,55 @@ export class PlaidClient {
|
|
|
924
1455
|
* @param {string} [auditMessage] - Audit message for this write
|
|
925
1456
|
* @param {object} [opts]
|
|
926
1457
|
* @param {string} [opts.id] - The new entity's id, minted by the caller (see uuidv7)
|
|
1458
|
+
* @returns {Promise<Created>}
|
|
927
1459
|
*/
|
|
928
1460
|
create: (tokenLayerId: string, name: string, auditMessage?: string, { id }?: {
|
|
929
1461
|
id?: string;
|
|
930
|
-
}) => Promise<
|
|
1462
|
+
}) => Promise<Created>;
|
|
931
1463
|
/**
|
|
932
1464
|
* Get a layer by ID.
|
|
933
1465
|
* @param {string} layerId - The layer ID
|
|
1466
|
+
* @returns {Promise<LayerRecords[K]>}
|
|
934
1467
|
*/
|
|
935
|
-
get: (layerId: string) => Promise<
|
|
1468
|
+
get: (layerId: string) => Promise<SpanLayer>;
|
|
936
1469
|
/**
|
|
937
1470
|
* Delete a layer.
|
|
938
1471
|
* @param {string} layerId - The layer ID
|
|
939
1472
|
* @param {string} [auditMessage] - Audit message for this write
|
|
1473
|
+
* @returns {Promise<void>}
|
|
940
1474
|
*/
|
|
941
|
-
delete: (layerId: string, auditMessage?: string) => Promise<
|
|
1475
|
+
delete: (layerId: string, auditMessage?: string) => Promise<void>;
|
|
942
1476
|
/**
|
|
943
1477
|
* Rename a layer.
|
|
944
1478
|
* @param {string} layerId - The layer ID
|
|
945
1479
|
* @param {string} name - The new name
|
|
946
1480
|
* @param {string} [auditMessage] - Audit message for this write
|
|
1481
|
+
* @returns {Promise<LayerRecords[K]>}
|
|
947
1482
|
*/
|
|
948
|
-
update: (layerId: string, name: string, auditMessage?: string) => Promise<
|
|
1483
|
+
update: (layerId: string, name: string, auditMessage?: string) => Promise<SpanLayer>;
|
|
949
1484
|
/**
|
|
950
1485
|
* Move a layer one place in its display order.
|
|
951
1486
|
* @param {string} layerId - The layer ID
|
|
952
1487
|
* @param {string} direction - The direction ("up" or "down")
|
|
953
1488
|
* @param {string} [auditMessage] - Audit message for this write
|
|
1489
|
+
* @returns {Promise<void>}
|
|
954
1490
|
*/
|
|
955
|
-
shift: (layerId: string, direction: string, auditMessage?: string) => Promise<
|
|
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>;
|
|
956
1507
|
/**
|
|
957
1508
|
* Declare an app namespace's constraints on this layer, replacing that
|
|
958
1509
|
* namespace's list. Refused with 422 and the violations when the layer's
|
|
@@ -977,18 +1528,22 @@ export class PlaidClient {
|
|
|
977
1528
|
* @param {string} namespace - The declaring app's namespace
|
|
978
1529
|
* @param {string} [auditMessage] - Audit message for this write
|
|
979
1530
|
* @param {{expected?: Array<object>|null}} [options] - `expected`, as on setConstraints.
|
|
1531
|
+
* @returns {Promise<void>}
|
|
980
1532
|
*/
|
|
981
1533
|
deleteConstraints: (layerId: string, namespace: string, auditMessage?: string, options?: {
|
|
982
1534
|
expected?: Array<object> | null;
|
|
983
|
-
}) => Promise<
|
|
1535
|
+
}) => Promise<void>;
|
|
984
1536
|
/**
|
|
985
1537
|
* The violations the given constraints would meet in this layer's stored
|
|
986
1538
|
* data. Writes nothing.
|
|
987
1539
|
* @param {string} layerId - The layer ID
|
|
988
1540
|
* @param {LayerConstraint[]} constraints - The list to check
|
|
1541
|
+
* @param {{limit?: number}} [options] - `limit`: how many violations to list (default 100)
|
|
989
1542
|
* @returns {Promise<{violations: ConstraintViolation[], violationCount: number}>}
|
|
990
1543
|
*/
|
|
991
|
-
checkConstraints: (layerId: string, constraints: LayerConstraint[]
|
|
1544
|
+
checkConstraints: (layerId: string, constraints: LayerConstraint[], options?: {
|
|
1545
|
+
limit?: number;
|
|
1546
|
+
}) => Promise<{
|
|
992
1547
|
violations: ConstraintViolation[];
|
|
993
1548
|
violationCount: number;
|
|
994
1549
|
}>;
|
|
@@ -1024,22 +1579,27 @@ export class PlaidClient {
|
|
|
1024
1579
|
* @param {any} configValue - Configuration value to set
|
|
1025
1580
|
* @param {string} [auditMessage] - Audit message for this write
|
|
1026
1581
|
* @param {{expected?: any}} [options] - `expected`: the value read for this key (null or undefined when it
|
|
1027
|
-
* was absent). The write is then refused with a 409 when the stored value differs.
|
|
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>}
|
|
1028
1586
|
*/
|
|
1029
1587
|
setConfig: (id: string, namespace: string, configKey: string, configValue: any, auditMessage?: string, options?: {
|
|
1030
1588
|
expected?: any;
|
|
1031
|
-
}) => Promise<
|
|
1589
|
+
}) => Promise<void>;
|
|
1032
1590
|
/**
|
|
1033
1591
|
* Remove a configuration value.
|
|
1034
1592
|
* @param {string} id - The record's ID
|
|
1035
1593
|
* @param {string} namespace - The config namespace
|
|
1036
1594
|
* @param {string} configKey - The config key
|
|
1037
1595
|
* @param {string} [auditMessage] - Audit message for this write
|
|
1038
|
-
* @param {{expected?: any}} [options] - `expected`, as on setConfig.
|
|
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>}
|
|
1039
1599
|
*/
|
|
1040
1600
|
deleteConfig: (id: string, namespace: string, configKey: string, auditMessage?: string, options?: {
|
|
1041
1601
|
expected?: any;
|
|
1042
|
-
}) => Promise<
|
|
1602
|
+
}) => Promise<void>;
|
|
1043
1603
|
};
|
|
1044
1604
|
spans: {
|
|
1045
1605
|
/**
|
|
@@ -1047,28 +1607,32 @@ export class PlaidClient {
|
|
|
1047
1607
|
* @param {string} id - The entity's ID
|
|
1048
1608
|
* @param {object} body - The new metadata map
|
|
1049
1609
|
* @param {string} [auditMessage] - Audit message for this write
|
|
1610
|
+
* @returns {Promise<MetadataRecords[K]>}
|
|
1050
1611
|
*/
|
|
1051
|
-
setMetadata: (id: string, body: object, auditMessage?: string) => Promise<
|
|
1612
|
+
setMetadata: (id: string, body: object, auditMessage?: string) => Promise<Span>;
|
|
1052
1613
|
/**
|
|
1053
1614
|
* Remove all metadata from an entity.
|
|
1054
1615
|
* @param {string} id - The entity's ID
|
|
1055
1616
|
* @param {string} [auditMessage] - Audit message for this write
|
|
1617
|
+
* @returns {Promise<MetadataRecords[K]>}
|
|
1056
1618
|
*/
|
|
1057
|
-
deleteMetadata: (id: string, auditMessage?: string) => Promise<
|
|
1619
|
+
deleteMetadata: (id: string, auditMessage?: string) => Promise<Span>;
|
|
1058
1620
|
/**
|
|
1059
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.
|
|
1060
1622
|
* @param {string} id - The entity's ID
|
|
1061
1623
|
* @param {MetadataOp[]} body - The metadata ops
|
|
1062
1624
|
* @param {string} [auditMessage] - Audit message for this write
|
|
1625
|
+
* @returns {Promise<MetadataRecords[K]>}
|
|
1063
1626
|
*/
|
|
1064
|
-
patchMetadata: (id: string, body: MetadataOp[], auditMessage?: string) => Promise<
|
|
1627
|
+
patchMetadata: (id: string, body: MetadataOp[], auditMessage?: string) => Promise<Span>;
|
|
1065
1628
|
/**
|
|
1066
1629
|
* Replace tokens for a span.
|
|
1067
1630
|
* @param {string} spanId - The span ID
|
|
1068
1631
|
* @param {Array} tokens - The tokens
|
|
1069
1632
|
* @param {string} [auditMessage] - Audit message for this write
|
|
1633
|
+
* @returns {Promise<Span>}
|
|
1070
1634
|
*/
|
|
1071
|
-
setTokens: (spanId: string, tokens: any[], auditMessage?: string) => Promise<
|
|
1635
|
+
setTokens: (spanId: string, tokens: any[], auditMessage?: string) => Promise<Span>;
|
|
1072
1636
|
/**
|
|
1073
1637
|
* Create a new span. A span holds a primary atomic value and optional
|
|
1074
1638
|
* metadata, and must at all times be associated with one or more tokens.
|
|
@@ -1079,28 +1643,32 @@ export class PlaidClient {
|
|
|
1079
1643
|
* @param {string} [auditMessage] - Audit message for this write
|
|
1080
1644
|
* @param {object} [opts]
|
|
1081
1645
|
* @param {string} [opts.id] - The new entity's id, minted by the caller (see uuidv7)
|
|
1646
|
+
* @returns {Promise<Created>}
|
|
1082
1647
|
*/
|
|
1083
1648
|
create: (spanLayerId: string, tokens: any[], value: any, metadata?: any, auditMessage?: string, { id }?: {
|
|
1084
1649
|
id?: string;
|
|
1085
|
-
}) => Promise<
|
|
1650
|
+
}) => Promise<Created>;
|
|
1086
1651
|
/**
|
|
1087
1652
|
* Get a span by ID.
|
|
1088
1653
|
* @param {string} spanId - The span ID
|
|
1654
|
+
* @returns {Promise<Span>}
|
|
1089
1655
|
*/
|
|
1090
|
-
get: (spanId: string) => Promise<
|
|
1656
|
+
get: (spanId: string) => Promise<Span>;
|
|
1091
1657
|
/**
|
|
1092
1658
|
* Delete a span.
|
|
1093
1659
|
* @param {string} spanId - The span ID
|
|
1094
1660
|
* @param {string} [auditMessage] - Audit message for this write
|
|
1661
|
+
* @returns {Promise<void>}
|
|
1095
1662
|
*/
|
|
1096
|
-
delete: (spanId: string, auditMessage?: string) => Promise<
|
|
1663
|
+
delete: (spanId: string, auditMessage?: string) => Promise<void>;
|
|
1097
1664
|
/**
|
|
1098
1665
|
* Update a span's value.
|
|
1099
1666
|
* @param {string} spanId - The span ID
|
|
1100
1667
|
* @param {any} value - The value
|
|
1101
1668
|
* @param {string} [auditMessage] - Audit message for this write
|
|
1669
|
+
* @returns {Promise<Span>}
|
|
1102
1670
|
*/
|
|
1103
|
-
update: (spanId: string, value: any, auditMessage?: string) => Promise<
|
|
1671
|
+
update: (spanId: string, value: any, auditMessage?: string) => Promise<Span>;
|
|
1104
1672
|
/**
|
|
1105
1673
|
* Create multiple spans in a single operation.
|
|
1106
1674
|
* @param {Array} body - The request body
|
|
@@ -1181,26 +1749,32 @@ export class PlaidClient {
|
|
|
1181
1749
|
* @param {string} body - The request body
|
|
1182
1750
|
* @param {any} [metadata] - Metadata map. Omit to leave unset; pass null to send JSON null.
|
|
1183
1751
|
* @param {string} [auditMessage]
|
|
1184
|
-
* @param {{id?: string, tokenEdges?: number[]}} [options] - `id`: the
|
|
1185
|
-
* this client minted. `tokenEdges`: the code-point offsets where
|
|
1186
|
-
* this text begin and end. The body is stored composed, except a
|
|
1187
|
-
* falls inside, which stays as sent (see composeText).
|
|
1188
|
-
|
|
1189
|
-
|
|
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 }?: {
|
|
1190
1761
|
id?: string;
|
|
1191
1762
|
tokenEdges?: number[];
|
|
1192
|
-
|
|
1763
|
+
tokenizeLayer?: string;
|
|
1764
|
+
}) => Promise<Created>;
|
|
1193
1765
|
/**
|
|
1194
1766
|
* Get a text.
|
|
1195
1767
|
* @param {string} textId - The text ID
|
|
1768
|
+
* @returns {Promise<PlaidText>}
|
|
1196
1769
|
*/
|
|
1197
|
-
get: (textId: string) => Promise<
|
|
1770
|
+
get: (textId: string) => Promise<PlaidText>;
|
|
1198
1771
|
/**
|
|
1199
1772
|
* Delete a text and all dependent data.
|
|
1200
1773
|
* @param {string} textId - The text ID
|
|
1201
1774
|
* @param {string} [auditMessage] - Audit message for this write
|
|
1775
|
+
* @returns {Promise<void>}
|
|
1202
1776
|
*/
|
|
1203
|
-
delete: (textId: string, auditMessage?: string) => Promise<
|
|
1777
|
+
delete: (textId: string, auditMessage?: string) => Promise<void>;
|
|
1204
1778
|
/**
|
|
1205
1779
|
* Update a text's body. A diff is computed and token indices are updated
|
|
1206
1780
|
* so that tokens remain intact. Alternatively, `body` can be a list of
|
|
@@ -1219,12 +1793,19 @@ export class PlaidClient {
|
|
|
1219
1793
|
* @param {string} textId - The text ID
|
|
1220
1794
|
* @param {any} body - The request body
|
|
1221
1795
|
* @param {string} [auditMessage]
|
|
1222
|
-
*
|
|
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}>}
|
|
1223
1801
|
*/
|
|
1224
|
-
update: (textId: string, body: any, auditMessage?: string, { base, versioned }?: {
|
|
1802
|
+
update: (textId: string, body: any, auditMessage?: string, { base, versioned, tokenizeLayer }?: {
|
|
1225
1803
|
base?: string;
|
|
1226
1804
|
versioned?: boolean;
|
|
1227
|
-
|
|
1805
|
+
tokenizeLayer?: string;
|
|
1806
|
+
}) => Promise<PlaidText & {
|
|
1807
|
+
reshape: TextReshape;
|
|
1808
|
+
}>;
|
|
1228
1809
|
/**
|
|
1229
1810
|
* Change a text's body by the edits made at the caret: a list of edit
|
|
1230
1811
|
* directives as `update` takes them (code-point indices, applied in
|
|
@@ -1236,36 +1817,43 @@ export class PlaidClient {
|
|
|
1236
1817
|
* `base`, the digest of the body the edits were made on, the edit
|
|
1237
1818
|
* applies only to that body and is refused with 409 and `text-changed`
|
|
1238
1819
|
* otherwise, and strict mode does not stamp it unless `versioned` is
|
|
1239
|
-
* true. See composeTextEdits and gapsToOps.
|
|
1820
|
+
* true. `tokenizeLayer` is as `update` takes it. See composeTextEdits and gapsToOps.
|
|
1240
1821
|
* @param {string} textId - The text ID
|
|
1241
1822
|
* @param {Array<object>} edits - The edit directives
|
|
1242
1823
|
* @param {string} [auditMessage]
|
|
1243
|
-
* @param {{base?: string, versioned?: boolean}} [options]
|
|
1824
|
+
* @param {{base?: string, versioned?: boolean, tokenizeLayer?: string}} [options]
|
|
1825
|
+
* @returns {Promise<PlaidText & {reshape: TextReshape}>}
|
|
1244
1826
|
*/
|
|
1245
|
-
edit: (textId: string, edits: Array<object>, auditMessage?: string, { base, versioned }?: {
|
|
1827
|
+
edit: (textId: string, edits: Array<object>, auditMessage?: string, { base, versioned, tokenizeLayer }?: {
|
|
1246
1828
|
base?: string;
|
|
1247
1829
|
versioned?: boolean;
|
|
1248
|
-
|
|
1830
|
+
tokenizeLayer?: string;
|
|
1831
|
+
}) => Promise<PlaidText & {
|
|
1832
|
+
reshape: TextReshape;
|
|
1833
|
+
}>;
|
|
1249
1834
|
/**
|
|
1250
1835
|
* Replace all metadata of an entity. Keys left out of the new map are removed.
|
|
1251
1836
|
* @param {string} id - The entity's ID
|
|
1252
1837
|
* @param {object} body - The new metadata map
|
|
1253
1838
|
* @param {string} [auditMessage] - Audit message for this write
|
|
1839
|
+
* @returns {Promise<MetadataRecords[K]>}
|
|
1254
1840
|
*/
|
|
1255
|
-
setMetadata: (id: string, body: object, auditMessage?: string) => Promise<
|
|
1841
|
+
setMetadata: (id: string, body: object, auditMessage?: string) => Promise<PlaidText>;
|
|
1256
1842
|
/**
|
|
1257
1843
|
* Remove all metadata from an entity.
|
|
1258
1844
|
* @param {string} id - The entity's ID
|
|
1259
1845
|
* @param {string} [auditMessage] - Audit message for this write
|
|
1846
|
+
* @returns {Promise<MetadataRecords[K]>}
|
|
1260
1847
|
*/
|
|
1261
|
-
deleteMetadata: (id: string, auditMessage?: string) => Promise<
|
|
1848
|
+
deleteMetadata: (id: string, auditMessage?: string) => Promise<PlaidText>;
|
|
1262
1849
|
/**
|
|
1263
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.
|
|
1264
1851
|
* @param {string} id - The entity's ID
|
|
1265
1852
|
* @param {MetadataOp[]} body - The metadata ops
|
|
1266
1853
|
* @param {string} [auditMessage] - Audit message for this write
|
|
1854
|
+
* @returns {Promise<MetadataRecords[K]>}
|
|
1267
1855
|
*/
|
|
1268
|
-
patchMetadata: (id: string, body: MetadataOp[], auditMessage?: string) => Promise<
|
|
1856
|
+
patchMetadata: (id: string, body: MetadataOp[], auditMessage?: string) => Promise<PlaidText>;
|
|
1269
1857
|
};
|
|
1270
1858
|
users: {
|
|
1271
1859
|
/**
|
|
@@ -1273,37 +1861,35 @@ export class PlaidClient {
|
|
|
1273
1861
|
* returns the full flat array. Admin-or-maintainer only.
|
|
1274
1862
|
* @param {object} [opts]
|
|
1275
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[]>}
|
|
1276
1865
|
*/
|
|
1277
1866
|
list: ({ q }?: {
|
|
1278
1867
|
q?: string;
|
|
1279
|
-
}) => Promise<
|
|
1868
|
+
}) => Promise<User[]>;
|
|
1280
1869
|
/**
|
|
1281
1870
|
* Fetch a single page of users (optionally filtered by `q`).
|
|
1282
1871
|
* @param {object} [opts]
|
|
1283
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
|
|
1284
1873
|
* @param {number} [opts.limit] - Page size (1..1000; server default 100)
|
|
1285
1874
|
* @param {string} [opts.cursor] - Opaque cursor from a previous page
|
|
1286
|
-
* @returns {Promise<
|
|
1875
|
+
* @returns {Promise<Page<User>>}
|
|
1287
1876
|
*/
|
|
1288
1877
|
listPage: ({ q, limit, cursor }?: {
|
|
1289
1878
|
q?: string;
|
|
1290
1879
|
limit?: number;
|
|
1291
1880
|
cursor?: string;
|
|
1292
|
-
}) => Promise<
|
|
1293
|
-
entries: any[];
|
|
1294
|
-
nextCursor: (string | null);
|
|
1295
|
-
}>;
|
|
1881
|
+
}) => Promise<Page<User>>;
|
|
1296
1882
|
/**
|
|
1297
1883
|
* Async-iterate users page by page; yields each page's entries array.
|
|
1298
1884
|
* @param {object} [opts]
|
|
1299
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
|
|
1300
1886
|
* @param {number} [opts.pageSize] - Per-request page size
|
|
1301
|
-
* @returns {AsyncGenerator<
|
|
1887
|
+
* @returns {AsyncGenerator<User[]>}
|
|
1302
1888
|
*/
|
|
1303
1889
|
iterPages: ({ q, pageSize }?: {
|
|
1304
1890
|
q?: string;
|
|
1305
1891
|
pageSize?: number;
|
|
1306
|
-
}) => AsyncGenerator<
|
|
1892
|
+
}) => AsyncGenerator<User[]>;
|
|
1307
1893
|
/**
|
|
1308
1894
|
* Create a new user. Admin only, and not with a named API token (403):
|
|
1309
1895
|
* it needs a sign-in token.
|
|
@@ -1314,8 +1900,9 @@ export class PlaidClient {
|
|
|
1314
1900
|
* @param {string} [displayName] - How the user is shown in the UI.
|
|
1315
1901
|
* Defaults to the local part of the email.
|
|
1316
1902
|
* @param {string} [auditMessage] - Audit message for this write
|
|
1903
|
+
* @returns {Promise<Created>}
|
|
1317
1904
|
*/
|
|
1318
|
-
create: (email: string, password: string, isAdmin: boolean, displayName?: string, auditMessage?: string) => Promise<
|
|
1905
|
+
create: (email: string, password: string, isAdmin: boolean, displayName?: string, auditMessage?: string) => Promise<Created>;
|
|
1319
1906
|
/**
|
|
1320
1907
|
* Get audit log for a user's actions. Transparently follows pagination
|
|
1321
1908
|
* cursors and returns the full flat array.
|
|
@@ -1328,8 +1915,9 @@ export class PlaidClient {
|
|
|
1328
1915
|
* one of its operations matches, carrying only the ones that did.
|
|
1329
1916
|
* @param {string[]|string} [kinds] - Only the entries of operations of
|
|
1330
1917
|
* these kinds (e.g. `['review', 'guess-adoption']`), each whole
|
|
1918
|
+
* @returns {Promise<AuditEntry[]>}
|
|
1331
1919
|
*/
|
|
1332
|
-
audit: (userId: string, startTime?: string, endTime?: string, opTypes?: string[] | string, kinds?: string[] | string) => Promise<
|
|
1920
|
+
audit: (userId: string, startTime?: string, endTime?: string, opTypes?: string[] | string, kinds?: string[] | string) => Promise<AuditEntry[]>;
|
|
1333
1921
|
/**
|
|
1334
1922
|
* One page of the same log, newest-first with `order: "desc"`. Use this
|
|
1335
1923
|
* rather than audit() wherever the caller wants the recent end of a log
|
|
@@ -1347,7 +1935,7 @@ export class PlaidClient {
|
|
|
1347
1935
|
* operations in `ops` (1..1000). `opCount` on every entry says how
|
|
1348
1936
|
* many it has
|
|
1349
1937
|
* @param {string} [opts.entryId] - Read only this entry, not a page
|
|
1350
|
-
* @returns {Promise<
|
|
1938
|
+
* @returns {Promise<Page<AuditEntry>>}
|
|
1351
1939
|
*/
|
|
1352
1940
|
auditPage: (userId: string, { startTime, endTime, opTypes, kinds, order, limit, cursor, opsLimit, entryId }?: {
|
|
1353
1941
|
startTime?: string;
|
|
@@ -1359,15 +1947,13 @@ export class PlaidClient {
|
|
|
1359
1947
|
cursor?: string;
|
|
1360
1948
|
opsLimit?: number;
|
|
1361
1949
|
entryId?: string;
|
|
1362
|
-
}) => Promise<
|
|
1363
|
-
entries: any[];
|
|
1364
|
-
nextCursor: (string | null);
|
|
1365
|
-
}>;
|
|
1950
|
+
}) => Promise<Page<AuditEntry>>;
|
|
1366
1951
|
/**
|
|
1367
1952
|
* Get a user by ID
|
|
1368
1953
|
* @param {string} id - The resource ID
|
|
1954
|
+
* @returns {Promise<User>}
|
|
1369
1955
|
*/
|
|
1370
|
-
get: (id: string) => Promise<
|
|
1956
|
+
get: (id: string) => Promise<User>;
|
|
1371
1957
|
/**
|
|
1372
1958
|
* Deactivate a user. Users are never hard-deleted: deactivation
|
|
1373
1959
|
* rejects their logins and tokens, strips their project memberships
|
|
@@ -1376,16 +1962,18 @@ export class PlaidClient {
|
|
|
1376
1962
|
* Reversible via activate(), which restores login only.
|
|
1377
1963
|
* @param {string} id - The resource ID
|
|
1378
1964
|
* @param {string} [auditMessage] - Audit message for this write
|
|
1965
|
+
* @returns {Promise<void>}
|
|
1379
1966
|
*/
|
|
1380
|
-
delete: (id: string, auditMessage?: string) => Promise<
|
|
1967
|
+
delete: (id: string, auditMessage?: string) => Promise<void>;
|
|
1381
1968
|
/**
|
|
1382
1969
|
* Reactivate a deactivated user, restoring their ability to log in.
|
|
1383
1970
|
* Project memberships, vocab maintainerships, and API tokens removed
|
|
1384
1971
|
* at deactivation are NOT restored — re-grant them deliberately.
|
|
1385
1972
|
* @param {string} id - The resource ID
|
|
1386
1973
|
* @param {string} [auditMessage] - Audit message for this write
|
|
1974
|
+
* @returns {Promise<User>}
|
|
1387
1975
|
*/
|
|
1388
|
-
activate: (id: string, auditMessage?: string) => Promise<
|
|
1976
|
+
activate: (id: string, auditMessage?: string) => Promise<User>;
|
|
1389
1977
|
/**
|
|
1390
1978
|
* Modify a user. Admins may change the display name, password, and admin
|
|
1391
1979
|
* status of any user. All other users may only modify their own display
|
|
@@ -1399,8 +1987,9 @@ export class PlaidClient {
|
|
|
1399
1987
|
* @param {string} [displayName] - New display name
|
|
1400
1988
|
* @param {boolean} [isAdmin] - New admin status
|
|
1401
1989
|
* @param {string} [auditMessage] - Audit message for this write
|
|
1990
|
+
* @returns {Promise<User>}
|
|
1402
1991
|
*/
|
|
1403
|
-
update: (id: string, password?: string, displayName?: string, isAdmin?: boolean, auditMessage?: string) => Promise<
|
|
1992
|
+
update: (id: string, password?: string, displayName?: string, isAdmin?: boolean, auditMessage?: string) => Promise<User>;
|
|
1404
1993
|
/**
|
|
1405
1994
|
* A token that shows any user's profile picture without an
|
|
1406
1995
|
* Authorization header, for an `<img>`, which cannot send one. Resolves
|
|
@@ -1449,8 +2038,9 @@ export class PlaidClient {
|
|
|
1449
2038
|
* Fetch a user's profile picture as raw bytes. Most callers want
|
|
1450
2039
|
* avatarUrl() instead. This one is for non-browser consumers.
|
|
1451
2040
|
* @param {string} id - The user ID
|
|
2041
|
+
* @returns {Promise<ArrayBuffer>}
|
|
1452
2042
|
*/
|
|
1453
|
-
getAvatar: (id: string) => Promise<
|
|
2043
|
+
getAvatar: (id: string) => Promise<ArrayBuffer>;
|
|
1454
2044
|
/**
|
|
1455
2045
|
* Upload a profile picture. Your own, or anyone's if you are an admin.
|
|
1456
2046
|
* The server center-crops to a square, scales to the configured edge
|
|
@@ -1459,14 +2049,16 @@ export class PlaidClient {
|
|
|
1459
2049
|
* @param {string} id - The user ID
|
|
1460
2050
|
* @param {File} file - The image to upload
|
|
1461
2051
|
* @param {string} [auditMessage] - Audit message for this write
|
|
2052
|
+
* @returns {Promise<User>}
|
|
1462
2053
|
*/
|
|
1463
|
-
setAvatar: (id: string, file: File, auditMessage?: string) => Promise<
|
|
2054
|
+
setAvatar: (id: string, file: File, auditMessage?: string) => Promise<User>;
|
|
1464
2055
|
/**
|
|
1465
2056
|
* Remove a profile picture. Your own, or anyone's if you are an admin.
|
|
1466
2057
|
* @param {string} id - The user ID
|
|
1467
2058
|
* @param {string} [auditMessage] - Audit message for this write
|
|
2059
|
+
* @returns {Promise<void>}
|
|
1468
2060
|
*/
|
|
1469
|
-
deleteAvatar: (id: string, auditMessage?: string) => Promise<
|
|
2061
|
+
deleteAvatar: (id: string, auditMessage?: string) => Promise<void>;
|
|
1470
2062
|
};
|
|
1471
2063
|
userData: {
|
|
1472
2064
|
/**
|
|
@@ -1579,8 +2171,9 @@ export class PlaidClient {
|
|
|
1579
2171
|
* Delete one private data entry; 404 if absent.
|
|
1580
2172
|
* @param {string} userId
|
|
1581
2173
|
* @param {string} key
|
|
2174
|
+
* @returns {Promise<void>}
|
|
1582
2175
|
*/
|
|
1583
|
-
delete: (userId: string, key: string) => Promise<
|
|
2176
|
+
delete: (userId: string, key: string) => Promise<void>;
|
|
1584
2177
|
};
|
|
1585
2178
|
apiTokens: {
|
|
1586
2179
|
/**
|
|
@@ -1588,34 +2181,32 @@ export class PlaidClient {
|
|
|
1588
2181
|
* string itself — that is only returned once, by create().
|
|
1589
2182
|
* Transparently follows pagination cursors and returns the full flat array.
|
|
1590
2183
|
* @param {string} userId - The user ID who owns the tokens
|
|
2184
|
+
* @returns {Promise<ApiToken[]>}
|
|
1591
2185
|
*/
|
|
1592
|
-
list: (userId: string) => Promise<
|
|
2186
|
+
list: (userId: string) => Promise<ApiToken[]>;
|
|
1593
2187
|
/**
|
|
1594
2188
|
* Fetch a single page of a user's named API tokens.
|
|
1595
2189
|
* @param {string} userId - The user ID who owns the tokens
|
|
1596
2190
|
* @param {object} [opts]
|
|
1597
2191
|
* @param {number} [opts.limit] - Page size (1..1000; server default 100)
|
|
1598
2192
|
* @param {string} [opts.cursor] - Opaque cursor from a previous page
|
|
1599
|
-
* @returns {Promise<
|
|
2193
|
+
* @returns {Promise<Page<ApiToken>>}
|
|
1600
2194
|
*/
|
|
1601
2195
|
listPage: (userId: string, { limit, cursor }?: {
|
|
1602
2196
|
limit?: number;
|
|
1603
2197
|
cursor?: string;
|
|
1604
|
-
}) => Promise<
|
|
1605
|
-
entries: any[];
|
|
1606
|
-
nextCursor: (string | null);
|
|
1607
|
-
}>;
|
|
2198
|
+
}) => Promise<Page<ApiToken>>;
|
|
1608
2199
|
/**
|
|
1609
2200
|
* Async-iterate a user's named API tokens page by page; yields each
|
|
1610
2201
|
* page's entries array.
|
|
1611
2202
|
* @param {string} userId - The user ID who owns the tokens
|
|
1612
2203
|
* @param {object} [opts]
|
|
1613
2204
|
* @param {number} [opts.pageSize] - Per-request page size
|
|
1614
|
-
* @returns {AsyncGenerator<
|
|
2205
|
+
* @returns {AsyncGenerator<ApiToken[]>}
|
|
1615
2206
|
*/
|
|
1616
2207
|
iterPages: (userId: string, { pageSize }?: {
|
|
1617
2208
|
pageSize?: number;
|
|
1618
|
-
}) => AsyncGenerator<
|
|
2209
|
+
}) => AsyncGenerator<ApiToken[]>;
|
|
1619
2210
|
/**
|
|
1620
2211
|
* Mint a named API token for a user. The returned `token` is the signed
|
|
1621
2212
|
* credential and is shown ONLY here — store it immediately. API tokens
|
|
@@ -1639,8 +2230,9 @@ export class PlaidClient {
|
|
|
1639
2230
|
* @param {string} userId - The user ID who owns the token
|
|
1640
2231
|
* @param {string} tokenId - The token ID to revoke
|
|
1641
2232
|
* @param {string} [auditMessage] - Audit message for this write
|
|
2233
|
+
* @returns {Promise<void>}
|
|
1642
2234
|
*/
|
|
1643
|
-
revoke: (userId: string, tokenId: string, auditMessage?: string) => Promise<
|
|
2235
|
+
revoke: (userId: string, tokenId: string, auditMessage?: string) => Promise<void>;
|
|
1644
2236
|
};
|
|
1645
2237
|
invites: {
|
|
1646
2238
|
/**
|
|
@@ -1731,8 +2323,9 @@ export class PlaidClient {
|
|
|
1731
2323
|
* the creator, an admin, or a maintainer of the invite's project.
|
|
1732
2324
|
* @param {string} id - The invite ID
|
|
1733
2325
|
* @param {string} [auditMessage] - Audit message for this write
|
|
2326
|
+
* @returns {Promise<void>}
|
|
1734
2327
|
*/
|
|
1735
|
-
revoke: (id: string, auditMessage?: string) => Promise<
|
|
2328
|
+
revoke: (id: string, auditMessage?: string) => Promise<void>;
|
|
1736
2329
|
};
|
|
1737
2330
|
admin: {
|
|
1738
2331
|
/**
|
|
@@ -1902,13 +2495,14 @@ export class PlaidClient {
|
|
|
1902
2495
|
* matches, carrying only the ones that did.
|
|
1903
2496
|
* @param {string[]|string} [opts.kinds] - Only the entries of operations
|
|
1904
2497
|
* of these kinds (e.g. `['review']`), each whole
|
|
2498
|
+
* @returns {Promise<AuditEntry[]>}
|
|
1905
2499
|
*/
|
|
1906
2500
|
list: ({ startTime, endTime, opTypes, kinds }?: {
|
|
1907
2501
|
startTime?: string;
|
|
1908
2502
|
endTime?: string;
|
|
1909
2503
|
opTypes?: string[] | string;
|
|
1910
2504
|
kinds?: string[] | string;
|
|
1911
|
-
}) => Promise<
|
|
2505
|
+
}) => Promise<AuditEntry[]>;
|
|
1912
2506
|
/**
|
|
1913
2507
|
* Fetch a single page of the instance-wide audit log. Admin only.
|
|
1914
2508
|
* @param {object} [opts]
|
|
@@ -1924,7 +2518,7 @@ export class PlaidClient {
|
|
|
1924
2518
|
* operations in `ops` (1..1000). `opCount` on every entry says how
|
|
1925
2519
|
* many it has
|
|
1926
2520
|
* @param {string} [opts.entryId] - Read only this entry, not a page
|
|
1927
|
-
* @returns {Promise<
|
|
2521
|
+
* @returns {Promise<Page<AuditEntry>>}
|
|
1928
2522
|
*/
|
|
1929
2523
|
listPage: ({ startTime, endTime, opTypes, kinds, order, limit, cursor, opsLimit, entryId }?: {
|
|
1930
2524
|
startTime?: string;
|
|
@@ -1936,10 +2530,7 @@ export class PlaidClient {
|
|
|
1936
2530
|
cursor?: string;
|
|
1937
2531
|
opsLimit?: number;
|
|
1938
2532
|
entryId?: string;
|
|
1939
|
-
}) => Promise<
|
|
1940
|
-
entries: any[];
|
|
1941
|
-
nextCursor: (string | null);
|
|
1942
|
-
}>;
|
|
2533
|
+
}) => Promise<Page<AuditEntry>>;
|
|
1943
2534
|
/**
|
|
1944
2535
|
* Async-iterate the instance-wide audit log page by page. Admin only.
|
|
1945
2536
|
* @param {object} [opts]
|
|
@@ -1948,7 +2539,7 @@ export class PlaidClient {
|
|
|
1948
2539
|
* @param {string[]|string} [opts.opTypes] - Only these op types
|
|
1949
2540
|
* @param {OperationKind[]|string} [opts.kinds] - Only the entries of operations of these kinds, each whole
|
|
1950
2541
|
* @param {number} [opts.pageSize] - Per-request page size
|
|
1951
|
-
* @returns {AsyncGenerator<
|
|
2542
|
+
* @returns {AsyncGenerator<AuditEntry[]>}
|
|
1952
2543
|
*/
|
|
1953
2544
|
iterPages: ({ startTime, endTime, opTypes, kinds, pageSize }?: {
|
|
1954
2545
|
startTime?: string;
|
|
@@ -1956,7 +2547,7 @@ export class PlaidClient {
|
|
|
1956
2547
|
opTypes?: string[] | string;
|
|
1957
2548
|
kinds?: OperationKind[] | string;
|
|
1958
2549
|
pageSize?: number;
|
|
1959
|
-
}) => AsyncGenerator<
|
|
2550
|
+
}) => AsyncGenerator<AuditEntry[]>;
|
|
1960
2551
|
/**
|
|
1961
2552
|
* Per-user activity counts. `changes` is the number of logical actions,
|
|
1962
2553
|
* folded the way the audit feed folds them, so one "Confirm word
|
|
@@ -2007,18 +2598,22 @@ export class PlaidClient {
|
|
|
2007
2598
|
* @param {string} namespace - The declaring app's namespace
|
|
2008
2599
|
* @param {string} [auditMessage] - Audit message for this write
|
|
2009
2600
|
* @param {{expected?: Array<object>|null}} [options] - `expected`, as on setConstraints.
|
|
2601
|
+
* @returns {Promise<void>}
|
|
2010
2602
|
*/
|
|
2011
2603
|
deleteConstraints: (layerId: string, namespace: string, auditMessage?: string, options?: {
|
|
2012
2604
|
expected?: Array<object> | null;
|
|
2013
|
-
}) => Promise<
|
|
2605
|
+
}) => Promise<void>;
|
|
2014
2606
|
/**
|
|
2015
2607
|
* The violations the given constraints would meet in this layer's stored
|
|
2016
2608
|
* data. Writes nothing.
|
|
2017
2609
|
* @param {string} layerId - The layer ID
|
|
2018
2610
|
* @param {LayerConstraint[]} constraints - The list to check
|
|
2611
|
+
* @param {{limit?: number}} [options] - `limit`: how many violations to list (default 100)
|
|
2019
2612
|
* @returns {Promise<{violations: ConstraintViolation[], violationCount: number}>}
|
|
2020
2613
|
*/
|
|
2021
|
-
checkConstraints: (layerId: string, constraints: LayerConstraint[]
|
|
2614
|
+
checkConstraints: (layerId: string, constraints: LayerConstraint[], options?: {
|
|
2615
|
+
limit?: number;
|
|
2616
|
+
}) => Promise<{
|
|
2022
2617
|
violations: ConstraintViolation[];
|
|
2023
2618
|
violationCount: number;
|
|
2024
2619
|
}>;
|
|
@@ -2054,22 +2649,44 @@ export class PlaidClient {
|
|
|
2054
2649
|
* @param {any} configValue - Configuration value to set
|
|
2055
2650
|
* @param {string} [auditMessage] - Audit message for this write
|
|
2056
2651
|
* @param {{expected?: any}} [options] - `expected`: the value read for this key (null or undefined when it
|
|
2057
|
-
* was absent). The write is then refused with a 409 when the stored value differs.
|
|
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>}
|
|
2058
2656
|
*/
|
|
2059
2657
|
setConfig: (id: string, namespace: string, configKey: string, configValue: any, auditMessage?: string, options?: {
|
|
2060
2658
|
expected?: any;
|
|
2061
|
-
}) => Promise<
|
|
2659
|
+
}) => Promise<void>;
|
|
2062
2660
|
/**
|
|
2063
2661
|
* Remove a configuration value.
|
|
2064
2662
|
* @param {string} id - The record's ID
|
|
2065
2663
|
* @param {string} namespace - The config namespace
|
|
2066
2664
|
* @param {string} configKey - The config key
|
|
2067
2665
|
* @param {string} [auditMessage] - Audit message for this write
|
|
2068
|
-
* @param {{expected?: any}} [options] - `expected`, as on setConfig.
|
|
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>}
|
|
2069
2669
|
*/
|
|
2070
2670
|
deleteConfig: (id: string, namespace: string, configKey: string, auditMessage?: string, options?: {
|
|
2071
2671
|
expected?: any;
|
|
2072
|
-
}) => Promise<
|
|
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
|
+
}>;
|
|
2073
2690
|
/**
|
|
2074
2691
|
* Create a new token layer.
|
|
2075
2692
|
* @param {string} textLayerId - The text layer ID
|
|
@@ -2079,35 +2696,40 @@ export class PlaidClient {
|
|
|
2079
2696
|
* @param {string} [auditMessage] - Audit message for this write
|
|
2080
2697
|
* @param {object} [opts]
|
|
2081
2698
|
* @param {string} [opts.id] - The new entity's id, minted by the caller (see uuidv7)
|
|
2699
|
+
* @returns {Promise<Created>}
|
|
2082
2700
|
*/
|
|
2083
2701
|
create: (textLayerId: string, name: string, overlapMode?: string, parentTokenLayerId?: string, auditMessage?: string, { id }?: {
|
|
2084
2702
|
id?: string;
|
|
2085
|
-
}) => Promise<
|
|
2703
|
+
}) => Promise<Created>;
|
|
2086
2704
|
/**
|
|
2087
2705
|
* Get a layer by ID.
|
|
2088
2706
|
* @param {string} layerId - The layer ID
|
|
2707
|
+
* @returns {Promise<LayerRecords[K]>}
|
|
2089
2708
|
*/
|
|
2090
|
-
get: (layerId: string) => Promise<
|
|
2709
|
+
get: (layerId: string) => Promise<TokenLayer>;
|
|
2091
2710
|
/**
|
|
2092
2711
|
* Delete a layer.
|
|
2093
2712
|
* @param {string} layerId - The layer ID
|
|
2094
2713
|
* @param {string} [auditMessage] - Audit message for this write
|
|
2714
|
+
* @returns {Promise<void>}
|
|
2095
2715
|
*/
|
|
2096
|
-
delete: (layerId: string, auditMessage?: string) => Promise<
|
|
2716
|
+
delete: (layerId: string, auditMessage?: string) => Promise<void>;
|
|
2097
2717
|
/**
|
|
2098
2718
|
* Rename a layer.
|
|
2099
2719
|
* @param {string} layerId - The layer ID
|
|
2100
2720
|
* @param {string} name - The new name
|
|
2101
2721
|
* @param {string} [auditMessage] - Audit message for this write
|
|
2722
|
+
* @returns {Promise<LayerRecords[K]>}
|
|
2102
2723
|
*/
|
|
2103
|
-
update: (layerId: string, name: string, auditMessage?: string) => Promise<
|
|
2724
|
+
update: (layerId: string, name: string, auditMessage?: string) => Promise<TokenLayer>;
|
|
2104
2725
|
/**
|
|
2105
2726
|
* Move a layer one place in its display order.
|
|
2106
2727
|
* @param {string} layerId - The layer ID
|
|
2107
2728
|
* @param {string} direction - The direction ("up" or "down")
|
|
2108
2729
|
* @param {string} [auditMessage] - Audit message for this write
|
|
2730
|
+
* @returns {Promise<void>}
|
|
2109
2731
|
*/
|
|
2110
|
-
shift: (layerId: string, direction: string, auditMessage?: string) => Promise<
|
|
2732
|
+
shift: (layerId: string, direction: string, auditMessage?: string) => Promise<void>;
|
|
2111
2733
|
};
|
|
2112
2734
|
documents: {
|
|
2113
2735
|
/**
|
|
@@ -2126,8 +2748,9 @@ export class PlaidClient {
|
|
|
2126
2748
|
* one of its operations matches, carrying only the ones that did.
|
|
2127
2749
|
* @param {string[]|string} [kinds] - Only the entries of operations of
|
|
2128
2750
|
* these kinds (e.g. `['review', 'guess-adoption']`), each whole
|
|
2751
|
+
* @returns {Promise<AuditEntry[]>}
|
|
2129
2752
|
*/
|
|
2130
|
-
audit: (documentId: string, startTime?: string, endTime?: string, opTypes?: string[] | string, kinds?: string[] | string) => Promise<
|
|
2753
|
+
audit: (documentId: string, startTime?: string, endTime?: string, opTypes?: string[] | string, kinds?: string[] | string) => Promise<AuditEntry[]>;
|
|
2131
2754
|
/**
|
|
2132
2755
|
* One page of the same log, newest-first with `order: "desc"`. Use this
|
|
2133
2756
|
* rather than audit() wherever the caller wants the recent end of a log
|
|
@@ -2145,7 +2768,7 @@ export class PlaidClient {
|
|
|
2145
2768
|
* operations in `ops` (1..1000). `opCount` on every entry says how
|
|
2146
2769
|
* many it has
|
|
2147
2770
|
* @param {string} [opts.entryId] - Read only this entry, not a page
|
|
2148
|
-
* @returns {Promise<
|
|
2771
|
+
* @returns {Promise<Page<AuditEntry>>}
|
|
2149
2772
|
*/
|
|
2150
2773
|
auditPage: (documentId: string, { startTime, endTime, opTypes, kinds, order, limit, cursor, opsLimit, entryId }?: {
|
|
2151
2774
|
startTime?: string;
|
|
@@ -2157,16 +2780,15 @@ export class PlaidClient {
|
|
|
2157
2780
|
cursor?: string;
|
|
2158
2781
|
opsLimit?: number;
|
|
2159
2782
|
entryId?: string;
|
|
2160
|
-
}) => Promise<
|
|
2161
|
-
entries: any[];
|
|
2162
|
-
nextCursor: (string | null);
|
|
2163
|
-
}>;
|
|
2783
|
+
}) => Promise<Page<AuditEntry>>;
|
|
2164
2784
|
/**
|
|
2165
2785
|
* Restore a document to its state at an earlier time, as one
|
|
2166
2786
|
* operation: what was deleted since then comes back under its original
|
|
2167
2787
|
* id, what was added since is removed, and what changed is set back,
|
|
2168
2788
|
* across every layer. A layer deleted since then, or a vocabulary entry
|
|
2169
|
-
* that no longer exists, is skipped and reported under `skipped`.
|
|
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}`).
|
|
2170
2792
|
* Resolves to a summary of the changes. Maintainers only.
|
|
2171
2793
|
* @param {string} documentId - The document ID
|
|
2172
2794
|
* @param {string} asOf - The moment to go back to (ISO-8601 instant),
|
|
@@ -2174,13 +2796,18 @@ export class PlaidClient {
|
|
|
2174
2796
|
* @param {{dryRun?: boolean}} [options] - `{ dryRun }`: with `dryRun` true nothing
|
|
2175
2797
|
* is written and the summary says what would change
|
|
2176
2798
|
* @param {string} [auditMessage] - Custom audit message for this operation
|
|
2799
|
+
* @returns {Promise<DocumentRestoreSummary>}
|
|
2177
2800
|
*/
|
|
2178
2801
|
restore: (documentId: string, asOf: string, { dryRun }?: {
|
|
2179
2802
|
dryRun?: boolean;
|
|
2180
|
-
}, auditMessage?: string) => Promise<
|
|
2803
|
+
}, auditMessage?: string) => Promise<DocumentRestoreSummary>;
|
|
2181
2804
|
/**
|
|
2182
2805
|
* Get a document. Set `includeBody` to true to include all data.
|
|
2183
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
|
+
*
|
|
2184
2811
|
* `layers` narrows a body read to the layers you name (ids of any kind:
|
|
2185
2812
|
* text, token, span, or relation). A layer comes back when it is named
|
|
2186
2813
|
* or is an ancestor of a named layer, and carries its own
|
|
@@ -2192,21 +2819,26 @@ export class PlaidClient {
|
|
|
2192
2819
|
* @param {boolean} [includeBody] - Include document body data
|
|
2193
2820
|
* @param {string} [asOf] - Temporal query timestamp
|
|
2194
2821
|
* @param {string[]|string} [layers] - Layer ids to restrict a body read to
|
|
2822
|
+
* @returns {Promise<PlaidDocument>}
|
|
2195
2823
|
*/
|
|
2196
|
-
get: (documentId: string, includeBody?: boolean, asOf?: string, layers?: string[] | string) => Promise<
|
|
2824
|
+
get: (documentId: string, includeBody?: boolean, asOf?: string, layers?: string[] | string) => Promise<PlaidDocument>;
|
|
2197
2825
|
/**
|
|
2198
2826
|
* Delete a document and all data contained.
|
|
2199
2827
|
* @param {string} documentId - The document ID
|
|
2200
2828
|
* @param {string} [auditMessage] - Audit message for this write
|
|
2829
|
+
* @returns {Promise<void>}
|
|
2201
2830
|
*/
|
|
2202
|
-
delete: (documentId: string, auditMessage?: string) => Promise<
|
|
2831
|
+
delete: (documentId: string, auditMessage?: string) => Promise<void>;
|
|
2203
2832
|
/**
|
|
2204
|
-
* Update a document's name.
|
|
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`.
|
|
2205
2836
|
* @param {string} documentId - The document ID
|
|
2206
2837
|
* @param {string} name - The name
|
|
2207
2838
|
* @param {string} [auditMessage] - Audit message for this write
|
|
2839
|
+
* @returns {Promise<PlaidDocument>}
|
|
2208
2840
|
*/
|
|
2209
|
-
update: (documentId: string, name: string, auditMessage?: string) => Promise<
|
|
2841
|
+
update: (documentId: string, name: string, auditMessage?: string) => Promise<PlaidDocument>;
|
|
2210
2842
|
/**
|
|
2211
2843
|
* Create a new document in a project.
|
|
2212
2844
|
* @param {string} projectId - The project ID
|
|
@@ -2215,30 +2847,43 @@ export class PlaidClient {
|
|
|
2215
2847
|
* @param {string} [auditMessage] - Audit message for this write
|
|
2216
2848
|
* @param {object} [opts]
|
|
2217
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
|
|
2218
2854
|
*/
|
|
2219
|
-
create: (projectId: string, name: string, metadata?: any, auditMessage?: string, { id }?: {
|
|
2855
|
+
create: (projectId: string, name: string, metadata?: any, auditMessage?: string, { id, freeName }?: {
|
|
2220
2856
|
id?: string;
|
|
2221
|
-
|
|
2857
|
+
freeName?: boolean;
|
|
2858
|
+
}) => Promise<{
|
|
2859
|
+
id: string;
|
|
2860
|
+
name: string;
|
|
2861
|
+
}>;
|
|
2222
2862
|
/**
|
|
2223
2863
|
* Copy a document and everything in it into a new document of the same
|
|
2224
2864
|
* project, as one operation. The copy shares the source's layers and
|
|
2225
2865
|
* the vocabulary entries its links name, and holds the source's texts,
|
|
2226
2866
|
* tokens, spans, relations and vocab links under fresh ids, with their
|
|
2227
2867
|
* metadata. Comments do not travel. The media file does, unless
|
|
2228
|
-
* `includeMedia` is false. Resolves to `{ id }`, plus `mediaError` when
|
|
2229
|
-
* the source had media the copy could not take with it.
|
|
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.
|
|
2230
2873
|
* @param {string} documentId - The document to copy
|
|
2231
2874
|
* @param {string} name - The new document's name
|
|
2232
|
-
* @param {{includeMedia?: boolean, id?: string}} [options] - `{ includeMedia }`: false leaves the media
|
|
2875
|
+
* @param {{includeMedia?: boolean, id?: string, freeName?: boolean}} [options] - `{ includeMedia }`: false leaves the media
|
|
2233
2876
|
* file behind
|
|
2234
2877
|
* @param {string} [auditMessage] - Custom audit message for this operation
|
|
2235
|
-
* @returns {Promise<{id: string, mediaError?: string}>}
|
|
2878
|
+
* @returns {Promise<{id: string, name: string, mediaError?: string}>}
|
|
2236
2879
|
*/
|
|
2237
|
-
copy: (documentId: string, name: string, { includeMedia, id }?: {
|
|
2880
|
+
copy: (documentId: string, name: string, { includeMedia, id, freeName }?: {
|
|
2238
2881
|
includeMedia?: boolean;
|
|
2239
2882
|
id?: string;
|
|
2883
|
+
freeName?: boolean;
|
|
2240
2884
|
}, auditMessage?: string) => Promise<{
|
|
2241
2885
|
id: string;
|
|
2886
|
+
name: string;
|
|
2242
2887
|
mediaError?: string;
|
|
2243
2888
|
}>;
|
|
2244
2889
|
/**
|
|
@@ -2246,26 +2891,33 @@ export class PlaidClient {
|
|
|
2246
2891
|
* @param {string} id - The entity's ID
|
|
2247
2892
|
* @param {object} body - The new metadata map
|
|
2248
2893
|
* @param {string} [auditMessage] - Audit message for this write
|
|
2894
|
+
* @returns {Promise<MetadataRecords[K]>}
|
|
2249
2895
|
*/
|
|
2250
|
-
setMetadata: (id: string, body: object, auditMessage?: string) => Promise<
|
|
2896
|
+
setMetadata: (id: string, body: object, auditMessage?: string) => Promise<PlaidDocument>;
|
|
2251
2897
|
/**
|
|
2252
2898
|
* Remove all metadata from an entity.
|
|
2253
2899
|
* @param {string} id - The entity's ID
|
|
2254
2900
|
* @param {string} [auditMessage] - Audit message for this write
|
|
2901
|
+
* @returns {Promise<MetadataRecords[K]>}
|
|
2255
2902
|
*/
|
|
2256
|
-
deleteMetadata: (id: string, auditMessage?: string) => Promise<
|
|
2903
|
+
deleteMetadata: (id: string, auditMessage?: string) => Promise<PlaidDocument>;
|
|
2257
2904
|
/**
|
|
2258
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.
|
|
2259
2906
|
* @param {string} id - The entity's ID
|
|
2260
2907
|
* @param {MetadataOp[]} body - The metadata ops
|
|
2261
2908
|
* @param {string} [auditMessage] - Audit message for this write
|
|
2909
|
+
* @returns {Promise<MetadataRecords[K]>}
|
|
2262
2910
|
*/
|
|
2263
|
-
patchMetadata: (id: string, body: MetadataOp[], auditMessage?: string) => Promise<
|
|
2911
|
+
patchMetadata: (id: string, body: MetadataOp[], auditMessage?: string) => Promise<PlaidDocument>;
|
|
2264
2912
|
/**
|
|
2265
2913
|
* Check the lock status of a document.
|
|
2266
2914
|
* @param {string} documentId - The document ID
|
|
2915
|
+
* @returns {Promise<{userId: string, expiresAt: number} | void>}
|
|
2267
2916
|
*/
|
|
2268
|
-
checkLock: (documentId: string) => Promise<
|
|
2917
|
+
checkLock: (documentId: string) => Promise<{
|
|
2918
|
+
userId: string;
|
|
2919
|
+
expiresAt: number;
|
|
2920
|
+
} | void>;
|
|
2269
2921
|
/**
|
|
2270
2922
|
* Acquire a document lock as a new holder.
|
|
2271
2923
|
*
|
|
@@ -2287,8 +2939,9 @@ export class PlaidClient {
|
|
|
2287
2939
|
* @param {string} documentId - The document ID
|
|
2288
2940
|
* @param {string} [auditMessage]
|
|
2289
2941
|
* @param {string} [newLockId] - A holder id this client minted
|
|
2942
|
+
* @returns {Promise<LockGrant>}
|
|
2290
2943
|
*/
|
|
2291
|
-
acquireLock: (documentId: string, auditMessage?: string, newLockId?: string) => Promise<
|
|
2944
|
+
acquireLock: (documentId: string, auditMessage?: string, newLockId?: string) => Promise<LockGrant>;
|
|
2292
2945
|
/**
|
|
2293
2946
|
* Renew the lock `lockId` holds while it is live. HTTP 423 if another
|
|
2294
2947
|
* holder has it, and also once it has expired or been dropped, even when
|
|
@@ -2297,8 +2950,9 @@ export class PlaidClient {
|
|
|
2297
2950
|
* @param {string} documentId - The document ID
|
|
2298
2951
|
* @param {string} lockId - The `lockId` acquireLock answered with
|
|
2299
2952
|
* @param {string} [auditMessage] - Audit message for this write
|
|
2953
|
+
* @returns {Promise<LockGrant>}
|
|
2300
2954
|
*/
|
|
2301
|
-
renewLock: (documentId: string, lockId: string, auditMessage?: string) => Promise<
|
|
2955
|
+
renewLock: (documentId: string, lockId: string, auditMessage?: string) => Promise<LockGrant>;
|
|
2302
2956
|
/**
|
|
2303
2957
|
* Release the lock `lockId` holds. Idempotent: a lock that holder no
|
|
2304
2958
|
* longer has is left alone. outOfBand, for the same reason as
|
|
@@ -2307,8 +2961,9 @@ export class PlaidClient {
|
|
|
2307
2961
|
* @param {string} documentId - The document ID
|
|
2308
2962
|
* @param {string} lockId - The `lockId` acquireLock answered with
|
|
2309
2963
|
* @param {string} [auditMessage] - Audit message for this write
|
|
2964
|
+
* @returns {Promise<void>}
|
|
2310
2965
|
*/
|
|
2311
|
-
releaseLock: (documentId: string, lockId: string, auditMessage?: string) => Promise<
|
|
2966
|
+
releaseLock: (documentId: string, lockId: string, auditMessage?: string) => Promise<void>;
|
|
2312
2967
|
/**
|
|
2313
2968
|
* Hold this document's server-enforced lock for the length of `fn`,
|
|
2314
2969
|
* releasing it on the way out (including on error). Resolves to what
|
|
@@ -2345,6 +3000,12 @@ export class PlaidClient {
|
|
|
2345
3000
|
* lost lock is recorded on the CLIENT, like strict mode, so it stops
|
|
2346
3001
|
* every write the client makes (on any batch of it too) and not only the
|
|
2347
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.
|
|
2348
3009
|
* @template T
|
|
2349
3010
|
* @param {string} documentId - The document ID
|
|
2350
3011
|
* @param {(lock: import("./documentLock.js").DocumentLock) => T | Promise<T>} fn - The work to run while holding it
|
|
@@ -2391,13 +3052,18 @@ export class PlaidClient {
|
|
|
2391
3052
|
* @param {File} file - The file to upload
|
|
2392
3053
|
* @param {string} [auditMessage] - Custom audit-log message for this write
|
|
2393
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}>}
|
|
2394
3056
|
*/
|
|
2395
3057
|
uploadMedia: (documentId: string, file: File, auditMessage?: string, { onProgress }?: {
|
|
2396
3058
|
onProgress?: (progress: {
|
|
2397
3059
|
loaded: number;
|
|
2398
3060
|
total: number | null;
|
|
2399
3061
|
}) => void;
|
|
2400
|
-
}) => Promise<
|
|
3062
|
+
}) => Promise<{
|
|
3063
|
+
message: string;
|
|
3064
|
+
extension: string;
|
|
3065
|
+
contentType: string;
|
|
3066
|
+
}>;
|
|
2401
3067
|
/**
|
|
2402
3068
|
* Delete media file for a document
|
|
2403
3069
|
* @param {string} documentId - The document ID
|
|
@@ -2406,10 +3072,11 @@ export class PlaidClient {
|
|
|
2406
3072
|
* recording meant, the `?v=` of the document's `mediaUrl`. The delete
|
|
2407
3073
|
* is refused with a 409 (`media-changed`, and the current `media-url`)
|
|
2408
3074
|
* when the stored recording is another one.
|
|
3075
|
+
* @returns {Promise<void>}
|
|
2409
3076
|
*/
|
|
2410
3077
|
deleteMedia: (documentId: string, auditMessage?: string, { mediaVersion }?: {
|
|
2411
3078
|
mediaVersion?: string;
|
|
2412
|
-
}) => Promise<
|
|
3079
|
+
}) => Promise<void>;
|
|
2413
3080
|
};
|
|
2414
3081
|
projects: {
|
|
2415
3082
|
/**
|
|
@@ -2417,15 +3084,17 @@ export class PlaidClient {
|
|
|
2417
3084
|
* @param {string} id - The resource ID
|
|
2418
3085
|
* @param {string} userId - The user ID
|
|
2419
3086
|
* @param {string} [auditMessage] - Audit message for this write
|
|
3087
|
+
* @returns {Promise<void>}
|
|
2420
3088
|
*/
|
|
2421
|
-
addMaintainer: (id: string, userId: string, auditMessage?: string) => Promise<
|
|
3089
|
+
addMaintainer: (id: string, userId: string, auditMessage?: string) => Promise<void>;
|
|
2422
3090
|
/**
|
|
2423
3091
|
* Remove a user's maintainer privileges for this project.
|
|
2424
3092
|
* @param {string} id - The resource ID
|
|
2425
3093
|
* @param {string} userId - The user ID
|
|
2426
3094
|
* @param {string} [auditMessage] - Audit message for this write
|
|
3095
|
+
* @returns {Promise<void>}
|
|
2427
3096
|
*/
|
|
2428
|
-
removeMaintainer: (id: string, userId: string, auditMessage?: string) => Promise<
|
|
3097
|
+
removeMaintainer: (id: string, userId: string, auditMessage?: string) => Promise<void>;
|
|
2429
3098
|
/**
|
|
2430
3099
|
* Get audit log for a project. Transparently follows pagination cursors
|
|
2431
3100
|
* and returns the full flat array. Each entry, and each of its `ops`,
|
|
@@ -2442,8 +3111,9 @@ export class PlaidClient {
|
|
|
2442
3111
|
* one of its operations matches, carrying only the ones that did.
|
|
2443
3112
|
* @param {string[]|string} [kinds] - Only the entries of operations of
|
|
2444
3113
|
* these kinds (e.g. `['review', 'guess-adoption']`), each whole
|
|
3114
|
+
* @returns {Promise<AuditEntry[]>}
|
|
2445
3115
|
*/
|
|
2446
|
-
audit: (projectId: string, startTime?: string, endTime?: string, opTypes?: string[] | string, kinds?: string[] | string) => Promise<
|
|
3116
|
+
audit: (projectId: string, startTime?: string, endTime?: string, opTypes?: string[] | string, kinds?: string[] | string) => Promise<AuditEntry[]>;
|
|
2447
3117
|
/**
|
|
2448
3118
|
* One page of the same log, newest-first with `order: "desc"`. Use this
|
|
2449
3119
|
* rather than audit() wherever the caller wants the recent end of a log
|
|
@@ -2461,7 +3131,7 @@ export class PlaidClient {
|
|
|
2461
3131
|
* operations in `ops` (1..1000). `opCount` on every entry says how
|
|
2462
3132
|
* many it has
|
|
2463
3133
|
* @param {string} [opts.entryId] - Read only this entry, not a page
|
|
2464
|
-
* @returns {Promise<
|
|
3134
|
+
* @returns {Promise<Page<AuditEntry>>}
|
|
2465
3135
|
*/
|
|
2466
3136
|
auditPage: (projectId: string, { startTime, endTime, opTypes, kinds, order, limit, cursor, opsLimit, entryId }?: {
|
|
2467
3137
|
startTime?: string;
|
|
@@ -2473,10 +3143,7 @@ export class PlaidClient {
|
|
|
2473
3143
|
cursor?: string;
|
|
2474
3144
|
opsLimit?: number;
|
|
2475
3145
|
entryId?: string;
|
|
2476
|
-
}) => Promise<
|
|
2477
|
-
entries: any[];
|
|
2478
|
-
nextCursor: (string | null);
|
|
2479
|
-
}>;
|
|
3146
|
+
}) => Promise<Page<AuditEntry>>;
|
|
2480
3147
|
/**
|
|
2481
3148
|
* When the calling user last wrote to each document in a project, as a
|
|
2482
3149
|
* `{documentId: timestamp}` map. Documents they have never written to
|
|
@@ -2495,21 +3162,24 @@ export class PlaidClient {
|
|
|
2495
3162
|
* @param {string} id - The resource ID
|
|
2496
3163
|
* @param {string} vocabId - The vocab layer ID
|
|
2497
3164
|
* @param {string} [auditMessage] - Audit message for this write
|
|
3165
|
+
* @returns {Promise<void>}
|
|
2498
3166
|
*/
|
|
2499
|
-
linkVocab: (id: string, vocabId: string, auditMessage?: string) => Promise<
|
|
3167
|
+
linkVocab: (id: string, vocabId: string, auditMessage?: string) => Promise<void>;
|
|
2500
3168
|
/**
|
|
2501
3169
|
* Unlink a vocabulary from a project.
|
|
2502
3170
|
* @param {string} id - The resource ID
|
|
2503
3171
|
* @param {string} vocabId - The vocab layer ID
|
|
2504
3172
|
* @param {string} [auditMessage] - Audit message for this write
|
|
3173
|
+
* @returns {Promise<void>}
|
|
2505
3174
|
*/
|
|
2506
|
-
unlinkVocab: (id: string, vocabId: string, auditMessage?: string) => Promise<
|
|
3175
|
+
unlinkVocab: (id: string, vocabId: string, auditMessage?: string) => Promise<void>;
|
|
2507
3176
|
/**
|
|
2508
3177
|
* Get a project by ID. To fetch the project's documents, use
|
|
2509
3178
|
* listDocuments(id) — the include-documents flag has been removed.
|
|
2510
3179
|
* @param {string} id - The resource ID
|
|
3180
|
+
* @returns {Promise<Project>}
|
|
2511
3181
|
*/
|
|
2512
|
-
get: (id: string) => Promise<
|
|
3182
|
+
get: (id: string) => Promise<Project>;
|
|
2513
3183
|
/**
|
|
2514
3184
|
* List all documents in a project. Transparently follows pagination
|
|
2515
3185
|
* cursors and returns the full flat array.
|
|
@@ -2517,8 +3187,9 @@ export class PlaidClient {
|
|
|
2517
3187
|
* Note: this endpoint does not support temporal (`as-of`) queries; the
|
|
2518
3188
|
* server rejects `?as-of=` on the documents-list route with a 400.
|
|
2519
3189
|
* @param {string} id - The project ID
|
|
3190
|
+
* @returns {Promise<DocumentListEntry[]>}
|
|
2520
3191
|
*/
|
|
2521
|
-
listDocuments: (id: string) => Promise<
|
|
3192
|
+
listDocuments: (id: string) => Promise<DocumentListEntry[]>;
|
|
2522
3193
|
/**
|
|
2523
3194
|
* Fetch a single page of a project's documents.
|
|
2524
3195
|
*
|
|
@@ -2528,15 +3199,12 @@ export class PlaidClient {
|
|
|
2528
3199
|
* @param {object} [opts]
|
|
2529
3200
|
* @param {number} [opts.limit] - Page size (1..1000; server default 100)
|
|
2530
3201
|
* @param {string} [opts.cursor] - Opaque cursor from a previous page
|
|
2531
|
-
* @returns {Promise<
|
|
3202
|
+
* @returns {Promise<Page<DocumentListEntry>>}
|
|
2532
3203
|
*/
|
|
2533
3204
|
listDocumentsPage: (id: string, { limit, cursor }?: {
|
|
2534
3205
|
limit?: number;
|
|
2535
3206
|
cursor?: string;
|
|
2536
|
-
}) => Promise<
|
|
2537
|
-
entries: any[];
|
|
2538
|
-
nextCursor: (string | null);
|
|
2539
|
-
}>;
|
|
3207
|
+
}) => Promise<Page<DocumentListEntry>>;
|
|
2540
3208
|
/**
|
|
2541
3209
|
* Async-iterate a project's documents page by page; yields each page's
|
|
2542
3210
|
* entries array.
|
|
@@ -2546,11 +3214,11 @@ export class PlaidClient {
|
|
|
2546
3214
|
* @param {string} id - The project ID
|
|
2547
3215
|
* @param {object} [opts]
|
|
2548
3216
|
* @param {number} [opts.pageSize] - Per-request page size
|
|
2549
|
-
* @returns {AsyncGenerator<
|
|
3217
|
+
* @returns {AsyncGenerator<DocumentListEntry[]>}
|
|
2550
3218
|
*/
|
|
2551
3219
|
iterDocuments: (id: string, { pageSize }?: {
|
|
2552
3220
|
pageSize?: number;
|
|
2553
|
-
}) => AsyncGenerator<
|
|
3221
|
+
}) => AsyncGenerator<DocumentListEntry[]>;
|
|
2554
3222
|
/**
|
|
2555
3223
|
* Delete a project and everything in it. This is irrecoverable. The
|
|
2556
3224
|
* project is gone when this returns, and what it holds is removed on
|
|
@@ -2559,55 +3227,56 @@ export class PlaidClient {
|
|
|
2559
3227
|
* @param {string} [auditMessage] - Custom audit-log message
|
|
2560
3228
|
* @param {object} [options]
|
|
2561
3229
|
* @param {number} [options.timeout] - Per-request timeout in ms, the client's own by default (0/null disables)
|
|
3230
|
+
* @returns {Promise<void>}
|
|
2562
3231
|
*/
|
|
2563
3232
|
delete: (id: string, auditMessage?: string, { timeout }?: {
|
|
2564
3233
|
timeout?: number;
|
|
2565
|
-
}) => Promise<
|
|
3234
|
+
}) => Promise<void>;
|
|
2566
3235
|
/**
|
|
2567
3236
|
* Update a project's name.
|
|
2568
3237
|
* @param {string} id - The resource ID
|
|
2569
3238
|
* @param {string} name - The name
|
|
2570
3239
|
* @param {string} [auditMessage] - Audit message for this write
|
|
3240
|
+
* @returns {Promise<Project>}
|
|
2571
3241
|
*/
|
|
2572
|
-
update: (id: string, name: string, auditMessage?: string) => Promise<
|
|
3242
|
+
update: (id: string, name: string, auditMessage?: string) => Promise<Project>;
|
|
2573
3243
|
/**
|
|
2574
3244
|
* List all projects accessible to user. Transparently follows pagination
|
|
2575
3245
|
* cursors and returns the full flat array.
|
|
3246
|
+
* @returns {Promise<ProjectListEntry[]>}
|
|
2576
3247
|
*/
|
|
2577
|
-
list: () => Promise<
|
|
3248
|
+
list: () => Promise<ProjectListEntry[]>;
|
|
2578
3249
|
/**
|
|
2579
3250
|
* Fetch a single page of projects.
|
|
2580
3251
|
* @param {object} [opts]
|
|
2581
3252
|
* @param {number} [opts.limit] - Page size (1..1000; server default 100)
|
|
2582
3253
|
* @param {string} [opts.cursor] - Opaque cursor from a previous page
|
|
2583
|
-
* @returns {Promise<
|
|
3254
|
+
* @returns {Promise<Page<ProjectListEntry>>}
|
|
2584
3255
|
*/
|
|
2585
3256
|
listPage: ({ limit, cursor }?: {
|
|
2586
3257
|
limit?: number;
|
|
2587
3258
|
cursor?: string;
|
|
2588
|
-
}) => Promise<
|
|
2589
|
-
entries: any[];
|
|
2590
|
-
nextCursor: (string | null);
|
|
2591
|
-
}>;
|
|
3259
|
+
}) => Promise<Page<ProjectListEntry>>;
|
|
2592
3260
|
/**
|
|
2593
3261
|
* Async-iterate projects page by page; yields each page's entries array.
|
|
2594
3262
|
* @param {object} [opts]
|
|
2595
3263
|
* @param {number} [opts.pageSize] - Per-request page size
|
|
2596
|
-
* @returns {AsyncGenerator<
|
|
3264
|
+
* @returns {AsyncGenerator<ProjectListEntry[]>}
|
|
2597
3265
|
*/
|
|
2598
3266
|
iterPages: ({ pageSize }?: {
|
|
2599
3267
|
pageSize?: number;
|
|
2600
|
-
}) => AsyncGenerator<
|
|
3268
|
+
}) => AsyncGenerator<ProjectListEntry[]>;
|
|
2601
3269
|
/**
|
|
2602
3270
|
* Create a new project. Note: this also registers the user as a maintainer.
|
|
2603
3271
|
* @param {string} name - The name
|
|
2604
3272
|
* @param {string} [auditMessage] - Audit message for this write
|
|
2605
3273
|
* @param {object} [opts]
|
|
2606
3274
|
* @param {string} [opts.id] - The new entity's id, minted by the caller (see uuidv7)
|
|
3275
|
+
* @returns {Promise<Created>}
|
|
2607
3276
|
*/
|
|
2608
3277
|
create: (name: string, auditMessage?: string, { id }?: {
|
|
2609
3278
|
id?: string;
|
|
2610
|
-
}) => Promise<
|
|
3279
|
+
}) => Promise<Created>;
|
|
2611
3280
|
/**
|
|
2612
3281
|
* Set a configuration value in an editor namespace.
|
|
2613
3282
|
* @param {string} id - The record's ID
|
|
@@ -2616,50 +3285,59 @@ export class PlaidClient {
|
|
|
2616
3285
|
* @param {any} configValue - Configuration value to set
|
|
2617
3286
|
* @param {string} [auditMessage] - Audit message for this write
|
|
2618
3287
|
* @param {{expected?: any}} [options] - `expected`: the value read for this key (null or undefined when it
|
|
2619
|
-
* was absent). The write is then refused with a 409 when the stored value differs.
|
|
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>}
|
|
2620
3292
|
*/
|
|
2621
3293
|
setConfig: (id: string, namespace: string, configKey: string, configValue: any, auditMessage?: string, options?: {
|
|
2622
3294
|
expected?: any;
|
|
2623
|
-
}) => Promise<
|
|
3295
|
+
}) => Promise<void>;
|
|
2624
3296
|
/**
|
|
2625
3297
|
* Remove a configuration value.
|
|
2626
3298
|
* @param {string} id - The record's ID
|
|
2627
3299
|
* @param {string} namespace - The config namespace
|
|
2628
3300
|
* @param {string} configKey - The config key
|
|
2629
3301
|
* @param {string} [auditMessage] - Audit message for this write
|
|
2630
|
-
* @param {{expected?: any}} [options] - `expected`, as on setConfig.
|
|
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>}
|
|
2631
3305
|
*/
|
|
2632
3306
|
deleteConfig: (id: string, namespace: string, configKey: string, auditMessage?: string, options?: {
|
|
2633
3307
|
expected?: any;
|
|
2634
|
-
}) => Promise<
|
|
3308
|
+
}) => Promise<void>;
|
|
2635
3309
|
/**
|
|
2636
3310
|
* Set a user's access level to read and write for this project.
|
|
2637
3311
|
* @param {string} id - The resource ID
|
|
2638
3312
|
* @param {string} userId - The user ID
|
|
2639
3313
|
* @param {string} [auditMessage] - Audit message for this write
|
|
3314
|
+
* @returns {Promise<void>}
|
|
2640
3315
|
*/
|
|
2641
|
-
addWriter: (id: string, userId: string, auditMessage?: string) => Promise<
|
|
3316
|
+
addWriter: (id: string, userId: string, auditMessage?: string) => Promise<void>;
|
|
2642
3317
|
/**
|
|
2643
3318
|
* Remove a user's writer privileges for this project.
|
|
2644
3319
|
* @param {string} id - The resource ID
|
|
2645
3320
|
* @param {string} userId - The user ID
|
|
2646
3321
|
* @param {string} [auditMessage] - Audit message for this write
|
|
3322
|
+
* @returns {Promise<void>}
|
|
2647
3323
|
*/
|
|
2648
|
-
removeWriter: (id: string, userId: string, auditMessage?: string) => Promise<
|
|
3324
|
+
removeWriter: (id: string, userId: string, auditMessage?: string) => Promise<void>;
|
|
2649
3325
|
/**
|
|
2650
3326
|
* Set a user's access level to read-only for this project.
|
|
2651
3327
|
* @param {string} id - The resource ID
|
|
2652
3328
|
* @param {string} userId - The user ID
|
|
2653
3329
|
* @param {string} [auditMessage] - Audit message for this write
|
|
3330
|
+
* @returns {Promise<void>}
|
|
2654
3331
|
*/
|
|
2655
|
-
addReader: (id: string, userId: string, auditMessage?: string) => Promise<
|
|
3332
|
+
addReader: (id: string, userId: string, auditMessage?: string) => Promise<void>;
|
|
2656
3333
|
/**
|
|
2657
3334
|
* Remove a user's reader privileges for this project.
|
|
2658
3335
|
* @param {string} id - The resource ID
|
|
2659
3336
|
* @param {string} userId - The user ID
|
|
2660
3337
|
* @param {string} [auditMessage] - Audit message for this write
|
|
3338
|
+
* @returns {Promise<void>}
|
|
2661
3339
|
*/
|
|
2662
|
-
removeReader: (id: string, userId: string, auditMessage?: string) => Promise<
|
|
3340
|
+
removeReader: (id: string, userId: string, auditMessage?: string) => Promise<void>;
|
|
2663
3341
|
};
|
|
2664
3342
|
textLayers: {
|
|
2665
3343
|
/**
|
|
@@ -2669,35 +3347,40 @@ export class PlaidClient {
|
|
|
2669
3347
|
* @param {string} [auditMessage] - Audit message for this write
|
|
2670
3348
|
* @param {object} [opts]
|
|
2671
3349
|
* @param {string} [opts.id] - The new entity's id, minted by the caller (see uuidv7)
|
|
3350
|
+
* @returns {Promise<Created>}
|
|
2672
3351
|
*/
|
|
2673
3352
|
create: (projectId: string, name: string, auditMessage?: string, { id }?: {
|
|
2674
3353
|
id?: string;
|
|
2675
|
-
}) => Promise<
|
|
3354
|
+
}) => Promise<Created>;
|
|
2676
3355
|
/**
|
|
2677
3356
|
* Get a layer by ID.
|
|
2678
3357
|
* @param {string} layerId - The layer ID
|
|
3358
|
+
* @returns {Promise<LayerRecords[K]>}
|
|
2679
3359
|
*/
|
|
2680
|
-
get: (layerId: string) => Promise<
|
|
3360
|
+
get: (layerId: string) => Promise<TextLayer>;
|
|
2681
3361
|
/**
|
|
2682
3362
|
* Delete a layer.
|
|
2683
3363
|
* @param {string} layerId - The layer ID
|
|
2684
3364
|
* @param {string} [auditMessage] - Audit message for this write
|
|
3365
|
+
* @returns {Promise<void>}
|
|
2685
3366
|
*/
|
|
2686
|
-
delete: (layerId: string, auditMessage?: string) => Promise<
|
|
3367
|
+
delete: (layerId: string, auditMessage?: string) => Promise<void>;
|
|
2687
3368
|
/**
|
|
2688
3369
|
* Rename a layer.
|
|
2689
3370
|
* @param {string} layerId - The layer ID
|
|
2690
3371
|
* @param {string} name - The new name
|
|
2691
3372
|
* @param {string} [auditMessage] - Audit message for this write
|
|
3373
|
+
* @returns {Promise<LayerRecords[K]>}
|
|
2692
3374
|
*/
|
|
2693
|
-
update: (layerId: string, name: string, auditMessage?: string) => Promise<
|
|
3375
|
+
update: (layerId: string, name: string, auditMessage?: string) => Promise<TextLayer>;
|
|
2694
3376
|
/**
|
|
2695
3377
|
* Move a layer one place in its display order.
|
|
2696
3378
|
* @param {string} layerId - The layer ID
|
|
2697
3379
|
* @param {string} direction - The direction ("up" or "down")
|
|
2698
3380
|
* @param {string} [auditMessage] - Audit message for this write
|
|
3381
|
+
* @returns {Promise<void>}
|
|
2699
3382
|
*/
|
|
2700
|
-
shift: (layerId: string, direction: string, auditMessage?: string) => Promise<
|
|
3383
|
+
shift: (layerId: string, direction: string, auditMessage?: string) => Promise<void>;
|
|
2701
3384
|
/**
|
|
2702
3385
|
* Set a configuration value in an editor namespace.
|
|
2703
3386
|
* @param {string} id - The record's ID
|
|
@@ -2706,22 +3389,27 @@ export class PlaidClient {
|
|
|
2706
3389
|
* @param {any} configValue - Configuration value to set
|
|
2707
3390
|
* @param {string} [auditMessage] - Audit message for this write
|
|
2708
3391
|
* @param {{expected?: any}} [options] - `expected`: the value read for this key (null or undefined when it
|
|
2709
|
-
* was absent). The write is then refused with a 409 when the stored value differs.
|
|
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>}
|
|
2710
3396
|
*/
|
|
2711
3397
|
setConfig: (id: string, namespace: string, configKey: string, configValue: any, auditMessage?: string, options?: {
|
|
2712
3398
|
expected?: any;
|
|
2713
|
-
}) => Promise<
|
|
3399
|
+
}) => Promise<void>;
|
|
2714
3400
|
/**
|
|
2715
3401
|
* Remove a configuration value.
|
|
2716
3402
|
* @param {string} id - The record's ID
|
|
2717
3403
|
* @param {string} namespace - The config namespace
|
|
2718
3404
|
* @param {string} configKey - The config key
|
|
2719
3405
|
* @param {string} [auditMessage] - Audit message for this write
|
|
2720
|
-
* @param {{expected?: any}} [options] - `expected`, as on setConfig.
|
|
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>}
|
|
2721
3409
|
*/
|
|
2722
3410
|
deleteConfig: (id: string, namespace: string, configKey: string, auditMessage?: string, options?: {
|
|
2723
3411
|
expected?: any;
|
|
2724
|
-
}) => Promise<
|
|
3412
|
+
}) => Promise<void>;
|
|
2725
3413
|
};
|
|
2726
3414
|
vocabItems: {
|
|
2727
3415
|
/**
|
|
@@ -2732,10 +3420,11 @@ export class PlaidClient {
|
|
|
2732
3420
|
* @param {string} [auditMessage] - Audit message for this write
|
|
2733
3421
|
* @param {object} [opts]
|
|
2734
3422
|
* @param {string} [opts.id] - The new entity's id, minted by the caller (see uuidv7)
|
|
3423
|
+
* @returns {Promise<Created>}
|
|
2735
3424
|
*/
|
|
2736
3425
|
create: (vocabLayerId: string, form: string, metadata?: any, auditMessage?: string, { id }?: {
|
|
2737
3426
|
id?: string;
|
|
2738
|
-
}) => Promise<
|
|
3427
|
+
}) => Promise<Created>;
|
|
2739
3428
|
/**
|
|
2740
3429
|
* Create multiple vocab items in a single operation. Entries may target
|
|
2741
3430
|
* different vocab layers; the user must have write access to each.
|
|
@@ -2778,8 +3467,9 @@ export class PlaidClient {
|
|
|
2778
3467
|
/**
|
|
2779
3468
|
* Get a vocab item by ID
|
|
2780
3469
|
* @param {string} id - The resource ID
|
|
3470
|
+
* @returns {Promise<VocabItem>}
|
|
2781
3471
|
*/
|
|
2782
|
-
get: (id: string) => Promise<
|
|
3472
|
+
get: (id: string) => Promise<VocabItem>;
|
|
2783
3473
|
/**
|
|
2784
3474
|
* Delete a vocab item, and every link to it. Every document holding one
|
|
2785
3475
|
* of those links has its version bumped, and a strict-mode client picks
|
|
@@ -2789,10 +3479,11 @@ export class PlaidClient {
|
|
|
2789
3479
|
* @param {{expectedLinkCount?: number}} [options] - `expectedLinkCount`: the
|
|
2790
3480
|
* number of links the caller showed. The delete is refused with a 409 when
|
|
2791
3481
|
* the entry has any other number of links by then.
|
|
3482
|
+
* @returns {Promise<void>}
|
|
2792
3483
|
*/
|
|
2793
3484
|
delete: (id: string, auditMessage?: string, { expectedLinkCount }?: {
|
|
2794
3485
|
expectedLinkCount?: number;
|
|
2795
|
-
}) => Promise<
|
|
3486
|
+
}) => Promise<void>;
|
|
2796
3487
|
/**
|
|
2797
3488
|
* Merge entries into this one, in one operation. Every link to a loser
|
|
2798
3489
|
* moves to the survivor (keeping its id and metadata), except a link on
|
|
@@ -2824,30 +3515,49 @@ export class PlaidClient {
|
|
|
2824
3515
|
* @param {string} id - The resource ID
|
|
2825
3516
|
* @param {string} form - The vocab item form
|
|
2826
3517
|
* @param {string} [auditMessage] - Audit message for this write
|
|
3518
|
+
* @returns {Promise<VocabItem>}
|
|
2827
3519
|
*/
|
|
2828
|
-
update: (id: string, form: string, auditMessage?: string) => Promise<
|
|
3520
|
+
update: (id: string, form: string, auditMessage?: string) => Promise<VocabItem>;
|
|
2829
3521
|
/**
|
|
2830
3522
|
* Replace all metadata of an entity. Keys left out of the new map are removed.
|
|
2831
3523
|
* @param {string} id - The entity's ID
|
|
2832
3524
|
* @param {object} body - The new metadata map
|
|
2833
3525
|
* @param {string} [auditMessage] - Audit message for this write
|
|
3526
|
+
* @returns {Promise<MetadataRecords[K]>}
|
|
2834
3527
|
*/
|
|
2835
|
-
setMetadata: (id: string, body: object, auditMessage?: string) => Promise<
|
|
3528
|
+
setMetadata: (id: string, body: object, auditMessage?: string) => Promise<VocabItem>;
|
|
2836
3529
|
/**
|
|
2837
3530
|
* Remove all metadata from an entity.
|
|
2838
3531
|
* @param {string} id - The entity's ID
|
|
2839
3532
|
* @param {string} [auditMessage] - Audit message for this write
|
|
3533
|
+
* @returns {Promise<MetadataRecords[K]>}
|
|
2840
3534
|
*/
|
|
2841
|
-
deleteMetadata: (id: string, auditMessage?: string) => Promise<
|
|
3535
|
+
deleteMetadata: (id: string, auditMessage?: string) => Promise<VocabItem>;
|
|
2842
3536
|
/**
|
|
2843
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.
|
|
2844
3538
|
* @param {string} id - The entity's ID
|
|
2845
3539
|
* @param {MetadataOp[]} body - The metadata ops
|
|
2846
3540
|
* @param {string} [auditMessage] - Audit message for this write
|
|
3541
|
+
* @returns {Promise<MetadataRecords[K]>}
|
|
2847
3542
|
*/
|
|
2848
|
-
patchMetadata: (id: string, body: MetadataOp[], auditMessage?: string) => Promise<
|
|
3543
|
+
patchMetadata: (id: string, body: MetadataOp[], auditMessage?: string) => Promise<VocabItem>;
|
|
2849
3544
|
};
|
|
2850
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>;
|
|
2851
3561
|
/**
|
|
2852
3562
|
* Declare an app namespace's constraints on this layer, replacing that
|
|
2853
3563
|
* namespace's list. Refused with 422 and the violations when the layer's
|
|
@@ -2872,18 +3582,22 @@ export class PlaidClient {
|
|
|
2872
3582
|
* @param {string} namespace - The declaring app's namespace
|
|
2873
3583
|
* @param {string} [auditMessage] - Audit message for this write
|
|
2874
3584
|
* @param {{expected?: Array<object>|null}} [options] - `expected`, as on setConstraints.
|
|
3585
|
+
* @returns {Promise<void>}
|
|
2875
3586
|
*/
|
|
2876
3587
|
deleteConstraints: (layerId: string, namespace: string, auditMessage?: string, options?: {
|
|
2877
3588
|
expected?: Array<object> | null;
|
|
2878
|
-
}) => Promise<
|
|
3589
|
+
}) => Promise<void>;
|
|
2879
3590
|
/**
|
|
2880
3591
|
* The violations the given constraints would meet in this layer's stored
|
|
2881
3592
|
* data. Writes nothing.
|
|
2882
3593
|
* @param {string} layerId - The layer ID
|
|
2883
3594
|
* @param {LayerConstraint[]} constraints - The list to check
|
|
3595
|
+
* @param {{limit?: number}} [options] - `limit`: how many violations to list (default 100)
|
|
2884
3596
|
* @returns {Promise<{violations: ConstraintViolation[], violationCount: number}>}
|
|
2885
3597
|
*/
|
|
2886
|
-
checkConstraints: (layerId: string, constraints: LayerConstraint[]
|
|
3598
|
+
checkConstraints: (layerId: string, constraints: LayerConstraint[], options?: {
|
|
3599
|
+
limit?: number;
|
|
3600
|
+
}) => Promise<{
|
|
2887
3601
|
violations: ConstraintViolation[];
|
|
2888
3602
|
violationCount: number;
|
|
2889
3603
|
}>;
|
|
@@ -2919,22 +3633,27 @@ export class PlaidClient {
|
|
|
2919
3633
|
* @param {any} configValue - Configuration value to set
|
|
2920
3634
|
* @param {string} [auditMessage] - Audit message for this write
|
|
2921
3635
|
* @param {{expected?: any}} [options] - `expected`: the value read for this key (null or undefined when it
|
|
2922
|
-
* was absent). The write is then refused with a 409 when the stored value differs.
|
|
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>}
|
|
2923
3640
|
*/
|
|
2924
3641
|
setConfig: (id: string, namespace: string, configKey: string, configValue: any, auditMessage?: string, options?: {
|
|
2925
3642
|
expected?: any;
|
|
2926
|
-
}) => Promise<
|
|
3643
|
+
}) => Promise<void>;
|
|
2927
3644
|
/**
|
|
2928
3645
|
* Remove a configuration value.
|
|
2929
3646
|
* @param {string} id - The record's ID
|
|
2930
3647
|
* @param {string} namespace - The config namespace
|
|
2931
3648
|
* @param {string} configKey - The config key
|
|
2932
3649
|
* @param {string} [auditMessage] - Audit message for this write
|
|
2933
|
-
* @param {{expected?: any}} [options] - `expected`, as on setConfig.
|
|
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>}
|
|
2934
3653
|
*/
|
|
2935
3654
|
deleteConfig: (id: string, namespace: string, configKey: string, auditMessage?: string, options?: {
|
|
2936
3655
|
expected?: any;
|
|
2937
|
-
}) => Promise<
|
|
3656
|
+
}) => Promise<void>;
|
|
2938
3657
|
/**
|
|
2939
3658
|
* Create a new relation layer.
|
|
2940
3659
|
* @param {string} spanLayerId - The span layer ID
|
|
@@ -2942,35 +3661,40 @@ export class PlaidClient {
|
|
|
2942
3661
|
* @param {string} [auditMessage] - Audit message for this write
|
|
2943
3662
|
* @param {object} [opts]
|
|
2944
3663
|
* @param {string} [opts.id] - The new entity's id, minted by the caller (see uuidv7)
|
|
3664
|
+
* @returns {Promise<Created>}
|
|
2945
3665
|
*/
|
|
2946
3666
|
create: (spanLayerId: string, name: string, auditMessage?: string, { id }?: {
|
|
2947
3667
|
id?: string;
|
|
2948
|
-
}) => Promise<
|
|
3668
|
+
}) => Promise<Created>;
|
|
2949
3669
|
/**
|
|
2950
3670
|
* Get a layer by ID.
|
|
2951
3671
|
* @param {string} layerId - The layer ID
|
|
3672
|
+
* @returns {Promise<LayerRecords[K]>}
|
|
2952
3673
|
*/
|
|
2953
|
-
get: (layerId: string) => Promise<
|
|
3674
|
+
get: (layerId: string) => Promise<RelationLayer>;
|
|
2954
3675
|
/**
|
|
2955
3676
|
* Delete a layer.
|
|
2956
3677
|
* @param {string} layerId - The layer ID
|
|
2957
3678
|
* @param {string} [auditMessage] - Audit message for this write
|
|
3679
|
+
* @returns {Promise<void>}
|
|
2958
3680
|
*/
|
|
2959
|
-
delete: (layerId: string, auditMessage?: string) => Promise<
|
|
3681
|
+
delete: (layerId: string, auditMessage?: string) => Promise<void>;
|
|
2960
3682
|
/**
|
|
2961
3683
|
* Rename a layer.
|
|
2962
3684
|
* @param {string} layerId - The layer ID
|
|
2963
3685
|
* @param {string} name - The new name
|
|
2964
3686
|
* @param {string} [auditMessage] - Audit message for this write
|
|
3687
|
+
* @returns {Promise<LayerRecords[K]>}
|
|
2965
3688
|
*/
|
|
2966
|
-
update: (layerId: string, name: string, auditMessage?: string) => Promise<
|
|
3689
|
+
update: (layerId: string, name: string, auditMessage?: string) => Promise<RelationLayer>;
|
|
2967
3690
|
/**
|
|
2968
3691
|
* Move a layer one place in its display order.
|
|
2969
3692
|
* @param {string} layerId - The layer ID
|
|
2970
3693
|
* @param {string} direction - The direction ("up" or "down")
|
|
2971
3694
|
* @param {string} [auditMessage] - Audit message for this write
|
|
3695
|
+
* @returns {Promise<void>}
|
|
2972
3696
|
*/
|
|
2973
|
-
shift: (layerId: string, direction: string, auditMessage?: string) => Promise<
|
|
3697
|
+
shift: (layerId: string, direction: string, auditMessage?: string) => Promise<void>;
|
|
2974
3698
|
};
|
|
2975
3699
|
tokens: {
|
|
2976
3700
|
/**
|
|
@@ -2978,21 +3702,24 @@ export class PlaidClient {
|
|
|
2978
3702
|
* @param {string} id - The entity's ID
|
|
2979
3703
|
* @param {object} body - The new metadata map
|
|
2980
3704
|
* @param {string} [auditMessage] - Audit message for this write
|
|
3705
|
+
* @returns {Promise<MetadataRecords[K]>}
|
|
2981
3706
|
*/
|
|
2982
|
-
setMetadata: (id: string, body: object, auditMessage?: string) => Promise<
|
|
3707
|
+
setMetadata: (id: string, body: object, auditMessage?: string) => Promise<Token>;
|
|
2983
3708
|
/**
|
|
2984
3709
|
* Remove all metadata from an entity.
|
|
2985
3710
|
* @param {string} id - The entity's ID
|
|
2986
3711
|
* @param {string} [auditMessage] - Audit message for this write
|
|
3712
|
+
* @returns {Promise<MetadataRecords[K]>}
|
|
2987
3713
|
*/
|
|
2988
|
-
deleteMetadata: (id: string, auditMessage?: string) => Promise<
|
|
3714
|
+
deleteMetadata: (id: string, auditMessage?: string) => Promise<Token>;
|
|
2989
3715
|
/**
|
|
2990
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.
|
|
2991
3717
|
* @param {string} id - The entity's ID
|
|
2992
3718
|
* @param {MetadataOp[]} body - The metadata ops
|
|
2993
3719
|
* @param {string} [auditMessage] - Audit message for this write
|
|
3720
|
+
* @returns {Promise<MetadataRecords[K]>}
|
|
2994
3721
|
*/
|
|
2995
|
-
patchMetadata: (id: string, body: MetadataOp[], auditMessage?: string) => Promise<
|
|
3722
|
+
patchMetadata: (id: string, body: MetadataOp[], auditMessage?: string) => Promise<Token>;
|
|
2996
3723
|
/**
|
|
2997
3724
|
* Create a new token in a token layer. Tokens define text substrings
|
|
2998
3725
|
* using begin and end offsets. Tokens may be zero-width and may overlap.
|
|
@@ -3013,22 +3740,25 @@ export class PlaidClient {
|
|
|
3013
3740
|
* @param {string} [auditMessage] - Audit message for this write
|
|
3014
3741
|
* @param {object} [opts]
|
|
3015
3742
|
* @param {string} [opts.id] - The new entity's id, minted by the caller (see uuidv7)
|
|
3743
|
+
* @returns {Promise<Created>}
|
|
3016
3744
|
*/
|
|
3017
3745
|
create: (tokenLayerId: string, text: string, begin: number, end: number, precedence?: number, metadata?: any, auditMessage?: string, { id }?: {
|
|
3018
3746
|
id?: string;
|
|
3019
|
-
}) => Promise<
|
|
3747
|
+
}) => Promise<Created>;
|
|
3020
3748
|
/**
|
|
3021
3749
|
* Get a token.
|
|
3022
3750
|
* @param {string} tokenId - The token ID
|
|
3751
|
+
* @returns {Promise<Token>}
|
|
3023
3752
|
*/
|
|
3024
|
-
get: (tokenId: string) => Promise<
|
|
3753
|
+
get: (tokenId: string) => Promise<Token>;
|
|
3025
3754
|
/**
|
|
3026
3755
|
* Delete a token and remove it from any spans. If this causes a span to
|
|
3027
3756
|
* have no remaining tokens, the span will also be deleted.
|
|
3028
3757
|
* @param {string} tokenId - The token ID
|
|
3029
3758
|
* @param {string} [auditMessage] - Audit message for this write
|
|
3759
|
+
* @returns {Promise<void>}
|
|
3030
3760
|
*/
|
|
3031
|
-
delete: (tokenId: string, auditMessage?: string) => Promise<
|
|
3761
|
+
delete: (tokenId: string, auditMessage?: string) => Promise<void>;
|
|
3032
3762
|
/**
|
|
3033
3763
|
* Update a token.
|
|
3034
3764
|
* @param {string} tokenId - The token ID
|
|
@@ -3039,8 +3769,9 @@ export class PlaidClient {
|
|
|
3039
3769
|
* CLEAR it (revert to no explicit ordering). bodyOf keeps null but
|
|
3040
3770
|
* drops undefined, so the three cases map correctly to the server.
|
|
3041
3771
|
* @param {string} [auditMessage] - Audit message for this write
|
|
3772
|
+
* @returns {Promise<Token>}
|
|
3042
3773
|
*/
|
|
3043
|
-
update: (tokenId: string, begin?: number, end?: number, precedence?: number | null, auditMessage?: string) => Promise<
|
|
3774
|
+
update: (tokenId: string, begin?: number, end?: number, precedence?: number | null, auditMessage?: string) => Promise<Token>;
|
|
3044
3775
|
/**
|
|
3045
3776
|
* Create multiple tokens in a single operation.
|
|
3046
3777
|
* @param {Array} body - The request body
|
|
@@ -3067,8 +3798,9 @@ export class PlaidClient {
|
|
|
3067
3798
|
count: number;
|
|
3068
3799
|
}>;
|
|
3069
3800
|
/**
|
|
3070
|
-
* Split a token at a Unicode code-point offset.
|
|
3071
|
-
*
|
|
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"`.
|
|
3072
3804
|
* @param {string} tokenId - The token ID
|
|
3073
3805
|
* @param {number} position - Code-point offset to split at (strictly between begin and end)
|
|
3074
3806
|
* @param {string} [auditMessage] - Audit message for this write
|
|
@@ -3079,11 +3811,12 @@ export class PlaidClient {
|
|
|
3079
3811
|
* half. A relation layer whose relations must stay inside one token
|
|
3080
3812
|
* of this layer declares a same-ancestor constraint, and the server deletes
|
|
3081
3813
|
* the relations the split leaves crossing in the same transaction.
|
|
3814
|
+
* @returns {Promise<Created>}
|
|
3082
3815
|
*/
|
|
3083
3816
|
split: (tokenId: string, position: number, auditMessage?: string, { id, keep }?: {
|
|
3084
3817
|
id?: string;
|
|
3085
3818
|
keep?: "left" | "right";
|
|
3086
|
-
}) => Promise<
|
|
3819
|
+
}) => Promise<Created>;
|
|
3087
3820
|
/**
|
|
3088
3821
|
* Merge two tokens. The left token (smaller begin) survives with the combined
|
|
3089
3822
|
* extent; the right is deleted and its spans/vocab-links are reparented to the left.
|
|
@@ -3092,8 +3825,9 @@ export class PlaidClient {
|
|
|
3092
3825
|
* @param {string} tokenId - The anchor token ID
|
|
3093
3826
|
* @param {string} otherTokenId - The other token to merge in
|
|
3094
3827
|
* @param {string} [auditMessage] - Audit message for this write
|
|
3828
|
+
* @returns {Promise<Token>}
|
|
3095
3829
|
*/
|
|
3096
|
-
merge: (tokenId: string, otherTokenId: string, auditMessage?: string) => Promise<
|
|
3830
|
+
merge: (tokenId: string, otherTokenId: string, auditMessage?: string) => Promise<Token>;
|
|
3097
3831
|
/**
|
|
3098
3832
|
* Shift a token's boundary. On partitioning layers the adjacent token is
|
|
3099
3833
|
* auto-adjusted to preserve the partition; on non-overlapping layers a shift that
|
|
@@ -3102,8 +3836,9 @@ export class PlaidClient {
|
|
|
3102
3836
|
* @param {number} [begin] - New start offset, inclusive (Unicode code points)
|
|
3103
3837
|
* @param {number} [end] - New end offset, exclusive (Unicode code points)
|
|
3104
3838
|
* @param {string} [auditMessage] - Audit message for this write
|
|
3839
|
+
* @returns {Promise<Token>}
|
|
3105
3840
|
*/
|
|
3106
|
-
shift: (tokenId: string, begin?: number, end?: number, auditMessage?: string) => Promise<
|
|
3841
|
+
shift: (tokenId: string, begin?: number, end?: number, auditMessage?: string) => Promise<Token>;
|
|
3107
3842
|
};
|
|
3108
3843
|
messages: {
|
|
3109
3844
|
/**
|
|
@@ -3129,9 +3864,12 @@ export class PlaidClient {
|
|
|
3129
3864
|
* queues, so a message queued after the writes goes out after them.
|
|
3130
3865
|
* @param {string} projectId - The UUID of the project to send to
|
|
3131
3866
|
* @param {any} data - The message data to send
|
|
3132
|
-
* @returns {Promise<
|
|
3867
|
+
* @returns {Promise<{success: boolean, message: string}>}
|
|
3133
3868
|
*/
|
|
3134
|
-
sendMessage: (projectId: string, data: any) => Promise<
|
|
3869
|
+
sendMessage: (projectId: string, data: any) => Promise<{
|
|
3870
|
+
success: boolean;
|
|
3871
|
+
message: string;
|
|
3872
|
+
}>;
|
|
3135
3873
|
/**
|
|
3136
3874
|
* Discover the services seen on a project (synchronous GET). Currently
|
|
3137
3875
|
* connected services carry `online: true`; previously-seen offline ones
|
|
@@ -3246,24 +3984,26 @@ export class PlaidClient {
|
|
|
3246
3984
|
*
|
|
3247
3985
|
* @param {Object} body - The query AST ({find, where, scope?, limit?, orderBy?,
|
|
3248
3986
|
* return?, bindings?}).
|
|
3249
|
-
* @returns {Promise<
|
|
3987
|
+
* @returns {Promise<QueryResult>} For 'ids'/'entities': {columns, results, count, truncated}.
|
|
3250
3988
|
* For 'count': {return: 'count', count, truncated}, where `truncated` says
|
|
3251
3989
|
* the count stopped at the server's cap. Entity cells are full entity
|
|
3252
3990
|
* objects (same shape as the GET endpoints).
|
|
3253
3991
|
*/
|
|
3254
|
-
query: (body: any) => Promise<
|
|
3992
|
+
query: (body: any) => Promise<QueryResult>;
|
|
3255
3993
|
operationGroups: {
|
|
3256
3994
|
/**
|
|
3257
3995
|
* Get a logical-operation group (its label + creator).
|
|
3258
3996
|
* @param {string} id - The group id
|
|
3997
|
+
* @returns {Promise<OperationGroup>}
|
|
3259
3998
|
*/
|
|
3260
|
-
get: (id: string) => Promise<
|
|
3999
|
+
get: (id: string) => Promise<OperationGroup>;
|
|
3261
4000
|
/**
|
|
3262
4001
|
* Relabel a logical-operation group after the fact. Owner or admin only.
|
|
3263
4002
|
* @param {string} id - The group id
|
|
3264
4003
|
* @param {string|null} message - The new label
|
|
4004
|
+
* @returns {Promise<OperationGroup>}
|
|
3265
4005
|
*/
|
|
3266
|
-
update: (id: string, message: string | null) => Promise<
|
|
4006
|
+
update: (id: string, message: string | null) => Promise<OperationGroup>;
|
|
3267
4007
|
};
|
|
3268
4008
|
comments: {
|
|
3269
4009
|
/**
|
|
@@ -3305,8 +4045,9 @@ export class PlaidClient {
|
|
|
3305
4045
|
* Delete a comment. The author may delete their own; a project
|
|
3306
4046
|
* maintainer (or admin) may delete any.
|
|
3307
4047
|
* @param {string} id - The comment id
|
|
4048
|
+
* @returns {Promise<void>}
|
|
3308
4049
|
*/
|
|
3309
|
-
delete: (id: string) => Promise<
|
|
4050
|
+
delete: (id: string) => Promise<void>;
|
|
3310
4051
|
/**
|
|
3311
4052
|
* List comments in a project, oldest first. Transparently follows
|
|
3312
4053
|
* pagination cursors and returns the full flat array.
|
|
@@ -3589,8 +4330,9 @@ export class PlaidClient {
|
|
|
3589
4330
|
* Delete a guideline.
|
|
3590
4331
|
* @param {string} id - The guideline id
|
|
3591
4332
|
* @param {string} [auditMessage] - Audit message for this write
|
|
4333
|
+
* @returns {Promise<void>}
|
|
3592
4334
|
*/
|
|
3593
|
-
delete: (id: string, auditMessage?: string) => Promise<
|
|
4335
|
+
delete: (id: string, auditMessage?: string) => Promise<void>;
|
|
3594
4336
|
/**
|
|
3595
4337
|
* List a project's guidelines, by title. Transparently follows
|
|
3596
4338
|
* pagination cursors and returns the full flat array.
|
|
@@ -3764,15 +4506,23 @@ export class PlaidClient {
|
|
|
3764
4506
|
* parents created earlier in the same batch, and any op's failure rolls the
|
|
3765
4507
|
* whole batch back. A batch is not nestable. Prefer `batched()`, which
|
|
3766
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]
|
|
3767
4514
|
* @returns {PlaidBatch} the batch view
|
|
3768
4515
|
*/
|
|
3769
|
-
batch(
|
|
4516
|
+
batch({ timeout }?: {
|
|
4517
|
+
timeout?: number | null;
|
|
4518
|
+
}): PlaidBatch;
|
|
3770
4519
|
/**
|
|
3771
4520
|
* POST one batch request (at most MAX_BATCH_OPS operations). Resolves to
|
|
3772
4521
|
* one `{ status, headers, body }` per operation, with only the body
|
|
3773
4522
|
* recased: the headers keep the server's spelling. `key` is the request's
|
|
3774
4523
|
* Idempotency-Key: a batch whose answer is lost (no response, 502, 504) is
|
|
3775
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.
|
|
3776
4526
|
* @private
|
|
3777
4527
|
*/
|
|
3778
4528
|
private _postBatch;
|
|
@@ -3789,11 +4539,15 @@ export class PlaidClient {
|
|
|
3789
4539
|
* });
|
|
3790
4540
|
*
|
|
3791
4541
|
* A write made on `client` inside `fn` is not part of the batch: it goes
|
|
3792
|
-
* over the wire at once, as it would anywhere else. See `batch()
|
|
4542
|
+
* over the wire at once, as it would anywhere else. See `batch()`, which
|
|
4543
|
+
* also says what `timeout` does.
|
|
3793
4544
|
* @param {(batch: PlaidBatch) => (void | Promise<void>)} fn
|
|
4545
|
+
* @param {{timeout?: number | null}} [options]
|
|
3794
4546
|
* @returns {Promise<any[]>}
|
|
3795
4547
|
*/
|
|
3796
|
-
batched(fn: (batch: PlaidBatch) => (void | Promise<void>)
|
|
4548
|
+
batched(fn: (batch: PlaidBatch) => (void | Promise<void>), { timeout }?: {
|
|
4549
|
+
timeout?: number | null;
|
|
4550
|
+
}): Promise<any[]>;
|
|
3797
4551
|
}
|
|
3798
4552
|
/**
|
|
3799
4553
|
* The server's cap on operations per batch request (plaid.rest-api.v1.batch).
|
|
@@ -3805,7 +4559,7 @@ export { cpLength, cpSlice, cpSlicer, utf16ToCp, cpIndexOf, composeText } from "
|
|
|
3805
4559
|
export { composeTextEdits, gapsToOps, applyTextOps } from "./textEdits.js";
|
|
3806
4560
|
export { PLAID_NAMESPACE, ROLE_KEY, PRESERVE_ON_SPLIT_KEY, SPLIT_ON_SPACE_KEY, ROLES, readRole, findByRole } from "./roles.js";
|
|
3807
4561
|
export { TASKS, servesTask, filterServicesByTask, getParamSchema, getServiceSummary, buildDefaultValues, coerceParamValues } from "./serviceSchema.js";
|
|
3808
|
-
export { ServiceCancelled, createCancelScope } from "./services.js";
|
|
4562
|
+
export { ServiceCancelled, createCancelScope, UNKNOWN_OUTCOME, UNREACHABLE } from "./services.js";
|
|
3809
4563
|
export { REQUESTED_BY, makeRequester, requesterOf } from "./requester.js";
|
|
3810
4564
|
export { DocumentLock, DocumentLockLost } from "./documentLock.js";
|
|
3811
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";
|