@wireapp/protocol-messaging 1.49.0 → 1.50.0

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/package.json CHANGED
@@ -27,5 +27,5 @@
27
27
  "preversion": "git checkout master && git pull && yarn && yarn dist && yarn test",
28
28
  "test": "tsc --noEmit"
29
29
  },
30
- "version": "1.49.0"
30
+ "version": "1.50.0"
31
31
  }
@@ -47,6 +47,16 @@ message GenericMessage {
47
47
  ButtonActionConfirmation buttonActionConfirmation = 22;
48
48
  DataTransfer dataTransfer = 23; // client-side synchronization across devices of the same user
49
49
  InCallEmoji inCallEmoji = 24;
50
+ // UnknownStrategy unknownStrategy = 25; -- Defined outside the oneof
51
+ // Next field should be 26 ↓
52
+ }
53
+ optional UnknownStrategy unknownStrategy = 25 [default = IGNORE];
54
+
55
+ // See internal RFC: "2024-07-18 RFC Improve future-proofing for new OTR message types"
56
+ enum UnknownStrategy {
57
+ IGNORE = 0; // Ignore the message completely. Trash. Bye
58
+ DISCARD_AND_WARN = 1; // Warn the user, but discard the message, as it won't be helpful in the future.
59
+ WARN_USER_ALLOW_RETRY = 2; // Warn the user. Client has freedom to store it and retry in the future.
50
60
  }
51
61
  }
52
62
 
package/web/messages.d.ts CHANGED
@@ -24,6 +24,7 @@ export interface IGenericMessage {
24
24
  buttonActionConfirmation?: (IButtonActionConfirmation|null);
25
25
  dataTransfer?: (IDataTransfer|null);
26
26
  inCallEmoji?: (IInCallEmoji|null);
27
+ unknownStrategy?: (GenericMessage.UnknownStrategy|null);
27
28
  }
28
29
 
