@sudoplatform/sudo-secure-communications 5.3.1 → 5.4.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.
Files changed (24) hide show
  1. package/cjs/private/data/common/matrixClientManager.js +42 -21
  2. package/cjs/private/data/common/matrixClientManager.js.map +1 -1
  3. package/cjs/private/data/messaging/matrixMessagingService.js +29 -7
  4. package/cjs/private/data/messaging/matrixMessagingService.js.map +1 -1
  5. package/cjs/private/data/messaging/transformer/messageTransformer.js +39 -8
  6. package/cjs/private/data/messaging/transformer/messageTransformer.js.map +1 -1
  7. package/lib/private/data/common/matrixClientManager.js +42 -21
  8. package/lib/private/data/common/matrixClientManager.js.map +1 -1
  9. package/lib/private/data/messaging/matrixMessagingService.js +29 -7
  10. package/lib/private/data/messaging/matrixMessagingService.js.map +1 -1
  11. package/lib/private/data/messaging/transformer/messageTransformer.js +39 -8
  12. package/lib/private/data/messaging/transformer/messageTransformer.js.map +1 -1
  13. package/package.json +103 -66
  14. package/types/private/data/common/matrixClientManager.d.ts +6 -1
  15. package/vendor/matrix-js-sdk/lib/client.cjs +3766 -2572
  16. package/vendor/matrix-js-sdk/lib/client.js +3766 -2572
  17. package/vendor/matrix-js-sdk/lib/crypto-api.cjs +9 -0
  18. package/vendor/matrix-js-sdk/lib/crypto-api.js +9 -0
  19. package/vendor/matrix-js-sdk/lib/matrix.cjs +4592 -2992
  20. package/vendor/matrix-js-sdk/lib/matrix.js +4592 -2992
  21. package/vendor/matrix-js-sdk/lib/sliding-sync.cjs +12 -319
  22. package/vendor/matrix-js-sdk/lib/sliding-sync.js +12 -319
  23. package/vendor/matrix-js-sdk/matrix-js-sdk.cjs +4603 -2992
  24. package/vendor/matrix-js-sdk/matrix-js-sdk.js +4603 -2992
@@ -7016,316 +7016,6 @@ var require_unhomoglyph = __commonJS({
7016
7016
  }
7017
7017
  });
7018
7018
 
