Skip to content

Commit

Permalink
Update biome and sort imports
Browse files Browse the repository at this point in the history
  • Loading branch information
fracek committed Jun 19, 2024
1 parent 8358ff3 commit cbbe949
Show file tree
Hide file tree
Showing 31 changed files with 103 additions and 918 deletions.
2 changes: 1 addition & 1 deletion biome.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
"organizeImports": {
"enabled": false
"enabled": true
},
"linter": {
"enabled": true,
Expand Down
2 changes: 1 addition & 1 deletion examples/evm-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"scripts": {
"start": "jiti ./src/main.ts",
"lint": "biome check .",
"lint:fix": "pnpm lint --apply",
"lint:fix": "pnpm lint --write",
"format": "biome format . --write"
},
"dependencies": {
Expand Down
6 changes: 3 additions & 3 deletions examples/evm-client/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { runMain, defineCommand } from "citty";
import consola from "consola";
import { encodeEventTopics, parseAbi, decodeEventLog } from "viem";
import { EvmStream, Filter } from "@apibara/evm";
import { createClient } from "@apibara/protocol";
import { defineCommand, runMain } from "citty";
import consola from "consola";
import { decodeEventLog, encodeEventTopics, parseAbi } from "viem";

const abi = parseAbi([
"event Transfer(address indexed from, address indexed to, uint256 value)",
Expand Down
3 changes: 1 addition & 2 deletions examples/indexer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"scripts": {
"start": "jiti ./src/main.ts",
"lint": "biome check .",
"lint:fix": "pnpm lint --apply",
"lint:fix": "pnpm lint --write",
"format": "biome format . --write"
},
"dependencies": {
Expand All @@ -22,7 +22,6 @@
"consola": "^3.2.3",
"csv-stringify": "^6.5.0",
"sqlite": "^5.1.1",
"sqlite3": "^5.1.7",
"viem": "^2.12.4"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions examples/indexer/src/indexer.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import consola from "consola";
import assert from "node:assert";
import { EvmStream } from "@apibara/evm";
import { defineIndexer, useIndexerContext } from "@apibara/indexer";
import { encodeEventTopics, parseAbi, decodeEventLog } from "viem";
import { trace } from "@opentelemetry/api";
import consola from "consola";
import { decodeEventLog, encodeEventTopics, parseAbi } from "viem";

const abi = parseAbi([
"event Transfer(address indexed from, address indexed to, uint256 value)",
Expand Down
6 changes: 3 additions & 3 deletions examples/indexer/src/instrumentation.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import consola from "consola";
import * as opentelemetry from "@opentelemetry/sdk-node";
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-proto";
import { Resource } from "@opentelemetry/resources";
import { SEMRESATTRS_SERVICE_NAME } from "@opentelemetry/semantic-conventions";
import * as opentelemetry from "@opentelemetry/sdk-node";
import {
BatchSpanProcessor,
type SpanProcessor,
} from "@opentelemetry/sdk-trace-base";
import { SEMRESATTRS_SERVICE_NAME } from "@opentelemetry/semantic-conventions";
import consola from "consola";

let spanProcessor: SpanProcessor | undefined;

Expand Down
6 changes: 3 additions & 3 deletions examples/indexer/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { runMain, defineCommand } from "citty";
import consola from "consola";
import { createClient } from "@apibara/protocol";
import { createIndexer, run } from "@apibara/indexer";
import { createClient } from "@apibara/protocol";
import { defineCommand, runMain } from "citty";
import consola from "consola";

import { createIndexerConfig } from "./indexer";

Expand Down
2 changes: 1 addition & 1 deletion examples/starknet-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"scripts": {
"start": "jiti ./src/main.ts",
"lint": "biome check .",
"lint:fix": "pnpm lint --apply",
"lint:fix": "pnpm lint --write",
"format": "biome format . --write"
},
"dependencies": {
Expand Down
6 changes: 3 additions & 3 deletions examples/starknet-client/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { runMain, defineCommand } from "citty";
import consola from "consola";
import { StarknetStream, Filter } from "@apibara/starknet";
import { createClient } from "@apibara/protocol";
import { Filter, StarknetStream } from "@apibara/starknet";
import { defineCommand, runMain } from "citty";
import consola from "consola";

const command = defineCommand({
meta: {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"release": "pnpm build && pnpm changeset publish"
},
"devDependencies": {
"@biomejs/biome": "^1.7.3",
"@biomejs/biome": "^1.8.1",
"@changesets/changelog-github": "^0.4.8",
"@changesets/cli": "^2.27.1",
"turbo": "^2.0.1"
Expand Down
2 changes: 1 addition & 1 deletion packages/evm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"build:proto": "buf generate proto",
"test": "vitest",
"lint": "biome check .",
"lint:fix": "pnpm lint --apply",
"lint:fix": "pnpm lint --write",
"format": "biome format . --write"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/evm/src/block.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Schema } from "@effect/schema";
import { Bytes, BytesFromUint8Array } from "@apibara/protocol";
import { Schema } from "@effect/schema";

import * as proto from "./proto";
import { Address, B256, U128, U256 } from "./common";
import * as proto from "./proto";

export const HexData = Schema.transform(
Schema.Struct({
Expand Down
4 changes: 2 additions & 2 deletions packages/evm/src/common.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { describe, it, expect } from "vitest";
import { describe, expect, it } from "vitest";

import { pad } from "viem";
import { Schema } from "@effect/schema";
import { pad } from "viem";

import { Address, B256, U128, U256 } from "./common";

Expand Down
4 changes: 2 additions & 2 deletions packages/evm/src/filter.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { describe, it, expect } from "vitest";
import { encodeEventTopics, pad, parseAbi } from "viem";
import { describe, expect, it } from "vitest";

import { Filter, LogFilter, filterFromProto, filterToProto } from "./filter";
import { Schema } from "@effect/schema";
import { Filter, LogFilter, filterFromProto, filterToProto } from "./filter";

const abi = parseAbi([
"event Transfer(address indexed from, address indexed to, uint256 value)",
Expand Down
2 changes: 1 addition & 1 deletion packages/evm/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { StreamConfig } from "@apibara/protocol";
import { FilterFromBytes } from "./filter";
import { BlockFromBytes } from "./block";
import { FilterFromBytes } from "./filter";

export * as proto from "./proto";

Expand Down
2 changes: 1 addition & 1 deletion packages/indexer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"test": "vitest",
"test:typecheck": "vitest typecheck",
"lint": "biome check .",
"lint:fix": "pnpm lint --apply",
"lint:fix": "pnpm lint --write",
"format": "biome format . --write"
},
"devDependencies": {
Expand Down
18 changes: 9 additions & 9 deletions packages/indexer/src/indexer.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
import consola from "consola";
import {
createHooks,
createDebugger,
type NestedHooks,
type Hookable,
} from "hookable";
import type {
Client,
Cursor,
Expand All @@ -14,11 +7,18 @@ import type {
StreamDataRequest,
StreamDataResponse,
} from "@apibara/protocol";
import consola from "consola";
import {
type Hookable,
type NestedHooks,
createDebugger,
createHooks,
} from "hookable";

import { indexerAsyncContext } from "./context";
import { type Sink, defaultSink } from "./sink";
import type { IndexerPlugin } from "./plugins";
import { tracer } from "./otel";
import type { IndexerPlugin } from "./plugins";
import { type Sink, defaultSink } from "./sink";

export interface IndexerHooks<TFilter, TBlock, TRet> {
"run:before": () => void;
Expand Down
4 changes: 2 additions & 2 deletions packages/indexer/src/sinks/csv.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fs from "node:fs";
import type { Cursor } from "@apibara/protocol";
import { type Options, type Stringifier, stringify } from "csv-stringify";
import { Sink, type SinkWriteArgs } from "../sink";
import { type Stringifier, stringify, type Options } from "csv-stringify";
import fs from "node:fs";

export type CsvArgs = {
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/indexer/src/sinks/sqlite.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Cursor } from "@apibara/protocol";
import { open, type Database, type ISqlite } from "sqlite";
import { type Database, type ISqlite, open } from "sqlite";
import { Sink, type SinkWriteArgs } from "../sink";

export type SqliteArgs = ISqlite.Config;
Expand Down
2 changes: 1 addition & 1 deletion packages/indexer/src/vcr/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import type {
StreamDataResponse,
} from "@apibara/protocol";
import type { VcrConfig } from "./config";
import type { CassetteDataType } from "./record";
import { deserialize } from "./helper";
import type { CassetteDataType } from "./record";

export class VcrClient<TFilter, TBlock> implements Client<TFilter, TBlock> {
constructor(
Expand Down
2 changes: 1 addition & 1 deletion packages/indexer/src/vcr/record.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import fs from "node:fs/promises";
import path from "node:path";
import { run, type Indexer } from "@apibara/indexer";
import { type Indexer, run } from "@apibara/indexer";
import type { Client, StreamDataResponse } from "@apibara/protocol";
import { klona } from "klona/full";
import type { CassetteOptions, VcrConfig } from "./config";
Expand Down
2 changes: 1 addition & 1 deletion packages/indexer/src/vcr/replay.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Indexer } from "@apibara/indexer";
import { VcrClient } from "./client";
import type { VcrConfig } from "./config";
import type { Indexer } from "@apibara/indexer";

export async function replay<TFilter, TBlock, TRet>(
vcrConfig: VcrConfig,
Expand Down
2 changes: 1 addition & 1 deletion packages/protocol/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"build:proto": "buf generate proto",
"test": "vitest",
"lint": "biome check .",
"lint:fix": "pnpm lint --apply",
"lint:fix": "pnpm lint --write",
"format": "biome format . --write"
},
"devDependencies": {
Expand Down
6 changes: 3 additions & 3 deletions packages/protocol/src/client.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { Schema } from "@effect/schema";
import {
type DefaultCallOptions,
type NormalizedServiceDefinition,
createClient as grpcCreateClient,
createChannel,
createClient as grpcCreateClient,
} from "nice-grpc";
import { Schema } from "@effect/schema";

import * as proto from "./proto";

import type { StreamConfig } from "./config";
import {
type StatusRequest,
type StatusResponse,
statusRequestToProto,
statusResponseFromProto,
type StatusResponse,
} from "./status";
import { type StreamDataRequest, StreamDataResponse } from "./stream";
import type { Cursor } from "./common";
Expand Down
4 changes: 2 additions & 2 deletions packages/protocol/src/common.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { hexToBytes, toHex } from "viem";
import { Option } from "effect";
import { Schema } from "@effect/schema";
import { Option } from "effect";
import { hexToBytes, toHex } from "viem";

import * as proto from "./proto";

Expand Down
2 changes: 1 addition & 1 deletion packages/starknet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"build:proto": "buf generate proto",
"test": "vitest",
"lint": "biome check .",
"lint:fix": "pnpm lint --apply",
"lint:fix": "pnpm lint --write",
"format": "biome format . --write"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/starknet/src/block.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Schema } from "@effect/schema";

import * as proto from "./proto";
import { FieldElement } from "./common";
import { tag } from "./helpers";
import * as proto from "./proto";

/** Price of a unit of resource.
*
Expand Down
4 changes: 2 additions & 2 deletions packages/starknet/src/common.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { describe, it, expect } from "vitest";
import { describe, expect, it } from "vitest";

import { pad } from "viem";

import { feltToProto, feltFromProto } from "./common";
import { feltFromProto, feltToProto } from "./common";

describe("FieldElement", () => {
it("should convert to and from proto", () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/starknet/src/filter.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, it, expect } from "vitest";
import { Schema } from "@effect/schema";
import { describe, expect, it } from "vitest";

import { EventFilter, HeaderFilter, Key, TransactionFilter } from "./filter";

Expand Down
2 changes: 1 addition & 1 deletion packages/starknet/src/filter.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Schema } from "@effect/schema";

import * as proto from "./proto";
import { FieldElement, FieldElementProto } from "./common";
import { tag } from "./helpers";
import * as proto from "./proto";

/** Header options.
*
Expand Down
Loading

0 comments on commit cbbe949

Please sign in to comment.