@quiltt/core 3.6.11 → 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,17 @@
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
+
9
+ ## 3.6.12
10
+
11
+ ### Patch Changes
12
+
13
+ - [#274](https://github.com/quiltt/quiltt-js/pull/274) [`d684ade`](https://github.com/quiltt/quiltt-js/commit/d684ade520689d6207c699cea0681a9331f06069) Thanks [@zubairaziz](https://github.com/zubairaziz)! - Update 'rol' types in PrivateClaims
14
+
3
15
  ## 3.6.11
4
16
 
5
17
  ### 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-1u-DL-7m.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-1u-DL-7m.js';
203
203
  */ const GlobalStorage = new Storage();
204
204
 
205
205
  var name = "@quiltt/core";
206
- var version$1 = "3.6.11";
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>>;
@@ -402,7 +327,6 @@ declare const endpointAuth: string;
402
327
  declare const endpointGraphQL: string;
403
328
  declare const endpointWebsockets: string;
404
329
 
405
- type AdminRole = 'manager' | 'core' | 'basic';
406
330
  type RegisteredClaims = {
407
331
  iss: string;
408
332
  sub: string;
@@ -418,7 +342,7 @@ type PrivateClaims = {
418
342
  cid: string;
419
343
  aid: string;
420
344
  ver: number;
421
- rol: AdminRole;
345
+ rol: 'basic' | 'core' | 'manager' | 'super-admin';
422
346
  };
423
347
  type Claims<T> = RegisteredClaims & T;
424
348
  type JsonWebToken<T> = {
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-Be2B_Wkn.js';
4
- export { L as LocalStorage, M as MemoryStorage, O as Observable, b as Storage, c as cdnBase, f as endpointWebsockets } from './SubscriptionLink-client-Be2B_Wkn.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.11",
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,7 +1,5 @@
1
1
  import type { Maybe } from './types'
2
2
 
3
- type AdminRole = 'manager' | 'core' | 'basic'
4
-
5
3
  export type RegisteredClaims = {
6
4
  iss: string // (issuer): Issuer of the JWT
7
5
  sub: string // (subject): Subject of the JWT (Person ID)
@@ -18,7 +16,7 @@ export type PrivateClaims = {
18
16
  cid: string // Client ID
19
17
  aid: string // Administrator ID
20
18
  ver: number // Session Token Version
21
- rol: AdminRole // Administrator Role
19
+ rol: 'basic' | 'core' | 'manager' | 'super-admin' // Administrator Role
22
20
  }
23
21
 
24
22
  export type Claims<T> = RegisteredClaims & T
@@ -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 = {} }) => ({