@rebasepro/client 0.12.1-canary.gf5f1d39 → 0.13.1-canary.g18cfeb7
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/auth.d.ts +3 -5
- package/dist/index.d.ts +12 -7
- package/dist/index.es.js +384 -93
- package/dist/index.es.js.map +1 -1
- package/dist/offline-query.d.ts +18 -3
- package/dist/offline-store.d.ts +8 -1
- package/dist/websocket.d.ts +19 -0
- package/package.json +8 -8
- package/src/auth-listener-errors.test.ts +57 -0
- package/src/auth-refresh-overflow.test.ts +89 -0
- package/src/auth.ts +60 -6
- package/src/client-close.test.ts +80 -0
- package/src/collection-listen-meta.test.ts +105 -0
- package/src/collection-observe.test.ts +138 -0
- package/src/collection.test.ts +50 -10
- package/src/collection.ts +191 -51
- package/src/data-proxy.test.ts +22 -6
- package/src/functions.ts +9 -1
- package/src/index.ts +76 -26
- package/src/like-pattern-redos.test.ts +61 -0
- package/src/offline-idb-store.test.ts +23 -4
- package/src/offline-query.test.ts +28 -2
- package/src/offline-query.ts +35 -8
- package/src/offline-store.ts +5 -1
- package/src/offline.test.ts +114 -1
- package/src/offline.ts +121 -7
- package/src/realtime-concurrent-subscribe.test.ts +102 -0
- package/src/realtime-optout.test.ts +52 -18
- package/src/realtime-subscription-key.test.ts +92 -0
- package/src/transport-baseurl.test.ts +49 -1
- package/src/transport.ts +65 -0
- package/src/websocket-url.test.ts +97 -0
- package/src/websocket.ts +100 -21
package/dist/auth.d.ts
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { Transport } from "./transport";
|
|
2
|
-
import type { AuthChangeEvent, RebaseSession,
|
|
2
|
+
import type { AuthChangeEvent, RebaseSession, DeviceSession, User } from "@rebasepro/types";
|
|
3
3
|
export type { RebaseSession, AuthTokens, AuthChangeEvent, DeviceSession } from "@rebasepro/types";
|
|
4
|
-
/** @deprecated Use `User` from `@rebasepro/types` instead. */
|
|
5
|
-
export type RebaseUser = User;
|
|
6
|
-
/** @deprecated Use `AuthTokens` from `@rebasepro/types` instead. */
|
|
7
|
-
export type RebaseTokens = AuthTokens;
|
|
8
4
|
/** Minimal, non-sensitive user profile returned by {@link findUserByEmail}. */
|
|
9
5
|
export interface PublicUserProfile {
|
|
10
6
|
uid: string;
|
|
@@ -128,6 +124,7 @@ export declare function createAuth(transport: Transport, options?: CreateAuthOpt
|
|
|
128
124
|
refreshToken: string;
|
|
129
125
|
}>;
|
|
130
126
|
signOut: () => Promise<void>;
|
|
127
|
+
stopAutoRefresh: () => void;
|
|
131
128
|
refreshSession: () => Promise<RebaseSession>;
|
|
132
129
|
handleUnauthorized: () => Promise<boolean>;
|
|
133
130
|
getUser: () => Promise<User>;
|
|
@@ -180,6 +177,7 @@ export declare function createAuth(transport: Transport, options?: CreateAuthOpt
|
|
|
180
177
|
getAuthConfig: () => Promise<AuthConfig>;
|
|
181
178
|
getSession: () => RebaseSession | null;
|
|
182
179
|
onAuthStateChange: (callback: (event: AuthChangeEvent, session: RebaseSession | null) => void) => () => boolean;
|
|
180
|
+
canRestoreSession: () => boolean;
|
|
183
181
|
isInitialized: () => Promise<void>;
|
|
184
182
|
};
|
|
185
183
|
export interface CookieStorageOptions {
|
package/dist/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ import { type OfflineApi, type OfflineConfig } from "./offline";
|
|
|
12
12
|
import { InsertOf, RebaseClient, RebaseSdkData, RowOf, StorageSource, StorageSourceDefinition, StorageSourceRegistry, UpdateOf } from "@rebasepro/types";
|
|
13
13
|
export { RebaseApiError } from "./transport";
|
|
14
14
|
export { RebaseClientError } from "./errors";
|
|
15
|
+
export type { RebaseErrorCode } from "@rebasepro/types";
|
|
15
16
|
export type { RebaseClientConfig, FindParams, FindResponse } from "./transport";
|
|
16
17
|
export type { CollectionClient } from "./collection";
|
|
17
18
|
export type { FindResult, SDKCollectionClient, SDKQueryBuilderInterface, PaginationMeta } from "@rebasepro/types";
|
|
@@ -21,9 +22,7 @@ export type { PaginationErrorCode } from "@rebasepro/common";
|
|
|
21
22
|
export { QueryBuilder, or, and, cond } from "@rebasepro/common";
|
|
22
23
|
export { createCookieStorage, createMemoryStorage } from "./auth";
|
|
23
24
|
export type { AuthConfig, AuthStorage, CookieStorageOptions, CreateAuthOptions } from "./auth";
|
|
24
|
-
export type { RebaseSession, AuthTokens, AuthChangeEvent, DeviceSession } from "@rebasepro/types";
|
|
25
|
-
/** @deprecated Import `User` / `AuthTokens` from `@rebasepro/types` instead. */
|
|
26
|
-
export type { RebaseUser, RebaseTokens } from "./auth";
|
|
25
|
+
export type { User, RebaseSession, AuthTokens, AuthChangeEvent, DeviceSession } from "@rebasepro/types";
|
|
27
26
|
export type { CreateAdminOptions } from "./admin";
|
|
28
27
|
export type { AdminUser } from "./admin";
|
|
29
28
|
export type { CreateCronOptions } from "./cron";
|
|
@@ -120,11 +119,17 @@ export type CreateRebaseClientResult<DB = Record<string, unknown>> = Omit<Rebase
|
|
|
120
119
|
channel: (name: string, options?: ChannelOptions) => RebaseRealtimeChannel;
|
|
121
120
|
};
|
|
122
121
|
/**
|
|
123
|
-
* Release
|
|
122
|
+
* Release everything this client holds that can keep a process alive: the
|
|
123
|
+
* realtime socket and its reconnect timer, channel presence heartbeats, the
|
|
124
|
+
* offline manager, and the scheduled token refresh.
|
|
124
125
|
*
|
|
125
|
-
*
|
|
126
|
-
* call this will not exit
|
|
127
|
-
*
|
|
126
|
+
* Each of those keeps the Node event loop alive on its own, so a script
|
|
127
|
+
* that does not call this will not exit — and, until the refresh timer was
|
|
128
|
+
* included, one that *did* call it still would not if it had signed in.
|
|
129
|
+
*
|
|
130
|
+
* Safe when realtime was never started (`realtime: false`), safe when
|
|
131
|
+
* signed out, and safe to call twice. It does not sign the user out: a
|
|
132
|
+
* persisted session survives for the next client to restore.
|
|
128
133
|
*/
|
|
129
134
|
close: () => void;
|
|
130
135
|
storage: StorageSource;
|