@rebasepro/client 0.9.0 → 0.9.1-canary.0de22e0
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/README.md +1 -1
- package/dist/admin.d.ts +1 -0
- package/dist/auth.d.ts +5 -0
- package/dist/backups.d.ts +13 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.es.js +828 -96
- package/dist/index.es.js.map +1 -1
- package/dist/realtime-channel.d.ts +243 -0
- package/dist/transport.d.ts +34 -0
- package/dist/websocket.d.ts +97 -3
- package/package.json +11 -10
- package/src/admin.ts +1 -1
- package/src/api-keys.ts +1 -1
- package/src/auth.ts +32 -0
- package/src/backups.ts +40 -0
- package/src/collection.ts +16 -0
- package/src/index.ts +112 -3
- package/src/realtime-channel.test.ts +542 -0
- package/src/realtime-channel.ts +539 -0
- package/src/realtime-optout.test.ts +245 -0
- package/src/realtime-row-identity.test.ts +254 -0
- package/src/sdk_query_builder.ts +4 -1
- package/src/transport-baseurl.test.ts +53 -0
- package/src/transport.ts +59 -3
- package/src/websocket.ts +516 -89
- package/dist/collection.test.d.ts +0 -1
- package/dist/cron.test.d.ts +0 -1
- package/dist/data-proxy.test.d.ts +0 -1
- package/dist/index.umd.js +0 -2484
- package/dist/index.umd.js.map +0 -1
package/README.md
CHANGED
|
@@ -161,4 +161,4 @@ const unsubscribe = client.data.products.listen(
|
|
|
161
161
|
- [`@rebasepro/common`](../common) — `QueryBuilder`, `buildRebaseData`, shared utilities
|
|
162
162
|
- [`@rebasepro/types`](../types) — `Snapshot`, `FindResponse`, `CollectionAccessor`, etc.
|
|
163
163
|
- [`@rebasepro/utils`](../utils) — `toSnakeCase` and other helpers
|
|
164
|
-
- [`@rebasepro/
|
|
164
|
+
- [`@rebasepro/app`](../auth) — React hook adapter that wraps `client.auth` for CMS integration
|
package/dist/admin.d.ts
CHANGED
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;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Transport } from "./transport";
|
|
2
|
+
import type { BackupInfo, BackupDestinationKind } from "@rebasepro/types";
|
|
3
|
+
export interface CreateBackupsOptions {
|
|
4
|
+
backupsPath?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function createBackups(transport: Transport, options?: CreateBackupsOptions): {
|
|
7
|
+
list: () => Promise<{
|
|
8
|
+
backups: BackupInfo[];
|
|
9
|
+
destinationKind: BackupDestinationKind;
|
|
10
|
+
configured: boolean;
|
|
11
|
+
}>;
|
|
12
|
+
download: (key: string) => Promise<Blob>;
|
|
13
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -2,10 +2,12 @@ import { RebaseClientConfig } from "./transport";
|
|
|
2
2
|
import { createAuth, CreateAuthOptions } from "./auth";
|
|
3
3
|
import { createAdmin, CreateAdminOptions } from "./admin";
|
|
4
4
|
import { createCron, CreateCronOptions } from "./cron";
|
|
5
|
+
import { createBackups } from "./backups";
|
|
5
6
|
import { createApiKeys, CreateApiKeysOptions } from "./api-keys";
|
|
6
7
|
import { CollectionClient } from "./collection";
|
|
7
8
|
import { createFunctionsClient } from "./functions";
|
|
8
9
|
import { RebaseWebSocketClient } from "./websocket";
|
|
10
|
+
import { RebaseRealtimeChannel, type ChannelOptions } from "./realtime-channel";
|
|
9
11
|
import { InsertOf, RebaseClient, RebaseSdkData, RowOf, StorageSource, StorageSourceDefinition, StorageSourceRegistry, UpdateOf } from "@rebasepro/types";
|
|
10
12
|
export { RebaseApiError } from "./transport";
|
|
11
13
|
export { RebaseClientError } from "./errors";
|
|
@@ -21,9 +23,13 @@ export type { RebaseUser, RebaseTokens } from "./auth";
|
|
|
21
23
|
export type { CreateAdminOptions } from "./admin";
|
|
22
24
|
export type { AdminUser } from "./admin";
|
|
23
25
|
export type { CreateCronOptions } from "./cron";
|
|
26
|
+
export { createBackups } from "./backups";
|
|
27
|
+
export type { CreateBackupsOptions } from "./backups";
|
|
24
28
|
export type { ApiKeyMasked, ApiKeyPermission, ApiKeyWithSecret, CreateApiKeyRequest, CreateApiKeysOptions, UpdateApiKeyRequest } from "./api-keys";
|
|
25
29
|
export type { FunctionInvokeOptions, FunctionsClient } from "./functions";
|
|
26
30
|
export { RebaseWebSocketClient } from "./websocket";
|
|
31
|
+
export { RebaseRealtimeChannel } from "./realtime-channel";
|
|
32
|
+
export type { PresenceState, PresenceDiff, BroadcastEvent, ChannelTransport, ChannelOptions, ChannelHistoryEntry, ChannelHistoryResult } from "./realtime-channel";
|
|
27
33
|
export interface CreateRebaseClientOptions extends RebaseClientConfig {
|
|
28
34
|
auth?: CreateAuthOptions;
|
|
29
35
|
admin?: CreateAdminOptions;
|
|
@@ -67,14 +73,42 @@ export type CreateRebaseClientResult<DB = Record<string, unknown>> = Omit<Rebase
|
|
|
67
73
|
auth: ReturnType<typeof createAuth>;
|
|
68
74
|
admin: ReturnType<typeof createAdmin>;
|
|
69
75
|
cron: ReturnType<typeof createCron>;
|
|
76
|
+
backups: ReturnType<typeof createBackups>;
|
|
70
77
|
apiKeys: ReturnType<typeof createApiKeys>;
|
|
71
78
|
functions: ReturnType<typeof createFunctionsClient>;
|
|
72
79
|
ws?: RebaseWebSocketClient;
|
|
80
|
+
/**
|
|
81
|
+
* Broadcast and presence channels.
|
|
82
|
+
*
|
|
83
|
+
* Was missing from this type while present on the returned object, which
|
|
84
|
+
* made `client.realtime.channel(...)` a type error and forced every adopter
|
|
85
|
+
* to cast around the feature before they could reach it.
|
|
86
|
+
*/
|
|
87
|
+
realtime: {
|
|
88
|
+
/**
|
|
89
|
+
* Join a broadcast/presence channel. Repeated calls with the same name
|
|
90
|
+
* return the same channel object. Throws only when the client was
|
|
91
|
+
* created with `realtime: false`.
|
|
92
|
+
*
|
|
93
|
+
* Pass `{ history: true }` to have the channel replay what it missed on
|
|
94
|
+
* join and on every reconnect, for channels the server retains.
|
|
95
|
+
*/
|
|
96
|
+
channel: (name: string, options?: ChannelOptions) => RebaseRealtimeChannel;
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* Release the realtime socket and its reconnect timer.
|
|
100
|
+
*
|
|
101
|
+
* An open socket keeps the Node event loop alive, so a script that does not
|
|
102
|
+
* call this will not exit on its own. Safe when realtime was never started
|
|
103
|
+
* (`realtime: false`), and safe to call twice.
|
|
104
|
+
*/
|
|
105
|
+
close: () => void;
|
|
73
106
|
storage: StorageSource;
|
|
74
107
|
storageRegistry: StorageSourceRegistry;
|
|
75
108
|
createStorageSource: (storageId: string) => StorageSource;
|
|
76
109
|
fetchStorageSources: () => Promise<StorageSourceDefinition[]>;
|
|
77
110
|
call: <T = unknown>(endpoint: string, payload?: unknown) => Promise<T>;
|
|
111
|
+
collection: <M extends Record<string, unknown> = Record<string, unknown>>(slug: string) => CollectionClient<M>;
|
|
78
112
|
data: TypedDataLayer<DB>;
|
|
79
113
|
};
|
|
80
114
|
export declare function createRebaseClient<DB = Record<string, unknown>>(options: CreateRebaseClientOptions): CreateRebaseClientResult<DB>;
|