Skip to content

Commit d9bd7be

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into matthew/sfu
Signed-off-by: Šimon Brandner <[email protected]>
2 parents cf28825 + ae849fd commit d9bd7be

File tree

156 files changed

+5986
-6275
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

156 files changed

+5986
-6275
lines changed

.eslintrc.js

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ module.exports = {
22
plugins: [
33
"matrix-org",
44
"import",
5+
"jsdoc",
56
],
67
extends: [
78
"plugin:matrix-org/babel",
@@ -45,7 +46,7 @@ module.exports = {
4546
// restrict EventEmitters to force callers to use TypedEventEmitter
4647
"no-restricted-imports": ["error", {
4748
name: "events",
48-
message: "Please use TypedEventEmitter instead"
49+
message: "Please use TypedEventEmitter instead",
4950
}],
5051

5152
"import/no-restricted-paths": ["error", {
@@ -61,6 +62,9 @@ module.exports = {
6162
files: [
6263
"**/*.ts",
6364
],
65+
plugins: [
66+
"eslint-plugin-tsdoc",
67+
],
6468
extends: [
6569
"plugin:matrix-org/typescript",
6670
],
@@ -84,6 +88,23 @@ module.exports = {
8488
"quotes": "off",
8589
// We use a `logger` intermediary module
8690
"no-console": "error",
91+
92+
},
93+
}, {
94+
// We don't need amazing docs in our spec files
95+
files: [
96+
"src/**/*.ts",
97+
],
98+
rules: {
99+
"tsdoc/syntax": "error",
100+
// We use some select jsdoc rules as the tsdoc linter has only one rule
101+
"jsdoc/no-types": "error",
102+
"jsdoc/empty-tags": "error",
103+
"jsdoc/check-property-names": "error",
104+
"jsdoc/check-values": "error",
105+
// These need a bit more work before we can enable
106+
// "jsdoc/check-param-names": "error",
107+
// "jsdoc/check-indentation": "error",
87108
},
88109
}, {
89110
files: [

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
tag="${{ github.ref_name }}"
3737
VERSION="${tag#v}"
3838
[ ! -e "$VERSION" ] || rm -r $VERSION
39-
cp -r $RUNNER_TEMP/docs/ $VERSION
39+
cp -r $RUNNER_TEMP/_docs/ $VERSION
4040
4141
# Add the new directory to the index if it isn't there already
4242
if ! grep -q ">Version $VERSION</a>" index.html; then

.github/workflows/static_analysis.yml

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -64,46 +64,11 @@ jobs:
6464

6565
- name: Generate Docs
6666
run: "yarn run gendoc"
67-
67+
6868
- name: Upload Artifact
6969
uses: actions/upload-artifact@v3
7070
with:
7171
name: docs
7272
path: _docs
7373
# We'll only use this in a workflow_run, then we're done with it
7474
retention-days: 1
75-
76-
tsc-strict:
77-
name: Typescript Strict Error Checker
78-
if: github.event_name == 'pull_request'
79-
runs-on: ubuntu-latest
80-
permissions:
81-
pull-requests: read
82-
checks: write
83-
steps:
84-
- uses: actions/checkout@v3
85-
86-
- name: Get diff lines
87-
id: diff
88-
uses: Equip-Collaboration/[email protected]
89-
with:
90-
include: '["\\.tsx?$"]'
91-
92-
- name: Detecting files changed
93-
id: files
94-
uses: futuratrepadeira/[email protected]
95-
with:
96-
repo-token: ${{ secrets.GITHUB_TOKEN }}
97-
pattern: '^.*\.tsx?$'
98-
99-
- uses: t3chguy/typescript-check-action@main
100-
with:
101-
repo-token: ${{ secrets.GITHUB_TOKEN }}
102-
use-check: false
103-
check-fail-mode: added
104-
output-behaviour: annotate
105-
ts-extra-args: '--noImplicitAny'
106-
files-changed: ${{ steps.files.outputs.files_updated }}
107-
files-added: ${{ steps.files.outputs.files_created }}
108-
files-deleted: ${{ steps.files.outputs.files_deleted }}
109-
line-numbers: ${{ steps.diff.outputs.lineNumbers }}

CHANGELOG.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,28 @@
1+
Changes in [22.0.0](https://github.com/matrix-org/matrix-js-sdk/releases/tag/v22.0.0) (2022-12-06)
2+
==================================================================================================
3+
4+
## 🚨 BREAKING CHANGES
5+
* Enable users to join group calls from multiple devices ([\#2902](https://github.com/matrix-org/matrix-js-sdk/pull/2902)).
6+
7+
## 🦖 Deprecations
8+
* Deprecate a function containing a typo ([\#2904](https://github.com/matrix-org/matrix-js-sdk/pull/2904)).
9+
10+
## ✨ Features
11+
* sliding sync: add receipts extension ([\#2912](https://github.com/matrix-org/matrix-js-sdk/pull/2912)).
12+
* Define a spec support policy for the js-sdk ([\#2882](https://github.com/matrix-org/matrix-js-sdk/pull/2882)).
13+
* Further improvements to e2ee logging ([\#2900](https://github.com/matrix-org/matrix-js-sdk/pull/2900)).
14+
* sliding sync: add support for typing extension ([\#2893](https://github.com/matrix-org/matrix-js-sdk/pull/2893)).
15+
* Improve logging on Olm session errors ([\#2885](https://github.com/matrix-org/matrix-js-sdk/pull/2885)).
16+
* Improve logging of e2ee messages ([\#2884](https://github.com/matrix-org/matrix-js-sdk/pull/2884)).
17+
18+
## 🐛 Bug Fixes
19+
* Fix 3pid invite acceptance not working due to mxid being sent in body ([\#2907](https://github.com/matrix-org/matrix-js-sdk/pull/2907)). Fixes vector-im/element-web#23823.
20+
* Don't hang up calls that haven't started yet ([\#2898](https://github.com/matrix-org/matrix-js-sdk/pull/2898)).
21+
* Read receipt accumulation for threads ([\#2881](https://github.com/matrix-org/matrix-js-sdk/pull/2881)).
22+
* Make GroupCall work better with widgets ([\#2935](https://github.com/matrix-org/matrix-js-sdk/pull/2935)).
23+
* Fix highlight notifications increasing when total notification is zero ([\#2937](https://github.com/matrix-org/matrix-js-sdk/pull/2937)). Fixes vector-im/element-web#23885.
24+
* Fix synthesizeReceipt ([\#2916](https://github.com/matrix-org/matrix-js-sdk/pull/2916)). Fixes vector-im/element-web#23827 vector-im/element-web#23754 and vector-im/element-web#23847.
25+
126
Changes in [21.2.0](https://github.com/matrix-org/matrix-js-sdk/releases/tag/v21.2.0) (2022-11-22)
227
==================================================================================================
328

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
[![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=matrix-js-sdk&metric=vulnerabilities)](https://sonarcloud.io/summary/new_code?id=matrix-js-sdk)
77
[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=matrix-js-sdk&metric=bugs)](https://sonarcloud.io/summary/new_code?id=matrix-js-sdk)
88

9-
Matrix Javascript SDK
9+
Matrix JavaScript SDK
1010
=====================
1111

1212
This is the [Matrix](https://matrix.org) Client-Server SDK for JavaScript and TypeScript. This SDK can be run in a
@@ -370,11 +370,14 @@ To build a browser version from scratch when developing::
370370
$ yarn build
371371
```
372372

373-
To run tests (Jasmine)::
373+
To run tests (Jest):
374374
```
375375
$ yarn test
376376
```
377377

378+
> **Note**
379+
> The `sync-browserify.spec.ts` requires a browser build (`yarn build`) in order to pass
380+
378381
To run linting:
379382
```
380383
$ yarn lint

examples/browser/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
To try it out, **you must build the SDK first** and then host this folder:
22

33
```
4-
$ npm run build
4+
$ yarn build
55
$ cd examples/browser
6-
$ python -m SimpleHTTPServer 8003
6+
$ python -m http.server 8003
77
```
88

99
Then visit ``http://localhost:8003``.

examples/browser/browserTest.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
console.log("Loading browser sdk");
22

3-
var client = matrixcs.createClient("https://matrix.org");
4-
client.publicRooms(function (err, data) {
5-
if (err) {
6-
console.error("err %s", JSON.stringify(err));
7-
return;
8-
}
3+
var client = matrixcs.createClient({baseUrl: "https://matrix.org"});
4+
client.publicRooms().then(function (data) {
95
console.log("data %s [...]", JSON.stringify(data).substring(0, 100));
106
console.log("Congratulations! The SDK is working on the browser!");
117
var result = document.getElementById("result");

package.json

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "matrix-js-sdk",
3-
"version": "21.2.0",
3+
"version": "22.0.0",
44
"description": "Matrix Client-Server SDK for Javascript",
55
"engines": {
66
"node": ">=16.0.0"
@@ -14,7 +14,7 @@
1414
"build:dev": "yarn clean && git rev-parse HEAD > git-revision.txt && yarn build:compile && yarn build:types",
1515
"build:types": "tsc -p tsconfig-build.json --emitDeclarationOnly",
1616
"build:compile": "babel -d lib --verbose --extensions \".ts,.js\" src",
17-
"build:compile-browser": "mkdirp dist && browserify -d src/browser-index.js -p [ tsify -p ./tsconfig-build.json ] -t [ babelify --sourceMaps=inline --presets [ @babel/preset-env @babel/preset-typescript ] ] | exorcist dist/browser-matrix.js.map > dist/browser-matrix.js",
17+
"build:compile-browser": "mkdirp dist && browserify -d src/browser-index.ts -p [ tsify -p ./tsconfig-build.json ] -t [ babelify --sourceMaps=inline --presets [ @babel/preset-env @babel/preset-typescript ] ] | exorcist dist/browser-matrix.js.map > dist/browser-matrix.js",
1818
"build:minify-browser": "terser dist/browser-matrix.js --compress --mangle --source-map --output dist/browser-matrix.min.js",
1919
"gendoc": "typedoc",
2020
"lint": "yarn lint:types && yarn lint:js",
@@ -33,9 +33,9 @@
3333
"matrix-org"
3434
],
3535
"main": "./src/index.ts",
36-
"browser": "./lib/browser-index.js",
36+
"browser": "./lib/browser-index.ts",
3737
"matrix_src_main": "./src/index.ts",
38-
"matrix_src_browser": "./src/browser-index.js",
38+
"matrix_src_browser": "./src/browser-index.ts",
3939
"matrix_lib_main": "./lib/index.js",
4040
"matrix_lib_typings": "./lib/index.d.ts",
4141
"author": "matrix.org",
@@ -63,7 +63,8 @@
6363
"p-retry": "4",
6464
"qs": "^6.9.6",
6565
"sdp-transform": "^2.14.1",
66-
"unhomoglyph": "^1.0.6"
66+
"unhomoglyph": "^1.0.6",
67+
"uuid": "7"
6768
},
6869
"devDependencies": {
6970
"@babel/cli": "^7.12.10",
@@ -79,15 +80,16 @@
7980
"@babel/preset-typescript": "^7.12.7",
8081
"@babel/register": "^7.12.10",
8182
"@casualbot/jest-sonar-reporter": "^2.2.5",
82-
"@matrix-org/olm": "https://gitlab.matrix.org/api/v4/projects/27/packages/npm/@matrix-org/olm/-/@matrix-org/olm-3.2.13.tgz",
83+
"@matrix-org/olm": "https://gitlab.matrix.org/api/v4/projects/27/packages/npm/@matrix-org/olm/-/@matrix-org/olm-3.2.14.tgz",
8384
"@types/bs58": "^4.0.1",
8485
"@types/content-type": "^1.1.5",
8586
"@types/domexception": "^4.0.0",
8687
"@types/jest": "^29.0.0",
8788
"@types/node": "18",
8889
"@types/sdp-transform": "^2.4.5",
89-
"@typescript-eslint/eslint-plugin": "^5.6.0",
90-
"@typescript-eslint/parser": "^5.6.0",
90+
"@types/uuid": "7",
91+
"@typescript-eslint/eslint-plugin": "^5.45.0",
92+
"@typescript-eslint/parser": "^5.45.0",
9193
"allchange": "^1.0.6",
9294
"babel-jest": "^29.0.0",
9395
"babelify": "^10.0.0",
@@ -99,7 +101,9 @@
99101
"eslint-config-google": "^0.14.0",
100102
"eslint-import-resolver-typescript": "^3.5.1",
101103
"eslint-plugin-import": "^2.26.0",
104+
"eslint-plugin-jsdoc": "^39.6.4",
102105
"eslint-plugin-matrix-org": "^0.8.0",
106+
"eslint-plugin-tsdoc": "^0.2.17",
103107
"eslint-plugin-unicorn": "^45.0.0",
104108
"exorcist": "^2.0.0",
105109
"fake-indexeddb": "^4.0.0",

spec/TestClient.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export class TestClient {
105105

106106
/**
107107
* stop the client
108-
* @return {Promise} Resolves once the mock http backend has finished all pending flushes
108+
* @returns Promise which resolves once the mock http backend has finished all pending flushes
109109
*/
110110
public async stop(): Promise<void> {
111111
this.client.stopClient();
@@ -135,7 +135,7 @@ export class TestClient {
135135
* set up an expectation that the keys will be uploaded, and wait for
136136
* that to happen.
137137
*
138-
* @returns {Promise} for the one-time keys
138+
* @returns Promise for the one-time keys
139139
*/
140140
public awaitOneTimeKeyUpload(): Promise<Record<string, IOneTimeKey>> {
141141
if (Object.keys(this.oneTimeKeys!).length != 0) {
@@ -177,13 +177,13 @@ export class TestClient {
177177
*
178178
* We check that the query contains each of the users in `response`.
179179
*
180-
* @param {Object} response response to the query.
180+
* @param response - response to the query.
181181
*/
182182
public expectKeyQuery(response: IDownloadKeyResult) {
183183
this.httpBackend.when('POST', '/keys/query').respond<IDownloadKeyResult>(
184184
200, (_path, content) => {
185185
Object.keys(response.device_keys).forEach((userId) => {
186-
expect(content.device_keys![userId]).toEqual([]);
186+
expect((content.device_keys! as Record<string, any>)[userId]).toEqual([]);
187187
});
188188
return response;
189189
});
@@ -202,7 +202,7 @@ export class TestClient {
202202
/**
203203
* get the uploaded curve25519 device key
204204
*
205-
* @return {string} base64 device key
205+
* @returns base64 device key
206206
*/
207207
public getDeviceKey(): string {
208208
const keyId = 'curve25519:' + this.deviceId;
@@ -212,7 +212,7 @@ export class TestClient {
212212
/**
213213
* get the uploaded ed25519 device key
214214
*
215-
* @return {string} base64 device key
215+
* @returns base64 device key
216216
*/
217217
public getSigningKey(): string {
218218
const keyId = 'ed25519:' + this.deviceId;

spec/browserify/setupTests.ts

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,7 @@ limitations under the License.
1515
*/
1616

1717
import "../../dist/browser-matrix"; // uses browser-matrix instead of the src
18-
import type { MatrixClient, ClientEvent } from "../../src";
19-
20-
declare global {
21-
// eslint-disable-next-line @typescript-eslint/no-namespace
22-
namespace NodeJS {
23-
interface Global {
24-
matrixcs: {
25-
MatrixClient: typeof MatrixClient;
26-
ClientEvent: typeof ClientEvent;
27-
};
28-
}
29-
}
30-
}
18+
import type { default as BrowserMatrix } from "../../src/browser-index";
3119

3220
// stub for browser-matrix browserify tests
3321
// @ts-ignore
@@ -43,4 +31,4 @@ afterAll(() => {
4331
global.matrixcs = {
4432
...global.matrixcs,
4533
timeoutSignal: () => new AbortController().signal,
46-
};
34+
} as typeof BrowserMatrix;

0 commit comments

Comments
 (0)