@apibara/plugin-mongo 2.1.0-beta.20 → 2.1.0-beta.22
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/index.cjs +9 -12
- package/dist/index.mjs +9 -12
- package/package.json +3 -3
- package/src/index.ts +9 -13
package/dist/index.cjs
CHANGED
|
@@ -367,23 +367,20 @@ function mongoStorage({
|
|
|
367
367
|
const { indexerName } = plugins$1.useInternalContext();
|
|
368
368
|
indexerId = internal.generateIndexerId(indexerName, identifier);
|
|
369
369
|
const logger = plugins.useLogger();
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
370
|
+
await withTransaction(client, async (session) => {
|
|
371
|
+
const db = client.db(dbName, dbOptions);
|
|
372
|
+
if (enablePersistence) {
|
|
373
|
+
await initializePersistentState(db, session);
|
|
374
|
+
}
|
|
375
|
+
if (alwaysReindex) {
|
|
376
|
+
logger.warn(
|
|
377
|
+
`Reindexing: Deleting all data from collections - ${collections.join(", ")}`
|
|
378
|
+
);
|
|
376
379
|
await cleanupStorage(db, session, collections);
|
|
377
380
|
if (enablePersistence) {
|
|
378
381
|
await resetPersistence({ db, session, indexerId });
|
|
379
382
|
}
|
|
380
383
|
logger.success("All data has been cleaned up for reindexing");
|
|
381
|
-
});
|
|
382
|
-
}
|
|
383
|
-
await withTransaction(client, async (session) => {
|
|
384
|
-
const db = client.db(dbName, dbOptions);
|
|
385
|
-
if (enablePersistence) {
|
|
386
|
-
await initializePersistentState(db, session);
|
|
387
384
|
}
|
|
388
385
|
});
|
|
389
386
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -365,23 +365,20 @@ function mongoStorage({
|
|
|
365
365
|
const { indexerName } = useInternalContext();
|
|
366
366
|
indexerId = generateIndexerId(indexerName, identifier);
|
|
367
367
|
const logger = useLogger();
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
368
|
+
await withTransaction(client, async (session) => {
|
|
369
|
+
const db = client.db(dbName, dbOptions);
|
|
370
|
+
if (enablePersistence) {
|
|
371
|
+
await initializePersistentState(db, session);
|
|
372
|
+
}
|
|
373
|
+
if (alwaysReindex) {
|
|
374
|
+
logger.warn(
|
|
375
|
+
`Reindexing: Deleting all data from collections - ${collections.join(", ")}`
|
|
376
|
+
);
|
|
374
377
|
await cleanupStorage(db, session, collections);
|
|
375
378
|
if (enablePersistence) {
|
|
376
379
|
await resetPersistence({ db, session, indexerId });
|
|
377
380
|
}
|
|
378
381
|
logger.success("All data has been cleaned up for reindexing");
|
|
379
|
-
});
|
|
380
|
-
}
|
|
381
|
-
await withTransaction(client, async (session) => {
|
|
382
|
-
const db = client.db(dbName, dbOptions);
|
|
383
|
-
if (enablePersistence) {
|
|
384
|
-
await initializePersistentState(db, session);
|
|
385
382
|
}
|
|
386
383
|
});
|
|
387
384
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apibara/plugin-mongo",
|
|
3
|
-
"version": "2.1.0-beta.
|
|
3
|
+
"version": "2.1.0-beta.22",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"mongodb": "^6.12.0"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@apibara/indexer": "2.1.0-beta.
|
|
39
|
-
"@apibara/protocol": "2.1.0-beta.
|
|
38
|
+
"@apibara/indexer": "2.1.0-beta.22",
|
|
39
|
+
"@apibara/protocol": "2.1.0-beta.22"
|
|
40
40
|
}
|
|
41
41
|
}
|
package/src/index.ts
CHANGED
|
@@ -70,13 +70,16 @@ export function mongoStorage<TFilter, TBlock>({
|
|
|
70
70
|
indexerId = generateIndexerId(indexerName, identifier);
|
|
71
71
|
const logger = useLogger();
|
|
72
72
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
73
|
+
await withTransaction(client, async (session) => {
|
|
74
|
+
const db = client.db(dbName, dbOptions);
|
|
75
|
+
if (enablePersistence) {
|
|
76
|
+
await initializePersistentState(db, session);
|
|
77
|
+
}
|
|
77
78
|
|
|
78
|
-
|
|
79
|
-
|
|
79
|
+
if (alwaysReindex) {
|
|
80
|
+
logger.warn(
|
|
81
|
+
`Reindexing: Deleting all data from collections - ${collections.join(", ")}`,
|
|
82
|
+
);
|
|
80
83
|
|
|
81
84
|
await cleanupStorage(db, session, collections);
|
|
82
85
|
|
|
@@ -85,13 +88,6 @@ export function mongoStorage<TFilter, TBlock>({
|
|
|
85
88
|
}
|
|
86
89
|
|
|
87
90
|
logger.success("All data has been cleaned up for reindexing");
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
await withTransaction(client, async (session) => {
|
|
92
|
-
const db = client.db(dbName, dbOptions);
|
|
93
|
-
if (enablePersistence) {
|
|
94
|
-
await initializePersistentState(db, session);
|
|
95
91
|
}
|
|
96
92
|
});
|
|
97
93
|
});
|