Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update all dev deps #974

Merged
merged 4 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,16 @@
},
"devDependencies": {
"@arethetypeswrong/cli": "^0.16.0",
"@pothos/core": "^3.41.2",
"@pothos/plugin-simple-objects": "^3.7.1",
"@pothos/core": "^4.0.0",
"@pothos/plugin-simple-objects": "^4.0.1",
"@tsconfig/node18": "^18.2.4",
"@tsconfig/strictest": "^2.0.5",
"@types/body-parser": "^1.19.5",
"@types/express": "^4.17.21",
"@types/json-bigint": "^1.0.4",
"@types/node": "^20.14.9",
"@typescript-eslint/eslint-plugin": "^7.15.0",
"@typescript-eslint/parser": "^7.15.0",
"@types/node": "^20.14.10",
"@typescript-eslint/eslint-plugin": "^7.16.0",
"@typescript-eslint/parser": "^7.16.0",
"apollo-server-express": "^3.13.0",
"body-parser": "^1.20.2",
"doctoc": "^2.2.1",
Expand All @@ -139,7 +139,7 @@
"tsx": "^4.16.2",
"type-fest": "^4.21.0",
"typescript": "^5.5.3",
"typescript-eslint": "^7.15.0",
"vitest": "^1.6.0"
"typescript-eslint": "^7.16.0",
"vitest": "^2.0.2"
}
}
742 changes: 266 additions & 476 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/layers/6_client/client.extend.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ test('using an extension returns a copy of the client', () => {

describe(`entrypoint pack`, () => {
test(`can add header`, async ({ fetch }) => {
fetch.mockImplementationOnce(async (input: Request) => {
fetch.mockImplementationOnce(async (input) => {
expect(input.headers.get('x-foo')).toEqual(headers['x-foo'])
return createResponse({ data: { id: db.id } })
})
Expand Down
8 changes: 4 additions & 4 deletions src/layers/6_client/client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ describe(`without schemaIndex only raw is available`, () => {
describe(`interface`, () => {
describe(`http`, () => {
test(`sends well formed request`, async ({ fetch, graffle }) => {
fetch.mockImplementationOnce(() => createResponse({ data: { greetings: `Hello World` } }))
fetch.mockImplementationOnce(() => Promise.resolve(createResponse({ data: { greetings: `Hello World` } })))
await graffle.raw({ document: `query { greetings }` })
const request = fetch.mock.calls[0][0] as Request // eslint-disable-line
expect(request.headers.get(`content-type`)).toEqual(CONTENT_TYPE_JSON)
expect(request.headers.get(`accept`)).toEqual(CONTENT_TYPE_GQL)
const request = fetch.mock.calls[0]?.[0]
expect(request?.headers.get(`content-type`)).toEqual(CONTENT_TYPE_JSON)
expect(request?.headers.get(`accept`)).toEqual(CONTENT_TYPE_GQL)
})
})
})
2 changes: 1 addition & 1 deletion src/legacy/helpers/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export type ResponseMiddleware = (

export type RequestMiddleware<V extends Variables = Variables> = (
request: RequestInitExtended<V>,
) => RequestInitExtended | Promise<RequestInitExtended>
) => MaybePromise<RequestInitExtended>

export type RequestInitExtended<V extends Variables = Variables> = RequestInit & {
url: string
Expand Down
10 changes: 4 additions & 6 deletions src/lib/anyware/specHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,20 @@ export type Input = {

export const initialInput: Input['input'] = { value: `initial` }

// export type $Core = Core<['a', 'b'],Anyware.HookMap<['a','b']>,Input>

type $Core = ReturnType<typeof createAnyware> & {
hooks: {
a: {
run: Mock
slots: {
append: Mock<[hookName: string], string>
appendExtra: Mock<[hookName: string], string>
append: Mock<(hookName: string) => string>
appendExtra: Mock<(hookName: string) => string>
}
}
b: {
run: Mock
slots: {
append: Mock<[hookName: string], string>
appendExtra: Mock<[hookName: string], string>
append: Mock<(hookName: string) => string>
appendExtra: Mock<(hookName: string) => string>
}
}
}
Expand Down
7 changes: 3 additions & 4 deletions tests/_/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,27 @@ export const createResponse = (body: object) =>
new Response(JSON.stringify(body), { status: 200, headers: { 'content-type': CONTENT_TYPE_JSON } })

interface Fixtures {
fetch: Mock
fetch: Mock<(request: Request) => Promise<Response>>
graffle: Client<any, any>
}

import { Graffle } from '../../src/entrypoints/alpha/main.js'
import type { Client } from '../../src/layers/6_client/client.js'

export const test = testBase.extend<Fixtures>({
// @ts-expect-error https://github.com/vitest-dev/vitest/discussions/5710
// eslint-disable-next-line
fetch: async ({}, use) => {
const fetch = globalThis.fetch
const fetchMock = vi.fn()
globalThis.fetch = fetchMock
// eslint-disable-next-line

await use(fetchMock)
globalThis.fetch = fetch
},
graffle: async ({ fetch }, use) => {
const graffle = Graffle.create({ schema: new URL(`https://foo.io/api/graphql`) })
.use(async ({ exchange }) => {
return exchange({ using: { fetch } })
return exchange({ using: { fetch: fetch as typeof globalThis.fetch } })
})
await use(graffle)
},
Expand Down
2 changes: 0 additions & 2 deletions tests/_/schema/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@ import { DateTimeISOResolver } from 'graphql-scalars'
import { db } from '../db.js'

const builder = new SchemaBuilder<{
DefaultFieldNullability: true
Scalars: {
Date: {
Input: Date
Output: Date
}
}
}>({
defaultFieldNullability: true,
plugins: [SimpleObjectsPlugin],
})

Expand Down
6 changes: 1 addition & 5 deletions tests/_/schemaMutationOnly/schema.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import SchemaBuilder from '@pothos/core'
import { db } from '../db.js'

const builder = new SchemaBuilder<{
DefaultFieldNullability: true
}>({
defaultFieldNullability: true,
})
const builder = new SchemaBuilder({})

builder.mutationType({
fields: t => ({
Expand Down
6 changes: 1 addition & 5 deletions tests/_/schemaQueryOnly/schema.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import SchemaBuilder from '@pothos/core'
import { db } from '../db.js'

const builder = new SchemaBuilder<{
DefaultFieldNullability: true
}>({
defaultFieldNullability: true,
})
const builder = new SchemaBuilder({})

builder.queryType({
fields: t => ({
Expand Down
14 changes: 6 additions & 8 deletions tests/legacy/general.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { gql } from 'graphql-tag'
import type { Mock } from 'vitest'
import { beforeEach, describe, expect, it, test, vitest } from 'vitest'
import type { RequestMiddleware, ResponseMiddleware } from '../../src/entrypoints/main.js'
import { GraphQLClient, rawRequest, request } from '../../src/entrypoints/main.js'
import { errors, setupMockServer } from './__helpers.js'

Expand Down Expand Up @@ -54,8 +55,8 @@ test(`basic error with raw request`, async () => {

describe(`middleware`, () => {
let client: GraphQLClient
let requestMiddleware: Mock
let responseMiddleware: Mock
let requestMiddleware: Mock<RequestMiddleware>
let responseMiddleware: Mock<ResponseMiddleware>

describe(`successful requests`, () => {
beforeEach(() => {
Expand Down Expand Up @@ -116,8 +117,7 @@ describe(`middleware`, () => {
})
expect(responseMiddleware).toBeCalledTimes(1)

// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const [_, res] = responseMiddleware.mock.calls[0]
const [_, res] = responseMiddleware.mock.calls[0]!
expect(res).toMatchObject({
operationName: `x`,
url: ctx.url,
Expand All @@ -130,8 +130,7 @@ describe(`middleware`, () => {
})
expect(responseMiddleware).toBeCalledTimes(1)

// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const [_, res] = responseMiddleware.mock.calls[0]
const [_, res] = responseMiddleware.mock.calls[0]!
expect(res).toMatchObject({
operationName: `x`,
url: ctx.url,
Expand All @@ -148,8 +147,7 @@ describe(`middleware`, () => {
])
expect(responseMiddleware).toBeCalledTimes(1)

// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const [_, res] = responseMiddleware.mock.calls[0]
const [_, res] = responseMiddleware.mock.calls[0]!
expect(res).toMatchObject({
operationName: undefined,
url: ctx.url,
Expand Down