Skip to content

Commit

Permalink
feat(hydra-cli): upgrade Node version to 14: hydra-cli, hydra-indexer…
Browse files Browse the repository at this point in the history
…, hydra-indexer-gateway (#390)

* docs: Docs for queries, pagination, sorting (#4)

* docs(docs): pagination, queries, sorting

* docs(docs): update announcing-hydra-v3.md

* feat(hydra-cli): upgrade Node version to 14: hydra-cli, hydra-indexer, hydra-indexer-gateway

affects: @dzlzv/hydra-cli, @dzlzv/hydra-indexer-gateway, @dzlzv/hydra-indexer

Co-authored-by: Metin Demir <metmirr@users.noreply.github.com>
  • Loading branch information
dzhelezov and metmirr committed May 10, 2021
1 parent 3a82cbc commit bc57996
Show file tree
Hide file tree
Showing 14 changed files with 41 additions and 50 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
@@ -1,4 +1,4 @@
FROM node:12-alpine
FROM node:14-alpine

# TODO: optimize this
#
Expand Down
1 change: 1 addition & 0 deletions docs/paginate-query-results.md
Expand Up @@ -95,6 +95,7 @@ query Query1 {
`PageInfo` returns the cursor, page information and object has following fields:

```javascript
```json
pageInfo {
startCursor
endCursor
Expand Down
39 changes: 19 additions & 20 deletions docs/queries.md
Expand Up @@ -2,25 +2,25 @@
description: GraphQL queries are used to fetch data from the server.
---

# Query Node Queries
# Queries

## Introduction

Hydra cli tooling auto-generates queries as part of the GraphQL schema from your input schema. It generates a range of possible queries and operators that also work with relationships defined in your input schema.

All entities of the input schema tracked by the cli \(re-generation is required when any change happens to the input schema\) can be queried over the GraphQL endpoint.
All entities of the input schema tracked by the cli (re-generation is required when any change happens to the input schema) can be queried over the GraphQL endpoint.

## Exploring queries

You can explore the entire schema and the available queries using the GraphiQL interface by running your graphql-server or looking at the graphql-server/generated/schema.graphql file.

Let’s take a look at the different queries you can run using the GraphQL server. We’ll use examples based on a typical channel/video schema for reference.

* Simple entity queries
* Relation entity queries
* Filter query results / search queries
* Sort query results
* Paginate query results
- Simple entity queries
- Relation entity queries
- Filter query results / search queries
- Sort query results
- Paginate query results

### Simple entity queries

Expand Down Expand Up @@ -86,15 +86,15 @@ query {

Hydra supports following scalar types:

* String
* Int
* Float
* BigInt
* Boolean
* Bytes
* DateTime
- String
- Int
- Float
- BigInt
- Boolean
- Bytes
- DateTime

**Equality Operators \(`_eq`\)**
**Equality Operators (`_eq`)**

`_eq` is supported by all the scalar types

Expand Down Expand Up @@ -127,9 +127,9 @@ query Query3 {
}
```

**Greater than or less than operators \(`gt`, `lt`, `gte`, `lte`\)**
**Greater than or less than operators (`gt`, `lt`, `gte`, `lte`)**

The `_gt` \(greater than\), `_lt` \(less than\), `_gte` \(greater than or equal to\), `_lte` \(less than or equal to\) operators are available on `Int, BigInt, Float, DataTime` types.
The `_gt` (greater than), `_lt` (less than), `_gte` (greater than or equal to), `_lte` (less than or equal to) operators are available on `Int, BigInt, Float, DataTime` types.

The following are examples of using these operators on different types:

Expand All @@ -152,7 +152,7 @@ query Query2 {
}
```

**List based search operators \(`_in`\)**
**List based search operators (`_in`)**

`_in` operator is available on all scalar types except `DataTime`.

Expand Down Expand Up @@ -199,7 +199,7 @@ query Query2 {
}
```

#### Using multiple filters in the same query \(`AND`, `OR`\)
#### Using multiple filters in the same query (`AND`, `OR`)

You can group multiple parameters in the same where argument using the `AND` or the `OR` operators to filter results based on more than one criteria.

Expand Down Expand Up @@ -239,4 +239,3 @@ query {
}
}
```

7 changes: 3 additions & 4 deletions docs/sort-query-results.md
Expand Up @@ -2,9 +2,9 @@
description: Results from your query can be sorted by using the orderBy argument.
---

# Sorting
## The `orderBy` argument

The sort order \(ascending vs. descending\) is set by specifying the asc or desc enum value for the column name in the `orderBy` input object, e.g. `title_DESC`.
The sort order (ascending vs. descending) is set by specifying the asc or desc enum value for the column name in the `orderBy` input object, e.g. `title_DESC`.

The `orderBy` argument takes an array of field to allow sorting by multiple columns.

Expand All @@ -23,7 +23,7 @@ query {

**Sorting entities by multiple fields**

Example: Fetch a list of videos that is sorted by their titles \(ascending\) and then on their published date \(descending\):
Example: Fetch a list of videos that is sorted by their titles (ascending) and then on their published date (descending):

```graphql
query {
Expand All @@ -34,4 +34,3 @@ query {
}
}
```

10 changes: 0 additions & 10 deletions package.json
Expand Up @@ -18,16 +18,6 @@
"lint": "yarn workspaces run lint",
"postinstall": "is-ci || husky install"
},
"resolutions": {
"@polkadot/keyring": "6.0.5",
"@polkadot/util": "6.0.5",
"@polkadot/util-crypto": "6.0.5",
"@polkadot/x-rxjs": "6.0.5",
"@polkadot/x-global": "6.0.5",
"@polkadot/networks": "6.0.5",
"@polkadot/x-ws": "6.0.5",
"@polkadot/x-fetch": "6.0.5"
},
"devDependencies": {
"@commitlint/cli": "^12.0.1",
"@commitlint/config-conventional": "^12.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/hydra-cli/Dockerfile
@@ -1,4 +1,4 @@
FROM node:12-alpine
FROM node:14-alpine

RUN mkdir -p /home/hydra-cli && chown -R node:node /home/hydra-cli
RUN mkdir -p /home/hydra && chown -R node:node /home/hydra
Expand Down
1 change: 1 addition & 0 deletions packages/hydra-cli/package.json
Expand Up @@ -75,6 +75,7 @@
},
"queryNodeDependencies": {
"lodash": "^4.17.20",
"pg": "^8.3.2",
"pg-listen": "^1.7.0",
"warthog": "https://github.com/metmirr/warthog/releases/download/v2.30.0/warthog-v2.30.0.tgz",
"typeorm": "^0.2.31"
Expand Down
@@ -1,4 +1,4 @@
FROM node:12-alpine
FROM node:14-alpine

RUN mkdir -p /home/hydra-builder && chown -R node:node /home/hydra-builder

Expand Down
@@ -1,4 +1,4 @@
FROM node:12-alpine
FROM node:14-alpine

RUN mkdir -p /home/hydra-processor && chown -R node:node /home/hydra-processor

Expand Down
@@ -1,4 +1,4 @@
FROM node:12-alpine
FROM node:14-alpine

RUN mkdir -p /home/query-node && chown -R node:node /home/query-node
WORKDIR /home/query-node
Expand Down
2 changes: 1 addition & 1 deletion packages/hydra-indexer-gateway/Dockerfile
@@ -1,4 +1,4 @@
FROM node:12-alpine
FROM node:14-alpine

RUN mkdir -p /home/hydra && chown -R node:node /home/hydra

Expand Down
3 changes: 2 additions & 1 deletion packages/hydra-indexer-gateway/package.json
Expand Up @@ -52,7 +52,8 @@
"ioredis": "^4.17.3",
"reflect-metadata": "^0.1.13",
"typeorm": "^0.2.26",
"warthog": "^2.20.0"
"warthog": "^2.20.0",
"pg": "^8.3.2"
},
"devDependencies": {
"@types/bn.js": "^4.11.6",
Expand Down
2 changes: 1 addition & 1 deletion packages/hydra-indexer/Dockerfile
@@ -1,4 +1,4 @@
FROM node:12-alpine
FROM node:14-alpine

# TODO: optimize this
#
Expand Down
16 changes: 8 additions & 8 deletions packages/hydra-indexer/package.json
Expand Up @@ -43,7 +43,7 @@
"@types/shortid": "^0.0.29",
"commander": "^6.2.0",
"debug": "^4.1.1",
"delay": "^5.0.0",
"delay": "~5.0.0",
"envalid": "^7.1.0",
"express": "^4.17.1",
"graphql": "15",
Expand All @@ -61,9 +61,13 @@
"p-whilst": "~2.1.0",
"prom-client": "^12.0.0",
"reflect-metadata": "^0.1.13",
"set-interval-async": "^2.0.1",
"set-interval-async": "~2.0.1",
"shortid": "^2.2.15",
"typeorm": "^0.2.25"
"typeorm": "^0.2.25",
"pg": "^8.3.2",
"pgtools": "^0.3.0",
"util": "^0.12.3",
"bn.js": "^5.1.2"
},
"devDependencies": {
"@polkadot/ts": "^0.3.14",
Expand All @@ -77,7 +81,6 @@
"@types/set-interval-async": "^1.0.0",
"@typescript-eslint/eslint-plugin": "^3.8.0",
"@typescript-eslint/parser": "^3.0.2",
"bn.js": "^5.1.2",
"chai": "^4.2.0",
"docker-compose-mocha": "^1.2.0",
"dotenv": "^8.2.0",
Expand All @@ -86,12 +89,9 @@
"eslint": "^7.1.0",
"mocha": "^8.1.3",
"nyc": "^15.1.0",
"pg": "^8.3.2",
"pgtools": "^0.3.0",
"prettier": "^2.1.2",
"ts-mockito": "^2.6.1",
"ts-node": "^9.0.0",
"typescript": "^3.8",
"util": "^0.12.3"
"typescript": "^3.8"
}
}

0 comments on commit bc57996

Please sign in to comment.