@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
@@ -7021,316 +7021,6 @@ var require_unhomoglyph = __commonJS({
7021
7021
  }
7022
7022
  });
7023
7023
 
7024
- // node_modules/retry/lib/retry_operation.js
7025
- var require_retry_operation = __commonJS({
7026
- "node_modules/retry/lib/retry_operation.js"(exports, module2) {
7027
- function RetryOperation(timeouts, options) {
7028
- if (typeof options === "boolean") {
7029
- options = { forever: options };
7030
- }
7031
- this._originalTimeouts = JSON.parse(JSON.stringify(timeouts));
7032
- this._timeouts = timeouts;
7033
- this._options = options || {};
7034
- this._maxRetryTime = options && options.maxRetryTime || Infinity;
7035
- this._fn = null;
7036
- this._errors = [];
7037
- this._attempts = 1;
7038
- this._operationTimeout = null;
7039
- this._operationTimeoutCb = null;
7040
- this._timeout = null;
7041
- this._operationStart = null;
7042
- this._timer = null;
7043
- if (this._options.forever) {
7044
- this._cachedTimeouts = this._timeouts.slice(0);
7045
- }
7046
- }
7047
- __name(RetryOperation, "RetryOperation");
7048
- module2.exports = RetryOperation;
7049
- RetryOperation.prototype.reset = function() {
7050
- this._attempts = 1;
7051
- this._timeouts = this._originalTimeouts.slice(0);
7052
- };
7053
- RetryOperation.prototype.stop = function() {
7054
- if (this._timeout) {
7055
- clearTimeout(this._timeout);
7056
- }
7057
- if (this._timer) {
7058
- clearTimeout(this._timer);
7059
- }
7060
- this._timeouts = [];
7061
- this._cachedTimeouts = null;
7062
- };
7063
- RetryOperation.prototype.retry = function(err) {
7064
- if (this._timeout) {
7065
- clearTimeout(this._timeout);
7066
- }
7067
- if (!err) {
7068
- return false;
7069
- }
7070
- var currentTime = (/* @__PURE__ */ new Date()).getTime();
7071
- if (err && currentTime - this._operationStart >= this._maxRetryTime) {
7072
- this._errors.push(err);
7073
- this._errors.unshift(new Error("RetryOperation timeout occurred"));
7074
- return false;
7075
- }
7076
- this._errors.push(err);
7077
- var timeout = this._timeouts.shift();
7078
- if (timeout === void 0) {
7079
- if (this._cachedTimeouts) {
7080
- this._errors.splice(0, this._errors.length - 1);
7081
- timeout = this._cachedTimeouts.slice(-1);
7082
- } else {
7083
- return false;
7084
- }
7085
- }
7086
- var self = this;
7087
- this._timer = setTimeout(function() {
7088
- self._attempts++;
7089
- if (self._operationTimeoutCb) {
7090
- self._timeout = setTimeout(function() {
7091
- self._operationTimeoutCb(self._attempts);
7092
- }, self._operationTimeout);
7093
- if (self._options.unref) {
7094
- self._timeout.unref();
7095
- }
7096
- }
7097
- self._fn(self._attempts);
7098
- }, timeout);
7099
- if (this._options.unref) {
7100
- this._timer.unref();
7101
- }
7102
- return true;
7103
- };
7104
- RetryOperation.prototype.attempt = function(fn, timeoutOps) {
7105
- this._fn = fn;
7106
- if (timeoutOps) {
7107
- if (timeoutOps.timeout) {
7108
- this._operationTimeout = timeoutOps.timeout;
7109
- }
7110
- if (timeoutOps.cb) {
7111
- this._operationTimeoutCb = timeoutOps.cb;
7112
- }
7113
- }
7114
- var self = this;
7115
- if (this._operationTimeoutCb) {
7116
- this._timeout = setTimeout(function() {
7117
- self._operationTimeoutCb();
7118
- }, self._operationTimeout);
7119
- }
7120
- this._operationStart = (/* @__PURE__ */ new Date()).getTime();
7121
- this._fn(this._attempts);
7122
- };
7123
- RetryOperation.prototype.try = function(fn) {
7124
- console.log("Using RetryOperation.try() is deprecated");
7125
- this.attempt(fn);
7126
- };
7127
- RetryOperation.prototype.start = function(fn) {
7128
- console.log("Using RetryOperation.start() is deprecated");
7129
- this.attempt(fn);
7130
- };
7131
- RetryOperation.prototype.start = RetryOperation.prototype.try;
7132
- RetryOperation.prototype.errors = function() {
7133
- return this._errors;
7134
- };
7135
- RetryOperation.prototype.attempts = function() {
7136
- return this._attempts;
7137
- };
7138
- RetryOperation.prototype.mainError = function() {
7139
- if (this._errors.length === 0) {
7140
- return null;
7141
- }
7142
- var counts = {};
7143
- var mainError = null;
7144
- var mainErrorCount = 0;
7145
- for (var i = 0; i < this._errors.length; i++) {
7146
- var error = this._errors[i];
7147
- var message = error.message;
7148
- var count = (counts[message] || 0) + 1;
7149
- counts[message] = count;
7150
- if (count >= mainErrorCount) {
7151
- mainError = error;
7152
- mainErrorCount = count;
7153
- }
7154
- }
7155
- return mainError;
7156
- };
7157
- }
7158
- });
7159
-
7160
- // node_modules/retry/lib/retry.js
7161
- var require_retry = __commonJS({
7162
- "node_modules/retry/lib/retry.js"(exports) {
7163
- var RetryOperation = require_retry_operation();
7164
- exports.operation = function(options) {
7165
- var timeouts = exports.timeouts(options);
7166
- return new RetryOperation(timeouts, {
7167
- forever: options && (options.forever || options.retries === Infinity),
7168
- unref: options && options.unref,
7169
- maxRetryTime: options && options.maxRetryTime
7170
- });
7171
- };
7172
- exports.timeouts = function(options) {
7173
- if (options instanceof Array) {
7174
- return [].concat(options);
7175
- }
7176
- var opts = {
7177
- retries: 10,
7178
- factor: 2,
7179
- minTimeout: 1 * 1e3,
7180
- maxTimeout: Infinity,
7181
- randomize: false
7182
- };
7183
- for (var key in options) {
7184
- opts[key] = options[key];
7185
- }
7186
- if (opts.minTimeout > opts.maxTimeout) {
7187
- throw new Error("minTimeout is greater than maxTimeout");
7188
- }
7189
- var timeouts = [];
7190
- for (var i = 0; i < opts.retries; i++) {
7191
- timeouts.push(this.createTimeout(i, opts));
7192
- }
7193
- if (options && options.forever && !timeouts.length) {
7194
- timeouts.push(this.createTimeout(i, opts));
7195
- }
7196
- timeouts.sort(function(a, b) {
7197
- return a - b;
7198
- });
7199
- return timeouts;
7200
- };
7201
- exports.createTimeout = function(attempt, opts) {
7202
- var random = opts.randomize ? Math.random() + 1 : 1;
7203
- var timeout = Math.round(random * Math.max(opts.minTimeout, 1) * Math.pow(opts.factor, attempt));
7204
- timeout = Math.min(timeout, opts.maxTimeout);
7205
- return timeout;
7206
- };
7207
- exports.wrap = function(obj, options, methods) {
7208
- if (options instanceof Array) {
7209
- methods = options;
7210
- options = null;
7211
- }
7212
- if (!methods) {
7213
- methods = [];
7214
- for (var key in obj) {
7215
- if (typeof obj[key] === "function") {
7216
- methods.push(key);
7217
- }
7218
- }
7219
- }
7220
- for (var i = 0; i < methods.length; i++) {
7221
- var method = methods[i];
7222
- var original = obj[method];
7223
- obj[method] = (/* @__PURE__ */ __name(function retryWrapper(original2) {
7224
- var op = exports.operation(options);
7225
- var args = Array.prototype.slice.call(arguments, 1);
7226
- var callback = args.pop();
7227
- args.push(function(err) {
7228
- if (op.retry(err)) {
7229
- return;
7230
- }
7231
- if (err) {
7232
- arguments[0] = op.mainError();
7233
- }
7234
- callback.apply(this, arguments);
7235
- });
7236
- op.attempt(function() {
7237
- original2.apply(obj, args);
7238
- });
7239
- }, "retryWrapper")).bind(obj, original);
7240
- obj[method].options = options;
7241
- }
7242
- };
7243
- }
7244
- });
7245
-
7246
- // node_modules/retry/index.js
7247
- var require_retry2 = __commonJS({
7248
- "node_modules/retry/index.js"(exports, module2) {
7249
- module2.exports = require_retry();
7250
- }
7251
- });
7252
-
7253
- // node_modules/p-retry/index.js
7254
- var require_p_retry = __commonJS({
7255
- "node_modules/p-retry/index.js"(exports, module2) {
7256
- "use strict";
7257
- var retry = require_retry2();
7258
- var networkErrorMsgs = [
7259
- "Failed to fetch",
7260
- // Chrome
7261
- "NetworkError when attempting to fetch resource.",
7262
- // Firefox
7263
- "The Internet connection appears to be offline.",
7264
- // Safari
7265
- "Network request failed"
7266
- // `cross-fetch`
7267
- ];
7268
- var _AbortError = class _AbortError extends Error {
7269
- constructor(message) {
7270
- super();
7271
- if (message instanceof Error) {
7272
- this.originalError = message;
7273
- ({ message } = message);
7274
- } else {
7275
- this.originalError = new Error(message);
7276
- this.originalError.stack = this.stack;
7277
- }
7278
- this.name = "AbortError";
7279
- this.message = message;
7280
- }
7281
- };
7282
- __name(_AbortError, "AbortError");
7283
- var AbortError = _AbortError;
7284
- var decorateErrorWithCounts = /* @__PURE__ */ __name((error, attemptNumber, options) => {
7285
- const retriesLeft = options.retries - (attemptNumber - 1);
7286
- error.attemptNumber = attemptNumber;
7287
- error.retriesLeft = retriesLeft;
7288
- return error;
7289
- }, "decorateErrorWithCounts");
7290
- var isNetworkError = /* @__PURE__ */ __name((errorMessage) => networkErrorMsgs.includes(errorMessage), "isNetworkError");
7291
- var pRetry = /* @__PURE__ */ __name((input, options) => new Promise((resolve, reject) => {
7292
- options = {
7293
- onFailedAttempt: /* @__PURE__ */ __name(() => {
7294
- }, "onFailedAttempt"),
7295
- retries: 10,
7296
- ...options
7297
- };
7298
- const operation = retry.operation(options);
7299
- operation.attempt(async (attemptNumber) => {
7300
- try {
7301
- resolve(await input(attemptNumber));
7302
- } catch (error) {
7303
- if (!(error instanceof Error)) {
7304
- reject(new TypeError(`Non-error was thrown: "${error}". You should only throw errors.`));
7305
- return;
7306
- }
7307
- if (error instanceof AbortError) {
7308
- operation.stop();
7309
- reject(error.originalError);
7310
- } else if (error instanceof TypeError && !isNetworkError(error.message)) {
7311
- operation.stop();
7312
- reject(error);
7313
- } else {
7314
- decorateErrorWithCounts(error, attemptNumber, options);
7315
- try {
7316
- await options.onFailedAttempt(error);
7317
- } catch (error2) {
7318
- reject(error2);
7319
- return;
7320
- }
7321
- if (!operation.retry(error)) {
7322
- reject(operation.mainError());
7323
- }
7324
- }
7325
- }
7326
- });
7327
- }), "pRetry");
7328
- module2.exports = pRetry;
7329
- module2.exports.default = pRetry;
7330
- module2.exports.AbortError = AbortError;
7331
- }
7332
- });
7333
-
7334
7024
  // node_modules/matrix-js-sdk/lib/sliding-sync.js
