piral-urql
Advanced tools
Comparing version 0.8.2 to 0.8.3-pre.708
import { Extend } from 'piral-core'; | ||
import { Client } from 'urql'; | ||
import { PiletGqlApi, GqlConfig } from './types'; | ||
import { PiletGqlApi, UrqlClient } from './types'; | ||
export interface GqlConfig { | ||
/** | ||
* Sets the default request init settings. | ||
*/ | ||
default?: RequestInit; | ||
/** | ||
* Sets the URL of the GraphQL endpoint. | ||
* @default location.origin | ||
*/ | ||
url?: string; | ||
/** | ||
* Sets the URL for the GraphQL subscription endpoint. | ||
*/ | ||
subscriptionUrl?: false | string; | ||
/** | ||
* Sets if the subscription should be lazy initialized. | ||
*/ | ||
lazy?: boolean; | ||
/** | ||
* Optional callback to the be used in case of a connection. | ||
*/ | ||
onConnected?(): void; | ||
/** | ||
* Optional callbsack to be used in case of a disconnect. | ||
* @param err The connection error. | ||
*/ | ||
onDisconnected?(err: Array<Error>): void; | ||
} | ||
/** | ||
@@ -8,3 +35,3 @@ * Sets up an urql client by using the given config. | ||
*/ | ||
export declare function setupGqlClient(config?: GqlConfig): Client; | ||
export declare function setupGqlClient(config?: GqlConfig): UrqlClient; | ||
/** | ||
@@ -14,2 +41,2 @@ * Creates a new Piral GraphQL API extension. | ||
*/ | ||
export declare function createGqlApi(client?: Client): Extend<PiletGqlApi>; | ||
export declare function createGqlApi(client?: UrqlClient): Extend<PiletGqlApi>; |
import { ArbiterModuleMetadata } from 'react-arbiter'; | ||
import { Client } from 'urql'; | ||
import { UrqlClient } from './types'; | ||
export interface PiletQueryResult { | ||
pilets: Array<ArbiterModuleMetadata>; | ||
} | ||
export declare function requestPiletsFromGraphQL(client: Client): Promise<ArbiterModuleMetadata[]>; | ||
export declare function requestPiletsFromGraphQL(client: UrqlClient): Promise<ArbiterModuleMetadata[]>; |
@@ -0,1 +1,3 @@ | ||
import 'piral-core'; | ||
import { Client } from 'urql'; | ||
declare module 'piral-core/lib/types/custom' { | ||
@@ -5,2 +7,3 @@ interface PiletCustomApi extends PiletGqlApi { | ||
} | ||
export declare type UrqlClient = Client; | ||
export interface GqlUnsubscriber { | ||
@@ -30,8 +33,2 @@ /** | ||
/** | ||
* The variables to be used in the mutation. | ||
*/ | ||
variables?: Record<string, any>; | ||
} | ||
export interface GqlMutationOptions { | ||
/** | ||
* The variables to be used in the query. | ||
@@ -47,30 +44,2 @@ */ | ||
} | ||
export interface GqlConfig { | ||
/** | ||
* Sets the default request init settings. | ||
*/ | ||
default?: RequestInit; | ||
/** | ||
* Sets the URL of the GraphQL endpoint. | ||
* @default location.origin | ||
*/ | ||
url?: string; | ||
/** | ||
* Sets the URL for the GraphQL subscription endpoint. | ||
*/ | ||
subscriptionUrl?: false | string; | ||
/** | ||
* Sets if the subscription should be lazy initialized. | ||
*/ | ||
lazy?: boolean; | ||
/** | ||
* Optional callback to the be used in case of a connection. | ||
*/ | ||
onConnected?(): void; | ||
/** | ||
* Optional callbsack to be used in case of a disconnect. | ||
* @param err The connection error. | ||
*/ | ||
onDisconnected?(err: Array<Error>): void; | ||
} | ||
export interface PiletGqlApiQuery { | ||
@@ -77,0 +46,0 @@ <T = any>(query: string, options?: GqlQueryOptions): Promise<T>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
require("piral-core"); | ||
//# sourceMappingURL=types.js.map |
{ | ||
"name": "piral-urql", | ||
"version": "0.8.2", | ||
"version": "0.8.3-pre.708", | ||
"description": "Introduces the query, mutate, and subscribe API extensions for extending piral-core.", | ||
@@ -26,2 +26,3 @@ "keywords": [ | ||
"files": [ | ||
"api.d.ts", | ||
"lib", | ||
@@ -43,3 +44,3 @@ "src" | ||
"devDependencies": { | ||
"piral-core": "^0.8.2" | ||
"piral-core": "^0.8.3-pre.708" | ||
}, | ||
@@ -56,3 +57,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "cf993caafe5cd122898308c692fcde3af5e40346" | ||
"gitHead": "ddd941b48c2470b06c839f08bc12b5ee19618626" | ||
} |
import { ArbiterModuleMetadata } from 'react-arbiter'; | ||
import { Client } from 'urql'; | ||
import { gqlQuery } from './queries'; | ||
import { UrqlClient } from './types'; | ||
@@ -18,4 +18,4 @@ export interface PiletQueryResult { | ||
export function requestPiletsFromGraphQL(client: Client) { | ||
export function requestPiletsFromGraphQL(client: UrqlClient) { | ||
return gqlQuery<PiletQueryResult>(client, piletsQuery).then(({ pilets }) => pilets); | ||
} |
@@ -1,2 +0,3 @@ | ||
import {} from 'piral-core'; | ||
import 'piral-core'; | ||
import { Client } from 'urql'; | ||
@@ -7,2 +8,4 @@ declare module 'piral-core/lib/types/custom' { | ||
export type UrqlClient = Client; | ||
export interface GqlUnsubscriber { | ||
@@ -35,9 +38,2 @@ /** | ||
/** | ||
* The variables to be used in the mutation. | ||
*/ | ||
variables?: Record<string, any>; | ||
} | ||
export interface GqlMutationOptions { | ||
/** | ||
* The variables to be used in the query. | ||
@@ -55,31 +51,2 @@ */ | ||
export interface GqlConfig { | ||
/** | ||
* Sets the default request init settings. | ||
*/ | ||
default?: RequestInit; | ||
/** | ||
* Sets the URL of the GraphQL endpoint. | ||
* @default location.origin | ||
*/ | ||
url?: string; | ||
/** | ||
* Sets the URL for the GraphQL subscription endpoint. | ||
*/ | ||
subscriptionUrl?: false | string; | ||
/** | ||
* Sets if the subscription should be lazy initialized. | ||
*/ | ||
lazy?: boolean; | ||
/** | ||
* Optional callback to the be used in case of a connection. | ||
*/ | ||
onConnected?(): void; | ||
/** | ||
* Optional callbsack to be used in case of a disconnect. | ||
* @param err The connection error. | ||
*/ | ||
onDisconnected?(err: Array<Error>): void; | ||
} | ||
export interface PiletGqlApiQuery { | ||
@@ -86,0 +53,0 @@ <T = any>(query: string, options?: GqlQueryOptions): Promise<T>; |
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
24
25973
541