@@ -71,14 +71,43 @@ export type BatchFunction<T extends LiveObject> = (ctx: BatchContext<T>) => void
7171 * Enables REST-based operations on Objects on a channel.
7272 */
7373export declare interface RestObject {
74- get ( params ?: Omit < RestObjectGetParams , 'compact' > & { compact ?: true } ) : Promise < RestObjectGetCompactResult > ;
75- get ( params : Omit < RestObjectGetParams , 'compact' > & { compact : false } ) : Promise < RestObjectGetResult > ;
74+ /**
75+ * Reads object data from the channel in compact object response format.
76+ * Uses the channel's root object as the entrypoint when no objectId is provided.
77+ *
78+ * Returns a {@link RestObjectGetCompactResult} representing the logical structure of your data as a JSON-like value.
79+ * {@link LiveMap} instances appear as JSON objects with their entries, and {@link LiveCounter} instances appear
80+ * as numbers. Binary values appear as base64 strings (JSON protocol) or `Buffer`/`ArrayBuffer` (binary protocol).
81+ * JSON-typed values remain as their JSON-encoded string representation.
82+ *
83+ * Cyclic references are included as `{ objectId: string }` rather than including the same object instance
84+ * in the result more than once.
85+ *
86+ * @param params - Optional parameters to specify the object to fetch.
87+ * @returns A promise that resolves to the object data in compact format.
88+ */
89+ get ( params ?: RestObjectGetCompactParams ) : Promise < RestObjectGetCompactResult > ;
90+ /**
91+ * Reads object data from the channel in full object response format.
92+ * Uses the channel's root object as the entrypoint when no objectId is provided.
93+ *
94+ * Returns a {@link RestObjectGetResult} with full object metadata and decoded object data values
95+ * (`bytes` decoded to `Buffer`/`ArrayBuffer`, `json` decoded to native objects/arrays).
96+ * If the path resolves to a leaf value in a map, returns the decoded {@link RestObjectData | ObjectData} directly.
97+ *
98+ * Cyclic references are included as `{ objectId: string }` rather than including the same object instance
99+ * in the result more than once.
100+ *
101+ * @param params - Parameters specifying the object to fetch with `compact: false`.
102+ * @returns A promise that resolves to the object data in full format.
103+ */
104+ get ( params : RestObjectGetFullParams ) : Promise < RestObjectGetResult > ;
76105 /**
77106 * Reads object data from the channel.
78107 * Uses the channel's root object as the entrypoint when no objectId is provided.
79108 *
80109 * When `compact` is `true` (the default), returns a {@link RestObjectGetCompactResult} representing the logical
81- * structure of your data as a JSON value. {@link LiveMap} instances appear as JSON objects with their entries,
110+ * structure of your data as a JSON-like value. {@link LiveMap} instances appear as JSON objects with their entries,
82111 * and {@link LiveCounter} instances appear as numbers. Binary values appear as base64 strings (JSON protocol) or
83112 * `Buffer`/`ArrayBuffer` (binary protocol). JSON-typed values remain as their JSON-encoded string representation.
84113 *
@@ -136,6 +165,7 @@ export interface RestObjectOperationBase {
136165type TargetByObjectId = {
137166 /** The unique identifier of the object instance to target. */
138167 objectId : string ;
168+ /** Not applicable when targeting by object ID. */
139169 path ?: never ;
140170} ;
141171
@@ -152,6 +182,7 @@ type TargetByPath = {
152182 * If a key contains a dot, escape it with a backslash (for example `posts.post\\.123.votes.up`).
153183 */
154184 path : string ;
185+ /** Not applicable when targeting by path. */
155186 objectId ?: never ;
156187} ;
157188
@@ -169,65 +200,68 @@ export type PublishObjectData =
169200 | {
170201 /** A string value. */
171202 string : string ;
172- number ?: never ;
173- boolean ?: never ;
174- bytes ?: never ;
175- json ?: never ;
176- objectId ?: never ;
203+ /** Not applicable. */ number ?: never ;
204+ /** Not applicable. */ boolean ?: never ;
205+ /** Not applicable. */ bytes ?: never ;
206+ /** Not applicable. */ json ?: never ;
207+ /** Not applicable. */ objectId ?: never ;
177208 }
178209 | {
179210 /** A numeric value. */
180211 number : number ;
181- string ?: never ;
182- boolean ?: never ;
183- bytes ?: never ;
184- json ?: never ;
185- objectId ?: never ;
212+ /** Not applicable. */ string ?: never ;
213+ /** Not applicable. */ boolean ?: never ;
214+ /** Not applicable. */ bytes ?: never ;
215+ /** Not applicable. */ json ?: never ;
216+ /** Not applicable. */ objectId ?: never ;
186217 }
187218 | {
188219 /** A boolean value. */
189220 boolean : boolean ;
190- string ?: never ;
191- number ?: never ;
192- bytes ?: never ;
193- json ?: never ;
194- objectId ?: never ;
221+ /** Not applicable. */ string ?: never ;
222+ /** Not applicable. */ number ?: never ;
223+ /** Not applicable. */ bytes ?: never ;
224+ /** Not applicable. */ json ?: never ;
225+ /** Not applicable. */ objectId ?: never ;
195226 }
196227 | {
197228 /** A binary value. */
198229 bytes : Buffer | ArrayBuffer ;
199- string ?: never ;
200- number ?: never ;
201- boolean ?: never ;
202- json ?: never ;
203- objectId ?: never ;
230+ /** Not applicable. */ string ?: never ;
231+ /** Not applicable. */ number ?: never ;
232+ /** Not applicable. */ boolean ?: never ;
233+ /** Not applicable. */ json ?: never ;
234+ /** Not applicable. */ objectId ?: never ;
204235 }
205236 | {
206237 /** A JSON value (array or object). */
207238 json : JsonArray | JsonObject ;
208- string ?: never ;
209- number ?: never ;
210- boolean ?: never ;
211- bytes ?: never ;
212- objectId ?: never ;
239+ /** Not applicable. */ string ?: never ;
240+ /** Not applicable. */ number ?: never ;
241+ /** Not applicable. */ boolean ?: never ;
242+ /** Not applicable. */ bytes ?: never ;
243+ /** Not applicable. */ objectId ?: never ;
213244 }
214245 | {
215246 /** A reference to another object by its ID. */
216247 objectId : string ;
217- string ?: never ;
218- number ?: never ;
219- boolean ?: never ;
220- bytes ?: never ;
221- json ?: never ;
248+ /** Not applicable. */ string ?: never ;
249+ /** Not applicable. */ number ?: never ;
250+ /** Not applicable. */ boolean ?: never ;
251+ /** Not applicable. */ bytes ?: never ;
252+ /** Not applicable. */ json ?: never ;
222253 } ;
223254
224255/**
225256 * Operation to create a new map object at the specified path with initial entries.
226257 */
227258export type RestObjectOperationMapCreate = RestObjectOperationBase &
228259 Partial < TargetByPath > & {
260+ /** The map creation parameters. */
229261 mapCreate : {
262+ /** The conflict-resolution semantics for the map. */
230263 semantics : Exclude < ObjectsMapSemantics , ObjectsMapSemanticsNamespace . UNKNOWN > ;
264+ /** Initial key-value pairs for the map. */
231265 entries : Record <
232266 string ,
233267 {
@@ -245,6 +279,7 @@ export type RestObjectOperationMapCreate = RestObjectOperationBase &
245279 */
246280export type RestObjectOperationMapCreateWithObjectId = RestObjectOperationBase &
247281 TargetByObjectId & {
282+ /** The map creation parameters for a pre-computed object ID. */
248283 mapCreateWithObjectId : {
249284 /**
250285 * JSON-encoded string representation of the {@link RestObjectOperationMapCreate.mapCreate} object.
@@ -261,8 +296,11 @@ export type RestObjectOperationMapCreateWithObjectId = RestObjectOperationBase &
261296 * Can target the map by either object ID or path.
262297 */
263298export type RestObjectOperationMapSet = AnyTargetRestObjectOperationBase & {
299+ /** The map set parameters. */
264300 mapSet : {
301+ /** The key to set. */
265302 key : string ;
303+ /** The value to assign to the key. */
266304 value : PublishObjectData ;
267305 } ;
268306} ;
@@ -272,7 +310,9 @@ export type RestObjectOperationMapSet = AnyTargetRestObjectOperationBase & {
272310 * Can target the map by either object ID or path.
273311 */
274312export type RestObjectOperationMapRemove = AnyTargetRestObjectOperationBase & {
313+ /** The map remove parameters. */
275314 mapRemove : {
315+ /** The key to remove. */
276316 key : string ;
277317 } ;
278318} ;
@@ -282,7 +322,9 @@ export type RestObjectOperationMapRemove = AnyTargetRestObjectOperationBase & {
282322 */
283323export type RestObjectOperationCounterCreate = RestObjectOperationBase &
284324 Partial < TargetByPath > & {
325+ /** The counter creation parameters. */
285326 counterCreate : {
327+ /** The initial value of the counter. */
286328 count : number ;
287329 } ;
288330 } ;
@@ -292,6 +334,7 @@ export type RestObjectOperationCounterCreate = RestObjectOperationBase &
292334 */
293335export type RestObjectOperationCounterCreateWithObjectId = RestObjectOperationBase &
294336 TargetByObjectId & {
337+ /** The counter creation parameters for a pre-computed object ID. */
295338 counterCreateWithObjectId : {
296339 /**
297340 * JSON-encoded string representation of the {@link RestObjectOperationCounterCreate.counterCreate} object.
@@ -308,7 +351,9 @@ export type RestObjectOperationCounterCreateWithObjectId = RestObjectOperationBa
308351 * Can target the counter by either object ID or path.
309352 */
310353export type RestObjectOperationCounterInc = AnyTargetRestObjectOperationBase & {
354+ /** The counter increment parameters. */
311355 counterInc : {
356+ /** The amount to increment by. Use a negative value to decrement. */
312357 number : number ;
313358 } ;
314359} ;
@@ -345,14 +390,30 @@ export interface RestObjectPublishResult {
345390 * Request parameters for {@link RestObject.get}.
346391 */
347392export interface RestObjectGetParams {
348- /** The unique identifier of the object instance to fetch. If omitted, fetches from the channel's root object */
393+ /** The unique identifier of the object instance to fetch. If omitted, fetches from the channel's root object. */
349394 objectId ?: string ;
350- /** A dot-separated path to return a subset of the object. Evaluated relative to the root or the specified objectId */
395+ /** A dot-separated path to return a subset of the object. Evaluated relative to the root or the specified objectId. */
351396 path ?: string ;
352- /** When true (default), returns a values-only representation. When false, includes object IDs and type metadata */
397+ /** When true (default), returns a values-only representation. When false, includes object IDs and type metadata. */
353398 compact ?: boolean ;
354399}
355400
401+ /**
402+ * Parameters for {@link RestObject.get} when requesting compact format (default).
403+ */
404+ export type RestObjectGetCompactParams = Omit < RestObjectGetParams , 'compact' > & {
405+ /** Must be `true` or omitted for compact format. */
406+ compact ?: true ;
407+ } ;
408+
409+ /**
410+ * Parameters for {@link RestObject.get} when requesting full object response format.
411+ */
412+ export type RestObjectGetFullParams = Omit < RestObjectGetParams , 'compact' > & {
413+ /** Must be `false` for full object response format. */
414+ compact : false ;
415+ } ;
416+
356417// Note: this type does not include arrays as no LiveObject type currently compacts
357418// into one, and json-typed values remain as JSON-encoded strings rather than being parsed.
358419/**
@@ -384,7 +445,7 @@ export type RestObjectGetResult = RestLiveObject | RestObjectData;
384445export type RestLiveObject = RestLiveMap | RestLiveCounter | AnyRestLiveObject ;
385446
386447/**
387- * Expanded representation of a map object with metadata.
448+ * Full object structure of a map object with metadata.
388449 */
389450export interface RestLiveMap {
390451 /** The ID of the map object. */
@@ -398,16 +459,24 @@ export interface RestLiveMap {
398459 } ;
399460}
400461
462+ /**
463+ * A map entry containing a primitive leaf value.
464+ */
401465export interface RestObjectDataMapEntry {
466+ /** The decoded object data for this entry. */
402467 data : RestObjectData ;
403468}
404469
470+ /**
471+ * A map entry containing a nested LiveObject.
472+ */
405473export interface RestLiveObjectMapEntry {
474+ /** The nested LiveObject at this entry. */
406475 data : RestLiveObject ;
407476}
408477
409478/**
410- * Expanded representation of a counter object with metadata.
479+ * Full object structure of a counter object with metadata.
411480 */
412481export interface RestLiveCounter {
413482 /** The ID of the counter object. */
@@ -430,7 +499,9 @@ export type AnyRestLiveObject = {
430499 objectId : string ;
431500} ;
432501
433- // to be used in jsdoc links
502+ /**
503+ * A decoded leaf data value in the non-compact {@link RestObject.get} responses.
504+ */
434505type RestObjectData = Omit < ObjectData , 'value' > ;
435506
436507/**
0 commit comments