@liveblocks/client 0.16.8 → 0.16.9

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/shared.js CHANGED
@@ -122,23 +122,23 @@ function _createForOfIteratorHelperLoose(o, allowArrayLike) {
122
122
  throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
123
123
  }
124
124
 
125
- var ServerMessageType, ClientMessageType, CrdtType, OpType, WebsocketCloseCodes;
125
+ var ServerMsgCode, ClientMsgCode, CrdtType, OpCode, WebsocketCloseCodes;
126
126
 
127
- exports.ServerMessageType = void 0, (ServerMessageType = exports.ServerMessageType || (exports.ServerMessageType = {}))[ServerMessageType.UpdatePresence = 100] = "UpdatePresence",
128
- ServerMessageType[ServerMessageType.UserJoined = 101] = "UserJoined", ServerMessageType[ServerMessageType.UserLeft = 102] = "UserLeft",
129
- ServerMessageType[ServerMessageType.Event = 103] = "Event", ServerMessageType[ServerMessageType.RoomState = 104] = "RoomState",
130
- ServerMessageType[ServerMessageType.InitialStorageState = 200] = "InitialStorageState",
131
- ServerMessageType[ServerMessageType.UpdateStorage = 201] = "UpdateStorage", exports.ClientMessageType = void 0,
132
- (ClientMessageType = exports.ClientMessageType || (exports.ClientMessageType = {}))[ClientMessageType.UpdatePresence = 100] = "UpdatePresence",
133
- ClientMessageType[ClientMessageType.ClientEvent = 103] = "ClientEvent", ClientMessageType[ClientMessageType.FetchStorage = 200] = "FetchStorage",
134
- ClientMessageType[ClientMessageType.UpdateStorage = 201] = "UpdateStorage", exports.CrdtType = void 0,
135
- (CrdtType = exports.CrdtType || (exports.CrdtType = {}))[CrdtType.Object = 0] = "Object",
136
- CrdtType[CrdtType.List = 1] = "List", CrdtType[CrdtType.Map = 2] = "Map", CrdtType[CrdtType.Register = 3] = "Register",
137
- exports.OpType = void 0, (OpType = exports.OpType || (exports.OpType = {}))[OpType.Init = 0] = "Init",
138
- OpType[OpType.SetParentKey = 1] = "SetParentKey", OpType[OpType.CreateList = 2] = "CreateList",
139
- OpType[OpType.UpdateObject = 3] = "UpdateObject", OpType[OpType.CreateObject = 4] = "CreateObject",
140
- OpType[OpType.DeleteCrdt = 5] = "DeleteCrdt", OpType[OpType.DeleteObjectKey = 6] = "DeleteObjectKey",
141
- OpType[OpType.CreateMap = 7] = "CreateMap", OpType[OpType.CreateRegister = 8] = "CreateRegister",
127
+ exports.ServerMsgCode = void 0, (ServerMsgCode = exports.ServerMsgCode || (exports.ServerMsgCode = {}))[ServerMsgCode.UPDATE_PRESENCE = 100] = "UPDATE_PRESENCE",
128
+ ServerMsgCode[ServerMsgCode.USER_JOINED = 101] = "USER_JOINED", ServerMsgCode[ServerMsgCode.USER_LEFT = 102] = "USER_LEFT",
129
+ ServerMsgCode[ServerMsgCode.BROADCASTED_EVENT = 103] = "BROADCASTED_EVENT", ServerMsgCode[ServerMsgCode.ROOM_STATE = 104] = "ROOM_STATE",
130
+ ServerMsgCode[ServerMsgCode.INITIAL_STORAGE_STATE = 200] = "INITIAL_STORAGE_STATE",
131
+ ServerMsgCode[ServerMsgCode.UPDATE_STORAGE = 201] = "UPDATE_STORAGE", exports.ClientMsgCode = void 0,
132
+ (ClientMsgCode = exports.ClientMsgCode || (exports.ClientMsgCode = {}))[ClientMsgCode.UPDATE_PRESENCE = 100] = "UPDATE_PRESENCE",
133
+ ClientMsgCode[ClientMsgCode.BROADCAST_EVENT = 103] = "BROADCAST_EVENT", ClientMsgCode[ClientMsgCode.FETCH_STORAGE = 200] = "FETCH_STORAGE",
134
+ ClientMsgCode[ClientMsgCode.UPDATE_STORAGE = 201] = "UPDATE_STORAGE", exports.CrdtType = void 0,
135
+ (CrdtType = exports.CrdtType || (exports.CrdtType = {}))[CrdtType.OBJECT = 0] = "OBJECT",
136
+ CrdtType[CrdtType.LIST = 1] = "LIST", CrdtType[CrdtType.MAP = 2] = "MAP", CrdtType[CrdtType.REGISTER = 3] = "REGISTER",
137
+ exports.OpCode = void 0, (OpCode = exports.OpCode || (exports.OpCode = {}))[OpCode.INIT = 0] = "INIT",
138
+ OpCode[OpCode.SET_PARENT_KEY = 1] = "SET_PARENT_KEY", OpCode[OpCode.CREATE_LIST = 2] = "CREATE_LIST",
139
+ OpCode[OpCode.UPDATE_OBJECT = 3] = "UPDATE_OBJECT", OpCode[OpCode.CREATE_OBJECT = 4] = "CREATE_OBJECT",
140
+ OpCode[OpCode.DELETE_CRDT = 5] = "DELETE_CRDT", OpCode[OpCode.DELETE_OBJECT_KEY = 6] = "DELETE_OBJECT_KEY",
141
+ OpCode[OpCode.CREATE_MAP = 7] = "CREATE_MAP", OpCode[OpCode.CREATE_REGISTER = 8] = "CREATE_REGISTER",
142
142
  exports.WebsocketCloseCodes = void 0, (WebsocketCloseCodes = exports.WebsocketCloseCodes || (exports.WebsocketCloseCodes = {}))[WebsocketCloseCodes.CLOSE_ABNORMAL = 1006] = "CLOSE_ABNORMAL",
