New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

replicache

Package Overview
Dependencies
Maintainers
5
Versions
106
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

replicache - npm Package Compare versions

Comparing version 11.3.2 to 12.0.0-beta.0

out/replicache.cjs

375

out/replicache.d.ts
/** The values that can be represented in JSON */
declare type JSONValue = null | string | boolean | number | Array<JSONValue> | JSONObject;
/**
* A JSON object. We allow undefined values because in TypeScript there is no
* way to express optional missing properties vs properties with the value
* `undefined`.
* A JSON object. This is a map from strings to JSON values.
*/
declare type JSONObject = Partial<{
declare type JSONObject = {
[key: string]: JSONValue;
}>;
/** Like [[JSONValue]] but deeply readonly */
};
/** Like {@link JSONValue} but deeply readonly */
declare type ReadonlyJSONValue = null | string | boolean | number | ReadonlyArray<ReadonlyJSONValue> | ReadonlyJSONObject;
/** Like [[JSONObject]] but deeply readonly */
declare type ReadonlyJSONObject = Partial<{
/** Like {@link JSONObject} but deeply readonly */
declare type ReadonlyJSONObject = {
readonly [key: string]: ReadonlyJSONValue;
}>;
};

@@ -25,3 +23,3 @@ declare type HTTPRequestInfo = {

* Pusher is the function type used to do the fetch part of a push. The request
* is a POST request where the body is JSON with the type [[PushRequest]].
* is a POST request where the body is JSON with the type {@link PushRequest}.
*/

@@ -34,8 +32,12 @@ declare type Pusher = (request: Request) => Promise<HTTPRequestInfo>;

name: string;
causedBy?: Error;
causedBy?: Error | undefined;
constructor(causedBy?: Error);
}
declare type BranchID = string;
/**
* The ID describing a group of clients. All clients in the same group share a
* perdag.
*/
declare type ClientGroupID = string;
/**
* The ID describing a client.

@@ -46,3 +48,3 @@ */

declare type PullerResult = {
response?: PullResponse;
response?: PullResponse | undefined;
httpRequestInfo: HTTPRequestInfo;

@@ -52,3 +54,3 @@ };

* Puller is the function type used to do the fetch part of a pull. The request
* is a POST request where the body is JSON with the type [[PullRequest]].
* is a POST request where the body is JSON with the type {@link PullRequest}.
*/

@@ -60,6 +62,7 @@ declare type Puller = (request: Request) => Promise<PullerResult>;

declare type PullResponseOK = {
cookie?: ReadonlyJSONValue;
cookie?: ReadonlyJSONValue | undefined;
lastMutationID: number;
patch: PatchOperation[];
};
/**

@@ -77,4 +80,5 @@ * In certain scenarios the server can signal that it does not know about the

declare type PullResponse = PullResponseOK | ClientStateNotFoundResponse;
/**
* This type describes the patch field in a [[PullResponse]] and it is used
* This type describes the patch field in a {@link PullResponse} and it is used
* to describe how to update the Replicache key-value store.

@@ -97,3 +101,3 @@ */

name: string;
causedBy?: Error;
causedBy?: Error | undefined;
constructor(causedBy?: Error);

@@ -178,18 +182,3 @@ }

declare const internalValueTag: unique symbol;
declare class InternalValueObject {
private [internalValueTag];
}
/**
* Opaque type representing a JSON value that we store inside Replicache. These
* must never escape.
*
* Example usages of these values are:
* - B+Tree values
* - Mutation args
* - Cookies
*/
declare type InternalValue = InternalValueObject | string | number | boolean | null;
/**
* The definition of a single index.

@@ -224,15 +213,6 @@ */

/**
* The definition of an index. This is used with
* [[Replicache.createIndex|createIndex]] when creating indexes.
*/
declare type CreateIndexDefinition = IndexDefinition & {
/** The name of the index. This is used when you [[ReadTransaction.scan|scan]] over an index. */
name: string;
};
declare type Entry<V> = readonly [key: string, value: V];
/**
* Describes the changes that happened to Replicache after a
* [[WriteTransaction]] was committed.
* {@link WriteTransaction} was committed.
*

@@ -277,20 +257,18 @@ * @experimental This type is experimental and may change in the future.

declare const PULL_VERSION_SDD = 0;
/**
* The JSON value used as the body when doing a POST to the [pull
* endpoint](/server-pull).
* endpoint](/reference/server-pull).
*/
declare type PullRequest<Cookie = ReadonlyJSONValue> = {
declare type PullRequest = {
profileID: string;
clientID: ClientID;
cookie: Cookie;
cookie: ReadonlyJSONValue;
lastMutationID: number;
pullVersion: typeof PULL_VERSION_SDD;
pullVersion: number;
schemaVersion: string;
};
declare const PUSH_VERSION = 0;
/**
* The JSON value used as the body when doing a POST to the [push
* endpoint](/server-push).
* endpoint](/reference/server-push).
*/

@@ -301,3 +279,8 @@ declare type PushRequest = {

mutations: Mutation[];
pushVersion: typeof PUSH_VERSION;
pushVersion: number;
/**
* `schemaVersion` can optionally be used to specify to the push endpoint
* version information about the mutators the app is using (e.g., format of
* mutator args).
*/
schemaVersion: string;

@@ -311,3 +294,3 @@ };

readonly name: string;
readonly args: InternalValue;
readonly args: ReadonlyJSONValue;
readonly timestamp: number;

@@ -323,7 +306,7 @@ };