29
30
  export class GenericMessage implements IGenericMessage {
@@ -51,6 +52,7 @@ export class GenericMessage implements IGenericMessage {
51
52
  public buttonActionConfirmation?: (IButtonActionConfirmation|null);
52
53
  public dataTransfer?: (IDataTransfer|null);
53
54
  public inCallEmoji?: (IInCallEmoji|null);
55
+ public unknownStrategy: GenericMessage.UnknownStrategy;
54
56
  public content?: ("text"|"image"|"knock"|"lastRead"|"cleared"|"external"|"clientAction"|"calling"|"asset"|"hidden"|"location"|"deleted"|"edited"|"confirmation"|"reaction"|"ephemeral"|"availability"|"composite"|"buttonAction"|"buttonActionConfirmation"|"dataTransfer"|"inCallEmoji");
55
57
  public static create(properties?: IGenericMessage): GenericMessage;
56
58
  public static encode(message: IGenericMessage, writer?: $protobuf.Writer): $protobuf.Writer;
@@ -64,6 +66,15 @@ export class GenericMessage implements IGenericMessage {
64
66
  public static getTypeUrl(typeUrlPrefix?: string): string;
65
67
  }
66
68
 
69
+ export namespace GenericMessage {
70
+
71
+ enum UnknownStrategy {
72
+ IGNORE = 0,
73
+ DISCARD_AND_WARN = 1,
74
+ WARN_USER_ALLOW_RETRY = 2
75
+ }
76
+ }
77
+
67
78
  export interface IQualifiedUserId {
68
79
  id: string;
69
80
  domain: string;
package/web/messages.js CHANGED
@@ -38,6 +38,7 @@ $root.GenericMessage = (function() {
38
38
  * @property {IButtonActionConfirmation|null} [buttonActionConfirmation] GenericMessage buttonActionConfirmation
39
39
  * @property {IDataTransfer|null} [dataTransfer] GenericMessage dataTransfer
40
40
  * @property {IInCallEmoji|null} [inCallEmoji] GenericMessage inCallEmoji
41
+ * @property {GenericMessage.UnknownStrategy|null} [unknownStrategy] GenericMessage unknownStrategy
41
42
  */
42
43
 
43
44
  /**
@@ -239,6 +240,14 @@ $root.GenericMessage = (function() {
239
240
  */
240
241
  GenericMessage.prototype.inCallEmoji = null;
241
242
 
243
+ /**
244
+ * GenericMessage unknownStrategy.
245
+ * @member {GenericMessage.UnknownStrategy} unknownStrategy
246
+ * @memberof GenericMessage
247
+ * @instance
248
+ */
249
+ GenericMessage.prototype.unknownStrategy = 0;
250
+
242
251
  // OneOf field names bound to virtual getters and setters
243
252
  var $oneOfFields;
244
253
 
@@ -322,6 +331,8 @@ $root.GenericMessage = (function() {
322
331
  $root.DataTransfer.encode(message.dataTransfer, writer.uint32(/* id 23, wireType 2 =*/186).fork()).ldelim();
323
332
  if (message.inCallEmoji != null && Object.hasOwnProperty.call(message, "inCallEmoji"))
324
333
  $root.InCallEmoji.encode(message.inCallEmoji, writer.uint32(/* id 24, wireType 2 =*/194).fork()).ldelim();
334
+ if (message.unknownStrategy != null && Object.hasOwnProperty.call(message, "unknownStrategy"))
335
+ writer.uint32(/* id 25, wireType 0 =*/200).int32(message.unknownStrategy);
325
336
  return writer;
326
337
  };
327
338
 
@@ -448,6 +459,10 @@ $root.GenericMessage = (function() {
448
459
  message.inCallEmoji = $root.InCallEmoji.decode(reader, reader.uint32());
449
460
  break;
450
461
  }
462
+ case 25: {
463
+ message.unknownStrategy = reader.int32();
464
+ break;
465
+ }
451
466
  default:
452
467
  reader.skipType(tag & 7);
453
468
  break;
@@ -707,6 +722,15 @@ $root.GenericMessage = (function() {
707
722
  return "inCallEmoji." + error;
708
723
  }
709
724
  }
725
+ if (message.unknownStrategy != null && message.hasOwnProperty("unknownStrategy"))
726
+ switch (message.unknownStrategy) {
727
+ default:
728
+ return "unknownStrategy: enum value expected";
729
+ case 0:
730
+ case 1:
731
+ case 2:
732
+ break;
733
+ }
710
734
  return null;
711
735
  };
712
736
 
@@ -841,6 +865,26 @@ $root.GenericMessage = (function() {
841
865
  throw TypeError(".GenericMessage.inCallEmoji: object expected");
842
866
  message.inCallEmoji = $root.InCallEmoji.fromObject(object.inCallEmoji);
843
867
  }
868
+ switch (object.unknownStrategy) {
869
+ default:
870
+ if (typeof object.unknownStrategy === "number") {
871
+ message.unknownStrategy = object.unknownStrategy;
872
+ break;
873
+ }
874
+ break;
875
+ case "IGNORE":
876
+ case 0:
877
+ message.unknownStrategy = 0;
878
+ break;
879
+ case "DISCARD_AND_WARN":
880
+ case 1:
881
+ message.unknownStrategy = 1;
882
+ break;
883
+ case "WARN_USER_ALLOW_RETRY":
884
+ case 2:
885
+ message.unknownStrategy = 2;
886
+ break;
887
+ }
844
888
  return message;
845
889
  };
846
890
 
@@ -857,8 +901,10 @@ $root.GenericMessage = (function() {
857
901
  if (!options)
858
902
  options = {};
859
903
  var object = {};
860
- if (options.defaults)
904
+ if (options.defaults) {
861
905
  object.messageId = "";
906
+ object.unknownStrategy = options.enums === String ? "IGNORE" : 0;
907
+ }
862
908
  if (message.messageId != null && message.hasOwnProperty("messageId"))
863
909
  object.messageId = message.messageId;
864
910
  if (message.text != null && message.hasOwnProperty("text")) {
@@ -971,6 +1017,8 @@ $root.GenericMessage = (function() {
971
1017
  if (options.oneofs)
972
1018
  object.content = "inCallEmoji";
973
1019
  }
1020
+ if (message.unknownStrategy != null && message.hasOwnProperty("unknownStrategy"))
1021
+ object.unknownStrategy = options.enums === String ? $root.GenericMessage.UnknownStrategy[message.unknownStrategy] === undefined ? message.unknownStrategy : $root.GenericMessage.UnknownStrategy[message.unknownStrategy] : message.unknownStrategy;
974
1022
  return object;
975
1023
  };
976
1024
 
@@ -1000,6 +1048,22 @@ $root.GenericMessage = (function() {
1000
1048
  return typeUrlPrefix + "/GenericMessage";
1001
1049
  };
1002
1050
 
1051
+ /**
1052
+ * UnknownStrategy enum.
1053
+ * @name GenericMessage.UnknownStrategy
1054
+ * @enum {number}
1055
+ * @property {number} IGNORE=0 IGNORE value
1056
+ * @property {number} DISCARD_AND_WARN=1 DISCARD_AND_WARN value
1057
+ * @property {number} WARN_USER_ALLOW_RETRY=2 WARN_USER_ALLOW_RETRY value
1058
+ */
1059
+ GenericMessage.UnknownStrategy = (function() {
1060
+ var valuesById = {}, values = Object.create(valuesById);
1061
+ values[valuesById[0] = "IGNORE"] = 0;
1062
+ values[valuesById[1] = "DISCARD_AND_WARN"] = 1;
1063
+ values[valuesById[2] = "WARN_USER_ALLOW_RETRY"] = 2;
1064
+ return values;
1065
+ })();
1066
+
1003
1067
  return GenericMessage;
1004
1068
  })();
1005
1069