@quiltt/core 3.6.12 → 3.6.13

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.6.13
4
+
5
+ ### Patch Changes
6
+
7
+ - [#276](https://github.com/quiltt/quiltt-js/pull/276) [`be1f9be`](https://github.com/quiltt/quiltt-js/commit/be1f9be957ef1a7686e6a25807275186c8dd51b4) Thanks [@rubendinho](https://github.com/rubendinho)! - Replace manually imported ActionCable code with official npm package
8
+
3
9
  ## 3.6.12
4
10
 
5
11
  ### Patch Changes
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import { ApolloLink, Observable as Observable$1 } from '@apollo/client/core/index.js';
3
+ import { createConsumer } from '@rails/actioncable';
3
4
  import { print } from 'graphql';
4
- import { c as createConsumer } from './index-client-AzYaJaCS.js';
5
5
 
6
6
  /**
7
7
  * An error and type safe wrapper for localStorage.
@@ -203,7 +203,7 @@ import { c as createConsumer } from './index-client-AzYaJaCS.js';
203
203
  */ const GlobalStorage = new Storage();
204
204
 
205
205
  var name = "@quiltt/core";
206
- var version$1 = "3.6.12";
206
+ var version$1 = "3.6.13";
207
207
 
208
208
  const QUILTT_API_INSECURE = (()=>{
209
209
  try {
package/dist/index.d.ts CHANGED
@@ -5,6 +5,7 @@ import * as _apollo_client from '@apollo/client';
5
5
  import { HttpLink as HttpLink$1 } from '@apollo/client/link/http/index.js';
6
6
  import { RetryLink as RetryLink$1 } from '@apollo/client/link/retry/index.js';
7
7
  import { ApolloLink as ApolloLink$1, Operation as Operation$1, NextLink as NextLink$1, Observable as Observable$2, FetchResult as FetchResult$1 } from '@apollo/client/core/index.js';
8
+ import { Consumer } from '@rails/actioncable';
8
9
  import { Dispatch, SetStateAction } from 'react';
9
10
 
10
11
  interface CallbackManager {
@@ -92,82 +93,6 @@ declare const HttpLink: HttpLink$1;
92
93
 
93
94
  declare const RetryLink: RetryLink$1;
94
95
 
95
- declare class Connection {
96
- constructor(consumer: any);
97
- send(data: any): boolean;
98
- open(): boolean;
99
- close({ allowReconnect }?: {
100
- allowReconnect: boolean;
101
- }): any;
102
- reopen(): any;
103
- getProtocol(): any;
104
- isOpen(): boolean;
105
- isActive(): boolean;
106
- triedToReconnect(): boolean;
107
- isProtocolSupported(): boolean;
108
- isState(...states: any[]): boolean;
109
- getState(): string | null;
110
- installEventHandlers(): void;
111
- uninstallEventHandlers(): void;
112
- }
113
-
114
- type Data = {
115
- [id: string]: string | object | null | undefined;
116
- };
117
- declare class Subscription {
118
- consumer: Consumer;
119
- identifier: string;
120
- constructor(consumer: Consumer, params: Data | undefined, mixin: Data);
121
- perform(action: string, data?: Data): boolean;
122
- send(data: object): boolean;
123
- unsubscribe(): Subscription;
124
- }
125
-
126
- declare class SubscriptionGuarantor {
127
- subscriptions: Subscriptions;
128
- pendingSubscriptions: Array<Subscription>;
129
- retryTimeout: ReturnType<typeof setTimeout> | undefined;
130
- constructor(subscriptions: Subscriptions);
131
- guarantee(subscription: Subscription): void;
132
- forget(subscription: Subscription): void;
133
- startGuaranteeing(): void;
134
- stopGuaranteeing(): void;
135
- retrySubscribing(): void;
136
- }
137
-
138
- declare class Subscriptions {
139
- consumer: Consumer;
140
- guarantor: SubscriptionGuarantor;
141
- subscriptions: Array<Subscription>;
142
- constructor(consumer: Consumer);
143
- create(channelName: string, mixin: Data): Subscription;
144
- add(subscription: Subscription): Subscription;
145
- remove(subscription: Subscription): Subscription;
146
- reject(identifier: string): Subscription[];
147
- forget(subscription: Subscription): Subscription;
148
- findAll(identifier: string): Subscription[];
149
- reload(): void[];
150
- notifyAll(callbackName: string, ...args: any[]): any[][];
151
- notify(subscription: Subscription, callbackName: string, ...args: any[]): any[];
152
- subscribe(subscription: Subscription): void;
153
- confirmSubscription(identifier: string): void;
154
- sendCommand(subscription: Subscription, command: string): boolean;
155
- }
156
-
157
- declare class Consumer {
158
- _url: string;
159
- subscriptions: Subscriptions;
160
- connection: Connection;
161
- subprotocols: Array<string>;
162
- constructor(url: string);
163
- get url(): string;
164
- send(data: object): boolean;
165
- connect(): boolean;
166
- disconnect(): any;
167
- ensureActiveConnection(): boolean | undefined;
168
- addSubProtocol(subprotocol: string): void;
169
- }
170
-
171
96
  type RequestResult = FetchResult$1<{
172
97
  [key: string]: unknown;
173
98
  }, Record<string, unknown>, Record<string, unknown>>;
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ApolloLink, ApolloClient } from '@apollo/client/index.js';
2
2
  export { InMemoryCache, gql, useMutation, useQuery, useSubscription } from '@apollo/client/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-CGUaoxuA.js';
4
- export { L as LocalStorage, M as MemoryStorage, O as Observable, b as Storage, c as cdnBase, f as endpointWebsockets } from './SubscriptionLink-client-CGUaoxuA.js';
3
+ import { G as GlobalStorage, e as endpointGraphQL, v as version, d as debugging, S as SubscriptionLink, a as endpointAuth } from './SubscriptionLink-client-C-9ecaeZ.js';
4
+ export { L as LocalStorage, M as MemoryStorage, O as Observable, b as Storage, c as cdnBase, f as endpointWebsockets } from './SubscriptionLink-client-C-9ecaeZ.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';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quiltt/core",
3
- "version": "3.6.12",
3
+ "version": "3.6.13",
4
4
  "description": "Javascript API client and utilities for Quiltt",
5
5
  "keywords": [
6
6
  "quiltt",
@@ -34,6 +34,7 @@
34
34
  ],
35
35
  "dependencies": {
36
36
  "@apollo/client": "^3.9.9",
37
+ "@rails/actioncable": "^7.1.3-4",
37
38
  "cross-fetch": "^4.0.0",
38
39
  "graphql": "^16.9.0",
39
40
  "graphql-ruby-client": "^1.14.0"
@@ -41,6 +42,7 @@
41
42
  "devDependencies": {
42
43
  "@biomejs/biome": "1.8.3",
43
44
  "@types/node": "20.14.10",
45
+ "@types/rails__actioncable": "6.1.11",
44
46
  "@types/react": "18.3.3",
45
47
  "bunchee": "5.2.2",
46
48
  "rimraf": "6.0.0",
@@ -1,10 +1,11 @@
1
- import { GlobalStorage } from '@/storage'
2
1
  import type { FetchResult, NextLink, Operation } from '@apollo/client/core/index.js'
3
2
  import { ApolloLink, Observable } from '@apollo/client/core/index.js'
3
+ import { createConsumer } from '@rails/actioncable'
4
+ import type { Consumer } from '@rails/actioncable'
4
5
  import { print } from 'graphql'
5
- import { endpointWebsockets } from '../../../configuration'
6
- import type { Consumer } from './actioncable'
7
- import { createConsumer } from './actioncable'
6
+
7
+ import { endpointWebsockets } from '@/configuration'
8
+ import { GlobalStorage } from '@/storage'
8
9
 
9
10
  type RequestResult = FetchResult<
10
11
  { [key: string]: unknown },
@@ -1,11 +1,11 @@
1
1
  import { BatchHttpLink as ApolloHttpLink } from '@apollo/client/link/batch-http/index.js'
2
2
  import crossfetch from 'cross-fetch'
3
3
 
4
+ import { endpointGraphQL } from '@/configuration'
5
+
4
6
  // Use `cross-fetch` only if `fetch` is not available on the `globalThis` object
5
7
  const effectiveFetch = typeof fetch === 'undefined' ? crossfetch : fetch
6
8
 
7
- import { endpointGraphQL } from '../../../configuration'
8
-
9
9
  export const BatchHttpLink = new ApolloHttpLink({
10
10
  uri: endpointGraphQL,
11
11
  fetch: effectiveFetch,
@@ -4,7 +4,7 @@ import crossfetch from 'cross-fetch'
4
4
  // Use `cross-fetch` only if `fetch` is not available on the `globalThis` object
5
5
  const effectiveFetch = typeof fetch === 'undefined' ? crossfetch : fetch
6
6
 
7
- import { endpointGraphQL } from '../../../configuration'
7
+ import { endpointGraphQL } from '@/configuration'
8
8
 
9
9
  export const HttpLink = new ApolloHttpLink({
10
10
  uri: endpointGraphQL,
@@ -1,6 +1,6 @@
1
1
  import { ApolloLink } from '@apollo/client/index.js'
2
2
 
3
- import { version } from '../../../configuration'
3
+ import { version } from '@/configuration'
4
4
 
5
5
  export const VersionLink = new ApolloLink((operation, forward) => {
6
6
  operation.setContext(({ headers = {} }) => ({