/**
* Options for [[ReadTransaction.scan|scan]]
* Options for {@link ReadTransaction.scan | scan}
*/
declare type ScanOptions = ScanIndexOptions | ScanNoIndexOptions;
/**
* Options for [[ReadTransaction.scan|scan]] when scanning over the entire key
* Options for {@link ReadTransaction.scan | scan} when scanning over the entire key
* space.

@@ -333,5 +316,5 @@ */

/** Only include keys starting with `prefix`. */
prefix?: string;
prefix?: string | undefined;
/** Only include up to `limit` results. */
limit?: number;
limit?: number | undefined;
/** When provided the scan starts at this key. */

@@ -341,7 +324,7 @@ start?: {

/** Whether the `key` is exclusive or inclusive. */
exclusive?: boolean;
};
exclusive?: boolean | undefined;
} | undefined;
};
/**
* Options for [[ReadTransaction.scan|scan]] when scanning over an index. When
* Options for {@link ReadTransaction.scan | scan} when scanning over an index. When
* scanning over and index you need to provide the `indexName` and the `start`

@@ -352,8 +335,8 @@ * `key` is now a tuple consisting of secondary and primary key

/** Only include results starting with the *secondary* keys starting with `prefix`. */
prefix?: string;
prefix?: string | undefined;
/** Only include up to `limit` results. */
limit?: number;
/** Do a [[ReadTransaction.scan|scan]] over a named index. The `indexName` is
* the name of an index defined when creating the [[Replicache]] instance using
* [{ReplicacheOptions.indexes]]. */
limit?: number | undefined;
/** Do a {@link ReadTransaction.scan | scan} over a named index. The `indexName` is
* the name of an index defined when creating the {@link Replicache} instance using
* {@link ReplicacheOptions.indexes}. */
indexName: string;

@@ -364,7 +347,7 @@ /** When provided the scan starts at this key. */

/** Whether the `key` is exclusive or inclusive. */
exclusive?: boolean;
};
exclusive?: boolean | undefined;
} | undefined;
};
/**
* Type narrowing of [[ScanOptions]].
* Type narrowing of {@link ScanOptions}.
*/

@@ -388,3 +371,3 @@ declare function isScanIndexOptions(options: ScanOptions): options is ScanIndexOptions;

*/
declare type ScanOptionIndexedStartKey = readonly [secondary: string, primary?: string] | string;
declare type ScanOptionIndexedStartKey = readonly [secondary: string, primary?: string | undefined] | string;

