@dittolive/ditto 1.1.1 → 1.1.2

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
@@ -437,6 +437,8 @@ interface IdentityOnlineWithAuthentication {
437
437
  * `Ditto` instance.
438
438
  */
439
439
  declare type Identity = IdentityDevelopment | IdentityOfflinePlayground | IdentitySharedKey | IdentityProduction | IdentityManual | IdentityOnlinePlayground | IdentityOnline | IdentityOnlineWithAuthentication;
440
+ /** The list of identity types that require activation through an offlineLicenseToken */
441
+ declare const IdentityTypesRequiringOfflineLicenseToken: string[];
440
442
 
441
443
  /**
442
444
  * TODO: document.
@@ -1718,8 +1720,8 @@ declare class Collection {
1718
1720
  * attachment into a document.
1719
1721
  *
1720
1722
  * ``` JavaScript
1721
- * const attachment = collection.newAttachment('/path/to/my/file.pdf')
1722
- * collection.insert({ _id: '123', attachment, other: 'some-string' })
1723
+ * const attachment = await collection.newAttachment('/path/to/my/file.pdf')
1724
+ * await collection.insert({ _id: '123', attachment, other: 'some-string' })
1723
1725
  * }
1724
1726
  * ```
1725
1727
  *
@@ -1730,7 +1732,7 @@ declare class Collection {
1730
1732
  */
1731
1733
  newAttachment(pathOrData: string | Uint8Array, metadata?: {
1732
1734
  [key: string]: string;
1733
- }): Attachment;
1735
+ }): Promise<Attachment>;
1734
1736
  /**
1735
1737
  * Trigger an attachment to be downloaded locally to the device and observe
1736
1738
  * its progress as it does so.
@@ -1962,14 +1964,14 @@ declare class Store {
1962
1964
  * Returns the names of all available collections in the store of the
1963
1965
  * related {@link Ditto} instance.
1964
1966
  */
1965
- collectionNames(): string[];
1967
+ collectionNames(): Promise<string[]>;
1966
1968
  /** @internal */
1967
1969
  constructor(ditto: Ditto);
1968
1970
  /**
1969
1971
  * Private method, used only by the Portal https://github.com/getditto/ditto/pull/3652
1970
1972
  * @internal
1971
1973
  */
1972
- registerLiveQueryWebhook(collectionName: string, query: string, url: string): DocumentIDValue;
1974
+ registerLiveQueryWebhook(collectionName: string, query: string, url: string): Promise<DocumentIDValue>;
1973
1975
  }
1974
1976
 
1975
1977
  /** @internal */
