diff --git a/index.ts b/index.ts index 330e5d3..9193ceb 100644 --- a/index.ts +++ b/index.ts @@ -1,7 +1,7 @@ // from: https://github.com/pinax-network/substreams-clock-api/blob/main/index.ts -import { config } from "./src/config"; -import { logger } from "./src/logger"; -import GET from "./src/fetch/GET"; +import { config } from "./src/config.js"; +import { logger } from "./src/logger.js"; +import GET from "./src/fetch/GET.js"; import * as prometheus from "./src/prometheus.js"; if (config.verbose) logger.enable(); diff --git a/src/clickhouse/createClient.ts b/src/clickhouse/createClient.ts index cd732b5..cc53f83 100644 --- a/src/clickhouse/createClient.ts +++ b/src/clickhouse/createClient.ts @@ -1,7 +1,7 @@ // from: https://github.com/pinax-network/substreams-clock-api/blob/main/src/clickhouse/createClient.ts import { createClient } from "@clickhouse/client-web"; -import { ping } from "./ping"; -import { APP_NAME, config } from "../config"; +import { ping } from "./ping.js"; +import { APP_NAME, config } from "../config.js"; const client = createClient({ ...config, diff --git a/src/clickhouse/makeQuery.ts b/src/clickhouse/makeQuery.ts index 5cf7018..87fc221 100644 --- a/src/clickhouse/makeQuery.ts +++ b/src/clickhouse/makeQuery.ts @@ -1,7 +1,7 @@ // from: https://github.com/pinax-network/substreams-clock-api/blob/main/src/clickhouse/makeQuery.ts -import { logger } from "../logger"; -import * as prometheus from "../prometheus"; -import client from "./createClient"; +import { logger } from "../logger.js"; +import * as prometheus from "../prometheus.js"; +import client from "./createClient.js"; export interface Meta { name: string, diff --git a/src/clickhouse/ping.ts b/src/clickhouse/ping.ts index 1d69880..afdb5d9 100644 --- a/src/clickhouse/ping.ts +++ b/src/clickhouse/ping.ts @@ -1,6 +1,6 @@ // from: https://github.com/pinax-network/substreams-clock-api/blob/main/src/clickhouse/ping.ts import { PingResult } from "@clickhouse/client-web"; -import client from "./createClient"; +import client from "./createClient.js"; // Does not work with Bun's implementation of Node streams. export async function ping(): Promise { diff --git a/src/fetch/openapi.ts b/src/fetch/openapi.ts index bf96b22..1539942 100644 --- a/src/fetch/openapi.ts +++ b/src/fetch/openapi.ts @@ -2,10 +2,10 @@ import pkg from "../../package.json" assert { type: "json" }; import { OpenApiBuilder, SchemaObject, ExampleObject, ParameterObject } from "openapi3-ts/oas31"; -import { config } from "../config"; -import { getBalanceChanges, getContracts, getTotalSupply } from "../queries"; -import { registry } from "../prometheus"; -import { makeQuery } from "../clickhouse/makeQuery"; +import { config } from "../config.js"; +import { getBalanceChanges, getContracts, getTotalSupply } from "../queries.js"; +import { registry } from "../prometheus.js"; +import { makeQuery } from "../clickhouse/makeQuery.js"; import { supportedChainsQuery } from "./chains.js"; const TAGS = { diff --git a/src/queries.spec.ts b/src/queries.spec.ts index cb71a3a..eb51556 100644 --- a/src/queries.spec.ts +++ b/src/queries.spec.ts @@ -1,7 +1,7 @@ // from: https://github.com/pinax-network/substreams-clock-api/blob/main/src/queries.spec.ts import { expect, test } from "bun:test"; -import { getContracts, getChain, getTotalSupply, getBalanceChanges } from "./queries"; +import { getContracts, getChain, getTotalSupply, getBalanceChanges } from "./queries.js"; const chain = "eth"; const address = 'dac17f958d2ee523a2206206994597c13d831ec7' diff --git a/src/queries.ts b/src/queries.ts index 8282b37..a053bcc 100644 --- a/src/queries.ts +++ b/src/queries.ts @@ -1,5 +1,5 @@ -import { DEFAULT_SORT_BY } from "./config"; -import { getAddress, parseLimit } from "./utils"; +import { DEFAULT_SORT_BY } from "./config.js"; +import { getAddress, parseLimit } from "./utils.js"; export function getTotalSupply(searchParams: URLSearchParams) { // Params diff --git a/src/types.ts b/src/types.d.ts similarity index 100% rename from src/types.ts rename to src/types.d.ts diff --git a/src/utils.spec.ts b/src/utils.spec.ts index 86726c8..a839002 100644 --- a/src/utils.spec.ts +++ b/src/utils.spec.ts @@ -1,5 +1,5 @@ import { expect, test } from "bun:test"; -import { formatAddress, checkValidAddress, getAddress } from "./utils"; +import { formatAddress, checkValidAddress, getAddress } from "./utils.js"; const address = "0xdac17f958d2ee523a2206206994597c13d831ec7"; diff --git a/src/utils.ts b/src/utils.ts index 44407c9..8f30472 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,5 +1,5 @@ import { ethers } from "ethers"; -import { config } from "./config"; +import { config } from "./config.js"; export function getAddress(searchParams: URLSearchParams, key: string, required: boolean = false) { const address = formatAddress(searchParams.get(key)); diff --git a/tsconfig.json b/tsconfig.json index b2d001e..8f96e58 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,38 +1,18 @@ { "compilerOptions": { - // add Bun type definitions - "types": ["bun-types"], - - // enable latest features - "lib": ["ESNext"], - "module": "esnext", - "target": "esnext", - - // if TS 5.x+ - "moduleResolution": "bundler", - "noEmit": true, - "allowImportingTsExtensions": true, - "moduleDetection": "force", - // if TS 4.x or earlier - // "moduleResolution": "nodenext", - - "jsx": "react-jsx", // support JSX - "allowJs": true, // allow importing `.js` from `.ts` - - // best practices + "target": "ESNext", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "resolveJsonModule": true, + "declaration": true, + "declarationMap": true, + "sourceMap": true, + "outDir": "./dist/", "strict": true, - "forceConsistentCasingInFileNames": true, + "noImplicitAny": true, + "strictNullChecks": true, + "alwaysStrict": true, "skipLibCheck": true, - "composite": true, - "downlevelIteration": true, - "allowSyntheticDefaultImports": true - }, - "include": [ - "src/**/*.ts", - "package.json" - ], - "exclude": [ - "node_modules", - "src/tests/*.spec.ts" - ] + "types": ["bun-types"] + } } \ No newline at end of file