graphql-request
Advanced tools
Comparing version 7.2.0-next.7 to 7.2.0-next.8
@@ -83,3 +83,3 @@ import type { TypedDocumentNode } from '@graphql-typed-document-node/core'; | ||
export type ResponseMiddleware = (response: GraphQLClientResponse<unknown> | ClientError | Error, request: RequestInitExtended) => MaybePromise<void>; | ||
export type RequestMiddleware<V extends Variables = Variables> = (request: RequestInitExtended<V>) => RequestInitExtended | Promise<RequestInitExtended>; | ||
export type RequestMiddleware<V extends Variables = Variables> = (request: RequestInitExtended<V>) => MaybePromise<RequestInitExtended>; | ||
export type RequestInitExtended<V extends Variables = Variables> = RequestInit & { | ||
@@ -86,0 +86,0 @@ url: string; |
@@ -19,4 +19,4 @@ import type { Mock } from 'vitest'; | ||
slots: { | ||
append: Mock<[hookName: string], string>; | ||
appendExtra: Mock<[hookName: string], string>; | ||
append: Mock<(hookName: string) => string>; | ||
appendExtra: Mock<(hookName: string) => string>; | ||
}; | ||
@@ -27,4 +27,4 @@ }; | ||
slots: { | ||
append: Mock<[hookName: string], string>; | ||
appendExtra: Mock<[hookName: string], string>; | ||
append: Mock<(hookName: string) => string>; | ||
appendExtra: Mock<(hookName: string) => string>; | ||
}; | ||
@@ -31,0 +31,0 @@ }; |
{ | ||
"name": "graphql-request", | ||
"version": "7.2.0-next.7", | ||
"packageManager": "pnpm@9.4.0", | ||
"version": "7.2.0-next.8", | ||
"packageManager": "pnpm@9.5.0", | ||
"type": "module", | ||
@@ -107,5 +107,5 @@ "bin": { | ||
"@arethetypeswrong/cli": "^0.16.0", | ||
"@pothos/core": "^3.41.2", | ||
"@pothos/plugin-simple-objects": "^3.7.1", | ||
"@tsconfig/node18": "^18.2.4", | ||
"@pothos/core": "^4.0.0", | ||
"@pothos/plugin-simple-objects": "^4.0.1", | ||
"@tsconfig/node20": "^20.1.4", | ||
"@tsconfig/strictest": "^2.0.5", | ||
@@ -115,7 +115,5 @@ "@types/body-parser": "^1.19.5", | ||
"@types/json-bigint": "^1.0.4", | ||
"@types/node": "^20.14.9", | ||
"@typescript-eslint/eslint-plugin": "^7.15.0", | ||
"@typescript-eslint/parser": "^7.15.0", | ||
"apollo-server-express": "^3.13.0", | ||
"body-parser": "^1.20.2", | ||
"@types/node": "^20.14.10", | ||
"@typescript-eslint/eslint-plugin": "^7.16.0", | ||
"@typescript-eslint/parser": "^7.16.0", | ||
"doctoc": "^2.2.1", | ||
@@ -131,3 +129,2 @@ "dripip": "^0.10.0", | ||
"eslint-typescript": "^1.1.0", | ||
"express": "^4.19.2", | ||
"get-port": "^7.1.0", | ||
@@ -145,5 +142,5 @@ "graphql": "^16.9.0", | ||
"typescript": "^5.5.3", | ||
"typescript-eslint": "^7.15.0", | ||
"vitest": "^1.6.0" | ||
"typescript-eslint": "^7.16.0", | ||
"vitest": "^2.0.2" | ||
} | ||
} |
@@ -18,3 +18,3 @@ /* eslint-disable */ | ||
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']) | ||
@@ -21,0 +21,0 @@ return createResponse({ data: { id: db.id } }) |
@@ -30,9 +30,9 @@ import { describe, expect } from 'vitest' | ||
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) | ||
}) | ||
}) | ||
}) |
@@ -100,3 +100,3 @@ import type { TypedDocumentNode } from '@graphql-typed-document-node/core' | ||
request: RequestInitExtended<V>, | ||
) => RequestInitExtended | Promise<RequestInitExtended> | ||
) => MaybePromise<RequestInitExtended> | ||
@@ -103,0 +103,0 @@ export type RequestInitExtended<V extends Variables = Variables> = RequestInit & { |
@@ -13,4 +13,2 @@ import type { Mock } from 'vitest' | ||
// export type $Core = Core<['a', 'b'],Anyware.HookMap<['a','b']>,Input> | ||
type $Core = ReturnType<typeof createAnyware> & { | ||
@@ -21,4 +19,4 @@ hooks: { | ||
slots: { | ||
append: Mock<[hookName: string], string> | ||
appendExtra: Mock<[hookName: string], string> | ||
append: Mock<(hookName: string) => string> | ||
appendExtra: Mock<(hookName: string) => string> | ||
} | ||
@@ -29,4 +27,4 @@ } | ||
slots: { | ||
append: Mock<[hookName: string], string> | ||
appendExtra: Mock<[hookName: string], string> | ||
append: Mock<(hookName: string) => string> | ||
appendExtra: Mock<(hookName: string) => string> | ||
} | ||
@@ -33,0 +31,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
35
916986
14216