Skip to content

Commit

Permalink
Organize import order
Browse files Browse the repository at this point in the history
  • Loading branch information
tkiapril committed Aug 18, 2023
1 parent c098839 commit 868678f
Show file tree
Hide file tree
Showing 13 changed files with 36 additions and 36 deletions.
2 changes: 1 addition & 1 deletion api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import { getAddress, keccak256, toHex } from "viem";

import type { PrismaClient } from "./prisma/shim.ts";

import { validateEventRequest } from "./constants/apiSchema.ts";
import { serializeEventResponse } from "./messages/EventResponse.ts";
import { formatAbiItemPrototype } from "./utils/abiUtils.ts";
import { validateEventRequest } from "./constants/apiSchema.ts";
import {
ApiBehindReverseProxyEnvKey,
ApiUrlEnvKey,
Expand Down
2 changes: 1 addition & 1 deletion constants/apiSchema.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Ajv, { type JSONSchemaType } from "https://esm.sh/[email protected]";
import ajvFormats from "https://esm.sh/[email protected]";
import Ajv, { type JSONSchemaType } from "https://esm.sh/[email protected]";

const ajv = new Ajv({ allowUnionTypes: true });
ajvFormats(ajv);
Expand Down
6 changes: 3 additions & 3 deletions dev.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
#!/usr/bin/env -S deno run --allow-read --allow-env --allow-run --allow-sys

import { parse } from "std/flags/mod.ts";
import * as path from "std/path/mod.ts";
import { ConsoleHandler } from "std/log/handlers.ts";
import { getLogger, setup as setupLog } from "std/log/mod.ts";
import * as path from "std/path/mod.ts";

import { parseOptions } from "amqp/src/amqp_connect_options.ts";

import { broker } from "https://deno.land/x/[email protected]/mod.ts";

import { api } from "./api.ts";
import { testWebhookReceiver } from "./devTools/testWebhookReceiver.ts";
import { emitter } from "./emitter.ts";
import { observer } from "./observer.ts";
import { AmqpBrokerUrlEnvKey, combinedEnv } from "./utils/envUtils.ts";
import {
ApiLoggerName,
Expand All @@ -22,14 +24,12 @@ import {
TestWebhookReceiverLoggerName,
WebLoggerName,
} from "./utils/logUtils.ts";
import { observer } from "./observer.ts";
import {
block,
runWithAmqp,
runWithChainDefinition,
runWithPrisma,
} from "./utils/runUtils.ts";
import { testWebhookReceiver } from "./devTools/testWebhookReceiver.ts";

async function prepareAndMain() {
const status = await new Deno.Command("deno", {
Expand Down
22 changes: 11 additions & 11 deletions emitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,30 @@ import { type Chain, getAddress, toHex } from "viem";

import type { PrismaClient } from "./prisma/shim.ts";

import { deserializeControlMessage } from "./messages/ControlMessage.ts";
import {
deserializeEventMessage,
EventMessage,
} from "./messages/EventMessage.ts";
import {
ControlEmitterRoutingKey,
ControlExchangeName,
EvmEventsQueueName,
} from "./constants/constants.ts";
import { deserializeControlMessage } from "./messages/ControlMessage.ts";
import {
runWithAmqp,
runWithChainDefinition,
runWithPrisma,
} from "./utils/runUtils.ts";
import { uint8ArrayEquals } from "./utils/uint8ArrayUtils.ts";
deserializeEventMessage,
EventMessage,
} from "./messages/EventMessage.ts";
import { serializeEventResponse } from "./messages/EventResponse.ts";
import { createMutex } from "./utils/concurrencyUtils.ts";
import {
defaultLogFormatter,
EmitterLoggerName,
getInternalLoggers,
getLoggingLevel,
} from "./utils/logUtils.ts";
import { createMutex } from "./utils/concurrencyUtils.ts";
import {
runWithAmqp,
runWithChainDefinition,
runWithPrisma,
} from "./utils/runUtils.ts";
import { uint8ArrayEquals } from "./utils/uint8ArrayUtils.ts";

export async function emitter(
chain: Chain,
Expand Down
10 changes: 5 additions & 5 deletions messages/control.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ import { getLogger } from "std/log/mod.ts";

import type { AmqpChannel } from "amqp/mod.ts";

import {
type EmitterControlMessages,
type ObserverControlMessages,
serializeControlMessage,
} from "./ControlMessage.ts";
import {
ControlEmitterRoutingKey,
ControlExchangeName,
ControlObserverRoutingKey,
} from "../constants/constants.ts";
import { ControlLoggerName } from "../utils/logUtils.ts";
import {
type EmitterControlMessages,
type ObserverControlMessages,
serializeControlMessage,
} from "./ControlMessage.ts";

export function reload(
amqpChannel: AmqpChannel,
Expand Down
4 changes: 2 additions & 2 deletions observer.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { ConsoleHandler } from "std/log/handlers.ts";
import { getLogger, setup as setupLog } from "std/log/mod.ts";

import type { AmqpConnection } from "amqp/mod.ts";
import type { AbiEvent } from "abitype";
import type { AmqpConnection } from "amqp/mod.ts";

import { Buffer } from "node:buffer";
import {
Expand All @@ -17,14 +17,14 @@ import {

import { Prisma, type PrismaClient } from "./prisma/shim.ts";

import { createMutex } from "./utils/concurrencyUtils.ts";
import {
ControlExchangeName,
ControlObserverRoutingKey,
EvmEventsQueueName,
} from "./constants/constants.ts";
import { deserializeControlMessage } from "./messages/ControlMessage.ts";
import { serializeEventMessage } from "./messages/EventMessage.ts";
import { createMutex } from "./utils/concurrencyUtils.ts";
import { BlockFinalityEnvKey, combinedEnv } from "./utils/envUtils.ts";
import {
defaultLogFormatter,
Expand Down
6 changes: 3 additions & 3 deletions utils/abiUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ import {
DecodeLogDataMismatch,
DecodeLogTopicsMismatch,
} from "viem/dist/esm/errors/abi.js";
import { decodeAbiParameters } from "viem/dist/esm/utils/abi/decodeAbiParameters.js";
import { formatAbiItem } from "viem/dist/esm/utils/abi/formatAbiItem.js";
import { getEventSelector } from "viem/dist/esm/utils/hash/getEventSelector.js";
import type {
EventDefinition,
GetEventArgsFromTopics,
InferEventName,
} from "viem/dist/types/types/contract.d.ts";
import type { Hex } from "viem/dist/types/types/misc.d.ts";
import type { Prettify } from "viem/dist/types/types/utils.d.ts";
import { getEventSelector } from "viem/dist/esm/utils/hash/getEventSelector.js";
import { decodeAbiParameters } from "viem/dist/esm/utils/abi/decodeAbiParameters.js";
import type { DecodeAbiParametersReturnType } from "viem/dist/types/utils/abi/decodeAbiParameters.d.ts";
import { formatAbiItem } from "viem/dist/esm/utils/abi/formatAbiItem.js";

/**
* Formats {@link AbiParameter} to human-readable ABI parameter prototype.
Expand Down
2 changes: 1 addition & 1 deletion utils/logUtils.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { format as formatDate } from "std/datetime/mod.ts";
import { type LevelName, LogLevelNames } from "std/log/levels.ts";
import {
Logger,
type LoggerConfig,
LogLevels,
type LogRecord,
} from "std/log/mod.ts";
import { type LevelName, LogLevelNames } from "std/log/levels.ts";

import { combinedEnv, LogLevelEnvKey } from "./envUtils.ts";

Expand Down
4 changes: 2 additions & 2 deletions web/routes/api/abi.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { LogLevels } from "std/log/levels.ts";

import { type Handlers, Status } from "fresh/server.ts";
import type { WithSession } from "fresh-session";
import { type Handlers, Status } from "fresh/server.ts";

import type { Abi, AbiEvent } from "abitype";

Expand All @@ -10,8 +10,8 @@ import { keccak256, toBytes, toHex } from "viem";

import { prisma } from "web/main.ts";
import { checkPermission, logRequest } from "web/util.ts";
import { formatAbiItemPrototype } from "~/utils/abiUtils.ts";
import type { User } from "~/prisma/shim.ts";
import { formatAbiItemPrototype } from "~/utils/abiUtils.ts";

import type { AbiEntry } from "web/islands/ListAbi.tsx";

Expand Down
6 changes: 3 additions & 3 deletions web/routes/api/sources.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { LogLevels } from "std/log/levels.ts";

import { type Handlers, Status } from "fresh/server.ts";
import type { WithSession } from "fresh-session";
import { type Handlers, Status } from "fresh/server.ts";

import { Buffer } from "node:buffer";
import { getAddress, toBytes, toHex } from "viem";

import { amqpChannel, prisma } from "web/main.ts";
import { checkPermission, logRequest } from "web/util.ts";
import { formatAbiItemPrototype } from "~/utils/abiUtils.ts";
import { reload as reloadControl } from "~/messages/control.ts";
import { ControlObserverRoutingKey } from "~/constants/constants.ts";
import { reload as reloadControl } from "~/messages/control.ts";
import type { User } from "~/prisma/shim.ts";
import { formatAbiItemPrototype } from "~/utils/abiUtils.ts";

import type { SourceEntry } from "web/islands/ListSources.tsx";

Expand Down
2 changes: 1 addition & 1 deletion web/routes/api/sources/testWebhook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { toBytes } from "viem";

import { amqpChannel, prisma } from "web/main.ts";
import { logRequest } from "web/util.ts";
import { serializeEventMessage } from "~/messages/EventMessage.ts";
import { EvmEventsQueueName } from "~/constants/constants.ts";
import { serializeEventMessage } from "~/messages/EventMessage.ts";

export const handler: Handlers = {
async POST(req, ctx) {
Expand Down
4 changes: 2 additions & 2 deletions web/routes/api/webhook.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { LogLevels } from "std/log/mod.ts";

import { type Handlers, Status } from "fresh/server.ts";
import type { WithSession } from "fresh-session";
import { type Handlers, Status } from "fresh/server.ts";

import { Buffer } from "node:buffer";
import { getAddress, toBytes, toHex } from "viem";

import { amqpChannel, prisma } from "web/main.ts";
import { checkPermission, logRequest } from "web/util.ts";
import { reload as reloadControl } from "~/messages/control.ts";
import { ControlEmitterRoutingKey } from "~/constants/constants.ts";
import { reload as reloadControl } from "~/messages/control.ts";
import type { User } from "~/prisma/shim.ts";

import type { WebhookEntry } from "web/islands/ListWebhook.tsx";
Expand Down
2 changes: 1 addition & 1 deletion web/util.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getCookies } from "std/http/cookie.ts";
import { join, resolve } from "std/path/mod.ts";
import { LogLevels } from "std/log/mod.ts";
import { join, resolve } from "std/path/mod.ts";

import { type ServeHandlerInfo, Status } from "fresh/server.ts";

Expand Down

0 comments on commit 868678f

Please sign in to comment.