143
143
  WebsocketCloseCodes[WebsocketCloseCodes.INVALID_MESSAGE_FORMAT = 4e3] = "INVALID_MESSAGE_FORMAT",
144
144
  WebsocketCloseCodes[WebsocketCloseCodes.NOT_ALLOWED = 4001] = "NOT_ALLOWED", WebsocketCloseCodes[WebsocketCloseCodes.MAX_NUMBER_OF_MESSAGES_PER_SECONDS = 4002] = "MAX_NUMBER_OF_MESSAGES_PER_SECONDS",
@@ -153,7 +153,7 @@ var AbstractCrdt = function() {
153
153
  }
154
154
  var _proto = AbstractCrdt.prototype;
155
155
  return _proto._apply = function(op, _isLocal) {
156
- return op.type === exports.OpType.DeleteCrdt && null != this._parent && null != this._parentKey ? this._parent._detachChild(this) : {
156
+ return op.type === exports.OpCode.DELETE_CRDT && null != this._parent && null != this._parentKey ? this._parent._detachChild(this) : {
157
157
  modified: !1
158
158
  };
159
159
  }, _proto._setParentLink = function(parent, key) {
@@ -217,7 +217,7 @@ var _Symbol$iterator$1, _Symbol$iterator2, LiveRegister = function(_AbstractCrdt
217
217
  }
218
218
  _inheritsLoose(LiveRegister, _AbstractCrdt), LiveRegister._deserialize = function(_ref, _parentToChildren, doc) {
219
219
  var id = _ref[0], item = _ref[1];
220
- if (item.type !== exports.CrdtType.Register) throw new Error('Tried to deserialize a map but item type is "' + item.type + '"');
220
+ if (item.type !== exports.CrdtType.REGISTER) throw new Error('Tried to deserialize a map but item type is "' + item.type + '"');
221
221
  var register = new LiveRegister(item.data);
222
222
  return register._attach(id, doc), register;
223
223
  };
@@ -225,7 +225,7 @@ var _Symbol$iterator$1, _Symbol$iterator2, LiveRegister = function(_AbstractCrdt
225
225
  return _proto._serialize = function(parentId, parentKey, doc, intent) {
226
226
  if (null == this._id || null == parentId || null == parentKey) throw new Error("Cannot serialize register if parentId or parentKey is undefined");
227
227
  return [ {
228
- type: exports.OpType.CreateRegister,
228
+ type: exports.OpCode.CREATE_REGISTER,
229
229
  opId: null == doc ? void 0 : doc.generateOpId(),
230
230
  id: this._id,
231
231
  intent: intent,
@@ -236,7 +236,7 @@ var _Symbol$iterator$1, _Symbol$iterator2, LiveRegister = function(_AbstractCrdt
236
236
  }, _proto._toSerializedCrdt = function() {
237
237
  var _this$_parent;
238
238
  return {
239
- type: exports.CrdtType.Register,
239
+ type: exports.CrdtType.REGISTER,
240
240
  parentId: null == (_this$_parent = this._parent) ? void 0 : _this$_parent._id,
241
241
  parentKey: this._parentKey,
242
242
  data: this.data
@@ -355,7 +355,7 @@ var LiveList = function(_AbstractCrdt) {
355
355
  id: this._id,
356
356
  opId: null == doc ? void 0 : doc.generateOpId(),
357
357
  intent: intent,
358
- type: exports.OpType.CreateList,
358
+ type: exports.OpCode.CREATE_LIST,
359
359
  parentId: parentId,
360
360
  parentKey: parentKey
361
361
  };
@@ -423,7 +423,7 @@ var LiveList = function(_AbstractCrdt) {
423
423
  }));
424
424
  return {
425
425
  reverse: [ {
426
- type: exports.OpType.DeleteCrdt,
426
+ type: exports.OpCode.DELETE_CRDT,
427
427
  id: id
428
428
  } ],
429
429
  modified: {
@@ -485,7 +485,7 @@ var LiveList = function(_AbstractCrdt) {
485
485
  } ]
486
486
  },
487
487
  reverse: [ {
488
- type: exports.OpType.SetParentKey,
488
+ type: exports.OpCode.SET_PARENT_KEY,
489
489
  id: null == item ? void 0 : item[0]._id,
490
490
  parentKey: previousKey
491
491
  } ]
@@ -495,7 +495,7 @@ var LiveList = function(_AbstractCrdt) {
495
495
  }, _proto._toSerializedCrdt = function() {
496
496
  var _this$_parent;
497
497
  return {
498
- type: exports.CrdtType.List,
498
+ type: exports.CrdtType.LIST,
499
499
  parentId: null == (_this$_parent = this._parent) ? void 0 : _this$_parent._id,
500
500
  parentKey: this._parentKey
501
501
  };
@@ -523,7 +523,7 @@ var LiveList = function(_AbstractCrdt) {
523
523
  type: "insert"
524
524
  } ]
525
525
  }), this._doc.dispatch(value._serialize(this._id, position, this._doc), [ {
526
- type: exports.OpType.DeleteCrdt,
526
+ type: exports.OpCode.DELETE_CRDT,
527
527
  id: _id
528
528
  } ], storageUpdates);
529
529
  }
@@ -555,12 +555,12 @@ var LiveList = function(_AbstractCrdt) {
555
555
  type: "move"
556
556
  } ]
557
557
  }), this._doc.dispatch([ {
558
- type: exports.OpType.SetParentKey,
558
+ type: exports.OpCode.SET_PARENT_KEY,
559
559
  id: item[0]._id,
560
560
  opId: this._doc.generateOpId(),
561
561
  parentKey: position
562
562
  } ], [ {
563
- type: exports.OpType.SetParentKey,
563
+ type: exports.OpCode.SET_PARENT_KEY,
564
564
  id: item[0]._id,
565
565
  parentKey: previousPosition
566
566
  } ], storageUpdates);
