@quiltt/core 3.6.0 → 3.6.2
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 +12 -0
- package/dist/{SubscriptionLink-client-Bf6n9gzT.js → SubscriptionLink-client-KnrzzvDN.js} +27 -32
- package/dist/{index-client-C87sSU05.js → index-client-DrtC68Ap.js} +1 -1
- package/dist/index.d.ts +2 -12
- package/dist/index.js +2 -2
- package/package.json +1 -1
- package/src/api/graphql/links/actioncable/README.md +1 -0
- package/src/configuration.ts +20 -31
- package/src/storage/Local.ts +5 -3
- package/src/types.ts +0 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @quiltt/core
|
|
2
2
|
|
|
3
|
+
## 3.6.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#236](https://github.com/quiltt/quiltt-js/pull/236) [`85c0be1`](https://github.com/quiltt/quiltt-js/commit/85c0be16803381de5dbd89a7295e326228542080) Thanks [@zubairaziz](https://github.com/zubairaziz)! - Fix config loading
|
|
8
|
+
|
|
9
|
+
## 3.6.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#232](https://github.com/quiltt/quiltt-js/pull/232) [`7a119af`](https://github.com/quiltt/quiltt-js/commit/7a119af8b0ba826b8df81f5eb242c002379b4e56) Thanks [@sirwolfgang](https://github.com/sirwolfgang)! - Improve typeof checks for mobile environments
|
|
14
|
+
|
|
3
15
|
## 3.6.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { ApolloLink, Observable as Observable$1 } from '@apollo/client/core/index.js';
|
|
3
3
|
import { print } from 'graphql';
|
|
4
|
-
import { c as createConsumer } from './index-client-
|
|
4
|
+
import { c as createConsumer } from './index-client-DrtC68Ap.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* An error and type safe wrapper for localStorage.
|
|
@@ -22,7 +22,7 @@ import { c as createConsumer } from './index-client-C87sSU05.js';
|
|
|
22
22
|
};
|
|
23
23
|
this.isDisabled = ()=>!this.isEnabled();
|
|
24
24
|
this.get = (key)=>{
|
|
25
|
-
if (typeof window === 'undefined' ||
|
|
25
|
+
if (typeof window === 'undefined' || typeof window.localStorage === 'undefined') return undefined;
|
|
26
26
|
try {
|
|
27
27
|
const state = window.localStorage.getItem(`quiltt.${key}`);
|
|
28
28
|
return state ? JSON.parse(state) : state;
|
|
@@ -32,7 +32,7 @@ import { c as createConsumer } from './index-client-C87sSU05.js';
|
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
34
|
this.set = (key, state)=>{
|
|
35
|
-
if (typeof window === 'undefined' ||
|
|
35
|
+
if (typeof window === 'undefined' || typeof window.localStorage === 'undefined') return;
|
|
36
36
|
try {
|
|
37
37
|
if (state) {
|
|
38
38
|
window.localStorage.setItem(`quiltt.${key}`, JSON.stringify(state));
|
|
@@ -44,6 +44,7 @@ import { c as createConsumer } from './index-client-C87sSU05.js';
|
|
|
44
44
|
}
|
|
45
45
|
};
|
|
46
46
|
this.remove = (key)=>{
|
|
47
|
+
if (typeof window === 'undefined' || typeof window.localStorage === 'undefined') return;
|
|
47
48
|
try {
|
|
48
49
|
window.localStorage.removeItem(`quiltt.${key}`);
|
|
49
50
|
} catch (error) {
|
|
@@ -71,7 +72,7 @@ import { c as createConsumer } from './index-client-C87sSU05.js';
|
|
|
71
72
|
});
|
|
72
73
|
}
|
|
73
74
|
};
|
|
74
|
-
if (typeof window !== 'undefined' &&
|
|
75
|
+
if (typeof window !== 'undefined' && typeof window.addEventListener !== 'undefined') {
|
|
75
76
|
window.addEventListener('storage', this.handleStorageEvent.bind(this));
|
|
76
77
|
}
|
|
77
78
|
}
|
|
@@ -203,38 +204,32 @@ import { c as createConsumer } from './index-client-C87sSU05.js';
|
|
|
203
204
|
*/ const GlobalStorage = new Storage();
|
|
204
205
|
|
|
205
206
|
var name = "@quiltt/core";
|
|
206
|
-
var version$1 = "3.6.
|
|
207
|
+
var version$1 = "3.6.2";
|
|
207
208
|
|
|
208
|
-
|
|
209
|
-
* Retrieves the environment variable by key, with fallback and type conversion,
|
|
210
|
-
* supporting Node.js, Vite, and potentially other runtime environments.
|
|
211
|
-
*/ const getEnv = (key, fallback = undefined)=>{
|
|
209
|
+
const QUILTT_API_INSECURE = (()=>{
|
|
212
210
|
try {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
if (typeof process !== 'undefined' && process.env) {
|
|
216
|
-
value = process.env[key];
|
|
217
|
-
}
|
|
218
|
-
// Return the value after type conversion if necessary or use fallback
|
|
219
|
-
if (value === undefined || value === null) {
|
|
220
|
-
return fallback;
|
|
221
|
-
}
|
|
222
|
-
// Convert to boolean if the value is 'true' or 'false'
|
|
223
|
-
if (value === 'true' || value === 'false') {
|
|
224
|
-
return value === 'true';
|
|
211
|
+
if (process.env.QUILTT_API_INSECURE === 'true' || process.env.QUILTT_API_INSECURE === 'false') {
|
|
212
|
+
return process.env.QUILTT_API_INSECURE === 'true';
|
|
225
213
|
}
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
return Number(value);
|
|
229
|
-
}
|
|
230
|
-
return value;
|
|
231
|
-
} catch (error) {
|
|
214
|
+
return process.env.QUILTT_API_INSECURE;
|
|
215
|
+
} catch {
|
|
232
216
|
return undefined;
|
|
233
217
|
}
|
|
234
|
-
};
|
|
235
|
-
const
|
|
236
|
-
|
|
237
|
-
|
|
218
|
+
})();
|
|
219
|
+
const QUILTT_API_DOMAIN = (()=>{
|
|
220
|
+
try {
|
|
221
|
+
return process.env.QUILTT_API_DOMAIN;
|
|
222
|
+
} catch {
|
|
223
|
+
return undefined;
|
|
224
|
+
}
|
|
225
|
+
})();
|
|
226
|
+
const QUILTT_DEBUG = (()=>{
|
|
227
|
+
try {
|
|
228
|
+
return !!process.env.QUILTT_DEBUG || process.env.NODE_ENV !== 'production';
|
|
229
|
+
} catch {
|
|
230
|
+
return false;
|
|
231
|
+
}
|
|
232
|
+
})();
|
|
238
233
|
const domain = QUILTT_API_DOMAIN || 'quiltt.io';
|
|
239
234
|
const protocolHttp = `http${QUILTT_API_INSECURE ? '' : 's'}`;
|
|
240
235
|
const protocolWebsockets = `ws${QUILTT_API_INSECURE ? '' : 's'}`;
|
|
@@ -306,4 +301,4 @@ class SubscriptionLink extends ActionCableLink {
|
|
|
306
301
|
}
|
|
307
302
|
}
|
|
308
303
|
|
|
309
|
-
export { GlobalStorage as G, LocalStorage as L, MemoryStorage as M, Observable as O, SubscriptionLink as S, endpointAuth as a, Storage as b, cdnBase as c, debugging as d, endpointGraphQL as e, endpointWebsockets as f,
|
|
304
|
+
export { GlobalStorage as G, LocalStorage as L, MemoryStorage as M, Observable as O, SubscriptionLink as S, endpointAuth as a, Storage as b, cdnBase as c, debugging as d, endpointGraphQL as e, endpointWebsockets as f, version as v };
|
package/dist/index.d.ts
CHANGED
|
@@ -301,11 +301,6 @@ type DeepPartial<T> = T extends object ? {
|
|
|
301
301
|
type DeepReadonly<T> = T extends object ? {
|
|
302
302
|
[P in keyof T]: DeepReadonly<T[P]>;
|
|
303
303
|
} : T;
|
|
304
|
-
declare global {
|
|
305
|
-
interface Window {
|
|
306
|
-
expo: any;
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
304
|
|
|
310
305
|
type Observer<T> = Dispatch<SetStateAction<Maybe<T> | undefined>>;
|
|
311
306
|
/**
|
|
@@ -400,12 +395,7 @@ declare class Storage<T> {
|
|
|
400
395
|
*/
|
|
401
396
|
declare const GlobalStorage: Storage<any>;
|
|
402
397
|
|
|
403
|
-
|
|
404
|
-
* Retrieves the environment variable by key, with fallback and type conversion,
|
|
405
|
-
* supporting Node.js, Vite, and potentially other runtime environments.
|
|
406
|
-
*/
|
|
407
|
-
declare const getEnv: (key: string, fallback?: any) => any;
|
|
408
|
-
declare const debugging: any;
|
|
398
|
+
declare const debugging: boolean;
|
|
409
399
|
declare const version: string;
|
|
410
400
|
declare const cdnBase: string;
|
|
411
401
|
declare const endpointAuth: string;
|
|
@@ -448,4 +438,4 @@ declare class Timeoutable {
|
|
|
448
438
|
private broadcast;
|
|
449
439
|
}
|
|
450
440
|
|
|
451
|
-
export { AuthAPI, AuthLink, AuthStrategies, BatchHttpLink, type Claims, type ConnectorSDK, type ConnectorSDKCallbackMetadata, type ConnectorSDKCallbacks, type ConnectorSDKConnectOptions, type ConnectorSDKConnector, type ConnectorSDKConnectorOptions, ConnectorSDKEventType, type ConnectorSDKOnEventCallback, type ConnectorSDKOnEventExitCallback, type ConnectorSDKOnExitAbortCallback, type ConnectorSDKOnExitErrorCallback, type ConnectorSDKOnExitSuccessCallback, type ConnectorSDKOnLoadCallback, type ConnectorSDKReconnectOptions, type DeepPartial, type DeepReadonly, ErrorLink, type Exact, ForwardableLink, GlobalStorage, HttpLink, type InputMaybe, type JsonWebToken, JsonWebTokenParse, LocalStorage, type MakeMaybe, type MakeOptional, type Maybe, MemoryStorage, type Mutable, type Nullable, Observable, type Observer, type PasscodePayload, type PrivateClaims, QuilttClient, type QuilttClientOptions, type QuilttJWT, type RegisteredClaims, RetryLink, type SessionResponse, Storage, SubscriptionLink, TerminatingLink, Timeoutable, type UnprocessableData, type UnprocessableResponse, type UsernamePayload, VersionLink, cdnBase, debugging, endpointAuth, endpointGraphQL, endpointWebsockets,
|
|
441
|
+
export { AuthAPI, AuthLink, AuthStrategies, BatchHttpLink, type Claims, type ConnectorSDK, type ConnectorSDKCallbackMetadata, type ConnectorSDKCallbacks, type ConnectorSDKConnectOptions, type ConnectorSDKConnector, type ConnectorSDKConnectorOptions, ConnectorSDKEventType, type ConnectorSDKOnEventCallback, type ConnectorSDKOnEventExitCallback, type ConnectorSDKOnExitAbortCallback, type ConnectorSDKOnExitErrorCallback, type ConnectorSDKOnExitSuccessCallback, type ConnectorSDKOnLoadCallback, type ConnectorSDKReconnectOptions, type DeepPartial, type DeepReadonly, ErrorLink, type Exact, ForwardableLink, GlobalStorage, HttpLink, type InputMaybe, type JsonWebToken, JsonWebTokenParse, LocalStorage, type MakeMaybe, type MakeOptional, type Maybe, MemoryStorage, type Mutable, type Nullable, Observable, type Observer, type PasscodePayload, type PrivateClaims, QuilttClient, type QuilttClientOptions, type QuilttJWT, type RegisteredClaims, RetryLink, type SessionResponse, Storage, SubscriptionLink, TerminatingLink, Timeoutable, type UnprocessableData, type UnprocessableResponse, type UsernamePayload, VersionLink, cdnBase, debugging, endpointAuth, endpointGraphQL, endpointWebsockets, version };
|
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-
|
|
4
|
-
export { L as LocalStorage, M as MemoryStorage, O as Observable, b as Storage, c as cdnBase, f as endpointWebsockets
|
|
3
|
+
import { G as GlobalStorage, e as endpointGraphQL, v as version, d as debugging, S as SubscriptionLink, a as endpointAuth } from './SubscriptionLink-client-KnrzzvDN.js';
|
|
4
|
+
export { L as LocalStorage, M as MemoryStorage, O as Observable, b as Storage, c as cdnBase, f as endpointWebsockets } from './SubscriptionLink-client-KnrzzvDN.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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
This is a patched version of @rails/actioncable now that https://github.com/rails/rails/pull/47939 has been merged in and released.
|
package/src/configuration.ts
CHANGED
|
@@ -1,42 +1,31 @@
|
|
|
1
1
|
import { name as packageName, version as packageVersion } from '../package.json'
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
* Retrieves the environment variable by key, with fallback and type conversion,
|
|
5
|
-
* supporting Node.js, Vite, and potentially other runtime environments.
|
|
6
|
-
*/
|
|
7
|
-
export const getEnv = (key: string, fallback: any = undefined): any => {
|
|
3
|
+
const QUILTT_API_INSECURE = (() => {
|
|
8
4
|
try {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
// Check if running under Node.js and use process.env
|
|
12
|
-
if (typeof process !== 'undefined' && process.env) {
|
|
13
|
-
value = process.env[key]
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
// Return the value after type conversion if necessary or use fallback
|
|
17
|
-
if (value === undefined || value === null) {
|
|
18
|
-
return fallback
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
// Convert to boolean if the value is 'true' or 'false'
|
|
22
|
-
if (value === 'true' || value === 'false') {
|
|
23
|
-
return value === 'true'
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// Convert to number if it's numeric
|
|
27
|
-
if (!isNaN(Number(value))) {
|
|
28
|
-
return Number(value)
|
|
5
|
+
if (process.env.QUILTT_API_INSECURE === 'true' || process.env.QUILTT_API_INSECURE === 'false') {
|
|
6
|
+
return process.env.QUILTT_API_INSECURE === 'true'
|
|
29
7
|
}
|
|
8
|
+
return process.env.QUILTT_API_INSECURE
|
|
9
|
+
} catch {
|
|
10
|
+
return undefined
|
|
11
|
+
}
|
|
12
|
+
})()
|
|
30
13
|
|
|
31
|
-
|
|
32
|
-
|
|
14
|
+
const QUILTT_API_DOMAIN = (() => {
|
|
15
|
+
try {
|
|
16
|
+
return process.env.QUILTT_API_DOMAIN
|
|
17
|
+
} catch {
|
|
33
18
|
return undefined
|
|
34
19
|
}
|
|
35
|
-
}
|
|
20
|
+
})()
|
|
36
21
|
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
22
|
+
const QUILTT_DEBUG = (() => {
|
|
23
|
+
try {
|
|
24
|
+
return !!process.env.QUILTT_DEBUG || process.env.NODE_ENV !== 'production'
|
|
25
|
+
} catch {
|
|
26
|
+
return false
|
|
27
|
+
}
|
|
28
|
+
})()
|
|
40
29
|
|
|
41
30
|
const domain = QUILTT_API_DOMAIN || 'quiltt.io'
|
|
42
31
|
const protocolHttp = `http${QUILTT_API_INSECURE ? '' : 's'}`
|
package/src/storage/Local.ts
CHANGED
|
@@ -11,7 +11,7 @@ export class LocalStorage<T> {
|
|
|
11
11
|
private observers: { [key: string]: Observer<T>[] } = {}
|
|
12
12
|
|
|
13
13
|
constructor() {
|
|
14
|
-
if (typeof window !== 'undefined' &&
|
|
14
|
+
if (typeof window !== 'undefined' && typeof window.addEventListener !== 'undefined') {
|
|
15
15
|
window.addEventListener('storage', this.handleStorageEvent.bind(this))
|
|
16
16
|
}
|
|
17
17
|
}
|
|
@@ -29,7 +29,7 @@ export class LocalStorage<T> {
|
|
|
29
29
|
isDisabled = (): boolean => !this.isEnabled()
|
|
30
30
|
|
|
31
31
|
get = (key: string): Maybe<T> | undefined => {
|
|
32
|
-
if (typeof window === 'undefined' ||
|
|
32
|
+
if (typeof window === 'undefined' || typeof window.localStorage === 'undefined') return undefined
|
|
33
33
|
|
|
34
34
|
try {
|
|
35
35
|
const state = window.localStorage.getItem(`quiltt.${key}`)
|
|
@@ -41,7 +41,7 @@ export class LocalStorage<T> {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
set = (key: string, state: Maybe<T> | undefined): void => {
|
|
44
|
-
if (typeof window === 'undefined' ||
|
|
44
|
+
if (typeof window === 'undefined' || typeof window.localStorage === 'undefined') return
|
|
45
45
|
|
|
46
46
|
try {
|
|
47
47
|
if (state) {
|
|
@@ -55,6 +55,8 @@ export class LocalStorage<T> {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
remove = (key: string) => {
|
|
58
|
+
if (typeof window === 'undefined' || typeof window.localStorage === 'undefined') return
|
|
59
|
+
|
|
58
60
|
try {
|
|
59
61
|
window.localStorage.removeItem(`quiltt.${key}`)
|
|
60
62
|
} catch (error) {
|
package/src/types.ts
CHANGED
|
@@ -8,8 +8,3 @@ export type Nullable<T> = { [K in keyof T]: T[K] | null }
|
|
|
8
8
|
export type Mutable<Type> = { -readonly [Key in keyof Type]: Type[Key] }
|
|
9
9
|
export type DeepPartial<T> = T extends object ? { [P in keyof T]?: DeepPartial<T[P]> } : T
|
|
10
10
|
export type DeepReadonly<T> = T extends object ? { [P in keyof T]: DeepReadonly<T[P]> } : T
|
|
11
|
-
declare global {
|
|
12
|
-
interface Window {
|
|
13
|
-
expo: any
|
|
14
|
-
}
|
|
15
|
-
}
|