@quiltt/core 3.9.2 → 3.9.3

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @quiltt/core
2
2
 
3
+ ## 3.9.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#319](https://github.com/quiltt/quiltt-js/pull/319) [`b97a814`](https://github.com/quiltt/quiltt-js/commit/b97a814b87b8bfec9f8b4bb155e1140724e441eb) Thanks [@zubairaziz](https://github.com/zubairaziz)! - Improve typings for query client and react components
8
+
3
9
  ## 3.9.2
4
10
 
5
11
  ### Patch Changes
@@ -204,7 +204,7 @@ import { print } from 'graphql';
204
204
  */ const GlobalStorage = new Storage();
205
205
 
206
206
  var name = "@quiltt/core";
207
- var version$1 = "3.9.2";
207
+ var version$1 = "3.9.3";
208
208
 
209
209
  const QUILTT_API_INSECURE = (()=>{
210
210
  try {
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _apollo_client_core from '@apollo/client/core';
2
- import { Operation, NextLink, FetchResult, ApolloClientOptions } from '@apollo/client/core';
2
+ import { Operation, NextLink, FetchResult, ApolloClientOptions, NormalizedCacheObject } from '@apollo/client/core';
3
3
  export { ApolloError, OperationVariables } from '@apollo/client/core';
4
4
  import { ApolloLink, ApolloClient } from '@apollo/client/core/index.js';
5
5
  export { gql } from '@apollo/client/core/index.js';
@@ -177,8 +177,8 @@ declare const TerminatingLink: ApolloLink;
177
177
  declare const VersionLink: ApolloLink;
178
178
 
179
179
  type QuilttClientOptions<T> = Omit<ApolloClientOptions<T>, 'link'>;
180
- declare class QuilttClient<T> extends ApolloClient<T> {
181
- constructor(options: QuilttClientOptions<T>);
180
+ declare class QuilttClient extends ApolloClient<NormalizedCacheObject> {
181
+ constructor(options: QuilttClientOptions<NormalizedCacheObject>);
182
182
  }
183
183
 
184
184
  type FetchResponse<T> = {
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ApolloLink, ApolloClient } from '@apollo/client/core/index.js';
2
2
  export { gql } from '@apollo/client/core/index.js';
3
- import { G as GlobalStorage, e as endpointGraphQL, v as version, d as debugging, S as SubscriptionLink, a as endpointAuth } from './SubscriptionLink-client-CvVnhUQS.js';
4
- export { L as LocalStorage, M as MemoryStorage, O as Observable, b as Storage, c as cdnBase, f as endpointWebsockets } from './SubscriptionLink-client-CvVnhUQS.js';
3
+ import { G as GlobalStorage, e as endpointGraphQL, v as version, d as debugging, S as SubscriptionLink, a as endpointAuth } from './SubscriptionLink-client-FHHdw7El.js';
4
+ export { L as LocalStorage, M as MemoryStorage, O as Observable, b as Storage, c as cdnBase, f as endpointWebsockets } from './SubscriptionLink-client-FHHdw7El.js';
5
5
  import { BatchHttpLink as BatchHttpLink$1 } from '@apollo/client/link/batch-http/index.js';
6
6
  import crossfetch from 'cross-fetch';
7
7
  import { onError } from '@apollo/client/link/error/index.js';
@@ -95,10 +95,15 @@ const VersionLink = new ApolloLink((operation, forward)=>{
95
95
 
96
96
  class QuilttClient extends ApolloClient {
97
97
  constructor(options){
98
- if (!options.connectToDevTools) options.connectToDevTools = debugging;
98
+ const finalOptions = {
99
+ ...options,
100
+ devtools: {
101
+ enabled: options.devtools?.enabled ?? debugging
102
+ }
103
+ };
104
+ const isOperationDefinition = (def)=>def.kind === 'OperationDefinition';
99
105
  const isSubscriptionOperation = (operation)=>{
100
- return operation.query.definitions.some(// @ts-ignore
101
- ({ kind, operation })=>kind === 'OperationDefinition' && operation === 'subscription');
106
+ return operation.query.definitions.some((definition)=>isOperationDefinition(definition) && definition.operation === 'subscription');
102
107
  };
103
108
  const isBatchable = (operation)=>{
104
109
  return operation.getContext().batchable ?? true;
@@ -113,7 +118,7 @@ class QuilttClient extends ApolloClient {
113
118
  ]).split(isSubscriptionOperation, subscriptionsLink, ForwardableLink).split(isBatchable, BatchHttpLink, HttpLink);
114
119
  super({
115
120
  link: quilttLink,
116
- ...options
121
+ ...finalOptions
117
122
  });
118
123
  }
119
124
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quiltt/core",
3
- "version": "3.9.2",
3
+ "version": "3.9.3",
4
4
  "description": "Javascript API client and utilities for Quiltt",
5
5
  "keywords": [
6
6
  "quiltt",
@@ -32,7 +32,7 @@
32
32
  ],
33
33
  "main": "dist/index.js",
34
34
  "dependencies": {
35
- "@apollo/client": "^3.11.8",
35
+ "@apollo/client": "^3.12.4",
36
36
  "@rails/actioncable": "^7.2.201",
37
37
  "braces": "^3.0.3",
38
38
  "cross-fetch": "^4.0.0",
@@ -41,12 +41,12 @@
41
41
  },
42
42
  "devDependencies": {
43
43
  "@biomejs/biome": "1.9.4",
44
- "@types/node": "22.10.2",
44
+ "@types/node": "22.10.5",
45
45
  "@types/rails__actioncable": "6.1.11",
46
46
  "@types/react": "18.3.12",
47
- "bunchee": "5.6.1",
47
+ "bunchee": "6.2.0",
48
48
  "rimraf": "6.0.1",
49
- "typescript": "5.7.2"
49
+ "typescript": "5.7.3"
50
50
  },
51
51
  "tags": [
52
52
  "quiltt"
@@ -1,5 +1,6 @@
1
- import type { ApolloClientOptions, Operation } from '@apollo/client/core'
1
+ import type { ApolloClientOptions, NormalizedCacheObject, Operation } from '@apollo/client/core'
2
2
  import { ApolloClient, ApolloLink } from '@apollo/client/core/index.js'
3
+ import type { DefinitionNode, OperationDefinitionNode } from 'graphql'
3
4
 
4
5
  import { debugging } from '../../configuration'
5
6
  import {
@@ -15,14 +16,21 @@ import {
15
16
 
16
17
  export type QuilttClientOptions<T> = Omit<ApolloClientOptions<T>, 'link'>
17
18
 
18
- export class QuilttClient<T> extends ApolloClient<T> {
19
- constructor(options: QuilttClientOptions<T>) {
20
- if (!options.connectToDevTools) options.connectToDevTools = debugging
19
+ export class QuilttClient extends ApolloClient<NormalizedCacheObject> {
20
+ constructor(options: QuilttClientOptions<NormalizedCacheObject>) {
21
+ const finalOptions = {
22
+ ...options,
23
+ devtools: {
24
+ enabled: options.devtools?.enabled ?? debugging,
25
+ },
26
+ }
27
+
28
+ const isOperationDefinition = (def: DefinitionNode): def is OperationDefinitionNode =>
29
+ def.kind === 'OperationDefinition'
21
30
 
22
31
  const isSubscriptionOperation = (operation: Operation) => {
23
32
  return operation.query.definitions.some(
24
- // @ts-ignore
25
- ({ kind, operation }) => kind === 'OperationDefinition' && operation === 'subscription'
33
+ (definition) => isOperationDefinition(definition) && definition.operation === 'subscription'
26
34
  )
27
35
  }
28
36
 
@@ -38,8 +46,8 @@ export class QuilttClient<T> extends ApolloClient<T> {
38
46
  .split(isBatchable, BatchHttpLink, HttpLink)
39
47
 
40
48
  super({
41
- link: quilttLink,
42
- ...options,
49
+ link: quilttLink as ApolloLink,
50
+ ...finalOptions,
43
51
  })
44
52
  }
45
53
  }