@contember/client-content
Advanced tools
Comparing version 1.3.0-alpha.5 to 1.3.0-alpha.6
@@ -6,4 +6,4 @@ import { mutationFragments } from "./utils/mutationFragments.js"; | ||
class ContentClient { | ||
constructor(executor) { | ||
this.executor = executor; | ||
constructor(client) { | ||
this.client = client; | ||
} | ||
@@ -14,3 +14,3 @@ async query(queries, options) { | ||
const { query, variables } = printer.printDocument("query", operationSet.selection, {}); | ||
const result = await this.executor(query, { variables, ...options }); | ||
const result = await this.client.execute(query, { variables, ...options }); | ||
return operationSet.parse(result); | ||
@@ -22,3 +22,3 @@ } | ||
const { query, variables } = printer.printDocument("mutation", operationSet.selection, mutationFragments); | ||
const result = await this.executor(query, { variables, ...options }); | ||
const result = await this.client.execute(query, { variables, ...options }); | ||
return operationSet.parse(result); | ||
@@ -25,0 +25,0 @@ } |
@@ -6,4 +6,4 @@ import { mutationFragments } from "./utils/mutationFragments.js"; | ||
class ContentClient { | ||
constructor(executor) { | ||
this.executor = executor; | ||
constructor(client) { | ||
this.client = client; | ||
} | ||
@@ -14,3 +14,3 @@ async query(queries, options) { | ||
const { query, variables } = printer.printDocument("query", operationSet.selection, {}); | ||
const result = await this.executor(query, { variables, ...options }); | ||
const result = await this.client.execute(query, { variables, ...options }); | ||
return operationSet.parse(result); | ||
@@ -22,3 +22,3 @@ } | ||
const { query, variables } = printer.printDocument("mutation", operationSet.selection, mutationFragments); | ||
const result = await this.executor(query, { variables, ...options }); | ||
const result = await this.client.execute(query, { variables, ...options }); | ||
return operationSet.parse(result); | ||
@@ -25,0 +25,0 @@ } |
@@ -1,8 +0,7 @@ | ||
import { GraphQlClientRequestOptions } from '@contember/graphql-client'; | ||
import { GraphQlClient, GraphQlClientRequestOptions } from '@contember/graphql-client'; | ||
import { ContentMutation, ContentQuery } from './nodes'; | ||
export type QueryExecutorOptions = GraphQlClientRequestOptions; | ||
export type QueryExecutor = <T = unknown>(query: string, options: GraphQlClientRequestOptions) => Promise<T>; | ||
export declare class ContentClient { | ||
private readonly executor; | ||
constructor(executor: QueryExecutor); | ||
private readonly client; | ||
constructor(client: Pick<GraphQlClient, 'execute'>); | ||
query<Value>(query: ContentQuery<Value>, options?: QueryExecutorOptions): Promise<Value>; | ||
@@ -9,0 +8,0 @@ query<Values extends Record<string, any>>(queries: { |
{ | ||
"name": "@contember/client-content", | ||
"license": "Apache-2.0", | ||
"version": "1.3.0-alpha.5", | ||
"version": "1.3.0-alpha.6", | ||
"main": "./dist/production/index.js", | ||
@@ -38,4 +38,4 @@ "exports": { | ||
"dependencies": { | ||
"@contember/graphql-builder": "1.3.0-alpha.5", | ||
"@contember/graphql-client": "1.3.0-alpha.5", | ||
"@contember/graphql-builder": "1.3.0-alpha.6", | ||
"@contember/graphql-client": "1.3.0-alpha.6", | ||
"@contember/schema": "^1.3.6" | ||
@@ -42,0 +42,0 @@ }, |
import { mutationFragments } from './utils/mutationFragments' | ||
import { GraphQlClientRequestOptions } from '@contember/graphql-client' | ||
import { GraphQlClient, GraphQlClientRequestOptions } from '@contember/graphql-client' | ||
import { GraphQlQueryPrinter } from '@contember/graphql-builder' | ||
@@ -9,9 +9,8 @@ import { ContentMutation, ContentQuery } from './nodes' | ||
export type QueryExecutorOptions = GraphQlClientRequestOptions | ||
export type QueryExecutorOptions = | ||
& GraphQlClientRequestOptions | ||
export type QueryExecutor = <T = unknown>(query: string, options: GraphQlClientRequestOptions) => Promise<T> | ||
export class ContentClient { | ||
constructor( | ||
private readonly executor: QueryExecutor, | ||
private readonly client: Pick<GraphQlClient, 'execute'>, | ||
) { | ||
@@ -27,3 +26,3 @@ } | ||
const { query, variables } = printer.printDocument('query', operationSet.selection, {}) | ||
const result = await this.executor(query, { variables, ...options }) | ||
const result = await this.client.execute(query, { variables, ...options }) | ||
return operationSet.parse(result) | ||
@@ -40,3 +39,3 @@ } | ||
const { query, variables } = printer.printDocument('mutation', operationSet.selection, mutationFragments) | ||
const result = await this.executor(query, { variables, ...options }) | ||
const result = await this.client.execute(query, { variables, ...options }) | ||
@@ -43,0 +42,0 @@ return operationSet.parse(result) |
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
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
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
347369
3555
+ Added@contember/graphql-builder@1.3.0-alpha.6(transitive)
+ Added@contember/graphql-client@1.3.0-alpha.6(transitive)
- Removed@contember/graphql-builder@1.3.0-alpha.5(transitive)
- Removed@contember/graphql-client@1.3.0-alpha.5(transitive)