@unwanted/matrix-sdk-mini 34.12.0-4 → 34.12.0-6

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unwanted/matrix-sdk-mini",
3
- "version": "34.12.0-4",
3
+ "version": "34.12.0-6",
4
4
  "description": "Matrix Client-Server mini SDK for Javascript",
5
5
  "engines": {
6
6
  "node": ">=20.0.0"
@@ -128,5 +128,6 @@
128
128
  "outputDirectory": "coverage",
129
129
  "outputName": "jest-sonar-report.xml",
130
130
  "relativePaths": true
131
- }
131
+ },
132
+ "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
132
133
  }
@@ -17,7 +17,7 @@ limitations under the License.
17
17
 
18
18
  import { IClientWellKnown, IWellKnownConfig, IServerVersions } from "./client.ts";
19
19
  import { logger } from "./logger.ts";
20
- import { MatrixError, Method, timeoutSignal } from "./http-api/index.ts";
20
+ import { MatrixError, Method, timeoutSignal, VersionsPrefix } from "./http-api/index.ts";
21
21
  import { SUPPORTED_MATRIX_VERSIONS } from "./version-support.ts";
22
22
 
23
23
  // Dev note: Auto discovery is part of the spec.
@@ -179,7 +179,7 @@ export class AutoDiscovery {
179
179
  }
180
180
 
181
181
  // Step 3: Make sure the homeserver URL points to a homeserver.
182
- const hsVersions = await this.fetchWellKnownObject<IServerVersions>(`${hsUrl}/_matrix/client/versions`);
182
+ const hsVersions = await this.fetchWellKnownObject<IServerVersions>(`${hsUrl}${VersionsPrefix}`);
183
183
  if (!hsVersions || !Array.isArray(hsVersions.raw?.["versions"])) {
184
184
  logger.error("Invalid /versions response");
185
185
  clientConfig["m.homeserver"].error = AutoDiscovery.ERROR_INVALID_HOMESERVER;
package/src/client.ts CHANGED
@@ -60,6 +60,7 @@ import {
60
60
  Upload,
61
61
  UploadOpts,
62
62
  UploadResponse,
63
+ VersionsPrefix,
63
64
  } from "./http-api/index.ts";
64
65
  import { User, UserEvent, UserEventHandlerMap } from "./models/user.ts";
65
66
  import { getHttpUriForMxc } from "./content-repo.ts";
@@ -452,14 +453,6 @@ export const UNSTABLE_MSC4133_EXTENDED_PROFILES = "uk.tcpip.msc4133";
452
453
 
453
454
  export type SendToDeviceContentMap = Map<string, Map<string, Record<string, any>>>;
454
455
 
455
- export interface ISignedKey {
456
- keys: Record<string, string>;
457
- signatures: ISignatures;
458
- user_id: string;
459
- algorithms: string[];
460
- device_id: string;
461
- }
462
-
463
456
  export interface IUploadKeySignaturesResponse {
464
457
  failures: Record<
465
458
  string,
@@ -5027,7 +5020,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
5027
5020
 
5028
5021
  // We send an authenticated request as of MSC4026
5029
5022
  this.serverVersionsPromise = this.http
5030
- .authedRequest<IServerVersions>(Method.Get, "/_matrix/client/versions", undefined, undefined, {
5023
+ .authedRequest<IServerVersions>(Method.Get, VersionsPrefix, undefined, undefined, {
5031
5024
  prefix: "",
5032
5025
  })
5033
5026
  .catch((e) => {
@@ -18,31 +18,33 @@ export enum ClientPrefix {
18
18
  /**
19
19
  * A constant representing the URI path for Client-Server API endpoints versioned at v1.
20
20
  */
21
- V1 = "/_matrix/client/v1",
21
+ V1 = "/im/_matrix/client/v1",
22
22
  /**
23
23
  * A constant representing the URI path for Client-Server API endpoints versioned at v3.
24
24
  */
25
- V3 = "/_matrix/client/v3",
25
+ V3 = "/im/_matrix/client/v3",
26
26
  /**
27
27
  * A constant representing the URI path for as-yet unspecified Client-Server HTTP APIs.
28
28
  */
29
- Unstable = "/_matrix/client/unstable",
29
+ Unstable = "/im/_matrix/client/unstable",
30
30
  }
31
31
 
32
32
  export enum IdentityPrefix {
33
33
  /**
34
34
  * URI path for the v2 identity API
35
35
  */
36
- V2 = "/_matrix/identity/v2",
36
+ V2 = "/im/_matrix/identity/v2",
37
37
  }
38
38
 
39
39
  export enum MediaPrefix {
40
40
  /**
41
41
  * A constant representing the URI path for Client-Server API Media endpoints versioned at v1.
42
42
  */
43
- V1 = "/_matrix/media/v1",
43
+ V1 = "/im/_matrix/media/v1",
44
44
  /**
45
45
  * A constant representing the URI path for Client-Server API Media endpoints versioned at v3.
46
46
  */
47
- V3 = "/_matrix/media/v3",
47
+ V3 = "/im/_matrix/media/v3",
48
48
  }
49
+
50
+ export const VersionsPrefix = "/im/_matrix/client/versions";
package/src/sync.ts CHANGED
@@ -48,7 +48,7 @@ import {
48
48
  IToDeviceEvent,
49
49
  } from "./sync-accumulator.ts";
50
50
  import { MatrixEvent } from "./models/event.ts";
51
- import { MatrixError, Method } from "./http-api/index.ts";
51
+ import { MatrixError, Method, VersionsPrefix } from "./http-api/index.ts";
52
52
  import { ISavedSync } from "./store/index.ts";
53
53
  import { EventType } from "./@types/event.ts";
54
54
  import { IPushRules } from "./@types/PushRules.ts";
@@ -1508,7 +1508,7 @@ export class SyncApi {
1508
1508
  this.client.http
1509
1509
  .request(
1510
1510
  Method.Get,
1511
- "/_matrix/client/versions",
1511
+ VersionsPrefix,
1512
1512
  undefined, // queryParams
1513
1513
  undefined, // data
1514
1514
  {