@koolbase/core 12.13.1 → 12.15.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/auth.d.ts +31 -1
- package/dist/cjs/auth.js +167 -20
- package/dist/cjs/cache-store.d.ts +5 -0
- package/dist/cjs/cache-store.js +31 -0
- package/dist/cjs/connectivity.d.ts +25 -0
- package/dist/cjs/connectivity.js +59 -0
- package/dist/cjs/database.d.ts +32 -0
- package/dist/cjs/database.js +111 -16
- package/dist/cjs/fiscal.js +2 -2
- package/dist/cjs/functions.js +2 -2
- package/dist/cjs/index.d.ts +3 -1
- package/dist/cjs/index.js +3 -1
- package/dist/cjs/network.d.ts +14 -0
- package/dist/cjs/network.js +60 -0
- package/dist/cjs/offline-state.d.ts +4 -0
- package/dist/cjs/offline-state.js +36 -0
- package/dist/cjs/platform.d.ts +16 -0
- package/dist/cjs/react/use-record.d.ts +1 -1
- package/dist/cjs/record-controller.d.ts +8 -1
- package/dist/cjs/record-controller.js +29 -7
- package/dist/cjs/shared.d.ts +1 -0
- package/dist/cjs/storage.js +11 -11
- package/dist/cjs/sync-engine.js +3 -3
- package/dist/cjs/types.d.ts +7 -0
- package/dist/esm/auth.d.ts +31 -1
- package/dist/esm/auth.js +168 -21
- package/dist/esm/cache-store.d.ts +5 -0
- package/dist/esm/cache-store.js +30 -0
- package/dist/esm/connectivity.d.ts +25 -0
- package/dist/esm/connectivity.js +55 -0
- package/dist/esm/database.d.ts +32 -0
- package/dist/esm/database.js +101 -6
- package/dist/esm/fiscal.js +3 -3
- package/dist/esm/functions.js +3 -3
- package/dist/esm/index.d.ts +3 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/network.d.ts +14 -0
- package/dist/esm/network.js +58 -0
- package/dist/esm/offline-state.d.ts +4 -0
- package/dist/esm/offline-state.js +35 -0
- package/dist/esm/platform.d.ts +16 -0
- package/dist/esm/react/use-record.d.ts +1 -1
- package/dist/esm/record-controller.d.ts +8 -1
- package/dist/esm/record-controller.js +29 -7
- package/dist/esm/shared.d.ts +1 -0
- package/dist/esm/storage.js +12 -12
- package/dist/esm/sync-engine.js +4 -4
- package/dist/esm/types.d.ts +7 -0
- package/package.json +1 -1
package/dist/esm/sync-engine.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { sessionFetch } from './network.js';
|
|
2
2
|
import { readOfflineState, mutateOfflineState, migrateLegacyQueue, flushLockName, } from './offline-state.js';
|
|
3
3
|
import { KoolbaseUnauthenticatedError } from './errors.js';
|
|
4
4
|
import { getPlatform } from './platform.js';
|
|
@@ -256,7 +256,7 @@ export class SyncEngine {
|
|
|
256
256
|
: `${this.config.baseUrl}/v1/sdk/db/records/${write.recordId}`;
|
|
257
257
|
let res;
|
|
258
258
|
if (write.operation === 'insert') {
|
|
259
|
-
res = await
|
|
259
|
+
res = await sessionFetch(url, {
|
|
260
260
|
method: 'POST',
|
|
261
261
|
headers,
|
|
262
262
|
// The write's own id: generated at enqueue, identical on every retry.
|
|
@@ -270,7 +270,7 @@ export class SyncEngine {
|
|
|
270
270
|
});
|
|
271
271
|
}
|
|
272
272
|
else if (write.operation === 'update') {
|
|
273
|
-
res = await
|
|
273
|
+
res = await sessionFetch(url, {
|
|
274
274
|
method: 'PATCH',
|
|
275
275
|
headers,
|
|
276
276
|
// The revision the change was composed against. The server applies it
|
|
@@ -289,7 +289,7 @@ export class SyncEngine {
|
|
|
289
289
|
const q = write.baseRevision !== undefined
|
|
290
290
|
? `?expected_revision=${write.baseRevision}`
|
|
291
291
|
: '';
|
|
292
|
-
res = await
|
|
292
|
+
res = await sessionFetch(`${url}${q}`, { method: 'DELETE', headers });
|
|
293
293
|
}
|
|
294
294
|
if (res.status === 401)
|
|
295
295
|
throw new KoolbaseUnauthenticatedError('unauthorized');
|
package/dist/esm/types.d.ts
CHANGED
|
@@ -180,6 +180,13 @@ export declare enum RestoreResult {
|
|
|
180
180
|
* broken listener cannot break propagation to others.
|
|
181
181
|
*/
|
|
182
182
|
export type AuthStateListener = (user: KoolbaseUser | null) => void;
|
|
183
|
+
/**
|
|
184
|
+
* Why the last session ended (#104): the person signed out, or the session
|
|
185
|
+
* ended on its own -- revoked, expired past renewal, signed out elsewhere.
|
|
186
|
+
* An app tells them apart to say "You were signed out" only when they did
|
|
187
|
+
* not ask to be.
|
|
188
|
+
*/
|
|
189
|
+
export type SignOutReason = 'signed_out' | 'session_ended';
|
|
183
190
|
/**
|
|
184
191
|
* Drop-in replacement for the global `fetch` function. Inject via
|
|
185
192
|
* KoolbaseConfig.fetch for testing (mock fetch), proxying, or
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@koolbase/core",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.15.0",
|
|
4
4
|
"description": "Koolbase SDK core \u2014 shared behaviour behind @koolbase/react-native and @koolbase/js. Install one of those, not this.",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"types": "./dist/esm/index.d.ts",
|