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

@electric-sql/pglite

Package Overview
Dependencies
Maintainers
3
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@electric-sql/pglite - npm Package Compare versions

Comparing version 0.0.1-debug.2 to 0.0.1

dist/chunk-Z6L7HPDY.js

2

dist/index.d.ts

@@ -292,3 +292,3 @@ /** Based on https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/emscripten/index.d.ts */

get closed(): boolean;
close(): Promise<void>;
close(): Promise<unknown>;
query(query: String): Promise<unknown>;

@@ -295,0 +295,0 @@ }

@@ -14,3 +14,3 @@ import {

share_default
} from "./chunk-RM7SEAOI.js";
} from "./chunk-Z6L7HPDY.js";

@@ -240,3 +240,3 @@ // ../../node_modules/.pnpm/async-mutex@0.4.1/node_modules/async-mutex/index.mjs

async init() {
const dbExists = (await window.indexedDB.databases()).map((db) => db.name).includes(`/pglite${this.dataDir}`);
const dbExists = (await globalThis.indexedDB.databases()).map((db) => db.name).includes(`/pglite${this.dataDir}`);
if (!dbExists) {

@@ -330,3 +330,3 @@ this.initModule = await initDb();

}
var _initStarted, _ready, _eventTarget, _closed, _awaitingResult, _resultError, _queryMutex, _fsSyncMutex, _init, init_fn, _syncToFs, syncToFs_fn;
var _initStarted, _ready, _eventTarget, _closing, _closed, _awaitingResult, _resultError, _queryMutex, _fsSyncMutex, _init, init_fn, _syncToFs, syncToFs_fn;
var PGlite = class {

@@ -339,2 +339,3 @@ constructor(dataDir) {

__privateAdd(this, _eventTarget, void 0);
__privateAdd(this, _closing, false);
__privateAdd(this, _closed, false);

@@ -375,13 +376,19 @@ __privateAdd(this, _awaitingResult, false);

}
async close() {
close() {
__privateSet(this, _closing, true);
const promise = new Promise((resolve, reject) => {
__privateGet(this, _eventTarget).addEventListener("closed", resolve, {
once: true
});
});
const event = new CustomEvent("query", {
detail: {
query: "",
qtype: "X"
}
detail: "X"
});
__privateGet(this, _eventTarget).dispatchEvent(event);
__privateSet(this, _closed, true);
return promise;
}
async query(query) {
if (__privateGet(this, _closing)) {
throw new Error("Postgreslite is closing");
}
if (__privateGet(this, _closed)) {

@@ -410,3 +417,3 @@ throw new Error("Postgreslite is closed");

__privateGet(this, _eventTarget).removeEventListener("waiting", handleWaiting);
resolve(e.detail.result);
resolve(JSON.parse(e.detail.result));
__privateSet(this, _resultError, void 0);

@@ -422,5 +429,3 @@ __privateSet(this, _awaitingResult, false);

const event = new CustomEvent("query", {
detail: {
query
}
detail: `Q${query}`
});

@@ -435,2 +440,3 @@ __privateGet(this, _eventTarget).dispatchEvent(event);

_eventTarget = new WeakMap();
_closing = new WeakMap();
_closed = new WeakMap();

@@ -449,3 +455,3 @@ _awaitingResult = new WeakMap();

if (this.dataDir && this.fsType === "nodefs") {
const { NodeFS } = await import("./nodefs-XF7PXNWE.js");
const { NodeFS } = await import("./nodefs-DDJQVOBZ.js");
this.fs = new NodeFS(this.dataDir);

@@ -488,2 +494,5 @@ } else if (this.dataDir && this.fsType === "idbfs") {

__privateSet(this, _resultError, text.split("ERROR:")[1].trim());
} else if (__privateGet(this, _closing) && text.includes("NOTICE: database system is shut down")) {
__privateSet(this, _closed, true);
__privateGet(this, _eventTarget).dispatchEvent(new CustomEvent("closed"));
}

@@ -490,0 +499,0 @@ },

{
"name": "@electric-sql/pglite",
"version": "0.0.1-debug.2",
"version": "0.0.1",
"private": false,

@@ -5,0 +5,0 @@ "publishConfig": {

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