@rebasepro/client 0.30.0 → 0.31.0-canary.g902a0ce

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 CHANGED
@@ -16,15 +16,15 @@ of it resolves too: Node has supported `require(esm)` since 22.12.
16
16
 
17
17
  `@rebasepro/client` is the primary SDK for interacting with a Rebase backend from any JavaScript/TypeScript environment (browser, Node.js, edge). It creates a single client instance that provides:
18
18
 
19
- - **Collection CRUD** with a fluent query builder (`.where()`, `.orderBy()`, `.limit()`, etc.)
19
+ - **Table CRUD** with a fluent query builder (`.where()`, `.orderBy()`, `.limit()`, etc.)
20
20
  - **Authentication** — email/password, Google, 10+ OAuth providers, session management, password reset
21
21
  - **Admin** — user CRUD for admins
22
22
  - **Storage** — file upload, download, delete, list
23
- - **Realtime** — WebSocket subscriptions for collection and row changes
23
+ - **Realtime** — WebSocket subscriptions for table and row changes
24
24
  - **Offline / local-first sync** (opt-in) — a local row database, writes that apply instantly offline and replay when the connection returns, and live queries
25
25
  - **Cron** — list, trigger, and manage cron jobs
26
26
  - **Custom functions** — invoke server-side Hono route functions
27
- - **Type-safe data proxy** — `client.data.products` auto-maps to the `products` collection
27
+ - **Type-safe data proxy** — `client.data.products` auto-maps to the `products` table
28
28
 
29
29
  ## Key Exports
30
30
 
@@ -34,7 +34,7 @@ of it resolves too: Node has supported `require(esm)` since 22.12.
34
34
  |---|---|
35
35
  | `createRebaseClient<DB>(options)` | Create a client instance. Generic `DB` parameter enables type-safe `client.data.*` access. |
36
36
  | `CreateRebaseClientResult<DB>` | The client type it returns (`RebaseClient<DB>` from `@rebasepro/types`, narrowed) — includes `auth`, `admin`, `cron`, `functions`, `storage`, `ws`, `data`, `call`, and token management methods. |
37
- | `CreateRebaseClientOptions` | Extends `RebaseClientConfig` with the `auth`, `admin`, `cron`, `apiKeys` and `personalKeys` sub-configs, plus `storageSources`, `collections`, `offline` and `debug`. |
37
+ | `CreateRebaseClientOptions` | Extends `RebaseClientConfig` with the `auth`, `admin`, `cron`, `apiKeys` and `personalKeys` sub-configs, plus `storageSources`, `tables`, `offline` and `debug`. |
38
38
 
39
39
  ### Config
40
40
 
@@ -47,7 +47,7 @@ of it resolves too: Node has supported `require(esm)` since 22.12.
47
47
  | `onUnauthorized` | `() => Promise<boolean>` | auto-refresh | Handler for a refused token, over HTTP (401) and on the realtime socket |
48
48
  | `websocketUrl` | `string` | derived from `baseUrl` | WebSocket URL for realtime |
49
49
  | `realtime` | `boolean` | `true` | Open the WebSocket — `false` lets a one-shot script exit |