7019
- // node_modules/retry/lib/retry_operation.js
7020
- var require_retry_operation = __commonJS({
7021
- "node_modules/retry/lib/retry_operation.js"(exports, module) {
7022
- function RetryOperation(timeouts, options) {
7023
- if (typeof options === "boolean") {
7024
- options = { forever: options };
7025
- }
7026
- this._originalTimeouts = JSON.parse(JSON.stringify(timeouts));
7027
- this._timeouts = timeouts;
7028
- this._options = options || {};
7029
- this._maxRetryTime = options && options.maxRetryTime || Infinity;
7030
- this._fn = null;
7031
- this._errors = [];
7032
- this._attempts = 1;
7033
- this._operationTimeout = null;
7034
- this._operationTimeoutCb = null;
7035
- this._timeout = null;
7036
- this._operationStart = null;
7037
- this._timer = null;
7038
- if (this._options.forever) {
7039
- this._cachedTimeouts = this._timeouts.slice(0);
7040
- }
7041
- }
7042
- __name(RetryOperation, "RetryOperation");
7043
- module.exports = RetryOperation;
7044
- RetryOperation.prototype.reset = function() {
7045
- this._attempts = 1;
7046
- this._timeouts = this._originalTimeouts.slice(0);
7047
- };
7048
- RetryOperation.prototype.stop = function() {
7049
- if (this._timeout) {
7050
- clearTimeout(this._timeout);
7051
- }
7052
- if (this._timer) {
7053
- clearTimeout(this._timer);
7054
- }
7055
- this._timeouts = [];
7056
- this._cachedTimeouts = null;
7057
- };
7058
- RetryOperation.prototype.retry = function(err) {
7059
- if (this._timeout) {
7060
- clearTimeout(this._timeout);
7061
- }
7062
- if (!err) {
7063
- return false;
7064
- }
7065
- var currentTime = (/* @__PURE__ */ new Date()).getTime();
7066
- if (err && currentTime - this._operationStart >= this._maxRetryTime) {
7067
- this._errors.push(err);
7068
- this._errors.unshift(new Error("RetryOperation timeout occurred"));
7069
- return false;
7070
- }
7071
- this._errors.push(err);
7072
- var timeout = this._timeouts.shift();
7073
- if (timeout === void 0) {
7074
- if (this._cachedTimeouts) {
7075
- this._errors.splice(0, this._errors.length - 1);
7076
- timeout = this._cachedTimeouts.slice(-1);
7077
- } else {
7078
- return false;
7079
- }
7080
- }
7081
- var self = this;
7082
- this._timer = setTimeout(function() {
7083
- self._attempts++;
7084
- if (self._operationTimeoutCb) {
7085
- self._timeout = setTimeout(function() {
7086
- self._operationTimeoutCb(self._attempts);
7087
- }, self._operationTimeout);
7088
- if (self._options.unref) {
7089
- self._timeout.unref();
7090
- }
7091
- }
7092
- self._fn(self._attempts);
7093
- }, timeout);
7094
- if (this._options.unref) {
7095
- this._timer.unref();
7096
- }
7097
- return true;
7098
- };
7099
- RetryOperation.prototype.attempt = function(fn, timeoutOps) {
7100
- this._fn = fn;
7101
- if (timeoutOps) {
7102
- if (timeoutOps.timeout) {
7103
- this._operationTimeout = timeoutOps.timeout;
7104
- }
7105
- if (timeoutOps.cb) {
7106
- this._operationTimeoutCb = timeoutOps.cb;
7107
- }
7108
- }
7109
- var self = this;
7110
- if (this._operationTimeoutCb) {
7111
- this._timeout = setTimeout(function() {
7112
- self._operationTimeoutCb();
7113
- }, self._operationTimeout);
7114
- }
7115
- this._operationStart = (/* @__PURE__ */ new Date()).getTime();
7116
- this._fn(this._attempts);
7117
- };
7118
- RetryOperation.prototype.try = function(fn) {
7119
- console.log("Using RetryOperation.try() is deprecated");
7120
- this.attempt(fn);
7121
- };
7122
- RetryOperation.prototype.start = function(fn) {
7123
- console.log("Using RetryOperation.start() is deprecated");
7124
- this.attempt(fn);
7125
- };
7126
- RetryOperation.prototype.start = RetryOperation.prototype.try;
7127
- RetryOperation.prototype.errors = function() {
7128
- return this._errors;
7129
- };
7130
- RetryOperation.prototype.attempts = function() {
7131
- return this._attempts;
7132
- };
7133
- RetryOperation.prototype.mainError = function() {
7134
- if (this._errors.length === 0) {
7135
- return null;
7136
- }
7137
- var counts = {};
7138
- var mainError = null;
7139
- var mainErrorCount = 0;
7140
- for (var i = 0; i < this._errors.length; i++) {
7141
- var error = this._errors[i];
7142
- var message = error.message;
7143
- var count = (counts[message] || 0) + 1;
7144
- counts[message] = count;
7145
- if (count >= mainErrorCount) {
7146
- mainError = error;
7147
- mainErrorCount = count;
7148
- }
7149
- }
7150
- return mainError;
7151
- };
7152
- }
7153
- });
7154
-
7155
- // node_modules/retry/lib/retry.js
7156
- var require_retry = __commonJS({
7157
- "node_modules/retry/lib/retry.js"(exports) {
7158
- var RetryOperation = require_retry_operation();
7159
- exports.operation = function(options) {
7160
- var timeouts = exports.timeouts(options);
7161
- return new RetryOperation(timeouts, {
7162
- forever: options && (options.forever || options.retries === Infinity),
7163
- unref: options && options.unref,
7164
- maxRetryTime: options && options.maxRetryTime
7165
- });
7166
- };
7167
- exports.timeouts = function(options) {
7168
- if (options instanceof Array) {
7169
- return [].concat(options);
7170
- }
7171
- var opts = {
7172
- retries: 10,
7173
- factor: 2,
7174
- minTimeout: 1 * 1e3,
7175
- maxTimeout: Infinity,
7176
- randomize: false
7177
- };
7178
- for (var key in options) {
7179
- opts[key] = options[key];
7180
- }
7181
- if (opts.minTimeout > opts.maxTimeout) {
7182
- throw new Error("minTimeout is greater than maxTimeout");
7183
- }
7184
- var timeouts = [];
7185
- for (var i = 0; i < opts.retries; i++) {
7186
- timeouts.push(this.createTimeout(i, opts));
7187
- }
7188
- if (options && options.forever && !timeouts.length) {
7189
- timeouts.push(this.createTimeout(i, opts));
7190
- }
7191
- timeouts.sort(function(a, b) {
7192
- return a - b;
7193
- });
7194
- return timeouts;
7195
- };
7196
- exports.createTimeout = function(attempt, opts) {
7197
- var random = opts.randomize ? Math.random() + 1 : 1;
7198
- var timeout = Math.round(random * Math.max(opts.minTimeout, 1) * Math.pow(opts.factor, attempt));
7199
- timeout = Math.min(timeout, opts.maxTimeout);
7200
- return timeout;
7201
- };
7202
- exports.wrap = function(obj, options, methods) {
7203
- if (options instanceof Array) {
7204
- methods = options;
7205
- options = null;
7206
- }
7207
- if (!methods) {
7208
- methods = [];
7209
- for (var key in obj) {
7210
- if (typeof obj[key] === "function") {
7211
- methods.push(key);
7212
- }
7213
- }
7214
- }
7215
- for (var i = 0; i < methods.length; i++) {
7216
- var method = methods[i];
7217
- var original = obj[method];
7218
- obj[method] = (/* @__PURE__ */ __name(function retryWrapper(original2) {
7219
- var op = exports.operation(options);
7220
- var args = Array.prototype.slice.call(arguments, 1);
7221
- var callback = args.pop();
7222
- args.push(function(err) {
7223
- if (op.retry(err)) {
7224
- return;
7225
- }
7226
- if (err) {
7227
- arguments[0] = op.mainError();
7228
- }
7229
- callback.apply(this, arguments);
7230
- });
7231
- op.attempt(function() {
7232
- original2.apply(obj, args);
7233
- });
7234
- }, "retryWrapper")).bind(obj, original);
7235
- obj[method].options = options;
7236
- }
7237
- };
7238
- }
7239
- });
7240
-
7241
- // node_modules/retry/index.js
7242
- var require_retry2 = __commonJS({
7243
- "node_modules/retry/index.js"(exports, module) {
7244
- module.exports = require_retry();
7245
- }
7246
- });
7247
-
7248
- // node_modules/p-retry/index.js
7249
- var require_p_retry = __commonJS({
7250
- "node_modules/p-retry/index.js"(exports, module) {
7251
- "use strict";
7252
- var retry = require_retry2();
7253
- var networkErrorMsgs = [
7254
- "Failed to fetch",
7255
- // Chrome
7256
- "NetworkError when attempting to fetch resource.",
7257
- // Firefox
7258
- "The Internet connection appears to be offline.",
7259
- // Safari
7260
- "Network request failed"
7261
- // `cross-fetch`
7262
- ];
7263
- var _AbortError = class _AbortError extends Error {
7264
- constructor(message) {
7265
- super();
7266
- if (message instanceof Error) {
7267
- this.originalError = message;
7268
- ({ message } = message);
7269
- } else {
7270
- this.originalError = new Error(message);
7271
- this.originalError.stack = this.stack;
7272
- }
7273
- this.name = "AbortError";
7274
- this.message = message;
7275
- }
7276
- };
7277
- __name(_AbortError, "AbortError");
7278
- var AbortError = _AbortError;
7279
- var decorateErrorWithCounts = /* @__PURE__ */ __name((error, attemptNumber, options) => {
7280
- const retriesLeft = options.retries - (attemptNumber - 1);
7281
- error.attemptNumber = attemptNumber;
7282
- error.retriesLeft = retriesLeft;
7283
- return error;
7284
- }, "decorateErrorWithCounts");
7285
- var isNetworkError = /* @__PURE__ */ __name((errorMessage) => networkErrorMsgs.includes(errorMessage), "isNetworkError");
7286
- var pRetry = /* @__PURE__ */ __name((input, options) => new Promise((resolve, reject) => {
7287
- options = {
7288
- onFailedAttempt: /* @__PURE__ */ __name(() => {
7289
- }, "onFailedAttempt"),
7290
- retries: 10,
7291
- ...options
7292
- };
7293
- const operation = retry.operation(options);
7294
- operation.attempt(async (attemptNumber) => {
7295
- try {
7296
- resolve(await input(attemptNumber));
7297
- } catch (error) {
7298
- if (!(error instanceof Error)) {
7299
- reject(new TypeError(`Non-error was thrown: "${error}". You should only throw errors.`));
7300
- return;
7301
- }
7302
- if (error instanceof AbortError) {
7303
- operation.stop();
7304
- reject(error.originalError);
7305
- } else if (error instanceof TypeError && !isNetworkError(error.message)) {
7306
- operation.stop();
7307
- reject(error);
7308
- } else {
7309
- decorateErrorWithCounts(error, attemptNumber, options);
7310
- try {
7311
- await options.onFailedAttempt(error);
7312
- } catch (error2) {
7313
- reject(error2);
7314
- return;
7315
- }
7316
- if (!operation.retry(error)) {
7317
- reject(operation.mainError());
7318
- }
7319
- }
7320
- }
7321
- });
7322
- }), "pRetry");
7323
- module.exports = pRetry;
7324
- module.exports.default = pRetry;
7325
- module.exports.AbortError = AbortError;
7326
- }
7327
- });
7328
-
7329
7019
  // node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js
