@koolbase/js 12.37.0 → 12.38.1
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 +7 -0
- package/dist/cjs/index.d.ts +19 -1
- package/dist/cjs/index.js +41 -0
- package/dist/esm/index.d.ts +19 -1
- package/dist/esm/index.js +42 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,13 @@ is based on [Keep a Changelog][kac], and this project adheres to
|
|
|
7
7
|
[kac]: https://keepachangelog.com/en/1.1.0/
|
|
8
8
|
[semver]: https://semver.org/
|
|
9
9
|
|
|
10
|
+
## 12.38.1
|
|
11
|
+
|
|
12
|
+
A shown record follows the app's own writes (R125). Same contract as koolbase_flutter 12.52.7.
|
|
13
|
+
|
|
14
|
+
- **`useRecord` / `KoolbaseRecordController`**: after the app updates the record -- or anything in its collection -- it shows the device's saved copy at once (which holds the change, made online or queued offline), then the server's, without `refreshing`. Before, a shown record kept its old values until the screen was opened again.
|
|
15
|
+
- **An offline `update`** now tells what shows its collection, as an online one does.
|
|
16
|
+
|
|
10
17
|
## 12.33.0
|
|
11
18
|
|
|
12
19
|
Search by meaning takes the typed filter (#173). Same contract as koolbase_flutter 12.43.0.
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,9 +1,27 @@
|
|
|
1
1
|
export * from '@koolbase/core';
|
|
2
2
|
export { BrowserAuthStorage } from './auth-storage.js';
|
|
3
3
|
export { browserPlatform } from './platform.js';
|
|
4
|
-
import { KoolbaseAuth, KoolbaseDatabase, KoolbaseFiscal, KoolbaseStorage, KoolbaseRealtime, KoolbaseFunctions, KoolbaseConnectivity, KoolbaseAnalytics, type KoolbaseConfig, type VersionCheckResult } from '@koolbase/core';
|
|
4
|
+
import { KoolbaseAuth, KoolbaseDatabase, KoolbaseFiscal, KoolbaseStorage, KoolbaseRealtime, KoolbaseFunctions, KoolbaseConnectivity, KoolbaseAnalytics, type KoolbaseConfig, type VersionCheckResult, type FetchLike } from '@koolbase/core';
|
|
5
5
|
export declare const Koolbase: {
|
|
6
6
|
initialize(config: KoolbaseConfig): Promise<void>;
|
|
7
|
+
/**
|
|
8
|
+
* For tests (R49): the real initialize, against a server you give as
|
|
9
|
+
* `fetch` -- the SDK's own auth and data code runs; only the server is
|
|
10
|
+
* yours -- with storage and the session in memory, and no analytics or
|
|
11
|
+
* messaging. Call resetForTesting after each test.
|
|
12
|
+
*
|
|
13
|
+
* ```ts
|
|
14
|
+
* await Koolbase.initializeForTesting({ fetch: myFakeServer });
|
|
15
|
+
* await Koolbase.auth.login({ email, password });
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
initializeForTesting(options: {
|
|
19
|
+
fetch: FetchLike;
|
|
20
|
+
baseUrl?: string;
|
|
21
|
+
publicKey?: string;
|
|
22
|
+
}): Promise<void>;
|
|
23
|
+
/** After a test (R49): everything initialize made is dropped, so the next one starts from nothing. */
|
|
24
|
+
resetForTesting(): void;
|
|
7
25
|
readonly auth: KoolbaseAuth;
|
|
8
26
|
readonly db: KoolbaseDatabase;
|
|
9
27
|
readonly storage: KoolbaseStorage;
|
package/dist/cjs/index.js
CHANGED
|
@@ -64,6 +64,8 @@ exports.Koolbase = {
|
|
|
64
64
|
return _initializing;
|
|
65
65
|
_initializing = (async () => {
|
|
66
66
|
(0, core_1.setPlatform)(config.platform ?? (0, platform_js_2.browserPlatform)());
|
|
67
|
+
// Every JSON request the SDK makes goes through config.fetch, when one is given (R49).
|
|
68
|
+
(0, core_1.setFetch)(config.fetch ?? null);
|
|
67
69
|
_auth = new core_1.KoolbaseAuth(config);
|
|
68
70
|
// A data request refused with the signed-in person's token renews the
|
|
69
71
|
// session once and goes again (#96); only a refused renewal ends it.
|
|
@@ -107,6 +109,45 @@ exports.Koolbase = {
|
|
|
107
109
|
_initializing = null;
|
|
108
110
|
}
|
|
109
111
|
},
|
|
112
|
+
/**
|
|
113
|
+
* For tests (R49): the real initialize, against a server you give as
|
|
114
|
+
* `fetch` -- the SDK's own auth and data code runs; only the server is
|
|
115
|
+
* yours -- with storage and the session in memory, and no analytics or
|
|
116
|
+
* messaging. Call resetForTesting after each test.
|
|
117
|
+
*
|
|
118
|
+
* ```ts
|
|
119
|
+
* await Koolbase.initializeForTesting({ fetch: myFakeServer });
|
|
120
|
+
* await Koolbase.auth.login({ email, password });
|
|
121
|
+
* ```
|
|
122
|
+
*/
|
|
123
|
+
async initializeForTesting(options) {
|
|
124
|
+
await exports.Koolbase.initialize({
|
|
125
|
+
baseUrl: options.baseUrl ?? 'http://koolbase.test',
|
|
126
|
+
publicKey: options.publicKey ?? 'pk_test',
|
|
127
|
+
platform: (0, core_1.memoryPlatform)(),
|
|
128
|
+
authStorage: new core_1.MemoryAuthStorage(),
|
|
129
|
+
fetch: options.fetch,
|
|
130
|
+
analyticsEnabled: false,
|
|
131
|
+
messagingEnabled: false,
|
|
132
|
+
});
|
|
133
|
+
},
|
|
134
|
+
/** After a test (R49): everything initialize made is dropped, so the next one starts from nothing. */
|
|
135
|
+
resetForTesting() {
|
|
136
|
+
_connectivity?.stop?.();
|
|
137
|
+
(0, core_1.setSessionRenewal)(null);
|
|
138
|
+
(0, core_1.setFetch)(null);
|
|
139
|
+
_auth = null;
|
|
140
|
+
_db = null;
|
|
141
|
+
_storage = null;
|
|
142
|
+
_fiscal = null;
|
|
143
|
+
_realtime = null;
|
|
144
|
+
_connectivity = null;
|
|
145
|
+
_functions = null;
|
|
146
|
+
_flags = null;
|
|
147
|
+
_analytics = null;
|
|
148
|
+
_initialized = false;
|
|
149
|
+
_initializing = null;
|
|
150
|
+
},
|
|
110
151
|
get auth() { ensureInitialized(); return _auth; },
|
|
111
152
|
get db() { ensureInitialized(); return _db; },
|
|
112
153
|
get storage() { ensureInitialized(); return _storage; },
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,9 +1,27 @@
|
|
|
1
1
|
export * from '@koolbase/core';
|
|
2
2
|
export { BrowserAuthStorage } from './auth-storage.js';
|
|
3
3
|
export { browserPlatform } from './platform.js';
|
|
4
|
-
import { KoolbaseAuth, KoolbaseDatabase, KoolbaseFiscal, KoolbaseStorage, KoolbaseRealtime, KoolbaseFunctions, KoolbaseConnectivity, KoolbaseAnalytics, type KoolbaseConfig, type VersionCheckResult } from '@koolbase/core';
|
|
4
|
+
import { KoolbaseAuth, KoolbaseDatabase, KoolbaseFiscal, KoolbaseStorage, KoolbaseRealtime, KoolbaseFunctions, KoolbaseConnectivity, KoolbaseAnalytics, type KoolbaseConfig, type VersionCheckResult, type FetchLike } from '@koolbase/core';
|
|
5
5
|
export declare const Koolbase: {
|
|
6
6
|
initialize(config: KoolbaseConfig): Promise<void>;
|
|
7
|
+
/**
|
|
8
|
+
* For tests (R49): the real initialize, against a server you give as
|
|
9
|
+
* `fetch` -- the SDK's own auth and data code runs; only the server is
|
|
10
|
+
* yours -- with storage and the session in memory, and no analytics or
|
|
11
|
+
* messaging. Call resetForTesting after each test.
|
|
12
|
+
*
|
|
13
|
+
* ```ts
|
|
14
|
+
* await Koolbase.initializeForTesting({ fetch: myFakeServer });
|
|
15
|
+
* await Koolbase.auth.login({ email, password });
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
initializeForTesting(options: {
|
|
19
|
+
fetch: FetchLike;
|
|
20
|
+
baseUrl?: string;
|
|
21
|
+
publicKey?: string;
|
|
22
|
+
}): Promise<void>;
|
|
23
|
+
/** After a test (R49): everything initialize made is dropped, so the next one starts from nothing. */
|
|
24
|
+
resetForTesting(): void;
|
|
7
25
|
readonly auth: KoolbaseAuth;
|
|
8
26
|
readonly db: KoolbaseDatabase;
|
|
9
27
|
readonly storage: KoolbaseStorage;
|
package/dist/esm/index.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
export * from '@koolbase/core';
|
|
10
10
|
export { BrowserAuthStorage } from './auth-storage.js';
|
|
11
11
|
export { browserPlatform } from './platform.js';
|
|
12
|
-
import { KoolbaseAuth, KoolbaseDatabase, KoolbaseFiscal, KoolbaseStorage, KoolbaseRealtime, KoolbaseFunctions, KoolbaseConnectivity, KoolbaseFlags, KoolbaseAnalytics, disabledAnalytics, getOrCreateDeviceId, setPlatform, setSessionRenewal } from '@koolbase/core';
|
|
12
|
+
import { KoolbaseAuth, KoolbaseDatabase, KoolbaseFiscal, KoolbaseStorage, KoolbaseRealtime, KoolbaseFunctions, KoolbaseConnectivity, KoolbaseFlags, KoolbaseAnalytics, disabledAnalytics, getOrCreateDeviceId, setPlatform, setSessionRenewal, setFetch, memoryPlatform, MemoryAuthStorage } from '@koolbase/core';
|
|
13
13
|
import { browserPlatform } from './platform.js';
|
|
14
14
|
let _auth = null;
|
|
15
15
|
let _db = null;
|
|
@@ -45,6 +45,8 @@ export const Koolbase = {
|
|
|
45
45
|
return _initializing;
|
|
46
46
|
_initializing = (async () => {
|
|
47
47
|
setPlatform(config.platform ?? browserPlatform());
|
|
48
|
+
// Every JSON request the SDK makes goes through config.fetch, when one is given (R49).
|
|
49
|
+
setFetch(config.fetch ?? null);
|
|
48
50
|
_auth = new KoolbaseAuth(config);
|
|
49
51
|
// A data request refused with the signed-in person's token renews the
|
|
50
52
|
// session once and goes again (#96); only a refused renewal ends it.
|
|
@@ -88,6 +90,45 @@ export const Koolbase = {
|
|
|
88
90
|
_initializing = null;
|
|
89
91
|
}
|
|
90
92
|
},
|
|
93
|
+
/**
|
|
94
|
+
* For tests (R49): the real initialize, against a server you give as
|
|
95
|
+
* `fetch` -- the SDK's own auth and data code runs; only the server is
|
|
96
|
+
* yours -- with storage and the session in memory, and no analytics or
|
|
97
|
+
* messaging. Call resetForTesting after each test.
|
|
98
|
+
*
|
|
99
|
+
* ```ts
|
|
100
|
+
* await Koolbase.initializeForTesting({ fetch: myFakeServer });
|
|
101
|
+
* await Koolbase.auth.login({ email, password });
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
async initializeForTesting(options) {
|
|
105
|
+
await Koolbase.initialize({
|
|
106
|
+
baseUrl: options.baseUrl ?? 'http://koolbase.test',
|
|
107
|
+
publicKey: options.publicKey ?? 'pk_test',
|
|
108
|
+
platform: memoryPlatform(),
|
|
109
|
+
authStorage: new MemoryAuthStorage(),
|
|
110
|
+
fetch: options.fetch,
|
|
111
|
+
analyticsEnabled: false,
|
|
112
|
+
messagingEnabled: false,
|
|
113
|
+
});
|
|
114
|
+
},
|
|
115
|
+
/** After a test (R49): everything initialize made is dropped, so the next one starts from nothing. */
|
|
116
|
+
resetForTesting() {
|
|
117
|
+
_connectivity?.stop?.();
|
|
118
|
+
setSessionRenewal(null);
|
|
119
|
+
setFetch(null);
|
|
120
|
+
_auth = null;
|
|
121
|
+
_db = null;
|
|
122
|
+
_storage = null;
|
|
123
|
+
_fiscal = null;
|
|
124
|
+
_realtime = null;
|
|
125
|
+
_connectivity = null;
|
|
126
|
+
_functions = null;
|
|
127
|
+
_flags = null;
|
|
128
|
+
_analytics = null;
|
|
129
|
+
_initialized = false;
|
|
130
|
+
_initializing = null;
|
|
131
|
+
},
|
|
91
132
|
get auth() { ensureInitialized(); return _auth; },
|
|
92
133
|
get db() { ensureInitialized(); return _db; },
|
|
93
134
|
get storage() { ensureInitialized(); return _storage; },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@koolbase/js",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.38.1",
|
|
4
4
|
"description": "Koolbase SDK for the browser \u2014 auth, database, storage, realtime, functions, flags and offline sync in one package.",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"types": "./dist/esm/index.d.ts",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"url": "https://github.com/koolbase/koolbase-react-native"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@koolbase/core": "12.
|
|
29
|
+
"@koolbase/core": "^12.38.1"
|
|
30
30
|
},
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"access": "public"
|