replicache
Advanced tools
Comparing version 8.0.0-beta.0 to 8.0.0
@@ -71,5 +71,14 @@ /** The values that can be represented in JSON */ | ||
declare type Refs = readonly string[]; | ||
declare const hashTag: unique symbol; | ||
/** | ||
* Opaque type representing a hash. The only way to create one is using `parse` | ||
* or `hashOf` (except for static unsafe cast of course). | ||
*/ | ||
declare type Hash = { | ||
[hashTag]: true; | ||
}; | ||
declare type Refs = readonly Hash[]; | ||
declare class Chunk<V extends Value = Value> { | ||
readonly hash: string; | ||
readonly hash: Hash; | ||
readonly data: V; | ||
@@ -83,3 +92,3 @@ /** | ||
static new<V extends Value = Value>(data: V, refs: Refs): Chunk<V>; | ||
static read<V extends Value = Value>(hash: string, data: V, refs: Refs): Chunk<V>; | ||
static read<V extends Value = Value>(hash: Hash, data: V, refs: Refs): Chunk<V>; | ||
} | ||
@@ -90,5 +99,5 @@ | ||
constructor(kv: Read$2); | ||
hasChunk(hash: string): Promise<boolean>; | ||
getChunk(hash: string): Promise<Chunk | undefined>; | ||
getHead(name: string): Promise<string | undefined>; | ||
hasChunk(hash: Hash): Promise<boolean>; | ||
getChunk(hash: Hash): Promise<Chunk | undefined>; | ||
getHead(name: string): Promise<Hash | undefined>; | ||
close(): void; | ||
@@ -103,4 +112,5 @@ get closed(): boolean; | ||
constructor(kvw: Write$1); | ||
get kvWrite(): Write$1; | ||
putChunk(c: Chunk): Promise<void>; | ||
setHead(name: string, hash: string): Promise<void>; | ||
setHead(name: string, hash: Hash): Promise<void>; | ||
removeHead(name: string): Promise<void>; | ||
@@ -110,6 +120,6 @@ private _setHead; | ||
collectGarbage(): Promise<void>; | ||
changeRefCount(hash: string, delta: number): Promise<void>; | ||
setRefCount(hash: string, count: number): Promise<void>; | ||
getRefCount(hash: string): Promise<number>; | ||
removeAllRelatedKeys(hash: string, updateMutatedChunks: boolean): Promise<void>; | ||
changeRefCount(hash: Hash, delta: number): Promise<void>; | ||
setRefCount(hash: Hash, count: number): Promise<void>; | ||
getRefCount(hash: Hash): Promise<number>; | ||
removeAllRelatedKeys(hash: Hash, updateMutatedChunks: boolean): Promise<void>; | ||
close(): void; | ||
@@ -125,3 +135,3 @@ } | ||
readonly definition: IndexDefinition; | ||
readonly valueHash: string; | ||
readonly valueHash: Hash; | ||
}; | ||
@@ -153,18 +163,2 @@ | ||
}; | ||
declare type ScanItem = { | ||
key: string; | ||
secondaryKey: string; | ||
val: ReadonlyJSONValue; | ||
}; | ||
declare const enum ScanResultType { | ||
Error = 0, | ||
Item = 1 | ||
} | ||
declare type ScanResult$1 = { | ||
type: ScanResultType.Error; | ||
error: unknown; | ||
} | { | ||
type: ScanResultType.Item; | ||
item: ScanItem; | ||
}; | ||
@@ -196,3 +190,4 @@ declare class BTreeWrite extends BTreeRead { | ||
private _addToModified; | ||
newInternalNodeImpl(entries: ReadonlyArray<Entry<Hash>>, level: number): InternalNodeImpl; | ||
updateNode(node: DataNodeImpl | InternalNodeImpl): void; | ||
newInternalNodeImpl(entries: Array<Entry<Hash>>, level: number): InternalNodeImpl; | ||
newDataNodeImpl(entries: Entry<ReadonlyJSONValue>[]): DataNodeImpl; | ||
@@ -217,3 +212,2 @@ newNodeImpl(entries: Entry<ReadonlyJSONValue>[], level: number): DataNodeImpl; | ||
declare type Hash = string; | ||
declare type Entry<V> = [key: string, value: V]; | ||
@@ -247,6 +241,6 @@ declare type ReadonlyEntry<V> = readonly [key: string, value: V]; | ||
declare abstract class NodeImpl<Value extends Hash | ReadonlyJSONValue> { | ||
readonly entries: ReadonlyArray<Entry<Value>>; | ||
readonly hash: Hash; | ||
entries: Array<Entry<Value>>; | ||
hash: Hash; | ||
abstract readonly level: number; | ||
constructor(entries: ReadonlyArray<Entry<Value>>, hash: Hash); | ||
constructor(entries: Array<Entry<Value>>, hash: Hash); | ||
abstract set(key: string, value: Value, tree: BTreeWrite): Promise<NodeImpl<Value>>; | ||
@@ -259,6 +253,6 @@ abstract del(key: string, tree: BTreeWrite): Promise<NodeImpl<Value> | DataNodeImpl>; | ||
readonly level = 0; | ||
constructor(entries: ReadonlyArray<Entry<ReadonlyJSONValue>>, hash: Hash); | ||
set(key: string, value: ReadonlyJSONValue, tree: BTreeWrite): Promise<DataNodeImpl>; | ||
private _splice; | ||
del(key: string, tree: BTreeWrite): Promise<DataNodeImpl>; | ||
scan(_tree: BTreeRead, prefix: string, fromKey: string, limit: number): AsyncGenerator<Entry<ReadonlyJSONValue>, number, unknown>; | ||
scan(_tree: BTreeRead, prefix: string, fromKey: string, limit: number, onLimitKey?: (inclusiveLimitKey: string) => void): AsyncGenerator<Entry<ReadonlyJSONValue>, number, unknown>; | ||
keys(_tree: BTreeRead): AsyncGenerator<string, void>; | ||
@@ -269,6 +263,12 @@ entriesIter(_tree: BTreeRead): AsyncGenerator<ReadonlyEntry<ReadonlyJSONValue>, void>; | ||
readonly level: number; | ||
constructor(entries: ReadonlyArray<Entry<Hash>>, hash: Hash, level: number); | ||
constructor(entries: Array<Entry<Hash>>, hash: Hash, level: number); | ||
set(key: string, value: ReadonlyJSONValue, tree: BTreeWrite): Promise<InternalNodeImpl>; | ||
/** | ||
* This merges the child node entries with previous or next sibling and then | ||
* partions the merged entries. | ||
*/ | ||
private _mergeAndPartition; | ||
private _replaceChild; | ||
del(key: string, tree: BTreeWrite): Promise<InternalNodeImpl | DataNodeImpl>; | ||
scan(tree: BTreeRead, prefix: string, fromKey: string, limit: number): AsyncGenerator<Entry<ReadonlyJSONValue>, number>; | ||
scan(tree: BTreeRead, prefix: string, fromKey: string, limit: number, onLimitKey?: (inclusiveLimitKey: string) => void): AsyncGenerator<Entry<ReadonlyJSONValue>, number>; | ||
keys(tree: BTreeRead): AsyncGenerator<string, void>; | ||
@@ -291,3 +291,3 @@ entriesIter(tree: BTreeRead): AsyncGenerator<ReadonlyEntry<ReadonlyJSONValue>, void>; | ||
isEmpty(): Promise<boolean>; | ||
scan(options: ScanOptionsInternal): AsyncGenerator<Entry<ReadonlyJSONValue>>; | ||
scan(options: ScanOptionsInternal, onLimitKey?: (inclusiveLimitKey: string) => void): AsyncGenerator<Entry<ReadonlyJSONValue>>; | ||
keys(): AsyncGenerator<string, void>; | ||
@@ -328,3 +328,3 @@ entries(): AsyncGenerator<ReadonlyEntry<ReadonlyJSONValue>, void>; | ||
isEmpty(): Promise<boolean>; | ||
scan(opts: ScanOptions$1, callback: (s: ScanResult$1) => void): Promise<void>; | ||
scan<R>(opts: ScanOptions$1, convertEntry: (entry: Entry<ReadonlyJSONValue>) => R, onLimitKey?: (inclusiveLimitKey: string) => void): AsyncIterableIterator<R>; | ||
get closed(): boolean; | ||
@@ -458,3 +458,4 @@ close(): void; | ||
shouldCloseTransaction: boolean, | ||
shouldClone: boolean | ||
shouldClone: boolean, | ||
onLimitKey?: (inclusiveLimitKey: string) => void | ||
]; | ||
@@ -621,9 +622,3 @@ /** | ||
* all keys are indexed. | ||
* @deprecated Use [[prefix]] instead. | ||
*/ | ||
keyPrefix?: string; | ||
/** | ||
* The prefix, if any, to limit the index over. If not provided the values of | ||
* all keys are indexed. | ||
*/ | ||
prefix?: string; | ||
@@ -820,3 +815,3 @@ /** | ||
requestID: string; | ||
syncHead: string; | ||
syncHead: Hash; | ||
ok: boolean; | ||
@@ -1073,6 +1068,3 @@ }; | ||
query<R>(body: (tx: ReadTransaction) => Promise<R> | R): Promise<R>; | ||
/** @deprecated Use [[ReplicacheOptions.mutators]] instead. */ | ||
register<Return extends JSONValue | void>(name: string, mutatorImpl: (tx: WriteTransaction) => MaybePromise<Return>): () => Promise<Return>; | ||
/** @deprecated Use [[ReplicacheOptions.mutators]] instead. */ | ||
register<Return extends JSONValue | void, Args extends JSONValue>(name: string, mutatorImpl: (tx: WriteTransaction, args: Args) => MaybePromise<Return>): (args: Args) => Promise<Return>; | ||
private _queryInternal; | ||
private _register; | ||
@@ -1079,0 +1071,0 @@ private _registerMutators; |
{ | ||
"name": "replicache", | ||
"description": "Realtime sync for any backend stack", | ||
"version": "8.0.0-beta.0", | ||
"version": "8.0.0", | ||
"repository": "github:rocicorp/replicache", | ||
@@ -23,3 +23,2 @@ "license": "BSL-1.1", | ||
"@esm-bundle/chai": "^4.3.4", | ||
"@types/lodash-es": "^4.17.5", | ||
"@types/mocha": "^8.2.2", | ||
@@ -26,0 +25,0 @@ "@types/sinon": "^10.0.3", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
414170
28
12546
1