Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

Commit

Permalink
fixing type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
hlolli committed Mar 21, 2022
1 parent 602530b commit c3090ba
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 76 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
13 changes: 4 additions & 9 deletions src/database/sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 }))
Expand Down
5 changes: 3 additions & 2 deletions src/graphql/resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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) {
Expand All @@ -198,7 +199,7 @@ export const resolvers = {
node: R.assoc("block", block, tx),
};
})
);
)) as TransactionEdge[];

return {
pageInfo: {
Expand Down
45 changes: 23 additions & 22 deletions src/graphql/types.graphql.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { GraphQLResolveInfo } from 'graphql';
export type Maybe<T> = T | null;
export type InputMaybe<T> = Maybe<T>;
export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
export type RequireFields<T, K extends keyof T> = { [X in Exclude<keyof T, K>]?: T[X] } & { [P in K]-?: NonNullable<T[P]> };
export type RequireFields<T, K extends keyof T> = Omit<T, K> & { [P in K]-?: NonNullable<T[P]> };
/** All built-in and custom scalars, mapped to their actual values */
export type Scalars = {
ID: string;
Expand Down Expand Up @@ -60,9 +61,9 @@ export type BlockEdge = {
/** Find blocks within a given range */
export type BlockFilter = {
/** Maximum block height to filter to */
max?: Maybe<Scalars['Int']>;
max?: InputMaybe<Scalars['Int']>;
/** Minimum block height to filter from */
min?: Maybe<Scalars['Int']>;
min?: InputMaybe<Scalars['Int']>;
};

/**
Expand Down Expand Up @@ -120,16 +121,16 @@ export type Query = {


export type QueryBlockArgs = {
id?: Maybe<Scalars['String']>;
id?: InputMaybe<Scalars['String']>;
};


export type QueryBlocksArgs = {
after?: Maybe<Scalars['String']>;
first?: Maybe<Scalars['Int']>;
height?: Maybe<BlockFilter>;
ids?: Maybe<Array<Scalars['ID']>>;
sort?: Maybe<SortOrder>;
after?: InputMaybe<Scalars['String']>;
first?: InputMaybe<Scalars['Int']>;
height?: InputMaybe<BlockFilter>;
ids?: InputMaybe<Array<Scalars['ID']>>;
sort?: InputMaybe<SortOrder>;
};


Expand All @@ -139,16 +140,16 @@ export type QueryTransactionArgs = {


export type QueryTransactionsArgs = {
after?: Maybe<Scalars['String']>;
block?: Maybe<BlockFilter>;
bundledIn?: Maybe<Array<Scalars['ID']>>;
dataRoots?: Maybe<Array<Scalars['String']>>;
first?: Maybe<Scalars['Int']>;
ids?: Maybe<Array<Scalars['ID']>>;
owners?: Maybe<Array<Scalars['String']>>;
recipients?: Maybe<Array<Scalars['String']>>;
sort?: Maybe<SortOrder>;
tags?: Maybe<Array<TagFilter>>;
after?: InputMaybe<Scalars['String']>;
block?: InputMaybe<BlockFilter>;
bundledIn?: InputMaybe<Array<Scalars['ID']>>;
dataRoots?: InputMaybe<Array<Scalars['String']>>;
first?: InputMaybe<Scalars['Int']>;
ids?: InputMaybe<Array<Scalars['ID']>>;
owners?: InputMaybe<Array<Scalars['String']>>;
recipients?: InputMaybe<Array<Scalars['String']>>;
sort?: InputMaybe<SortOrder>;
tags?: InputMaybe<Array<TagFilter>>;
};

/** Optionally reverse the result sort order from `HEIGHT_DESC` (default) to `HEIGHT_ASC`. */
Expand All @@ -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<TagOperator>;
op?: InputMaybe<TagOperator>;
/**
* 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.
*
Expand Down Expand Up @@ -268,7 +269,7 @@ export type SubscriptionSubscribeFn<TResult, TParent, TContext, TArgs> = (
args: TArgs,
context: TContext,
info: GraphQLResolveInfo
) => AsyncIterator<TResult> | Promise<AsyncIterator<TResult>>;
) => AsyncIterable<TResult> | Promise<AsyncIterable<TResult>>;

export type SubscriptionResolveFn<TResult, TParent, TContext, TArgs> = (
parent: TParent,
Expand Down Expand Up @@ -417,7 +418,7 @@ export type ParentResolvers<ContextType = any, ParentType extends ResolversParen
};

export type QueryResolvers<ContextType = any, ParentType extends ResolversParentTypes['Query'] = ResolversParentTypes['Query']> = {
block?: Resolver<Maybe<ResolversTypes['Block']>, ParentType, ContextType, RequireFields<QueryBlockArgs, never>>;
block?: Resolver<Maybe<ResolversTypes['Block']>, ParentType, ContextType, Partial<QueryBlockArgs>>;
blocks?: Resolver<ResolversTypes['BlockConnection'], ParentType, ContextType, RequireFields<QueryBlocksArgs, 'first' | 'sort'>>;
transaction?: Resolver<Maybe<ResolversTypes['Transaction']>, ParentType, ContextType, RequireFields<QueryTransactionArgs, 'id'>>;
transactions?: Resolver<ResolversTypes['TransactionConnection'], ParentType, ContextType, RequireFields<QueryTransactionsArgs, 'first' | 'sort'>>;
Expand Down
77 changes: 35 additions & 42 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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==
Expand All @@ -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"
Expand Down Expand Up @@ -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==
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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==
Expand Down Expand Up @@ -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==
Expand Down Expand Up @@ -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==
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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==

[email protected]:
version "3.1.0"
Expand Down Expand Up @@ -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==
Expand Down

0 comments on commit c3090ba

Please sign in to comment.