@@ -2065,9 +2067,9 @@ declare class Ditto {
2065
2067
  */
2066
2068
  readonly siteID: number | BigInt;
2067
2069
  /**
2068
- * Returns `true` if a license token has been set, otherwise returns `false`.
2070
+ * Returns `true` if an offline license token has been set, otherwise returns `false`.
2069
2071
  *
2070
- * @see {@link setLicenseToken | setLicenseToken()}
2072
+ * @see {@link setOfflineOnlyLicenseToken | setOfflineOnlyLicenseToken()}
2071
2073
  */
2072
2074
  readonly isActivated: boolean;
2073
2075
  /**
@@ -2103,17 +2105,37 @@ declare class Ditto {
2103
2105
  */
2104
2106
  constructor(identity?: Identity, path?: string);
2105
2107
  /**
2106
- * Activate a `Ditto` instance by setting a license token. You cannot sync
2107
- * with `Ditto` before you have activated it.
2108
+ * @deprecated use {@link setOfflineOnlyLicenseToken | setOfflineOnlyLicenseToken()} instead.
2109
+ * Activate a `Ditto` instance by setting an offline only license token. You cannot initiate sync
2110
+ * with `Ditto` before you have activated it. The offline license token is only valid for identities
2111
+ * of type `development`, `manual`, `offlinePlayground`, and `sharedKey`.
2108
2112
  *
2109
2113
  * @param licenseToken the license token to activate the `Ditto` instance
2110
- * with. You can find yours on the Ditto portal (https://portal.ditto.live).
2114
+ * with. You can find yours on the [Ditto portal](https://portal.ditto.live).
2115
+ */
2116
+ setAccessLicense(accessLicense: string): void;
2117
+ /**
2118
+ * Activate a `Ditto` instance by setting an offline only license token. You cannot initiate sync
2119
+ * with `Ditto` before you have activated it. The offline license token is only valid for identities
2120
+ * of type `development`, `manual`, `offlinePlayground`, and `sharedKey`.
2121
+ *
2122
+ * @deprecated use {@link setOfflineOnlyLicenseToken} for identities of type `development`, `manual`,
2123
+ * `offlinePlayground`, and `sharedKey`.
2124
+ *
2125
+ *
2126
+ * @param licenseToken the license token to activate the `Ditto` instance
2127
+ * with. You can find yours on the [Ditto portal](https://portal.ditto.live).
2111
2128
  */
2112
2129
  setLicenseToken(licenseToken: string): void;
2113
2130
  /**
2114
- * @deprecated use {@link setLicenseToken | setLicenseToken()} instead.
2131
+ * Activate a `Ditto` instance by setting an offline only license token. You cannot initiate sync
2132
+ * with `Ditto` before you have activated it. The offline license token is only valid for identities
2133
+ * of type `development`, `manual`, `offlinePlayground`, and `sharedKey`.
2134
+ *
2135
+ * @param licenseToken the license token to activate the `Ditto` instance
2136
+ * with. You can find yours on the [Ditto portal](https://portal.ditto.live).
2115
2137
  */
2116
- setAccessLicense(accessLicense: string): void;
2138
+ setOfflineOnlyLicenseToken(licenseToken: string): void;
2117
2139
  /**
2118
2140
  * Returns the current transport configuration, frozen. If you want to modify
2119
2141
  * the transport config, make a {@link TransportConfig.copy | copy} first. Or
@@ -2614,5 +2636,5 @@ declare class CBOR {
2614
2636
  static decode(data: Uint8Array): any;
2615
2637
  }
2616
2638
 
2617
- export { Attachment, AttachmentFetchEvent, AttachmentFetchEventCompleted, AttachmentFetchEventDeleted, AttachmentFetchEventProgress, AttachmentFetchEventType, AttachmentFetcher, AttachmentToken, AuthenticationHandler, AuthenticationStatus, Authenticator, CBOR, Collection, CollectionsEvent, CollectionsEventParams, ConditionSource, Counter, CustomLogCallback, Ditto, Document, DocumentIDValue, DocumentLike, DocumentPath, DocumentValue, Identity, IdentityDevelopment, IdentityManual, IdentityOfflinePlayground, IdentityOnline, IdentityOnlinePlayground, IdentityOnlineWithAuthentication, IdentityProduction, IdentitySharedKey, InitOptions, InsertOptions, KeepAlive, LiveQuery, LiveQueryEvent, LiveQueryEventInitial, LiveQueryEventUpdate, LiveQueryEventUpdateParams, LiveQueryMove, LogLevel, Logger, MutableDocument, MutableDocumentLike, MutableDocumentPath, NotAvailableAuthenticator, Observer, ObserverOptions, OnlineAuthenticator, PendingCursorOperation, PendingIDSpecificOperation, PresenceConnectionType, QueryArguments, QueryObservationHandler, RemotePeer, SingleDocumentLiveQueryEvent, SingleObservationHandler, SortDirection, Store, Subscription, SubscriptionContextInfo, TransportCondition, TransportConfig, TransportConfigConnect, TransportConfigGlobal, TransportConfigLan, TransportConfigListen, TransportConfigListenHTTP, TransportConfigListenTCP, TransportConfigPeerToPeer, UpdateResult, UpdateResultType, UpdateResultsMap, UpsertOptions, Value, WebAssemblyModule, WriteStrategy, __log, attachmentBridge, dittoBridge, documentBridge, init, mutableDocumentBridge, validateDocumentIDCBOR, validateDocumentIDValue };
2639
+ export { Attachment, AttachmentFetchEvent, AttachmentFetchEventCompleted, AttachmentFetchEventDeleted, AttachmentFetchEventProgress, AttachmentFetchEventType, AttachmentFetcher, AttachmentToken, AuthenticationHandler, AuthenticationStatus, Authenticator, CBOR, Collection, CollectionsEvent, CollectionsEventParams, ConditionSource, Counter, CustomLogCallback, Ditto, Document, DocumentIDValue, DocumentLike, DocumentPath, DocumentValue, Identity, IdentityDevelopment, IdentityManual, IdentityOfflinePlayground, IdentityOnline, IdentityOnlinePlayground, IdentityOnlineWithAuthentication, IdentityProduction, IdentitySharedKey, IdentityTypesRequiringOfflineLicenseToken, InitOptions, InsertOptions, KeepAlive, LiveQuery, LiveQueryEvent, LiveQueryEventInitial, LiveQueryEventUpdate, LiveQueryEventUpdateParams, LiveQueryMove, LogLevel, Logger, MutableDocument, MutableDocumentLike, MutableDocumentPath, NotAvailableAuthenticator, Observer, ObserverOptions, OnlineAuthenticator, PendingCursorOperation, PendingIDSpecificOperation, PresenceConnectionType, QueryArguments, QueryObservationHandler, RemotePeer, SingleDocumentLiveQueryEvent, SingleObservationHandler, SortDirection, Store, Subscription, SubscriptionContextInfo, TransportCondition, TransportConfig, TransportConfigConnect, TransportConfigGlobal, TransportConfigLan, TransportConfigListen, TransportConfigListenHTTP, TransportConfigListenTCP, TransportConfigPeerToPeer, UpdateResult, UpdateResultType, UpdateResultsMap, UpsertOptions, Value, WebAssemblyModule, WriteStrategy, __log, attachmentBridge, dittoBridge, documentBridge, init, mutableDocumentBridge, validateDocumentIDCBOR, validateDocumentIDValue };
2618
2640
  //# sourceMappingURL=ditto.d.ts.map