replicache
Advanced tools
Comparing version 10.0.0 to 10.1.0
@@ -173,4 +173,12 @@ /** The values that can be represented in JSON */ | ||
*/ | ||
declare type Diff = readonly DiffOperation[]; | ||
declare type Diff = IndexDiff | NoIndexDiff; | ||
/** | ||
* @experimental This type is experimental and may change in the future. | ||
*/ | ||
declare type IndexDiff = readonly DiffOperation<IndexKey>[]; | ||
/** | ||
* @experimental This type is experimental and may change in the future. | ||
*/ | ||
declare type NoIndexDiff = readonly DiffOperation<string>[]; | ||
/** | ||
* The individual parts describing the changes that happened to the Replicache | ||
@@ -184,13 +192,13 @@ * data. There are three different kinds of operations: | ||
*/ | ||
declare type DiffOperation = { | ||
declare type DiffOperation<Key> = { | ||
readonly op: 'add'; | ||
readonly key: string; | ||
readonly key: Key; | ||
readonly newValue: ReadonlyJSONValue; | ||
} | { | ||
readonly op: 'del'; | ||
readonly key: string; | ||
readonly key: Key; | ||
readonly oldValue: ReadonlyJSONValue; | ||
} | { | ||
readonly op: 'change'; | ||
readonly key: string; | ||
readonly key: Key; | ||
readonly oldValue: ReadonlyJSONValue; | ||
@@ -407,4 +415,13 @@ readonly newValue: ReadonlyJSONValue; | ||
*/ | ||
declare type WatchCallback = (diff: Diff) => void; | ||
declare type WatchNoIndexCallback = (diff: NoIndexDiff) => void; | ||
declare type WatchCallbackForOptions<Options extends WatchOptions> = Options extends WatchIndexOptions ? WatchIndexCallback : WatchNoIndexCallback; | ||
/** | ||
* Function that gets passed into [[Replicache.experimentalWatch]] when doing a | ||
* watch on a secondary index map and gets called when the data in Replicache | ||
* changes. | ||
* | ||
* @experimental This type is experimental and may change in the future. | ||
*/ | ||
declare type WatchIndexCallback = (diff: IndexDiff) => void; | ||
/** | ||
* Options for [[Replicache.experimentalWatch]]. | ||
@@ -414,7 +431,22 @@ * | ||
*/ | ||
interface WatchOptions { | ||
declare type WatchOptions = WatchIndexOptions | WatchNoIndexOptions; | ||
/** | ||
* Options object passed to [[Replicache.experimentalWatch]]. This is for an | ||
* index watch. | ||
*/ | ||
declare type WatchIndexOptions = WatchNoIndexOptions & { | ||
/** | ||
* When provided, the `watch` is limited to changes where the `key` starts with | ||
* `prefix`. | ||
* When provided, the `watch` is limited to the changes that apply to the index map. | ||
*/ | ||
indexName: string; | ||
}; | ||
/** | ||
* Options object passed to [[Replicache.experimentalWatch]]. This is for a non | ||
* index watch. | ||
*/ | ||
declare type WatchNoIndexOptions = { | ||
/** | ||
* When provided, the `watch` is limited to changes where the `key` starts | ||
* with `prefix`. | ||
*/ | ||
prefix?: string; | ||
@@ -428,3 +460,3 @@ /** | ||
initialValuesInFirstDiff?: boolean; | ||
} | ||
}; | ||
/** | ||
@@ -458,2 +490,7 @@ * The options passed to [[Replicache.subscribe]]. | ||
* returns `undefined`. | ||
* | ||
* Important: The returned JSON is readonly and should not be modified. This | ||
* is only enforced statically by TypeScript and there are no runtime checks | ||
* for performance reasons. If you mutate the return value you will get | ||
* undefined behavior. | ||
*/ | ||
@@ -467,4 +504,4 @@ get(key: string): Promise<ReadonlyJSONValue | undefined>; | ||
* Gets many values from the database. This returns a [[ScanResult]] which | ||
* implements `AsyncIterable`. It also has methods to iterate over the [[ScanResult.keys|keys]] | ||
* and [[ScanResult.entries|entries]]. | ||
* implements `AsyncIterable`. It also has methods to iterate over the | ||
* [[ScanResult.keys|keys]] and [[ScanResult.entries|entries]]. | ||
* | ||
@@ -475,4 +512,9 @@ * If `options` has an `indexName`, then this does a scan over an index with | ||
* | ||
* If the [[ScanResult]] is used after the `ReadTransaction` has been closed it | ||
* will throw a [[TransactionClosedError]]. | ||
* If the [[ScanResult]] is used after the `ReadTransaction` has been closed | ||
* it will throw a [[TransactionClosedError]]. | ||
* | ||
* Important: The returned JSON is readonly and should not be modified. This | ||
* is only enforced statically by TypeScript and there are no runtime checks | ||
* for performance reasons. If you mutate the return value you will get | ||
* undefined behavior. | ||
*/ | ||
@@ -482,4 +524,4 @@ scan(): ScanResult<string, ReadonlyJSONValue>; | ||
* Gets many values from the database. This returns a [[ScanResult]] which | ||
* implements `AsyncIterable`. It also has methods to iterate over the [[ScanResult.keys|keys]] | ||
* and [[ScanResult.entries|entries]]. | ||
* implements `AsyncIterable`. It also has methods to iterate over the | ||
* [[ScanResult.keys|keys]] and [[ScanResult.entries|entries]]. | ||
* | ||
@@ -490,4 +532,9 @@ * If `options` has an `indexName`, then this does a scan over an index with | ||
* | ||
* If the [[ScanResult]] is used after the `ReadTransaction` has been closed it | ||
* will throw a [[TransactionClosedError]]. | ||
* If the [[ScanResult]] is used after the `ReadTransaction` has been closed | ||
* it will throw a [[TransactionClosedError]]. | ||
* | ||
* Important: The returned JSON is readonly and should not be modified. This | ||
* is only enforced statically by TypeScript and there are no runtime checks | ||
* for performance reasons. If you mutate the return value you will get | ||
* undefined behavior. | ||
*/ | ||
@@ -542,2 +589,6 @@ scan<Options extends ScanOptions>(options?: Options): ScanResult<KeyTypeForScanOptions<Options>, ReadonlyJSONValue>; | ||
jsonPointer: string; | ||
/** | ||
* If `true`, indexing empty values will not emit a warning. Defaults to `false`. | ||
*/ | ||
allowEmpty?: boolean; | ||
} | ||
@@ -600,4 +651,4 @@ | ||
/** | ||
* The duration between each [[pull]]. Set this to `null` to prevent pulling | ||
* in the background. | ||
* The duration between each [[pull]] in milliseconds. Set this to `null` to | ||
* prevent pulling in the background. Defaults to 60 seconds. | ||
*/ | ||
@@ -854,2 +905,3 @@ pullInterval?: number | null; | ||
private readonly _subscriptions; | ||
private readonly _mutationRecovery; | ||
/** | ||
@@ -870,2 +922,3 @@ * This is the name Replicache uses for the IndexedDB database where data is | ||
protected _licenseActivePromise: Promise<boolean>; | ||
private _testLicenseKeyTimeout; | ||
private _root; | ||
@@ -909,5 +962,3 @@ private readonly _mutatorRegistry; | ||
private _persistIsScheduled; | ||
private _recoveringMutations; | ||
private readonly _enableLicensing; | ||
private readonly _enableMutationRecovery; | ||
/** | ||
@@ -1009,3 +1060,3 @@ * The options used to control the [[pull]] and push request behavior. This | ||
private _indexOp; | ||
protected _maybeEndPull(beginPullResult: BeginPullResult): Promise<void>; | ||
protected _maybeEndPull(syncHead: Hash, requestID: string): Promise<void>; | ||
private _replay; | ||
@@ -1062,12 +1113,15 @@ private _invokePull; | ||
* The `callback` gets called whenever the underlying data changes and the | ||
* `key` changes matches the [[WatchOptions.prefix]] if present. If a change | ||
* occurs to the data but the change does not impact the key space the | ||
* callback is not called. In other words, the callback is never called with | ||
* an empty diff. | ||
* `key` changes matches the | ||
* [[ExperimentalWatchNoIndexOptions|ExperimentalWatchOptions.prefix]] | ||
* if present. If a change occurs to the data but the change does not impact | ||
* the key space the callback is not called. In other words, the callback is | ||
* never called with an empty diff. | ||
* | ||
* This gets called after commit (a mutation or a rebase). | ||
* | ||
* @experimental This method is under development and its semantics will change. | ||
* @experimental This method is under development and its semantics will | ||
* change. | ||
*/ | ||
experimentalWatch(callback: WatchCallback, options?: WatchOptions): () => void; | ||
experimentalWatch(callback: WatchNoIndexCallback): () => void; | ||
experimentalWatch<Options extends WatchOptions>(callback: WatchCallbackForOptions<Options>, options?: Options): () => void; | ||
/** | ||
@@ -1089,11 +1143,2 @@ * Query is used for read transactions. It is recommended to use transactions | ||
protected _recoverMutations(preReadClientMap?: ClientMap): Promise<boolean>; | ||
private _recoverMutationsFromPerdag; | ||
/** | ||
* @returns When mutations are recovered the resulting updated client map. | ||
* Otherwise undefined, which can be because there were no mutations to | ||
* recover, or because an error occurred when trying to recover the | ||
* mutations. | ||
*/ | ||
private _recoverMutationsOfClient; | ||
private _logMutationRecoveryError; | ||
} | ||
@@ -1133,2 +1178,2 @@ | ||
export { AsyncIterableIteratorToArray, ClientStateNotFoundReason, ClientStateNotFoundResponse, CreateIndexDefinition, Diff as ExperimentalDiff, DiffOperation as ExperimentalDiffOperation, Read as ExperimentalKVRead, Store as ExperimentalKVStore, Write as ExperimentalKVWrite, WatchCallback as ExperimentalWatchCallback, WatchOptions as ExperimentalWatchOptions, GetIndexScanIterator, GetScanIterator, HTTPRequestInfo, IndexKey, IterableUnion, JSONObject, JSONValue, KeyTypeForScanOptions, LogLevel, LogSink, MaybePromise, MutatorDefs, PatchOperation, Poke, PullError, PullRequest, PullResponse, PullResponseOK, Puller, PullerResult, PushError, PushRequest, Pusher, ReadTransaction, ReadonlyJSONObject, ReadonlyJSONValue, Replicache, ReplicacheOptions, RequestOptions, ScanIndexOptions, ScanNoIndexOptions, ScanOptionIndexedStartKey, ScanOptions, ScanResult, SubscribeOptions, TEST_LICENSE_KEY, TransactionClosedError, WriteTransaction, consoleLogSink, filterAsyncIterable, isScanIndexOptions, makeIDBName, makeScanResult, mergeAsyncIterables, version }; | ||
export { AsyncIterableIteratorToArray, ClientStateNotFoundReason, ClientStateNotFoundResponse, CreateIndexDefinition, Diff as ExperimentalDiff, DiffOperation as ExperimentalDiffOperation, IndexDiff as ExperimentalIndexDiff, Read as ExperimentalKVRead, Store as ExperimentalKVStore, Write as ExperimentalKVWrite, NoIndexDiff as ExperimentalNoIndexDiff, WatchCallbackForOptions as ExperimentalWatchCallbackForOptions, WatchIndexCallback as ExperimentalWatchIndexCallback, WatchIndexOptions as ExperimentalWatchIndexOptions, WatchNoIndexCallback as ExperimentalWatchNoIndexCallback, WatchNoIndexOptions as ExperimentalWatchNoIndexOptions, WatchOptions as ExperimentalWatchOptions, GetIndexScanIterator, GetScanIterator, HTTPRequestInfo, IndexKey, IterableUnion, JSONObject, JSONValue, KeyTypeForScanOptions, LogLevel, LogSink, MaybePromise, MutatorDefs, PatchOperation, Poke, PullError, PullRequest, PullResponse, PullResponseOK, Puller, PullerResult, PushError, PushRequest, Pusher, ReadTransaction, ReadonlyJSONObject, ReadonlyJSONValue, Replicache, ReplicacheOptions, RequestOptions, ScanIndexOptions, ScanNoIndexOptions, ScanOptionIndexedStartKey, ScanOptions, ScanResult, SubscribeOptions, TEST_LICENSE_KEY, TransactionClosedError, WriteTransaction, consoleLogSink, filterAsyncIterable, isScanIndexOptions, makeIDBName, makeScanResult, mergeAsyncIterables, version }; |
{ | ||
"name": "replicache", | ||
"description": "Realtime sync for any backend stack", | ||
"version": "10.0.0", | ||
"version": "10.1.0", | ||
"repository": "github:rocicorp/replicache", | ||
@@ -40,2 +40,3 @@ "license": "https://roci.dev/terms.html", | ||
"command-line-usage": "^6.1.2", | ||
"compare-utf8": "^0.1.0", | ||
"esbuild": "^0.14.34", | ||
@@ -71,6 +72,4 @@ "eslint": "^8.12.0", | ||
"out/replicache.js", | ||
"out/replicache.mjs", | ||
"out/replicache.wasm", | ||
"out/replicache.dev.wasm" | ||
"out/replicache.mjs" | ||
] | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
369835
2456
32
1