7330
7020
  function asyncGeneratorStep(n, t, e, r, o, a, c) {
7331
7021
  try {
@@ -7599,7 +7289,6 @@ var TypedEventEmitter = _TypedEventEmitter;
7599
7289
 
7600
7290
  // node_modules/matrix-js-sdk/lib/utils.js
7601
7291
  var import_unhomoglyph = __toESM(require_unhomoglyph(), 1);
7602
- var import_p_retry = __toESM(require_p_retry(), 1);
7603
7292
 
7604
7293
  // node_modules/matrix-js-sdk/lib/NamespacedValue.js
7605
7294
  var _NamespacedValue = class _NamespacedValue {
@@ -7696,7 +7385,7 @@ var DEFAULT_ALPHABET = (() => {
7696
7385
  return str;
7697
7386
  })();
7698
7387
 
7699
- // node_modules/uuid/dist/esm-browser/stringify.js
7388
+ // node_modules/matrix-js-sdk/node_modules/uuid/dist/stringify.js
7700
7389
  var byteToHex = [];
7701
7390
  for (let i = 0; i < 256; ++i) {
7702
7391
  byteToHex.push((i + 256).toString(16).slice(1));
@@ -7706,7 +7395,7 @@ function unsafeStringify(arr, offset = 0) {
7706
7395
  }
7707
7396
  __name(unsafeStringify, "unsafeStringify");
7708
7397
 
7709
- // node_modules/uuid/dist/esm-browser/rng.js
7398
+ // node_modules/matrix-js-sdk/node_modules/uuid/dist/rng.js
7710
7399
  var getRandomValues;
7711
7400
  var rnds8 = new Uint8Array(16);
7712
7401
  function rng() {
@@ -7720,15 +7409,12 @@ function rng() {
7720
7409
  }
7721
7410
  __name(rng, "rng");
7722
7411
 
7723
- // node_modules/uuid/dist/esm-browser/native.js
7412
+ // node_modules/matrix-js-sdk/node_modules/uuid/dist/native.js
7724
7413
  var randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
7725
7414
  var native_default = { randomUUID };
7726
7415
 
7727
- // node_modules/uuid/dist/esm-browser/v4.js
7728
- function v4(options, buf, offset) {
7729
- if (native_default.randomUUID && !buf && !options) {
7730
- return native_default.randomUUID();
7731
- }
7416
+ // node_modules/matrix-js-sdk/node_modules/uuid/dist/v4.js
7417
+ function _v4(options, buf, offset) {
7732
7418
  options = options || {};
7733
7419
  const rnds = options.random ?? options.rng?.() ?? rng();
7734
7420
  if (rnds.length < 16) {
@@ -7748,6 +7434,13 @@ function v4(options, buf, offset) {
7748
7434
  }
7749
7435
  return unsafeStringify(rnds);
7750
7436
  }
7437
+ __name(_v4, "_v4");
7438
+ function v4(options, buf, offset) {
7439
+ if (native_default.randomUUID && !buf && !options) {
7440
+ return native_default.randomUUID();
7441
+ }
7442
+ return _v4(options, buf, offset);
7443
+ }
7751
7444
  __name(v4, "v4");
7752
7445
  var v4_default = v4;
7753
7446