Skip to content

Commit

Permalink
update to deps to latest
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanio committed Oct 2, 2023
1 parent 6050d71 commit 5731d79
Show file tree
Hide file tree
Showing 18 changed files with 1,372 additions and 1,681 deletions.
17 changes: 11 additions & 6 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ module.exports = {
format: ['camelCase'],
leadingUnderscore: 'allow',
trailingUnderscore: 'allow',
filter: {
// you can expand this regex to add more allowed names
regex: '^(Content-Type|Another-Property-Name)$',
match: false,
},
},
{
selector: ['variable', 'parameter'],
Expand All @@ -111,6 +116,11 @@ module.exports = {
selector: ['objectLiteralProperty', 'objectLiteralMethod'],
format: ['camelCase', 'PascalCase', 'snake_case', 'UPPER_CASE'],
leadingUnderscore: 'allow',
filter: {
// you can expand this regex to add more allowed names
regex: '^(Content-Type|Another-Property-Name)$',
match: false,
},
},
{
selector: 'typeProperty',
Expand Down Expand Up @@ -234,12 +244,7 @@ module.exports = {
},
],
'use-isnan': 'error',
'no-restricted-imports': [
'error',
{
patterns: ['src'],
},
],
// 'no-restricted-imports': ['error', { patterns: ['src'] }],
'sort-imports': ['error', { ignoreDeclarationSort: true }],
},
overrides: [
Expand Down
Binary file modified datadirs/datadir/dev.db
Binary file not shown.
Binary file modified datadirs/datadir2/dev.db
Binary file not shown.
95 changes: 45 additions & 50 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"name": "seaport-gossip",
"private": true,
"version": "0.0.1",
"description": "A peer-to-peer network for sharing Seaport orders.",
"author": "OpenSea",
Expand All @@ -11,7 +10,7 @@
"prisma"
],
"engines": {
"node": ">=16.15.1"
"node": ">=18"
},
"type": "module",
"types": "./dist/index.d.ts",
Expand All @@ -24,8 +23,7 @@
"seaport-gossip": "./dist/bin/cli.js"
},
"scripts": {
"postinstall": "yarn fixStreamJSTypeImports && yarn build",
"fixStreamJSTypeImports": "npx json -I -f node_modules/@opensea/stream-js/package.json -e \"this.exports.types='./dist/index.d.ts'\" && npx replace \"client'\" \"client.js'\" node_modules/@opensea/stream-js/dist/index.d.ts && npx replace \"types'\" \"types.js'\" node_modules/@opensea/stream-js/dist/index.d.ts",
"postinstall": "yarn build",
"build": "yarn prisma:generate && yarn build:ts",
"build:ts": "tsc -p tsconfig.prod.json",
"lint": "eslint src test prisma",
Expand All @@ -44,63 +42,63 @@
"seed": "ts-node-esm prisma/seed.ts"
},
"dependencies": {
"@chainsafe/libp2p-gossipsub": "^5.2.1",
"@chainsafe/libp2p-noise": "^10.2.0",
"@chainsafe/ssz": "^0.9.2",
"@graphql-yoga/node": "^2.13.13",
"@libp2p/interfaces": "^3.0.3",
"@libp2p/kad-dht": "^6.0.1",
"@libp2p/mplex": "^7.1.0",
"@libp2p/peer-id": "^1.1.16",
"@libp2p/peer-id-factory": "^1.0.18",
"@libp2p/prometheus-metrics": "^1.1.2",
"@libp2p/websockets": "^5.0.0",
"@multiformats/multiaddr": "^11.0.0",
"@chainsafe/libp2p-gossipsub": "^8.0.0",
"@chainsafe/libp2p-noise": "^12.0.1",
"@chainsafe/ssz": "^0.11.1",
"@libp2p/interfaces": "^3.3.2",
"@libp2p/kad-dht": "^9.3.6",
"@libp2p/mplex": "^8.0.3",
"@libp2p/peer-id": "^2.0.3",
"@libp2p/peer-id-factory": "^2.0.3",
"@libp2p/prometheus-metrics": "^1.1.5",
"@libp2p/websockets": "^6.0.3",
"@multiformats/multiaddr": "^12.1.3",
"@opensea/seaport-order-validator": "^0.1.1",
"@opensea/stream-js": "^0.0.21-rc.1",
"@prisma/client": "^4.3.1",
"@opensea/stream-js": "^0.1.1",
"@prisma/client": "^4.15.0",
"async-sema": "^3.1.1",
"bigint-buffer": "^1.1.5",
"class-validator": "^0.14.0",
"ethers": "^5.7.1",
"graphql": "^15.3.0",
"ethers": "^5.7.2",
"graphql": "^16.6.0",
"graphql-fields": "^2.0.3",
"graphql-scalars": "^1.18.0",
"it-pipe": "^2.0.4",
"libp2p": "0.40.0-bae32ba",
"merkletreejs": "^0.3.3",
"node-fetch": "^3.2.10",
"prom-client": "^14.1.0",
"graphql-scalars": "^1.22.2",
"graphql-yoga": "^4.0.0",
"it-pipe": "^3.0.1",
"libp2p": "^0.45.5",
"merkletreejs": "^0.3.10",
"node-fetch": "^3.3.1",
"prom-client": "^14.2.0",
"reflect-metadata": "^0.1.13",
"type-graphql": "^1.1.1",
"typegraphql-prisma": "^0.21.5",
"winston": "^3.8.2",
"type-graphql": "^2.0.0-beta.2",
"typegraphql-prisma": "^0.25.1",
"winston": "^3.9.0",
"winston-daily-rotate-file": "^4.7.1",
"ws": "^8.10.0"
"ws": "^8.13.0"
},
"devDependencies": {
"@chainsafe/eslint-plugin-node": "^11.2.3",
"@types/chai": "^4.3.3",
"@types/chai": "^4.3.5",
"@types/chai-as-promised": "^7.1.5",
"@types/graphql-fields": "^1.3.4",
"@types/mocha": "^9.1.1",
"@types/node": "^16.11.7",
"@types/ws": "^8.5.3",
"@typescript-eslint/eslint-plugin": "^5.38.1",
"@typescript-eslint/parser": "^5.38.1",
"chai": "^4.3.6",
"@types/graphql-fields": "^1.3.5",
"@types/mocha": "^10.0.1",
"@types/node": "^18.15.3",
"@types/ws": "^8.5.5",
"@typescript-eslint/eslint-plugin": "^5.59.9",
"@typescript-eslint/parser": "^5.59.9",
"chai": "^4.3.7",
"chai-as-promised": "^7.1.1",
"eslint": "^8.24.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.26.0",
"eslint": "^8.42.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-prettier": "^4.2.1",
"husky": "^8.0.1",
"lint-staged": "^13.0.3",
"mocha": "^10.0.0",
"prettier": "^2.7.1",
"prisma": "^4.3.1",
"husky": "^8.0.3",
"lint-staged": "^13.2.2",
"mocha": "^10.2.0",
"prettier": "^2.8.8",
"prisma": "^4.15.0",
"ts-node": "^10.9.1",
"typescript": "^4.8.3"
"typescript": "^5.1.3"
},
"repository": {
"type": "git",
Expand All @@ -109,8 +107,5 @@
"homepage": "https://github.com/ProjectOpenSea/seaport-gossip#readme",
"bugs": {
"url": "https://github.com/ProjectOpenSea/seaport-gossip/issues"
},
"resolutions": {
"@prisma/engine-core": ">=4.13.0"
}
}
34 changes: 28 additions & 6 deletions src/db/server.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { createServer } from '@graphql-yoga/node'
import { PrismaClient } from '@prisma/client'
import { createYoga } from 'graphql-yoga'
import { createServer } from 'node:http'

import { createWinstonLogger } from '../util/log.js'

import { schema } from './schema.js'

import type winston from 'winston'

const prisma = new PrismaClient()
export type Yoga = ReturnType<typeof initYoga>

const yogaLogger = (logger: winston.Logger) => ({
debug: logger.debug.bind(logger),
Expand All @@ -16,10 +17,31 @@ const yogaLogger = (logger: winston.Logger) => ({
warn: logger.warn.bind(logger),
})

export const startGraphqlServer = (
opts = { port: 4000, logger: createWinstonLogger() }
export const initYoga = (
opts = {
prisma: new PrismaClient(),
port: 4000,
logger: createWinstonLogger(),
}
) => {
const { port, logger } = opts
const { prisma, port, logger } = opts
const logging = yogaLogger(logger)
return createServer({ schema, logging, context: { prisma }, port })

const yogaInstance = createYoga({ schema, logging, context: { prisma } })
const server = createServer(yogaInstance)

const start = () => {
server.listen(port, () => {
logger.info(
`GraphQL server is running on http://localhost:${port}/graphql`
)
})
}

const stop = () => {
server.closeAllConnections()
server.close()
}

return { instance: yogaInstance, start, stop }
}
Loading

0 comments on commit 5731d79

Please sign in to comment.