Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@electric-sql/client

Package Overview
Dependencies
Maintainers
0
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@electric-sql/client - npm Package Compare versions

Comparing version 0.6.4 to 0.6.5

1

dist/index.d.ts

@@ -215,2 +215,3 @@ /**

get isUpToDate(): boolean;
get error(): unknown;
start(): Promise<void>;

@@ -217,0 +218,0 @@ subscribe(callback: (messages: Message<T>[]) => MaybePromise<void>, onError?: (error: FetchError | Error) => void): () => void;

29

dist/index.legacy-esm.js

@@ -369,3 +369,3 @@ var __defProp = Object.defineProperty;

// src/client.ts
var _fetchClient2, _messageParser, _subscribers, _upToDateSubscribers, _lastOffset, _liveCacheBuster, _lastSyncedAt, _isUpToDate, _connected, _shapeId, _schema, _ShapeStream_instances, publish_fn, sendErrorToSubscribers_fn, notifyUpToDateSubscribers_fn, sendErrorToUpToDateSubscribers_fn, reset_fn;
var _fetchClient2, _messageParser, _subscribers, _upToDateSubscribers, _lastOffset, _liveCacheBuster, _lastSyncedAt, _isUpToDate, _connected, _shapeId, _schema, _error, _ShapeStream_instances, publish_fn, sendErrorToSubscribers_fn, notifyUpToDateSubscribers_fn, sendErrorToUpToDateSubscribers_fn, reset_fn;
var ShapeStream = class {

@@ -387,2 +387,3 @@ constructor(options) {

__privateAdd(this, _schema);
__privateAdd(this, _error);
var _a, _b, _c;

@@ -412,2 +413,5 @@ validateOptions(options);

}
get error() {
return __privateGet(this, _error);
}
async start() {

@@ -444,7 +448,3 @@ var _a;

if (!(e instanceof FetchError)) throw e;
if (e.status == 400) {
__privateMethod(this, _ShapeStream_instances, reset_fn).call(this);
await __privateMethod(this, _ShapeStream_instances, publish_fn).call(this, e.json);
continue;
} else if (e.status == 409) {
if (e.status == 409) {
const newShapeId = e.headers[SHAPE_ID_HEADER];

@@ -496,2 +496,4 @@ __privateMethod(this, _ShapeStream_instances, reset_fn).call(this, newShapeId);

}
} catch (err) {
__privateSet(this, _error, err);
} finally {

@@ -550,2 +552,3 @@ __privateSet(this, _connected, false);

_schema = new WeakMap();
_error = new WeakMap();
_ShapeStream_instances = new WeakSet();

@@ -610,3 +613,3 @@ publish_fn = async function(messages) {

// src/shape.ts
var _stream, _data, _subscribers2, _hasNotifiedSubscribersUpToDate, _error, _Shape_instances, process_fn, handleError_fn, notify_fn;
var _stream, _data, _subscribers2, _hasNotifiedSubscribersUpToDate, _error2, _Shape_instances, process_fn, handleError_fn, notify_fn;
var Shape = class {

@@ -619,3 +622,3 @@ constructor(stream) {

__privateAdd(this, _hasNotifiedSubscribersUpToDate, false);
__privateAdd(this, _error, false);
__privateAdd(this, _error2, false);
__privateSet(this, _stream, stream);

@@ -646,3 +649,3 @@ __privateGet(this, _stream).subscribe(

unsubscribe();
if (__privateGet(this, _error)) reject(__privateGet(this, _error));
if (__privateGet(this, _error2)) reject(__privateGet(this, _error2));
resolve(shapeData);

@@ -657,3 +660,3 @@ });

get error() {
return __privateGet(this, _error);
return __privateGet(this, _error2);
}

@@ -694,3 +697,3 @@ /** Unix time at which we last synced. Undefined when `isLoading` is true. */

_hasNotifiedSubscribersUpToDate = new WeakMap();
_error = new WeakMap();
_error2 = new WeakMap();
_Shape_instances = new WeakSet();

@@ -728,3 +731,3 @@ process_fn = function(messages) {

__privateGet(this, _data).clear();
__privateSet(this, _error, false);
__privateSet(this, _error2, false);
__privateSet(this, _hasNotifiedSubscribersUpToDate, false);

@@ -744,3 +747,3 @@ isUpToDate = false;

if (e instanceof FetchError) {
__privateSet(this, _error, e);
__privateSet(this, _error2, e);
__privateMethod(this, _Shape_instances, notify_fn).call(this);

@@ -747,0 +750,0 @@ }

{
"name": "@electric-sql/client",
"version": "0.6.4",
"version": "0.6.5",
"description": "Postgres everywhere - your data, in sync, wherever you need it.",

@@ -5,0 +5,0 @@ "type": "module",

@@ -162,2 +162,3 @@ import {

#schema?: Schema
#error?: unknown

@@ -197,2 +198,6 @@ constructor(options: ShapeStreamOptions<GetExtensions<T>>) {

get error() {
return this.#error
}
async start() {

@@ -237,9 +242,3 @@ this.#isUpToDate = false

if (!(e instanceof FetchError)) throw e // should never happen
if (e.status == 400) {
// The request is invalid, most likely because the shape has been deleted.
// We should start from scratch, this will force the shape to be recreated.
this.#reset()
await this.#publish(e.json as Message<T>[])
continue
} else if (e.status == 409) {
if (e.status == 409) {
// Upon receiving a 409, we should start from scratch

@@ -256,3 +255,4 @@ // with the newly provided shape ID

// 400 errors are not actionable without additional user input, so we're throwing them.
// 400 errors are not actionable without additional user input,
// so we exit the loop
throw e

@@ -308,2 +308,4 @@ }

}
} catch (err) {
this.#error = err
} finally {

@@ -310,0 +312,0 @@ this.#connected = false

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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