@@ -34,7 +34,7 @@ export interface ObjectData {
3434 /** A reference to another object, used to support composable object structures. */
3535 objectId ?: string ; // OD2a
3636
37- /** Can be set by the client to indicate that value in `string` or `bytes ` field have an encoding. */
37+ /** May be set by the client to indicate that value in `string` field have an encoding. */
3838 encoding ?: string ; // OD2b
3939 /** A primitive boolean leaf value in the object graph. Only one value field can be set. */
4040 boolean ?: boolean ; // OD2c
@@ -213,6 +213,8 @@ export class ObjectMessage {
213213 * Mutates the provided ObjectMessage.
214214 *
215215 * Uses encoding functions from regular `Message` processing.
216+ *
217+ * @spec OM4
216218 */
217219 static encode ( message : ObjectMessage , client : BaseClient ) : ObjectMessage {
218220 const encodeInitialValueFn : EncodeInitialValueFunction = ( data , encoding ) => {
@@ -260,6 +262,8 @@ export class ObjectMessage {
260262 * Format is used to decode the bytes value as it's implicitly encoded depending on the protocol used:
261263 * - json: bytes are base64 encoded string
262264 * - msgpack: bytes have a binary representation and don't need to be decoded
265+ *
266+ * @spec OM5
263267 */
264268 static async decode (
265269 message : ObjectMessage ,
@@ -367,6 +371,7 @@ export class ObjectMessage {
367371 }
368372 }
369373
374+ /** @spec OD5 */
370375 private static async _decodeObjectData (
371376 objectData : ObjectData ,
372377 client : BaseClient ,
@@ -379,11 +384,12 @@ export class ObjectMessage {
379384 // - if connection is json - "bytes" was received as a base64 string, need to decode it to a buffer
380385
381386 if ( format !== 'msgpack' && objectData . bytes != null ) {
382- // connection is using JSON protocol, decode bytes value
387+ // OD5b2 - connection is using JSON protocol, decode bytes value
383388 objectData . bytes = client . Platform . BufferUtils . base64Decode ( String ( objectData . bytes ) ) ;
384389 }
385390 }
386391
392+ /** @spec OOP5 */
387393 private static _encodeObjectOperation (
388394 objectOperation : ObjectOperation ,
389395 encodeObjectDataFn : EncodeObjectDataFunction ,
@@ -449,6 +455,7 @@ export class ObjectMessage {
449455 return objectStateCopy ;
450456 }
451457
458+ /** @spec OD4 */
452459 private static _encodeObjectData ( data : ObjectData , encodeFn : EncodeObjectDataFunction ) : ObjectData {
453460 const encodedData = encodeFn ( data ) ;
454461 return encodedData ;
@@ -468,6 +475,7 @@ export class ObjectMessage {
468475 objectState ?: ObjectState ;
469476 } {
470477 const encodeInitialValueFn : EncodeInitialValueFunction = ( data , encoding ) => {
478+ // OOP5a1, OOP5b1 - initialValue encoded based on the protocol used
471479 const { data : encodedData , encoding : newEncoding } = messageEncoding . encodeDataForWire ( data , encoding , format ) ;
472480 return {
473481 data : encodedData ,
@@ -484,6 +492,7 @@ export class ObjectMessage {
484492
485493 let encodedBytes : any = data . bytes ;
486494 if ( data . bytes != null ) {
495+ // OD4c2, OD4d2
487496 const result = messageEncoding . encodeDataForWire ( data . bytes , data . encoding , format ) ;
488497 encodedBytes = result . data ;
489498 // no need to change the encoding
0 commit comments