@@ -401,10 +384,10 @@ /**

declare type ScanKey = string | IndexKey;
interface ScanResult<K extends ScanKey, V extends ReadonlyJSONValue> extends AsyncIterable<V> {
/** The default AsyncIterable. This is the same as [[values]]. */
[Symbol.asyncIterator](): AsyncIterableIteratorToArray<V>;
/** Async iterator over the values of the [[ReadTransaction.scan|scan]] call. */
values(): AsyncIterableIteratorToArray<V>;
interface ScanResult<K extends ScanKey> extends AsyncIterable<ReadonlyJSONValue> {
/** The default AsyncIterable. This is the same as {@link values}. */
[Symbol.asyncIterator](): AsyncIterableIteratorToArray<ReadonlyJSONValue>;
/** Async iterator over the values of the {@link ReadTransaction.scan | scan} call. */
values(): AsyncIterableIteratorToArray<ReadonlyJSONValue>;
/**
* Async iterator over the keys of the [[ReadTransaction.scan|scan]]
* call. If the [[ReadTransaction.scan|scan]] is over an index the key
* Async iterator over the keys of the {@link ReadTransaction.scan | scan}
* call. If the {@link ReadTransaction.scan | scan} is over an index the key
* is a tuple of `[secondaryKey: string, primaryKey]`

@@ -414,13 +397,13 @@ */

/**
* Async iterator over the entries of the [[ReadTransaction.scan|scan]]
* Async iterator over the entries of the {@link ReadTransaction.scan | scan}
* call. An entry is a tuple of key values. If the
* [[ReadTransaction.scan|scan]] is over an index the key is a tuple of
* {@link ReadTransaction.scan | scan} is over an index the key is a tuple of
* `[secondaryKey: string, primaryKey]`
*/
entries(): AsyncIterableIteratorToArray<readonly [K, V]>;
entries(): AsyncIterableIteratorToArray<readonly [K, ReadonlyJSONValue]>;
/** Returns all the values as an array. Same as `values().toArray()` */
toArray(): Promise<V[]>;
toArray(): Promise<ReadonlyJSONValue[]>;
}
/**
* An interface that adds a [[toArray]] method to `AsyncIterableIterator`.
* An interface that adds a {@link toArray} method to `AsyncIterableIterator`.
*

@@ -437,3 +420,3 @@ * Usage:

/**
* This is called when doing a [[ReadTransaction.scan|scan]] without an
* This is called when doing a {@link ReadTransaction.scan | scan} without an
* `indexName`.

@@ -443,7 +426,7 @@ *

* first entry to return in the iterator. It is based on `prefix` and
* `start.key` of the [[ScanNoIndexOptions]].
* `start.key` of the {@link ScanNoIndexOptions}.
*/
declare type GetScanIterator = (fromKey: string) => IterableUnion<Entry<ReadonlyJSONValue>>;
/**
* When using [[makeScanResult]] this is the type used for the function called when doing a [[ReadTransaction.scan|scan]] with an
* When using {@link makeScanResult} this is the type used for the function called when doing a {@link ReadTransaction.scan | scan} with an
* `indexName`.

@@ -454,10 +437,10 @@ *

* the secondary key of the first entry to return in the iterator. It is based
* on `prefix` and `start.key` of the [[ScanIndexOptions]].
* on `prefix` and `start.key` of the {@link ScanIndexOptions}.
* @param fromPrimaryKey The `fromPrimaryKey` is computed by `scan` and is the
* primary key of the first entry to return in the iterator. It is based on
* `prefix` and `start.key` of the [[ScanIndexOptions]].
* `prefix` and `start.key` of the {@link ScanIndexOptions}.
*/
declare type GetIndexScanIterator = (indexName: string, fromSecondaryKey: string, fromPrimaryKey: string | undefined) => IterableUnion<readonly [key: IndexKey, value: ReadonlyJSONValue]>;
/**
* A helper function that makes it easier to implement [[ReadTransaction.scan]]
* A helper function that makes it easier to implement {@link ReadTransaction.scan}
* with a custom backend.

@@ -467,3 +450,3 @@ *

* iterable we provide two helper functions to make it easier to merge these
* together. [[mergeAsyncIterables]] and [[filterAsyncIterable]].
* together. {@link mergeAsyncIterables} and {@link filterAsyncIterable}.
*

@@ -492,6 +475,6 @@ * For example:

*/
declare function makeScanResult<Options extends ScanOptions, Value extends ReadonlyJSONValue>(options: Options, getScanIterator: Options extends ScanIndexOptions ? GetIndexScanIterator : GetScanIterator): ScanResult<KeyTypeForScanOptions<Options>, Value>;
declare function makeScanResult<Options extends ScanOptions>(options: Options, getScanIterator: Options extends ScanIndexOptions ? GetIndexScanIterator : GetScanIterator): ScanResult<KeyTypeForScanOptions<Options>>;
/**
* Function that gets passed into [[Replicache.experimentalWatch]] and gets
* Function that gets passed into {@link Replicache.experimentalWatch} and gets
* called when the data in Replicache changes.

@@ -504,3 +487,3 @@ *

/**
* Function that gets passed into [[Replicache.experimentalWatch]] when doing a
* Function that gets passed into {@link Replicache.experimentalWatch} when doing a
* watch on a secondary index map and gets called when the data in Replicache

@@ -513,3 +496,3 @@ * changes.

/**
* Options for [[Replicache.experimentalWatch]].
* Options for {@link Replicache.experimentalWatch}.
*

@@ -520,3 +503,3 @@ * @experimental This interface is experimental and may change in the future.

/**
* Options object passed to [[Replicache.experimentalWatch]]. This is for an
* Options object passed to {@link Replicache.experimentalWatch}. This is for an
* index watch.

@@ -531,3 +514,3 @@ */

/**
* Options object passed to [[Replicache.experimentalWatch]]. This is for a non
* Options object passed to {@link Replicache.experimentalWatch}. This is for a non
* index watch.

@@ -550,5 +533,5 @@ */

