@whisk/client 0.0.17 → 0.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/WhiskClient.js +1 -2
- package/dist/WhiskClient.js.map +1 -1
- package/package.json +2 -2
- package/src/WhiskClient.ts +1 -2
package/dist/WhiskClient.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import {
|
|
2
|
-
cacheExchange,
|
|
3
2
|
fetchExchange,
|
|
4
3
|
Client as UrqlClient
|
|
5
4
|
} from "@urql/core";
|
|
@@ -12,7 +11,7 @@ class WhiskClient {
|
|
|
12
11
|
constructor({ apiKey, url = DEFAULT_WHISK_API_URL, debug = false }) {
|
|
13
12
|
this.urql = new UrqlClient({
|
|
14
13
|
url,
|
|
15
|
-
exchanges: [scalarsExchange,
|
|
14
|
+
exchanges: [scalarsExchange, fetchExchange],
|
|
16
15
|
fetchOptions: {
|
|
17
16
|
headers: {
|
|
18
17
|
Authorization: `Bearer ${apiKey}`
|
package/dist/WhiskClient.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/WhiskClient.ts"],"sourcesContent":["import {\n type AnyVariables,\n
|
|
1
|
+
{"version":3,"sources":["../src/WhiskClient.ts"],"sourcesContent":["import {\n type AnyVariables,\n fetchExchange,\n type TypedDocumentNode,\n Client as UrqlClient,\n} from \"@urql/core\"\nimport { WhiskError } from \"./errors.js\"\nimport { scalarsExchange } from \"./scalarExchange.js\"\n\nconst DEFAULT_WHISK_API_URL = \"https://api-v2.whisk.so/graphql\"\n\nexport interface WhiskClientConfig {\n readonly apiKey: string\n readonly url?: string\n readonly debug?: boolean\n}\n\nexport class WhiskClient {\n private readonly urql: UrqlClient\n private readonly debug: boolean\n\n constructor({ apiKey, url = DEFAULT_WHISK_API_URL, debug = false }: WhiskClientConfig) {\n this.urql = new UrqlClient({\n url,\n exchanges: [scalarsExchange, fetchExchange],\n fetchOptions: {\n headers: {\n Authorization: `Bearer ${apiKey}`,\n },\n },\n })\n\n this.debug = debug\n }\n\n public async query<TValue, TVariables extends AnyVariables>(\n document: TypedDocumentNode<TValue, TVariables>,\n variables: TVariables,\n ): Promise<TValue> {\n const result = await this.urql.query(document, variables)\n\n // Bubbles up any network errors\n if (result.error && !result.data) {\n throw WhiskError.from(result.error)\n }\n\n // Error if we have no data\n if (!result.data) {\n throw WhiskError.from(\"No data returned from query\")\n }\n\n // Log any graphql errors (but don't put into error, since partial is fine)\n if (result.error && this.debug) {\n console.debug(\"[Whisk Client] GraphQL errors:\", result.error)\n }\n\n return result.data\n }\n}\n"],"mappings":"AAAA;AAAA,EAEE;AAAA,EAEA,UAAU;AAAA,OACL;AACP,SAAS,kBAAkB;AAC3B,SAAS,uBAAuB;AAEhC,MAAM,wBAAwB;AAQvB,MAAM,YAAY;AAAA,EACN;AAAA,EACA;AAAA,EAEjB,YAAY,EAAE,QAAQ,MAAM,uBAAuB,QAAQ,MAAM,GAAsB;AACrF,SAAK,OAAO,IAAI,WAAW;AAAA,MACzB;AAAA,MACA,WAAW,CAAC,iBAAiB,aAAa;AAAA,MAC1C,cAAc;AAAA,QACZ,SAAS;AAAA,UACP,eAAe,UAAU,MAAM;AAAA,QACjC;AAAA,MACF;AAAA,IACF,CAAC;AAED,SAAK,QAAQ;AAAA,EACf;AAAA,EAEA,MAAa,MACX,UACA,WACiB;AACjB,UAAM,SAAS,MAAM,KAAK,KAAK,MAAM,UAAU,SAAS;AAGxD,QAAI,OAAO,SAAS,CAAC,OAAO,MAAM;AAChC,YAAM,WAAW,KAAK,OAAO,KAAK;AAAA,IACpC;AAGA,QAAI,CAAC,OAAO,MAAM;AAChB,YAAM,WAAW,KAAK,6BAA6B;AAAA,IACrD;AAGA,QAAI,OAAO,SAAS,KAAK,OAAO;AAC9B,cAAQ,MAAM,kCAAkC,OAAO,KAAK;AAAA,IAC9D;AAEA,WAAO,OAAO;AAAA,EAChB;AACF;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@whisk/client",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.19",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/office-supply-ventures/whisk-sdk.git",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"@atmina/urql-custom-scalars-exchange": "1.2.0",
|
|
28
28
|
"@urql/core": "6.0.1",
|
|
29
29
|
"gql.tada": "1.9.0",
|
|
30
|
-
"@whisk/graphql": "0.0.
|
|
30
|
+
"@whisk/graphql": "0.0.18"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"graphql": ">=16"
|
package/src/WhiskClient.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
2
|
type AnyVariables,
|
|
3
|
-
cacheExchange,
|
|
4
3
|
fetchExchange,
|
|
5
4
|
type TypedDocumentNode,
|
|
6
5
|
Client as UrqlClient,
|
|
@@ -23,7 +22,7 @@ export class WhiskClient {
|
|
|
23
22
|
constructor({ apiKey, url = DEFAULT_WHISK_API_URL, debug = false }: WhiskClientConfig) {
|
|
24
23
|
this.urql = new UrqlClient({
|
|
25
24
|
url,
|
|
26
|
-
exchanges: [scalarsExchange,
|
|
25
|
+
exchanges: [scalarsExchange, fetchExchange],
|
|
27
26
|
fetchOptions: {
|
|
28
27
|
headers: {
|
|
29
28
|
Authorization: `Bearer ${apiKey}`,
|