envio
Version:
A latency and sync speed optimized, developer friendly blockchain data indexer.
44 lines (40 loc) • 1.28 kB
JavaScript
// Generated by ReScript, PLEASE EDIT WITH CARE
;
var Internal = require("./Internal.res.js");
var Prometheus = require("./Prometheus.res.js");
var S$RescriptSchema = require("rescript-schema/src/S.res.js");
function experimental_createEffect(options, handler) {
Prometheus.EffectCallsCount.set(0, options.name);
var outputSchema = S$RescriptSchema.schema(function (param) {
return options.output;
});
var match = options.cache;
var tmp;
if (match !== undefined && match) {
var itemSchema = S$RescriptSchema.schema(function (s) {
return {
id: s.m(S$RescriptSchema.string),
output: s.m(outputSchema)
};
});
tmp = {
itemSchema: itemSchema,
rowsSchema: S$RescriptSchema.array(itemSchema),
table: Internal.makeCacheTable(options.name)
};
} else {
tmp = undefined;
}
return {
name: options.name,
handler: handler,
cache: tmp,
output: outputSchema,
input: S$RescriptSchema.schema(function (param) {
return options.input;
}),
callsCount: 0
};
}
exports.experimental_createEffect = experimental_createEffect;
/* Internal Not a pure module */