diff --git a/package.json b/package.json index c5e1291..928206d 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "web3.storage": "^4.2.0" }, "devDependencies": { - "@snapshot-labs/eslint-config": "^0.1.0-beta.11", + "@snapshot-labs/eslint-config": "^0.1.0-beta.18", "@snapshot-labs/prettier-config": "^0.1.0-beta.7", "@types/express": "^4.17.17", "@types/jest": "^29.5.3", diff --git a/src/aws.ts b/src/aws.ts index 924d4b0..aefb2ef 100644 --- a/src/aws.ts +++ b/src/aws.ts @@ -1,5 +1,5 @@ -import * as AWS from '@aws-sdk/client-s3'; import { Readable } from 'stream'; +import * as AWS from '@aws-sdk/client-s3'; let client; const region = process.env.AWS_REGION; diff --git a/src/index.ts b/src/index.ts index d6678e8..01de5cb 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,13 +1,13 @@ import 'dotenv/config'; -import express from 'express'; +import { fallbackLogger, initLogger } from '@snapshot-labs/snapshot-sentry'; import compression from 'compression'; -import { initLogger, fallbackLogger } from '@snapshot-labs/snapshot-sentry'; import cors from 'cors'; +import express from 'express'; +import initMetrics from './metrics'; +import proxy from './proxy'; import rpc from './rpc'; import upload from './upload'; -import proxy from './proxy'; import { version } from '../package.json'; -import initMetrics from './metrics'; const app = express(); const PORT = process.env.PORT || 3000; diff --git a/src/metrics.ts b/src/metrics.ts index 72a6cc3..6072174 100644 --- a/src/metrics.ts +++ b/src/metrics.ts @@ -1,8 +1,8 @@ import init, { client } from '@snapshot-labs/snapshot-metrics'; import { capture } from '@snapshot-labs/snapshot-sentry'; -import type { Express } from 'express'; +import { Express } from 'express'; import gateways from './gateways.json'; -import { providersMap, IMAGE_PROVIDERS, JSON_PROVIDERS } from './providers/utils'; +import { IMAGE_PROVIDERS, JSON_PROVIDERS, providersMap } from './providers/utils'; export default function initMetrics(app: Express) { init(app, { diff --git a/src/middlewares/useProxyCache.ts b/src/middlewares/useProxyCache.ts index 66d9301..1a53850 100644 --- a/src/middlewares/useProxyCache.ts +++ b/src/middlewares/useProxyCache.ts @@ -1,7 +1,7 @@ import { capture } from '@snapshot-labs/snapshot-sentry'; -import { MAX } from '../utils'; import { get, set } from '../aws'; import { ipfsGatewaysCacheHitCount, ipfsGatewaysCacheSize } from '../metrics'; +import { MAX } from '../utils'; /** * This middleware serves a cache if it exists, else it will process the controller diff --git a/src/providers/index.ts b/src/providers/index.ts index ac6af76..1c9b196 100644 --- a/src/providers/index.ts +++ b/src/providers/index.ts @@ -1,6 +1,6 @@ import { capture } from '@snapshot-labs/snapshot-sentry'; -import { timeProvidersUpload, providersUploadSize, countOpenProvidersRequest } from '../metrics'; import { providersMap } from './utils'; +import { countOpenProvidersRequest, providersUploadSize, timeProvidersUpload } from '../metrics'; type ProviderType = 'image' | 'json'; export default function uploadToProviders(providers: string[], type: ProviderType, params: any) { diff --git a/src/providers/pinata.ts b/src/providers/pinata.ts index df0ec8a..713ebf4 100644 --- a/src/providers/pinata.ts +++ b/src/providers/pinata.ts @@ -1,6 +1,6 @@ -import pinataSDK from '@pinata/sdk'; import { randomUUID } from 'crypto'; import { Readable } from 'stream'; +import pinataSDK from '@pinata/sdk'; const { PINATA_API_KEY, PINATA_API_SECRET } = process.env; diff --git a/src/providers/utils.ts b/src/providers/utils.ts index cd72d0a..7dfe693 100644 --- a/src/providers/utils.ts +++ b/src/providers/utils.ts @@ -1,8 +1,8 @@ +import * as fourEverland from './4everland'; import * as fleek from './fleek'; import * as infura from './infura'; import * as pinata from './pinata'; import * as web3storage from './web3storage'; -import * as fourEverland from './4everland'; // List of providers used for pinning images export const IMAGE_PROVIDERS = ['fleek', 'infura', 'pinata', '4everland']; diff --git a/src/providers/web3storage.ts b/src/providers/web3storage.ts index af08d39..b584c8a 100644 --- a/src/providers/web3storage.ts +++ b/src/providers/web3storage.ts @@ -1,4 +1,4 @@ -import { Web3Storage, Blob, File } from 'web3.storage'; +import { Blob, File, Web3Storage } from 'web3.storage'; import { sha256 } from '../utils'; const { WEB3STORAGE_API_TOKEN } = process.env; diff --git a/src/proxy.ts b/src/proxy.ts index 134301f..e902bda 100644 --- a/src/proxy.ts +++ b/src/proxy.ts @@ -1,11 +1,11 @@ +import { capture } from '@snapshot-labs/snapshot-sentry'; import express from 'express'; import fetch from 'node-fetch'; -import { capture } from '@snapshot-labs/snapshot-sentry'; import gateways from './gateways.json'; import { + countOpenGatewaysRequest, ipfsGatewaysReturnCount, - timeIpfsGatewaysResponse, - countOpenGatewaysRequest + timeIpfsGatewaysResponse } from './metrics'; import useProxyCache from './middlewares/useProxyCache'; diff --git a/src/rpc.ts b/src/rpc.ts index d08c3c9..9cd1b3f 100644 --- a/src/rpc.ts +++ b/src/rpc.ts @@ -1,9 +1,9 @@ -import express from 'express'; import { capture } from '@snapshot-labs/snapshot-sentry'; -import { MAX, rpcError, rpcSuccess } from './utils'; +import express from 'express'; import { set as setAws } from './aws'; import uploadToProviders from './providers/'; import { JSON_PROVIDERS } from './providers/utils'; +import { MAX, rpcError, rpcSuccess } from './utils'; const router = express.Router(); diff --git a/src/upload.ts b/src/upload.ts index dba4c45..5a5dbe0 100644 --- a/src/upload.ts +++ b/src/upload.ts @@ -1,11 +1,11 @@ import fs from 'fs'; +import { capture } from '@snapshot-labs/snapshot-sentry'; import express from 'express'; import multer from 'multer'; import sharp from 'sharp'; -import { capture } from '@snapshot-labs/snapshot-sentry'; -import { rpcError, rpcSuccess } from './utils'; import uploadToProviders from './providers/'; import { IMAGE_PROVIDERS } from './providers/utils'; +import { rpcError, rpcSuccess } from './utils'; const MAX_INPUT_SIZE = 1024 * 1024; const MAX_IMAGE_DIMENSION = 1500; diff --git a/test/e2e/proxy.test.ts b/test/e2e/proxy.test.ts index 06837bf..a0af361 100644 --- a/test/e2e/proxy.test.ts +++ b/test/e2e/proxy.test.ts @@ -1,5 +1,5 @@ import request from 'supertest'; -import { set, get, remove } from '../../src/aws'; +import { get, remove, set } from '../../src/aws'; const HOST = `http://localhost:${process.env.PORT || 3003}`; diff --git a/test/unit/providers/index.test.ts b/test/unit/providers/index.test.ts index 1e068a5..beaabf1 100644 --- a/test/unit/providers/index.test.ts +++ b/test/unit/providers/index.test.ts @@ -1,9 +1,9 @@ import fs from 'fs'; import path from 'path'; +import * as FourEverland from '../../../src/providers/4everland'; import * as Fleek from '../../../src/providers/fleek'; import * as Infura from '../../../src/providers/infura'; import * as Pinata from '../../../src/providers/pinata'; -import * as FourEverland from '../../../src/providers/4everland'; describe('providers', () => { jest.retryTimes(2); diff --git a/yarn.lock b/yarn.lock index af0f0a3..60fb92a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1863,10 +1863,10 @@ "@smithy/types" "^2.3.4" tslib "^2.5.0" -"@snapshot-labs/eslint-config-base@^0.1.0-beta.11": - version "0.1.0-beta.15" - resolved "https://registry.yarnpkg.com/@snapshot-labs/eslint-config-base/-/eslint-config-base-0.1.0-beta.15.tgz#2f64a21a0590d0ffea8a82852ab4bd5742495daa" - integrity sha512-uqOqCDTsl92e1k3edaGweQCSlDo9mU8I1ejqXCJHHDr/ZZyBldd8R73qOjhEVdYBtbdHd97QRdKh3JhMjzhrtg== +"@snapshot-labs/eslint-config-base@^0.1.0-beta.18": + version "0.1.0-beta.18" + resolved "https://registry.yarnpkg.com/@snapshot-labs/eslint-config-base/-/eslint-config-base-0.1.0-beta.18.tgz#b39a1e6f14e7cdccbc02a70ae52e8a49459a41c3" + integrity sha512-OLB5Lcw+SUkjVhz6lo4oTCFthEkQrczh6t73dW4wmlug+OSAUPa8Uk9mh//b1Dsc4kQuh63CRVwRChJQlsuUHg== dependencies: "@typescript-eslint/eslint-plugin" "^6.7.3" "@typescript-eslint/parser" "^6.7.3" @@ -1874,12 +1874,12 @@ eslint-plugin-import "^2.29.0" eslint-plugin-prettier "^5.0.1" -"@snapshot-labs/eslint-config@^0.1.0-beta.11": - version "0.1.0-beta.11" - resolved "https://registry.yarnpkg.com/@snapshot-labs/eslint-config/-/eslint-config-0.1.0-beta.11.tgz#30ccd6094d1e97e17c53b0427cad28cbfb26fa60" - integrity sha512-DR868Fsga8lcMgdYIfsAT3Uf1X6IpPPCyNPUf6TW9J/7hdR7y/8keG/RCUdXpy8Kl39/M4LHxokGW5aOAJIA2w== +"@snapshot-labs/eslint-config@^0.1.0-beta.18": + version "0.1.0-beta.18" + resolved "https://registry.yarnpkg.com/@snapshot-labs/eslint-config/-/eslint-config-0.1.0-beta.18.tgz#fb5b80f546a73399c3e071dcd29616077f489c4e" + integrity sha512-wE6Kd8aToMQSAf3wkRJxZBVboau9Wys04PC5yAUwABt1E2KOhJQ9d29NFpJtLPN+B0WBni/m6o46SmNMGkKXZg== dependencies: - "@snapshot-labs/eslint-config-base" "^0.1.0-beta.11" + "@snapshot-labs/eslint-config-base" "^0.1.0-beta.18" "@snapshot-labs/prettier-config@^0.1.0-beta.7": version "0.1.0-beta.7"