50
- | `collections` | `Record<string, string>` | — | Maps accessor names to collection slugs |
50
+ | `tables` | `Record<string, string>` | — | Maps accessor names to table slugs: the generated `tablesDictionary`. With it, an unknown accessor throws `UNKNOWN_TABLE` |
51
51
  | `offline` | `boolean \| OfflineConfig` | `false` | Local-first sync — see [the docs](https://rebase.pro/docs/sdk/offline) |
52
52
  | `debug` | `boolean` | `false` | Log the realtime connection's progress with `console.debug`. One browser can turn it on with `localStorage.setItem("rebase_debug", "1")` — see [Connection logging](https://rebase.pro/docs/sdk#connection-logging) |
53
53
 
@@ -66,9 +66,9 @@ Installing a getter or calling `setToken()` rebuilds an open socket so it authen
66
66
  client.setAuthTokenGetter(() => clerk.session?.getToken() ?? Promise.resolve(null));
67
67
  ```
68
68
 
69
- ### Collection Client
69
+ ### Table Client
70
70
 
71
- `client.data.collection("slug")` or `client.data.myCollection` returns a `CollectionClient<M>`:
71
+ `client.data.table("slug")` or `client.data.myTable` returns a `TableClient<M>`:
72
72
 
73
73
  | Method | Description |
74
74
  |---|---|
@@ -81,7 +81,7 @@ client.setAuthTokenGetter(() => clerk.session?.getToken() ?? Promise.resolve(nul
81
81
  | `where(col, op, val)` | Start a fluent query — returns a query builder |
82
82
  | `orderBy(col, dir?)` | Order results — returns a query builder |
83
83
  | `limit(n)` / `offset(n)` | Pagination — returns a query builder |
84
- | `search(str)` | Text search: a case-insensitive substring match by default, ranked full-text where the collection opts in — returns a query builder |
84
+ | `search(str)` | Text search: a case-insensitive substring match by default, ranked full-text where the table opts in — returns a query builder |
85
85
  | `include(...rels)` | Include related rows — returns a query builder |
86
86
  | `listen(params, onUpdate, onError?)` | Realtime subscription (requires WebSocket) |
87
87
  | `listenById(id, onUpdate, onError?)` | Realtime single-row subscription |
@@ -189,7 +189,7 @@ const unsubscribe = client.data.products.listen(
189
189
 
190
190
  ## Related Packages
191
191
 
192
- - [`@rebasepro/common`](../common) — `QueryBuilder`, `buildRebaseData`, shared utilities
193
- - [`@rebasepro/types`](../types) — `Entity`, `FindResult`, `CollectionAccessor`, etc.
192
+ - [`@rebasepro/common`](../common) — `buildSdkData`, query helpers (`or`, `and`, `cond`), shared utilities
193
+ - [`@rebasepro/types`](../types) — `FindResult`, `SDKTableClient`, etc.
194
194
  - [`@rebasepro/utils`](../utils) — `toSnakeCase` and other helpers
195
195
  - [`@rebasepro/app`](../app) — React hook adapter that wraps `client.auth` for CMS integration
package/dist/auth.d.ts CHANGED
@@ -17,6 +17,55 @@ export interface PublicUserProfile {
17
17
  * every backend does send.
18
18
  */
19
19
  export type AuthConfig = AuthConfigDocument;
20
+ /**
21
+ * A device sign-in waiting to be approved in a browser. See
22
+ * `startDeviceLogin`.
23
+ */
24
+ export interface DeviceLoginStart {
25
+ /** The secret this device polls with. Never shown. */
26
+ deviceCode: string;
27
+ /** The code the person checks on the approval page, like `BCDF-GHJK`. */
28
+ userCode: string;
29
+ /** The approval page. */
30
+ verificationUri: string;
31
+ /** The approval page with the code filled in. */
32
+ verificationUriComplete: string;
33
+ /** Seconds until the sign-in expires. */
34
+ expiresIn: number;
35
+ /** Seconds to wait between polls. */
36
+ interval: number;
37
+ }
38
+ /** What one poll of a device sign-in found. See `pollDeviceLogin`. */
39
+ export type DeviceLoginPoll = {
40
+ status: "pending";
41
+ interval: number;
42
+ }
43
+ /** Polled too soon: wait `interval` seconds — the new, longer interval — before the next. */
44
+ | {
45
+ status: "slow_down";
46
+ interval: number;
47
+ } | {
48
+ status: "denied";
49
+ } | {
50
+ status: "expired";
51
+ } | {
52
+ status: "approved";
53
+ user: User;
54
+ accessToken: string;
55
+ refreshToken: string;
56
+ };
57
+ /** A device sign-in as the approval page shows it. See `describeDeviceLogin`. */
58
+ export interface DeviceLoginRequest {
59
+ userCode: string;
60
+ /** What the device calls itself, e.g. `Rebase CLI on francesco-mbp`. */
61
+ clientName: string;
62
+ /** The address the device asked from. */
63
+ requestIp: string;
64
+ requestUserAgent: string;
65
+ status: "pending" | "approved" | "denied" | "consumed" | "expired";
66
+ createdAt: string;
67
+ expiresAt: string;
68
+ }
20
69
  /** The body of an Apple sign-in. See `signInWithApple`. */
21
70
  export interface AppleSignInPayload {
22
71
  /** The authorization code Apple returned. */
@@ -360,6 +409,13 @@ export declare function createAuth(transport: Transport, options?: CreateAuthOpt
360
409
  accessToken: string;
361
410
  refreshToken: string;
362
411
  }>;
412
+ startDeviceLogin: (options?: {
413
+ clientName?: string;
414
+ }) => Promise<DeviceLoginStart>;
415
+ pollDeviceLogin: (deviceCode: string) => Promise<DeviceLoginPoll>;
416
+ describeDeviceLogin: (userCode: string) => Promise<DeviceLoginRequest>;
417
+ approveDeviceLogin: (userCode: string) => Promise<void>;
418
+ denyDeviceLogin: (userCode: string) => Promise<void>;
363
419
  getSessions: () => Promise<DeviceSession[]>;
364
420
  revokeSession: (sessionId: string) => Promise<{
365
421
  success: boolean;
@@ -54,4 +54,29 @@ export declare const typedIsARebaseClient: RebaseClient<ContractDatabase>;
54
54
  export declare const untypedIsARebaseClient: RebaseClient;
55
55
  /** `data.batch` takes the accessor names, as `client.batch` does. */
56
56
  export declare const typedDataBatch: () => Promise<import("@rebasepro/types").BatchResult<Record<string, unknown>>>;
57
+ /**
58
+ * `data.table(slug)` is the by-slug accessor, typed from the generated
59
+ * `Database` exactly as the accessor property is: `table("order_items")` is
60
+ * `orderItems`, and a slug the `Database` does not declare falls through to
61
+ * the untyped overload.
62
+ */
63
+ export declare const typedTableBySlug: () => Promise<{
64
+ sku: string;
65
+ byAccessor: import("./table.js").TableClient<{
66
+ id: string;
67
+ order_id: string;
68
+ sku: string;
69
+ }, {
70
+ order_id: string;
71
+ sku: string;
72
+ }, {
73
+ sku?: string;
74
+ }, import("@rebasepro/types").IncludeSpec>;
75
+ untyped: import("./table.js").TableClient<Record<string, unknown>, Partial<Record<string, unknown>>, Partial<Record<string, unknown>>, import("@rebasepro/types").IncludeSpec>;
76
+ }>;
77
+ /**
78
+ * The backend's data is addressed as a table: `data.collection(slug)` and the
79
+ * top-level `client.collection(slug)` are gone, with no alias left behind.
80
+ */
81
+ export declare const noCollectionAccessor: () => void;
57
82
  export {};
package/dist/errors.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Client-side logic error (e.g. accessing an unknown collection when a typed
2
+ * Client-side logic error (e.g. accessing an unknown table when a typed
3
3
  * dictionary is available). A subclass of {@link RebaseApiError}, so a single
4
4
  * `catch (e) { if (e instanceof RebaseApiError) ... }` covers it too.
5
5
  *
package/dist/index.d.ts CHANGED
@@ -3,8 +3,9 @@ import { createAuth, CreateAuthOptions } from "./auth.js";
3
3
  import { createAdmin, CreateAdminOptions } from "./admin.js";
4
4
  import { createCron, CreateCronOptions } from "./cron.js";
5
5
  import { createBackups } from "./backups.js";
6
+ import { createSchema } from "./schema.js";
6
7
  import { createApiKeys, CreateApiKeysOptions, createPersonalKeys, CreatePersonalKeysOptions } from "./api-keys.js";
7
- import { CollectionClient } from "./collection.js";
8
+ import { TableClient } from "./table.js";
8
9
  import { createFunctionsClient } from "./functions.js";
9
10
  import { RebaseWebSocketClient } from "./websocket.js";
10
11
  import { RebaseRealtimeChannel, type ChannelOptions } from "./realtime-channel.js";
@@ -13,9 +14,9 @@ import { type AccessSimulation, type BatchOperation, type BatchResult, type Incl
13
14
  export { RebaseApiError } from "./transport.js";
14
15
  export { RebaseClientError } from "./errors.js";
15
16
  export type { RebaseErrorCode } from "@rebasepro/types";
16
- export type { RebaseClientConfig, RealtimeClientOptions, FindParams, FindResponse } from "./transport.js";
17
- export type { CollectionClient, RestoreOptions, TrashClient } from "./collection.js";
18
- export type { FindResult, SDKCollectionClient, SDKQueryBuilderInterface, PaginationMeta } from "@rebasepro/types";
17
+ export type { RebaseClientConfig, RealtimeClientOptions, FindParams } from "./transport.js";
18
+ export type { TableClient, RestoreOptions, TrashClient } from "./table.js";
19
+ export type { FindResult, SDKTableClient, SDKQueryBuilderInterface, PaginationMeta } from "@rebasepro/types";
19
20
  export type { IterateParams, FindAllParams, PageWalkOptions, CursorSpec } from "@rebasepro/types";
20
21
  export { RebasePaginationError } from "@rebasepro/common";
21
22
  export type { PaginationErrorCode } from "@rebasepro/common";
@@ -23,7 +24,7 @@ export { or, and, not, cond } from "@rebasepro/common";
23
24
  export { resolveStorageReferences, storageReference, parseStorageReference, isStorageReference, STORAGE_REFERENCE_SCHEME, storageTargetOfDownloadUrl, storageReferencesForDownloadUrls, storageTargetsInText } from "@rebasepro/types";
24
25
  export type { StorageReferenceTarget, StorageReferenceResolver } from "@rebasepro/types";
25
26
  export { createCookieStorage, createMemoryStorage } from "./auth.js";
26
- export type { AppleSignInPayload, AuthConfig, AuthStorage, CookieStorageOptions, CreateAuthOptions, SessionRestoreOutcome } from "./auth.js";
27
+ export type { AppleSignInPayload, AuthConfig, AuthStorage, CookieStorageOptions, CreateAuthOptions, DeviceLoginPoll, DeviceLoginRequest, DeviceLoginStart, SessionRestoreOutcome } from "./auth.js";
27
28
  export { requestAppleAuthorization, preloadAppleSignIn, APPLE_JS_SDK_URL } from "./apple-sign-in.js";
28
29
  export type { AppleAuthorization, AppleAuthorizationRequest } from "./apple-sign-in.js";
29
30
  export type { User, RebaseSession, AuthTokens, AuthChangeEvent, DeviceSession } from "@rebasepro/types";
@@ -31,6 +32,8 @@ export type { CreateAdminOptions, ListGuestsOptions, ListUsersOptions } from "./
31
32
  export type { AdminUser } from "./admin.js";
32
33
  export type { CreateCronOptions } from "./cron.js";
33
34
  export type { BackupStream } from "./backups.js";
35
+ export { SCHEMA_UNAVAILABLE, isSchemaUnavailable } from "./schema.js";
36
+ export type { SchemaAPI, SchemaTablesOptions, TableDescriptor } from "@rebasepro/types";
34
37
  export type { ApiKeyKind, ApiKeyMasked, ApiKeyWithSecret, CreateApiKeyRequest, CreateApiKeysOptions, CreatePersonalKeyRequest, CreatePersonalKeysOptions, UpdateApiKeyRequest } from "./api-keys.js";
35
38
  export type { FunctionInvokeOptions, FunctionsClient } from "./functions.js";
36
39
  export { RebaseWebSocketClient } from "./websocket.js";
@@ -38,8 +41,8 @@ export { RebaseRealtimeChannel } from "./realtime-channel.js";
38
41
  export type { PresenceState, PresenceDiff, BroadcastEvent, ChannelTransport, ChannelOptions, ChannelHistoryEntry, ChannelHistoryResult } from "./realtime-channel.js";
39
42
  export type { ConflictResolution, OfflineApi, OfflineConfig, OfflineQueueOptions, OfflineStatus } from "./offline.js";
40
43
  export { isOfflineError } from "./offline-errors.js";
41
- export type { LiveResult, ObserveByIdOptions, ObserveOptions, RowSnapshotMeta } from "./collection.js";
42
- export { etagOf } from "./collection.js";
44
+ export type { LiveResult, ObserveByIdOptions, ObserveOptions, RowSnapshotMeta } from "./table.js";
45
+ export { etagOf } from "./table.js";
43
46
  export type { BatchOperation, BatchRef, BatchResult, FieldOperation, UpdateValues, UpsertOptions } from "@rebasepro/types";
44
47
  export type { WriteOptions, WhereFilterOp, WhereFor, WhereConditionFor, WhereValueFor, FilterValues, FieldPath, OrderBySpec, LogicalCondition, LogicalConditionFor, FilterCondition, FilterConditionFor, AggregateParams, AggregateSelect, AggregateRow, AggregateResult, AggregateMeta, IncludeSpec, IncludeOptions, QueryComputedFields, RowOf, InsertOf, UpdateOf, StorageSource, ClientStorageSource, ClientUploadFileProps, UploadFileResult } from "@rebasepro/types";
45
48
  export type { OfflineStore, OfflineCacheEntry, OfflineCacheRecord, PendingMutation, MutationRollback } from "./offline-store.js";
@@ -59,19 +62,19 @@ export interface CreateRebaseClientOptions extends RebaseClientConfig {
59
62
  */
60
63
  storageSources?: StorageSourceDefinition[];
61
64
  /**
62
- * Maps each `client.data` accessor to the collection slug the server
65
+ * Maps each `client.data` accessor to the table slug the server
63
66
  * serves (e.g. `{ companyMembers: "company-members" }`): the generated
64
- * `collectionsDictionary`.
67
+ * `tablesDictionary`.
65
68
  *
66
69
  * **Required for a typed client** (`createRebaseClient<Database>`). The
67
70
  * types offer every accessor, but without the map the proxy sends
68
71
  * `client.data.companyMembers` to `/data/company_members`, so a kebab-case
69
- * slug or a renamed accessor (`collectionCollection`) answers 404; a
72
+ * slug or a renamed accessor (`tableTable`) answers 404; a
70
73
  * one-time warning names the accessor. With the map, an unknown accessor
71
- * throws `UNKNOWN_COLLECTION` with a suggestion. A later version will make
74
+ * throws `UNKNOWN_TABLE` with a suggestion. A later version will make
72
75
  * it required in the types when `Database` is supplied.
73
76
  */
74
- collections?: Record<string, string>;
77
+ tables?: Record<string, string>;
75
78
  /**
76
79
  * Local-first sync for the data layer.
77
80
  *
@@ -110,16 +113,16 @@ type DBEntry<DB, S extends string> = [
110
113
  AccessorOfSlug<DB, S>
111
114
  ] extends [never] ? (KebabToCamelCase<S> extends keyof DB ? DB[KebabToCamelCase<S>] : unknown) : DB[AccessorOfSlug<DB, S>];
112
115
  type TypedDataLayer<DB> = {
113
- collection<S extends string>(slug: S): CollectionClient<RowOf<DBEntry<DB, S>>, InsertOf<DBEntry<DB, S>>, UpdateOf<DBEntry<DB, S>>, IncludeOf<DBEntry<DB, S>, DB>>;
116
+ table<S extends string>(slug: S): TableClient<RowOf<DBEntry<DB, S>>, InsertOf<DBEntry<DB, S>>, UpdateOf<DBEntry<DB, S>>, IncludeOf<DBEntry<DB, S>, DB>>;
114
117
  } & {
115
- [K in keyof DB]: CollectionClient<RowOf<DB[K]>, InsertOf<DB[K]>, UpdateOf<DB[K]>, IncludeOf<DB[K], DB>>;
116
- } & (string extends keyof DB ? RebaseSdkData : Pick<RebaseSdkData, "collection"> & Pick<RebaseSdkData<DB>, "batch">);
118
+ [K in keyof DB]: TableClient<RowOf<DB[K]>, InsertOf<DB[K]>, UpdateOf<DB[K]>, IncludeOf<DB[K], DB>>;
119
+ } & (string extends keyof DB ? RebaseSdkData : Pick<RebaseSdkData, "table"> & Pick<RebaseSdkData<DB>, "batch">);
117
120
  /**
118
121
  * The return type of `createRebaseClient<DB>()`.
119
122
  *
120
123
  * This is `RebaseClient` (from `@rebasepro/types`) with all optional
121
124
  * capabilities populated and the `data` layer narrowed to provide
122
- * typed collection accessors when a `DB` schema generic is supplied.
125
+ * typed table accessors when a `DB` schema generic is supplied.
123
126
  */
124
127
  export type CreateRebaseClientResult<DB = Record<string, unknown>> = Omit<RebaseClient<DB>, "data" | "email" | "simulate"> & {
125
128
  /**
@@ -129,7 +132,7 @@ export type CreateRebaseClientResult<DB = Record<string, unknown>> = Omit<Rebase
129
132
  * {@link RebaseClient.simulate} for what the server honours and refuses.
130
133
  *
131
134
  * Always present here, typed by the same `Database` (it is built with the
132
- * same `collections` dictionary), and closable: it is a client of its own,
135
+ * same `tables` dictionary), and closable: it is a client of its own,
133
136
  * so release it with `close()` when done. On `RebaseClient` it is optional,
134
137
  * because a server-side client has none.
135
138
  */
@@ -168,6 +171,8 @@ export type CreateRebaseClientResult<DB = Record<string, unknown>> = Omit<Rebase
168
171
  admin: ReturnType<typeof createAdmin>;
169
172
  cron: ReturnType<typeof createCron>;
170
173
  backups: ReturnType<typeof createBackups>;
174
+ /** The backend's tables, as `GET /api/schema/tables` serves them to the caller. */
175
+ schema: ReturnType<typeof createSchema>;
171
176
  apiKeys: ReturnType<typeof createApiKeys>;
172
177
  personalKeys: ReturnType<typeof createPersonalKeys>;
173
178
  functions: ReturnType<typeof createFunctionsClient>;
@@ -227,18 +232,18 @@ export type CreateRebaseClientResult<DB = Record<string, unknown>> = Omit<Rebase
227
232
  */
228
233
  call: <T = unknown>(endpoint: string, payload?: unknown) => Promise<T>;
229
234
  /**
230
- * A collection by slug — the same client `data.collection(slug)` returns,
235
+ * A table by slug — the same client `data.table(slug)` returns,
231
236
  * typed from the generated `Database` when the slug is one of its
232
- * collections, or by the row type passed explicitly.
237
+ * tables, or by the row type passed explicitly.
233
238
  */
234
- collection: {
235
- <S extends string>(slug: S): CollectionClient<RowOf<DBEntry<DB, S>>, InsertOf<DBEntry<DB, S>>, UpdateOf<DBEntry<DB, S>>, IncludeOf<DBEntry<DB, S>, DB>>;
236
- <M extends Record<string, unknown> = Record<string, unknown>>(slug: string): CollectionClient<M>;
239
+ table: {
240
+ <S extends string>(slug: S): TableClient<RowOf<DBEntry<DB, S>>, InsertOf<DBEntry<DB, S>>, UpdateOf<DBEntry<DB, S>>, IncludeOf<DBEntry<DB, S>, DB>>;
241
+ <M extends Record<string, unknown> = Record<string, unknown>>(slug: string): TableClient<M>;
237
242
  };
238
243
  /**
239
- * Write across collections in one transaction.
244
+ * Write across tables in one transaction.
240
245
  *
241
- * `createMany` and friends are one collection at a time, which is the wrong
246
+ * `createMany` and friends are one table at a time, which is the wrong
242
247
  * shape for the writes that most need to be atomic: an order and its line
243
248
  * items, a user and their membership row, a document and its audit entry.
244
249
  * Sent as separate calls those can half-succeed, and the recovery — read
@@ -257,18 +262,18 @@ export type CreateRebaseClientResult<DB = Record<string, unknown>> = Omit<Rebase
257
262
  * `data` is aligned to `operations`: the written row for a create, upsert
258
263
  * or update, and `null` for a delete.
259
264
  *
260
- * `collection` is the accessor `client.data.<accessor>` takes — `orderItems`
265
+ * `table` is the accessor `client.data.<accessor>` takes — `orderItems`
261
266
  * for the slug `order_items` — and is sent as the slug through the
262
- * `collections` dictionary. A name that is not an accessor goes out as
267
+ * `tables` dictionary. A name that is not an accessor goes out as
263
268
  * written, so an untyped client can still pass the slug.
264
269
  *
265
270
  * @example
266
271
  * ```ts
267
272
  * await client.batch([
268
- * { op: "create", collection: "orders", values: { total: 40 }, ref: "order" },
269
- * { op: "create", collection: "orderItems",
273
+ * { op: "create", table: "orders", values: { total: 40 }, ref: "order" },
274
+ * { op: "create", table: "orderItems",
270
275
  * values: { orderId: { $ref: "order.id" }, sku: "A-1" } },
271
- * { op: "update", collection: "stock", id: "A-1", values: { count: { $inc: -1 } } }
276
+ * { op: "update", table: "stock", id: "A-1", values: { count: { $inc: -1 } } }
272
277
  * ]);
273
278
  * ```
274
279
  */