@@ -582,7 +582,7 @@ var LiveList = function(_AbstractCrdt) {
582
582
  }), this._doc.dispatch([ {
583
583
  id: childRecordId,
584
584
  opId: this._doc.generateOpId(),
585
- type: exports.OpType.DeleteCrdt
585
+ type: exports.OpCode.DELETE_CRDT
586
586
  } ], item[0]._serialize(this._id, item[1]), storageUpdates);
587
587
  }
588
588
  }
@@ -594,7 +594,7 @@ var LiveList = function(_AbstractCrdt) {
594
594
  var childId = _item3[0]._id;
595
595
  childId && (ops.push({
596
596
  id: childId,
597
- type: exports.OpType.DeleteCrdt
597
+ type: exports.OpCode.DELETE_CRDT
598
598
  }), reverseOps.push.apply(reverseOps, _item3[0]._serialize(this._id, _item3[1])),
599
599
  updateDelta.push({
600
600
  index: i,
@@ -728,7 +728,7 @@ var LiveMap = function(_AbstractCrdt) {
728
728
  var ops = [], op = {
729
729
  id: this._id,
730
730
  opId: null == doc ? void 0 : doc.generateOpId(),
731
- type: exports.OpType.CreateMap,
731
+ type: exports.OpCode.CREATE_MAP,
732
732
  intent: intent,
733
733
  parentId: parentId,
734
734
  parentKey: parentKey
@@ -741,7 +741,7 @@ var LiveMap = function(_AbstractCrdt) {
741
741
  return ops;
742
742
  }, LiveMap._deserialize = function(_ref, parentToChildren, doc) {
743
743
  var id = _ref[0], item = _ref[1];
744
- if (item.type !== exports.CrdtType.Map) throw new Error('Tried to deserialize a map but item type is "' + item.type + '"');
744
+ if (item.type !== exports.CrdtType.MAP) throw new Error('Tried to deserialize a map but item type is "' + item.type + '"');
745
745
  var map = new LiveMap;
746
746
  map._attach(id, doc);
747
747
  var children = parentToChildren.get(id);
@@ -770,7 +770,7 @@ var LiveMap = function(_AbstractCrdt) {
770
770
  };
771
771
  var reverse, previousValue = this._map.get(key);
772
772
  return previousValue ? (reverse = previousValue._serialize(this._id, key), previousValue._detach()) : reverse = [ {
773
- type: exports.OpType.DeleteCrdt,
773
+ type: exports.OpCode.DELETE_CRDT,
774
774
  id: id
775
775
  } ], child._setParentLink(this, key), child._attach(id, this._doc), this._map.set(key, child),
776
776
  {
@@ -806,7 +806,7 @@ var LiveMap = function(_AbstractCrdt) {
806
806
  }, _proto._toSerializedCrdt = function() {
807
807
  var _this$_parent;
808
808
  return {
809
- type: exports.CrdtType.Map,
809
+ type: exports.CrdtType.MAP,
810
810
  parentId: null == (_this$_parent = this._parent) ? void 0 : _this$_parent._id,
811
811
  parentKey: this._parentKey
812
812
  };
@@ -828,7 +828,7 @@ var LiveMap = function(_AbstractCrdt) {
828
828
  type: "update"
829
829
  }, _updates3)
830
830
  }), this._doc.dispatch(item._serialize(this._id, key, this._doc), oldValue ? oldValue._serialize(this._id, key) : [ {
831
- type: exports.OpType.DeleteCrdt,
831
+ type: exports.OpCode.DELETE_CRDT,
832
832
  id: id
833
833
  } ], storageUpdates);
834
834
  }
@@ -846,7 +846,7 @@ var LiveMap = function(_AbstractCrdt) {
846
846
  type: "delete"
847
847
  }, _updates4)
848
848
  }), this._doc.dispatch([ {
849
- type: exports.OpType.DeleteCrdt,
849
+ type: exports.OpCode.DELETE_CRDT,
850
850
  id: item._id,
851
851
  opId: this._doc.generateOpId()
852
852
  } ], item._serialize(this._id, key), storageUpdates);
@@ -897,32 +897,32 @@ var LiveMap = function(_AbstractCrdt) {
897
897
 
898
898
  function creationOpToLiveStructure(op) {
899
899
  switch (op.type) {
900
- case exports.OpType.CreateRegister:
900
+ case exports.OpCode.CREATE_REGISTER:
901
901
  return new LiveRegister(op.data);
902
902
 
903
- case exports.OpType.CreateObject:
903
+ case exports.OpCode.CREATE_OBJECT:
904
904
  return new LiveObject(op.data);
905
905
 
906
- case exports.OpType.CreateMap:
906
+ case exports.OpCode.CREATE_MAP:
907
907
  return new LiveMap;
908
908
 
909
- case exports.OpType.CreateList:
909
+ case exports.OpCode.CREATE_LIST:
910
910
  return new LiveList;
911
911
  }
912
912
  }
913
913
 
914
914
  function deserialize(entry, parentToChildren, doc) {
915
915
  switch (entry[1].type) {
916
- case exports.CrdtType.Object:
916
+ case exports.CrdtType.OBJECT:
917
917
  return LiveObject._deserialize(entry, parentToChildren, doc);
918
918
 
919
- case exports.CrdtType.List:
919
+ case exports.CrdtType.LIST:
920
920
  return LiveList._deserialize(entry, parentToChildren, doc);
921
921
 
922
- case exports.CrdtType.Map:
922
+ case exports.CrdtType.MAP:
923
923
  return LiveMap._deserialize(entry, parentToChildren, doc);
924
924
 
925
- case exports.CrdtType.Register:
925
+ case exports.CrdtType.REGISTER:
926
926
  return LiveRegister._deserialize(entry, parentToChildren, doc);
927
927
 
928
928
  default:
@@ -978,7 +978,7 @@ var LiveObject = function(_AbstractCrdt) {
978
978
  id: this._id,
979
979
  opId: null == doc ? void 0 : doc.generateOpId(),
980
980
  intent: intent,
981
- type: exports.OpType.CreateObject,
981
+ type: exports.OpCode.CREATE_OBJECT,
982
982
  parentId: parentId,
983
983
  parentKey: parentKey,
984
984
  data: {}
@@ -991,7 +991,7 @@ var LiveObject = function(_AbstractCrdt) {
991
991
  return ops;
992
992
  }, LiveObject._deserialize = function(_ref, parentToChildren, doc) {
993
993
  var id = _ref[0], item = _ref[1];
994
- if (item.type !== exports.CrdtType.Object) throw new Error('Tried to deserialize a record but item type is "' + item.type + '"');
994
+ if (item.type !== exports.CrdtType.OBJECT) throw new Error('Tried to deserialize a record but item type is "' + item.type + '"');
995
995
  var liveObj = new LiveObject(item.data);
996
996
  return liveObj._attach(id, doc), this._deserializeChildren(liveObj, parentToChildren, doc);
997
997
  }, LiveObject._deserializeChildren = function(liveObj, parentToChildren, doc) {
@@ -1028,13 +1028,13 @@ var LiveObject = function(_AbstractCrdt) {
1028
1028
  };
1029
1029
  var reverse, previousValue = this._map.get(key);
1030
1030
  if (isCrdt(previousValue)) reverse = previousValue._serialize(this._id, key), previousValue._detach(); else if (void 0 === previousValue) reverse = [ {
1031
- type: exports.OpType.DeleteObjectKey,
1031
+ type: exports.OpCode.DELETE_OBJECT_KEY,
1032
1032
  id: this._id,
1033
1033
  key: key
1034
1034
  } ]; else {
1035
1035
  var _data;
1036
1036
  reverse = [ {
1037
- type: exports.OpType.UpdateObject,
1037
+ type: exports.OpCode.UPDATE_OBJECT,
1038
1038
  id: this._id,
1039
1039
  data: (_data = {}, _data[key] = previousValue, _data)
1040
1040
  } ];
@@ -1082,21 +1082,21 @@ var LiveObject = function(_AbstractCrdt) {
1082
1082
  isCrdt(value) && value._detach();
1083
1083
  }
1084
1084
  }, _proto._apply = function(op, isLocal) {
1085
- return op.type === exports.OpType.UpdateObject ? this._applyUpdate(op, isLocal) : op.type === exports.OpType.DeleteObjectKey ? this._applyDeleteObjectKey(op) : _AbstractCrdt.prototype._apply.call(this, op, isLocal);
1085
+ return op.type === exports.OpCode.UPDATE_OBJECT ? this._applyUpdate(op, isLocal) : op.type === exports.OpCode.DELETE_OBJECT_KEY ? this._applyDeleteObjectKey(op) : _AbstractCrdt.prototype._apply.call(this, op, isLocal);
1086
1086
  }, _proto._toSerializedCrdt = function() {
1087
1087
  for (var _this$_parent, _step7, data = {}, _iterator7 = _createForOfIteratorHelperLoose(this._map); !(_step7 = _iterator7()).done; ) {
1088
1088
  var _step7$value = _step7.value, key = _step7$value[0], value = _step7$value[1];
1089
1089
  value instanceof AbstractCrdt == !1 && (data[key] = value);
1090
1090
  }
1091
1091
  return {
1092
- type: exports.CrdtType.Object,
1092
+ type: exports.CrdtType.OBJECT,
1093
1093
  parentId: null == (_this$_parent = this._parent) ? void 0 : _this$_parent._id,
1094
1094
  parentKey: this._parentKey,
1095
1095
  data: data
1096
1096
  };
1097
1097
  }, _proto._applyUpdate = function(op, isLocal) {
1098
1098
  var isModified = !1, reverse = [], reverseUpdate = {
1099
- type: exports.OpType.UpdateObject,
1099
+ type: exports.OpCode.UPDATE_OBJECT,
1100
1100
  id: this._id,
1101
1101
  data: {}
1102
1102
  };
@@ -1104,7 +1104,7 @@ var LiveObject = function(_AbstractCrdt) {
1104
1104
  var oldValue = this._map.get(key);
1105
1105
  oldValue instanceof AbstractCrdt ? (reverse.push.apply(reverse, oldValue._serialize(this._id, key)),
1106
1106
  oldValue._detach()) : void 0 !== oldValue ? reverseUpdate.data[key] = oldValue : void 0 === oldValue && reverse.push({
1107
- type: exports.OpType.DeleteObjectKey,
1107
+ type: exports.OpCode.DELETE_OBJECT_KEY,
1108
1108
  id: this._id,
1109
1109
  key: key
1110
1110
  });
@@ -1149,7 +1149,7 @@ var LiveObject = function(_AbstractCrdt) {
1149
1149
  if (isCrdt(oldValue)) reverse = oldValue._serialize(this._id, op.key), oldValue._detach(); else if (void 0 !== oldValue) {
1150
1150
  var _data2;
1151
1151
  reverse = [ {
1152
- type: exports.OpType.UpdateObject,
1152
+ type: exports.OpCode.UPDATE_OBJECT,
1153
1153
  id: this._id,
1154
1154
  data: (_data2 = {}, _data2[key] = oldValue, _data2)
1155
1155
  } ];
@@ -1184,7 +1184,7 @@ var LiveObject = function(_AbstractCrdt) {
1184
1184
  void this._map.delete(keyAsString);
1185
1185
  var reverse, _data3;
1186
1186
  if (oldValue instanceof AbstractCrdt) oldValue._detach(), reverse = oldValue._serialize(this._id, keyAsString); else reverse = [ {
1187
- type: exports.OpType.UpdateObject,
1187
+ type: exports.OpCode.UPDATE_OBJECT,
1188
1188
  data: (_data3 = {}, _data3[keyAsString] = oldValue, _data3),
1189
1189
  id: this._id
1190
1190
  } ];
@@ -1197,7 +1197,7 @@ var LiveObject = function(_AbstractCrdt) {
1197
1197
  type: "delete"
1198
1198
  }, _updates4)
1199
1199
  }), this._doc.dispatch([ {
1200
- type: exports.OpType.DeleteObjectKey,
1200
+ type: exports.OpCode.DELETE_OBJECT_KEY,
1201
1201
  key: keyAsString,
1202
1202
  id: this._id,
1203
1203
  opId: this._doc.generateOpId()
@@ -1208,14 +1208,14 @@ var LiveObject = function(_AbstractCrdt) {
1208
1208
  if (null != this._doc && null != this._id) {
1209
1209
  var ops = [], reverseOps = [], opId = this._doc.generateOpId(), updatedProps = {}, reverseUpdateOp = {
1210
1210
  id: this._id,
1211
- type: exports.OpType.UpdateObject,
1211
+ type: exports.OpCode.UPDATE_OBJECT,
1212
1212
  data: {}
1213
1213
  }, updateDelta = {};
1214
1214
  for (var _key3 in overrides) {
1215
1215
  var _oldValue2 = this._map.get(_key3);
1216
1216
  _oldValue2 instanceof AbstractCrdt ? (reverseOps.push.apply(reverseOps, _oldValue2._serialize(this._id, _key3)),
1217
1217
  _oldValue2._detach()) : void 0 === _oldValue2 ? reverseOps.push({
1218
- type: exports.OpType.DeleteObjectKey,
1218
+ type: exports.OpCode.DELETE_OBJECT_KEY,
1219
1219
  id: this._id,
1220
1220
  key: _key3
1221
1221
  }) : reverseUpdateOp.data[_key3] = _oldValue2;
@@ -1235,7 +1235,7 @@ var LiveObject = function(_AbstractCrdt) {
1235
1235
  0 !== Object.keys(updatedProps).length && ops.unshift({
1236
1236
  opId: opId,
1237
1237
  id: this._id,
1238
- type: exports.OpType.UpdateObject,
1238
+ type: exports.OpCode.UPDATE_OBJECT,
1239
1239
  data: updatedProps
1240
1240
  });
1241
1241
  var storageUpdates = new Map;
@@ -1289,23 +1289,23 @@ exports.errorIf = function(condition, message) {
1289
1289
  var ops = [];
1290
1290
  return currentItems.forEach((function(_, id) {
1291
1291
  newItems.get(id) || ops.push({
1292
- type: exports.OpType.DeleteCrdt,
1292
+ type: exports.OpCode.DELETE_CRDT,
1293
1293
  id: id
1294
1294
  });
1295
1295
  })), newItems.forEach((function(crdt, id) {
1296
1296
  var currentCrdt = currentItems.get(id);
1297
- if (currentCrdt) crdt.type === exports.CrdtType.Object && JSON.stringify(crdt.data) !== JSON.stringify(currentCrdt.data) && ops.push({
1298
- type: exports.OpType.UpdateObject,
1297
+ if (currentCrdt) crdt.type === exports.CrdtType.OBJECT && JSON.stringify(crdt.data) !== JSON.stringify(currentCrdt.data) && ops.push({
1298
+ type: exports.OpCode.UPDATE_OBJECT,
1299
1299
  id: id,
1300
1300
  data: crdt.data
1301
1301
  }), crdt.parentKey !== currentCrdt.parentKey && ops.push({
1302
- type: exports.OpType.SetParentKey,
1302
+ type: exports.OpCode.SET_PARENT_KEY,
1303
1303
  id: id,
1304
1304
  parentKey: crdt.parentKey
1305
1305
  }); else switch (crdt.type) {
1306
- case exports.CrdtType.Register:
1306
+ case exports.CrdtType.REGISTER:
1307
1307
  ops.push({
1308
- type: exports.OpType.CreateRegister,
1308
+ type: exports.OpCode.CREATE_REGISTER,
1309
1309
  id: id,
1310
1310
  parentId: crdt.parentId,
1311
1311
  parentKey: crdt.parentKey,
@@ -1313,18 +1313,18 @@ exports.errorIf = function(condition, message) {
1313
1313
  });
1314
1314
  break;
1315
1315
 
1316
- case exports.CrdtType.List:
1316
+ case exports.CrdtType.LIST:
1317
1317
  ops.push({
1318
- type: exports.OpType.CreateList,
1318
+ type: exports.OpCode.CREATE_LIST,
1319
1319
  id: id,
1320
1320
  parentId: crdt.parentId,
1321
1321
  parentKey: crdt.parentKey
1322
1322
  });
1323
1323
  break;
1324
1324
 
1325
- case exports.CrdtType.Object:
1325
+ case exports.CrdtType.OBJECT:
1326
1326
  ops.push({
1327
- type: exports.OpType.CreateObject,
1327
+ type: exports.OpCode.CREATE_OBJECT,
1328
1328
  id: id,
1329
1329
  parentId: crdt.parentId,
1330
1330
  parentKey: crdt.parentKey,
@@ -1332,9 +1332,9 @@ exports.errorIf = function(condition, message) {
1332
1332
  });
1333
1333
  break;
1334
1334
 
1335
- case exports.CrdtType.Map:
1335
+ case exports.CrdtType.MAP:
1336
1336
  ops.push({
1337
- type: exports.OpType.CreateMap,
1337
+ type: exports.OpCode.CREATE_MAP,
1338
1338
  id: id,
1339
1339
  parentId: crdt.parentId,
1340
1340
  parentKey: crdt.parentKey