ponder 0.8.14 → 0.8.16
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/bin/ponder.js +19 -6
- package/dist/bin/ponder.js.map +1 -1
- package/package.json +1 -1
- package/src/bin/utils/run.ts +2 -2
- package/src/build/plugin.ts +5 -1
- package/src/sync/index.ts +14 -4
- package/src/utils/pglite.ts +9 -1
package/dist/bin/ponder.js
CHANGED
|
@@ -1397,13 +1397,14 @@ export * from "${schemaPath}";
|
|
|
1397
1397
|
export default schema;
|
|
1398
1398
|
`;
|
|
1399
1399
|
var vitePluginPonder = (options) => {
|
|
1400
|
+
const schemaPath = options.schemaFile.replace(/\\/g, "/");
|
|
1400
1401
|
return {
|
|
1401
1402
|
name: "ponder",
|
|
1402
1403
|
load: (id) => {
|
|
1403
1404
|
if (id === "ponder:registry")
|
|
1404
1405
|
return virtualModule();
|
|
1405
1406
|
if (id === "ponder:schema")
|
|
1406
|
-
return schemaModule(
|
|
1407
|
+
return schemaModule(schemaPath);
|
|
1407
1408
|
return null;
|
|
1408
1409
|
}
|
|
1409
1410
|
};
|
|
@@ -3969,7 +3970,11 @@ function createPool(config, logger) {
|
|
|
3969
3970
|
import { mkdirSync as mkdirSync2 } from "node:fs";
|
|
3970
3971
|
import { PGlite } from "@electric-sql/pglite";
|
|
3971
3972
|
function createPglite(options) {
|
|
3972
|
-
|
|
3973
|
+
if (options.dataDir === "memory://") {
|
|
3974
|
+
options.dataDir = void 0;
|
|
3975
|
+
} else {
|
|
3976
|
+
mkdirSync2(options.dataDir, { recursive: true });
|
|
3977
|
+
}
|
|
3973
3978
|
return new PGlite(options);
|
|
3974
3979
|
}
|
|
3975
3980
|
|
|
@@ -9893,10 +9898,18 @@ var splitEvents = (events) => {
|
|
|
9893
9898
|
const result = [];
|
|
9894
9899
|
for (const event of events) {
|
|
9895
9900
|
if (prevHash === void 0 || prevHash !== event.block.hash) {
|
|
9896
|
-
result.push(
|
|
9901
|
+
result.push({
|
|
9902
|
+
checkpoint: encodeCheckpoint({
|
|
9903
|
+
...maxCheckpoint,
|
|
9904
|
+
blockTimestamp: Number(event.block.timestamp),
|
|
9905
|
+
chainId: BigInt(event.chainId),
|
|
9906
|
+
blockNumber: event.block.number
|
|
9907
|
+
}),
|
|
9908
|
+
events: []
|
|
9909
|
+
});
|
|
9897
9910
|
prevHash = event.block.hash;
|
|
9898
9911
|
}
|
|
9899
|
-
result[result.length - 1].push(event);
|
|
9912
|
+
result[result.length - 1].events.push(event);
|
|
9900
9913
|
}
|
|
9901
9914
|
return result;
|
|
9902
9915
|
};
|
|
@@ -10653,14 +10666,14 @@ async function run({
|
|
|
10653
10666
|
worker: async (event) => {
|
|
10654
10667
|
switch (event.type) {
|
|
10655
10668
|
case "block": {
|
|
10656
|
-
for (const events of splitEvents(event.events)) {
|
|
10669
|
+
for (const { checkpoint, events } of splitEvents(event.events)) {
|
|
10657
10670
|
const result = await handleEvents(
|
|
10658
10671
|
decodeEvents(common, indexingBuild.sources, events),
|
|
10659
10672
|
event.checkpoint
|
|
10660
10673
|
);
|
|
10661
10674
|
if (result.status === "error")
|
|
10662
10675
|
onReloadableError(result.error);
|
|
10663
|
-
await database.complete({ checkpoint
|
|
10676
|
+
await database.complete({ checkpoint });
|
|
10664
10677
|
}
|
|
10665
10678
|
await metadataStore.setStatus(event.status);
|
|
10666
10679
|
break;
|