diff options
Diffstat (limited to 'includes/external/matrix/node_modules/matrix-widget-api/lib')
96 files changed, 0 insertions, 6191 deletions
diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/ClientWidgetApi.d.ts b/includes/external/matrix/node_modules/matrix-widget-api/lib/ClientWidgetApi.d.ts deleted file mode 100644 index 12a1098..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/ClientWidgetApi.d.ts +++ /dev/null @@ -1,114 +0,0 @@ -import { EventEmitter } from "events"; -import { ITransport } from "./transport/ITransport"; -import { Widget } from "./models/Widget"; -import { Capability } from "./interfaces/Capabilities"; -import { WidgetDriver } from "./driver/WidgetDriver"; -import { IScreenshotActionResponseData } from "./interfaces/ScreenshotAction"; -import { IWidgetApiResponseData } from "./interfaces/IWidgetApiResponse"; -import { IModalWidgetOpenRequestData, IModalWidgetOpenRequestDataButton, IModalWidgetReturnData } from "./interfaces/ModalWidgetActions"; -import { IRoomEvent } from "./interfaces/IRoomEvent"; -import { Symbols } from "./Symbols"; -/** - * API handler for the client side of widgets. This raises events - * for each action received as `action:${action}` (eg: "action:screenshot"). - * Default handling can be prevented by using preventDefault() on the - * raised event. The default handling varies for each action: ones - * which the SDK can handle safely are acknowledged appropriately and - * ones which are unhandled (custom or require the client to do something) - * are rejected with an error. - * - * Events which are preventDefault()ed must reply using the transport. - * The events raised will have a default of an IWidgetApiRequest - * interface. - * - * When the ClientWidgetApi is ready to start sending requests, it will - * raise a "ready" CustomEvent. After the ready event fires, actions can - * be sent and the transport will be ready. - * - * When the widget has indicated it has loaded, this class raises a - * "preparing" CustomEvent. The preparing event does not indicate that - * the widget is ready to receive communications - that is signified by - * the ready event exclusively. - * - * This class only handles one widget at a time. - */ -export declare class ClientWidgetApi extends EventEmitter { - readonly widget: Widget; - private iframe; - private driver; - readonly transport: ITransport; - private contentLoadedActionSent; - private allowedCapabilities; - private allowedEvents; - private isStopped; - private turnServers; - /** - * Creates a new client widget API. This will instantiate the transport - * and start everything. When the iframe is loaded under the widget's - * conditions, a "ready" event will be raised. - * @param {Widget} widget The widget to communicate with. - * @param {HTMLIFrameElement} iframe The iframe the widget is in. - * @param {WidgetDriver} driver The driver for this widget/client. - */ - constructor(widget: Widget, iframe: HTMLIFrameElement, driver: WidgetDriver); - hasCapability(capability: Capability): boolean; - canUseRoomTimeline(roomId: string | Symbols.AnyRoom): boolean; - canSendRoomEvent(eventType: string, msgtype?: string | null): boolean; - canSendStateEvent(eventType: string, stateKey: string): boolean; - canSendToDeviceEvent(eventType: string): boolean; - canReceiveRoomEvent(eventType: string, msgtype?: string | null): boolean; - canReceiveStateEvent(eventType: string, stateKey: string | null): boolean; - canReceiveToDeviceEvent(eventType: string): boolean; - stop(): void; - private beginCapabilities; - private notifyCapabilities; - private onIframeLoad; - private handleContentLoadedAction; - private replyVersions; - private handleCapabilitiesRenegotiate; - private handleNavigate; - private handleOIDC; - private handleReadEvents; - private handleSendEvent; - private handleSendToDevice; - private pollTurnServers; - private handleWatchTurnServers; - private handleUnwatchTurnServers; - private handleReadRelations; - private handleUserDirectorySearch; - private handleMessage; - /** - * Takes a screenshot of the widget. - * @returns Resolves to the widget's screenshot. - * @throws Throws if there is a problem. - */ - takeScreenshot(): Promise<IScreenshotActionResponseData>; - /** - * Alerts the widget to whether or not it is currently visible. - * @param {boolean} isVisible Whether the widget is visible or not. - * @returns {Promise<IWidgetApiResponseData>} Resolves when the widget acknowledges the update. - */ - updateVisibility(isVisible: boolean): Promise<IWidgetApiResponseData>; - sendWidgetConfig(data: IModalWidgetOpenRequestData): Promise<void>; - notifyModalWidgetButtonClicked(id: IModalWidgetOpenRequestDataButton["id"]): Promise<void>; - notifyModalWidgetClose(data: IModalWidgetReturnData): Promise<void>; - /** - * Feeds an event to the widget. If the widget is not able to accept the event due to - * permissions, this will no-op and return calmly. If the widget failed to handle the - * event, this will raise an error. - * @param {IRoomEvent} rawEvent The event to (try to) send to the widget. - * @param {string} currentViewedRoomId The room ID the user is currently interacting with. - * Not the room ID of the event. - * @returns {Promise<void>} Resolves when complete, rejects if there was an error sending. - */ - feedEvent(rawEvent: IRoomEvent, currentViewedRoomId: string): Promise<void>; - /** - * Feeds a to-device event to the widget. If the widget is not able to accept the - * event due to permissions, this will no-op and return calmly. If the widget failed - * to handle the event, this will raise an error. - * @param {IRoomEvent} rawEvent The event to (try to) send to the widget. - * @param {boolean} encrypted Whether the event contents were encrypted. - * @returns {Promise<void>} Resolves when complete, rejects if there was an error sending. - */ - feedToDevice(rawEvent: IRoomEvent, encrypted: boolean): Promise<void>; -} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/ClientWidgetApi.js b/includes/external/matrix/node_modules/matrix-widget-api/lib/ClientWidgetApi.js deleted file mode 100644 index 8b0da4f..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/ClientWidgetApi.js +++ /dev/null @@ -1,1343 +0,0 @@ -"use strict"; - -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.ClientWidgetApi = void 0; - -var _events = require("events"); - -var _PostmessageTransport = require("./transport/PostmessageTransport"); - -var _WidgetApiDirection = require("./interfaces/WidgetApiDirection"); - -var _WidgetApiAction = require("./interfaces/WidgetApiAction"); - -var _Capabilities = require("./interfaces/Capabilities"); - -var _ApiVersion = require("./interfaces/ApiVersion"); - -var _WidgetEventCapability = require("./models/WidgetEventCapability"); - -var _GetOpenIDAction = require("./interfaces/GetOpenIDAction"); - -var _SimpleObservable = require("./util/SimpleObservable"); - -var _Symbols = require("./Symbols"); - -function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; } - -function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } - -function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } - -function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } - -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } - -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -function _asyncIterator(iterable) { var method, async, sync, retry = 2; for ("undefined" != typeof Symbol && (async = Symbol.asyncIterator, sync = Symbol.iterator); retry--;) { if (async && null != (method = iterable[async])) return method.call(iterable); if (sync && null != (method = iterable[sync])) return new AsyncFromSyncIterator(method.call(iterable)); async = "@@asyncIterator", sync = "@@iterator"; } throw new TypeError("Object is not async iterable"); } - -function AsyncFromSyncIterator(s) { function AsyncFromSyncIteratorContinuation(r) { if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object.")); var done = r.done; return Promise.resolve(r.value).then(function (value) { return { value: value, done: done }; }); } return AsyncFromSyncIterator = function AsyncFromSyncIterator(s) { this.s = s, this.n = s.next; }, AsyncFromSyncIterator.prototype = { s: null, n: null, next: function next() { return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments)); }, "return": function _return(value) { var ret = this.s["return"]; return void 0 === ret ? Promise.resolve({ value: value, done: !0 }) : AsyncFromSyncIteratorContinuation(ret.apply(this.s, arguments)); }, "throw": function _throw(value) { var thr = this.s["return"]; return void 0 === thr ? Promise.reject(value) : AsyncFromSyncIteratorContinuation(thr.apply(this.s, arguments)); } }, new AsyncFromSyncIterator(s); } - -/** - * API handler for the client side of widgets. This raises events - * for each action received as `action:${action}` (eg: "action:screenshot"). - * Default handling can be prevented by using preventDefault() on the - * raised event. The default handling varies for each action: ones - * which the SDK can handle safely are acknowledged appropriately and - * ones which are unhandled (custom or require the client to do something) - * are rejected with an error. - * - * Events which are preventDefault()ed must reply using the transport. - * The events raised will have a default of an IWidgetApiRequest - * interface. - * - * When the ClientWidgetApi is ready to start sending requests, it will - * raise a "ready" CustomEvent. After the ready event fires, actions can - * be sent and the transport will be ready. - * - * When the widget has indicated it has loaded, this class raises a - * "preparing" CustomEvent. The preparing event does not indicate that - * the widget is ready to receive communications - that is signified by - * the ready event exclusively. - * - * This class only handles one widget at a time. - */ -var ClientWidgetApi = /*#__PURE__*/function (_EventEmitter) { - _inherits(ClientWidgetApi, _EventEmitter); - - var _super = _createSuper(ClientWidgetApi); - - // contentLoadedActionSent is used to check that only one ContentLoaded request is send. - - /** - * Creates a new client widget API. This will instantiate the transport - * and start everything. When the iframe is loaded under the widget's - * conditions, a "ready" event will be raised. - * @param {Widget} widget The widget to communicate with. - * @param {HTMLIFrameElement} iframe The iframe the widget is in. - * @param {WidgetDriver} driver The driver for this widget/client. - */ - function ClientWidgetApi(widget, iframe, driver) { - var _this; - - _classCallCheck(this, ClientWidgetApi); - - _this = _super.call(this); - _this.widget = widget; - _this.iframe = iframe; - _this.driver = driver; - - _defineProperty(_assertThisInitialized(_this), "transport", void 0); - - _defineProperty(_assertThisInitialized(_this), "contentLoadedActionSent", false); - - _defineProperty(_assertThisInitialized(_this), "allowedCapabilities", new Set()); - - _defineProperty(_assertThisInitialized(_this), "allowedEvents", []); - - _defineProperty(_assertThisInitialized(_this), "isStopped", false); - - _defineProperty(_assertThisInitialized(_this), "turnServers", null); - - if (!(iframe !== null && iframe !== void 0 && iframe.contentWindow)) { - throw new Error("No iframe supplied"); - } - - if (!widget) { - throw new Error("Invalid widget"); - } - - if (!driver) { - throw new Error("Invalid driver"); - } - - _this.transport = new _PostmessageTransport.PostmessageTransport(_WidgetApiDirection.WidgetApiDirection.ToWidget, widget.id, iframe.contentWindow, window); - _this.transport.targetOrigin = widget.origin; - - _this.transport.on("message", _this.handleMessage.bind(_assertThisInitialized(_this))); - - iframe.addEventListener("load", _this.onIframeLoad.bind(_assertThisInitialized(_this))); - - _this.transport.start(); - - return _this; - } - - _createClass(ClientWidgetApi, [{ - key: "hasCapability", - value: function hasCapability(capability) { - return this.allowedCapabilities.has(capability); - } - }, { - key: "canUseRoomTimeline", - value: function canUseRoomTimeline(roomId) { - return this.hasCapability("org.matrix.msc2762.timeline:".concat(_Symbols.Symbols.AnyRoom)) || this.hasCapability("org.matrix.msc2762.timeline:".concat(roomId)); - } - }, { - key: "canSendRoomEvent", - value: function canSendRoomEvent(eventType) { - var msgtype = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; - return this.allowedEvents.some(function (e) { - return e.matchesAsRoomEvent(_WidgetEventCapability.EventDirection.Send, eventType, msgtype); - }); - } - }, { - key: "canSendStateEvent", - value: function canSendStateEvent(eventType, stateKey) { - return this.allowedEvents.some(function (e) { - return e.matchesAsStateEvent(_WidgetEventCapability.EventDirection.Send, eventType, stateKey); - }); - } - }, { - key: "canSendToDeviceEvent", - value: function canSendToDeviceEvent(eventType) { - return this.allowedEvents.some(function (e) { - return e.matchesAsToDeviceEvent(_WidgetEventCapability.EventDirection.Send, eventType); - }); - } - }, { - key: "canReceiveRoomEvent", - value: function canReceiveRoomEvent(eventType) { - var msgtype = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; - return this.allowedEvents.some(function (e) { - return e.matchesAsRoomEvent(_WidgetEventCapability.EventDirection.Receive, eventType, msgtype); - }); - } - }, { - key: "canReceiveStateEvent", - value: function canReceiveStateEvent(eventType, stateKey) { - return this.allowedEvents.some(function (e) { - return e.matchesAsStateEvent(_WidgetEventCapability.EventDirection.Receive, eventType, stateKey); - }); - } - }, { - key: "canReceiveToDeviceEvent", - value: function canReceiveToDeviceEvent(eventType) { - return this.allowedEvents.some(function (e) { - return e.matchesAsToDeviceEvent(_WidgetEventCapability.EventDirection.Receive, eventType); - }); - } - }, { - key: "stop", - value: function stop() { - this.isStopped = true; - this.transport.stop(); - } - }, { - key: "beginCapabilities", - value: function beginCapabilities() { - var _this2 = this; - - // widget has loaded - tell all the listeners that - this.emit("preparing"); - var requestedCaps; - this.transport.send(_WidgetApiAction.WidgetApiToWidgetAction.Capabilities, {}).then(function (caps) { - requestedCaps = caps.capabilities; - return _this2.driver.validateCapabilities(new Set(caps.capabilities)); - }).then(function (allowedCaps) { - console.log("Widget ".concat(_this2.widget.id, " is allowed capabilities:"), Array.from(allowedCaps)); - _this2.allowedCapabilities = allowedCaps; - _this2.allowedEvents = _WidgetEventCapability.WidgetEventCapability.findEventCapabilities(allowedCaps); - - _this2.notifyCapabilities(requestedCaps); - - _this2.emit("ready"); - }); - } - }, { - key: "notifyCapabilities", - value: function notifyCapabilities(requested) { - var _this3 = this; - - this.transport.send(_WidgetApiAction.WidgetApiToWidgetAction.NotifyCapabilities, { - requested: requested, - approved: Array.from(this.allowedCapabilities) - })["catch"](function (e) { - console.warn("non-fatal error notifying widget of approved capabilities:", e); - }).then(function () { - _this3.emit("capabilitiesNotified"); - }); - } - }, { - key: "onIframeLoad", - value: function onIframeLoad(ev) { - if (this.widget.waitForIframeLoad) { - // If the widget is set to waitForIframeLoad the capabilities immediatly get setup after load. - // The client does not wait for the ContentLoaded action. - this.beginCapabilities(); - } else { - // Reaching this means, that the Iframe got reloaded/loaded and - // the clientApi is awaiting the FIRST ContentLoaded action. - this.contentLoadedActionSent = false; - } - } - }, { - key: "handleContentLoadedAction", - value: function handleContentLoadedAction(action) { - if (this.contentLoadedActionSent) { - throw new Error("Improper sequence: ContentLoaded Action can only be send once after the widget loaded " + "and should only be used if waitForIframeLoad is false (default=true)"); - } - - if (this.widget.waitForIframeLoad) { - this.transport.reply(action, { - error: { - message: "Improper sequence: not expecting ContentLoaded event if " + "waitForIframLoad is true (default=true)" - } - }); - } else { - this.transport.reply(action, {}); - this.beginCapabilities(); - } - - this.contentLoadedActionSent = true; - } - }, { - key: "replyVersions", - value: function replyVersions(request) { - this.transport.reply(request, { - supported_versions: _ApiVersion.CurrentApiVersions - }); - } - }, { - key: "handleCapabilitiesRenegotiate", - value: function handleCapabilitiesRenegotiate(request) { - var _request$data, - _this4 = this; - - // acknowledge first - this.transport.reply(request, {}); - var requested = ((_request$data = request.data) === null || _request$data === void 0 ? void 0 : _request$data.capabilities) || []; - var newlyRequested = new Set(requested.filter(function (r) { - return !_this4.hasCapability(r); - })); - - if (newlyRequested.size === 0) { - // Nothing to do - notify capabilities - return this.notifyCapabilities([]); - } - - this.driver.validateCapabilities(newlyRequested).then(function (allowed) { - allowed.forEach(function (c) { - return _this4.allowedCapabilities.add(c); - }); - - var allowedEvents = _WidgetEventCapability.WidgetEventCapability.findEventCapabilities(allowed); - - allowedEvents.forEach(function (c) { - return _this4.allowedEvents.push(c); - }); - return _this4.notifyCapabilities(Array.from(newlyRequested)); - }); - } - }, { - key: "handleNavigate", - value: function handleNavigate(request) { - var _request$data2, - _request$data3, - _this5 = this; - - if (!this.hasCapability(_Capabilities.MatrixCapabilities.MSC2931Navigate)) { - return this.transport.reply(request, { - error: { - message: "Missing capability" - } - }); - } - - if (!((_request$data2 = request.data) !== null && _request$data2 !== void 0 && _request$data2.uri) || !((_request$data3 = request.data) !== null && _request$data3 !== void 0 && _request$data3.uri.toString().startsWith("https://matrix.to/#"))) { - return this.transport.reply(request, { - error: { - message: "Invalid matrix.to URI" - } - }); - } - - var onErr = function onErr(e) { - console.error("[ClientWidgetApi] Failed to handle navigation: ", e); - return _this5.transport.reply(request, { - error: { - message: "Error handling navigation" - } - }); - }; - - try { - this.driver.navigate(request.data.uri.toString())["catch"](function (e) { - return onErr(e); - }).then(function () { - return _this5.transport.reply(request, {}); - }); - } catch (e) { - return onErr(e); - } - } - }, { - key: "handleOIDC", - value: function handleOIDC(request) { - var _this6 = this; - - var phase = 1; // 1 = initial request, 2 = after user manual confirmation - - var replyState = function replyState(state, credential) { - credential = credential || {}; - - if (phase > 1) { - return _this6.transport.send(_WidgetApiAction.WidgetApiToWidgetAction.OpenIDCredentials, _objectSpread({ - state: state, - original_request_id: request.requestId - }, credential)); - } else { - return _this6.transport.reply(request, _objectSpread({ - state: state - }, credential)); - } - }; - - var replyError = function replyError(msg) { - console.error("[ClientWidgetApi] Failed to handle OIDC: ", msg); - - if (phase > 1) { - // We don't have a way to indicate that a random error happened in this flow, so - // just block the attempt. - return replyState(_GetOpenIDAction.OpenIDRequestState.Blocked); - } else { - return _this6.transport.reply(request, { - error: { - message: msg - } - }); - } - }; - - var observer = new _SimpleObservable.SimpleObservable(function (update) { - if (update.state === _GetOpenIDAction.OpenIDRequestState.PendingUserConfirmation && phase > 1) { - observer.close(); - return replyError("client provided out-of-phase response to OIDC flow"); - } - - if (update.state === _GetOpenIDAction.OpenIDRequestState.PendingUserConfirmation) { - replyState(update.state); - phase++; - return; - } - - if (update.state === _GetOpenIDAction.OpenIDRequestState.Allowed && !update.token) { - return replyError("client provided invalid OIDC token for an allowed request"); - } - - if (update.state === _GetOpenIDAction.OpenIDRequestState.Blocked) { - update.token = undefined; // just in case the client did something weird - } - - observer.close(); - return replyState(update.state, update.token); - }); - this.driver.askOpenID(observer); - } - }, { - key: "handleReadEvents", - value: function handleReadEvents(request) { - var _this7 = this; - - if (!request.data.type) { - return this.transport.reply(request, { - error: { - message: "Invalid request - missing event type" - } - }); - } - - if (request.data.limit !== undefined && (!request.data.limit || request.data.limit < 0)) { - return this.transport.reply(request, { - error: { - message: "Invalid request - limit out of range" - } - }); - } - - var askRoomIds = null; // null denotes current room only - - if (request.data.room_ids) { - askRoomIds = request.data.room_ids; - - if (!Array.isArray(askRoomIds)) { - askRoomIds = [askRoomIds]; - } - - var _iterator2 = _createForOfIteratorHelper(askRoomIds), - _step2; - - try { - for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { - var roomId = _step2.value; - - if (!this.canUseRoomTimeline(roomId)) { - return this.transport.reply(request, { - error: { - message: "Unable to access room timeline: ".concat(roomId) - } - }); - } - } - } catch (err) { - _iterator2.e(err); - } finally { - _iterator2.f(); - } - } - - var limit = request.data.limit || 0; - var events = Promise.resolve([]); - - if (request.data.state_key !== undefined) { - var stateKey = request.data.state_key === true ? undefined : request.data.state_key.toString(); - - if (!this.canReceiveStateEvent(request.data.type, stateKey !== null && stateKey !== void 0 ? stateKey : null)) { - return this.transport.reply(request, { - error: { - message: "Cannot read state events of this type" - } - }); - } - - events = this.driver.readStateEvents(request.data.type, stateKey, limit, askRoomIds); - } else { - if (!this.canReceiveRoomEvent(request.data.type, request.data.msgtype)) { - return this.transport.reply(request, { - error: { - message: "Cannot read room events of this type" - } - }); - } - - events = this.driver.readRoomEvents(request.data.type, request.data.msgtype, limit, askRoomIds); - } - - return events.then(function (evs) { - return _this7.transport.reply(request, { - events: evs - }); - }); - } - }, { - key: "handleSendEvent", - value: function handleSendEvent(request) { - var _this8 = this; - - if (!request.data.type) { - return this.transport.reply(request, { - error: { - message: "Invalid request - missing event type" - } - }); - } - - if (!!request.data.room_id && !this.canUseRoomTimeline(request.data.room_id)) { - return this.transport.reply(request, { - error: { - message: "Unable to access room timeline: ".concat(request.data.room_id) - } - }); - } - - var isState = request.data.state_key !== null && request.data.state_key !== undefined; - var sendEventPromise; - - if (isState) { - if (!this.canSendStateEvent(request.data.type, request.data.state_key)) { - return this.transport.reply(request, { - error: { - message: "Cannot send state events of this type" - } - }); - } - - sendEventPromise = this.driver.sendEvent(request.data.type, request.data.content || {}, request.data.state_key, request.data.room_id); - } else { - var content = request.data.content || {}; - var msgtype = content['msgtype']; - - if (!this.canSendRoomEvent(request.data.type, msgtype)) { - return this.transport.reply(request, { - error: { - message: "Cannot send room events of this type" - } - }); - } - - sendEventPromise = this.driver.sendEvent(request.data.type, content, null, // not sending a state event - request.data.room_id); - } - - sendEventPromise.then(function (sentEvent) { - return _this8.transport.reply(request, { - room_id: sentEvent.roomId, - event_id: sentEvent.eventId - }); - })["catch"](function (e) { - console.error("error sending event: ", e); - return _this8.transport.reply(request, { - error: { - message: "Error sending event" - } - }); - }); - } - }, { - key: "handleSendToDevice", - value: function () { - var _handleSendToDevice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(request) { - return _regeneratorRuntime().wrap(function _callee$(_context) { - while (1) { - switch (_context.prev = _context.next) { - case 0: - if (request.data.type) { - _context.next = 5; - break; - } - - _context.next = 3; - return this.transport.reply(request, { - error: { - message: "Invalid request - missing event type" - } - }); - - case 3: - _context.next = 32; - break; - - case 5: - if (request.data.messages) { - _context.next = 10; - break; - } - - _context.next = 8; - return this.transport.reply(request, { - error: { - message: "Invalid request - missing event contents" - } - }); - - case 8: - _context.next = 32; - break; - - case 10: - if (!(typeof request.data.encrypted !== "boolean")) { - _context.next = 15; - break; - } - - _context.next = 13; - return this.transport.reply(request, { - error: { - message: "Invalid request - missing encryption flag" - } - }); - - case 13: - _context.next = 32; - break; - - case 15: - if (this.canSendToDeviceEvent(request.data.type)) { - _context.next = 20; - break; - } - - _context.next = 18; - return this.transport.reply(request, { - error: { - message: "Cannot send to-device events of this type" - } - }); - - case 18: - _context.next = 32; - break; - - case 20: - _context.prev = 20; - _context.next = 23; - return this.driver.sendToDevice(request.data.type, request.data.encrypted, request.data.messages); - - case 23: - _context.next = 25; - return this.transport.reply(request, {}); - - case 25: - _context.next = 32; - break; - - case 27: - _context.prev = 27; - _context.t0 = _context["catch"](20); - console.error("error sending to-device event", _context.t0); - _context.next = 32; - return this.transport.reply(request, { - error: { - message: "Error sending event" - } - }); - - case 32: - case "end": - return _context.stop(); - } - } - }, _callee, this, [[20, 27]]); - })); - - function handleSendToDevice(_x) { - return _handleSendToDevice.apply(this, arguments); - } - - return handleSendToDevice; - }() - }, { - key: "pollTurnServers", - value: function () { - var _pollTurnServers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(turnServers, initialServer) { - var _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, server; - - return _regeneratorRuntime().wrap(function _callee2$(_context2) { - while (1) { - switch (_context2.prev = _context2.next) { - case 0: - _context2.prev = 0; - _context2.next = 3; - return this.transport.send(_WidgetApiAction.WidgetApiToWidgetAction.UpdateTurnServers, initialServer // it's compatible, but missing the index signature - ); - - case 3: - // Pick the generator up where we left off - _iteratorAbruptCompletion = false; - _didIteratorError = false; - _context2.prev = 5; - _iterator = _asyncIterator(turnServers); - - case 7: - _context2.next = 9; - return _iterator.next(); - - case 9: - if (!(_iteratorAbruptCompletion = !(_step = _context2.sent).done)) { - _context2.next = 16; - break; - } - - server = _step.value; - _context2.next = 13; - return this.transport.send(_WidgetApiAction.WidgetApiToWidgetAction.UpdateTurnServers, server // it's compatible, but missing the index signature - ); - - case 13: - _iteratorAbruptCompletion = false; - _context2.next = 7; - break; - - case 16: - _context2.next = 22; - break; - - case 18: - _context2.prev = 18; - _context2.t0 = _context2["catch"](5); - _didIteratorError = true; - _iteratorError = _context2.t0; - - case 22: - _context2.prev = 22; - _context2.prev = 23; - - if (!(_iteratorAbruptCompletion && _iterator["return"] != null)) { - _context2.next = 27; - break; - } - - _context2.next = 27; - return _iterator["return"](); - - case 27: - _context2.prev = 27; - - if (!_didIteratorError) { - _context2.next = 30; - break; - } - - throw _iteratorError; - - case 30: - return _context2.finish(27); - - case 31: - return _context2.finish(22); - - case 32: - _context2.next = 37; - break; - - case 34: - _context2.prev = 34; - _context2.t1 = _context2["catch"](0); - console.error("error polling for TURN servers", _context2.t1); - - case 37: - case "end": - return _context2.stop(); - } - } - }, _callee2, this, [[0, 34], [5, 18, 22, 32], [23,, 27, 31]]); - })); - - function pollTurnServers(_x2, _x3) { - return _pollTurnServers.apply(this, arguments); - } - - return pollTurnServers; - }() - }, { - key: "handleWatchTurnServers", - value: function () { - var _handleWatchTurnServers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(request) { - var turnServers, _yield$turnServers$ne, done, value; - - return _regeneratorRuntime().wrap(function _callee3$(_context3) { - while (1) { - switch (_context3.prev = _context3.next) { - case 0: - if (this.hasCapability(_Capabilities.MatrixCapabilities.MSC3846TurnServers)) { - _context3.next = 5; - break; - } - - _context3.next = 3; - return this.transport.reply(request, { - error: { - message: "Missing capability" - } - }); - - case 3: - _context3.next = 30; - break; - - case 5: - if (!this.turnServers) { - _context3.next = 10; - break; - } - - _context3.next = 8; - return this.transport.reply(request, {}); - - case 8: - _context3.next = 30; - break; - - case 10: - _context3.prev = 10; - turnServers = this.driver.getTurnServers(); // Peek at the first result, so we can at least verify that the - // client isn't banned from getting TURN servers entirely - - _context3.next = 14; - return turnServers.next(); - - case 14: - _yield$turnServers$ne = _context3.sent; - done = _yield$turnServers$ne.done; - value = _yield$turnServers$ne.value; - - if (!done) { - _context3.next = 19; - break; - } - - throw new Error("Client refuses to provide any TURN servers"); - - case 19: - _context3.next = 21; - return this.transport.reply(request, {}); - - case 21: - // Start the poll loop, sending the widget the initial result - this.pollTurnServers(turnServers, value); - this.turnServers = turnServers; - _context3.next = 30; - break; - - case 25: - _context3.prev = 25; - _context3.t0 = _context3["catch"](10); - console.error("error getting first TURN server results", _context3.t0); - _context3.next = 30; - return this.transport.reply(request, { - error: { - message: "TURN servers not available" - } - }); - - case 30: - case "end": - return _context3.stop(); - } - } - }, _callee3, this, [[10, 25]]); - })); - - function handleWatchTurnServers(_x4) { - return _handleWatchTurnServers.apply(this, arguments); - } - - return handleWatchTurnServers; - }() - }, { - key: "handleUnwatchTurnServers", - value: function () { - var _handleUnwatchTurnServers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(request) { - return _regeneratorRuntime().wrap(function _callee4$(_context4) { - while (1) { - switch (_context4.prev = _context4.next) { - case 0: - if (this.hasCapability(_Capabilities.MatrixCapabilities.MSC3846TurnServers)) { - _context4.next = 5; - break; - } - - _context4.next = 3; - return this.transport.reply(request, { - error: { - message: "Missing capability" - } - }); - - case 3: - _context4.next = 15; - break; - - case 5: - if (this.turnServers) { - _context4.next = 10; - break; - } - - _context4.next = 8; - return this.transport.reply(request, {}); - - case 8: - _context4.next = 15; - break; - - case 10: - _context4.next = 12; - return this.turnServers["return"](undefined); - - case 12: - this.turnServers = null; - _context4.next = 15; - return this.transport.reply(request, {}); - - case 15: - case "end": - return _context4.stop(); - } - } - }, _callee4, this); - })); - - function handleUnwatchTurnServers(_x5) { - return _handleUnwatchTurnServers.apply(this, arguments); - } - - return handleUnwatchTurnServers; - }() - }, { - key: "handleReadRelations", - value: function () { - var _handleReadRelations = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(request) { - var _this9 = this; - - var result, chunk; - return _regeneratorRuntime().wrap(function _callee5$(_context5) { - while (1) { - switch (_context5.prev = _context5.next) { - case 0: - if (request.data.event_id) { - _context5.next = 2; - break; - } - - return _context5.abrupt("return", this.transport.reply(request, { - error: { - message: "Invalid request - missing event ID" - } - })); - - case 2: - if (!(request.data.limit !== undefined && request.data.limit < 0)) { - _context5.next = 4; - break; - } - - return _context5.abrupt("return", this.transport.reply(request, { - error: { - message: "Invalid request - limit out of range" - } - })); - - case 4: - if (!(request.data.room_id !== undefined && !this.canUseRoomTimeline(request.data.room_id))) { - _context5.next = 6; - break; - } - - return _context5.abrupt("return", this.transport.reply(request, { - error: { - message: "Unable to access room timeline: ".concat(request.data.room_id) - } - })); - - case 6: - _context5.prev = 6; - _context5.next = 9; - return this.driver.readEventRelations(request.data.event_id, request.data.room_id, request.data.rel_type, request.data.event_type, request.data.from, request.data.to, request.data.limit, request.data.direction); - - case 9: - result = _context5.sent; - // only return events that the user has the permission to receive - chunk = result.chunk.filter(function (e) { - if (e.state_key !== undefined) { - return _this9.canReceiveStateEvent(e.type, e.state_key); - } else { - return _this9.canReceiveRoomEvent(e.type, e.content['msgtype']); - } - }); - return _context5.abrupt("return", this.transport.reply(request, { - chunk: chunk, - prev_batch: result.prevBatch, - next_batch: result.nextBatch - })); - - case 14: - _context5.prev = 14; - _context5.t0 = _context5["catch"](6); - console.error("error getting the relations", _context5.t0); - _context5.next = 19; - return this.transport.reply(request, { - error: { - message: "Unexpected error while reading relations" - } - }); - - case 19: - case "end": - return _context5.stop(); - } - } - }, _callee5, this, [[6, 14]]); - })); - - function handleReadRelations(_x6) { - return _handleReadRelations.apply(this, arguments); - } - - return handleReadRelations; - }() - }, { - key: "handleUserDirectorySearch", - value: function () { - var _handleUserDirectorySearch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(request) { - var result; - return _regeneratorRuntime().wrap(function _callee6$(_context6) { - while (1) { - switch (_context6.prev = _context6.next) { - case 0: - if (this.hasCapability(_Capabilities.MatrixCapabilities.MSC3973UserDirectorySearch)) { - _context6.next = 2; - break; - } - - return _context6.abrupt("return", this.transport.reply(request, { - error: { - message: "Missing capability" - } - })); - - case 2: - if (!(typeof request.data.search_term !== 'string')) { - _context6.next = 4; - break; - } - - return _context6.abrupt("return", this.transport.reply(request, { - error: { - message: "Invalid request - missing search term" - } - })); - - case 4: - if (!(request.data.limit !== undefined && request.data.limit < 0)) { - _context6.next = 6; - break; - } - - return _context6.abrupt("return", this.transport.reply(request, { - error: { - message: "Invalid request - limit out of range" - } - })); - - case 6: - _context6.prev = 6; - _context6.next = 9; - return this.driver.searchUserDirectory(request.data.search_term, request.data.limit); - - case 9: - result = _context6.sent; - return _context6.abrupt("return", this.transport.reply(request, { - limited: result.limited, - results: result.results.map(function (r) { - return { - user_id: r.userId, - display_name: r.displayName, - avatar_url: r.avatarUrl - }; - }) - })); - - case 13: - _context6.prev = 13; - _context6.t0 = _context6["catch"](6); - console.error("error searching in the user directory", _context6.t0); - _context6.next = 18; - return this.transport.reply(request, { - error: { - message: "Unexpected error while searching in the user directory" - } - }); - - case 18: - case "end": - return _context6.stop(); - } - } - }, _callee6, this, [[6, 13]]); - })); - - function handleUserDirectorySearch(_x7) { - return _handleUserDirectorySearch.apply(this, arguments); - } - - return handleUserDirectorySearch; - }() - }, { - key: "handleMessage", - value: function handleMessage(ev) { - if (this.isStopped) return; - var actionEv = new CustomEvent("action:".concat(ev.detail.action), { - detail: ev.detail, - cancelable: true - }); - this.emit("action:".concat(ev.detail.action), actionEv); - - if (!actionEv.defaultPrevented) { - switch (ev.detail.action) { - case _WidgetApiAction.WidgetApiFromWidgetAction.ContentLoaded: - return this.handleContentLoadedAction(ev.detail); - - case _WidgetApiAction.WidgetApiFromWidgetAction.SupportedApiVersions: - return this.replyVersions(ev.detail); - - case _WidgetApiAction.WidgetApiFromWidgetAction.SendEvent: - return this.handleSendEvent(ev.detail); - - case _WidgetApiAction.WidgetApiFromWidgetAction.SendToDevice: - return this.handleSendToDevice(ev.detail); - - case _WidgetApiAction.WidgetApiFromWidgetAction.GetOpenIDCredentials: - return this.handleOIDC(ev.detail); - - case _WidgetApiAction.WidgetApiFromWidgetAction.MSC2931Navigate: - return this.handleNavigate(ev.detail); - - case _WidgetApiAction.WidgetApiFromWidgetAction.MSC2974RenegotiateCapabilities: - return this.handleCapabilitiesRenegotiate(ev.detail); - - case _WidgetApiAction.WidgetApiFromWidgetAction.MSC2876ReadEvents: - return this.handleReadEvents(ev.detail); - - case _WidgetApiAction.WidgetApiFromWidgetAction.WatchTurnServers: - return this.handleWatchTurnServers(ev.detail); - - case _WidgetApiAction.WidgetApiFromWidgetAction.UnwatchTurnServers: - return this.handleUnwatchTurnServers(ev.detail); - - case _WidgetApiAction.WidgetApiFromWidgetAction.MSC3869ReadRelations: - return this.handleReadRelations(ev.detail); - - case _WidgetApiAction.WidgetApiFromWidgetAction.MSC3973UserDirectorySearch: - return this.handleUserDirectorySearch(ev.detail); - - default: - return this.transport.reply(ev.detail, { - error: { - message: "Unknown or unsupported action: " + ev.detail.action - } - }); - } - } - } - /** - * Takes a screenshot of the widget. - * @returns Resolves to the widget's screenshot. - * @throws Throws if there is a problem. - */ - - }, { - key: "takeScreenshot", - value: function takeScreenshot() { - return this.transport.send(_WidgetApiAction.WidgetApiToWidgetAction.TakeScreenshot, {}); - } - /** - * Alerts the widget to whether or not it is currently visible. - * @param {boolean} isVisible Whether the widget is visible or not. - * @returns {Promise<IWidgetApiResponseData>} Resolves when the widget acknowledges the update. - */ - - }, { - key: "updateVisibility", - value: function updateVisibility(isVisible) { - return this.transport.send(_WidgetApiAction.WidgetApiToWidgetAction.UpdateVisibility, { - visible: isVisible - }); - } - }, { - key: "sendWidgetConfig", - value: function sendWidgetConfig(data) { - return this.transport.send(_WidgetApiAction.WidgetApiToWidgetAction.WidgetConfig, data).then(); - } - }, { - key: "notifyModalWidgetButtonClicked", - value: function notifyModalWidgetButtonClicked(id) { - return this.transport.send(_WidgetApiAction.WidgetApiToWidgetAction.ButtonClicked, { - id: id - }).then(); - } - }, { - key: "notifyModalWidgetClose", - value: function notifyModalWidgetClose(data) { - return this.transport.send(_WidgetApiAction.WidgetApiToWidgetAction.CloseModalWidget, data).then(); - } - /** - * Feeds an event to the widget. If the widget is not able to accept the event due to - * permissions, this will no-op and return calmly. If the widget failed to handle the - * event, this will raise an error. - * @param {IRoomEvent} rawEvent The event to (try to) send to the widget. - * @param {string} currentViewedRoomId The room ID the user is currently interacting with. - * Not the room ID of the event. - * @returns {Promise<void>} Resolves when complete, rejects if there was an error sending. - */ - - }, { - key: "feedEvent", - value: function () { - var _feedEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(rawEvent, currentViewedRoomId) { - var _rawEvent$content; - - return _regeneratorRuntime().wrap(function _callee7$(_context7) { - while (1) { - switch (_context7.prev = _context7.next) { - case 0: - if (!(rawEvent.room_id !== currentViewedRoomId && !this.canUseRoomTimeline(rawEvent.room_id))) { - _context7.next = 2; - break; - } - - return _context7.abrupt("return"); - - case 2: - if (!(rawEvent.state_key !== undefined && rawEvent.state_key !== null)) { - _context7.next = 7; - break; - } - - if (this.canReceiveStateEvent(rawEvent.type, rawEvent.state_key)) { - _context7.next = 5; - break; - } - - return _context7.abrupt("return"); - - case 5: - _context7.next = 9; - break; - - case 7: - if (this.canReceiveRoomEvent(rawEvent.type, (_rawEvent$content = rawEvent.content) === null || _rawEvent$content === void 0 ? void 0 : _rawEvent$content["msgtype"])) { - _context7.next = 9; - break; - } - - return _context7.abrupt("return"); - - case 9: - _context7.next = 11; - return this.transport.send(_WidgetApiAction.WidgetApiToWidgetAction.SendEvent, rawEvent // it's compatible, but missing the index signature - ); - - case 11: - case "end": - return _context7.stop(); - } - } - }, _callee7, this); - })); - - function feedEvent(_x8, _x9) { - return _feedEvent.apply(this, arguments); - } - - return feedEvent; - }() - /** - * Feeds a to-device event to the widget. If the widget is not able to accept the - * event due to permissions, this will no-op and return calmly. If the widget failed - * to handle the event, this will raise an error. - * @param {IRoomEvent} rawEvent The event to (try to) send to the widget. - * @param {boolean} encrypted Whether the event contents were encrypted. - * @returns {Promise<void>} Resolves when complete, rejects if there was an error sending. - */ - - }, { - key: "feedToDevice", - value: function () { - var _feedToDevice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(rawEvent, encrypted) { - return _regeneratorRuntime().wrap(function _callee8$(_context8) { - while (1) { - switch (_context8.prev = _context8.next) { - case 0: - if (!this.canReceiveToDeviceEvent(rawEvent.type)) { - _context8.next = 3; - break; - } - - _context8.next = 3; - return this.transport.send(_WidgetApiAction.WidgetApiToWidgetAction.SendToDevice, // it's compatible, but missing the index signature - _objectSpread(_objectSpread({}, rawEvent), {}, { - encrypted: encrypted - })); - - case 3: - case "end": - return _context8.stop(); - } - } - }, _callee8, this); - })); - - function feedToDevice(_x10, _x11) { - return _feedToDevice.apply(this, arguments); - } - - return feedToDevice; - }() - }]); - - return ClientWidgetApi; -}(_events.EventEmitter); - -exports.ClientWidgetApi = ClientWidgetApi;
\ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/Symbols.d.ts b/includes/external/matrix/node_modules/matrix-widget-api/lib/Symbols.d.ts deleted file mode 100644 index ce657a4..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/Symbols.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export declare enum Symbols { - AnyRoom = "*" -} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/Symbols.js b/includes/external/matrix/node_modules/matrix-widget-api/lib/Symbols.js deleted file mode 100644 index 13813f5..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/Symbols.js +++ /dev/null @@ -1,28 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.Symbols = void 0; - -/* - * Copyright 2021 The Matrix.org Foundation C.I.C. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -var Symbols; -exports.Symbols = Symbols; - -(function (Symbols) { - Symbols["AnyRoom"] = "*"; -})(Symbols || (exports.Symbols = Symbols = {}));
\ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/WidgetApi.d.ts b/includes/external/matrix/node_modules/matrix-widget-api/lib/WidgetApi.d.ts deleted file mode 100644 index f153c9c..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/WidgetApi.d.ts +++ /dev/null @@ -1,265 +0,0 @@ -import { EventEmitter } from "events"; -import { Capability } from "./interfaces/Capabilities"; -import { ApiVersion } from "./interfaces/ApiVersion"; -import { ITransport } from "./transport/ITransport"; -import { IStickerActionRequestData } from "./interfaces/StickerAction"; -import { IOpenIDCredentials } from "./interfaces/GetOpenIDAction"; -import { WidgetType } from "./interfaces/WidgetType"; -import { IModalWidgetCreateData, IModalWidgetOpenRequestDataButton, IModalWidgetReturnData, ModalButtonID } from "./interfaces/ModalWidgetActions"; -import { ISendEventFromWidgetResponseData } from "./interfaces/SendEventAction"; -import { ISendToDeviceFromWidgetResponseData } from "./interfaces/SendToDeviceAction"; -import { IRoomEvent } from "./interfaces/IRoomEvent"; -import { ITurnServer } from "./interfaces/TurnServerActions"; -import { Symbols } from "./Symbols"; -import { IReadRelationsFromWidgetResponseData } from "./interfaces/ReadRelationsAction"; -import { IUserDirectorySearchFromWidgetResponseData } from "./interfaces/UserDirectorySearchAction"; -/** - * API handler for widgets. This raises events for each action - * received as `action:${action}` (eg: "action:screenshot"). - * Default handling can be prevented by using preventDefault() - * on the raised event. The default handling varies for each - * action: ones which the SDK can handle safely are acknowledged - * appropriately and ones which are unhandled (custom or require - * the widget to do something) are rejected with an error. - * - * Events which are preventDefault()ed must reply using the - * transport. The events raised will have a detail of an - * IWidgetApiRequest interface. - * - * When the WidgetApi is ready to start sending requests, it will - * raise a "ready" CustomEvent. After the ready event fires, actions - * can be sent and the transport will be ready. - */ -export declare class WidgetApi extends EventEmitter { - private clientOrigin; - readonly transport: ITransport; - private capabilitiesFinished; - private supportsMSC2974Renegotiate; - private requestedCapabilities; - private approvedCapabilities?; - private cachedClientVersions?; - private turnServerWatchers; - /** - * Creates a new API handler for the given widget. - * @param {string} widgetId The widget ID to listen for. If not supplied then - * the API will use the widget ID from the first valid request it receives. - * @param {string} clientOrigin The origin of the client, or null if not known. - */ - constructor(widgetId?: string | null, clientOrigin?: string | null); - /** - * Determines if the widget was granted a particular capability. Note that on - * clients where the capabilities are not fed back to the widget this function - * will rely on requested capabilities instead. - * @param {Capability} capability The capability to check for approval of. - * @returns {boolean} True if the widget has approval for the given capability. - */ - hasCapability(capability: Capability): boolean; - /** - * Request a capability from the client. It is not guaranteed to be allowed, - * but will be asked for. - * @param {Capability} capability The capability to request. - * @throws Throws if the capabilities negotiation has already started and the - * widget is unable to request additional capabilities. - */ - requestCapability(capability: Capability): void; - /** - * Request capabilities from the client. They are not guaranteed to be allowed, - * but will be asked for if the negotiation has not already happened. - * @param {Capability[]} capabilities The capabilities to request. - * @throws Throws if the capabilities negotiation has already started. - */ - requestCapabilities(capabilities: Capability[]): void; - /** - * Requests the capability to interact with rooms other than the user's currently - * viewed room. Applies to event receiving and sending. - * @param {string | Symbols.AnyRoom} roomId The room ID, or `Symbols.AnyRoom` to - * denote all known rooms. - */ - requestCapabilityForRoomTimeline(roomId: string | Symbols.AnyRoom): void; - /** - * Requests the capability to send a given state event with optional explicit - * state key. It is not guaranteed to be allowed, but will be asked for if the - * negotiation has not already happened. - * @param {string} eventType The state event type to ask for. - * @param {string} stateKey If specified, the specific state key to request. - * Otherwise all state keys will be requested. - */ - requestCapabilityToSendState(eventType: string, stateKey?: string): void; - /** - * Requests the capability to receive a given state event with optional explicit - * state key. It is not guaranteed to be allowed, but will be asked for if the - * negotiation has not already happened. - * @param {string} eventType The state event type to ask for. - * @param {string} stateKey If specified, the specific state key to request. - * Otherwise all state keys will be requested. - */ - requestCapabilityToReceiveState(eventType: string, stateKey?: string): void; - /** - * Requests the capability to send a given to-device event. It is not - * guaranteed to be allowed, but will be asked for if the negotiation has - * not already happened. - * @param {string} eventType The room event type to ask for. - */ - requestCapabilityToSendToDevice(eventType: string): void; - /** - * Requests the capability to receive a given to-device event. It is not - * guaranteed to be allowed, but will be asked for if the negotiation has - * not already happened. - * @param {string} eventType The room event type to ask for. - */ - requestCapabilityToReceiveToDevice(eventType: string): void; - /** - * Requests the capability to send a given room event. It is not guaranteed to be - * allowed, but will be asked for if the negotiation has not already happened. - * @param {string} eventType The room event type to ask for. - */ - requestCapabilityToSendEvent(eventType: string): void; - /** - * Requests the capability to receive a given room event. It is not guaranteed to be - * allowed, but will be asked for if the negotiation has not already happened. - * @param {string} eventType The room event type to ask for. - */ - requestCapabilityToReceiveEvent(eventType: string): void; - /** - * Requests the capability to send a given message event with optional explicit - * `msgtype`. It is not guaranteed to be allowed, but will be asked for if the - * negotiation has not already happened. - * @param {string} msgtype If specified, the specific msgtype to request. - * Otherwise all message types will be requested. - */ - requestCapabilityToSendMessage(msgtype?: string): void; - /** - * Requests the capability to receive a given message event with optional explicit - * `msgtype`. It is not guaranteed to be allowed, but will be asked for if the - * negotiation has not already happened. - * @param {string} msgtype If specified, the specific msgtype to request. - * Otherwise all message types will be requested. - */ - requestCapabilityToReceiveMessage(msgtype?: string): void; - /** - * Requests an OpenID Connect token from the client for the currently logged in - * user. This token can be validated server-side with the federation API. Note - * that the widget is responsible for validating the token and caching any results - * it needs. - * @returns {Promise<IOpenIDCredentials>} Resolves to a token for verification. - * @throws Throws if the user rejected the request or the request failed. - */ - requestOpenIDConnectToken(): Promise<IOpenIDCredentials>; - /** - * Asks the client for additional capabilities. Capabilities can be queued for this - * request with the requestCapability() functions. - * @returns {Promise<void>} Resolves when complete. Note that the promise resolves when - * the capabilities request has gone through, not when the capabilities are approved/denied. - * Use the WidgetApiToWidgetAction.NotifyCapabilities action to detect changes. - */ - updateRequestedCapabilities(): Promise<void>; - /** - * Tell the client that the content has been loaded. - * @returns {Promise} Resolves when the client acknowledges the request. - */ - sendContentLoaded(): Promise<void>; - /** - * Sends a sticker to the client. - * @param {IStickerActionRequestData} sticker The sticker to send. - * @returns {Promise} Resolves when the client acknowledges the request. - */ - sendSticker(sticker: IStickerActionRequestData): Promise<void>; - /** - * Asks the client to set the always-on-screen status for this widget. - * @param {boolean} value The new state to request. - * @returns {Promise<boolean>} Resolve with true if the client was able to fulfill - * the request, resolves to false otherwise. Rejects if an error occurred. - */ - setAlwaysOnScreen(value: boolean): Promise<boolean>; - /** - * Opens a modal widget. - * @param {string} url The URL to the modal widget. - * @param {string} name The name of the widget. - * @param {IModalWidgetOpenRequestDataButton[]} buttons The buttons to have on the widget. - * @param {IModalWidgetCreateData} data Data to supply to the modal widget. - * @param {WidgetType} type The type of modal widget. - * @returns {Promise<void>} Resolves when the modal widget has been opened. - */ - openModalWidget(url: string, name: string, buttons?: IModalWidgetOpenRequestDataButton[], data?: IModalWidgetCreateData, type?: WidgetType): Promise<void>; - /** - * Closes the modal widget. The widget's session will be terminated shortly after. - * @param {IModalWidgetReturnData} data Optional data to close the modal widget with. - * @returns {Promise<void>} Resolves when complete. - */ - closeModalWidget(data?: IModalWidgetReturnData): Promise<void>; - sendRoomEvent(eventType: string, content: unknown, roomId?: string): Promise<ISendEventFromWidgetResponseData>; - sendStateEvent(eventType: string, stateKey: string, content: unknown, roomId?: string): Promise<ISendEventFromWidgetResponseData>; - /** - * Sends a to-device event. - * @param {string} eventType The type of events being sent. - * @param {boolean} encrypted Whether to encrypt the message contents. - * @param {Object} contentMap A map from user IDs to device IDs to message contents. - * @returns {Promise<ISendToDeviceFromWidgetResponseData>} Resolves when complete. - */ - sendToDevice(eventType: string, encrypted: boolean, contentMap: { - [userId: string]: { - [deviceId: string]: object; - }; - }): Promise<ISendToDeviceFromWidgetResponseData>; - readRoomEvents(eventType: string, limit?: number, msgtype?: string, roomIds?: (string | Symbols.AnyRoom)[]): Promise<IRoomEvent[]>; - /** - * Reads all related events given a known eventId. - * @param eventId The id of the parent event to be read. - * @param roomId The room to look within. When undefined, the user's currently - * viewed room. - * @param relationType The relationship type of child events to search for. - * When undefined, all relations are returned. - * @param eventType The event type of child events to search for. When undefined, - * all related events are returned. - * @param limit The maximum number of events to retrieve per room. If not - * supplied, the server will apply a default limit. - * @param from The pagination token to start returning results from, as - * received from a previous call. If not supplied, results start at the most - * recent topological event known to the server. - * @param to The pagination token to stop returning results at. If not - * supplied, results continue up to limit or until there are no more events. - * @param direction The direction to search for according to MSC3715. - * @returns Resolves to the room relations. - */ - readEventRelations(eventId: string, roomId?: string, relationType?: string, eventType?: string, limit?: number, from?: string, to?: string, direction?: 'f' | 'b'): Promise<IReadRelationsFromWidgetResponseData>; - readStateEvents(eventType: string, limit?: number, stateKey?: string, roomIds?: (string | Symbols.AnyRoom)[]): Promise<IRoomEvent[]>; - /** - * Sets a button as disabled or enabled on the modal widget. Buttons are enabled by default. - * @param {ModalButtonID} buttonId The button ID to enable/disable. - * @param {boolean} isEnabled Whether or not the button is enabled. - * @returns {Promise<void>} Resolves when complete. - * @throws Throws if the button cannot be disabled, or the client refuses to disable the button. - */ - setModalButtonEnabled(buttonId: ModalButtonID, isEnabled: boolean): Promise<void>; - /** - * Attempts to navigate the client to the given URI. This can only be called with Matrix URIs - * (currently only matrix.to, but in future a Matrix URI scheme will be defined). - * @param {string} uri The URI to navigate to. - * @returns {Promise<void>} Resolves when complete. - * @throws Throws if the URI is invalid or cannot be processed. - * @deprecated This currently relies on an unstable MSC (MSC2931). - */ - navigateTo(uri: string): Promise<void>; - /** - * Starts watching for TURN servers, yielding an initial set of credentials as soon as possible, - * and thereafter yielding new credentials whenever the previous ones expire. - * @yields {ITurnServer} The TURN server URIs and credentials currently available to the widget. - */ - getTurnServers(): AsyncGenerator<ITurnServer>; - /** - * Search for users in the user directory. - * @param searchTerm The term to search for. - * @param limit The maximum number of results to return. If not supplied, the - * @returns Resolves to the search results. - */ - searchUserDirectory(searchTerm: string, limit?: number): Promise<IUserDirectorySearchFromWidgetResponseData>; - /** - * Starts the communication channel. This should be done early to ensure - * that messages are not missed. Communication can only be stopped by the client. - */ - start(): void; - private handleMessage; - private replyVersions; - getClientVersions(): Promise<ApiVersion[]>; - private handleCapabilities; -} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/WidgetApi.js b/includes/external/matrix/node_modules/matrix-widget-api/lib/WidgetApi.js deleted file mode 100644 index 8896d9c..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/WidgetApi.js +++ /dev/null @@ -1,922 +0,0 @@ -"use strict"; - -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.WidgetApi = void 0; - -var _events = require("events"); - -var _WidgetApiDirection = require("./interfaces/WidgetApiDirection"); - -var _ApiVersion = require("./interfaces/ApiVersion"); - -var _PostmessageTransport = require("./transport/PostmessageTransport"); - -var _WidgetApiAction = require("./interfaces/WidgetApiAction"); - -var _GetOpenIDAction = require("./interfaces/GetOpenIDAction"); - -var _WidgetType = require("./interfaces/WidgetType"); - -var _ModalWidgetActions = require("./interfaces/ModalWidgetActions"); - -var _WidgetEventCapability = require("./models/WidgetEventCapability"); - -var _Symbols = require("./Symbols"); - -function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; } - -function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } - -function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } - -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -function _awaitAsyncGenerator(value) { return new _AwaitValue(value); } - -function _wrapAsyncGenerator(fn) { return function () { return new _AsyncGenerator(fn.apply(this, arguments)); }; } - -function _AsyncGenerator(gen) { var front, back; function send(key, arg) { return new Promise(function (resolve, reject) { var request = { key: key, arg: arg, resolve: resolve, reject: reject, next: null }; if (back) { back = back.next = request; } else { front = back = request; resume(key, arg); } }); } function resume(key, arg) { try { var result = gen[key](arg); var value = result.value; var wrappedAwait = value instanceof _AwaitValue; Promise.resolve(wrappedAwait ? value.wrapped : value).then(function (arg) { if (wrappedAwait) { resume(key === "return" ? "return" : "next", arg); return; } settle(result.done ? "return" : "normal", arg); }, function (err) { resume("throw", err); }); } catch (err) { settle("throw", err); } } function settle(type, value) { switch (type) { case "return": front.resolve({ value: value, done: true }); break; case "throw": front.reject(value); break; default: front.resolve({ value: value, done: false }); break; } front = front.next; if (front) { resume(front.key, front.arg); } else { back = null; } } this._invoke = send; if (typeof gen["return"] !== "function") { this["return"] = undefined; } } - -_AsyncGenerator.prototype[typeof Symbol === "function" && Symbol.asyncIterator || "@@asyncIterator"] = function () { return this; }; - -_AsyncGenerator.prototype.next = function (arg) { return this._invoke("next", arg); }; - -_AsyncGenerator.prototype["throw"] = function (arg) { return this._invoke("throw", arg); }; - -_AsyncGenerator.prototype["return"] = function (arg) { return this._invoke("return", arg); }; - -function _AwaitValue(value) { this.wrapped = value; } - -/** - * API handler for widgets. This raises events for each action - * received as `action:${action}` (eg: "action:screenshot"). - * Default handling can be prevented by using preventDefault() - * on the raised event. The default handling varies for each - * action: ones which the SDK can handle safely are acknowledged - * appropriately and ones which are unhandled (custom or require - * the widget to do something) are rejected with an error. - * - * Events which are preventDefault()ed must reply using the - * transport. The events raised will have a detail of an - * IWidgetApiRequest interface. - * - * When the WidgetApi is ready to start sending requests, it will - * raise a "ready" CustomEvent. After the ready event fires, actions - * can be sent and the transport will be ready. - */ -var WidgetApi = /*#__PURE__*/function (_EventEmitter) { - _inherits(WidgetApi, _EventEmitter); - - var _super = _createSuper(WidgetApi); - - /** - * Creates a new API handler for the given widget. - * @param {string} widgetId The widget ID to listen for. If not supplied then - * the API will use the widget ID from the first valid request it receives. - * @param {string} clientOrigin The origin of the client, or null if not known. - */ - function WidgetApi() { - var _this2; - - var widgetId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; - var clientOrigin = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; - - _classCallCheck(this, WidgetApi); - - _this2 = _super.call(this); - _this2.clientOrigin = clientOrigin; - - _defineProperty(_assertThisInitialized(_this2), "transport", void 0); - - _defineProperty(_assertThisInitialized(_this2), "capabilitiesFinished", false); - - _defineProperty(_assertThisInitialized(_this2), "supportsMSC2974Renegotiate", false); - - _defineProperty(_assertThisInitialized(_this2), "requestedCapabilities", []); - - _defineProperty(_assertThisInitialized(_this2), "approvedCapabilities", void 0); - - _defineProperty(_assertThisInitialized(_this2), "cachedClientVersions", void 0); - - _defineProperty(_assertThisInitialized(_this2), "turnServerWatchers", 0); - - if (!window.parent) { - throw new Error("No parent window. This widget doesn't appear to be embedded properly."); - } - - _this2.transport = new _PostmessageTransport.PostmessageTransport(_WidgetApiDirection.WidgetApiDirection.FromWidget, widgetId, window.parent, window); - _this2.transport.targetOrigin = clientOrigin; - - _this2.transport.on("message", _this2.handleMessage.bind(_assertThisInitialized(_this2))); - - return _this2; - } - /** - * Determines if the widget was granted a particular capability. Note that on - * clients where the capabilities are not fed back to the widget this function - * will rely on requested capabilities instead. - * @param {Capability} capability The capability to check for approval of. - * @returns {boolean} True if the widget has approval for the given capability. - */ - - - _createClass(WidgetApi, [{ - key: "hasCapability", - value: function hasCapability(capability) { - if (Array.isArray(this.approvedCapabilities)) { - return this.approvedCapabilities.includes(capability); - } - - return this.requestedCapabilities.includes(capability); - } - /** - * Request a capability from the client. It is not guaranteed to be allowed, - * but will be asked for. - * @param {Capability} capability The capability to request. - * @throws Throws if the capabilities negotiation has already started and the - * widget is unable to request additional capabilities. - */ - - }, { - key: "requestCapability", - value: function requestCapability(capability) { - if (this.capabilitiesFinished && !this.supportsMSC2974Renegotiate) { - throw new Error("Capabilities have already been negotiated"); - } - - this.requestedCapabilities.push(capability); - } - /** - * Request capabilities from the client. They are not guaranteed to be allowed, - * but will be asked for if the negotiation has not already happened. - * @param {Capability[]} capabilities The capabilities to request. - * @throws Throws if the capabilities negotiation has already started. - */ - - }, { - key: "requestCapabilities", - value: function requestCapabilities(capabilities) { - var _this3 = this; - - capabilities.forEach(function (cap) { - return _this3.requestCapability(cap); - }); - } - /** - * Requests the capability to interact with rooms other than the user's currently - * viewed room. Applies to event receiving and sending. - * @param {string | Symbols.AnyRoom} roomId The room ID, or `Symbols.AnyRoom` to - * denote all known rooms. - */ - - }, { - key: "requestCapabilityForRoomTimeline", - value: function requestCapabilityForRoomTimeline(roomId) { - this.requestCapability("org.matrix.msc2762.timeline:".concat(roomId)); - } - /** - * Requests the capability to send a given state event with optional explicit - * state key. It is not guaranteed to be allowed, but will be asked for if the - * negotiation has not already happened. - * @param {string} eventType The state event type to ask for. - * @param {string} stateKey If specified, the specific state key to request. - * Otherwise all state keys will be requested. - */ - - }, { - key: "requestCapabilityToSendState", - value: function requestCapabilityToSendState(eventType, stateKey) { - this.requestCapability(_WidgetEventCapability.WidgetEventCapability.forStateEvent(_WidgetEventCapability.EventDirection.Send, eventType, stateKey).raw); - } - /** - * Requests the capability to receive a given state event with optional explicit - * state key. It is not guaranteed to be allowed, but will be asked for if the - * negotiation has not already happened. - * @param {string} eventType The state event type to ask for. - * @param {string} stateKey If specified, the specific state key to request. - * Otherwise all state keys will be requested. - */ - - }, { - key: "requestCapabilityToReceiveState", - value: function requestCapabilityToReceiveState(eventType, stateKey) { - this.requestCapability(_WidgetEventCapability.WidgetEventCapability.forStateEvent(_WidgetEventCapability.EventDirection.Receive, eventType, stateKey).raw); - } - /** - * Requests the capability to send a given to-device event. It is not - * guaranteed to be allowed, but will be asked for if the negotiation has - * not already happened. - * @param {string} eventType The room event type to ask for. - */ - - }, { - key: "requestCapabilityToSendToDevice", - value: function requestCapabilityToSendToDevice(eventType) { - this.requestCapability(_WidgetEventCapability.WidgetEventCapability.forToDeviceEvent(_WidgetEventCapability.EventDirection.Send, eventType).raw); - } - /** - * Requests the capability to receive a given to-device event. It is not - * guaranteed to be allowed, but will be asked for if the negotiation has - * not already happened. - * @param {string} eventType The room event type to ask for. - */ - - }, { - key: "requestCapabilityToReceiveToDevice", - value: function requestCapabilityToReceiveToDevice(eventType) { - this.requestCapability(_WidgetEventCapability.WidgetEventCapability.forToDeviceEvent(_WidgetEventCapability.EventDirection.Receive, eventType).raw); - } - /** - * Requests the capability to send a given room event. It is not guaranteed to be - * allowed, but will be asked for if the negotiation has not already happened. - * @param {string} eventType The room event type to ask for. - */ - - }, { - key: "requestCapabilityToSendEvent", - value: function requestCapabilityToSendEvent(eventType) { - this.requestCapability(_WidgetEventCapability.WidgetEventCapability.forRoomEvent(_WidgetEventCapability.EventDirection.Send, eventType).raw); - } - /** - * Requests the capability to receive a given room event. It is not guaranteed to be - * allowed, but will be asked for if the negotiation has not already happened. - * @param {string} eventType The room event type to ask for. - */ - - }, { - key: "requestCapabilityToReceiveEvent", - value: function requestCapabilityToReceiveEvent(eventType) { - this.requestCapability(_WidgetEventCapability.WidgetEventCapability.forRoomEvent(_WidgetEventCapability.EventDirection.Receive, eventType).raw); - } - /** - * Requests the capability to send a given message event with optional explicit - * `msgtype`. It is not guaranteed to be allowed, but will be asked for if the - * negotiation has not already happened. - * @param {string} msgtype If specified, the specific msgtype to request. - * Otherwise all message types will be requested. - */ - - }, { - key: "requestCapabilityToSendMessage", - value: function requestCapabilityToSendMessage(msgtype) { - this.requestCapability(_WidgetEventCapability.WidgetEventCapability.forRoomMessageEvent(_WidgetEventCapability.EventDirection.Send, msgtype).raw); - } - /** - * Requests the capability to receive a given message event with optional explicit - * `msgtype`. It is not guaranteed to be allowed, but will be asked for if the - * negotiation has not already happened. - * @param {string} msgtype If specified, the specific msgtype to request. - * Otherwise all message types will be requested. - */ - - }, { - key: "requestCapabilityToReceiveMessage", - value: function requestCapabilityToReceiveMessage(msgtype) { - this.requestCapability(_WidgetEventCapability.WidgetEventCapability.forRoomMessageEvent(_WidgetEventCapability.EventDirection.Receive, msgtype).raw); - } - /** - * Requests an OpenID Connect token from the client for the currently logged in - * user. This token can be validated server-side with the federation API. Note - * that the widget is responsible for validating the token and caching any results - * it needs. - * @returns {Promise<IOpenIDCredentials>} Resolves to a token for verification. - * @throws Throws if the user rejected the request or the request failed. - */ - - }, { - key: "requestOpenIDConnectToken", - value: function requestOpenIDConnectToken() { - var _this4 = this; - - return new Promise(function (resolve, reject) { - _this4.transport.sendComplete(_WidgetApiAction.WidgetApiFromWidgetAction.GetOpenIDCredentials, {}).then(function (response) { - var rdata = response.response; - - if (rdata.state === _GetOpenIDAction.OpenIDRequestState.Allowed) { - resolve(rdata); - } else if (rdata.state === _GetOpenIDAction.OpenIDRequestState.Blocked) { - reject(new Error("User declined to verify their identity")); - } else if (rdata.state === _GetOpenIDAction.OpenIDRequestState.PendingUserConfirmation) { - var handlerFn = function handlerFn(ev) { - ev.preventDefault(); - var request = ev.detail; - if (request.data.original_request_id !== response.requestId) return; - - if (request.data.state === _GetOpenIDAction.OpenIDRequestState.Allowed) { - resolve(request.data); - - _this4.transport.reply(request, {}); // ack - - } else if (request.data.state === _GetOpenIDAction.OpenIDRequestState.Blocked) { - reject(new Error("User declined to verify their identity")); - - _this4.transport.reply(request, {}); // ack - - } else { - reject(new Error("Invalid state on reply: " + rdata.state)); - - _this4.transport.reply(request, { - error: { - message: "Invalid state" - } - }); - } - - _this4.off("action:".concat(_WidgetApiAction.WidgetApiToWidgetAction.OpenIDCredentials), handlerFn); - }; - - _this4.on("action:".concat(_WidgetApiAction.WidgetApiToWidgetAction.OpenIDCredentials), handlerFn); - } else { - reject(new Error("Invalid state: " + rdata.state)); - } - })["catch"](reject); - }); - } - /** - * Asks the client for additional capabilities. Capabilities can be queued for this - * request with the requestCapability() functions. - * @returns {Promise<void>} Resolves when complete. Note that the promise resolves when - * the capabilities request has gone through, not when the capabilities are approved/denied. - * Use the WidgetApiToWidgetAction.NotifyCapabilities action to detect changes. - */ - - }, { - key: "updateRequestedCapabilities", - value: function updateRequestedCapabilities() { - return this.transport.send(_WidgetApiAction.WidgetApiFromWidgetAction.MSC2974RenegotiateCapabilities, { - capabilities: this.requestedCapabilities - }).then(); - } - /** - * Tell the client that the content has been loaded. - * @returns {Promise} Resolves when the client acknowledges the request. - */ - - }, { - key: "sendContentLoaded", - value: function sendContentLoaded() { - return this.transport.send(_WidgetApiAction.WidgetApiFromWidgetAction.ContentLoaded, {}).then(); - } - /** - * Sends a sticker to the client. - * @param {IStickerActionRequestData} sticker The sticker to send. - * @returns {Promise} Resolves when the client acknowledges the request. - */ - - }, { - key: "sendSticker", - value: function sendSticker(sticker) { - return this.transport.send(_WidgetApiAction.WidgetApiFromWidgetAction.SendSticker, sticker).then(); - } - /** - * Asks the client to set the always-on-screen status for this widget. - * @param {boolean} value The new state to request. - * @returns {Promise<boolean>} Resolve with true if the client was able to fulfill - * the request, resolves to false otherwise. Rejects if an error occurred. - */ - - }, { - key: "setAlwaysOnScreen", - value: function setAlwaysOnScreen(value) { - return this.transport.send(_WidgetApiAction.WidgetApiFromWidgetAction.UpdateAlwaysOnScreen, { - value: value - }).then(function (res) { - return res.success; - }); - } - /** - * Opens a modal widget. - * @param {string} url The URL to the modal widget. - * @param {string} name The name of the widget. - * @param {IModalWidgetOpenRequestDataButton[]} buttons The buttons to have on the widget. - * @param {IModalWidgetCreateData} data Data to supply to the modal widget. - * @param {WidgetType} type The type of modal widget. - * @returns {Promise<void>} Resolves when the modal widget has been opened. - */ - - }, { - key: "openModalWidget", - value: function openModalWidget(url, name) { - var buttons = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; - var data = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; - var type = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : _WidgetType.MatrixWidgetType.Custom; - return this.transport.send(_WidgetApiAction.WidgetApiFromWidgetAction.OpenModalWidget, { - type: type, - url: url, - name: name, - buttons: buttons, - data: data - }).then(); - } - /** - * Closes the modal widget. The widget's session will be terminated shortly after. - * @param {IModalWidgetReturnData} data Optional data to close the modal widget with. - * @returns {Promise<void>} Resolves when complete. - */ - - }, { - key: "closeModalWidget", - value: function closeModalWidget() { - var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - return this.transport.send(_WidgetApiAction.WidgetApiFromWidgetAction.CloseModalWidget, data).then(); - } - }, { - key: "sendRoomEvent", - value: function sendRoomEvent(eventType, content, roomId) { - return this.transport.send(_WidgetApiAction.WidgetApiFromWidgetAction.SendEvent, { - type: eventType, - content: content, - room_id: roomId - }); - } - }, { - key: "sendStateEvent", - value: function sendStateEvent(eventType, stateKey, content, roomId) { - return this.transport.send(_WidgetApiAction.WidgetApiFromWidgetAction.SendEvent, { - type: eventType, - content: content, - state_key: stateKey, - room_id: roomId - }); - } - /** - * Sends a to-device event. - * @param {string} eventType The type of events being sent. - * @param {boolean} encrypted Whether to encrypt the message contents. - * @param {Object} contentMap A map from user IDs to device IDs to message contents. - * @returns {Promise<ISendToDeviceFromWidgetResponseData>} Resolves when complete. - */ - - }, { - key: "sendToDevice", - value: function sendToDevice(eventType, encrypted, contentMap) { - return this.transport.send(_WidgetApiAction.WidgetApiFromWidgetAction.SendToDevice, { - type: eventType, - encrypted: encrypted, - messages: contentMap - }); - } - }, { - key: "readRoomEvents", - value: function readRoomEvents(eventType, limit, msgtype, roomIds) { - var data = { - type: eventType, - msgtype: msgtype - }; - - if (limit !== undefined) { - data.limit = limit; - } - - if (roomIds) { - if (roomIds.includes(_Symbols.Symbols.AnyRoom)) { - data.room_ids = _Symbols.Symbols.AnyRoom; - } else { - data.room_ids = roomIds; - } - } - - return this.transport.send(_WidgetApiAction.WidgetApiFromWidgetAction.MSC2876ReadEvents, data).then(function (r) { - return r.events; - }); - } - /** - * Reads all related events given a known eventId. - * @param eventId The id of the parent event to be read. - * @param roomId The room to look within. When undefined, the user's currently - * viewed room. - * @param relationType The relationship type of child events to search for. - * When undefined, all relations are returned. - * @param eventType The event type of child events to search for. When undefined, - * all related events are returned. - * @param limit The maximum number of events to retrieve per room. If not - * supplied, the server will apply a default limit. - * @param from The pagination token to start returning results from, as - * received from a previous call. If not supplied, results start at the most - * recent topological event known to the server. - * @param to The pagination token to stop returning results at. If not - * supplied, results continue up to limit or until there are no more events. - * @param direction The direction to search for according to MSC3715. - * @returns Resolves to the room relations. - */ - - }, { - key: "readEventRelations", - value: function () { - var _readEventRelations = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(eventId, roomId, relationType, eventType, limit, from, to, direction) { - var versions, data; - return _regeneratorRuntime().wrap(function _callee$(_context) { - while (1) { - switch (_context.prev = _context.next) { - case 0: - _context.next = 2; - return this.getClientVersions(); - - case 2: - versions = _context.sent; - - if (versions.includes(_ApiVersion.UnstableApiVersion.MSC3869)) { - _context.next = 5; - break; - } - - throw new Error("The read_relations action is not supported by the client."); - - case 5: - data = { - event_id: eventId, - rel_type: relationType, - event_type: eventType, - room_id: roomId, - to: to, - from: from, - limit: limit, - direction: direction - }; - return _context.abrupt("return", this.transport.send(_WidgetApiAction.WidgetApiFromWidgetAction.MSC3869ReadRelations, data)); - - case 7: - case "end": - return _context.stop(); - } - } - }, _callee, this); - })); - - function readEventRelations(_x, _x2, _x3, _x4, _x5, _x6, _x7, _x8) { - return _readEventRelations.apply(this, arguments); - } - - return readEventRelations; - }() - }, { - key: "readStateEvents", - value: function readStateEvents(eventType, limit, stateKey, roomIds) { - var data = { - type: eventType, - state_key: stateKey === undefined ? true : stateKey - }; - - if (limit !== undefined) { - data.limit = limit; - } - - if (roomIds) { - if (roomIds.includes(_Symbols.Symbols.AnyRoom)) { - data.room_ids = _Symbols.Symbols.AnyRoom; - } else { - data.room_ids = roomIds; - } - } - - return this.transport.send(_WidgetApiAction.WidgetApiFromWidgetAction.MSC2876ReadEvents, data).then(function (r) { - return r.events; - }); - } - /** - * Sets a button as disabled or enabled on the modal widget. Buttons are enabled by default. - * @param {ModalButtonID} buttonId The button ID to enable/disable. - * @param {boolean} isEnabled Whether or not the button is enabled. - * @returns {Promise<void>} Resolves when complete. - * @throws Throws if the button cannot be disabled, or the client refuses to disable the button. - */ - - }, { - key: "setModalButtonEnabled", - value: function setModalButtonEnabled(buttonId, isEnabled) { - if (buttonId === _ModalWidgetActions.BuiltInModalButtonID.Close) { - throw new Error("The close button cannot be disabled"); - } - - return this.transport.send(_WidgetApiAction.WidgetApiFromWidgetAction.SetModalButtonEnabled, { - button: buttonId, - enabled: isEnabled - }).then(); - } - /** - * Attempts to navigate the client to the given URI. This can only be called with Matrix URIs - * (currently only matrix.to, but in future a Matrix URI scheme will be defined). - * @param {string} uri The URI to navigate to. - * @returns {Promise<void>} Resolves when complete. - * @throws Throws if the URI is invalid or cannot be processed. - * @deprecated This currently relies on an unstable MSC (MSC2931). - */ - - }, { - key: "navigateTo", - value: function navigateTo(uri) { - if (!uri || !uri.startsWith("https://matrix.to/#")) { - throw new Error("Invalid matrix.to URI"); - } - - return this.transport.send(_WidgetApiAction.WidgetApiFromWidgetAction.MSC2931Navigate, { - uri: uri - }).then(); - } - /** - * Starts watching for TURN servers, yielding an initial set of credentials as soon as possible, - * and thereafter yielding new credentials whenever the previous ones expire. - * @yields {ITurnServer} The TURN server URIs and credentials currently available to the widget. - */ - - }, { - key: "getTurnServers", - value: function getTurnServers() { - var _this = this; - - return _wrapAsyncGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() { - var setTurnServer, onUpdateTurnServers; - return _regeneratorRuntime().wrap(function _callee3$(_context3) { - while (1) { - switch (_context3.prev = _context3.next) { - case 0: - onUpdateTurnServers = /*#__PURE__*/function () { - var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(ev) { - return _regeneratorRuntime().wrap(function _callee2$(_context2) { - while (1) { - switch (_context2.prev = _context2.next) { - case 0: - ev.preventDefault(); - setTurnServer(ev.detail.data); - _context2.next = 4; - return _this.transport.reply(ev.detail, {}); - - case 4: - case "end": - return _context2.stop(); - } - } - }, _callee2); - })); - - return function onUpdateTurnServers(_x9) { - return _ref.apply(this, arguments); - }; - }(); // Start listening for updates before we even start watching, to catch - // TURN data that is sent immediately - - - _this.on("action:".concat(_WidgetApiAction.WidgetApiToWidgetAction.UpdateTurnServers), onUpdateTurnServers); // Only send the 'watch' action if we aren't already watching - - - if (!(_this.turnServerWatchers === 0)) { - _context3.next = 12; - break; - } - - _context3.prev = 3; - _context3.next = 6; - return _awaitAsyncGenerator(_this.transport.send(_WidgetApiAction.WidgetApiFromWidgetAction.WatchTurnServers, {})); - - case 6: - _context3.next = 12; - break; - - case 8: - _context3.prev = 8; - _context3.t0 = _context3["catch"](3); - - _this.off("action:".concat(_WidgetApiAction.WidgetApiToWidgetAction.UpdateTurnServers), onUpdateTurnServers); - - throw _context3.t0; - - case 12: - _this.turnServerWatchers++; - _context3.prev = 13; - - case 14: - if (!true) { - _context3.next = 21; - break; - } - - _context3.next = 17; - return _awaitAsyncGenerator(new Promise(function (resolve) { - return setTurnServer = resolve; - })); - - case 17: - _context3.next = 19; - return _context3.sent; - - case 19: - _context3.next = 14; - break; - - case 21: - _context3.prev = 21; - - // The loop was broken by the caller - clean up - _this.off("action:".concat(_WidgetApiAction.WidgetApiToWidgetAction.UpdateTurnServers), onUpdateTurnServers); // Since sending the 'unwatch' action will end updates for all other - // consumers, only send it if we're the only consumer remaining - - - _this.turnServerWatchers--; - - if (!(_this.turnServerWatchers === 0)) { - _context3.next = 27; - break; - } - - _context3.next = 27; - return _awaitAsyncGenerator(_this.transport.send(_WidgetApiAction.WidgetApiFromWidgetAction.UnwatchTurnServers, {})); - - case 27: - return _context3.finish(21); - - case 28: - case "end": - return _context3.stop(); - } - } - }, _callee3, null, [[3, 8], [13,, 21, 28]]); - }))(); - } - /** - * Search for users in the user directory. - * @param searchTerm The term to search for. - * @param limit The maximum number of results to return. If not supplied, the - * @returns Resolves to the search results. - */ - - }, { - key: "searchUserDirectory", - value: function () { - var _searchUserDirectory = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(searchTerm, limit) { - var versions, data; - return _regeneratorRuntime().wrap(function _callee4$(_context4) { - while (1) { - switch (_context4.prev = _context4.next) { - case 0: - _context4.next = 2; - return this.getClientVersions(); - - case 2: - versions = _context4.sent; - - if (versions.includes(_ApiVersion.UnstableApiVersion.MSC3973)) { - _context4.next = 5; - break; - } - - throw new Error("The user_directory_search action is not supported by the client."); - - case 5: - data = { - search_term: searchTerm, - limit: limit - }; - return _context4.abrupt("return", this.transport.send(_WidgetApiAction.WidgetApiFromWidgetAction.MSC3973UserDirectorySearch, data)); - - case 7: - case "end": - return _context4.stop(); - } - } - }, _callee4, this); - })); - - function searchUserDirectory(_x10, _x11) { - return _searchUserDirectory.apply(this, arguments); - } - - return searchUserDirectory; - }() - /** - * Starts the communication channel. This should be done early to ensure - * that messages are not missed. Communication can only be stopped by the client. - */ - - }, { - key: "start", - value: function start() { - var _this5 = this; - - this.transport.start(); - this.getClientVersions().then(function (v) { - if (v.includes(_ApiVersion.UnstableApiVersion.MSC2974)) { - _this5.supportsMSC2974Renegotiate = true; - } - }); - } - }, { - key: "handleMessage", - value: function handleMessage(ev) { - var actionEv = new CustomEvent("action:".concat(ev.detail.action), { - detail: ev.detail, - cancelable: true - }); - this.emit("action:".concat(ev.detail.action), actionEv); - - if (!actionEv.defaultPrevented) { - switch (ev.detail.action) { - case _WidgetApiAction.WidgetApiToWidgetAction.SupportedApiVersions: - return this.replyVersions(ev.detail); - - case _WidgetApiAction.WidgetApiToWidgetAction.Capabilities: - return this.handleCapabilities(ev.detail); - - case _WidgetApiAction.WidgetApiToWidgetAction.UpdateVisibility: - return this.transport.reply(ev.detail, {}); - // ack to avoid error spam - - case _WidgetApiAction.WidgetApiToWidgetAction.NotifyCapabilities: - return this.transport.reply(ev.detail, {}); - // ack to avoid error spam - - default: - return this.transport.reply(ev.detail, { - error: { - message: "Unknown or unsupported action: " + ev.detail.action - } - }); - } - } - } - }, { - key: "replyVersions", - value: function replyVersions(request) { - this.transport.reply(request, { - supported_versions: _ApiVersion.CurrentApiVersions - }); - } - }, { - key: "getClientVersions", - value: function getClientVersions() { - var _this6 = this; - - if (Array.isArray(this.cachedClientVersions)) { - return Promise.resolve(this.cachedClientVersions); - } - - return this.transport.send(_WidgetApiAction.WidgetApiFromWidgetAction.SupportedApiVersions, {}).then(function (r) { - _this6.cachedClientVersions = r.supported_versions; - return r.supported_versions; - })["catch"](function (e) { - console.warn("non-fatal error getting supported client versions: ", e); - return []; - }); - } - }, { - key: "handleCapabilities", - value: function handleCapabilities(request) { - var _this7 = this; - - if (this.capabilitiesFinished) { - return this.transport.reply(request, { - error: { - message: "Capability negotiation already completed" - } - }); - } // See if we can expect a capabilities notification or not - - - return this.getClientVersions().then(function (v) { - if (v.includes(_ApiVersion.UnstableApiVersion.MSC2871)) { - _this7.once("action:".concat(_WidgetApiAction.WidgetApiToWidgetAction.NotifyCapabilities), function (ev) { - _this7.approvedCapabilities = ev.detail.data.approved; - - _this7.emit("ready"); - }); - } else { - // if we can't expect notification, we're as done as we can be - _this7.emit("ready"); - } // in either case, reply to that capabilities request - - - _this7.capabilitiesFinished = true; - return _this7.transport.reply(request, { - capabilities: _this7.requestedCapabilities - }); - }); - } - }]); - - return WidgetApi; -}(_events.EventEmitter); - -exports.WidgetApi = WidgetApi;
\ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/driver/WidgetDriver.d.ts b/includes/external/matrix/node_modules/matrix-widget-api/lib/driver/WidgetDriver.d.ts deleted file mode 100644 index 7ab0cb3..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/driver/WidgetDriver.d.ts +++ /dev/null @@ -1,170 +0,0 @@ -import { Capability, IOpenIDCredentials, OpenIDRequestState, SimpleObservable, IRoomEvent, ITurnServer } from ".."; -export interface ISendEventDetails { - roomId: string; - eventId: string; -} -export interface IOpenIDUpdate { - state: OpenIDRequestState; - token?: IOpenIDCredentials; -} -export interface IReadEventRelationsResult { - chunk: IRoomEvent[]; - nextBatch?: string; - prevBatch?: string; -} -export interface ISearchUserDirectoryResult { - limited: boolean; - results: Array<{ - userId: string; - displayName?: string; - avatarUrl?: string; - }>; -} -/** - * Represents the functions and behaviour the widget-api is unable to - * do, such as prompting the user for information or interacting with - * the UI. Clients are expected to implement this class and override - * any functions they need/want to support. - * - * This class assumes the client will have a context of a Widget - * instance already. - */ -export declare abstract class WidgetDriver { - /** - * Verifies the widget's requested capabilities, returning the ones - * it is approved to use. Mutating the requested capabilities will - * have no effect. - * - * This SHOULD result in the user being prompted to approve/deny - * capabilities. - * - * By default this rejects all capabilities (returns an empty set). - * @param {Set<Capability>} requested The set of requested capabilities. - * @returns {Promise<Set<Capability>>} Resolves to the allowed capabilities. - */ - validateCapabilities(requested: Set<Capability>): Promise<Set<Capability>>; - /** - * Sends an event into a room. If `roomId` is falsy, the client should send the event - * into the room the user is currently looking at. The widget API will have already - * verified that the widget is capable of sending the event to that room. - * @param {string} eventType The event type to be sent. - * @param {*} content The content for the event. - * @param {string|null} stateKey The state key if this is a state event, otherwise null. - * May be an empty string. - * @param {string|null} roomId The room ID to send the event to. If falsy, the room the - * user is currently looking at. - * @returns {Promise<ISendEventDetails>} Resolves when the event has been sent with - * details of that event. - * @throws Rejected when the event could not be sent. - */ - sendEvent(eventType: string, content: unknown, stateKey?: string | null, roomId?: string | null): Promise<ISendEventDetails>; - /** - * Sends a to-device event. The widget API will have already verified that the widget - * is capable of sending the event. - * @param {string} eventType The event type to be sent. - * @param {boolean} encrypted Whether to encrypt the message contents. - * @param {Object} contentMap A map from user ID and device ID to event content. - * @returns {Promise<void>} Resolves when the event has been sent. - * @throws Rejected when the event could not be sent. - */ - sendToDevice(eventType: string, encrypted: boolean, contentMap: { - [userId: string]: { - [deviceId: string]: object; - }; - }): Promise<void>; - /** - * Reads all events of the given type, and optionally `msgtype` (if applicable/defined), - * the user has access to. The widget API will have already verified that the widget is - * capable of receiving the events. Less events than the limit are allowed to be returned, - * but not more. If `roomIds` is supplied, it may contain `Symbols.AnyRoom` to denote that - * `limit` in each of the client's known rooms should be returned. When `null`, only the - * room the user is currently looking at should be considered. - * @param eventType The event type to be read. - * @param msgtype The msgtype of the events to be read, if applicable/defined. - * @param limit The maximum number of events to retrieve per room. Will be zero to denote "as many - * as possible". - * @param roomIds When null, the user's currently viewed room. Otherwise, the list of room IDs - * to look within, possibly containing Symbols.AnyRoom to denote all known rooms. - * @returns {Promise<IRoomEvent[]>} Resolves to the room events, or an empty array. - */ - readRoomEvents(eventType: string, msgtype: string | undefined, limit: number, roomIds?: string[] | null): Promise<IRoomEvent[]>; - /** - * Reads all events of the given type, and optionally state key (if applicable/defined), - * the user has access to. The widget API will have already verified that the widget is - * capable of receiving the events. Less events than the limit are allowed to be returned, - * but not more. If `roomIds` is supplied, it may contain `Symbols.AnyRoom` to denote that - * `limit` in each of the client's known rooms should be returned. When `null`, only the - * room the user is currently looking at should be considered. - * @param eventType The event type to be read. - * @param stateKey The state key of the events to be read, if applicable/defined. - * @param limit The maximum number of events to retrieve. Will be zero to denote "as many - * as possible". - * @param roomIds When null, the user's currently viewed room. Otherwise, the list of room IDs - * to look within, possibly containing Symbols.AnyRoom to denote all known rooms. - * @returns {Promise<IRoomEvent[]>} Resolves to the state events, or an empty array. - */ - readStateEvents(eventType: string, stateKey: string | undefined, limit: number, roomIds?: string[] | null): Promise<IRoomEvent[]>; - /** - * Reads all events that are related to a given event. The widget API will - * have already verified that the widget is capable of receiving the event, - * or will make sure to reject access to events which are returned from this - * function, but are not capable of receiving. If `relationType` or `eventType` - * are set, the returned events should already be filtered. Less events than - * the limit are allowed to be returned, but not more. - * @param eventId The id of the parent event to be read. - * @param roomId The room to look within. When undefined, the user's - * currently viewed room. - * @param relationType The relationship type of child events to search for. - * When undefined, all relations are returned. - * @param eventType The event type of child events to search for. When undefined, - * all related events are returned. - * @param from The pagination token to start returning results from, as - * received from a previous call. If not supplied, results start at the most - * recent topological event known to the server. - * @param to The pagination token to stop returning results at. If not - * supplied, results continue up to limit or until there are no more events. - * @param limit The maximum number of events to retrieve per room. If not - * supplied, the server will apply a default limit. - * @param direction The direction to search for according to MSC3715 - * @returns Resolves to the room relations. - */ - readEventRelations(eventId: string, roomId?: string, relationType?: string, eventType?: string, from?: string, to?: string, limit?: number, direction?: 'f' | 'b'): Promise<IReadEventRelationsResult>; - /** - * Asks the user for permission to validate their identity through OpenID Connect. The - * interface for this function is an observable which accepts the state machine of the - * OIDC exchange flow. For example, if the client/user blocks the request then it would - * feed back a `{state: Blocked}` into the observable. Similarly, if the user already - * approved the widget then a `{state: Allowed}` would be fed into the observable alongside - * the token itself. If the client is asking for permission, it should feed in a - * `{state: PendingUserConfirmation}` followed by the relevant Allowed or Blocked state. - * - * The widget API will reject the widget's request with an error if this contract is not - * met properly. By default, the widget driver will block all OIDC requests. - * @param {SimpleObservable<IOpenIDUpdate>} observer The observable to feed updates into. - */ - askOpenID(observer: SimpleObservable<IOpenIDUpdate>): void; - /** - * Navigates the client with a matrix.to URI. In future this function will also be provided - * with the Matrix URIs once matrix.to is replaced. The given URI will have already been - * lightly checked to ensure it looks like a valid URI, though the implementation is recommended - * to do further checks on the URI. - * @param {string} uri The URI to navigate to. - * @returns {Promise<void>} Resolves when complete. - * @throws Throws if there's a problem with the navigation, such as invalid format. - */ - navigate(uri: string): Promise<void>; - /** - * Polls for TURN server data, yielding an initial set of credentials as soon as possible, and - * thereafter yielding new credentials whenever the previous ones expire. The widget API will - * have already verified that the widget has permission to access TURN servers. - * @yields {ITurnServer} The TURN server URIs and credentials currently available to the client. - */ - getTurnServers(): AsyncGenerator<ITurnServer>; - /** - * Search for users in the user directory. - * @param searchTerm The term to search for. - * @param limit The maximum number of results to return. If not supplied, the - * @returns Resolves to the search results. - */ - searchUserDirectory(searchTerm: string, limit?: number): Promise<ISearchUserDirectoryResult>; -} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/driver/WidgetDriver.js b/includes/external/matrix/node_modules/matrix-widget-api/lib/driver/WidgetDriver.js deleted file mode 100644 index 5a598b1..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/driver/WidgetDriver.js +++ /dev/null @@ -1,229 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.WidgetDriver = void 0; - -var _ = require(".."); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - -/** - * Represents the functions and behaviour the widget-api is unable to - * do, such as prompting the user for information or interacting with - * the UI. Clients are expected to implement this class and override - * any functions they need/want to support. - * - * This class assumes the client will have a context of a Widget - * instance already. - */ -var WidgetDriver = /*#__PURE__*/function () { - function WidgetDriver() { - _classCallCheck(this, WidgetDriver); - } - - _createClass(WidgetDriver, [{ - key: "validateCapabilities", - value: - /** - * Verifies the widget's requested capabilities, returning the ones - * it is approved to use. Mutating the requested capabilities will - * have no effect. - * - * This SHOULD result in the user being prompted to approve/deny - * capabilities. - * - * By default this rejects all capabilities (returns an empty set). - * @param {Set<Capability>} requested The set of requested capabilities. - * @returns {Promise<Set<Capability>>} Resolves to the allowed capabilities. - */ - function validateCapabilities(requested) { - return Promise.resolve(new Set()); - } - /** - * Sends an event into a room. If `roomId` is falsy, the client should send the event - * into the room the user is currently looking at. The widget API will have already - * verified that the widget is capable of sending the event to that room. - * @param {string} eventType The event type to be sent. - * @param {*} content The content for the event. - * @param {string|null} stateKey The state key if this is a state event, otherwise null. - * May be an empty string. - * @param {string|null} roomId The room ID to send the event to. If falsy, the room the - * user is currently looking at. - * @returns {Promise<ISendEventDetails>} Resolves when the event has been sent with - * details of that event. - * @throws Rejected when the event could not be sent. - */ - - }, { - key: "sendEvent", - value: function sendEvent(eventType, content) { - var stateKey = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; - var roomId = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; - return Promise.reject(new Error("Failed to override function")); - } - /** - * Sends a to-device event. The widget API will have already verified that the widget - * is capable of sending the event. - * @param {string} eventType The event type to be sent. - * @param {boolean} encrypted Whether to encrypt the message contents. - * @param {Object} contentMap A map from user ID and device ID to event content. - * @returns {Promise<void>} Resolves when the event has been sent. - * @throws Rejected when the event could not be sent. - */ - - }, { - key: "sendToDevice", - value: function sendToDevice(eventType, encrypted, contentMap) { - return Promise.reject(new Error("Failed to override function")); - } - /** - * Reads all events of the given type, and optionally `msgtype` (if applicable/defined), - * the user has access to. The widget API will have already verified that the widget is - * capable of receiving the events. Less events than the limit are allowed to be returned, - * but not more. If `roomIds` is supplied, it may contain `Symbols.AnyRoom` to denote that - * `limit` in each of the client's known rooms should be returned. When `null`, only the - * room the user is currently looking at should be considered. - * @param eventType The event type to be read. - * @param msgtype The msgtype of the events to be read, if applicable/defined. - * @param limit The maximum number of events to retrieve per room. Will be zero to denote "as many - * as possible". - * @param roomIds When null, the user's currently viewed room. Otherwise, the list of room IDs - * to look within, possibly containing Symbols.AnyRoom to denote all known rooms. - * @returns {Promise<IRoomEvent[]>} Resolves to the room events, or an empty array. - */ - - }, { - key: "readRoomEvents", - value: function readRoomEvents(eventType, msgtype, limit) { - var roomIds = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; - return Promise.resolve([]); - } - /** - * Reads all events of the given type, and optionally state key (if applicable/defined), - * the user has access to. The widget API will have already verified that the widget is - * capable of receiving the events. Less events than the limit are allowed to be returned, - * but not more. If `roomIds` is supplied, it may contain `Symbols.AnyRoom` to denote that - * `limit` in each of the client's known rooms should be returned. When `null`, only the - * room the user is currently looking at should be considered. - * @param eventType The event type to be read. - * @param stateKey The state key of the events to be read, if applicable/defined. - * @param limit The maximum number of events to retrieve. Will be zero to denote "as many - * as possible". - * @param roomIds When null, the user's currently viewed room. Otherwise, the list of room IDs - * to look within, possibly containing Symbols.AnyRoom to denote all known rooms. - * @returns {Promise<IRoomEvent[]>} Resolves to the state events, or an empty array. - */ - - }, { - key: "readStateEvents", - value: function readStateEvents(eventType, stateKey, limit) { - var roomIds = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; - return Promise.resolve([]); - } - /** - * Reads all events that are related to a given event. The widget API will - * have already verified that the widget is capable of receiving the event, - * or will make sure to reject access to events which are returned from this - * function, but are not capable of receiving. If `relationType` or `eventType` - * are set, the returned events should already be filtered. Less events than - * the limit are allowed to be returned, but not more. - * @param eventId The id of the parent event to be read. - * @param roomId The room to look within. When undefined, the user's - * currently viewed room. - * @param relationType The relationship type of child events to search for. - * When undefined, all relations are returned. - * @param eventType The event type of child events to search for. When undefined, - * all related events are returned. - * @param from The pagination token to start returning results from, as - * received from a previous call. If not supplied, results start at the most - * recent topological event known to the server. - * @param to The pagination token to stop returning results at. If not - * supplied, results continue up to limit or until there are no more events. - * @param limit The maximum number of events to retrieve per room. If not - * supplied, the server will apply a default limit. - * @param direction The direction to search for according to MSC3715 - * @returns Resolves to the room relations. - */ - - }, { - key: "readEventRelations", - value: function readEventRelations(eventId, roomId, relationType, eventType, from, to, limit, direction) { - return Promise.resolve({ - chunk: [] - }); - } - /** - * Asks the user for permission to validate their identity through OpenID Connect. The - * interface for this function is an observable which accepts the state machine of the - * OIDC exchange flow. For example, if the client/user blocks the request then it would - * feed back a `{state: Blocked}` into the observable. Similarly, if the user already - * approved the widget then a `{state: Allowed}` would be fed into the observable alongside - * the token itself. If the client is asking for permission, it should feed in a - * `{state: PendingUserConfirmation}` followed by the relevant Allowed or Blocked state. - * - * The widget API will reject the widget's request with an error if this contract is not - * met properly. By default, the widget driver will block all OIDC requests. - * @param {SimpleObservable<IOpenIDUpdate>} observer The observable to feed updates into. - */ - - }, { - key: "askOpenID", - value: function askOpenID(observer) { - observer.update({ - state: _.OpenIDRequestState.Blocked - }); - } - /** - * Navigates the client with a matrix.to URI. In future this function will also be provided - * with the Matrix URIs once matrix.to is replaced. The given URI will have already been - * lightly checked to ensure it looks like a valid URI, though the implementation is recommended - * to do further checks on the URI. - * @param {string} uri The URI to navigate to. - * @returns {Promise<void>} Resolves when complete. - * @throws Throws if there's a problem with the navigation, such as invalid format. - */ - - }, { - key: "navigate", - value: function navigate(uri) { - throw new Error("Navigation is not implemented"); - } - /** - * Polls for TURN server data, yielding an initial set of credentials as soon as possible, and - * thereafter yielding new credentials whenever the previous ones expire. The widget API will - * have already verified that the widget has permission to access TURN servers. - * @yields {ITurnServer} The TURN server URIs and credentials currently available to the client. - */ - - }, { - key: "getTurnServers", - value: function getTurnServers() { - throw new Error("TURN server support is not implemented"); - } - /** - * Search for users in the user directory. - * @param searchTerm The term to search for. - * @param limit The maximum number of results to return. If not supplied, the - * @returns Resolves to the search results. - */ - - }, { - key: "searchUserDirectory", - value: function searchUserDirectory(searchTerm, limit) { - return Promise.resolve({ - limited: false, - results: [] - }); - } - }]); - - return WidgetDriver; -}(); - -exports.WidgetDriver = WidgetDriver;
\ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/index.d.ts b/includes/external/matrix/node_modules/matrix-widget-api/lib/index.d.ts deleted file mode 100644 index f11c89d..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/index.d.ts +++ /dev/null @@ -1,46 +0,0 @@ -export * from "./WidgetApi"; -export * from "./ClientWidgetApi"; -export * from "./Symbols"; -export * from "./transport/ITransport"; -export * from "./transport/PostmessageTransport"; -export * from "./interfaces/ICustomWidgetData"; -export * from "./interfaces/IJitsiWidgetData"; -export * from "./interfaces/IStickerpickerWidgetData"; -export * from "./interfaces/IWidget"; -export * from "./interfaces/WidgetType"; -export * from "./interfaces/IWidgetApiErrorResponse"; -export * from "./interfaces/IWidgetApiRequest"; -export * from "./interfaces/IWidgetApiResponse"; -export * from "./interfaces/WidgetApiAction"; -export * from "./interfaces/WidgetApiDirection"; -export * from "./interfaces/ApiVersion"; -export * from "./interfaces/Capabilities"; -export * from "./interfaces/CapabilitiesAction"; -export * from "./interfaces/ContentLoadedAction"; -export * from "./interfaces/ScreenshotAction"; -export * from "./interfaces/StickerAction"; -export * from "./interfaces/StickyAction"; -export * from "./interfaces/SupportedVersionsAction"; -export * from "./interfaces/VisibilityAction"; -export * from "./interfaces/GetOpenIDAction"; -export * from "./interfaces/OpenIDCredentialsAction"; -export * from "./interfaces/WidgetKind"; -export * from "./interfaces/ModalButtonKind"; -export * from "./interfaces/ModalWidgetActions"; -export * from "./interfaces/SetModalButtonEnabledAction"; -export * from "./interfaces/WidgetConfigAction"; -export * from "./interfaces/SendEventAction"; -export * from "./interfaces/SendToDeviceAction"; -export * from "./interfaces/ReadEventAction"; -export * from "./interfaces/IRoomEvent"; -export * from "./interfaces/NavigateAction"; -export * from "./interfaces/TurnServerActions"; -export * from "./interfaces/ReadRelationsAction"; -export * from "./models/WidgetEventCapability"; -export * from "./models/validation/url"; -export * from "./models/validation/utils"; -export * from "./models/Widget"; -export * from "./models/WidgetParser"; -export * from "./templating/url-template"; -export * from "./util/SimpleObservable"; -export * from "./driver/WidgetDriver"; diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/index.js b/includes/external/matrix/node_modules/matrix-widget-api/lib/index.js deleted file mode 100644 index 15a7d2b..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/index.js +++ /dev/null @@ -1,603 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _WidgetApi = require("./WidgetApi"); - -Object.keys(_WidgetApi).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _WidgetApi[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function get() { - return _WidgetApi[key]; - } - }); -}); - -var _ClientWidgetApi = require("./ClientWidgetApi"); - -Object.keys(_ClientWidgetApi).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _ClientWidgetApi[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function get() { - return _ClientWidgetApi[key]; - } - }); -}); - -var _Symbols = require("./Symbols"); - -Object.keys(_Symbols).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _Symbols[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function get() { - return _Symbols[key]; - } - }); -}); - -var _ITransport = require("./transport/ITransport"); - -Object.keys(_ITransport).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _ITransport[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function get() { - return _ITransport[key]; - } - }); -}); - -var _PostmessageTransport = require("./transport/PostmessageTransport"); - -Object.keys(_PostmessageTransport).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _PostmessageTransport[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function get() { - return _PostmessageTransport[key]; - } - }); -}); - -var _ICustomWidgetData = require("./interfaces/ICustomWidgetData"); - -Object.keys(_ICustomWidgetData).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _ICustomWidgetData[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function get() { - return _ICustomWidgetData[key]; - } - }); -}); - -var _IJitsiWidgetData = require("./interfaces/IJitsiWidgetData"); - -Object.keys(_IJitsiWidgetData).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _IJitsiWidgetData[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function get() { - return _IJitsiWidgetData[key]; - } - }); -}); - -var _IStickerpickerWidgetData = require("./interfaces/IStickerpickerWidgetData"); - -Object.keys(_IStickerpickerWidgetData).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _IStickerpickerWidgetData[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function get() { - return _IStickerpickerWidgetData[key]; - } - }); -}); - -var _IWidget = require("./interfaces/IWidget"); - -Object.keys(_IWidget).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _IWidget[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function get() { - return _IWidget[key]; - } - }); -}); - -var _WidgetType = require("./interfaces/WidgetType"); - -Object.keys(_WidgetType).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _WidgetType[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function get() { - return _WidgetType[key]; - } - }); -}); - -var _IWidgetApiErrorResponse = require("./interfaces/IWidgetApiErrorResponse"); - -Object.keys(_IWidgetApiErrorResponse).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _IWidgetApiErrorResponse[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function get() { - return _IWidgetApiErrorResponse[key]; - } - }); -}); - -var _IWidgetApiRequest = require("./interfaces/IWidgetApiRequest"); - -Object.keys(_IWidgetApiRequest).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _IWidgetApiRequest[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function get() { - return _IWidgetApiRequest[key]; - } - }); -}); - -var _IWidgetApiResponse = require("./interfaces/IWidgetApiResponse"); - -Object.keys(_IWidgetApiResponse).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _IWidgetApiResponse[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function get() { - return _IWidgetApiResponse[key]; - } - }); -}); - -var _WidgetApiAction = require("./interfaces/WidgetApiAction"); - -Object.keys(_WidgetApiAction).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _WidgetApiAction[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function get() { - return _WidgetApiAction[key]; - } - }); -}); - -var _WidgetApiDirection = require("./interfaces/WidgetApiDirection"); - -Object.keys(_WidgetApiDirection).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _WidgetApiDirection[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function get() { - return _WidgetApiDirection[key]; - } - }); -}); - -var _ApiVersion = require("./interfaces/ApiVersion"); - -Object.keys(_ApiVersion).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _ApiVersion[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function get() { - return _ApiVersion[key]; - } - }); -}); - -var _Capabilities = require("./interfaces/Capabilities"); - -Object.keys(_Capabilities).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _Capabilities[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function get() { - return _Capabilities[key]; - } - }); -}); - -var _CapabilitiesAction = require("./interfaces/CapabilitiesAction"); - -Object.keys(_CapabilitiesAction).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _CapabilitiesAction[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function get() { - return _CapabilitiesAction[key]; - } - }); -}); - -var _ContentLoadedAction = require("./interfaces/ContentLoadedAction"); - -Object.keys(_ContentLoadedAction).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _ContentLoadedAction[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function get() { - return _ContentLoadedAction[key]; - } - }); -}); - -var _ScreenshotAction = require("./interfaces/ScreenshotAction"); - -Object.keys(_ScreenshotAction).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _ScreenshotAction[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function get() { - return _ScreenshotAction[key]; - } - }); -}); - -var _StickerAction = require("./interfaces/StickerAction"); - -Object.keys(_StickerAction).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _StickerAction[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function get() { - return _StickerAction[key]; - } - }); -}); - -var _StickyAction = require("./interfaces/StickyAction"); - -Object.keys(_StickyAction).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _StickyAction[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function get() { - return _StickyAction[key]; - } - }); -}); - -var _SupportedVersionsAction = require("./interfaces/SupportedVersionsAction"); - -Object.keys(_SupportedVersionsAction).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _SupportedVersionsAction[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function get() { - return _SupportedVersionsAction[key]; - } - }); -}); - -var _VisibilityAction = require("./interfaces/VisibilityAction"); - -Object.keys(_VisibilityAction).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _VisibilityAction[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function get() { - return _VisibilityAction[key]; - } - }); -}); - -var _GetOpenIDAction = require("./interfaces/GetOpenIDAction"); - -Object.keys(_GetOpenIDAction).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _GetOpenIDAction[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function get() { - return _GetOpenIDAction[key]; - } - }); -}); - -var _OpenIDCredentialsAction = require("./interfaces/OpenIDCredentialsAction"); - -Object.keys(_OpenIDCredentialsAction).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _OpenIDCredentialsAction[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function get() { - return _OpenIDCredentialsAction[key]; - } - }); -}); - -var _WidgetKind = require("./interfaces/WidgetKind"); - -Object.keys(_WidgetKind).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _WidgetKind[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function get() { - return _WidgetKind[key]; - } - }); -}); - -var _ModalButtonKind = require("./interfaces/ModalButtonKind"); - -Object.keys(_ModalButtonKind).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _ModalButtonKind[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function get() { - return _ModalButtonKind[key]; - } - }); -}); - -var _ModalWidgetActions = require("./interfaces/ModalWidgetActions"); - -Object.keys(_ModalWidgetActions).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _ModalWidgetActions[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function get() { - return _ModalWidgetActions[key]; - } - }); -}); - -var _SetModalButtonEnabledAction = require("./interfaces/SetModalButtonEnabledAction"); - -Object.keys(_SetModalButtonEnabledAction).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _SetModalButtonEnabledAction[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function get() { - return _SetModalButtonEnabledAction[key]; - } - }); -}); - -var _WidgetConfigAction = require("./interfaces/WidgetConfigAction"); - -Object.keys(_WidgetConfigAction).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _WidgetConfigAction[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function get() { - return _WidgetConfigAction[key]; - } - }); -}); - -var _SendEventAction = require("./interfaces/SendEventAction"); - -Object.keys(_SendEventAction).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _SendEventAction[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function get() { - return _SendEventAction[key]; - } - }); -}); - -var _SendToDeviceAction = require("./interfaces/SendToDeviceAction"); - -Object.keys(_SendToDeviceAction).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _SendToDeviceAction[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function get() { - return _SendToDeviceAction[key]; - } - }); -}); - -var _ReadEventAction = require("./interfaces/ReadEventAction"); - -Object.keys(_ReadEventAction).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _ReadEventAction[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function get() { - return _ReadEventAction[key]; - } - }); -}); - -var _IRoomEvent = require("./interfaces/IRoomEvent"); - -Object.keys(_IRoomEvent).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _IRoomEvent[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function get() { - return _IRoomEvent[key]; - } - }); -}); - -var _NavigateAction = require("./interfaces/NavigateAction"); - -Object.keys(_NavigateAction).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _NavigateAction[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function get() { - return _NavigateAction[key]; - } - }); -}); - -var _TurnServerActions = require("./interfaces/TurnServerActions"); - -Object.keys(_TurnServerActions).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _TurnServerActions[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function get() { - return _TurnServerActions[key]; - } - }); -}); - -var _ReadRelationsAction = require("./interfaces/ReadRelationsAction"); - -Object.keys(_ReadRelationsAction).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _ReadRelationsAction[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function get() { - return _ReadRelationsAction[key]; - } - }); -}); - -var _WidgetEventCapability = require("./models/WidgetEventCapability"); - -Object.keys(_WidgetEventCapability).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _WidgetEventCapability[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function get() { - return _WidgetEventCapability[key]; - } - }); -}); - -var _url = require("./models/validation/url"); - -Object.keys(_url).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _url[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function get() { - return _url[key]; - } - }); -}); - -var _utils = require("./models/validation/utils"); - -Object.keys(_utils).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _utils[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function get() { - return _utils[key]; - } - }); -}); - -var _Widget = require("./models/Widget"); - -Object.keys(_Widget).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _Widget[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function get() { - return _Widget[key]; - } - }); -}); - -var _WidgetParser = require("./models/WidgetParser"); - -Object.keys(_WidgetParser).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _WidgetParser[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function get() { - return _WidgetParser[key]; - } - }); -}); - -var _urlTemplate = require("./templating/url-template"); - -Object.keys(_urlTemplate).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _urlTemplate[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function get() { - return _urlTemplate[key]; - } - }); -}); - -var _SimpleObservable = require("./util/SimpleObservable"); - -Object.keys(_SimpleObservable).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _SimpleObservable[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function get() { - return _SimpleObservable[key]; - } - }); -}); - -var _WidgetDriver = require("./driver/WidgetDriver"); - -Object.keys(_WidgetDriver).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - if (key in exports && exports[key] === _WidgetDriver[key]) return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function get() { - return _WidgetDriver[key]; - } - }); -});
\ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/ApiVersion.d.ts b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/ApiVersion.d.ts deleted file mode 100644 index 1234c5b..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/ApiVersion.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -export declare enum MatrixApiVersion { - Prerelease1 = "0.0.1", - Prerelease2 = "0.0.2" -} -export declare enum UnstableApiVersion { - MSC2762 = "org.matrix.msc2762", - MSC2871 = "org.matrix.msc2871", - MSC2931 = "org.matrix.msc2931", - MSC2974 = "org.matrix.msc2974", - MSC2876 = "org.matrix.msc2876", - MSC3819 = "org.matrix.msc3819", - MSC3846 = "town.robin.msc3846", - MSC3869 = "org.matrix.msc3869", - MSC3973 = "org.matrix.msc3973" -} -export declare type ApiVersion = MatrixApiVersion | UnstableApiVersion | string; -export declare const CurrentApiVersions: ApiVersion[]; diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/ApiVersion.js b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/ApiVersion.js deleted file mode 100644 index 2454c0a..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/ApiVersion.js +++ /dev/null @@ -1,48 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.UnstableApiVersion = exports.MatrixApiVersion = exports.CurrentApiVersions = void 0; - -/* - * Copyright 2020 The Matrix.org Foundation C.I.C. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -var MatrixApiVersion; -exports.MatrixApiVersion = MatrixApiVersion; - -(function (MatrixApiVersion) { - MatrixApiVersion["Prerelease1"] = "0.0.1"; - MatrixApiVersion["Prerelease2"] = "0.0.2"; -})(MatrixApiVersion || (exports.MatrixApiVersion = MatrixApiVersion = {})); - -var UnstableApiVersion; -exports.UnstableApiVersion = UnstableApiVersion; - -(function (UnstableApiVersion) { - UnstableApiVersion["MSC2762"] = "org.matrix.msc2762"; - UnstableApiVersion["MSC2871"] = "org.matrix.msc2871"; - UnstableApiVersion["MSC2931"] = "org.matrix.msc2931"; - UnstableApiVersion["MSC2974"] = "org.matrix.msc2974"; - UnstableApiVersion["MSC2876"] = "org.matrix.msc2876"; - UnstableApiVersion["MSC3819"] = "org.matrix.msc3819"; - UnstableApiVersion["MSC3846"] = "town.robin.msc3846"; - UnstableApiVersion["MSC3869"] = "org.matrix.msc3869"; - UnstableApiVersion["MSC3973"] = "org.matrix.msc3973"; -})(UnstableApiVersion || (exports.UnstableApiVersion = UnstableApiVersion = {})); - -var CurrentApiVersions = [MatrixApiVersion.Prerelease1, MatrixApiVersion.Prerelease2, //MatrixApiVersion.V010, -UnstableApiVersion.MSC2762, UnstableApiVersion.MSC2871, UnstableApiVersion.MSC2931, UnstableApiVersion.MSC2974, UnstableApiVersion.MSC2876, UnstableApiVersion.MSC3819, UnstableApiVersion.MSC3846, UnstableApiVersion.MSC3869, UnstableApiVersion.MSC3973]; -exports.CurrentApiVersions = CurrentApiVersions;
\ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/Capabilities.d.ts b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/Capabilities.d.ts deleted file mode 100644 index 941e359..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/Capabilities.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { Symbols } from "../Symbols"; -export declare enum MatrixCapabilities { - Screenshots = "m.capability.screenshot", - StickerSending = "m.sticker", - AlwaysOnScreen = "m.always_on_screen", - /** - * @deprecated It is not recommended to rely on this existing - it can be removed without notice. - * Ask Element to not give the option to move the widget into a separate tab. - */ - RequiresClient = "io.element.requires_client", - /** - * @deprecated It is not recommended to rely on this existing - it can be removed without notice. - */ - MSC2931Navigate = "org.matrix.msc2931.navigate", - MSC3846TurnServers = "town.robin.msc3846.turn_servers", - /** - * @deprecated It is not recommended to rely on this existing - it can be removed without notice. - */ - MSC3973UserDirectorySearch = "org.matrix.msc3973.user_directory_search" -} -export declare type Capability = MatrixCapabilities | string; -export declare const StickerpickerCapabilities: Capability[]; -export declare const VideoConferenceCapabilities: Capability[]; -/** - * Determines if a capability is a capability for a timeline. - * @param {Capability} capability The capability to test. - * @returns {boolean} True if a timeline capability, false otherwise. - */ -export declare function isTimelineCapability(capability: Capability): boolean; -/** - * Determines if a capability is a timeline capability for the given room. - * @param {Capability} capability The capability to test. - * @param {string | Symbols.AnyRoom} roomId The room ID, or `Symbols.AnyRoom` for that designation. - * @returns {boolean} True if a matching capability, false otherwise. - */ -export declare function isTimelineCapabilityFor(capability: Capability, roomId: string | Symbols.AnyRoom): boolean; -/** - * Gets the room ID described by a timeline capability. - * @param {string} capability The capability to parse. - * @returns {string} The room ID. - */ -export declare function getTimelineRoomIDFromCapability(capability: Capability): string; diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/Capabilities.js b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/Capabilities.js deleted file mode 100644 index 110b91a..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/Capabilities.js +++ /dev/null @@ -1,74 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.VideoConferenceCapabilities = exports.StickerpickerCapabilities = exports.MatrixCapabilities = void 0; -exports.getTimelineRoomIDFromCapability = getTimelineRoomIDFromCapability; -exports.isTimelineCapability = isTimelineCapability; -exports.isTimelineCapabilityFor = isTimelineCapabilityFor; - -/* - * Copyright 2020 - 2021 The Matrix.org Foundation C.I.C. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -var MatrixCapabilities; -exports.MatrixCapabilities = MatrixCapabilities; - -(function (MatrixCapabilities) { - MatrixCapabilities["Screenshots"] = "m.capability.screenshot"; - MatrixCapabilities["StickerSending"] = "m.sticker"; - MatrixCapabilities["AlwaysOnScreen"] = "m.always_on_screen"; - MatrixCapabilities["RequiresClient"] = "io.element.requires_client"; - MatrixCapabilities["MSC2931Navigate"] = "org.matrix.msc2931.navigate"; - MatrixCapabilities["MSC3846TurnServers"] = "town.robin.msc3846.turn_servers"; - MatrixCapabilities["MSC3973UserDirectorySearch"] = "org.matrix.msc3973.user_directory_search"; -})(MatrixCapabilities || (exports.MatrixCapabilities = MatrixCapabilities = {})); - -var StickerpickerCapabilities = [MatrixCapabilities.StickerSending]; -exports.StickerpickerCapabilities = StickerpickerCapabilities; -var VideoConferenceCapabilities = [MatrixCapabilities.AlwaysOnScreen]; -/** - * Determines if a capability is a capability for a timeline. - * @param {Capability} capability The capability to test. - * @returns {boolean} True if a timeline capability, false otherwise. - */ - -exports.VideoConferenceCapabilities = VideoConferenceCapabilities; - -function isTimelineCapability(capability) { - // TODO: Change when MSC2762 becomes stable. - return capability === null || capability === void 0 ? void 0 : capability.startsWith("org.matrix.msc2762.timeline:"); -} -/** - * Determines if a capability is a timeline capability for the given room. - * @param {Capability} capability The capability to test. - * @param {string | Symbols.AnyRoom} roomId The room ID, or `Symbols.AnyRoom` for that designation. - * @returns {boolean} True if a matching capability, false otherwise. - */ - - -function isTimelineCapabilityFor(capability, roomId) { - return capability === "org.matrix.msc2762.timeline:".concat(roomId); -} -/** - * Gets the room ID described by a timeline capability. - * @param {string} capability The capability to parse. - * @returns {string} The room ID. - */ - - -function getTimelineRoomIDFromCapability(capability) { - return capability.substring(capability.indexOf(":") + 1); -}
\ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/CapabilitiesAction.d.ts b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/CapabilitiesAction.d.ts deleted file mode 100644 index c8fb957..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/CapabilitiesAction.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { IWidgetApiRequest, IWidgetApiRequestData, IWidgetApiRequestEmptyData } from "./IWidgetApiRequest"; -import { WidgetApiFromWidgetAction, WidgetApiToWidgetAction } from "./WidgetApiAction"; -import { Capability } from "./Capabilities"; -import { IWidgetApiAcknowledgeResponseData, IWidgetApiResponseData } from "./IWidgetApiResponse"; -export interface ICapabilitiesActionRequest extends IWidgetApiRequest { - action: WidgetApiToWidgetAction.Capabilities; - data: IWidgetApiRequestEmptyData; -} -export interface ICapabilitiesActionResponseData extends IWidgetApiResponseData { - capabilities: Capability[]; -} -export interface ICapabilitiesActionResponse extends ICapabilitiesActionRequest { - response: ICapabilitiesActionResponseData; -} -export interface INotifyCapabilitiesActionRequestData extends IWidgetApiRequestData { - requested: Capability[]; - approved: Capability[]; -} -export interface INotifyCapabilitiesActionRequest extends IWidgetApiRequest { - action: WidgetApiToWidgetAction.NotifyCapabilities; - data: INotifyCapabilitiesActionRequestData; -} -export interface INotifyCapabilitiesActionResponse extends INotifyCapabilitiesActionRequest { - response: IWidgetApiAcknowledgeResponseData; -} -export interface IRenegotiateCapabilitiesActionRequest extends IWidgetApiRequest { - action: WidgetApiFromWidgetAction.MSC2974RenegotiateCapabilities; - data: IRenegotiateCapabilitiesRequestData; -} -export interface IRenegotiateCapabilitiesRequestData extends IWidgetApiResponseData { - capabilities: Capability[]; -} -export interface IRenegotiateCapabilitiesActionResponse extends IRenegotiateCapabilitiesActionRequest { -} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/CapabilitiesAction.js b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/CapabilitiesAction.js deleted file mode 100644 index 430afc1..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/CapabilitiesAction.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -});
\ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/ContentLoadedAction.d.ts b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/ContentLoadedAction.d.ts deleted file mode 100644 index 65a768c..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/ContentLoadedAction.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { IWidgetApiRequest, IWidgetApiRequestEmptyData } from "./IWidgetApiRequest"; -import { WidgetApiFromWidgetAction } from "./WidgetApiAction"; -import { IWidgetApiAcknowledgeResponseData } from "./IWidgetApiResponse"; -export interface IContentLoadedActionRequest extends IWidgetApiRequest { - action: WidgetApiFromWidgetAction.ContentLoaded; - data: IWidgetApiRequestEmptyData; -} -export interface IContentLoadedActionResponse extends IContentLoadedActionRequest { - response: IWidgetApiAcknowledgeResponseData; -} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/ContentLoadedAction.js b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/ContentLoadedAction.js deleted file mode 100644 index 430afc1..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/ContentLoadedAction.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -});
\ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/GetOpenIDAction.d.ts b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/GetOpenIDAction.d.ts deleted file mode 100644 index 0b090f9..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/GetOpenIDAction.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { IWidgetApiRequest, IWidgetApiRequestData } from "./IWidgetApiRequest"; -import { WidgetApiFromWidgetAction } from "./WidgetApiAction"; -import { IWidgetApiResponseData } from "./IWidgetApiResponse"; -export declare enum OpenIDRequestState { - Allowed = "allowed", - Blocked = "blocked", - PendingUserConfirmation = "request" -} -export interface IOpenIDCredentials { - access_token?: string; - expires_in?: number; - matrix_server_name?: string; - token_type?: "Bearer" | string; -} -export interface IGetOpenIDActionRequestData extends IWidgetApiRequestData { -} -export interface IGetOpenIDActionRequest extends IWidgetApiRequest { - action: WidgetApiFromWidgetAction.GetOpenIDCredentials; - data: IGetOpenIDActionRequestData; -} -export interface IGetOpenIDActionResponseData extends IWidgetApiResponseData, IOpenIDCredentials { - state: OpenIDRequestState; -} -export interface IGetOpenIDActionResponse extends IGetOpenIDActionRequest { - response: IGetOpenIDActionResponseData; -} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/GetOpenIDAction.js b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/GetOpenIDAction.js deleted file mode 100644 index 4a38dfa..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/GetOpenIDAction.js +++ /dev/null @@ -1,30 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.OpenIDRequestState = void 0; - -/* - * Copyright 2020 The Matrix.org Foundation C.I.C. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -var OpenIDRequestState; -exports.OpenIDRequestState = OpenIDRequestState; - -(function (OpenIDRequestState) { - OpenIDRequestState["Allowed"] = "allowed"; - OpenIDRequestState["Blocked"] = "blocked"; - OpenIDRequestState["PendingUserConfirmation"] = "request"; -})(OpenIDRequestState || (exports.OpenIDRequestState = OpenIDRequestState = {}));
\ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/ICustomWidgetData.d.ts b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/ICustomWidgetData.d.ts deleted file mode 100644 index 862ab54..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/ICustomWidgetData.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { IWidgetData } from "./IWidget"; -/** - * Widget data for m.custom specifically. - */ -export interface ICustomWidgetData extends IWidgetData { - /** - * The URL for the widget if the templated URL is not exactly what will be loaded. - */ - url?: string; -} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/ICustomWidgetData.js b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/ICustomWidgetData.js deleted file mode 100644 index 430afc1..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/ICustomWidgetData.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -});
\ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/IJitsiWidgetData.d.ts b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/IJitsiWidgetData.d.ts deleted file mode 100644 index 695b322..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/IJitsiWidgetData.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { IWidgetData } from "./IWidget"; -/** - * Widget data for m.jitsi widgets. - */ -export interface IJitsiWidgetData extends IWidgetData { - /** - * The domain where the Jitsi Meet conference is being held. - */ - domain: string; - /** - * The conference ID (also known as the room name) where the conference is being held. - */ - conferenceId: string; - /** - * Optional. True to indicate that the conference should be without video, false - * otherwise (default). - */ - isAudioOnly?: boolean; -} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/IJitsiWidgetData.js b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/IJitsiWidgetData.js deleted file mode 100644 index 430afc1..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/IJitsiWidgetData.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -});
\ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/IRoomEvent.d.ts b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/IRoomEvent.d.ts deleted file mode 100644 index 15b258c..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/IRoomEvent.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -export interface IRoomEvent { - type: string; - sender: string; - event_id: string; - room_id: string; - state_key?: string; - origin_server_ts: number; - content: unknown; - unsigned: unknown; -} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/IRoomEvent.js b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/IRoomEvent.js deleted file mode 100644 index 430afc1..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/IRoomEvent.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -});
\ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/IStickerpickerWidgetData.d.ts b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/IStickerpickerWidgetData.d.ts deleted file mode 100644 index 5188bab..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/IStickerpickerWidgetData.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { IWidgetData } from "./IWidget"; -export interface IStickerpickerWidgetData extends IWidgetData { -} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/IStickerpickerWidgetData.js b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/IStickerpickerWidgetData.js deleted file mode 100644 index 430afc1..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/IStickerpickerWidgetData.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -});
\ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/IWidget.d.ts b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/IWidget.d.ts deleted file mode 100644 index fbc3d90..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/IWidget.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { WidgetType } from "./WidgetType"; -/** - * Widget data. - */ -export interface IWidgetData { - /** - * Optional title for the widget. - */ - title?: string; - /** - * Custom keys for inclusion in the template URL. - */ - [key: string]: unknown; -} -/** - * Common properties of a widget. - * https://matrix.org/docs/spec/widgets/latest#widgetcommonproperties-schema - */ -export interface IWidget { - /** - * The ID of the widget. - */ - id: string; - /** - * The user ID who originally created the widget. - */ - creatorUserId: string; - /** - * Optional name for the widget. - */ - name?: string; - /** - * The type of widget. - */ - type: WidgetType; - /** - * The URL for the widget, with template variables. - */ - url: string; - /** - * Optional flag to indicate whether or not the client should initiate communication - * right after the iframe loads (default, true) or when the widget indicates it is - * ready (false). - */ - waitForIframeLoad?: boolean; - /** - * Data for the widget. - */ - data?: IWidgetData; -} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/IWidget.js b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/IWidget.js deleted file mode 100644 index 430afc1..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/IWidget.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -});
\ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/IWidgetApiErrorResponse.d.ts b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/IWidgetApiErrorResponse.d.ts deleted file mode 100644 index af8105f..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/IWidgetApiErrorResponse.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { IWidgetApiResponse, IWidgetApiResponseData } from "./IWidgetApiResponse"; -export interface IWidgetApiErrorResponseData extends IWidgetApiResponseData { - error: { - message: string; - }; -} -export interface IWidgetApiErrorResponse extends IWidgetApiResponse { - response: IWidgetApiErrorResponseData; -} -export declare function isErrorResponse(responseData: IWidgetApiResponseData): boolean; diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/IWidgetApiErrorResponse.js b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/IWidgetApiErrorResponse.js deleted file mode 100644 index e20ea22..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/IWidgetApiErrorResponse.js +++ /dev/null @@ -1,30 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.isErrorResponse = isErrorResponse; - -/* - * Copyright 2020 The Matrix.org Foundation C.I.C. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -function isErrorResponse(responseData) { - if ("error" in responseData) { - var err = responseData; - return !!err.error.message; - } - - return false; -}
\ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/IWidgetApiRequest.d.ts b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/IWidgetApiRequest.d.ts deleted file mode 100644 index 1e43391..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/IWidgetApiRequest.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { WidgetApiDirection } from "./WidgetApiDirection"; -import { WidgetApiAction } from "./WidgetApiAction"; -export interface IWidgetApiRequestData { - [key: string]: unknown; -} -export interface IWidgetApiRequestEmptyData extends IWidgetApiRequestData { -} -export interface IWidgetApiRequest { - api: WidgetApiDirection; - requestId: string; - action: WidgetApiAction; - widgetId: string; - data: IWidgetApiRequestData; - visible?: any; -} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/IWidgetApiRequest.js b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/IWidgetApiRequest.js deleted file mode 100644 index 430afc1..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/IWidgetApiRequest.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -});
\ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/IWidgetApiResponse.d.ts b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/IWidgetApiResponse.d.ts deleted file mode 100644 index df28eac..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/IWidgetApiResponse.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { IWidgetApiRequest } from "./IWidgetApiRequest"; -export interface IWidgetApiResponseData { - [key: string]: unknown; -} -export interface IWidgetApiAcknowledgeResponseData extends IWidgetApiResponseData { -} -export interface IWidgetApiResponse extends IWidgetApiRequest { - response: IWidgetApiResponseData; -} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/IWidgetApiResponse.js b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/IWidgetApiResponse.js deleted file mode 100644 index 430afc1..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/IWidgetApiResponse.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -});
\ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/ModalButtonKind.d.ts b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/ModalButtonKind.d.ts deleted file mode 100644 index 71c9feb..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/ModalButtonKind.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -export declare enum ModalButtonKind { - Primary = "m.primary", - Secondary = "m.secondary", - Warning = "m.warning", - Danger = "m.danger", - Link = "m.link" -} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/ModalButtonKind.js b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/ModalButtonKind.js deleted file mode 100644 index 25d3b66..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/ModalButtonKind.js +++ /dev/null @@ -1,32 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.ModalButtonKind = void 0; - -/* - * Copyright 2020 The Matrix.org Foundation C.I.C. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -var ModalButtonKind; -exports.ModalButtonKind = ModalButtonKind; - -(function (ModalButtonKind) { - ModalButtonKind["Primary"] = "m.primary"; - ModalButtonKind["Secondary"] = "m.secondary"; - ModalButtonKind["Warning"] = "m.warning"; - ModalButtonKind["Danger"] = "m.danger"; - ModalButtonKind["Link"] = "m.link"; -})(ModalButtonKind || (exports.ModalButtonKind = ModalButtonKind = {}));
\ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/ModalWidgetActions.d.ts b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/ModalWidgetActions.d.ts deleted file mode 100644 index 52089b8..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/ModalWidgetActions.d.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { IWidgetApiRequest, IWidgetApiRequestData } from "./IWidgetApiRequest"; -import { WidgetApiFromWidgetAction, WidgetApiToWidgetAction } from "./WidgetApiAction"; -import { IWidgetApiAcknowledgeResponseData, IWidgetApiResponse } from "./IWidgetApiResponse"; -import { IWidget } from "./IWidget"; -import { ModalButtonKind } from "./ModalButtonKind"; -export declare enum BuiltInModalButtonID { - Close = "m.close" -} -export declare type ModalButtonID = BuiltInModalButtonID | string; -export interface IModalWidgetCreateData extends IWidgetApiRequestData { - [key: string]: unknown; -} -export interface IModalWidgetReturnData { - [key: string]: unknown; -} -export interface IModalWidgetOpenRequestDataButton { - id: ModalButtonID; - label: string; - kind: ModalButtonKind | string; - disabled?: boolean; -} -export interface IModalWidgetOpenRequestData extends IModalWidgetCreateData, Omit<IWidget, "id" | "creatorUserId"> { - buttons?: IModalWidgetOpenRequestDataButton[]; -} -export interface IModalWidgetOpenRequest extends IWidgetApiRequest { - action: WidgetApiFromWidgetAction.OpenModalWidget; - data: IModalWidgetOpenRequestData; -} -export interface IModalWidgetOpenResponse extends IWidgetApiResponse { - response: IWidgetApiAcknowledgeResponseData; -} -export interface IModalWidgetButtonClickedRequestData extends IWidgetApiRequestData { - id: IModalWidgetOpenRequestDataButton["id"]; -} -export interface IModalWidgetButtonClickedRequest extends IWidgetApiRequest { - action: WidgetApiToWidgetAction.ButtonClicked; - data: IModalWidgetButtonClickedRequestData; -} -export interface IModalWidgetButtonClickedResponse extends IWidgetApiResponse { - response: IWidgetApiAcknowledgeResponseData; -} -export interface IModalWidgetCloseRequest extends IWidgetApiRequest { - action: WidgetApiFromWidgetAction.CloseModalWidget; - data: IModalWidgetReturnData; -} -export interface IModalWidgetCloseResponse extends IWidgetApiResponse { - response: IWidgetApiAcknowledgeResponseData; -} -export interface IModalWidgetCloseNotificationRequest extends IWidgetApiRequest { - action: WidgetApiToWidgetAction.CloseModalWidget; - data: IModalWidgetReturnData; -} -export interface IModalWidgetCloseNotificationResponse extends IWidgetApiResponse { - response: IWidgetApiAcknowledgeResponseData; -} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/ModalWidgetActions.js b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/ModalWidgetActions.js deleted file mode 100644 index 39dc434..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/ModalWidgetActions.js +++ /dev/null @@ -1,28 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.BuiltInModalButtonID = void 0; - -/* - * Copyright 2020 The Matrix.org Foundation C.I.C. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -var BuiltInModalButtonID; -exports.BuiltInModalButtonID = BuiltInModalButtonID; - -(function (BuiltInModalButtonID) { - BuiltInModalButtonID["Close"] = "m.close"; -})(BuiltInModalButtonID || (exports.BuiltInModalButtonID = BuiltInModalButtonID = {}));
\ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/NavigateAction.d.ts b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/NavigateAction.d.ts deleted file mode 100644 index a0447dd..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/NavigateAction.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { IWidgetApiRequest, IWidgetApiRequestData } from "./IWidgetApiRequest"; -import { WidgetApiFromWidgetAction } from "./WidgetApiAction"; -import { IWidgetApiAcknowledgeResponseData } from "./IWidgetApiResponse"; -export interface INavigateActionRequest extends IWidgetApiRequest { - action: WidgetApiFromWidgetAction.MSC2931Navigate; - data: INavigateActionRequestData; -} -export interface INavigateActionRequestData extends IWidgetApiRequestData { - uri: string; -} -export interface INavigateActionResponse extends INavigateActionRequest { - response: IWidgetApiAcknowledgeResponseData; -} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/NavigateAction.js b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/NavigateAction.js deleted file mode 100644 index 430afc1..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/NavigateAction.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -});
\ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/OpenIDCredentialsAction.d.ts b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/OpenIDCredentialsAction.d.ts deleted file mode 100644 index 7cd0410..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/OpenIDCredentialsAction.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { IWidgetApiRequest, IWidgetApiRequestData } from "./IWidgetApiRequest"; -import { WidgetApiToWidgetAction } from "./WidgetApiAction"; -import { IWidgetApiResponseData } from "./IWidgetApiResponse"; -import { IOpenIDCredentials, OpenIDRequestState } from "./GetOpenIDAction"; -export interface IOpenIDCredentialsActionRequestData extends IWidgetApiRequestData, IOpenIDCredentials { - state: OpenIDRequestState; - original_request_id: string; -} -export interface IOpenIDCredentialsActionRequest extends IWidgetApiRequest { - action: WidgetApiToWidgetAction.OpenIDCredentials; - data: IOpenIDCredentialsActionRequestData; -} -export interface IOpenIDCredentialsActionResponseData extends IWidgetApiResponseData { -} -export interface IOpenIDCredentialsIDActionResponse extends IOpenIDCredentialsActionRequest { - response: IOpenIDCredentialsActionResponseData; -} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/OpenIDCredentialsAction.js b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/OpenIDCredentialsAction.js deleted file mode 100644 index 430afc1..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/OpenIDCredentialsAction.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -});
\ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/ReadEventAction.d.ts b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/ReadEventAction.d.ts deleted file mode 100644 index 807f9be..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/ReadEventAction.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { IWidgetApiRequest, IWidgetApiRequestData } from "./IWidgetApiRequest"; -import { WidgetApiFromWidgetAction } from "./WidgetApiAction"; -import { IWidgetApiResponseData } from "./IWidgetApiResponse"; -import { IRoomEvent } from "./IRoomEvent"; -import { Symbols } from "../Symbols"; -export interface IReadEventFromWidgetRequestData extends IWidgetApiRequestData { - state_key?: string | boolean; - msgtype?: string; - type: string; - limit?: number; - room_ids?: Symbols.AnyRoom | string[]; -} -export interface IReadEventFromWidgetActionRequest extends IWidgetApiRequest { - action: WidgetApiFromWidgetAction.MSC2876ReadEvents; - data: IReadEventFromWidgetRequestData; -} -export interface IReadEventFromWidgetResponseData extends IWidgetApiResponseData { - events: IRoomEvent[]; -} -export interface IReadEventFromWidgetActionResponse extends IReadEventFromWidgetActionRequest { - response: IReadEventFromWidgetResponseData; -} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/ReadEventAction.js b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/ReadEventAction.js deleted file mode 100644 index 430afc1..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/ReadEventAction.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -});
\ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/ReadRelationsAction.d.ts b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/ReadRelationsAction.d.ts deleted file mode 100644 index 0d15dfe..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/ReadRelationsAction.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { IRoomEvent } from "./IRoomEvent"; -import { IWidgetApiRequest, IWidgetApiRequestData } from "./IWidgetApiRequest"; -import { IWidgetApiResponseData } from "./IWidgetApiResponse"; -import { WidgetApiFromWidgetAction } from "./WidgetApiAction"; -export interface IReadRelationsFromWidgetRequestData extends IWidgetApiRequestData { - event_id: string; - rel_type?: string; - event_type?: string; - room_id?: string; - limit?: number; - from?: string; - to?: string; - direction?: 'f' | 'b'; -} -export interface IReadRelationsFromWidgetActionRequest extends IWidgetApiRequest { - action: WidgetApiFromWidgetAction.MSC3869ReadRelations; - data: IReadRelationsFromWidgetRequestData; -} -export interface IReadRelationsFromWidgetResponseData extends IWidgetApiResponseData { - chunk: IRoomEvent[]; - next_batch?: string; - prev_batch?: string; -} -export interface IReadRelationsFromWidgetActionResponse extends IReadRelationsFromWidgetActionRequest { - response: IReadRelationsFromWidgetResponseData; -} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/ReadRelationsAction.js b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/ReadRelationsAction.js deleted file mode 100644 index 430afc1..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/ReadRelationsAction.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -});
\ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/ScreenshotAction.d.ts b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/ScreenshotAction.d.ts deleted file mode 100644 index 7f0f62a..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/ScreenshotAction.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { IWidgetApiRequest, IWidgetApiRequestEmptyData } from "./IWidgetApiRequest"; -import { WidgetApiToWidgetAction } from "./WidgetApiAction"; -import { IWidgetApiResponseData } from "./IWidgetApiResponse"; -export interface IScreenshotActionRequest extends IWidgetApiRequest { - action: WidgetApiToWidgetAction.TakeScreenshot; - data: IWidgetApiRequestEmptyData; -} -export interface IScreenshotActionResponseData extends IWidgetApiResponseData { - screenshot: Blob; -} -export interface IScreenshotActionResponse extends IScreenshotActionRequest { - response: IScreenshotActionResponseData; -} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/ScreenshotAction.js b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/ScreenshotAction.js deleted file mode 100644 index 430afc1..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/ScreenshotAction.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -});
\ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/SendEventAction.d.ts b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/SendEventAction.d.ts deleted file mode 100644 index cb27110..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/SendEventAction.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { IWidgetApiRequest, IWidgetApiRequestData } from "./IWidgetApiRequest"; -import { WidgetApiFromWidgetAction, WidgetApiToWidgetAction } from "./WidgetApiAction"; -import { IWidgetApiResponseData } from "./IWidgetApiResponse"; -import { IRoomEvent } from "./IRoomEvent"; -export interface ISendEventFromWidgetRequestData extends IWidgetApiRequestData { - state_key?: string; - type: string; - content: unknown; - room_id?: string; -} -export interface ISendEventFromWidgetActionRequest extends IWidgetApiRequest { - action: WidgetApiFromWidgetAction.SendEvent; - data: ISendEventFromWidgetRequestData; -} -export interface ISendEventFromWidgetResponseData extends IWidgetApiResponseData { - room_id: string; - event_id: string; -} -export interface ISendEventFromWidgetActionResponse extends ISendEventFromWidgetActionRequest { - response: ISendEventFromWidgetResponseData; -} -export interface ISendEventToWidgetRequestData extends IWidgetApiRequestData, IRoomEvent { -} -export interface ISendEventToWidgetActionRequest extends IWidgetApiRequest { - action: WidgetApiToWidgetAction.SendEvent; - data: ISendEventToWidgetRequestData; -} -export interface ISendEventToWidgetResponseData extends IWidgetApiResponseData { -} -export interface ISendEventToWidgetActionResponse extends ISendEventToWidgetActionRequest { - response: ISendEventToWidgetResponseData; -} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/SendEventAction.js b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/SendEventAction.js deleted file mode 100644 index 430afc1..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/SendEventAction.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -});
\ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/SendToDeviceAction.d.ts b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/SendToDeviceAction.d.ts deleted file mode 100644 index f9e3841..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/SendToDeviceAction.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { IWidgetApiRequest, IWidgetApiRequestData } from "./IWidgetApiRequest"; -import { WidgetApiFromWidgetAction, WidgetApiToWidgetAction } from "./WidgetApiAction"; -import { IWidgetApiResponseData } from "./IWidgetApiResponse"; -import { IRoomEvent } from "./IRoomEvent"; -export interface ISendToDeviceFromWidgetRequestData extends IWidgetApiRequestData { - type: string; - encrypted: boolean; - messages: { - [userId: string]: { - [deviceId: string]: object; - }; - }; -} -export interface ISendToDeviceFromWidgetActionRequest extends IWidgetApiRequest { - action: WidgetApiFromWidgetAction.SendToDevice; - data: ISendToDeviceFromWidgetRequestData; -} -export interface ISendToDeviceFromWidgetResponseData extends IWidgetApiResponseData { -} -export interface ISendToDeviceFromWidgetActionResponse extends ISendToDeviceFromWidgetActionRequest { - response: ISendToDeviceFromWidgetResponseData; -} -export interface ISendToDeviceToWidgetRequestData extends IWidgetApiRequestData, IRoomEvent { - encrypted: boolean; -} -export interface ISendToDeviceToWidgetActionRequest extends IWidgetApiRequest { - action: WidgetApiToWidgetAction.SendToDevice; - data: ISendToDeviceToWidgetRequestData; -} -export interface ISendToDeviceToWidgetResponseData extends IWidgetApiResponseData { -} -export interface ISendToDeviceToWidgetActionResponse extends ISendToDeviceToWidgetActionRequest { - response: ISendToDeviceToWidgetResponseData; -} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/SendToDeviceAction.js b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/SendToDeviceAction.js deleted file mode 100644 index 430afc1..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/SendToDeviceAction.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -});
\ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/SetModalButtonEnabledAction.d.ts b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/SetModalButtonEnabledAction.d.ts deleted file mode 100644 index 177dfce..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/SetModalButtonEnabledAction.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { IWidgetApiRequest, IWidgetApiRequestData } from "./IWidgetApiRequest"; -import { WidgetApiFromWidgetAction } from "./WidgetApiAction"; -import { IWidgetApiAcknowledgeResponseData } from "./IWidgetApiResponse"; -import { ModalButtonID } from "./ModalWidgetActions"; -export interface ISetModalButtonEnabledActionRequestData extends IWidgetApiRequestData { - enabled: boolean; - button: ModalButtonID; -} -export interface ISetModalButtonEnabledActionRequest extends IWidgetApiRequest { - action: WidgetApiFromWidgetAction.SetModalButtonEnabled; - data: ISetModalButtonEnabledActionRequestData; -} -export interface ISetModalButtonEnabledActionResponse extends ISetModalButtonEnabledActionRequest { - response: IWidgetApiAcknowledgeResponseData; -} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/SetModalButtonEnabledAction.js b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/SetModalButtonEnabledAction.js deleted file mode 100644 index 430afc1..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/SetModalButtonEnabledAction.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -});
\ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/StickerAction.d.ts b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/StickerAction.d.ts deleted file mode 100644 index 0ae474b..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/StickerAction.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { IWidgetApiRequest, IWidgetApiRequestData } from "./IWidgetApiRequest"; -import { WidgetApiFromWidgetAction } from "./WidgetApiAction"; -import { IWidgetApiAcknowledgeResponseData } from "./IWidgetApiResponse"; -export interface IStickerActionRequestData extends IWidgetApiRequestData { - name: string; - description?: string; - content: { - url: string; - info?: { - h?: number; - w?: number; - mimetype?: string; - size?: number; - thumbnail_info?: { - h?: number; - w?: number; - mimetype?: string; - size?: number; - }; - }; - }; -} -export interface IStickerActionRequest extends IWidgetApiRequest { - action: WidgetApiFromWidgetAction.SendSticker; - data: IStickerActionRequestData; -} -export interface IStickerActionResponse extends IStickerActionRequest { - response: IWidgetApiAcknowledgeResponseData; -} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/StickerAction.js b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/StickerAction.js deleted file mode 100644 index 430afc1..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/StickerAction.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -});
\ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/StickyAction.d.ts b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/StickyAction.d.ts deleted file mode 100644 index bb6faa4..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/StickyAction.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { IWidgetApiRequest, IWidgetApiRequestData } from "./IWidgetApiRequest"; -import { WidgetApiFromWidgetAction } from "./WidgetApiAction"; -import { IWidgetApiResponseData } from "./IWidgetApiResponse"; -export interface IStickyActionRequestData extends IWidgetApiRequestData { - value: boolean; -} -export interface IStickyActionRequest extends IWidgetApiRequest { - action: WidgetApiFromWidgetAction.UpdateAlwaysOnScreen; - data: IStickyActionRequestData; -} -export interface IStickyActionResponseData extends IWidgetApiResponseData { - success: boolean; -} -export interface IStickyActionResponse extends IStickyActionRequest { - response: IStickyActionResponseData; -} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/StickyAction.js b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/StickyAction.js deleted file mode 100644 index 430afc1..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/StickyAction.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -});
\ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/SupportedVersionsAction.d.ts b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/SupportedVersionsAction.d.ts deleted file mode 100644 index 3e1dd13..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/SupportedVersionsAction.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { IWidgetApiRequest, IWidgetApiRequestEmptyData } from "./IWidgetApiRequest"; -import { WidgetApiFromWidgetAction, WidgetApiToWidgetAction } from "./WidgetApiAction"; -import { ApiVersion } from "./ApiVersion"; -import { IWidgetApiResponseData } from "./IWidgetApiResponse"; -export interface ISupportedVersionsActionRequest extends IWidgetApiRequest { - action: WidgetApiFromWidgetAction.SupportedApiVersions | WidgetApiToWidgetAction.SupportedApiVersions; - data: IWidgetApiRequestEmptyData; -} -export interface ISupportedVersionsActionResponseData extends IWidgetApiResponseData { - supported_versions: ApiVersion[]; -} -export interface ISupportedVersionsActionResponse extends ISupportedVersionsActionRequest { - response: ISupportedVersionsActionResponseData; -} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/SupportedVersionsAction.js b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/SupportedVersionsAction.js deleted file mode 100644 index 430afc1..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/SupportedVersionsAction.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -});
\ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/TurnServerActions.d.ts b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/TurnServerActions.d.ts deleted file mode 100644 index 55d5b3d..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/TurnServerActions.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { IWidgetApiRequest, IWidgetApiRequestData, IWidgetApiRequestEmptyData } from "./IWidgetApiRequest"; -import { WidgetApiFromWidgetAction, WidgetApiToWidgetAction } from "./WidgetApiAction"; -import { IWidgetApiAcknowledgeResponseData, IWidgetApiResponse } from "./IWidgetApiResponse"; -export interface ITurnServer { - uris: string[]; - username: string; - password: string; -} -export interface IWatchTurnServersRequest extends IWidgetApiRequest { - action: WidgetApiFromWidgetAction.WatchTurnServers; - data: IWidgetApiRequestEmptyData; -} -export interface IWatchTurnServersResponse extends IWidgetApiResponse { - response: IWidgetApiAcknowledgeResponseData; -} -export interface IUnwatchTurnServersRequest extends IWidgetApiRequest { - action: WidgetApiFromWidgetAction.UnwatchTurnServers; - data: IWidgetApiRequestEmptyData; -} -export interface IUnwatchTurnServersResponse extends IWidgetApiResponse { - response: IWidgetApiAcknowledgeResponseData; -} -export interface IUpdateTurnServersRequestData extends IWidgetApiRequestData, ITurnServer { -} -export interface IUpdateTurnServersRequest extends IWidgetApiRequest { - action: WidgetApiToWidgetAction.UpdateTurnServers; - data: IUpdateTurnServersRequestData; -} -export interface IUpdateTurnServersResponse extends IWidgetApiResponse { - response: IWidgetApiAcknowledgeResponseData; -} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/TurnServerActions.js b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/TurnServerActions.js deleted file mode 100644 index 430afc1..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/TurnServerActions.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -});
\ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/UserDirectorySearchAction.d.ts b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/UserDirectorySearchAction.d.ts deleted file mode 100644 index 923cfa1..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/UserDirectorySearchAction.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { IWidgetApiRequest, IWidgetApiRequestData } from "./IWidgetApiRequest"; -import { IWidgetApiResponseData } from "./IWidgetApiResponse"; -import { WidgetApiFromWidgetAction } from "./WidgetApiAction"; -export interface IUserDirectorySearchFromWidgetRequestData extends IWidgetApiRequestData { - search_term: string; - limit?: number; -} -export interface IUserDirectorySearchFromWidgetActionRequest extends IWidgetApiRequest { - action: WidgetApiFromWidgetAction.MSC3973UserDirectorySearch; - data: IUserDirectorySearchFromWidgetRequestData; -} -export interface IUserDirectorySearchFromWidgetResponseData extends IWidgetApiResponseData { - limited: boolean; - results: Array<{ - user_id: string; - display_name?: string; - avatar_url?: string; - }>; -} -export interface IUserDirectorySearchFromWidgetActionResponse extends IUserDirectorySearchFromWidgetActionRequest { - response: IUserDirectorySearchFromWidgetResponseData; -} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/UserDirectorySearchAction.js b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/UserDirectorySearchAction.js deleted file mode 100644 index 430afc1..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/UserDirectorySearchAction.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -});
\ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/VisibilityAction.d.ts b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/VisibilityAction.d.ts deleted file mode 100644 index 814f9e9..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/VisibilityAction.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { IWidgetApiRequest, IWidgetApiRequestData } from "./IWidgetApiRequest"; -import { WidgetApiToWidgetAction } from "./WidgetApiAction"; -import { IWidgetApiAcknowledgeResponseData } from "./IWidgetApiResponse"; -export interface IVisibilityActionRequestData extends IWidgetApiRequestData { - visible: boolean; -} -export interface IVisibilityActionRequest extends IWidgetApiRequest { - action: WidgetApiToWidgetAction.UpdateVisibility; - data: IVisibilityActionRequestData; -} -export interface IVisibilityActionResponse extends IVisibilityActionRequest { - response: IWidgetApiAcknowledgeResponseData; -} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/VisibilityAction.js b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/VisibilityAction.js deleted file mode 100644 index 430afc1..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/VisibilityAction.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -});
\ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/WidgetApiAction.d.ts b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/WidgetApiAction.d.ts deleted file mode 100644 index 0e67d07..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/WidgetApiAction.d.ts +++ /dev/null @@ -1,49 +0,0 @@ -export declare enum WidgetApiToWidgetAction { - SupportedApiVersions = "supported_api_versions", - Capabilities = "capabilities", - NotifyCapabilities = "notify_capabilities", - TakeScreenshot = "screenshot", - UpdateVisibility = "visibility", - OpenIDCredentials = "openid_credentials", - WidgetConfig = "widget_config", - CloseModalWidget = "close_modal", - ButtonClicked = "button_clicked", - SendEvent = "send_event", - SendToDevice = "send_to_device", - UpdateTurnServers = "update_turn_servers" -} -export declare enum WidgetApiFromWidgetAction { - SupportedApiVersions = "supported_api_versions", - ContentLoaded = "content_loaded", - SendSticker = "m.sticker", - UpdateAlwaysOnScreen = "set_always_on_screen", - GetOpenIDCredentials = "get_openid", - CloseModalWidget = "close_modal", - OpenModalWidget = "open_modal", - SetModalButtonEnabled = "set_button_enabled", - SendEvent = "send_event", - SendToDevice = "send_to_device", - WatchTurnServers = "watch_turn_servers", - UnwatchTurnServers = "unwatch_turn_servers", - /** - * @deprecated It is not recommended to rely on this existing - it can be removed without notice. - */ - MSC2876ReadEvents = "org.matrix.msc2876.read_events", - /** - * @deprecated It is not recommended to rely on this existing - it can be removed without notice. - */ - MSC2931Navigate = "org.matrix.msc2931.navigate", - /** - * @deprecated It is not recommended to rely on this existing - it can be removed without notice. - */ - MSC2974RenegotiateCapabilities = "org.matrix.msc2974.request_capabilities", - /** - * @deprecated It is not recommended to rely on this existing - it can be removed without notice. - */ - MSC3869ReadRelations = "org.matrix.msc3869.read_relations", - /** - * @deprecated It is not recommended to rely on this existing - it can be removed without notice. - */ - MSC3973UserDirectorySearch = "org.matrix.msc3973.user_directory_search" -} -export declare type WidgetApiAction = WidgetApiToWidgetAction | WidgetApiFromWidgetAction | string; diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/WidgetApiAction.js b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/WidgetApiAction.js deleted file mode 100644 index 2a2aede..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/WidgetApiAction.js +++ /dev/null @@ -1,62 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.WidgetApiToWidgetAction = exports.WidgetApiFromWidgetAction = void 0; - -/* - * Copyright 2020 The Matrix.org Foundation C.I.C. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -var WidgetApiToWidgetAction; -exports.WidgetApiToWidgetAction = WidgetApiToWidgetAction; - -(function (WidgetApiToWidgetAction) { - WidgetApiToWidgetAction["SupportedApiVersions"] = "supported_api_versions"; - WidgetApiToWidgetAction["Capabilities"] = "capabilities"; - WidgetApiToWidgetAction["NotifyCapabilities"] = "notify_capabilities"; - WidgetApiToWidgetAction["TakeScreenshot"] = "screenshot"; - WidgetApiToWidgetAction["UpdateVisibility"] = "visibility"; - WidgetApiToWidgetAction["OpenIDCredentials"] = "openid_credentials"; - WidgetApiToWidgetAction["WidgetConfig"] = "widget_config"; - WidgetApiToWidgetAction["CloseModalWidget"] = "close_modal"; - WidgetApiToWidgetAction["ButtonClicked"] = "button_clicked"; - WidgetApiToWidgetAction["SendEvent"] = "send_event"; - WidgetApiToWidgetAction["SendToDevice"] = "send_to_device"; - WidgetApiToWidgetAction["UpdateTurnServers"] = "update_turn_servers"; -})(WidgetApiToWidgetAction || (exports.WidgetApiToWidgetAction = WidgetApiToWidgetAction = {})); - -var WidgetApiFromWidgetAction; -exports.WidgetApiFromWidgetAction = WidgetApiFromWidgetAction; - -(function (WidgetApiFromWidgetAction) { - WidgetApiFromWidgetAction["SupportedApiVersions"] = "supported_api_versions"; - WidgetApiFromWidgetAction["ContentLoaded"] = "content_loaded"; - WidgetApiFromWidgetAction["SendSticker"] = "m.sticker"; - WidgetApiFromWidgetAction["UpdateAlwaysOnScreen"] = "set_always_on_screen"; - WidgetApiFromWidgetAction["GetOpenIDCredentials"] = "get_openid"; - WidgetApiFromWidgetAction["CloseModalWidget"] = "close_modal"; - WidgetApiFromWidgetAction["OpenModalWidget"] = "open_modal"; - WidgetApiFromWidgetAction["SetModalButtonEnabled"] = "set_button_enabled"; - WidgetApiFromWidgetAction["SendEvent"] = "send_event"; - WidgetApiFromWidgetAction["SendToDevice"] = "send_to_device"; - WidgetApiFromWidgetAction["WatchTurnServers"] = "watch_turn_servers"; - WidgetApiFromWidgetAction["UnwatchTurnServers"] = "unwatch_turn_servers"; - WidgetApiFromWidgetAction["MSC2876ReadEvents"] = "org.matrix.msc2876.read_events"; - WidgetApiFromWidgetAction["MSC2931Navigate"] = "org.matrix.msc2931.navigate"; - WidgetApiFromWidgetAction["MSC2974RenegotiateCapabilities"] = "org.matrix.msc2974.request_capabilities"; - WidgetApiFromWidgetAction["MSC3869ReadRelations"] = "org.matrix.msc3869.read_relations"; - WidgetApiFromWidgetAction["MSC3973UserDirectorySearch"] = "org.matrix.msc3973.user_directory_search"; -})(WidgetApiFromWidgetAction || (exports.WidgetApiFromWidgetAction = WidgetApiFromWidgetAction = {}));
\ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/WidgetApiDirection.d.ts b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/WidgetApiDirection.d.ts deleted file mode 100644 index 19e58f4..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/WidgetApiDirection.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -export declare enum WidgetApiDirection { - ToWidget = "toWidget", - FromWidget = "fromWidget" -} -export declare function invertedDirection(dir: WidgetApiDirection): WidgetApiDirection; diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/WidgetApiDirection.js b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/WidgetApiDirection.js deleted file mode 100644 index 69f296c..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/WidgetApiDirection.js +++ /dev/null @@ -1,40 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.WidgetApiDirection = void 0; -exports.invertedDirection = invertedDirection; - -/* - * Copyright 2020 The Matrix.org Foundation C.I.C. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -var WidgetApiDirection; -exports.WidgetApiDirection = WidgetApiDirection; - -(function (WidgetApiDirection) { - WidgetApiDirection["ToWidget"] = "toWidget"; - WidgetApiDirection["FromWidget"] = "fromWidget"; -})(WidgetApiDirection || (exports.WidgetApiDirection = WidgetApiDirection = {})); - -function invertedDirection(dir) { - if (dir === WidgetApiDirection.ToWidget) { - return WidgetApiDirection.FromWidget; - } else if (dir === WidgetApiDirection.FromWidget) { - return WidgetApiDirection.ToWidget; - } else { - throw new Error("Invalid direction"); - } -}
\ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/WidgetConfigAction.d.ts b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/WidgetConfigAction.d.ts deleted file mode 100644 index 1d23330..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/WidgetConfigAction.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { IWidgetApiRequest } from "./IWidgetApiRequest"; -import { WidgetApiToWidgetAction } from "./WidgetApiAction"; -import { IWidgetApiAcknowledgeResponseData, IWidgetApiResponse } from "./IWidgetApiResponse"; -import { IModalWidgetOpenRequestData } from "./ModalWidgetActions"; -export interface IWidgetConfigRequest extends IWidgetApiRequest { - action: WidgetApiToWidgetAction.WidgetConfig; - data: IModalWidgetOpenRequestData; -} -export interface IWidgetConfigResponse extends IWidgetApiResponse { - response: IWidgetApiAcknowledgeResponseData; -} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/WidgetConfigAction.js b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/WidgetConfigAction.js deleted file mode 100644 index 430afc1..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/WidgetConfigAction.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -});
\ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/WidgetKind.d.ts b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/WidgetKind.d.ts deleted file mode 100644 index ee039b8..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/WidgetKind.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -export declare enum WidgetKind { - Room = "room", - Account = "account", - Modal = "modal" -} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/WidgetKind.js b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/WidgetKind.js deleted file mode 100644 index 1f0c622..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/WidgetKind.js +++ /dev/null @@ -1,30 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.WidgetKind = void 0; - -/* - * Copyright 2020 The Matrix.org Foundation C.I.C. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -var WidgetKind; -exports.WidgetKind = WidgetKind; - -(function (WidgetKind) { - WidgetKind["Room"] = "room"; - WidgetKind["Account"] = "account"; - WidgetKind["Modal"] = "modal"; -})(WidgetKind || (exports.WidgetKind = WidgetKind = {}));
\ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/WidgetType.d.ts b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/WidgetType.d.ts deleted file mode 100644 index 87cb6c2..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/WidgetType.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare enum MatrixWidgetType { - Custom = "m.custom", - JitsiMeet = "m.jitsi", - Stickerpicker = "m.stickerpicker" -} -export declare type WidgetType = MatrixWidgetType | string; diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/WidgetType.js b/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/WidgetType.js deleted file mode 100644 index 5a96344..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/interfaces/WidgetType.js +++ /dev/null @@ -1,30 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.MatrixWidgetType = void 0; - -/* - * Copyright 2020 The Matrix.org Foundation C.I.C. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -var MatrixWidgetType; -exports.MatrixWidgetType = MatrixWidgetType; - -(function (MatrixWidgetType) { - MatrixWidgetType["Custom"] = "m.custom"; - MatrixWidgetType["JitsiMeet"] = "m.jitsi"; - MatrixWidgetType["Stickerpicker"] = "m.stickerpicker"; -})(MatrixWidgetType || (exports.MatrixWidgetType = MatrixWidgetType = {}));
\ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/models/Widget.d.ts b/includes/external/matrix/node_modules/matrix-widget-api/lib/models/Widget.d.ts deleted file mode 100644 index d2278e6..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/models/Widget.d.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { IWidget, IWidgetData, WidgetType } from ".."; -import { ITemplateParams } from ".."; -/** - * Represents the barest form of widget. - */ -export declare class Widget { - private definition; - constructor(definition: IWidget); - /** - * The user ID who created the widget. - */ - get creatorUserId(): string; - /** - * The type of widget. - */ - get type(): WidgetType; - /** - * The ID of the widget. - */ - get id(): string; - /** - * The name of the widget, or null if not set. - */ - get name(): string | null; - /** - * The title for the widget, or null if not set. - */ - get title(): string | null; - /** - * The templated URL for the widget. - */ - get templateUrl(): string; - /** - * The origin for this widget. - */ - get origin(): string; - /** - * Whether or not the client should wait for the iframe to load. Defaults - * to true. - */ - get waitForIframeLoad(): boolean; - /** - * The raw data for the widget. This will always be defined, though - * may be empty. - */ - get rawData(): IWidgetData; - /** - * Gets a complete widget URL for the client to render. - * @param {ITemplateParams} params The template parameters. - * @returns {string} A templated URL. - */ - getCompleteUrl(params: ITemplateParams): string; -} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/models/Widget.js b/includes/external/matrix/node_modules/matrix-widget-api/lib/models/Widget.js deleted file mode 100644 index 4650c54..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/models/Widget.js +++ /dev/null @@ -1,134 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.Widget = void 0; - -var _utils = require("./validation/utils"); - -var _ = require(".."); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - -/** - * Represents the barest form of widget. - */ -var Widget = /*#__PURE__*/function () { - function Widget(definition) { - _classCallCheck(this, Widget); - - this.definition = definition; - if (!this.definition) throw new Error("Definition is required"); - (0, _utils.assertPresent)(definition, "id"); - (0, _utils.assertPresent)(definition, "creatorUserId"); - (0, _utils.assertPresent)(definition, "type"); - (0, _utils.assertPresent)(definition, "url"); - } - /** - * The user ID who created the widget. - */ - - - _createClass(Widget, [{ - key: "creatorUserId", - get: function get() { - return this.definition.creatorUserId; - } - /** - * The type of widget. - */ - - }, { - key: "type", - get: function get() { - return this.definition.type; - } - /** - * The ID of the widget. - */ - - }, { - key: "id", - get: function get() { - return this.definition.id; - } - /** - * The name of the widget, or null if not set. - */ - - }, { - key: "name", - get: function get() { - return this.definition.name || null; - } - /** - * The title for the widget, or null if not set. - */ - - }, { - key: "title", - get: function get() { - return this.rawData.title || null; - } - /** - * The templated URL for the widget. - */ - - }, { - key: "templateUrl", - get: function get() { - return this.definition.url; - } - /** - * The origin for this widget. - */ - - }, { - key: "origin", - get: function get() { - return new URL(this.templateUrl).origin; - } - /** - * Whether or not the client should wait for the iframe to load. Defaults - * to true. - */ - - }, { - key: "waitForIframeLoad", - get: function get() { - if (this.definition.waitForIframeLoad === false) return false; - if (this.definition.waitForIframeLoad === true) return true; - return true; // default true - } - /** - * The raw data for the widget. This will always be defined, though - * may be empty. - */ - - }, { - key: "rawData", - get: function get() { - return this.definition.data || {}; - } - /** - * Gets a complete widget URL for the client to render. - * @param {ITemplateParams} params The template parameters. - * @returns {string} A templated URL. - */ - - }, { - key: "getCompleteUrl", - value: function getCompleteUrl(params) { - return (0, _.runTemplate)(this.templateUrl, this.definition, params); - } - }]); - - return Widget; -}(); - -exports.Widget = Widget;
\ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/models/WidgetEventCapability.d.ts b/includes/external/matrix/node_modules/matrix-widget-api/lib/models/WidgetEventCapability.d.ts deleted file mode 100644 index c0fbcdb..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/models/WidgetEventCapability.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { Capability } from ".."; -export declare enum EventKind { - Event = "event", - State = "state_event", - ToDevice = "to_device" -} -export declare enum EventDirection { - Send = "send", - Receive = "receive" -} -export declare class WidgetEventCapability { - readonly direction: EventDirection; - readonly eventType: string; - readonly kind: EventKind; - readonly keyStr: string | null; - readonly raw: string; - private constructor(); - matchesAsStateEvent(direction: EventDirection, eventType: string, stateKey: string | null): boolean; - matchesAsToDeviceEvent(direction: EventDirection, eventType: string): boolean; - matchesAsRoomEvent(direction: EventDirection, eventType: string, msgtype?: string | null): boolean; - static forStateEvent(direction: EventDirection, eventType: string, stateKey?: string): WidgetEventCapability; - static forToDeviceEvent(direction: EventDirection, eventType: string): WidgetEventCapability; - static forRoomEvent(direction: EventDirection, eventType: string): WidgetEventCapability; - static forRoomMessageEvent(direction: EventDirection, msgtype?: string): WidgetEventCapability; - /** - * Parses a capabilities request to find all the event capability requests. - * @param {Iterable<Capability>} capabilities The capabilities requested/to parse. - * @returns {WidgetEventCapability[]} An array of event capability requests. May be empty, but never null. - */ - static findEventCapabilities(capabilities: Iterable<Capability>): WidgetEventCapability[]; -} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/models/WidgetEventCapability.js b/includes/external/matrix/node_modules/matrix-widget-api/lib/models/WidgetEventCapability.js deleted file mode 100644 index 337665e..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/models/WidgetEventCapability.js +++ /dev/null @@ -1,253 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.WidgetEventCapability = exports.EventKind = exports.EventDirection = void 0; - -function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - -/* - * Copyright 2020 The Matrix.org Foundation C.I.C. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -var EventKind; -exports.EventKind = EventKind; - -(function (EventKind) { - EventKind["Event"] = "event"; - EventKind["State"] = "state_event"; - EventKind["ToDevice"] = "to_device"; -})(EventKind || (exports.EventKind = EventKind = {})); - -var EventDirection; -exports.EventDirection = EventDirection; - -(function (EventDirection) { - EventDirection["Send"] = "send"; - EventDirection["Receive"] = "receive"; -})(EventDirection || (exports.EventDirection = EventDirection = {})); - -var WidgetEventCapability = /*#__PURE__*/function () { - function WidgetEventCapability(direction, eventType, kind, keyStr, raw) { - _classCallCheck(this, WidgetEventCapability); - - this.direction = direction; - this.eventType = eventType; - this.kind = kind; - this.keyStr = keyStr; - this.raw = raw; - } - - _createClass(WidgetEventCapability, [{ - key: "matchesAsStateEvent", - value: function matchesAsStateEvent(direction, eventType, stateKey) { - if (this.kind !== EventKind.State) return false; // not a state event - - if (this.direction !== direction) return false; // direction mismatch - - if (this.eventType !== eventType) return false; // event type mismatch - - if (this.keyStr === null) return true; // all state keys are allowed - - if (this.keyStr === stateKey) return true; // this state key is allowed - // Default not allowed - - return false; - } - }, { - key: "matchesAsToDeviceEvent", - value: function matchesAsToDeviceEvent(direction, eventType) { - if (this.kind !== EventKind.ToDevice) return false; // not a to-device event - - if (this.direction !== direction) return false; // direction mismatch - - if (this.eventType !== eventType) return false; // event type mismatch - // Checks passed, the event is allowed - - return true; - } - }, { - key: "matchesAsRoomEvent", - value: function matchesAsRoomEvent(direction, eventType) { - var msgtype = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; - if (this.kind !== EventKind.Event) return false; // not a room event - - if (this.direction !== direction) return false; // direction mismatch - - if (this.eventType !== eventType) return false; // event type mismatch - - if (this.eventType === "m.room.message") { - if (this.keyStr === null) return true; // all message types are allowed - - if (this.keyStr === msgtype) return true; // this message type is allowed - } else { - return true; // already passed the check for if the event is allowed - } // Default not allowed - - - return false; - } - }], [{ - key: "forStateEvent", - value: function forStateEvent(direction, eventType, stateKey) { - // TODO: Enable support for m.* namespace once the MSC lands. - // https://github.com/matrix-org/matrix-widget-api/issues/22 - eventType = eventType.replace(/#/g, '\\#'); - stateKey = stateKey !== null && stateKey !== undefined ? "#".concat(stateKey) : ''; - var str = "org.matrix.msc2762.".concat(direction, ".state_event:").concat(eventType).concat(stateKey); // cheat by sending it through the processor - - return WidgetEventCapability.findEventCapabilities([str])[0]; - } - }, { - key: "forToDeviceEvent", - value: function forToDeviceEvent(direction, eventType) { - // TODO: Enable support for m.* namespace once the MSC lands. - // https://github.com/matrix-org/matrix-widget-api/issues/56 - var str = "org.matrix.msc3819.".concat(direction, ".to_device:").concat(eventType); // cheat by sending it through the processor - - return WidgetEventCapability.findEventCapabilities([str])[0]; - } - }, { - key: "forRoomEvent", - value: function forRoomEvent(direction, eventType) { - // TODO: Enable support for m.* namespace once the MSC lands. - // https://github.com/matrix-org/matrix-widget-api/issues/22 - var str = "org.matrix.msc2762.".concat(direction, ".event:").concat(eventType); // cheat by sending it through the processor - - return WidgetEventCapability.findEventCapabilities([str])[0]; - } - }, { - key: "forRoomMessageEvent", - value: function forRoomMessageEvent(direction, msgtype) { - // TODO: Enable support for m.* namespace once the MSC lands. - // https://github.com/matrix-org/matrix-widget-api/issues/22 - msgtype = msgtype === null || msgtype === undefined ? '' : msgtype; - var str = "org.matrix.msc2762.".concat(direction, ".event:m.room.message#").concat(msgtype); // cheat by sending it through the processor - - return WidgetEventCapability.findEventCapabilities([str])[0]; - } - /** - * Parses a capabilities request to find all the event capability requests. - * @param {Iterable<Capability>} capabilities The capabilities requested/to parse. - * @returns {WidgetEventCapability[]} An array of event capability requests. May be empty, but never null. - */ - - }, { - key: "findEventCapabilities", - value: function findEventCapabilities(capabilities) { - var parsed = []; - - var _iterator = _createForOfIteratorHelper(capabilities), - _step; - - try { - for (_iterator.s(); !(_step = _iterator.n()).done;) { - var cap = _step.value; - var _direction = null; - var eventSegment = void 0; - var _kind = null; // TODO: Enable support for m.* namespace once the MSCs land. - // https://github.com/matrix-org/matrix-widget-api/issues/22 - // https://github.com/matrix-org/matrix-widget-api/issues/56 - - if (cap.startsWith("org.matrix.msc2762.send.event:")) { - _direction = EventDirection.Send; - _kind = EventKind.Event; - eventSegment = cap.substring("org.matrix.msc2762.send.event:".length); - } else if (cap.startsWith("org.matrix.msc2762.send.state_event:")) { - _direction = EventDirection.Send; - _kind = EventKind.State; - eventSegment = cap.substring("org.matrix.msc2762.send.state_event:".length); - } else if (cap.startsWith("org.matrix.msc3819.send.to_device:")) { - _direction = EventDirection.Send; - _kind = EventKind.ToDevice; - eventSegment = cap.substring("org.matrix.msc3819.send.to_device:".length); - } else if (cap.startsWith("org.matrix.msc2762.receive.event:")) { - _direction = EventDirection.Receive; - _kind = EventKind.Event; - eventSegment = cap.substring("org.matrix.msc2762.receive.event:".length); - } else if (cap.startsWith("org.matrix.msc2762.receive.state_event:")) { - _direction = EventDirection.Receive; - _kind = EventKind.State; - eventSegment = cap.substring("org.matrix.msc2762.receive.state_event:".length); - } else if (cap.startsWith("org.matrix.msc3819.receive.to_device:")) { - _direction = EventDirection.Receive; - _kind = EventKind.ToDevice; - eventSegment = cap.substring("org.matrix.msc3819.receive.to_device:".length); - } - - if (_direction === null || _kind === null || eventSegment === undefined) continue; // The capability uses `#` as a separator between event type and state key/msgtype, - // so we split on that. However, a # is also valid in either one of those so we - // join accordingly. - // Eg: `m.room.message##m.text` is "m.room.message" event with msgtype "#m.text". - - var expectingKeyStr = eventSegment.startsWith("m.room.message#") || _kind === EventKind.State; - - var _keyStr = null; - - if (eventSegment.includes('#') && expectingKeyStr) { - // Dev note: regex is difficult to write, so instead the rules are manually written - // out. This is probably just as understandable as a boring regex though, so win-win? - // Test cases: - // str eventSegment keyStr - // ------------------------------------------------------------- - // m.room.message# m.room.message <empty string> - // m.room.message#test m.room.message test - // m.room.message\# m.room.message# test - // m.room.message##test m.room.message #test - // m.room.message\##test m.room.message# test - // m.room.message\\##test m.room.message\# test - // m.room.message\\###test m.room.message\# #test - // First step: explode the string - var parts = eventSegment.split('#'); // To form the eventSegment, we'll keep finding parts of the exploded string until - // there's one that doesn't end with the escape character (\). We'll then join those - // segments together with the exploding character. We have to remember to consume the - // escape character as well. - - var idx = parts.findIndex(function (p) { - return !p.endsWith("\\"); - }); - eventSegment = parts.slice(0, idx + 1).map(function (p) { - return p.endsWith('\\') ? p.substring(0, p.length - 1) : p; - }).join('#'); // The keyStr is whatever is left over. - - _keyStr = parts.slice(idx + 1).join('#'); - } - - parsed.push(new WidgetEventCapability(_direction, eventSegment, _kind, _keyStr, cap)); - } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); - } - - return parsed; - } - }]); - - return WidgetEventCapability; -}(); - -exports.WidgetEventCapability = WidgetEventCapability;
\ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/models/WidgetParser.d.ts b/includes/external/matrix/node_modules/matrix-widget-api/lib/models/WidgetParser.d.ts deleted file mode 100644 index f0cde3b..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/models/WidgetParser.d.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { Widget } from "./Widget"; -import { IWidget } from ".."; -export interface IStateEvent { - event_id: string; - room_id: string; - type: string; - sender: string; - origin_server_ts: number; - unsigned?: unknown; - content: unknown; - state_key: string; -} -export interface IAccountDataWidgets { - [widgetId: string]: { - type: "m.widget"; - state_key: string; - sender: string; - content: IWidget; - id?: string; - }; -} -export declare class WidgetParser { - private constructor(); - /** - * Parses widgets from the "m.widgets" account data event. This will always - * return an array, though may be empty if no valid widgets were found. - * @param {IAccountDataWidgets} content The content of the "m.widgets" account data. - * @returns {Widget[]} The widgets in account data, or an empty array. - */ - static parseAccountData(content: IAccountDataWidgets): Widget[]; - /** - * Parses all the widgets possible in the given array. This will always return - * an array, though may be empty if no widgets could be parsed. - * @param {IStateEvent[]} currentState The room state to parse. - * @returns {Widget[]} The widgets in the state, or an empty array. - */ - static parseWidgetsFromRoomState(currentState: IStateEvent[]): Widget[]; - /** - * Parses a state event into a widget. If the state event does not represent - * a widget (wrong event type, invalid widget, etc) then null is returned. - * @param {IStateEvent} stateEvent The state event. - * @returns {Widget|null} The widget, or null if invalid - */ - static parseRoomWidget(stateEvent: IStateEvent): Widget | null; - private static processEstimatedWidget; -} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/models/WidgetParser.js b/includes/external/matrix/node_modules/matrix-widget-api/lib/models/WidgetParser.js deleted file mode 100644 index 42c61d8..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/models/WidgetParser.js +++ /dev/null @@ -1,150 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.WidgetParser = void 0; - -var _Widget = require("./Widget"); - -var _url = require("./validation/url"); - -function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - -var WidgetParser = /*#__PURE__*/function () { - function WidgetParser() {// private constructor because this is a util class - - _classCallCheck(this, WidgetParser); - } - /** - * Parses widgets from the "m.widgets" account data event. This will always - * return an array, though may be empty if no valid widgets were found. - * @param {IAccountDataWidgets} content The content of the "m.widgets" account data. - * @returns {Widget[]} The widgets in account data, or an empty array. - */ - - - _createClass(WidgetParser, null, [{ - key: "parseAccountData", - value: function parseAccountData(content) { - if (!content) return []; - var result = []; - - for (var _i = 0, _Object$keys = Object.keys(content); _i < _Object$keys.length; _i++) { - var _widgetId = _Object$keys[_i]; - var roughWidget = content[_widgetId]; - if (!roughWidget) continue; - if (roughWidget.type !== "m.widget" && roughWidget.type !== "im.vector.modular.widgets") continue; - if (!roughWidget.sender) continue; - var probableWidgetId = roughWidget.state_key || roughWidget.id; - if (probableWidgetId !== _widgetId) continue; - var asStateEvent = { - content: roughWidget.content, - sender: roughWidget.sender, - type: "m.widget", - state_key: _widgetId, - event_id: "$example", - room_id: "!example", - origin_server_ts: 1 - }; - var widget = WidgetParser.parseRoomWidget(asStateEvent); - if (widget) result.push(widget); - } - - return result; - } - /** - * Parses all the widgets possible in the given array. This will always return - * an array, though may be empty if no widgets could be parsed. - * @param {IStateEvent[]} currentState The room state to parse. - * @returns {Widget[]} The widgets in the state, or an empty array. - */ - - }, { - key: "parseWidgetsFromRoomState", - value: function parseWidgetsFromRoomState(currentState) { - if (!currentState) return []; - var result = []; - - var _iterator = _createForOfIteratorHelper(currentState), - _step; - - try { - for (_iterator.s(); !(_step = _iterator.n()).done;) { - var state = _step.value; - var widget = WidgetParser.parseRoomWidget(state); - if (widget) result.push(widget); - } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); - } - - return result; - } - /** - * Parses a state event into a widget. If the state event does not represent - * a widget (wrong event type, invalid widget, etc) then null is returned. - * @param {IStateEvent} stateEvent The state event. - * @returns {Widget|null} The widget, or null if invalid - */ - - }, { - key: "parseRoomWidget", - value: function parseRoomWidget(stateEvent) { - if (!stateEvent) return null; // TODO: [Legacy] Remove legacy support - - if (stateEvent.type !== "m.widget" && stateEvent.type !== "im.vector.modular.widgets") { - return null; - } // Dev note: Throughout this function we have null safety to ensure that - // if the caller did not supply something useful that we don't error. This - // is done against the requirements of the interface because not everyone - // will have an interface to validate against. - - - var content = stateEvent.content || {}; // Form our best approximation of a widget with the information we have - - var estimatedWidget = { - id: stateEvent.state_key, - creatorUserId: content['creatorUserId'] || stateEvent.sender, - name: content['name'], - type: content['type'], - url: content['url'], - waitForIframeLoad: content['waitForIframeLoad'], - data: content['data'] - }; // Finally, process that widget - - return WidgetParser.processEstimatedWidget(estimatedWidget); - } - }, { - key: "processEstimatedWidget", - value: function processEstimatedWidget(widget) { - // Validate that the widget has the best chance of passing as a widget - if (!widget.id || !widget.creatorUserId || !widget.type) { - return null; - } - - if (!(0, _url.isValidUrl)(widget.url)) { - return null; - } // TODO: Validate data for known widget types - - - return new _Widget.Widget(widget); - } - }]); - - return WidgetParser; -}(); - -exports.WidgetParser = WidgetParser;
\ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/models/validation/url.d.ts b/includes/external/matrix/node_modules/matrix-widget-api/lib/models/validation/url.d.ts deleted file mode 100644 index 0c6625d..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/models/validation/url.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare function isValidUrl(val: string): boolean; diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/models/validation/url.js b/includes/external/matrix/node_modules/matrix-widget-api/lib/models/validation/url.js deleted file mode 100644 index 1e927f9..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/models/validation/url.js +++ /dev/null @@ -1,41 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.isValidUrl = isValidUrl; - -/* - * Copyright 2020 The Matrix.org Foundation C.I.C. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -function isValidUrl(val) { - if (!val) return false; // easy: not valid if not present - - try { - var parsed = new URL(val); - - if (parsed.protocol !== "http" && parsed.protocol !== "https") { - return false; - } - - return true; - } catch (e) { - if (e instanceof TypeError) { - return false; - } - - throw e; - } -}
\ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/models/validation/utils.d.ts b/includes/external/matrix/node_modules/matrix-widget-api/lib/models/validation/utils.d.ts deleted file mode 100644 index 90252db..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/models/validation/utils.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare function assertPresent<O>(obj: O, key: keyof O): void; diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/models/validation/utils.js b/includes/external/matrix/node_modules/matrix-widget-api/lib/models/validation/utils.js deleted file mode 100644 index 961fd14..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/models/validation/utils.js +++ /dev/null @@ -1,27 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.assertPresent = assertPresent; - -/* - * Copyright 2020 The Matrix.org Foundation C.I.C. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -function assertPresent(obj, key) { - if (!obj[key]) { - throw new Error("".concat(key, " is required")); - } -}
\ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/templating/url-template.d.ts b/includes/external/matrix/node_modules/matrix-widget-api/lib/templating/url-template.d.ts deleted file mode 100644 index 33d5ee3..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/templating/url-template.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { IWidget } from ".."; -export interface ITemplateParams { - widgetRoomId?: string; - currentUserId: string; - userDisplayName?: string; - userHttpAvatarUrl?: string; - clientId?: string; - clientTheme?: string; - clientLanguage?: string; -} -export declare function runTemplate(url: string, widget: IWidget, params: ITemplateParams): string; -export declare function toString(a: unknown): string; diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/templating/url-template.js b/includes/external/matrix/node_modules/matrix-widget-api/lib/templating/url-template.js deleted file mode 100644 index 8eb51da..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/templating/url-template.js +++ /dev/null @@ -1,60 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.runTemplate = runTemplate; -exports.toString = toString; - -/* - * Copyright 2020, 2021 The Matrix.org Foundation C.I.C. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -function runTemplate(url, widget, params) { - // Always apply the supplied params over top of data to ensure the data can't lie about them. - var variables = Object.assign({}, widget.data, { - 'matrix_room_id': params.widgetRoomId || "", - 'matrix_user_id': params.currentUserId, - 'matrix_display_name': params.userDisplayName || params.currentUserId, - 'matrix_avatar_url': params.userHttpAvatarUrl || "", - 'matrix_widget_id': widget.id, - // TODO: Convert to stable (https://github.com/matrix-org/matrix-doc/pull/2873) - 'org.matrix.msc2873.client_id': params.clientId || "", - 'org.matrix.msc2873.client_theme': params.clientTheme || "", - 'org.matrix.msc2873.client_language': params.clientLanguage || "" - }); - var result = url; - - for (var _i = 0, _Object$keys = Object.keys(variables); _i < _Object$keys.length; _i++) { - var key = _Object$keys[_i]; - // Regex escape from https://stackoverflow.com/a/6969486/7037379 - var pattern = "$".concat(key).replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string - - var rexp = new RegExp(pattern, 'g'); // This is technically not what we're supposed to do for a couple of reasons: - // 1. We are assuming that there won't later be a $key match after we replace a variable. - // 2. We are assuming that the variable is in a place where it can be escaped (eg: path or query string). - - result = result.replace(rexp, encodeURIComponent(toString(variables[key]))); - } - - return result; -} - -function toString(a) { - if (a === null || a === undefined) { - return "".concat(a); - } - - return String(a); -}
\ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/transport/ITransport.d.ts b/includes/external/matrix/node_modules/matrix-widget-api/lib/transport/ITransport.d.ts deleted file mode 100644 index 62688db..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/transport/ITransport.d.ts +++ /dev/null @@ -1,67 +0,0 @@ -import { EventEmitter } from "events"; -import { IWidgetApiAcknowledgeResponseData, IWidgetApiRequest, IWidgetApiRequestData, IWidgetApiResponse, IWidgetApiResponseData, WidgetApiAction } from ".."; -/** - * A transport for widget requests/responses. All actions - * get raised through a "message" CustomEvent with detail - * of the IWidgetApiRequest. - */ -export interface ITransport extends EventEmitter { - /** - * True if the transport is ready to start sending, false otherwise. - */ - readonly ready: boolean; - /** - * The widget ID, if known. If not known, null. - */ - readonly widgetId: string | null; - /** - * If true, the transport will refuse requests from origins other than the - * widget's current origin. This is intended to be used only by widgets which - * need excess security. - */ - strictOriginCheck: boolean; - /** - * The origin the transport should be replying/sending to. If not known, leave - * null. - */ - targetOrigin: string | null; - /** - * The number of seconds an outbound request is allowed to take before it - * times out. - */ - timeoutSeconds: number; - /** - * Starts the transport for listening - */ - start(): void; - /** - * Stops the transport. It cannot be re-started. - */ - stop(): void; - /** - * Sends a request to the remote end. - * @param {WidgetApiAction} action The action to send. - * @param {IWidgetApiRequestData} data The request data. - * @returns {Promise<IWidgetApiResponseData>} A promise which resolves - * to the remote end's response, or throws with an Error if the request - * failed. - */ - send<T extends IWidgetApiRequestData, R extends IWidgetApiResponseData = IWidgetApiAcknowledgeResponseData>(action: WidgetApiAction, data: T): Promise<R>; - /** - * Sends a request to the remote end. This is similar to the send() function - * however this version returns the full response rather than just the response - * data. - * @param {WidgetApiAction} action The action to send. - * @param {IWidgetApiRequestData} data The request data. - * @returns {Promise<IWidgetApiResponseData>} A promise which resolves - * to the remote end's response, or throws with an Error if the request - * failed. - */ - sendComplete<T extends IWidgetApiRequestData, R extends IWidgetApiResponse>(action: WidgetApiAction, data: T): Promise<R>; - /** - * Replies to a request. - * @param {IWidgetApiRequest} request The request to reply to. - * @param {IWidgetApiResponseData} responseData The response data to reply with. - */ - reply<T extends IWidgetApiResponseData>(request: IWidgetApiRequest, responseData: T): void; -} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/transport/ITransport.js b/includes/external/matrix/node_modules/matrix-widget-api/lib/transport/ITransport.js deleted file mode 100644 index 430afc1..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/transport/ITransport.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -});
\ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/transport/PostmessageTransport.d.ts b/includes/external/matrix/node_modules/matrix-widget-api/lib/transport/PostmessageTransport.d.ts deleted file mode 100644 index 8cfbbd9..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/transport/PostmessageTransport.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { EventEmitter } from "events"; -import { ITransport } from "./ITransport"; -import { IWidgetApiRequest, IWidgetApiRequestData, IWidgetApiResponse, IWidgetApiResponseData, WidgetApiAction, WidgetApiDirection } from ".."; -/** - * Transport for the Widget API over postMessage. - */ -export declare class PostmessageTransport extends EventEmitter implements ITransport { - private sendDirection; - private initialWidgetId; - private transportWindow; - private inboundWindow; - strictOriginCheck: boolean; - targetOrigin: string; - timeoutSeconds: number; - private _ready; - private _widgetId; - private outboundRequests; - private stopController; - get ready(): boolean; - get widgetId(): string | null; - constructor(sendDirection: WidgetApiDirection, initialWidgetId: string | null, transportWindow: Window, inboundWindow: Window); - private get nextRequestId(); - private sendInternal; - reply<T extends IWidgetApiResponseData>(request: IWidgetApiRequest, responseData: T): void; - send<T extends IWidgetApiRequestData, R extends IWidgetApiResponseData>(action: WidgetApiAction, data: T): Promise<R>; - sendComplete<T extends IWidgetApiRequestData, R extends IWidgetApiResponse>(action: WidgetApiAction, data: T): Promise<R>; - start(): void; - stop(): void; - private handleMessage; - private handleRequest; - private handleResponse; -} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/transport/PostmessageTransport.js b/includes/external/matrix/node_modules/matrix-widget-api/lib/transport/PostmessageTransport.js deleted file mode 100644 index 7f8e3d6..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/transport/PostmessageTransport.js +++ /dev/null @@ -1,255 +0,0 @@ -"use strict"; - -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.PostmessageTransport = void 0; - -var _events = require("events"); - -var _ = require(".."); - -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } - -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -/** - * Transport for the Widget API over postMessage. - */ -var PostmessageTransport = /*#__PURE__*/function (_EventEmitter) { - _inherits(PostmessageTransport, _EventEmitter); - - var _super = _createSuper(PostmessageTransport); - - function PostmessageTransport(sendDirection, initialWidgetId, transportWindow, inboundWindow) { - var _this; - - _classCallCheck(this, PostmessageTransport); - - _this = _super.call(this); - _this.sendDirection = sendDirection; - _this.initialWidgetId = initialWidgetId; - _this.transportWindow = transportWindow; - _this.inboundWindow = inboundWindow; - - _defineProperty(_assertThisInitialized(_this), "strictOriginCheck", false); - - _defineProperty(_assertThisInitialized(_this), "targetOrigin", "*"); - - _defineProperty(_assertThisInitialized(_this), "timeoutSeconds", 10); - - _defineProperty(_assertThisInitialized(_this), "_ready", false); - - _defineProperty(_assertThisInitialized(_this), "_widgetId", null); - - _defineProperty(_assertThisInitialized(_this), "outboundRequests", new Map()); - - _defineProperty(_assertThisInitialized(_this), "stopController", new AbortController()); - - _this._widgetId = initialWidgetId; - return _this; - } - - _createClass(PostmessageTransport, [{ - key: "ready", - get: function get() { - return this._ready; - } - }, { - key: "widgetId", - get: function get() { - return this._widgetId || null; - } - }, { - key: "nextRequestId", - get: function get() { - var idBase = "widgetapi-".concat(Date.now()); - var index = 0; - var id = idBase; - - while (this.outboundRequests.has(id)) { - id = "".concat(idBase, "-").concat(index++); - } // reserve the ID - - - this.outboundRequests.set(id, null); - return id; - } - }, { - key: "sendInternal", - value: function sendInternal(message) { - console.log("[PostmessageTransport] Sending object to ".concat(this.targetOrigin, ": "), message); - this.transportWindow.postMessage(message, this.targetOrigin); - } - }, { - key: "reply", - value: function reply(request, responseData) { - return this.sendInternal(_objectSpread(_objectSpread({}, request), {}, { - response: responseData - })); - } - }, { - key: "send", - value: function send(action, data) { - return this.sendComplete(action, data).then(function (r) { - return r.response; - }); - } - }, { - key: "sendComplete", - value: function sendComplete(action, data) { - var _this2 = this; - - if (!this.ready || !this.widgetId) { - return Promise.reject(new Error("Not ready or unknown widget ID")); - } - - var request = { - api: this.sendDirection, - widgetId: this.widgetId, - requestId: this.nextRequestId, - action: action, - data: data - }; - - if (action === _.WidgetApiToWidgetAction.UpdateVisibility) { - request['visible'] = data['visible']; - } - - return new Promise(function (prResolve, prReject) { - var resolve = function resolve(response) { - cleanUp(); - prResolve(response); - }; - - var reject = function reject(err) { - cleanUp(); - prReject(err); - }; - - var timerId = setTimeout(function () { - return reject(new Error("Request timed out")); - }, (_this2.timeoutSeconds || 1) * 1000); - - var onStop = function onStop() { - return reject(new Error("Transport stopped")); - }; - - _this2.stopController.signal.addEventListener("abort", onStop); - - var cleanUp = function cleanUp() { - _this2.outboundRequests["delete"](request.requestId); - - clearTimeout(timerId); - - _this2.stopController.signal.removeEventListener("abort", onStop); - }; - - _this2.outboundRequests.set(request.requestId, { - request: request, - resolve: resolve, - reject: reject - }); - - _this2.sendInternal(request); - }); - } - }, { - key: "start", - value: function start() { - var _this3 = this; - - this.inboundWindow.addEventListener("message", function (ev) { - _this3.handleMessage(ev); - }); - this._ready = true; - } - }, { - key: "stop", - value: function stop() { - this._ready = false; - this.stopController.abort(); - } - }, { - key: "handleMessage", - value: function handleMessage(ev) { - if (this.stopController.signal.aborted) return; - if (!ev.data) return; // invalid event - - if (this.strictOriginCheck && ev.origin !== window.origin) return; // bad origin - // treat the message as a response first, then downgrade to a request - - var response = ev.data; - if (!response.action || !response.requestId || !response.widgetId) return; // invalid request/response - - if (!response.response) { - // it's a request - var request = response; - if (request.api !== (0, _.invertedDirection)(this.sendDirection)) return; // wrong direction - - this.handleRequest(request); - } else { - // it's a response - if (response.api !== this.sendDirection) return; // wrong direction - - this.handleResponse(response); - } - } - }, { - key: "handleRequest", - value: function handleRequest(request) { - if (this.widgetId) { - if (this.widgetId !== request.widgetId) return; // wrong widget - } else { - this._widgetId = request.widgetId; - } - - this.emit("message", new CustomEvent("message", { - detail: request - })); - } - }, { - key: "handleResponse", - value: function handleResponse(response) { - if (response.widgetId !== this.widgetId) return; // wrong widget - - var req = this.outboundRequests.get(response.requestId); - if (!req) return; // response to an unknown request - - if ((0, _.isErrorResponse)(response.response)) { - var _err = response.response; - req.reject(new Error(_err.error.message)); - } else { - req.resolve(response); - } - } - }]); - - return PostmessageTransport; -}(_events.EventEmitter); - -exports.PostmessageTransport = PostmessageTransport;
\ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/util/SimpleObservable.d.ts b/includes/external/matrix/node_modules/matrix-widget-api/lib/util/SimpleObservable.d.ts deleted file mode 100644 index 886eca2..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/util/SimpleObservable.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -export declare type ObservableFunction<T> = (val: T) => void; -export declare class SimpleObservable<T> { - private listeners; - constructor(initialFn?: ObservableFunction<T>); - onUpdate(fn: ObservableFunction<T>): void; - update(val: T): void; - close(): void; -} diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/util/SimpleObservable.js b/includes/external/matrix/node_modules/matrix-widget-api/lib/util/SimpleObservable.js deleted file mode 100644 index d8ef3c3..0000000 --- a/includes/external/matrix/node_modules/matrix-widget-api/lib/util/SimpleObservable.js +++ /dev/null @@ -1,78 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.SimpleObservable = void 0; - -function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -/* - * Copyright 2020 The Matrix.org Foundation C.I.C. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -var SimpleObservable = /*#__PURE__*/function () { - function SimpleObservable(initialFn) { - _classCallCheck(this, SimpleObservable); - - _defineProperty(this, "listeners", []); - - if (initialFn) this.listeners.push(initialFn); - } - - _createClass(SimpleObservable, [{ - key: "onUpdate", - value: function onUpdate(fn) { - this.listeners.push(fn); - } - }, { - key: "update", - value: function update(val) { - var _iterator = _createForOfIteratorHelper(this.listeners), - _step; - - try { - for (_iterator.s(); !(_step = _iterator.n()).done;) { - var listener = _step.value; - listener(val); - } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); - } - } - }, { - key: "close", - value: function close() { - this.listeners = []; // reset - } - }]); - - return SimpleObservable; -}(); - -exports.SimpleObservable = SimpleObservable;
\ No newline at end of file |