/**
* The options passed to [[Replicache.subscribe]].
* The options passed to {@link Replicache.subscribe}.
*/
interface SubscribeOptions<R extends ReadonlyJSONValue | undefined, E> {
interface SubscribeOptions<R extends ReadonlyJSONValue | undefined> {
/**

@@ -561,12 +544,12 @@ * Called when the return value of the body function changes.

*/
onError?: (error: E) => void;
onError?: ((error: unknown) => void) | undefined;
/**
* If present, called when the subscription is removed/done.
*/
onDone?: () => void;
onDone?: (() => void) | undefined;
}
/**
* ReadTransactions are used with [[Replicache.query]] and
* [[Replicache.subscribe]] and allows read operations on the
* ReadTransactions are used with {@link Replicache.query} and
* {@link Replicache.subscribe} and allows read operations on the
* database.

@@ -591,5 +574,5 @@ */

/**
* Gets many values from the database. This returns a [[ScanResult]] which
* Gets many values from the database. This returns a {@link ScanResult} which
* implements `AsyncIterable`. It also has methods to iterate over the
* [[ScanResult.keys|keys]] and [[ScanResult.entries|entries]].
* {@link ScanResult.keys | keys} and {@link ScanResult.entries | entries}.
*

@@ -600,4 +583,4 @@ * 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 {@link ScanResult} is used after the `ReadTransaction` has been closed
* it will throw a {@link TransactionClosedError}.
*

@@ -609,7 +592,7 @@ * Important: The returned JSON is readonly and should not be modified. This

*/
scan(): ScanResult<string, ReadonlyJSONValue>;
scan(): ScanResult<string>;
/**
* Gets many values from the database. This returns a [[ScanResult]] which
* Gets many values from the database. This returns a {@link ScanResult} which
* implements `AsyncIterable`. It also has methods to iterate over the
* [[ScanResult.keys|keys]] and [[ScanResult.entries|entries]].
* {@link ScanResult.keys | keys} and {@link ScanResult.entries | entries}.
*

@@ -620,4 +603,4 @@ * 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 {@link ScanResult} is used after the `ReadTransaction` has been closed
* it will throw a {@link TransactionClosedError}.
*

@@ -629,7 +612,7 @@ * Important: The returned JSON is readonly and should not be modified. This

*/
scan<Options extends ScanOptions>(options?: Options): ScanResult<KeyTypeForScanOptions<Options>, ReadonlyJSONValue>;
scan<Options extends ScanOptions>(options?: Options): ScanResult<KeyTypeForScanOptions<Options>>;
}
/**
* WriteTransactions are used with *mutators* which are registered using
* [[ReplicacheOptions.mutators]] and allows read and write operations on the
* {@link ReplicacheOptions.mutators} and allows read and write operations on the
* database.

@@ -639,6 +622,6 @@ */

/**
* Sets a single `value` in the database. The `value` will be encoded using
* `JSON.stringify`.
* Sets a single `value` in the database. The value will be frozen (using
* `Object.freeze`) in debug mode.
*/
put(key: string, value: JSONValue): Promise<void>;
put(key: string, value: ReadonlyJSONValue): Promise<void>;
/**

@@ -649,15 +632,9 @@ * Removes a `key` and its value from the database. Returns `true` if there was a

del(key: string): Promise<boolean>;
/**
* Overrides [[ReadTransaction.get]] to return a mutable [[JSONValue]].
*/
get(key: string): Promise<JSONValue | undefined>;
/**
* Overrides [[ReadTransaction.scan]] to return a mutable [[JSONValue]].
*/
scan(): ScanResult<string, JSONValue>;
scan<Options extends ScanOptions>(options?: Options): ScanResult<KeyTypeForScanOptions<Options>, JSONValue>;
}
declare type CreateIndexDefinition = IndexDefinition & {
name: string;
};
/**
* The options passed to [[Replicache]].
* The options passed to {@link Replicache}.
*/

