@rebasepro/client 0.29.1 → 0.29.2
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 +1 -1
- package/dist/collection.d.ts +9 -2
- package/dist/index.es.js +6 -4
- package/dist/index.es.js.map +1 -1
- package/dist/{offline-Cy6woFyt.js → offline-B6J1YUWF.js} +69 -9
- package/dist/offline-B6J1YUWF.js.map +1 -0
- package/dist/offline-connectivity.d.ts +8 -2
- package/dist/{offline-store-C2Sy3Kwl.js → offline-store-B7F5mimt.js} +51 -6
- package/dist/offline-store-B7F5mimt.js.map +1 -0
- package/dist/offline.d.ts +9 -0
- package/dist/transport.d.ts +15 -1
- package/dist/websocket.d.ts +34 -1
- package/package.json +4 -4
- package/dist/offline-Cy6woFyt.js.map +0 -1
- package/dist/offline-store-C2Sy3Kwl.js.map +0 -1
package/dist/transport.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AggregateParams, FindParams as TypesFindParams, FindResponse as TypesFindResponse, type IncludeSpec } from "@rebasepro/types";
|
|
1
|
+
import { AggregateParams, FindParams as TypesFindParams, FindResponse as TypesFindResponse, type IncludeSpec, type LogicalCondition } from "@rebasepro/types";
|
|
2
2
|
export { RebaseApiError } from "@rebasepro/types";
|
|
3
3
|
export type { RebaseErrorInit } from "@rebasepro/types";
|
|
4
4
|
/** Options for the realtime socket: `createRebaseClient({ realtime: { ... } })`. */
|
|
@@ -197,6 +197,20 @@ export declare function buildQueryString(params?: FindParams, deleted?: SoftDele
|
|
|
197
197
|
* same parameters and runs the same listing.
|
|
198
198
|
*/
|
|
199
199
|
export declare function buildQueryBody(params?: FindParams, deleted?: SoftDeletedRows): Record<string, string | string[]>;
|
|
200
|
+
/**
|
|
201
|
+
* The filter of a filtered write (`updateWhere`, `deleteWhere`) and an
|
|
202
|
+
* upsert's `where`, as the bulk routes read it from the body: `where` in the
|
|
203
|
+
* `?where=` JSON dialect, `logical` as the `?or=` / `?and=` / `?not=` group
|
|
204
|
+
* spells it. An `undefined` condition value is refused here, as it is on a
|
|
205
|
+
* listing, rather than dropped on the way to the server.
|
|
206
|
+
*/
|
|
207
|
+
export declare function writeFilterBody(query: {
|
|
208
|
+
where?: Record<string, unknown>;
|
|
209
|
+
logical?: LogicalCondition;
|
|
210
|
+
}): {
|
|
211
|
+
where?: Record<string, unknown>;
|
|
212
|
+
logical?: string;
|
|
213
|
+
};
|
|
200
214
|
/**
|
|
201
215
|
* The query string for `GET /<collection>/aggregate`.
|
|
202
216
|
*
|
package/dist/websocket.d.ts
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
import { DeleteProps, CollectionConfig, FetchCollectionProps, ListenCollectionProps, FetchOneProps, ListenOneTarget, SaveProps, CollectionUpdateMeta, ChannelMessage, TableMetadata, BranchInfo, RebaseApiError, type RealtimeConnectionState } from "@rebasepro/types";
|
|
2
2
|
import type { SqlScriptResult } from "@rebasepro/types";
|
|
3
|
+
/**
|
|
4
|
+
* A socket handler slot, declared with method syntax so its parameter is
|
|
5
|
+
* compared bivariantly — the way an `on…` slot is assigned in practice. The
|
|
6
|
+
* DOM `WebSocket` hands its handlers a `MessageEvent`/`CloseEvent`, Node's `ws`
|
|
7
|
+
* its own event classes, a test fake a plain `{ data }`; the client reads
|
|
8
|
+
* nothing but a message's `data`, so all of them fit.
|
|
9
|
+
*/
|
|
10
|
+
type SocketHandler<E> = {
|
|
11
|
+
bivarianceHack(event: E): void;
|
|
12
|
+
}["bivarianceHack"];
|
|
13
|
+
/**
|
|
14
|
+
* The part of a WebSocket this client uses: open/message/close/error slots,
|
|
15
|
+
* `readyState`, `send` and `close`. The DOM `WebSocket`, Node's `ws` and a
|
|
16
|
+
* hand-written fake all satisfy it — `typeof WebSocket` asked for the whole DOM
|
|
17
|
+
* class, which `ws` is not, so a Node caller had to cast to pass one.
|
|
18
|
+
*/
|
|
19
|
+
export interface RealtimeSocket {
|
|
20
|
+
readonly readyState: number;
|
|
21
|
+
onopen: SocketHandler<unknown> | null;
|
|
22
|
+
onmessage: SocketHandler<{
|
|
23
|
+
data: unknown;
|
|
24
|
+
}> | null;
|
|
25
|
+
onclose: SocketHandler<unknown> | null;
|
|
26
|
+
onerror: SocketHandler<unknown> | null;
|
|
27
|
+
send(data: string): void;
|
|
28
|
+
close(code?: number, reason?: string): void;
|
|
29
|
+
}
|
|
30
|
+
/** A constructor for a {@link RealtimeSocket}, with the `OPEN` state constant. */
|
|
31
|
+
export interface RealtimeSocketConstructor {
|
|
32
|
+
new (url: string): RealtimeSocket;
|
|
33
|
+
readonly OPEN: number;
|
|
34
|
+
}
|
|
3
35
|
export interface RebaseWebSocketConfig {
|
|
4
36
|
websocketUrl: string;
|
|
5
37
|
/** The group this socket belongs to — see `RealtimeClientOptions.affinity`. */
|
|
@@ -10,7 +42,7 @@ export interface RebaseWebSocketConfig {
|
|
|
10
42
|
*/
|
|
11
43
|
getAuthToken?: () => Promise<string | null>;
|
|
12
44
|
/** Optional WebSocket constructor to override globalThis.WebSocket (e.g. for Node environments) */
|
|
13
|
-
WebSocket?:
|
|
45
|
+
WebSocket?: RealtimeSocketConstructor;
|
|
14
46
|
/** Callback to handle unauthorized requests or token expiration (refreshes auth session) */
|
|
15
47
|
onUnauthorized?: () => Promise<boolean>;
|
|
16
48
|
/**
|
|
@@ -485,3 +517,4 @@ export declare class RebaseWebSocketClient {
|
|
|
485
517
|
private createCollectionSubscriptionKey;
|
|
486
518
|
private createSingleSubscriptionKey;
|
|
487
519
|
}
|
|
520
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rebasepro/client",
|
|
3
|
-
"version": "0.29.
|
|
3
|
+
"version": "0.29.2",
|
|
4
4
|
"description": "HTTP SDK client for the Rebase custom backend",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"rebase",
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
"./package.json": "./package.json"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@rebasepro/common": "0.29.
|
|
45
|
-
"@rebasepro/types": "0.29.
|
|
46
|
-
"@rebasepro/utils": "0.29.
|
|
44
|
+
"@rebasepro/common": "0.29.2",
|
|
45
|
+
"@rebasepro/types": "0.29.2",
|
|
46
|
+
"@rebasepro/utils": "0.29.2"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@jest/globals": "^30.4.1",
|