From 69acadd3fb8c1394f647dd9834c12e6a6bc0dbb0 Mon Sep 17 00:00:00 2001 From: Andrew Ferrazzutti Date: Fri, 1 Nov 2024 01:22:04 -0400 Subject: [PATCH 1/5] Let widget driver send error details --- src/stores/widgets/StopGapWidgetDriver.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/stores/widgets/StopGapWidgetDriver.ts b/src/stores/widgets/StopGapWidgetDriver.ts index 09553b40ce8..5b4e1705fd8 100644 --- a/src/stores/widgets/StopGapWidgetDriver.ts +++ b/src/stores/widgets/StopGapWidgetDriver.ts @@ -9,6 +9,7 @@ import { Capability, EventDirection, + IMatrixApiError as IWidgetMatrixError, IOpenIDCredentials, IOpenIDUpdate, ISendDelayedEventDetails, @@ -33,6 +34,7 @@ import { ITurnServer as IClientTurnServer, EventType, IContent, + MatrixError, MatrixEvent, Room, Direction, @@ -689,4 +691,15 @@ export class StopGapWidgetDriver extends WidgetDriver { const blob = await response.blob(); return { file: blob }; } + + /** + * Expresses a {@link MatrixError} as a {@link IWidgetMatrixError} + * for use by Widget API error responses. + * @param error The error to handle. + * @returns The error expressed as a {@link IWidgetMatrixError}, + * or undefined if it is not a {@link MatrixError}. + */ + public processError(error: unknown): IWidgetMatrixError | undefined { + return error instanceof MatrixError ? error.asWidgetApiErrorData() : undefined; + } } From 94ffc7b0a8e03640131b3c1acd76f6e7dc008992 Mon Sep 17 00:00:00 2001 From: Andrew Ferrazzutti Date: Wed, 6 Nov 2024 09:43:07 -0500 Subject: [PATCH 2/5] Match new widget API types --- src/stores/widgets/StopGapWidgetDriver.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/stores/widgets/StopGapWidgetDriver.ts b/src/stores/widgets/StopGapWidgetDriver.ts index 5b4e1705fd8..85f643ff979 100644 --- a/src/stores/widgets/StopGapWidgetDriver.ts +++ b/src/stores/widgets/StopGapWidgetDriver.ts @@ -9,7 +9,6 @@ import { Capability, EventDirection, - IMatrixApiError as IWidgetMatrixError, IOpenIDCredentials, IOpenIDUpdate, ISendDelayedEventDetails, @@ -25,6 +24,7 @@ import { WidgetDriver, WidgetEventCapability, WidgetKind, + IWidgetApiErrorResponseDataDetails, ISearchUserDirectoryResult, IGetMediaConfigResult, UpdateDelayedEventAction, @@ -693,13 +693,13 @@ export class StopGapWidgetDriver extends WidgetDriver { } /** - * Expresses a {@link MatrixError} as a {@link IWidgetMatrixError} + * Expresses a {@link MatrixError} as a {@link IWidgetApiErrorResponseDataDetails} * for use by Widget API error responses. * @param error The error to handle. - * @returns The error expressed as a {@link IWidgetMatrixError}, + * @returns The error expressed as a {@link IWidgetApiErrorResponseDataDetails}, * or undefined if it is not a {@link MatrixError}. */ - public processError(error: unknown): IWidgetMatrixError | undefined { - return error instanceof MatrixError ? error.asWidgetApiErrorData() : undefined; + public processError(error: unknown): IWidgetApiErrorResponseDataDetails | undefined { + return error instanceof MatrixError ? { matrix_api_error: error.asWidgetApiErrorData() } : undefined; } } From 2abb3cd65767d6496c9d390ea8c9297edc4048c5 Mon Sep 17 00:00:00 2001 From: Andrew Ferrazzutti Date: Mon, 11 Nov 2024 00:02:58 -0500 Subject: [PATCH 3/5] Don't @link across packages in case web documentation generation disallows it. --- src/stores/widgets/StopGapWidgetDriver.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/stores/widgets/StopGapWidgetDriver.ts b/src/stores/widgets/StopGapWidgetDriver.ts index 85f643ff979..5bc2ac7fc01 100644 --- a/src/stores/widgets/StopGapWidgetDriver.ts +++ b/src/stores/widgets/StopGapWidgetDriver.ts @@ -693,10 +693,10 @@ export class StopGapWidgetDriver extends WidgetDriver { } /** - * Expresses a {@link MatrixError} as a {@link IWidgetApiErrorResponseDataDetails} + * Expresses a {@link MatrixError} as a JSON payload * for use by Widget API error responses. * @param error The error to handle. - * @returns The error expressed as a {@link IWidgetApiErrorResponseDataDetails}, + * @returns The error expressed as a JSON payload, * or undefined if it is not a {@link MatrixError}. */ public processError(error: unknown): IWidgetApiErrorResponseDataDetails | undefined { From 416f1567abc4feecc208d47ad3e23749e2e2392c Mon Sep 17 00:00:00 2001 From: Andrew Ferrazzutti Date: Mon, 11 Nov 2024 00:01:46 -0500 Subject: [PATCH 4/5] Update matrix-widget-api --- package.json | 2 +- yarn.lock | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index cbb8a33480c..e40dea659e1 100644 --- a/package.json +++ b/package.json @@ -127,7 +127,7 @@ "matrix-encrypt-attachment": "^1.0.3", "matrix-events-sdk": "0.0.1", "matrix-js-sdk": "github:matrix-org/matrix-js-sdk#develop", - "matrix-widget-api": "^1.9.0", + "matrix-widget-api": "^1.10.0", "memoize-one": "^6.0.0", "oidc-client-ts": "^3.0.1", "opus-recorder": "^8.0.3", diff --git a/yarn.lock b/yarn.lock index 343a0f3ef48..9d9b86dd74e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8309,7 +8309,7 @@ matrix-events-sdk@0.0.1: "matrix-js-sdk@github:matrix-org/matrix-js-sdk#develop": version "34.10.0" - resolved "https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/5a1488ebd5552817b1e95265afe7b3baac1231a2" + resolved "https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/10a4fd8328bbe5380629ba90a64139ec60acf5fd" dependencies: "@babel/runtime" "^7.12.5" "@matrix-org/matrix-sdk-crypto-wasm" "^9.0.0" @@ -8320,7 +8320,7 @@ matrix-events-sdk@0.0.1: jwt-decode "^4.0.0" loglevel "^1.7.1" matrix-events-sdk "0.0.1" - matrix-widget-api "^1.8.2" + matrix-widget-api "^1.10.0" oidc-client-ts "^3.0.1" p-retry "4" sdp-transform "^2.14.1" @@ -8345,10 +8345,10 @@ matrix-web-i18n@^3.2.1: minimist "^1.2.8" walk "^2.3.15" -matrix-widget-api@^1.8.2, matrix-widget-api@^1.9.0: - version "1.9.0" - resolved "https://registry.yarnpkg.com/matrix-widget-api/-/matrix-widget-api-1.9.0.tgz#884136b405bd3c56e4ea285095c9e01ec52b6b1f" - integrity sha512-au8mqralNDqrEvaVAkU37bXOb8I9SCe+ACdPk11QWw58FKstVq31q2wRz+qWA6J+42KJ6s1DggWbG/S3fEs3jw== +matrix-widget-api@^1.10.0: + version "1.10.0" + resolved "https://registry.yarnpkg.com/matrix-widget-api/-/matrix-widget-api-1.10.0.tgz#d31ea073a5871a1fb1a511ef900b0c125a37bf55" + integrity sha512-rkAJ29briYV7TJnfBVLVSKtpeBrBju15JZFSDP6wj8YdbCu1bdmlplJayQ+vYaw1x4fzI49Q+Nz3E85s46sRDw== dependencies: "@types/events" "^3.0.0" events "^3.2.0" From 90c3a850e8bd495bfc556f9b356bf969bb297a84 Mon Sep 17 00:00:00 2001 From: Andrew Ferrazzutti Date: Mon, 11 Nov 2024 10:29:30 -0500 Subject: [PATCH 5/5] Update matrix-js-sdk Include matrix-org/matrix-js-sdk#4507 to fix playwright CI --- yarn.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yarn.lock b/yarn.lock index 9d9b86dd74e..c5ef6a55e77 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8309,7 +8309,7 @@ matrix-events-sdk@0.0.1: "matrix-js-sdk@github:matrix-org/matrix-js-sdk#develop": version "34.10.0" - resolved "https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/10a4fd8328bbe5380629ba90a64139ec60acf5fd" + resolved "https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/6855ace6422082d173438cb23368d2fabc6a1086" dependencies: "@babel/runtime" "^7.12.5" "@matrix-org/matrix-sdk-crypto-wasm" "^9.0.0"