@@ -667,24 +644,24 @@ interface ReplicacheOptions<MD extends MutatorDefs> {

* This is the URL to the server endpoint dealing with the push updates. See
* [Push Endpoint Reference](https://doc.replicache.dev/server-push) for more
* [Push Endpoint Reference](https://doc.replicache.dev/reference/server-push) for more
* details.
*
* If not provided, push requests will not be made unless a custom
* [[ReplicacheOptions.pusher]] is provided.
* {@link ReplicacheOptions.pusher} is provided.
*/
pushURL?: string;
pushURL?: string | undefined;
/**
* This is the authorization token used when doing a
* [pull](https://doc.replicache.dev/server-pull#authorization) and
* [push](https://doc.replicache.dev/server-push#authorization).
* [pull](https://doc.replicache.dev/reference/server-pull#authorization) and
* [push](https://doc.replicache.dev/reference/server-push#authorization).
*/
auth?: string;
auth?: string | undefined;
/**
* This is the URL to the server endpoint dealing with pull. See [Pull
* Endpoint Reference](https://doc.replicache.dev/server-pull) for more
* Endpoint Reference](https://doc.replicache.dev/reference/server-pull) for more
* details.
*
* If not provided, pull requests will not be made unless a custom
* [[ReplicacheOptions.puller]] is provided.
* {@link ReplicacheOptions.puller} is provided.
*/
pullURL?: string;
pullURL?: string | undefined;
/**

@@ -696,10 +673,10 @@ * The name of the Replicache database.

*
* For efficiency and performance, a new [[Replicache]] instance will
* initialize its state from the persisted state of an existing [[Replicache]]
* For efficiency and performance, a new {@link Replicache} instance will
* initialize its state from the persisted state of an existing {@link Replicache}
* instance with the same `name`, domain and browser profile.
*
* Mutations from one [[Replicache]] instance may be pushed using the
* [[ReplicacheOptions.auth]], [[ReplicacheOptions.pushURL]],
* [[ReplicacheOptions.pullURL]], [[ReplicacheOptions.pusher]], and
* [[ReplicacheOptions.puller]] of another Replicache instance with the same
* Mutations from one {@link Replicache} instance may be pushed using the
* {@link ReplicacheOptions.auth}, {@link ReplicacheOptions.pushURL},
* {@link ReplicacheOptions.pullURL}, {@link ReplicacheOptions.pusher}, and
* {@link ReplicacheOptions.puller} of another Replicache instance with the same
* `name`, domain and browser profile.

@@ -716,8 +693,8 @@ *

*/
schemaVersion?: string;
schemaVersion?: string | undefined;
/**
* The duration between each [[pull]] in milliseconds. Set this to `null` to
* The duration between each {@link pull} in milliseconds. Set this to `null` to
* prevent pulling in the background. Defaults to 60 seconds.
*/
pullInterval?: number | null;
pullInterval?: number | null | undefined;
/**

@@ -727,3 +704,3 @@ * The delay between when a change is made to Replicache and when Replicache

*/
pushDelay?: number;
pushDelay?: number | undefined;
/**

@@ -736,3 +713,3 @@ * Determines how much logging to do. When this is set to `'debug'`,

*/
logLevel?: LogLevel;
logLevel?: LogLevel | undefined;
/**

@@ -743,6 +720,6 @@ * Enables custom handling of logs.

* sent elsewhere (e.g. to a cloud logging service like DataDog) you can
* provide an array of [[LogSink]]s. Logs at or above
* [[ReplicacheOptions.logLevel]] are sent to each of these [[LogSink]]s.
* provide an array of {@link LogSink}s. Logs at or above
* {@link ReplicacheOptions.logLevel} are sent to each of these {@link LogSink}s.
* If you would still like logs to go to the console, include
* [[consoleLogSink]] in the array.
* `consoleLogSink` in the array.
*

@@ -753,6 +730,6 @@ * ```ts

*/
logSinks?: LogSink[];
logSinks?: LogSink[] | undefined;
/**
* An object used as a map to define the *mutators*. These gets registered at
* startup of [[Replicache]].
* startup of {@link Replicache}.
*

@@ -764,3 +741,3 @@ * *Mutators* are used to make changes to the data.

* The registered *mutations* are reflected on the
* [[Replicache.mutate|mutate]] property of the [[Replicache]] instance.
* {@link Replicache.mutate | mutate} property of the {@link Replicache} instance.
*

@@ -807,6 +784,6 @@ * ```ts

* During push, a description of each mutation is sent to the server's [push
* endpoint](https://doc.replicache.dev/server-push) where it is applied. Once
* endpoint](https://doc.replicache.dev/reference/server-push) where it is applied. Once
* the *mutation* has been applied successfully, as indicated by the client
* view's
* [`lastMutationId`](https://doc.replicache.dev/server-pull#lastmutationid)
* [`lastMutationId`](https://doc.replicache.dev/reference/server-pull#lastmutationid)
* field, the local version of the *mutation* is removed. See the [design

@@ -820,12 +797,12 @@ * doc](https://doc.replicache.dev/design#commits) for additional details on

* Throwing an exception aborts the transaction. Otherwise, it is committed.
* As with [[query]] and [[subscribe]] all reads will see a consistent view of
* As with {@link query} and {@link subscribe} all reads will see a consistent view of
* the cache while they run.
*/
mutators?: MD;
mutators?: MD | undefined;
/**
* Options to use when doing pull and push requests.
*/
requestOptions?: RequestOptions;
requestOptions?: RequestOptions | undefined;
/**
* Allows passing in a custom implementation of a [[Puller]] function. This
* Allows passing in a custom implementation of a {@link Puller} function. This
* function is called when doing a pull and it is responsible for

@@ -837,5 +814,5 @@ * communicating with the server.

*/
puller?: Puller;
puller?: Puller | undefined;
/**
* Allows passing in a custom implementation of a [[Pusher]] function. This
* Allows passing in a custom implementation of a {@link Pusher} function. This
* function is called when doing a push and it is responsible for

@@ -847,3 +824,3 @@ * communicating with the server.

*/
pusher?: Pusher;
pusher?: Pusher | undefined;
/**

@@ -866,7 +843,7 @@ * The license key for Replicache. This parameter is required for Replicache to

*/
experimentalKVStore?: Store;
experimentalKVStore?: Store | undefined;
/**
* Defines the indexes, if any, to use on the data.
*/
readonly indexes?: IndexDefinitions;
readonly indexes?: IndexDefinitions | undefined;
}

@@ -928,6 +905,6 @@

/**
* ID of this client's perdag branch. This needs to be sent in pull request
* (to enable syncing all last mutation ids in the branch).
* ID of this client's perdag client group. This needs to be sent in pull
* request (to enable syncing all last mutation ids in the client group).
*/
readonly branchID: BranchID;
readonly clientGroupID: ClientGroupID;
};

@@ -964,8 +941,8 @@

declare function makeIDBName(name: string, schemaVersion?: string): string;
declare type MutatorReturn = MaybePromise<JSONValue | void>;
declare type MutatorReturn<T extends ReadonlyJSONValue = ReadonlyJSONValue> = MaybePromise<T | void>;
/**
* The type used to describe the mutator definitions passed into [Replicache](classes/Replicache)
* constructor as part of the [[ReplicacheOptions]].
* constructor as part of the {@link ReplicacheOptions}.
*
* See [[ReplicacheOptions]] [[ReplicacheOptions.mutators|mutators]] for more
* See {@link ReplicacheOptions} {@link ReplicacheOptions.mutators | mutators} for more
* info.

@@ -976,3 +953,3 @@ */

};
declare type MakeMutator<F extends (tx: WriteTransaction, ...args: [] | [JSONValue]) => MutatorReturn> = F extends (tx: WriteTransaction, ...args: infer Args) => infer Ret ? (...args: Args) => ToPromise<Ret> : never;
declare type MakeMutator<F extends (tx: WriteTransaction, ...args: [] | [ReadonlyJSONValue]) => MutatorReturn> = F extends (tx: WriteTransaction, ...args: infer Args) => infer Ret ? (...args: Args) => ToPromise<Ret> : never;
declare type MakeMutators<T extends MutatorDefs> = {

@@ -982,3 +959,3 @@ readonly [P in keyof T]: MakeMutator<T[P]>;

/**
* Base options for [[PullOptions]] and [[PushOptions]]
* Base options for {@link PullOptions} and {@link PushOptions}
*/

@@ -998,3 +975,3 @@ interface RequestOptions {

/**
* The reason [[onClientStateNotFound]] was called.
* The reason {@link onClientStateNotFound} was called.
*/

@@ -1018,3 +995,3 @@ declare type ClientStateNotFoundReason = {

auth: string;
/** The name of the Replicache database. Populated by [[ReplicacheOptions#name]]. */
/** The name of the Replicache database. Populated by {@link ReplicacheOptions#name}. */
readonly name: string;

@@ -1036,3 +1013,3 @@ private readonly _subscriptions;

private readonly _clientIDPromise;
private readonly _branchIDPromise;
private readonly _clientGroupIDPromise;
protected readonly _licenseCheckPromise: Promise<boolean>;

@@ -1052,5 +1029,5 @@ protected _licenseActivePromise: Promise<boolean>;

/**
* The duration between each periodic [[pull]]. Setting this to `null`
* The duration between each periodic {@link pull}. Setting this to `null`
* disables periodic pull completely. Pull will still happen if you call
* [[pull]] manually.
* {@link pull} manually.
*/

@@ -1078,6 +1055,11 @@ pullInterval: number | null;

private readonly _closeAbortController;
private _persistIsScheduled;
private _persistIsRunning;
private readonly _enableScheduledPersist;
private readonly _enableRefresh;
private _persistScheduler;
private readonly _onPersist;
private _refreshScheduler;
private readonly _enableLicensing;
/**
* The options used to control the [[pull]] and push request behavior. This
* The options used to control the {@link pull} and push request behavior. This
* object is live so changes to it will affect the next pull or push call.

@@ -1120,3 +1102,2 @@ */

constructor(options: ReplicacheOptions<MD>);
protected _memdagHashFunction(): () => Hash;
private _open;

@@ -1140,4 +1121,4 @@ private _syncIndexes;

/**
* `onOnlineChange` is called when the [[online]] property changes. See
* [[online]] for more details.
* `onOnlineChange` is called when the {@link online} property changes. See
* {@link online} for more details.
*/

@@ -1173,12 +1154,12 @@ onOnlineChange: ((online: boolean) => void) | null;

* an error is thrown.
* @deprecated Use [[ReplicacheOptions.indexes]] instead.
* @deprecated Use {@link ReplicacheOptions.indexes} instead.
*/
createIndex(def: CreateIndexDefinition): Promise<void>;
/**
* Drops an index previously created with [[createIndex]].
* @deprecated Use [[ReplicacheOptions.indexes]] instead.
* Drops an index previously created with {@link createIndex}.
* @deprecated Use {@link ReplicacheOptions.indexes} instead.
*/
dropIndex(name: string): Promise<void>;
private _indexOp;
protected _maybeEndPull(requestID: string): Promise<void>;
protected _maybeEndPull(syncHead: Hash, requestID: string): Promise<void>;
private _invokePull;

@@ -1191,5 +1172,5 @@ private _isPullDisabled;

/**
* Push pushes pending changes to the [[pushURL]].
* Push pushes pending changes to the {@link pushURL}.
*
* You do not usually need to manually call push. If [[pushDelay]] is non-zero
* You do not usually need to manually call push. If {@link pushDelay} is non-zero
* (which it is by default) pushes happen automatically shortly after

@@ -1200,3 +1181,3 @@ * mutations.

/**
* Pull pulls changes from the [[pullURL]]. If there are any changes
* Pull pulls changes from the {@link pullURL}. If there are any changes
* local changes will get replayed on top of the new server state.

@@ -1217,4 +1198,8 @@ */

private _persist;
private _refresh;
private _fireOnClientStateNotFound;
private _schedulePersist;
private _handlePersist;
private _scheduleRefresh;
private _schedule;
private _changeSyncCounters;

@@ -1232,3 +1217,3 @@ /**

*/
subscribe<R extends ReadonlyJSONValue | undefined, E>(body: (tx: ReadTransaction) => Promise<R>, options: SubscribeOptions<R, E>): () => void;
subscribe<R extends ReadonlyJSONValue | undefined>(body: (tx: ReadTransaction) => Promise<R>, options: SubscribeOptions<R>): () => void;
/**

@@ -1238,7 +1223,7 @@ * Watches Replicache for changes.

* The `callback` gets called whenever the underlying data changes and the
* `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.
* `key` changes matches the `prefix` of {@link ExperimentalWatchIndexOptions} or
* {@link ExperimentalWatchNoIndexOptions} 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.
*

@@ -1272,3 +1257,3 @@ * This gets called after commit (a mutation or a rebase).

* Gives a list of local mutations that have
* mutationID > syncHead.mutationID that exists on the main branch.
* mutationID > syncHead.mutationID that exists on the main client group.
*

@@ -1281,3 +1266,3 @@ * @experimental This method is experimental and may change in the future.

// TODO when our license is finalized add a link to it.
declare const TEST_LICENSE_KEY = "This key only good for automated testing";
declare const TEST_LICENSE_KEY = 'This key only good for automated testing';

@@ -1294,3 +1279,3 @@ /**

* This utility function is provided because it is useful when using
* [[makeScanResult]]. It can be used to merge an in memory pending async
* {@link makeScanResult}. It can be used to merge an in memory pending async
* iterable on to a persistent async iterable for example.

@@ -1304,3 +1289,3 @@ */

* This utility function is provided because it is useful when using
* [[makeScanResult]]. It can be used to filter out tombstones (delete entries)
* {@link makeScanResult}. It can be used to filter out tombstones (delete entries)
* for example.

@@ -1315,2 +1300,2 @@ */

export { AsyncIterableIteratorToArray, ClientID, ClientStateNotFoundReason, ClientStateNotFoundResponse, CreateIndexDefinition, Diff as ExperimentalDiff, DiffOperation as ExperimentalDiffOperation, DiffOperationAdd as ExperimentalDiffOperationAdd, DiffOperationChange as ExperimentalDiffOperationChange, DiffOperationDel as ExperimentalDiffOperationDel, 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, IndexDefinition, IndexDefinitions, IndexKey, IterableUnion, JSONObject, JSONValue, KeyTypeForScanOptions, LogLevel, LogSink, MaybePromise, MutatorDefs, PatchOperation, PendingMutation, 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, deleteAllReplicacheData, filterAsyncIterable, isScanIndexOptions, makeIDBName, makeScanResult, mergeAsyncIterables, version };
export { AsyncIterableIteratorToArray, ClientID, ClientStateNotFoundReason, ClientStateNotFoundResponse, CreateIndexDefinition, Diff as ExperimentalDiff, DiffOperation as ExperimentalDiffOperation, DiffOperationAdd as ExperimentalDiffOperationAdd, DiffOperationChange as ExperimentalDiffOperationChange, DiffOperationDel as ExperimentalDiffOperationDel, 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, IndexDefinition, IndexDefinitions, IndexKey, IterableUnion, JSONObject, JSONValue, KeyTypeForScanOptions, LogLevel, LogSink, MaybePromise, Mutation, MutatorDefs, PatchOperation, PendingMutation, 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, deleteAllReplicacheData, filterAsyncIterable, isScanIndexOptions, makeIDBName, makeScanResult, mergeAsyncIterables, version };
{
"name": "replicache",
"description": "Realtime sync for any backend stack",
"version": "11.3.2",
"version": "12.0.0-beta.0",
"repository": "github:rocicorp/replicache",

@@ -15,5 +15,5 @@ "license": "https://roci.dev/terms.html",

"build-dts": "rm -rf out/.dts/ && tsc --emitDeclarationOnly --outDir out/.dts/ && rollup --config rollup.config.js && rm -rf out/.dts",
"build": "rm -rf out && npm run build-dts && node tool/build.mjs",
"build-perf": "node tool/build.mjs --perf",
"build-bundle-sizes": "rm -rf out && npm run build-dts && node tool/build.mjs --bundle-sizes",
"build": "rm -rf out && npm run build-dts && node tool/build.js",
"build-perf": "node tool/build.js --perf",
"build-bundle-sizes": "rm -rf out && npm run build-dts && node tool/build.js --bundle-sizes",
"prepack": "npm run lint && npm run test && npm run build",

@@ -25,4 +25,4 @@ "prepare": "rm -f node_modules/fetch-mock/esm/client.d.ts",

"@esm-bundle/chai": "^4.3.4",
"@rocicorp/eslint-config": "^0.1.2",
"@rocicorp/licensing": "^4.0.0",
"@rocicorp/eslint-config": "^0.2.0",
"@rocicorp/licensing": "^4.1.0",
"@rocicorp/lock": "^1.0.1",

@@ -32,4 +32,6 @@ "@rocicorp/logger": "^2.2.0",

"@rocicorp/resolver": "^1.0.0",
"@types/command-line-usage": "^5.0.2",
"@types/lodash-es": "^4.17.6",
"@types/mocha": "^9.1.0",
"@types/node": "^18.11.9",
"@types/sinon": "^10.0.11",

@@ -50,3 +52,3 @@ "@web/dev-server": "0.1.29",

"navigator.locks": "^0.8.5",
"playwright": "^1.17.2",
"playwright": "^1.20.2",
"rollup": "^2.70.1",

@@ -58,4 +60,5 @@ "rollup-plugin-dts": "^4.2.0",

},
"main": "out/replicache.js",
"module": "out/replicache.mjs",
"type": "module",
"main": "out/replicache.cjs",
"module": "out/replicache.js",
"types": "out/replicache.d.ts",

@@ -69,11 +72,11 @@ "bin": {

"exports": {
"module": "./out/replicache.mjs",
"require": "./out/replicache.js",
"default": "./out/replicache.mjs"
"module": "./out/replicache.js",
"require": "./out/replicache.cjs",
"default": "./out/replicache.js"
},
"files": [
"out/cli.mjs",
"out/cli.js",
"out/replicache.d.ts",
"out/replicache.js",
"out/replicache.mjs"
"out/replicache.cjs",
"out/replicache.js"
],

@@ -80,0 +83,0 @@ "eslintConfig": {

@@ -14,8 +14,5 @@ # Cutting a release

```
export NEW_VERSION="<new_version>"
git branch -D release
git checkout -b release HEAD
jq ".version = \"$NEW_VERSION\"" package.json | sponge package.json
npm install
git commit -a -m "Bump version to $NEW_VERSION."
npm version major # or minor or patch v12.0.0-beta.0
```

@@ -31,2 +28,13 @@

### create-replicache-app
```bash
npx create-replicache-app my-app react
cd my-app/client/react
npm add /path/to/replicache-<version>.tgz
npm run watch --ws
```
Do the same for `npx create-replicache-app my-app ts-web-component`
### Replidraw

@@ -87,3 +95,2 @@

- `replicache-react`
- `replicache-nextjs`

@@ -90,0 +97,0 @@ - `rails`

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc