@koolbase/react-native 12.13.1 → 12.14.0
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/cjs/index.d.ts +2 -1
- package/dist/cjs/index.js +13 -1
- package/dist/cjs/platform.js +6 -0
- package/dist/esm/index.d.ts +2 -1
- package/dist/esm/index.js +14 -2
- package/dist/esm/platform.js +6 -0
- package/package.json +2 -2
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from '@koolbase/core';
|
|
2
2
|
export { reactNativePlatform } from './platform.js';
|
|
3
|
-
import { KoolbaseAuth, KoolbaseDatabase, KoolbaseFiscal, KoolbaseStorage, KoolbaseRealtime, KoolbaseFunctions, KoolbaseAnalytics, KoolbaseMessaging, type KoolbaseConfig, type VersionCheckResult } from '@koolbase/core';
|
|
3
|
+
import { KoolbaseAuth, KoolbaseDatabase, KoolbaseFiscal, KoolbaseStorage, KoolbaseRealtime, KoolbaseFunctions, KoolbaseConnectivity, KoolbaseAnalytics, KoolbaseMessaging, type KoolbaseConfig, type VersionCheckResult } from '@koolbase/core';
|
|
4
4
|
export declare const Koolbase: {
|
|
5
5
|
initialize(config: KoolbaseConfig): Promise<void>;
|
|
6
6
|
readonly auth: KoolbaseAuth;
|
|
@@ -8,6 +8,7 @@ export declare const Koolbase: {
|
|
|
8
8
|
readonly storage: KoolbaseStorage;
|
|
9
9
|
readonly fiscal: KoolbaseFiscal;
|
|
10
10
|
readonly realtime: KoolbaseRealtime;
|
|
11
|
+
readonly connectivity: KoolbaseConnectivity;
|
|
11
12
|
readonly functions: KoolbaseFunctions;
|
|
12
13
|
isEnabled(key: string): boolean;
|
|
13
14
|
configString(key: string, fallback?: string): string;
|
package/dist/cjs/index.js
CHANGED
|
@@ -33,6 +33,7 @@ let _db = null;
|
|
|
33
33
|
let _storage = null;
|
|
34
34
|
let _fiscal = null;
|
|
35
35
|
let _realtime = null;
|
|
36
|
+
let _connectivity = null;
|
|
36
37
|
let _functions = null;
|
|
37
38
|
let _flags = null;
|
|
38
39
|
let _analytics = null;
|
|
@@ -78,7 +79,14 @@ exports.Koolbase = {
|
|
|
78
79
|
_realtime = new core_1.KoolbaseRealtime(config, () => _auth?.validAccessToken() ?? Promise.resolve(null), () => _auth?.currentUser?.id ?? null);
|
|
79
80
|
// Signed in, signed out, another user: the realtime connection is
|
|
80
81
|
// replaced to match (signed out, collections anyone can read only).
|
|
81
|
-
_auth?.onAuthStateChange(() =>
|
|
82
|
+
_auth?.onAuthStateChange(() => {
|
|
83
|
+
_realtime?.sessionChanged();
|
|
84
|
+
// Pending writes and conflicts are per-user: watchers read again.
|
|
85
|
+
_db?.sessionChanged();
|
|
86
|
+
});
|
|
87
|
+
// Whether the device reports a connection: unknown until it first answers.
|
|
88
|
+
_connectivity = new core_1.KoolbaseConnectivity();
|
|
89
|
+
_connectivity.start();
|
|
82
90
|
_functions = new core_1.KoolbaseFunctions(config, () => _auth?.validAccessToken() ?? Promise.resolve(null), async () => { await _auth?.clearStoredSession(); });
|
|
83
91
|
// One anonymous device id for the whole SDK — bucketing (flags), targeting
|
|
84
92
|
// (code push), and registration keying (messaging) must all agree on it.
|
|
@@ -129,6 +137,10 @@ exports.Koolbase = {
|
|
|
129
137
|
ensureInitialized();
|
|
130
138
|
return _realtime;
|
|
131
139
|
},
|
|
140
|
+
get connectivity() {
|
|
141
|
+
ensureInitialized();
|
|
142
|
+
return _connectivity;
|
|
143
|
+
},
|
|
132
144
|
get functions() {
|
|
133
145
|
ensureInitialized();
|
|
134
146
|
return _functions;
|
package/dist/cjs/platform.js
CHANGED
|
@@ -21,6 +21,12 @@ function reactNativePlatform() {
|
|
|
21
21
|
getAllKeys: async () => Array.from(await async_storage_1.default.getAllKeys()),
|
|
22
22
|
},
|
|
23
23
|
network: {
|
|
24
|
+
current: async () => {
|
|
25
|
+
const state = await netinfo_1.default.fetch();
|
|
26
|
+
if (state.isConnected === null || state.isConnected === undefined)
|
|
27
|
+
return null;
|
|
28
|
+
return Boolean(state.isConnected) && state.isInternetReachable !== false;
|
|
29
|
+
},
|
|
24
30
|
onChange: (cb) => netinfo_1.default.addEventListener(state => {
|
|
25
31
|
cb(Boolean(state.isConnected) && state.isInternetReachable !== false);
|
|
26
32
|
}),
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from '@koolbase/core';
|
|
2
2
|
export { reactNativePlatform } from './platform.js';
|
|
3
|
-
import { KoolbaseAuth, KoolbaseDatabase, KoolbaseFiscal, KoolbaseStorage, KoolbaseRealtime, KoolbaseFunctions, KoolbaseAnalytics, KoolbaseMessaging, type KoolbaseConfig, type VersionCheckResult } from '@koolbase/core';
|
|
3
|
+
import { KoolbaseAuth, KoolbaseDatabase, KoolbaseFiscal, KoolbaseStorage, KoolbaseRealtime, KoolbaseFunctions, KoolbaseConnectivity, KoolbaseAnalytics, KoolbaseMessaging, type KoolbaseConfig, type VersionCheckResult } from '@koolbase/core';
|
|
4
4
|
export declare const Koolbase: {
|
|
5
5
|
initialize(config: KoolbaseConfig): Promise<void>;
|
|
6
6
|
readonly auth: KoolbaseAuth;
|
|
@@ -8,6 +8,7 @@ export declare const Koolbase: {
|
|
|
8
8
|
readonly storage: KoolbaseStorage;
|
|
9
9
|
readonly fiscal: KoolbaseFiscal;
|
|
10
10
|
readonly realtime: KoolbaseRealtime;
|
|
11
|
+
readonly connectivity: KoolbaseConnectivity;
|
|
11
12
|
readonly functions: KoolbaseFunctions;
|
|
12
13
|
isEnabled(key: string): boolean;
|
|
13
14
|
configString(key: string, fallback?: string): string;
|
package/dist/esm/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import { Platform } from 'react-native';
|
|
|
7
7
|
// React Native platform adapter and keychain-backed session storage.
|
|
8
8
|
export * from '@koolbase/core';
|
|
9
9
|
export { reactNativePlatform } from './platform.js';
|
|
10
|
-
import { KoolbaseAuth, KoolbaseDatabase, KoolbaseFiscal, KoolbaseStorage, KoolbaseRealtime, KoolbaseFunctions, KoolbaseFlags, KoolbaseAnalytics, disabledAnalytics, KoolbaseMessaging, getOrCreateDeviceId, setPlatform, } from '@koolbase/core';
|
|
10
|
+
import { KoolbaseAuth, KoolbaseDatabase, KoolbaseFiscal, KoolbaseStorage, KoolbaseRealtime, KoolbaseFunctions, KoolbaseConnectivity, KoolbaseFlags, KoolbaseAnalytics, disabledAnalytics, KoolbaseMessaging, getOrCreateDeviceId, setPlatform, } from '@koolbase/core';
|
|
11
11
|
import { reactNativePlatform } from './platform.js';
|
|
12
12
|
import { createUseCollection, createUseRecord } from '@koolbase/core/react';
|
|
13
13
|
let _auth = null;
|
|
@@ -15,6 +15,7 @@ let _db = null;
|
|
|
15
15
|
let _storage = null;
|
|
16
16
|
let _fiscal = null;
|
|
17
17
|
let _realtime = null;
|
|
18
|
+
let _connectivity = null;
|
|
18
19
|
let _functions = null;
|
|
19
20
|
let _flags = null;
|
|
20
21
|
let _analytics = null;
|
|
@@ -60,7 +61,14 @@ export const Koolbase = {
|
|
|
60
61
|
_realtime = new KoolbaseRealtime(config, () => _auth?.validAccessToken() ?? Promise.resolve(null), () => _auth?.currentUser?.id ?? null);
|
|
61
62
|
// Signed in, signed out, another user: the realtime connection is
|
|
62
63
|
// replaced to match (signed out, collections anyone can read only).
|
|
63
|
-
_auth?.onAuthStateChange(() =>
|
|
64
|
+
_auth?.onAuthStateChange(() => {
|
|
65
|
+
_realtime?.sessionChanged();
|
|
66
|
+
// Pending writes and conflicts are per-user: watchers read again.
|
|
67
|
+
_db?.sessionChanged();
|
|
68
|
+
});
|
|
69
|
+
// Whether the device reports a connection: unknown until it first answers.
|
|
70
|
+
_connectivity = new KoolbaseConnectivity();
|
|
71
|
+
_connectivity.start();
|
|
64
72
|
_functions = new KoolbaseFunctions(config, () => _auth?.validAccessToken() ?? Promise.resolve(null), async () => { await _auth?.clearStoredSession(); });
|
|
65
73
|
// One anonymous device id for the whole SDK — bucketing (flags), targeting
|
|
66
74
|
// (code push), and registration keying (messaging) must all agree on it.
|
|
@@ -111,6 +119,10 @@ export const Koolbase = {
|
|
|
111
119
|
ensureInitialized();
|
|
112
120
|
return _realtime;
|
|
113
121
|
},
|
|
122
|
+
get connectivity() {
|
|
123
|
+
ensureInitialized();
|
|
124
|
+
return _connectivity;
|
|
125
|
+
},
|
|
114
126
|
get functions() {
|
|
115
127
|
ensureInitialized();
|
|
116
128
|
return _functions;
|
package/dist/esm/platform.js
CHANGED
|
@@ -15,6 +15,12 @@ export function reactNativePlatform() {
|
|
|
15
15
|
getAllKeys: async () => Array.from(await AsyncStorage.getAllKeys()),
|
|
16
16
|
},
|
|
17
17
|
network: {
|
|
18
|
+
current: async () => {
|
|
19
|
+
const state = await NetInfo.fetch();
|
|
20
|
+
if (state.isConnected === null || state.isConnected === undefined)
|
|
21
|
+
return null;
|
|
22
|
+
return Boolean(state.isConnected) && state.isInternetReachable !== false;
|
|
23
|
+
},
|
|
18
24
|
onChange: (cb) => NetInfo.addEventListener(state => {
|
|
19
25
|
cb(Boolean(state.isConnected) && state.isInternetReachable !== false);
|
|
20
26
|
}),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@koolbase/react-native",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.14.0",
|
|
4
4
|
"description": "React Native SDK for Koolbase \u2014 auth, database, storage, realtime, feature flags, and functions in one package.",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"types": "./dist/esm/index.d.ts",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"url": "https://github.com/koolbase/koolbase-react-native"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@koolbase/core": "12.
|
|
27
|
+
"@koolbase/core": "12.14.0"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"@react-native-async-storage/async-storage": "^2.2.0 || ^3.0.2",
|