From 633c92eae865e957121e08de634aeee11a8b3992 Mon Sep 17 00:00:00 2001 From: RaindropsSys Date: Mon, 24 Apr 2023 14:03:36 +0200 Subject: Updated 18 files, added 1692 files and deleted includes/system/compare.inc (automated) --- .../matrix-js-sdk/lib/http-api/errors.d.ts | 43 ++++ .../matrix-js-sdk/lib/http-api/errors.d.ts.map | 1 + .../matrix-js-sdk/lib/http-api/errors.js | 85 +++++++ .../matrix-js-sdk/lib/http-api/errors.js.map | 1 + .../matrix-js-sdk/lib/http-api/fetch.d.ts | 105 ++++++++ .../matrix-js-sdk/lib/http-api/fetch.d.ts.map | 1 + .../matrix-js-sdk/lib/http-api/fetch.js | 271 +++++++++++++++++++++ .../matrix-js-sdk/lib/http-api/fetch.js.map | 1 + .../matrix-js-sdk/lib/http-api/index.d.ts | 33 +++ .../matrix-js-sdk/lib/http-api/index.d.ts.map | 1 + .../matrix-js-sdk/lib/http-api/index.js | 244 +++++++++++++++++++ .../matrix-js-sdk/lib/http-api/index.js.map | 1 + .../matrix-js-sdk/lib/http-api/interface.d.ts | 113 +++++++++ .../matrix-js-sdk/lib/http-api/interface.d.ts.map | 1 + .../matrix-js-sdk/lib/http-api/interface.js | 28 +++ .../matrix-js-sdk/lib/http-api/interface.js.map | 1 + .../matrix-js-sdk/lib/http-api/method.d.ts | 7 + .../matrix-js-sdk/lib/http-api/method.d.ts.map | 1 + .../matrix-js-sdk/lib/http-api/method.js | 30 +++ .../matrix-js-sdk/lib/http-api/method.js.map | 1 + .../matrix-js-sdk/lib/http-api/prefix.d.ts | 31 +++ .../matrix-js-sdk/lib/http-api/prefix.d.ts.map | 1 + .../matrix-js-sdk/lib/http-api/prefix.js | 40 +++ .../matrix-js-sdk/lib/http-api/prefix.js.map | 1 + .../matrix-js-sdk/lib/http-api/utils.d.ts | 25 ++ .../matrix-js-sdk/lib/http-api/utils.d.ts.map | 1 + .../matrix-js-sdk/lib/http-api/utils.js | 145 +++++++++++ .../matrix-js-sdk/lib/http-api/utils.js.map | 1 + 28 files changed, 1214 insertions(+) create mode 100644 includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/errors.d.ts create mode 100644 includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/errors.d.ts.map create mode 100644 includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/errors.js create mode 100644 includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/errors.js.map create mode 100644 includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/fetch.d.ts create mode 100644 includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/fetch.d.ts.map create mode 100644 includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/fetch.js create mode 100644 includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/fetch.js.map create mode 100644 includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/index.d.ts create mode 100644 includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/index.d.ts.map create mode 100644 includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/index.js create mode 100644 includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/index.js.map create mode 100644 includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/interface.d.ts create mode 100644 includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/interface.d.ts.map create mode 100644 includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/interface.js create mode 100644 includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/interface.js.map create mode 100644 includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/method.d.ts create mode 100644 includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/method.d.ts.map create mode 100644 includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/method.js create mode 100644 includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/method.js.map create mode 100644 includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/prefix.d.ts create mode 100644 includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/prefix.d.ts.map create mode 100644 includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/prefix.js create mode 100644 includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/prefix.js.map create mode 100644 includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/utils.d.ts create mode 100644 includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/utils.d.ts.map create mode 100644 includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/utils.js create mode 100644 includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/utils.js.map (limited to 'includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api') diff --git a/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/errors.d.ts b/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/errors.d.ts new file mode 100644 index 0000000..f5b21c2 --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/errors.d.ts @@ -0,0 +1,43 @@ +import { IUsageLimit } from "../@types/partials"; +import { MatrixEvent } from "../models/event"; +interface IErrorJson extends Partial { + [key: string]: any; + errcode?: string; + error?: string; +} +/** + * Construct a generic HTTP error. This is a JavaScript Error with additional information + * specific to HTTP responses. + * @param msg - The error message to include. + * @param httpStatus - The HTTP response status code. + */ +export declare class HTTPError extends Error { + readonly httpStatus?: number | undefined; + constructor(msg: string, httpStatus?: number | undefined); +} +export declare class MatrixError extends HTTPError { + readonly httpStatus?: number | undefined; + url?: string | undefined; + event?: MatrixEvent | undefined; + readonly errcode?: string; + data: IErrorJson; + /** + * Construct a Matrix error. This is a JavaScript Error with additional + * information specific to the standard Matrix error response. + * @param errorJson - The Matrix error JSON returned from the homeserver. + * @param httpStatus - The numeric HTTP status code given + */ + constructor(errorJson?: IErrorJson, httpStatus?: number | undefined, url?: string | undefined, event?: MatrixEvent | undefined); +} +/** + * Construct a ConnectionError. This is a JavaScript Error indicating + * that a request failed because of some error with the connection, either + * CORS was not correctly configured on the server, the server didn't response, + * the request timed out, or the internet connection on the client side went down. + */ +export declare class ConnectionError extends Error { + constructor(message: string, cause?: Error); + get name(): string; +} +export {}; +//# sourceMappingURL=errors.d.ts.map \ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/errors.d.ts.map b/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/errors.d.ts.map new file mode 100644 index 0000000..f13050a --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/errors.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/http-api/errors.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,UAAU,UAAW,SAAQ,OAAO,CAAC,WAAW,CAAC;IAC7C,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;GAKG;AACH,qBAAa,SAAU,SAAQ,KAAK;aACgB,UAAU,CAAC;gBAAxC,GAAG,EAAE,MAAM,EAAkB,UAAU,CAAC,oBAAQ;CAGtE;AAED,qBAAa,WAAY,SAAQ,SAAS;aAclB,UAAU,CAAC;IACpB,GAAG,CAAC;IACJ,KAAK,CAAC;IAdjB,SAAgB,OAAO,CAAC,EAAE,MAAM,CAAC;IAE1B,IAAI,EAAE,UAAU,CAAC;IAExB;;;;;OAKG;gBAEC,SAAS,GAAE,UAAe,EACV,UAAU,CAAC,oBAAQ,EAC5B,GAAG,CAAC,oBAAQ,EACZ,KAAK,CAAC,yBAAa;CAcjC;AAED;;;;;GAKG;AACH,qBAAa,eAAgB,SAAQ,KAAK;gBACnB,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK;IAIjD,IAAW,IAAI,IAAI,MAAM,CAExB;CACJ"} \ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/errors.js b/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/errors.js new file mode 100644 index 0000000..88ec475 --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/errors.js @@ -0,0 +1,85 @@ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.MatrixError = exports.HTTPError = exports.ConnectionError = void 0; +var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); +/* +Copyright 2022 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. +*/ + +/** + * Construct a generic HTTP error. This is a JavaScript Error with additional information + * specific to HTTP responses. + * @param msg - The error message to include. + * @param httpStatus - The HTTP response status code. + */ +class HTTPError extends Error { + constructor(msg, httpStatus) { + super(msg); + this.httpStatus = httpStatus; + } +} +exports.HTTPError = HTTPError; +class MatrixError extends HTTPError { + // The Matrix 'errcode' value, e.g. "M_FORBIDDEN". + + // The raw Matrix error JSON used to construct this object. + + /** + * Construct a Matrix error. This is a JavaScript Error with additional + * information specific to the standard Matrix error response. + * @param errorJson - The Matrix error JSON returned from the homeserver. + * @param httpStatus - The numeric HTTP status code given + */ + constructor(errorJson = {}, httpStatus, url, event) { + let message = errorJson.error || "Unknown message"; + if (httpStatus) { + message = `[${httpStatus}] ${message}`; + } + if (url) { + message = `${message} (${url})`; + } + super(`MatrixError: ${message}`, httpStatus); + this.httpStatus = httpStatus; + this.url = url; + this.event = event; + (0, _defineProperty2.default)(this, "errcode", void 0); + (0, _defineProperty2.default)(this, "data", void 0); + this.errcode = errorJson.errcode; + this.name = errorJson.errcode || "Unknown error code"; + this.data = errorJson; + } +} + +/** + * Construct a ConnectionError. This is a JavaScript Error indicating + * that a request failed because of some error with the connection, either + * CORS was not correctly configured on the server, the server didn't response, + * the request timed out, or the internet connection on the client side went down. + */ +exports.MatrixError = MatrixError; +class ConnectionError extends Error { + constructor(message, cause) { + super(message + (cause ? `: ${cause.message}` : "")); + } + get name() { + return "ConnectionError"; + } +} +exports.ConnectionError = ConnectionError; +//# sourceMappingURL=errors.js.map \ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/errors.js.map b/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/errors.js.map new file mode 100644 index 0000000..db59fe9 --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/errors.js.map @@ -0,0 +1 @@ +{"version":3,"file":"errors.js","names":["HTTPError","Error","constructor","msg","httpStatus","exports","MatrixError","errorJson","url","event","message","error","_defineProperty2","default","errcode","name","data","ConnectionError","cause"],"sources":["../../src/http-api/errors.ts"],"sourcesContent":["/*\nCopyright 2022 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { IUsageLimit } from \"../@types/partials\";\nimport { MatrixEvent } from \"../models/event\";\n\ninterface IErrorJson extends Partial {\n [key: string]: any; // extensible\n errcode?: string;\n error?: string;\n}\n\n/**\n * Construct a generic HTTP error. This is a JavaScript Error with additional information\n * specific to HTTP responses.\n * @param msg - The error message to include.\n * @param httpStatus - The HTTP response status code.\n */\nexport class HTTPError extends Error {\n public constructor(msg: string, public readonly httpStatus?: number) {\n super(msg);\n }\n}\n\nexport class MatrixError extends HTTPError {\n // The Matrix 'errcode' value, e.g. \"M_FORBIDDEN\".\n public readonly errcode?: string;\n // The raw Matrix error JSON used to construct this object.\n public data: IErrorJson;\n\n /**\n * Construct a Matrix error. This is a JavaScript Error with additional\n * information specific to the standard Matrix error response.\n * @param errorJson - The Matrix error JSON returned from the homeserver.\n * @param httpStatus - The numeric HTTP status code given\n */\n public constructor(\n errorJson: IErrorJson = {},\n public readonly httpStatus?: number,\n public url?: string,\n public event?: MatrixEvent,\n ) {\n let message = errorJson.error || \"Unknown message\";\n if (httpStatus) {\n message = `[${httpStatus}] ${message}`;\n }\n if (url) {\n message = `${message} (${url})`;\n }\n super(`MatrixError: ${message}`, httpStatus);\n this.errcode = errorJson.errcode;\n this.name = errorJson.errcode || \"Unknown error code\";\n this.data = errorJson;\n }\n}\n\n/**\n * Construct a ConnectionError. This is a JavaScript Error indicating\n * that a request failed because of some error with the connection, either\n * CORS was not correctly configured on the server, the server didn't response,\n * the request timed out, or the internet connection on the client side went down.\n */\nexport class ConnectionError extends Error {\n public constructor(message: string, cause?: Error) {\n super(message + (cause ? `: ${cause.message}` : \"\"));\n }\n\n public get name(): string {\n return \"ConnectionError\";\n }\n}\n"],"mappings":";;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAWA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,SAAS,SAASC,KAAK,CAAC;EAC1BC,WAAWA,CAACC,GAAW,EAAkBC,UAAmB,EAAE;IACjE,KAAK,CAACD,GAAG,CAAC;IAAC,KADiCC,UAAmB,GAAnBA,UAAmB;EAEnE;AACJ;AAACC,OAAA,CAAAL,SAAA,GAAAA,SAAA;AAEM,MAAMM,WAAW,SAASN,SAAS,CAAC;EACvC;;EAEA;;EAGA;AACJ;AACA;AACA;AACA;AACA;EACWE,WAAWA,CACdK,SAAqB,GAAG,CAAC,CAAC,EACVH,UAAmB,EAC5BI,GAAY,EACZC,KAAmB,EAC5B;IACE,IAAIC,OAAO,GAAGH,SAAS,CAACI,KAAK,IAAI,iBAAiB;IAClD,IAAIP,UAAU,EAAE;MACZM,OAAO,GAAI,IAAGN,UAAW,KAAIM,OAAQ,EAAC;IAC1C;IACA,IAAIF,GAAG,EAAE;MACLE,OAAO,GAAI,GAAEA,OAAQ,KAAIF,GAAI,GAAE;IACnC;IACA,KAAK,CAAE,gBAAeE,OAAQ,EAAC,EAAEN,UAAU,CAAC;IAAC,KAX7BA,UAAmB,GAAnBA,UAAmB;IAAA,KAC5BI,GAAY,GAAZA,GAAY;IAAA,KACZC,KAAmB,GAAnBA,KAAmB;IAAA,IAAAG,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAU1B,IAAI,CAACC,OAAO,GAAGP,SAAS,CAACO,OAAO;IAChC,IAAI,CAACC,IAAI,GAAGR,SAAS,CAACO,OAAO,IAAI,oBAAoB;IACrD,IAAI,CAACE,IAAI,GAAGT,SAAS;EACzB;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AALAF,OAAA,CAAAC,WAAA,GAAAA,WAAA;AAMO,MAAMW,eAAe,SAAShB,KAAK,CAAC;EAChCC,WAAWA,CAACQ,OAAe,EAAEQ,KAAa,EAAE;IAC/C,KAAK,CAACR,OAAO,IAAIQ,KAAK,GAAI,KAAIA,KAAK,CAACR,OAAQ,EAAC,GAAG,EAAE,CAAC,CAAC;EACxD;EAEA,IAAWK,IAAIA,CAAA,EAAW;IACtB,OAAO,iBAAiB;EAC5B;AACJ;AAACV,OAAA,CAAAY,eAAA,GAAAA,eAAA"} \ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/fetch.d.ts b/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/fetch.d.ts new file mode 100644 index 0000000..60d0440 --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/fetch.d.ts @@ -0,0 +1,105 @@ +import { TypedEventEmitter } from "../models/typed-event-emitter"; +import { Method } from "./method"; +import { HttpApiEvent, HttpApiEventHandlerMap, IHttpOpts, IRequestOpts } from "./interface"; +import { QueryDict } from "../utils"; +type Body = Record | BodyInit; +interface TypedResponse extends Response { + json(): Promise; +} +export type ResponseType = O extends undefined ? T : O extends { + onlyData: true; +} ? T : TypedResponse; +export declare class FetchHttpApi { + private eventEmitter; + readonly opts: O; + private abortController; + constructor(eventEmitter: TypedEventEmitter, opts: O); + abort(): void; + fetch(resource: URL | string, options?: RequestInit): ReturnType; + /** + * Sets the base URL for the identity server + * @param url - The new base url + */ + setIdBaseUrl(url: string): void; + idServerRequest>(method: Method, path: string, params: Record | undefined, prefix: string, accessToken?: string): Promise>; + /** + * Perform an authorised request to the homeserver. + * @param method - The HTTP method e.g. "GET". + * @param path - The HTTP path after the supplied prefix e.g. + * "/createRoom". + * + * @param queryParams - A dict of query params (these will NOT be + * urlencoded). If unspecified, there will be no query params. + * + * @param body - The HTTP JSON body. + * + * @param opts - additional options. If a number is specified, + * this is treated as `opts.localTimeoutMs`. + * + * @returns Promise which resolves to + * ``` + * { + * data: {Object}, + * headers: {Object}, + * code: {Number}, + * } + * ``` + * If `onlyData` is set, this will resolve to the `data` object only. + * @returns Rejects with an error if a problem occurred. + * This includes network problems and Matrix-specific error JSON. + */ + authedRequest(method: Method, path: string, queryParams?: QueryDict, body?: Body, opts?: IRequestOpts): Promise>; + /** + * Perform a request to the homeserver without any credentials. + * @param method - The HTTP method e.g. "GET". + * @param path - The HTTP path after the supplied prefix e.g. + * "/createRoom". + * + * @param queryParams - A dict of query params (these will NOT be + * urlencoded). If unspecified, there will be no query params. + * + * @param body - The HTTP JSON body. + * + * @param opts - additional options + * + * @returns Promise which resolves to + * ``` + * { + * data: {Object}, + * headers: {Object}, + * code: {Number}, + * } + * ``` + * If `onlyData is set, this will resolve to the data` + * object only. + * @returns Rejects with an error if a problem + * occurred. This includes network problems and Matrix-specific error JSON. + */ + request(method: Method, path: string, queryParams?: QueryDict, body?: Body, opts?: IRequestOpts): Promise>; + /** + * Perform a request to an arbitrary URL. + * @param method - The HTTP method e.g. "GET". + * @param url - The HTTP URL object. + * + * @param body - The HTTP JSON body. + * + * @param opts - additional options + * + * @returns Promise which resolves to data unless `onlyData` is specified as false, + * where the resolved value will be a fetch Response object. + * @returns Rejects with an error if a problem + * occurred. This includes network problems and Matrix-specific error JSON. + */ + requestOtherUrl(method: Method, url: URL | string, body?: Body, opts?: Pick): Promise>; + /** + * Form and return a homeserver request URL based on the given path params and prefix. + * @param path - The HTTP path after the supplied prefix e.g. "/createRoom". + * @param queryParams - A dict of query params (these will NOT be urlencoded). + * @param prefix - The full prefix to use e.g. "/_matrix/client/v2_alpha", defaulting to this.opts.prefix. + * @param baseUrl - The baseUrl to use e.g. "https://matrix.org/", defaulting to this.opts.baseUrl. + * @returns URL + */ + getUrl(path: string, queryParams?: QueryDict, prefix?: string, baseUrl?: string): URL; +} +export {}; +//# sourceMappingURL=fetch.d.ts.map \ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/fetch.d.ts.map b/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/fetch.d.ts.map new file mode 100644 index 0000000..42f4b1f --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/fetch.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../src/http-api/fetch.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE5F,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,KAAK,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,QAAQ,CAAC;AAE3C,UAAU,aAA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AAiB,GACxB,OAAO,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAkC9B;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACI,OAAO,CAAC,CAAC,EACZ,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,WAAW,CAAC,EAAE,SAAS,EACvB,IAAI,CAAC,EAAE,IAAI,EACX,IAAI,CAAC,EAAE,YAAY,GACpB,OAAO,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAK9B;;;;;;;;;;;;;OAaG;IACU,eAAe,CAAC,CAAC,EAC1B,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,GAAG,GAAG,MAAM,EACjB,IAAI,CAAC,EAAE,IAAI,EACX,IAAI,GAAE,IAAI,CAAC,YAAY,EAAE,SAAS,GAAG,MAAM,GAAG,gBAAgB,GAAG,WAAW,GAAG,aAAa,CAAM,GACnG,OAAO,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAqE9B;;;;;;;OAOG;IACI,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,GAAG;CAO/F"} \ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/fetch.js b/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/fetch.js new file mode 100644 index 0000000..d009861 --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/fetch.js @@ -0,0 +1,271 @@ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.FetchHttpApi = void 0; +var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); +var utils = _interopRequireWildcard(require("../utils")); +var _method = require("./method"); +var _errors = require("./errors"); +var _interface = require("./interface"); +var _utils2 = require("./utils"); +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } +/* +Copyright 2022 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. +*/ + +/** + * This is an internal module. See {@link MatrixHttpApi} for the public class. + */ + +class FetchHttpApi { + constructor(eventEmitter, opts) { + var _opts$useAuthorizatio; + this.eventEmitter = eventEmitter; + this.opts = opts; + (0, _defineProperty2.default)(this, "abortController", new AbortController()); + utils.checkObjectHasKeys(opts, ["baseUrl", "prefix"]); + opts.onlyData = !!opts.onlyData; + opts.useAuthorizationHeader = (_opts$useAuthorizatio = opts.useAuthorizationHeader) !== null && _opts$useAuthorizatio !== void 0 ? _opts$useAuthorizatio : true; + } + abort() { + this.abortController.abort(); + this.abortController = new AbortController(); + } + fetch(resource, options) { + if (this.opts.fetchFn) { + return this.opts.fetchFn(resource, options); + } + return global.fetch(resource, options); + } + + /** + * Sets the base URL for the identity server + * @param url - The new base url + */ + setIdBaseUrl(url) { + this.opts.idBaseUrl = url; + } + idServerRequest(method, path, params, prefix, accessToken) { + if (!this.opts.idBaseUrl) { + throw new Error("No identity server base URL set"); + } + let queryParams = undefined; + let body = undefined; + if (method === _method.Method.Get) { + queryParams = params; + } else { + body = params; + } + const fullUri = this.getUrl(path, queryParams, prefix, this.opts.idBaseUrl); + const opts = { + json: true, + headers: {} + }; + if (accessToken) { + opts.headers.Authorization = `Bearer ${accessToken}`; + } + return this.requestOtherUrl(method, fullUri, body, opts); + } + + /** + * Perform an authorised request to the homeserver. + * @param method - The HTTP method e.g. "GET". + * @param path - The HTTP path after the supplied prefix e.g. + * "/createRoom". + * + * @param queryParams - A dict of query params (these will NOT be + * urlencoded). If unspecified, there will be no query params. + * + * @param body - The HTTP JSON body. + * + * @param opts - additional options. If a number is specified, + * this is treated as `opts.localTimeoutMs`. + * + * @returns Promise which resolves to + * ``` + * { + * data: {Object}, + * headers: {Object}, + * code: {Number}, + * } + * ``` + * If `onlyData` is set, this will resolve to the `data` object only. + * @returns Rejects with an error if a problem occurred. + * This includes network problems and Matrix-specific error JSON. + */ + authedRequest(method, path, queryParams, body, opts = {}) { + if (!queryParams) queryParams = {}; + if (this.opts.accessToken) { + if (this.opts.useAuthorizationHeader) { + if (!opts.headers) { + opts.headers = {}; + } + if (!opts.headers.Authorization) { + opts.headers.Authorization = "Bearer " + this.opts.accessToken; + } + if (queryParams.access_token) { + delete queryParams.access_token; + } + } else if (!queryParams.access_token) { + queryParams.access_token = this.opts.accessToken; + } + } + const requestPromise = this.request(method, path, queryParams, body, opts); + requestPromise.catch(err => { + if (err.errcode == "M_UNKNOWN_TOKEN" && !(opts !== null && opts !== void 0 && opts.inhibitLogoutEmit)) { + this.eventEmitter.emit(_interface.HttpApiEvent.SessionLoggedOut, err); + } else if (err.errcode == "M_CONSENT_NOT_GIVEN") { + this.eventEmitter.emit(_interface.HttpApiEvent.NoConsent, err.message, err.data.consent_uri); + } + }); + + // return the original promise, otherwise tests break due to it having to + // go around the event loop one more time to process the result of the request + return requestPromise; + } + + /** + * Perform a request to the homeserver without any credentials. + * @param method - The HTTP method e.g. "GET". + * @param path - The HTTP path after the supplied prefix e.g. + * "/createRoom". + * + * @param queryParams - A dict of query params (these will NOT be + * urlencoded). If unspecified, there will be no query params. + * + * @param body - The HTTP JSON body. + * + * @param opts - additional options + * + * @returns Promise which resolves to + * ``` + * { + * data: {Object}, + * headers: {Object}, + * code: {Number}, + * } + * ``` + * If `onlyData is set, this will resolve to the data` + * object only. + * @returns Rejects with an error if a problem + * occurred. This includes network problems and Matrix-specific error JSON. + */ + request(method, path, queryParams, body, opts) { + const fullUri = this.getUrl(path, queryParams, opts === null || opts === void 0 ? void 0 : opts.prefix, opts === null || opts === void 0 ? void 0 : opts.baseUrl); + return this.requestOtherUrl(method, fullUri, body, opts); + } + + /** + * Perform a request to an arbitrary URL. + * @param method - The HTTP method e.g. "GET". + * @param url - The HTTP URL object. + * + * @param body - The HTTP JSON body. + * + * @param opts - additional options + * + * @returns Promise which resolves to data unless `onlyData` is specified as false, + * where the resolved value will be a fetch Response object. + * @returns Rejects with an error if a problem + * occurred. This includes network problems and Matrix-specific error JSON. + */ + async requestOtherUrl(method, url, body, opts = {}) { + var _opts$json, _body$constructor, _opts$localTimeoutMs, _opts$keepAlive; + const headers = Object.assign({}, opts.headers || {}); + const json = (_opts$json = opts.json) !== null && _opts$json !== void 0 ? _opts$json : true; + // We can't use getPrototypeOf here as objects made in other contexts e.g. over postMessage won't have same ref + const jsonBody = json && (body === null || body === void 0 ? void 0 : (_body$constructor = body.constructor) === null || _body$constructor === void 0 ? void 0 : _body$constructor.name) === Object.name; + if (json) { + if (jsonBody && !headers["Content-Type"]) { + headers["Content-Type"] = "application/json"; + } + if (!headers["Accept"]) { + headers["Accept"] = "application/json"; + } + } + const timeout = (_opts$localTimeoutMs = opts.localTimeoutMs) !== null && _opts$localTimeoutMs !== void 0 ? _opts$localTimeoutMs : this.opts.localTimeoutMs; + const keepAlive = (_opts$keepAlive = opts.keepAlive) !== null && _opts$keepAlive !== void 0 ? _opts$keepAlive : false; + const signals = [this.abortController.signal]; + if (timeout !== undefined) { + signals.push((0, _utils2.timeoutSignal)(timeout)); + } + if (opts.abortSignal) { + signals.push(opts.abortSignal); + } + let data; + if (jsonBody) { + data = JSON.stringify(body); + } else { + data = body; + } + const { + signal, + cleanup + } = (0, _utils2.anySignal)(signals); + let res; + try { + res = await this.fetch(url, { + signal, + method, + body: data, + headers, + mode: "cors", + redirect: "follow", + referrer: "", + referrerPolicy: "no-referrer", + cache: "no-cache", + credentials: "omit", + // we send credentials via headers + keepalive: keepAlive + }); + } catch (e) { + if (e.name === "AbortError") { + throw e; + } + throw new _errors.ConnectionError("fetch failed", e); + } finally { + cleanup(); + } + if (!res.ok) { + throw (0, _utils2.parseErrorResponse)(res, await res.text()); + } + if (this.opts.onlyData) { + return json ? res.json() : res.text(); + } + return res; + } + + /** + * Form and return a homeserver request URL based on the given path params and prefix. + * @param path - The HTTP path after the supplied prefix e.g. "/createRoom". + * @param queryParams - A dict of query params (these will NOT be urlencoded). + * @param prefix - The full prefix to use e.g. "/_matrix/client/v2_alpha", defaulting to this.opts.prefix. + * @param baseUrl - The baseUrl to use e.g. "https://matrix.org/", defaulting to this.opts.baseUrl. + * @returns URL + */ + getUrl(path, queryParams, prefix, baseUrl) { + const url = new URL((baseUrl !== null && baseUrl !== void 0 ? baseUrl : this.opts.baseUrl) + (prefix !== null && prefix !== void 0 ? prefix : this.opts.prefix) + path); + if (queryParams) { + utils.encodeParams(queryParams, url.searchParams); + } + return url; + } +} +exports.FetchHttpApi = FetchHttpApi; +//# sourceMappingURL=fetch.js.map \ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/fetch.js.map b/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/fetch.js.map new file mode 100644 index 0000000..b5e30ee --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/fetch.js.map @@ -0,0 +1 @@ +{"version":3,"file":"fetch.js","names":["utils","_interopRequireWildcard","require","_method","_errors","_interface","_utils2","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","FetchHttpApi","constructor","eventEmitter","opts","_opts$useAuthorizatio","_defineProperty2","AbortController","checkObjectHasKeys","onlyData","useAuthorizationHeader","abort","abortController","fetch","resource","options","fetchFn","global","setIdBaseUrl","url","idBaseUrl","idServerRequest","method","path","params","prefix","accessToken","Error","queryParams","undefined","body","Method","Get","fullUri","getUrl","json","headers","Authorization","requestOtherUrl","authedRequest","access_token","requestPromise","request","catch","err","errcode","inhibitLogoutEmit","emit","HttpApiEvent","SessionLoggedOut","NoConsent","message","data","consent_uri","baseUrl","_opts$json","_body$constructor","_opts$localTimeoutMs","_opts$keepAlive","assign","jsonBody","name","timeout","localTimeoutMs","keepAlive","signals","signal","push","timeoutSignal","abortSignal","JSON","stringify","cleanup","anySignal","res","mode","redirect","referrer","referrerPolicy","credentials","keepalive","e","ConnectionError","ok","parseErrorResponse","text","URL","encodeParams","searchParams","exports"],"sources":["../../src/http-api/fetch.ts"],"sourcesContent":["/*\nCopyright 2022 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\n/**\n * This is an internal module. See {@link MatrixHttpApi} for the public class.\n */\n\nimport * as utils from \"../utils\";\nimport { TypedEventEmitter } from \"../models/typed-event-emitter\";\nimport { Method } from \"./method\";\nimport { ConnectionError, MatrixError } from \"./errors\";\nimport { HttpApiEvent, HttpApiEventHandlerMap, IHttpOpts, IRequestOpts } from \"./interface\";\nimport { anySignal, parseErrorResponse, timeoutSignal } from \"./utils\";\nimport { QueryDict } from \"../utils\";\n\ntype Body = Record | BodyInit;\n\ninterface TypedResponse extends Response {\n json(): Promise;\n}\n\nexport type ResponseType = O extends undefined\n ? T\n : O extends { onlyData: true }\n ? T\n : TypedResponse;\n\nexport class FetchHttpApi {\n private abortController = new AbortController();\n\n public constructor(\n private eventEmitter: TypedEventEmitter,\n public readonly opts: O,\n ) {\n utils.checkObjectHasKeys(opts, [\"baseUrl\", \"prefix\"]);\n opts.onlyData = !!opts.onlyData;\n opts.useAuthorizationHeader = opts.useAuthorizationHeader ?? true;\n }\n\n public abort(): void {\n this.abortController.abort();\n this.abortController = new AbortController();\n }\n\n public fetch(resource: URL | string, options?: RequestInit): ReturnType {\n if (this.opts.fetchFn) {\n return this.opts.fetchFn(resource, options);\n }\n return global.fetch(resource, options);\n }\n\n /**\n * Sets the base URL for the identity server\n * @param url - The new base url\n */\n public setIdBaseUrl(url: string): void {\n this.opts.idBaseUrl = url;\n }\n\n public idServerRequest>(\n method: Method,\n path: string,\n params: Record | undefined,\n prefix: string,\n accessToken?: string,\n ): Promise> {\n if (!this.opts.idBaseUrl) {\n throw new Error(\"No identity server base URL set\");\n }\n\n let queryParams: QueryDict | undefined = undefined;\n let body: Record | undefined = undefined;\n if (method === Method.Get) {\n queryParams = params;\n } else {\n body = params;\n }\n\n const fullUri = this.getUrl(path, queryParams, prefix, this.opts.idBaseUrl);\n\n const opts: IRequestOpts = {\n json: true,\n headers: {},\n };\n if (accessToken) {\n opts.headers!.Authorization = `Bearer ${accessToken}`;\n }\n\n return this.requestOtherUrl(method, fullUri, body, opts);\n }\n\n /**\n * Perform an authorised request to the homeserver.\n * @param method - The HTTP method e.g. \"GET\".\n * @param path - The HTTP path after the supplied prefix e.g.\n * \"/createRoom\".\n *\n * @param queryParams - A dict of query params (these will NOT be\n * urlencoded). If unspecified, there will be no query params.\n *\n * @param body - The HTTP JSON body.\n *\n * @param opts - additional options. If a number is specified,\n * this is treated as `opts.localTimeoutMs`.\n *\n * @returns Promise which resolves to\n * ```\n * {\n * data: {Object},\n * headers: {Object},\n * code: {Number},\n * }\n * ```\n * If `onlyData` is set, this will resolve to the `data` object only.\n * @returns Rejects with an error if a problem occurred.\n * This includes network problems and Matrix-specific error JSON.\n */\n public authedRequest(\n method: Method,\n path: string,\n queryParams?: QueryDict,\n body?: Body,\n opts: IRequestOpts = {},\n ): Promise> {\n if (!queryParams) queryParams = {};\n\n if (this.opts.accessToken) {\n if (this.opts.useAuthorizationHeader) {\n if (!opts.headers) {\n opts.headers = {};\n }\n if (!opts.headers.Authorization) {\n opts.headers.Authorization = \"Bearer \" + this.opts.accessToken;\n }\n if (queryParams.access_token) {\n delete queryParams.access_token;\n }\n } else if (!queryParams.access_token) {\n queryParams.access_token = this.opts.accessToken;\n }\n }\n\n const requestPromise = this.request(method, path, queryParams, body, opts);\n\n requestPromise.catch((err: MatrixError) => {\n if (err.errcode == \"M_UNKNOWN_TOKEN\" && !opts?.inhibitLogoutEmit) {\n this.eventEmitter.emit(HttpApiEvent.SessionLoggedOut, err);\n } else if (err.errcode == \"M_CONSENT_NOT_GIVEN\") {\n this.eventEmitter.emit(HttpApiEvent.NoConsent, err.message, err.data.consent_uri);\n }\n });\n\n // return the original promise, otherwise tests break due to it having to\n // go around the event loop one more time to process the result of the request\n return requestPromise;\n }\n\n /**\n * Perform a request to the homeserver without any credentials.\n * @param method - The HTTP method e.g. \"GET\".\n * @param path - The HTTP path after the supplied prefix e.g.\n * \"/createRoom\".\n *\n * @param queryParams - A dict of query params (these will NOT be\n * urlencoded). If unspecified, there will be no query params.\n *\n * @param body - The HTTP JSON body.\n *\n * @param opts - additional options\n *\n * @returns Promise which resolves to\n * ```\n * {\n * data: {Object},\n * headers: {Object},\n * code: {Number},\n * }\n * ```\n * If `onlyData is set, this will resolve to the data`\n * object only.\n * @returns Rejects with an error if a problem\n * occurred. This includes network problems and Matrix-specific error JSON.\n */\n public request(\n method: Method,\n path: string,\n queryParams?: QueryDict,\n body?: Body,\n opts?: IRequestOpts,\n ): Promise> {\n const fullUri = this.getUrl(path, queryParams, opts?.prefix, opts?.baseUrl);\n return this.requestOtherUrl(method, fullUri, body, opts);\n }\n\n /**\n * Perform a request to an arbitrary URL.\n * @param method - The HTTP method e.g. \"GET\".\n * @param url - The HTTP URL object.\n *\n * @param body - The HTTP JSON body.\n *\n * @param opts - additional options\n *\n * @returns Promise which resolves to data unless `onlyData` is specified as false,\n * where the resolved value will be a fetch Response object.\n * @returns Rejects with an error if a problem\n * occurred. This includes network problems and Matrix-specific error JSON.\n */\n public async requestOtherUrl(\n method: Method,\n url: URL | string,\n body?: Body,\n opts: Pick = {},\n ): Promise> {\n const headers = Object.assign({}, opts.headers || {});\n const json = opts.json ?? true;\n // We can't use getPrototypeOf here as objects made in other contexts e.g. over postMessage won't have same ref\n const jsonBody = json && body?.constructor?.name === Object.name;\n\n if (json) {\n if (jsonBody && !headers[\"Content-Type\"]) {\n headers[\"Content-Type\"] = \"application/json\";\n }\n\n if (!headers[\"Accept\"]) {\n headers[\"Accept\"] = \"application/json\";\n }\n }\n\n const timeout = opts.localTimeoutMs ?? this.opts.localTimeoutMs;\n const keepAlive = opts.keepAlive ?? false;\n const signals = [this.abortController.signal];\n if (timeout !== undefined) {\n signals.push(timeoutSignal(timeout));\n }\n if (opts.abortSignal) {\n signals.push(opts.abortSignal);\n }\n\n let data: BodyInit;\n if (jsonBody) {\n data = JSON.stringify(body);\n } else {\n data = body as BodyInit;\n }\n\n const { signal, cleanup } = anySignal(signals);\n\n let res: Response;\n try {\n res = await this.fetch(url, {\n signal,\n method,\n body: data,\n headers,\n mode: \"cors\",\n redirect: \"follow\",\n referrer: \"\",\n referrerPolicy: \"no-referrer\",\n cache: \"no-cache\",\n credentials: \"omit\", // we send credentials via headers\n keepalive: keepAlive,\n });\n } catch (e) {\n if ((e).name === \"AbortError\") {\n throw e;\n }\n throw new ConnectionError(\"fetch failed\", e);\n } finally {\n cleanup();\n }\n\n if (!res.ok) {\n throw parseErrorResponse(res, await res.text());\n }\n\n if (this.opts.onlyData) {\n return json ? res.json() : res.text();\n }\n return res as ResponseType;\n }\n\n /**\n * Form and return a homeserver request URL based on the given path params and prefix.\n * @param path - The HTTP path after the supplied prefix e.g. \"/createRoom\".\n * @param queryParams - A dict of query params (these will NOT be urlencoded).\n * @param prefix - The full prefix to use e.g. \"/_matrix/client/v2_alpha\", defaulting to this.opts.prefix.\n * @param baseUrl - The baseUrl to use e.g. \"https://matrix.org/\", defaulting to this.opts.baseUrl.\n * @returns URL\n */\n public getUrl(path: string, queryParams?: QueryDict, prefix?: string, baseUrl?: string): URL {\n const url = new URL((baseUrl ?? this.opts.baseUrl) + (prefix ?? this.opts.prefix) + path);\n if (queryParams) {\n utils.encodeParams(queryParams, url.searchParams);\n }\n return url;\n }\n}\n"],"mappings":";;;;;;;;AAoBA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAAuE,SAAAK,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAP,wBAAAW,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,o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AAI,IAAI,CAAClD,IAAI,CAACkD,OAAO,KAAK7B,MAAM,aAANA,MAAM,cAANA,MAAM,GAAI,IAAI,CAACrB,IAAI,CAACqB,MAAM,CAAC,GAAGF,IAAI,CAAC;IACzF,IAAIK,WAAW,EAAE;MACbxD,KAAK,CAACmH,YAAY,CAAC3D,WAAW,EAAET,GAAG,CAACqE,YAAY,CAAC;IACrD;IACA,OAAOrE,GAAG;EACd;AACJ;AAACsE,OAAA,CAAAxF,YAAA,GAAAA,YAAA"} \ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/index.d.ts b/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/index.d.ts new file mode 100644 index 0000000..0825c4e --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/index.d.ts @@ -0,0 +1,33 @@ +import { FetchHttpApi } from "./fetch"; +import { FileType, IContentUri, IHttpOpts, Upload, UploadOpts, UploadResponse } from "./interface"; +export * from "./interface"; +export * from "./prefix"; +export * from "./errors"; +export * from "./method"; +export * from "./utils"; +export declare class MatrixHttpApi extends FetchHttpApi { + private uploads; + /** + * Upload content to the homeserver + * + * @param file - The object to upload. On a browser, something that + * can be sent to XMLHttpRequest.send (typically a File). Under node.js, + * a Buffer, String or ReadStream. + * + * @param opts - options object + * + * @returns Promise which resolves to response object, as + * determined by this.opts.onlyData, opts.rawResponse, and + * opts.onlyContentUri. Rejects with an error (usually a MatrixError). + */ + uploadContent(file: FileType, opts?: UploadOpts): Promise; + cancelUpload(promise: Promise): boolean; + getCurrentUploads(): Upload[]; + /** + * Get the content repository url with query parameters. + * @returns An object with a 'base', 'path' and 'params' for base URL, + * path and query parameters respectively. + */ + getContentUri(): IContentUri; +} +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/index.d.ts.map b/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/index.d.ts.map new file mode 100644 index 0000000..e8dd81a --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/http-api/index.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAQnG,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AAExB,qBAAa,aAAa,CAAC,CAAC,SAAS,SAAS,CAAE,SAAQ,YAAY,CAAC,CAAC,CAAC;IACnE,OAAO,CAAC,OAAO,CAAgB;IAE/B;;;;;;;;;;;;OAYG;IACI,aAAa,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,GAAE,UAAe,GAAG,OAAO,CAAC,cAAc,CAAC;IAoH7E,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG,OAAO;IASvD,iBAAiB,IAAI,MAAM,EAAE;IAIpC;;;;OAIG;IACI,aAAa,IAAI,WAAW;CAStC"} \ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/index.js b/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/index.js new file mode 100644 index 0000000..ec2a00c --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/index.js @@ -0,0 +1,244 @@ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); +Object.defineProperty(exports, "__esModule", { + value: true +}); +var _exportNames = { + MatrixHttpApi: true +}; +exports.MatrixHttpApi = void 0; +var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); +var _fetch = require("./fetch"); +var _prefix = require("./prefix"); +Object.keys(_prefix).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; + if (key in exports && exports[key] === _prefix[key]) return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function () { + return _prefix[key]; + } + }); +}); +var utils = _interopRequireWildcard(require("../utils")); +var callbacks = _interopRequireWildcard(require("../realtime-callbacks")); +var _method = require("./method"); +Object.keys(_method).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; + if (key in exports && exports[key] === _method[key]) return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function () { + return _method[key]; + } + }); +}); +var _errors = require("./errors"); +Object.keys(_errors).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; + if (key in exports && exports[key] === _errors[key]) return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function () { + return _errors[key]; + } + }); +}); +var _utils2 = require("./utils"); +Object.keys(_utils2).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; + if (key in exports && exports[key] === _utils2[key]) return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function () { + return _utils2[key]; + } + }); +}); +var _interface = require("./interface"); +Object.keys(_interface).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; + if (key in exports && exports[key] === _interface[key]) return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function () { + return _interface[key]; + } + }); +}); +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } +/* +Copyright 2022 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. +*/ + +class MatrixHttpApi extends _fetch.FetchHttpApi { + constructor(...args) { + super(...args); + (0, _defineProperty2.default)(this, "uploads", []); + } + /** + * Upload content to the homeserver + * + * @param file - The object to upload. On a browser, something that + * can be sent to XMLHttpRequest.send (typically a File). Under node.js, + * a Buffer, String or ReadStream. + * + * @param opts - options object + * + * @returns Promise which resolves to response object, as + * determined by this.opts.onlyData, opts.rawResponse, and + * opts.onlyContentUri. Rejects with an error (usually a MatrixError). + */ + uploadContent(file, opts = {}) { + var _opts$includeFilename, _opts$abortController, _ref, _opts$type, _opts$name; + const includeFilename = (_opts$includeFilename = opts.includeFilename) !== null && _opts$includeFilename !== void 0 ? _opts$includeFilename : true; + const abortController = (_opts$abortController = opts.abortController) !== null && _opts$abortController !== void 0 ? _opts$abortController : new AbortController(); + + // If the file doesn't have a mime type, use a default since the HS errors if we don't supply one. + const contentType = (_ref = (_opts$type = opts.type) !== null && _opts$type !== void 0 ? _opts$type : file.type) !== null && _ref !== void 0 ? _ref : "application/octet-stream"; + const fileName = (_opts$name = opts.name) !== null && _opts$name !== void 0 ? _opts$name : file.name; + const upload = { + loaded: 0, + total: 0, + abortController + }; + const defer = utils.defer(); + if (global.XMLHttpRequest) { + const xhr = new global.XMLHttpRequest(); + const timeoutFn = function () { + xhr.abort(); + defer.reject(new Error("Timeout")); + }; + + // set an initial timeout of 30s; we'll advance it each time we get a progress notification + let timeoutTimer = callbacks.setTimeout(timeoutFn, 30000); + xhr.onreadystatechange = function () { + switch (xhr.readyState) { + case global.XMLHttpRequest.DONE: + callbacks.clearTimeout(timeoutTimer); + try { + if (xhr.status === 0) { + throw new DOMException(xhr.statusText, "AbortError"); // mimic fetch API + } + + if (!xhr.responseText) { + throw new Error("No response body."); + } + if (xhr.status >= 400) { + defer.reject((0, _utils2.parseErrorResponse)(xhr, xhr.responseText)); + } else { + defer.resolve(JSON.parse(xhr.responseText)); + } + } catch (err) { + if (err.name === "AbortError") { + defer.reject(err); + return; + } + defer.reject(new _errors.ConnectionError("request failed", err)); + } + break; + } + }; + xhr.upload.onprogress = ev => { + var _opts$progressHandler; + callbacks.clearTimeout(timeoutTimer); + upload.loaded = ev.loaded; + upload.total = ev.total; + timeoutTimer = callbacks.setTimeout(timeoutFn, 30000); + (_opts$progressHandler = opts.progressHandler) === null || _opts$progressHandler === void 0 ? void 0 : _opts$progressHandler.call(opts, { + loaded: ev.loaded, + total: ev.total + }); + }; + const url = this.getUrl("/upload", undefined, _prefix.MediaPrefix.R0); + if (includeFilename && fileName) { + url.searchParams.set("filename", encodeURIComponent(fileName)); + } + if (!this.opts.useAuthorizationHeader && this.opts.accessToken) { + url.searchParams.set("access_token", encodeURIComponent(this.opts.accessToken)); + } + xhr.open(_method.Method.Post, url.href); + if (this.opts.useAuthorizationHeader && this.opts.accessToken) { + xhr.setRequestHeader("Authorization", "Bearer " + this.opts.accessToken); + } + xhr.setRequestHeader("Content-Type", contentType); + xhr.send(file); + abortController.signal.addEventListener("abort", () => { + xhr.abort(); + }); + } else { + const queryParams = {}; + if (includeFilename && fileName) { + queryParams.filename = fileName; + } + const headers = { + "Content-Type": contentType + }; + this.authedRequest(_method.Method.Post, "/upload", queryParams, file, { + prefix: _prefix.MediaPrefix.R0, + headers, + abortSignal: abortController.signal + }).then(response => { + return this.opts.onlyData ? response : response.json(); + }).then(defer.resolve, defer.reject); + } + + // remove the upload from the list on completion + upload.promise = defer.promise.finally(() => { + utils.removeElement(this.uploads, elem => elem === upload); + }); + abortController.signal.addEventListener("abort", () => { + utils.removeElement(this.uploads, elem => elem === upload); + defer.reject(new DOMException("Aborted", "AbortError")); + }); + this.uploads.push(upload); + return upload.promise; + } + cancelUpload(promise) { + const upload = this.uploads.find(u => u.promise === promise); + if (upload) { + upload.abortController.abort(); + return true; + } + return false; + } + getCurrentUploads() { + return this.uploads; + } + + /** + * Get the content repository url with query parameters. + * @returns An object with a 'base', 'path' and 'params' for base URL, + * path and query parameters respectively. + */ + getContentUri() { + return { + base: this.opts.baseUrl, + path: _prefix.MediaPrefix.R0 + "/upload", + params: { + access_token: this.opts.accessToken + } + }; + } +} +exports.MatrixHttpApi = MatrixHttpApi; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/index.js.map b/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/index.js.map new file mode 100644 index 0000000..f497156 --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","names":["_fetch","require","_prefix","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","utils","_interopRequireWildcard","callbacks","_method","_errors","_utils2","_interface","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","newObj","hasPropertyDescriptor","getOwnPropertyDescriptor","desc","set","MatrixHttpApi","FetchHttpApi","constructor","args","_defineProperty2","uploadContent","file","opts","_opts$includeFilename","_opts$abortController","_ref","_opts$type","_opts$name","includeFilename","abortController","AbortController","contentType","type","fileName","name","upload","loaded","total","defer","global","XMLHttpRequest","xhr","timeoutFn","abort","reject","Error","timeoutTimer","setTimeout","onreadystatechange","readyState","DONE","clearTimeout","status","DOMException","statusText","responseText","parseErrorResponse","resolve","JSON","parse","err","ConnectionError","onprogress","ev","_opts$progressHandler","progressHandler","url","getUrl","undefined","MediaPrefix","R0","searchParams","encodeURIComponent","useAuthorizationHeader","accessToken","open","Method","Post","href","setRequestHeader","send","signal","addEventListener","queryParams","filename","headers","authedRequest","prefix","abortSignal","then","response","onlyData","json","promise","finally","removeElement","uploads","elem","push","cancelUpload","find","u","getCurrentUploads","getContentUri","base","baseUrl","path","params","access_token"],"sources":["../../src/http-api/index.ts"],"sourcesContent":["/*\nCopyright 2022 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { FetchHttpApi } from \"./fetch\";\nimport { FileType, IContentUri, IHttpOpts, Upload, UploadOpts, UploadResponse } from \"./interface\";\nimport { MediaPrefix } from \"./prefix\";\nimport * as utils from \"../utils\";\nimport * as callbacks from \"../realtime-callbacks\";\nimport { Method } from \"./method\";\nimport { ConnectionError } from \"./errors\";\nimport { parseErrorResponse } from \"./utils\";\n\nexport * from \"./interface\";\nexport * from \"./prefix\";\nexport * from \"./errors\";\nexport * from \"./method\";\nexport * from \"./utils\";\n\nexport class MatrixHttpApi extends FetchHttpApi {\n private uploads: Upload[] = [];\n\n /**\n * Upload content to the homeserver\n *\n * @param file - The object to upload. On a browser, something that\n * can be sent to XMLHttpRequest.send (typically a File). Under node.js,\n * a Buffer, String or ReadStream.\n *\n * @param opts - options object\n *\n * @returns Promise which resolves to response object, as\n * determined by this.opts.onlyData, opts.rawResponse, and\n * opts.onlyContentUri. Rejects with an error (usually a MatrixError).\n */\n public uploadContent(file: FileType, opts: UploadOpts = {}): Promise {\n const includeFilename = opts.includeFilename ?? true;\n const abortController = opts.abortController ?? new AbortController();\n\n // If the file doesn't have a mime type, use a default since the HS errors if we don't supply one.\n const contentType = opts.type ?? (file as File).type ?? \"application/octet-stream\";\n const fileName = opts.name ?? (file as File).name;\n\n const upload = {\n loaded: 0,\n total: 0,\n abortController,\n } as Upload;\n const defer = utils.defer();\n\n if (global.XMLHttpRequest) {\n const xhr = new global.XMLHttpRequest();\n\n const timeoutFn = function (): void {\n xhr.abort();\n defer.reject(new Error(\"Timeout\"));\n };\n\n // set an initial timeout of 30s; we'll advance it each time we get a progress notification\n let timeoutTimer = callbacks.setTimeout(timeoutFn, 30000);\n\n xhr.onreadystatechange = function (): void {\n switch (xhr.readyState) {\n case global.XMLHttpRequest.DONE:\n callbacks.clearTimeout(timeoutTimer);\n try {\n if (xhr.status === 0) {\n throw new DOMException(xhr.statusText, \"AbortError\"); // mimic fetch API\n }\n if (!xhr.responseText) {\n throw new Error(\"No response body.\");\n }\n\n if (xhr.status >= 400) {\n defer.reject(parseErrorResponse(xhr, xhr.responseText));\n } else {\n defer.resolve(JSON.parse(xhr.responseText));\n }\n } catch (err) {\n if ((err).name === \"AbortError\") {\n defer.reject(err);\n return;\n }\n defer.reject(new ConnectionError(\"request failed\", err));\n }\n break;\n }\n };\n\n xhr.upload.onprogress = (ev: ProgressEvent): void => {\n callbacks.clearTimeout(timeoutTimer);\n upload.loaded = ev.loaded;\n upload.total = ev.total;\n timeoutTimer = callbacks.setTimeout(timeoutFn, 30000);\n opts.progressHandler?.({\n loaded: ev.loaded,\n total: ev.total,\n });\n };\n\n const url = this.getUrl(\"/upload\", undefined, MediaPrefix.R0);\n\n if (includeFilename && fileName) {\n url.searchParams.set(\"filename\", encodeURIComponent(fileName));\n }\n\n if (!this.opts.useAuthorizationHeader && this.opts.accessToken) {\n url.searchParams.set(\"access_token\", encodeURIComponent(this.opts.accessToken));\n }\n\n xhr.open(Method.Post, url.href);\n if (this.opts.useAuthorizationHeader && this.opts.accessToken) {\n xhr.setRequestHeader(\"Authorization\", \"Bearer \" + this.opts.accessToken);\n }\n xhr.setRequestHeader(\"Content-Type\", contentType);\n xhr.send(file);\n\n abortController.signal.addEventListener(\"abort\", () => {\n xhr.abort();\n });\n } else {\n const queryParams: utils.QueryDict = {};\n if (includeFilename && fileName) {\n queryParams.filename = fileName;\n }\n\n const headers: Record = { \"Content-Type\": contentType };\n\n this.authedRequest(Method.Post, \"/upload\", queryParams, file, {\n prefix: MediaPrefix.R0,\n headers,\n abortSignal: abortController.signal,\n })\n .then((response) => {\n return this.opts.onlyData ? response : response.json();\n })\n .then(defer.resolve, defer.reject);\n }\n\n // remove the upload from the list on completion\n upload.promise = defer.promise.finally(() => {\n utils.removeElement(this.uploads, (elem) => elem === upload);\n });\n abortController.signal.addEventListener(\"abort\", () => {\n utils.removeElement(this.uploads, (elem) => elem === upload);\n defer.reject(new DOMException(\"Aborted\", \"AbortError\"));\n });\n this.uploads.push(upload);\n return upload.promise;\n }\n\n public cancelUpload(promise: Promise): boolean {\n const upload = this.uploads.find((u) => u.promise === promise);\n if (upload) {\n upload.abortController.abort();\n return true;\n }\n return false;\n }\n\n public getCurrentUploads(): Upload[] {\n return this.uploads;\n }\n\n /**\n * Get the content repository url with query parameters.\n * @returns An object with a 'base', 'path' and 'params' for base URL,\n * path and query parameters respectively.\n */\n public getContentUri(): IContentUri {\n return {\n base: this.opts.baseUrl,\n path: MediaPrefix.R0 + \"/upload\",\n params: {\n access_token: this.opts.accessToken!,\n },\n };\n }\n}\n"],"mappings":";;;;;;;;;;;AAgBA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAD,OAAA;AAQAE,MAAA,CAAAC,IAAA,CAA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CAACN,eAAe,CAACc,KAAK,EAAE;MAC9B,OAAO,IAAI;IACf;IACA,OAAO,KAAK;EAChB;EAEO2D,iBAAiBA,CAAA,EAAa;IACjC,OAAO,IAAI,CAACN,OAAO;EACvB;;EAEA;AACJ;AACA;AACA;AACA;EACWO,aAAaA,CAAA,EAAgB;IAChC,OAAO;MACHC,IAAI,EAAE,IAAI,CAAClF,IAAI,CAACmF,OAAO;MACvBC,IAAI,EAAErC,mBAAW,CAACC,EAAE,GAAG,SAAS;MAChCqC,MAAM,EAAE;QACJC,YAAY,EAAE,IAAI,CAACtF,IAAI,CAACoD;MAC5B;IACJ,CAAC;EACL;AACJ;AAACrF,OAAA,CAAA0B,aAAA,GAAAA,aAAA"} \ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/interface.d.ts b/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/interface.d.ts new file mode 100644 index 0000000..321a67e --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/interface.d.ts @@ -0,0 +1,113 @@ +import { MatrixError } from "./errors"; +export interface IHttpOpts { + fetchFn?: typeof global.fetch; + baseUrl: string; + idBaseUrl?: string; + prefix: string; + extraParams?: Record; + accessToken?: string; + useAuthorizationHeader?: boolean; + onlyData?: boolean; + localTimeoutMs?: number; +} +export interface IRequestOpts { + /** + * The alternative base url to use. + * If not specified, uses this.opts.baseUrl + */ + baseUrl?: string; + /** + * The full prefix to use e.g. + * "/_matrix/client/v2_alpha". If not specified, uses this.opts.prefix. + */ + prefix?: string; + /** + * map of additional request headers + */ + headers?: Record; + abortSignal?: AbortSignal; + /** + * The maximum amount of time to wait before + * timing out the request. If not specified, there is no timeout. + */ + localTimeoutMs?: number; + keepAlive?: boolean; + json?: boolean; + inhibitLogoutEmit?: boolean; +} +export interface IContentUri { + base: string; + path: string; + params: { + access_token: string; + }; +} +export declare enum HttpApiEvent { + SessionLoggedOut = "Session.logged_out", + NoConsent = "no_consent" +} +export type HttpApiEventHandlerMap = { + /** + * Fires whenever the login session the JS SDK is using is no + * longer valid and the user must log in again. + * NB. This only fires when action is required from the user, not + * when then login session can be renewed by using a refresh token. + * @example + * ``` + * matrixClient.on("Session.logged_out", function(errorObj){ + * // show the login screen + * }); + * ``` + */ + [HttpApiEvent.SessionLoggedOut]: (err: MatrixError) => void; + /** + * Fires when the JS SDK receives a M_CONSENT_NOT_GIVEN error in response + * to a HTTP request. + * @example + * ``` + * matrixClient.on("no_consent", function(message, contentUri) { + * console.info(message + ' Go to ' + contentUri); + * }); + * ``` + */ + [HttpApiEvent.NoConsent]: (message: string, consentUri: string) => void; +}; +export interface UploadProgress { + loaded: number; + total: number; +} +export interface UploadOpts { + /** + * Name to give the file on the server. Defaults to file.name. + */ + name?: string; + /** + * Content-type for the upload. Defaults to + * file.type, or applicaton/octet-stream. + */ + type?: string; + /** + * if false will not send the filename, + * e.g for encrypted file uploads where filename leaks are undesirable. + * Defaults to true. + */ + includeFilename?: boolean; + /** + * Optional. Called when a chunk of + * data has been uploaded, with an object containing the fields `loaded` + * (number of bytes transferred) and `total` (total size, if known). + */ + progressHandler?(progress: UploadProgress): void; + abortController?: AbortController; +} +export interface Upload { + loaded: number; + total: number; + promise: Promise; + abortController: AbortController; +} +export interface UploadResponse { + content_uri: string; +} +export type FileType = XMLHttpRequestBodyInit; +//# sourceMappingURL=interface.d.ts.map \ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/interface.d.ts.map b/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/interface.d.ts.map new file mode 100644 index 0000000..47f3140 --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/interface.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../src/http-api/interface.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,MAAM,WAAW,SAAS;IACtB,OAAO,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AK,IAAI,CAAC;CAC3E,CAAC;AAEF,MAAM,WAAW,cAAc;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,UAAU;IACvB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;OAIG;IACH,eAAe,CAAC,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI,CAAC;IACjD,eAAe,CAAC,EAAE,eAAe,CAAC;CACrC;AAED,MAAM,WAAW,MAAM;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IACjC,eAAe,EAAE,eAAe,CAAC;CACpC;AAED,MAAM,WAAW,cAAc;IAE3B,WAAW,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,MAAM,QAAQ,GAAG,sBAAsB,CAAC"} \ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/interface.js b/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/interface.js new file mode 100644 index 0000000..9510b45 --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/interface.js @@ -0,0 +1,28 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.HttpApiEvent = void 0; +/* +Copyright 2022 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. +*/ +let HttpApiEvent; +exports.HttpApiEvent = HttpApiEvent; +(function (HttpApiEvent) { + HttpApiEvent["SessionLoggedOut"] = "Session.logged_out"; + HttpApiEvent["NoConsent"] = "no_consent"; +})(HttpApiEvent || (exports.HttpApiEvent = HttpApiEvent = {})); +//# sourceMappingURL=interface.js.map \ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/interface.js.map b/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/interface.js.map new file mode 100644 index 0000000..06baa9f --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/interface.js.map @@ -0,0 +1 @@ +{"version":3,"file":"interface.js","names":["HttpApiEvent","exports"],"sources":["../../src/http-api/interface.ts"],"sourcesContent":["/*\nCopyright 2022 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { MatrixError } from \"./errors\";\n\nexport interface IHttpOpts {\n fetchFn?: typeof global.fetch;\n\n baseUrl: string;\n idBaseUrl?: string;\n prefix: string;\n extraParams?: Record;\n\n accessToken?: string;\n useAuthorizationHeader?: boolean; // defaults to true\n\n onlyData?: boolean;\n localTimeoutMs?: number;\n}\n\nexport interface IRequestOpts {\n /**\n * The alternative base url to use.\n * If not specified, uses this.opts.baseUrl\n */\n baseUrl?: string;\n /**\n * The full prefix to use e.g.\n * \"/_matrix/client/v2_alpha\". If not specified, uses this.opts.prefix.\n */\n prefix?: string;\n /**\n * map of additional request headers\n */\n headers?: Record;\n abortSignal?: AbortSignal;\n /**\n * The maximum amount of time to wait before\n * timing out the request. If not specified, there is no timeout.\n */\n localTimeoutMs?: number;\n keepAlive?: boolean; // defaults to false\n json?: boolean; // defaults to true\n\n // Set to true to prevent the request function from emitting a Session.logged_out event.\n // This is intended for use on endpoints where M_UNKNOWN_TOKEN is a valid/notable error response,\n // such as with token refreshes.\n inhibitLogoutEmit?: boolean;\n}\n\nexport interface IContentUri {\n base: string;\n path: string;\n params: {\n // eslint-disable-next-line camelcase\n access_token: string;\n };\n}\n\nexport enum HttpApiEvent {\n SessionLoggedOut = \"Session.logged_out\",\n NoConsent = \"no_consent\",\n}\n\nexport type HttpApiEventHandlerMap = {\n /**\n * Fires whenever the login session the JS SDK is using is no\n * longer valid and the user must log in again.\n * NB. This only fires when action is required from the user, not\n * when then login session can be renewed by using a refresh token.\n * @example\n * ```\n * matrixClient.on(\"Session.logged_out\", function(errorObj){\n * // show the login screen\n * });\n * ```\n */\n [HttpApiEvent.SessionLoggedOut]: (err: MatrixError) => void;\n /**\n * Fires when the JS SDK receives a M_CONSENT_NOT_GIVEN error in response\n * to a HTTP request.\n * @example\n * ```\n * matrixClient.on(\"no_consent\", function(message, contentUri) {\n * console.info(message + ' Go to ' + contentUri);\n * });\n * ```\n */\n [HttpApiEvent.NoConsent]: (message: string, consentUri: string) => void;\n};\n\nexport interface UploadProgress {\n loaded: number;\n total: number;\n}\n\nexport interface UploadOpts {\n /**\n * Name to give the file on the server. Defaults to file.name.\n */\n name?: string;\n /**\n * Content-type for the upload. Defaults to\n * file.type, or applicaton/octet-stream.\n */\n type?: string;\n /**\n * if false will not send the filename,\n * e.g for encrypted file uploads where filename leaks are undesirable.\n * Defaults to true.\n */\n includeFilename?: boolean;\n /**\n * Optional. Called when a chunk of\n * data has been uploaded, with an object containing the fields `loaded`\n * (number of bytes transferred) and `total` (total size, if known).\n */\n progressHandler?(progress: UploadProgress): void;\n abortController?: AbortController;\n}\n\nexport interface Upload {\n loaded: number;\n total: number;\n promise: Promise;\n abortController: AbortController;\n}\n\nexport interface UploadResponse {\n // eslint-disable-next-line camelcase\n content_uri: string;\n}\n\nexport type FileType = XMLHttpRequestBodyInit;\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAdA,IAwEYA,YAAY;AAAAC,OAAA,CAAAD,YAAA,GAAAA,YAAA;AAAA,WAAZA,YAAY;EAAZA,YAAY;EAAZA,YAAY;AAAA,GAAZA,YAAY,KAAAC,OAAA,CAAAD,YAAA,GAAZA,YAAY"} \ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/method.d.ts b/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/method.d.ts new file mode 100644 index 0000000..6cf2bd8 --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/method.d.ts @@ -0,0 +1,7 @@ +export declare enum Method { + Get = "GET", + Put = "PUT", + Post = "POST", + Delete = "DELETE" +} +//# sourceMappingURL=method.d.ts.map \ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/method.d.ts.map b/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/method.d.ts.map new file mode 100644 index 0000000..d03e27b --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/method.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"method.d.ts","sourceRoot":"","sources":["../../src/http-api/method.ts"],"names":[],"mappings":"AAgBA,oBAAY,MAAM;IACd,GAAG,QAAQ;IACX,GAAG,QAAQ;IACX,IAAI,SAAS;IACb,MAAM,WAAW;CACpB"} \ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/method.js b/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/method.js new file mode 100644 index 0000000..a72c48b --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/method.js @@ -0,0 +1,30 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.Method = void 0; +/* +Copyright 2022 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. +*/ +let Method; +exports.Method = Method; +(function (Method) { + Method["Get"] = "GET"; + Method["Put"] = "PUT"; + Method["Post"] = "POST"; + Method["Delete"] = "DELETE"; +})(Method || (exports.Method = Method = {})); +//# sourceMappingURL=method.js.map \ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/method.js.map b/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/method.js.map new file mode 100644 index 0000000..2cbf2f5 --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/method.js.map @@ -0,0 +1 @@ +{"version":3,"file":"method.js","names":["Method","exports"],"sources":["../../src/http-api/method.ts"],"sourcesContent":["/*\nCopyright 2022 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nexport enum Method {\n Get = \"GET\",\n Put = \"PUT\",\n Post = \"POST\",\n Delete = \"DELETE\",\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAdA,IAgBYA,MAAM;AAAAC,OAAA,CAAAD,MAAA,GAAAA,MAAA;AAAA,WAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;AAAA,GAANA,MAAM,KAAAC,OAAA,CAAAD,MAAA,GAANA,MAAM"} \ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/prefix.d.ts b/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/prefix.d.ts new file mode 100644 index 0000000..e12d6a7 --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/prefix.d.ts @@ -0,0 +1,31 @@ +export declare enum ClientPrefix { + /** + * A constant representing the URI path for release 0 of the Client-Server HTTP API. + */ + R0 = "/_matrix/client/r0", + /** + * A constant representing the URI path for the legacy release v1 of the Client-Server HTTP API. + */ + V1 = "/_matrix/client/v1", + /** + * A constant representing the URI path for Client-Server API endpoints versioned at v3. + */ + V3 = "/_matrix/client/v3", + /** + * A constant representing the URI path for as-yet unspecified Client-Server HTTP APIs. + */ + Unstable = "/_matrix/client/unstable" +} +export declare enum IdentityPrefix { + /** + * URI path for the v2 identity API + */ + V2 = "/_matrix/identity/v2" +} +export declare enum MediaPrefix { + /** + * URI path for the media repo API + */ + R0 = "/_matrix/media/r0" +} +//# sourceMappingURL=prefix.d.ts.map \ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/prefix.d.ts.map b/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/prefix.d.ts.map new file mode 100644 index 0000000..a5a4d0c --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/prefix.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"prefix.d.ts","sourceRoot":"","sources":["../../src/http-api/prefix.ts"],"names":[],"mappings":"AAgBA,oBAAY,YAAY;IACpB;;OAEG;IACH,EAAE,uBAAuB;IACzB;;OAEG;IACH,EAAE,uBAAuB;IACzB;;OAEG;IACH,EAAE,uBAAuB;IACzB;;OAEG;IACH,QAAQ,6BAA6B;CACxC;AAED,oBAAY,cAAc;IACtB;;OAEG;IACH,EAAE,yBAAyB;CAC9B;AAED,oBAAY,WAAW;IACnB;;OAEG;IACH,EAAE,sBAAsB;CAC3B"} \ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/prefix.js b/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/prefix.js new file mode 100644 index 0000000..7db19ba --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/prefix.js @@ -0,0 +1,40 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.MediaPrefix = exports.IdentityPrefix = exports.ClientPrefix = void 0; +/* +Copyright 2022 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. +*/ +let ClientPrefix; +exports.ClientPrefix = ClientPrefix; +(function (ClientPrefix) { + ClientPrefix["R0"] = "/_matrix/client/r0"; + ClientPrefix["V1"] = "/_matrix/client/v1"; + ClientPrefix["V3"] = "/_matrix/client/v3"; + ClientPrefix["Unstable"] = "/_matrix/client/unstable"; +})(ClientPrefix || (exports.ClientPrefix = ClientPrefix = {})); +let IdentityPrefix; +exports.IdentityPrefix = IdentityPrefix; +(function (IdentityPrefix) { + IdentityPrefix["V2"] = "/_matrix/identity/v2"; +})(IdentityPrefix || (exports.IdentityPrefix = IdentityPrefix = {})); +let MediaPrefix; +exports.MediaPrefix = MediaPrefix; +(function (MediaPrefix) { + MediaPrefix["R0"] = "/_matrix/media/r0"; +})(MediaPrefix || (exports.MediaPrefix = MediaPrefix = {})); +//# sourceMappingURL=prefix.js.map \ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/prefix.js.map b/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/prefix.js.map new file mode 100644 index 0000000..9a3e6d6 --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/prefix.js.map @@ -0,0 +1 @@ +{"version":3,"file":"prefix.js","names":["ClientPrefix","exports","IdentityPrefix","MediaPrefix"],"sources":["../../src/http-api/prefix.ts"],"sourcesContent":["/*\nCopyright 2022 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nexport enum ClientPrefix {\n /**\n * A constant representing the URI path for release 0 of the Client-Server HTTP API.\n */\n R0 = \"/_matrix/client/r0\",\n /**\n * A constant representing the URI path for the legacy release v1 of the Client-Server HTTP API.\n */\n V1 = \"/_matrix/client/v1\",\n /**\n * A constant representing the URI path for Client-Server API endpoints versioned at v3.\n */\n V3 = \"/_matrix/client/v3\",\n /**\n * A constant representing the URI path for as-yet unspecified Client-Server HTTP APIs.\n */\n Unstable = \"/_matrix/client/unstable\",\n}\n\nexport enum IdentityPrefix {\n /**\n * URI path for the v2 identity API\n */\n V2 = \"/_matrix/identity/v2\",\n}\n\nexport enum MediaPrefix {\n /**\n * URI path for the media repo API\n */\n R0 = \"/_matrix/media/r0\",\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAdA,IAgBYA,YAAY;AAAAC,OAAA,CAAAD,YAAA,GAAAA,YAAA;AAAA,WAAZA,YAAY;EAAZA,YAAY;EAAZA,YAAY;EAAZA,YAAY;EAAZA,YAAY;AAAA,GAAZA,YAAY,KAAAC,OAAA,CAAAD,YAAA,GAAZA,YAAY;AAAA,IAmBZE,cAAc;AAAAD,OAAA,CAAAC,cAAA,GAAAA,cAAA;AAAA,WAAdA,cAAc;EAAdA,cAAc;AAAA,GAAdA,cAAc,KAAAD,OAAA,CAAAC,cAAA,GAAdA,cAAc;AAAA,IAOdC,WAAW;AAAAF,OAAA,CAAAE,WAAA,GAAAA,WAAA;AAAA,WAAXA,WAAW;EAAXA,WAAW;AAAA,GAAXA,WAAW,KAAAF,OAAA,CAAAE,WAAA,GAAXA,WAAW"} \ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/utils.d.ts b/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/utils.d.ts new file mode 100644 index 0000000..0814e80 --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/utils.d.ts @@ -0,0 +1,25 @@ +export declare function timeoutSignal(ms: number): AbortSignal; +export declare function anySignal(signals: AbortSignal[]): { + signal: AbortSignal; + cleanup(): void; +}; +/** + * Attempt to turn an HTTP error response into a Javascript Error. + * + * If it is a JSON response, we will parse it into a MatrixError. Otherwise + * we return a generic Error. + * + * @param response - response object + * @param body - raw body of the response + * @returns + */ +export declare function parseErrorResponse(response: XMLHttpRequest | Response, body?: string): Error; +/** + * Retries a network operation run in a callback. + * @param maxAttempts - maximum attempts to try + * @param callback - callback that returns a promise of the network operation. If rejected with ConnectionError, it will be retried by calling the callback again. + * @returns the result of the network operation + * @throws {@link ConnectionError} If after maxAttempts the callback still throws ConnectionError + */ +export declare function retryNetworkOperation(maxAttempts: number, callback: () => Promise): Promise; +//# sourceMappingURL=utils.d.ts.map \ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/utils.d.ts.map b/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/utils.d.ts.map new file mode 100644 index 0000000..4ff990f --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/utils.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/http-api/utils.ts"],"names":[],"mappings":"AAuBA,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,WAAW,CAOrD;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,WAAW,EAAE,GAAG;IAC/C,MAAM,EAAE,WAAW,CAAC;IACpB,OAAO,IAAI,IAAI,CAAC;CACnB,CA0BA;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,cAAc,GAAG,QAAQ,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,KAAK,CAmB5F;AAgCD;;;;;;GAMG;AACH,wBAAsB,qBAAqB,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAqB1G"} \ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/utils.js b/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/utils.js new file mode 100644 index 0000000..9115598 --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/utils.js @@ -0,0 +1,145 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.anySignal = anySignal; +exports.parseErrorResponse = parseErrorResponse; +exports.retryNetworkOperation = retryNetworkOperation; +exports.timeoutSignal = timeoutSignal; +var _contentType3 = require("content-type"); +var _logger = require("../logger"); +var _utils = require("../utils"); +var _errors = require("./errors"); +/* +Copyright 2022 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. +*/ + +// Ponyfill for https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/timeout +function timeoutSignal(ms) { + const controller = new AbortController(); + setTimeout(() => { + controller.abort(); + }, ms); + return controller.signal; +} +function anySignal(signals) { + const controller = new AbortController(); + function cleanup() { + for (const signal of signals) { + signal.removeEventListener("abort", onAbort); + } + } + function onAbort() { + controller.abort(); + cleanup(); + } + for (const signal of signals) { + if (signal.aborted) { + onAbort(); + break; + } + signal.addEventListener("abort", onAbort); + } + return { + signal: controller.signal, + cleanup + }; +} + +/** + * Attempt to turn an HTTP error response into a Javascript Error. + * + * If it is a JSON response, we will parse it into a MatrixError. Otherwise + * we return a generic Error. + * + * @param response - response object + * @param body - raw body of the response + * @returns + */ +function parseErrorResponse(response, body) { + var _contentType, _contentType2; + let contentType; + try { + contentType = getResponseContentType(response); + } catch (e) { + return e; + } + if (((_contentType = contentType) === null || _contentType === void 0 ? void 0 : _contentType.type) === "application/json" && body) { + return new _errors.MatrixError(JSON.parse(body), response.status, isXhr(response) ? response.responseURL : response.url); + } + if (((_contentType2 = contentType) === null || _contentType2 === void 0 ? void 0 : _contentType2.type) === "text/plain") { + return new _errors.HTTPError(`Server returned ${response.status} error: ${body}`, response.status); + } + return new _errors.HTTPError(`Server returned ${response.status} error`, response.status); +} +function isXhr(response) { + return "getResponseHeader" in response; +} + +/** + * extract the Content-Type header from the response object, and + * parse it to a `{type, parameters}` object. + * + * returns null if no content-type header could be found. + * + * @param response - response object + * @returns parsed content-type header, or null if not found + */ +function getResponseContentType(response) { + let contentType; + if (isXhr(response)) { + contentType = response.getResponseHeader("Content-Type"); + } else { + contentType = response.headers.get("Content-Type"); + } + if (!contentType) return null; + try { + return (0, _contentType3.parse)(contentType); + } catch (e) { + throw new Error(`Error parsing Content-Type '${contentType}': ${e}`); + } +} + +/** + * Retries a network operation run in a callback. + * @param maxAttempts - maximum attempts to try + * @param callback - callback that returns a promise of the network operation. If rejected with ConnectionError, it will be retried by calling the callback again. + * @returns the result of the network operation + * @throws {@link ConnectionError} If after maxAttempts the callback still throws ConnectionError + */ +async function retryNetworkOperation(maxAttempts, callback) { + let attempts = 0; + let lastConnectionError = null; + while (attempts < maxAttempts) { + try { + if (attempts > 0) { + const timeout = 1000 * Math.pow(2, attempts); + _logger.logger.log(`network operation failed ${attempts} times, retrying in ${timeout}ms...`); + await (0, _utils.sleep)(timeout); + } + return await callback(); + } catch (err) { + if (err instanceof _errors.ConnectionError) { + attempts += 1; + lastConnectionError = err; + } else { + throw err; + } + } + } + throw lastConnectionError; +} +//# sourceMappingURL=utils.js.map \ No newline at end of file diff --git a/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/utils.js.map b/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/utils.js.map new file mode 100644 index 0000000..41425cc --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-js-sdk/lib/http-api/utils.js.map @@ -0,0 +1 @@ +{"version":3,"file":"utils.js","names":["_contentType3","require","_logger","_utils","_errors","timeoutSignal","ms","controller","AbortController","setTimeout","abort","signal","anySignal","signals","cleanup","removeEventListener","onAbort","aborted","addEventListener","parseErrorResponse","response","body","_contentType","_contentType2","contentType","getResponseContentType","e","type","MatrixError","JSON","parse","status","isXhr","responseURL","url","HTTPError","getResponseHeader","headers","get","parseContentType","Error","retryNetworkOperation","maxAttempts","callback","attempts","lastConnectionError","timeout","Math","pow","logger","log","sleep","err","ConnectionError"],"sources":["../../src/http-api/utils.ts"],"sourcesContent":["/*\nCopyright 2022 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { parse as parseContentType, ParsedMediaType } from \"content-type\";\n\nimport { logger } from \"../logger\";\nimport { sleep } from \"../utils\";\nimport { ConnectionError, HTTPError, MatrixError } from \"./errors\";\n\n// Ponyfill for https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/timeout\nexport function timeoutSignal(ms: number): AbortSignal {\n const controller = new AbortController();\n setTimeout(() => {\n controller.abort();\n }, ms);\n\n return controller.signal;\n}\n\nexport function anySignal(signals: AbortSignal[]): {\n signal: AbortSignal;\n cleanup(): void;\n} {\n const controller = new AbortController();\n\n function cleanup(): void {\n for (const signal of signals) {\n signal.removeEventListener(\"abort\", onAbort);\n }\n }\n\n function onAbort(): void {\n controller.abort();\n cleanup();\n }\n\n for (const signal of signals) {\n if (signal.aborted) {\n onAbort();\n break;\n }\n signal.addEventListener(\"abort\", onAbort);\n }\n\n return {\n signal: controller.signal,\n cleanup,\n };\n}\n\n/**\n * Attempt to turn an HTTP error response into a Javascript Error.\n *\n * If it is a JSON response, we will parse it into a MatrixError. Otherwise\n * we return a generic Error.\n *\n * @param response - response object\n * @param body - raw body of the response\n * @returns\n */\nexport function parseErrorResponse(response: XMLHttpRequest | Response, body?: string): Error {\n let contentType: ParsedMediaType | null;\n try {\n contentType = getResponseContentType(response);\n } catch (e) {\n return e;\n }\n\n if (contentType?.type === \"application/json\" && body) {\n return new MatrixError(\n JSON.parse(body),\n response.status,\n isXhr(response) ? response.responseURL : response.url,\n );\n }\n if (contentType?.type === \"text/plain\") {\n return new HTTPError(`Server returned ${response.status} error: ${body}`, response.status);\n }\n return new HTTPError(`Server returned ${response.status} error`, response.status);\n}\n\nfunction isXhr(response: XMLHttpRequest | Response): response is XMLHttpRequest {\n return \"getResponseHeader\" in response;\n}\n\n/**\n * extract the Content-Type header from the response object, and\n * parse it to a `{type, parameters}` object.\n *\n * returns null if no content-type header could be found.\n *\n * @param response - response object\n * @returns parsed content-type header, or null if not found\n */\nfunction getResponseContentType(response: XMLHttpRequest | Response): ParsedMediaType | null {\n let contentType: string | null;\n if (isXhr(response)) {\n contentType = response.getResponseHeader(\"Content-Type\");\n } else {\n contentType = response.headers.get(\"Content-Type\");\n }\n\n if (!contentType) return null;\n\n try {\n return parseContentType(contentType);\n } catch (e) {\n throw new Error(`Error parsing Content-Type '${contentType}': ${e}`);\n }\n}\n\n/**\n * Retries a network operation run in a callback.\n * @param maxAttempts - maximum attempts to try\n * @param callback - callback that returns a promise of the network operation. If rejected with ConnectionError, it will be retried by calling the callback again.\n * @returns the result of the network operation\n * @throws {@link ConnectionError} If after maxAttempts the callback still throws ConnectionError\n */\nexport async function retryNetworkOperation(maxAttempts: number, callback: () => Promise): Promise {\n let attempts = 0;\n let lastConnectionError: ConnectionError | null = null;\n while (attempts < maxAttempts) {\n try {\n if (attempts > 0) {\n const timeout = 1000 * Math.pow(2, attempts);\n logger.log(`network operation failed ${attempts} times, retrying in ${timeout}ms...`);\n await sleep(timeout);\n }\n return await callback();\n } catch (err) {\n if (err instanceof ConnectionError) {\n attempts += 1;\n lastConnectionError = err;\n } else {\n throw err;\n }\n }\n }\n throw lastConnectionError;\n}\n"],"mappings":";;;;;;;;;AAgBA,IAAAA,aAAA,GAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AApBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA;AACO,SAASI,aAAaA,CAACC,EAAU,EAAe;EACnD,MAAMC,UAAU,GAAG,IAAIC,eAAe,EAAE;EACxCC,UAAU,CAAC,MAAM;IACbF,UAAU,CAACG,KAAK,EAAE;EACtB,CAAC,EAAEJ,EAAE,CAAC;EAEN,OAAOC,UAAU,CAACI,MAAM;AAC5B;AAEO,SAASC,SAASA,CAACC,OAAsB,EAG9C;EACE,MAAMN,UAAU,GAAG,IAAIC,eAAe,EAAE;EAExC,SAASM,OAAOA,CAAA,EAAS;IACrB,KAAK,MAAMH,MAAM,IAAIE,OAAO,EAAE;MAC1BF,MAAM,CAACI,mBAAmB,CAAC,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