@apibara/plugin-mongo 2.0.0-beta.39 → 2.0.0-beta.41
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 +3 -2
- package/dist/index.mjs +3 -2
- package/package.json +3 -3
- package/src/persistence.ts +4 -4
package/dist/index.cjs
CHANGED
|
@@ -4,6 +4,7 @@ const indexer = require('@apibara/indexer');
|
|
|
4
4
|
const plugins = require('@apibara/indexer/plugins');
|
|
5
5
|
const internal = require('@apibara/indexer/internal');
|
|
6
6
|
const plugins$1 = require('@apibara/indexer/internal/plugins');
|
|
7
|
+
const protocol = require('@apibara/protocol');
|
|
7
8
|
|
|
8
9
|
async function invalidate(db, session, cursor, collections) {
|
|
9
10
|
const orderKeyValue = Number(cursor.orderKey);
|
|
@@ -94,10 +95,10 @@ async function getState(props) {
|
|
|
94
95
|
let filter;
|
|
95
96
|
const checkpointRow = await db.collection(checkpointCollectionName).findOne({ id: indexerId }, { session });
|
|
96
97
|
if (checkpointRow) {
|
|
97
|
-
cursor = {
|
|
98
|
+
cursor = protocol.normalizeCursor({
|
|
98
99
|
orderKey: BigInt(checkpointRow.orderKey),
|
|
99
100
|
uniqueKey: checkpointRow.uniqueKey
|
|
100
|
-
};
|
|
101
|
+
});
|
|
101
102
|
}
|
|
102
103
|
const filterRow = await db.collection(filterCollectionName).findOne(
|
|
103
104
|
{
|
package/dist/index.mjs
CHANGED
|
@@ -2,6 +2,7 @@ import { useIndexerContext } from '@apibara/indexer';
|
|
|
2
2
|
import { defineIndexerPlugin } from '@apibara/indexer/plugins';
|
|
3
3
|
import { generateIndexerId } from '@apibara/indexer/internal';
|
|
4
4
|
import { useInternalContext } from '@apibara/indexer/internal/plugins';
|
|
5
|
+
import { normalizeCursor } from '@apibara/protocol';
|
|
5
6
|
|
|
6
7
|
async function invalidate(db, session, cursor, collections) {
|
|
7
8
|
const orderKeyValue = Number(cursor.orderKey);
|
|
@@ -92,10 +93,10 @@ async function getState(props) {
|
|
|
92
93
|
let filter;
|
|
93
94
|
const checkpointRow = await db.collection(checkpointCollectionName).findOne({ id: indexerId }, { session });
|
|
94
95
|
if (checkpointRow) {
|
|
95
|
-
cursor = {
|
|
96
|
+
cursor = normalizeCursor({
|
|
96
97
|
orderKey: BigInt(checkpointRow.orderKey),
|
|
97
98
|
uniqueKey: checkpointRow.uniqueKey
|
|
98
|
-
};
|
|
99
|
+
});
|
|
99
100
|
}
|
|
100
101
|
const filterRow = await db.collection(filterCollectionName).findOne(
|
|
101
102
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apibara/plugin-mongo",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.41",
|
|
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.0.0-beta.
|
|
39
|
-
"@apibara/protocol": "2.0.0-beta.
|
|
38
|
+
"@apibara/indexer": "2.0.0-beta.41",
|
|
39
|
+
"@apibara/protocol": "2.0.0-beta.41"
|
|
40
40
|
}
|
|
41
41
|
}
|
package/src/persistence.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Cursor, normalizeCursor } from "@apibara/protocol";
|
|
2
2
|
import type { ClientSession, Db } from "mongodb";
|
|
3
3
|
|
|
4
4
|
export type CheckpointSchema = {
|
|
5
5
|
id: string;
|
|
6
6
|
orderKey: number;
|
|
7
|
-
uniqueKey
|
|
7
|
+
uniqueKey: string | null;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
export type FilterSchema = {
|
|
@@ -98,10 +98,10 @@ export async function getState<TFilter>(props: {
|
|
|
98
98
|
.findOne({ id: indexerId }, { session });
|
|
99
99
|
|
|
100
100
|
if (checkpointRow) {
|
|
101
|
-
cursor = {
|
|
101
|
+
cursor = normalizeCursor({
|
|
102
102
|
orderKey: BigInt(checkpointRow.orderKey),
|
|
103
103
|
uniqueKey: checkpointRow.uniqueKey,
|
|
104
|
-
};
|
|
104
|
+
});
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
const filterRow = await db
|