envio 3.0.0-alpha.2 → 3.0.0-alpha.21
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/README.md +164 -30
- package/bin.mjs +49 -0
- package/evm.schema.json +79 -169
- package/fuel.schema.json +50 -21
- package/index.d.ts +578 -1
- package/index.js +4 -0
- package/package.json +47 -31
- package/rescript.json +4 -1
- package/src/Batch.res +11 -8
- package/src/Batch.res.mjs +11 -9
- package/src/ChainFetcher.res +531 -0
- package/src/ChainFetcher.res.mjs +339 -0
- package/src/ChainManager.res +190 -0
- package/src/ChainManager.res.mjs +166 -0
- package/src/Change.res +3 -3
- package/src/Config.gen.ts +19 -0
- package/src/Config.res +725 -25
- package/src/Config.res.mjs +692 -26
- package/src/{Indexer.res → Ctx.res} +1 -1
- package/src/Ecosystem.res +9 -124
- package/src/Ecosystem.res.mjs +19 -160
- package/src/Env.res +33 -73
- package/src/Env.res.mjs +29 -85
- package/src/Envio.gen.ts +3 -1
- package/src/Envio.res +77 -9
- package/src/Envio.res.mjs +39 -1
- package/src/EventConfigBuilder.res +408 -0
- package/src/EventConfigBuilder.res.mjs +376 -0
- package/src/EventProcessing.res +469 -0
- package/src/EventProcessing.res.mjs +337 -0
- package/src/EvmTypes.gen.ts +6 -0
- package/src/EvmTypes.res +1 -0
- package/src/FetchState.res +1256 -639
- package/src/FetchState.res.mjs +1135 -612
- package/src/GlobalState.res +1224 -0
- package/src/GlobalState.res.mjs +1291 -0
- package/src/GlobalStateManager.res +68 -0
- package/src/GlobalStateManager.res.mjs +75 -0
- package/src/GlobalStateManager.resi +7 -0
- package/src/HandlerLoader.res +89 -0
- package/src/HandlerLoader.res.mjs +79 -0
- package/src/HandlerRegister.res +357 -0
- package/src/HandlerRegister.res.mjs +299 -0
- package/src/HandlerRegister.resi +30 -0
- package/src/Hasura.res +111 -175
- package/src/Hasura.res.mjs +88 -150
- package/src/InMemoryStore.res +1 -1
- package/src/InMemoryStore.res.mjs +3 -3
- package/src/InMemoryTable.res +1 -1
- package/src/InMemoryTable.res.mjs +1 -1
- package/src/Internal.gen.ts +6 -0
- package/src/Internal.res +265 -12
- package/src/Internal.res.mjs +115 -1
- package/src/LoadLayer.res +444 -0
- package/src/LoadLayer.res.mjs +296 -0
- package/src/LoadLayer.resi +32 -0
- package/src/LogSelection.res +33 -27
- package/src/LogSelection.res.mjs +6 -0
- package/src/Logging.res +21 -7
- package/src/Logging.res.mjs +16 -8
- package/src/Main.res +390 -0
- package/src/Main.res.mjs +341 -0
- package/src/Persistence.res +7 -21
- package/src/Persistence.res.mjs +3 -3
- package/src/PgStorage.gen.ts +10 -0
- package/src/PgStorage.res +116 -69
- package/src/PgStorage.res.d.mts +5 -0
- package/src/PgStorage.res.mjs +93 -50
- package/src/Prometheus.res +294 -224
- package/src/Prometheus.res.mjs +353 -340
- package/src/ReorgDetection.res +6 -10
- package/src/ReorgDetection.res.mjs +6 -6
- package/src/SafeCheckpointTracking.res +4 -4
- package/src/SafeCheckpointTracking.res.mjs +2 -2
- package/src/SimulateItems.res +353 -0
- package/src/SimulateItems.res.mjs +335 -0
- package/src/Sink.res +4 -2
- package/src/Sink.res.mjs +2 -1
- package/src/TableIndices.res +0 -1
- package/src/TestIndexer.res +913 -0
- package/src/TestIndexer.res.mjs +698 -0
- package/src/TestIndexerProxyStorage.res +205 -0
- package/src/TestIndexerProxyStorage.res.mjs +151 -0
- package/src/TopicFilter.res +1 -1
- package/src/Types.ts +1 -1
- package/src/UserContext.res +424 -0
- package/src/UserContext.res.mjs +279 -0
- package/src/Utils.res +97 -26
- package/src/Utils.res.mjs +91 -44
- package/src/bindings/BigInt.res +10 -0
- package/src/bindings/BigInt.res.mjs +15 -0
- package/src/bindings/ClickHouse.res +120 -23
- package/src/bindings/ClickHouse.res.mjs +118 -28
- package/src/bindings/DateFns.res +74 -0
- package/src/bindings/DateFns.res.mjs +22 -0
- package/src/bindings/EventSource.res +11 -2
- package/src/bindings/EventSource.res.mjs +8 -1
- package/src/bindings/Express.res +1 -0
- package/src/bindings/Hrtime.res +14 -1
- package/src/bindings/Hrtime.res.mjs +22 -2
- package/src/bindings/Hrtime.resi +4 -0
- package/src/bindings/Lodash.res +0 -1
- package/src/bindings/NodeJs.res +49 -3
- package/src/bindings/NodeJs.res.mjs +11 -3
- package/src/bindings/Pino.res +24 -10
- package/src/bindings/Pino.res.mjs +14 -8
- package/src/bindings/Postgres.gen.ts +8 -0
- package/src/bindings/Postgres.res +5 -1
- package/src/bindings/Postgres.res.d.mts +5 -0
- package/src/bindings/PromClient.res +0 -10
- package/src/bindings/PromClient.res.mjs +0 -3
- package/src/bindings/Vitest.res +144 -0
- package/src/bindings/Vitest.res.mjs +9 -0
- package/src/bindings/WebSocket.res +27 -0
- package/src/bindings/WebSocket.res.mjs +2 -0
- package/src/bindings/Yargs.res +8 -0
- package/src/bindings/Yargs.res.mjs +2 -0
- package/src/db/EntityHistory.res +7 -7
- package/src/db/EntityHistory.res.mjs +9 -9
- package/src/db/InternalTable.res +59 -111
- package/src/db/InternalTable.res.mjs +73 -104
- package/src/db/Table.res +27 -8
- package/src/db/Table.res.mjs +25 -14
- package/src/sources/Evm.res +84 -0
- package/src/sources/Evm.res.mjs +105 -0
- package/src/sources/EvmChain.res +94 -0
- package/src/sources/EvmChain.res.mjs +60 -0
- package/src/sources/Fuel.res +19 -34
- package/src/sources/Fuel.res.mjs +34 -16
- package/src/sources/FuelSDK.res +38 -0
- package/src/sources/FuelSDK.res.mjs +29 -0
- package/src/sources/HyperFuel.res +2 -2
- package/src/sources/HyperFuel.resi +1 -1
- package/src/sources/HyperFuelClient.res +2 -2
- package/src/sources/HyperFuelSource.res +35 -13
- package/src/sources/HyperFuelSource.res.mjs +26 -16
- package/src/sources/HyperSync.res +61 -60
- package/src/sources/HyperSync.res.mjs +53 -67
- package/src/sources/HyperSync.resi +6 -4
- package/src/sources/HyperSyncClient.res +29 -2
- package/src/sources/HyperSyncClient.res.mjs +9 -0
- package/src/sources/HyperSyncHeightStream.res +76 -118
- package/src/sources/HyperSyncHeightStream.res.mjs +68 -75
- package/src/sources/HyperSyncSource.res +122 -143
- package/src/sources/HyperSyncSource.res.mjs +106 -121
- package/src/sources/Rpc.res +86 -14
- package/src/sources/Rpc.res.mjs +101 -9
- package/src/sources/RpcSource.res +731 -364
- package/src/sources/RpcSource.res.mjs +845 -410
- package/src/sources/RpcWebSocketHeightStream.res +181 -0
- package/src/sources/RpcWebSocketHeightStream.res.mjs +196 -0
- package/src/sources/SimulateSource.res +59 -0
- package/src/sources/SimulateSource.res.mjs +50 -0
- package/src/sources/Source.res +7 -5
- package/src/sources/SourceManager.res +358 -221
- package/src/sources/SourceManager.res.mjs +346 -171
- package/src/sources/SourceManager.resi +17 -6
- package/src/sources/Svm.res +81 -0
- package/src/sources/Svm.res.mjs +90 -0
- package/src/tui/Tui.res +247 -0
- package/src/tui/Tui.res.mjs +337 -0
- package/src/tui/bindings/Ink.res +371 -0
- package/src/tui/bindings/Ink.res.mjs +72 -0
- package/src/tui/bindings/Style.res +123 -0
- package/src/tui/bindings/Style.res.mjs +2 -0
- package/src/tui/components/BufferedProgressBar.res +40 -0
- package/src/tui/components/BufferedProgressBar.res.mjs +57 -0
- package/src/tui/components/CustomHooks.res +122 -0
- package/src/tui/components/CustomHooks.res.mjs +179 -0
- package/src/tui/components/Messages.res +41 -0
- package/src/tui/components/Messages.res.mjs +75 -0
- package/src/tui/components/SyncETA.res +174 -0
- package/src/tui/components/SyncETA.res.mjs +263 -0
- package/src/tui/components/TuiData.res +47 -0
- package/src/tui/components/TuiData.res.mjs +34 -0
- package/svm.schema.json +112 -0
- package/bin.js +0 -48
- package/src/EventRegister.res +0 -241
- package/src/EventRegister.res.mjs +0 -240
- package/src/EventRegister.resi +0 -30
- package/src/bindings/Ethers.gen.ts +0 -14
- package/src/bindings/Ethers.res +0 -204
- package/src/bindings/Ethers.res.mjs +0 -130
- /package/src/{Indexer.res.mjs → Ctx.res.mjs} +0 -0
package/src/Hasura.res.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
3
|
import * as Rest from "./vendored/Rest.res.mjs";
|
|
4
|
+
import * as Time from "./Time.res.mjs";
|
|
4
5
|
import * as Table from "./db/Table.res.mjs";
|
|
5
6
|
import * as Utils from "./Utils.res.mjs";
|
|
6
7
|
import * as Schema from "./db/Schema.res.mjs";
|
|
@@ -60,21 +61,6 @@ function trackTablesRoute() {
|
|
|
60
61
|
};
|
|
61
62
|
}
|
|
62
63
|
|
|
63
|
-
function createSelectPermissionRoute() {
|
|
64
|
-
return {
|
|
65
|
-
method: "POST",
|
|
66
|
-
path: "",
|
|
67
|
-
input: (function (s) {
|
|
68
|
-
s.field("type", S$RescriptSchema.literal("pg_create_select_permission"));
|
|
69
|
-
return {
|
|
70
|
-
args: s.field("args", S$RescriptSchema.json(false)),
|
|
71
|
-
auth: auth(s)
|
|
72
|
-
};
|
|
73
|
-
}),
|
|
74
|
-
responses: responses
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
|
|
78
64
|
function rawBodyRoute() {
|
|
79
65
|
return {
|
|
80
66
|
method: "POST",
|
|
@@ -89,41 +75,31 @@ function rawBodyRoute() {
|
|
|
89
75
|
};
|
|
90
76
|
}
|
|
91
77
|
|
|
92
|
-
function
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
78
|
+
async function sendOperation(endpoint, auth, operation) {
|
|
79
|
+
var retry = async function (attempt) {
|
|
80
|
+
try {
|
|
81
|
+
await Rest.$$fetch(rawBodyRoute, {
|
|
82
|
+
bodyString: JSON.stringify(operation),
|
|
83
|
+
auth: auth
|
|
84
|
+
}, Rest.client(endpoint, undefined));
|
|
85
|
+
return ;
|
|
86
|
+
}
|
|
87
|
+
catch (raw_exn){
|
|
88
|
+
var exn = Caml_js_exceptions.internalToOCamlException(raw_exn);
|
|
89
|
+
if (attempt >= 3) {
|
|
90
|
+
return Logging.warn({
|
|
91
|
+
msg: "Hasura configuration request failed. Indexing will still work - but you may have issues querying data via GraphQL.",
|
|
92
|
+
err: Utils.prettifyExn(exn)
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
var backoffMs = Math.imul(Math.pow(2.0, attempt) | 0, 1000);
|
|
96
|
+
await Time.resolvePromiseAfterDelay(backoffMs);
|
|
97
|
+
return await retry(attempt + 1 | 0);
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
return await retry(0);
|
|
108
101
|
}
|
|
109
102
|
|
|
110
|
-
var bulkKeepGoingErrorsSchema = S$RescriptSchema.transform(S$RescriptSchema.array(S$RescriptSchema.union([
|
|
111
|
-
S$RescriptSchema.object(function (s) {
|
|
112
|
-
s.tag("message", "success");
|
|
113
|
-
}),
|
|
114
|
-
S$RescriptSchema.object(function (s) {
|
|
115
|
-
return s.f("error", S$RescriptSchema.string);
|
|
116
|
-
})
|
|
117
|
-
])), (function (param) {
|
|
118
|
-
return {
|
|
119
|
-
p: (function (a) {
|
|
120
|
-
return Belt_Array.keepMapU(a, (function (a) {
|
|
121
|
-
return a;
|
|
122
|
-
}));
|
|
123
|
-
})
|
|
124
|
-
};
|
|
125
|
-
}));
|
|
126
|
-
|
|
127
103
|
async function clearHasuraMetadata(endpoint, auth) {
|
|
128
104
|
try {
|
|
129
105
|
var result = await Rest.$$fetch(clearMetadataRoute, auth, Rest.client(endpoint, undefined));
|
|
@@ -134,7 +110,7 @@ async function clearHasuraMetadata(endpoint, auth) {
|
|
|
134
110
|
catch (raw_exn){
|
|
135
111
|
var exn = Caml_js_exceptions.internalToOCamlException(raw_exn);
|
|
136
112
|
return Logging.error({
|
|
137
|
-
msg: "
|
|
113
|
+
msg: "There was an issue clearing metadata in hasura - indexing may still work - but you may have issues querying the data in hasura.",
|
|
138
114
|
err: Utils.prettifyExn(exn)
|
|
139
115
|
});
|
|
140
116
|
}
|
|
@@ -169,95 +145,55 @@ async function trackTables(endpoint, auth, pgSchema, tableNames) {
|
|
|
169
145
|
catch (raw_exn){
|
|
170
146
|
var exn = Caml_js_exceptions.internalToOCamlException(raw_exn);
|
|
171
147
|
return Logging.error({
|
|
172
|
-
msg: "
|
|
148
|
+
msg: "There was an issue tracking tables in hasura - indexing may still work - but you may have issues querying the data in hasura.",
|
|
173
149
|
tableNames: tableNames,
|
|
174
150
|
err: Utils.prettifyExn(exn)
|
|
175
151
|
});
|
|
176
152
|
}
|
|
177
153
|
}
|
|
178
154
|
|
|
179
|
-
function
|
|
180
|
-
return {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
155
|
+
async function createSelectPermission(endpoint, auth, tableName, pgSchema, responseLimit, aggregateEntities) {
|
|
156
|
+
return await sendOperation(endpoint, auth, {
|
|
157
|
+
type: "pg_create_select_permission",
|
|
158
|
+
args: {
|
|
159
|
+
table: {
|
|
160
|
+
schema: pgSchema,
|
|
161
|
+
name: tableName
|
|
162
|
+
},
|
|
163
|
+
role: "public",
|
|
164
|
+
source: "default",
|
|
165
|
+
permission: {
|
|
166
|
+
columns: "*",
|
|
167
|
+
filter: {},
|
|
168
|
+
limit: responseLimit,
|
|
169
|
+
allow_aggregations: aggregateEntities.includes(tableName)
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
});
|
|
197
173
|
}
|
|
198
174
|
|
|
199
|
-
function
|
|
175
|
+
async function createEntityRelationship(endpoint, auth, pgSchema, tableName, relationshipType, relationalKey, objectName, mappedEntity, isDerivedFrom) {
|
|
200
176
|
var derivedFromTo = isDerivedFrom ? "\"id\": \"" + relationalKey + "\"" : "\"" + relationalKey + "_id\" : \"id\"";
|
|
201
|
-
return {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
schema: pgSchema,
|
|
206
|
-
name: tableName
|
|
207
|
-
},
|
|
208
|
-
name: objectName,
|
|
209
|
-
source: "default",
|
|
210
|
-
using: {
|
|
211
|
-
manual_configuration: {
|
|
212
|
-
remote_table: {
|
|
177
|
+
return await sendOperation(endpoint, auth, {
|
|
178
|
+
type: "pg_create_" + relationshipType + "_relationship",
|
|
179
|
+
args: {
|
|
180
|
+
table: {
|
|
213
181
|
schema: pgSchema,
|
|
214
|
-
name:
|
|
182
|
+
name: tableName
|
|
215
183
|
},
|
|
216
|
-
|
|
184
|
+
name: objectName,
|
|
185
|
+
source: "default",
|
|
186
|
+
using: {
|
|
187
|
+
manual_configuration: {
|
|
188
|
+
remote_table: {
|
|
189
|
+
schema: pgSchema,
|
|
190
|
+
name: mappedEntity
|
|
191
|
+
},
|
|
192
|
+
column_mapping: JSON.parse("{" + derivedFromTo + "}")
|
|
193
|
+
}
|
|
194
|
+
}
|
|
217
195
|
}
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
};
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
async function executeBulkKeepGoing(endpoint, auth, operations) {
|
|
224
|
-
if (operations.length === 0) {
|
|
225
|
-
return Logging.trace("No hasura bulk configuration operations to execute");
|
|
226
|
-
}
|
|
227
|
-
try {
|
|
228
|
-
var result = await Rest.$$fetch(bulkKeepGoingRoute, {
|
|
229
|
-
auth: auth,
|
|
230
|
-
args: operations
|
|
231
|
-
}, Rest.client(endpoint, undefined));
|
|
232
|
-
var errors;
|
|
233
|
-
try {
|
|
234
|
-
errors = S$RescriptSchema.parseJsonOrThrow(result, bulkKeepGoingErrorsSchema);
|
|
235
|
-
}
|
|
236
|
-
catch (raw_error){
|
|
237
|
-
var error = Caml_js_exceptions.internalToOCamlException(raw_error);
|
|
238
|
-
errors = error.RE_EXN_ID === S$RescriptSchema.Raised ? [S$RescriptSchema.$$Error.message(error._1)] : [Utils.prettifyExn(error)];
|
|
239
|
-
}
|
|
240
|
-
if (errors.length !== 0) {
|
|
241
|
-
return Logging.warn({
|
|
242
|
-
msg: "Hasura configuration completed with errors. Indexing will still work - but you may have issues querying data via GraphQL.",
|
|
243
|
-
errors: errors,
|
|
244
|
-
operations: operations.length
|
|
245
|
-
});
|
|
246
|
-
} else {
|
|
247
|
-
return Logging.trace({
|
|
248
|
-
msg: "Hasura configuration completed",
|
|
249
|
-
operations: operations.length
|
|
250
|
-
});
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
catch (raw_exn){
|
|
254
|
-
var exn = Caml_js_exceptions.internalToOCamlException(raw_exn);
|
|
255
|
-
return Logging.error({
|
|
256
|
-
msg: "EE809: There was an issue executing bulk operations in hasura - indexing may still work - but you may have issues querying the data in hasura.",
|
|
257
|
-
operations: operations.length,
|
|
258
|
-
err: Utils.prettifyExn(exn)
|
|
259
|
-
});
|
|
260
|
-
}
|
|
196
|
+
});
|
|
261
197
|
}
|
|
262
198
|
|
|
263
199
|
async function trackDatabase(endpoint, auth, pgSchema, userEntities, aggregateEntities, responseLimit, schema) {
|
|
@@ -276,23 +212,28 @@ async function trackDatabase(endpoint, auth, pgSchema, userEntities, aggregateEn
|
|
|
276
212
|
Logging.info("Tracking tables in Hasura");
|
|
277
213
|
await clearHasuraMetadata(endpoint, auth);
|
|
278
214
|
await trackTables(endpoint, auth, pgSchema, tableNames);
|
|
279
|
-
var
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
userEntities.
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
215
|
+
for(var i = 0 ,i_finish = tableNames.length; i < i_finish; ++i){
|
|
216
|
+
var tableName = tableNames[i];
|
|
217
|
+
await createSelectPermission(endpoint, auth, tableName, pgSchema, responseLimit, aggregateEntities);
|
|
218
|
+
}
|
|
219
|
+
for(var i$1 = 0 ,i_finish$1 = userEntities.length; i$1 < i_finish$1; ++i$1){
|
|
220
|
+
var entityConfig = userEntities[i$1];
|
|
221
|
+
var match = entityConfig.table;
|
|
222
|
+
var tableName$1 = match.tableName;
|
|
223
|
+
var derivedFromFields = Table.getDerivedFromFields(entityConfig.table);
|
|
224
|
+
for(var j = 0 ,j_finish = derivedFromFields.length; j < j_finish; ++j){
|
|
225
|
+
var derivedFromField = derivedFromFields[j];
|
|
226
|
+
var relationalFieldName = Utils.unwrapResultExn(Schema.getDerivedFromFieldName(schema, derivedFromField));
|
|
227
|
+
await createEntityRelationship(endpoint, auth, pgSchema, tableName$1, "array", relationalFieldName, derivedFromField.fieldName, derivedFromField.derivedFromEntity, true);
|
|
228
|
+
}
|
|
229
|
+
var linkedEntityFields = Table.getLinkedEntityFields(entityConfig.table);
|
|
230
|
+
for(var j$1 = 0 ,j_finish$1 = linkedEntityFields.length; j$1 < j_finish$1; ++j$1){
|
|
231
|
+
var match$1 = linkedEntityFields[j$1];
|
|
232
|
+
var field = match$1[0];
|
|
233
|
+
await createEntityRelationship(endpoint, auth, pgSchema, tableName$1, "object", field.fieldName, field.fieldName, match$1[1], false);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
return Logging.info("Hasura configuration completed");
|
|
296
237
|
}
|
|
297
238
|
|
|
298
239
|
export {
|
|
@@ -300,15 +241,12 @@ export {
|
|
|
300
241
|
responses ,
|
|
301
242
|
clearMetadataRoute ,
|
|
302
243
|
trackTablesRoute ,
|
|
303
|
-
createSelectPermissionRoute ,
|
|
304
244
|
rawBodyRoute ,
|
|
305
|
-
|
|
306
|
-
bulkKeepGoingErrorsSchema ,
|
|
245
|
+
sendOperation ,
|
|
307
246
|
clearHasuraMetadata ,
|
|
308
247
|
trackTables ,
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
executeBulkKeepGoing ,
|
|
248
|
+
createSelectPermission ,
|
|
249
|
+
createEntityRelationship ,
|
|
312
250
|
trackDatabase ,
|
|
313
251
|
}
|
|
314
|
-
/*
|
|
252
|
+
/* Rest Not a pure module */
|
package/src/InMemoryStore.res
CHANGED
|
@@ -100,7 +100,7 @@ let isRollingBack = (inMemoryStore: t) => inMemoryStore.rollbackTargetCheckpoint
|
|
|
100
100
|
|
|
101
101
|
let setBatchDcs = (inMemoryStore: t, ~batch: Batch.t, ~shouldSaveHistory) => {
|
|
102
102
|
let inMemTable =
|
|
103
|
-
inMemoryStore->getInMemTable(~entityConfig=InternalTable.DynamicContractRegistry.
|
|
103
|
+
inMemoryStore->getInMemTable(~entityConfig=InternalTable.DynamicContractRegistry.entityConfig)
|
|
104
104
|
|
|
105
105
|
let itemIdx = ref(0)
|
|
106
106
|
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
import * as $$Array from "rescript/lib/es6/array.js";
|
|
4
4
|
import * as Utils from "./Utils.res.mjs";
|
|
5
|
+
import * as Config from "./Config.res.mjs";
|
|
5
6
|
import * as Js_dict from "rescript/lib/es6/js_dict.js";
|
|
6
7
|
import * as Belt_Array from "rescript/lib/es6/belt_Array.js";
|
|
7
8
|
import * as EventUtils from "./EventUtils.res.mjs";
|
|
8
9
|
import * as ErrorHandling from "./ErrorHandling.res.mjs";
|
|
9
10
|
import * as InMemoryTable from "./InMemoryTable.res.mjs";
|
|
10
|
-
import * as InternalTable from "./db/InternalTable.res.mjs";
|
|
11
11
|
import * as Caml_exceptions from "rescript/lib/es6/caml_exceptions.js";
|
|
12
12
|
|
|
13
13
|
function hashRawEventsKey(key) {
|
|
@@ -102,7 +102,7 @@ function isRollingBack(inMemoryStore) {
|
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
function setBatchDcs(inMemoryStore, batch, shouldSaveHistory) {
|
|
105
|
-
var inMemTable = getInMemTable(inMemoryStore,
|
|
105
|
+
var inMemTable = getInMemTable(inMemoryStore, Config.DynamicContractRegistry.entityConfig);
|
|
106
106
|
var itemIdx = 0;
|
|
107
107
|
for(var checkpoint = 0 ,checkpoint_finish = batch.checkpointIds.length; checkpoint < checkpoint_finish; ++checkpoint){
|
|
108
108
|
var checkpointId = batch.checkpointIds[checkpoint];
|
|
@@ -114,7 +114,7 @@ function setBatchDcs(inMemoryStore, batch, shouldSaveHistory) {
|
|
|
114
114
|
if (dcs !== undefined) {
|
|
115
115
|
for(var dcIdx = 0 ,dcIdx_finish = dcs.length; dcIdx < dcIdx_finish; ++dcIdx){
|
|
116
116
|
var dc = dcs[dcIdx];
|
|
117
|
-
var entity_id =
|
|
117
|
+
var entity_id = Config.DynamicContractRegistry.makeId(chainId, dc.address);
|
|
118
118
|
var entity_registering_event_block_number = item.blockNumber;
|
|
119
119
|
var entity_registering_event_log_index = item.logIndex;
|
|
120
120
|
var entity_registering_event_block_timestamp = item.timestamp;
|
package/src/InMemoryTable.res
CHANGED
|
@@ -51,7 +51,7 @@ module Entity = {
|
|
|
51
51
|
// Helper to extract entity ID from any entity
|
|
52
52
|
exception UnexpectedIdNotDefinedOnEntity
|
|
53
53
|
let getEntityIdUnsafe = (entity: 'entity): string =>
|
|
54
|
-
switch Utils.magic
|
|
54
|
+
switch (entity->(Utils.magic: 'entity => {"id": option<string>}))["id"] {
|
|
55
55
|
| Some(id) => id
|
|
56
56
|
| None =>
|
|
57
57
|
UnexpectedIdNotDefinedOnEntity->ErrorHandling.mkLogAndRaise(
|
|
@@ -54,7 +54,7 @@ var UnexpectedIdNotDefinedOnEntity = /* @__PURE__ */Caml_exceptions.create("InMe
|
|
|
54
54
|
function getEntityIdUnsafe(entity) {
|
|
55
55
|
var id = entity.id;
|
|
56
56
|
if (id !== undefined) {
|
|
57
|
-
return
|
|
57
|
+
return id;
|
|
58
58
|
} else {
|
|
59
59
|
return ErrorHandling.mkLogAndRaise(undefined, "Property 'id' does not exist on expected entity object", {
|
|
60
60
|
RE_EXN_ID: UnexpectedIdNotDefinedOnEntity
|
package/src/Internal.gen.ts
CHANGED
|
@@ -10,6 +10,8 @@ import type {Invalid as $$noEventFilters} from './Types.ts';
|
|
|
10
10
|
import type {t as Address_t} from './Address.gen.js';
|
|
11
11
|
|
|
12
12
|
export type genericEvent<params,block,transaction> = {
|
|
13
|
+
readonly contractName: string;
|
|
14
|
+
readonly eventName: string;
|
|
13
15
|
readonly params: params;
|
|
14
16
|
readonly chainId: number;
|
|
15
17
|
readonly srcAddress: Address_t;
|
|
@@ -45,6 +47,10 @@ export type genericHandlerWithLoader<loader,handler,eventFilters> = {
|
|
|
45
47
|
readonly eventFilters?: eventFilters
|
|
46
48
|
};
|
|
47
49
|
|
|
50
|
+
export abstract class fuelEventConfig { protected opaque!: any }; /* simulate opaque types */
|
|
51
|
+
|
|
52
|
+
export abstract class evmEventConfig { protected opaque!: any }; /* simulate opaque types */
|
|
53
|
+
|
|
48
54
|
export type eventOptions<eventFilters> = { readonly wildcard?: boolean; readonly eventFilters?: eventFilters };
|
|
49
55
|
|
|
50
56
|
export type fuelSupplyParams = { readonly subId: string; readonly amount: bigint };
|