@gambalabs/apollo 6.0.0-alpha.12 → 6.0.0-alpha.14

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/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gambalabs/apollo",
3
- "version": "6.0.0-alpha.12",
3
+ "version": "6.0.0-alpha.14",
4
4
  "configKey": "apollo",
5
5
  "compatibility": {
6
6
  "nuxt": "^3.0.0-rc.9"
package/dist/module.mjs CHANGED
@@ -5,7 +5,7 @@ import { useLogger, defineNuxtModule, createResolver, addTemplate, addPlugin, ad
5
5
  import GraphQLPlugin from '@rollup/plugin-graphql';
6
6
 
7
7
  const name = "@gambalabs/apollo";
8
- const version = "6.0.0-alpha.12";
8
+ const version = "6.0.0-alpha.14";
9
9
 
10
10
  const logger = useLogger(name);
11
11
  async function readConfigFile(path) {
@@ -81,13 +81,9 @@ export default defineNuxtPlugin((nuxtApp) => {
81
81
  return context.value;
82
82
  });
83
83
  let baseLink = csrfLink.concat(authLink).concat(contextLink);
84
- let optionalPersistedLink;
84
+ let persistedLink;
85
85
  if (clientConfig.persistedQueries) {
86
- const persistedLink = createPersistedQueryLink({ sha256, useGETForHashedQueries: true });
87
- optionalPersistedLink = split(({ query }) => {
88
- const definition = getMainDefinition(query);
89
- return definition.kind === "OperationDefinition" && definition.operation === "query";
90
- }, persistedLink);
86
+ persistedLink = createPersistedQueryLink({ sha256, useGETForHashedQueries: true });
91
87
  }
92
88
  const httpEndLink = createUploadLink({
93
89
  ...clientConfig?.httpLinkOptions && clientConfig.httpLinkOptions,
@@ -143,12 +139,19 @@ export default defineNuxtPlugin((nuxtApp) => {
143
139
  const link = pusherLink ? ApolloLink.from([
144
140
  errorLink,
145
141
  baseLink,
146
- ...clientConfig.persistedQueries ? [optionalPersistedLink] : [],
147
142
  pusherLink,
148
- httpEndLink
143
+ ...clientConfig.persistedQueries ? [
144
+ split(
145
+ ({ query }) => {
146
+ const definition = getMainDefinition(query);
147
+ return definition.kind === "OperationDefinition" && definition.operation === "subscription";
148
+ },
149
+ persistedLink.concat(httpEndLink),
150
+ httpEndLink
151
+ )
152
+ ] : [httpEndLink]
149
153
  ]) : ApolloLink.from([
150
154
  errorLink,
151
- ...clientConfig.persistedQueries ? [optionalPersistedLink] : [],
152
155
  pusherLink,
153
156
  ...!wsLink ? [httpLink] : [
154
157
  ...clientConfig?.websocketsOnly ? [wsLink] : [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gambalabs/apollo",
3
- "version": "6.0.0-alpha.12",
3
+ "version": "6.0.0-alpha.14",
4
4
  "license": "MIT",
5
5
  "repository": "https://github.com/GambaLabs/apollo",
6
6
  "homepage": "https://apollo.nuxtjs.org",