envio 2.20.0 → 2.20.1
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/evm.schema.json +1 -1
- package/fuel.schema.json +1 -1
- package/package.json +5 -5
- package/src/db/EntityHistory.res +16 -12
package/evm.schema.json
CHANGED
package/fuel.schema.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "envio",
|
|
3
|
-
"version": "v2.20.
|
|
3
|
+
"version": "v2.20.1",
|
|
4
4
|
"description": "A latency and sync speed optimized, developer friendly blockchain data indexer.",
|
|
5
5
|
"bin": "./bin.js",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
},
|
|
26
26
|
"homepage": "https://envio.dev",
|
|
27
27
|
"optionalDependencies": {
|
|
28
|
-
"envio-linux-x64": "v2.20.
|
|
29
|
-
"envio-linux-arm64": "v2.20.
|
|
30
|
-
"envio-darwin-x64": "v2.20.
|
|
31
|
-
"envio-darwin-arm64": "v2.20.
|
|
28
|
+
"envio-linux-x64": "v2.20.1",
|
|
29
|
+
"envio-linux-arm64": "v2.20.1",
|
|
30
|
+
"envio-darwin-x64": "v2.20.1",
|
|
31
|
+
"envio-darwin-arm64": "v2.20.1"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@envio-dev/hypersync-client": "0.6.3",
|
package/src/db/EntityHistory.res
CHANGED
|
@@ -24,6 +24,15 @@ type historyRow<'entity> = {
|
|
|
24
24
|
current: historyFields,
|
|
25
25
|
previous: option<historyFields>,
|
|
26
26
|
entityData: entityData<'entity>,
|
|
27
|
+
// In the event of a rollback, some entity updates may have been
|
|
28
|
+
// been affected by a rollback diff. If there was no rollback diff
|
|
29
|
+
// this will always be false.
|
|
30
|
+
// If there was a rollback diff, this will be false in the case of a
|
|
31
|
+
// new entity update (where entity affected is not present in the diff) b
|
|
32
|
+
// but true if the update is related to an entity that is
|
|
33
|
+
// currently present in the diff
|
|
34
|
+
// Optional since it's discarded during parsing/serialization
|
|
35
|
+
containsRollbackDiffChange?: bool,
|
|
27
36
|
}
|
|
28
37
|
|
|
29
38
|
type previousHistoryFields = historyFieldsGeneral<option<int>>
|
|
@@ -134,6 +143,7 @@ type t<'entity> = {
|
|
|
134
143
|
table: table,
|
|
135
144
|
createInsertFnQuery: string,
|
|
136
145
|
schema: S.t<historyRow<'entity>>,
|
|
146
|
+
// Used for parsing
|
|
137
147
|
schemaRows: S.t<array<historyRow<'entity>>>,
|
|
138
148
|
insertFn: (Postgres.sql, Js.Json.t, ~shouldCopyCurrentEntity: bool) => promise<unit>,
|
|
139
149
|
}
|
|
@@ -148,19 +158,13 @@ let insertRow = (
|
|
|
148
158
|
self.insertFn(sql, row, ~shouldCopyCurrentEntity)
|
|
149
159
|
}
|
|
150
160
|
|
|
151
|
-
let batchInsertRows = (
|
|
152
|
-
self: t<'entity>,
|
|
153
|
-
~sql,
|
|
154
|
-
~rows: array<historyRow<'entity>>,
|
|
155
|
-
~shouldCopyCurrentEntity,
|
|
156
|
-
) => {
|
|
157
|
-
let rows =
|
|
158
|
-
rows
|
|
159
|
-
->S.reverseConvertToJsonOrThrow(self.schemaRows)
|
|
160
|
-
->(Utils.magic: Js.Json.t => array<Js.Json.t>)
|
|
161
|
+
let batchInsertRows = (self: t<'entity>, ~sql, ~rows: array<historyRow<'entity>>) => {
|
|
161
162
|
rows
|
|
162
|
-
->Belt.Array.map(
|
|
163
|
-
|
|
163
|
+
->Belt.Array.map(historyRow => {
|
|
164
|
+
let containsRollbackDiffChange =
|
|
165
|
+
historyRow.containsRollbackDiffChange->Belt.Option.getWithDefault(false)
|
|
166
|
+
let shouldCopyCurrentEntity = !containsRollbackDiffChange
|
|
167
|
+
self->insertRow(~sql, ~historyRow, ~shouldCopyCurrentEntity)
|
|
164
168
|
})
|
|
165
169
|
->Promise.all
|
|
166
170
|
->Promise.thenResolve(_ => ())
|