@kubun/with-apollo 0.6.0 → 0.8.0
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/lib/index.d.ts +2 -6
- package/lib/index.js +1 -1
- package/package.json +6 -6
package/lib/index.d.ts
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
1
|
import { ApolloLink } from '@apollo/client';
|
|
2
|
-
import type {
|
|
3
|
-
export
|
|
4
|
-
client: KubunClient;
|
|
5
|
-
graphID: string;
|
|
6
|
-
};
|
|
7
|
-
export declare function createLink(params: LinkParams): ApolloLink;
|
|
2
|
+
import type { GraphQLSource } from '@kubun/protocol';
|
|
3
|
+
export declare function createLink(source: GraphQLSource): ApolloLink;
|
package/lib/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ApolloLink as
|
|
1
|
+
import{ApolloLink as e,Observable as r}from"@apollo/client";import{getMainDefinition as t,print as n}from"@apollo/client/utilities";function i(e){return new r(r=>{e.then(e=>{try{r.next(e),r.complete()}catch(e){r.error(e)}},e=>{r.error(e)})})}export function createLink(o){return new e(e=>{let a=t(e.query);if("OperationDefinition"!==a.kind){var c;return c=Error(`Invalid definition: ${a.kind}, expected OperationDefinition`),new r(e=>{e.error(c)})}let l={text:n(e.query),variables:e.variables};return"subscription"===a.operation?new r(e=>{o.subscribe(l).then(r=>{Symbol.asyncIterator in r?(async()=>{try{for await(let t of r)e.next(t);e.complete()}catch(r){e.error(r)}})():(e.next(r),e.complete())},r=>{e.error(r)})}):"mutation"===a.operation?i(o.mutate(l)):i(o.query(l))})}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubun/with-apollo",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"license": "see LICENSE.md",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"type": "module",
|
|
@@ -15,19 +15,19 @@
|
|
|
15
15
|
],
|
|
16
16
|
"sideEffects": false,
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@apollo/client": "^4.1.
|
|
19
|
-
"graphql": "^16.
|
|
18
|
+
"@apollo/client": "^4.1.7",
|
|
19
|
+
"graphql": "^16.13.2"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@kubun/
|
|
22
|
+
"@kubun/protocol": "^0.8.0"
|
|
23
23
|
},
|
|
24
24
|
"scripts": {
|
|
25
25
|
"build:clean": "del lib",
|
|
26
26
|
"build:js": "swc src -d ./lib --config-file ../../swc.json --strip-leading-paths",
|
|
27
27
|
"build:types": "tsc --emitDeclarationOnly --skipLibCheck",
|
|
28
|
-
"build:types:ci": "tsc --emitDeclarationOnly --declarationMap false",
|
|
28
|
+
"build:types:ci": "tsc --emitDeclarationOnly --declarationMap false --skipLibCheck",
|
|
29
29
|
"build": "pnpm run build:clean && pnpm run build:js && pnpm run build:types",
|
|
30
|
-
"test:types": "tsc --noEmit",
|
|
30
|
+
"test:types": "tsc --noEmit --skipLibCheck",
|
|
31
31
|
"test:unit": "vitest run",
|
|
32
32
|
"test": "pnpm run test:types && pnpm run test:unit"
|
|
33
33
|
}
|