@rebasepro/client 0.9.1-canary.fd3754b → 0.10.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/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,6 +7,7 @@ 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, type ChannelOptions } from "./realtime-channel";
10
11
  import { InsertOf, RebaseClient, RebaseSdkData, RowOf, StorageSource, StorageSourceDefinition, StorageSourceRegistry, UpdateOf } from "@rebasepro/types";
11
12
  export { RebaseApiError } from "./transport";
12
13
  export { RebaseClientError } from "./errors";
@@ -27,6 +28,8 @@ export type { CreateBackupsOptions } from "./backups";
27
28
  export type { ApiKeyMasked, ApiKeyPermission, ApiKeyWithSecret, CreateApiKeyRequest, CreateApiKeysOptions, UpdateApiKeyRequest } from "./api-keys";
28
29
  export type { FunctionInvokeOptions, FunctionsClient } from "./functions";
29
30
  export { RebaseWebSocketClient } from "./websocket";
31
+ export { RebaseRealtimeChannel } from "./realtime-channel";
32
+ export type { PresenceState, PresenceDiff, BroadcastEvent, ChannelTransport, ChannelOptions, ChannelHistoryEntry, ChannelHistoryResult } from "./realtime-channel";
30
33
  export interface CreateRebaseClientOptions extends RebaseClientConfig {
31
34
  auth?: CreateAuthOptions;
32
35
  admin?: CreateAdminOptions;
@@ -74,11 +77,38 @@ export type CreateRebaseClientResult<DB = Record<string, unknown>> = Omit<Rebase
74
77
  apiKeys: ReturnType<typeof createApiKeys>;
75
78
  functions: ReturnType<typeof createFunctionsClient>;
76
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;
77
106
  storage: StorageSource;
78
107
  storageRegistry: StorageSourceRegistry;
79
108
  createStorageSource: (storageId: string) => StorageSource;
80
109
  fetchStorageSources: () => Promise<StorageSourceDefinition[]>;
81
110
  call: <T = unknown>(endpoint: string, payload?: unknown) => Promise<T>;
111
+ collection: <M extends Record<string, unknown> = Record<string, unknown>>(slug: string) => CollectionClient<M>;
82
112
  data: TypedDataLayer<DB>;
83
113
  };
84
114
  export declare function createRebaseClient<DB = Record<string, unknown>>(options: CreateRebaseClientOptions): CreateRebaseClientResult<DB>;