@electric-sql/next
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -28,2 +28,3 @@ import { Message, JsonSerializable, Offset } from './types'; | ||
signal?: AbortSignal; | ||
fetchClient?: typeof fetch; | ||
} | ||
@@ -71,2 +72,3 @@ export declare class FetchError extends Error { | ||
private backoffOptions; | ||
private fetchClient; | ||
private subscribers; | ||
@@ -73,0 +75,0 @@ private upToDateSubscribers; |
@@ -99,3 +99,3 @@ var __defProp = Object.defineProperty; | ||
this.isUpToDate = false; | ||
var _a, _b; | ||
var _a, _b, _c; | ||
this.validateOptions(options); | ||
@@ -106,2 +106,3 @@ this.options = __spreadValues({ subscribe: true }, options); | ||
this.backoffOptions = (_b = options.backoffOptions) != null ? _b : BackoffDefaults; | ||
this.fetchClient = (_c = options.fetchClient) != null ? _c : fetch; | ||
this.start(); | ||
@@ -120,4 +121,3 @@ } | ||
); | ||
if (shape.where) | ||
url.searchParams.set(`where`, shape.where); | ||
if (shape.where) url.searchParams.set(`where`, shape.where); | ||
url.searchParams.set(`offset`, this.lastOffset); | ||
@@ -131,4 +131,3 @@ if (this.isUpToDate) { | ||
try { | ||
yield fetch(url.toString(), { signal }).then((response) => __async(this, null, function* () { | ||
var _a; | ||
yield this.fetchClient(url.toString(), { signal }).then((response) => __async(this, null, function* () { | ||
if (!response.ok) { | ||
@@ -138,6 +137,10 @@ throw yield FetchError.fromResponse(response, url.toString()); | ||
const { headers, status } = response; | ||
const shapeId = (_a = headers.get(`X-Electric-Shape-Id`)) != null ? _a : void 0; | ||
const shapeId = headers.get(`X-Electric-Shape-Id`); | ||
if (shapeId) { | ||
this.shapeId = shapeId; | ||
} | ||
const lastOffset = headers.get(`X-Electric-Chunk-Last-Offset`); | ||
if (lastOffset) { | ||
this.lastOffset = lastOffset; | ||
} | ||
attempt = 0; | ||
@@ -161,5 +164,2 @@ if (status === 204) { | ||
} | ||
if (`offset` in message) { | ||
this.lastOffset = message.offset; | ||
} | ||
}); | ||
@@ -307,3 +307,3 @@ this.publish(batch); | ||
var _a, _b; | ||
if (`key` in message && message.value) { | ||
if (`key` in message) { | ||
switch ((_a = message.headers) == null ? void 0 : _a[`action`]) { | ||
@@ -310,0 +310,0 @@ case `insert`: |
{ | ||
"name": "@electric-sql/next", | ||
"version": "0.0.2", | ||
"description": "The Next Electric", | ||
"version": "0.0.3", | ||
"description": "Postgres everywhere - your data, in sync, wherever you need it.", | ||
"main": "dist/index.js", | ||
@@ -23,8 +23,8 @@ "types": "dist/index.d.ts", | ||
}, | ||
"author": "", | ||
"license": "ISC", | ||
"author": "ElectricSQL team and contributors.", | ||
"license": "Apache-2", | ||
"bugs": { | ||
"url": "https://github.com/electric-sql/electric-next/issues" | ||
}, | ||
"homepage": "https://github.com/electric-sql/electric-next#readme", | ||
"homepage": "https://next.electric-sql.com", | ||
"dependencies": {}, | ||
@@ -31,0 +31,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
38836
495
0
1