From c3090ba0cc7c87c007e5c048e0198d3b41a39d7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hl=C3=B6=C3=B0ver=20Sigur=C3=B0sson?= Date: Mon, 21 Mar 2022 15:25:38 +0200 Subject: [PATCH] fixing type errors --- package.json | 2 +- src/database/sync.ts | 13 ++---- src/graphql/resolver.ts | 5 ++- src/graphql/types.graphql.ts | 45 ++++++++++----------- yarn.lock | 77 ++++++++++++++++-------------------- 5 files changed, 66 insertions(+), 76 deletions(-) diff --git a/package.json b/package.json index 7d59ff5..28617d1 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,7 @@ "fs-jetpack": "^4.3.1", "gauge": "^4.0.3", "git-rev-sync": "^3.0.2", - "got": "^12.0.2", + "got": "11.x", "graceful-fs": "^4.2.9", "graphql": "16", "graphql-bigint": "^1.0.0", diff --git a/src/database/sync.ts b/src/database/sync.ts index d478a04..5ab4768 100644 --- a/src/database/sync.ts +++ b/src/database/sync.ts @@ -5,7 +5,6 @@ import pWhilst from "p-whilst"; import pLimit from "p-limit"; import exitHook from "exit-hook"; import Gauge from "gauge"; -import GaugeThemes from "gauge/themes"; import { types as CassandraTypes } from "cassandra-driver"; import { env, KEYSPACE, isGatewayNodeModeEnabled } from "../constants"; import { log } from "../utility/log"; @@ -40,13 +39,6 @@ const currentImports = new Set(); // export const getTxsInFlight = (): number => // Object.values(txInFlight).reduce((a, b) => numberOr0(a) + numberOr0(b)); -const trackerTheme = GaugeThemes.newTheme( - GaugeThemes({ - hasUnicode: false, - hasColor: true, - }) -); - export let topHash = ""; export let gatewayHeight: CassandraTypes.Long = toLong(0); export let topHeight = 0; @@ -305,8 +297,11 @@ export async function startSync({ { type: "section", kerning: 1, default: "" }, { type: "subsection", kerning: 1, default: "" }, ], + theme: { + hasUnicode: false, + hasColor: true, + }, }); - gauge.setTheme(trackerTheme); let unsyncedBlocks: UnsyncedBlock[] = firstRun ? hashList.map((hash, height) => ({ hash, height })) diff --git a/src/graphql/resolver.ts b/src/graphql/resolver.ts index 1a67aa6..396cab6 100644 --- a/src/graphql/resolver.ts +++ b/src/graphql/resolver.ts @@ -24,6 +24,7 @@ import { QueryTransactionArgs as QueryTransactionArguments, QueryTransactionsArgs as QueryTransactionsArguments, Transaction, + TransactionEdge, } from "./types.graphql"; import { Tag } from "../types/arweave"; import { KEYSPACE } from "../constants"; @@ -184,7 +185,7 @@ export const resolvers = { ); const txsClean = R.reject(R.isNil)(txs); - const edges = await Promise.all( + const edges = (await Promise.all( txsClean.map(async ({ tx, cursor }) => { let block = {}; if (wantsBlock && tx.block_hash) { @@ -198,7 +199,7 @@ export const resolvers = { node: R.assoc("block", block, tx), }; }) - ); + )) as TransactionEdge[]; return { pageInfo: { diff --git a/src/graphql/types.graphql.ts b/src/graphql/types.graphql.ts index 715a759..cbbaf1f 100644 --- a/src/graphql/types.graphql.ts +++ b/src/graphql/types.graphql.ts @@ -1,9 +1,10 @@ import { GraphQLResolveInfo } from 'graphql'; export type Maybe = T | null; +export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; -export type RequireFields = { [X in Exclude]?: T[X] } & { [P in K]-?: NonNullable }; +export type RequireFields = Omit & { [P in K]-?: NonNullable }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -60,9 +61,9 @@ export type BlockEdge = { /** Find blocks within a given range */ export type BlockFilter = { /** Maximum block height to filter to */ - max?: Maybe; + max?: InputMaybe; /** Minimum block height to filter from */ - min?: Maybe; + min?: InputMaybe; }; /** @@ -120,16 +121,16 @@ export type Query = { export type QueryBlockArgs = { - id?: Maybe; + id?: InputMaybe; }; export type QueryBlocksArgs = { - after?: Maybe; - first?: Maybe; - height?: Maybe; - ids?: Maybe>; - sort?: Maybe; + after?: InputMaybe; + first?: InputMaybe; + height?: InputMaybe; + ids?: InputMaybe>; + sort?: InputMaybe; }; @@ -139,16 +140,16 @@ export type QueryTransactionArgs = { export type QueryTransactionsArgs = { - after?: Maybe; - block?: Maybe; - bundledIn?: Maybe>; - dataRoots?: Maybe>; - first?: Maybe; - ids?: Maybe>; - owners?: Maybe>; - recipients?: Maybe>; - sort?: Maybe; - tags?: Maybe>; + after?: InputMaybe; + block?: InputMaybe; + bundledIn?: InputMaybe>; + dataRoots?: InputMaybe>; + first?: InputMaybe; + ids?: InputMaybe>; + owners?: InputMaybe>; + recipients?: InputMaybe>; + sort?: InputMaybe; + tags?: InputMaybe>; }; /** Optionally reverse the result sort order from `HEIGHT_DESC` (default) to `HEIGHT_ASC`. */ @@ -172,7 +173,7 @@ export type TagFilter = { /** The tag name */ name: Scalars['String']; /** @deprecated (now ignored) The operator to apply to to the tag filter. Defaults to EQ (equal). */ - op?: Maybe; + op?: InputMaybe; /** * An array of values to match against. If multiple values are passed then transactions with _any_ matching tag value from the set will be returned. * @@ -268,7 +269,7 @@ export type SubscriptionSubscribeFn = ( args: TArgs, context: TContext, info: GraphQLResolveInfo -) => AsyncIterator | Promise>; +) => AsyncIterable | Promise>; export type SubscriptionResolveFn = ( parent: TParent, @@ -417,7 +418,7 @@ export type ParentResolvers = { - block?: Resolver, ParentType, ContextType, RequireFields>; + block?: Resolver, ParentType, ContextType, Partial>; blocks?: Resolver>; transaction?: Resolver, ParentType, ContextType, RequireFields>; transactions?: Resolver>; diff --git a/yarn.lock b/yarn.lock index 4851ca8..32777ba 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1697,7 +1697,7 @@ resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-0.14.0.tgz#9fb3a3cf3132328151f353de4632e01e52102bea" integrity sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ== -"@sindresorhus/is@^4.6.0": +"@sindresorhus/is@^4.0.0": version "4.6.0" resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-4.6.0.tgz#3c7c9c46e678feefe7a2e5bb609d3dbd665ffb3f" integrity sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw== @@ -1723,12 +1723,12 @@ dependencies: defer-to-connect "^1.0.1" -"@szmarczak/http-timer@^5.0.1": - version "5.0.1" - resolved "https://registry.yarnpkg.com/@szmarczak/http-timer/-/http-timer-5.0.1.tgz#c7c1bf1141cdd4751b0399c8fc7b8b664cd5be3a" - integrity sha512-+PmQX0PiAYPMeVYe237LJAYvOMYW1j2rH5YROyS3b4CTVJum34HfRvKvAzozHAQG0TnHNdUfY9nCeUyRAs//cw== +"@szmarczak/http-timer@^4.0.5": + version "4.0.6" + resolved "https://registry.yarnpkg.com/@szmarczak/http-timer/-/http-timer-4.0.6.tgz#b4a914bb62e7c272d4e5989fe4440f812ab1d807" + integrity sha512-4BAffykYOgO+5nzBWYwE3W90sBgLJoUPRWWcL8wlyiM8IB8ipJz3UMJ9KXQd1RKQXpKp8Tutn80HZtWsu2u76w== dependencies: - defer-to-connect "^2.0.1" + defer-to-connect "^2.0.0" "@tootallnate/once@1": version "1.1.2" @@ -1811,7 +1811,7 @@ "@types/connect" "*" "@types/node" "*" -"@types/cacheable-request@^6.0.2": +"@types/cacheable-request@^6.0.1": version "6.0.2" resolved "https://registry.yarnpkg.com/@types/cacheable-request/-/cacheable-request-6.0.2.tgz#c324da0197de0a98a2312156536ae262429ff6b9" integrity sha512-B3xVo+dlKM6nnKTcmm5ZtY/OL8bOAOd2Olee9M1zft65ox50OzjEHW91sDiU9j6cvW8Ejg1/Qkf4xd2kugApUA== @@ -2926,10 +2926,10 @@ cache-base@^1.0.1: union-value "^1.0.0" unset-value "^1.0.0" -cacheable-lookup@^6.0.4: - version "6.0.4" - resolved "https://registry.yarnpkg.com/cacheable-lookup/-/cacheable-lookup-6.0.4.tgz#65c0e51721bb7f9f2cb513aed6da4a1b93ad7dc8" - integrity sha512-mbcDEZCkv2CZF4G01kr8eBd/5agkt9oCqz75tJMSIsquvRZ2sL6Hi5zGVKi/0OSC9oO1GHfJ2AV0ZIOY9vye0A== +cacheable-lookup@^5.0.3: + version "5.0.4" + resolved "https://registry.yarnpkg.com/cacheable-lookup/-/cacheable-lookup-5.0.4.tgz#5a6b865b2c44357be3d5ebc2a467b032719a7005" + integrity sha512-2/kNscPhpcxrOigMZzbiWF7dz8ilhb/nIHU3EyZiXWXpeq/au8qJ8VhdftMkty3n7Gj6HIGalQG8oiBNB3AJgA== cacheable-request@^6.0.0: version "6.1.0" @@ -3604,7 +3604,7 @@ defer-to-connect@^1.0.1: resolved "https://registry.yarnpkg.com/defer-to-connect/-/defer-to-connect-1.1.3.tgz#331ae050c08dcf789f8c83a7b81f0ed94f4ac591" integrity sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ== -defer-to-connect@^2.0.1: +defer-to-connect@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/defer-to-connect/-/defer-to-connect-2.0.1.tgz#8016bdb4143e4632b77a3449c6236277de520587" integrity sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg== @@ -4411,7 +4411,7 @@ forever-monitor@^3.0.3: minimatch "^3.0.4" ps-tree "^1.2.0" -form-data-encoder@1.7.1, form-data-encoder@^1.7.1: +form-data-encoder@^1.7.1: version "1.7.1" resolved "https://registry.yarnpkg.com/form-data-encoder/-/form-data-encoder-1.7.1.tgz#ac80660e4f87ee0d3d3c3638b7da8278ddb8ec96" integrity sha512-EFRDrsMm/kyqbTQocNvRXMLjc7Es2Vk+IQFx/YW7hkUH1eBl4J1fqiP34l74Yt0pFLCNpc06fkbVk00008mzjg== @@ -4552,7 +4552,7 @@ get-stream@^5.1.0: dependencies: pump "^3.0.0" -get-stream@^6.0.0, get-stream@^6.0.1: +get-stream@^6.0.0: version "6.0.1" resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7" integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg== @@ -4642,23 +4642,21 @@ globby@^11.0.3, globby@^11.0.4: merge2 "^1.3.0" slash "^3.0.0" -got@^12.0.2: - version "12.0.2" - resolved "https://registry.yarnpkg.com/got/-/got-12.0.2.tgz#8ce4c3baa50bb18a0858d2539caa0fac19e109bf" - integrity sha512-Zi4yHiqCgaorUbknr/RHFBsC3XqjSodaw0F3qxlqAqyj+OGYZl37/uy01R0qz++KANKQYdY5FHJ0okXZpEzwWQ== +got@11.x: + version "11.8.3" + resolved "https://registry.yarnpkg.com/got/-/got-11.8.3.tgz#f496c8fdda5d729a90b4905d2b07dbd148170770" + integrity sha512-7gtQ5KiPh1RtGS9/Jbv1ofDpBFuq42gyfEib+ejaRBJuj/3tQFeR5+gw57e4ipaU8c/rCjvX6fkQz2lyDlGAOg== dependencies: - "@sindresorhus/is" "^4.6.0" - "@szmarczak/http-timer" "^5.0.1" - "@types/cacheable-request" "^6.0.2" + "@sindresorhus/is" "^4.0.0" + "@szmarczak/http-timer" "^4.0.5" + "@types/cacheable-request" "^6.0.1" "@types/responselike" "^1.0.0" - cacheable-lookup "^6.0.4" + cacheable-lookup "^5.0.3" cacheable-request "^7.0.2" decompress-response "^6.0.0" - form-data-encoder "1.7.1" - get-stream "^6.0.1" - http2-wrapper "^2.1.10" - lowercase-keys "^3.0.0" - p-cancelable "^3.0.0" + http2-wrapper "^1.0.0-beta.5.2" + lowercase-keys "^2.0.0" + p-cancelable "^2.0.0" responselike "^2.0.0" got@^9.6.0: @@ -4924,13 +4922,13 @@ http-proxy-agent@^4.0.1: agent-base "6" debug "4" -http2-wrapper@^2.1.10: - version "2.1.10" - resolved "https://registry.yarnpkg.com/http2-wrapper/-/http2-wrapper-2.1.10.tgz#307cd0cee2564723692ad34c2d570d12f10e83be" - integrity sha512-QHgsdYkieKp+6JbXP25P+tepqiHYd+FVnDwXpxi/BlUcoIB0nsmTOymTNvETuTO+pDuwcSklPE72VR3DqV+Haw== +http2-wrapper@^1.0.0-beta.5.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/http2-wrapper/-/http2-wrapper-1.0.3.tgz#b8f55e0c1f25d4ebd08b3b0c2c079f9590800b3d" + integrity sha512-V+23sDMr12Wnz7iTcDeJr3O6AIxlnvT/bmaAAAP/Xda35C90p9599p0F1eHR/N1KILWSoWVAiOMFjBBXaXSMxg== dependencies: quick-lru "^5.1.1" - resolve-alpn "^1.2.0" + resolve-alpn "^1.0.0" https-proxy-agent@^5.0.0: version "5.0.0" @@ -6382,11 +6380,6 @@ lowercase-keys@^2.0.0: resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-2.0.0.tgz#2603e78b7b4b0006cbca2fbcc8a3202558ac9479" integrity sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA== -lowercase-keys@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-3.0.0.tgz#c5e7d442e37ead247ae9db117a9d0a467c89d4f2" - integrity sha512-ozCC6gdQ+glXOQsveKD0YsDy8DSQFjDTz4zyzEHNV5+JP5D62LmfDZ6o1cycFx9ouG940M5dE8C8CTewdj2YWQ== - lru-cache@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" @@ -6901,10 +6894,10 @@ p-cancelable@^1.0.0: resolved "https://registry.yarnpkg.com/p-cancelable/-/p-cancelable-1.1.0.tgz#d078d15a3af409220c886f1d9a0ca2e441ab26cc" integrity sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw== -p-cancelable@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/p-cancelable/-/p-cancelable-3.0.0.tgz#63826694b54d61ca1c20ebcb6d3ecf5e14cd8050" - integrity sha512-mlVgR3PGuzlo0MmTdk4cXqXWlwQDLnONTAg6sm62XkMJEiRxN3GL3SffkYvqwonbkJBcrI7Uvv5Zh9yjvn2iUw== +p-cancelable@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/p-cancelable/-/p-cancelable-2.1.1.tgz#aab7fbd416582fa32a3db49859c122487c5ed2cf" + integrity sha512-BZOr3nRQHOntUjTrH8+Lh54smKHoHyur8We1V8DSMVrl5A2malOOwuJRnKRDjSnkoeBh4at6BwEnb5I7Jl31wg== p-limit@3.1.0: version "3.1.0" @@ -7494,7 +7487,7 @@ require-main-filename@^2.0.0: resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b" integrity sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg== -resolve-alpn@^1.2.0: +resolve-alpn@^1.0.0: version "1.2.1" resolved "https://registry.yarnpkg.com/resolve-alpn/-/resolve-alpn-1.2.1.tgz#b7adbdac3546aaaec20b45e7d8265927072726f9" integrity sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g==