@dittolive/ditto 2.0.0-alpha1 → 2.0.0
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/README.md +2 -2
- package/node/ditto.cjs.js +1 -1
- package/node/ditto.darwin-arm64.node +0 -0
- package/node/ditto.darwin-x64.node +0 -0
- package/node/ditto.linux-arm.node +0 -0
- package/node/ditto.linux-x64.node +0 -0
- package/node/transports.darwin-arm64.node +0 -0
- package/node/transports.darwin-x64.node +0 -0
- package/package.json +2 -2
- package/types/ditto.d.ts +250 -133
- package/web/ditto.es6.js +1 -1
- package/web/ditto.umd.js +1 -1
- package/web/ditto.wasm +0 -0
package/types/ditto.d.ts
CHANGED
|
@@ -425,6 +425,80 @@ declare class Bridge<JSClass extends object, FFIType> {
|
|
|
425
425
|
private finalize;
|
|
426
426
|
}
|
|
427
427
|
|
|
428
|
+
/** Represents a unique identifier for a {@link Document}. */
|
|
429
|
+
declare type DocumentIDValue = any;
|
|
430
|
+
/** Represents a unique identifier for a {@link Document}. */
|
|
431
|
+
declare class DocumentID {
|
|
432
|
+
/**
|
|
433
|
+
* Returns the value of the receiver, lazily decoded from its CBOR
|
|
434
|
+
* representation if needed.
|
|
435
|
+
*/
|
|
436
|
+
get value(): any;
|
|
437
|
+
/**
|
|
438
|
+
* Returns `false` if validation has been skipped at construction time,
|
|
439
|
+
* otherwise returns `true`. This is mostly for internal use only, you
|
|
440
|
+
* shouldn't need this in client code.
|
|
441
|
+
*/
|
|
442
|
+
readonly isValidated: boolean;
|
|
443
|
+
/**
|
|
444
|
+
* Creates a new `DocumentID`.
|
|
445
|
+
*
|
|
446
|
+
* A document ID can be created from any of the following:
|
|
447
|
+
*
|
|
448
|
+
* - `string`
|
|
449
|
+
* - `number` (integer)
|
|
450
|
+
* - `boolean`
|
|
451
|
+
* - `null`
|
|
452
|
+
* - raw data in the form of a JS [Typed Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays)
|
|
453
|
+
* - `Array` (containing any of the items in this list)
|
|
454
|
+
* - Map (a raw JS `object`, where the keys must be strings and the values
|
|
455
|
+
* can be made up of any of the items in this list)
|
|
456
|
+
*
|
|
457
|
+
* Note that you cannot use floats or other custom types to create a document
|
|
458
|
+
* ID.
|
|
459
|
+
*
|
|
460
|
+
* Document IDs are also limited in size, based on their serialized
|
|
461
|
+
* representation, to 256 bytes. You will receive an error if you try to
|
|
462
|
+
* create a document ID that exceeds the size limit.
|
|
463
|
+
*
|
|
464
|
+
* @param value The value that represents the document identifier.
|
|
465
|
+
* @param skipCBOREncoding If `true, skips CBOR encoding and assumes
|
|
466
|
+
* the passed in `value` is already CBOR encoded. You shouldn't need to ever
|
|
467
|
+
* pass this parameter, it's only used internally for certain edge cases.
|
|
468
|
+
* @param skipValidation If `true, skips validation of the passed in value or
|
|
469
|
+
* CBOR. You shouldn't need to ever pass this parameter, it's only used
|
|
470
|
+
* internally for certain edge cases.
|
|
471
|
+
*/
|
|
472
|
+
constructor(value: any, skipCBOREncoding?: boolean, skipValidation?: boolean);
|
|
473
|
+
/**
|
|
474
|
+
* Returns `true` if passed in `documentID` is equal to the receiver,
|
|
475
|
+
* otherwise returns `false`.
|
|
476
|
+
*/
|
|
477
|
+
equals(documentID: DocumentID): boolean;
|
|
478
|
+
/**
|
|
479
|
+
* Returns a string representation of the receiver.
|
|
480
|
+
*
|
|
481
|
+
* The returned string can be used directly in queries that you use with
|
|
482
|
+
* other Ditto functions. For example you could create a query that was like
|
|
483
|
+
* this:
|
|
484
|
+
*
|
|
485
|
+
* ``` TypeScript
|
|
486
|
+
* collection.find(`_id == ${documentID.toString()}`)
|
|
487
|
+
* ```
|
|
488
|
+
*/
|
|
489
|
+
toString(): string;
|
|
490
|
+
/**
|
|
491
|
+
* Returns a byte representation of the document ID value as base64 string.
|
|
492
|
+
*/
|
|
493
|
+
toBase64String(): string;
|
|
494
|
+
/** @internal */
|
|
495
|
+
toCBOR(): Uint8Array;
|
|
496
|
+
}
|
|
497
|
+
/** @internal */
|
|
498
|
+
declare function validateDocumentIDValue(id: DocumentIDValue): DocumentIDValue;
|
|
499
|
+
/** @internal */
|
|
500
|
+
declare function validateDocumentIDCBOR(idCBOR: Uint8Array): Uint8Array;
|
|
501
|
+
|
|
428
502
|
/**
|
|
429
503
|
* The types of an {@link UpdateResult}.
|
|
430
504
|
*/
|
|
@@ -433,7 +507,7 @@ declare class UpdateResult {
|
|
|
433
507
|
/** The update result's type. */
|
|
434
508
|
readonly type: UpdateResultType;
|
|
435
509
|
/** The ID of the document that was updated. */
|
|
436
|
-
readonly docID:
|
|
510
|
+
readonly docID: DocumentID;
|
|
437
511
|
/** The path to the key in the document that was updated. */
|
|
438
512
|
readonly path: string;
|
|
439
513
|
/**
|
|
@@ -453,19 +527,19 @@ declare class UpdateResult {
|
|
|
453
527
|
/** The associated amount, only set if {@link type} is `incremented`. */
|
|
454
528
|
readonly amount?: number;
|
|
455
529
|
/** @internal */
|
|
456
|
-
static set(docID:
|
|
530
|
+
static set(docID: DocumentID, path: string, value?: any): UpdateResult;
|
|
457
531
|
/** @internal */
|
|
458
|
-
static replacedWithCounter(docID:
|
|
532
|
+
static replacedWithCounter(docID: DocumentID, path: string): UpdateResult;
|
|
459
533
|
/** @internal */
|
|
460
|
-
static incremented(docID:
|
|
534
|
+
static incremented(docID: DocumentID, path: string, amount: number): UpdateResult;
|
|
461
535
|
/** @internal */
|
|
462
|
-
static inserted(docID:
|
|
536
|
+
static inserted(docID: DocumentID, path: string, value?: any): UpdateResult;
|
|
463
537
|
/** @internal */
|
|
464
|
-
static removed(docID:
|
|
538
|
+
static removed(docID: DocumentID, path: string): UpdateResult;
|
|
465
539
|
/** @internal */
|
|
466
|
-
static pushed(docID:
|
|
540
|
+
static pushed(docID: DocumentID, path: string, value?: any): UpdateResult;
|
|
467
541
|
/** @internal */
|
|
468
|
-
static popped(docID:
|
|
542
|
+
static popped(docID: DocumentID, path: string, value?: any): UpdateResult;
|
|
469
543
|
/** @internal */
|
|
470
544
|
private constructor();
|
|
471
545
|
}
|
|
@@ -494,13 +568,17 @@ declare class Counter {
|
|
|
494
568
|
* any counter property within an update block via {@link MutableDocumentPath.counter}.
|
|
495
569
|
*/
|
|
496
570
|
declare class MutableCounter extends Counter {
|
|
497
|
-
constructor();
|
|
498
571
|
/**
|
|
499
|
-
* Increments the counter by `amount`, which can be any valid number.
|
|
500
|
-
*
|
|
501
|
-
*
|
|
572
|
+
* Increments the counter by `amount`, which can be any valid number.
|
|
573
|
+
*
|
|
574
|
+
* Only valid within the `update` closure of
|
|
575
|
+
* {@link PendingCursorOperation.update | PendingCursorOperation.update()} and
|
|
576
|
+
* {@link PendingIDSpecificOperation.update | PendingIDSpecificOperation.update()},
|
|
577
|
+
* otherwise an exception is thrown.
|
|
502
578
|
*/
|
|
503
579
|
increment(amount: number): void;
|
|
580
|
+
/** @internal */
|
|
581
|
+
constructor();
|
|
504
582
|
}
|
|
505
583
|
|
|
506
584
|
/**
|
|
@@ -531,16 +609,23 @@ declare class Register {
|
|
|
531
609
|
* any register property of a document within an update block via {@link MutableDocumentPath.register}.
|
|
532
610
|
*/
|
|
533
611
|
declare class MutableRegister extends Register {
|
|
534
|
-
constructor(value: any);
|
|
535
612
|
/** Returns the value of the register. */
|
|
536
613
|
get value(): any;
|
|
537
614
|
/**
|
|
538
|
-
*
|
|
539
|
-
* {@link Collection}'s {@link Collection.update | update()}
|
|
540
|
-
* method, otherwise an exception is thrown.
|
|
615
|
+
* Convenience setter, equivalent to {@link set | set()}.
|
|
541
616
|
*/
|
|
542
617
|
set value(value: any);
|
|
618
|
+
/**
|
|
619
|
+
* Sets the register to the provided value.
|
|
620
|
+
*
|
|
621
|
+
* Only valid within the `update` closure of
|
|
622
|
+
* {@link PendingCursorOperation.update | PendingCursorOperation.update()} and
|
|
623
|
+
* {@link PendingIDSpecificOperation.update | PendingIDSpecificOperation.update()},
|
|
624
|
+
* otherwise an exception is thrown.
|
|
625
|
+
*/
|
|
543
626
|
set(value: any): void;
|
|
627
|
+
/** @internal */
|
|
628
|
+
constructor(value: any);
|
|
544
629
|
}
|
|
545
630
|
|
|
546
631
|
/**
|
|
@@ -567,48 +652,89 @@ declare class RGA {
|
|
|
567
652
|
protected '@ditto.value': any;
|
|
568
653
|
}
|
|
569
654
|
/**
|
|
570
|
-
* Represents a mutable CRDT RGA that can be
|
|
571
|
-
* updating a document.
|
|
655
|
+
* Represents a mutable CRDT Replicated Growable Array (RGA) that can be
|
|
656
|
+
* mutated as part of updating a document.
|
|
572
657
|
*
|
|
573
658
|
* This class can't be instantiated directly, it's returned automatically for
|
|
574
659
|
* any `rga` property of a document within an update block via {@link MutableDocumentPath.rga}.
|
|
575
660
|
*/
|
|
576
661
|
declare class MutableRGA extends RGA {
|
|
577
|
-
constructor(value: any);
|
|
578
662
|
/** Returns the value of the RGA. */
|
|
579
663
|
get value(): any[];
|
|
580
664
|
/**
|
|
581
665
|
* Set a value at the specified index.
|
|
582
666
|
*
|
|
667
|
+
* Only valid within the `update` closure of
|
|
668
|
+
* {@link PendingCursorOperation.update | PendingCursorOperation.update()} and
|
|
669
|
+
* {@link PendingIDSpecificOperation.update | PendingIDSpecificOperation.update()},
|
|
670
|
+
* otherwise an exception is thrown.
|
|
671
|
+
*
|
|
583
672
|
* @param value - The value to set at the specified index.
|
|
584
673
|
* @param index - The index at which to set the provided value.
|
|
674
|
+
*
|
|
675
|
+
* @deprecated: RGA usage should be replaced. Use arrays inside Registers
|
|
676
|
+
* instead.
|
|
585
677
|
*/
|
|
586
678
|
setAt(value: any, index: number): void;
|
|
587
679
|
/**
|
|
588
680
|
* Remove a value at the specified index.
|
|
589
681
|
*
|
|
682
|
+
* Only valid within the `update` closure of
|
|
683
|
+
* {@link PendingCursorOperation.update | PendingCursorOperation.update()} and
|
|
684
|
+
* {@link PendingIDSpecificOperation.update | PendingIDSpecificOperation.update()},
|
|
685
|
+
* otherwise an exception is thrown.
|
|
686
|
+
*
|
|
590
687
|
* @param index - The index of the element to remove.
|
|
688
|
+
*
|
|
689
|
+
* @deprecated: RGA usage should be replaced. Use arrays inside Registers
|
|
690
|
+
* instead.
|
|
591
691
|
*/
|
|
592
692
|
removeAt(index: number): void;
|
|
593
693
|
/**
|
|
594
694
|
* Push a value on to the end of the RGA.
|
|
595
695
|
*
|
|
696
|
+
* Only valid within the `update` closure of
|
|
697
|
+
* {@link PendingCursorOperation.update | PendingCursorOperation.update()} and
|
|
698
|
+
* {@link PendingIDSpecificOperation.update | PendingIDSpecificOperation.update()},
|
|
699
|
+
* otherwise an exception is thrown.
|
|
700
|
+
*
|
|
596
701
|
* @param value - The value to push on to the RGA.
|
|
702
|
+
*
|
|
703
|
+
* @deprecated: RGA usage should be replaced. Use arrays inside Registers
|
|
704
|
+
* instead.
|
|
597
705
|
*/
|
|
598
706
|
push(value: any): void;
|
|
599
707
|
/**
|
|
600
708
|
* Pop a value off the end of the RGA.
|
|
601
709
|
*
|
|
710
|
+
* Only valid within the `update` closure of
|
|
711
|
+
* {@link PendingCursorOperation.update | PendingCursorOperation.update()} and
|
|
712
|
+
* {@link PendingIDSpecificOperation.update | PendingIDSpecificOperation.update()},
|
|
713
|
+
* otherwise an exception is thrown.
|
|
714
|
+
*
|
|
602
715
|
* @return The value popped off from the end of the RGA.
|
|
716
|
+
*
|
|
717
|
+
* @deprecated: RGA usage should be replaced. Use arrays inside Registers
|
|
718
|
+
* instead.
|
|
603
719
|
*/
|
|
604
720
|
pop(): any | null;
|
|
605
721
|
/**
|
|
606
|
-
* Inserts a value into
|
|
722
|
+
* Inserts a value into the RGA at the index specified.
|
|
723
|
+
*
|
|
724
|
+
* Only valid within the `update` closure of
|
|
725
|
+
* {@link PendingCursorOperation.update | PendingCursorOperation.update()} and
|
|
726
|
+
* {@link PendingIDSpecificOperation.update | PendingIDSpecificOperation.update()},
|
|
727
|
+
* otherwise an exception is thrown.
|
|
607
728
|
*
|
|
608
729
|
* @param value - The value to insert into the RGA.
|
|
609
730
|
* @param index - The index at which to insert the provided value.
|
|
731
|
+
*
|
|
732
|
+
* @deprecated: RGA usage should be replaced. Use arrays inside Registers
|
|
733
|
+
* instead.
|
|
610
734
|
*/
|
|
611
735
|
insertAt(value: any, index: number): void;
|
|
736
|
+
/** @internal */
|
|
737
|
+
constructor(value: any);
|
|
612
738
|
}
|
|
613
739
|
|
|
614
740
|
/**
|
|
@@ -630,9 +756,12 @@ declare class AttachmentToken {
|
|
|
630
756
|
}
|
|
631
757
|
|
|
632
758
|
/**
|
|
759
|
+
* Represents a portion of the document at a specific key-path.
|
|
760
|
+
*
|
|
633
761
|
* Provides an interface to specify a path to a key in a document that you can
|
|
634
762
|
* then call a function on to get the value at the specified key as a specific
|
|
635
|
-
* type. You don't create a `DocumentPath` directly but obtain one via the
|
|
763
|
+
* type. You don't create a `DocumentPath` directly but obtain one via the
|
|
764
|
+
* {@link Document.path | path} property or the {@link Document.at | at()}
|
|
636
765
|
* method of {@link Document}.
|
|
637
766
|
*/
|
|
638
767
|
declare class DocumentPath {
|
|
@@ -646,9 +775,9 @@ declare class DocumentPath {
|
|
|
646
775
|
*
|
|
647
776
|
* A key-path can be a single property name or multiple property names
|
|
648
777
|
* separated by a dot. Indexes can also be specified as part of the key
|
|
649
|
-
* path using square
|
|
650
|
-
* representing the same portion of the document as the receiver. If a
|
|
651
|
-
* path starts with a property name and is prefixed by a dot, the dot is
|
|
778
|
+
* path using the square bracket syntax. The empty string returns a document
|
|
779
|
+
* path representing the same portion of the document as the receiver. If a
|
|
780
|
+
* key-path starts with a property name and is prefixed by a dot, the dot is
|
|
652
781
|
* ignored.
|
|
653
782
|
*
|
|
654
783
|
* Examples:
|
|
@@ -661,28 +790,31 @@ declare class DocumentPath {
|
|
|
661
790
|
*/
|
|
662
791
|
at(keyPathOrIndex: string | number): DocumentPath;
|
|
663
792
|
/**
|
|
664
|
-
* Traverses the document with the key
|
|
793
|
+
* Traverses the document with the key-path represented by the receiver and
|
|
665
794
|
* returns the corresponding object or value.
|
|
666
795
|
*/
|
|
667
796
|
get value(): any | undefined;
|
|
668
797
|
/**
|
|
669
798
|
* Returns the value at the previously specified key in the document as a
|
|
670
|
-
*
|
|
799
|
+
* {@link Counter} if possible, otherwise returns `null`.
|
|
671
800
|
*/
|
|
672
801
|
get counter(): Counter | null;
|
|
673
802
|
/**
|
|
674
803
|
* Returns the value at the previously specified key in the document as a
|
|
675
|
-
*
|
|
804
|
+
* {@link Register} if possible, otherwise returns `null`.
|
|
676
805
|
*/
|
|
677
806
|
get register(): Register | null;
|
|
678
807
|
/**
|
|
679
|
-
* Returns the value at the previously specified key in the document as
|
|
680
|
-
*
|
|
808
|
+
* Returns the value at the previously specified key in the document as an
|
|
809
|
+
* {@link RGA} if possible, otherwise returns `null`.
|
|
810
|
+
*
|
|
811
|
+
* @deprecated: RGA usage should be replaced. Use arrays inside Registers
|
|
812
|
+
* instead.
|
|
681
813
|
*/
|
|
682
814
|
get rga(): RGA | null;
|
|
683
815
|
/**
|
|
684
|
-
* Returns the value at the previously specified key in the document as
|
|
685
|
-
*
|
|
816
|
+
* Returns the value at the previously specified key in the document as an
|
|
817
|
+
* {@link AttachmentToken} if possible, otherwise returns `null`.
|
|
686
818
|
*/
|
|
687
819
|
get attachmentToken(): AttachmentToken | null;
|
|
688
820
|
/** @internal */
|
|
@@ -692,8 +824,9 @@ declare class DocumentPath {
|
|
|
692
824
|
}
|
|
693
825
|
/**
|
|
694
826
|
* Mutable version of {@link DocumentPath} allowing you to mutate a document at
|
|
695
|
-
* a specific key
|
|
696
|
-
*
|
|
827
|
+
* a specific key-path. You don't create a `MutableDocumentPath` directly but
|
|
828
|
+
* obtain one via the {@link MutableDocument.path | path} property or the
|
|
829
|
+
* {@link MutableDocument.at | at()} method of {@link MutableDocument}.
|
|
697
830
|
*/
|
|
698
831
|
declare class MutableDocumentPath {
|
|
699
832
|
/** The (mutable) document this path belongs to. */
|
|
@@ -721,32 +854,35 @@ declare class MutableDocumentPath {
|
|
|
721
854
|
*/
|
|
722
855
|
at(keyPathOrIndex: string | number): MutableDocumentPath;
|
|
723
856
|
/**
|
|
724
|
-
* Traverses the document with the key
|
|
857
|
+
* Traverses the document with the key-path represented by the receiver and
|
|
725
858
|
* returns the corresponding object or value.
|
|
726
859
|
*/
|
|
727
860
|
get value(): any | undefined;
|
|
728
861
|
/**
|
|
729
862
|
* Returns the value at the previously specified key in the document as a
|
|
730
|
-
*
|
|
863
|
+
* {@link MutableCounter} if possible, otherwise returns `null`.
|
|
731
864
|
*/
|
|
732
865
|
get counter(): MutableCounter | null;
|
|
733
866
|
/**
|
|
734
867
|
* Returns the value at the previously specified key in the document as a
|
|
735
|
-
*
|
|
868
|
+
* {@link MutableRegister} if possible, otherwise returns `null`.
|
|
736
869
|
*/
|
|
737
870
|
get register(): MutableRegister | null;
|
|
738
871
|
/**
|
|
739
872
|
* Returns the value at the previously specified key in the document as a
|
|
740
|
-
*
|
|
873
|
+
* {@link MutableRGA} if possible, otherwise returns `null`.
|
|
874
|
+
*
|
|
875
|
+
* @deprecated: RGA usage should be replaced. Use arrays inside Registers
|
|
876
|
+
* instead.
|
|
741
877
|
*/
|
|
742
878
|
get rga(): MutableRGA | null;
|
|
743
879
|
/**
|
|
744
880
|
* Returns the value at the previously specified key in the document as a
|
|
745
|
-
*
|
|
881
|
+
* {@link AttachmentToken} if possible, otherwise returns `null`.
|
|
746
882
|
*/
|
|
747
883
|
get attachmentToken(): AttachmentToken | null;
|
|
748
884
|
/**
|
|
749
|
-
* Sets a value at the document's key
|
|
885
|
+
* Sets a value at the document's key-path defined by the receiver.
|
|
750
886
|
*
|
|
751
887
|
* @param isDefault Represents whether or not the value should be set as a
|
|
752
888
|
* default value. Set this to `true` if you want to set a default value that
|
|
@@ -755,7 +891,7 @@ declare class MutableDocumentPath {
|
|
|
755
891
|
*/
|
|
756
892
|
set(value: any, isDefault?: boolean): void;
|
|
757
893
|
/**
|
|
758
|
-
* Removes a value at the document's key
|
|
894
|
+
* Removes a value at the document's key-path defined by the receiver.
|
|
759
895
|
* If removing an index from an `RGA`, any subsequent indexes will be shifted
|
|
760
896
|
* left to fill the gap.
|
|
761
897
|
*/
|
|
@@ -782,8 +918,6 @@ declare class MutableDocumentPath {
|
|
|
782
918
|
private recordUpdateResult;
|
|
783
919
|
}
|
|
784
920
|
|
|
785
|
-
/** Represents a unique identifier for a {@link Document}. */
|
|
786
|
-
declare type DocumentIDValue = any;
|
|
787
921
|
/**
|
|
788
922
|
* A document value is a JavaScript object containing values for keys that
|
|
789
923
|
* can be serialized via CBOR.
|
|
@@ -791,22 +925,6 @@ declare type DocumentIDValue = any;
|
|
|
791
925
|
declare type DocumentValue = Record<string, any>;
|
|
792
926
|
/** A document belonging to a {@link Collection} with an inner value. */
|
|
793
927
|
declare class Document {
|
|
794
|
-
/**
|
|
795
|
-
* Returns a string representation of the passed in document ID value.
|
|
796
|
-
*
|
|
797
|
-
* The returned string can be used directly in queries that you use with
|
|
798
|
-
* other Ditto functions. For example you could create a query that was like
|
|
799
|
-
* this:
|
|
800
|
-
*
|
|
801
|
-
* ``` TypeScript
|
|
802
|
-
* collection.find(`_id == ${Document.stringForID(documentID)}`)
|
|
803
|
-
* ```
|
|
804
|
-
*/
|
|
805
|
-
static stringForID(documentID: DocumentIDValue): string;
|
|
806
|
-
/**
|
|
807
|
-
* Returns a byte representation of the document ID value as base64 string.
|
|
808
|
-
*/
|
|
809
|
-
static base64StringForID(documentID: DocumentIDValue): string;
|
|
810
928
|
/**
|
|
811
929
|
* Returns a hash that represents the passed in document(s).
|
|
812
930
|
*/
|
|
@@ -817,9 +935,9 @@ declare class Document {
|
|
|
817
935
|
*/
|
|
818
936
|
static hashMnemonic(documentOrMany: Document | Document[]): string;
|
|
819
937
|
/**
|
|
820
|
-
* Returns the document ID
|
|
938
|
+
* Returns the document ID.
|
|
821
939
|
*/
|
|
822
|
-
get
|
|
940
|
+
get id(): DocumentID;
|
|
823
941
|
/**
|
|
824
942
|
* Returns the document path at the root of the document.
|
|
825
943
|
*/
|
|
@@ -835,6 +953,8 @@ declare class Document {
|
|
|
835
953
|
*/
|
|
836
954
|
at(keyPathOrIndex: string | number): DocumentPath;
|
|
837
955
|
/** @internal */
|
|
956
|
+
constructor();
|
|
957
|
+
/** @internal */
|
|
838
958
|
static idCBOR(document: Document): Uint8Array;
|
|
839
959
|
/** @internal */
|
|
840
960
|
static canonicalizedIDCBOR(idCBOR: Uint8Array): Uint8Array;
|
|
@@ -853,7 +973,7 @@ declare class MutableDocument {
|
|
|
853
973
|
/**
|
|
854
974
|
* Returns the ID of the document.
|
|
855
975
|
*/
|
|
856
|
-
get
|
|
976
|
+
get id(): DocumentID;
|
|
857
977
|
/**
|
|
858
978
|
* Returns the document path at the root of the document.
|
|
859
979
|
*/
|
|
@@ -878,10 +998,6 @@ declare class MutableDocument {
|
|
|
878
998
|
static isIDCBORCanonical: typeof Document.isIDCBORCanonical;
|
|
879
999
|
}
|
|
880
1000
|
/** @internal */
|
|
881
|
-
declare function validateDocumentIDValue(id: DocumentIDValue): DocumentIDValue;
|
|
882
|
-
/** @internal */
|
|
883
|
-
declare function validateDocumentIDCBOR(idCBOR: Uint8Array): Uint8Array;
|
|
884
|
-
/** @internal */
|
|
885
1001
|
declare const documentBridge: Bridge<Document, "CDocument_t">;
|
|
886
1002
|
/** @internal */
|
|
887
1003
|
declare const mutableDocumentBridge: Bridge<MutableDocument, "CDocument_t">;
|
|
@@ -915,6 +1031,7 @@ declare class Attachment {
|
|
|
915
1031
|
/** @internal */
|
|
916
1032
|
constructor(ditto: Ditto, token: AttachmentToken);
|
|
917
1033
|
}
|
|
1034
|
+
/** @internal */
|
|
918
1035
|
declare const attachmentBridge: Bridge<Attachment, "AttachmentHandle_t">;
|
|
919
1036
|
|
|
920
1037
|
/**
|
|
@@ -999,11 +1116,15 @@ declare class AttachmentFetcher implements PromiseLike<Attachment | null> {
|
|
|
999
1116
|
private cancelToken;
|
|
1000
1117
|
}
|
|
1001
1118
|
|
|
1119
|
+
/** @internal */
|
|
1002
1120
|
declare type SubscriptionContextInfo = {
|
|
1003
1121
|
ditto: Ditto;
|
|
1004
1122
|
collectionName: string;
|
|
1005
1123
|
query: string;
|
|
1006
1124
|
queryArgsCBOR: Uint8Array | null;
|
|
1125
|
+
orderBys: OrderBy[];
|
|
1126
|
+
limit: number;
|
|
1127
|
+
offset: number;
|
|
1007
1128
|
};
|
|
1008
1129
|
/**
|
|
1009
1130
|
* Used to subscribe to receive updates from remote peers about matching
|
|
@@ -1032,7 +1153,7 @@ declare class Subscription {
|
|
|
1032
1153
|
*/
|
|
1033
1154
|
cancel(): void;
|
|
1034
1155
|
/** @internal */
|
|
1035
|
-
constructor(collection: Collection, query: string, queryArgsCBOR: Uint8Array | null);
|
|
1156
|
+
constructor(collection: Collection, query: string, queryArgsCBOR: Uint8Array | null, orderBys: OrderBy[], limit: number, offset: number);
|
|
1036
1157
|
/**
|
|
1037
1158
|
* The collection this subscription belongs to.
|
|
1038
1159
|
* @internal Because not exposed in any of the other SDKs (yet?).
|
|
@@ -1050,8 +1171,8 @@ declare class Subscription {
|
|
|
1050
1171
|
}
|
|
1051
1172
|
|
|
1052
1173
|
/**
|
|
1053
|
-
* Maps a {@link
|
|
1054
|
-
* @link UpdateResult | update results}. This is the data structure you get
|
|
1174
|
+
* Maps a {@link DocumentID} to an array of
|
|
1175
|
+
* {@link UpdateResult | update results}. This is the data structure you get
|
|
1055
1176
|
* when {@link PendingCursorOperation.update | updating} a set of documents
|
|
1056
1177
|
* with detailed info about the performed updates.
|
|
1057
1178
|
*/
|
|
@@ -1060,14 +1181,14 @@ declare class UpdateResultsMap {
|
|
|
1060
1181
|
* Returns an array of {@link UpdateResult | update results} associated with
|
|
1061
1182
|
* the `documentID` or undefined if not found.
|
|
1062
1183
|
*/
|
|
1063
|
-
get(
|
|
1184
|
+
get(documentIDOrValue: DocumentID | DocumentIDValue): UpdateResult[] | undefined;
|
|
1064
1185
|
/**
|
|
1065
|
-
* Returns all contained keys, i.e. {@link
|
|
1186
|
+
* Returns all contained keys, i.e. {@link DocumentID | document IDs}
|
|
1066
1187
|
* contained in this map.
|
|
1067
1188
|
*/
|
|
1068
|
-
keys():
|
|
1189
|
+
keys(): DocumentID[];
|
|
1069
1190
|
/** @internal */
|
|
1070
|
-
constructor(documentIDs:
|
|
1191
|
+
constructor(documentIDs: DocumentID[], updateResultsByDocumentIDString: object);
|
|
1071
1192
|
private documentIDs;
|
|
1072
1193
|
private updateResultsByDocumentIDString;
|
|
1073
1194
|
}
|
|
@@ -1257,20 +1378,20 @@ declare type QueryObservationHandler = (documents: Document[], event: LiveQueryE
|
|
|
1257
1378
|
* {@link Document | documents} as an immediate return value, or you can
|
|
1258
1379
|
* establish either a live query or a subscription, which both work over time.
|
|
1259
1380
|
*
|
|
1260
|
-
* A live query, established by calling {@link observe | observe()}, will notify
|
|
1381
|
+
* A live query, established by calling {@link PendingCursorOperation.observe | observe()}, will notify
|
|
1261
1382
|
* you every time there's an update to a document that matches the query you
|
|
1262
1383
|
* provided in the preceding `find`-like call.
|
|
1263
1384
|
*
|
|
1264
|
-
* A subscription, established by calling {@link subscribe | subscribe()}, will
|
|
1385
|
+
* A subscription, established by calling {@link PendingCursorOperation.subscribe | subscribe()}, will
|
|
1265
1386
|
* act as a signal to other peers that the device connects to that you would
|
|
1266
1387
|
* like to receive updates from them about documents that match the query you
|
|
1267
1388
|
* provided in the preceding `find`-like call.
|
|
1268
1389
|
*
|
|
1269
|
-
* Calling {@link observe | observe()} will generate both a subscription and a
|
|
1390
|
+
* Calling {@link PendingCursorOperation.observe | observe()} will generate both a subscription and a
|
|
1270
1391
|
* live query at the same time.
|
|
1271
1392
|
*
|
|
1272
1393
|
* If you'd like to only observe local changes then you can call
|
|
1273
|
-
* {@link observeLocal | observeLocal()}.
|
|
1394
|
+
* {@link PendingCursorOperation.observeLocal | observeLocal()}.
|
|
1274
1395
|
*
|
|
1275
1396
|
* Update and remove functionality is also exposed through this object.
|
|
1276
1397
|
*/
|
|
@@ -1346,7 +1467,7 @@ declare class PendingCursorOperation implements PromiseLike<Document[]> {
|
|
|
1346
1467
|
*
|
|
1347
1468
|
* The `handler` block will be called when local or remote changes are
|
|
1348
1469
|
* made to documents that match the query generated by the chain of operations
|
|
1349
|
-
* that precedes the call to {@link observe | observe()}. The returned
|
|
1470
|
+
* that precedes the call to {@link PendingCursorOperation.observe | observe()}. The returned
|
|
1350
1471
|
* {@link LiveQuery} object must be kept in scope for as long as you want the
|
|
1351
1472
|
* provided `handler` to be called when an update occurs.
|
|
1352
1473
|
*
|
|
@@ -1366,7 +1487,7 @@ declare class PendingCursorOperation implements PromiseLike<Document[]> {
|
|
|
1366
1487
|
*
|
|
1367
1488
|
* The `handler` block will be called when local or remote changes are
|
|
1368
1489
|
* made to documents that match the query generated by the chain of operations
|
|
1369
|
-
* that precedes the call to {@link observe | observe()}. The returned
|
|
1490
|
+
* that precedes the call to {@link PendingCursorOperation.observe | observe()}. The returned
|
|
1370
1491
|
* {@link LiveQuery} object must be kept in scope for as long as you want the
|
|
1371
1492
|
* provided `handler` to be called when an update occurs.
|
|
1372
1493
|
*
|
|
@@ -1384,7 +1505,7 @@ declare class PendingCursorOperation implements PromiseLike<Document[]> {
|
|
|
1384
1505
|
*
|
|
1385
1506
|
* This won't subscribe to receive changes made remotely by others and so it
|
|
1386
1507
|
* will only fire updates when a local change is made. If you want to receive
|
|
1387
|
-
* remotely performed updates as well then use {@link observe | observe()} or
|
|
1508
|
+
* remotely performed updates as well then use {@link PendingCursorOperation.observe | observe()} or
|
|
1388
1509
|
* call {@link subscribe | subscribe()} with the relevant query. The returned
|
|
1389
1510
|
* {@link LiveQuery} object must be kept in scope for as long as you want the
|
|
1390
1511
|
* provided `eventHandler` to be called when an update occurs.
|
|
@@ -1403,7 +1524,7 @@ declare class PendingCursorOperation implements PromiseLike<Document[]> {
|
|
|
1403
1524
|
*
|
|
1404
1525
|
* The `handler` block will be called when local or remote changes are
|
|
1405
1526
|
* made to documents that match the query generated by the chain of operations
|
|
1406
|
-
* that precedes the call to {@link observe | observe()}. The returned
|
|
1527
|
+
* that precedes the call to {@link PendingCursorOperation.observe | observe()}. The returned
|
|
1407
1528
|
* {@link LiveQuery} object must be kept in scope for as long as you want the
|
|
1408
1529
|
* provided `handler` to be called when an update occurs.
|
|
1409
1530
|
*
|
|
@@ -1423,7 +1544,7 @@ declare class PendingCursorOperation implements PromiseLike<Document[]> {
|
|
|
1423
1544
|
* @returns An array promise containing the IDs of the documents that were
|
|
1424
1545
|
* removed.
|
|
1425
1546
|
*/
|
|
1426
|
-
remove(): Promise<
|
|
1547
|
+
remove(): Promise<DocumentID[]>;
|
|
1427
1548
|
/**
|
|
1428
1549
|
* Evicts all documents that match the query generated by the preceding
|
|
1429
1550
|
* function chaining.
|
|
@@ -1431,7 +1552,7 @@ declare class PendingCursorOperation implements PromiseLike<Document[]> {
|
|
|
1431
1552
|
* @return An array promise containing the IDs of the documents that were
|
|
1432
1553
|
* evicted.
|
|
1433
1554
|
*/
|
|
1434
|
-
evict(): Promise<
|
|
1555
|
+
evict(): Promise<DocumentID[]>;
|
|
1435
1556
|
/**
|
|
1436
1557
|
* Executes the query generated by the preceding function chaining and return
|
|
1437
1558
|
* the list of matching documents.
|
|
@@ -1470,33 +1591,33 @@ declare class PendingCursorOperation implements PromiseLike<Document[]> {
|
|
|
1470
1591
|
*/
|
|
1471
1592
|
declare type SingleObservationHandler = (document: Document | null, event: SingleDocumentLiveQueryEvent, signalNext?: () => void) => void | Promise<void>;
|
|
1472
1593
|
/**
|
|
1473
|
-
* These objects are returned when using {@link findByID | findByID()}
|
|
1594
|
+
* These objects are returned when using {@link Collection.findByID | findByID()}
|
|
1474
1595
|
* functionality on {@link Collection | collections}.
|
|
1475
1596
|
*
|
|
1476
1597
|
* You can either call {@link exec | exec()} on the object to get an immediate
|
|
1477
1598
|
* return value, or you can establish either a live query or a subscription,
|
|
1478
1599
|
* which both work over time.
|
|
1479
1600
|
*
|
|
1480
|
-
* A live query, established by calling {@link observe | observe()}, will notify
|
|
1601
|
+
* A live query, established by calling {@link PendingIDSpecificOperation.observe | observe()}, will notify
|
|
1481
1602
|
* you every time there's an update to the document with the ID you provided in
|
|
1482
|
-
* the preceding {@link findByID | findByID()} call.
|
|
1603
|
+
* the preceding {@link Collection.findByID | findByID()} call.
|
|
1483
1604
|
*
|
|
1484
|
-
* A subscription, established by calling {@link subscribe | subscribe()}, will
|
|
1605
|
+
* A subscription, established by calling {@link PendingIDSpecificOperation.subscribe | subscribe()}, will
|
|
1485
1606
|
* act as a signal to other peers that you would like to receive updates from
|
|
1486
1607
|
* them about the document with the ID you provided in the preceding
|
|
1487
|
-
* {@link findByID | findByID()} call.
|
|
1608
|
+
* {@link Collection.findByID | findByID()} call.
|
|
1488
1609
|
*
|
|
1489
|
-
* Calling {@link observe | observe()} will generate both a subscription and a
|
|
1610
|
+
* Calling {@link PendingIDSpecificOperation.observe | observe()} will generate both a subscription and a
|
|
1490
1611
|
* live query at the same time.
|
|
1491
1612
|
*
|
|
1492
1613
|
* If you'd like to only observe local changes then you can call
|
|
1493
|
-
* {@link observeLocal | observeLocal()}.
|
|
1614
|
+
* {@link PendingIDSpecificOperation.observeLocal | observeLocal()}.
|
|
1494
1615
|
*
|
|
1495
1616
|
* Update and remove functionality is also exposed through this object.
|
|
1496
1617
|
*/
|
|
1497
1618
|
declare class PendingIDSpecificOperation implements PromiseLike<Document | undefined> {
|
|
1498
1619
|
/** The ID of the document this operation operates on. */
|
|
1499
|
-
readonly documentID:
|
|
1620
|
+
readonly documentID: DocumentID;
|
|
1500
1621
|
/** The collection the receiver is operating on. */
|
|
1501
1622
|
readonly collection: Collection;
|
|
1502
1623
|
/**
|
|
@@ -1519,8 +1640,8 @@ declare class PendingIDSpecificOperation implements PromiseLike<Document | undef
|
|
|
1519
1640
|
* locally and remotely.
|
|
1520
1641
|
*
|
|
1521
1642
|
* The `handler` closure will be called when local or remote changes are
|
|
1522
|
-
* made to the document referenced by the {@link findByID | findByID()} call
|
|
1523
|
-
* that precedes the call to {@link observe | observe()}.
|
|
1643
|
+
* made to the document referenced by the {@link Collection.findByID | findByID()} call
|
|
1644
|
+
* that precedes the call to {@link PendingIDSpecificOperation.observe | observe()}.
|
|
1524
1645
|
*
|
|
1525
1646
|
* The returned {@link LiveQuery} object must be kept in scope for as long as
|
|
1526
1647
|
* you want the provided `handler` to be called when an update occurs.
|
|
@@ -1528,7 +1649,7 @@ declare class PendingIDSpecificOperation implements PromiseLike<Document | undef
|
|
|
1528
1649
|
* @param handler A closure that will be called every time there is a
|
|
1529
1650
|
* transaction committed to the store that involves a modification to the
|
|
1530
1651
|
* document with the relevant ID in the collection that
|
|
1531
|
-
* {@link observe | observe()} was called on.
|
|
1652
|
+
* {@link PendingIDSpecificOperation.observe | observe()} was called on.
|
|
1532
1653
|
*
|
|
1533
1654
|
* @return A {@link LiveQuery} object that must be kept in scope for as long
|
|
1534
1655
|
* as you want to keep receiving updates.
|
|
@@ -1540,8 +1661,8 @@ declare class PendingIDSpecificOperation implements PromiseLike<Document | undef
|
|
|
1540
1661
|
* to deliver the next event.
|
|
1541
1662
|
*
|
|
1542
1663
|
* The `handler` closure will be called when local or remote changes are
|
|
1543
|
-
* made to the document referenced by the {@link findByID | findByID()} call
|
|
1544
|
-
* that precedes the call to {@link observe | observe()}.
|
|
1664
|
+
* made to the document referenced by the {@link Collection.findByID | findByID()} call
|
|
1665
|
+
* that precedes the call to {@link PendingIDSpecificOperation.observe | observe()}.
|
|
1545
1666
|
*
|
|
1546
1667
|
* The returned {@link LiveQuery} object must be kept in scope for as long as
|
|
1547
1668
|
* you want the provided `handler` to be called when an update occurs.
|
|
@@ -1549,7 +1670,7 @@ declare class PendingIDSpecificOperation implements PromiseLike<Document | undef
|
|
|
1549
1670
|
* @param handler A closure that will be called every time there is a
|
|
1550
1671
|
* transaction committed to the store that involves a modification to the
|
|
1551
1672
|
* document with the relevant ID in the collection that
|
|
1552
|
-
* {@link observe | observe()} was called on.
|
|
1673
|
+
* {@link PendingIDSpecificOperation.observe | observe()} was called on.
|
|
1553
1674
|
*
|
|
1554
1675
|
* @return A {@link LiveQuery} object that must be kept in scope for as long
|
|
1555
1676
|
* as you want to keep receiving updates.
|
|
@@ -1561,9 +1682,9 @@ declare class PendingIDSpecificOperation implements PromiseLike<Document | undef
|
|
|
1561
1682
|
*
|
|
1562
1683
|
* This won't subscribe to receive changes made remotely by others and so it
|
|
1563
1684
|
* will only fire updates when a local change is made. If you want to receive
|
|
1564
|
-
* remotely performed updates as well then use {@link observe | observe()} or
|
|
1685
|
+
* remotely performed updates as well then use {@link PendingIDSpecificOperation.observe | observe()} or
|
|
1565
1686
|
* also call {@link subscribe | subscribe()} separately, using another
|
|
1566
|
-
* {@link findByID | findByID()} call that references the same document ID.
|
|
1687
|
+
* {@link Collection.findByID | findByID()} call that references the same document ID.
|
|
1567
1688
|
*
|
|
1568
1689
|
* The returned {@link LiveQuery} object must be kept in scope for as long
|
|
1569
1690
|
* as you want the provided `handler` to be called when an update
|
|
@@ -1572,7 +1693,7 @@ declare class PendingIDSpecificOperation implements PromiseLike<Document | undef
|
|
|
1572
1693
|
* @param handler A block that will be called every time there is a
|
|
1573
1694
|
* transaction committed to the store that involves a modification to the
|
|
1574
1695
|
* document with the relevant ID in the collection that
|
|
1575
|
-
* {@link observeLocal | observeLocal()} was called on.
|
|
1696
|
+
* {@link PendingIDSpecificOperation.observeLocal | observeLocal()} was called on.
|
|
1576
1697
|
*
|
|
1577
1698
|
* @returns A {@link LiveQuery} object that must be kept in scope for as long
|
|
1578
1699
|
* as you want to keep receiving updates.
|
|
@@ -1585,9 +1706,9 @@ declare class PendingIDSpecificOperation implements PromiseLike<Document | undef
|
|
|
1585
1706
|
*
|
|
1586
1707
|
* This won't subscribe to receive changes made remotely by others and so it
|
|
1587
1708
|
* will only fire updates when a local change is made. If you want to receive
|
|
1588
|
-
* remotely performed updates as well then use {@link observe | observe()} or
|
|
1709
|
+
* remotely performed updates as well then use {@link PendingIDSpecificOperation.observe | observe()} or
|
|
1589
1710
|
* also call {@link subscribe | subscribe()} separately, using another
|
|
1590
|
-
* {@link findByID | findByID()} call that references the same document ID.
|
|
1711
|
+
* {@link Collection.findByID | findByID()} call that references the same document ID.
|
|
1591
1712
|
*
|
|
1592
1713
|
* The returned {@link LiveQuery} object must be kept in scope for as long
|
|
1593
1714
|
* as you want the provided `handler` to be called when an update
|
|
@@ -1596,7 +1717,7 @@ declare class PendingIDSpecificOperation implements PromiseLike<Document | undef
|
|
|
1596
1717
|
* @param handler A block that will be called every time there is a
|
|
1597
1718
|
* transaction committed to the store that involves a modification to the
|
|
1598
1719
|
* document with the relevant ID in the collection that
|
|
1599
|
-
* {@link observeLocal | observeLocal()} was called on.
|
|
1720
|
+
* {@link PendingIDSpecificOperation.observeLocal | observeLocal()} was called on.
|
|
1600
1721
|
*
|
|
1601
1722
|
* @returns A {@link LiveQuery} object that must be kept in scope for as long
|
|
1602
1723
|
* as you want to keep receiving updates.
|
|
@@ -1620,7 +1741,7 @@ declare class PendingIDSpecificOperation implements PromiseLike<Document | undef
|
|
|
1620
1741
|
* Executes the find operation to return the document with the matching ID.
|
|
1621
1742
|
*
|
|
1622
1743
|
* @returns The {@link Document} promise with the ID provided in the
|
|
1623
|
-
* {@link findByID | findByID()} call or `undefined` if the document was
|
|
1744
|
+
* {@link Collection.findByID | findByID()} call or `undefined` if the document was
|
|
1624
1745
|
* not found.
|
|
1625
1746
|
*/
|
|
1626
1747
|
exec(): Promise<Document | undefined>;
|
|
@@ -1637,7 +1758,7 @@ declare class PendingIDSpecificOperation implements PromiseLike<Document | undef
|
|
|
1637
1758
|
*/
|
|
1638
1759
|
update(closure: (document: MutableDocument) => void): Promise<UpdateResult[]>;
|
|
1639
1760
|
/** @internal */
|
|
1640
|
-
constructor(documentID:
|
|
1761
|
+
constructor(documentID: DocumentID, collection: Collection);
|
|
1641
1762
|
/** @internal */
|
|
1642
1763
|
then<TResult1 = any, TResult2 = never>(onfulfilled?: ((value: any) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined): PromiseLike<TResult1 | TResult2>;
|
|
1643
1764
|
private documentIDCBOR;
|
|
@@ -1691,13 +1812,13 @@ declare class Collection {
|
|
|
1691
1812
|
* ID.
|
|
1692
1813
|
*
|
|
1693
1814
|
* The returned object can be used to find and return the document or you can
|
|
1694
|
-
* chain a call to {@link observe | observe()}, or {@link subscribe | subscribe()}
|
|
1815
|
+
* chain a call to {@link PendingIDSpecificOperation.observe | observe()}, or {@link PendingIDSpecificOperation.subscribe | subscribe()}
|
|
1695
1816
|
* if you want to get updates about the document over time. It can also be
|
|
1696
1817
|
* used to update, remove or evict the document.
|
|
1697
1818
|
*
|
|
1698
1819
|
* @param id The ID of the document to find.
|
|
1699
1820
|
*/
|
|
1700
|
-
findByID(id: DocumentIDValue): PendingIDSpecificOperation;
|
|
1821
|
+
findByID(id: DocumentID | DocumentIDValue): PendingIDSpecificOperation;
|
|
1701
1822
|
/**
|
|
1702
1823
|
* Inserts a new document into the collection and returns its ID. If the
|
|
1703
1824
|
* document already exists, the contents of both are merged by default. You
|
|
@@ -1708,7 +1829,7 @@ declare class Collection {
|
|
|
1708
1829
|
* @param options.writeStrategy Specifies the desired strategy for inserting a
|
|
1709
1830
|
* document, defaults to `'merge'`.
|
|
1710
1831
|
*/
|
|
1711
|
-
upsert(value: DocumentValue, options?: UpsertOptions): Promise<
|
|
1832
|
+
upsert(value: DocumentValue, options?: UpsertOptions): Promise<DocumentID>;
|
|
1712
1833
|
/**
|
|
1713
1834
|
* Creates a new {@link Attachment} object, which can then be inserted into a
|
|
1714
1835
|
* document. Node only, throws when running in the web browser.
|
|
@@ -1821,8 +1942,10 @@ declare class CollectionsEvent {
|
|
|
1821
1942
|
* about collections, that the collections have moved to.
|
|
1822
1943
|
*/
|
|
1823
1944
|
readonly moves: LiveQueryMove[];
|
|
1824
|
-
|
|
1945
|
+
/** @internal */
|
|
1825
1946
|
static initial(collections: Collection[]): CollectionsEvent;
|
|
1947
|
+
/** @internal */
|
|
1948
|
+
constructor(params: CollectionsEventParams);
|
|
1826
1949
|
}
|
|
1827
1950
|
|
|
1828
1951
|
/**
|
|
@@ -1831,7 +1954,7 @@ declare class CollectionsEvent {
|
|
|
1831
1954
|
*/
|
|
1832
1955
|
declare type CollectionsObservationHandler = (event: CollectionsEvent) => void | Promise<void>;
|
|
1833
1956
|
/**
|
|
1834
|
-
* These objects are returned when calling {@link collections | collections()}
|
|
1957
|
+
* These objects are returned when calling {@link Store.collections | collections()}
|
|
1835
1958
|
* on {@link Store}.
|
|
1836
1959
|
*
|
|
1837
1960
|
* They allow chaining of further collections-related functions. You can either
|
|
@@ -1839,7 +1962,7 @@ declare type CollectionsObservationHandler = (event: CollectionsEvent) => void |
|
|
|
1839
1962
|
* {@link Collection}s as an immediate return value, or you can establish either
|
|
1840
1963
|
* a live query or a subscription, which both work over time.
|
|
1841
1964
|
*
|
|
1842
|
-
* A live query, established by calling {@link observe | observe()}, will notify
|
|
1965
|
+
* A live query, established by calling {@link PendingCollectionsOperation.observe | observe()}, will notify
|
|
1843
1966
|
* you every time there's a change in the collections that the device knows
|
|
1844
1967
|
* about.
|
|
1845
1968
|
*
|
|
@@ -1847,16 +1970,8 @@ declare type CollectionsObservationHandler = (event: CollectionsEvent) => void |
|
|
|
1847
1970
|
* act as a signal to other peers that the device connects to that you would
|
|
1848
1971
|
* like to receive updates from them about the collections that they know about.
|
|
1849
1972
|
*
|
|
1850
|
-
* Calling {@link observe | observe()} will generate both a subscription and a
|
|
1973
|
+
* Calling {@link PendingCollectionsOperation.observe | observe()} will generate both a subscription and a
|
|
1851
1974
|
* live query at the same time.
|
|
1852
|
-
*
|
|
1853
|
-
* If you'd like to only observe local changes then you can call
|
|
1854
|
-
* {@link observeLocal | observeLocal()}.
|
|
1855
|
-
*
|
|
1856
|
-
* If you want to observe changes in such a way that you can signal when you're
|
|
1857
|
-
* ready for the live query to deliver a new update then you can call
|
|
1858
|
-
* {@link observeWithNextSignal | observeWithNextSignal()} or
|
|
1859
|
-
* {@link observeLocalWithNextSignal | observeLocalWithNextSignal()}.
|
|
1860
1975
|
*/
|
|
1861
1976
|
declare class PendingCollectionsOperation implements PromiseLike<Collection[]> {
|
|
1862
1977
|
/**
|
|
@@ -1976,7 +2091,7 @@ declare class Store {
|
|
|
1976
2091
|
* Private method, used only by the Portal https://github.com/getditto/ditto/pull/3652
|
|
1977
2092
|
* @internal
|
|
1978
2093
|
*/
|
|
1979
|
-
registerLiveQueryWebhook(collectionName: string, query: string, url: string): Promise<
|
|
2094
|
+
registerLiveQueryWebhook(collectionName: string, query: string, url: string): Promise<DocumentID>;
|
|
1980
2095
|
}
|
|
1981
2096
|
|
|
1982
2097
|
/** @internal */
|
|
@@ -2039,8 +2154,8 @@ declare class Ditto {
|
|
|
2039
2154
|
* When using {@link observePeers | observePeers()}, each remote peer is
|
|
2040
2155
|
* represented by a short UTF-8 "device name". By default this will be a
|
|
2041
2156
|
* truncated version of the device's hostname. It does not need to be unique
|
|
2042
|
-
* among peers. Configure the device name before calling
|
|
2043
|
-
* is too long it may be truncated.
|
|
2157
|
+
* among peers. Configure the device name before calling
|
|
2158
|
+
* {@link startSync | startSync()}. If it is too long it may be truncated.
|
|
2044
2159
|
*/
|
|
2045
2160
|
deviceName: string;
|
|
2046
2161
|
/** Returns a string identifying the version of the Ditto SDK. */
|
|
@@ -2074,7 +2189,8 @@ declare class Ditto {
|
|
|
2074
2189
|
readonly isActivated: boolean;
|
|
2075
2190
|
/**
|
|
2076
2191
|
* Returns `true` if sync is active, otherwise returns `false`. Use
|
|
2077
|
-
*
|
|
2192
|
+
* {@link startSync | startSync()} to activate and {@link stopSync | stopSync()}
|
|
2193
|
+
* to deactivate sync.
|
|
2078
2194
|
*/
|
|
2079
2195
|
readonly isSyncActive: boolean;
|
|
2080
2196
|
/**
|
|
@@ -2093,8 +2209,8 @@ declare class Ditto {
|
|
|
2093
2209
|
* (in-memory at the moment, support for IndexedDB is in development).
|
|
2094
2210
|
* Defaults to `"ditto"`.
|
|
2095
2211
|
*
|
|
2096
|
-
* @see {@link identity}
|
|
2097
|
-
* @see {@link path}
|
|
2212
|
+
* @see {@link Ditto.identity}
|
|
2213
|
+
* @see {@link Ditto.path}
|
|
2098
2214
|
*/
|
|
2099
2215
|
constructor(identity?: Identity, path?: string);
|
|
2100
2216
|
/**
|
|
@@ -2138,16 +2254,18 @@ declare class Ditto {
|
|
|
2138
2254
|
* Starts the network transports. Ditto will connect to other devices.
|
|
2139
2255
|
*
|
|
2140
2256
|
* By default Ditto will enable all peer-to-peer transport types. On **Node**,
|
|
2141
|
-
* this means
|
|
2142
|
-
*
|
|
2143
|
-
*
|
|
2257
|
+
* this means BluetoothLE, WiFi/LAN, and AWDL. On the **Web**, only connecting
|
|
2258
|
+
* via Websockets is supported. The network configuration can be
|
|
2259
|
+
* customized with {@link updateTransportConfig | updateTransportConfig()}
|
|
2260
|
+
* or replaced entirely with {@link setTransportConfig | setTransportConfig()}.
|
|
2261
|
+
*
|
|
2144
2262
|
*
|
|
2145
2263
|
* Ditto will prevent the process from exiting until sync is stopped (not
|
|
2146
2264
|
* relevant when running in the browser).
|
|
2147
2265
|
*
|
|
2148
|
-
* **NOTE**: the BluetoothLE transport on
|
|
2149
|
-
* panics if no BluetoothLE hardware is available. Therefore, contrary
|
|
2150
|
-
* the above, the BluetoothLE transport is temporarily disabled by default
|
|
2266
|
+
* **NOTE**: the BluetoothLE transport on Linux is experimental, this
|
|
2267
|
+
* method panics if no BluetoothLE hardware is available. Therefore, contrary
|
|
2268
|
+
* to the above, the BluetoothLE transport is temporarily disabled by default
|
|
2151
2269
|
* on Linux.
|
|
2152
2270
|
*
|
|
2153
2271
|
* @see {@link isSyncActive}
|
|
@@ -2244,7 +2362,6 @@ declare class ObserverManager {
|
|
|
2244
2362
|
private hasObservers;
|
|
2245
2363
|
private registerIfNeeded;
|
|
2246
2364
|
private unregisterIfNeeded;
|
|
2247
|
-
private generateToken;
|
|
2248
2365
|
private finalize;
|
|
2249
2366
|
}
|
|
2250
2367
|
|
|
@@ -2503,5 +2620,5 @@ declare class CBOR {
|
|
|
2503
2620
|
static decode(data: Uint8Array): any;
|
|
2504
2621
|
}
|
|
2505
2622
|
|
|
2506
|
-
export { Attachment, AttachmentFetchEvent, AttachmentFetchEventCompleted, AttachmentFetchEventDeleted, AttachmentFetchEventProgress, AttachmentFetchEventType, AttachmentFetcher, AttachmentToken, AuthenticationHandler, AuthenticationStatus, Authenticator, CBOR, Collection, CollectionsEvent, CollectionsEventParams, ConditionSource, Counter, CustomLogCallback, Ditto, Document, DocumentIDValue, DocumentPath, DocumentValue, Identity, IdentityManual, IdentityOfflinePlayground, IdentityOnlinePlayground, IdentityOnlineWithAuthentication, IdentitySharedKey, IdentityTypesRequiringOfflineLicenseToken, InitOptions, KeepAlive, LiveQuery, LiveQueryEvent, LiveQueryEventInitial, LiveQueryEventUpdate, LiveQueryEventUpdateParams, LiveQueryMove, LogLevel, Logger, MutableCounter, MutableDocument, MutableDocumentPath, MutableRGA, MutableRegister, NotAvailableAuthenticator, Observer, ObserverOptions, OnlineAuthenticator, PendingCursorOperation, PendingIDSpecificOperation, PresenceConnectionType, QueryArguments, QueryObservationHandler, RGA, Register, RemotePeer, SingleDocumentLiveQueryEvent, SingleObservationHandler, SortDirection, Store, Subscription, SubscriptionContextInfo, TransportCondition, TransportConfig, TransportConfigConnect, TransportConfigGlobal, TransportConfigLan, TransportConfigListen, TransportConfigListenHTTP, TransportConfigListenTCP, TransportConfigPeerToPeer, UpdateResult, UpdateResultType, UpdateResultsMap, UpsertOptions, Value, WebAssemblyModule, WriteStrategy, attachmentBridge, dittoBridge, documentBridge, init, mutableDocumentBridge, validateDocumentIDCBOR, validateDocumentIDValue };
|
|
2623
|
+
export { Attachment, AttachmentFetchEvent, AttachmentFetchEventCompleted, AttachmentFetchEventDeleted, AttachmentFetchEventProgress, AttachmentFetchEventType, AttachmentFetcher, AttachmentToken, AuthenticationHandler, AuthenticationStatus, Authenticator, CBOR, Collection, CollectionsEvent, CollectionsEventParams, CollectionsObservationHandler, ConditionSource, Counter, CustomLogCallback, Ditto, Document, DocumentID, DocumentIDValue, DocumentPath, DocumentValue, Identity, IdentityManual, IdentityOfflinePlayground, IdentityOnlinePlayground, IdentityOnlineWithAuthentication, IdentitySharedKey, IdentityTypesRequiringOfflineLicenseToken, InitOptions, KeepAlive, LiveQuery, LiveQueryEvent, LiveQueryEventInitial, LiveQueryEventUpdate, LiveQueryEventUpdateParams, LiveQueryMove, LogLevel, Logger, MutableCounter, MutableDocument, MutableDocumentPath, MutableRGA, MutableRegister, NotAvailableAuthenticator, Observer, ObserverOptions, OnlineAuthenticator, PendingCollectionsOperation, PendingCursorOperation, PendingIDSpecificOperation, PresenceConnectionType, QueryArguments, QueryObservationHandler, RGA, Register, RemotePeer, SingleDocumentLiveQueryEvent, SingleObservationHandler, SortDirection, Store, Subscription, SubscriptionContextInfo, TransportCondition, TransportConfig, TransportConfigConnect, TransportConfigGlobal, TransportConfigLan, TransportConfigListen, TransportConfigListenHTTP, TransportConfigListenTCP, TransportConfigPeerToPeer, UpdateResult, UpdateResultType, UpdateResultsMap, UpsertOptions, Value, WebAssemblyModule, WriteStrategy, attachmentBridge, dittoBridge, documentBridge, init, mutableDocumentBridge, validateDocumentIDCBOR, validateDocumentIDValue };
|
|
2507
2624
|
//# sourceMappingURL=ditto.d.ts.map
|