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 12.0.0-beta.0 to 12.0.0

104

out/replicache.d.ts

@@ -22,6 +22,39 @@ /** The values that can be represented in JSON */

/**
* In certain scenarios the server can signal that it does not know about the
* client. For example, the server might have lost all of its state (this might
* happen during the development of the server).
*/
declare type ClientStateNotFoundResponse = {
error: 'ClientStateNotFound';
};
/**
* The server endpoint may respond with a `VersionNotSupported` error if it does
* not know how to handle the {@link pullVersion}, {@link pushVersion} or the
* {@link schemaVersion}.
*/
declare type VersionNotSupportedResponse = {
error: 'VersionNotSupported';
versionType?: 'pull' | 'push' | 'schema' | undefined;
};
declare type PusherResult = {
response?: PushResponse | undefined;
httpRequestInfo: HTTPRequestInfo;
};
/**
* The response from a push can contain information about error conditions.
*/
declare type PushResponse = ClientStateNotFoundResponse | VersionNotSupportedResponse;
/**
* 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 {@link PushRequest}.
*
* The return value should either be a {@link HTTPRequestInfo} or a
* {@link PusherResult}. The reason for the two different return types is that
* we didn't use to care about the response body of the push request. The
* default pusher implementation checks if the response body is JSON and if it
* matches the type {@link PusherResponse}. If it does, it is included in the
* return value.
*/
declare type Pusher = (request: Request) => Promise<HTTPRequestInfo>;
declare type Pusher = (request: Request) => Promise<HTTPRequestInfo | PusherResult>;
/**

@@ -65,13 +98,6 @@ * This error is thrown when the pusher fails for any reason.

/**
* In certain scenarios the server can signal that it does not know about the
* client. For example, the server might have deleted the client.
*/
declare type ClientStateNotFoundResponse = {
error: 'ClientStateNotFound';
};
/**
* PullResponse defines the shape and type of the response of a pull. This is
* the JSON you should return from your pull server endpoint.
*/
declare type PullResponse = PullResponseOK | ClientStateNotFoundResponse;
declare type PullResponse = PullResponseOK | ClientStateNotFoundResponse | VersionNotSupportedResponse;

@@ -83,10 +109,10 @@ /**

declare type PatchOperation = {
op: 'put';
key: string;
value: JSONValue;
readonly op: 'put';
readonly key: string;
readonly value: ReadonlyJSONValue;
} | {
op: 'del';
key: string;
readonly op: 'del';
readonly key: string;
} | {
op: 'clear';
readonly op: 'clear';
};

@@ -122,3 +148,3 @@ /**

*/
declare type Hash = {
declare type Hash = string & {
[hashTag]: true;

@@ -931,2 +957,11 @@ };

};
/**
* The reason [[onUpdateNeeded]] was called.
*/
declare type UpdateNeededReason = {
type: 'NewClientGroup';
} | {
type: 'VersionNotSupported';
versionType?: 'push' | 'pull' | 'schema' | undefined;
};
declare type PendingMutation = {

@@ -949,2 +984,7 @@ readonly name: string;

/**
* Client groups gets disabled when the server does not know about it.
* A disabled client group prevents the client from pushing and pulling.
*/
private _isClientGroupDisabled;
/**
* This is the name Replicache uses for the IndexedDB database where data is

@@ -1031,7 +1071,5 @@ * stored.

* `onClientStateNotFound` is called when the persistent client has been
* garbage collected. This can happen if the client has not been used for over
* a week.
* garbage collected. This can happen if the client has no pending mutations
* and has not been used for a while.
*
* It can also happen if the server no longer knows about this client.
*
* The default behavior is to reload the page (using `location.reload()`). Set

@@ -1043,2 +1081,22 @@ * this to `null` or provide your own function to prevent the page from

/**
* `onUpdateNeeded` is called when a code update is needed.
*
* A code update can be needed because:
* - the server no longer supports the {@link pushVersion},
* {@link pullVersion} or {@link schemaVersion} of the current code.
* - a new Replicache client has created a new client group, because its code
* has different mutators, indexes, schema version and/or format version
* from this Replicache client. This is likely due to the new client having
* newer code. A code update is needed to be able to locally sync with this
* new Replicache client (i.e. to sync while offline, the clients can can
* still sync with each other via the server).
*
* The default behavior is to reload the page (using `location.reload()`). Set
* this to `null` or provide your own function to prevent the page from
* reloading automatically. You may want to provide your own function to
* display a toast to inform the end user there is a new version of your app
* available and prompting them to refresh.
*/
onUpdateNeeded: ((reason: UpdateNeededReason) => void) | null;
/**
* This gets called when we get an HTTP unauthorized (401) response from the

@@ -1116,2 +1174,3 @@ * push or pull endpoint. Set this to a function that will ask your user to

protected _invokePush(): Promise<boolean>;
private _handleVersionNotSupportedResponse;
/**

@@ -1144,2 +1203,5 @@ * Push pushes pending changes to the {@link pushURL}.

private _fireOnClientStateNotFound;
private _clientStateNotFoundOnClient;
private _clientStateNotFoundOnServer;
private _fireOnUpdateNeeded;
private _schedulePersist;

@@ -1238,2 +1300,2 @@ private _handlePersist;

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 };
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, PushResponse, Pusher, PusherResult, ReadTransaction, ReadonlyJSONObject, ReadonlyJSONValue, Replicache, ReplicacheOptions, RequestOptions, ScanIndexOptions, ScanNoIndexOptions, ScanOptionIndexedStartKey, ScanOptions, ScanResult, SubscribeOptions, TEST_LICENSE_KEY, TransactionClosedError, VersionNotSupportedResponse, WriteTransaction, consoleLogSink, deleteAllReplicacheData, filterAsyncIterable, isScanIndexOptions, makeIDBName, makeScanResult, mergeAsyncIterables, version };
{
"name": "replicache",
"description": "Realtime sync for any backend stack",
"version": "12.0.0-beta.0",
"version": "12.0.0",
"repository": "github:rocicorp/replicache",

@@ -16,3 +16,3 @@ "license": "https://roci.dev/terms.html",

"build": "rm -rf out && npm run build-dts && node tool/build.js",
"build-perf": "node tool/build.js --perf",
"build-perf": "node tool/build.js --perf --dd31",
"build-bundle-sizes": "rm -rf out && npm run build-dts && node tool/build.js --bundle-sizes",

@@ -19,0 +19,0 @@ "prepack": "npm run lint && npm run test && npm run build",

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