@rebasepro/client 0.9.1-canary.ff338b5 → 0.10.1-canary.a54c057
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 +5 -0
- package/dist/index.d.ts +21 -3
- package/dist/index.es.js +852 -13
- package/dist/index.es.js.map +1 -1
- package/dist/offline-store.d.ts +109 -0
- package/dist/offline.d.ts +129 -0
- package/dist/realtime-channel.d.ts +142 -1
- package/dist/websocket.d.ts +1 -0
- package/package.json +5 -4
- package/src/auth.ts +32 -0
- package/src/index.ts +70 -6
- package/src/offline-idb-store.test.ts +151 -0
- package/src/offline-integration.test.ts +134 -0
- package/src/offline-store.ts +232 -0
- package/src/offline.test.ts +688 -0
- package/src/offline.ts +621 -0
- package/src/realtime-channel.test.ts +206 -0
- package/src/realtime-channel.ts +294 -4
- package/src/transport-baseurl.test.ts +53 -0
- package/src/transport.ts +25 -3
- package/src/websocket.ts +13 -2
package/dist/auth.d.ts
CHANGED
|
@@ -147,6 +147,11 @@ export declare function createAuth(transport: Transport, options?: CreateAuthOpt
|
|
|
147
147
|
success: boolean;
|
|
148
148
|
message: string;
|
|
149
149
|
}>;
|
|
150
|
+
linkProvider: (providerId: string, payload: Record<string, unknown>) => Promise<{
|
|
151
|
+
success: boolean;
|
|
152
|
+
provider: string;
|
|
153
|
+
alreadyLinked: boolean;
|
|
154
|
+
}>;
|
|
150
155
|
sendVerificationEmail: () => Promise<{
|
|
151
156
|
success: boolean;
|
|
152
157
|
message: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,8 @@ import { createApiKeys, CreateApiKeysOptions } from "./api-keys";
|
|
|
7
7
|
import { CollectionClient } from "./collection";
|
|
8
8
|
import { createFunctionsClient } from "./functions";
|
|
9
9
|
import { RebaseWebSocketClient } from "./websocket";
|
|
10
|
-
import { RebaseRealtimeChannel } from "./realtime-channel";
|
|
10
|
+
import { RebaseRealtimeChannel, type ChannelOptions } from "./realtime-channel";
|
|
11
|
+
import { type OfflineApi, type OfflineConfig } from "./offline";
|
|
11
12
|
import { InsertOf, RebaseClient, RebaseSdkData, RowOf, StorageSource, StorageSourceDefinition, StorageSourceRegistry, UpdateOf } from "@rebasepro/types";
|
|
12
13
|
export { RebaseApiError } from "./transport";
|
|
13
14
|
export { RebaseClientError } from "./errors";
|
|
@@ -29,7 +30,10 @@ export type { ApiKeyMasked, ApiKeyPermission, ApiKeyWithSecret, CreateApiKeyRequ
|
|
|
29
30
|
export type { FunctionInvokeOptions, FunctionsClient } from "./functions";
|
|
30
31
|
export { RebaseWebSocketClient } from "./websocket";
|
|
31
32
|
export { RebaseRealtimeChannel } from "./realtime-channel";
|
|
32
|
-
export type { PresenceState, PresenceDiff, BroadcastEvent, ChannelTransport } from "./realtime-channel";
|
|
33
|
+
export type { PresenceState, PresenceDiff, BroadcastEvent, ChannelTransport, ChannelOptions, ChannelHistoryEntry, ChannelHistoryResult } from "./realtime-channel";
|
|
34
|
+
export type { OfflineApi, OfflineConfig } from "./offline";
|
|
35
|
+
export type { OfflineStore, OfflineCacheEntry, PendingMutation } from "./offline-store";
|
|
36
|
+
export { MemoryOfflineStore } from "./offline-store";
|
|
33
37
|
export interface CreateRebaseClientOptions extends RebaseClientConfig {
|
|
34
38
|
auth?: CreateAuthOptions;
|
|
35
39
|
admin?: CreateAdminOptions;
|
|
@@ -50,6 +54,15 @@ export interface CreateRebaseClientOptions extends RebaseClientConfig {
|
|
|
50
54
|
* correct slugs via this map before falling back to automatic snake_casing.
|
|
51
55
|
*/
|
|
52
56
|
collections?: Record<string, string>;
|
|
57
|
+
/**
|
|
58
|
+
* Offline support for the data layer. `true` enables it with defaults
|
|
59
|
+
* (network-first reads served from cache on network failure, writes
|
|
60
|
+
* queued and replayed when connectivity returns); pass an
|
|
61
|
+
* {@link OfflineConfig} to control the store, cache size, or sync error
|
|
62
|
+
* handling. Cached reads and queued writes are partitioned per signed-in
|
|
63
|
+
* user. Off by default.
|
|
64
|
+
*/
|
|
65
|
+
offline?: boolean | OfflineConfig;
|
|
53
66
|
}
|
|
54
67
|
type KebabToCamelCase<S extends string> = S extends `${infer T}-${infer U}` ? `${T}${Capitalize<KebabToCamelCase<U>>}` : S;
|
|
55
68
|
type DBEntry<DB, S extends string> = KebabToCamelCase<S> extends keyof DB ? DB[KebabToCamelCase<S>] : unknown;
|
|
@@ -89,8 +102,11 @@ export type CreateRebaseClientResult<DB = Record<string, unknown>> = Omit<Rebase
|
|
|
89
102
|
* Join a broadcast/presence channel. Repeated calls with the same name
|
|
90
103
|
* return the same channel object. Throws only when the client was
|
|
91
104
|
* created with `realtime: false`.
|
|
105
|
+
*
|
|
106
|
+
* Pass `{ history: true }` to have the channel replay what it missed on
|
|
107
|
+
* join and on every reconnect, for channels the server retains.
|
|
92
108
|
*/
|
|
93
|
-
channel: (name: string) => RebaseRealtimeChannel;
|
|
109
|
+
channel: (name: string, options?: ChannelOptions) => RebaseRealtimeChannel;
|
|
94
110
|
};
|
|
95
111
|
/**
|
|
96
112
|
* Release the realtime socket and its reconnect timer.
|
|
@@ -107,5 +123,7 @@ export type CreateRebaseClientResult<DB = Record<string, unknown>> = Omit<Rebase
|
|
|
107
123
|
call: <T = unknown>(endpoint: string, payload?: unknown) => Promise<T>;
|
|
108
124
|
collection: <M extends Record<string, unknown> = Record<string, unknown>>(slug: string) => CollectionClient<M>;
|
|
109
125
|
data: TypedDataLayer<DB>;
|
|
126
|
+
/** Present only when the client was created with `offline` enabled. */
|
|
127
|
+
offline?: OfflineApi;
|
|
110
128
|
};
|
|
111
129
|
export declare function createRebaseClient<DB = Record<string, unknown>>(options: CreateRebaseClientOptions): CreateRebaseClientResult<DB>;
|