7335
7025
  var sliding_sync_exports = {};
7336
7026
  __export(sliding_sync_exports, {
@@ -7617,7 +7307,6 @@ var TypedEventEmitter = _TypedEventEmitter;
7617
7307
 
7618
7308
  // node_modules/matrix-js-sdk/lib/utils.js
7619
7309
  var import_unhomoglyph = __toESM(require_unhomoglyph(), 1);
7620
- var import_p_retry = __toESM(require_p_retry(), 1);
7621
7310
 
7622
7311
  // node_modules/matrix-js-sdk/lib/NamespacedValue.js
7623
7312
  var _NamespacedValue = class _NamespacedValue {
@@ -7714,7 +7403,7 @@ var DEFAULT_ALPHABET = (() => {
7714
7403
  return str;
7715
7404
  })();
7716
7405
 
7717
- // node_modules/uuid/dist/esm-browser/stringify.js
7406
+ // node_modules/matrix-js-sdk/node_modules/uuid/dist/stringify.js
7718
7407
  var byteToHex = [];
7719
7408
  for (let i = 0; i < 256; ++i) {
7720
7409
  byteToHex.push((i + 256).toString(16).slice(1));
@@ -7724,7 +7413,7 @@ function unsafeStringify(arr, offset = 0) {
7724
7413
  }
7725
7414
  __name(unsafeStringify, "unsafeStringify");
7726
7415
 
7727
- // node_modules/uuid/dist/esm-browser/rng.js
7416
+ // node_modules/matrix-js-sdk/node_modules/uuid/dist/rng.js
7728
7417
  var getRandomValues;
7729
7418
  var rnds8 = new Uint8Array(16);
7730
7419
  function rng() {
@@ -7738,15 +7427,12 @@ function rng() {
7738
7427
  }
7739
7428
  __name(rng, "rng");
7740
7429
 
7741
- // node_modules/uuid/dist/esm-browser/native.js
7430
+ // node_modules/matrix-js-sdk/node_modules/uuid/dist/native.js
7742
7431
  var randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
7743
7432
  var native_default = { randomUUID };
7744
7433
 
7745
- // node_modules/uuid/dist/esm-browser/v4.js
7746
- function v4(options, buf, offset) {
7747
- if (native_default.randomUUID && !buf && !options) {
7748
- return native_default.randomUUID();
7749
- }
7434
+ // node_modules/matrix-js-sdk/node_modules/uuid/dist/v4.js
7435
+ function _v4(options, buf, offset) {
7750
7436
  options = options || {};
7751
7437
  const rnds = options.random ?? options.rng?.() ?? rng();
7752
7438
  if (rnds.length < 16) {
@@ -7766,6 +7452,13 @@ function v4(options, buf, offset) {
7766
7452
  }
7767
7453
  return unsafeStringify(rnds);
7768
7454
  }
7455
+ __name(_v4, "_v4");
7456
+ function v4(options, buf, offset) {
7457
+ if (native_default.randomUUID && !buf && !options) {
7458
+ return native_default.randomUUID();
7459
+ }
7460
+ return _v4(options, buf, offset);
7461
+ }
7769
7462
  __name(v4, "v4");
7770
7463
  var v4_default = v4;
7771
7464