@apibara/indexer 2.0.0-beta.38 → 2.0.0-beta.39
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.
|
@@ -25,8 +25,10 @@ function internalContext(values) {
|
|
|
25
25
|
}
|
|
26
26
|
function useInternalContext() {
|
|
27
27
|
const ctx = context.useIndexerContext();
|
|
28
|
-
if (
|
|
29
|
-
throw new Error(
|
|
28
|
+
if (ctx[INTERNAL_CONTEXT_PROPERTY] === void 0) {
|
|
29
|
+
throw new Error(
|
|
30
|
+
"Internal context is not available, possibly 'internalContext' plugin is missing!"
|
|
31
|
+
);
|
|
30
32
|
}
|
|
31
33
|
return ctx[INTERNAL_CONTEXT_PROPERTY];
|
|
32
34
|
}
|
|
@@ -23,8 +23,10 @@ function internalContext(values) {
|
|
|
23
23
|
}
|
|
24
24
|
function useInternalContext() {
|
|
25
25
|
const ctx = useIndexerContext();
|
|
26
|
-
if (
|
|
27
|
-
throw new Error(
|
|
26
|
+
if (ctx[INTERNAL_CONTEXT_PROPERTY] === void 0) {
|
|
27
|
+
throw new Error(
|
|
28
|
+
"Internal context is not available, possibly 'internalContext' plugin is missing!"
|
|
29
|
+
);
|
|
28
30
|
}
|
|
29
31
|
return ctx[INTERNAL_CONTEXT_PROPERTY];
|
|
30
32
|
}
|
package/dist/testing/index.cjs
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
const protocol = require('@apibara/protocol');
|
|
4
4
|
const ci = require('ci-info');
|
|
5
5
|
const index = require('../index.cjs');
|
|
6
|
+
const internal_plugins = require('../internal/plugins.cjs');
|
|
6
7
|
const logger = require('../shared/indexer.2416906c.cjs');
|
|
7
8
|
const vcr_index = require('../vcr/index.cjs');
|
|
8
9
|
require('consola');
|
|
@@ -37,7 +38,14 @@ function createVcr() {
|
|
|
37
38
|
orderKey: range.toBlock
|
|
38
39
|
}
|
|
39
40
|
};
|
|
40
|
-
indexerConfig.plugins = [
|
|
41
|
+
indexerConfig.plugins = [
|
|
42
|
+
internal_plugins.internalContext({
|
|
43
|
+
indexerName: cassetteName,
|
|
44
|
+
availableIndexers: [cassetteName]
|
|
45
|
+
}),
|
|
46
|
+
logger.logger(),
|
|
47
|
+
...indexerConfig.plugins ?? []
|
|
48
|
+
];
|
|
41
49
|
const indexer = index.createIndexer(indexerConfig);
|
|
42
50
|
if (!vcr_index.isCassetteAvailable(vcrConfig, cassetteName)) {
|
|
43
51
|
if (ci__default.isCI) {
|
package/dist/testing/index.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createClient } from '@apibara/protocol';
|
|
2
2
|
import ci from 'ci-info';
|
|
3
3
|
import { createIndexer } from '../index.mjs';
|
|
4
|
+
import { internalContext } from '../internal/plugins.mjs';
|
|
4
5
|
import { l as logger } from '../shared/indexer.ff25c953.mjs';
|
|
5
6
|
import { isCassetteAvailable, record, replay } from '../vcr/index.mjs';
|
|
6
7
|
import 'consola';
|
|
@@ -31,7 +32,14 @@ function createVcr() {
|
|
|
31
32
|
orderKey: range.toBlock
|
|
32
33
|
}
|
|
33
34
|
};
|
|
34
|
-
indexerConfig.plugins = [
|
|
35
|
+
indexerConfig.plugins = [
|
|
36
|
+
internalContext({
|
|
37
|
+
indexerName: cassetteName,
|
|
38
|
+
availableIndexers: [cassetteName]
|
|
39
|
+
}),
|
|
40
|
+
logger(),
|
|
41
|
+
...indexerConfig.plugins ?? []
|
|
42
|
+
];
|
|
35
43
|
const indexer = createIndexer(indexerConfig);
|
|
36
44
|
if (!isCassetteAvailable(vcrConfig, cassetteName)) {
|
|
37
45
|
if (ci.isCI) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apibara/indexer",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.39",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"vitest": "^1.6.0"
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"@apibara/protocol": "2.0.0-beta.
|
|
73
|
+
"@apibara/protocol": "2.0.0-beta.39",
|
|
74
74
|
"@opentelemetry/api": "^1.9.0",
|
|
75
75
|
"ci-info": "^4.1.0",
|
|
76
76
|
"consola": "^3.2.3",
|
package/src/plugins/context.ts
CHANGED
|
@@ -30,8 +30,11 @@ export type InternalContext = {
|
|
|
30
30
|
|
|
31
31
|
export function useInternalContext(): InternalContext {
|
|
32
32
|
const ctx = useIndexerContext();
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
|
|
34
|
+
if (ctx[INTERNAL_CONTEXT_PROPERTY] === undefined) {
|
|
35
|
+
throw new Error(
|
|
36
|
+
"Internal context is not available, possibly 'internalContext' plugin is missing!",
|
|
37
|
+
);
|
|
35
38
|
}
|
|
36
39
|
return ctx[INTERNAL_CONTEXT_PROPERTY];
|
|
37
40
|
}
|
package/src/testing/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createClient } from "@apibara/protocol";
|
|
2
2
|
import ci from "ci-info";
|
|
3
3
|
import { type IndexerWithStreamConfig, createIndexer } from "../indexer";
|
|
4
|
+
import { type InternalContext, internalContext } from "../plugins/context";
|
|
4
5
|
import { logger } from "../plugins/logger";
|
|
5
6
|
import type { CassetteOptions, VcrConfig } from "../vcr/config";
|
|
6
7
|
import { isCassetteAvailable } from "../vcr/helper";
|
|
@@ -28,7 +29,14 @@ export function createVcr() {
|
|
|
28
29
|
},
|
|
29
30
|
};
|
|
30
31
|
|
|
31
|
-
indexerConfig.plugins = [
|
|
32
|
+
indexerConfig.plugins = [
|
|
33
|
+
internalContext({
|
|
34
|
+
indexerName: cassetteName,
|
|
35
|
+
availableIndexers: [cassetteName],
|
|
36
|
+
} as InternalContext),
|
|
37
|
+
logger(),
|
|
38
|
+
...(indexerConfig.plugins ?? []),
|
|
39
|
+
];
|
|
32
40
|
|
|
33
41
|
const indexer = createIndexer(indexerConfig);
|
|
34
42
|
|