@peerbit/indexer-sqlite3 1.3.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/sqlite3/sqlite3.worker.min.js +24 -8
- package/dist/index.min.js +27 -9
- package/dist/index.min.js.map +3 -3
- package/dist/src/schema.js +3 -5
- package/dist/src/schema.js.map +1 -1
- package/dist/src/sqlite3.wasm.d.ts.map +1 -1
- package/dist/src/sqlite3.wasm.js +24 -7
- package/dist/src/sqlite3.wasm.js.map +1 -1
- package/package.json +3 -3
- package/src/schema.ts +5 -5
- package/src/sqlite3.wasm.ts +28 -10
|
@@ -17604,14 +17604,30 @@ var loadSqlite3InitModule = async () => {
|
|
|
17604
17604
|
};
|
|
17605
17605
|
var poolUtil = void 0;
|
|
17606
17606
|
var sqlite3 = void 0;
|
|
17607
|
+
var sqlite3Promise = void 0;
|
|
17608
|
+
var getSqlite3 = async () => {
|
|
17609
|
+
if (sqlite3) {
|
|
17610
|
+
return sqlite3;
|
|
17611
|
+
}
|
|
17612
|
+
if (!sqlite3Promise) {
|
|
17613
|
+
sqlite3Promise = (async () => {
|
|
17614
|
+
const sqlite3InitModule2 = await loadSqlite3InitModule();
|
|
17615
|
+
ensureSqlite3InitModuleState();
|
|
17616
|
+
return sqlite3InitModule2({
|
|
17617
|
+
print: log,
|
|
17618
|
+
printErr: error,
|
|
17619
|
+
locateFile: (file) => `${SQLITE3_ASSET_BASE}/${file}`
|
|
17620
|
+
});
|
|
17621
|
+
})().then((module) => {
|
|
17622
|
+
sqlite3 = module;
|
|
17623
|
+
return module;
|
|
17624
|
+
});
|
|
17625
|
+
}
|
|
17626
|
+
return sqlite3Promise;
|
|
17627
|
+
};
|
|
17607
17628
|
var create = async (directory) => {
|
|
17608
17629
|
let statements = /* @__PURE__ */ new Map();
|
|
17609
|
-
const
|
|
17610
|
-
sqlite3 = sqlite3 || await sqlite3InitModule2({
|
|
17611
|
-
print: log,
|
|
17612
|
-
printErr: error,
|
|
17613
|
-
locateFile: (file) => `${SQLITE3_ASSET_BASE}/${file}`
|
|
17614
|
-
});
|
|
17630
|
+
const sqlite32 = await getSqlite3();
|
|
17615
17631
|
let sqliteDb = void 0;
|
|
17616
17632
|
let closeInternal = async () => {
|
|
17617
17633
|
await Promise.all([...statements.values()].map((x) => x.finalize?.()));
|
|
@@ -17692,14 +17708,14 @@ var create = async (directory) => {
|
|
|
17692
17708
|
directory = directory.replace(/^\./, "");
|
|
17693
17709
|
dbFileName = `${directory}/db.sqlite`;
|
|
17694
17710
|
const poolDirectory = `${directory}/peerbit/sqlite-opfs-pool`;
|
|
17695
|
-
const activePoolUtil = poolUtil || await
|
|
17711
|
+
const activePoolUtil = poolUtil || await sqlite32.installOpfsSAHPoolVfs({
|
|
17696
17712
|
directory: poolDirectory
|
|
17697
17713
|
});
|
|
17698
17714
|
poolUtil = activePoolUtil;
|
|
17699
17715
|
await activePoolUtil.reserveMinimumCapacity(100);
|
|
17700
17716
|
sqliteDb = new activePoolUtil.OpfsSAHPoolDb(dbFileName);
|
|
17701
17717
|
} else {
|
|
17702
|
-
sqliteDb = new
|
|
17718
|
+
sqliteDb = new sqlite32.oo1.DB(":memory:");
|
|
17703
17719
|
}
|
|
17704
17720
|
if (!sqliteDb) {
|
|
17705
17721
|
throw new Error("Failed to open sqlite database");
|
package/dist/index.min.js
CHANGED
|
@@ -20399,7 +20399,9 @@ var getNameOfClass = (ctor) => {
|
|
|
20399
20399
|
throw new Error("Schema not found for " + ctor.name);
|
|
20400
20400
|
}
|
|
20401
20401
|
if (schema.variant === void 0) {
|
|
20402
|
-
|
|
20402
|
+
const ctorName = ctor.name || "<anonymous>";
|
|
20403
|
+
const variantHint = ctor.name || "your-variant";
|
|
20404
|
+
throw new Error(`Schema associated with ${ctorName} has no variant. Add @variant("${variantHint}") to define a stable table name.`);
|
|
20403
20405
|
} else {
|
|
20404
20406
|
name = getNameOfVariant(schema.variant);
|
|
20405
20407
|
}
|
|
@@ -22472,14 +22474,30 @@ var loadSqlite3InitModule = async () => {
|
|
|
22472
22474
|
};
|
|
22473
22475
|
var poolUtil = void 0;
|
|
22474
22476
|
var sqlite3 = void 0;
|
|
22477
|
+
var sqlite3Promise = void 0;
|
|
22478
|
+
var getSqlite3 = async () => {
|
|
22479
|
+
if (sqlite3) {
|
|
22480
|
+
return sqlite3;
|
|
22481
|
+
}
|
|
22482
|
+
if (!sqlite3Promise) {
|
|
22483
|
+
sqlite3Promise = (async () => {
|
|
22484
|
+
const sqlite3InitModule2 = await loadSqlite3InitModule();
|
|
22485
|
+
ensureSqlite3InitModuleState();
|
|
22486
|
+
return sqlite3InitModule2({
|
|
22487
|
+
print: log,
|
|
22488
|
+
printErr: error,
|
|
22489
|
+
locateFile: (file) => `${SQLITE3_ASSET_BASE}/${file}`
|
|
22490
|
+
});
|
|
22491
|
+
})().then((module) => {
|
|
22492
|
+
sqlite3 = module;
|
|
22493
|
+
return module;
|
|
22494
|
+
});
|
|
22495
|
+
}
|
|
22496
|
+
return sqlite3Promise;
|
|
22497
|
+
};
|
|
22475
22498
|
var create = async (directory) => {
|
|
22476
22499
|
let statements = /* @__PURE__ */ new Map();
|
|
22477
|
-
const
|
|
22478
|
-
sqlite3 = sqlite3 || await sqlite3InitModule2({
|
|
22479
|
-
print: log,
|
|
22480
|
-
printErr: error,
|
|
22481
|
-
locateFile: (file) => `${SQLITE3_ASSET_BASE}/${file}`
|
|
22482
|
-
});
|
|
22500
|
+
const sqlite32 = await getSqlite3();
|
|
22483
22501
|
let sqliteDb = void 0;
|
|
22484
22502
|
let closeInternal = async () => {
|
|
22485
22503
|
await Promise.all([...statements.values()].map((x) => x.finalize?.()));
|
|
@@ -22560,14 +22578,14 @@ var create = async (directory) => {
|
|
|
22560
22578
|
directory = directory.replace(/^\./, "");
|
|
22561
22579
|
dbFileName = `${directory}/db.sqlite`;
|
|
22562
22580
|
const poolDirectory = `${directory}/peerbit/sqlite-opfs-pool`;
|
|
22563
|
-
const activePoolUtil = poolUtil || await
|
|
22581
|
+
const activePoolUtil = poolUtil || await sqlite32.installOpfsSAHPoolVfs({
|
|
22564
22582
|
directory: poolDirectory
|
|
22565
22583
|
});
|
|
22566
22584
|
poolUtil = activePoolUtil;
|
|
22567
22585
|
await activePoolUtil.reserveMinimumCapacity(100);
|
|
22568
22586
|
sqliteDb = new activePoolUtil.OpfsSAHPoolDb(dbFileName);
|
|
22569
22587
|
} else {
|
|
22570
|
-
sqliteDb = new
|
|
22588
|
+
sqliteDb = new sqlite32.oo1.DB(":memory:");
|
|
22571
22589
|
}
|
|
22572
22590
|
if (!sqliteDb) {
|
|
22573
22591
|
throw new Error("Failed to open sqlite database");
|