@dittolive/ditto 2.0.2 → 2.0.3

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/types/ditto.d.ts CHANGED
@@ -478,19 +478,26 @@ declare class DocumentID {
478
478
  /**
479
479
  * Returns a string representation of the receiver.
480
480
  *
481
+ * If you need a string representation to be used directly in a query,
482
+ * please use `toQueryCompatibleString()` instead.
483
+ */
484
+ toString(): string;
485
+ /**
486
+ * Returns a byte representation of the document ID value as base64 string.
487
+ */
488
+ toBase64String(): string;
489
+ /**
490
+ * Returns a query compatible string representation of the receiver.
491
+ *
481
492
  * The returned string can be used directly in queries that you use with
482
493
  * other Ditto functions. For example you could create a query that was like
483
494
  * this:
484
495
  *
485
496
  * ``` TypeScript
486
- * collection.find(`_id == ${documentID.toString()}`)
497
+ * collection.find(`_id == ${documentID.toQueryCompatibleString()}`)
487
498
  * ```
488
499
  */
489
- toString(): string;
490
- /**
491
- * Returns a byte representation of the document ID value as base64 string.
492
- */
493
- toBase64String(): string;
500
+ toQueryCompatibleString(): string;
494
501
  /** @internal */
495
502
  toCBOR(): Uint8Array;
496
503
  }
@@ -1113,19 +1120,11 @@ declare class AttachmentFetcher implements PromiseLike<Attachment | null> {
1113
1120
  readonly eventHandler: (attachmentFetchEvent: AttachmentFetchEvent) => void | null;
1114
1121
  /** @internal */
1115
1122
  constructor(ditto: Ditto, token: AttachmentToken, eventHandler?: (attachmentFetchEvent: AttachmentFetchEvent) => void);
1116
- private cancelToken;
1123
+ private cancelTokenPromise;
1124
+ private static finalizationRegistry;
1125
+ private static stopWithContextInfo;
1117
1126
  }
1118
1127
 
1119
- /** @internal */
1120
- declare type SubscriptionContextInfo = {
1121
- ditto: Ditto;
1122
- collectionName: string;
1123
- query: string;
1124
- queryArgsCBOR: Uint8Array | null;
1125
- orderBys: OrderBy[];
1126
- limit: number;
1127
- offset: number;
1128
- };
1129
1128
  /**
1130
1129
  * Used to subscribe to receive updates from remote peers about matching
1131
1130
  * documents.
@@ -1867,10 +1866,10 @@ declare class Collection {
1867
1866
  * will not automatically be downloaded along with the document. You trigger
1868
1867
  * an attachment to be downloaded locally to a device by calling this method.
1869
1868
  * It will report events relating to the attachment fetch attempt as it tries
1870
- * to download it. The `onFetchEvent` block may be called multiple times with
1869
+ * to download it. The `eventHandler` block may be called multiple times with
1871
1870
  * progress events. It will then be called with either a `Completed` event or
1872
1871
  * a `Deleted` event. If downloading the attachment succeeds then the
1873
- * `Completed` event that the `callback` will be called with will hold a
1872
+ * `Completed` event that the `eventHandler` will be called with will hold a
1874
1873
  * reference to the downloaded attachment.
1875
1874
  *
1876
1875
  * @param token The {@link AttachmentToken} relevant to the attachment that
@@ -1878,6 +1877,10 @@ declare class Collection {
1878
1877
  *
1879
1878
  * @param eventHandler An optional callback that will be called when there is
1880
1879
  * an update to the status of the attachment fetch attempt.
1880
+ *
1881
+ * @return An `AttachmentFetcher` object, which must be kept alive for the
1882
+ * fetch request to proceed and for you to be notified about the attachment's
1883
+ * fetch status changes.
1881
1884
  */
1882
1885
  fetchAttachment(token: AttachmentToken, eventHandler?: (AttachmentFetchEvent: any) => void): AttachmentFetcher;
1883
1886
  /** @internal */
@@ -2620,5 +2623,5 @@ declare class CBOR {
2620
2623
  static decode(data: Uint8Array): any;
2621
2624
  }
2622
2625
 
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 };
2626
+ 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, TransportCondition, TransportConfig, TransportConfigConnect, TransportConfigGlobal, TransportConfigLan, TransportConfigListen, TransportConfigListenHTTP, TransportConfigListenTCP, TransportConfigPeerToPeer, UpdateResult, UpdateResultType, UpdateResultsMap, UpsertOptions, Value, WebAssemblyModule, WriteStrategy, attachmentBridge, dittoBridge, documentBridge, init, mutableDocumentBridge, validateDocumentIDCBOR, validateDocumentIDValue };
2624
2627
  //# sourceMappingURL=ditto.d.ts.map