Skip to content

Commit

Permalink
Merge pull request #207 from input-output-hk/chore/custom-date-time-s…
Browse files Browse the repository at this point in the history
…calar-placeholder

Remove deprecated scalar package, resolve to single graphql package, fix test cleanup sequence
  • Loading branch information
rhyslbw committed Jul 3, 2020
2 parents 0832942 + 0443fc4 commit 37b23bf
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 39 deletions.
6 changes: 5 additions & 1 deletion package.json
Expand Up @@ -9,6 +9,8 @@
"scripts": {
"build": "yarn workspaces run build",
"cleanup": "yarn workspaces run cleanup && shx rm -rf node_modules",
"cli:install": "yarn workspace @cardano-graphql/cli global:add",
"cli:uninstall": "yarn workspace @cardano-graphql/cli global:remove",
"dev": "yarn service-dependencies up --build",
"lint": "yarn workspaces run lint",
"loadtest:byron-staging": "artillery run test/loadtest/byron-staging-config.yml",
Expand Down Expand Up @@ -36,7 +38,6 @@
"@types/figlet": "^1.2.0",
"@types/fs-extra": "^9.0.1",
"@types/graphql-depth-limit": "^1.1.2",
"@types/graphql-iso-date": "^3.3.3",
"@types/inquirer": "^6.5.0",
"@types/jest": "^26.0.3",
"@types/js-yaml": "^3.12.5",
Expand Down Expand Up @@ -73,5 +74,8 @@
"ts-jest": "^26.1.1",
"ts-node-dev": "^1.0.0-pre.49",
"typescript": "^3.9.5"
},
"resolutions": {
"**/graphql": "14.5.8"
}
}
1 change: 0 additions & 1 deletion packages/api-cardano-db-hasura/package.json
Expand Up @@ -42,7 +42,6 @@
"cross-fetch": "^3.0.4",
"graphql": "14.5.8",
"graphql-bigint": "^1.0.0",
"graphql-iso-date": "^3.6.1",
"p-retry": "^4.2.0"
},
"devDependencies": {
Expand Down
8 changes: 4 additions & 4 deletions packages/api-cardano-db-hasura/src/lib/scalar_resolvers.ts
@@ -1,16 +1,16 @@
import {
DateTime,
Hash32HexString,
LoveLaces,
Lovelaces,
Percentage
} from './scalars'

const GraphQLBigInt = require('graphql-bigint')
const GraphQLDateTime = require('graphql-iso-date')

export const scalarResolvers = {
Hash32HexString: Hash32HexString,
BigInt: GraphQLBigInt,
DateTime: GraphQLDateTime,
Lovelaces: LoveLaces,
DateTime,
Lovelaces,
Percentage: Percentage
} as any
18 changes: 18 additions & 0 deletions packages/api-cardano-db-hasura/src/lib/scalars/DateTime.ts
@@ -0,0 +1,18 @@
import { GraphQLScalarType, Kind } from 'graphql'

export const DateTime = new GraphQLScalarType({
name: 'DateTime',
description: 'SQL timestamp without timezone',
serialize (value) {
return value
},
parseValue (value) {
return value
},
parseLiteral (ast) {
switch (ast.kind) {
case Kind.STRING :
return ast.value
}
}
})
4 changes: 1 addition & 3 deletions packages/api-cardano-db-hasura/src/lib/scalars/Lovelaces.ts
@@ -1,14 +1,12 @@
import { GraphQLScalarType, Kind } from 'graphql'

export const LoveLaces = new GraphQLScalarType({
export const Lovelaces = new GraphQLScalarType({
name: 'LoveLaces',
description: 'LoveLaces, the atomic unit of ADA',
serialize (value) {
// Todo: Implement
return value
},
parseValue (value) {
// Todo: Implement
return value
},
parseLiteral (ast) {
Expand Down
1 change: 1 addition & 0 deletions packages/api-cardano-db-hasura/src/lib/scalars/index.ts
@@ -1,3 +1,4 @@
export * from './DateTime'
export * from './Hash32HexString'
export * from './Lovelaces'
export * from './Percentage'
4 changes: 2 additions & 2 deletions packages/cli/package.json
Expand Up @@ -11,11 +11,11 @@
"access": "public"
},
"scripts": {
"add-global": "yarn build && yarn global add file:$PWD",
"remove-global": "yarn global remove @cardano-graphql/cli",
"build": "tsc -b ./src && shx cp src/Docker/docker-compose.yml dist/Docker/",
"cleanup": "shx rm -rf dist node_modules",
"dev": "ts-node-dev --no-notify --respawn --transpileOnly src/index.ts",
"global:add": "yarn build && yarn global add file:$PWD",
"global:remove": "yarn global remove @cardano-graphql/cli",
"lint": "eslint --ignore-path ../../.eslintignore \"**/*.ts\"",
"prepack": "yarn build",
"postpack": "shx rm -rf dist",
Expand Down
8 changes: 5 additions & 3 deletions packages/cli/test/util.ts
Expand Up @@ -4,14 +4,14 @@ import DoneCallback = jest.DoneCallback
export function setup (done: DoneCallback) {
teardown()
setTimeout(() => {
const yarnAddGlobal = spawn('yarn', ['add-global'])
const yarnAddGlobal = spawn('yarn', ['global:add'])
yarnAddGlobal.stderr.on('error', (error) => done(error))
yarnAddGlobal.on('close', done)
}, 6000)
}

export function teardown (done?: DoneCallback) {
const yarnRemoveGlobal = spawn('yarn', ['remove-global'])
const yarnRemoveGlobal = spawn('yarn', ['global:remove'])
yarnRemoveGlobal.stderr.on('error', (error) => {
if (done !== undefined) done(error)
})
Expand All @@ -26,5 +26,7 @@ export function dockerCommandCleanup (done: DoneCallback) {
console.error(error)
if (error) return done(error)
})
done()
cgqlCleanup.on('close', () => {
done()
})
}
26 changes: 1 addition & 25 deletions yarn.lock
Expand Up @@ -1389,13 +1389,6 @@
dependencies:
graphql "^14.5.3"

"@types/graphql-iso-date@^3.3.3":
version "3.4.0"
resolved "https://registry.yarnpkg.com/@types/graphql-iso-date/-/graphql-iso-date-3.4.0.tgz#b6710b21e3b0bfdb1a0529b285148d98eac18b1f"
integrity sha512-V3jITHTsoI2E8TGt9+/HPDz6LWt3z9/HYnPJYWI6WwiLRexsngg7KzaQlCgQkA4jkEbGPROUD0hJFc9F02W9WA==
dependencies:
graphql "^15.1.0"

"@types/graphql-upload@^8.0.0":
version "8.0.3"
resolved "https://registry.yarnpkg.com/@types/graphql-upload/-/graphql-upload-8.0.3.tgz#b371edb5f305a2a1f7b7843a890a2a7adc55c3ec"
Expand Down Expand Up @@ -4356,11 +4349,6 @@ graphql-extensions@^0.12.3:
apollo-server-env "^2.4.4"
apollo-server-types "^0.5.0"

graphql-iso-date@^3.6.1:
version "3.6.1"
resolved "https://registry.yarnpkg.com/graphql-iso-date/-/graphql-iso-date-3.6.1.tgz#bd2d0dc886e0f954cbbbc496bbf1d480b57ffa96"
integrity sha512-AwFGIuYMJQXOEAgRlJlFL4H1ncFM8n8XmoVDTNypNOZyQ8LFDG2ppMFlsS862BSTCDcSUfHp8PD3/uJhv7t59Q==

graphql-request@^1.5.0:
version "1.8.2"
resolved "https://registry.yarnpkg.com/graphql-request/-/graphql-request-1.8.2.tgz#398d10ae15c585676741bde3fc01d5ca948f8fbe"
Expand Down Expand Up @@ -4415,25 +4403,13 @@ graphql-upload@^8.0.2:
http-errors "^1.7.3"
object-path "^0.11.4"

graphql@14.5.8:
graphql@14.5.8, graphql@^14.5.3:
version "14.5.8"
resolved "https://registry.yarnpkg.com/graphql/-/graphql-14.5.8.tgz#504f3d3114cb9a0a3f359bbbcf38d9e5bf6a6b3c"
integrity sha512-MMwmi0zlVLQKLdGiMfWkgQD7dY/TUKt4L+zgJ/aR0Howebod3aNgP5JkgvAULiR2HPVZaP2VEElqtdidHweLkg==
dependencies:
iterall "^1.2.2"

graphql@^14.5.3:
version "14.6.0"
resolved "https://registry.yarnpkg.com/graphql/-/graphql-14.6.0.tgz#57822297111e874ea12f5cd4419616930cd83e49"
integrity sha512-VKzfvHEKybTKjQVpTFrA5yUq2S9ihcZvfJAtsDBBCuV6wauPu1xl/f9ehgVf0FcEJJs4vz6ysb/ZMkGigQZseg==
dependencies:
iterall "^1.2.2"

graphql@^15.1.0:
version "15.1.0"
resolved "https://registry.yarnpkg.com/graphql/-/graphql-15.1.0.tgz#b93e28de805294ec08e1630d901db550cb8960a1"
integrity sha512-0TVyfOlCGhv/DBczQkJmwXOK6fjWkjzY3Pt7wY8i0gcYXq8aogG3weCsg48m72lywKSeOqedEHvVPOvZvSD51Q==

growly@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/growly/-/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081"
Expand Down

0 comments on commit 37b23bf

Please sign in to comment.